|
@@ -211,7 +211,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|
|
BigDecimal amount = calcTotalAmount(orderItemList);
|
|
|
if (!StringUtil.isEmpty(orderParam.getCouponId())) {
|
|
|
Map data = feignMecCouponAmount(orderParam.getCouponId(), amount);
|
|
|
- couponAmount = MapUtil.get(data, "mallCouponAmount", BigDecimal.class);
|
|
|
+ couponAmount = new BigDecimal(MapUtil.get(data, "mallCouponAmount", String.class));
|
|
|
}
|
|
|
if (couponAmount == null) {
|
|
|
couponAmount = BigDecimal.ZERO;
|
|
@@ -236,8 +236,8 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|
|
// if(data != null) {
|
|
|
// couponAmount = data.getDiscountedPrices();
|
|
|
// }
|
|
|
- if (couponAmount.compareTo(orderParam.getOrderAmount()) > 0) {
|
|
|
- couponAmount = orderParam.getOrderAmount();
|
|
|
+ if (couponAmount.compareTo(amount) > 0) {
|
|
|
+ couponAmount = amount;
|
|
|
}
|
|
|
handleCouponAmount(orderItemList, couponAmount);
|
|
|
}
|
|
@@ -413,17 +413,28 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|
|
userOrderPaymentService.saveOrUpdate(userOrderPayment);
|
|
|
}
|
|
|
// 记录余额支付金额
|
|
|
- BigDecimal balanceAmount1 = MapUtil.get(data, "balanceAmount", BigDecimal.class);
|
|
|
- if (BigDecimal.ZERO.compareTo(balanceAmount1) !=0 ) {
|
|
|
- order.setIntegrationAmount(balanceAmount1);
|
|
|
- order.setPayAmount(orderParam.getOrderAmount().subtract(balanceAmount1));
|
|
|
- orderMapper.updateByPrimaryKey(order);
|
|
|
+ String balanceAmount1 = MapUtil.get(data, "balanceAmount", String.class);
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(balanceAmount1);
|
|
|
+ if (BigDecimal.ZERO.compareTo(bigDecimal) !=0 ) {
|
|
|
+ order.setIntegrationAmount(bigDecimal);
|
|
|
+ order.setPayAmount(order.getPayAmount().subtract(bigDecimal));
|
|
|
+ orderMapper.updateByPrimaryKeySelective(order);
|
|
|
+
|
|
|
+ updateOrderDetail(order, userOrderPayment);
|
|
|
}
|
|
|
result.put("pay",data);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private void updateOrderDetail(OmsOrder order, UserOrderPayment userOrderPayment) {
|
|
|
+ OmsOrderDetail detail = detail(order.getOrderSn());
|
|
|
+ MallCreateOrderModel model = new MallCreateOrderModel();
|
|
|
+ model.setOrderNo(userOrderPayment.getAdapayNo());
|
|
|
+ model.setOrderInfo(JSON.toJSONString(detail));
|
|
|
+ webFeignService.mallSaveOrderInfo(model);
|
|
|
+ }
|
|
|
+
|
|
|
private Map feignMecCouponAmount(String couponId,BigDecimal amount) {
|
|
|
|
|
|
MallCreateOrderModel model = new MallCreateOrderModel();
|