...
|
...
|
@@ -388,8 +388,8 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { |
|
|
|
|
|
// 处罚保证金:总账修改
|
|
|
// 卖家取消、鉴定失败
|
|
|
public SellerWallet punishEarnest(Integer uid, BigDecimal money, MerchantOrderAttachInfo attach, SellerWalletDetail.Type type) {
|
|
|
return changeEarnest(uid, money, 0L, attach, type);
|
|
|
public SellerWallet punishEarnest(Integer uid, BigDecimal money, MerchantOrderAttachInfo attach, long orderCode, SellerWalletDetail.Type type) {
|
|
|
return changeEarnest(uid, money, orderCode, attach, type);
|
|
|
}
|
|
|
|
|
|
// 支付保证金:明细记录+orders_pay记录
|
...
|
...
|
@@ -455,6 +455,16 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { |
|
|
return null;
|
|
|
}
|
|
|
|
|
|
//////////////////////////////////////
|
|
|
// 核算总账
|
|
|
BigDecimal checkMoney = checkMoney(sw,0);
|
|
|
if (checkMoney == null) {
|
|
|
logger.info("uid={}退出入驻账目简要核对,结果失败", uid);
|
|
|
return null;
|
|
|
}
|
|
|
// 查询充值表,查询明细表
|
|
|
//////////////////////////////////////
|
|
|
|
|
|
sw.setUpdateTime(TimeUtils.getTimeStampSecond());
|
|
|
if (sellerWalletMapper.returnMoney(sw) == 0) {
|
|
|
logger.error("退还所有证金失败,更新表返回0,uid={}", uid);
|
...
|
...
|
@@ -482,6 +492,40 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { |
|
|
return amount;
|
|
|
}
|
|
|
|
|
|
private BigDecimal checkMoney(SellerWallet sw, Integer uid0) {
|
|
|
if(sw==null) {
|
|
|
sw = sellerWalletMapper.selectByUidAndType(uid0, 1);
|
|
|
}
|
|
|
Integer uid = sw.getUid();
|
|
|
logger.info("uid={}退出入驻账目简要核对", uid);
|
|
|
logger.info("uid={}退出入驻账目简要核对,保证金余额={},锁定余额={}", uid, sw.getAmount(), sw.getLockAmount());
|
|
|
if (sw.getLockAmount().compareTo(BigDecimal.ZERO) != 0) {
|
|
|
logger.error("uid={}退出入驻账目简要核对,锁定余额{}不为0", uid, sw.getLockAmount());
|
|
|
return null;
|
|
|
}
|
|
|
EntrySellerRechargeOrder recharge = entrySellerRechargeOrderMapper.selectAllRechargeByUid(uid);
|
|
|
if (recharge == null) {
|
|
|
logger.error("uid={}退出入驻账目简要核对,未找到充值订单");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
BigDecimal allMoney = recharge.getAmount();
|
|
|
logger.info("uid={}退出入驻账目简要核对,保证金充值总额为={}", uid, recharge.getAmount());
|
|
|
SellerWalletDetail punish = sellerWalletDetailMapper.selectUserPunishAmount(uid);
|
|
|
if (punish != null) {
|
|
|
logger.info("uid={}退出入驻账目简要核对,处罚总额为={}", uid, punish.getAmount().abs());
|
|
|
allMoney = allMoney.subtract(punish.getAmount().abs());
|
|
|
} else {
|
|
|
logger.info("uid={}退出入驻账目简要核对,无处罚记录", uid);
|
|
|
}
|
|
|
if (allMoney.compareTo(sw.getAmount()) != 0) {
|
|
|
logger.error("uid={}退出入驻账目简要核对,总账-处罚={},与余额{}不一致", uid, allMoney, sw.getAmount());
|
|
|
return null;
|
|
|
}
|
|
|
logger.info("uid={}退出入驻账目简要核对,保证金余额={},核对成功", uid, sw.getAmount());
|
|
|
return sw.getAmount();
|
|
|
}
|
|
|
|
|
|
// 增加:明细
|
|
|
private SellerWalletDetail addWalletDetail(SellerWallet sw, long orderCode, BigDecimal amount, SellerWalletDetail.Type type) {
|
|
|
Integer uid = sw.getUid();
|
...
|
...
|
|