OmsshipShipmentInstructionsServiceImpl.java 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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 = DataChange.dataToBigDecimal(map.get("batchId"));
  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. omsshipShipmentInstructions.setBatchId(batchId);
  94. //新增合计吨位
  95. omsshipShipmentInstructions.setInstructionsTotalTonnage(DataChange.dataToBigDecimal(map.get("instructionsTotalTonnage")));
  96. //新增装船日期
  97. long instructionTime =(long) map.get("instructionTime");
  98. omsshipShipmentInstructions.setInstructionTime(new Date(instructionTime));
  99. if (map.get("statu").equals(true)) {
  100. omsshipShipmentInstructions.setInstructionsStatus("二程:海港-江港");
  101. }
  102. if (map.get("transportPortName")!=null){
  103. //新增中转港
  104. omsshipShipmentInstructions.setTransitPort( DataChange.dataToBigDecimal(map.get("transportPortName")));
  105. }
  106. if (map.get("handoverMethod")!=null){
  107. omsshipShipmentInstructions.setHandoverMode((String)map.get("handoverMethod"));
  108. }
  109. // 设置常规字段
  110. omsshipShipmentInstructions.setInsertTime(new Date());
  111. omsshipShipmentInstructions.setInsertUpdateRemark("无");
  112. omsshipShipmentInstructions.setDeleted(new BigDecimal(0));
  113. omsshipShipmentInstructions.setInstructionIssueStatus("未下发");
  114. return omsshipShipmentInstructionsMapper.insertSelective(omsshipShipmentInstructions);
  115. }
  116. /**
  117. * 通过主键修改
  118. * @param omsshipShipmentInstructions
  119. * @return
  120. */
  121. @Override
  122. public int updateByPrimaryKey(Map<String,Object> omsshipShipmentInstructions) {
  123. BigDecimal instructionsId = DataChange.dataToBigDecimal(omsshipShipmentInstructions.get("shipmentInstructionsId"));
  124. BigDecimal instructionsTotalTonnage = DataChange.dataToBigDecimal(omsshipShipmentInstructions.get("instructionsTotalTonnage"));
  125. long instructionTime = (long)omsshipShipmentInstructions.get("instructionTime");
  126. OmsshipShipmentInstructions omsshipShipmentInstructions1=new OmsshipShipmentInstructions();
  127. omsshipShipmentInstructions1.setShipmentInstructionsId(instructionsId);
  128. omsshipShipmentInstructions1.setInstructionsTotalTonnage(instructionsTotalTonnage);
  129. omsshipShipmentInstructions1.setInstructionTime(new Date(instructionTime));
  130. return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions1);
  131. }
  132. // @Override
  133. // public BigDecimal selectMaxId() {
  134. // return omsshipShipmentInstructionsMapper.selectMaxId();
  135. // }
  136. /**
  137. * 查询装船指令表单
  138. * @param shipmentInstructionsId
  139. * @return
  140. */
  141. @Override
  142. public List<Map<String, Object>> selectShipmentInstructions(BigDecimal shipmentInstructionsId) {
  143. return omsshipShipmentInstructionsMapper.selectShipmentInstructions(shipmentInstructionsId);
  144. }
  145. /**
  146. * 修改下发状态
  147. * @param shipmentInstructionsId
  148. * @return
  149. */
  150. @Override
  151. public int updateIssueStatus(BigDecimal shipmentInstructionsId) {
  152. OmsshipShipmentInstructions omsshipShipmentInstructions = selectByKey(shipmentInstructionsId);
  153. omsshipShipmentInstructions.setInstructionIssueStatus("已下发");
  154. return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions);
  155. }
  156. /**
  157. * 获得批次下拉框
  158. * @return
  159. */
  160. @Override
  161. public List<Map<String, Object>> getBatchId() {
  162. return omsshipShipmentInstructionsMapper.getBatchId();
  163. }
  164. @Override
  165. public List<Map<String, Object>> getPortList(Map<String, Object> map) {
  166. return omsshipShipmentInstructionsMapper.getPortList(map);
  167. }
  168. //修改状态
  169. @Override
  170. public int updateByPrimaryKeySelective(OmsshipShipmentInstructions omsshipShipmentInstructions) {
  171. return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions);
  172. }
  173. }