RmsSupplierServiceImpl.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. Integer EASSupplierIdValue = (Integer) mapVal.get("EASSupplierId");
  38. BigDecimal EASSupplierId = new BigDecimal(EASSupplierIdValue);
  39. // 得到供应商名称
  40. String supplierName = (String) mapVal.get("supplierName");
  41. // 得到供应商供应商简称
  42. String supplierAbbreviation = (String) mapVal.get("supplierAbbreviation");
  43. // 得到供应商代码
  44. String supplierDutyParagraph = (String) mapVal.get("supplierDutyParagraph");
  45. // 得到供应商地址
  46. String supplierAddress = (String) mapVal.get("supplierAddress");
  47. // 得到联系人
  48. String supplierContactsName = (String) mapVal.get("supplierAgent");
  49. // 得到联系电话
  50. String supplierContactNumber = (String) mapVal.get("supplierContactNumber");
  51. // 得到数据数据状态
  52. Integer dataStatus = (Integer) mapVal.get("dataStatus");
  53. // 判断是否EASId已存在
  54. Map<String,Object> map1 = new HashMap<>();
  55. map1.put("easSupplierId",EASSupplierId);
  56. BigDecimal deleted = new BigDecimal(0);
  57. map1.put("deleted",deleted);
  58. List<RmsSupplier> rmsSuppliers = rmsSupplierMapper.selectByParameters(map1);
  59. RmsSupplier rmsSupplier = new RmsSupplier();
  60. rmsSupplier.setEasSupplierId(EASSupplierId);
  61. rmsSupplier.setSupplierName(supplierName);
  62. rmsSupplier.setSupplierAbbreviation(supplierAbbreviation);
  63. rmsSupplier.setSupplierDutyParagraph(supplierDutyParagraph);
  64. rmsSupplier.setSupplierAddress(supplierAddress);
  65. rmsSupplier.setSupplierContactsName(supplierContactsName);
  66. rmsSupplier.setSupplierContactNumber(supplierContactNumber);
  67. int result = 0;
  68. // 新增
  69. if (rmsSuppliers.size() == 0) {
  70. BigDecimal supplierId = rmsSupplierMapper.getSupplierId();
  71. rmsSupplier.setSupplierId(supplierId);
  72. rmsSupplier.setDeleted(new BigDecimal(0));
  73. result = rmsSupplierMapper.insertSelective(rmsSupplier);
  74. }
  75. // 修改
  76. if (rmsSuppliers.size() != 0 && dataStatus == 1) {
  77. RmsSupplier rmsSupplier1 = rmsSuppliers.get(0);
  78. rmsSupplier.setSupplierId(rmsSupplier1.getSupplierId());
  79. result = rmsSupplierMapper.updateByPrimaryKeySelective(rmsSupplier);
  80. }
  81. // 逻辑删除
  82. if (rmsSuppliers.size() != 0 && dataStatus == 2) {
  83. RmsSupplier rmsSupplier1 = rmsSuppliers.get(0);
  84. rmsSupplier.setSupplierId(rmsSupplier1.getSupplierId());
  85. rmsSupplier.setDeleted(new BigDecimal(1));
  86. result = rmsSupplierMapper.updateByPrimaryKeySelective(rmsSupplier);
  87. }
  88. return result;
  89. }
  90. /**
  91. * 查询供应商列表
  92. * @param mapVal
  93. * @return
  94. */
  95. @Override
  96. public List<Map<String, Object>> getSupplierList(Map<String, Object> mapVal) {
  97. return rmsSupplierMapper.getSupplierList(mapVal);
  98. }
  99. }