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

货主还款、取消支付、重新支付

上级 9484140c
...@@ -5,6 +5,7 @@ import com.clx.performance.param.pc.loan.owner.OwnerLoanRecordParam; ...@@ -5,6 +5,7 @@ import com.clx.performance.param.pc.loan.owner.OwnerLoanRecordParam;
import com.clx.performance.service.loan.OwnerLoanAccountApproveService; import com.clx.performance.service.loan.OwnerLoanAccountApproveService;
import com.clx.performance.service.loan.OwnerLoanAccountService; import com.clx.performance.service.loan.OwnerLoanAccountService;
import com.clx.performance.service.loan.OwnerLoanRecordService; import com.clx.performance.service.loan.OwnerLoanRecordService;
import com.clx.performance.service.loan.OwnerRepaymentService;
import com.clx.performance.vo.pc.loan.owner.OwnerAccountVO; import com.clx.performance.vo.pc.loan.owner.OwnerAccountVO;
import com.msl.common.convertor.aspect.UnitCovert; import com.msl.common.convertor.aspect.UnitCovert;
import com.msl.common.result.Result; import com.msl.common.result.Result;
...@@ -15,6 +16,8 @@ import lombok.extern.slf4j.Slf4j; ...@@ -15,6 +16,8 @@ import lombok.extern.slf4j.Slf4j;
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;
@Slf4j @Slf4j
@RestController @RestController
...@@ -30,6 +33,8 @@ public class OwnerLoanAccountController { ...@@ -30,6 +33,8 @@ public class OwnerLoanAccountController {
private final OwnerLoanAccountService ownerLoanAccountService; private final OwnerLoanAccountService ownerLoanAccountService;
private final OwnerRepaymentService ownerRepaymentService;
@ApiOperation(value = "货主借款账户开通",notes = "<br>By:胡宇帆") @ApiOperation(value = "货主借款账户开通",notes = "<br>By:胡宇帆")
@GetMapping("/openOwnerLoanAccount") @GetMapping("/openOwnerLoanAccount")
public Result<Object> openOwnerLoanAccount() { public Result<Object> openOwnerLoanAccount() {
...@@ -62,4 +67,18 @@ public class OwnerLoanAccountController { ...@@ -62,4 +67,18 @@ public class OwnerLoanAccountController {
ownerLoanAccountService.ownerRepayment(param); ownerLoanAccountService.ownerRepayment(param);
return Result.ok(); return Result.ok();
} }
@ApiOperation(value = "取消支付(还款)",notes = "<br>By:胡宇帆")
@GetMapping("/ownerRepaymentCancelPay")
public Result<Object> ownerLoanRecordCancelPay(@RequestParam(value = "repaymentNo") @NotBlank String repaymentNo) {
ownerRepaymentService.ownerLoanRecordCancelPay(repaymentNo);
return Result.ok();
}
@ApiOperation(value = "还款重新支付(只更改还款状态)",notes = "<br>By:胡宇帆")
@GetMapping("/ownerRepaymentRetryPay")
public Result<Object> ownerRepaymentRetryPay(@RequestParam(value = "repaymentNo") @NotBlank String repaymentNo) {
ownerRepaymentService.ownerRepaymentRetryPay(repaymentNo);
return Result.ok();
}
} }
...@@ -68,4 +68,21 @@ public class OwnerRepaymentDaoImpl extends BaseDaoImpl<OwnerRepaymentMapper, Own ...@@ -68,4 +68,21 @@ public class OwnerRepaymentDaoImpl extends BaseDaoImpl<OwnerRepaymentMapper, Own
); );
} }
@Override
public void updateRePay(OwnerRepayment ownerRepayment) {
update(lUdWrapper().eq(OwnerRepayment::getId, ownerRepayment.getId())
.set(OwnerRepayment::getRemittanceIdentificationCode, ownerRepayment.getRemittanceIdentificationCode())
.set(OwnerRepayment::getStatus, ownerRepayment.getStatus())
.set(OwnerRepayment::getRunningWaterOpenNo,ownerRepayment.getRunningWaterOpenNo())
.set(OwnerRepayment::getMerchantRunningWaterNo,ownerRepayment.getMerchantRunningWaterNo())
);
}
@Override
public void updateStatusById(OwnerRepayment ownerRepayment) {
update(lUdWrapper().eq(OwnerRepayment::getId, ownerRepayment.getId())
.set(OwnerRepayment::getStatus, ownerRepayment.getStatus())
);
}
} }
...@@ -27,4 +27,8 @@ public interface OwnerRepaymentDao extends BaseDao<OwnerRepaymentMapper, OwnerRe ...@@ -27,4 +27,8 @@ public interface OwnerRepaymentDao extends BaseDao<OwnerRepaymentMapper, OwnerRe
* @return * @return
*/ */
List<OwnerRepayment> selectListByStatusAndOwnerUserNo(Integer status, Long ownerUserNo); List<OwnerRepayment> selectListByStatusAndOwnerUserNo(Integer status, Long ownerUserNo);
void updateRePay(OwnerRepayment ownerRepayment);
void updateStatusById(OwnerRepayment ownerRepayment);
} }
...@@ -129,16 +129,17 @@ public class OwnerLoanAccountServiceImpl implements OwnerLoanAccountService { ...@@ -129,16 +129,17 @@ public class OwnerLoanAccountServiceImpl implements OwnerLoanAccountService {
bankTrade.setTradeType(BankTradeEnum.TradeType.ORDER_DIRECT_PAY.getCode()); bankTrade.setTradeType(BankTradeEnum.TradeType.ORDER_DIRECT_PAY.getCode());
} else { } else {
//TODO 是否转账是部分支付 // 订单转账支付
// 转账支付 NbBankOrderPayResultVO orderPayResultVO = bankService.orderTransferPay(ownerRepayment.getRepaymentBalance().intValue());
NbBankOrderPayResultVO orderPayResultVO = bankService.orderTransferPay(ownerLoanRecord.getLoanBalance().intValue()); ownerRepayment.setRunningWaterOpenNo(orderPayResultVO.getTransSeqNo());
ownerRepayment.setMerchantRunningWaterNo(orderPayResultVO.getMerSeqNo());
ownerRepayment.setRemittanceIdentificationCode(orderPayResultVO.getSignNo());
bankTrade.setTradeType(BankTradeEnum.TradeType.ORDER_TRANSFER_PAY.getCode()); bankTrade.setTradeType(BankTradeEnum.TradeType.ORDER_TRANSFER_PAY.getCode());
} }
ownerRepayment.setStatus(OwnerLoanRecordEnum.Status.PAYING.getCode()); ownerRepayment.setStatus(OwnerLoanRecordEnum.Status.PAYING.getCode());
// 更新还款支付信息 // 更新还款支付信息
//ownerRepaymentDao.updatePay(ownerLoanRecord); ownerRepaymentDao.updateRePay(ownerRepayment);
bankTrade.setRelationNo(ownerRepayment.getRepaymentNo().toString()); bankTrade.setRelationNo(ownerRepayment.getRepaymentNo().toString());
bankTrade.setOrderType(BankTradeEnum.OrderType.OWNER_LOAN_RECORD.getCode()); bankTrade.setOrderType(BankTradeEnum.OrderType.OWNER_LOAN_RECORD.getCode());
......
package com.clx.performance.service.impl.loan; package com.clx.performance.service.impl.loan;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -11,23 +12,31 @@ import com.clx.performance.config.ClxMessageConfig; ...@@ -11,23 +12,31 @@ import com.clx.performance.config.ClxMessageConfig;
import com.clx.performance.config.loan.ClxPayeeConfig; import com.clx.performance.config.loan.ClxPayeeConfig;
import com.clx.performance.config.loan.PaymentFromConfig; import com.clx.performance.config.loan.PaymentFromConfig;
import com.clx.performance.config.nbbank.NbBankConfig; import com.clx.performance.config.nbbank.NbBankConfig;
import com.clx.performance.dao.loan.BankTradeDao;
import com.clx.performance.dao.loan.OwnerRepaymentDao; import com.clx.performance.dao.loan.OwnerRepaymentDao;
import com.clx.performance.enums.PerformanceResultEnum; import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.loan.OwnerLoanRecordEnum;
import com.clx.performance.enums.loan.OwnerRePaymentEnum; import com.clx.performance.enums.loan.OwnerRePaymentEnum;
import com.clx.performance.enums.nbbank.NbBankStatusEnum;
import com.clx.performance.extranal.user.impl.OwnerInfoServiceImpl; import com.clx.performance.extranal.user.impl.OwnerInfoServiceImpl;
import com.clx.performance.model.loan.BankTrade;
import com.clx.performance.model.loan.OwnerLoanRecord;
import com.clx.performance.model.loan.OwnerRepayment; import com.clx.performance.model.loan.OwnerRepayment;
import com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerRepaymentParam; import com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerRepaymentParam;
import com.clx.performance.param.pc.loan.carrier.PageOwnerRepaymentOfOwner; import com.clx.performance.param.pc.loan.carrier.PageOwnerRepaymentOfOwner;
import com.clx.performance.param.pc.loan.owner.ExportPaymentApplicationFormParam; import com.clx.performance.param.pc.loan.owner.ExportPaymentApplicationFormParam;
import com.clx.performance.service.loan.OwnerRepaymentService; import com.clx.performance.service.loan.OwnerRepaymentService;
import com.clx.performance.service.thirdparty.nbbank.NbBankService;
import com.clx.performance.struct.loan.OwnerRepaymentStruct; import com.clx.performance.struct.loan.OwnerRepaymentStruct;
import com.clx.performance.vo.pc.loan.carrier.OwnerRepaymentVO; import com.clx.performance.vo.pc.loan.carrier.OwnerRepaymentVO;
import com.clx.performance.vo.pc.loan.owner.ExportOwnerRepaymentVO; 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.OwnerCashierInfoVO;
import com.clx.performance.vo.pc.loan.owner.OwnerOrderPaymentDetailVO; import com.clx.performance.vo.pc.loan.owner.OwnerOrderPaymentDetailVO;
import com.clx.performance.vo.pc.loan.owner.OwnerTransferPaymentDetailVO; import com.clx.performance.vo.pc.loan.owner.OwnerTransferPaymentDetailVO;
import com.clx.performance.vo.pc.nbbank.NbBankOrderResultVO;
import com.clx.user.vo.feign.OwnerInfoFeignVO; import com.clx.user.vo.feign.OwnerInfoFeignVO;
import com.clx.user.vo.pc.owner.OwnerBindCardVO; import com.clx.user.vo.pc.owner.OwnerBindCardVO;
import com.msl.common.exception.ServiceSystemException;
import com.msl.common.result.Result; import com.msl.common.result.Result;
import com.msl.common.utils.DateUtils; import com.msl.common.utils.DateUtils;
import com.msl.document.api.feign.ContractEvidenceFeign; import com.msl.document.api.feign.ContractEvidenceFeign;
...@@ -39,6 +48,7 @@ import com.msl.user.utils.TokenUtil; ...@@ -39,6 +48,7 @@ import com.msl.user.utils.TokenUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
...@@ -62,6 +72,8 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService { ...@@ -62,6 +72,8 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService {
private final NbBankConfig nbBankConfig; private final NbBankConfig nbBankConfig;
private final ClxMessageOpenapiFeign clxMessageOpenapiFeign; private final ClxMessageOpenapiFeign clxMessageOpenapiFeign;
private final ClxMessageConfig messageConfig; private final ClxMessageConfig messageConfig;
private final NbBankService bankService;
private final BankTradeDao bankTradeDao;
@Override @Override
public IPage<OwnerRepaymentVO> pageOwnerRepayment(PageCarrierOwnerRepaymentParam param) { public IPage<OwnerRepaymentVO> pageOwnerRepayment(PageCarrierOwnerRepaymentParam param) {
...@@ -200,4 +212,45 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService { ...@@ -200,4 +212,45 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService {
return UUID.randomUUID().toString(); return UUID.randomUUID().toString();
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void ownerLoanRecordCancelPay(String repaymentNo) {
OwnerRepayment ownerRepayment = ownerRepaymentDao.getOneByField(OwnerRepayment::getRepaymentNo, repaymentNo)
.orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
if (ownerRepayment.getStatus().equals(OwnerRePaymentEnum.Status.PAY_SUCCESS.getCode()))
{
log.info("还款记录状态异常,不能取消");
throw new ServiceSystemException(PerformanceResultEnum.OWNER_LOAN_RECORD_CANCEL_STATUS_ERROR);
}
BankTrade bankTrade = bankTradeDao.selectByRelationNo(repaymentNo).get();
NbBankOrderResultVO result = bankService.getResult(bankTrade.getMerchantRunningWaterNo());
Integer status = result.getStatus();
if (!NbBankStatusEnum.Status.INIT.getCode().equals(status)
&& !NbBankStatusEnum.Status.FAIL.getCode().equals(status)
&& !NbBankStatusEnum.Status.NOT_FOUND.getCode().equals(status)
) {
log.info("宁波银行响应当前业务,不能取消{}", JSONUtil.parse(result));
throw new ServiceSystemException(PerformanceResultEnum.OWNER_LOAN_RECORD_CANCEL_STATUS_ERROR);
}
log.info("还款记录取消,更新状态为待审批");
ownerRepayment.setStatus(OwnerRePaymentEnum.Status.PAY_WAIT.getCode());
ownerRepaymentDao.updateStatusById(ownerRepayment);
Integer tradeType = bankTrade.getTradeType();
// 调用宁波退款
bankService.refund(tradeType, bankTrade.getMerchantRunningWaterNo(), Integer.valueOf(ownerRepayment.getRepaymentBalance().movePointRight(2).toString()), bankTrade.getRunningWaterOpenNo());
}
@Override
public void ownerRepaymentRetryPay(String repaymentNo) {
OwnerRepayment ownerRepayment = ownerRepaymentDao.getOneByField(OwnerRepayment::getRepaymentNo, repaymentNo)
.orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
ownerRepayment.setStatus(OwnerRePaymentEnum.Status.PAY_WAIT.getCode());
// 更新借款信息
ownerRepaymentDao.updateStatusById(ownerRepayment);
}
} }
...@@ -32,4 +32,8 @@ public interface OwnerRepaymentService { ...@@ -32,4 +32,8 @@ public interface OwnerRepaymentService {
String sendPaymentSms(String mobile,Long repaymentNo); String sendPaymentSms(String mobile,Long repaymentNo);
String sendOrderPaySms(String mobile,String payee, String payeeAccount); String sendOrderPaySms(String mobile,String payee, String payeeAccount);
void ownerLoanRecordCancelPay(String repaymentNo);
void ownerRepaymentRetryPay(String repaymentNo);
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论