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
cda02486
Commit
cda02486
authored
Oct 20, 2023
by
张庆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增挡板规则
parent
acc3b051
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
131 additions
and
21 deletions
+131
-21
GetCreditCommand.java
src/main/java/com/jqtx/windows/command/GetCreditCommand.java
+27
-12
LoanStatusCommand.java
...main/java/com/jqtx/windows/command/LoanStatusCommand.java
+21
-9
SpringContextConfig.java
...a/com/jqtx/windows/common/config/SpringContextConfig.java
+83
-0
No files found.
src/main/java/com/jqtx/windows/command/GetCreditCommand.java
View file @
cda02486
...
...
@@ -3,6 +3,7 @@ package com.jqtx.windows.command;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.jqtx.windows.common.config.SpringContextConfig
;
import
com.jqtx.windows.common.exception.BizException
;
import
com.jqtx.windows.common.factory.AbstractCommand
;
import
com.jqtx.windows.common.factory.RuntimeContextHolder
;
...
...
@@ -21,10 +22,11 @@ import org.springframework.stereotype.Service;
public
class
GetCreditCommand
extends
AbstractCommand
{
@Autowired
private
CreditComponent
creditComponent
;
public
JsonResult
execute
(){
public
JsonResult
execute
()
{
String
requestBody
=
RuntimeContextHolder
.
currentRuntimeContext
().
getRequestBody
();
GetCreditRequest
request
=
JSON
.
parseObject
(
requestBody
,
GetCreditRequest
.
class
);
if
(
ObjectUtil
.
isNull
(
request
)
||
StringUtils
.
isBlank
(
request
.
getOrderNo
()))
{
GetCreditRequest
request
=
JSON
.
parseObject
(
requestBody
,
GetCreditRequest
.
class
);
if
(
ObjectUtil
.
isNull
(
request
)
||
StringUtils
.
isBlank
(
request
.
getOrderNo
()))
{
throw
new
BizException
(
ExceptionCodeEnum
.
PARAMS_NULL
);
}
CreditDetailResponse
response
=
this
.
convert
(
request
.
getOrderNo
());
...
...
@@ -32,24 +34,37 @@ public class GetCreditCommand extends AbstractCommand {
return
JsonResult
.
success
(
response
);
}
public
CreditDetailResponse
convert
(
String
orderNo
){
public
CreditDetailResponse
convert
(
String
orderNo
)
{
CreditDetailResponse
response
=
new
CreditDetailResponse
();
CreditModel
credit
=
creditComponent
.
getByOrderNo
(
orderNo
);
if
(
ObjectUtil
.
isNull
(
credit
))
{
if
(
ObjectUtil
.
isNull
(
credit
))
{
throw
new
BizException
(
ExceptionCodeEnum
.
BIZ_CREDIT_NOT_FOUND_ERROR
);
}
response
.
setStatus
(
"0"
);
response
.
setApprovalAmount
(
"0"
);
response
.
setOrderNo
(
credit
.
getOrderNo
());
response
.
setUpdateTime
(
LocalDateTimeUtil
.
formatNormal
(
credit
.
getGmtModified
()));
if
(
CreditResultStatusEnum
.
PASS
.
name
().
equals
(
credit
.
getCreditResult
())){
response
.
setStatus
(
"1"
);
response
.
setApprovalAmount
(
credit
.
getCreditAmt
());
}
if
(
CreditResultStatusEnum
.
REFUSED
.
name
().
equals
(
credit
.
getCreditResult
())){
response
.
setStatus
(
"2"
);
String
substring
=
credit
.
getOrderNo
().
substring
(
credit
.
getOrderNo
().
length
()
-
1
,
credit
.
getOrderNo
().
length
());
//偶数TODO
if
(!
SpringContextConfig
.
getActiveProfile
().
equals
(
"prod"
))
{
if
(
Integer
.
valueOf
(
substring
)
%
2
==
0
)
{
response
.
setStatus
(
"1"
);
response
.
setApprovalAmount
(
"10000.00"
);
}
else
{
response
.
setStatus
(
"2"
);
//response.setApprovalAmount("10000.00");
response
.
setRemark
(
"挡板拒绝"
);
}
}
else
{
if
(
CreditResultStatusEnum
.
PASS
.
name
().
equals
(
credit
.
getCreditResult
()))
{
response
.
setStatus
(
"1"
);
response
.
setApprovalAmount
(
credit
.
getCreditAmt
());
}
if
(
CreditResultStatusEnum
.
REFUSED
.
name
().
equals
(
credit
.
getCreditResult
()))
{
response
.
setStatus
(
"2"
);
}
response
.
setRemark
(
credit
.
getMemo
());
}
response
.
setRemark
(
credit
.
getMemo
());
return
response
;
}
}
src/main/java/com/jqtx/windows/command/LoanStatusCommand.java
View file @
cda02486
package
com
.
jqtx
.
windows
.
command
;
import
com.alibaba.fastjson.JSON
;
import
com.jqtx.windows.common.config.SpringContextConfig
;
import
com.jqtx.windows.common.exception.BizException
;
import
com.jqtx.windows.common.factory.AbstractCommand
;
import
com.jqtx.windows.common.factory.RuntimeContextHolder
;
...
...
@@ -30,22 +31,33 @@ public class LoanStatusCommand extends AbstractCommand {
public
JsonResult
execute
()
{
String
request
=
RuntimeContextHolder
.
currentRuntimeContext
().
getRequestBody
();
LoanSubmitResponse
loanSubmitResponse
=
JSON
.
parseObject
(
request
,
LoanSubmitResponse
.
class
);
LoanModel
byLoanNo
=
loanComponent
.
getByLoanNo
(
loanSubmitResponse
.
getLoanNo
());
LoanModel
loanModel
=
loanComponent
.
getByLoanNo
(
loanSubmitResponse
.
getLoanNo
());
LoanDetailResponse
response
=
new
LoanDetailResponse
();
response
.
setOrderNo
(
loanSubmitResponse
.
getOrderNo
());
response
.
setStatus
(
0
);
response
.
setRemark
(
"提现审核中"
);
if
(
Objects
.
isNull
(
byLoanNo
))
{
if
(
Objects
.
isNull
(
loanModel
))
{
throw
new
BizException
(
ExceptionCodeEnum
.
BIZ_CREDIT_NOT_FOUND_ERROR
);
}
if
(
"PASS"
.
equals
(
byLoanNo
.
getLoanCreditResult
())){
response
.
setStatus
(
1
);
response
.
setRemark
(
"提现通过"
);
}
if
(
"REFUSED"
.
equals
(
byLoanNo
.
getLoanCreditResult
())){
response
.
setStatus
(
2
);
response
.
setRemark
(
"提现拒绝,去别家看看"
);
if
(!
SpringContextConfig
.
getActiveProfile
().
equals
(
"prod"
))
{
String
substring
=
loanModel
.
getOrderNo
().
substring
(
loanModel
.
getOrderNo
().
length
()
-
1
,
loanModel
.
getOrderNo
().
length
());
if
(
Integer
.
valueOf
(
substring
)
%
2
==
0
)
{
response
.
setStatus
(
1
);
response
.
setRemark
(
"挡板:提现通过"
);
}
else
{
response
.
setStatus
(
2
);
response
.
setRemark
(
"挡板:提现拒绝,去别家看看"
);
}
}
else
{
if
(
"PASS"
.
equals
(
loanModel
.
getLoanCreditResult
()))
{
response
.
setStatus
(
1
);
response
.
setRemark
(
"提现通过"
);
}
if
(
"REFUSED"
.
equals
(
loanModel
.
getLoanCreditResult
()))
{
response
.
setStatus
(
2
);
response
.
setRemark
(
"提现拒绝,去别家看看"
);
}
}
return
JsonResult
.
success
(
response
);
}
...
...
src/main/java/com/jqtx/windows/common/config/SpringContextConfig.java
0 → 100644
View file @
cda02486
package
com
.
jqtx
.
windows
.
common
.
config
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.NoSuchBeanDefinitionException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Component
;
import
java.util.Map
;
/**
* 获取Spring的ApplicationContext对象工具,可以用静态方法的方式获取spring容器中的bean
* @author https://blog.csdn.net/chen_2890
* @date 2019/6/26 16:20
*/
@Component
public
class
SpringContextConfig
implements
ApplicationContextAware
{
private
static
ApplicationContext
applicationContext
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
SpringContextConfig
.
applicationContext
=
applicationContext
;
}
/**
* 获取applicationContext
*/
public
static
ApplicationContext
getApplicationContext
()
{
return
applicationContext
;
}
/**
* 通过name获取 Bean.
*/
public
static
Object
getBean
(
String
name
)
{
Object
o
=
null
;
try
{
o
=
getApplicationContext
().
getBean
(
name
);
}
catch
(
NoSuchBeanDefinitionException
e
)
{
// e.printStackTrace();
}
return
o
;
}
/**
* 通过class获取Bean.
*/
public
static
<
T
>
T
getBean
(
Class
<
T
>
clazz
)
{
return
getApplicationContext
().
getBean
(
clazz
);
}
/**
* 通过name,以及Clazz返回指定的Bean
*/
public
static
<
T
>
T
getBean
(
String
name
,
Class
<
T
>
clazz
)
{
return
getApplicationContext
().
getBean
(
name
,
clazz
);
}
/**
* 通过name获取 Bean.
*/
public
static
<
T
>
Map
<
String
,
T
>
getBeansOfType
(
Class
<
T
>
clazz
)
{
return
getApplicationContext
().
getBeansOfType
(
clazz
);
}
/**
* 获取配置文件配置项的值
*
* @param key 配置项key
*/
public
static
String
getEnvironmentProperty
(
String
key
)
{
return
getApplicationContext
().
getEnvironment
().
getProperty
(
key
);
}
/**
* 获取spring.profiles.active
*/
public
static
String
getActiveProfile
()
{
return
getApplicationContext
().
getEnvironment
().
getActiveProfiles
()[
0
];
}
}
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