123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- package com.steerinfo.dil.service.impl;
- import com.steerinfo.dil.mapper.BmsshipContractPriceMapper;
- import com.steerinfo.dil.mapper.RmsPersonnelMapper;
- import com.steerinfo.dil.model.BmsshipContractPrice;
- import com.steerinfo.dil.service.IBmsshipContractPriceService;
- import com.steerinfo.dil.util.DataChange;
- import com.steerinfo.framework.mapper.IBaseMapper;
- import com.steerinfo.framework.service.impl.BaseServiceImpl;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.ArrayList;
- import java.util.Date;
- import java.math.BigDecimal;
- import java.util.List;
- import java.util.Map;
- /**
- * BmsshipContractPrice服务实现:
- * @author generator
- * @version 1.0-SNAPSHORT 2022-07-07 09:38
- * 类描述
- * 修订历史:
- * 日期:2022-07-07
- * 作者:generator
- * 参考:
- * 描述:BmsshipContractPrice服务实现
- * @see null
- * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
- */
- @Service(value = "bmsshipContractPriceService")
- public class BmsshipContractPriceServiceImpl implements IBmsshipContractPriceService {
- @Autowired
- private BmsshipContractPriceMapper bmsshipContractPriceMapper;
- @Autowired
- private RmsPersonnelMapper rmsPersonnelMapper;
- @Override
- public int insertBmsshipContractPrice(Map<String, Object> mapValue) {
- int i=0;
- String userId = (String) mapValue.get("userId");
- String personnelName = rmsPersonnelMapper.getPersonnelNameByUserId(userId);
- String remark =(String) mapValue.get("remark");
- String contractNo =(String) mapValue.get("contractNo");
- ArrayList<Object> portIds= (ArrayList<Object>)(mapValue.get("portId"));
- //判断是否存在相同的合同号
- // BigDecimal conpareNo = bmsshipContractPriceMapper.contractNoCompare(contractNo);
- // if (conpareNo!=null){
- // return -1;
- // }
- BigDecimal unitPrice = DataChange.dataToBigDecimal(mapValue.get("unitPrice"));
- long startTime =(long) mapValue.get("startTime");
- long endTime = (long) mapValue.get("endTime");
- //新增实体类
- BmsshipContractPrice bmsshipContractPrice=new BmsshipContractPrice();
- bmsshipContractPrice.setContractNo(contractNo);
- bmsshipContractPrice.setUnitPrice(unitPrice);
- bmsshipContractPrice.setStartTime(new Date(startTime));
- bmsshipContractPrice.setEndTime(new Date(endTime));
- bmsshipContractPrice.setInsertTime(new Date());
- bmsshipContractPrice.setDeleted(new BigDecimal(0));
- if (personnelName!=null){
- bmsshipContractPrice.setInsertUsername(personnelName);
- }else {
- bmsshipContractPrice.setInsertUsername(userId);
- }
- bmsshipContractPrice.setInsertUpdateRemark(remark);
- for(Object portId:portIds){
- bmsshipContractPrice.setResultId(bmsshipContractPriceMapper.getMaxId());
- bmsshipContractPrice.setPortId(DataChange.dataToBigDecimal(portId));
- i+= bmsshipContractPriceMapper.insertSelective(bmsshipContractPrice);
- }
- return i;
- }
- @Override
- public List<Map<String, Object>> bmsshipContractPriceList(Map<String, Object> map) {
- return bmsshipContractPriceMapper.bmsshipContractPriceList(map);
- }
- //修改船运合同单价
- @Override
- public int updateBmsshipContractPrice(Map<String, Object> mapValue) {
- BigDecimal resultId =DataChange.dataToBigDecimal(mapValue.get("resultId"));
- String userId =(String) mapValue.get("userId");
- String remark =(String) mapValue.get("remark");
- String contractNo =(String) mapValue.get("contractNo");
- BigDecimal portId=DataChange.dataToBigDecimal(mapValue.get("portId"));
- //判断是否存在相同的合同号
- // BigDecimal conpareNo = bmsshipContractPriceMapper.contractNoCompare(contractNo);
- // if (conpareNo!=null&&!conpareNo.equals(resultId)){
- // return -1;
- // }
- BigDecimal unitPrice = DataChange.dataToBigDecimal(mapValue.get("unitPrice"));
- long startTime =(long) mapValue.get("startTime");
- long endTime = (long) mapValue.get("endTime");
- String personnelName = rmsPersonnelMapper.getPersonnelNameByUserId(userId);
- BmsshipContractPrice bmsshipContractPrice=new BmsshipContractPrice();
- bmsshipContractPrice.setResultId(resultId);
- bmsshipContractPrice.setUpdateTime(new Date());
- if (personnelName!=null) {
- bmsshipContractPrice.setUpdateUsername(personnelName);
- }else {
- bmsshipContractPrice.setUpdateUsername(userId);
- }
- bmsshipContractPrice.setStartTime(new Date(startTime));
- bmsshipContractPrice.setEndTime(new Date(endTime));
- bmsshipContractPrice.setContractNo(contractNo);
- bmsshipContractPrice.setInsertUpdateRemark(remark);
- if(portId!=null && portId.intValue()!=0){
- bmsshipContractPrice.setPortId(portId);
- }
- bmsshipContractPrice.setUnitPrice(unitPrice);
- return bmsshipContractPriceMapper.updateByPrimaryKeySelective(bmsshipContractPrice);
- }
- //删除合同单价
- @Override
- public int deleteBmsshipContractPrice(Map<String, Object> mapValue) {
- String userId =(String) mapValue.get("userId");
- BigDecimal resultId =DataChange.dataToBigDecimal(mapValue.get("resultId"));
- BmsshipContractPrice bmsshipContractPrice=new BmsshipContractPrice();
- bmsshipContractPrice.setResultId(resultId);
- bmsshipContractPrice.setDeleted(new BigDecimal(1));
- bmsshipContractPrice.setUpdateUsername(userId);
- bmsshipContractPrice.setUpdateTime(new Date());
- return bmsshipContractPriceMapper.updateByPrimaryKeySelective(bmsshipContractPrice);
- }
- //查询水运单条
- @Override
- public List<Map<String, Object>> selectBmsshipPriceList(BigDecimal id) {
- return bmsshipContractPriceMapper.selectBmsshipPriceList(id);
- }
- }
|