傅行帆 5 anni fa
parent
commit
5a09f6ef5a

+ 5
- 0
src/main/java/com/huiju/estateagents/common/CommConstant.java Vedi File

678
      */
678
      */
679
     public static final String PAY_STATUS_REFUNDED = "refunded";
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 Vedi File

198
         log.info("更新订单{}状态为退款",orderInfo.get("transaction_id"));
198
         log.info("更新订单{}状态为退款",orderInfo.get("transaction_id"));
199
         //更新订单状态为退款
199
         //更新订单状态为退款
200
         String transactionId = orderInfo.get("transaction_id");
200
         String transactionId = orderInfo.get("transaction_id");
201
+        Integer raiseRecordId;
202
+        String personId;
201
         List<TaOrder> orderList = taOrderMapper.selectList(new QueryWrapper<TaOrder>().eq("transaction_id", transactionId));
203
         List<TaOrder> orderList = taOrderMapper.selectList(new QueryWrapper<TaOrder>().eq("transaction_id", transactionId));
202
         orderList.forEach(e -> {
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
             if (null != e.getParentOrderId()){
212
             if (null != e.getParentOrderId()){
213
+
205
                 //更新认筹单为退款
214
                 //更新认筹单为退款
206
                 TaRaiseRecord taRaiseRecord = taRaiseRecordMapper.selectOne(new QueryWrapper<TaRaiseRecord>().eq("order_id", e.getParentOrderId()));
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
                 taRaiseRecordMapper.updateById(taRaiseRecord);
223
                 taRaiseRecordMapper.updateById(taRaiseRecord);
209
                 //更新退款时间
224
                 //更新退款时间
210
                 e.setPayTime(LocalDateTime.now());
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
             taOrderMapper.updateById(e);
235
             taOrderMapper.updateById(e);
215
         });
236
         });