提交 0d68177e authored 作者: jiangwenye's avatar jiangwenye

Merge remote-tracking branch 'origin/v5.5_settlement_20231011' into v5.5_settlement_20231011

......@@ -69,7 +69,7 @@ public enum PerformanceResultEnum implements ResultEnum {
SETTLEMENT_ORDER_STATUS_CHANGED(1401, "结算单状态已变更,请重新刷新页面"),
SETTLEMENT_NO_FOUND(1401, "结算单不存在"),
MONEY_NO_SAME(1501, "货主提现金额和平台支付金额不一致"),
;
private final int code;
......
package com.clx.performance.param.pc;
import com.msl.common.convertor.type.MoneyInConvert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
......@@ -29,6 +30,7 @@ public class OwnerCaseOutApproveParam {
private String paymentProof;
@ApiModelProperty(value = "平台付款金额", example = "11.21")
@MoneyInConvert
private BigDecimal platformPayBalance;
}
......@@ -17,7 +17,7 @@ public class PageOwnerAccountListParam extends PageParam {
private String ownerUserNo;
@ApiModelProperty(value = "联系电话")
private Integer mobile;
private String mobile;
@ApiModelProperty(value = "账户类型 1:保证金 2:预付运费")
private Integer accountType;
......
......@@ -15,9 +15,9 @@ public class FrozenAccountParam {
private Long userNo;
//保证金
private BigDecimal frozenBalance;
//预付运费
private BigDecimal frozenBalance;
//保证金
private BigDecimal ensureBalance;
private Integer orderId;
private String orderNo;
......
......@@ -93,6 +93,7 @@ public class CarrierAccountController {
@ApiOperation(value = "提现审批", notes = "<br>By:胡宇帆")
@PostMapping("/accountCaseOutApprove")
@UnitCovert()
public Result<Object> accountCaseOutApprove(@RequestBody OwnerCaseOutApproveParam param) {
ownerAccountService.accountCaseOutApprove(param);
return Result.ok();
......
......@@ -40,6 +40,9 @@ public interface OwnerAccountMapper extends BaseMapper<OwnerAccount> {
)
Integer subAccount(@Param("account") OwnerAccount account, @Param("now")String now);
@SelectProvider(type = OwnerAccountSqlProvider.class, method = "updateOwnerAccountForConfirm")
@Update("update owner_account set frozen_balance = frozen_balance - #{account.frozenBalance}," +
"modified_time=#{now}"
+"where id = #{account.id} and modified_time = #{account.modifiedTime}"
)
Integer updateOwnerAccountForConfirm(OwnerAccount account);
}
\ No newline at end of file
......@@ -328,7 +328,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
BigDecimal caseOutBalance = ownerCaseOut.getCaseOutBalance();
BigDecimal platformPayBalance = ownerCaseOut.getPlatformPayBalance();
if (platformPayBalance.compareTo(caseOutBalance) != 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "货主提现金额和平台支付金额不一致");
throw new ServiceSystemException(PerformanceResultEnum.MONEY_NO_SAME);
}
//给对应账户减少金额
......@@ -627,26 +627,26 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
entity.setId(ownerAccount.getId());
entity.setModifiedTime(ownerAccount.getModifiedTime());
if (ownerAccount.getAccountType().equals(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode())) {
if (ownerAccount.getUsableBalance().compareTo(frozenBalance) < 0) {
if (ownerAccount.getUsableBalance().compareTo(ensureBalance) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主保证金账户可用余额不够冻结");
}
//冻结金额
entity.setFrozenBalance(frozenBalance);
entity.setFrozenBalance(ensureBalance);
//可用余额
entity.setUsableBalance(frozenBalance);
entity.setUsableBalance(ensureBalance);
//账户余额
entity.setAccountBalance(frozenBalance);
entity.setAccountBalance(ensureBalance);
//updateList.add(entity);
flag += ownerAccountDao.updateAccountCAS(entity, now, false);
} else {
if (ownerAccount.getUsableBalance().compareTo(ensureBalance) < 0) {
if (ownerAccount.getUsableBalance().compareTo(frozenBalance) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主预付运费账户可用余额不够冻结");
}
//冻结金额
entity.setFrozenBalance(ensureBalance);
entity.setFrozenBalance(frozenBalance);
//可用余额
entity.setUsableBalance(ensureBalance);
entity.setUsableBalance(frozenBalance);
//账户余额
entity.setAccountBalance(frozenBalance);
//updateList.add(entity);
......
......@@ -64,13 +64,4 @@ public class OwnerAccountSqlProvider {
return sqlList.toString();
}
public String updateOwnerAccountForConfirm(OwnerAccount account) {
StringBuffer sqlList = new StringBuffer();
sqlList.append("update owner_account set frozen_balance = frozen_balance -" +
account.getFrozenBalance()
+ "where id = " + account.getId() + "and modified_time = '" + DateUtils.formatDateTime(account.getModifiedTime(), "yyyy-MM-dd HH:mm:ss").get()+"'"
);
return sqlList.toString();
}
}
......@@ -11,16 +11,20 @@ import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.constant.RedisConstants;
import com.clx.performance.dao.OrderGoodsDao;
import com.clx.performance.dao.OwnerAccountDao;
import com.clx.performance.dao.OwnerCaseOutDao;
import com.clx.performance.enums.OrderGoodsStatusEnum;
import com.clx.performance.enums.OrderGoodsTruckBindEnum;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.feign.PerformanceFeign;
import com.clx.performance.mapper.OrderGoodsMapper;
import com.clx.performance.model.OrderGoods;
import com.clx.performance.model.OwnerAccount;
import com.clx.performance.model.OwnerCaseOut;
import com.clx.performance.param.pc.OwnerCaseOutParam;
import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.service.OwnerAccountService;
import com.msl.common.base.Optional;
import com.msl.common.exception.ServiceSystemException;
import com.msl.common.result.Result;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -69,8 +73,17 @@ public class JobTest {
@Autowired
private PerformanceFeign performanceFeign;
@Autowired
private OwnerCaseOutDao ownerCaseOutDao;
@Test
public void test1() {
Optional<OwnerCaseOut> optional = ownerCaseOutDao.getEntityByKey(19);
OwnerCaseOut ownerCaseOut = optional.get();
BigDecimal caseOutBalance = ownerCaseOut.getCaseOutBalance();
BigDecimal platformPayBalance = ownerCaseOut.getPlatformPayBalance();
if (platformPayBalance.compareTo(caseOutBalance) != 0) {
throw new ServiceSystemException(PerformanceResultEnum.MONEY_NO_SAME);
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论