提交 308d1cba authored 作者: huyufan's avatar huyufan

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

...@@ -13,7 +13,7 @@ public enum BankTradeEnum { ...@@ -13,7 +13,7 @@ public enum BankTradeEnum {
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum TradeType { public enum TradeType {
ORDER_DIRECT_PAY(1, "订单支付"), ORDER_DIRECT_PAY(3, "订单支付"),
ORDER_TRANSFER_PAY(2, "转账支付"), ORDER_TRANSFER_PAY(2, "转账支付"),
; ;
......
...@@ -54,6 +54,25 @@ public enum OwnerLoanRecordEnum { ...@@ -54,6 +54,25 @@ public enum OwnerLoanRecordEnum {
} }
} }
@Getter
@AllArgsConstructor
public enum LoanFlag {
NO_LOAN(0, "未借款"),
LOAN(2, "已借款"),
RE_PAY(3, "已还款"),
;
private final Integer code;
private final String msg;
public static Optional<LoanFlag> getByCode(Integer code) {
return Arrays.stream(values()).filter(e ->Objects.equals(e.code, code)).findFirst();
}
public static String getMsgByCode(Integer code) {
return getByCode(code).map(LoanFlag::getMsg).orElse(null);
}
}
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
......
package com.clx.performance; package com.clx.performance.param;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -8,9 +8,9 @@ import javax.validation.constraints.NotNull; ...@@ -8,9 +8,9 @@ import javax.validation.constraints.NotNull;
@Data @Data
public class OwnerLoanPayNotifyMqParam { public class OwnerLoanPayNotifyMqParam {
@NotNull(message = "借款单号不能为空") @NotNull(message = "流水号不能为空")
@ApiModelProperty("借款单号") @ApiModelProperty("流水号")
private String loanNo; private String merSeqNo;
@ApiModelProperty("支付状态") @ApiModelProperty("支付状态")
private Integer payStatus; private Integer payStatus;
......
...@@ -22,8 +22,13 @@ public class OwnerLoanRecordParam { ...@@ -22,8 +22,13 @@ public class OwnerLoanRecordParam {
@MoneyInConvert @MoneyInConvert
private BigDecimal loanBalance; private BigDecimal loanBalance;
@ApiModelProperty(value = "借款方", example = "伟华煤炭运销公司") @ApiModelProperty(value = "借出方ID", example = "伟华煤炭运销公司")
@NotBlank(message = "借款方不能为空") @NotNull(message = "借出方ID不能为空")
private Integer borrowerId;
@ApiModelProperty(value = "借出方", example = "诚联信网络科技有限公司")
@NotBlank(message = "借出方不能为空")
private String borrower; private String borrower;
@ApiModelProperty(value = "收款方") @ApiModelProperty(value = "收款方")
...@@ -32,12 +37,13 @@ public class OwnerLoanRecordParam { ...@@ -32,12 +37,13 @@ public class OwnerLoanRecordParam {
@ApiModelProperty(value = "收款方账户") @ApiModelProperty(value = "收款方账户")
private String payeeAccount; private String payeeAccount;
@ApiModelProperty(value = "借出方", example = "诚联信网络科技有限公司")
@NotBlank(message = "借出方不能为空") @ApiModelProperty(value = "借款方", example = "伟华煤炭运销公司")
@NotBlank(message = "借款方不能为空")
private String lendingParty; private String lendingParty;
@ApiModelProperty(value = "借方账户", example = "诚联信银行账户") @ApiModelProperty(value = "借方账户", example = "诚联信银行账户")
@NotBlank(message = "借方不能为空") @NotBlank(message = "借方不能为空")
private String lendingPartyAccount; private String lendingPartyAccount;
@ApiModelProperty(value = "借出时效(天)", example = "2") @ApiModelProperty(value = "借出时效(天)", example = "2")
......
...@@ -20,22 +20,22 @@ import java.math.BigDecimal; ...@@ -20,22 +20,22 @@ import java.math.BigDecimal;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class OwnerOrderPaymentDetailVO { public class CarrierOwnerOrderPaymentDetailVO {
@ApiModelProperty("借款单号") @ApiModelProperty("借款单号")
private Long loanNo; private Long loanNo;
@ApiModelProperty("付款方") @ApiModelProperty("付款方(借款记录中的借出方为现在的付款方)")
private String lendingParty; private String payer;
@ApiModelProperty("付款账户") @ApiModelProperty("付款账户(借款记录中的借出方账户为现在的付款方账户)")
private String lendingPartyAccount; private String payerAccount;
@ApiModelProperty("收款方") @ApiModelProperty(value = "收款方",example = "馨祥和")
private String borrower; private String payee;
@ApiModelProperty("收款账户") @ApiModelProperty("收款账户")
private String borrowerAccount; private String payeeAccount;
@MoneyOutConvert @MoneyOutConvert
@ApiModelProperty("订单金额") @ApiModelProperty("订单金额")
......
...@@ -72,11 +72,11 @@ public class ExportOwnerLoanRecordVO { ...@@ -72,11 +72,11 @@ public class ExportOwnerLoanRecordVO {
private String borrower; private String borrower;
@ApiModelProperty("借方") @ApiModelProperty("借方")
private String lendingParty; private String lendingParty;
@ApiModelProperty("借方账户") @ApiModelProperty("借方账户")
private String lendingPartyAccount; private String lendingPartyAccount;
......
...@@ -66,14 +66,13 @@ public class OwnerLoanRecordVO { ...@@ -66,14 +66,13 @@ public class OwnerLoanRecordVO {
@ApiModelProperty("借款方") @ApiModelProperty("借款方")
private String borrower; private String borrower;
@ApiModelProperty("借出方ID")
private String lendingPartyId;
@ApiModelProperty("借出方")
@ApiModelProperty("借款方")
private String lendingParty; private String lendingParty;
@ApiModelProperty("借方账户") @ApiModelProperty("借方账户")
private String lendingPartyAccount; private String lendingPartyAccount;
......
...@@ -16,6 +16,9 @@ import lombok.Setter; ...@@ -16,6 +16,9 @@ import lombok.Setter;
@Setter @Setter
public class BorrowerSelectVO { public class BorrowerSelectVO {
@ApiModelProperty("id")
private Integer id;
@ApiModelProperty("借出方") @ApiModelProperty("借出方")
private String name; private String name;
......
...@@ -20,6 +20,7 @@ import com.clx.performance.enums.loan.OwnerLoanAccountRunningWaterRecordEnum; ...@@ -20,6 +20,7 @@ import com.clx.performance.enums.loan.OwnerLoanAccountRunningWaterRecordEnum;
import com.clx.performance.enums.loan.OwnerLoanRecordEnum; 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.settle.SettlementOwnerEnum; import com.clx.performance.enums.settle.SettlementOwnerEnum;
import com.clx.performance.enums.settle.SettlementWayEnum;
import com.clx.performance.model.OrderChild; import com.clx.performance.model.OrderChild;
import com.clx.performance.model.OrderGoods; import com.clx.performance.model.OrderGoods;
import com.clx.performance.model.OwnerRunningWaterRecord; import com.clx.performance.model.OwnerRunningWaterRecord;
...@@ -43,6 +44,7 @@ import java.math.BigDecimal; ...@@ -43,6 +44,7 @@ import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Component @Component
...@@ -170,8 +172,16 @@ public class OrderChildLoanComponent { ...@@ -170,8 +172,16 @@ public class OrderChildLoanComponent {
* @param settlementOwnerDetail * @param settlementOwnerDetail
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void childLoanConfirmAfterProcess(SettlementDriverDetail settlementDriverDetail, SettlementOwnerDetail settlementOwnerDetail) { public void childLoanConfirmAfterProcess(SettlementDriverDetail settlementDriverDetail, SettlementOwnerDetail settlementOwnerDetail, OrderChild orderChild) {
log.info("1.运单确认收货后借款相关处理执行"); log.info("1.运单确认收货后借款相关处理执行");
OwnerQuotationDetailVO quotationDetailVO = orderFeign.getQuotationByOrderNo(settlementDriverDetail.getOrderNo()).getData();
BigDecimal freightFreezeRate = quotationDetailVO.getFreightFreezeRate();
if (freightFreezeRate.compareTo(BigDecimal.ONE) == 0) {
//百分百预付不需要考虑借款账户
log.info("1.1百分百预付不需要考虑借款账户");
return;
}
if (SettlementOwnerEnum.InvoiceType.ORDINARY.getCode().equals(settlementDriverDetail.getInvoiceType())) { if (SettlementOwnerEnum.InvoiceType.ORDINARY.getCode().equals(settlementDriverDetail.getInvoiceType())) {
log.info("2.当前不是网运单,不需要处理借款标识"); log.info("2.当前不是网运单,不需要处理借款标识");
return; return;
...@@ -182,10 +192,15 @@ public class OrderChildLoanComponent { ...@@ -182,10 +192,15 @@ public class OrderChildLoanComponent {
return; return;
} }
String childNo = settlementDriverDetail.getChildNo(); String childNo = settlementDriverDetail.getChildNo();
List<OwnerLoanAccountRunningWaterRecord> runningWaterRecordList = ownerLoanAccountRunningWaterRecordDao.getListByOrderNoAndRunningWaterType List<OwnerLoanAccountRunningWaterRecord> runningWaterRecordList = ownerLoanAccountRunningWaterRecordDao.getListByOrderNoAndRunningWaterType
(childNo, OwnerLoanAccountRunningWaterRecordEnum.RunWaterType.APPROVE_FROZEN.getCode()); (childNo, OwnerLoanAccountRunningWaterRecordEnum.RunWaterType.APPROVE_FROZEN.getCode());
settlementDriverDetail.setLoanFlag(1); //已借款
settlementDriverDetail.setLoanFlag(OwnerLoanRecordEnum.LoanFlag.LOAN.getCode());
// 抵扣金额
settlementOwnerDetail.setLoanFreight(settlementFreightCalc(orderChild.getSettlementWay(), settlementOwnerDetail));
settlementOwnerDetail.setLoanFreight(settlementOwnerDetail.getSettlementFreight()); settlementOwnerDetail.setLoanFreight(settlementOwnerDetail.getSettlementFreight());
log.info("4.查询当前运单号:{}, 当前货主,{}, 此运单借款冻结记录:{}", childNo, settlementOwnerDetail.getOwnerUserNo(), JSONUtil.parse(runningWaterRecordList)); log.info("4.查询当前运单号:{}, 当前货主,{}, 此运单借款冻结记录:{}", childNo, settlementOwnerDetail.getOwnerUserNo(), JSONUtil.parse(runningWaterRecordList));
...@@ -198,7 +213,7 @@ public class OrderChildLoanComponent { ...@@ -198,7 +213,7 @@ public class OrderChildLoanComponent {
param.setChildNo(childNo); param.setChildNo(childNo);
param.setSettlementDriverDetail(settlementDriverDetail); param.setSettlementDriverDetail(settlementDriverDetail);
param.setSettlementOwnerDetail(settlementOwnerDetail); param.setSettlementOwnerDetail(settlementOwnerDetail);
//扣钱,获取锁,此处有可能钱不够,抛异常,走网络货运重试 //扣钱,获取锁,此处有可能钱不够,抛异常,
getLoanBalanceLock(param); getLoanBalanceLock(param);
runningWaterRecordList = ownerLoanAccountRunningWaterRecordDao.getListByOrderNoAndRunningWaterType runningWaterRecordList = ownerLoanAccountRunningWaterRecordDao.getListByOrderNoAndRunningWaterType
...@@ -237,7 +252,7 @@ public class OrderChildLoanComponent { ...@@ -237,7 +252,7 @@ public class OrderChildLoanComponent {
param.setChildNo(childNo); param.setChildNo(childNo);
param.setSettlementDriverDetail(settlementDriverDetail); param.setSettlementDriverDetail(settlementDriverDetail);
param.setSettlementOwnerDetail(settlementOwnerDetail); param.setSettlementOwnerDetail(settlementOwnerDetail);
//扣钱,获取锁,此处有可能钱不够,抛异常,走网络货运重试 //扣钱,获取锁,此处有可能钱不够,抛异常,
getLoanBalanceLock(param); getLoanBalanceLock(param);
runningWaterRecordList = ownerLoanAccountRunningWaterRecordDao.getListByOrderNoAndRunningWaterType runningWaterRecordList = ownerLoanAccountRunningWaterRecordDao.getListByOrderNoAndRunningWaterType
...@@ -386,4 +401,17 @@ public class OrderChildLoanComponent { ...@@ -386,4 +401,17 @@ public class OrderChildLoanComponent {
} }
} }
} }
/**
* 结算金额
*/
private BigDecimal settlementFreightCalc(Integer settlementWay, SettlementOwnerDetail settlementOwnerDetail) {
if (Objects.equals(settlementWay, SettlementWayEnum.WayType.LOAD.getCode())) { //订单结算方式为“装车净重”时,结算金额=实际净重*平台运费报价-预付运费-货损金额。
return settlementOwnerDetail.getWeight().multiply(settlementOwnerDetail.getFreightPrice())
.subtract(settlementOwnerDetail.getPrepayFreight()).subtract(settlementOwnerDetail.getLossFreight());
} else { //订单结算方式为“卸车净重”时,结算金额=实际净重*平台运费报价-预付运费
return settlementOwnerDetail.getWeight().multiply(settlementOwnerDetail.getFreightPrice()).subtract(settlementOwnerDetail.getPrepayFreight());
}
}
} }
...@@ -183,7 +183,21 @@ public class RabbitBeanConfig { ...@@ -183,7 +183,21 @@ public class RabbitBeanConfig {
* 货主借款支付处理 * 货主借款支付处理
*/ */
@Bean @Bean
public Binding ownerLoanBind() { public Binding ownerLoanPayBind() {
return BindingBuilder.bind(ownerLoanPayQueue()).to(ownerLoanExchange()).with(RabbitKeyConstants.OWNER_LOAN_PAY_ROUTE_KEY); return BindingBuilder.bind(ownerLoanPayQueue()).to(ownerLoanExchange()).with(RabbitKeyConstants.OWNER_LOAN_PAY_ROUTE_KEY);
} }
/**
* 货主借款队列
* @return
*/
@Bean
public Queue ownerLoanQueue() {
return new Queue(RabbitKeyConstants.OWNER_LOAN_QUEUE, true, false, false);
}
@Bean
public Binding ownerLoanBind() {
return BindingBuilder.bind(ownerLoanQueue()).to(ownerLoanExchange()).with(RabbitKeyConstants.OWNER_LOAN_ROUTE_KEY);
}
} }
...@@ -89,4 +89,8 @@ public class RabbitKeyConstants { ...@@ -89,4 +89,8 @@ public class RabbitKeyConstants {
public static final String OWNER_LOAN_PAY_ROUTE_KEY ="clx-performance.loan.pay.route.key"; public static final String OWNER_LOAN_PAY_ROUTE_KEY ="clx-performance.loan.pay.route.key";
public static final String OWNER_LOAN_PAY_QUEUE ="clx-performance.loan.pay.queue"; public static final String OWNER_LOAN_PAY_QUEUE ="clx-performance.loan.pay.queue";
public static final String OWNER_LOAN_ROUTE_KEY ="clx-performance.loan.route.key";
public static final String OWNER_LOAN_QUEUE ="clx-performance.loan.queue";
} }
...@@ -5,7 +5,7 @@ import com.clx.performance.param.pc.loan.carrier.*; ...@@ -5,7 +5,7 @@ import com.clx.performance.param.pc.loan.carrier.*;
import com.clx.performance.param.pc.loan.owner.ExportPaymentApplicationFormParam; import com.clx.performance.param.pc.loan.owner.ExportPaymentApplicationFormParam;
import com.clx.performance.service.loan.OwnerLoanRecordService; import com.clx.performance.service.loan.OwnerLoanRecordService;
import com.clx.performance.vo.pc.loan.carrier.CarrierCashierInfoVO; import com.clx.performance.vo.pc.loan.carrier.CarrierCashierInfoVO;
import com.clx.performance.vo.pc.loan.carrier.OwnerOrderPaymentDetailVO; import com.clx.performance.vo.pc.loan.carrier.CarrierOwnerOrderPaymentDetailVO;
import com.clx.performance.vo.pc.loan.carrier.OwnerLoanRecordVO; import com.clx.performance.vo.pc.loan.carrier.OwnerLoanRecordVO;
import com.clx.performance.vo.pc.loan.carrier.CarrierTransferPaymentDetailVO; import com.clx.performance.vo.pc.loan.carrier.CarrierTransferPaymentDetailVO;
import com.msl.common.base.PageData; import com.msl.common.base.PageData;
...@@ -48,7 +48,7 @@ public class CarrierOwnerLoanRecordController { ...@@ -48,7 +48,7 @@ public class CarrierOwnerLoanRecordController {
return Result.ok(); return Result.ok();
} }
@ApiOperation(value = "重新支付(只更改借款状态)",notes = "<br>By:胡宇帆") @ApiOperation(value = "借款重新支付(只更改借款状态)",notes = "<br>By:胡宇帆")
@GetMapping("/ownerLoanRecordRetryPay") @GetMapping("/ownerLoanRecordRetryPay")
public Result<Object> ownerLoanRecordRetryPay(@RequestParam(value = "loanNo") @NotBlank String loanNo) { public Result<Object> ownerLoanRecordRetryPay(@RequestParam(value = "loanNo") @NotBlank String loanNo) {
ownerLoanRecordService.ownerLoanRecordRetryPay(loanNo); ownerLoanRecordService.ownerLoanRecordRetryPay(loanNo);
...@@ -82,8 +82,8 @@ public class CarrierOwnerLoanRecordController { ...@@ -82,8 +82,8 @@ 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(@RequestParam("id") @NotNull(message = "id不能为空") Integer id) { public Result<CarrierOwnerOrderPaymentDetailVO> getOrderPaymentDetail(@Param("id") @NotNull(message = "id不能为空") Integer id) {
OwnerOrderPaymentDetailVO vo = ownerLoanRecordService.getOrderPaymentDetail(id); CarrierOwnerOrderPaymentDetailVO vo = ownerLoanRecordService.getOrderPaymentDetail(id);
return Result.ok(vo); return Result.ok(vo);
} }
......
...@@ -30,8 +30,19 @@ public class BankTradeDaoImpl extends BaseDaoImpl<BankTradeMapper, BankTrade, In ...@@ -30,8 +30,19 @@ public class BankTradeDaoImpl extends BaseDaoImpl<BankTradeMapper, BankTrade, In
return Optional.of(merchantRunningWaterNo) return Optional.of(merchantRunningWaterNo)
.map(item -> lQrWrapper() .map(item -> lQrWrapper()
.eq(BankTrade::getMerchantRunningWaterNo, item) .eq(BankTrade::getMerchantRunningWaterNo, item)
.orderByDesc(BankTrade::getId)
.last("limit 1") .last("limit 1")
) )
.map(super::getOne); .map(super::getOne);
} }
@Override
public Optional<BankTrade> selectByRelationNo(String relationNo) {
return Optional.of(relationNo)
.map(item -> lQrWrapper()
.eq(BankTrade::getRelationNo, item)
.orderByDesc(BankTrade::getId)
.last("limit 1")
)
.map(super::getOne); }
} }
package com.clx.performance.dao.impl.loan;
import com.clx.performance.dao.loan.OrderChildLoanRetryRecordDao;
import com.clx.performance.mapper.loan.OrderChildLoanRetryRecordMapper;
import com.clx.performance.model.loan.OrderChildLoanRetryRecord;
import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author kavin
* Date 2024-02-21
* Time 19:58
*/
@Repository
public class OrderChildLoanRetryRecordDaoImpl extends BaseDaoImpl<OrderChildLoanRetryRecordMapper, OrderChildLoanRetryRecord, Integer> implements OrderChildLoanRetryRecordDao {
@Override
public List<OrderChildLoanRetryRecord> selectListByIdAsc() {
return baseMapper.selectList(lQrWrapper().orderByAsc(OrderChildLoanRetryRecord::getId));
}
}
...@@ -80,4 +80,5 @@ public class SettlementDriverDetailDaoImpl extends BaseDaoImpl<SettlementDriverD ...@@ -80,4 +80,5 @@ public class SettlementDriverDetailDaoImpl extends BaseDaoImpl<SettlementDriverD
public List<SettlementDriverDetail> findByDriverSettlementIds(List<Integer> ids) { public List<SettlementDriverDetail> findByDriverSettlementIds(List<Integer> ids) {
return baseMapper.findByDriverSettlementIds(ids); return baseMapper.findByDriverSettlementIds(ids);
} }
} }
...@@ -154,4 +154,5 @@ public class SettlementOwnerDetailDaoImpl extends BaseDaoImpl<SettlementOwnerDet ...@@ -154,4 +154,5 @@ public class SettlementOwnerDetailDaoImpl extends BaseDaoImpl<SettlementOwnerDet
.set(SettlementOwnerDetail :: getSettlementNo,settlementNo) .set(SettlementOwnerDetail :: getSettlementNo,settlementNo)
); );
} }
} }
...@@ -18,4 +18,7 @@ public interface BankTradeDao extends BaseDao<BankTradeMapper, BankTrade, Intege ...@@ -18,4 +18,7 @@ public interface BankTradeDao extends BaseDao<BankTradeMapper, BankTrade, Intege
Optional<BankTrade> selectByMerchantRunningWaterNo(String merchantRunningWaterNo); Optional<BankTrade> selectByMerchantRunningWaterNo(String merchantRunningWaterNo);
Optional<BankTrade> selectByRelationNo(String relationNo);
} }
package com.clx.performance.dao.loan;
import com.clx.performance.mapper.loan.OrderChildLoanRetryRecordMapper;
import com.clx.performance.model.loan.OrderChildLoanRetryRecord;
import com.msl.common.dao.BaseDao;
import java.util.List;
/**
* @author kavin
* Date 2024-02-21
* Time 19:58
*/
public interface OrderChildLoanRetryRecordDao extends BaseDao<OrderChildLoanRetryRecordMapper, OrderChildLoanRetryRecord, Integer> {
List<OrderChildLoanRetryRecord> selectListByIdAsc();
}
...@@ -30,4 +30,5 @@ public interface SettlementDriverDetailDao extends BaseDao<SettlementDriverDetai ...@@ -30,4 +30,5 @@ public interface SettlementDriverDetailDao extends BaseDao<SettlementDriverDetai
List<SettlementDriverDetail> listUnPay(LocalDateTime beginTime); List<SettlementDriverDetail> listUnPay(LocalDateTime beginTime);
List<SettlementDriverDetail> findByDriverSettlementIds(List<Integer> ids); List<SettlementDriverDetail> findByDriverSettlementIds(List<Integer> ids);
} }
...@@ -46,4 +46,5 @@ public interface SettlementOwnerDetailDao extends BaseDao<SettlementOwnerDetailM ...@@ -46,4 +46,5 @@ public interface SettlementOwnerDetailDao extends BaseDao<SettlementOwnerDetailM
List<SettlementOwnerDetail> selectListByOrderNo(String orderNo); List<SettlementOwnerDetail> selectListByOrderNo(String orderNo);
void updateSettlementMerge(String settlementNo, List<String> settlementNos); void updateSettlementMerge(String settlementNo, List<String> settlementNos);
} }
package com.clx.performance.dto;
import com.clx.performance.model.OrderChild;
import com.clx.performance.model.settle.SettlementDriverDetail;
import com.clx.performance.model.settle.SettlementOwnerDetail;
import lombok.Data;
@Data
public class OwnerLoanMqDTO {
private SettlementOwnerDetail settlementOwnerDetail;
private SettlementDriverDetail settlementDriverDetail;
private OrderChild orderChild;
}
package com.clx.performance.event;
import cn.hutool.json.JSONUtil;
import com.clx.performance.dao.loan.OrderChildLoanRetryRecordDao;
import com.clx.performance.dao.settle.SettlementDriverDetailDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.model.loan.OrderChildLoanRetryRecord;
import com.clx.performance.model.settle.SettlementDriverDetail;
import com.clx.performance.model.settle.SettlementOwnerDetail;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
@Component
@Slf4j
@AllArgsConstructor
public class SettlementListener {
private final SettlementOwnerDetailDao settlementOwnerDetailDao;
private final SettlementDriverDetailDao settlementDriverDetailDao;
private final OrderChildLoanRetryRecordDao orderChildLoanRetryRecordDao;
@EventListener(classes = {SettlementUpdateEvent.class})
public void listen(SettlementUpdateEvent event) {
SettlementOwnerDetail settlementOwnerDetail = event.getSettlementOwnerDetail();
SettlementDriverDetail settlementDriverDetail = event.getSettlementDriverDetail();
log.info("当前货主结算信息{},车主结算信息:{}", JSONUtil.parse(settlementOwnerDetail), JSONUtil.parse(settlementDriverDetail));
settlementOwnerDetailDao.updateInvoiceType(settlementOwnerDetail);
settlementDriverDetailDao.updateInvoiceTypeAndPrepayFreightFlag(settlementDriverDetail);
OrderChildLoanRetryRecord entity = new OrderChildLoanRetryRecord();
entity.setSettlementOwnerId(settlementOwnerDetail.getId());
entity.setSettlementDriverId(settlementDriverDetail.getId());
// 保存重试记录
orderChildLoanRetryRecordDao.saveEntity(entity);
}
}
package com.clx.performance.event;
import com.clx.performance.model.settle.SettlementDriverDetail;
import com.clx.performance.model.settle.SettlementOwnerDetail;
import org.springframework.context.ApplicationEvent;
public class SettlementUpdateEvent extends ApplicationEvent {
private SettlementDriverDetail settlementDriverDetail;
private SettlementOwnerDetail settlementOwnerDetail;
/**
* Create a new {@code ApplicationEvent}.
*
* @param source the object on which the event initially occurred or with
* which the event is associated (never {@code null})
*/
public SettlementUpdateEvent(Object source) {
super(source);
}
public SettlementUpdateEvent(Object source, SettlementDriverDetail settlementDriverDetail, SettlementOwnerDetail settlementOwnerDetail) {
super(source);
this.settlementDriverDetail = settlementDriverDetail;
this.settlementOwnerDetail = settlementOwnerDetail;
}
public SettlementDriverDetail getSettlementDriverDetail() {
return settlementDriverDetail;
}
public void setSettlementDriverDetail(SettlementDriverDetail settlementDriverDetail) {
this.settlementDriverDetail = settlementDriverDetail;
}
public SettlementOwnerDetail getSettlementOwnerDetail() {
return settlementOwnerDetail;
}
public void setSettlementOwnerDetail(SettlementOwnerDetail settlementOwnerDetail) {
this.settlementOwnerDetail = settlementOwnerDetail;
}
}
...@@ -12,6 +12,7 @@ import com.clx.performance.dao.OwnerRunningWaterRecordDao; ...@@ -12,6 +12,7 @@ import com.clx.performance.dao.OwnerRunningWaterRecordDao;
import com.clx.performance.dao.settle.SettlementDriverDetailDao; import com.clx.performance.dao.settle.SettlementDriverDetailDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao; import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.dto.OrderChildSyncDTO; import com.clx.performance.dto.OrderChildSyncDTO;
import com.clx.performance.dto.OwnerLoanMqDTO;
import com.clx.performance.enums.*; import com.clx.performance.enums.*;
import com.clx.performance.enums.settle.SettlementDriverEnum; import com.clx.performance.enums.settle.SettlementDriverEnum;
import com.clx.performance.enums.settle.SettlementOwnerDetailEnum; import com.clx.performance.enums.settle.SettlementOwnerDetailEnum;
...@@ -29,7 +30,10 @@ import com.msl.common.dto.HttpDTO; ...@@ -29,7 +30,10 @@ import com.msl.common.dto.HttpDTO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -64,9 +68,7 @@ public class OrderChildSyncTransportListener { ...@@ -64,9 +68,7 @@ public class OrderChildSyncTransportListener {
private final OrderChildSyncTransportInvoiceRecordDao orderChildSyncTransportInvoiceRecordDao; private final OrderChildSyncTransportInvoiceRecordDao orderChildSyncTransportInvoiceRecordDao;
private final SettlementMqService settlementMqService; private final RabbitTemplate rabbitTemplate;
private final OrderChildLoanComponent orderChildLoanComponent;
@RabbitListener(queues = RabbitKeyConstants.ORDER_CHILD_SYNC_TRANSPORT_QUEUE) @RabbitListener(queues = RabbitKeyConstants.ORDER_CHILD_SYNC_TRANSPORT_QUEUE)
public void onMessage(String message) { public void onMessage(String message) {
...@@ -164,8 +166,6 @@ public class OrderChildSyncTransportListener { ...@@ -164,8 +166,6 @@ public class OrderChildSyncTransportListener {
settlementOwnerDetail.setPrepayFreight(BigDecimal.ZERO); settlementOwnerDetail.setPrepayFreight(BigDecimal.ZERO);
settlementOwnerDetail.setFinalPaymentStatus(SettlementOwnerDetailEnum.FinalPaymentStatus.NO.getCode()); settlementOwnerDetail.setFinalPaymentStatus(SettlementOwnerDetailEnum.FinalPaymentStatus.NO.getCode());
} }
// 结算金额
settlementOwnerDetail.setSettlementFreight(settlementFreightCalc(orderChild.getSettlementWay(), settlementOwnerDetail));
if (SettlementOwnerEnum.InvoiceType.ORDINARY.getCode().equals(invoiceType)) { if (SettlementOwnerEnum.InvoiceType.ORDINARY.getCode().equals(invoiceType)) {
if (settlementOwnerDetail.getSettlementFreight().compareTo(BigDecimal.ZERO) == 0) { if (settlementOwnerDetail.getSettlementFreight().compareTo(BigDecimal.ZERO) == 0) {
...@@ -179,16 +179,15 @@ public class OrderChildSyncTransportListener { ...@@ -179,16 +179,15 @@ public class OrderChildSyncTransportListener {
settlementOwnerDetail.setInvoiceType(invoiceType); settlementOwnerDetail.setInvoiceType(invoiceType);
settlementDriverDetail.setInvoiceType(invoiceType); settlementDriverDetail.setInvoiceType(invoiceType);
//生成借款标识 //货主借款监听器处理
orderChildLoanComponent.childLoanConfirmAfterProcess(settlementDriverDetail, settlementOwnerDetail); OwnerLoanMqDTO dto = new OwnerLoanMqDTO();
dto.setSettlementOwnerDetail(settlementOwnerDetail);
log.info("当前货主结算信息{},车主结算信息:{}", JSONUtil.parse(settlementOwnerDetail), JSONUtil.parse(settlementDriverDetail)); dto.setSettlementDriverDetail(settlementDriverDetail);
settlementOwnerDetailDao.updateInvoiceType(settlementOwnerDetail); dto.setOrderChild(orderChild);
settlementDriverDetailDao.updateInvoiceTypeAndPrepayFreightFlag(settlementDriverDetail); Message message = MessageBuilder.withBody(JSONUtil.parse(dto).toString().getBytes()).build();
rabbitTemplate.send(
// 发送mq 通过开票标识 RabbitKeyConstants.OWNER_LOAN_EXCHANGE, RabbitKeyConstants.OWNER_LOAN_ROUTE_KEY, message
settlementMqService.invoiceTypeSync(orderChild.getChildNo(), invoiceType); ); }
}
private void generateTakeOutRunningWatter(OrderChild orderChild, BigDecimal ans, SettlementOwnerDetail settlementOwnerDetail, SettlementDriverDetail settlementDriverDetail) { private void generateTakeOutRunningWatter(OrderChild orderChild, BigDecimal ans, SettlementOwnerDetail settlementOwnerDetail, SettlementDriverDetail settlementDriverDetail) {
OwnerAccount account = null; OwnerAccount account = null;
...@@ -252,17 +251,7 @@ public class OrderChildSyncTransportListener { ...@@ -252,17 +251,7 @@ public class OrderChildSyncTransportListener {
} }
} }
/**
* 结算金额
*/
private BigDecimal settlementFreightCalc(Integer settlementWay, SettlementOwnerDetail settlementOwnerDetail) {
if (Objects.equals(settlementWay, SettlementWayEnum.WayType.LOAD.getCode())) { //订单结算方式为“装车净重”时,结算金额=实际净重*平台运费报价-预付运费-货损金额。
return settlementOwnerDetail.getWeight().multiply(settlementOwnerDetail.getFreightPrice())
.subtract(settlementOwnerDetail.getPrepayFreight()).subtract(settlementOwnerDetail.getLossFreight());
} else { //订单结算方式为“卸车净重”时,结算金额=实际净重*平台运费报价-预付运费
return settlementOwnerDetail.getWeight().multiply(settlementOwnerDetail.getFreightPrice()).subtract(settlementOwnerDetail.getPrepayFreight());
}
}
/** /**
* 开票金额 * 开票金额
......
package com.clx.performance.listener;
import cn.hutool.json.JSONUtil;
import com.clx.performance.component.OrderChildLoanComponent;
import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.dao.settle.SettlementDriverDetailDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.dto.OwnerLoanMqDTO;
import com.clx.performance.enums.loan.OwnerLoanRecordEnum;
import com.clx.performance.event.SettlementUpdateEvent;
import com.clx.performance.model.OrderChild;
import com.clx.performance.model.settle.SettlementDriverDetail;
import com.clx.performance.model.settle.SettlementOwnerDetail;
import com.clx.performance.service.settle.SettlementMqService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;
/**
* 处理货主借款监听器
*/
@Slf4j
@Component
@AllArgsConstructor
public class OwnerLoanListener {
private final OrderChildLoanComponent orderChildLoanComponent;
private final SettlementMqService settlementMqService;
private final ApplicationEventPublisher applicationEventPublisher;
private final SettlementOwnerDetailDao settlementOwnerDetailDao;
private final SettlementDriverDetailDao settlementDriverDetailDao;
@RabbitListener(queues = RabbitKeyConstants.OWNER_LOAN_QUEUE)
public void onMessage(String message) {
log.info("处理货主借款监听器执行,数据为{}", message);
OwnerLoanMqDTO param = JSONUtil.toBean(message, OwnerLoanMqDTO.class);
SettlementOwnerDetail settlementOwnerDetail = param.getSettlementOwnerDetail();
SettlementDriverDetail settlementDriverDetail = param.getSettlementDriverDetail();
OrderChild orderChild = param.getOrderChild();
try {
//生成借款标识
orderChildLoanComponent.childLoanConfirmAfterProcess(settlementDriverDetail, settlementOwnerDetail, orderChild);
} catch (Exception e) {
log.error("处理货主借款监听器执行异常,数据为{}", message, e);
//未借款
settlementDriverDetail.setLoanFlag(OwnerLoanRecordEnum.LoanFlag.NO_LOAN.getCode());
applicationEventPublisher.publishEvent(new SettlementUpdateEvent(this, settlementDriverDetail, settlementOwnerDetail));
throw e;
}
settlementOwnerDetailDao.updateInvoiceType(settlementOwnerDetail);
settlementDriverDetailDao.updateInvoiceTypeAndPrepayFreightFlag(settlementDriverDetail);
// 发送mq 通过开票标识
settlementMqService.invoiceTypeSync(settlementDriverDetail.getChildNo(), settlementDriverDetail.getInvoiceType());
}
}
package com.clx.performance.listener; package com.clx.performance.listener;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.clx.performance.OwnerLoanPayNotifyMqParam; import com.clx.performance.param.OwnerLoanPayNotifyMqParam;
import com.clx.performance.constant.RabbitKeyConstants; import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.enums.nbbank.NbBankStatusEnum; import com.clx.performance.enums.nbbank.NbBankStatusEnum;
import com.clx.performance.service.loan.OwnerLoanRecordService; import com.clx.performance.service.loan.OwnerLoanRecordService;
...@@ -29,11 +29,11 @@ public class OwnerLoanPayNotifyListener { ...@@ -29,11 +29,11 @@ public class OwnerLoanPayNotifyListener {
if (Objects.equals(param.getPayStatus(), NbBankStatusEnum.Status.SUCCESS.getCode())) { if (Objects.equals(param.getPayStatus(), NbBankStatusEnum.Status.SUCCESS.getCode())) {
// 支付成功 // 支付成功
ownerLoanRecordService.paySuccess(param.getLoanNo()); ownerLoanRecordService.paySuccess(param.getMerSeqNo());
} }
else if (Objects.equals(param.getPayStatus(), NbBankStatusEnum.Status.FAIL.getCode())) { else if (Objects.equals(param.getPayStatus(), NbBankStatusEnum.Status.FAIL.getCode())) {
// 支付失败 // 支付失败
ownerLoanRecordService.payFail(param.getLoanNo()); ownerLoanRecordService.payFail(param.getMerSeqNo());
} }
} }
} }
package com.clx.performance.mapper.loan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.clx.performance.model.loan.OrderChildLoanRetryRecord;
/**
* @author kavin
* Date 2024-02-21
* Time 19:58
*/
public interface OrderChildLoanRetryRecordMapper extends BaseMapper<OrderChildLoanRetryRecord> {
}
...@@ -36,6 +36,7 @@ public class BankTrade implements HasKey<Integer> { ...@@ -36,6 +36,7 @@ public class BankTrade implements HasKey<Integer> {
private String remark; //备注 private String remark; //备注
private LocalDateTime createTime; //创建时间 private LocalDateTime createTime; //创建时间
private LocalDateTime modifiedTime; //修改时间 private LocalDateTime modifiedTime; //修改时间
private String relationNo;
@KeyColumn("id") @KeyColumn("id")
@Override @Override
......
package com.clx.performance.model.loan;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.msl.common.config.KeyColumn;
import com.msl.common.model.HasKey;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
/**
* @author kavin
* Date 2024-02-21
* Time 19:58
*/
@Getter
@Setter
@Accessors(chain = true)
@TableName("order_child_loan_retry_record")
public class OrderChildLoanRetryRecord implements HasKey<Integer> {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableField("settlement_driver_id")
@ApiModelProperty("车主计费主键")
private Integer settlementDriverId;
@TableField("settlement_owner_id")
@ApiModelProperty("货主计费主键")
private Integer settlementOwnerId;
@TableField("create_time")
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@TableField("modified_time")
@ApiModelProperty("修改时间")
private LocalDateTime modifiedTime;
@Override
@KeyColumn("id")
public Integer gainKey() {
return this.id;
}
}
...@@ -84,12 +84,9 @@ public class OwnerLoanRecord implements HasKey<Integer> { ...@@ -84,12 +84,9 @@ public class OwnerLoanRecord implements HasKey<Integer> {
@ApiModelProperty("汇款识别码") @ApiModelProperty("汇款识别码")
private String remittanceIdentificationCode; private String remittanceIdentificationCode;
@TableField("lending_party_id")
@ApiModelProperty("借出方ID")
private String lendingPartyId;
@TableField("lending_party") @TableField("lending_party")
@ApiModelProperty("借方") @ApiModelProperty("借方")
private String lendingParty; private String lendingParty;
@TableField("lending_party_account") @TableField("lending_party_account")
......
package com.clx.performance.service.impl.loan; package com.clx.performance.service.impl.loan;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.component.OrderChildLoanComponent;
import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.dao.OrderChildDao;
import com.clx.performance.dao.loan.OrderChildLoanRetryRecordDao;
import com.clx.performance.dao.loan.OwnerLoanAccountDao; import com.clx.performance.dao.loan.OwnerLoanAccountDao;
import com.clx.performance.dao.settle.SettlementDriverDetailDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.dto.OwnerLoanMqDTO;
import com.clx.performance.model.OrderChild;
import com.clx.performance.model.breakcontract.BreakContractSettlementDriver;
import com.clx.performance.model.loan.OrderChildLoanRetryRecord;
import com.clx.performance.model.loan.OwnerLoanAccount; import com.clx.performance.model.loan.OwnerLoanAccount;
import com.clx.performance.model.settle.SettlementDriverDetail;
import com.clx.performance.model.settle.SettlementOwnerDetail;
import com.clx.performance.param.pc.loan.carrier.PageOwnerLoanAccountParam; import com.clx.performance.param.pc.loan.carrier.PageOwnerLoanAccountParam;
import com.clx.performance.service.loan.OwnerLoanAccountService; import com.clx.performance.service.loan.OwnerLoanAccountService;
import com.clx.performance.struct.loan.OwnerLoanAccountStruct; import com.clx.performance.struct.loan.OwnerLoanAccountStruct;
...@@ -14,10 +27,14 @@ import com.msl.user.data.UserSessionData; ...@@ -14,10 +27,14 @@ import com.msl.user.data.UserSessionData;
import com.msl.user.utils.TokenUtil; 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.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
/** /**
* @author kavin * @author kavin
...@@ -27,12 +44,22 @@ import java.math.BigDecimal; ...@@ -27,12 +44,22 @@ import java.math.BigDecimal;
@Service @Service
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
public class OwnerLoanAccountServiceImpl implements OwnerLoanAccountService { public class OwnerLoanAccountServiceImpl implements OwnerLoanAccountService {
private final OwnerLoanAccountDao ownerLoanAccountDao; private final OwnerLoanAccountDao ownerLoanAccountDao;
private final OwnerLoanAccountStruct ownerLoanAccountStruct; private final OwnerLoanAccountStruct ownerLoanAccountStruct;
private final OrderChildDao orderChildDao;
private final SettlementDriverDetailDao settlementDriverDetailDao;
private final SettlementOwnerDetailDao settlementOwnerDetailDao;
private final OrderChildLoanRetryRecordDao orderChildLoanRetryRecordDao;
private final RabbitTemplate rabbitTemplate;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void openOwnerLoanAccount(Long ownerUserNo, String ownerUserName, String mobile) { public void openOwnerLoanAccount(Long ownerUserNo, String ownerUserName, String mobile) {
...@@ -63,12 +90,40 @@ public class OwnerLoanAccountServiceImpl implements OwnerLoanAccountService { ...@@ -63,12 +90,40 @@ public class OwnerLoanAccountServiceImpl implements OwnerLoanAccountService {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo(); UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
Optional<OwnerLoanAccount> optional = ownerLoanAccountDao.getOneByField(OwnerLoanAccount::getOwnerUserNo, Optional<OwnerLoanAccount> optional = ownerLoanAccountDao.getOneByField(OwnerLoanAccount::getOwnerUserNo,
loginUserInfo.getUserNo()); loginUserInfo.getUserNo());
if(!optional.isPresent()){ if (!optional.isPresent()) {
return OwnerAccountVO.builder().openAccount(0).build(); return OwnerAccountVO.builder().openAccount(0).build();
} }
OwnerLoanAccount ownerLoanAccount = optional.get(); OwnerLoanAccount ownerLoanAccount = optional.get();
OwnerAccountVO ownerAccountVO = ownerLoanAccountStruct.convertVO(ownerLoanAccount); OwnerAccountVO ownerAccountVO = ownerLoanAccountStruct.convertVO(ownerLoanAccount);
ownerAccountVO.setOpenAccount(1); ownerAccountVO.setOpenAccount(1);
return ownerAccountVO; return ownerAccountVO;
} }
/**
* 货主借款后执行阻塞流程的相关运单
*
* @param ownerUserNo
*/
@Override
public void orderChildLoanProcess(Long ownerUserNo) {
List<OrderChildLoanRetryRecord> orderChildLoanRetryRecordList = orderChildLoanRetryRecordDao.selectListByIdAsc();
for (OrderChildLoanRetryRecord retryRecord : orderChildLoanRetryRecordList) {
//生成借款标识
SettlementDriverDetail settlementDriverDetail = settlementDriverDetailDao.getEntityByKey(retryRecord.getSettlementDriverId()).get();
SettlementOwnerDetail settlementOwnerDetail = settlementOwnerDetailDao.getEntityByKey(retryRecord.getSettlementOwnerId()).get();
OrderChild orderChild = orderChildDao.getByChildNo(settlementDriverDetail.getChildNo()).get();
OwnerLoanMqDTO dto = new OwnerLoanMqDTO();
dto.setSettlementOwnerDetail(settlementOwnerDetail);
dto.setSettlementDriverDetail(settlementDriverDetail);
dto.setOrderChild(orderChild);
//货主借款监听器处理
Message message = MessageBuilder.withBody(JSONUtil.parse(dto).toString().getBytes()).build();
rabbitTemplate.send(
RabbitKeyConstants.OWNER_LOAN_EXCHANGE, RabbitKeyConstants.OWNER_LOAN_ROUTE_KEY, message
);
orderChildLoanRetryRecordDao.deleteByKey(retryRecord.getId());
}
}
} }
...@@ -3,6 +3,7 @@ package com.clx.performance.service.impl.settle; ...@@ -3,6 +3,7 @@ package com.clx.performance.service.impl.settle;
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.performance.dao.settle.SettlementDriverDetailDao; import com.clx.performance.dao.settle.SettlementDriverDetailDao;
import com.clx.performance.enums.loan.OwnerLoanRecordEnum;
import com.clx.performance.model.OrderChild; import com.clx.performance.model.OrderChild;
import com.clx.performance.model.settle.SettlementDriverDetail; import com.clx.performance.model.settle.SettlementDriverDetail;
import com.clx.performance.param.pc.driver.PageCarrierSettlementDriverDetailParam; import com.clx.performance.param.pc.driver.PageCarrierSettlementDriverDetailParam;
...@@ -58,7 +59,6 @@ public class SettlementDriverDetailServiceImpl implements SettlementDriverDetai ...@@ -58,7 +59,6 @@ public class SettlementDriverDetailServiceImpl implements SettlementDriverDetai
// 预付运费 // 预付运费
settlementDriverDetail.setPrepayFreight(BigDecimal.ZERO); settlementDriverDetail.setPrepayFreight(BigDecimal.ZERO);
// 结算金额 // 结算金额
settlementDriverDetail.setSettlementFreight(settlementFreightCalc(settlementDriverDetail.getFreight(), settlementDriverDetail.getLossFreight())); settlementDriverDetail.setSettlementFreight(settlementFreightCalc(settlementDriverDetail.getFreight(), settlementDriverDetail.getLossFreight()));
......
...@@ -2,7 +2,7 @@ package com.clx.performance.service.impl.thirdparty.nbbank; ...@@ -2,7 +2,7 @@ package com.clx.performance.service.impl.thirdparty.nbbank;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.clx.performance.OwnerLoanPayNotifyMqParam; import com.clx.performance.param.OwnerLoanPayNotifyMqParam;
import com.clx.performance.component.IdGenerateSnowFlake; import com.clx.performance.component.IdGenerateSnowFlake;
import com.clx.performance.constant.RabbitKeyConstants; import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.dao.loan.BankTradeDao; import com.clx.performance.dao.loan.BankTradeDao;
...@@ -10,11 +10,9 @@ import com.clx.performance.enums.PerformanceResultEnum; ...@@ -10,11 +10,9 @@ import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.loan.BankTradeEnum; import com.clx.performance.enums.loan.BankTradeEnum;
import com.clx.performance.enums.nbbank.NbBankStatusEnum; import com.clx.performance.enums.nbbank.NbBankStatusEnum;
import com.clx.performance.model.loan.BankTrade; import com.clx.performance.model.loan.BankTrade;
import com.clx.performance.service.loan.OwnerLoanRecordService;
import com.clx.performance.service.thirdparty.nbbank.NbBankService; import com.clx.performance.service.thirdparty.nbbank.NbBankService;
import com.clx.performance.service.thirdparty.nbbank.NbBankThirdpartyService; import com.clx.performance.service.thirdparty.nbbank.NbBankThirdpartyService;
import com.clx.performance.utils.LocalDateTimeUtils; import com.clx.performance.utils.LocalDateTimeUtils;
import com.clx.performance.utils.SpringContextUtils;
import com.clx.performance.vo.pc.nbbank.NbBankOrderPayResultVO; import com.clx.performance.vo.pc.nbbank.NbBankOrderPayResultVO;
import com.clx.performance.vo.pc.nbbank.NbBankOrderResultVO; import com.clx.performance.vo.pc.nbbank.NbBankOrderResultVO;
import com.msl.common.exception.ServiceSystemException; import com.msl.common.exception.ServiceSystemException;
...@@ -87,7 +85,7 @@ public class NbBankServiceImpl implements NbBankService { ...@@ -87,7 +85,7 @@ public class NbBankServiceImpl implements NbBankService {
@Override @Override
public NbBankOrderPayResultVO orderDirectPay(Long loanNo, Integer amount, public NbBankOrderPayResultVO orderDirectPay(Long loanNo, Integer amount,
String payAcctOpenBankId, String payAcctNo, String payAcctNm) { String payAcctOpenBankId, String payAcctNo, String payAcctNm) {
String merSeqNo = String.valueOf(loanNo); String merSeqNo = idGenerateSnowFlake.nextIdToString(1L);
String merDtTm = LocalDateTimeUtils.formatTime(); String merDtTm = LocalDateTimeUtils.formatTime();
String closeDtTm = LocalDateTimeUtils.formatTime(LocalDateTimeUtils.parseTime(merDtTm).plusDays(30)); String closeDtTm = LocalDateTimeUtils.formatTime(LocalDateTimeUtils.parseTime(merDtTm).plusDays(30));
...@@ -240,7 +238,7 @@ public class NbBankServiceImpl implements NbBankService { ...@@ -240,7 +238,7 @@ public class NbBankServiceImpl implements NbBankService {
// 货主借款支付回调 // 货主借款支付回调
if (Objects.equals(bankTrade.getOrderType(), BankTradeEnum.OrderType.OWNER_LOAN_RECORD.getCode())){ if (Objects.equals(bankTrade.getOrderType(), BankTradeEnum.OrderType.OWNER_LOAN_RECORD.getCode())){
OwnerLoanPayNotifyMqParam param = new OwnerLoanPayNotifyMqParam(); OwnerLoanPayNotifyMqParam param = new OwnerLoanPayNotifyMqParam();
param.setLoanNo(merSeqNo); param.setMerSeqNo(merSeqNo);
param.setPayStatus(transStatus); param.setPayStatus(transStatus);
Message message = MessageBuilder.withBody(JSONUtil.parse(param).toString().getBytes()).build(); Message message = MessageBuilder.withBody(JSONUtil.parse(param).toString().getBytes()).build();
......
...@@ -17,4 +17,6 @@ public interface OwnerLoanAccountService { ...@@ -17,4 +17,6 @@ public interface OwnerLoanAccountService {
IPage<CarrierOwnerLoanAccountVO> pageOwnerLoanAccount(PageOwnerLoanAccountParam param); IPage<CarrierOwnerLoanAccountVO> pageOwnerLoanAccount(PageOwnerLoanAccountParam param);
OwnerAccountVO getOwnerLoanAccount(); OwnerAccountVO getOwnerLoanAccount();
void orderChildLoanProcess(Long ownerUserNo);
} }
...@@ -8,7 +8,7 @@ import com.clx.performance.param.pc.loan.owner.OwnerLoanRecordParam; ...@@ -8,7 +8,7 @@ import com.clx.performance.param.pc.loan.owner.OwnerLoanRecordParam;
import com.clx.performance.vo.pc.loan.carrier.CarrierCashierInfoVO; import com.clx.performance.vo.pc.loan.carrier.CarrierCashierInfoVO;
import com.clx.performance.vo.pc.loan.carrier.CarrierTransferPaymentDetailVO; import com.clx.performance.vo.pc.loan.carrier.CarrierTransferPaymentDetailVO;
import com.clx.performance.vo.pc.loan.carrier.OwnerLoanRecordVO; import com.clx.performance.vo.pc.loan.carrier.OwnerLoanRecordVO;
import com.clx.performance.vo.pc.loan.carrier.OwnerOrderPaymentDetailVO; import com.clx.performance.vo.pc.loan.carrier.CarrierOwnerOrderPaymentDetailVO;
import com.clx.performance.vo.pc.loan.owner.OwnerLoanRecordDetail; import com.clx.performance.vo.pc.loan.owner.OwnerLoanRecordDetail;
...@@ -31,7 +31,7 @@ public interface OwnerLoanRecordService { ...@@ -31,7 +31,7 @@ public interface OwnerLoanRecordService {
CarrierCashierInfoVO getCashierInfo(Integer id); CarrierCashierInfoVO getCashierInfo(Integer id);
OwnerOrderPaymentDetailVO getOrderPaymentDetail(Integer id); CarrierOwnerOrderPaymentDetailVO getOrderPaymentDetail(Integer id);
CarrierTransferPaymentDetailVO getTransferPaymentDetail(Integer id); CarrierTransferPaymentDetailVO getTransferPaymentDetail(Integer id);
...@@ -42,9 +42,9 @@ public interface OwnerLoanRecordService { ...@@ -42,9 +42,9 @@ public interface OwnerLoanRecordService {
void updateOwnerLoanRecordRepay(CarrierOwnerLoanRecordRepayParam param); void updateOwnerLoanRecordRepay(CarrierOwnerLoanRecordRepayParam param);
void updateOwnerLoanRecordPayCancel(CarrierOwnerLoanRecordPayCancelParam param); void updateOwnerLoanRecordPayCancel(CarrierOwnerLoanRecordPayCancelParam param);
void payFail(String loanNo); void payFail(String merSeqNo);
void paySuccess(String loanNo); void paySuccess(String merSeqNo);
void ownerLoanRecordRetryPay(String loanNo); void ownerLoanRecordRetryPay(String loanNo);
......
...@@ -33,7 +33,7 @@ public class BorrowerSqlProvider { ...@@ -33,7 +33,7 @@ public class BorrowerSqlProvider {
public String selectAllBorrowConfig() { public String selectAllBorrowConfig() {
return new SQL(){{ return new SQL(){{
SELECT(" a.name,a.bank_card_no as bankCardNo,b.type,b.day "); SELECT(" a.id,a.name,a.bank_card_no as bankCardNo,b.type,b.day ");
FROM("borrower a"); FROM("borrower a");
LEFT_OUTER_JOIN("borrower_config b on a.id = b.borrower_id "); LEFT_OUTER_JOIN("borrower_config b on a.id = b.borrower_id ");
WHERE("a.delete_status = " + DeleteStatusEnum.NO.getCode()); WHERE("a.delete_status = " + DeleteStatusEnum.NO.getCode());
......
...@@ -19,7 +19,7 @@ public class OwnerLoanRecordSqlProvider { ...@@ -19,7 +19,7 @@ public class OwnerLoanRecordSqlProvider {
" running_water_open_no as runningWaterOpenNo, merchant_running_water_no as merchantRunningWaterNo, " + " running_water_open_no as runningWaterOpenNo, merchant_running_water_no as merchantRunningWaterNo, " +
" loan_no as loanNo, loan_type as loanType, loan_balance as loanBalance, " + " loan_no as loanNo, loan_type as loanType, loan_balance as loanBalance, " +
" borrower, borrower_account as borrowerAccount, remittance_identification_code as remittanceIdentificationCode, " + " borrower, borrower_account as borrowerAccount, remittance_identification_code as remittanceIdentificationCode, " +
" lending_party_id as lendingPartyId, lending_party as lendingParty, lending_party_account as lendingPartyAccount, " + " lending_party as lendingParty, lending_party_account as lendingPartyAccount, " +
" payee, payee_account as payeeAccount, " + " payee, payee_account as payeeAccount, " +
" status, " + " status, " +
" date_format(approve_time, '%Y-%m-%d %H:%i:%s') as approveTime, approve_by as approveBy, " + " date_format(approve_time, '%Y-%m-%d %H:%i:%s') as approveTime, approve_by as approveBy, " +
......
...@@ -2,8 +2,8 @@ package com.clx.performance.struct.loan; ...@@ -2,8 +2,8 @@ package com.clx.performance.struct.loan;
import com.clx.performance.model.loan.OwnerLoanRecord; import com.clx.performance.model.loan.OwnerLoanRecord;
import com.clx.performance.vo.pc.loan.carrier.CarrierCashierInfoVO; import com.clx.performance.vo.pc.loan.carrier.CarrierCashierInfoVO;
import com.clx.performance.vo.pc.loan.carrier.CarrierOwnerOrderPaymentDetailVO;
import com.clx.performance.vo.pc.loan.carrier.ExportOwnerLoanRecordVO; import com.clx.performance.vo.pc.loan.carrier.ExportOwnerLoanRecordVO;
import com.clx.performance.vo.pc.loan.carrier.OwnerOrderPaymentDetailVO;
import com.clx.performance.vo.pc.loan.carrier.OwnerLoanRecordVO; import com.clx.performance.vo.pc.loan.carrier.OwnerLoanRecordVO;
import com.msl.common.utils.DateStructUtil; import com.msl.common.utils.DateStructUtil;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
...@@ -19,7 +19,7 @@ public interface OwnerLoanRecordStruct { ...@@ -19,7 +19,7 @@ public interface OwnerLoanRecordStruct {
CarrierCashierInfoVO convertCashierInfo(OwnerLoanRecord ownerLoanRecord); CarrierCashierInfoVO convertCashierInfo(OwnerLoanRecord ownerLoanRecord);
OwnerOrderPaymentDetailVO convertOrderPaymentDetail(OwnerLoanRecord ownerLoanRecord); CarrierOwnerOrderPaymentDetailVO convertOrderPaymentDetail(OwnerLoanRecord ownerLoanRecord);
ExportOwnerLoanRecordVO convert(OwnerLoanRecord ownerLoanRecord); ExportOwnerLoanRecordVO convert(OwnerLoanRecord ownerLoanRecord);
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论