123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- 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<String, Object> 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<String,Object> map1 = new HashMap<>();
- map1.put("easSupplierId",EASSupplierId);
- BigDecimal deleted = new BigDecimal(0);
- map1.put("deleted",deleted);
- List<RmsSupplier> 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<Map<String, Object>> getSupplierList(Map<String, Object> mapVal) {
- return rmsSupplierMapper.getSupplierList(mapVal);
- }
- }
|