|
@@ -388,8 +388,8 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { |
|
@@ -388,8 +388,8 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { |
388
|
|
388
|
|
389
|
// 处罚保证金:总账修改
|
389
|
// 处罚保证金:总账修改
|
390
|
// 卖家取消、鉴定失败
|
390
|
// 卖家取消、鉴定失败
|
391
|
- public SellerWallet punishEarnest(Integer uid, BigDecimal money, MerchantOrderAttachInfo attach, SellerWalletDetail.Type type) {
|
|
|
392
|
- return changeEarnest(uid, money, 0L, attach, type);
|
391
|
+ public SellerWallet punishEarnest(Integer uid, BigDecimal money, MerchantOrderAttachInfo attach, long orderCode, SellerWalletDetail.Type type) {
|
|
|
392
|
+ return changeEarnest(uid, money, orderCode, attach, type);
|
393
|
}
|
393
|
}
|
394
|
|
394
|
|
395
|
// 支付保证金:明细记录+orders_pay记录
|
395
|
// 支付保证金:明细记录+orders_pay记录
|
|
@@ -454,6 +454,16 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { |
|
@@ -454,6 +454,16 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { |
454
|
CommonAlarmEventPublisher.publish("退还所有保证金失败", "ufo.order.changeEarnest", "钱包不可用uid=" + uid+", 退还金额为:"+amount);
|
454
|
CommonAlarmEventPublisher.publish("退还所有保证金失败", "ufo.order.changeEarnest", "钱包不可用uid=" + uid+", 退还金额为:"+amount);
|
455
|
return null;
|
455
|
return null;
|
456
|
}
|
456
|
}
|
|
|
457
|
+
|
|
|
458
|
+ //////////////////////////////////////
|
|
|
459
|
+ // 核算总账
|
|
|
460
|
+ BigDecimal checkMoney = checkMoney(sw,0);
|
|
|
461
|
+ if (checkMoney == null) {
|
|
|
462
|
+ logger.info("uid={}退出入驻账目简要核对,结果失败", uid);
|
|
|
463
|
+ return null;
|
|
|
464
|
+ }
|
|
|
465
|
+ // 查询充值表,查询明细表
|
|
|
466
|
+ //////////////////////////////////////
|
457
|
|
467
|
|
458
|
sw.setUpdateTime(TimeUtils.getTimeStampSecond());
|
468
|
sw.setUpdateTime(TimeUtils.getTimeStampSecond());
|
459
|
if (sellerWalletMapper.returnMoney(sw) == 0) {
|
469
|
if (sellerWalletMapper.returnMoney(sw) == 0) {
|
|
@@ -482,6 +492,40 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { |
|
@@ -482,6 +492,40 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { |
482
|
return amount;
|
492
|
return amount;
|
483
|
}
|
493
|
}
|
484
|
|
494
|
|
|
|
495
|
+ private BigDecimal checkMoney(SellerWallet sw, Integer uid0) {
|
|
|
496
|
+ if(sw==null) {
|
|
|
497
|
+ sw = sellerWalletMapper.selectByUidAndType(uid0, 1);
|
|
|
498
|
+ }
|
|
|
499
|
+ Integer uid = sw.getUid();
|
|
|
500
|
+ logger.info("uid={}退出入驻账目简要核对", uid);
|
|
|
501
|
+ logger.info("uid={}退出入驻账目简要核对,保证金余额={},锁定余额={}", uid, sw.getAmount(), sw.getLockAmount());
|
|
|
502
|
+ if (sw.getLockAmount().compareTo(BigDecimal.ZERO) != 0) {
|
|
|
503
|
+ logger.error("uid={}退出入驻账目简要核对,锁定余额{}不为0", uid, sw.getLockAmount());
|
|
|
504
|
+ return null;
|
|
|
505
|
+ }
|
|
|
506
|
+ EntrySellerRechargeOrder recharge = entrySellerRechargeOrderMapper.selectAllRechargeByUid(uid);
|
|
|
507
|
+ if (recharge == null) {
|
|
|
508
|
+ logger.error("uid={}退出入驻账目简要核对,未找到充值订单");
|
|
|
509
|
+ return null;
|
|
|
510
|
+ }
|
|
|
511
|
+
|
|
|
512
|
+ BigDecimal allMoney = recharge.getAmount();
|
|
|
513
|
+ logger.info("uid={}退出入驻账目简要核对,保证金充值总额为={}", uid, recharge.getAmount());
|
|
|
514
|
+ SellerWalletDetail punish = sellerWalletDetailMapper.selectUserPunishAmount(uid);
|
|
|
515
|
+ if (punish != null) {
|
|
|
516
|
+ logger.info("uid={}退出入驻账目简要核对,处罚总额为={}", uid, punish.getAmount().abs());
|
|
|
517
|
+ allMoney = allMoney.subtract(punish.getAmount().abs());
|
|
|
518
|
+ } else {
|
|
|
519
|
+ logger.info("uid={}退出入驻账目简要核对,无处罚记录", uid);
|
|
|
520
|
+ }
|
|
|
521
|
+ if (allMoney.compareTo(sw.getAmount()) != 0) {
|
|
|
522
|
+ logger.error("uid={}退出入驻账目简要核对,总账-处罚={},与余额{}不一致", uid, allMoney, sw.getAmount());
|
|
|
523
|
+ return null;
|
|
|
524
|
+ }
|
|
|
525
|
+ logger.info("uid={}退出入驻账目简要核对,保证金余额={},核对成功", uid, sw.getAmount());
|
|
|
526
|
+ return sw.getAmount();
|
|
|
527
|
+ }
|
|
|
528
|
+
|
485
|
// 增加:明细
|
529
|
// 增加:明细
|
486
|
private SellerWalletDetail addWalletDetail(SellerWallet sw, long orderCode, BigDecimal amount, SellerWalletDetail.Type type) {
|
530
|
private SellerWalletDetail addWalletDetail(SellerWallet sw, long orderCode, BigDecimal amount, SellerWalletDetail.Type type) {
|
487
|
Integer uid = sw.getUid();
|
531
|
Integer uid = sw.getUid();
|