提交 04a4f7cd authored 作者: liuhaiquan's avatar liuhaiquan

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

Merge remote-tracking branch 'origin/v10.7_borrowing_and_repayment_20240118' into v10.7_borrowing_and_repayment_20240118
...@@ -131,6 +131,7 @@ public enum PerformanceResultEnum implements ResultEnum { ...@@ -131,6 +131,7 @@ public enum PerformanceResultEnum implements ResultEnum {
OWNER_LOAN_RECORD_PAY_STATUS_ERROR(1850, "状态已变更无法支付"), OWNER_LOAN_RECORD_PAY_STATUS_ERROR(1850, "状态已变更无法支付"),
OWNER_LOAN_RECORD_CANCEL_STATUS_ERROR(1851, "状态已变更无法取消"), OWNER_LOAN_RECORD_CANCEL_STATUS_ERROR(1851, "状态已变更无法取消"),
OWNER_LOAN_RECORD_PAY_WAIT_ERROR(1852,"当前借款单状态不是待付款"), OWNER_LOAN_RECORD_PAY_WAIT_ERROR(1852,"当前借款单状态不是待付款"),
OWNER_LOAN_PAYMENT_STATUS_ERROR(1851, "状态已变变更"),
; ;
private final int code; private final int code;
......
...@@ -36,8 +36,6 @@ public class CarrierOwnerPaymentController { ...@@ -36,8 +36,6 @@ public class CarrierOwnerPaymentController {
return Result.page(page.getRecords(),page.getTotal(),page.getPages()); return Result.page(page.getRecords(),page.getTotal(),page.getPages());
} }
@ApiOperation(value = "付款详情",notes = "<br>By:刘海泉") @ApiOperation(value = "付款详情",notes = "<br>By:刘海泉")
@PostMapping("/getOwnerPaymentDetail") @PostMapping("/getOwnerPaymentDetail")
@UnitCovert(param = false) @UnitCovert(param = false)
...@@ -46,8 +44,13 @@ public class CarrierOwnerPaymentController { ...@@ -46,8 +44,13 @@ public class CarrierOwnerPaymentController {
return Result.ok(vo); return Result.ok(vo);
} }
@ApiOperation(value = "付款",notes = "<br>By:胡宇帆")
@PostMapping("/pay")
@UnitCovert(param = false)
public Result<Object> pay(@RequestParam("id") @NotNull(message = "id不能为空") Integer id) {
ownerPaymentService.pay(id);
return Result.ok();
}
} }
...@@ -15,6 +15,8 @@ import lombok.extern.slf4j.Slf4j; ...@@ -15,6 +15,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.NotNull;
@Slf4j @Slf4j
@RestController @RestController
...@@ -51,4 +53,12 @@ public class CarrierOwnerRepaymentController { ...@@ -51,4 +53,12 @@ public class CarrierOwnerRepaymentController {
return Result.page(page.getRecords(),page.getTotal(),page.getPages()); return Result.page(page.getRecords(),page.getTotal(),page.getPages());
} }
@ApiOperation(value = "核销",notes = "<br>By:姜文业")
@GetMapping("/adjust")
public Result<Object> adjust(@RequestParam("id") @NotNull(message = "id不能为空") Integer id) {
return Result.ok();
}
} }
...@@ -11,6 +11,7 @@ import com.msl.common.dao.impl.BaseDaoImpl; ...@@ -11,6 +11,7 @@ import com.msl.common.dao.impl.BaseDaoImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
...@@ -20,6 +21,7 @@ import java.util.Objects; ...@@ -20,6 +21,7 @@ import java.util.Objects;
*/ */
@Repository @Repository
public class OwnerPaymentDaoImpl extends BaseDaoImpl<OwnerPaymentMapper, OwnerPayment, Integer> implements OwnerPaymentDao { public class OwnerPaymentDaoImpl extends BaseDaoImpl<OwnerPaymentMapper, OwnerPayment, Integer> implements OwnerPaymentDao {
@Override @Override
public IPage<OwnerPayment> pageOwnerPayment(PageCarrierOwnerPaymentParam param) { public IPage<OwnerPayment> pageOwnerPayment(PageCarrierOwnerPaymentParam param) {
...@@ -45,4 +47,24 @@ public class OwnerPaymentDaoImpl extends BaseDaoImpl<OwnerPaymentMapper, OwnerPa ...@@ -45,4 +47,24 @@ public class OwnerPaymentDaoImpl extends BaseDaoImpl<OwnerPaymentMapper, OwnerPa
query.orderByDesc(OwnerPayment :: getCreateTime); query.orderByDesc(OwnerPayment :: getCreateTime);
return baseMapper.selectPage(Page.of(param.getPage(), param.getPageSize()),query); return baseMapper.selectPage(Page.of(param.getPage(), param.getPageSize()),query);
} }
@Override
public void updateStatusAndMerchantRunningWaterNo(OwnerPayment ownerPayment) {
update(lUdWrapper().set(OwnerPayment::getStatus, ownerPayment.getStatus())
.set(OwnerPayment::getMerchantRunningWaterNo, ownerPayment.getMerchantRunningWaterNo())
.eq(OwnerPayment::getId, ownerPayment.getId())
);
}
@Override
public List<OwnerPayment> selectListByPayStatus(Integer status) {
return list(lQrWrapper().eq(OwnerPayment::getStatus, status));
}
@Override
public void updatePayStatus(Integer id, Integer status) {
update(lUdWrapper().set(OwnerPayment::getStatus, status)
.eq(OwnerPayment::getId, id)
);
}
} }
...@@ -5,11 +5,21 @@ import com.clx.performance.mapper.loan.OwnerPaymentMapper; ...@@ -5,11 +5,21 @@ import com.clx.performance.mapper.loan.OwnerPaymentMapper;
import com.clx.performance.model.loan.OwnerPayment; import com.clx.performance.model.loan.OwnerPayment;
import com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerPaymentParam; import com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerPaymentParam;
import com.msl.common.dao.BaseDao; import com.msl.common.dao.BaseDao;
import java.util.List;
/** /**
* @author kavin * @author kavin
* Date 2024-01-20 * Date 2024-01-20
* Time 13:31 * Time 13:31
*/ */
public interface OwnerPaymentDao extends BaseDao<OwnerPaymentMapper, OwnerPayment, Integer> { public interface OwnerPaymentDao extends BaseDao<OwnerPaymentMapper, OwnerPayment, Integer> {
IPage<OwnerPayment> pageOwnerPayment(PageCarrierOwnerPaymentParam param); IPage<OwnerPayment> pageOwnerPayment(PageCarrierOwnerPaymentParam param);
void updateStatusAndMerchantRunningWaterNo(OwnerPayment ownerPayment);
List<OwnerPayment> selectListByPayStatus(Integer status);
void updatePayStatus(Integer id, Integer status);
} }
package com.clx.performance.job;
import cn.hutool.json.JSONUtil;
import com.clx.order.feign.LoanPaymentFeign;
import com.clx.order.vo.pc.nbbank.NbBankOrderPayStatusResultVO;
import com.clx.performance.dao.loan.OwnerPaymentDao;
import com.clx.performance.enums.loan.OwnerPaymentEnum;
import com.clx.performance.model.loan.OwnerPayment;
import com.msl.common.result.Result;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
@Slf4j
@Component
@AllArgsConstructor
public class OwnerPaymentPayStatusJob {
private final OwnerPaymentDao ownerPaymentDao;
private final LoanPaymentFeign loanPaymentFeign;
/**
* 货主付款支付状态
*/
@XxlJob("ownerPaymentPayStatusJob")
public void ownerPaymentPayStatusJob() {
log.info("货主付款支付状态定时器执行");
List<OwnerPayment> ownerPaymentList = ownerPaymentDao.selectListByPayStatus(OwnerPaymentEnum.Status.PAYING.getCode());
if (CollectionUtils.isEmpty(ownerPaymentList)) {
log.info("当前未存在付款中的付款单");
}
for (OwnerPayment ownerPayment : ownerPaymentList) {
Result<NbBankOrderPayStatusResultVO> result = loanPaymentFeign.getResult(ownerPayment.getMerchantRunningWaterNo());
log.info("货主付款支付状态定时器执行,货主付款单流水号:{},查询结果:{}", ownerPayment.getMerchantRunningWaterNo(), JSONUtil.parse(result));
if (!result.succeed()) {
continue;
}
NbBankOrderPayStatusResultVO data = result.getData();
if (data.getStatus() == 1) {
ownerPaymentDao.updatePayStatus(ownerPayment.getId(), OwnerPaymentEnum.Status.PAY_SUCCESS.getCode());
} else {
ownerPaymentDao.updatePayStatus(ownerPayment.getId(), OwnerPaymentEnum.Status.PAY_FAIL.getCode());
}
}
}
}
...@@ -44,6 +44,10 @@ public class OwnerPayment implements HasKey<Integer> { ...@@ -44,6 +44,10 @@ public class OwnerPayment implements HasKey<Integer> {
@ApiModelProperty("交易流水号(第三方)") @ApiModelProperty("交易流水号(第三方)")
private String runningWaterOpenNo; private String runningWaterOpenNo;
@TableField("merchant_running_water_no")
@ApiModelProperty("商户流水")
private String merchantRunningWaterNo;
@TableField("payment_no") @TableField("payment_no")
@ApiModelProperty("付款单号") @ApiModelProperty("付款单号")
private Long paymentNo; private Long paymentNo;
...@@ -72,6 +76,10 @@ public class OwnerPayment implements HasKey<Integer> { ...@@ -72,6 +76,10 @@ public class OwnerPayment implements HasKey<Integer> {
@ApiModelProperty("收款账户") @ApiModelProperty("收款账户")
private String payeeAccount; private String payeeAccount;
@TableField("payee_bank_code")
@ApiModelProperty("收款银行行号")
private String payeeBankCode;
@TableField("status") @TableField("status")
@ApiModelProperty("10 待付款 40 付款中 50 付款成功 60 付款失败") @ApiModelProperty("10 待付款 40 付款中 50 付款成功 60 付款失败")
private Integer status; private Integer status;
......
...@@ -2,16 +2,25 @@ package com.clx.performance.service.impl.loan; ...@@ -2,16 +2,25 @@ package com.clx.performance.service.impl.loan;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.order.feign.AddressFeign;
import com.clx.order.feign.LoanPaymentFeign;
import com.clx.order.param.feign.PaymentParam;
import com.clx.order.vo.pc.nbbank.NbBankOrderPayResultVO;
import com.clx.performance.component.IdGenerateSnowFlake;
import com.clx.performance.dao.loan.OwnerPaymentDao; import com.clx.performance.dao.loan.OwnerPaymentDao;
import com.clx.performance.enums.PerformanceResultEnum; import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.loan.OwnerPaymentEnum;
import com.clx.performance.model.loan.OwnerPayment; import com.clx.performance.model.loan.OwnerPayment;
import com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerPaymentParam; import com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerPaymentParam;
import com.clx.performance.service.loan.OwnerPaymentService; import com.clx.performance.service.loan.OwnerPaymentService;
import com.clx.performance.struct.loan.OwnerPaymentStruct; import com.clx.performance.struct.loan.OwnerPaymentStruct;
import com.clx.performance.vo.pc.loan.carrier.CarrierOwnerPaymentVO; import com.clx.performance.vo.pc.loan.carrier.CarrierOwnerPaymentVO;
import com.clx.performance.vo.pc.loan.carrier.OwnerPaymentVO; import com.clx.performance.vo.pc.loan.carrier.OwnerPaymentVO;
import com.msl.common.exception.ServiceSystemException;
import com.msl.common.result.Result;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
...@@ -24,9 +33,16 @@ import java.util.List; ...@@ -24,9 +33,16 @@ import java.util.List;
@Service @Service
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
public class OwnerPaymentServiceImpl implements OwnerPaymentService { public class OwnerPaymentServiceImpl implements OwnerPaymentService {
private final OwnerPaymentDao ownerPaymentDao; private final OwnerPaymentDao ownerPaymentDao;
private final OwnerPaymentStruct ownerPaymentStruct; private final OwnerPaymentStruct ownerPaymentStruct;
private final IdGenerateSnowFlake idGenerateSnowFlake;
private final LoanPaymentFeign loanPaymentFeign;
@Override @Override
public IPage<OwnerPaymentVO> pageOwnerPayment(PageCarrierOwnerPaymentParam param) { public IPage<OwnerPaymentVO> pageOwnerPayment(PageCarrierOwnerPaymentParam param) {
IPage<OwnerPayment> page = ownerPaymentDao.pageOwnerPayment(param); IPage<OwnerPayment> page = ownerPaymentDao.pageOwnerPayment(param);
...@@ -43,4 +59,31 @@ public class OwnerPaymentServiceImpl implements OwnerPaymentService { ...@@ -43,4 +59,31 @@ public class OwnerPaymentServiceImpl implements OwnerPaymentService {
OwnerPayment ownerPayment = ownerPaymentDao.getEntityByKey(id).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND); OwnerPayment ownerPayment = ownerPaymentDao.getEntityByKey(id).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
return ownerPaymentStruct.convert(ownerPayment); return ownerPaymentStruct.convert(ownerPayment);
} }
/**
* 调用财资支付
*
* @param id
*/
@Override
public void pay(Integer id) {
OwnerPayment ownerPayment = ownerPaymentDao.getEntityByKey(id).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
if (!OwnerPaymentEnum.Status.PAY_WAIT.getCode().equals(ownerPayment.getStatus())) {
throw new ServiceSystemException(PerformanceResultEnum.OWNER_LOAN_PAYMENT_STATUS_ERROR);
}
String merSeqNo = idGenerateSnowFlake.nextIdToString(1L);
PaymentParam param = new PaymentParam();
param.setAmount(Integer.parseInt(ownerPayment.getPaymentBalance().toString()));
param.setMerSeqNo(merSeqNo);
param.setPayAcc(ownerPayment.getPaymentAccount());
param.setRcvAcc(ownerPayment.getPayeeAccount());
param.setRcvName(ownerPayment.getPayee());
param.setRcvBankId(ownerPayment.getPayeeBankCode());
Result<NbBankOrderPayResultVO> result = loanPaymentFeign.pay(param);
if (result.succeed()) {
ownerPayment.setMerchantRunningWaterNo(merSeqNo);
ownerPayment.setStatus(OwnerPaymentEnum.Status.PAYING.getCode());
ownerPaymentDao.updateStatusAndMerchantRunningWaterNo(ownerPayment);
}
}
} }
...@@ -280,19 +280,20 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService { ...@@ -280,19 +280,20 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService {
ownerPayment.setOwnerUserNo(ownerRepayment.getOwnerUserNo()); ownerPayment.setOwnerUserNo(ownerRepayment.getOwnerUserNo());
ownerPayment.setOwnerUserName(ownerRepayment.getOwnerUserName()); ownerPayment.setOwnerUserName(ownerRepayment.getOwnerUserName());
ownerPayment.setMobile(ownerRepayment.getMobile()); ownerPayment.setMobile(ownerRepayment.getMobile());
ownerPayment.setRunningWaterOpenNo(bankTrade.getRunningWaterOpenNo());
ownerPayment.setPaymentNo(idGenerateSnowFlake.nextId(1L)); ownerPayment.setPaymentNo(idGenerateSnowFlake.nextId(1L));
ownerPayment.setRepaymentNo(ownerRepayment.getRepaymentNo()); ownerPayment.setRepaymentNo(ownerRepayment.getRepaymentNo());
ownerPayment.setPaymentBalance(ownerRepayment.getRepaymentBalance()); ownerPayment.setPaymentBalance(ownerRepayment.getRepaymentBalance());
//付款单的付款方取还款单的收款方 //付款单的付款方取借款单的付款方
ownerPayment.setPayment(ownerRepayment.getPayee()); ownerPayment.setPayment(ownerRepayment.getPayee());
ownerPayment.setPaymentAccount(ownerRepayment.getPayeeAccount()); ownerPayment.setPaymentAccount(ownerRepayment.getPayeeAccount());
//付款单的收款方取借款单的借出方 //付款单的收款方取借款单的借出方
ownerPayment.setPayee(ownerLoanRecord.getBorrower()); ownerPayment.setPayee(ownerLoanRecord.getBorrower());
ownerPayment.setPayeeAccount(ownerLoanRecord.getBorrowerAccount()); ownerPayment.setPayeeAccount(ownerLoanRecord.getBorrowerAccount());
ownerPayment.setPayeeBankCode(ownerLoanRecord.getBorrowerBankCode());
ownerPayment.setStatus(OwnerPaymentEnum.Status.PAY_WAIT.getCode()); ownerPayment.setStatus(OwnerPaymentEnum.Status.PAY_WAIT.getCode());
ownerPayment.setPayChannel(OwnerLoanRecordEnum.PayChannel.ASSET.getCode()); ownerPayment.setPayChannel(OwnerLoanRecordEnum.PayChannel.ASSET.getCode());
ownerPayment.setCreateBy("system"); ownerPayment.setCreateBy("系统");
ownerPaymentDao.saveEntity(ownerPayment); ownerPaymentDao.saveEntity(ownerPayment);
} }
......
...@@ -14,4 +14,6 @@ public interface OwnerPaymentService { ...@@ -14,4 +14,6 @@ public interface OwnerPaymentService {
IPage<OwnerPaymentVO> pageOwnerPayment(PageCarrierOwnerPaymentParam param); IPage<OwnerPaymentVO> pageOwnerPayment(PageCarrierOwnerPaymentParam param);
CarrierOwnerPaymentVO getOwnerPaymentDetail(Integer id); CarrierOwnerPaymentVO getOwnerPaymentDetail(Integer id);
void pay(Integer id);
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论