package com.steerinfo.dil.service.impl; import com.steerinfo.dil.mapper.RmsSupplierMapper; import com.steerinfo.dil.model.RmsSupplier; import com.steerinfo.dil.service.IRmsSupplierService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * RmsSupplier服务实现: * @author generator * @version 1.0-SNAPSHORT 2021-10-22 06:18 * 类描述 * 修订历史: * 日期:2021-10-22 * 作者:generator * 参考: * 描述:RmsSupplier服务实现 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @Service(value = "rmsSupplierService") public class RmsSupplierServiceImpl implements IRmsSupplierService { @Autowired private RmsSupplierMapper rmsSupplierMapper; /** * 操作供应商 * @param mapVal * @return */ @Override public int operationSupplier(Map mapVal) { // 得到金蝶主键供应商id Integer EASSupplierIdValue = (Integer) mapVal.get("EASSupplierId"); BigDecimal EASSupplierId = new BigDecimal(EASSupplierIdValue); // 得到供应商名称 String supplierName = (String) mapVal.get("supplierName"); // 得到供应商供应商简称 String supplierAbbreviation = (String) mapVal.get("supplierAbbreviation"); // 得到供应商代码 String supplierDutyParagraph = (String) mapVal.get("supplierDutyParagraph"); // 得到供应商地址 String supplierAddress = (String) mapVal.get("supplierAddress"); // 得到联系人 String supplierContactsName = (String) mapVal.get("supplierAgent"); // 得到联系电话 String supplierContactNumber = (String) mapVal.get("supplierContactNumber"); // 得到数据数据状态 Integer dataStatus = (Integer) mapVal.get("dataStatus"); // 判断是否EASId已存在 Map map1 = new HashMap<>(); map1.put("easSupplierId",EASSupplierId); BigDecimal deleted = new BigDecimal(0); map1.put("deleted",deleted); List rmsSuppliers = rmsSupplierMapper.selectByParameters(map1); RmsSupplier rmsSupplier = new RmsSupplier(); rmsSupplier.setEasSupplierId(EASSupplierId); rmsSupplier.setSupplierName(supplierName); rmsSupplier.setSupplierAbbreviation(supplierAbbreviation); rmsSupplier.setSupplierDutyParagraph(supplierDutyParagraph); rmsSupplier.setSupplierAddress(supplierAddress); rmsSupplier.setSupplierContactsName(supplierContactsName); rmsSupplier.setSupplierContactNumber(supplierContactNumber); int result = 0; // 新增 if (rmsSuppliers.size() == 0) { BigDecimal supplierId = rmsSupplierMapper.getSupplierId(); rmsSupplier.setSupplierId(supplierId); rmsSupplier.setDeleted(new BigDecimal(0)); result = rmsSupplierMapper.insertSelective(rmsSupplier); } // 修改 if (rmsSuppliers.size() != 0 && dataStatus == 1) { RmsSupplier rmsSupplier1 = rmsSuppliers.get(0); rmsSupplier.setSupplierId(rmsSupplier1.getSupplierId()); result = rmsSupplierMapper.updateByPrimaryKeySelective(rmsSupplier); } // 逻辑删除 if (rmsSuppliers.size() != 0 && dataStatus == 2) { RmsSupplier rmsSupplier1 = rmsSuppliers.get(0); rmsSupplier.setSupplierId(rmsSupplier1.getSupplierId()); rmsSupplier.setDeleted(new BigDecimal(1)); result = rmsSupplierMapper.updateByPrimaryKeySelective(rmsSupplier); } return result; } /** * 查询供应商列表 * @param mapVal * @return */ @Override public List> getSupplierList(Map mapVal) { return rmsSupplierMapper.getSupplierList(mapVal); } }