|
|
|
@ -259,6 +259,7 @@ public class RecycleOrderServiceImpl extends ServiceImpl<RecycleOrderMapper, Rec
|
|
|
|
|
}
|
|
|
|
|
// 创建订单
|
|
|
|
|
String orderNo = CommonUtil.getIdNumber(BusinessCodeEnum.ORDER.getCode());
|
|
|
|
|
String enterpriseId = recycler.getCompanyId();
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
RecycleOrder recycleOrder = new RecycleOrder();
|
|
|
|
|
recycleOrder.setRecycleStationId(recycler.getStationId());
|
|
|
|
@ -270,7 +271,7 @@ public class RecycleOrderServiceImpl extends ServiceImpl<RecycleOrderMapper, Rec
|
|
|
|
|
recycleOrder.setOrderStatus(OrderStatusEnum.FINISHED); // 直接完成
|
|
|
|
|
recycleOrder.setCreatorTime(now);
|
|
|
|
|
recycleOrder.setCompleteTime(now); // 完成时间
|
|
|
|
|
this.saveRecycleOrder(recycleOrder, recycler.getCompanyId());
|
|
|
|
|
this.saveRecycleOrder(recycleOrder, enterpriseId);
|
|
|
|
|
|
|
|
|
|
// 创建订单明细
|
|
|
|
|
String orderId = recycleOrder.getId();
|
|
|
|
@ -280,7 +281,7 @@ public class RecycleOrderServiceImpl extends ServiceImpl<RecycleOrderMapper, Rec
|
|
|
|
|
rp.setRecycleOrderId(orderId);
|
|
|
|
|
rp.setCreatorTime(now);
|
|
|
|
|
rp.setUpdateTime(now);
|
|
|
|
|
PriceProduct latestPriceProduct = this.recycleOrderProductService.getLatestPriceProduct(rp.getProductId());
|
|
|
|
|
PriceProduct latestPriceProduct = this.recycleOrderProductService.getLatestPriceProduct(rp.getProductId(), enterpriseId);
|
|
|
|
|
log.info("latest price product: {}", latestPriceProduct);
|
|
|
|
|
if (ObjectUtil.isEmpty(latestPriceProduct)) {
|
|
|
|
|
throw new BusinessLogicException("产品价格信息未公布,请联系商户!");
|
|
|
|
@ -403,9 +404,10 @@ public class RecycleOrderServiceImpl extends ServiceImpl<RecycleOrderMapper, Rec
|
|
|
|
|
// 更新订单明细信息
|
|
|
|
|
List<RecycleOrderDetailUpdateVO> recycleOrderProductVOList = orderFinishVO.getOrderDetails();
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
String enterpriseId = recycleOrder.getCompanyId();
|
|
|
|
|
recycleOrderProductVOList.forEach(rp -> {
|
|
|
|
|
rp.setUpdateTime(now);
|
|
|
|
|
PriceProduct latestPriceProduct = this.recycleOrderProductService.getLatestPriceProduct(rp.getProductId());
|
|
|
|
|
PriceProduct latestPriceProduct = this.recycleOrderProductService.getLatestPriceProduct(rp.getProductId(), enterpriseId);
|
|
|
|
|
log.info("latest price product: {}", latestPriceProduct);
|
|
|
|
|
if (ObjectUtil.isEmpty(latestPriceProduct)) {
|
|
|
|
|
throw new BusinessLogicException("产品价格信息未公布,请联系商户!");
|
|
|
|
@ -462,11 +464,12 @@ public class RecycleOrderServiceImpl extends ServiceImpl<RecycleOrderMapper, Rec
|
|
|
|
|
List<RecycleOrderDetailSaveVO> recycleOrderProductVOList = tmOrderFinishVO.getOrderDetails();
|
|
|
|
|
List<RecycleOrderProduct> recycleOrderProducts = BeanUtils.copyList(recycleOrderProductVOList, RecycleOrderProduct.class);
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
String enterpriseId = recycleOrder.getCompanyId();
|
|
|
|
|
recycleOrderProducts.forEach(rp -> {
|
|
|
|
|
rp.setRecycleOrderId(orderId);
|
|
|
|
|
rp.setCreatorTime(now);
|
|
|
|
|
rp.setUpdateTime(now);
|
|
|
|
|
PriceProduct latestPriceProduct = this.recycleOrderProductService.getLatestPriceProduct(rp.getProductId());
|
|
|
|
|
PriceProduct latestPriceProduct = this.recycleOrderProductService.getLatestPriceProduct(rp.getProductId(), enterpriseId);
|
|
|
|
|
log.info("latest price product: {}", latestPriceProduct);
|
|
|
|
|
if (ObjectUtil.isEmpty(latestPriceProduct)) {
|
|
|
|
|
throw new BusinessLogicException("产品价格信息未公布,请联系商户!");
|
|
|
|
|