RmsSupplierServiceImpl.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. package com.steerinfo.dil.service.impl;
  2. import com.steerinfo.dil.mapper.RmsCarrierMapper;
  3. import com.steerinfo.dil.mapper.RmsSupplierMapper;
  4. import com.steerinfo.dil.model.RmsSupplier;
  5. import com.steerinfo.dil.service.IRmsSupplierService;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Service;
  8. import java.math.BigDecimal;
  9. import java.util.Date;
  10. import java.util.HashMap;
  11. import java.util.List;
  12. import java.util.Map;
  13. /**
  14. * RmsSupplier服务实现:
  15. * @author generator
  16. * @version 1.0-SNAPSHORT 2021-10-22 06:18
  17. * 类描述
  18. * 修订历史:
  19. * 日期:2021-10-22
  20. * 作者:generator
  21. * 参考:
  22. * 描述:RmsSupplier服务实现
  23. * @see null
  24. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  25. */
  26. @Service(value = "rmsSupplierService")
  27. public class RmsSupplierServiceImpl implements IRmsSupplierService {
  28. @Autowired
  29. private RmsSupplierMapper rmsSupplierMapper;
  30. @Autowired
  31. RmsCarrierMapper rmsCarrierMapper;
  32. /**
  33. * 操作供应商
  34. * @param mapVal
  35. * @return
  36. */
  37. @Override
  38. public int operationSupplier(Map<String, Object> mapVal) {
  39. // 得到金蝶主键供应商id
  40. String EASSupplierId = (String) mapVal.get("EASSupplierId");
  41. // 得到供应商名称
  42. String supplierName = (String) mapVal.get("supplierName");
  43. // 得到供应商供应商简称
  44. String supplierAbbreviation = (String) mapVal.get("supplierAbbreviation");
  45. // 得到供应商代码
  46. String supplierDutyParagraph = (String) mapVal.get("supplierDutyParagraph");
  47. // 得到供应商地址
  48. String supplierAddress = (String) mapVal.get("supplierAddress");
  49. // 得到联系人
  50. String supplierContactsName = (String) mapVal.get("supplierAgent");
  51. // 得到联系电话
  52. String supplierContactNumber = (String) mapVal.get("supplierContactNumber");
  53. // 得到数据数据状态
  54. Integer dataStatus = (Integer) mapVal.get("dataStatus");
  55. // 得到供应商屏蔽信息
  56. Object supplierScreenInfo = mapVal.get("supplierScreenInfo");
  57. // // 判断是供应商还是承运商
  58. // String dataType = (String) mapVal.get("dataType");
  59. // 判断是否EASId已存在
  60. Map<String,Object> map1 = new HashMap<>();
  61. map1.put("easSupplierId",EASSupplierId);
  62. Map<String,Object> map2 = new HashMap<>();
  63. BigDecimal deleted = new BigDecimal(0);
  64. // map1.put("deleted",deleted);
  65. // map2.put("deleted",deleted);
  66. List<RmsSupplier> rmsSuppliers = rmsSupplierMapper.selectByParameters(map1);
  67. // 供应商
  68. RmsSupplier rmsSupplier = new RmsSupplier();
  69. rmsSupplier.setEasSupplierId(EASSupplierId);
  70. rmsSupplier.setSupplierName(supplierName);
  71. rmsSupplier.setSupplierAbbreviation(supplierAbbreviation);
  72. rmsSupplier.setSupplierDutyParagraph(supplierDutyParagraph);
  73. rmsSupplier.setSupplierAddress(supplierAddress);
  74. if (supplierScreenInfo != null) {
  75. rmsSupplier.setSupplierScreenInfo(supplierScreenInfo.toString());
  76. }
  77. rmsSupplier.setSupplierContactsName(supplierContactsName);
  78. rmsSupplier.setSupplierContactNumber(supplierContactNumber);
  79. rmsSupplier.setInsertTime(new Date());
  80. rmsSupplier.setInsertUsername("admin");
  81. rmsSupplier.setUpdateTime(new Date());
  82. rmsSupplier.setUpdateUsername("admin");
  83. rmsSupplier.setInsertUpdateRemark("无");
  84. int result = 0;
  85. // 新增
  86. if (rmsSuppliers.size() == 0) {
  87. BigDecimal supplierId = rmsSupplierMapper.getSupplierId();
  88. rmsSupplier.setSupplierId(supplierId);
  89. rmsSupplier.setDeleted(new BigDecimal(0));
  90. result += rmsSupplierMapper.insertSelective(rmsSupplier);
  91. }
  92. // 修改
  93. if (rmsSuppliers.size() != 0 && dataStatus == 1) {
  94. RmsSupplier rmsSupplier1 = rmsSuppliers.get(0);
  95. rmsSupplier.setSupplierId(rmsSupplier1.getSupplierId());
  96. rmsSupplier.setDeleted(deleted);
  97. result += rmsSupplierMapper.updateByPrimaryKeySelective(rmsSupplier);
  98. }
  99. // 逻辑删除
  100. if (rmsSuppliers.size() != 0 && dataStatus == 2) {
  101. RmsSupplier rmsSupplier1 = rmsSuppliers.get(0);
  102. rmsSupplier.setSupplierId(rmsSupplier1.getSupplierId());
  103. rmsSupplier.setDeleted(new BigDecimal(1));
  104. result += rmsSupplierMapper.updateByPrimaryKeySelective(rmsSupplier);
  105. }
  106. return result;
  107. }
  108. /**
  109. * 查询供应商列表
  110. * @param mapVal
  111. * @return
  112. */
  113. @Override
  114. public List<Map<String, Object>> getSupplierList(Map<String, Object> mapVal) {
  115. return rmsSupplierMapper.getSupplierList(mapVal);
  116. }
  117. }