From dfe1c8a124c71925e309285637d9b782469934ef Mon Sep 17 00:00:00 2001 From: 199901012 Date: Sat, 27 Mar 2021 01:09:39 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/HighCouponController.java | 2 +- .../cweb/controller/HighOrderController.java | 4 +--- .../hai/common/pay/util/SignatureUtil.java | 4 ++-- .../hai/common/pay/util/sdk/WXPayRequest.java | 2 +- .../service/impl/HighOrderServiceImpl.java | 5 +++++ .../pay/impl/GoodsOrderServiceImpl.java | 20 +++++++++++++++++++ 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java index c77cde84..801d78f7 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java @@ -451,7 +451,7 @@ public class HighCouponController { highCouponCode.setSalesCode(generateCode.couponSalesCode(coupon.getMerchantId(), couponId)); highCouponCode.setSalesEndTime(salesEndTimeC.getTime()); highCouponCode.setUseEndTime(useEndTimeC.getTime()); - highCouponCode.setStatus(1); // 状态:1.待销售 2.未使用 3.已使用 + highCouponCode.setStatus(1); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 highCouponCode.setCreateTime(new Date()); highCouponCode.setOperatorId(userInfoModel.getSecUser().getId()); highCouponCode.setOperatorName(userInfoModel.getSecUser().getUserName()); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index 2d83c68d..d93c6d86 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -71,9 +71,7 @@ public class HighOrderController { SessionObject sessionObject = userCenter.getSessionObject(request); HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); - if (highOrder.getPayModel() == null - || highOrder.getPayType() == null - || highOrder.getHighChildOrderList() == null + if (highOrder.getHighChildOrderList() == null || highOrder.getHighChildOrderList().size() == 0 ) { log.error("HighOrderController --> addOrder() error!", "参数错误"); diff --git a/hai-service/src/main/java/com/hai/common/pay/util/SignatureUtil.java b/hai-service/src/main/java/com/hai/common/pay/util/SignatureUtil.java index 522112f1..193fd85d 100644 --- a/hai-service/src/main/java/com/hai/common/pay/util/SignatureUtil.java +++ b/hai-service/src/main/java/com/hai/common/pay/util/SignatureUtil.java @@ -1,7 +1,7 @@ package com.hai.common.pay.util; -import com.shinwoten.train.common.pay.entity.WechatPayReturnParam; -import com.shinwoten.train.common.pay.entity.WechatReturn; +import com.hai.common.pay.entity.WechatPayReturnParam; +import com.hai.common.pay.entity.WechatReturn; import org.apache.commons.lang3.StringUtils; import org.dom4j.DocumentException; import org.slf4j.Logger; diff --git a/hai-service/src/main/java/com/hai/common/pay/util/sdk/WXPayRequest.java b/hai-service/src/main/java/com/hai/common/pay/util/sdk/WXPayRequest.java index 58a7baa4..9259e793 100644 --- a/hai-service/src/main/java/com/hai/common/pay/util/sdk/WXPayRequest.java +++ b/hai-service/src/main/java/com/hai/common/pay/util/sdk/WXPayRequest.java @@ -24,7 +24,7 @@ import java.net.UnknownHostException; import java.security.KeyStore; import java.security.SecureRandom; -import static com.shinwoten.train.common.pay.util.sdk.WXPayConstants.USER_AGENT; +import static com.hai.common.pay.util.sdk.WXPayConstants.USER_AGENT; public class WXPayRequest { private WXPayConfig config; diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 9094f5c5..fb2b9ed6 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -42,8 +42,13 @@ public class HighOrderServiceImpl implements HighOrderService { } @Override + @Transactional(propagation= Propagation.REQUIRES_NEW) public void updateOrder(HighOrder highOrder) { + highOrderMapper.updateByPrimaryKey(highOrder); + for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { + highChildOrderMapper.updateByPrimaryKey(childOrder); + } } @Override diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java index f43acae0..76116496 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java @@ -1,6 +1,10 @@ package com.hai.service.pay.impl; import com.alibaba.fastjson.JSONObject; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.entity.HighChildOrder; import com.hai.entity.HighOrder; import com.hai.service.HighOrderService; import com.hai.service.pay.PayService; @@ -9,6 +13,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; +import java.util.Date; import java.util.List; import java.util.Map; @@ -30,10 +35,25 @@ public class GoodsOrderServiceImpl implements PayService { return; } if (payType.equals("WechatPay")) { + // 查询订单信息 HighOrder order = highOrderService.getOrderByOrderNo(map.get("out_trade_no")); if (order == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, ""); + } + order.setPaySerialNo(map.get("transaction_id")); // 支付流水号 + order.setPayRealPrice(new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100"))); // 实付金额 + order.setPayTime(new Date()); // 支付时间 + order.setPayModel(2); // 支付模式:1 金币,2 第三方平台,3 混合 + order.setPayType(2); // 支付方式: 1:支付宝 2:微信 3:金币 + order.setOrderStatus(2); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 + for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { + highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 } + + highOrderService.updateOrder(order); + + } } }