提交 2f66aff9 authored 作者: huyufan's avatar huyufan

Merge remote-tracking branch 'origin/v10.7_borrowing_and_repayment_20240118' into test

......@@ -16,5 +16,6 @@ public class NbBankConfig {
private String configFilePath;
private String publicKeyPath;
private String privateKeyPath;
private String orderSupportBank;
}
......@@ -19,6 +19,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Slf4j
......@@ -47,6 +48,13 @@ public class CarrierOwnerLoanRecordController {
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:艾庆国")
@PostMapping("/pageOwnerLoanRecordOfOwner")
@UnitCovert(param = false)
......@@ -58,7 +66,7 @@ public class CarrierOwnerLoanRecordController {
@ApiOperation(value = "收银台信息",notes = "<br>By:刘海泉")
@GetMapping("/getCashierInfo")
@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);
return Result.ok(vo);
}
......@@ -67,7 +75,7 @@ public class CarrierOwnerLoanRecordController {
@ApiOperation(value = "订单支付详情",notes = "<br>By:刘海泉")
@GetMapping("/getOrderPaymentDetail")
@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);
return Result.ok(vo);
}
......@@ -75,7 +83,7 @@ public class CarrierOwnerLoanRecordController {
@ApiOperation(value = "转账支付详情",notes = "<br>By:刘海泉")
@GetMapping("/getTransferPaymentDetail")
@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);
return Result.ok(vo);
}
......
......@@ -98,12 +98,18 @@ public class OwnerLoanRecordDaoImpl extends BaseDaoImpl<OwnerLoanRecordMapper, O
@Override
public boolean updatePaySuccess(OwnerLoanRecord item) {
return false;
return update(lUdWrapper()
.eq(OwnerLoanRecord::getId, item.getId())
.set(OwnerLoanRecord::getStatus, item.getStatus())
);
}
@Override
public boolean updatePayFail(OwnerLoanRecord item) {
return false;
return update(lUdWrapper()
.eq(OwnerLoanRecord::getId, item.getId())
.set(OwnerLoanRecord::getStatus, item.getStatus())
);
}
......
package com.clx.performance.extranal.user;
import com.clx.user.vo.feign.OwnerInfoFeignVO;
import com.clx.user.vo.pc.owner.OwnerBindCardVO;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -9,4 +10,7 @@ public interface OwnerInfoService {
OwnerInfoFeignVO getOwnerInfo(@RequestParam("userNo") Long userNo);
OwnerBindCardVO getOwnerBindCard(Long userNo);
}
......@@ -3,6 +3,7 @@ package com.clx.performance.extranal.user.impl;
import com.clx.performance.extranal.user.OwnerInfoService;
import com.clx.user.feign.OwnerInfoFeign;
import com.clx.user.vo.feign.OwnerInfoFeignVO;
import com.clx.user.vo.pc.owner.OwnerBindCardVO;
import com.msl.common.base.Optional;
import com.msl.common.enums.ResultCodeEnum;
import com.msl.common.result.Result;
......@@ -23,4 +24,11 @@ public class OwnerInfoServiceImpl implements OwnerInfoService {
.filter(Result::succeed).map(Result::getData).orElseThrow(ResultCodeEnum.FAIL,"未查询到对应的货主信息");
}
@Override
public OwnerBindCardVO getOwnerBindCard(Long userNo) {
return Optional.ofNullable(ownerInfoFeign.getOwnerInfoVO(userNo))
.filter(Result::succeed).map(Result::getData).orElseThrow(ResultCodeEnum.FAIL,"未查询到对应的货主绑卡信息");
}
}
......@@ -5,9 +5,11 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.order.enums.DeleteStatusEnum;
import com.clx.performance.component.IdGenerateSnowFlake;
import com.clx.performance.config.loan.ClxPayeeConfig;
import com.clx.performance.config.loan.PaymentFromConfig;
import com.clx.performance.config.nbbank.NbBankConfig;
import com.clx.performance.dao.OwnerBindCardRecordDao;
import com.clx.performance.dao.loan.BorrowerDao;
import com.clx.performance.dao.loan.OwnerLoanAccountDao;
......@@ -99,6 +101,7 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
private final ContractEvidenceFeign contractEvidenceFeign;
private final ContractTemplateFeign contractTemplateFeign;
private final PaymentFromConfig paymentFromConfig;
private final NbBankConfig nbBankConfig;
@Override
public IPage<OwnerLoanRecordVO> pageOwnerLoanRecord(PageCarrierOwnerLoanRecordParam param) {
......@@ -318,7 +321,17 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
OwnerLoanRecord ownerLoanRecord = ownerLoanRecordDao.getEntityByKey(id).orElseThrow(
PerformanceResultEnum.DATA_NOT_FIND);
CarrierCashierInfoVO vo = ownerLoanRecordStruct.convertCashierInfo(ownerLoanRecord);
//TODO 设置支付方式和付款账户和银行名称 ,宇帆提供
Borrower borrower = borrowerDao.getEntityByKey(ownerLoanRecord.getBorrowerId()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
if(Objects.equals(borrower.getDeleteStatus(), DeleteStatusEnum.NO.getCode())){
throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND);
}
vo.setOrderPayWay(false);
String bankName = borrower.getBankName();
if(nbBankConfig.getOrderSupportBank().contains(bankName)){
vo.setOrderPayWay(true);
}
vo.setBankName(bankName);
vo.setPayAccount(borrower.getBankCardNo());
return vo;
}
......@@ -485,6 +498,7 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
@Override
@Transactional(rollbackFor = Exception.class)
public void payFail(String loanNo){
OwnerLoanRecord ownerLoanRecord = ownerLoanRecordDao.getOneByField(OwnerLoanRecord::getLoanNo, loanNo)
.orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
......@@ -495,11 +509,12 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
ownerLoanRecord.setStatus(OwnerLoanRecordEnum.Status.PAY_FAIL.getCode());
ownerLoanRecordDao.updatePaySuccess(ownerLoanRecord);
ownerLoanRecordDao.updatePayFail(ownerLoanRecord);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void paySuccess(String loanNo){
OwnerLoanRecord ownerLoanRecord = ownerLoanRecordDao.getOneByField(OwnerLoanRecord::getLoanNo, loanNo)
.orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
......@@ -510,9 +525,71 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
}
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) {
......
......@@ -7,9 +7,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.config.loan.ClxPayeeConfig;
import com.clx.performance.config.loan.PaymentFromConfig;
import com.clx.performance.config.nbbank.NbBankConfig;
import com.clx.performance.dao.loan.OwnerRepaymentDao;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.loan.OwnerRePaymentEnum;
import com.clx.performance.extranal.user.impl.OwnerInfoServiceImpl;
import com.clx.performance.model.loan.OwnerRepayment;
import com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerRepaymentParam;
import com.clx.performance.param.pc.loan.carrier.PageOwnerRepaymentOfOwner;
......@@ -21,6 +23,9 @@ import com.clx.performance.vo.pc.loan.owner.ExportOwnerRepaymentVO;
import com.clx.performance.vo.pc.loan.owner.OwnerCashierInfoVO;
import com.clx.performance.vo.pc.loan.owner.OwnerOrderPaymentDetailVO;
import com.clx.performance.vo.pc.loan.owner.OwnerTransferPaymentDetailVO;
import com.clx.user.feign.OwnerInfoFeign;
import com.clx.user.vo.feign.OwnerInfoFeignVO;
import com.clx.user.vo.pc.owner.OwnerBindCardVO;
import com.msl.common.result.Result;
import com.msl.common.utils.DateUtils;
import com.msl.document.api.feign.ContractEvidenceFeign;
......@@ -51,6 +56,9 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService {
private final ContractEvidenceFeign contractEvidenceFeign;
private final ContractTemplateFeign contractTemplateFeign;
private final PaymentFromConfig paymentFromConfig;
private final OwnerInfoServiceImpl ownerInfoService;
private final NbBankConfig nbBankConfig;
@Override
public IPage<OwnerRepaymentVO> pageOwnerRepayment(PageCarrierOwnerRepaymentParam param) {
IPage<OwnerRepayment> page = ownerRepaymentDao.pageOwnerRepayment(param);
......@@ -72,7 +80,15 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService {
OwnerRepayment ownerRepayment = ownerRepaymentDao.getEntityByKey(id).orElseThrow(
PerformanceResultEnum.DATA_NOT_FIND);
OwnerCashierInfoVO vo = ownerRepaymentStruct.convertCashierInfo(ownerRepayment);
//TODO 设置支付方式和付款账户和银行名称 ,宇帆提供
OwnerBindCardVO bindCard = ownerInfoService.getOwnerBindCard(ownerRepayment.getOwnerUserNo());
String ownerAccountBank = bindCard.getOwnerAccountBank();
vo.setOrderPayWay(false);
if(nbBankConfig.getOrderSupportBank().contains(ownerAccountBank)){
vo.setOrderPayWay(true);
}
vo.setBankName(ownerAccountBank);
vo.setPayAccount(bindCard.getOwnerBankAccount());
return vo;
}
......
......@@ -45,4 +45,6 @@ public interface OwnerLoanRecordService {
void payFail(String loanNo);
void paySuccess(String loanNo);
void ownerLoanRecordRetryPay(String loanNo);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论