提交 b99f753c authored 作者: 刘海泉's avatar 刘海泉

新增履约进度表相关接口

上级 efea642a
...@@ -179,7 +179,8 @@ public enum OrderChildEnum { ...@@ -179,7 +179,8 @@ public enum OrderChildEnum {
public static ConcurrentHashMap<Integer, String> map = new ConcurrentHashMap(); public static ConcurrentHashMap<Integer, String> map = new ConcurrentHashMap();
static { static {
for(OrderChildEnum.Status orderChildStatusEnum : OrderChildEnum.Status.values()){ for(OrderChildEnum.Status
orderChildStatusEnum : OrderChildEnum.Status.values()){
map.put(orderChildStatusEnum.getCode(), orderChildStatusEnum.getName()); map.put(orderChildStatusEnum.getCode(), orderChildStatusEnum.getName());
} }
} }
......
...@@ -47,10 +47,10 @@ public class CarrierPerformanceProgressController { ...@@ -47,10 +47,10 @@ public class CarrierPerformanceProgressController {
@ApiOperation(value = "进行中数据调整顺序",notes = "<br>By:刘海泉") @ApiOperation(value = "进行中数据调整顺序",notes = "<br>By:刘海泉")
@GetMapping("/updateAdjustOrder") @GetMapping("/updateAdjustOrder")
public Result<Object> updateAdjustOrder( public Result<Object> updateAdjustOrder(
@RequestParam("adjustOrderOneId") @NotBlank(message = "调整订单1的id不能为空") Integer adjustOrderOneId, @RequestParam("adjustOrderOneId") @NotBlank(message = "调整订单1的id不能为空") Integer adjustOrderId,
@RequestParam("adjustOrderTwoId") @NotBlank(message = "调整订单2的id不能为空") Integer adjustOrderTwoId @RequestParam("adjustOrderTwoId") @NotBlank(message = "调整订单2的id不能为空") Integer adjustOrderBeforeId
) { ) {
performanceProgressService.updateAdjustOrder(adjustOrderOneId,adjustOrderTwoId); performanceProgressService.updateAdjustOrder(adjustOrderId,adjustOrderBeforeId);
return Result.ok(); return Result.ok();
} }
...@@ -64,7 +64,7 @@ public class CarrierPerformanceProgressController { ...@@ -64,7 +64,7 @@ public class CarrierPerformanceProgressController {
} }
@ApiOperation(value = "编辑履约进度",notes = "<br>By:刘海泉") @ApiOperation(value = "获取履约进度详情",notes = "<br>By:刘海泉")
@GetMapping("/getPerformanceProgressDetail") @GetMapping("/getPerformanceProgressDetail")
public Result<PerformanceProgressDetailVO> getPerformanceProgressDetail(@RequestParam("id") @NotNull(message = "id不能为空") Integer id) { public Result<PerformanceProgressDetailVO> getPerformanceProgressDetail(@RequestParam("id") @NotNull(message = "id不能为空") Integer id) {
PerformanceProgressDetailVO vo = performanceProgressService.getPerformanceProgressDetail(id); PerformanceProgressDetailVO vo = performanceProgressService.getPerformanceProgressDetail(id);
...@@ -72,7 +72,7 @@ public class CarrierPerformanceProgressController { ...@@ -72,7 +72,7 @@ public class CarrierPerformanceProgressController {
} }
@ApiOperation(value = "编辑履约进度",notes = "<br>By:刘海泉") @ApiOperation(value = "获取履约进度编辑日志列表",notes = "<br>By:刘海泉")
@GetMapping("/getOperationLog") @GetMapping("/getOperationLog")
public Result<List<PerformanceProgressOperationLogVO>> getOperationLog(@RequestParam("orderNo") @NotBlank(message = "订单编号不能为空") String orderNo) { public Result<List<PerformanceProgressOperationLogVO>> getOperationLog(@RequestParam("orderNo") @NotBlank(message = "订单编号不能为空") String orderNo) {
List<PerformanceProgressOperationLogVO> list = performanceProgressService.getOperationLog(orderNo); List<PerformanceProgressOperationLogVO> list = performanceProgressService.getOperationLog(orderNo);
......
...@@ -15,4 +15,6 @@ import java.util.List; ...@@ -15,4 +15,6 @@ import java.util.List;
*/ */
public interface PerformanceProgressDao extends BaseDao<PerformanceProgressMapper, PerformanceProgress, Integer> { public interface PerformanceProgressDao extends BaseDao<PerformanceProgressMapper, PerformanceProgress, Integer> {
IPage<PerformanceProgress> pagePerformanceProgress(List<Integer> statusList, PagePerformanceProgress param); IPage<PerformanceProgress> pagePerformanceProgress(List<Integer> statusList, PagePerformanceProgress param);
void updateRecordOrder(Integer seq,boolean isUp);
} }
package com.clx.performance.dao.impl; package com.clx.performance.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.dao.PerformanceProgressDao; import com.clx.performance.dao.PerformanceProgressDao;
...@@ -24,8 +25,20 @@ public class PerformanceProgressDaoImpl extends BaseDaoImpl<PerformanceProgressM ...@@ -24,8 +25,20 @@ public class PerformanceProgressDaoImpl extends BaseDaoImpl<PerformanceProgressM
Page<PerformanceProgress> page = Page.of(param.getPage(), param.getPageSize()); Page<PerformanceProgress> page = Page.of(param.getPage(), param.getPageSize());
LambdaQueryWrapper<PerformanceProgress> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PerformanceProgress> query = new LambdaQueryWrapper<>();
query.in(PerformanceProgress :: getOrderStatus,statusList); query.in(PerformanceProgress :: getOrderStatus,statusList);
//最新接单的seq最大,所以这里序排序 //最新接单的seq最大,所以这里序排序
query.orderByAsc(PerformanceProgress :: getSeq); query.orderByDesc(PerformanceProgress :: getSeq);
return baseMapper.selectPage(page,query); return baseMapper.selectPage(page,query);
} }
@Override
public void updateRecordOrder(Integer seq,boolean isUp) {
LambdaUpdateWrapper<PerformanceProgress> update = new LambdaUpdateWrapper<>();
if(isUp){
update.gt(PerformanceProgress :: getSeq,seq);
}else{
update.ge(PerformanceProgress :: getSeq,seq);
}
update.setSql("seq = seq + 1");
baseMapper.update(null,update);
}
} }
package com.clx.performance.service; package com.clx.performance.service;
import com.clx.performance.enums.PerformanceProgressEnum;
import com.clx.performance.model.PerformanceProgressLog;
/** /**
* @author kavin * @author kavin
* Date 2024-07-12 * Date 2024-07-12
* Time 16:02 * Time 16:02
*/ */
public interface PerformanceProgressLogService { public interface PerformanceProgressLogService {
PerformanceProgressLog generateLog(String orderNo, PerformanceProgressEnum.LogType logType, Object content,
Long userNo, String userName);
} }
...@@ -18,7 +18,7 @@ import java.util.List; ...@@ -18,7 +18,7 @@ import java.util.List;
public interface PerformanceProgressService { public interface PerformanceProgressService {
IPage<PerformanceProgressVO> pagePerformanceProgress(PagePerformanceProgress param); IPage<PerformanceProgressVO> pagePerformanceProgress(PagePerformanceProgress param);
void updateAdjustOrder(Integer adjustOrderOneId, Integer adjustOrderTwoId); void updateAdjustOrder(Integer adjustOrderId, Integer adjustOrderBeforeId);
void saveOrUpdatePerformanceProgress(PerformanceProgress item); void saveOrUpdatePerformanceProgress(PerformanceProgress item);
......
package com.clx.performance.service.impl; package com.clx.performance.service.impl;
import com.clx.performance.enums.PerformanceProgressEnum;
import com.clx.performance.model.PerformanceProgressLog;
import com.clx.performance.service.PerformanceProgressLogService; import com.clx.performance.service.PerformanceProgressLogService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -12,4 +14,15 @@ import org.springframework.stereotype.Service; ...@@ -12,4 +14,15 @@ import org.springframework.stereotype.Service;
@Service @Service
@Slf4j @Slf4j
public class PerformanceProgressLogServiceImpl implements PerformanceProgressLogService { public class PerformanceProgressLogServiceImpl implements PerformanceProgressLogService {
@Override
public PerformanceProgressLog generateLog(String orderNo, PerformanceProgressEnum.LogType logType,
Object content, Long userNo, String userName) {
PerformanceProgressLog log = new PerformanceProgressLog();
log.setOrderNo(orderNo);
log.setOperateType(logType.getCode());
log.setOperateContent(logType.getName() + ":" + content);
log.setCreateBy(userNo);
log.setCreateName(userName);
return log;
}
} }
...@@ -11,6 +11,7 @@ import com.clx.performance.model.PerformanceProgress; ...@@ -11,6 +11,7 @@ import com.clx.performance.model.PerformanceProgress;
import com.clx.performance.model.PerformanceProgressLog; import com.clx.performance.model.PerformanceProgressLog;
import com.clx.performance.param.pc.carrier.PagePerformanceProgress; import com.clx.performance.param.pc.carrier.PagePerformanceProgress;
import com.clx.performance.param.pc.carrier.UpdatePerformanceProgressParam; import com.clx.performance.param.pc.carrier.UpdatePerformanceProgressParam;
import com.clx.performance.service.PerformanceProgressLogService;
import com.clx.performance.service.PerformanceProgressService; import com.clx.performance.service.PerformanceProgressService;
import com.clx.performance.struct.PerformanceProgressLogStruct; import com.clx.performance.struct.PerformanceProgressLogStruct;
import com.clx.performance.struct.PerformanceProgressStruct; import com.clx.performance.struct.PerformanceProgressStruct;
...@@ -23,6 +24,7 @@ import lombok.AllArgsConstructor; ...@@ -23,6 +24,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -43,6 +45,7 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi ...@@ -43,6 +45,7 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi
private final PerformanceProgressStruct performanceProgressStruct; private final PerformanceProgressStruct performanceProgressStruct;
private final PerformanceProgressLogDao performanceProgressLogDao; private final PerformanceProgressLogDao performanceProgressLogDao;
private final PerformanceProgressLogStruct performanceProgressLogStruct; private final PerformanceProgressLogStruct performanceProgressLogStruct;
private final PerformanceProgressLogService performanceProgressLogService;
public static List<Integer> inProcessStatusList; public static List<Integer> inProcessStatusList;
...@@ -118,28 +121,35 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi ...@@ -118,28 +121,35 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi
return returnPage; return returnPage;
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void updateAdjustOrder(Integer adjustOrderOneId, Integer adjustOrderTwoId) { public void updateAdjustOrder(Integer adjustOrderId, Integer adjustOrderBeforeId) {
Optional<PerformanceProgress> one = performanceProgressDao.getEntityByKey(adjustOrderId);
Optional<PerformanceProgress> one = performanceProgressDao.getEntityByKey(adjustOrderOneId); //如果上调,这条记录传的是移动数据后面的记录id,如果下调,这条记录传的是移动数据前面的记录id
Optional<PerformanceProgress> two = performanceProgressDao.getEntityByKey(adjustOrderTwoId); Optional<PerformanceProgress> two = performanceProgressDao.getEntityByKey(adjustOrderBeforeId);
if(!one.isPresent() || !two.isPresent()){ if(!one.isPresent() || !two.isPresent()){
throw new ServiceSystemException(ResultEnum.DATA_NOT_FIND); throw new ServiceSystemException(ResultEnum.DATA_NOT_FIND);
} }
PerformanceProgress updateOne = new PerformanceProgress(); boolean isUp = false;
updateOne.setId(one.get().getId()); //通过seq判断是上调还是下调
updateOne.setSeq(two.get().getSeq()); if(one.get().getSeq() < two.get().getSeq()){
PerformanceProgress updateTwo = new PerformanceProgress(); isUp = true;
updateTwo.setId(two.get().getId()); }
updateTwo.setSeq(one.get().getSeq()); //上调:大于two 这条记录的seq + 1 ; 下调:大于等于two这条记录的seq + 1 ;
performanceProgressDao.updateRecordOrder(two.get().getSeq(),isUp);
if(isUp){ //上调
List<PerformanceProgress> list = new ArrayList<>(); //调整的记录使用 two 的seq + 1;
list.add(updateOne); PerformanceProgress updateOne = new PerformanceProgress();
list.add(updateTwo); updateOne.setId(one.get().getId());
performanceProgressDao.updateBatchList(list); updateOne.setSeq(two.get().getSeq() + 1);
performanceProgressDao.updateEntityByKey(updateOne);
}else{ //下调
//调整的记录使用 two 的seq;
PerformanceProgress updateOne = new PerformanceProgress();
updateOne.setId(one.get().getId());
updateOne.setSeq(two.get().getSeq());
performanceProgressDao.updateEntityByKey(updateOne);
}
} }
//通过dts监听订单、货单、运单表进行更新履约进度表的数据 //通过dts监听订单、货单、运单表进行更新履约进度表的数据
...@@ -155,9 +165,73 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi ...@@ -155,9 +165,73 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi
} }
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void updatePerformanceProgress(UpdatePerformanceProgressParam param, Long userNo, String userName) { public void updatePerformanceProgress(UpdatePerformanceProgressParam param, Long userNo, String userName) {
PerformanceProgress item = performanceProgressDao.getEntityByKey(param.getId()).
orElseThrow(ResultEnum.DATA_NOT_FIND);
PerformanceProgress update = new PerformanceProgress();
List<PerformanceProgressLog> logs = new ArrayList<>();
boolean change = false;
if(Objects.nonNull(item.getTodayExpectComplete())
&& Objects.nonNull(param.getTodayExpectComplete())
&& item.getTodayExpectComplete().compareTo(param.getTodayExpectComplete()) != 0){
PerformanceProgressLog log = performanceProgressLogService.generateLog(item.getOrderNo(),
PerformanceProgressEnum.LogType.TODAY_EXPECT_COMPLETE,
param.getTodayExpectComplete(),userNo,userName);
update.setTodayExpectComplete(param.getTodayExpectComplete());
logs.add(log);
change = true;
}
if(Objects.equals(item.getTradeRequireArriveStationTime(),param.getTradeRequireArriveStationTime())){
PerformanceProgressLog log = performanceProgressLogService.generateLog(item.getOrderNo(),
PerformanceProgressEnum.LogType.TRADE_REQUIRE_ARRIVE_STATION_TIME,
param.getTradeRequireArriveStationTime(),userNo,userName);
update.setTradeRequireArriveStationTime(param.getTradeRequireArriveStationTime());
logs.add(log);
change = true;
}
if(Objects.equals(item.getTransportExpectArriveStationTime(),param.getTransportExpectArriveStationTime())){
PerformanceProgressLog log = performanceProgressLogService.generateLog(item.getOrderNo(),
PerformanceProgressEnum.LogType.TRADE_REQUIRE_ARRIVE_STATION_TIME,
param.getTransportExpectArriveStationTime(),userNo,userName);
update.setTransportExpectArriveStationTime(param.getTransportExpectArriveStationTime());
logs.add(log);
change = true;
}
if(Objects.equals(item.getAbnormalRemark(),param.getAbnormalRemark())){
PerformanceProgressLog log = performanceProgressLogService.generateLog(item.getOrderNo(),
PerformanceProgressEnum.LogType.ABNORMAL_REMARK,
param.getAbnormalRemark(),userNo,userName);
update.setAbnormalRemark(param.getAbnormalRemark());
logs.add(log);
change = true;
}
if(Objects.equals(item.getPerformanceAbnormalReason(),param.getPerformanceAbnormalReason())){
PerformanceProgressLog log = performanceProgressLogService.generateLog(item.getOrderNo(),
PerformanceProgressEnum.LogType.PERFORMANCE_ABNORMAL_REASON,
param.getPerformanceAbnormalReason(),userNo,userName);
update.setPerformanceAbnormalReason(param.getPerformanceAbnormalReason());
logs.add(log);
change = true;
}
if(Objects.equals(item.getDispatchFollow(),param.getDispatchFollow())){
PerformanceProgressLog log = performanceProgressLogService.generateLog(item.getOrderNo(),
PerformanceProgressEnum.LogType.DISPATCH_FOLLOW,
param.getDispatchFollow(),userNo,userName);
update.setDispatchFollow(param.getDispatchFollow());
logs.add(log);
change = true;
}
if(change){
performanceProgressDao.updateEntityByKey(update);
performanceProgressLogDao.saveBatchList(logs);
}
} }
@Override @Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论