OmsshipShipmentInstructionsServiceImpl.java 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. package com.steerinfo.dil.service.impl;
  2. import com.steerinfo.dil.mapper.AmsshipCargoTransferResultMapper;
  3. import com.steerinfo.dil.model.TmsshipShipLocation;
  4. import com.steerinfo.dil.util.DataChange;
  5. import com.steerinfo.framework.mapper.IBaseMapper;
  6. import com.steerinfo.framework.service.impl.BaseServiceImpl;
  7. import com.steerinfo.dil.model.OmsshipShipmentInstructions;
  8. import com.steerinfo.dil.mapper.OmsshipShipmentInstructionsMapper;
  9. import com.steerinfo.dil.service.IOmsshipShipmentInstructionsService;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.stereotype.Service;
  12. import java.math.BigDecimal;
  13. import java.util.Date;
  14. import java.util.HashMap;
  15. import java.util.List;
  16. import java.util.Map;
  17. /**
  18. * OmsshipShipmentInstructions服务实现:
  19. * @author generator
  20. * @version 1.0-SNAPSHORT 2021-08-20 03:05
  21. * 类描述
  22. * 修订历史:
  23. * 日期:2021-08-20
  24. * 作者:generator
  25. * 参考:
  26. * 描述:OmsshipShipmentInstructions服务实现
  27. * @see null
  28. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  29. */
  30. @Service(value = "omsshipShipmentInstructionsService")
  31. public class OmsshipShipmentInstructionsServiceImpl implements IOmsshipShipmentInstructionsService {
  32. @Autowired
  33. private OmsshipShipmentInstructionsMapper omsshipShipmentInstructionsMapper;
  34. @Autowired
  35. private AmsshipCargoTransferResultMapper amsshipCargoTransferResultMapper;
  36. /**
  37. * 通过主键查询
  38. * @param shipmentInstructionsId
  39. * @return
  40. */
  41. @Override
  42. public OmsshipShipmentInstructions selectByKey(BigDecimal shipmentInstructionsId) {
  43. return omsshipShipmentInstructionsMapper.selectByPrimaryKey(shipmentInstructionsId);
  44. }
  45. /**
  46. * 展示所有装船指令
  47. * @param mapVal
  48. * @return
  49. */
  50. @Override
  51. public List<Map<String, Object>> selectAll(Map<String, Object> mapVal) {
  52. List<Map<String, Object>> mapList = omsshipShipmentInstructionsMapper.selectAll(mapVal);
  53. if (mapList.size()!=0){
  54. for (Map<String,Object> map:mapList){
  55. map.put("shipperName","四川省达州钢铁集团有限公司");
  56. }
  57. }
  58. return mapList;
  59. }
  60. /**
  61. * 逻辑删除
  62. * @param shipmentInstructionsId
  63. * @return
  64. */
  65. @Override
  66. public int deleteByPrimaryKey(BigDecimal shipmentInstructionsId) {
  67. OmsshipShipmentInstructions omsshipShipmentInstructions = selectByKey(shipmentInstructionsId);
  68. omsshipShipmentInstructions.setDeleted(new BigDecimal(1));
  69. return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions);
  70. }
  71. /**
  72. * 新增装船指令
  73. * @param map
  74. * @return
  75. */
  76. @Override
  77. public int insert(Map<String,Object> map) {
  78. OmsshipShipmentInstructions omsshipShipmentInstructions=new OmsshipShipmentInstructions();
  79. String userId = (String) map.get("userId");
  80. if (userId!=null){
  81. String userName = amsshipCargoTransferResultMapper.getUserNameByUserId(userId);
  82. //设置新增用户名
  83. omsshipShipmentInstructions.setInsertUsername(userName);
  84. }
  85. BigDecimal shipmentInstructionsId = omsshipShipmentInstructionsMapper.selectInstructionId();
  86. omsshipShipmentInstructions.setShipmentInstructionsId(shipmentInstructionsId);
  87. BigDecimal batchId = omsshipShipmentInstructions.getBatchId();
  88. Map<String,Object> map1 = omsshipShipmentInstructionsMapper.getPortAndPier(batchId);
  89. BigDecimal pierId = (BigDecimal) map1.get("pierId");
  90. BigDecimal portId = (BigDecimal) map1.get("portId");
  91. omsshipShipmentInstructions.setRecipientCarrierId(pierId);
  92. omsshipShipmentInstructions.setPortCarrierId(portId);
  93. // 设置常规字段
  94. omsshipShipmentInstructions.setInsertTime(new Date());
  95. omsshipShipmentInstructions.setInsertUpdateRemark("无");
  96. omsshipShipmentInstructions.setDeleted(new BigDecimal(0));
  97. omsshipShipmentInstructions.setInstructionIssueStatus("未下发");
  98. return omsshipShipmentInstructionsMapper.insert(omsshipShipmentInstructions);
  99. }
  100. /**
  101. * 通过主键修改
  102. * @param omsshipShipmentInstructions
  103. * @return
  104. */
  105. @Override
  106. public int updateByPrimaryKey(OmsshipShipmentInstructions omsshipShipmentInstructions) {
  107. omsshipShipmentInstructions.setUpdateTime(new Date());
  108. return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions);
  109. }
  110. @Override
  111. public BigDecimal selectMaxId() {
  112. return omsshipShipmentInstructionsMapper.selectMaxId();
  113. }
  114. /**
  115. * 查询装船指令表单
  116. * @param shipmentInstructionsId
  117. * @return
  118. */
  119. @Override
  120. public List<Map<String, Object>> selectShipmentInstructions(BigDecimal shipmentInstructionsId) {
  121. return omsshipShipmentInstructionsMapper.selectShipmentInstructions(shipmentInstructionsId);
  122. }
  123. /**
  124. * 修改下发状态
  125. * @param shipmentInstructionsId
  126. * @return
  127. */
  128. @Override
  129. public int updateIssueStatus(BigDecimal shipmentInstructionsId) {
  130. OmsshipShipmentInstructions omsshipShipmentInstructions = selectByKey(shipmentInstructionsId);
  131. omsshipShipmentInstructions.setInstructionIssueStatus("已下发");
  132. return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions);
  133. }
  134. /**
  135. * 获得批次下拉框
  136. * @return
  137. */
  138. @Override
  139. public List<Map<String, Object>> getBatchId() {
  140. return omsshipShipmentInstructionsMapper.getBatchId();
  141. }
  142. @Override
  143. public List<Map<String, Object>> getPortList(Map<String, Object> map) {
  144. return omsshipShipmentInstructionsMapper.getPortList(map);
  145. }
  146. //修改状态
  147. @Override
  148. public int updateByPrimaryKeySelective(OmsshipShipmentInstructions omsshipShipmentInstructions) {
  149. return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions);
  150. }
  151. }