OmsshipShipmentInstructionsServiceImpl.java 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. // 设置常规字段
  100. omsshipShipmentInstructions.setInsertTime(new Date());
  101. omsshipShipmentInstructions.setInsertUpdateRemark("无");
  102. omsshipShipmentInstructions.setDeleted(new BigDecimal(0));
  103. omsshipShipmentInstructions.setInstructionIssueStatus("未下发");
  104. return omsshipShipmentInstructionsMapper.insertSelective(omsshipShipmentInstructions);
  105. }
  106. /**
  107. * 通过主键修改
  108. * @param omsshipShipmentInstructions
  109. * @return
  110. */
  111. @Override
  112. public int updateByPrimaryKey(Map<String,Object> omsshipShipmentInstructions) {
  113. BigDecimal instructionsId = DataChange.dataToBigDecimal(omsshipShipmentInstructions.get("shipmentInstructionsId"));
  114. BigDecimal instructionsTotalTonnage = DataChange.dataToBigDecimal(omsshipShipmentInstructions.get("instructionsTotalTonnage"));
  115. long instructionTime = (long)omsshipShipmentInstructions.get("instructionTime");
  116. OmsshipShipmentInstructions omsshipShipmentInstructions1=new OmsshipShipmentInstructions();
  117. omsshipShipmentInstructions1.setShipmentInstructionsId(instructionsId);
  118. omsshipShipmentInstructions1.setInstructionsTotalTonnage(instructionsTotalTonnage);
  119. omsshipShipmentInstructions1.setInstructionTime(new Date(instructionTime));
  120. return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions1);
  121. }
  122. // @Override
  123. // public BigDecimal selectMaxId() {
  124. // return omsshipShipmentInstructionsMapper.selectMaxId();
  125. // }
  126. /**
  127. * 查询装船指令表单
  128. * @param shipmentInstructionsId
  129. * @return
  130. */
  131. @Override
  132. public List<Map<String, Object>> selectShipmentInstructions(BigDecimal shipmentInstructionsId) {
  133. return omsshipShipmentInstructionsMapper.selectShipmentInstructions(shipmentInstructionsId);
  134. }
  135. /**
  136. * 修改下发状态
  137. * @param shipmentInstructionsId
  138. * @return
  139. */
  140. @Override
  141. public int updateIssueStatus(BigDecimal shipmentInstructionsId) {
  142. OmsshipShipmentInstructions omsshipShipmentInstructions = selectByKey(shipmentInstructionsId);
  143. omsshipShipmentInstructions.setInstructionIssueStatus("已下发");
  144. return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions);
  145. }
  146. /**
  147. * 获得批次下拉框
  148. * @return
  149. */
  150. @Override
  151. public List<Map<String, Object>> getBatchId() {
  152. return omsshipShipmentInstructionsMapper.getBatchId();
  153. }
  154. @Override
  155. public List<Map<String, Object>> getPortList(Map<String, Object> map) {
  156. return omsshipShipmentInstructionsMapper.getPortList(map);
  157. }
  158. //修改状态
  159. @Override
  160. public int updateByPrimaryKeySelective(OmsshipShipmentInstructions omsshipShipmentInstructions) {
  161. return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions);
  162. }
  163. }