提交 b09cb1b3 authored 作者: huyufan's avatar huyufan

借款重新支付

上级 f18a4723
...@@ -19,6 +19,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -19,6 +19,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@Slf4j @Slf4j
...@@ -47,6 +48,13 @@ public class CarrierOwnerLoanRecordController { ...@@ -47,6 +48,13 @@ public class CarrierOwnerLoanRecordController {
return Result.ok(); return Result.ok();
} }
@ApiOperation(value = "重新支付",notes = "<br>By:胡宇帆")
@GetMapping("/ownerLoanRecordRetryPay")
public Result<Object> ownerLoanRecordRetryPay(@RequestParam(value = "loanNo") @NotBlank String loanNo) {
ownerLoanRecordService.ownerLoanRecordRetryPay(loanNo);
return Result.ok();
}
@ApiOperation(value = "分页搜索货主借款列表",notes = "<br>By:艾庆国") @ApiOperation(value = "分页搜索货主借款列表",notes = "<br>By:艾庆国")
@PostMapping("/pageOwnerLoanRecordOfOwner") @PostMapping("/pageOwnerLoanRecordOfOwner")
@UnitCovert(param = false) @UnitCovert(param = false)
...@@ -58,7 +66,7 @@ public class CarrierOwnerLoanRecordController { ...@@ -58,7 +66,7 @@ public class CarrierOwnerLoanRecordController {
@ApiOperation(value = "收银台信息",notes = "<br>By:刘海泉") @ApiOperation(value = "收银台信息",notes = "<br>By:刘海泉")
@GetMapping("/getCashierInfo") @GetMapping("/getCashierInfo")
@UnitCovert(param = false) @UnitCovert(param = false)
public Result<CarrierCashierInfoVO> getCashierInfo(@Param("id") @NotNull(message = "id不能为空") Integer id) { public Result<CarrierCashierInfoVO> getCashierInfo(@RequestParam("id") @NotNull(message = "id不能为空") Integer id) {
CarrierCashierInfoVO vo = ownerLoanRecordService.getCashierInfo(id); CarrierCashierInfoVO vo = ownerLoanRecordService.getCashierInfo(id);
return Result.ok(vo); return Result.ok(vo);
} }
...@@ -67,7 +75,7 @@ public class CarrierOwnerLoanRecordController { ...@@ -67,7 +75,7 @@ public class CarrierOwnerLoanRecordController {
@ApiOperation(value = "订单支付详情",notes = "<br>By:刘海泉") @ApiOperation(value = "订单支付详情",notes = "<br>By:刘海泉")
@GetMapping("/getOrderPaymentDetail") @GetMapping("/getOrderPaymentDetail")
@UnitCovert(param = false) @UnitCovert(param = false)
public Result<OwnerOrderPaymentDetailVO> getOrderPaymentDetail(@Param("id") @NotNull(message = "id不能为空") Integer id) { public Result<OwnerOrderPaymentDetailVO> getOrderPaymentDetail(@RequestParam("id") @NotNull(message = "id不能为空") Integer id) {
OwnerOrderPaymentDetailVO vo = ownerLoanRecordService.getOrderPaymentDetail(id); OwnerOrderPaymentDetailVO vo = ownerLoanRecordService.getOrderPaymentDetail(id);
return Result.ok(vo); return Result.ok(vo);
} }
...@@ -75,7 +83,7 @@ public class CarrierOwnerLoanRecordController { ...@@ -75,7 +83,7 @@ public class CarrierOwnerLoanRecordController {
@ApiOperation(value = "转账支付详情",notes = "<br>By:刘海泉") @ApiOperation(value = "转账支付详情",notes = "<br>By:刘海泉")
@GetMapping("/getTransferPaymentDetail") @GetMapping("/getTransferPaymentDetail")
@UnitCovert(param = false) @UnitCovert(param = false)
public Result<CarrierTransferPaymentDetailVO> getTransferPaymentDetail(@Param("id") @NotNull(message = "id不能为空") Integer id) { public Result<CarrierTransferPaymentDetailVO> getTransferPaymentDetail(@RequestParam("id") @NotNull(message = "id不能为空") Integer id) {
CarrierTransferPaymentDetailVO vo = ownerLoanRecordService.getTransferPaymentDetail(id); CarrierTransferPaymentDetailVO vo = ownerLoanRecordService.getTransferPaymentDetail(id);
return Result.ok(vo); return Result.ok(vo);
} }
......
...@@ -98,12 +98,18 @@ public class OwnerLoanRecordDaoImpl extends BaseDaoImpl<OwnerLoanRecordMapper, O ...@@ -98,12 +98,18 @@ public class OwnerLoanRecordDaoImpl extends BaseDaoImpl<OwnerLoanRecordMapper, O
@Override @Override
public boolean updatePaySuccess(OwnerLoanRecord item) { public boolean updatePaySuccess(OwnerLoanRecord item) {
return false; return update(lUdWrapper()
.eq(OwnerLoanRecord::getId, item.getId())
.set(OwnerLoanRecord::getStatus, item.getStatus())
);
} }
@Override @Override
public boolean updatePayFail(OwnerLoanRecord item) { public boolean updatePayFail(OwnerLoanRecord item) {
return false; return update(lUdWrapper()
.eq(OwnerLoanRecord::getId, item.getId())
.set(OwnerLoanRecord::getStatus, item.getStatus())
);
} }
......
...@@ -498,6 +498,7 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService { ...@@ -498,6 +498,7 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void payFail(String loanNo){ public void payFail(String loanNo){
OwnerLoanRecord ownerLoanRecord = ownerLoanRecordDao.getOneByField(OwnerLoanRecord::getLoanNo, loanNo) OwnerLoanRecord ownerLoanRecord = ownerLoanRecordDao.getOneByField(OwnerLoanRecord::getLoanNo, loanNo)
.orElseThrow(PerformanceResultEnum.DATA_NOT_FIND); .orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
...@@ -508,11 +509,12 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService { ...@@ -508,11 +509,12 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
ownerLoanRecord.setStatus(OwnerLoanRecordEnum.Status.PAY_FAIL.getCode()); ownerLoanRecord.setStatus(OwnerLoanRecordEnum.Status.PAY_FAIL.getCode());
ownerLoanRecordDao.updatePaySuccess(ownerLoanRecord); ownerLoanRecordDao.updatePayFail(ownerLoanRecord);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void paySuccess(String loanNo){ public void paySuccess(String loanNo){
OwnerLoanRecord ownerLoanRecord = ownerLoanRecordDao.getOneByField(OwnerLoanRecord::getLoanNo, loanNo) OwnerLoanRecord ownerLoanRecord = ownerLoanRecordDao.getOneByField(OwnerLoanRecord::getLoanNo, loanNo)
.orElseThrow(PerformanceResultEnum.DATA_NOT_FIND); .orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
...@@ -523,9 +525,71 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService { ...@@ -523,9 +525,71 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
} }
ownerLoanRecord.setStatus(OwnerLoanRecordEnum.Status.PAY_SUCCESS.getCode()); ownerLoanRecord.setStatus(OwnerLoanRecordEnum.Status.PAY_SUCCESS.getCode());
while (true) {
OwnerLoanAccount ownerLoanAccount = ownerLoanAccountDao.getOneByField(OwnerLoanAccount::getOwnerUserNo,
ownerLoanRecord.getOwnerUserNo()).get();
OwnerLoanAccount entity = new OwnerLoanAccount();
entity.setId(ownerLoanAccount.getId());
entity.setFundingAccountBalance(BigDecimal.ZERO);
entity.setFundingFrozenBalance(BigDecimal.ZERO);
entity.setFundingUsableBalance(BigDecimal.ZERO);
entity.setVirtuallyAccountBalance(ownerLoanRecord.getLoanBalance());
entity.setVirtuallyFrozenBalance(BigDecimal.ZERO);
entity.setVirtuallyUsableBalance(ownerLoanRecord.getLoanBalance());
entity.setModifiedTime(ownerLoanAccount.getModifiedTime());
Integer flag = ownerLoanAccountDao.updateAccountCAS(entity, LocalDateTime.now(), true);
if (flag == 1) {
//生成借款流水
initOwnerLoanRunningWaterRecord(ownerLoanRecord);
//生成还款记录
initOwnerRepayment(ownerLoanRecord);
ownerLoanRecordDao.updatePaySuccess(ownerLoanRecord);
break;
}
}
}
@Override
public void ownerLoanRecordRetryPay(String loanNo) {
BankTrade bankTrade = bankTradeDao.selectByMerchantRunningWaterNo(loanNo).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
OwnerLoanRecord ownerLoanRecord = ownerLoanRecordDao.getOneByField(OwnerLoanRecord::getLoanNo, loanNo)
.orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
borrowerConfigDao.selectByBorrowerIdAndType(ownerLoanRecord.getBorrowerId(), OwnerLoanRecordEnum.LoanType.FUND.getCode())
.orElseThrow(PerformanceResultEnum.BORROWER_CONFIG_TYPE_NOT_SUPPORT_ERROR);
Borrower borrower = borrowerDao.getEntityByKey(ownerLoanRecord.getBorrowerId())
.orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
if (BankTradeEnum.TradeType.ORDER_DIRECT_PAY.getCode().equals(bankTrade.getTradeType())) {
//资金 TODO 调宁波银企直连的产品,从诚联信账户中给鑫祥和执行转账
// 订单支付
NbBankOrderPayResultVO orderPayResultVO = bankService.orderDirectPay(Long.valueOf(loanNo),
ownerLoanRecord.getLoanBalance().intValue(), borrower.getOpenBankId(), borrower.getBankCardNo(), borrower.getName());
ownerLoanRecord.setRunningWaterOpenNo(orderPayResultVO.getTransSeqNo());
ownerLoanRecord.setMerchantRunningWaterNo(orderPayResultVO.getMerSeqNo());
ownerLoanRecord.setRemittanceIdentificationCode(null);
ownerLoanRecord.setStatus(OwnerLoanRecordEnum.Status.PAYING.getCode());
ownerLoanRecord.setLoanResidueBalance(ownerLoanRecord.getLoanBalance());
ownerLoanRecord.setLendingParty(borrower.getName());
ownerLoanRecord.setLendingPartyAccount(borrower.getBankCardNo());
}
else {
//资金 TODO 调宁波银企直连的产品,从诚联信账户中给鑫祥和执行转账
// 转账支付
NbBankOrderPayResultVO orderPayResultVO = bankService.orderTransferPay(ownerLoanRecord.getLoanBalance().intValue());
ownerLoanRecord.setRunningWaterOpenNo(orderPayResultVO.getTransSeqNo());
ownerLoanRecord.setMerchantRunningWaterNo(orderPayResultVO.getMerSeqNo());
ownerLoanRecord.setRemittanceIdentificationCode(orderPayResultVO.getSignNo());
ownerLoanRecord.setStatus(OwnerLoanRecordEnum.Status.PAYING.getCode());
ownerLoanRecord.setLoanResidueBalance(ownerLoanRecord.getLoanBalance());
ownerLoanRecord.setLendingParty(null);
ownerLoanRecord.setLendingPartyAccount(null);
}
// 更新借款支付信息
ownerLoanRecordDao.updatePay(ownerLoanRecord);
ownerLoanRecordDao.updatePaySuccess(ownerLoanRecord);
} }
public void generateFrozenOwnerLoanRunningWater(OwnerLoanRecord ownerLoanRecord, String childNo, BigDecimal orderChildPrice) { public void generateFrozenOwnerLoanRunningWater(OwnerLoanRecord ownerLoanRecord, String childNo, BigDecimal orderChildPrice) {
......
...@@ -45,4 +45,6 @@ public interface OwnerLoanRecordService { ...@@ -45,4 +45,6 @@ public interface OwnerLoanRecordService {
void payFail(String loanNo); void payFail(String loanNo);
void paySuccess(String loanNo); void paySuccess(String loanNo);
void ownerLoanRecordRetryPay(String loanNo);
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论