RmsSupplierServiceImpl.java 3.9 KB

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