|
@@ -107,9 +107,8 @@ public class SubmitServiceImpl implements SubmitService {
|
|
* "bankAccountNo": "987987465465464"
|
|
* "bankAccountNo": "987987465465464"
|
|
* }
|
|
* }
|
|
* }
|
|
* }
|
|
- * @return {code: -1=(用户账户异常,数据异常,操作异常等),1提交成功(支付完成),2提交成功(未支付),
|
|
|
|
- * code为1和2时:data{orderNo:订单号,orderId:订单Id,payTotalFee:订单金额,orderMark:订单标识}
|
|
|
|
*/
|
|
*/
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
public ResponseJson<Map<String, Object>> generateOrder(SubmitDto submitDto) {
|
|
public ResponseJson<Map<String, Object>> generateOrder(SubmitDto submitDto) {
|
|
// 获取机构用户Id
|
|
// 获取机构用户Id
|
|
@@ -270,7 +269,6 @@ public class SubmitServiceImpl implements SubmitService {
|
|
return saveOrder(orderParamBo);
|
|
return saveOrder(orderParamBo);
|
|
}
|
|
}
|
|
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
public ResponseJson<Map<String, Object>> saveOrder(OrderParamBo orderParamBo) {
|
|
public ResponseJson<Map<String, Object>> saveOrder(OrderParamBo orderParamBo) {
|
|
log.info("******************** 提交订单逻辑处理 start *******************");
|
|
log.info("******************** 提交订单逻辑处理 start *******************");
|
|
/*
|
|
/*
|
|
@@ -576,6 +574,9 @@ public class SubmitServiceImpl implements SubmitService {
|
|
promotionPrice.setProductId(productId);
|
|
promotionPrice.setProductId(productId);
|
|
promotionPrice.setNumber(productNum);
|
|
promotionPrice.setNumber(productNum);
|
|
promotionPrice.setPrice(discountPrice);
|
|
promotionPrice.setPrice(discountPrice);
|
|
|
|
+ if (null == promotions.getProductList()){
|
|
|
|
+ promotions.setProductList(new ArrayList<>());
|
|
|
|
+ }
|
|
promotions.getProductList().add(promotionPrice);
|
|
promotions.getProductList().add(promotionPrice);
|
|
if (!promotionsIds.contains(promotions.getId())) {
|
|
if (!promotionsIds.contains(promotions.getId())) {
|
|
promotionsIds.add(promotions.getId());
|
|
promotionsIds.add(promotions.getId());
|
|
@@ -781,8 +782,6 @@ public class SubmitServiceImpl implements SubmitService {
|
|
couponAmount = coupon.getCouponAmount();
|
|
couponAmount = coupon.getCouponAmount();
|
|
}
|
|
}
|
|
mainOrder.setCouponAmount(couponAmount);
|
|
mainOrder.setCouponAmount(couponAmount);
|
|
- // 订单总额 = 商品费 - 优惠券金额
|
|
|
|
- payTotalFee.set(MathUtil.sub(productTotalFee.get(), couponAmount).doubleValue());
|
|
|
|
/*
|
|
/*
|
|
* 计算运费
|
|
* 计算运费
|
|
*/
|
|
*/
|
|
@@ -804,8 +803,11 @@ public class SubmitServiceImpl implements SubmitService {
|
|
// 运费标志:0包邮 -1到付 1遵循运费规则
|
|
// 运费标志:0包邮 -1到付 1遵循运费规则
|
|
mainOrder.setPostageFlag(orderParamBo.getPostageFlag());
|
|
mainOrder.setPostageFlag(orderParamBo.getPostageFlag());
|
|
if (1 == orderParamBo.getPostageFlag() && orderParamBo.getOffsetBeans() > 0) {
|
|
if (1 == orderParamBo.getPostageFlag() && orderParamBo.getOffsetBeans() > 0) {
|
|
- // 采美豆抵扣运费,订单总额 = 商品费
|
|
|
|
- payTotalFee.set(productTotalFee.get());
|
|
|
|
|
|
+ // 订单总额 = 商品费 - 优惠券金额
|
|
|
|
+ payTotalFee.set(MathUtil.sub(productTotalFee.get(), couponAmount).doubleValue());
|
|
|
|
+ } else {
|
|
|
|
+ // 订单总额 -= 优惠券金额
|
|
|
|
+ payTotalFee.set(MathUtil.sub(payTotalFee.get(), couponAmount).doubleValue());
|
|
}
|
|
}
|
|
// 商品总额
|
|
// 商品总额
|
|
mainOrder.setProductTotalFee(productTotalFee.get());
|
|
mainOrder.setProductTotalFee(productTotalFee.get());
|
|
@@ -861,6 +863,8 @@ public class SubmitServiceImpl implements SubmitService {
|
|
log.info("【提交订单】>>>>>更新用户余额,抵扣后剩余:[userMoney:" + lastUserMoney + "] ,ableUserMoney:" + lastAbleUserMoney);
|
|
log.info("【提交订单】>>>>>更新用户余额,抵扣后剩余:[userMoney:" + lastUserMoney + "] ,ableUserMoney:" + lastAbleUserMoney);
|
|
// 支付时间
|
|
// 支付时间
|
|
mainOrder.setPayTime(curDateStr);
|
|
mainOrder.setPayTime(curDateStr);
|
|
|
|
+ } else {
|
|
|
|
+ payableAmount.set(payTotalFee.get());
|
|
}
|
|
}
|
|
// 余额支付金额
|
|
// 余额支付金额
|
|
mainOrder.setBalancePayFee(balancePayFee.get());
|
|
mainOrder.setBalancePayFee(balancePayFee.get());
|
|
@@ -1260,11 +1264,14 @@ public class SubmitServiceImpl implements SubmitService {
|
|
info.put("payableAmount", mainOrder.getPayableAmount());
|
|
info.put("payableAmount", mainOrder.getPayableAmount());
|
|
if (isPaySuccessFlag) {
|
|
if (isPaySuccessFlag) {
|
|
// 1提交成功(支付完成)
|
|
// 1提交成功(支付完成)
|
|
- return ResponseJson.success(1,"提交成功且已支付完成!", info);
|
|
|
|
|
|
+ info.put("code", 1);
|
|
|
|
+ info.put("msg", "提交成功且已支付完成!");
|
|
} else {
|
|
} else {
|
|
//2提交成功(未支付)
|
|
//2提交成功(未支付)
|
|
- return ResponseJson.success(2,"提交成功但未支付!", info);
|
|
|
|
|
|
+ info.put("code", 2);
|
|
|
|
+ info.put("msg", "提交成功但未支付!");
|
|
}
|
|
}
|
|
|
|
+ return ResponseJson.success("操作成功!", info);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|