提交 17ba1b8f authored 作者: liruixin's avatar liruixin

Merge remote-tracking branch 'origin/v5.7_break_contract_reverse_20231020' into…

Merge remote-tracking branch 'origin/v5.7_break_contract_reverse_20231020' into v5.7_break_contract_reverse_20231020
...@@ -655,6 +655,8 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -655,6 +655,8 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
String ownerName = ""; String ownerName = "";
BigDecimal frozenBalance = param.getFrozenBalance(); BigDecimal frozenBalance = param.getFrozenBalance();
BigDecimal ensureBalance = param.getEnsureBalance(); BigDecimal ensureBalance = param.getEnsureBalance();
boolean ensureBalanceZeroFlag = false;
boolean frozenBalanceZeroFlag = false;
Integer orderId = param.getOrderId(); Integer orderId = param.getOrderId();
String orderNo = param.getOrderNo(); String orderNo = param.getOrderNo();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
...@@ -677,27 +679,38 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -677,27 +679,38 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
if (ownerAccount.getUsableBalance().compareTo(ensureBalance) < 0) { if (ownerAccount.getUsableBalance().compareTo(ensureBalance) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主保证金账户可用余额不够冻结"); throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主保证金账户可用余额不够冻结");
} }
//冻结金额 if (ensureBalance.compareTo(BigDecimal.ZERO) == 0) {
entity.setFrozenBalance(ensureBalance); flag += 1;
//可用余额 ensureBalanceZeroFlag = true;
entity.setUsableBalance(ensureBalance); } else {
//账户余额 //冻结金额
entity.setAccountBalance(BigDecimal.ZERO); entity.setFrozenBalance(ensureBalance);
//可用余额
entity.setUsableBalance(ensureBalance);
//账户余额
entity.setAccountBalance(BigDecimal.ZERO);
//updateList.add(entity);
flag += ownerAccountDao.updateAccountCAS(entity, now, false);
}
//updateList.add(entity);
flag += ownerAccountDao.updateAccountCAS(entity, now, false);
} else { } else {
if (ownerAccount.getUsableBalance().compareTo(frozenBalance) < 0) { if (ownerAccount.getUsableBalance().compareTo(frozenBalance) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主预付运费账户可用余额不够冻结"); throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主预付运费账户可用余额不够冻结");
} }
//冻结金额 if (frozenBalance.compareTo(BigDecimal.ZERO) == 0) {
entity.setFrozenBalance(frozenBalance); flag += 1;
//可用余额 frozenBalanceZeroFlag = true;
entity.setUsableBalance(frozenBalance); } else {
//账户余额 //冻结金额
entity.setAccountBalance(BigDecimal.ZERO); entity.setFrozenBalance(frozenBalance);
//updateList.add(entity); //可用余额
flag += ownerAccountDao.updateAccountCAS(entity, now, false); entity.setUsableBalance(frozenBalance);
//账户余额
entity.setAccountBalance(BigDecimal.ZERO);
//updateList.add(entity);
flag += ownerAccountDao.updateAccountCAS(entity, now, false);
}
} }
} }
if (flag == 2) { if (flag == 2) {
...@@ -707,6 +720,10 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -707,6 +720,10 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
for (OwnerAccount ownerAccount : accountList) { for (OwnerAccount ownerAccount : accountList) {
if (ownerAccount.getAccountType().equals(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode())) { if (ownerAccount.getAccountType().equals(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode())) {
log.info("插入保证金冻结流水"); log.info("插入保证金冻结流水");
if (ensureBalanceZeroFlag) {
log.info("保证金账户需冻结金额为0,不产生流水");
continue;
}
OwnerRunningWaterRecord marginAccount = new OwnerRunningWaterRecord(); OwnerRunningWaterRecord marginAccount = new OwnerRunningWaterRecord();
marginAccount.setOwnerUserName(ownerName); marginAccount.setOwnerUserName(ownerName);
marginAccount.setMobile(mobile); marginAccount.setMobile(mobile);
...@@ -728,6 +745,10 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -728,6 +745,10 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
ownerRunningWaterRecordDao.saveEntity(marginAccount); ownerRunningWaterRecordDao.saveEntity(marginAccount);
} else { } else {
log.info("插入预付运费冻结流水"); log.info("插入预付运费冻结流水");
if (frozenBalanceZeroFlag) {
log.info("保证金账户需冻结金额为0,不产生流水");
continue;
}
OwnerRunningWaterRecord prepaidFreight = new OwnerRunningWaterRecord(); OwnerRunningWaterRecord prepaidFreight = new OwnerRunningWaterRecord();
prepaidFreight.setOwnerUserName(ownerName); prepaidFreight.setOwnerUserName(ownerName);
prepaidFreight.setMobile(mobile); prepaidFreight.setMobile(mobile);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论