提交 0a81674a authored 作者: huyufan's avatar huyufan

Merge remote-tracking branch 'origin/v4.9_create_goods_child_20230918' into test

# Conflicts: # performance-web/src/main/java/com/clx/performance/strategy/impl/TwoGoodsOrderStrategy.java
......@@ -59,6 +59,10 @@ public class OrderGoodsStatusLazyComponent implements InitializingBean {
log.info("货单已完结定时器查询redis条数为null");
return;
}
if (orderGoodsIds.isEmpty()) {
log.info("货单已完结定时器查询redis条数为空");
return;
}
if (!CollectionUtil.isEmpty(orderGoodsIds)) {
log.info("货单已完结定时器查询redis条数:{}", orderGoodsIds.size());
......
......@@ -17,8 +17,10 @@ import com.clx.performance.struct.OrderGoodsStruct;
import com.clx.performance.vo.app.OrderGoodsAPPVO;
import com.clx.performance.vo.feign.OrderGoodsFeignVO;
import com.clx.performance.vo.pc.OrderGoodsVO;
import com.clx.user.feign.UserClxFeign;
import com.msl.common.base.Optional;
import com.msl.common.exception.ServiceSystemException;
import com.msl.common.result.Result;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -52,6 +54,9 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
@Autowired
private OrderGoodsDriverTruckDao orderGoodsDriverTruckDao;
@Autowired
private UserClxFeign userClxFeign;
@Override
public OrderGoodsVO getOrderGoodsInfoByOrderGoodsNoForPC(String orderGoodsNo) {
OrderGoodsVO orderGoodsVO = orderGoodsDao.getOrderGoodsInfoByOrderGoodsNoForPC(orderGoodsNo).map(orderGoodsStruct::convert).get();
......@@ -84,16 +89,26 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
@Override
public IPage<OrderGoodsAPPVO> indexOrderGoodsList(OrderGoodsListPageParam orderGoodsListParam) {
if (StringUtils.equals(orderGoodsListParam.getOrderGoodsType(),"1")){
if (StringUtils.equals(orderGoodsListParam.getOrderGoodsType(), "1")) {
return orderGoodsDao.openOrderPageGoodsList(orderGoodsListParam);
}else {
} else {
List<OrderGoodsDriverTruck> truckList = orderGoodsDriverTruckDao.
selectListByDriverUserNo(orderGoodsListParam.getDriverUserNo())
.orElseThrow(PerformanceResultEnum.DATA_NOT_FIND, "当前用户未绑定车辆");
List<String> truckNoList = null;
if (truckList.isEmpty()) {
throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND, "当前用户未绑定车辆");
//查询当前用户是否是货主
Long driverUserNo = orderGoodsListParam.getDriverUserNo();
Result<List<String>> ownTruckByUserNo = userClxFeign.getOwnTruckByUserNo(driverUserNo);
if (ownTruckByUserNo.getCode() == 200) {
if (ownTruckByUserNo.getData().isEmpty()) {
throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND, "当前用户未绑定车辆");
}
truckNoList = ownTruckByUserNo.getData();
}
} else {
truckNoList = truckList.stream().map(OrderGoodsDriverTruck::getTruckNo).collect(Collectors.toList());
}
List<String> truckNoList = truckList.stream().map(OrderGoodsDriverTruck::getTruckNo).collect(Collectors.toList());
List<OrderGoodsTruckBind> orderGoodsDriverTrucks = orderGoodsTruckBindDao.selectListByTruckNo(truckNoList)
.orElseThrow(PerformanceResultEnum.DATA_NOT_FIND, "当前用户没有专属单");
if (orderGoodsDriverTrucks.isEmpty()) {
......@@ -101,7 +116,7 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
}
List<String> orderGoodsNoList = orderGoodsDriverTrucks.stream().map(OrderGoodsTruckBind::getOrderGoodsNo).collect(Collectors.toList());
return orderGoodsDao.exclusiveOrderPageGoodsList(orderGoodsListParam,orderGoodsNoList);
return orderGoodsDao.exclusiveOrderPageGoodsList(orderGoodsListParam, orderGoodsNoList);
}
}
......
......@@ -12,7 +12,10 @@ import com.clx.performance.component.OrderGoodsStatusLazyComponent;
import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.dao.OrderGoodsDao;
import com.clx.performance.dao.OrderGoodsTruckBindDao;
import com.clx.performance.enums.*;
import com.clx.performance.enums.OrderGoodsStatusEnum;
import com.clx.performance.enums.OrderGoodsTypeEnum;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.TruckDemandEnum;
import com.clx.performance.model.OrderGoods;
import com.clx.performance.service.OrderGoodsService;
import com.clx.performance.strategy.GoodsOrderStrategy;
......@@ -21,7 +24,6 @@ import com.msl.common.utils.DateUtils;
import com.msl.user.data.UserSessionData;
import com.msl.user.utils.TokenUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
......@@ -146,7 +148,7 @@ public class ThreeGoodsOrderStrategy implements GoodsOrderStrategy, Initializing
orderGoods.setModifiedTime(now);
orderGoods.setUserName(loginUserInfo.getUserName());
orderGoods.setUserNo(loginUserInfo.getUserNo());
if (StringUtils.equals(child.getVehicleUsage(), OrderGoodsPendingVehicleUsageEnum.Status.OWN_TRUCK.getCode()) && CollectionUtil.isNotEmpty(child.getTruckList())) {
if (CollectionUtil.isNotEmpty(child.getTruckList())) {
orderGoodsTruckBindDao.saveBatchEntity(orderNo, OrderGoodsTypeEnum.Status.PLATFORM.getCode() + beginOrderGoodsId, child.getTruckList(), now);
}
mqMap.put(OrderGoodsTypeEnum.Status.PLATFORM.getCode() + beginOrderGoodsId, postedTime);
......
......@@ -158,12 +158,11 @@ public class TwoGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
orderGoods.setModifiedTime(now);
orderGoods.setUserName(loginUserInfo.getUserName());
orderGoods.setUserNo(loginUserInfo.getUserNo());
if (StringUtils.equals(child.getVehicleUsage(), OrderGoodsPendingVehicleUsageEnum.Status.OWN_TRUCK.getCode()) && CollectionUtil.isNotEmpty(child.getTruckList())) {
if (CollectionUtil.isNotEmpty(child.getTruckList())) {
orderGoodsTruckBindDao.saveBatchEntity(orderNo, OrderGoodsTypeEnum.Status.PLATFORM.getCode() + beginOrderGoodsId, child.getTruckList(), now);
}
mqMap.put(OrderGoodsTypeEnum.Status.PLATFORM.getCode() + beginOrderGoodsId, postedTime);
orderGoodsStatusLazyComponent.expireProduce(orderGoods.getLastArriveSendTime(),OrderGoodsTypeEnum.Status.PLATFORM.getCode() + beginOrderGoodsId);
orderGoodsStatusLazyComponent.expireProduce(orderGoods.getLastArriveSendTime(), OrderGoodsTypeEnum.Status.PLATFORM.getCode() + beginOrderGoodsId);
beginOrderGoodsId = beginOrderGoodsId + 1;
orderGoodsList.add(orderGoods);
......@@ -171,26 +170,33 @@ public class TwoGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
orderGoodsDao.saveBatchEntity(orderGoodsList);
BigDecimal residueWeight = new BigDecimal(orderInfo.getResidueWeight());
if (platSum.compareTo(BigDecimal.ZERO) != 0 && ownSum.compareTo(BigDecimal.ZERO) != 0) {
BigDecimal residuePlatSum = new BigDecimal(orderInfo.getPlatformResidueCarryWeight());
BigDecimal residueOwnSum = new BigDecimal(orderInfo.getOwnResidueCarryWeight());
UpdateOrderInfoResidueWeightParam param = new UpdateOrderInfoResidueWeightParam();
param.setOrderId(orderInfo.getId());
param.setUpdateType("4");
param.setResidueWeight(residueWeight.subtract(platSum).subtract(ownSum));
param.setOwnWeight(ownSum);
param.setPlatWeight(platSum);
param.setOwnWeight(residueOwnSum.subtract(ownSum));
param.setPlatWeight(residuePlatSum.subtract(platSum));
orderFeign.updateOrderInfoResidueWeight(param);
} else if (platSum.compareTo(BigDecimal.ZERO) != 0 && ownSum.compareTo(BigDecimal.ZERO) == 0) {
BigDecimal residuePlatSum = new BigDecimal(orderInfo.getPlatformResidueCarryWeight());
UpdateOrderInfoResidueWeightParam param = new UpdateOrderInfoResidueWeightParam();
param.setOrderId(orderInfo.getId());
param.setUpdateType("2");
param.setResidueWeight(residueWeight.subtract(platSum));
param.setPlatWeight(platSum);
param.setPlatWeight(residuePlatSum.subtract(platSum));
orderFeign.updateOrderInfoResidueWeight(param);
} else if (platSum.compareTo(BigDecimal.ZERO) == 0 && ownSum.compareTo(BigDecimal.ZERO) != 0) {
BigDecimal residueOwnSum = new BigDecimal(orderInfo.getOwnResidueCarryWeight());
UpdateOrderInfoResidueWeightParam param = new UpdateOrderInfoResidueWeightParam();
param.setOrderId(orderInfo.getId());
param.setUpdateType("3");
param.setResidueWeight(residueWeight.subtract(ownSum));
param.setOwnWeight(ownSum);
param.setOwnWeight(residueOwnSum.subtract(ownSum));
orderFeign.updateOrderInfoResidueWeight(param);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论