|
@@ -119,7 +119,6 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
119
|
119
|
IPage<TaOrgOrder> result = pg;
|
120
|
120
|
|
121
|
121
|
if (CommConstant.ITEM_TYPE_RECHARGE.equals(orderType) || CommConstant.ITEM_TYPE_REFUND.equals(orderType)) {
|
122
|
|
- List<String> urlList = new ArrayList<>();
|
123
|
122
|
result = taOrgOrderMapper.orderListByRechargeOrRefund(pg, orderType, orgId, tradeNo, isOffline, tradingStatus, startDate, endDate, miniAppName, auditStatus, payStartDate, payEndDate);
|
124
|
123
|
result.getRecords().forEach(e -> {
|
125
|
124
|
e.setCertificateUrlList(getCertificateByOrderId(e.getOrderId()));
|
|
@@ -346,7 +345,17 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
346
|
345
|
return responseBean;
|
347
|
346
|
}
|
348
|
347
|
|
349
|
|
- // 4.创建账户退款申请表信息
|
|
348
|
+ // 4.创建冻结表数据
|
|
349
|
+ TaOrgAccountBlocked taOrgAccountBlocked = new TaOrgAccountBlocked();
|
|
350
|
+ taOrgAccountBlocked.setAccountId(taOrgAccount.getAccountId());
|
|
351
|
+ taOrgAccountBlocked.setBlockedBalance(amount);
|
|
352
|
+ taOrgAccountBlocked.setBlockedReason("线上退款申请");
|
|
353
|
+ taOrgAccountBlocked.setCreateDate(LocalDateTime.now());
|
|
354
|
+ taOrgAccountBlocked.setStatus(CommConstant.STATUS_NORMAL);
|
|
355
|
+ taOrgAccountBlocked.setOrgId(orgId);
|
|
356
|
+ taOrgAccountBlockedMapper.insert(taOrgAccountBlocked);
|
|
357
|
+
|
|
358
|
+ // 5.创建账户退款申请表信息
|
350
|
359
|
TaOrgRefundApplication taOrgRefundApplication = new TaOrgRefundApplication();
|
351
|
360
|
taOrgRefundApplication.setOrgId(orgId);
|
352
|
361
|
taOrgRefundApplication.setUserId(userId);
|
|
@@ -355,6 +364,7 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
355
|
364
|
taOrgRefundApplication.setAuditStatus(CommConstant.CHECK_STATUS_CHECKING);
|
356
|
365
|
taOrgRefundApplication.setOrderId(taOrgOrder.getOrderId());
|
357
|
366
|
taOrgRefundApplication.setStatus(CommConstant.STATUS_NORMAL);
|
|
367
|
+ taOrgRefundApplication.setBlockedId(taOrgAccountBlocked.getSerialNo());
|
358
|
368
|
taOrgRefundApplication.setCreateDate(LocalDateTime.now());
|
359
|
369
|
taOrgRefundApplication.setReason("线上申请退款");
|
360
|
370
|
if (taOrgRefundApplicationMapper.insert(taOrgRefundApplication) < 1) {
|
|
@@ -364,15 +374,7 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
364
|
374
|
return responseBean;
|
365
|
375
|
}
|
366
|
376
|
|
367
|
|
- // 5.创建冻结表数据
|
368
|
|
- TaOrgAccountBlocked taOrgAccountBlocked = new TaOrgAccountBlocked();
|
369
|
|
- taOrgAccountBlocked.setAccountId(taOrgAccount.getAccountId());
|
370
|
|
- taOrgAccountBlocked.setBlockedBalance(amount);
|
371
|
|
- taOrgAccountBlocked.setBlockedReason("线上退款申请");
|
372
|
|
- taOrgAccountBlocked.setCreateDate(LocalDateTime.now());
|
373
|
|
- taOrgAccountBlocked.setStatus(CommConstant.STATUS_NORMAL);
|
374
|
|
- taOrgAccountBlocked.setOrgId(orgId);
|
375
|
|
- taOrgAccountBlockedMapper.insert(taOrgAccountBlocked);
|
|
377
|
+
|
376
|
378
|
|
377
|
379
|
// 6.更新账户新金额
|
378
|
380
|
taOrgAccountMapper.updateAvailableBalanceById(taOrgAccount.getAccountId(), amount);
|
|
@@ -545,13 +547,16 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
545
|
547
|
taOrgAccountDetailedListMapper.insert(taOrgAccountDetailedList);
|
546
|
548
|
|
547
|
549
|
//更新账户退款申请
|
|
550
|
+ TaOrgRefundApplication selectRefundApplication = selectRefundApplication(id);
|
|
551
|
+
|
548
|
552
|
TaOrgRefundApplication updateRefundApplication = assembleRefundApplication(userId, CommConstant.ITEM_TYPE_REFUND, refundApplication);
|
549
|
553
|
QueryWrapper<TaOrgRefundApplication> taOrgRefundApplicationQueryWrapper = new QueryWrapper<>();
|
550
|
554
|
taOrgRefundApplicationQueryWrapper.eq("order_id", id);
|
|
555
|
+ taOrgRefundApplicationQueryWrapper.eq("blocked_id", selectRefundApplication.getBlockedId());
|
551
|
556
|
taOrgRefundApplicationMapper.update(updateRefundApplication, taOrgRefundApplicationQueryWrapper);
|
552
|
557
|
|
553
|
558
|
//更新账户冻结记录
|
554
|
|
- updateOrgAccountBlock(refundApplication);
|
|
559
|
+ updateOrgAccountBlock(refundApplication, selectRefundApplication.getBlockedId());
|
555
|
560
|
|
556
|
561
|
//插入凭证记录
|
557
|
562
|
if (CollectionUtils.isNotEmpty(refundApplication.getCertificateList())) {
|
|
@@ -574,15 +579,17 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
574
|
579
|
TaOrgAccount taOrgAccount = assembleRefundAccount(refundApplication.getOrgId(), refundApplication, CommConstant.ITEM_TYPE_REJECT);
|
575
|
580
|
taOrgAccountMapper.updateById(taOrgAccount);
|
576
|
581
|
|
577
|
|
- //更新账户冻结记录
|
578
|
|
- int taOrgAccountBlockedUpdateResult = updateOrgAccountBlock(refundApplication);
|
579
|
|
-
|
580
|
582
|
//更新退款申请记录
|
|
583
|
+ TaOrgRefundApplication selectRefundApplication = selectRefundApplication(id);
|
|
584
|
+
|
581
|
585
|
TaOrgRefundApplication updateRefundApplication = assembleRefundApplication(userId, CommConstant.ITEM_TYPE_REJECT, refundApplication);
|
582
|
586
|
QueryWrapper<TaOrgRefundApplication> taOrgRefundApplicationQueryWrapper = new QueryWrapper<>();
|
583
|
587
|
taOrgRefundApplicationQueryWrapper.eq("order_id", id);
|
584
|
588
|
int taOrgRefundApplicationUpdateResult = taOrgRefundApplicationMapper.update(updateRefundApplication, taOrgRefundApplicationQueryWrapper);
|
585
|
589
|
|
|
590
|
+ //更新账户冻结记录
|
|
591
|
+ int taOrgAccountBlockedUpdateResult = updateOrgAccountBlock(refundApplication, selectRefundApplication.getBlockedId());
|
|
592
|
+
|
586
|
593
|
//更新订单状态
|
587
|
594
|
TaOrgOrder taOrgOrder = new TaOrgOrder();
|
588
|
595
|
taOrgOrder.setOrderId(id);
|
|
@@ -614,13 +621,13 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
614
|
621
|
rechargeAccount.setAccountId(selectOneAccount.getAccountId());
|
615
|
622
|
|
616
|
623
|
if (CommConstant.ITEM_TYPE_REFUND.equals(operateType)) {
|
617
|
|
- TaOrgRefundApplication taOrgRefundApplication = selectRefundApplication(refundApplication);
|
|
624
|
+ TaOrgRefundApplication taOrgRefundApplication = selectRefundApplication(refundApplication.getOrderId());
|
618
|
625
|
rechargeAccount.setRealBalance(selectOneAccount.getRealBalance() - taOrgRefundApplication.getAmount());
|
619
|
626
|
rechargeAccount.setTotalRefund(selectOneAccount.getTotalRefund() + taOrgRefundApplication.getAmount());
|
620
|
627
|
}
|
621
|
628
|
|
622
|
629
|
if (CommConstant.ITEM_TYPE_REJECT.equals(operateType)) {
|
623
|
|
- TaOrgRefundApplication taOrgRefundApplication = selectRefundApplication(refundApplication);
|
|
630
|
+ TaOrgRefundApplication taOrgRefundApplication = selectRefundApplication(refundApplication.getOrderId());
|
624
|
631
|
rechargeAccount.setAvailableBalance(selectOneAccount.getAvailableBalance() + taOrgRefundApplication.getAmount());
|
625
|
632
|
}
|
626
|
633
|
|
|
@@ -737,12 +744,13 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
737
|
744
|
return taOrgRefundApplication;
|
738
|
745
|
}
|
739
|
746
|
|
740
|
|
- private Integer updateOrgAccountBlock(TaOrgRefundApplication refundApplication) {
|
|
747
|
+ private Integer updateOrgAccountBlock(TaOrgRefundApplication refundApplication, Integer blockedId) {
|
741
|
748
|
//更新账户冻结记录
|
742
|
749
|
TaOrgAccountBlocked taOrgAccountBlocked = new TaOrgAccountBlocked();
|
743
|
750
|
taOrgAccountBlocked.setStatus(CommConstant.STATUS_UNACCALIMED);
|
744
|
751
|
QueryWrapper<TaOrgAccountBlocked> taOrgAccountBlockedQueryWrapper = new QueryWrapper<>();
|
745
|
752
|
taOrgAccountBlockedQueryWrapper.eq("org_id", refundApplication.getOrgId());
|
|
753
|
+ taOrgAccountBlockedQueryWrapper.eq("serial_no", blockedId);
|
746
|
754
|
return taOrgAccountBlockedMapper.update(taOrgAccountBlocked, taOrgAccountBlockedQueryWrapper);
|
747
|
755
|
}
|
748
|
756
|
|
|
@@ -767,9 +775,9 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
767
|
775
|
return sysUser;
|
768
|
776
|
}
|
769
|
777
|
|
770
|
|
- public TaOrgRefundApplication selectRefundApplication(TaOrgRefundApplication refundApplication) {
|
|
778
|
+ public TaOrgRefundApplication selectRefundApplication(String orderId) {
|
771
|
779
|
QueryWrapper<TaOrgRefundApplication> taOrgRefundApplicationQueryWrapper = new QueryWrapper<>();
|
772
|
|
- taOrgRefundApplicationQueryWrapper.eq("order_id", refundApplication.getOrderId());
|
|
780
|
+ taOrgRefundApplicationQueryWrapper.eq("order_id", orderId);
|
773
|
781
|
return taOrgRefundApplicationMapper.selectOne(taOrgRefundApplicationQueryWrapper);
|
774
|
782
|
}
|
775
|
783
|
|