This commit is contained in:
gaowdong 2025-04-25 09:07:37 +08:00
parent d96ce38b1c
commit 309ee07859
3 changed files with 15 additions and 10 deletions

View File

@ -189,8 +189,6 @@ public class OrderInfo extends BaseEntity
orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY));
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
orderInfo.setUserId(param.getUserId());
orderInfo.setPayableAmount(param.getPayableAmount());
orderInfo.setRealAmount(param.getRealAmount());
orderInfo.setSourceType(param.getSourceType());
orderInfo.setCreateBy(SecurityUtils.getUsername());
orderInfo.setCreateTime(DateUtils.getNowDate());
@ -210,7 +208,6 @@ public class OrderInfo extends BaseEntity
orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey());
orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey());
orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey());
orderInfo.setPayType(param.getPayType());
orderInfo.setPayChannel(PayChannelEnum.ACC.getKey());
orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
orderInfo.setDeliveryAmount(BigDecimal.ZERO);
@ -286,14 +283,11 @@ public class OrderInfo extends BaseEntity
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
orderInfo.setIdentityVerification(orderInfoAddParam.getIdentityVerification());
orderInfo.setUserId(param.getUserId());
orderInfo.setPayableAmount(param.getPayableAmount());
orderInfo.setRealAmount(param.getRealAmount());
orderInfo.setSourceType(param.getSourceType());
orderInfo.setCreateBy(SecurityUtils.getUsername());
orderInfo.setCreateTime(DateUtils.getNowDate());
orderInfo.setUpdateBy(SecurityUtils.getUsername());
orderInfo.setUpdateTime(DateUtils.getNowDate());
orderInfo.setPayType(param.getPayType());
Long canteenId = orderInfoAddParam.getCanteenId();
orderInfo.setCanteenId(Objects.isNull(canteenId) ? -1 : canteenId);
Long stallId = orderInfoAddParam.getStallId();

View File

@ -62,8 +62,6 @@ public class ShopOrderAddParam {
orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY));
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
orderInfo.setUserId(param.getUserId());
orderInfo.setPayableAmount(param.getPayableAmount());
orderInfo.setRealAmount(param.getRealAmount());
orderInfo.setSourceType(param.getSourceType());
orderInfo.setCreateBy(SecurityUtils.getUsername());
orderInfo.setCreateTime(DateUtils.getNowDate());
@ -76,7 +74,6 @@ public class ShopOrderAddParam {
orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey());
orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey());
orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey());
orderInfo.setPayType(param.getPayType());
orderInfo.setPayChannel(PayChannelEnum.ACC.getKey());
orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
orderInfo.setDeliveryAmount(BigDecimal.ZERO);
@ -86,7 +83,7 @@ public class ShopOrderAddParam {
orderInfo.setOrderTime(DateUtils.getNowDate());
orderInfo.setExternalPayAmount(BigDecimal.ZERO);
orderInfo.setRefundAmount(BigDecimal.ZERO);
orderInfo.setPayableAmount(param.getRealAmount());
orderInfo.setPayableAmount(param.getPayableAmount());
orderInfo.setDiscountsAmount(BigDecimal.ZERO);
orderInfo.setRealAmount(param.getRealAmount());
orderInfo.setAccountPayAmount(param.getRealAmount());

View File

@ -139,6 +139,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
accInfoService.checkAccStatus(accInfoVO);
List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam);
checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount());
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList);
orderPay(orderInfoList);
return 1;
@ -154,6 +155,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
accInfoService.checkAccStatus(accInfoVO);
List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam);
checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount());
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList);
orderPay(orderInfoList);
return 1;
@ -291,6 +293,18 @@ public class OrderInfoServiceImpl implements IOrderInfoService
return orderPayDTO;
}
private void checkOrdersTotalAmount(List<OrderInfo> orderInfoList ,BigDecimal totalAmountParam) {
BigDecimal totalAmount = BigDecimal.ZERO;
if(CollUtil.isNotEmpty(orderInfoList)) {
totalAmount = orderInfoList.stream()
.map(OrderInfo::getRealAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
if(totalAmount.compareTo(totalAmountParam) != 0) {
throw new ServiceException("订单金额有误");
}
}
/**
* 修改订单