This commit is contained in:
parent
d96ce38b1c
commit
309ee07859
|
|
@ -189,8 +189,6 @@ public class OrderInfo extends BaseEntity
|
||||||
orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY));
|
orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY));
|
||||||
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
|
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
|
||||||
orderInfo.setUserId(param.getUserId());
|
orderInfo.setUserId(param.getUserId());
|
||||||
orderInfo.setPayableAmount(param.getPayableAmount());
|
|
||||||
orderInfo.setRealAmount(param.getRealAmount());
|
|
||||||
orderInfo.setSourceType(param.getSourceType());
|
orderInfo.setSourceType(param.getSourceType());
|
||||||
orderInfo.setCreateBy(SecurityUtils.getUsername());
|
orderInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
orderInfo.setCreateTime(DateUtils.getNowDate());
|
orderInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
|
|
@ -210,7 +208,6 @@ public class OrderInfo extends BaseEntity
|
||||||
orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey());
|
orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey());
|
||||||
orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey());
|
orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey());
|
||||||
orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey());
|
orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey());
|
||||||
orderInfo.setPayType(param.getPayType());
|
|
||||||
orderInfo.setPayChannel(PayChannelEnum.ACC.getKey());
|
orderInfo.setPayChannel(PayChannelEnum.ACC.getKey());
|
||||||
orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
|
orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
|
||||||
orderInfo.setDeliveryAmount(BigDecimal.ZERO);
|
orderInfo.setDeliveryAmount(BigDecimal.ZERO);
|
||||||
|
|
@ -286,14 +283,11 @@ public class OrderInfo extends BaseEntity
|
||||||
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
|
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
|
||||||
orderInfo.setIdentityVerification(orderInfoAddParam.getIdentityVerification());
|
orderInfo.setIdentityVerification(orderInfoAddParam.getIdentityVerification());
|
||||||
orderInfo.setUserId(param.getUserId());
|
orderInfo.setUserId(param.getUserId());
|
||||||
orderInfo.setPayableAmount(param.getPayableAmount());
|
|
||||||
orderInfo.setRealAmount(param.getRealAmount());
|
|
||||||
orderInfo.setSourceType(param.getSourceType());
|
orderInfo.setSourceType(param.getSourceType());
|
||||||
orderInfo.setCreateBy(SecurityUtils.getUsername());
|
orderInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
orderInfo.setCreateTime(DateUtils.getNowDate());
|
orderInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
orderInfo.setUpdateBy(SecurityUtils.getUsername());
|
orderInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||||
orderInfo.setUpdateTime(DateUtils.getNowDate());
|
orderInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
orderInfo.setPayType(param.getPayType());
|
|
||||||
Long canteenId = orderInfoAddParam.getCanteenId();
|
Long canteenId = orderInfoAddParam.getCanteenId();
|
||||||
orderInfo.setCanteenId(Objects.isNull(canteenId) ? -1 : canteenId);
|
orderInfo.setCanteenId(Objects.isNull(canteenId) ? -1 : canteenId);
|
||||||
Long stallId = orderInfoAddParam.getStallId();
|
Long stallId = orderInfoAddParam.getStallId();
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,6 @@ public class ShopOrderAddParam {
|
||||||
orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY));
|
orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY));
|
||||||
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
|
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
|
||||||
orderInfo.setUserId(param.getUserId());
|
orderInfo.setUserId(param.getUserId());
|
||||||
orderInfo.setPayableAmount(param.getPayableAmount());
|
|
||||||
orderInfo.setRealAmount(param.getRealAmount());
|
|
||||||
orderInfo.setSourceType(param.getSourceType());
|
orderInfo.setSourceType(param.getSourceType());
|
||||||
orderInfo.setCreateBy(SecurityUtils.getUsername());
|
orderInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
orderInfo.setCreateTime(DateUtils.getNowDate());
|
orderInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
|
|
@ -76,7 +74,6 @@ public class ShopOrderAddParam {
|
||||||
orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey());
|
orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey());
|
||||||
orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey());
|
orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey());
|
||||||
orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey());
|
orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey());
|
||||||
orderInfo.setPayType(param.getPayType());
|
|
||||||
orderInfo.setPayChannel(PayChannelEnum.ACC.getKey());
|
orderInfo.setPayChannel(PayChannelEnum.ACC.getKey());
|
||||||
orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
|
orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
|
||||||
orderInfo.setDeliveryAmount(BigDecimal.ZERO);
|
orderInfo.setDeliveryAmount(BigDecimal.ZERO);
|
||||||
|
|
@ -86,7 +83,7 @@ public class ShopOrderAddParam {
|
||||||
orderInfo.setOrderTime(DateUtils.getNowDate());
|
orderInfo.setOrderTime(DateUtils.getNowDate());
|
||||||
orderInfo.setExternalPayAmount(BigDecimal.ZERO);
|
orderInfo.setExternalPayAmount(BigDecimal.ZERO);
|
||||||
orderInfo.setRefundAmount(BigDecimal.ZERO);
|
orderInfo.setRefundAmount(BigDecimal.ZERO);
|
||||||
orderInfo.setPayableAmount(param.getRealAmount());
|
orderInfo.setPayableAmount(param.getPayableAmount());
|
||||||
orderInfo.setDiscountsAmount(BigDecimal.ZERO);
|
orderInfo.setDiscountsAmount(BigDecimal.ZERO);
|
||||||
orderInfo.setRealAmount(param.getRealAmount());
|
orderInfo.setRealAmount(param.getRealAmount());
|
||||||
orderInfo.setAccountPayAmount(param.getRealAmount());
|
orderInfo.setAccountPayAmount(param.getRealAmount());
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||||
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
|
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
|
||||||
accInfoService.checkAccStatus(accInfoVO);
|
accInfoService.checkAccStatus(accInfoVO);
|
||||||
List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam);
|
List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam);
|
||||||
|
checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount());
|
||||||
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList);
|
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList);
|
||||||
orderPay(orderInfoList);
|
orderPay(orderInfoList);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -154,6 +155,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||||
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
|
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
|
||||||
accInfoService.checkAccStatus(accInfoVO);
|
accInfoService.checkAccStatus(accInfoVO);
|
||||||
List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam);
|
List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam);
|
||||||
|
checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount());
|
||||||
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList);
|
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList);
|
||||||
orderPay(orderInfoList);
|
orderPay(orderInfoList);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -291,6 +293,18 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||||
return orderPayDTO;
|
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("订单金额有误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改订单
|
* 修改订单
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue