123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- package com.steerinfo.dil.service.impl;
- import com.steerinfo.dil.mapper.AmsshipCargoTransferResultMapper;
- import com.steerinfo.dil.model.TmsshipShipLocation;
- import com.steerinfo.dil.util.DataChange;
- import com.steerinfo.framework.mapper.IBaseMapper;
- import com.steerinfo.framework.service.impl.BaseServiceImpl;
- import com.steerinfo.dil.model.OmsshipShipmentInstructions;
- import com.steerinfo.dil.mapper.OmsshipShipmentInstructionsMapper;
- import com.steerinfo.dil.service.IOmsshipShipmentInstructionsService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.math.BigDecimal;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * OmsshipShipmentInstructions服务实现:
- * @author generator
- * @version 1.0-SNAPSHORT 2021-08-20 03:05
- * 类描述
- * 修订历史:
- * 日期:2021-08-20
- * 作者:generator
- * 参考:
- * 描述:OmsshipShipmentInstructions服务实现
- * @see null
- * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
- */
- @Service(value = "omsshipShipmentInstructionsService")
- public class OmsshipShipmentInstructionsServiceImpl implements IOmsshipShipmentInstructionsService {
- @Autowired
- private OmsshipShipmentInstructionsMapper omsshipShipmentInstructionsMapper;
- @Autowired
- private AmsshipCargoTransferResultMapper amsshipCargoTransferResultMapper;
- /**
- * 通过主键查询
- * @param shipmentInstructionsId
- * @return
- */
- @Override
- public OmsshipShipmentInstructions selectByKey(BigDecimal shipmentInstructionsId) {
- return omsshipShipmentInstructionsMapper.selectByPrimaryKey(shipmentInstructionsId);
- }
- /**
- * 展示所有装船指令
- * @param mapVal
- * @return
- */
- @Override
- public List<Map<String, Object>> selectAll(Map<String, Object> mapVal) {
- List<Map<String, Object>> mapList = omsshipShipmentInstructionsMapper.selectAll(mapVal);
- if (mapList.size()!=0){
- for (Map<String,Object> map:mapList){
- map.put("shipperName","四川省达州钢铁集团有限公司");
- }
- }
- return mapList;
- }
- /**
- * 逻辑删除
- * @param shipmentInstructionsId
- * @return
- */
- @Override
- public int deleteByPrimaryKey(BigDecimal shipmentInstructionsId) {
- OmsshipShipmentInstructions omsshipShipmentInstructions = selectByKey(shipmentInstructionsId);
- omsshipShipmentInstructions.setDeleted(new BigDecimal(1));
- return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions);
- }
- /**
- * 新增装船指令
- * @param map
- * @return
- */
- @Override
- public int insert(Map<String,Object> map) {
- OmsshipShipmentInstructions omsshipShipmentInstructions=new OmsshipShipmentInstructions();
- String userId = (String) map.get("userId");
- if (userId!=null){
- String userName = amsshipCargoTransferResultMapper.getUserNameByUserId(userId);
- //设置新增用户名
- omsshipShipmentInstructions.setInsertUsername(userName);
- }
- BigDecimal shipmentInstructionsId = omsshipShipmentInstructionsMapper.selectInstructionId();
- omsshipShipmentInstructions.setShipmentInstructionsId(shipmentInstructionsId);
- BigDecimal batchId = DataChange.dataToBigDecimal(map.get("batchId"));
- Map<String,Object> map1 = omsshipShipmentInstructionsMapper.getPortAndPier(batchId);
- BigDecimal pierId = (BigDecimal) map1.get("pierId");
- BigDecimal portId = (BigDecimal) map1.get("portId");
- omsshipShipmentInstructions.setRecipientCarrierId(pierId);
- omsshipShipmentInstructions.setPortCarrierId(portId);
- omsshipShipmentInstructions.setBatchId(batchId);
- //新增合计吨位
- omsshipShipmentInstructions.setInstructionsTotalTonnage(DataChange.dataToBigDecimal(map.get("instructionsTotalTonnage")));
- //新增装船日期
- long instructionTime =(long) map.get("instructionTime");
- omsshipShipmentInstructions.setInstructionTime(new Date(instructionTime));
- // 设置常规字段
- omsshipShipmentInstructions.setInsertTime(new Date());
- omsshipShipmentInstructions.setInsertUpdateRemark("无");
- omsshipShipmentInstructions.setDeleted(new BigDecimal(0));
- omsshipShipmentInstructions.setInstructionIssueStatus("未下发");
- return omsshipShipmentInstructionsMapper.insertSelective(omsshipShipmentInstructions);
- }
- /**
- * 通过主键修改
- * @param omsshipShipmentInstructions
- * @return
- */
- @Override
- public int updateByPrimaryKey(Map<String,Object> omsshipShipmentInstructions) {
- BigDecimal instructionsId = DataChange.dataToBigDecimal(omsshipShipmentInstructions.get("shipmentInstructionsId"));
- BigDecimal instructionsTotalTonnage = DataChange.dataToBigDecimal(omsshipShipmentInstructions.get("instructionsTotalTonnage"));
- long instructionTime = (long)omsshipShipmentInstructions.get("instructionTime");
- OmsshipShipmentInstructions omsshipShipmentInstructions1=new OmsshipShipmentInstructions();
- omsshipShipmentInstructions1.setShipmentInstructionsId(instructionsId);
- omsshipShipmentInstructions1.setInstructionsTotalTonnage(instructionsTotalTonnage);
- omsshipShipmentInstructions1.setInstructionTime(new Date(instructionTime));
- return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions1);
- }
- // @Override
- // public BigDecimal selectMaxId() {
- // return omsshipShipmentInstructionsMapper.selectMaxId();
- // }
- /**
- * 查询装船指令表单
- * @param shipmentInstructionsId
- * @return
- */
- @Override
- public List<Map<String, Object>> selectShipmentInstructions(BigDecimal shipmentInstructionsId) {
- return omsshipShipmentInstructionsMapper.selectShipmentInstructions(shipmentInstructionsId);
- }
- /**
- * 修改下发状态
- * @param shipmentInstructionsId
- * @return
- */
- @Override
- public int updateIssueStatus(BigDecimal shipmentInstructionsId) {
- OmsshipShipmentInstructions omsshipShipmentInstructions = selectByKey(shipmentInstructionsId);
- omsshipShipmentInstructions.setInstructionIssueStatus("已下发");
- return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions);
- }
- /**
- * 获得批次下拉框
- * @return
- */
- @Override
- public List<Map<String, Object>> getBatchId() {
- return omsshipShipmentInstructionsMapper.getBatchId();
- }
- @Override
- public List<Map<String, Object>> getPortList(Map<String, Object> map) {
- return omsshipShipmentInstructionsMapper.getPortList(map);
- }
- //修改状态
- @Override
- public int updateByPrimaryKeySelective(OmsshipShipmentInstructions omsshipShipmentInstructions) {
- return omsshipShipmentInstructionsMapper.updateByPrimaryKeySelective(omsshipShipmentInstructions);
- }
- }
|