Browse Source

退款字段

qzyReal 2 years ago
parent
commit
e8764475b5

+ 10 - 7
sp-server/src/main/java/com/pj/api/wx/service/WxService.java

@@ -221,7 +221,7 @@ public class WxService {
             log.error("========订单不存在==========:{}", outTradeNo);
             return;
         }
-        String payopenid=tbOrder.getOpenid();
+        String payopenid = tbOrder.getOpenid();
         String total_fee = notifyBO.getTotalFee();
         BigDecimal money = new BigDecimal(total_fee).divide(new BigDecimal(100), 2, BigDecimal.ROUND_UP);
         String attachStr = tbOrder.getAttach();
@@ -242,7 +242,10 @@ public class WxService {
                     log.error("付款金额不正确:{}", JSONUtil.toJsonStr(notifyBO));
                     continue;
                 }
-                car.setPay(1).setMoney(price).setPayTime(payTime).setPayType(TbBusinessCar.PayTypeEnum.HAS_PAY_TYPE.getType());
+                car.setPay(1).setMoney(price).setPayTime(payTime)
+                        .setPayType(TbBusinessCar.PayTypeEnum.HAS_PAY_TYPE.getType())
+                        .setOutTradeNo(outTradeNo)
+                        .setPayOpenid(payopenid);
                 tbBusinessCarService.updateById(car);
                 //支付完之后要解绑
                 automaticPay.unbindRun(car.getCarNo());
@@ -253,14 +256,14 @@ public class WxService {
             if (StrUtil.isNotEmpty(businessId)) {
                 List<String> businessIds = StrUtil.splitTrim(businessId, ",");
                 List<TbBusiness> businessList = tbBusinessService.listByIds(businessIds);
-                businessList=businessList.stream().filter(tbBusiness -> tbBusiness.getPayStatus()!=TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode()).collect(Collectors.toList());
-                businessIds=businessList.stream().map(TbBusiness::getId).collect(Collectors.toList());
+                businessList = businessList.stream().filter(tbBusiness -> tbBusiness.getPayStatus() != TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode()).collect(Collectors.toList());
+                businessIds = businessList.stream().map(TbBusiness::getId).collect(Collectors.toList());
                 List<TbBusinessItem> items = tbBusinessItemService.findByBusinessIdList(businessIds);
-                items=items.stream().filter(item -> item.getPayStatus()==0).collect(Collectors.toList());
+                items = items.stream().filter(item -> item.getPayStatus() == 0).collect(Collectors.toList());
                 for (TbBusiness tbBusiness : businessList) {
-                    tbBusiness.setPayTime(payTime).setPayType(3).setConfirmInput(1).setConfirmInputTime(payTime)
+                    tbBusiness.setPayTime(payTime).setPayType(TbBusiness.PayType.WX_PAY.getCode()).setConfirmInput(1).setConfirmInputTime(payTime)
                             .setPayMoney(tbBusiness.getItemPrice()).setPayOpenid(payopenid)
-                            .setPayNo(transactionId);
+                            .setPayNo(transactionId).setOutTradeNo(outTradeNo);
                     tbBusiness.setPayStatus(TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode());
                     tbBusinessService.updateById(tbBusiness);
                     TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());

+ 4 - 1
sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java

@@ -292,7 +292,10 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
      * 微信支付用户
      */
     private String payOpenid;
-
+    /**
+     * 交易单号
+     */
+    private String outTradeNo;
 
 
 

+ 4 - 0
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCar.java

@@ -153,6 +153,10 @@ public class TbBusinessCar extends Model<TbBusinessCar> implements Serializable
      * 微信支付用户
      */
     private String payOpenid;
+    /**
+     * 交易单号
+     */
+    private String outTradeNo;
 
     @Getter
     @AllArgsConstructor