傅行帆 5 年之前
父節點
當前提交
5a09f6ef5a

+ 5
- 0
src/main/java/com/huiju/estateagents/common/CommConstant.java 查看文件

@@ -678,6 +678,11 @@ public class CommConstant {
678 678
      */
679 679
     public static final String PAY_STATUS_REFUNDED = "refunded";
680 680
 
681
+    /**
682
+     * 退款异常
683
+     */
684
+    public static final String PAY_STATUS_CHANGE = "change";
685
+
681 686
 
682 687
     /**
683 688
      * 已经取消支付

+ 25
- 4
src/main/java/com/huiju/estateagents/service/impl/WxPayServiceImpl.java 查看文件

@@ -198,18 +198,39 @@ public class WxPayServiceImpl implements IWxPayService {
198 198
         log.info("更新订单{}状态为退款",orderInfo.get("transaction_id"));
199 199
         //更新订单状态为退款
200 200
         String transactionId = orderInfo.get("transaction_id");
201
+        Integer raiseRecordId;
202
+        String personId;
201 203
         List<TaOrder> orderList = taOrderMapper.selectList(new QueryWrapper<TaOrder>().eq("transaction_id", transactionId));
202 204
         orderList.forEach(e -> {
203
-            e.setPayStatus(CommConstant.PAY_STATUS_REFUNDED);
205
+            if (orderInfo.get("refund_status").equals(WXPayConstants.SUCCESS)){
206
+                e.setPayStatus(CommConstant.PAY_STATUS_REFUNDED);
207
+            }
208
+            if (!orderInfo.get("refund_status").equals(WXPayConstants.SUCCESS)){
209
+                e.setPayStatus(CommConstant.PAY_STATUS_CHANGE);
210
+            }
211
+
204 212
             if (null != e.getParentOrderId()){
213
+
205 214
                 //更新认筹单为退款
206 215
                 TaRaiseRecord taRaiseRecord = taRaiseRecordMapper.selectOne(new QueryWrapper<TaRaiseRecord>().eq("order_id", e.getParentOrderId()));
207
-                taRaiseRecord.setPayStatus(CommConstant.PAY_STATUS_REFUNDED);
216
+                if (orderInfo.get("refund_status").equals(WXPayConstants.SUCCESS)){
217
+                    taRaiseRecord.setPayStatus(CommConstant.PAY_STATUS_REFUNDED);
218
+                }
219
+                if (!orderInfo.get("refund_status").equals(WXPayConstants.SUCCESS)){
220
+                    taRaiseRecord.setPayStatus(CommConstant.PAY_STATUS_CHANGE);
221
+                }
222
+
208 223
                 taRaiseRecordMapper.updateById(taRaiseRecord);
209 224
                 //更新退款时间
210 225
                 e.setPayTime(LocalDateTime.now());
211
-                //发送订阅消息
212
-                taRaiseRecordService.sendRaiseMsg(taRaiseRecord.getRaiseRecordId(),taRaiseRecord.getRaiseId(),"在线选房认筹通知","线上退费成功","点击详情查看认筹单","线上退费成功",false);
226
+                if (orderInfo.get("refund_status").equals(WXPayConstants.SUCCESS)){
227
+                    //发送订阅消息
228
+                    taRaiseRecordService.sendRaiseMsg(taRaiseRecord.getRaiseRecordId(),taRaiseRecord.getPersonId(),"在线选房认筹通知","线上退费成功","点击详情查看认筹单","线上退费成功",false);
229
+                }
230
+                if (!orderInfo.get("refund_status").equals(WXPayConstants.SUCCESS)){
231
+                    //发送订阅消息
232
+                    taRaiseRecordService.sendRaiseMsg(taRaiseRecord.getRaiseRecordId(),taRaiseRecord.getPersonId(),"在线选房认筹通知","线上退费失败","点击详情查看认筹单","请联系置业顾问",false);
233
+                }
213 234
             }
214 235
             taOrderMapper.updateById(e);
215 236
         });