Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
windows
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhanhai
windows
Commits
c26d5508
Commit
c26d5508
authored
Oct 27, 2023
by
张庆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增MQ
parent
2ce1691c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
95 additions
and
51 deletions
+95
-51
BackedCommand.java
src/main/java/com/jqtx/windows/command/BackedCommand.java
+16
-7
GetSignContractCommand.java
...java/com/jqtx/windows/command/GetSignContractCommand.java
+17
-9
LoanSubmitCommand.java
...main/java/com/jqtx/windows/command/LoanSubmitCommand.java
+2
-1
SaveProtocolCommand.java
...in/java/com/jqtx/windows/command/SaveProtocolCommand.java
+15
-6
SignContractCommand.java
...in/java/com/jqtx/windows/command/SignContractCommand.java
+15
-8
SyncCreditCommand.java
...main/java/com/jqtx/windows/command/SyncCreditCommand.java
+11
-4
SyncLoanCommand.java
src/main/java/com/jqtx/windows/command/SyncLoanCommand.java
+7
-7
AbstractCommand.java
...java/com/jqtx/windows/common/factory/AbstractCommand.java
+12
-9
No files found.
src/main/java/com/jqtx/windows/command/BackedCommand.java
View file @
c26d5508
...
...
@@ -2,6 +2,7 @@ package com.jqtx.windows.command;
import
com.alibaba.fastjson.JSONObject
;
import
com.jqtx.windows.common.exception.BizException
;
import
com.jqtx.windows.common.factory.AbstractCommand
;
import
com.jqtx.windows.common.factory.RuntimeContextHolder
;
import
com.jqtx.windows.component.BackedDetailComponent
;
...
...
@@ -17,6 +18,7 @@ import com.jqtx.windows.infrastructure.feign.enums.DebtPlanStatusEnum;
import
com.jqtx.windows.web.request.BackedDetail
;
import
com.jqtx.windows.web.request.BackedRequest
;
import
com.jqtx.windows.web.response.JsonResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -30,6 +32,7 @@ import java.util.List;
import
java.util.stream.Collectors
;
@Service
@Slf4j
public
class
BackedCommand
extends
AbstractCommand
{
@Autowired
...
...
@@ -49,13 +52,19 @@ public class BackedCommand extends AbstractCommand {
public
JsonResult
execute
()
{
String
request
=
RuntimeContextHolder
.
currentRuntimeContext
().
getRequestBody
();
BackedRequest
backedRequest
=
JSONObject
.
parseObject
(
request
,
BackedRequest
.
class
);
//生成 windows_repay 信息
creditRepay
(
backedRequest
);
//生成 windows_backed_detail 信息
//修改 windows_plan backAmt 信息
//修改 windows_plan 还款状态
//修改 windows_loan 还款状态
backedDetail
(
backedRequest
.
getLoanNo
(),
new
BigDecimal
(
backedRequest
.
getBackAmt
()),
backedRequest
.
getBackedNo
(),
backedRequest
);
try
{
//生成 windows_repay 信息
creditRepay
(
backedRequest
);
//生成 windows_backed_detail 信息
//修改 windows_plan backAmt 信息
//修改 windows_plan 还款状态
//修改 windows_loan 还款状态
backedDetail
(
backedRequest
.
getLoanNo
(),
new
BigDecimal
(
backedRequest
.
getBackAmt
()),
backedRequest
.
getBackedNo
(),
backedRequest
);
}
catch
(
Exception
e
)
{
log
.
error
(
"用户还款,授信编号:{},报错:{}"
,
backedRequest
.
getLoanNo
(),
e
.
getMessage
(),
e
);
throw
new
BizException
(
"用户还款错误"
);
}
return
JsonResult
.
success
();
}
...
...
src/main/java/com/jqtx/windows/command/GetSignContractCommand.java
View file @
c26d5508
...
...
@@ -3,17 +3,20 @@ package com.jqtx.windows.command;
import
com.alibaba.fastjson.JSONObject
;
import
com.jqtx.infrastructure.oss.starter.config.OssUtils
;
import
com.jqtx.windows.common.exception.BizException
;
import
com.jqtx.windows.common.factory.AbstractCommand
;
import
com.jqtx.windows.common.factory.RuntimeContextHolder
;
import
com.jqtx.windows.component.model.GetSignContractModel
;
import
com.jqtx.windows.infrastructure.feign.IProtocalFeignService
;
import
com.jqtx.windows.web.response.GetSignContractResponse
;
import
com.jqtx.windows.web.response.JsonResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
@Slf4j
public
class
GetSignContractCommand
extends
AbstractCommand
{
@Autowired
private
IProtocalFeignService
iProtocalFeignService
;
...
...
@@ -25,15 +28,20 @@ public class GetSignContractCommand extends AbstractCommand {
public
JsonResult
execute
()
{
String
requestBody
=
RuntimeContextHolder
.
currentRuntimeContext
().
getRequestBody
();
GetSignContractModel
getSignContractModel
=
JSONObject
.
parseObject
(
requestBody
,
GetSignContractModel
.
class
);
GetSignContractResponse
getSignContractResponse
=
new
GetSignContractResponse
();
JsonResult
<
String
>
rongdanPdfJsonResult
=
iProtocalFeignService
.
getFilePathPdf
(
getSignContractModel
.
getLoanNo
(),
"own-rongdan"
);
if
(
rongdanPdfJsonResult
.
isSuccess
()
&&
StringUtils
.
isNotEmpty
(
rongdanPdfJsonResult
.
getResult
())){
getSignContractResponse
.
setSignStatus
(
"SIGN"
);
String
path
=
ossUtils
.
generateTempURLPrivateDomain
(
rongdanPdfJsonResult
.
getResult
());
getSignContractResponse
.
setContractFileUrl
(
path
);
}
else
{
getSignContractResponse
.
setSignStatus
(
"SIGN_ING"
);
try
{
GetSignContractResponse
getSignContractResponse
=
new
GetSignContractResponse
();
JsonResult
<
String
>
rongdanPdfJsonResult
=
iProtocalFeignService
.
getFilePathPdf
(
getSignContractModel
.
getLoanNo
(),
"own-rongdan"
);
if
(
rongdanPdfJsonResult
.
isSuccess
()
&&
StringUtils
.
isNotEmpty
(
rongdanPdfJsonResult
.
getResult
()))
{
getSignContractResponse
.
setSignStatus
(
"SIGN"
);
String
path
=
ossUtils
.
generateTempURLPrivateDomain
(
rongdanPdfJsonResult
.
getResult
());
getSignContractResponse
.
setContractFileUrl
(
path
);
}
else
{
getSignContractResponse
.
setSignStatus
(
"SIGN_ING"
);
}
return
JsonResult
.
success
(
getSignContractResponse
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取融单协议,授信编号:{},报错:{}"
,
getSignContractModel
.
getLoanNo
(),
e
.
getMessage
(),
e
);
throw
new
BizException
(
"获取融单协议错误"
);
}
return
JsonResult
.
success
(
getSignContractResponse
);
}
}
src/main/java/com/jqtx/windows/command/LoanSubmitCommand.java
View file @
c26d5508
...
...
@@ -76,8 +76,9 @@ public class LoanSubmitCommand extends AbstractCommand {
model
.
setOrderNo
(
loanSubmitResponse
.
getOrderNo
());
JsonResult
<
Boolean
>
booleanJsonResult
=
wakandaFeignService
.
loanCredit
(
model
);
JsonResult
.
success
(
booleanJsonResult
.
isSuccess
());
}
catch
(
Biz
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"LoanSubmitCommand借款编号:{} 报错:{}"
,
loanSubmitResponse
.
getLoanNo
(),
e
.
getMessage
(),
e
);
throw
new
BizException
(
"提现授信审核错误"
);
}
return
JsonResult
.
success
();
}
...
...
src/main/java/com/jqtx/windows/command/SaveProtocolCommand.java
View file @
c26d5508
...
...
@@ -2,6 +2,7 @@ package com.jqtx.windows.command;
import
com.alibaba.fastjson.JSON
;
import
com.jqtx.windows.common.converter.ProtocolConverter
;
import
com.jqtx.windows.common.exception.BizException
;
import
com.jqtx.windows.common.factory.AbstractCommand
;
import
com.jqtx.windows.common.factory.RuntimeContextHolder
;
import
com.jqtx.windows.component.model.UploadPdfDetailRequest
;
...
...
@@ -9,6 +10,7 @@ import com.jqtx.windows.component.model.UploadPdfRequest;
import
com.jqtx.windows.infrastructure.feign.IProtocalFeignService
;
import
com.jqtx.windows.web.request.SyncLoanRequest
;
import
com.jqtx.windows.web.response.JsonResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -17,22 +19,29 @@ import java.util.List;
import
java.util.stream.Collectors
;
@Service
@Slf4j
public
class
SaveProtocolCommand
extends
AbstractCommand
{
@Autowired
private
IProtocalFeignService
iProtocalFeignService
;
@Autowired
private
ProtocolConverter
protocolConverter
;
@Override
public
JsonResult
execute
()
{
String
request
=
RuntimeContextHolder
.
currentRuntimeContext
().
getRequestBody
();
SyncLoanRequest
syncLoanRequest
=
JSON
.
parseObject
(
request
,
SyncLoanRequest
.
class
);
UploadPdfRequest
uploadPdfRequest
=
new
UploadPdfRequest
();
uploadPdfRequest
.
setLoanNo
(
syncLoanRequest
.
getLoanNo
());
uploadPdfRequest
.
setOrderNo
(
syncLoanRequest
.
getOrderNo
());
List
<
UploadPdfDetailRequest
>
detailRequestList
=
syncLoanRequest
.
getProtocolList
().
stream
().
map
(
protocolConverter:
:
toModel
).
collect
(
Collectors
.
toList
());
uploadPdfRequest
.
setDetailRequestList
(
detailRequestList
);
iProtocalFeignService
.
uploadProtocolPdf
(
uploadPdfRequest
);
try
{
UploadPdfRequest
uploadPdfRequest
=
new
UploadPdfRequest
();
uploadPdfRequest
.
setLoanNo
(
syncLoanRequest
.
getLoanNo
());
uploadPdfRequest
.
setOrderNo
(
syncLoanRequest
.
getOrderNo
());
List
<
UploadPdfDetailRequest
>
detailRequestList
=
syncLoanRequest
.
getProtocolList
().
stream
().
map
(
protocolConverter:
:
toModel
).
collect
(
Collectors
.
toList
());
uploadPdfRequest
.
setDetailRequestList
(
detailRequestList
);
iProtocalFeignService
.
uploadProtocolPdf
(
uploadPdfRequest
);
}
catch
(
Exception
e
)
{
log
.
error
(
"保存用户协议,授信编号:{},报错:{}"
,
syncLoanRequest
.
getLoanNo
(),
e
.
getMessage
(),
e
);
throw
new
BizException
(
"保存用户协议错误"
);
}
return
JsonResult
.
success
();
}
}
src/main/java/com/jqtx/windows/command/SignContractCommand.java
View file @
c26d5508
package
com
.
jqtx
.
windows
.
command
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jqtx.windows.common.exception.BizException
;
import
com.jqtx.windows.common.factory.AbstractCommand
;
import
com.jqtx.windows.common.factory.RuntimeContextHolder
;
import
com.jqtx.windows.component.CreditComponent
;
...
...
@@ -22,18 +23,24 @@ public class SignContractCommand extends AbstractCommand {
@Autowired
private
CreditComponent
creditComponent
;
@Override
public
JsonResult
execute
()
{
String
requestBody
=
RuntimeContextHolder
.
currentRuntimeContext
().
getRequestBody
();
SignContractRequest
signContractRequest
=
JSONObject
.
parseObject
(
requestBody
,
SignContractRequest
.
class
);
CreditModel
creditModel
=
creditComponent
.
getByOrderNo
(
signContractRequest
.
getOrderNo
());
signContractRequest
.
setClientName
(
creditModel
.
getClientName
());
signContractRequest
.
setCertNo
(
creditModel
.
getCertNo
());
signContractRequest
.
setClientCell
(
creditModel
.
getClientCell
());
log
.
info
(
"融单协议提交-{}"
,
JSONObject
.
toJSON
(
signContractRequest
));
creditModel
.
setCreditThirdToken
(
"INIT"
);
creditComponent
.
updateByOrderNo
(
creditModel
.
getOrderNo
(),
creditModel
);
iProtocalFeignService
.
uploadRongdan
(
signContractRequest
);
try
{
CreditModel
creditModel
=
creditComponent
.
getByOrderNo
(
signContractRequest
.
getOrderNo
());
signContractRequest
.
setClientName
(
creditModel
.
getClientName
());
signContractRequest
.
setCertNo
(
creditModel
.
getCertNo
());
signContractRequest
.
setClientCell
(
creditModel
.
getClientCell
());
log
.
info
(
"融单协议提交-{}"
,
JSONObject
.
toJSON
(
signContractRequest
));
creditModel
.
setCreditThirdToken
(
"INIT"
);
creditComponent
.
updateByOrderNo
(
creditModel
.
getOrderNo
(),
creditModel
);
iProtocalFeignService
.
uploadRongdan
(
signContractRequest
);
}
catch
(
Exception
e
)
{
log
.
error
(
"签约融单协议,授信编号:{},报错:{}"
,
signContractRequest
.
getOrderNo
(),
e
.
getMessage
(),
e
);
throw
new
BizException
(
"签约融单协议错误"
);
}
return
JsonResult
.
success
();
}
}
src/main/java/com/jqtx/windows/command/SyncCreditCommand.java
View file @
c26d5508
...
...
@@ -2,6 +2,7 @@ package com.jqtx.windows.command;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.jqtx.windows.common.exception.BizException
;
import
com.jqtx.windows.common.factory.AbstractCommand
;
import
com.jqtx.windows.common.factory.RuntimeContextHolder
;
import
com.jqtx.windows.common.utils.ValidateUtil
;
...
...
@@ -9,11 +10,13 @@ import com.jqtx.windows.component.CreditResultComponent;
import
com.jqtx.windows.component.model.CreditResultModel
;
import
com.jqtx.windows.web.request.SyncCreditResultRequest
;
import
com.jqtx.windows.web.response.JsonResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
@Slf4j
public
class
SyncCreditCommand
extends
AbstractCommand
{
@Autowired
private
CreditResultComponent
creditResultComponent
;
...
...
@@ -24,10 +27,14 @@ public class SyncCreditCommand extends AbstractCommand {
SyncCreditResultRequest
syncCreditResultRequest
=
JSON
.
parseObject
(
request
,
SyncCreditResultRequest
.
class
);
//
ValidateUtil
.
valid
(
syncCreditResultRequest
);
//
CreditResultModel
creditResultModel
=
BeanUtil
.
toBean
(
syncCreditResultRequest
,
CreditResultModel
.
class
);
creditResultModel
.
setCreditStatus
(
syncCreditResultRequest
.
getStatus
());
creditResultComponent
.
insert
(
creditResultModel
);
try
{
CreditResultModel
creditResultModel
=
BeanUtil
.
toBean
(
syncCreditResultRequest
,
CreditResultModel
.
class
);
creditResultModel
.
setCreditStatus
(
syncCreditResultRequest
.
getStatus
());
creditResultComponent
.
insert
(
creditResultModel
);
}
catch
(
Exception
e
)
{
log
.
error
(
"同步授信结果授信编号:{},报错:{}"
,
syncCreditResultRequest
.
getOrderNo
(),
e
.
getMessage
(),
e
);
throw
new
BizException
(
"同步授信结果错误"
);
}
return
JsonResult
.
success
();
}
}
src/main/java/com/jqtx/windows/command/SyncLoanCommand.java
View file @
c26d5508
...
...
@@ -49,11 +49,11 @@ public class SyncLoanCommand extends AbstractCommand {
@Override
public
JsonResult
execute
()
{
String
request
=
RuntimeContextHolder
.
currentRuntimeContext
().
getRequestBody
();
SyncLoanRequest
syncLoanRequest
=
JSON
.
parseObject
(
request
,
SyncLoanRequest
.
class
);
//校验
ValidateUtil
.
valid
(
syncLoanRequest
);
try
{
String
request
=
RuntimeContextHolder
.
currentRuntimeContext
().
getRequestBody
();
SyncLoanRequest
syncLoanRequest
=
JSON
.
parseObject
(
request
,
SyncLoanRequest
.
class
);
//校验
ValidateUtil
.
valid
(
syncLoanRequest
);
//修改loan
LoanModel
loanModel
=
loanComponent
.
getByLoanNo
(
syncLoanRequest
.
getLoanNo
());
Assert
.
isFalse
(
loanModel
==
null
,
"借款不存在"
);
...
...
@@ -95,9 +95,9 @@ public class SyncLoanCommand extends AbstractCommand {
List
<
UploadPdfDetailRequest
>
detailRequestList
=
syncLoanRequest
.
getProtocolList
().
stream
().
map
(
protocolConverter:
:
toModel
).
collect
(
Collectors
.
toList
());
uploadPdfRequest
.
setDetailRequestList
(
detailRequestList
);
iProtocalFeignService
.
uploadProtocolPdf
(
uploadPdfRequest
);
}
catch
(
Biz
Exception
e
)
{
log
.
error
(
"同步放款
错误:{}"
,
e
.
getMessage
(),
e
);
throw
new
BizException
(
"同步放款错误"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"同步放款
借款编号:{},数据错误:{}"
,
syncLoanRequest
.
getLoanNo
()
,
e
.
getMessage
(),
e
);
throw
new
BizException
(
"同步放款
数据
错误"
);
}
return
JsonResult
.
success
();
...
...
src/main/java/com/jqtx/windows/common/factory/AbstractCommand.java
View file @
c26d5508
...
...
@@ -9,18 +9,21 @@ import org.springframework.stereotype.Service;
@Service
@Slf4j
public
abstract
class
AbstractCommand
{
public
abstract
class
AbstractCommand
{
public
JsonResult
doAction
(){
try
{
public
JsonResult
doAction
()
{
try
{
return
this
.
execute
();
}
catch
(
BizException
e
)
{
log
.
error
(
"[处理业务异常:{}]"
,
e
.
getMessage
(),
e
);
}
catch
(
BizException
e
)
{
log
.
error
(
"[处理业务异常:{}]"
,
e
.
getMessage
(),
e
);
return
JsonResult
.
error
(
e
.
getErrorEnum
());
}
catch
(
Exception
e
){
log
.
error
(
"[处理异常:{}]"
,
e
.
getMessage
(),
e
);
}
finally
{
RuntimeContextHolder
.
clear
();
}
catch
(
IllegalArgumentException
e
)
{
log
.
error
(
"[处理业务异常:{}]"
,
e
.
getMessage
(),
e
);
return
JsonResult
.
error
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"[处理异常:{}]"
,
e
.
getMessage
(),
e
);
}
finally
{
RuntimeContextHolder
.
clear
();
}
return
JsonResult
.
error
(
ExceptionCodeEnum
.
SYSTEM_ERROR
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment