Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-performance
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
姜武杰
clx-performance
Commits
b35f3996
提交
b35f3996
authored
2月 23, 2024
作者:
liuhaiquan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/v10.7_borrowing_and_repayment_20240118' into test
# Conflicts: # performance-web/src/main/java/com/clx/performance/controller/temp/TempBankController.java
上级
4577b68b
4186ee28
隐藏空白字符变更
内嵌
并排
正在显示
48 个修改的文件
包含
833 行增加
和
107 行删除
+833
-107
PerformanceResultEnum.java
...java/com/clx/performance/enums/PerformanceResultEnum.java
+2
-0
OwnerLoanRecordEnum.java
...a/com/clx/performance/enums/loan/OwnerLoanRecordEnum.java
+2
-1
OwnerRePaymentEnum.java
...va/com/clx/performance/enums/loan/OwnerRePaymentEnum.java
+3
-2
OwnerBankNotifyMqParam.java
...ava/com/clx/performance/param/OwnerBankNotifyMqParam.java
+1
-1
OwnerRepaymentParam.java
...erformance/param/pc/loan/carrier/OwnerRepaymentParam.java
+18
-0
PageCarrierOwnerLoanRecordParam.java
...aram/pc/loan/carrier/PageCarrierOwnerLoanRecordParam.java
+1
-1
PageOwnerLoanRecordOfOwner.java
...nce/param/pc/loan/carrier/PageOwnerLoanRecordOfOwner.java
+2
-1
CarrierOwnerOrderPaymentDetailVO.java
.../vo/pc/loan/carrier/CarrierOwnerOrderPaymentDetailVO.java
+1
-1
CarrierOwnerPaymentVO.java
...performance/vo/pc/loan/carrier/CarrierOwnerPaymentVO.java
+37
-0
CarrierTransferPaymentDetailVO.java
...ce/vo/pc/loan/carrier/CarrierTransferPaymentDetailVO.java
+3
-0
ExportOwnerLoanRecordVO.java
...rformance/vo/pc/loan/carrier/ExportOwnerLoanRecordVO.java
+2
-2
OwnerLoanRecordVO.java
...clx/performance/vo/pc/loan/carrier/OwnerLoanRecordVO.java
+2
-2
OwnerPaymentVO.java
...om/clx/performance/vo/pc/loan/carrier/OwnerPaymentVO.java
+4
-3
OwnerOrderPaymentDetailVO.java
...rformance/vo/pc/loan/owner/OwnerOrderPaymentDetailVO.java
+3
-0
OwnerTransferPaymentDetailVO.java
...rmance/vo/pc/loan/owner/OwnerTransferPaymentDetailVO.java
+11
-0
OrderChildLoanComponent.java
...om/clx/performance/component/OrderChildLoanComponent.java
+36
-11
ClxMessageConfig.java
...ain/java/com/clx/performance/config/ClxMessageConfig.java
+9
-0
RabbitBeanConfig.java
...ain/java/com/clx/performance/config/RabbitBeanConfig.java
+20
-0
RabbitKeyConstants.java
...java/com/clx/performance/constant/RabbitKeyConstants.java
+4
-0
CarrierOwnerLoanRecordController.java
...ler/pc/loan/carrier/CarrierOwnerLoanRecordController.java
+26
-1
CarrierOwnerPaymentController.java
...roller/pc/loan/carrier/CarrierOwnerPaymentController.java
+17
-4
OwnerLoanAccountController.java
.../controller/pc/loan/owner/OwnerLoanAccountController.java
+28
-3
OwnerRepaymentController.java
...ce/controller/pc/loan/owner/OwnerRepaymentController.java
+16
-0
TempBankController.java
...m/clx/performance/controller/temp/TempBankController.java
+3
-1
OwnerLoanRecordDaoImpl.java
...clx/performance/dao/impl/loan/OwnerLoanRecordDaoImpl.java
+1
-1
OwnerRepaymentDaoImpl.java
.../clx/performance/dao/impl/loan/OwnerRepaymentDaoImpl.java
+26
-0
OwnerRepaymentDao.java
.../java/com/clx/performance/dao/loan/OwnerRepaymentDao.java
+13
-0
EventListenerComponent.java
...ava/com/clx/performance/event/EventListenerComponent.java
+14
-1
OwnerRepaymentUpdateEvent.java
.../com/clx/performance/event/OwnerRepaymentUpdateEvent.java
+33
-0
OwnerLoanListener.java
.../java/com/clx/performance/listener/OwnerLoanListener.java
+1
-1
OwnerLoanPayNotifyListener.java
.../clx/performance/listener/OwnerLoanPayNotifyListener.java
+6
-2
OwnerRepaymentPayNotifyListener.java
...performance/listener/OwnerRepaymentPayNotifyListener.java
+41
-0
OwnerLoanRecord.java
.../java/com/clx/performance/model/loan/OwnerLoanRecord.java
+30
-2
OwnerPayment.java
...ain/java/com/clx/performance/model/loan/OwnerPayment.java
+1
-1
OwnerRepayment.java
...n/java/com/clx/performance/model/loan/OwnerRepayment.java
+4
-0
OrderChildServiceImpl.java
...m/clx/performance/service/impl/OrderChildServiceImpl.java
+1
-1
OwnerLoanAccountApproveServiceImpl.java
...service/impl/loan/OwnerLoanAccountApproveServiceImpl.java
+7
-4
OwnerLoanAccountServiceImpl.java
...rmance/service/impl/loan/OwnerLoanAccountServiceImpl.java
+56
-26
OwnerLoanRecordServiceImpl.java
...ormance/service/impl/loan/OwnerLoanRecordServiceImpl.java
+137
-16
OwnerPaymentServiceImpl.java
...erformance/service/impl/loan/OwnerPaymentServiceImpl.java
+8
-0
OwnerRepaymentServiceImpl.java
...formance/service/impl/loan/OwnerRepaymentServiceImpl.java
+161
-8
NbBankServiceImpl.java
...nce/service/impl/thirdparty/nbbank/NbBankServiceImpl.java
+14
-8
OwnerLoanAccountService.java
...clx/performance/service/loan/OwnerLoanAccountService.java
+2
-1
OwnerLoanRecordService.java
.../clx/performance/service/loan/OwnerLoanRecordService.java
+8
-0
OwnerPaymentService.java
...com/clx/performance/service/loan/OwnerPaymentService.java
+3
-0
OwnerRepaymentService.java
...m/clx/performance/service/loan/OwnerRepaymentService.java
+11
-0
NbBankService.java
.../performance/service/thirdparty/nbbank/NbBankService.java
+1
-1
OwnerPaymentStruct.java
...a/com/clx/performance/struct/loan/OwnerPaymentStruct.java
+3
-0
没有找到文件。
performance-api/src/main/java/com/clx/performance/enums/PerformanceResultEnum.java
浏览文件 @
b35f3996
...
...
@@ -134,10 +134,12 @@ public enum PerformanceResultEnum implements ResultEnum {
PLATFORM_ACCOUNT_CONFIG_IS_NULL
(
1918
,
"平台账户未配置"
),
PLATFORM_ACCOUNT_CONFIG_MANY
(
1919
,
"平台账户配置不唯一"
),
GET_LOAN_RECORD
(
1901
,
"货主借款失败"
),
OWNER_ACCOUNT_ERROR
(
1902
,
"货主货款不足"
),
OWNER_LOAN_RECORD_PAY_STATUS_ERROR
(
1850
,
"状态已变更无法支付"
),
OWNER_LOAN_RECORD_CANCEL_STATUS_ERROR
(
1851
,
"状态已变更无法取消"
),
OWNER_LOAN_RECORD_PAY_WAIT_ERROR
(
1852
,
"当前借款单状态不是待付款"
),
;
private
final
int
code
;
...
...
performance-api/src/main/java/com/clx/performance/enums/loan/OwnerLoanRecordEnum.java
浏览文件 @
b35f3996
...
...
@@ -10,11 +10,11 @@ import java.util.Optional;
public
enum
OwnerLoanRecordEnum
{
;
//“待审批”,“审批通过”,“审批拒绝”,“付款中”,“付款成功”,“付款失败”
@Getter
@AllArgsConstructor
public
enum
Status
{
APPROVE_WAIT
(
10
,
"待审批"
),
PAY_WAIT
(
15
,
"待付款"
),
APPROVE_PASS
(
20
,
"审批通过"
),
APPROVE_REFUSE
(
30
,
"审批拒绝"
),
PAYING
(
40
,
"付款中"
),
...
...
@@ -79,6 +79,7 @@ public enum OwnerLoanRecordEnum {
public
enum
PayChannel
{
ORDER_DIRECT_PAY
(
1
,
"订单支付"
),
ORDER_TRANSFER_PAY
(
2
,
"转账支付"
),
ASSET
(
3
,
"财资"
)
;
private
final
Integer
code
;
...
...
performance-api/src/main/java/com/clx/performance/enums/loan/OwnerRePaymentEnum.java
浏览文件 @
b35f3996
...
...
@@ -16,8 +16,9 @@ public enum OwnerRePaymentEnum {
public
enum
Status
{
PAY_WAIT
(
10
,
"待付款"
),
PAYING
(
40
,
"付款中"
),
PAY_SUCCESS
(
50
,
"付款成功"
),
PAY_FAIL
(
60
,
"付款失败"
),
PAY_FAIL
(
50
,
"付款失败"
),
PAY_SUCCESS
(
60
,
"付款成功"
),
;
private
final
Integer
code
;
...
...
performance-api/src/main/java/com/clx/performance/param/Owner
LoanPay
NotifyMqParam.java
→
performance-api/src/main/java/com/clx/performance/param/Owner
Bank
NotifyMqParam.java
浏览文件 @
b35f3996
...
...
@@ -6,7 +6,7 @@ import lombok.Data;
import
javax.validation.constraints.NotNull
;
@Data
public
class
Owner
LoanPay
NotifyMqParam
{
public
class
Owner
Bank
NotifyMqParam
{
@NotNull
(
message
=
"流水号不能为空"
)
@ApiModelProperty
(
"流水号"
)
...
...
performance-api/src/main/java/com/clx/performance/param/pc/loan/carrier/OwnerRepaymentParam.java
0 → 100644
浏览文件 @
b35f3996
package
com
.
clx
.
performance
.
param
.
pc
.
loan
.
carrier
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
@Getter
@Setter
public
class
OwnerRepaymentParam
{
@ApiModelProperty
(
"还款单号"
)
private
Long
repaymentNo
;
@ApiModelProperty
(
"支付通道:1订单支付 2转账支付"
)
private
Integer
payChannel
;
}
performance-api/src/main/java/com/clx/performance/param/pc/loan/carrier/PageCarrierOwnerLoanRecordParam.java
浏览文件 @
b35f3996
...
...
@@ -31,6 +31,6 @@ public class PageCarrierOwnerLoanRecordParam extends PageParam {
@ApiModelProperty
(
"借款类型 1:虚拟货币 2:资金"
)
private
Integer
loanType
;
@ApiModelProperty
(
"10 待审批 20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
@ApiModelProperty
(
"10 待审批
15 待付款
20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
private
Integer
status
;
}
performance-api/src/main/java/com/clx/performance/param/pc/loan/carrier/PageOwnerLoanRecordOfOwner.java
浏览文件 @
b35f3996
...
...
@@ -25,7 +25,7 @@ public class PageOwnerLoanRecordOfOwner extends PageParam {
@ApiModelProperty
(
value
=
"借款类型 1:虚拟货币 2:资金"
,
example
=
"1"
)
private
Integer
loanType
;
@ApiModelProperty
(
value
=
"10 待审批 20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"10 待审批
15 待付款
20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
,
example
=
"1"
)
private
Integer
status
;
}
\ No newline at end of file
performance-api/src/main/java/com/clx/performance/vo/pc/loan/carrier/CarrierOwnerOrderPaymentDetailVO.java
浏览文件 @
b35f3996
...
...
@@ -43,7 +43,7 @@ public class CarrierOwnerOrderPaymentDetailVO {
@ApiModelProperty
(
"10 待审批 20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
@ApiModelProperty
(
"10 待审批
15 待付款
20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
private
Integer
status
;
@ApiModelProperty
(
"订单支付状态 10 待付款 40 付款中 50 付款成功 60 付款失败"
)
...
...
performance-api/src/main/java/com/clx/performance/vo/pc/loan/carrier/CarrierOwnerPaymentVO.java
0 → 100644
浏览文件 @
b35f3996
package
com
.
clx
.
performance
.
vo
.
pc
.
loan
.
carrier
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.*
;
import
java.math.BigDecimal
;
/**
* @author kavin
* Date 2024-01-20
* Time 13:31
*/
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public
class
CarrierOwnerPaymentVO
{
private
Integer
id
;
@ApiModelProperty
(
"付款金额"
)
private
BigDecimal
paymentBalance
;
@ApiModelProperty
(
"付款方"
)
private
String
payment
;
@ApiModelProperty
(
"付款账户"
)
private
String
paymentAccount
;
@ApiModelProperty
(
"收款方"
)
private
String
payee
;
@ApiModelProperty
(
"收款账户"
)
private
String
payeeAccount
;
}
performance-api/src/main/java/com/clx/performance/vo/pc/loan/carrier/CarrierTransferPaymentDetailVO.java
浏览文件 @
b35f3996
...
...
@@ -59,5 +59,8 @@ public class CarrierTransferPaymentDetailVO {
@ApiModelProperty
(
"付款最后时间"
)
public
String
finalPaymentTime
;
@ApiModelProperty
(
"借款单号"
)
private
Long
loanNo
;
}
performance-api/src/main/java/com/clx/performance/vo/pc/loan/carrier/ExportOwnerLoanRecordVO.java
浏览文件 @
b35f3996
...
...
@@ -95,11 +95,11 @@ public class ExportOwnerLoanRecordVO {
private
String
payeeBankCode
;
@ApiModelProperty
(
"10 待审批 20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
@ApiModelProperty
(
"10 待审批
15 待付款
20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
private
Integer
status
;
@ApiModelProperty
(
"10 待审批 20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
@ApiModelProperty
(
"10 待审批
15 待付款
20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
private
String
statusMsg
;
public
String
getStatusMsg
(){
...
...
performance-api/src/main/java/com/clx/performance/vo/pc/loan/carrier/OwnerLoanRecordVO.java
浏览文件 @
b35f3996
...
...
@@ -91,11 +91,11 @@ public class OwnerLoanRecordVO {
private
String
payeeBankCode
;
@ApiModelProperty
(
"10 待审批 20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
@ApiModelProperty
(
"10 待审批
15 待付款
20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
private
Integer
status
;
@ApiModelProperty
(
"10 待审批 20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
@ApiModelProperty
(
"10 待审批
15 待付款
20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
private
String
statusMsg
;
public
String
getStatusMsg
(){
...
...
performance-api/src/main/java/com/clx/performance/vo/pc/loan/carrier/OwnerPaymentVO.java
浏览文件 @
b35f3996
package
com
.
clx
.
performance
.
vo
.
pc
.
loan
.
carrier
;
import
com.clx.performance.enums.loan.OwnerLoanRecordEnum
;
import
com.clx.performance.enums.loan.OwnerPaymentEnum
;
import
com.msl.common.convertor.type.MoneyOutConvert
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
@@ -76,14 +77,14 @@ public class OwnerPaymentVO{
}
@ApiModelProperty
(
"默认财资
30
"
)
@ApiModelProperty
(
"默认财资"
)
private
Integer
payChannel
;
@ApiModelProperty
(
"
财资
"
)
@ApiModelProperty
(
"
支付渠道名称
"
)
private
String
payChannelMsg
;
public
String
getPayChannelMsg
(){
return
"财资"
;
return
OwnerLoanRecordEnum
.
PayChannel
.
ASSET
.
getMsg
()
;
}
...
...
performance-api/src/main/java/com/clx/performance/vo/pc/loan/owner/OwnerOrderPaymentDetailVO.java
浏览文件 @
b35f3996
...
...
@@ -26,6 +26,9 @@ public class OwnerOrderPaymentDetailVO {
@ApiModelProperty
(
"还款单号"
)
private
Long
repaymentNo
;
@ApiModelProperty
(
"借款单号"
)
private
Long
loanNo
;
@ApiModelProperty
(
"付款方"
)
private
String
payment
;
...
...
performance-api/src/main/java/com/clx/performance/vo/pc/loan/owner/OwnerTransferPaymentDetailVO.java
浏览文件 @
b35f3996
...
...
@@ -22,6 +22,16 @@ import java.math.BigDecimal;
@Builder
public
class
OwnerTransferPaymentDetailVO
{
@ApiModelProperty
(
"还款单号"
)
private
Long
repaymentNo
;
@ApiModelProperty
(
"借款单号"
)
private
Long
loanNo
;
@ApiModelProperty
(
"收款户名"
)
private
String
payee
;
...
...
@@ -60,4 +70,5 @@ public class OwnerTransferPaymentDetailVO {
public
String
finalPaymentTime
;
}
performance-web/src/main/java/com/clx/performance/component/OrderChildLoanComponent.java
浏览文件 @
b35f3996
...
...
@@ -21,6 +21,8 @@ import com.clx.performance.enums.loan.OwnerLoanRecordEnum;
import
com.clx.performance.enums.loan.OwnerRePaymentEnum
;
import
com.clx.performance.enums.settle.SettlementOwnerEnum
;
import
com.clx.performance.enums.settle.SettlementWayEnum
;
import
com.clx.performance.event.OwnerRepaymentUpdateEvent
;
import
com.clx.performance.event.SettlementUpdateEvent
;
import
com.clx.performance.model.OrderChild
;
import
com.clx.performance.model.OrderGoods
;
import
com.clx.performance.model.OwnerRunningWaterRecord
;
...
...
@@ -37,6 +39,7 @@ import lombok.AllArgsConstructor;
import
lombok.extern.slf4j.Slf4j
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -70,6 +73,8 @@ public class OrderChildLoanComponent {
private
final
RedissonClient
redissonClient
;
private
final
ApplicationEventPublisher
applicationEventPublisher
;
/**
* 接单校验判断
*
...
...
@@ -141,7 +146,7 @@ public class OrderChildLoanComponent {
}
log
.
info
(
"8.预付运费不够,开始进行借款判断"
);
// 进行借款判断
OwnerLoanAccount
ownerLoanAccount
=
ownerLoanAccountDao
.
getOneByField
(
OwnerLoanAccount:
:
getOwnerUserNo
,
ownerInfoFeignVO
.
getUserNo
()).
get
(
);
OwnerLoanAccount
ownerLoanAccount
=
ownerLoanAccountDao
.
getOneByField
(
OwnerLoanAccount:
:
getOwnerUserNo
,
ownerInfoFeignVO
.
getUserNo
()).
orElseThrow
(
PerformanceResultEnum
.
OWNER_ACCOUNT_ERROR
);
BigDecimal
ownerLoanAccountSum
=
ownerLoanAccount
.
getVirtuallyUsableBalance
().
add
(
ownerLoanAccount
.
getFundingUsableBalance
());
if
(
ownerLoanAccountSum
.
compareTo
(
orderChildPrice
)
<
0
)
{
...
...
@@ -150,8 +155,8 @@ public class OrderChildLoanComponent {
}
//借款账户钱够,判断是否逾期
log
.
info
(
"10.借款账户钱够,判断是否逾期"
);
Optional
<
OwnerRepayment
>
optional
=
ownerRepaymentDao
.
getLimitOneByField
(
OwnerRepayment:
:
getBeOverdue
,
OwnerRePaymentEnum
.
BeOverdue
.
YES
.
getCode
());
if
(
optional
.
isPresent
()
)
{
boolean
beOverdue
=
this
.
beOverdue
(
ownerInfoFeignVO
.
getUserNo
());
if
(
beOverdue
)
{
//逾期:不允许
log
.
info
(
"11.当前货主存在逾期借款"
);
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
ORDER_CHILD_SAVE_FAIL
,
"货主已欠款"
);
...
...
@@ -174,6 +179,9 @@ public class OrderChildLoanComponent {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
childLoanConfirmAfterProcess
(
SettlementDriverDetail
settlementDriverDetail
,
SettlementOwnerDetail
settlementOwnerDetail
,
OrderChild
orderChild
)
{
log
.
info
(
"1.运单确认收货后借款相关处理执行"
);
//临时结算金额,借款抵扣后需要重新赋值结算金额为0,如果不需要借款相关逻辑,正常设置结算金额
settlementOwnerDetail
.
setSettlementFreight
(
settlementFreightCalc
(
orderChild
.
getSettlementWay
(),
settlementOwnerDetail
));
OwnerQuotationDetailVO
quotationDetailVO
=
orderFeign
.
getQuotationByOrderNo
(
settlementDriverDetail
.
getOrderNo
()).
getData
();
BigDecimal
freightFreezeRate
=
quotationDetailVO
.
getFreightFreezeRate
();
...
...
@@ -196,15 +204,11 @@ public class OrderChildLoanComponent {
String
childNo
=
settlementDriverDetail
.
getChildNo
();
List
<
OwnerLoanAccountRunningWaterRecord
>
runningWaterRecordList
=
ownerLoanAccountRunningWaterRecordDao
.
getListByOrderNoAndRunningWaterType
(
childNo
,
OwnerLoanAccountRunningWaterRecordEnum
.
RunWaterType
.
APPROVE_FROZEN
.
getCode
());
//已借款
settlementDriverDetail
.
setLoanFlag
(
OwnerLoanRecordEnum
.
LoanFlag
.
LOAN
.
getCode
());
// 抵扣金额
settlementOwnerDetail
.
setLoanFreight
(
settlementFreightCalc
(
orderChild
.
getSettlementWay
(),
settlementOwnerDetail
));
settlementOwnerDetail
.
setLoanFreight
(
settlementOwnerDetail
.
getSettlementFreight
());
log
.
info
(
"4.查询当前运单号:{}, 当前货主,{}, 此运单借款冻结记录:{}"
,
childNo
,
settlementOwnerDetail
.
getOwnerUserNo
(),
JSONUtil
.
parse
(
runningWaterRecordList
));
if
(
CollectionUtil
.
isEmpty
(
runningWaterRecordList
))
{
//说明当初没借款,预付运费够,但是真实结算后,预付运费不够,走此逻辑
log
.
info
(
"4.1 说明当初没借款,预付运费够,但是真实结算后,预付运费不够,走此逻辑"
);
LoanBalanceDTO
param
=
new
LoanBalanceDTO
();
...
...
@@ -218,15 +222,17 @@ public class OrderChildLoanComponent {
runningWaterRecordList
=
ownerLoanAccountRunningWaterRecordDao
.
getListByOrderNoAndRunningWaterType
(
childNo
,
OwnerLoanAccountRunningWaterRecordEnum
.
RunWaterType
.
APPROVE_FROZEN
.
getCode
());
childWriteOffOwnerLoanAccount
(
runningWaterRecordList
);
}
else
{
BigDecimal
alterationBalance
=
runningWaterRecordList
.
stream
().
map
(
OwnerLoanAccountRunningWaterRecord:
:
getAlterationBalance
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
if
(
alterationBalance
.
compareTo
(
settlementOwnerDetail
.
getSettlementFreight
())
==
0
)
{
log
.
info
(
"4.2 相等直接生成运单核销"
);
//相等直接生成运单核销
childWriteOffOwnerLoanAccount
(
runningWaterRecordList
);
}
else
if
(
alterationBalance
.
compareTo
(
settlementOwnerDetail
.
getSettlementFreight
())
>
0
)
{
//大于,则生成核销后,释放冻结的借款
log
.
info
(
"4.3 大于,则生成核销后,释放冻结的借款"
);
...
...
@@ -262,7 +268,11 @@ public class OrderChildLoanComponent {
}
}
//已借款
settlementDriverDetail
.
setLoanFlag
(
OwnerLoanRecordEnum
.
LoanFlag
.
LOAN
.
getCode
());
// 抵扣金额
settlementOwnerDetail
.
setLoanFreight
(
settlementOwnerDetail
.
getSettlementFreight
());
settlementOwnerDetail
.
setSettlementFreight
(
BigDecimal
.
ZERO
);
}
...
...
@@ -402,9 +412,24 @@ public class OrderChildLoanComponent {
}
}
private
boolean
beOverdue
(
Long
ownerUserNo
)
{
//查询未付款成功还款单
List
<
OwnerRepayment
>
ownerRepaymentList
=
ownerRepaymentDao
.
selectListByStatusAndOwnerUserNo
(
OwnerRePaymentEnum
.
Status
.
PAY_SUCCESS
.
getCode
(),
ownerUserNo
);
for
(
OwnerRepayment
ownerRepayment
:
ownerRepaymentList
)
{
if
(
OwnerRePaymentEnum
.
BeOverdue
.
YES
.
getCode
().
equals
(
ownerRepayment
.
getBeOverdue
()))
{
return
true
;
}
else
{
if
(
ownerRepayment
.
getLoanRepaymentTime
().
equals
(
LocalDateTime
.
now
())
||
ownerRepayment
.
getLoanRepaymentTime
().
isBefore
(
LocalDateTime
.
now
()))
{
applicationEventPublisher
.
publishEvent
(
new
OwnerRepaymentUpdateEvent
(
this
,
ownerRepayment
.
getId
()));
}
}
}
return
false
;
}
/**
*
结算
金额
*
抵扣
金额
*/
private
BigDecimal
settlementFreightCalc
(
Integer
settlementWay
,
SettlementOwnerDetail
settlementOwnerDetail
)
{
if
(
Objects
.
equals
(
settlementWay
,
SettlementWayEnum
.
WayType
.
LOAD
.
getCode
()))
{
//订单结算方式为“装车净重”时,结算金额=实际净重*平台运费报价-预付运费-货损金额。
...
...
performance-web/src/main/java/com/clx/performance/config/ClxMessageConfig.java
浏览文件 @
b35f3996
...
...
@@ -20,4 +20,13 @@ public class ClxMessageConfig {
//短信验证码模板
private
String
captchaTemplateCode
;
//订单支付短信模板
private
String
orderPayTemplateCode
;
//转账支付-借款单短信模板
private
String
borrowTemplateCode
;
//转账支付-还款单短信模板
private
String
repaymentTemplateCode
;
}
performance-web/src/main/java/com/clx/performance/config/RabbitBeanConfig.java
浏览文件 @
b35f3996
...
...
@@ -200,4 +200,24 @@ public class RabbitBeanConfig {
public
Binding
ownerLoanBind
()
{
return
BindingBuilder
.
bind
(
ownerLoanQueue
()).
to
(
ownerLoanExchange
()).
with
(
RabbitKeyConstants
.
OWNER_LOAN_ROUTE_KEY
);
}
/**
* 货主还款队列
* @return
*/
@Bean
public
Queue
ownerRepaymentQueue
()
{
return
new
Queue
(
RabbitKeyConstants
.
OWNER_REPAYMENT_QUEUE
,
true
,
false
,
false
);
}
/**
* 货主还款bind
* @return
*/
@Bean
public
Binding
ownerRepaymentBind
()
{
return
BindingBuilder
.
bind
(
ownerLoanQueue
()).
to
(
ownerLoanExchange
()).
with
(
RabbitKeyConstants
.
OWNER_REPAYMENT_ROUTE_KEY
);
}
}
performance-web/src/main/java/com/clx/performance/constant/RabbitKeyConstants.java
浏览文件 @
b35f3996
...
...
@@ -93,4 +93,8 @@ public class RabbitKeyConstants {
public
static
final
String
OWNER_LOAN_ROUTE_KEY
=
"clx-performance.loan.route.key"
;
public
static
final
String
OWNER_LOAN_QUEUE
=
"clx-performance.loan.queue"
;
public
static
final
String
OWNER_REPAYMENT_QUEUE
=
"clx-performance.owner.repayment.queue"
;
public
static
final
String
OWNER_REPAYMENT_ROUTE_KEY
=
"clx-performance.owner.repayment.route.key"
;
}
performance-web/src/main/java/com/clx/performance/controller/pc/loan/carrier/CarrierOwnerLoanRecordController.java
浏览文件 @
b35f3996
...
...
@@ -41,13 +41,20 @@ public class CarrierOwnerLoanRecordController {
return
Result
.
page
(
page
.
getRecords
(),
page
.
getTotal
(),
page
.
getPages
());
}
@ApiOperation
(
value
=
"借款审批"
,
notes
=
"<br>By:胡宇帆"
)
@ApiOperation
(
value
=
"借款审批
(虚拟币直接增加,资金需要跳收银台提交申请)
"
,
notes
=
"<br>By:胡宇帆"
)
@PostMapping
(
"/ownerLoanRecordApprove"
)
public
Result
<
Object
>
ownerLoanRecordApprove
(
@RequestBody
@Validated
CarrierOwnerLoanRecordApproveParam
param
)
{
ownerLoanRecordService
.
ownerLoanRecordApprove
(
param
);
return
Result
.
ok
();
}
@ApiOperation
(
value
=
"借款提交申请(调用宁波银行)"
,
notes
=
"<br>By:胡宇帆"
)
@PostMapping
(
"/ownerLoanRecordSubmitNbBank"
)
public
Result
<
Object
>
ownerLoanRecordSubmitNbBank
(
@RequestBody
@Validated
CarrierOwnerLoanRecordApproveParam
param
)
{
Integer
id
=
ownerLoanRecordService
.
ownerLoanRecordSubmitNbBank
(
param
);
return
Result
.
ok
(
id
);
}
@ApiOperation
(
value
=
"借款重新支付(只更改借款状态)"
,
notes
=
"<br>By:胡宇帆"
)
@GetMapping
(
"/ownerLoanRecordRetryPay"
)
public
Result
<
Object
>
ownerLoanRecordRetryPay
(
@RequestParam
(
value
=
"loanNo"
)
@NotBlank
String
loanNo
)
{
...
...
@@ -124,4 +131,22 @@ public class CarrierOwnerLoanRecordController {
return
Result
.
ok
();
}
@ApiOperation
(
value
=
"转账支付-借款短信"
,
notes
=
"<br>By:姜文业"
)
@GetMapping
(
"/sendLoanSms"
)
public
Result
<
String
>
sendLoanSms
(
@RequestParam
(
"mobile"
)
@NotBlank
(
message
=
"通知的手机号码不能为空"
)
String
mobile
,
@Param
(
"loanNo"
)
@NotNull
(
message
=
"借款单号不能为空"
)
Long
loanNo
)
{
String
token
=
ownerLoanRecordService
.
sendLoanSms
(
mobile
,
loanNo
);
return
Result
.
ok
(
token
);
}
@ApiOperation
(
value
=
"订单支付短信"
,
notes
=
"<br>By:姜文业"
)
@GetMapping
(
"/sendOrderPaySms"
)
public
Result
<
String
>
sendOrderPaySms
(
@RequestParam
(
"mobile"
)
@NotBlank
(
message
=
"通知的手机号码不能为空"
)
String
mobile
,
@Param
(
"payee"
)
@NotBlank
(
message
=
"收款方不能为空"
)
String
payee
,
@Param
(
"payeeAccount"
)
@NotBlank
(
message
=
"收款账户不能为空"
)
String
payeeAccount
)
{
String
token
=
ownerLoanRecordService
.
sendOrderPaySms
(
mobile
,
payee
,
payeeAccount
);
return
Result
.
ok
(
token
);
}
}
performance-web/src/main/java/com/clx/performance/controller/pc/loan/carrier/CarrierOwnerPaymentController.java
浏览文件 @
b35f3996
...
...
@@ -3,6 +3,7 @@ package com.clx.performance.controller.pc.loan.carrier;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerPaymentParam
;
import
com.clx.performance.service.loan.OwnerPaymentService
;
import
com.clx.performance.vo.pc.loan.carrier.CarrierOwnerPaymentVO
;
import
com.clx.performance.vo.pc.loan.carrier.OwnerPaymentVO
;
import
com.msl.common.base.PageData
;
import
com.msl.common.convertor.aspect.UnitCovert
;
...
...
@@ -12,10 +13,9 @@ import io.swagger.annotations.ApiOperation;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.constraints.NotNull
;
@Slf4j
@RestController
...
...
@@ -37,4 +37,17 @@ public class CarrierOwnerPaymentController {
}
@ApiOperation
(
value
=
"付款详情"
,
notes
=
"<br>By:刘海泉"
)
@PostMapping
(
"/getOwnerPaymentDetail"
)
@UnitCovert
(
param
=
false
)
public
Result
<
CarrierOwnerPaymentVO
>
getOwnerPaymentDetail
(
@RequestParam
(
"id"
)
@NotNull
(
message
=
"id不能为空"
)
Integer
id
)
{
CarrierOwnerPaymentVO
vo
=
ownerPaymentService
.
getOwnerPaymentDetail
(
id
);
return
Result
.
ok
(
vo
);
}
}
performance-web/src/main/java/com/clx/performance/controller/pc/loan/owner/OwnerLoanAccountController.java
浏览文件 @
b35f3996
package
com
.
clx
.
performance
.
controller
.
pc
.
loan
.
owner
;
import
com.clx.performance.param.pc.loan.carrier.OwnerRepaymentParam
;
import
com.clx.performance.param.pc.loan.owner.OwnerLoanRecordParam
;
import
com.clx.performance.service.loan.OwnerLoanAccountApproveService
;
import
com.clx.performance.service.loan.OwnerLoanAccountService
;
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.msl.common.convertor.aspect.UnitCovert
;
import
com.msl.common.result.Result
;
...
...
@@ -14,6 +16,8 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.constraints.NotBlank
;
@Slf4j
@RestController
...
...
@@ -29,6 +33,8 @@ public class OwnerLoanAccountController {
private
final
OwnerLoanAccountService
ownerLoanAccountService
;
private
final
OwnerRepaymentService
ownerRepaymentService
;
@ApiOperation
(
value
=
"货主借款账户开通"
,
notes
=
"<br>By:胡宇帆"
)
@GetMapping
(
"/openOwnerLoanAccount"
)
public
Result
<
Object
>
openOwnerLoanAccount
()
{
...
...
@@ -36,16 +42,14 @@ public class OwnerLoanAccountController {
return
Result
.
ok
();
}
@ApiOperation
(
value
=
"货主借款申请"
,
notes
=
"<br>By:胡宇帆"
)
@PostMapping
(
"/ownerLoanRecordSubmit"
)
@UnitCovert
(
result
=
false
)
public
Result
<
Object
>
ownerLoanRecordSubmit
(
@RequestBody
OwnerLoanRecordParam
param
)
{
ownerLoanRecordService
.
ownerLoanRecordSubmit
(
param
);
return
Result
.
ok
();
}
@ApiOperation
(
value
=
"货主借款账户信息"
,
notes
=
"<br>By:刘海泉"
)
@GetMapping
(
"/getOwnerLoanAccount"
)
@UnitCovert
(
param
=
false
)
...
...
@@ -53,4 +57,25 @@ public class OwnerLoanAccountController {
OwnerAccountVO
ownerAccount
=
ownerLoanAccountService
.
getOwnerLoanAccount
();
return
Result
.
ok
(
ownerAccount
);
}
@ApiOperation
(
value
=
"货主还款"
,
notes
=
"<br>By:胡宇帆"
)
@PostMapping
(
"/ownerRepayment"
)
public
Result
<
OwnerAccountVO
>
ownerRepayment
(
@RequestBody
OwnerRepaymentParam
param
)
{
ownerLoanAccountService
.
ownerRepayment
(
param
);
return
Result
.
ok
();
}
@ApiOperation
(
value
=
"取消支付(还款)"
,
notes
=
"<br>By:胡宇帆"
)
@GetMapping
(
"/ownerRepaymentCancelPay"
)
public
Result
<
Object
>
ownerRepaymentCancelPay
(
@RequestParam
(
value
=
"repaymentNo"
)
@NotBlank
String
repaymentNo
)
{
ownerRepaymentService
.
ownerRepaymentCancelPay
(
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
();
}
}
performance-web/src/main/java/com/clx/performance/controller/pc/loan/owner/OwnerRepaymentController.java
浏览文件 @
b35f3996
...
...
@@ -21,6 +21,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
...
...
@@ -78,7 +79,22 @@ public class OwnerRepaymentController {
return
Result
.
ok
(
url
);
}
@ApiOperation
(
value
=
"转账支付-还款短信"
,
notes
=
"<br>By:姜文业"
)
@GetMapping
(
"/sendPaymentSms"
)
public
Result
<
String
>
sendPaymentSms
(
@RequestParam
(
"mobile"
)
@NotBlank
(
message
=
"通知的手机号码不能为空"
)
String
mobile
,
@Param
(
"repaymentNo"
)
@NotNull
(
message
=
"还款单号不能为空"
)
Long
repaymentNo
)
{
String
token
=
ownerRepaymentService
.
sendPaymentSms
(
mobile
,
repaymentNo
);
return
Result
.
ok
(
token
);
}
@ApiOperation
(
value
=
"订单支付短信"
,
notes
=
"<br>By:姜文业"
)
@GetMapping
(
"/sendOrderPaySms"
)
public
Result
<
String
>
sendOrderPaySms
(
@RequestParam
(
"mobile"
)
@NotBlank
(
message
=
"通知的手机号码不能为空"
)
String
mobile
,
@Param
(
"payee"
)
@NotBlank
(
message
=
"收款方不能为空"
)
String
payee
,
@Param
(
"payeeAccount"
)
@NotBlank
(
message
=
"收款账户不能为空"
)
String
payeeAccount
)
{
String
token
=
ownerRepaymentService
.
sendOrderPaySms
(
mobile
,
payee
,
payeeAccount
);
return
Result
.
ok
(
token
);
}
...
...
performance-web/src/main/java/com/clx/performance/controller/temp/TempBankController.java
浏览文件 @
b35f3996
...
...
@@ -39,13 +39,15 @@ public class TempBankController {
// return Result.ok(bankService.orderDirectPay(null,2,"313332082914","86041110000076809", "黑玫瑰"));
// return Result.ok(bankService.orderDirectPay(null,2,"313332082914","86041110000075926", "客户客户"));
return
Result
.
ok
(
bankService
.
orderDirectPay
(
null
,
1
,
"313332082914"
,
"86031110000180611"
,
"槟榔王"
));
return
Result
.
ok
(
bankService
.
orderDirectPay
(
null
,
""
,
1
,
"313332082914"
,
"86031110000180611"
,
"槟榔王"
));
}
@ApiOperation
(
value
=
"订单支付1"
,
notes
=
"<br>By:艾庆国"
)
@RequestMapping
(
value
=
"/orderDirectPay1"
,
method
=
RequestMethod
.
POST
)
public
Result
<
NbBankOrderPayResultVO
>
orderDirectPay1
(
String
payAcctNo
,
String
payAcctNm
)
{
// return Result.ok(bankService.orderDirectPay(null,2,"313332082914","86041110000076809", "黑玫瑰"));
// return Result.ok(bankService.orderDirectPay(null,2,"313332082914","86041110000075926", "客户客户"));
return
Result
.
ok
(
bankService
.
orderDirectPay
(
null
,
1
,
"313332082914"
,
payAcctNo
,
payAcctNm
));
}
@ApiOperation
(
value
=
"订单支付2"
,
notes
=
"<br>By:艾庆国"
)
...
...
performance-web/src/main/java/com/clx/performance/dao/impl/loan/OwnerLoanRecordDaoImpl.java
浏览文件 @
b35f3996
...
...
@@ -90,7 +90,7 @@ public class OwnerLoanRecordDaoImpl extends BaseDaoImpl<OwnerLoanRecordMapper, O
.
set
(
OwnerLoanRecord:
:
getMerchantRunningWaterNo
,
item
.
getMerchantRunningWaterNo
())
.
set
(
OwnerLoanRecord:
:
getRemittanceIdentificationCode
,
item
.
getRemittanceIdentificationCode
())
.
set
(
OwnerLoanRecord:
:
getLoanResidueBalance
,
item
.
getLoanResidueBalance
())
.
set
(
OwnerLoanRecord:
:
getRemittanceIdentificationCode
,
item
.
getRemittanceIdentificationCode
())
.
set
(
OwnerLoanRecord:
:
getLendingParty
,
item
.
getLendingParty
())
.
set
(
OwnerLoanRecord:
:
getLendingPartyAccount
,
item
.
getLendingPartyAccount
())
);
...
...
performance-web/src/main/java/com/clx/performance/dao/impl/loan/OwnerRepaymentDaoImpl.java
浏览文件 @
b35f3996
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.clx.performance.dao.loan.OwnerRepaymentDao
;
import
com.clx.performance.enums.loan.OwnerRePaymentEnum
;
import
com.clx.performance.mapper.loan.OwnerRepaymentMapper
;
import
com.clx.performance.model.loan.OwnerRepayment
;
import
com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerRepaymentParam
;
...
...
@@ -13,6 +14,7 @@ import com.msl.common.dao.impl.BaseDaoImpl;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Objects
;
/**
...
...
@@ -59,4 +61,28 @@ public class OwnerRepaymentDaoImpl extends BaseDaoImpl<OwnerRepaymentMapper, Own
return
baseMapper
.
pageByParam
(
page
,
param
);
}
@Override
public
List
<
OwnerRepayment
>
selectListByStatusAndOwnerUserNo
(
Integer
status
,
Long
ownerUserNo
)
{
return
baseMapper
.
selectList
(
lQrWrapper
().
eq
(
OwnerRepayment:
:
getOwnerUserNo
,
ownerUserNo
)
.
lt
(
OwnerRepayment:
:
getStatus
,
status
)
);
}
@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
())
);
}
}
performance-web/src/main/java/com/clx/performance/dao/loan/OwnerRepaymentDao.java
浏览文件 @
b35f3996
...
...
@@ -8,6 +8,8 @@ import com.clx.performance.param.pc.loan.carrier.PageOwnerRepaymentOfOwner;
import
com.clx.performance.vo.pc.loan.carrier.OwnerRepaymentVO
;
import
com.msl.common.dao.BaseDao
;
import
java.util.List
;
/**
* @author kavin
* Date 2024-01-20
...
...
@@ -18,4 +20,15 @@ public interface OwnerRepaymentDao extends BaseDao<OwnerRepaymentMapper, OwnerRe
IPage
<
OwnerRepaymentVO
>
pageByParam
(
PageOwnerRepaymentOfOwner
param
);
/**
* 查询未付款成功还款单
* @param status
* @param ownerUserNo
* @return
*/
List
<
OwnerRepayment
>
selectListByStatusAndOwnerUserNo
(
Integer
status
,
Long
ownerUserNo
);
void
updateRePay
(
OwnerRepayment
ownerRepayment
);
void
updateStatusById
(
OwnerRepayment
ownerRepayment
);
}
performance-web/src/main/java/com/clx/performance/event/
SettlementListener
.java
→
performance-web/src/main/java/com/clx/performance/event/
EventListenerComponent
.java
浏览文件 @
b35f3996
...
...
@@ -2,9 +2,12 @@ package com.clx.performance.event;
import
cn.hutool.json.JSONUtil
;
import
com.clx.performance.dao.loan.OrderChildLoanRetryRecordDao
;
import
com.clx.performance.dao.loan.OwnerRepaymentDao
;
import
com.clx.performance.dao.settle.SettlementDriverDetailDao
;
import
com.clx.performance.dao.settle.SettlementOwnerDetailDao
;
import
com.clx.performance.enums.loan.OwnerRePaymentEnum
;
import
com.clx.performance.model.loan.OrderChildLoanRetryRecord
;
import
com.clx.performance.model.loan.OwnerRepayment
;
import
com.clx.performance.model.settle.SettlementDriverDetail
;
import
com.clx.performance.model.settle.SettlementOwnerDetail
;
import
lombok.AllArgsConstructor
;
...
...
@@ -15,7 +18,7 @@ import org.springframework.stereotype.Component;
@Component
@Slf4j
@AllArgsConstructor
public
class
SettlementListener
{
public
class
EventListenerComponent
{
private
final
SettlementOwnerDetailDao
settlementOwnerDetailDao
;
...
...
@@ -23,6 +26,8 @@ public class SettlementListener {
private
final
OrderChildLoanRetryRecordDao
orderChildLoanRetryRecordDao
;
private
final
OwnerRepaymentDao
ownerRepaymentDao
;
@EventListener
(
classes
=
{
SettlementUpdateEvent
.
class
})
public
void
listen
(
SettlementUpdateEvent
event
)
{
...
...
@@ -38,4 +43,12 @@ public class SettlementListener {
// 保存重试记录
orderChildLoanRetryRecordDao
.
saveEntity
(
entity
);
}
@EventListener
(
classes
=
{
OwnerRepaymentUpdateEvent
.
class
})
public
void
listen
(
OwnerRepaymentUpdateEvent
event
)
{
OwnerRepayment
update
=
new
OwnerRepayment
();
update
.
setId
(
event
.
getId
());
update
.
setBeOverdue
(
OwnerRePaymentEnum
.
BeOverdue
.
YES
.
getCode
());
ownerRepaymentDao
.
updateEntityByKey
(
update
);
}
}
performance-web/src/main/java/com/clx/performance/event/OwnerRepaymentUpdateEvent.java
0 → 100644
浏览文件 @
b35f3996
package
com
.
clx
.
performance
.
event
;
import
org.springframework.context.ApplicationEvent
;
public
class
OwnerRepaymentUpdateEvent
extends
ApplicationEvent
{
private
Integer
id
;
/**
* 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
OwnerRepaymentUpdateEvent
(
Object
source
)
{
super
(
source
);
}
public
OwnerRepaymentUpdateEvent
(
Object
source
,
Integer
id
)
{
super
(
source
);
this
.
id
=
id
;
}
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
}
performance-web/src/main/java/com/clx/performance/listener/OwnerLoanListener.java
浏览文件 @
b35f3996
...
...
@@ -53,7 +53,7 @@ public class OwnerLoanListener {
//未借款
settlementDriverDetail
.
setLoanFlag
(
OwnerLoanRecordEnum
.
LoanFlag
.
NO_LOAN
.
getCode
());
applicationEventPublisher
.
publishEvent
(
new
SettlementUpdateEvent
(
this
,
settlementDriverDetail
,
settlementOwnerDetail
));
throw
e
;
return
;
}
settlementOwnerDetailDao
.
updateInvoiceType
(
settlementOwnerDetail
);
settlementDriverDetailDao
.
updateInvoiceTypeAndPrepayFreightFlag
(
settlementDriverDetail
);
...
...
performance-web/src/main/java/com/clx/performance/listener/OwnerLoanPayNotifyListener.java
浏览文件 @
b35f3996
package
com
.
clx
.
performance
.
listener
;
import
cn.hutool.json.JSONUtil
;
import
com.clx.performance.param.Owner
LoanPay
NotifyMqParam
;
import
com.clx.performance.param.Owner
Bank
NotifyMqParam
;
import
com.clx.performance.constant.RabbitKeyConstants
;
import
com.clx.performance.enums.nbbank.NbBankStatusEnum
;
import
com.clx.performance.service.loan.OwnerLoanAccountService
;
import
com.clx.performance.service.loan.OwnerLoanRecordService
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -22,14 +23,17 @@ public class OwnerLoanPayNotifyListener {
private
final
OwnerLoanRecordService
ownerLoanRecordService
;
private
final
OwnerLoanAccountService
ownerLoanAccountService
;
@RabbitListener
(
queues
=
RabbitKeyConstants
.
OWNER_LOAN_PAY_QUEUE
)
public
void
onMessage
(
String
message
)
{
log
.
info
(
"处理货主借款支付监听器执行,数据为{}"
,
message
);
Owner
LoanPayNotifyMqParam
param
=
JSONUtil
.
toBean
(
message
,
OwnerLoanPay
NotifyMqParam
.
class
);
Owner
BankNotifyMqParam
param
=
JSONUtil
.
toBean
(
message
,
OwnerBank
NotifyMqParam
.
class
);
if
(
Objects
.
equals
(
param
.
getPayStatus
(),
NbBankStatusEnum
.
Status
.
SUCCESS
.
getCode
()))
{
// 支付成功
ownerLoanRecordService
.
paySuccess
(
param
.
getMerSeqNo
());
}
else
if
(
Objects
.
equals
(
param
.
getPayStatus
(),
NbBankStatusEnum
.
Status
.
FAIL
.
getCode
()))
{
// 支付失败
...
...
performance-web/src/main/java/com/clx/performance/listener/OwnerRepaymentPayNotifyListener.java
0 → 100644
浏览文件 @
b35f3996
package
com
.
clx
.
performance
.
listener
;
import
cn.hutool.json.JSONUtil
;
import
com.clx.performance.constant.RabbitKeyConstants
;
import
com.clx.performance.enums.nbbank.NbBankStatusEnum
;
import
com.clx.performance.param.OwnerBankNotifyMqParam
;
import
com.clx.performance.service.loan.OwnerRepaymentService
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.stereotype.Component
;
import
java.util.Objects
;
/**
* 处理货主还款支付监听器
*/
@Slf4j
@Component
@AllArgsConstructor
public
class
OwnerRepaymentPayNotifyListener
{
private
final
OwnerRepaymentService
ownerRepaymentService
;
@RabbitListener
(
queues
=
RabbitKeyConstants
.
OWNER_REPAYMENT_QUEUE
)
public
void
onMessage
(
String
message
)
{
log
.
info
(
"处理货主还款支付监听器执行,数据为{}"
,
message
);
OwnerBankNotifyMqParam
param
=
JSONUtil
.
toBean
(
message
,
OwnerBankNotifyMqParam
.
class
);
if
(
Objects
.
equals
(
param
.
getPayStatus
(),
NbBankStatusEnum
.
Status
.
SUCCESS
.
getCode
()))
{
// 支付成功
ownerRepaymentService
.
paySuccess
(
param
.
getMerSeqNo
());
}
else
if
(
Objects
.
equals
(
param
.
getPayStatus
(),
NbBankStatusEnum
.
Status
.
FAIL
.
getCode
()))
{
// 支付失败
ownerRepaymentService
.
payFail
(
param
.
getMerSeqNo
());
}
}
}
performance-web/src/main/java/com/clx/performance/model/loan/OwnerLoanRecord.java
浏览文件 @
b35f3996
...
...
@@ -68,6 +68,7 @@ public class OwnerLoanRecord implements HasKey<Integer> {
@ApiModelProperty
(
"借款剩余金额"
)
private
BigDecimal
loanResidueBalance
;
@TableField
(
"borrower_id"
)
@ApiModelProperty
(
"借出方Id"
)
private
Integer
borrowerId
;
...
...
@@ -76,10 +77,23 @@ public class OwnerLoanRecord implements HasKey<Integer> {
@ApiModelProperty
(
"借出方"
)
private
String
borrower
;
@ApiModelProperty
(
"借
款
方账户"
)
@ApiModelProperty
(
"借
出
方账户"
)
@TableField
(
"borrower_account"
)
private
String
borrowerAccount
;
@TableField
(
"borrower_bank"
)
@ApiModelProperty
(
"借出方银行"
)
private
String
borrowerBank
;
@TableField
(
"borrower_bank_code"
)
@ApiModelProperty
(
"借出方银行行号"
)
private
String
borrowerBankCode
;
@TableField
(
"borrower_open_bank"
)
@ApiModelProperty
(
"借出方开户行"
)
private
String
borrowerOpenBank
;
@TableField
(
"remittance_identification_code"
)
@ApiModelProperty
(
"汇款识别码"
)
private
String
remittanceIdentificationCode
;
...
...
@@ -93,6 +107,20 @@ public class OwnerLoanRecord implements HasKey<Integer> {
@ApiModelProperty
(
"借款方账户"
)
private
String
lendingPartyAccount
;
@TableField
(
"lending_party_bank"
)
@ApiModelProperty
(
"借款方银行"
)
private
String
lendingPartyBank
;
@TableField
(
"lending_party_bank_code"
)
@ApiModelProperty
(
"借款方银行行号"
)
private
String
lendingPartyBankCode
;
@TableField
(
"lending_party_open_bank"
)
@ApiModelProperty
(
"借款方开户行"
)
private
String
lendingPartyOpenBank
;
@TableField
(
"payee"
)
@ApiModelProperty
(
"收款方"
)
private
String
payee
;
...
...
@@ -110,7 +138,7 @@ public class OwnerLoanRecord implements HasKey<Integer> {
private
String
payeeBankCode
;
@TableField
(
"status"
)
@ApiModelProperty
(
"10 待审批 20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
@ApiModelProperty
(
"10 待审批
15 待付款
20 审批通过 30 审批拒绝 40 付款中 50 付款成功 60 付款失败 "
)
private
Integer
status
;
@TableField
(
"approve_time"
)
...
...
performance-web/src/main/java/com/clx/performance/model/loan/OwnerPayment.java
浏览文件 @
b35f3996
...
...
@@ -77,7 +77,7 @@ public class OwnerPayment implements HasKey<Integer> {
private
Integer
status
;
@TableField
(
"pay_channel"
)
@ApiModelProperty
(
"默认财资
30
"
)
@ApiModelProperty
(
"默认财资"
)
private
Integer
payChannel
;
@TableField
(
"operate_time"
)
...
...
performance-web/src/main/java/com/clx/performance/model/loan/OwnerRepayment.java
浏览文件 @
b35f3996
...
...
@@ -94,6 +94,10 @@ public class OwnerRepayment implements HasKey<Integer> {
@ApiModelProperty
(
"借款单号"
)
private
Long
loanNo
;
@TableField
(
"loan_type"
)
@ApiModelProperty
(
"借款类型 1:虚拟货币 2:资金"
)
private
Long
loanType
;
@TableField
(
"status"
)
@ApiModelProperty
(
"10 待付款 40 付款中 50 付款成功 60 付款失败"
)
private
Integer
status
;
...
...
performance-web/src/main/java/com/clx/performance/service/impl/OrderChildServiceImpl.java
浏览文件 @
b35f3996
...
...
@@ -326,7 +326,7 @@ public class OrderChildServiceImpl implements OrderChildService {
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
ORDER_WEIGHT_LACK
);
}
//接单判断
//接单
借款
判断
orderChildLoanComponent
.
getChildDetermine
(
orderInfo
,
ownerInfo
,
orderGoods
,
childNo
);
OrderChild
orderChild
=
new
OrderChild
();
...
...
performance-web/src/main/java/com/clx/performance/service/impl/loan/OwnerLoanAccountApproveServiceImpl.java
浏览文件 @
b35f3996
...
...
@@ -3,6 +3,7 @@ package com.clx.performance.service.impl.loan;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.clx.performance.dao.loan.OwnerLoanAccountApproveDao
;
import
com.clx.performance.enums.PerformanceResultEnum
;
import
com.clx.performance.enums.loan.OwnerLoanAccountApproveEnum
;
import
com.clx.performance.model.loan.OwnerLoanAccountApprove
;
import
com.clx.performance.param.pc.loan.carrier.OwnerLoanAccountApproveParam
;
...
...
@@ -72,18 +73,20 @@ public class OwnerLoanAccountApproveServiceImpl implements OwnerLoanAccountAppr
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
ownerLoanAccountApprove
(
OwnerLoanAccountApproveParam
param
)
{
Boolean
status
=
param
.
getStatus
();
OwnerLoanAccountApprove
entity
=
new
OwnerLoanAccountApprove
();
entity
.
setId
(
param
.
getId
());
OwnerLoanAccountApprove
entity
=
ownerLoanAccountApproveDao
.
getEntityByKey
(
param
.
getId
()).
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
OwnerLoanAccountApprove
update
=
new
OwnerLoanAccountApprove
();
update
.
setId
(
param
.
getId
());
if
(
status
)
{
//审批通过
entity
.
setStatus
(
OwnerLoanAccountApproveEnum
.
Status
.
APPROVE_PASS
.
getCode
());
ownerLoanAccountApproveDao
.
updateEntityByKey
(
entity
);
ownerLoanAccountApproveDao
.
updateEntityByKey
(
update
);
ownerLoanAccountService
.
openOwnerLoanAccount
(
entity
.
getOwnerUserNo
(),
entity
.
getOwnerUserName
(),
entity
.
getMobile
());
}
else
{
//审批拒绝
entity
.
setStatus
(
OwnerLoanAccountApproveEnum
.
Status
.
APPROVE_REFUSE
.
getCode
());
entity
.
setRejectReason
(
param
.
getRejectReason
());
ownerLoanAccountApproveDao
.
updateEntityByKey
(
entity
);
ownerLoanAccountApproveDao
.
updateEntityByKey
(
update
);
}
}
...
...
performance-web/src/main/java/com/clx/performance/service/impl/loan/OwnerLoanAccountServiceImpl.java
浏览文件 @
b35f3996
...
...
@@ -5,26 +5,33 @@ 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.*
;
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.OwnerAccountEnum
;
import
com.clx.performance.enums.loan.BankTradeEnum
;
import
com.clx.performance.enums.loan.OwnerLoanAccountApproveEnum
;
import
com.clx.performance.enums.loan.OwnerLoanRecordEnum
;
import
com.clx.performance.enums.loan.OwnerRePaymentEnum
;
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.*
;
import
com.clx.performance.model.settle.SettlementDriverDetail
;
import
com.clx.performance.model.settle.SettlementOwnerDetail
;
import
com.clx.performance.param.pc.loan.carrier.OwnerRepaymentParam
;
import
com.clx.performance.param.pc.loan.carrier.PageOwnerLoanAccountParam
;
import
com.clx.performance.service.loan.OwnerLoanAccountService
;
import
com.clx.performance.service.thirdparty.nbbank.NbBankService
;
import
com.clx.performance.struct.loan.OwnerLoanAccountStruct
;
import
com.clx.performance.vo.pc.loan.carrier.CarrierOwnerLoanAccountVO
;
import
com.clx.performance.vo.pc.loan.owner.OwnerAccountVO
;
import
com.clx.performance.vo.pc.nbbank.NbBankOrderPayResultVO
;
import
com.msl.common.base.Optional
;
import
com.msl.common.convertor.aspect.UnitCovert
;
import
com.msl.user.data.UserSessionData
;
import
com.msl.user.utils.TokenUtil
;
import
io.swagger.models.auth.In
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.core.Message
;
...
...
@@ -34,6 +41,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
...
...
@@ -60,6 +68,14 @@ public class OwnerLoanAccountServiceImpl implements OwnerLoanAccountService {
private
final
RabbitTemplate
rabbitTemplate
;
private
final
OwnerRepaymentDao
ownerRepaymentDao
;
private
final
NbBankService
bankService
;
private
final
BankTradeDao
bankTradeDao
;
private
final
OwnerLoanRecordDao
ownerLoanRecordDao
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
openOwnerLoanAccount
(
Long
ownerUserNo
,
String
ownerUserName
,
String
mobile
)
{
...
...
@@ -76,6 +92,7 @@ public class OwnerLoanAccountServiceImpl implements OwnerLoanAccountService {
entity
.
setVirtuallyAccountBalance
(
BigDecimal
.
ZERO
);
entity
.
setVirtuallyUsableBalance
(
BigDecimal
.
ZERO
);
entity
.
setVirtuallyFrozenBalance
(
BigDecimal
.
ZERO
);
entity
.
setAccountType
(
OwnerAccountEnum
.
AccountTypeStatus
.
LOAN_ACCOUNT
.
getCode
());
ownerLoanAccountDao
.
saveEntity
(
entity
);
}
...
...
@@ -99,30 +116,43 @@ public class OwnerLoanAccountServiceImpl implements OwnerLoanAccountService {
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
());
public
void
ownerRepayment
(
OwnerRepaymentParam
param
)
{
OwnerRepayment
ownerRepayment
=
ownerRepaymentDao
.
getOneByField
(
OwnerRepayment:
:
getRepaymentNo
,
param
.
getRepaymentNo
()).
get
();
OwnerLoanRecord
ownerLoanRecord
=
ownerLoanRecordDao
.
getOneByField
(
OwnerLoanRecord:
:
getLoanNo
,
ownerRepayment
.
getLoanNo
()).
get
();
BankTrade
bankTrade
=
new
BankTrade
();
if
(
OwnerLoanRecordEnum
.
PayChannel
.
ORDER_DIRECT_PAY
.
getCode
().
equals
(
param
.
getPayChannel
()))
{
// 订单支付
NbBankOrderPayResultVO
orderPayResultVO
=
bankService
.
orderDirectPay
(
ownerRepayment
.
getRepaymentNo
(),
"还款单"
,
ownerRepayment
.
getRepaymentBalance
().
intValue
(),
ownerLoanRecord
.
getPayeeBankCode
(),
ownerLoanRecord
.
getPayeeAccount
(),
ownerLoanRecord
.
getPayee
());
ownerRepayment
.
setRunningWaterOpenNo
(
orderPayResultVO
.
getTransSeqNo
());
ownerRepayment
.
setMerchantRunningWaterNo
(
orderPayResultVO
.
getMerSeqNo
());
bankTrade
.
setTradeType
(
BankTradeEnum
.
TradeType
.
ORDER_DIRECT_PAY
.
getCode
());
}
else
{
// 订单转账支付
NbBankOrderPayResultVO
orderPayResultVO
=
bankService
.
orderTransferPay
(
ownerRepayment
.
getRepaymentBalance
().
intValue
());
ownerRepayment
.
setRunningWaterOpenNo
(
orderPayResultVO
.
getTransSeqNo
());
ownerRepayment
.
setMerchantRunningWaterNo
(
orderPayResultVO
.
getMerSeqNo
());
ownerRepayment
.
setRemittanceIdentificationCode
(
orderPayResultVO
.
getSignNo
());
bankTrade
.
setTradeType
(
BankTradeEnum
.
TradeType
.
ORDER_TRANSFER_PAY
.
getCode
());
}
ownerRepayment
.
setStatus
(
OwnerLoanRecordEnum
.
Status
.
PAYING
.
getCode
());
// 更新还款支付信息
ownerRepaymentDao
.
updateRePay
(
ownerRepayment
);
bankTrade
.
setRelationNo
(
ownerRepayment
.
getRepaymentNo
().
toString
());
bankTrade
.
setOrderType
(
BankTradeEnum
.
OrderType
.
OWNER_LOAN_RECORD
.
getCode
());
bankTrade
.
setAmount
(
ownerLoanRecord
.
getLoanBalance
());
bankTrade
.
setMerchantRunningWaterNo
(
ownerLoanRecord
.
getMerchantRunningWaterNo
());
bankTrade
.
setRunningWaterOpenNo
(
ownerLoanRecord
.
getRunningWaterOpenNo
());
bankTrade
.
setRemark
(
"还款单"
);
// 保存银行交易记录
bankTradeDao
.
saveEntity
(
bankTrade
);
}
}
...
...
performance-web/src/main/java/com/clx/performance/service/impl/loan/OwnerLoanRecordServiceImpl.java
浏览文件 @
b35f3996
package
com
.
clx
.
performance
.
service
.
impl
.
loan
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
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.message.feign.ClxMessageOpenapiFeign
;
import
com.clx.message.req.message.AliSmsMessageReq
;
import
com.clx.order.enums.DeleteStatusEnum
;
import
com.clx.performance.component.IdGenerateSnowFlake
;
import
com.clx.performance.config.ClxMessageConfig
;
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.constant.RabbitKeyConstants
;
import
com.clx.performance.dao.OrderChildDao
;
import
com.clx.performance.dao.OwnerBindCardRecordDao
;
import
com.clx.performance.dao.loan.BorrowerDao
;
import
com.clx.performance.dao.loan.OwnerLoanAccountDao
;
import
com.clx.performance.dao.loan.OwnerLoanAccountRunningWaterRecordDao
;
import
com.clx.performance.dao.loan.OwnerLoanRecordDao
;
import
com.clx.performance.dao.loan.OwnerRepaymentDao
;
import
com.clx.performance.dao.settle.SettlementDriverDetailDao
;
import
com.clx.performance.dao.settle.SettlementOwnerDetailDao
;
import
com.clx.performance.dto.LoanBalanceDTO
;
import
com.clx.performance.dao.loan.*
;
import
com.clx.performance.dto.OwnerLoanMqDTO
;
import
com.clx.performance.enums.PerformanceResultEnum
;
import
com.clx.performance.enums.RunningWaterTypeEnum
;
import
com.clx.performance.enums.loan.BankTradeEnum
;
...
...
@@ -25,8 +34,12 @@ import com.clx.performance.enums.loan.OwnerLoanAccountRunningWaterRecordEnum;
import
com.clx.performance.enums.loan.OwnerLoanRecordEnum
;
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.model.OrderChild
;
import
com.clx.performance.model.OwnerBindCardRecord
;
import
com.clx.performance.model.loan.*
;
import
com.clx.performance.model.settle.SettlementDriverDetail
;
import
com.clx.performance.model.settle.SettlementOwnerDetail
;
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.OwnerLoanRecordParam
;
...
...
@@ -54,6 +67,9 @@ import com.msl.user.data.UserSessionData;
import
com.msl.user.utils.TokenUtil
;
import
lombok.AllArgsConstructor
;
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.transaction.annotation.Transactional
;
...
...
@@ -99,7 +115,20 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
private
final
ContractTemplateFeign
contractTemplateFeign
;
private
final
PaymentFromConfig
paymentFromConfig
;
private
final
NbBankConfig
nbBankConfig
;
private
final
ClxPayeeConfig
clxPayeeConfig
;
private
final
OwnerInfoServiceImpl
ownerInfoService
;
private
final
ClxMessageOpenapiFeign
clxMessageOpenapiFeign
;
private
final
ClxMessageConfig
messageConfig
;
private
final
OrderChildLoanRetryRecordDao
orderChildLoanRetryRecordDao
;
private
final
SettlementDriverDetailDao
settlementDriverDetailDao
;
private
final
SettlementOwnerDetailDao
settlementOwnerDetailDao
;
private
final
OrderChildDao
orderChildDao
;
private
final
RabbitTemplate
rabbitTemplate
;
@Override
public
IPage
<
OwnerLoanRecordVO
>
pageOwnerLoanRecord
(
PageCarrierOwnerLoanRecordParam
param
)
{
...
...
@@ -155,9 +184,24 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
//同意
ownerLoanRecord
.
setLoanType
(
param
.
getLoanType
());
//设置借款记录中借款方和借出方的银行账户信息
OwnerInfoFeignVO
ownerInfoFeignVO
=
ownerInfoService
.
getOwnerInfo
(
ownerLoanRecord
.
getOwnerUserNo
());
String
ownerAccountBank
=
ownerInfoFeignVO
.
getOwnerAccountBank
();
ownerLoanRecord
.
setLendingParty
(
ownerInfoFeignVO
.
getName
());
ownerLoanRecord
.
setLendingPartyBank
(
ownerAccountBank
);
ownerLoanRecord
.
setLendingPartyAccount
(
ownerInfoFeignVO
.
getOwnerBankAccount
());
ownerLoanRecord
.
setLendingPartyOpenBank
(
ownerInfoFeignVO
.
getOwnerOpenBank
());
ownerLoanRecord
.
setLendingPartyBankCode
(
ownerInfoFeignVO
.
getOwnerOpenBankNumber
());
//设置借款记录中借出方的银行账户信息
ownerLoanRecord
.
setBorrower
(
borrower
.
getName
());
ownerLoanRecord
.
setBorrowerAccount
(
borrower
.
getBankCardNo
());
ownerLoanRecord
.
setBorrowerBank
(
borrower
.
getBankName
());
ownerLoanRecord
.
setBorrowerOpenBank
(
borrower
.
getOpenBankName
());
ownerLoanRecord
.
setBorrowerBankCode
(
borrower
.
getOpenBankId
());
if
(
OwnerLoanRecordEnum
.
LoanType
.
FUND
.
getCode
().
equals
(
param
.
getLoanType
()))
{
//ownerLoanRecord.setStatus()
fundPayProcess
(
param
,
ownerLoanRecord
,
borrower
);
ownerLoanRecord
.
setStatus
(
OwnerLoanRecordEnum
.
Status
.
PAY_WAIT
.
getCode
());
//
fundPayProcess(param, ownerLoanRecord, borrower);
}
else
{
// 虚拟币 直接增加 更改状态审批通过
ownerLoanRecord
.
setStatus
(
OwnerLoanRecordEnum
.
Status
.
APPROVE_PASS
.
getCode
());
...
...
@@ -196,9 +240,10 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
private
void
fundPayProcess
(
CarrierOwnerLoanRecordApproveParam
param
,
OwnerLoanRecord
ownerLoanRecord
,
Borrower
borrower
)
{
//资金
BankTrade
bankTrade
=
new
BankTrade
();
bankTrade
.
setRemark
(
"借款单"
);
if
(
OwnerLoanRecordEnum
.
PayChannel
.
ORDER_DIRECT_PAY
.
getCode
().
equals
(
param
.
getPayChannel
()))
{
// 订单支付
NbBankOrderPayResultVO
orderPayResultVO
=
bankService
.
orderDirectPay
(
param
.
getLoanNo
(),
NbBankOrderPayResultVO
orderPayResultVO
=
bankService
.
orderDirectPay
(
param
.
getLoanNo
(),
"借款单"
,
ownerLoanRecord
.
getLoanBalance
().
intValue
(),
borrower
.
getOpenBankId
(),
borrower
.
getBankCardNo
(),
borrower
.
getName
());
ownerLoanRecord
.
setRunningWaterOpenNo
(
orderPayResultVO
.
getTransSeqNo
());
ownerLoanRecord
.
setMerchantRunningWaterNo
(
orderPayResultVO
.
getMerSeqNo
());
...
...
@@ -217,7 +262,7 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
ownerLoanRecord
.
setRemittanceIdentificationCode
(
orderPayResultVO
.
getSignNo
());
ownerLoanRecord
.
setStatus
(
OwnerLoanRecordEnum
.
Status
.
PAYING
.
getCode
());
ownerLoanRecord
.
setLoanResidueBalance
(
ownerLoanRecord
.
getLoanBalance
());
ownerLoanRecord
.
setRemittanceIdentificationCode
(
orderPayResultVO
.
getSignNo
());
bankTrade
.
setTradeType
(
BankTradeEnum
.
TradeType
.
ORDER_TRANSFER_PAY
.
getCode
());
}
// 更新借款支付信息
...
...
@@ -246,8 +291,7 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
* @param ownerLoanRecord
*/
private
void
initOwnerLoanRunningWaterRecord
(
OwnerLoanRecord
ownerLoanRecord
)
{
OwnerLoanAccount
ownerLoanAccount
;
ownerLoanAccount
=
ownerLoanAccountDao
.
getOneByField
(
OwnerLoanAccount:
:
getOwnerUserNo
,
ownerLoanRecord
.
getOwnerUserNo
()).
get
();
OwnerLoanAccount
ownerLoanAccount
=
ownerLoanAccountDao
.
getOneByField
(
OwnerLoanAccount:
:
getOwnerUserNo
,
ownerLoanRecord
.
getOwnerUserNo
()).
get
();
ownerLoanRecordDao
.
updateEntityByKey
(
ownerLoanRecord
);
OwnerLoanAccountRunningWaterRecord
record
=
new
OwnerLoanAccountRunningWaterRecord
()
.
setOwnerUserNo
(
ownerLoanRecord
.
getOwnerUserNo
())
...
...
@@ -257,6 +301,8 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
.
setLoanNo
(
ownerLoanRecord
.
getLoanNo
())
.
setRunningWaterType
(
RunningWaterTypeEnum
.
Status
.
LOAN
.
getCode
())
.
setAlterationBalance
(
ownerLoanRecord
.
getLoanBalance
())
.
setUseAbleBalance
(
ownerLoanAccount
.
getFundingUsableBalance
().
add
(
ownerLoanAccount
.
getVirtuallyUsableBalance
()))
.
setFrozenBalance
(
ownerLoanAccount
.
getFundingFrozenBalance
().
add
(
ownerLoanAccount
.
getVirtuallyFrozenBalance
()))
.
setAccountBalance
(
ownerLoanAccount
.
getFundingAccountBalance
().
add
(
ownerLoanAccount
.
getVirtuallyAccountBalance
()))
.
setCreateBy
(
"系统"
);
ownerLoanAccountRunningWaterRecordDao
.
saveEntity
(
record
);
...
...
@@ -278,14 +324,12 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
ownerRepayment
.
setRepaymentBalance
(
ownerLoanRecord
.
getLoanBalance
());
ownerRepayment
.
setRepaymentNo
(
idGenerateSnowFlake
.
nextId
(
2L
));
OwnerInfoFeignVO
ownerInfoFeignVO
=
ownerFeign
.
getOwnerInfo
(
ownerLoanRecord
.
getOwnerUserNo
()).
getData
();
log
.
info
(
"生成还款记录,查询到用户信息:{}"
,
JSONUtil
.
parse
(
ownerInfoFeignVO
));
ownerRepayment
.
setPayment
(
ownerInfoFeignVO
.
getCompanyName
());
ownerRepayment
.
setPaymentAccount
(
ownerInfoFeignVO
.
getOwnerBankAccount
());
ownerRepayment
.
setPayee
(
owner
Repayment
.
getPayee
());
ownerRepayment
.
setPayee
(
owner
LoanRecord
.
getPayee
());
ownerRepayment
.
setPayeeAccount
(
ownerLoanRecord
.
getPayeeAccount
());
ownerRepayment
.
setPayChannel
(
ownerLoanRecord
.
getPayChannel
());
ownerRepayment
.
setPayeeBank
(
ownerLoanRecord
.
getPayeeBank
());
ownerRepayment
.
setPayeeBankCode
(
ownerLoanRecord
.
getPayeeBankCode
());
ownerRepayment
.
setBeOverdue
(
OwnerRePaymentEnum
.
BeOverdue
.
NO
.
getCode
());
ownerRepayment
.
setCreateBy
(
"系统"
);
ownerRepayment
.
setStatus
(
OwnerRePaymentEnum
.
Status
.
PAY_WAIT
.
getCode
());
...
...
@@ -372,7 +416,8 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
.
payeeAccount
(
payeeMap
.
getAccount
()).
payeeBank
(
payeeMap
.
getBank
()).
payeeBankNo
(
payeeMap
.
getBankNo
())
.
loanBalance
(
ownerLoanRecord
.
getLoanBalance
())
.
remittanceIdentificationCode
(
ownerLoanRecord
.
getRemittanceIdentificationCode
())
.
status
(
ownerLoanRecord
.
getStatus
()).
finalPaymentTime
(
ownerLoanRecord
.
getCloseOrderTime
()).
build
();
.
status
(
ownerLoanRecord
.
getStatus
()).
finalPaymentTime
(
ownerLoanRecord
.
getCloseOrderTime
())
.
loanNo
(
ownerLoanRecord
.
getLoanNo
()).
build
();
}
@Override
...
...
@@ -464,11 +509,10 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
if
(
OwnerLoanRecordEnum
.
PayChannel
.
ORDER_DIRECT_PAY
.
getCode
().
equals
(
param
.
getPayChannel
()))
{
//资金 TODO 调宁波银企直连的产品,从诚联信账户中给鑫祥和执行转账
// 订单支付
NbBankOrderPayResultVO
orderPayResultVO
=
bankService
.
orderDirectPay
(
param
.
getLoanNo
(),
NbBankOrderPayResultVO
orderPayResultVO
=
bankService
.
orderDirectPay
(
param
.
getLoanNo
(),
"借款单"
,
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
());
...
...
@@ -538,7 +582,7 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
.
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
if
(
Objects
.
equals
(
ownerLoanRecord
.
getStatus
(),
OwnerLoanRecordEnum
.
Status
.
PAYING
.
getCode
()))
{
log
.
info
(
"借款单非支付中状态, loanNo:{}"
,
bankTrade
.
getRelatio
nNo
());
log
.
info
(
"借款单非支付中状态, loanNo:{}"
,
ownerLoanRecord
.
getLoa
nNo
());
return
;
}
...
...
@@ -562,10 +606,39 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
//生成还款记录
initOwnerRepayment
(
ownerLoanRecord
);
ownerLoanRecordDao
.
updateStatusById
(
ownerLoanRecord
);
//执行货主未处理借款标志的计费(运单确认生成后因为借款不够阻塞流程的相关计费进行处理)
orderChildLoanProcess
(
ownerLoanRecord
.
getOwnerUserNo
());
break
;
}
}
}
/**
* 执行货主未处理借款标志的计费
*
* @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
());
}
}
@Override
...
...
@@ -675,4 +748,52 @@ public class OwnerLoanRecordServiceImpl implements OwnerLoanRecordService {
}
}
@Override
public
String
sendLoanSms
(
String
mobile
,
Long
loanNo
)
{
AliSmsMessageReq
req
=
new
AliSmsMessageReq
();
req
.
setTemplateCode
(
messageConfig
.
getRepaymentTemplateCode
());
JSONObject
jsonObject
=
new
JSONObject
();
//随机生成4位数字
jsonObject
.
set
(
"borrowNo"
,
loanNo
);
req
.
setChannelId
(
messageConfig
.
getChannelId
());
req
.
setAppId
(
messageConfig
.
getAppId
().
toString
());
req
.
setMobile
(
mobile
);
req
.
setContent
(
jsonObject
.
toString
());
req
.
setExpire
(
300L
);
clxMessageOpenapiFeign
.
sendAliSms
(
req
);
return
UUID
.
randomUUID
().
toString
();
}
@Override
public
String
sendOrderPaySms
(
String
mobile
,
String
payee
,
String
payeeAccount
)
{
AliSmsMessageReq
req
=
new
AliSmsMessageReq
();
req
.
setTemplateCode
(
messageConfig
.
getOrderPayTemplateCode
());
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
set
(
"companyName"
,
payee
);
jsonObject
.
set
(
"bankAccount"
,
payeeAccount
);
req
.
setChannelId
(
messageConfig
.
getChannelId
());
req
.
setAppId
(
messageConfig
.
getAppId
().
toString
());
req
.
setMobile
(
mobile
);
req
.
setContent
(
jsonObject
.
toString
());
req
.
setExpire
(
300L
);
clxMessageOpenapiFeign
.
sendAliSms
(
req
);
return
UUID
.
randomUUID
().
toString
();
}
@Override
public
Integer
ownerLoanRecordSubmitNbBank
(
CarrierOwnerLoanRecordApproveParam
param
)
{
OwnerLoanRecord
ownerLoanRecord
=
ownerLoanRecordDao
.
getOneByField
(
OwnerLoanRecord:
:
getLoanNo
,
param
.
getLoanNo
()).
get
();
if
(!
OwnerLoanRecordEnum
.
Status
.
PAY_WAIT
.
getCode
().
equals
(
ownerLoanRecord
.
getStatus
()))
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
OWNER_LOAN_RECORD_PAY_WAIT_ERROR
);
}
borrowerConfigDao
.
selectByBorrowerIdAndType
(
ownerLoanRecord
.
getBorrowerId
(),
param
.
getLoanType
())
.
orElseThrow
(
PerformanceResultEnum
.
BORROWER_CONFIG_TYPE_NOT_SUPPORT_ERROR
);
Borrower
borrower
=
borrowerDao
.
getEntityByKey
(
ownerLoanRecord
.
getBorrowerId
())
.
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
fundPayProcess
(
param
,
ownerLoanRecord
,
borrower
);
return
ownerLoanRecord
.
getId
();
}
}
performance-web/src/main/java/com/clx/performance/service/impl/loan/OwnerPaymentServiceImpl.java
浏览文件 @
b35f3996
...
...
@@ -3,10 +3,12 @@ package com.clx.performance.service.impl.loan;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.clx.performance.dao.loan.OwnerPaymentDao
;
import
com.clx.performance.enums.PerformanceResultEnum
;
import
com.clx.performance.model.loan.OwnerPayment
;
import
com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerPaymentParam
;
import
com.clx.performance.service.loan.OwnerPaymentService
;
import
com.clx.performance.struct.loan.OwnerPaymentStruct
;
import
com.clx.performance.vo.pc.loan.carrier.CarrierOwnerPaymentVO
;
import
com.clx.performance.vo.pc.loan.carrier.OwnerPaymentVO
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -35,4 +37,10 @@ public class OwnerPaymentServiceImpl implements OwnerPaymentService {
returnPage
.
setRecords
(
records
);
return
returnPage
;
}
@Override
public
CarrierOwnerPaymentVO
getOwnerPaymentDetail
(
Integer
id
)
{
OwnerPayment
ownerPayment
=
ownerPaymentDao
.
getEntityByKey
(
id
).
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
return
ownerPaymentStruct
.
convert
(
ownerPayment
);
}
}
performance-web/src/main/java/com/clx/performance/service/impl/loan/OwnerRepaymentServiceImpl.java
浏览文件 @
b35f3996
package
com
.
clx
.
performance
.
service
.
impl
.
loan
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
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.message.feign.ClxMessageOpenapiFeign
;
import
com.clx.message.req.message.AliSmsMessageReq
;
import
com.clx.performance.component.IdGenerateSnowFlake
;
import
com.clx.performance.config.ClxMessageConfig
;
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.BankTradeDao
;
import
com.clx.performance.dao.loan.OwnerLoanRecordDao
;
import
com.clx.performance.dao.loan.OwnerPaymentDao
;
import
com.clx.performance.dao.loan.OwnerRepaymentDao
;
import
com.clx.performance.enums.PerformanceResultEnum
;
import
com.clx.performance.enums.loan.OwnerLoanRecordEnum
;
import
com.clx.performance.enums.loan.OwnerPaymentEnum
;
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.model.loan.BankTrade
;
import
com.clx.performance.model.loan.OwnerLoanRecord
;
import
com.clx.performance.model.loan.OwnerPayment
;
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
;
import
com.clx.performance.param.pc.loan.owner.ExportPaymentApplicationFormParam
;
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.vo.pc.loan.carrier.OwnerRepaymentVO
;
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.performance.vo.pc.nbbank.NbBankOrderResultVO
;
import
com.clx.user.vo.feign.OwnerInfoFeignVO
;
import
com.clx.user.vo.pc.owner.OwnerBindCardVO
;
import
com.msl.common.exception.ServiceSystemException
;
import
com.msl.common.result.Result
;
import
com.msl.common.utils.DateUtils
;
import
com.msl.document.api.feign.ContractEvidenceFeign
;
...
...
@@ -34,12 +54,10 @@ import com.msl.user.utils.TokenUtil;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.*
;
/**
* @author kavin
...
...
@@ -58,6 +76,13 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService {
private
final
PaymentFromConfig
paymentFromConfig
;
private
final
OwnerInfoServiceImpl
ownerInfoService
;
private
final
NbBankConfig
nbBankConfig
;
private
final
ClxMessageOpenapiFeign
clxMessageOpenapiFeign
;
private
final
ClxMessageConfig
messageConfig
;
private
final
NbBankService
bankService
;
private
final
BankTradeDao
bankTradeDao
;
private
final
IdGenerateSnowFlake
idGenerateSnowFlake
;
private
final
OwnerPaymentDao
ownerPaymentDao
;
private
final
OwnerLoanRecordDao
ownerLoanRecordDao
;
@Override
public
IPage
<
OwnerRepaymentVO
>
pageOwnerRepayment
(
PageCarrierOwnerRepaymentParam
param
)
{
...
...
@@ -103,14 +128,14 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService {
PerformanceResultEnum
.
DATA_NOT_FIND
);
OwnerCashierInfoVO
vo
=
ownerRepaymentStruct
.
convertCashierInfo
(
ownerRepayment
);
Owner
BindCardVO
bindCard
=
ownerInfoService
.
getOwnerBindCard
(
ownerRepayment
.
getOwnerUserNo
());
String
ownerAccountBank
=
bindCard
.
getOwnerAccountBank
();
Owner
InfoFeignVO
ownerInfoFeignVO
=
ownerInfoService
.
getOwnerInfo
(
ownerRepayment
.
getOwnerUserNo
());
String
ownerAccountBank
=
ownerInfoFeignVO
.
getOwnerAccountBank
();
vo
.
setOrderPayWay
(
false
);
if
(
nbBankConfig
.
getOrderSupportBank
().
contains
(
ownerAccountBank
)){
vo
.
setOrderPayWay
(
true
);
}
vo
.
setBankName
(
ownerAccountBank
);
vo
.
setPayAccount
(
bindCard
.
getOwnerBankAccount
());
vo
.
setPayAccount
(
ownerInfoFeignVO
.
getOwnerBankAccount
());
return
vo
;
}
...
...
@@ -119,6 +144,10 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService {
OwnerRepayment
ownerRepayment
=
ownerRepaymentDao
.
getEntityByKey
(
id
).
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
OwnerOrderPaymentDetailVO
vo
=
ownerRepaymentStruct
.
convertOrderPaymentDetail
(
ownerRepayment
);
ClxPayeeConfig
.
PayeeConfig
payeeMap
=
ClxPayeeConfig
.
getPayee
(
ClxPayeeConfig
.
XXH_ID
);
vo
.
setPayee
(
payeeMap
.
getName
());
vo
.
setPayeeAccount
(
payeeMap
.
getAccount
());
//计算倒计时时间,下单时间 + 30天 为截止时间
LocalDateTime
endTime
=
ownerRepayment
.
getCreateTime
().
plusDays
(
30
);
vo
.
setFinalPaymentTime
(
DateUtils
.
formatDateTime
(
endTime
).
get
());
...
...
@@ -134,7 +163,8 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService {
.
payeeAccount
(
payeeMap
.
getAccount
()).
payeeBank
(
payeeMap
.
getBank
()).
payeeBankNo
(
payeeMap
.
getBankNo
())
.
repaymentBalance
(
ownerRepayment
.
getRepaymentBalance
())
.
remittanceIdentificationCode
(
ownerRepayment
.
getRemittanceIdentificationCode
())
.
status
(
ownerRepayment
.
getStatus
()).
finalPaymentTime
(
ownerRepayment
.
getCloseOrderTime
()).
build
();
.
status
(
ownerRepayment
.
getStatus
()).
finalPaymentTime
(
ownerRepayment
.
getCloseOrderTime
())
.
repaymentNo
(
ownerRepayment
.
getRepaymentNo
()).
build
();
}
@Override
...
...
@@ -156,4 +186,127 @@ public class OwnerRepaymentServiceImpl implements OwnerRepaymentService {
Result
<
ContractEvidenceRecordVo
>
contractEvidenceDetail
=
contractEvidenceFeign
.
getContractEvidenceDetail
(
longResult
.
getData
());
return
contractEvidenceDetail
.
getData
().
getFileUrl
();
}
@Override
public
String
sendPaymentSms
(
String
mobile
,
Long
repaymentNo
)
{
AliSmsMessageReq
req
=
new
AliSmsMessageReq
();
req
.
setTemplateCode
(
messageConfig
.
getRepaymentTemplateCode
());
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
set
(
"repaymentNo"
,
repaymentNo
);
req
.
setChannelId
(
messageConfig
.
getChannelId
());
req
.
setAppId
(
messageConfig
.
getAppId
().
toString
());
req
.
setMobile
(
mobile
);
req
.
setContent
(
jsonObject
.
toString
());
req
.
setExpire
(
300L
);
clxMessageOpenapiFeign
.
sendAliSms
(
req
);
return
UUID
.
randomUUID
().
toString
();
}
@Override
public
String
sendOrderPaySms
(
String
mobile
,
String
payee
,
String
payeeAccount
)
{
AliSmsMessageReq
req
=
new
AliSmsMessageReq
();
req
.
setTemplateCode
(
messageConfig
.
getOrderPayTemplateCode
());
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
set
(
"companyName"
,
payee
);
jsonObject
.
set
(
"bankAccount"
,
payeeAccount
);
req
.
setChannelId
(
messageConfig
.
getChannelId
());
req
.
setAppId
(
messageConfig
.
getAppId
().
toString
());
req
.
setMobile
(
mobile
);
req
.
setContent
(
jsonObject
.
toString
());
req
.
setExpire
(
300L
);
clxMessageOpenapiFeign
.
sendAliSms
(
req
);
return
UUID
.
randomUUID
().
toString
();
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
ownerRepaymentCancelPay
(
String
repaymentNo
)
{
OwnerRepayment
ownerRepayment
=
ownerRepaymentDao
.
getOneByField
(
OwnerRepayment:
:
getRepaymentNo
,
repaymentNo
)
.
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
if
(!
ownerRepayment
.
getStatus
().
equals
(
OwnerRePaymentEnum
.
Status
.
PAYING
.
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
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
paySuccess
(
String
merSeqNo
)
{
// 查询交易流水
BankTrade
bankTrade
=
bankTradeDao
.
getOneByField
(
BankTrade:
:
getMerchantRunningWaterNo
,
merSeqNo
)
.
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
// 查询还款信息
OwnerRepayment
ownerRepayment
=
ownerRepaymentDao
.
getOneByField
(
OwnerRepayment:
:
getRepaymentNo
,
bankTrade
.
getRelationNo
()).
get
();
ownerRepayment
.
setStatus
(
OwnerRePaymentEnum
.
Status
.
PAY_SUCCESS
.
getCode
());
// 更新借款信息
ownerRepaymentDao
.
updateStatusById
(
ownerRepayment
);
OwnerLoanRecord
ownerLoanRecord
=
ownerLoanRecordDao
.
getOneByField
(
OwnerLoanRecord:
:
getLoanNo
,
ownerRepayment
.
getLoanNo
()).
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
//生成付款记录
OwnerPayment
ownerPayment
=
new
OwnerPayment
();
ownerPayment
.
setOwnerUserNo
(
ownerRepayment
.
getOwnerUserNo
());
ownerPayment
.
setOwnerUserName
(
ownerRepayment
.
getOwnerUserName
());
ownerPayment
.
setMobile
(
ownerRepayment
.
getMobile
());
ownerPayment
.
setRunningWaterOpenNo
(
bankTrade
.
getRunningWaterOpenNo
());
ownerPayment
.
setPaymentNo
(
idGenerateSnowFlake
.
nextId
(
1L
));
ownerPayment
.
setRepaymentNo
(
ownerRepayment
.
getRepaymentNo
());
ownerPayment
.
setPaymentBalance
(
ownerRepayment
.
getRepaymentBalance
());
//付款单的付款方取还款单的收款方
ownerPayment
.
setPayment
(
ownerRepayment
.
getPayee
());
ownerPayment
.
setPaymentAccount
(
ownerRepayment
.
getPayeeAccount
());
//付款单的收款方取借款单的借出方
ownerPayment
.
setPayee
(
ownerLoanRecord
.
getBorrower
());
ownerPayment
.
setPayeeAccount
(
ownerLoanRecord
.
getBorrowerAccount
());
ownerPayment
.
setStatus
(
OwnerPaymentEnum
.
Status
.
PAY_WAIT
.
getCode
());
ownerPayment
.
setPayChannel
(
OwnerLoanRecordEnum
.
PayChannel
.
ASSET
.
getCode
());
ownerPayment
.
setCreateBy
(
"system"
);
ownerPaymentDao
.
saveEntity
(
ownerPayment
);
}
@Override
public
void
payFail
(
String
merSeqNo
)
{
// 查询交易流水
BankTrade
bankTrade
=
bankTradeDao
.
getOneByField
(
BankTrade:
:
getMerchantRunningWaterNo
,
merSeqNo
)
.
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
// 查询还款信息
OwnerRepayment
ownerRepayment
=
ownerRepaymentDao
.
getOneByField
(
OwnerRepayment:
:
getRepaymentNo
,
bankTrade
.
getRelationNo
()).
get
();
ownerRepayment
.
setStatus
(
OwnerRePaymentEnum
.
Status
.
PAY_FAIL
.
getCode
());
// 更新借款信息
ownerRepaymentDao
.
updateStatusById
(
ownerRepayment
);
}
}
performance-web/src/main/java/com/clx/performance/service/impl/thirdparty/nbbank/NbBankServiceImpl.java
浏览文件 @
b35f3996
...
...
@@ -2,7 +2,7 @@ package com.clx.performance.service.impl.thirdparty.nbbank;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.clx.performance.param.Owner
LoanPay
NotifyMqParam
;
import
com.clx.performance.param.Owner
Bank
NotifyMqParam
;
import
com.clx.performance.component.IdGenerateSnowFlake
;
import
com.clx.performance.constant.RabbitKeyConstants
;
import
com.clx.performance.dao.loan.BankTradeDao
;
...
...
@@ -83,7 +83,7 @@ public class NbBankServiceImpl implements NbBankService {
* @param payAcctNm 付款户名
*/
@Override
public
NbBankOrderPayResultVO
orderDirectPay
(
Long
loanNo
,
Integer
amount
,
public
NbBankOrderPayResultVO
orderDirectPay
(
Long
loanNo
,
String
remark
,
Integer
amount
,
String
payAcctOpenBankId
,
String
payAcctNo
,
String
payAcctNm
)
{
String
merSeqNo
=
idGenerateSnowFlake
.
nextIdToString
(
1L
);
...
...
@@ -94,7 +94,7 @@ public class NbBankServiceImpl implements NbBankService {
String
transSeqNo
=
data
.
getString
(
"transSeqNo"
);
if
(
StringUtils
.
isBlank
(
transSeqNo
))
{
log
.
info
(
"宁波银行订单支付失败,
借款
单号{},返回结果:{}"
,
loanNo
,
data
);
log
.
info
(
"宁波银行订单支付失败,单号{},返回结果:{}"
,
loanNo
,
data
);
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
NB_BANK_ORDER_PAY_ERROR
);
}
NbBankOrderPayResultVO
result
=
new
NbBankOrderPayResultVO
();
...
...
@@ -237,15 +237,21 @@ public class NbBankServiceImpl implements NbBankService {
bankTradeDao
.
updateStatus
(
bankTrade
);
// 货主借款支付回调
if
(
Objects
.
equals
(
bankTrade
.
getOrderType
(),
BankTradeEnum
.
OrderType
.
OWNER_LOAN_RECORD
.
getCode
())){
Owner
LoanPayNotifyMqParam
param
=
new
OwnerLoanPay
NotifyMqParam
();
Owner
BankNotifyMqParam
param
=
new
OwnerBank
NotifyMqParam
();
param
.
setMerSeqNo
(
merSeqNo
);
param
.
setPayStatus
(
transStatus
);
Message
message
=
MessageBuilder
.
withBody
(
JSONUtil
.
parse
(
param
).
toString
().
getBytes
()).
build
();
//执行解绑自有车辆处理逻辑,将绑定记录正常改为取消
rabbitTemplate
.
send
(
RabbitKeyConstants
.
OWNER_LOAN_EXCHANGE
,
RabbitKeyConstants
.
OWNER_LOAN_PAY_ROUTE_KEY
,
message
);
if
(
"借款单"
.
equals
(
bankTrade
.
getRemark
()))
{
//执行借款支付成功通知
rabbitTemplate
.
send
(
RabbitKeyConstants
.
OWNER_LOAN_EXCHANGE
,
RabbitKeyConstants
.
OWNER_LOAN_PAY_ROUTE_KEY
,
message
);
}
else
if
(
"还款单"
.
equals
(
bankTrade
.
getRemark
()))
{
rabbitTemplate
.
send
(
RabbitKeyConstants
.
OWNER_LOAN_EXCHANGE
,
RabbitKeyConstants
.
OWNER_REPAYMENT_ROUTE_KEY
,
message
);
}
}
...
...
performance-web/src/main/java/com/clx/performance/service/loan/OwnerLoanAccountService.java
浏览文件 @
b35f3996
package
com
.
clx
.
performance
.
service
.
loan
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.clx.performance.param.pc.loan.carrier.OwnerRepaymentParam
;
import
com.clx.performance.param.pc.loan.carrier.PageOwnerLoanAccountParam
;
import
com.clx.performance.vo.pc.loan.carrier.CarrierOwnerLoanAccountVO
;
import
com.clx.performance.vo.pc.loan.owner.OwnerAccountVO
;
...
...
@@ -18,5 +19,5 @@ public interface OwnerLoanAccountService {
OwnerAccountVO
getOwnerLoanAccount
();
void
o
rderChildLoanProcess
(
Long
ownerUserNo
);
void
o
wnerRepayment
(
OwnerRepaymentParam
param
);
}
performance-web/src/main/java/com/clx/performance/service/loan/OwnerLoanRecordService.java
浏览文件 @
b35f3996
...
...
@@ -49,4 +49,12 @@ public interface OwnerLoanRecordService {
void
ownerLoanRecordRetryPay
(
String
loanNo
);
void
ownerLoanRecordCancelPay
(
String
loanNo
);
String
sendLoanSms
(
String
mobile
,
Long
loanNo
);
String
sendOrderPaySms
(
String
mobile
,
String
payee
,
String
payeeAccount
);
Integer
ownerLoanRecordSubmitNbBank
(
CarrierOwnerLoanRecordApproveParam
param
);
void
orderChildLoanProcess
(
Long
ownerUserNo
);
}
performance-web/src/main/java/com/clx/performance/service/loan/OwnerPaymentService.java
浏览文件 @
b35f3996
...
...
@@ -2,6 +2,7 @@ package com.clx.performance.service.loan;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.clx.performance.param.pc.loan.carrier.PageCarrierOwnerPaymentParam
;
import
com.clx.performance.vo.pc.loan.carrier.CarrierOwnerPaymentVO
;
import
com.clx.performance.vo.pc.loan.carrier.OwnerPaymentVO
;
/**
...
...
@@ -11,4 +12,6 @@ import com.clx.performance.vo.pc.loan.carrier.OwnerPaymentVO;
*/
public
interface
OwnerPaymentService
{
IPage
<
OwnerPaymentVO
>
pageOwnerPayment
(
PageCarrierOwnerPaymentParam
param
);
CarrierOwnerPaymentVO
getOwnerPaymentDetail
(
Integer
id
);
}
performance-web/src/main/java/com/clx/performance/service/loan/OwnerRepaymentService.java
浏览文件 @
b35f3996
...
...
@@ -29,4 +29,15 @@ public interface OwnerRepaymentService {
OwnerTransferPaymentDetailVO
getTransferPaymentDetail
(
Integer
id
);
String
savePaymentApplicationForm
(
ExportPaymentApplicationFormParam
param
);
String
sendPaymentSms
(
String
mobile
,
Long
repaymentNo
);
String
sendOrderPaySms
(
String
mobile
,
String
payee
,
String
payeeAccount
);
void
ownerRepaymentCancelPay
(
String
repaymentNo
);
void
ownerRepaymentRetryPay
(
String
repaymentNo
);
void
paySuccess
(
String
merSeqNo
);
void
payFail
(
String
merSeqNo
);
}
performance-web/src/main/java/com/clx/performance/service/thirdparty/nbbank/NbBankService.java
浏览文件 @
b35f3996
...
...
@@ -10,7 +10,7 @@ public interface NbBankService {
NbBankOrderPayResultVO
orderTransferPay
(
Integer
amount
);
NbBankOrderPayResultVO
orderDirectPay
(
Long
loanNo
,
Integer
amount
,
NbBankOrderPayResultVO
orderDirectPay
(
Long
loanNo
,
String
remark
,
Integer
amount
,
String
payAcctOpenBankId
,
String
payAcctNo
,
String
payAcctNm
);
NbBankOrderResultVO
getResult
(
String
merSeqNo
);
...
...
performance-web/src/main/java/com/clx/performance/struct/loan/OwnerPaymentStruct.java
浏览文件 @
b35f3996
package
com
.
clx
.
performance
.
struct
.
loan
;
import
com.clx.performance.model.loan.OwnerPayment
;
import
com.clx.performance.vo.pc.loan.carrier.CarrierOwnerPaymentVO
;
import
com.clx.performance.vo.pc.loan.carrier.OwnerPaymentVO
;
import
com.msl.common.utils.DateStructUtil
;
import
org.mapstruct.Mapper
;
...
...
@@ -12,4 +13,6 @@ import java.util.Objects;
public
interface
OwnerPaymentStruct
{
List
<
OwnerPaymentVO
>
convertList
(
List
<
OwnerPayment
>
list
);
CarrierOwnerPaymentVO
convert
(
OwnerPayment
ownerPayment
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论