提交 80f9d573 authored 作者: huyufan's avatar huyufan

逆向

上级 54b67d23
......@@ -145,6 +145,12 @@ public class GoodsOrderController {
return Result.ok(orderGoodsService.orderGoodsCancelStyle(orderGoodsNo));
}
@ApiOperation(value = "查看未装车的车辆", notes = "<br>By:胡宇帆")
@GetMapping("/getOrderChildTruckList")
public Result<List<String>> getOrderChildTruckList(@RequestParam(value = "orderGoodsNo") String orderGoodsNo) {
return Result.ok(orderGoodsService.getOrderChildTruckList(orderGoodsNo));
}
@ApiOperation(value = "取消货单", notes = "<br>By:胡宇帆")
@GetMapping("/orderGoodsCancel")
public Result<Object> orderGoodsCancel(@RequestBody OrderGoodsCancelParam param) {
......
......@@ -82,7 +82,9 @@ public interface OrderChildDao extends BaseDao<OrderChildMapper, OrderChild, Int
List<OrderChild> selectResidueWeight(String orderNo,Integer status);
List<OrderChild> selectResidueWeight(String orderNo,Integer status,List<String> truckList);
List<OrderChild> selectResidueWeightByOrderGoodsNo(String orderGoodsNo,Integer status);
List<OrderChild> selectResidueWeightByOrderGoodsNo(String orderGoodsNo,Integer status,List<String> truckList);
/**
* 查询在途运单
......
......@@ -267,8 +267,15 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild,
}
@Override
public List<OrderChild> selectResidueWeight(String orderNo, Integer status, List<String> truckList) {
return baseMapper.selectList(lQrWrapper().eq(OrderChild::getOrderNo,orderNo)
public List<OrderChild> selectResidueWeightByOrderGoodsNo(String orderGoodsNo, Integer status) {
return baseMapper.selectList(lQrWrapper().eq(OrderChild::getOrderGoodsNo,orderGoodsNo)
.lt(ObjectUtil.isNotEmpty(status),OrderChild::getStatus, status)
);
}
@Override
public List<OrderChild> selectResidueWeightByOrderGoodsNo(String orderGoodsNo, Integer status, List<String> truckList) {
return baseMapper.selectList(lQrWrapper().eq(OrderChild::getOrderGoodsNo,orderGoodsNo)
.lt(ObjectUtil.isNotEmpty(status),OrderChild::getStatus, status)
.in(OrderChild::getTruckNo, truckList)
);
......
......@@ -61,7 +61,9 @@ public interface OrderGoodsService {
/**
* 取消货单
* @param OrderGoodsCancelParam
* @param orderGoodsNo
*/
void orderGoodsCancel(OrderGoodsCancelParam orderGoodsNo);
List<String> getOrderChildTruckList(String orderGoodsNo);
}
package com.clx.performance.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -45,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
......@@ -280,7 +282,7 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
Integer cancelOperateType = goodsCancelParam.getCancelOperateType();
switch (cancelOperateType){
case 1:
orderChildList = orderChildDao.selectResidueWeight(orderGoods.getOrderGoodsNo(), OrderChildEnum.Status.ARRIVE_SEND.getCode());
orderChildList = orderChildDao.selectResidueWeightByOrderGoodsNo(orderGoods.getOrderGoodsNo(), null);
if (CollectionUtils.isNotEmpty(orderChildList)) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货单已产生运单");
}
......@@ -303,10 +305,16 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
orderGoodsTruckBindDao.updateOrderGoodsBindStatus(orderGoodsNo, OrderGoodsTruckBindEnum.Status.CANCEL.getCode());
log.info("取消货单,参数:{}", JSONUtil.parse(param));
orderFeign.rollbackOrderWeight(param);
if (orderFeign.rollbackOrderWeight(param).succeed()) {
OrderGoods update = new OrderGoods();
update.setId(orderGoods.getId());
update.setOrderGoodsStatus(OrderGoodsStatusEnum.Status.CANCEL.getCode());
update.setResidueTransportWeight(BigDecimal.ZERO);
orderGoodsDao.updateEntityByKey(update);
}
return;
case 2:
orderChildList = orderChildDao.selectResidueWeight(orderGoods.getOrderGoodsNo(), OrderChildEnum.Status.ARRIVE_SEND.getCode());
orderChildList = orderChildDao.selectResidueWeightByOrderGoodsNo(orderGoods.getOrderGoodsNo(), OrderChildEnum.Status.ARRIVE_SEND.getCode());
if (CollectionUtils.isNotEmpty(orderChildList)) {
sum = orderChildList.stream().map(OrderChild::getWeight).reduce(BigDecimal.ZERO, BigDecimal::add);
}
......@@ -329,14 +337,16 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
orderGoodsTruckBindDao.updateOrderGoodsBindStatus(orderGoodsNo, OrderGoodsTruckBindEnum.Status.CANCEL.getCode());
orderChildDao.batchUpdateOrderChildStatus(OrderChildEnum.Status.PLATFORM_CANCEL.getCode(), orderChildList.stream().map(OrderChild::getId).collect(Collectors.toList()));
log.info("取消货单,参数:{}", JSONUtil.parse(param));
Result<Object> result = orderFeign.rollbackOrderWeight(param);
if (result.succeed()) {
//orderGoodsDao.updateEntityByKey();
if (orderFeign.rollbackOrderWeight(param).succeed()) {
OrderGoods update = new OrderGoods();
update.setId(orderGoods.getId());
update.setOrderGoodsStatus(OrderGoodsStatusEnum.Status.CANCEL.getCode());
update.setResidueTransportWeight(BigDecimal.ZERO);
orderGoodsDao.updateEntityByKey(update);
}
return;
case 3:
orderChildList = orderChildDao.selectResidueWeight(orderGoods.getOrderGoodsNo(), OrderChildEnum.Status.LOAD.getCode(), goodsCancelParam.getTruckList());
orderChildList = orderChildDao.selectResidueWeightByOrderGoodsNo(orderGoods.getOrderGoodsNo(), OrderChildEnum.Status.LOAD.getCode(), goodsCancelParam.getTruckList());
if (CollectionUtils.isNotEmpty(orderChildList)) {
sum = orderChildList.stream().map(OrderChild::getWeight).reduce(BigDecimal.ZERO, BigDecimal::add);
}
......@@ -358,7 +368,13 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
orderGoodsTruckBindDao.updateOrderGoodsBindStatus(orderGoodsNo, OrderGoodsTruckBindEnum.Status.CANCEL.getCode());
orderChildDao.batchUpdateOrderChildStatus(OrderChildEnum.Status.PLATFORM_CANCEL.getCode(), orderChildList.stream().map(OrderChild::getId).collect(Collectors.toList()));
log.info("取消货单,参数:{}", JSONUtil.parse(param));
orderFeign.rollbackOrderWeight(param);
if (orderFeign.rollbackOrderWeight(param).succeed()) {
OrderGoods update = new OrderGoods();
update.setId(orderGoods.getId());
update.setOrderGoodsStatus(OrderGoodsStatusEnum.Status.CANCEL.getCode());
update.setResidueTransportWeight(BigDecimal.ZERO);
orderGoodsDao.updateEntityByKey(update);
}
return;
default:
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "参数类型有误");
......@@ -368,4 +384,13 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
}
@Override
public List<String> getOrderChildTruckList(String orderGoodsNo) {
List<OrderChild> orderChildList = orderChildDao.selectResidueWeightByOrderGoodsNo(orderGoodsNo, OrderChildEnum.Status.LOAD.getCode());
if (CollectionUtil.isNotEmpty(orderChildList)) {
return orderChildList.stream().map(OrderChild::getTruckNo).collect(Collectors.toList());
}
return null;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论