Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
QA
qa-platform
Commits
88e47805
Commit
88e47805
authored
Mar 10, 2021
by
黎博
Browse files
Options
Browse Files
Download
Plain Diff
合并master
parents
b02c68ed
715dfe0b
Changes
80
Show whitespace changes
Inline
Side-by-side
Showing
80 changed files
with
2773 additions
and
356 deletions
+2773
-356
.gitignore
.gitignore
+3
-0
pom.xml
pom.xml
+39
-3
HttpLogAspect.java
src/main/java/cn/qg/qaplatform/aspect/HttpLogAspect.java
+45
-6
InterfaceController.java
...qaplatform/automation/controller/InterfaceController.java
+4
-4
ModuleController.java
...qg/qaplatform/automation/controller/ModuleController.java
+3
-4
ProjectController.java
...g/qaplatform/automation/controller/ProjectController.java
+2
-2
TestcaseController.java
.../qaplatform/automation/controller/TestcaseController.java
+3
-6
InterfaceServiceImpl.java
...latform/automation/service/impl/InterfaceServiceImpl.java
+1
-2
TestcaseServiceImpl.java
...platform/automation/service/impl/TestcaseServiceImpl.java
+1
-1
MybatisPlusConfig.java
src/main/java/cn/qg/qaplatform/config/MybatisPlusConfig.java
+5
-3
Swagger2Config.java
src/main/java/cn/qg/qaplatform/config/Swagger2Config.java
+1
-1
SwitchDataSource.java
src/main/java/cn/qg/qaplatform/config/SwitchDataSource.java
+16
-14
ErrorType.java
src/main/java/cn/qg/qaplatform/enums/ErrorType.java
+1
-1
Namespace.java
src/main/java/cn/qg/qaplatform/enums/Namespace.java
+4
-4
InterceptorConfig.java
.../java/cn/qg/qaplatform/mock/config/InterceptorConfig.java
+23
-0
MockController.java
...java/cn/qg/qaplatform/mock/controller/MockController.java
+50
-0
EncryptConvertor.java
.../qg/qaplatform/mock/encrypt/factory/EncryptConvertor.java
+8
-0
EncryptFactory.java
...cn/qg/qaplatform/mock/encrypt/factory/EncryptFactory.java
+18
-0
YeebaoEncryptConvertor.java
...platform/mock/encrypt/factory/YeebaoEncryptConvertor.java
+49
-0
AbstractConvertUtils.java
...platform/mock/encrypt/paycenter/AbstractConvertUtils.java
+23
-0
Aes.java
...ain/java/cn/qg/qaplatform/mock/encrypt/paycenter/Aes.java
+121
-0
Base64.java
.../java/cn/qg/qaplatform/mock/encrypt/paycenter/Base64.java
+590
-0
CheckUtils.java
...a/cn/qg/qaplatform/mock/encrypt/paycenter/CheckUtils.java
+33
-0
ConfigureEncryptAndDecrypt.java
...rm/mock/encrypt/paycenter/ConfigureEncryptAndDecrypt.java
+8
-0
Digest.java
.../java/cn/qg/qaplatform/mock/encrypt/paycenter/Digest.java
+164
-0
EncryUtil.java
...va/cn/qg/qaplatform/mock/encrypt/paycenter/EncryUtil.java
+80
-0
RandomUtil.java
...a/cn/qg/qaplatform/mock/encrypt/paycenter/RandomUtil.java
+22
-0
Rsa.java
...ain/java/cn/qg/qaplatform/mock/encrypt/paycenter/Rsa.java
+164
-0
Mock.java
src/main/java/cn/qg/qaplatform/mock/entity/Mock.java
+23
-0
PayInterceptor.java
...ava/cn/qg/qaplatform/mock/interceptor/PayInterceptor.java
+99
-0
MockMapper.java
src/main/java/cn/qg/qaplatform/mock/mapper/MockMapper.java
+7
-0
MockService.java
src/main/java/cn/qg/qaplatform/mock/service/MockService.java
+8
-0
MockServiceImpl.java
...a/cn/qg/qaplatform/mock/service/impl/MockServiceImpl.java
+15
-0
JenkinsBuildController.java
.../qaplatform/stools/controller/JenkinsBuildController.java
+61
-0
KdspDecryptController.java
...g/qaplatform/stools/controller/KdspDecryptController.java
+71
-0
JenkinsApi.java
src/main/java/cn/qg/qaplatform/stools/utils/JenkinsApi.java
+144
-0
AESUtil.java
...main/java/cn/qg/qaplatform/stools/utils/kdsp/AESUtil.java
+100
-0
ConfigureEncryptAndDecrypt.java
...latform/stools/utils/kdsp/ConfigureEncryptAndDecrypt.java
+9
-0
RSA.java
src/main/java/cn/qg/qaplatform/stools/utils/kdsp/RSA.java
+161
-0
EncryptRequest.java
src/main/java/cn/qg/qaplatform/stools/vo/EncryptRequest.java
+25
-0
JenkinsBuildInfo.java
...ain/java/cn/qg/qaplatform/stools/vo/JenkinsBuildInfo.java
+18
-0
DBUtils.java
src/main/java/cn/qg/qaplatform/utils/DBUtils.java
+1
-1
JsonResult.java
src/main/java/cn/qg/qaplatform/utils/JsonResult.java
+2
-2
LexinEncrypt.java
...ain/java/cn/qg/qaplatform/zdata/Encrypt/LexinEncrypt.java
+1
-1
VccGenController.java
.../qg/qaplatform/zdata/controller/vcc/VccGenController.java
+6
-6
VccQueryController.java
...g/qaplatform/zdata/controller/vcc/VccQueryController.java
+19
-17
XyqbGenController.java
...g/qaplatform/zdata/controller/xyqb/XyqbGenController.java
+19
-19
XyqbQueryController.java
...qaplatform/zdata/controller/xyqb/XyqbQueryController.java
+8
-8
VccOpenResultVo.java
...n/java/cn/qg/qaplatform/zdata/entity/VccOpenResultVo.java
+5
-2
VccUserEntity.java
...ain/java/cn/qg/qaplatform/zdata/entity/VccUserEntity.java
+14
-9
XjfqGenProcessVo.java
.../java/cn/qg/qaplatform/zdata/entity/XjfqGenProcessVo.java
+5
-2
XjfqUserEntity.java
...in/java/cn/qg/qaplatform/zdata/entity/XjfqUserEntity.java
+2
-2
XyqbApplyDataVo.java
...n/java/cn/qg/qaplatform/zdata/entity/XyqbApplyDataVo.java
+2
-2
ChannelEnum.java
src/main/java/cn/qg/qaplatform/zdata/enums/ChannelEnum.java
+2
-2
FundEnum.java
src/main/java/cn/qg/qaplatform/zdata/enums/FundEnum.java
+2
-2
VccDataMapper.java
...ain/java/cn/qg/qaplatform/zdata/mapper/VccDataMapper.java
+17
-0
XyqbLoanDataMapper.java
...ava/cn/qg/qaplatform/zdata/mapper/XyqbLoanDataMapper.java
+6
-6
Common.java
src/main/java/cn/qg/qaplatform/zdata/process/Common.java
+1
-1
Lexin.java
src/main/java/cn/qg/qaplatform/zdata/process/Lexin.java
+13
-13
Vcc.java
src/main/java/cn/qg/qaplatform/zdata/process/Vcc.java
+11
-6
RuleEngineService.java
...n/qg/qaplatform/zdata/service/risk/RuleEngineService.java
+2
-2
RuleEngineServiceImpl.java
...atform/zdata/service/risk/impl/RuleEngineServiceImpl.java
+11
-3
VccDataService.java
...va/cn/qg/qaplatform/zdata/service/vcc/VccDataService.java
+27
-0
VccDataServiceImpl.java
...qaplatform/zdata/service/vcc/impl/VccDataServiceImpl.java
+48
-28
LexinDataService.java
...cn/qg/qaplatform/zdata/service/xyqb/LexinDataService.java
+12
-0
QueryInProcessStatusService.java
...tform/zdata/service/xyqb/QueryInProcessStatusService.java
+1
-1
XyqbBasicQueryService.java
.../qaplatform/zdata/service/xyqb/XyqbBasicQueryService.java
+7
-7
XyqbGenDataService.java
.../qg/qaplatform/zdata/service/xyqb/XyqbGenDataService.java
+52
-0
XyqbQueryService.java
...cn/qg/qaplatform/zdata/service/xyqb/XyqbQueryService.java
+2
-2
LexinDataServiceImpl.java
...latform/zdata/service/xyqb/impl/LexinDataServiceImpl.java
+19
-17
QueryInProcessStatusServiceImpl.java
...ta/service/xyqb/impl/QueryInProcessStatusServiceImpl.java
+8
-8
XyqbBasicQueryServiceImpl.java
...rm/zdata/service/xyqb/impl/XyqbBasicQueryServiceImpl.java
+26
-26
XyqbGenDataServiceImpl.java
...tform/zdata/service/xyqb/impl/XyqbGenDataServiceImpl.java
+80
-80
XyqbQueryServiceImpl.java
...latform/zdata/service/xyqb/impl/XyqbQueryServiceImpl.java
+15
-15
application.yml
src/main/resources/application.yml
+12
-7
logback-dev.xml
src/main/resources/logback-dev.xml
+47
-0
logback-pro.xml
src/main/resources/logback-pro.xml
+38
-0
VccDataMapper.xml
src/main/resources/mapper/zdata/VccDataMapper.xml
+3
-3
XyqbLoanDataMapper.xml
src/main/resources/mapper/zdata/XyqbLoanDataMapper.xml
+4
-4
Lexin.java
src/test/java/cn/qg/qaplatform/test/Lexin.java
+1
-1
No files found.
.gitignore
View file @
88e47805
...
@@ -29,3 +29,6 @@ build/
...
@@ -29,3 +29,6 @@ build/
### VS Code ###
### VS Code ###
.vscode/
.vscode/
### local log ###
*.log
pom.xml
View file @
88e47805
...
@@ -116,10 +116,40 @@
...
@@ -116,10 +116,40 @@
</dependency>
</dependency>
<!-- log4j -->
<!-- log4j -->
<!-- <dependency>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-1.2-api</artifactId>-->
<!-- <version>2.11.1</version>-->
<!-- </dependency>-->
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-api
</artifactId>
<version>
1.7.30
</version>
</dependency>
<dependency>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-core
</artifactId>
<version>
1.2.3
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
log4j-1.2-api
</artifactId>
<artifactId>
logback-classic
</artifactId>
<version>
2.11.1
</version>
<version>
1.2.3
</version>
</dependency>
<dependency>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
spring-boot-starter-sentry
</artifactId>
<version>
1.0.9
</version>
</dependency>
<dependency>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
spring-boot-starter-sentry
</artifactId>
<version>
1.0.9
</version>
</dependency>
</dependency>
<!-- fastjson -->
<!-- fastjson -->
...
@@ -171,6 +201,12 @@
...
@@ -171,6 +201,12 @@
<version>
2.0.1.Final
</version>
<version>
2.0.1.Final
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.offbytwo.jenkins
</groupId>
<artifactId>
jenkins-client
</artifactId>
<version>
0.3.8
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/cn/qg/qaplatform/
common/
aspect/HttpLogAspect.java
→
src/main/java/cn/qg/qaplatform/aspect/HttpLogAspect.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
common
.
aspect
;
package
cn
.
qg
.
qaplatform
.
aspect
;
import
cn.qg.qaplatform.utils.JsonTransUtils
;
import
cn.qg.qaplatform.utils.JsonTransUtils
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
org.apache.commons.io.IOUtils
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.AfterReturning
;
import
org.aspectj.lang.annotation.AfterReturning
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Aspect
;
...
@@ -17,8 +18,11 @@ import org.springframework.web.context.request.RequestContextHolder;
...
@@ -17,8 +18,11 @@ import org.springframework.web.context.request.RequestContextHolder;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Parameter
;
import
java.lang.reflect.Parameter
;
import
java.nio.charset.Charset
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -45,11 +49,12 @@ public class HttpLogAspect {
...
@@ -45,11 +49,12 @@ public class HttpLogAspect {
public
void
doBefore
(
JoinPoint
joinPoint
)
throws
JsonProcessingException
{
public
void
doBefore
(
JoinPoint
joinPoint
)
throws
JsonProcessingException
{
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
attributes
.
getRequest
();
HttpServletRequest
request
=
attributes
.
getRequest
();
logger
.
info
(
"url:{}"
,
request
.
getRequestURL
());
// logger.info("url:{}", request.getRequestURL());
logger
.
info
(
"method:{}"
,
request
.
getMethod
());
// logger.info("method:{}", request.getMethod());
logger
.
info
(
"ip:{}"
,
request
.
getRemoteAddr
());
// logger.info("ip:{}", request.getRemoteAddr());
logger
.
info
(
"class_method={}"
,
joinPoint
.
getSignature
().
getDeclaringTypeName
()
+
"."
+
joinPoint
.
getSignature
().
getName
());
// logger.info("class_method={}", joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());
logger
.
info
(
"args:{}"
,
joinPoint
.
getArgs
());
// logger.info("args:{}", joinPoint.getArgs());
logger
.
info
(
"请求发起ip地址: {}, 请求url: {}, 请求参数:{}"
,
request
.
getRemoteAddr
(),
request
.
getRequestURI
(),
getQuery
(
request
));
}
}
/**
/**
...
@@ -97,4 +102,38 @@ public class HttpLogAspect {
...
@@ -97,4 +102,38 @@ public class HttpLogAspect {
return
argList
;
return
argList
;
}
}
}
}
private
String
getQuery
(
HttpServletRequest
request
)
{
if
(
isPostPutRequest
(
request
))
{
return
getParameters
(
request
)
+
getRequestBody
(
request
);
}
else
{
return
getParameters
(
request
);
}
}
private
boolean
isPostPutRequest
(
HttpServletRequest
request
)
{
return
"POST"
.
equalsIgnoreCase
(
request
.
getMethod
())
||
"PUT"
.
equalsIgnoreCase
(
request
.
getMethod
());
}
private
String
getParameters
(
HttpServletRequest
request
)
{
StringBuilder
sb
=
new
StringBuilder
();
Map
<
String
,
String
[]>
params
=
request
.
getParameterMap
();
for
(
String
key
:
params
.
keySet
())
{
sb
.
append
(
'['
)
.
append
(
key
)
.
append
(
'='
)
.
append
(
request
.
getParameter
(
key
))
.
append
(
"] "
);
}
return
sb
.
toString
();
}
private
String
getRequestBody
(
HttpServletRequest
request
)
{
try
{
return
IOUtils
.
toString
(
request
.
getInputStream
(),
String
.
valueOf
(
Charset
.
defaultCharset
()));
}
catch
(
IOException
e
)
{
return
""
;
}
}
}
}
\ No newline at end of file
src/main/java/cn/qg/qaplatform/automation/controller/InterfaceController.java
View file @
88e47805
...
@@ -2,8 +2,8 @@ package cn.qg.qaplatform.automation.controller;
...
@@ -2,8 +2,8 @@ package cn.qg.qaplatform.automation.controller;
import
cn.qg.qaplatform.automation.domain.Interface
;
import
cn.qg.qaplatform.automation.domain.Interface
;
import
cn.qg.qaplatform.automation.service.InterfaceService
;
import
cn.qg.qaplatform.automation.service.InterfaceService
;
import
cn.qg.qaplatform.co
mmon.JsonResult
;
import
cn.qg.qaplatform.co
nfig.SwitchDataSource
;
import
cn.qg.qaplatform.
common.SwitchDataSource
;
import
cn.qg.qaplatform.
utils.JsonResult
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
...
src/main/java/cn/qg/qaplatform/automation/controller/ModuleController.java
View file @
88e47805
...
@@ -2,9 +2,8 @@ package cn.qg.qaplatform.automation.controller;
...
@@ -2,9 +2,8 @@ package cn.qg.qaplatform.automation.controller;
import
cn.qg.qaplatform.automation.domain.Module
;
import
cn.qg.qaplatform.automation.domain.Module
;
import
cn.qg.qaplatform.automation.service.ModuleService
;
import
cn.qg.qaplatform.automation.service.ModuleService
;
import
cn.qg.qaplatform.common.JsonResult
;
import
cn.qg.qaplatform.config.SwitchDataSource
;
import
cn.qg.qaplatform.common.SwitchDataSource
;
import
cn.qg.qaplatform.utils.JsonResult
;
import
com.sun.org.apache.xpath.internal.operations.Mod
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
...
src/main/java/cn/qg/qaplatform/automation/controller/ProjectController.java
View file @
88e47805
...
@@ -2,8 +2,8 @@ package cn.qg.qaplatform.automation.controller;
...
@@ -2,8 +2,8 @@ package cn.qg.qaplatform.automation.controller;
import
cn.qg.qaplatform.automation.domain.Project
;
import
cn.qg.qaplatform.automation.domain.Project
;
import
cn.qg.qaplatform.automation.service.ProjectService
;
import
cn.qg.qaplatform.automation.service.ProjectService
;
import
cn.qg.qaplatform.co
mmon.JsonResult
;
import
cn.qg.qaplatform.co
nfig.SwitchDataSource
;
import
cn.qg.qaplatform.
common.SwitchDataSource
;
import
cn.qg.qaplatform.
utils.JsonResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
...
src/main/java/cn/qg/qaplatform/automation/controller/TestcaseController.java
View file @
88e47805
...
@@ -3,17 +3,14 @@ package cn.qg.qaplatform.automation.controller;
...
@@ -3,17 +3,14 @@ package cn.qg.qaplatform.automation.controller;
import
cn.qg.qaplatform.automation.domain.Testcase
;
import
cn.qg.qaplatform.automation.domain.Testcase
;
import
cn.qg.qaplatform.automation.service.AssertService
;
import
cn.qg.qaplatform.automation.service.AssertService
;
import
cn.qg.qaplatform.automation.service.TestcaseService
;
import
cn.qg.qaplatform.automation.service.TestcaseService
;
import
cn.qg.qaplatform.co
mmon.JsonResult
;
import
cn.qg.qaplatform.co
nfig.SwitchDataSource
;
import
cn.qg.qaplatform.
common.SwitchDataSource
;
import
cn.qg.qaplatform.
utils.JsonResult
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.net.URISyntaxException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
@CrossOrigin
@CrossOrigin
...
...
src/main/java/cn/qg/qaplatform/automation/service/impl/InterfaceServiceImpl.java
View file @
88e47805
...
@@ -3,8 +3,7 @@ package cn.qg.qaplatform.automation.service.impl;
...
@@ -3,8 +3,7 @@ package cn.qg.qaplatform.automation.service.impl;
import
cn.qg.qaplatform.automation.domain.Interface
;
import
cn.qg.qaplatform.automation.domain.Interface
;
import
cn.qg.qaplatform.automation.mapper.InterfaceMapper
;
import
cn.qg.qaplatform.automation.mapper.InterfaceMapper
;
import
cn.qg.qaplatform.automation.service.InterfaceService
;
import
cn.qg.qaplatform.automation.service.InterfaceService
;
import
cn.qg.qaplatform.common.SwitchDataSource
;
import
cn.qg.qaplatform.config.SwitchDataSource
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
...
src/main/java/cn/qg/qaplatform/automation/service/impl/TestcaseServiceImpl.java
View file @
88e47805
...
@@ -5,7 +5,7 @@ import cn.qg.qaplatform.automation.domain.Project;
...
@@ -5,7 +5,7 @@ import cn.qg.qaplatform.automation.domain.Project;
import
cn.qg.qaplatform.automation.domain.Testcase
;
import
cn.qg.qaplatform.automation.domain.Testcase
;
import
cn.qg.qaplatform.automation.mapper.*
;
import
cn.qg.qaplatform.automation.mapper.*
;
import
cn.qg.qaplatform.automation.service.TestcaseService
;
import
cn.qg.qaplatform.automation.service.TestcaseService
;
import
cn.qg.qaplatform.co
mmon
.SwitchDataSource
;
import
cn.qg.qaplatform.co
nfig
.SwitchDataSource
;
import
cn.qg.qaplatform.utils.HttpClientUtils
;
import
cn.qg.qaplatform.utils.HttpClientUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
...
src/main/java/cn/qg/qaplatform/config/MybatisPlusConfig.java
View file @
88e47805
...
@@ -6,9 +6,6 @@ import org.mybatis.spring.annotation.MapperScan;
...
@@ -6,9 +6,6 @@ import org.mybatis.spring.annotation.MapperScan;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
/**
* Mybatis-plus分页配置
*/
@Configuration
@Configuration
@MapperScan
(
"cn.qg.qaplatform.*.mapper*"
)
@MapperScan
(
"cn.qg.qaplatform.*.mapper*"
)
public
class
MybatisPlusConfig
{
public
class
MybatisPlusConfig
{
...
@@ -16,6 +13,11 @@ public class MybatisPlusConfig {
...
@@ -16,6 +13,11 @@ public class MybatisPlusConfig {
@Bean
@Bean
public
PaginationInterceptor
paginationInterceptor
()
{
public
PaginationInterceptor
paginationInterceptor
()
{
PaginationInterceptor
paginationInterceptor
=
new
PaginationInterceptor
();
PaginationInterceptor
paginationInterceptor
=
new
PaginationInterceptor
();
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false
// paginationInterceptor.setOverflow(false);
// 设置最大单页限制数量,默认 500 条,-1 不受限制
// paginationInterceptor.setLimit(500);
// 开启 count 的 join 优化,只针对部分 left join
paginationInterceptor
.
setCountSqlParser
(
new
JsqlParserCountOptimize
(
true
));
paginationInterceptor
.
setCountSqlParser
(
new
JsqlParserCountOptimize
(
true
));
return
paginationInterceptor
;
return
paginationInterceptor
;
}
}
...
...
src/main/java/cn/qg/qaplatform/config/Swagger2Config.java
View file @
88e47805
...
@@ -23,7 +23,7 @@ public class Swagger2Config {
...
@@ -23,7 +23,7 @@ public class Swagger2Config {
.
groupName
(
"测试平台后台"
)
.
groupName
(
"测试平台后台"
)
.
apiInfo
(
apiInfo
())
.
apiInfo
(
apiInfo
())
.
select
()
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"cn.qg.qaplatform.controller"
))
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"cn.qg.qaplatform.
zdata.
controller"
))
.
paths
(
PathSelectors
.
any
())
.
paths
(
PathSelectors
.
any
())
.
build
()
.
build
()
.
securitySchemes
(
securitySchemes
())
.
securitySchemes
(
securitySchemes
())
...
...
src/main/java/cn/qg/qaplatform/co
mmon
/SwitchDataSource.java
→
src/main/java/cn/qg/qaplatform/co
nfig
/SwitchDataSource.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
co
mmon
;
package
cn
.
qg
.
qaplatform
.
co
nfig
;
import
cn.qg.qaplatform.common.enums.Namespace
;
import
cn.qg.qaplatform.enums.Namespace
;
import
cn.qg.qaplatform.config.DynamicDataSource
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.alibaba.druid.pool.DruidDataSource
;
...
@@ -15,6 +14,20 @@ public class SwitchDataSource {
...
@@ -15,6 +14,20 @@ public class SwitchDataSource {
public
static
void
dataSourceSwitch
(
String
namespace
,
String
database
)
{
public
static
void
dataSourceSwitch
(
String
namespace
,
String
database
)
{
/**
* dev1环境
*/
if
(
namespace
.
equals
(
"dev1"
))
{
DruidDataSource
druidDataSource
=
new
DruidDataSource
();
String
url
=
Namespace
.
DEV1
.
getUrl
()
+
database
+
SUFFIX
;
String
dbKey
=
Namespace
.
DEV1
.
getKey
();
druidDataSource
.
setUrl
(
url
);
druidDataSource
.
setUsername
(
Namespace
.
DEV1
.
getUsername
());
druidDataSource
.
setPassword
(
Namespace
.
DEV1
.
getPassword
());
DynamicDataSource
.
dataSourcesMap
.
put
(
dbKey
,
druidDataSource
);
DynamicDataSource
.
setDataSource
(
dbKey
);
}
/**
/**
* pre 环境
* pre 环境
*/
*/
...
@@ -168,16 +181,5 @@ public class SwitchDataSource {
...
@@ -168,16 +181,5 @@ public class SwitchDataSource {
DynamicDataSource
.
dataSourcesMap
.
put
(
dbKey
,
druidDataSource
);
DynamicDataSource
.
dataSourcesMap
.
put
(
dbKey
,
druidDataSource
);
DynamicDataSource
.
setDataSource
(
dbKey
);
DynamicDataSource
.
setDataSource
(
dbKey
);
}
}
if
(
namespace
.
equals
(
"localhost"
))
{
DruidDataSource
druidDataSource
=
new
DruidDataSource
();
String
url
=
Namespace
.
LOCALHOST
.
getUrl
()
+
database
+
SUFFIX
;
String
dbKey
=
Namespace
.
LOCALHOST
.
getKey
();
druidDataSource
.
setUrl
(
url
);
druidDataSource
.
setUsername
(
Namespace
.
LOCALHOST
.
getUsername
());
druidDataSource
.
setPassword
(
Namespace
.
LOCALHOST
.
getPassword
());
DynamicDataSource
.
dataSourcesMap
.
put
(
dbKey
,
druidDataSource
);
DynamicDataSource
.
setDataSource
(
dbKey
);
}
}
}
}
}
src/main/java/cn/qg/qaplatform/
common/
enums/ErrorType.java
→
src/main/java/cn/qg/qaplatform/enums/ErrorType.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
common
.
enums
;
package
cn
.
qg
.
qaplatform
.
enums
;
/**
/**
* 定义错误类别
* 定义错误类别
...
...
src/main/java/cn/qg/qaplatform/
common/
enums/Namespace.java
→
src/main/java/cn/qg/qaplatform/enums/Namespace.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
common
.
enums
;
package
cn
.
qg
.
qaplatform
.
enums
;
public
enum
Namespace
{
public
enum
Namespace
{
PRE
(
"pre"
,
"pre"
,
"jdbc:mysql://172.17.5.14:32178/"
,
"qa"
,
"qatest"
),
DEV1
(
"dev1"
,
"dev1"
,
"jdbc:mysql://172.17.5.16:32661/"
,
"qa"
,
"qatest"
),
PRE
(
"pre"
,
"pre"
,
"jdbc:mysql://172.17.5.17:32178/"
,
"qa"
,
"qatest"
),
QA
(
"qa"
,
"qa"
,
"jdbc:mysql://172.17.5.16:32743/"
,
"qa"
,
"qatest"
),
QA
(
"qa"
,
"qa"
,
"jdbc:mysql://172.17.5.16:32743/"
,
"qa"
,
"qatest"
),
QA2
(
"qa2"
,
"qa2"
,
"jdbc:mysql://172.17.5.5:31905/"
,
"qa"
,
"qatest"
),
QA2
(
"qa2"
,
"qa2"
,
"jdbc:mysql://172.17.5.5:31905/"
,
"qa"
,
"qatest"
),
QA3
(
"qa3"
,
"qa3"
,
"jdbc:mysql://172.17.5.14:32659/"
,
"qa"
,
"qatest"
),
QA3
(
"qa3"
,
"qa3"
,
"jdbc:mysql://172.17.5.14:32659/"
,
"qa"
,
"qatest"
),
...
@@ -12,8 +13,7 @@ public enum Namespace {
...
@@ -12,8 +13,7 @@ public enum Namespace {
FE
(
"fe"
,
"fe"
,
"jdbc:mysql://172.17.5.9:31024/"
,
"qa"
,
"qatest"
),
FE
(
"fe"
,
"fe"
,
"jdbc:mysql://172.17.5.9:31024/"
,
"qa"
,
"qatest"
),
VCC
(
"vcc"
,
"vcc"
,
"jdbc:mysql://172.17.5.8:31110/"
,
"qa"
,
"qatest"
),
VCC
(
"vcc"
,
"vcc"
,
"jdbc:mysql://172.17.5.8:31110/"
,
"qa"
,
"qatest"
),
VCC2
(
"vcc2"
,
"vcc2"
,
"jdbc:mysql://172.17.5.12:30977/"
,
"qa"
,
"qatest"
),
VCC2
(
"vcc2"
,
"vcc2"
,
"jdbc:mysql://172.17.5.12:30977/"
,
"qa"
,
"qatest"
),
VCC3
(
"vcc3"
,
"vcc3"
,
"jdbc:mysql://172.17.5.9:31393"
,
"qa"
,
"qatest"
),
VCC3
(
"vcc3"
,
"vcc3"
,
"jdbc:mysql://172.17.5.9:31393/"
,
"qa"
,
"qatest"
);
LOCALHOST
(
"localhost"
,
"localhost"
,
"jdbc:mysql://127.0.0.1:3306/"
,
"root"
,
"123456"
);
private
String
key
;
private
String
key
;
...
...
src/main/java/cn/qg/qaplatform/mock/config/InterceptorConfig.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
config
;
import
cn.qg.qaplatform.mock.interceptor.PayInterceptor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
@Configuration
public
class
InterceptorConfig
implements
WebMvcConfigurer
{
@Bean
public
PayInterceptor
payInterceptor
()
{
return
new
PayInterceptor
();
}
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
payInterceptor
()).
addPathPatterns
(
"/mock/tzt-api/**"
);
}
}
src/main/java/cn/qg/qaplatform/mock/controller/MockController.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
controller
;
import
cn.qg.qaplatform.mock.service.MockService
;
import
cn.qg.qaplatform.utils.JsonResult
;
import
cn.qg.qaplatform.config.SwitchDataSource
;
import
cn.qg.qaplatform.mock.entity.Mock
;
import
cn.qg.qaplatform.mock.mapper.MockMapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.HashMap
;
import
java.util.Map
;
@CrossOrigin
@RestController
public
class
MockController
{
@Autowired
MockService
mockService
;
@RequestMapping
(
value
=
"/mock/**"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
void
mockMethod
()
{}
@PostMapping
(
"/add/mock"
)
public
JsonResult
addMock
(
@RequestBody
Mock
mock
)
{
SwitchDataSource
.
dataSourceSwitch
(
"pre"
,
"qa"
);
return
JsonResult
.
success
(
mockService
.
save
(
mock
));
}
@GetMapping
(
"/list/mock"
)
public
JsonResult
getMockList
(
Integer
pageNum
,
Integer
pageSize
)
{
SwitchDataSource
.
dataSourceSwitch
(
"pre"
,
"qa"
);
IPage
<
Mock
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
IPage
<
Mock
>
pageEntity
=
mockService
.
page
(
page
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"list"
,
pageEntity
.
getRecords
());
map
.
put
(
"total"
,
pageEntity
.
getTotal
());
return
JsonResult
.
success
(
map
);
}
@PostMapping
(
"/edit/mock"
)
public
JsonResult
modifyMock
(
@RequestBody
Mock
mock
)
{
SwitchDataSource
.
dataSourceSwitch
(
"pre"
,
"qa"
);
return
JsonResult
.
success
(
mockService
.
saveOrUpdate
(
mock
));
}
}
src/main/java/cn/qg/qaplatform/mock/encrypt/factory/EncryptConvertor.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
factory
;
public
interface
EncryptConvertor
{
String
encrypt
(
String
response
);
String
decrypt
(
String
request
);
}
src/main/java/cn/qg/qaplatform/mock/encrypt/factory/EncryptFactory.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
factory
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
public
class
EncryptFactory
{
public
static
EncryptConvertor
produce
(
String
type
)
{
if
(
"yeebao"
.
equals
(
type
))
{
return
new
YeebaoEncryptConvertor
();
}
else
{
log
.
info
(
"请输入正确的加密类型类型!"
);
return
null
;
}
}
}
src/main/java/cn/qg/qaplatform/mock/encrypt/factory/YeebaoEncryptConvertor.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
factory
;
import
cn.qg.qaplatform.mock.encrypt.paycenter.Aes
;
import
cn.qg.qaplatform.mock.encrypt.paycenter.Rsa
;
import
cn.qg.qaplatform.utils.JsonTransUtils
;
import
java.util.Map
;
public
class
YeebaoEncryptConvertor
implements
EncryptConvertor
{
private
final
String
privateKey
=
"MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANSBQSc0Hlr+mS7uoIjYS71X2DJ6ZrCcbB1uICqty9QY6W16nZ8tLN/d9k2Z+e2rGG8s7PskpU2T+WuJeDSXs/vpPllG8/tSRVaWcr9EzPaSti3ltSUH0QOLSypZEjTT/slscExj4PMOmQXUXP3gewjNWz1cYRI7dGnKPm+ZFah/AgMBAAECgYB8AcFngz6DkzcI8C+2K6JnJ6/+JPdv8JgWxID45tqfNrphLMB2dwJM0VY+CrCSRNnJZsoT9FqSXtuaKWqAJlbchhPZjupA9RkWFzlGpCQ63/CC71RYYY03eCnc7AIpn52whkjfWG/yf57jKzEwUT+U034uvXdaA+lVvJ0xqpj3gQJBAOmLODjecn450TJbNQaop+7Q5Hz2TUIxbYakzPpcLGv1QYgHa657r7PJ23ZltDBGldMaNTZfqJrtDcq0rTA4lBECQQDo8CcdUhMZ3JbR2UZN0CG8ljMbNWgNWBa37ebE3ZG5yYldc7zY9US/+/7lhxNDqG0saTvM9pJwEc3ccVMvksOPAkEAqq7V+zIQKVJmItBn06MFgNNoei+kTUFEk8f0CvG8gXYwW5NYzp+UzOg1HbW82B9uNmeMBl4pInknwEMF5B0lkQJAdRxQPgCGk+kAdo6LNxHd9Ed7eEF4h8Ty3xQfgnh3DHYTtsU6e8WMBA24kENB3zEtejeKFjkdVHTPD/Z1wSRDZwJAAvNuq0YuRDsESOAerkBZKonA5CD0M4vHTRqihHrjBohv6yxBU8P7gALrX7qmoaZ3aLmN8wHdOAGTR6LZjQdkoQ=="
;
private
String
aesKey
=
null
;
private
String
encryptKey
=
null
;
/**
* 易宝加密
* @param response
* @return
*/
@Override
public
String
encrypt
(
String
response
)
{
try
{
Map
responseMap
=
JsonTransUtils
.
strToMap
(
response
);
responseMap
.
put
(
"sign"
,
Rsa
.
sign
(
response
,
privateKey
));
responseMap
.
put
(
"data"
,
Aes
.
encryptToBase64
(
response
,
aesKey
));
return
JsonTransUtils
.
mapToJson
(
responseMap
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
* 易宝解密
* @param request Http请求的request
* @return
*/
@Override
public
String
decrypt
(
String
request
)
{
try
{
Map
requestMap
=
JsonTransUtils
.
strToMap
(
request
);
aesKey
=
Rsa
.
decrypt
((
String
)
requestMap
.
get
(
"encryptkey"
),
privateKey
);
return
Aes
.
decryptFromBase64
((
String
)
requestMap
.
get
(
"data"
),
aesKey
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
}
src/main/java/cn/qg/qaplatform/mock/encrypt/paycenter/AbstractConvertUtils.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
paycenter
;
public
abstract
class
AbstractConvertUtils
{
private
AbstractConvertUtils
()
{
}
public
static
String
toHex
(
byte
input
[])
{
if
(
input
==
null
)
{
return
null
;
}
StringBuffer
output
=
new
StringBuffer
(
input
.
length
*
2
);
for
(
int
i
=
0
;
i
<
input
.
length
;
i
++)
{
int
current
=
input
[
i
]
&
0xff
;
if
(
current
<
16
)
{
output
.
append
(
"0"
);
}
output
.
append
(
Integer
.
toString
(
current
,
16
));
}
return
output
.
toString
();
}
}
src/main/java/cn/qg/qaplatform/mock/encrypt/paycenter/Aes.java
0 → 100755
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
paycenter
;
import
javax.crypto.Cipher
;
import
javax.crypto.KeyGenerator
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.io.UnsupportedEncodingException
;
import
java.security.Key
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.SecureRandom
;
public
class
Aes
{
private
static
final
int
KEY_LENGTH
=
16
;
/**
* 加密
*
* @param data 需要加密的内容
* @param key 加密密码
*/
public
static
byte
[]
encrypt
(
byte
[]
data
,
byte
[]
key
)
{
CheckUtils
.
notEmpty
(
data
,
"data"
);
CheckUtils
.
notEmpty
(
key
,
"key"
);
if
(
key
.
length
!=
KEY_LENGTH
)
{
throw
new
RuntimeException
(
"Invalid Aes key length (must be 16 bytes)"
);
}
try
{
SecretKeySpec
secretKey
=
new
SecretKeySpec
(
key
,
"Aes"
);
byte
[]
enCodeFormat
=
secretKey
.
getEncoded
();
SecretKeySpec
seckey
=
new
SecretKeySpec
(
enCodeFormat
,
"Aes"
);
Cipher
cipher
=
Cipher
.
getInstance
(
ConfigureEncryptAndDecrypt
.
AES_ALGORITHM
);
// 创建密码器
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
seckey
);
// 初始化
byte
[]
result
=
cipher
.
doFinal
(
data
);
return
result
;
// 加密
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"encrypt fail!"
,
e
);
}
}
/**
* 解密
*
* @param data 待解密内容
* @param key 解密密钥
*/
public
static
byte
[]
decrypt
(
byte
[]
data
,
byte
[]
key
)
{
CheckUtils
.
notEmpty
(
data
,
"data"
);
CheckUtils
.
notEmpty
(
key
,
"key"
);
if
(
key
.
length
!=
KEY_LENGTH
)
{
throw
new
RuntimeException
(
"Invalid Aes key length (must be 16 bytes)"
);
}
try
{
SecretKeySpec
secretKey
=
new
SecretKeySpec
(
key
,
"Aes"
);
byte
[]
enCodeFormat
=
secretKey
.
getEncoded
();
SecretKeySpec
seckey
=
new
SecretKeySpec
(
enCodeFormat
,
"Aes"
);
Cipher
cipher
=
Cipher
.
getInstance
(
ConfigureEncryptAndDecrypt
.
AES_ALGORITHM
);
// 创建密码器
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
seckey
);
// 初始化
byte
[]
result
=
cipher
.
doFinal
(
data
);
return
result
;
// 加密
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"decrypt fail!"
,
e
);
}
}
public
static
String
encryptToBase64
(
String
data
,
String
key
)
{
try
{
byte
[]
valueByte
=
encrypt
(
data
.
getBytes
(
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
),
key
.
getBytes
(
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
));
return
new
String
(
Base64
.
encode
(
valueByte
));
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
RuntimeException
(
"encrypt fail!"
,
e
);
}
}
public
static
String
decryptFromBase64
(
String
data
,
String
key
)
{
try
{
byte
[]
originalData
=
Base64
.
decode
(
data
.
getBytes
());
byte
[]
valueByte
=
decrypt
(
originalData
,
key
.
getBytes
(
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
));
return
new
String
(
valueByte
,
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
RuntimeException
(
"decrypt fail!"
,
e
);
}
}
public
static
String
encryptWithKeyBase64
(
String
data
,
String
key
)
{
try
{
byte
[]
valueByte
=
encrypt
(
data
.
getBytes
(
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
),
Base64
.
decode
(
key
.
getBytes
()));
return
new
String
(
Base64
.
encode
(
valueByte
));
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
RuntimeException
(
"encrypt fail!"
,
e
);
}
}
public
static
String
decryptWithKeyBase64
(
String
data
,
String
key
)
{
try
{
byte
[]
originalData
=
Base64
.
decode
(
data
.
getBytes
());
byte
[]
valueByte
=
decrypt
(
originalData
,
Base64
.
decode
(
key
.
getBytes
()));
return
new
String
(
valueByte
,
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
RuntimeException
(
"decrypt fail!"
,
e
);
}
}
public
static
byte
[]
genarateRandomKey
()
{
KeyGenerator
keygen
=
null
;
try
{
keygen
=
KeyGenerator
.
getInstance
(
ConfigureEncryptAndDecrypt
.
AES_ALGORITHM
);
}
catch
(
NoSuchAlgorithmException
e
)
{
throw
new
RuntimeException
(
" genarateRandomKey fail!"
,
e
);
}
SecureRandom
random
=
new
SecureRandom
();
keygen
.
init
(
random
);
Key
key
=
keygen
.
generateKey
();
return
key
.
getEncoded
();
}
public
static
String
genarateRandomKeyWithBase64
()
{
return
new
String
(
Base64
.
encode
(
genarateRandomKey
()));
}
}
src/main/java/cn/qg/qaplatform/mock/encrypt/paycenter/Base64.java
0 → 100755
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
paycenter
;
import
java.io.UnsupportedEncodingException
;
public
class
Base64
{
/**
* Chunk size per RFC 2045 section 6.8.
* <p/>
* <p>The {@value} character limit does not count the trailing CRLF, but counts
* all other characters, including any equal signs.</p>
*
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 6.8</a>
*/
static
final
int
CHUNK_SIZE
=
76
;
/**
* Chunk separator per RFC 2045 section 2.1.
*
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 2.1</a>
*/
static
final
byte
[]
CHUNK_SEPARATOR
=
"\r\n"
.
getBytes
();
/**
* The basis length.
*/
static
final
int
BASELENGTH
=
255
;
/**
* Lookup length.
*/
static
final
int
LOOKUPLENGTH
=
64
;
/**
* Used to calculate the number of bits in a byte.
*/
static
final
int
EIGHTBIT
=
8
;
/**
* Used when encoding something which has fewer than 24 bits.
*/
static
final
int
SIXTEENBIT
=
16
;
/**
* Used to determine how many bits data contains.
*/
static
final
int
TWENTYFOURBITGROUP
=
24
;
/**
* Used to get the number of Quadruples.
*/
static
final
int
FOURBYTE
=
4
;
/**
* Used to test the sign of a byte.
*/
static
final
int
SIGN
=
-
128
;
/**
* Byte used to pad output.
*/
static
final
byte
PAD
=
(
byte
)
'='
;
// Create arrays to hold the base64 characters and a
// lookup for base64 chars
private
static
byte
[]
base64Alphabet
=
new
byte
[
BASELENGTH
];
private
static
byte
[]
lookUpBase64Alphabet
=
new
byte
[
LOOKUPLENGTH
];
// Populating the lookup and character arrays
static
{
for
(
int
i
=
0
;
i
<
BASELENGTH
;
i
++)
{
base64Alphabet
[
i
]
=
(
byte
)
-
1
;
}
for
(
int
i
=
'Z'
;
i
>=
'A'
;
i
--)
{
base64Alphabet
[
i
]
=
(
byte
)
(
i
-
'A'
);
}
for
(
int
i
=
'z'
;
i
>=
'a'
;
i
--)
{
base64Alphabet
[
i
]
=
(
byte
)
(
i
-
'a'
+
26
);
}
for
(
int
i
=
'9'
;
i
>=
'0'
;
i
--)
{
base64Alphabet
[
i
]
=
(
byte
)
(
i
-
'0'
+
52
);
}
base64Alphabet
[
'+'
]
=
62
;
base64Alphabet
[
'/'
]
=
63
;
for
(
int
i
=
0
;
i
<=
25
;
i
++)
{
lookUpBase64Alphabet
[
i
]
=
(
byte
)
(
'A'
+
i
);
}
for
(
int
i
=
26
,
j
=
0
;
i
<=
51
;
i
++,
j
++)
{
lookUpBase64Alphabet
[
i
]
=
(
byte
)
(
'a'
+
j
);
}
for
(
int
i
=
52
,
j
=
0
;
i
<=
61
;
i
++,
j
++)
{
lookUpBase64Alphabet
[
i
]
=
(
byte
)
(
'0'
+
j
);
}
lookUpBase64Alphabet
[
62
]
=
(
byte
)
'+'
;
lookUpBase64Alphabet
[
63
]
=
(
byte
)
'/'
;
}
private
static
boolean
isBase64
(
byte
octect
)
{
if
(
octect
==
PAD
)
{
return
true
;
}
else
{
return
base64Alphabet
[
octect
]
!=
-
1
;
}
}
/**
* Tests a given byte array to see if it contains
* only valid characters within the Base64 alphabet.
*
* @param arrayOctect byte array to test
* @return true if all bytes are valid characters in the Base64 alphabet or if the byte array is
* empty; false, otherwise
*/
public
static
boolean
isArrayByteBase64
(
byte
[]
arrayOctect
)
{
arrayOctect
=
discardWhitespace
(
arrayOctect
);
int
length
=
arrayOctect
.
length
;
if
(
length
==
0
)
{
// shouldn't a 0 length array be valid base64 data?
// return false;
return
true
;
}
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
if
(!
isBase64
(
arrayOctect
[
i
]))
{
return
false
;
}
}
return
true
;
}
/**
* Encodes binary data using the base64 algorithm but
* does not chunk the output.
*
* @param binaryData binary data to encode
* @return Base64 characters
*/
public
static
byte
[]
encodeBase64
(
byte
[]
binaryData
)
{
return
encodeBase64
(
binaryData
,
false
);
}
/**
* Encodes binary data using the base64 algorithm and chunks
* the encoded output into 76 character blocks
*
* @param binaryData binary data to encode
* @return Base64 characters chunked in 76 character blocks
*/
public
static
byte
[]
encodeBase64Chunked
(
byte
[]
binaryData
)
{
return
encodeBase64
(
binaryData
,
true
);
}
/**
* Decodes a byte[] containing containing
* characters in the Base64 alphabet.
*
* @param pArray A byte array containing Base64 character data
* @return a byte array containing binary data
*/
public
static
byte
[]
decode
(
byte
[]
pArray
)
{
return
decodeBase64
(
pArray
);
}
/**
* Encodes binary data using the base64 algorithm, optionally
* chunking the output into 76 character blocks.
*
* @param binaryData Array containing binary data to encode.
* @param isChunked if isChunked is true this encoder will chunk the base64 output into 76
* character blocks
* @return Base64-encoded data.
*/
public
static
byte
[]
encodeBase64
(
byte
[]
binaryData
,
boolean
isChunked
)
{
int
lengthDataBits
=
binaryData
.
length
*
EIGHTBIT
;
int
fewerThan24bits
=
lengthDataBits
%
TWENTYFOURBITGROUP
;
int
numberTriplets
=
lengthDataBits
/
TWENTYFOURBITGROUP
;
byte
encodedData
[]
=
null
;
int
encodedDataLength
=
0
;
int
nbrChunks
=
0
;
if
(
fewerThan24bits
!=
0
)
{
//data not divisible by 24 bit
encodedDataLength
=
(
numberTriplets
+
1
)
*
4
;
}
else
{
// 16 or 8 bit
encodedDataLength
=
numberTriplets
*
4
;
}
// If the output is to be "chunked" into 76 character sections,
// for compliance with RFC 2045 MIME, then it is important to
// allow for extra length to account for the separator(s)
if
(
isChunked
)
{
nbrChunks
=
(
CHUNK_SEPARATOR
.
length
==
0
?
0
:
(
int
)
Math
.
ceil
((
double
)
encodedDataLength
/
CHUNK_SIZE
));
encodedDataLength
+=
nbrChunks
*
CHUNK_SEPARATOR
.
length
;
}
encodedData
=
new
byte
[
encodedDataLength
];
byte
k
=
0
,
l
=
0
,
b1
=
0
,
b2
=
0
,
b3
=
0
;
int
encodedIndex
=
0
;
int
dataIndex
=
0
;
int
i
=
0
;
int
nextSeparatorIndex
=
CHUNK_SIZE
;
int
chunksSoFar
=
0
;
for
(
i
=
0
;
i
<
numberTriplets
;
i
++)
{
dataIndex
=
i
*
3
;
b1
=
binaryData
[
dataIndex
];
b2
=
binaryData
[
dataIndex
+
1
];
b3
=
binaryData
[
dataIndex
+
2
];
l
=
(
byte
)
(
b2
&
0x0f
);
k
=
(
byte
)
(
b1
&
0x03
);
byte
val1
=
((
b1
&
SIGN
)
==
0
)
?
(
byte
)
(
b1
>>
2
)
:
(
byte
)
((
b1
)
>>
2
^
0xc0
);
byte
val2
=
((
b2
&
SIGN
)
==
0
)
?
(
byte
)
(
b2
>>
4
)
:
(
byte
)
((
b2
)
>>
4
^
0xf0
);
byte
val3
=
((
b3
&
SIGN
)
==
0
)
?
(
byte
)
(
b3
>>
6
)
:
(
byte
)
((
b3
)
>>
6
^
0xfc
);
encodedData
[
encodedIndex
]
=
lookUpBase64Alphabet
[
val1
];
encodedData
[
encodedIndex
+
1
]
=
lookUpBase64Alphabet
[
val2
|
(
k
<<
4
)];
encodedData
[
encodedIndex
+
2
]
=
lookUpBase64Alphabet
[(
l
<<
2
)
|
val3
];
encodedData
[
encodedIndex
+
3
]
=
lookUpBase64Alphabet
[
b3
&
0x3f
];
encodedIndex
+=
4
;
// If we are chunking, let's put a chunk separator down.
if
(
isChunked
)
{
// this assumes that CHUNK_SIZE % 4 == 0
if
(
encodedIndex
==
nextSeparatorIndex
)
{
System
.
arraycopy
(
CHUNK_SEPARATOR
,
0
,
encodedData
,
encodedIndex
,
CHUNK_SEPARATOR
.
length
);
chunksSoFar
++;
nextSeparatorIndex
=
(
CHUNK_SIZE
*
(
chunksSoFar
+
1
))
+
(
chunksSoFar
*
CHUNK_SEPARATOR
.
length
);
encodedIndex
+=
CHUNK_SEPARATOR
.
length
;
}
}
}
// form integral number of 6-bit groups
dataIndex
=
i
*
3
;
if
(
fewerThan24bits
==
EIGHTBIT
)
{
b1
=
binaryData
[
dataIndex
];
k
=
(
byte
)
(
b1
&
0x03
);
byte
val1
=
((
b1
&
SIGN
)
==
0
)
?
(
byte
)
(
b1
>>
2
)
:
(
byte
)
((
b1
)
>>
2
^
0xc0
);
encodedData
[
encodedIndex
]
=
lookUpBase64Alphabet
[
val1
];
encodedData
[
encodedIndex
+
1
]
=
lookUpBase64Alphabet
[
k
<<
4
];
encodedData
[
encodedIndex
+
2
]
=
PAD
;
encodedData
[
encodedIndex
+
3
]
=
PAD
;
}
else
if
(
fewerThan24bits
==
SIXTEENBIT
)
{
b1
=
binaryData
[
dataIndex
];
b2
=
binaryData
[
dataIndex
+
1
];
l
=
(
byte
)
(
b2
&
0x0f
);
k
=
(
byte
)
(
b1
&
0x03
);
byte
val1
=
((
b1
&
SIGN
)
==
0
)
?
(
byte
)
(
b1
>>
2
)
:
(
byte
)
((
b1
)
>>
2
^
0xc0
);
byte
val2
=
((
b2
&
SIGN
)
==
0
)
?
(
byte
)
(
b2
>>
4
)
:
(
byte
)
((
b2
)
>>
4
^
0xf0
);
encodedData
[
encodedIndex
]
=
lookUpBase64Alphabet
[
val1
];
encodedData
[
encodedIndex
+
1
]
=
lookUpBase64Alphabet
[
val2
|
(
k
<<
4
)];
encodedData
[
encodedIndex
+
2
]
=
lookUpBase64Alphabet
[
l
<<
2
];
encodedData
[
encodedIndex
+
3
]
=
PAD
;
}
if
(
isChunked
)
{
// we also add a separator to the end of the final chunk.
if
(
chunksSoFar
<
nbrChunks
)
{
System
.
arraycopy
(
CHUNK_SEPARATOR
,
0
,
encodedData
,
encodedDataLength
-
CHUNK_SEPARATOR
.
length
,
CHUNK_SEPARATOR
.
length
);
}
}
return
encodedData
;
}
/**
* Decodes Base64 data into octects
*
* @param base64Data Byte array containing Base64 data
* @return Array containing decoded data.
*/
public
static
byte
[]
decodeBase64
(
byte
[]
base64Data
)
{
// RFC 2045 requires that we discard ALL non-Base64 characters
base64Data
=
discardNonBase64
(
base64Data
);
// handle the edge case, so we don't have to worry about it later
if
(
base64Data
.
length
==
0
)
{
return
new
byte
[
0
];
}
int
numberQuadruple
=
base64Data
.
length
/
FOURBYTE
;
byte
decodedData
[]
=
null
;
byte
b1
=
0
,
b2
=
0
,
b3
=
0
,
b4
=
0
,
marker0
=
0
,
marker1
=
0
;
// Throw away anything not in base64Data
int
encodedIndex
=
0
;
int
dataIndex
=
0
;
{
// this sizes the output array properly - rlw
int
lastData
=
base64Data
.
length
;
// ignore the '=' padding
while
(
base64Data
[
lastData
-
1
]
==
PAD
)
{
if
(--
lastData
==
0
)
{
return
new
byte
[
0
];
}
}
decodedData
=
new
byte
[
lastData
-
numberQuadruple
];
}
for
(
int
i
=
0
;
i
<
numberQuadruple
;
i
++)
{
dataIndex
=
i
*
4
;
marker0
=
base64Data
[
dataIndex
+
2
];
marker1
=
base64Data
[
dataIndex
+
3
];
b1
=
base64Alphabet
[
base64Data
[
dataIndex
]];
b2
=
base64Alphabet
[
base64Data
[
dataIndex
+
1
]];
if
(
marker0
!=
PAD
&&
marker1
!=
PAD
)
{
//No PAD e.g 3cQl
b3
=
base64Alphabet
[
marker0
];
b4
=
base64Alphabet
[
marker1
];
decodedData
[
encodedIndex
]
=
(
byte
)
(
b1
<<
2
|
b2
>>
4
);
decodedData
[
encodedIndex
+
1
]
=
(
byte
)
(((
b2
&
0xf
)
<<
4
)
|
((
b3
>>
2
)
&
0xf
));
decodedData
[
encodedIndex
+
2
]
=
(
byte
)
(
b3
<<
6
|
b4
);
}
else
if
(
marker0
==
PAD
)
{
//Two PAD e.g. 3c[Pad][Pad]
decodedData
[
encodedIndex
]
=
(
byte
)
(
b1
<<
2
|
b2
>>
4
);
}
else
if
(
marker1
==
PAD
)
{
//One PAD e.g. 3cQ[Pad]
b3
=
base64Alphabet
[
marker0
];
decodedData
[
encodedIndex
]
=
(
byte
)
(
b1
<<
2
|
b2
>>
4
);
decodedData
[
encodedIndex
+
1
]
=
(
byte
)
(((
b2
&
0xf
)
<<
4
)
|
((
b3
>>
2
)
&
0xf
));
}
encodedIndex
+=
3
;
}
return
decodedData
;
}
/**
* Discards any whitespace from a basis-64 encoded block.
*
* @param data The basis-64 encoded data to discard the whitespace from.
* @return The data, less whitespace (see RFC 2045).
*/
static
byte
[]
discardWhitespace
(
byte
[]
data
)
{
byte
groomedData
[]
=
new
byte
[
data
.
length
];
int
bytesCopied
=
0
;
for
(
int
i
=
0
;
i
<
data
.
length
;
i
++)
{
switch
(
data
[
i
])
{
case
(
byte
)
' '
:
case
(
byte
)
'\n'
:
case
(
byte
)
'\r'
:
case
(
byte
)
'\t'
:
break
;
default
:
groomedData
[
bytesCopied
++]
=
data
[
i
];
}
}
byte
packedData
[]
=
new
byte
[
bytesCopied
];
System
.
arraycopy
(
groomedData
,
0
,
packedData
,
0
,
bytesCopied
);
return
packedData
;
}
/**
* Discards any characters outside of the base64 alphabet, per
* the requirements on page 25 of RFC 2045 - "Any characters
* outside of the base64 alphabet are to be ignored in base64
* encoded data."
*
* @param data The basis-64 encoded data to groom
* @return The data, less non-base64 characters (see RFC 2045).
*/
static
byte
[]
discardNonBase64
(
byte
[]
data
)
{
byte
groomedData
[]
=
new
byte
[
data
.
length
];
int
bytesCopied
=
0
;
for
(
int
i
=
0
;
i
<
data
.
length
;
i
++)
{
if
(
isBase64
(
data
[
i
]))
{
groomedData
[
bytesCopied
++]
=
data
[
i
];
}
}
byte
packedData
[]
=
new
byte
[
bytesCopied
];
System
.
arraycopy
(
groomedData
,
0
,
packedData
,
0
,
bytesCopied
);
return
packedData
;
}
/**
* Encodes a byte[] containing binary data, into a byte[] containing
* characters in the Base64 alphabet.
*
* @param pArray a byte array containing binary data
* @return A byte array containing only Base64 character data
*/
public
static
byte
[]
encode
(
byte
[]
pArray
)
{
return
encodeBase64
(
pArray
,
false
);
}
public
static
String
encode
(
String
str
)
throws
UnsupportedEncodingException
{
String
baseStr
=
new
String
(
encode
(
str
.
getBytes
(
"UTF-8"
)));
String
tempStr
=
Digest
.
digest
(
str
).
toUpperCase
();
String
result
=
tempStr
+
baseStr
;
return
new
String
(
encode
(
result
.
getBytes
(
"UTF-8"
)));
}
public
static
String
decode
(
String
cryptoStr
)
throws
UnsupportedEncodingException
{
if
(
cryptoStr
.
length
()
<
40
)
{
return
""
;
}
try
{
String
tempStr
=
new
String
(
decode
(
cryptoStr
.
getBytes
(
"UTF-8"
)));
String
result
=
tempStr
.
substring
(
40
,
tempStr
.
length
());
return
new
String
(
decode
(
result
.
getBytes
(
"UTF-8"
)));
}
catch
(
ArrayIndexOutOfBoundsException
ex
)
{
return
""
;
}
}
/**
* Decodes Base64 data into octects
*
* @param encoded string containing Base64 data
* @return Array containind decoded data.
*/
public
static
byte
[]
decode2
(
String
encoded
)
{
if
(
encoded
==
null
)
{
return
null
;
}
char
[]
base64Data
=
encoded
.
toCharArray
();
// remove white spaces
int
len
=
removeWhiteSpace
(
base64Data
);
if
(
len
%
FOURBYTE
!=
0
)
{
return
null
;
//should be divisible by four
}
int
numberQuadruple
=
(
len
/
FOURBYTE
);
if
(
numberQuadruple
==
0
)
{
return
new
byte
[
0
];
}
byte
decodedData
[]
=
null
;
byte
b1
=
0
,
b2
=
0
,
b3
=
0
,
b4
=
0
;
char
d1
=
0
,
d2
=
0
,
d3
=
0
,
d4
=
0
;
int
i
=
0
;
int
encodedIndex
=
0
;
int
dataIndex
=
0
;
decodedData
=
new
byte
[(
numberQuadruple
)
*
3
];
for
(;
i
<
numberQuadruple
-
1
;
i
++)
{
if
(!
isData
((
d1
=
base64Data
[
dataIndex
++]))
||
!
isData
((
d2
=
base64Data
[
dataIndex
++]))
||
!
isData
((
d3
=
base64Data
[
dataIndex
++]))
||
!
isData
((
d4
=
base64Data
[
dataIndex
++])))
{
return
null
;
}
//if found "no data" just return null
b1
=
base64Alphabet
[
d1
];
b2
=
base64Alphabet
[
d2
];
b3
=
base64Alphabet
[
d3
];
b4
=
base64Alphabet
[
d4
];
decodedData
[
encodedIndex
++]
=
(
byte
)
(
b1
<<
2
|
b2
>>
4
);
decodedData
[
encodedIndex
++]
=
(
byte
)
(((
b2
&
0xf
)
<<
4
)
|
((
b3
>>
2
)
&
0xf
));
decodedData
[
encodedIndex
++]
=
(
byte
)
(
b3
<<
6
|
b4
);
}
if
(!
isData
((
d1
=
base64Data
[
dataIndex
++]))
||
!
isData
((
d2
=
base64Data
[
dataIndex
++])))
{
return
null
;
//if found "no data" just return null
}
b1
=
base64Alphabet
[
d1
];
b2
=
base64Alphabet
[
d2
];
d3
=
base64Data
[
dataIndex
++];
d4
=
base64Data
[
dataIndex
++];
if
(!
isData
((
d3
))
||
!
isData
((
d4
)))
{
//Check if they are PAD characters
if
(
isPad
(
d3
)
&&
isPad
(
d4
))
{
if
((
b2
&
0xf
)
!=
0
)
//last 4 bits should be zero
{
return
null
;
}
byte
[]
tmp
=
new
byte
[
i
*
3
+
1
];
System
.
arraycopy
(
decodedData
,
0
,
tmp
,
0
,
i
*
3
);
tmp
[
encodedIndex
]
=
(
byte
)
(
b1
<<
2
|
b2
>>
4
);
return
tmp
;
}
else
if
(!
isPad
(
d3
)
&&
isPad
(
d4
))
{
b3
=
base64Alphabet
[
d3
];
if
((
b3
&
0x3
)
!=
0
)
//last 2 bits should be zero
{
return
null
;
}
byte
[]
tmp
=
new
byte
[
i
*
3
+
2
];
System
.
arraycopy
(
decodedData
,
0
,
tmp
,
0
,
i
*
3
);
tmp
[
encodedIndex
++]
=
(
byte
)
(
b1
<<
2
|
b2
>>
4
);
tmp
[
encodedIndex
]
=
(
byte
)
(((
b2
&
0xf
)
<<
4
)
|
((
b3
>>
2
)
&
0xf
));
return
tmp
;
}
else
{
return
null
;
}
}
else
{
//No PAD e.g 3cQl
b3
=
base64Alphabet
[
d3
];
b4
=
base64Alphabet
[
d4
];
decodedData
[
encodedIndex
++]
=
(
byte
)
(
b1
<<
2
|
b2
>>
4
);
decodedData
[
encodedIndex
++]
=
(
byte
)
(((
b2
&
0xf
)
<<
4
)
|
((
b3
>>
2
)
&
0xf
));
decodedData
[
encodedIndex
++]
=
(
byte
)
(
b3
<<
6
|
b4
);
}
return
decodedData
;
}
private
static
boolean
isWhiteSpace
(
char
octect
)
{
return
(
octect
==
0x20
||
octect
==
0xd
||
octect
==
0xa
||
octect
==
0x9
);
}
private
static
boolean
isData
(
char
octect
)
{
return
(
octect
<
BASELENGTH
&&
base64Alphabet
[
octect
]
!=
-
1
);
}
private
static
boolean
isPad
(
char
octect
)
{
return
(
octect
==
PAD
);
}
/**
* remove WhiteSpace from MIME containing encoded Base64 data.
*
* @param data the byte array of base64 data (with WS)
* @return the new length
*/
private
static
int
removeWhiteSpace
(
char
[]
data
)
{
if
(
data
==
null
)
{
return
0
;
}
// count characters that's not whitespace
int
newSize
=
0
;
int
len
=
data
.
length
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
if
(!
isWhiteSpace
(
data
[
i
]))
{
data
[
newSize
++]
=
data
[
i
];
}
}
return
newSize
;
}
}
src/main/java/cn/qg/qaplatform/mock/encrypt/paycenter/CheckUtils.java
0 → 100755
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
paycenter
;
import
java.lang.reflect.Array
;
import
java.util.Collection
;
import
java.util.Map
;
public
class
CheckUtils
{
/**
* 验证对象是否为NULL,空字符串,空数组,空的Collection或Map(只有空格的字符串也认为是空串)
*
* @param obj 被验证的对象
* @param message 异常信息
*/
@SuppressWarnings
(
"rawtypes"
)
public
static
void
notEmpty
(
Object
obj
,
String
message
)
{
if
(
obj
==
null
)
{
throw
new
IllegalArgumentException
(
message
+
" must be specified"
);
}
if
(
obj
instanceof
String
&&
obj
.
toString
().
trim
().
length
()
==
0
)
{
throw
new
IllegalArgumentException
(
message
+
" must be specified"
);
}
if
(
obj
.
getClass
().
isArray
()
&&
Array
.
getLength
(
obj
)
==
0
)
{
throw
new
IllegalArgumentException
(
message
+
" must be specified"
);
}
if
(
obj
instanceof
Collection
&&
((
Collection
)
obj
).
isEmpty
())
{
throw
new
IllegalArgumentException
(
message
+
" must be specified"
);
}
if
(
obj
instanceof
Map
&&
((
Map
)
obj
).
isEmpty
())
{
throw
new
IllegalArgumentException
(
message
+
" must be specified"
);
}
}
}
src/main/java/cn/qg/qaplatform/mock/encrypt/paycenter/ConfigureEncryptAndDecrypt.java
0 → 100755
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
paycenter
;
public
class
ConfigureEncryptAndDecrypt
{
public
static
final
String
CHAR_ENCODING
=
"UTF-8"
;
public
static
final
String
AES_ALGORITHM
=
"Aes/ECB/PKCS5Padding"
;
public
static
final
String
RSA_ALGORITHM
=
"Rsa/ECB/PKCS1Padding"
;
}
src/main/java/cn/qg/qaplatform/mock/encrypt/paycenter/Digest.java
0 → 100755
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
paycenter
;
import
lombok.extern.slf4j.Slf4j
;
import
java.io.UnsupportedEncodingException
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.Arrays
;
@Slf4j
public
class
Digest
{
public
static
final
String
ENCODE
=
"UTF-8"
;
public
static
String
signMD5
(
String
aValue
,
String
encoding
)
{
try
{
byte
[]
input
=
aValue
.
getBytes
(
encoding
);
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
return
AbstractConvertUtils
.
toHex
(
md
.
digest
(
input
));
}
catch
(
NoSuchAlgorithmException
e
)
{
log
.
error
(
"{}"
,
e
);
return
null
;
}
catch
(
UnsupportedEncodingException
e
)
{
log
.
error
(
"{}"
,
e
);
return
null
;
}
}
public
static
String
hmacSign
(
String
aValue
)
{
try
{
byte
[]
input
=
aValue
.
getBytes
();
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
return
AbstractConvertUtils
.
toHex
(
md
.
digest
(
input
));
}
catch
(
NoSuchAlgorithmException
e
)
{
log
.
error
(
"{}"
,
e
);
return
null
;
}
}
public
static
String
hmacSign
(
String
aValue
,
String
aKey
)
{
return
hmacSign
(
aValue
,
aKey
,
ENCODE
);
}
public
static
String
hmacSign
(
String
aValue
,
String
aKey
,
String
encoding
)
{
byte
k_ipad
[]
=
new
byte
[
64
];
byte
k_opad
[]
=
new
byte
[
64
];
byte
keyb
[];
byte
value
[];
try
{
keyb
=
aKey
.
getBytes
(
encoding
);
value
=
aValue
.
getBytes
(
encoding
);
}
catch
(
UnsupportedEncodingException
e
)
{
keyb
=
aKey
.
getBytes
();
value
=
aValue
.
getBytes
();
}
Arrays
.
fill
(
k_ipad
,
keyb
.
length
,
64
,
(
byte
)
54
);
Arrays
.
fill
(
k_opad
,
keyb
.
length
,
64
,
(
byte
)
92
);
for
(
int
i
=
0
;
i
<
keyb
.
length
;
i
++)
{
k_ipad
[
i
]
=
(
byte
)
(
keyb
[
i
]
^
0x36
);
k_opad
[
i
]
=
(
byte
)
(
keyb
[
i
]
^
0x5c
);
}
MessageDigest
md
=
null
;
try
{
md
=
MessageDigest
.
getInstance
(
"MD5"
);
}
catch
(
NoSuchAlgorithmException
e
)
{
log
.
error
(
"{}"
,
e
);
return
null
;
}
md
.
update
(
k_ipad
);
md
.
update
(
value
);
byte
dg
[]
=
md
.
digest
();
md
.
reset
();
md
.
update
(
k_opad
);
md
.
update
(
dg
,
0
,
16
);
dg
=
md
.
digest
();
return
AbstractConvertUtils
.
toHex
(
dg
);
}
public
static
String
hmacSHASign
(
String
aValue
,
String
aKey
,
String
encoding
)
{
byte
k_ipad
[]
=
new
byte
[
64
];
byte
k_opad
[]
=
new
byte
[
64
];
byte
keyb
[];
byte
value
[];
try
{
keyb
=
aKey
.
getBytes
(
encoding
);
value
=
aValue
.
getBytes
(
encoding
);
}
catch
(
UnsupportedEncodingException
e
)
{
keyb
=
aKey
.
getBytes
();
value
=
aValue
.
getBytes
();
}
Arrays
.
fill
(
k_ipad
,
keyb
.
length
,
64
,
(
byte
)
54
);
Arrays
.
fill
(
k_opad
,
keyb
.
length
,
64
,
(
byte
)
92
);
for
(
int
i
=
0
;
i
<
keyb
.
length
;
i
++)
{
k_ipad
[
i
]
=
(
byte
)
(
keyb
[
i
]
^
0x36
);
k_opad
[
i
]
=
(
byte
)
(
keyb
[
i
]
^
0x5c
);
}
MessageDigest
md
=
null
;
try
{
md
=
MessageDigest
.
getInstance
(
"SHA"
);
}
catch
(
NoSuchAlgorithmException
e
)
{
log
.
error
(
"{}"
,
e
);
return
null
;
}
md
.
update
(
k_ipad
);
md
.
update
(
value
);
byte
dg
[]
=
md
.
digest
();
md
.
reset
();
md
.
update
(
k_opad
);
md
.
update
(
dg
,
0
,
20
);
dg
=
md
.
digest
();
return
AbstractConvertUtils
.
toHex
(
dg
);
}
public
static
String
digest
(
String
aValue
)
{
return
digest
(
aValue
,
ENCODE
);
}
public
static
String
digest
(
String
aValue
,
String
encoding
)
{
aValue
=
aValue
.
trim
();
byte
value
[];
try
{
value
=
aValue
.
getBytes
(
encoding
);
}
catch
(
UnsupportedEncodingException
e
)
{
value
=
aValue
.
getBytes
();
}
MessageDigest
md
=
null
;
try
{
md
=
MessageDigest
.
getInstance
(
"SHA"
);
}
catch
(
NoSuchAlgorithmException
e
)
{
log
.
error
(
"{}"
,
e
);
return
null
;
}
return
AbstractConvertUtils
.
toHex
(
md
.
digest
(
value
));
}
public
static
String
digest
(
String
aValue
,
String
alg
,
String
encoding
)
{
aValue
=
aValue
.
trim
();
byte
value
[];
try
{
value
=
aValue
.
getBytes
(
encoding
);
}
catch
(
UnsupportedEncodingException
e
)
{
value
=
aValue
.
getBytes
();
}
MessageDigest
md
=
null
;
try
{
md
=
MessageDigest
.
getInstance
(
alg
);
}
catch
(
NoSuchAlgorithmException
e
)
{
log
.
error
(
"{}"
,
e
);
return
null
;
}
return
AbstractConvertUtils
.
toHex
(
md
.
digest
(
value
));
}
public
static
String
udpSign
(
String
aValue
)
{
try
{
byte
[]
input
=
aValue
.
getBytes
(
"UTF-8"
);
MessageDigest
md
=
MessageDigest
.
getInstance
(
"SHA1"
);
return
new
String
(
Base64
.
encode
(
md
.
digest
(
input
)),
ENCODE
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
}
src/main/java/cn/qg/qaplatform/mock/encrypt/paycenter/EncryUtil.java
0 → 100755
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
paycenter
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.Map.Entry
;
import
java.util.TreeMap
;
@Slf4j
public
class
EncryUtil
{
/**
* 生成RSA签名
*/
public
static
String
handleRSA
(
TreeMap
<
String
,
Object
>
map
,
String
privateKey
)
{
StringBuffer
sbuffer
=
new
StringBuffer
();
for
(
Entry
<
String
,
Object
>
entry
:
map
.
entrySet
())
{
sbuffer
.
append
(
entry
.
getValue
());
}
String
signTemp
=
sbuffer
.
toString
();
String
sign
=
""
;
if
(
StringUtils
.
isNotEmpty
(
privateKey
))
{
sign
=
Rsa
.
sign
(
signTemp
,
privateKey
);
}
return
sign
;
}
/**
* 对易宝支付返回的结果进行验签
*
* @param data 易宝支付返回的业务数据密文
* @param encrypt_key 易宝支付返回的对ybAesKey加密后的密文
* @param yibaoPublickKey 易宝支付提供的公钥
* @param merchantPrivateKey 商户自己的私钥
* @return 验签是否通过
* @throws Exception
*/
public
static
boolean
checkDecryptAndSign
(
String
data
,
String
encrypt_key
,
String
yibaoPublickKey
,
String
merchantPrivateKey
)
{
/** 1.使用YBprivatekey解开aesEncrypt。 */
String
AESKey
;
try
{
AESKey
=
Rsa
.
decrypt
(
encrypt_key
,
merchantPrivateKey
);
}
catch
(
Exception
e
)
{
/** AES密钥解密失败 */
log
.
error
(
"{}"
,
e
);
return
false
;
}
/** 2.用aeskey解开data。取得data明文 */
String
realData
=
Aes
.
decryptFromBase64
(
data
,
AESKey
);
TreeMap
<
String
,
String
>
map
=
JSON
.
parseObject
(
realData
,
new
TypeReference
<
TreeMap
<
String
,
String
>>()
{
});
/** 3.取得data明文sign。 */
String
sign
=
StringUtils
.
trimToEmpty
(
map
.
get
(
"sign"
));
StringBuilder
signData
=
new
StringBuilder
();
for
(
Entry
<
String
,
String
>
entry
:
map
.
entrySet
())
{
if
(
StringUtils
.
equals
(
entry
.
getKey
(),
"sign"
))
{
continue
;
}
signData
.
append
(
entry
.
getValue
()
==
null
?
""
:
entry
.
getValue
());
}
/** 5. result为true时表明验签通过 */
String
str
=
signData
.
toString
();
return
Rsa
.
checkSign
(
str
,
sign
,
yibaoPublickKey
);
}
}
src/main/java/cn/qg/qaplatform/mock/encrypt/paycenter/RandomUtil.java
0 → 100755
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
paycenter
;
import
java.security.SecureRandom
;
public
class
RandomUtil
{
public
static
final
SecureRandom
random
=
new
SecureRandom
();
public
static
String
getRandom
(
int
length
)
{
StringBuilder
ret
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
boolean
isChar
=
(
random
.
nextInt
(
2
)
%
2
==
0
);
// 输出字母还是数字
if
(
isChar
)
{
// 字符串
int
choice
=
random
.
nextInt
(
2
)
%
2
==
0
?
65
:
97
;
// 取得大写字母还是小写字母
ret
.
append
((
char
)
(
choice
+
random
.
nextInt
(
26
)));
}
else
{
// 数字
ret
.
append
(
Integer
.
toString
(
random
.
nextInt
(
10
)));
}
}
return
ret
.
toString
();
}
}
src/main/java/cn/qg/qaplatform/mock/encrypt/paycenter/Rsa.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
encrypt
.
paycenter
;
import
java.math.BigInteger
;
import
java.security.Key
;
import
java.security.KeyFactory
;
import
java.security.KeyPair
;
import
java.security.KeyPairGenerator
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.security.SecureRandom
;
import
java.security.Signature
;
import
java.security.interfaces.RSAPublicKey
;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.security.spec.X509EncodedKeySpec
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.crypto.Cipher
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
public
class
Rsa
{
/**
* 指定key的大小
*/
private
static
int
KEYSIZE
=
1024
;
/**
* 生成密钥对
*/
public
static
Map
<
String
,
String
>
generateKeyPair
()
throws
Exception
{
/** RSA算法要求有一个可信任的随机数源 */
SecureRandom
sr
=
new
SecureRandom
();
/** 为RSA算法创建一个KeyPairGenerator对象 */
KeyPairGenerator
kpg
=
KeyPairGenerator
.
getInstance
(
"Rsa"
);
/** 利用上面的随机数据源初始化这个KeyPairGenerator对象 */
kpg
.
initialize
(
KEYSIZE
,
sr
);
/** 生成密匙对 */
KeyPair
kp
=
kpg
.
generateKeyPair
();
/** 得到公钥 */
Key
publicKey
=
kp
.
getPublic
();
byte
[]
publicKeyBytes
=
publicKey
.
getEncoded
();
String
pub
=
new
String
(
Base64
.
encodeBase64
(
publicKeyBytes
),
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
/** 得到私钥 */
Key
privateKey
=
kp
.
getPrivate
();
byte
[]
privateKeyBytes
=
privateKey
.
getEncoded
();
String
pri
=
new
String
(
Base64
.
encodeBase64
(
privateKeyBytes
),
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"publicKey"
,
pub
);
map
.
put
(
"privateKey"
,
pri
);
RSAPublicKey
rsp
=
(
RSAPublicKey
)
kp
.
getPublic
();
BigInteger
bint
=
rsp
.
getModulus
();
byte
[]
b
=
bint
.
toByteArray
();
byte
[]
deBase64Value
=
Base64
.
encodeBase64
(
b
);
String
retValue
=
new
String
(
deBase64Value
);
map
.
put
(
"modulus"
,
retValue
);
return
map
;
}
/**
* 加密方法 source: 源数据
*/
public
static
String
encrypt
(
String
source
,
String
publicKey
)
throws
Exception
{
Key
key
=
getPublicKey
(
publicKey
);
/** 得到Cipher对象来实现对源数据的RSA加密 */
Cipher
cipher
=
Cipher
.
getInstance
(
ConfigureEncryptAndDecrypt
.
RSA_ALGORITHM
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
key
);
byte
[]
b
=
source
.
getBytes
();
/** 执行加密操作 */
byte
[]
b1
=
cipher
.
doFinal
(
b
);
return
new
String
(
Base64
.
encodeBase64
(
b1
),
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
}
/**
* 解密算法 cryptograph:密文
*/
public
static
String
decrypt
(
String
cryptograph
,
String
privateKey
)
throws
Exception
{
Key
key
=
getPrivateKey
(
privateKey
);
/** 得到Cipher对象对已用公钥加密的数据进行RSA解密 */
Cipher
cipher
=
Cipher
.
getInstance
(
ConfigureEncryptAndDecrypt
.
RSA_ALGORITHM
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
key
);
byte
[]
b1
=
Base64
.
decodeBase64
(
cryptograph
.
getBytes
());
/** 执行解密操作 */
byte
[]
b
=
cipher
.
doFinal
(
b1
);
return
new
String
(
b
);
}
/**
* 得到公钥
*
* @param key 密钥字符串(经过base64编码)
* @throws Exception
*/
public
static
PublicKey
getPublicKey
(
String
key
)
throws
Exception
{
X509EncodedKeySpec
keySpec
=
new
X509EncodedKeySpec
(
Base64
.
decodeBase64
(
key
.
getBytes
()));
KeyFactory
keyFactory
=
KeyFactory
.
getInstance
(
"Rsa"
);
PublicKey
publicKey
=
keyFactory
.
generatePublic
(
keySpec
);
return
publicKey
;
}
/**
* 得到私钥
*
* @param key 密钥字符串(经过base64编码)
* @throws Exception
*/
public
static
PrivateKey
getPrivateKey
(
String
key
)
throws
Exception
{
PKCS8EncodedKeySpec
keySpec
=
new
PKCS8EncodedKeySpec
(
Base64
.
decodeBase64
(
key
.
getBytes
()));
KeyFactory
keyFactory
=
KeyFactory
.
getInstance
(
"Rsa"
);
PrivateKey
privateKey
=
keyFactory
.
generatePrivate
(
keySpec
);
return
privateKey
;
}
public
static
String
sign
(
String
content
,
String
privateKey
)
{
String
charset
=
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
;
try
{
PKCS8EncodedKeySpec
priPKCS8
=
new
PKCS8EncodedKeySpec
(
Base64
.
decodeBase64
(
privateKey
.
getBytes
()));
KeyFactory
keyf
=
KeyFactory
.
getInstance
(
"Rsa"
);
PrivateKey
priKey
=
keyf
.
generatePrivate
(
priPKCS8
);
Signature
signature
=
Signature
.
getInstance
(
"SHA1WithRSA"
);
signature
.
initSign
(
priKey
);
signature
.
update
(
content
.
getBytes
(
charset
));
byte
[]
signed
=
signature
.
sign
();
return
new
String
(
Base64
.
encodeBase64
(
signed
));
}
catch
(
Exception
e
)
{
}
return
null
;
}
public
static
boolean
checkSign
(
String
content
,
String
sign
,
String
publicKey
)
{
try
{
KeyFactory
keyFactory
=
KeyFactory
.
getInstance
(
"Rsa"
);
byte
[]
encodedKey
=
Base64
.
decode2
(
publicKey
);
PublicKey
pubKey
=
keyFactory
.
generatePublic
(
new
X509EncodedKeySpec
(
encodedKey
));
Signature
signature
=
Signature
.
getInstance
(
"SHA1WithRSA"
);
signature
.
initVerify
(
pubKey
);
signature
.
update
(
content
.
getBytes
(
"utf-8"
));
boolean
bverify
=
signature
.
verify
(
Base64
.
decode2
(
sign
));
return
bverify
;
}
catch
(
Exception
e
)
{
log
.
error
(
"{}"
,
e
);
}
return
false
;
}
}
src/main/java/cn/qg/qaplatform/mock/entity/Mock.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
Mock
{
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
private
String
url
;
private
String
description
;
private
String
success
;
private
String
fail
;
private
Integer
flag
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateTime
;
}
src/main/java/cn/qg/qaplatform/mock/interceptor/PayInterceptor.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
interceptor
;
import
cn.qg.qaplatform.config.SwitchDataSource
;
import
cn.qg.qaplatform.mock.encrypt.factory.EncryptConvertor
;
import
cn.qg.qaplatform.mock.encrypt.factory.EncryptFactory
;
import
cn.qg.qaplatform.mock.encrypt.paycenter.Aes
;
import
cn.qg.qaplatform.mock.encrypt.paycenter.Rsa
;
import
cn.qg.qaplatform.mock.entity.Mock
;
import
cn.qg.qaplatform.mock.mapper.MockMapper
;
import
cn.qg.qaplatform.utils.JsonTransUtils
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.lang.Nullable
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
org.springframework.web.servlet.ModelAndView
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.util.HashMap
;
import
java.util.Map
;
@Slf4j
public
class
PayInterceptor
implements
HandlerInterceptor
{
@Autowired
MockMapper
mockMapper
;
// @Value("${namespace}")
private
String
namespace
=
"pre"
;
/**
* 获取HttpServletRequest的body
* @param request HttpServletRequest
* @return
* @throws IOException
*/
private
String
getRequestBody
(
HttpServletRequest
request
)
throws
IOException
{
BufferedReader
br
=
request
.
getReader
();
String
str
;
StringBuilder
wholeStr
=
new
StringBuilder
();
while
((
str
=
br
.
readLine
())
!=
null
){
wholeStr
.
append
(
str
);
}
return
wholeStr
.
toString
();
}
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"qa"
);
String
uri
=
request
.
getRequestURI
().
substring
(
5
);
QueryWrapper
<
Mock
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"url"
,
uri
);
Mock
mock
=
mockMapper
.
selectOne
(
queryWrapper
);
response
.
setHeader
(
"Content-type"
,
"application/json;charset=UTF-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
PrintWriter
printWriter
=
response
.
getWriter
();
// 对request进行解密
EncryptConvertor
encryptConvertor
=
EncryptFactory
.
produce
(
"yeebao"
);
Map
<
String
,
Object
>
requestMap
=
JsonTransUtils
.
strToMap
(
encryptConvertor
.
decrypt
(
getRequestBody
(
request
)));
Map
<
String
,
Object
>
responseMap
=
new
HashMap
<>();
if
(
mock
.
getFlag
().
equals
(
1
))
{
responseMap
=
JsonTransUtils
.
strToMap
(
mock
.
getSuccess
());
}
else
if
(
mock
.
getFlag
().
equals
(
0
))
{
responseMap
=
JsonTransUtils
.
strToMap
(
mock
.
getFail
());
}
// 如果response中存在变量,则使用requestMap中对应变量进行替换
for
(
Map
.
Entry
<
String
,
Object
>
entry:
responseMap
.
entrySet
())
{
String
value
=
(
String
)
entry
.
getValue
();
if
(
value
.
startsWith
(
"$request"
))
{
entry
.
setValue
(
requestMap
.
get
(
value
.
split
(
"\\."
)[
1
]));
}
}
// 对response加密
printWriter
.
write
(
encryptConvertor
.
encrypt
(
JsonTransUtils
.
mapToJson
(
responseMap
)));
return
true
;
}
@Override
public
void
postHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
@Nullable
ModelAndView
modelAndView
)
throws
Exception
{
// 对请求加密
}
@Override
public
void
afterCompletion
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
@Nullable
Exception
ex
)
throws
Exception
{
log
.
info
(
"calling afterCompletion"
);
}
public
static
void
main
(
String
[]
args
)
{
}
}
src/main/java/cn/qg/qaplatform/mock/mapper/MockMapper.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
mapper
;
import
cn.qg.qaplatform.mock.entity.Mock
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
public
interface
MockMapper
extends
BaseMapper
<
Mock
>
{
}
src/main/java/cn/qg/qaplatform/mock/service/MockService.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
service
;
import
cn.qg.qaplatform.mock.entity.Mock
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.IService
;
public
interface
MockService
extends
IService
<
Mock
>
{
}
src/main/java/cn/qg/qaplatform/mock/service/impl/MockServiceImpl.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
mock
.
service
.
impl
;
import
cn.qg.qaplatform.config.SwitchDataSource
;
import
cn.qg.qaplatform.mock.entity.Mock
;
import
cn.qg.qaplatform.mock.mapper.MockMapper
;
import
cn.qg.qaplatform.mock.service.MockService
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
public
class
MockServiceImpl
extends
ServiceImpl
<
MockMapper
,
Mock
>
implements
MockService
{
}
src/main/java/cn/qg/qaplatform/stools/controller/JenkinsBuildController.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
stools
.
controller
;
import
cn.qg.qaplatform.stools.utils.JenkinsApi
;
import
cn.qg.qaplatform.stools.vo.JenkinsBuildInfo
;
import
cn.qg.qaplatform.utils.JsonResult
;
import
com.offbytwo.jenkins.model.Build
;
import
org.springframework.web.bind.annotation.*
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@CrossOrigin
@RestController
@RequestMapping
(
"/jenkins"
)
public
class
JenkinsBuildController
{
/**
* 获取构建信息列表
* @param jobName 任务名称
* @param num 获取的数量
* @param project 项目名,非必填
* @return 构建信息列表
* @throws IOException
*/
@GetMapping
(
"/buildlist"
)
public
JsonResult
getLatestBuildInfo
(
@RequestParam
String
jobName
,
@RequestParam
Integer
num
,
@RequestParam
(
required
=
false
)
String
project
)
throws
IOException
{
JenkinsApi
jenkinsApi
=
new
JenkinsApi
();
List
<
Build
>
buildList
;
if
(
project
==
null
)
{
buildList
=
jenkinsApi
.
getJobBuildList
(
jobName
,
num
);
}
else
{
buildList
=
jenkinsApi
.
getJobBuildList
(
jobName
,
num
,
project
);
}
List
<
JenkinsBuildInfo
>
jenkinsBuildInfoList
=
new
ArrayList
<>();
for
(
Build
build:
buildList
)
{
JenkinsBuildInfo
jenkinsBuildInfo
=
new
JenkinsBuildInfo
();
jenkinsBuildInfo
.
setProject
(
build
.
details
().
getParameters
().
get
(
"GIT_REPO"
));
jenkinsBuildInfo
.
setBranch
(
build
.
details
().
getParameters
().
get
(
"BRANCH_NAME"
));
jenkinsBuildInfo
.
setNamespace
(
build
.
details
().
getParameters
().
get
(
"NAMESPACE"
));
jenkinsBuildInfo
.
setUserName
(
build
.
details
().
getCauses
().
get
(
0
).
getUserName
());
jenkinsBuildInfo
.
setResult
(
build
.
details
().
getResult
().
toString
());
jenkinsBuildInfo
.
setCreateAt
(
new
Date
(
build
.
details
().
getTimestamp
()));
jenkinsBuildInfoList
.
add
(
jenkinsBuildInfo
);
}
return
JsonResult
.
success
(
jenkinsBuildInfoList
);
}
/**
* 获取job列表
* @return
*/
@GetMapping
(
"/joblist"
)
public
JsonResult
getJenkinsJobList
()
{
JenkinsApi
jenkinsApi
=
new
JenkinsApi
();
return
JsonResult
.
success
(
jenkinsApi
.
getJobList
());
}
}
src/main/java/cn/qg/qaplatform/stools/controller/KdspDecryptController.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
stools
.
controller
;
import
cn.qg.qaplatform.utils.JsonResult
;
import
cn.qg.qaplatform.stools.utils.kdsp.AESUtil
;
import
cn.qg.qaplatform.stools.utils.kdsp.RSA
;
import
cn.qg.qaplatform.stools.vo.EncryptRequest
;
import
com.alibaba.fastjson.JSON
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Date
;
import
java.util.UUID
;
@CrossOrigin
@Api
(
tags
=
"kdsp加解密接口"
)
@RestController
@RequestMapping
(
"/kdsp"
)
public
class
KdspDecryptController
{
private
final
String
APP_PRIMARY_KEY
=
"MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIZ/jCc0lcdcznjCybFPCGmI9oCnbvMzdCyta7X4Y4ygIOYAQ5vaNiPI2HAEh5X15jR/Cgr4x9YHLBuifKnJezWPmX+ZOYVFDwhlj7FkXS3TVyiuegykomdyg2LCpz06eyLAY+rMiz+ItqUGiemmqFZKfSD328VLaqCvRac5aWotAgMBAAECgYA8E1Kt3F4ee4S6Cf9/FFcklInOc3sqZEw6/IdE85q7oHaxZWLNhY1zNG4AsvVA9WILBsecmPzhy7hW66AVUqqWXA8jLIg/J3UyIRQo1sH9cX+3iERhNZluxXzxcX/UXrVQihyEFWZbehtpXFfPq1F7XzkTKy8qSodRLO79F8Tc/QJBAOF2vZ4Ah8GhiZP/KMYX7Q1fY5x/zTKmnNs1fJGDoRmgcF47Inzf2Ovjo+do/QdCf+Bzki6WG0AOpIHKksuw5r8CQQCYtttPfP8FKRxumcczNmkaKDWjrKElwRcGef5OuNBb7Crso9gUY+sL9/4kQHfmBfCS6KVbAA56RSdeSWFYZDYTAkA58pbRoTlDHw2JKC+Gmmem5Dlp478NoZz3Ckw16irht0aqMXCvv6i1GBDsTSObVhAf1BRiPNpMIHdPlI0eJR1pAkA7Oge6P0cEcFpHhrpb4UlHzLpo3QWuh8FvUJbRXxnn3KMVHcIqvkmlXauh0aLugfU4dKPUtCPpRbKr/ZeUWWEjAkAN5D5hH16RwrR6KN8W7t0gnlwOECPD8KbBQeWSja9r8C/yWMmr4RsWirBoDSYu4IG8jnrNcmYk8l1eAWmNyJWe"
;
@ApiOperation
(
value
=
"kdsp提交订单解密接口"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"data"
,
value
=
"待解密的json串"
,
required
=
true
)})
@GetMapping
(
"/decrypt"
)
public
JsonResult
decryptKdsp
(
String
data
)
throws
Exception
{
EncryptRequest
encryptRequest
=
JSON
.
parseObject
(
data
,
EncryptRequest
.
class
);
//使用服务端私钥对AES key进行解密
String
encryptKey
=
RSA
.
decryptFromBase64
(
encryptRequest
.
getEncryptKey
(),
APP_PRIMARY_KEY
);
String
result
=
AESUtil
.
decryptFromBase64
(
encryptRequest
.
getBody
(),
encryptKey
);
return
JsonResult
.
success
(
result
);
}
@ApiOperation
(
value
=
"kdsp提交订单加密接口"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"data"
,
value
=
"待加密的json串"
,
required
=
true
)})
@GetMapping
(
"/encrypt"
)
public
JsonResult
encryptKdsp
(
String
data
)
throws
Exception
{
EncryptRequest
encryptRequest
=
new
EncryptRequest
();
//加密过程
String
appId
=
"102"
;
String
SERVER_PUBLIC_KEY
=
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCGf4wnNJXHXM54wsmxTwhpiPaAp27zM3QsrWu1+GOMoCDmAEOb2jYjyNhwBIeV9eY0fwoK+MfWBywbonypyXs1j5l/mTmFRQ8IZY+xZF0t01cornoMpKJncoNiwqc9OnsiwGPqzIs/iLalBonppqhWSn0g99vFS2qgr0WnOWlqLQIDAQAB"
;
String
nonce
=
UUID
.
randomUUID
().
toString
();
String
timeStamp
=
DateFormatUtils
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
);
//生成AES key
String
randomKey
=
AESUtil
.
getRandomKey
();
//使用AES key对业务数据进行加密
String
encodeBody
=
AESUtil
.
encryptToBase64
(
data
,
randomKey
);
String
body
=
appId
+
nonce
+
timeStamp
+
encodeBody
;
//使用私钥进行签名
String
sign
=
RSA
.
sign
(
body
,
APP_PRIMARY_KEY
);
//使用服务端公钥对AES key进行加密
String
encryptKey
=
RSA
.
encryptToBase64
(
randomKey
,
SERVER_PUBLIC_KEY
);
encryptRequest
.
setAppId
(
appId
);
encryptRequest
.
setEncryptKey
(
encryptKey
);
encryptRequest
.
setBody
(
encodeBody
);
encryptRequest
.
setSign
(
sign
);
encryptRequest
.
setNonce
(
nonce
);
encryptRequest
.
setTimestamp
(
timeStamp
);
return
JsonResult
.
success
(
JSON
.
toJSONString
(
encryptRequest
));
}
}
src/main/java/cn/qg/qaplatform/stools/utils/JenkinsApi.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
stools
.
utils
;
import
com.offbytwo.jenkins.JenkinsServer
;
import
com.offbytwo.jenkins.model.*
;
import
java.io.IOException
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.util.*
;
/**
* 操作Jenkins的api
*/
public
class
JenkinsApi
{
// Jenkins 对象
private
JenkinsServer
jenkinsServer
;
// http 客户端对象
// private JenkinsHttpClient jenkinsHttpClient;
// 连接 Jenkins 需要设置的信息
static
final
String
JENKINS_URL
=
"http://192.168.4.96:8080/"
;
static
final
String
JENKINS_USERNAME
=
"qahome"
;
static
final
String
JENKINS_PASSWORD
=
"Quantgroup123"
;
/**
* 构造方法中调用连接 Jenkins 方法
*/
public
JenkinsApi
()
{
// 连接 Jenkins
try
{
jenkinsServer
=
new
JenkinsServer
(
new
URI
(
JENKINS_URL
),
JENKINS_USERNAME
,
JENKINS_PASSWORD
);
}
catch
(
URISyntaxException
e
)
{
e
.
printStackTrace
();
}
// 设置客户端连接 Jenkins
// try {
// jenkinsHttpClient = new JenkinsHttpClient(new URI(JENKINS_URL), JENKINS_USERNAME, JENKINS_PASSWORD);
// } catch (URISyntaxException e) {
// e.printStackTrace();
// }
}
/**
* 根据job名称获取job信息
*/
public
JobWithDetails
getJobInfoByName
(
String
jobName
)
{
try
{
JobWithDetails
job
=
jenkinsServer
.
getJob
(
jobName
);
return
job
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
* 获取job列表
* @return
*/
public
List
<
Map
<
String
,
String
>>
getJobList
()
{
try
{
Map
<
String
,
Job
>
jobs
=
jenkinsServer
.
getJobs
();
List
<
Map
<
String
,
String
>>
jobList
=
new
ArrayList
<>();
for
(
Job
job:
jobs
.
values
()){
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"value"
,
job
.
getName
());
map
.
put
(
"label"
,
job
.
getName
());
jobList
.
add
(
map
);
}
return
jobList
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
* 获取Job Build列表
*/
public
List
<
Build
>
getJobBuildList
(
String
jobName
,
Integer
num
)
{
try
{
// 获取 Job 信息
JobWithDetails
job
=
jenkinsServer
.
getJob
(
jobName
);
// 获取全部 Build 信息
Build
lastBuild
=
job
.
getLastBuild
();
int
lastBuildNumber
=
lastBuild
.
getNumber
();
List
<
Build
>
buildList
=
new
ArrayList
<>();
for
(
int
i
=
lastBuildNumber
;
i
>
lastBuildNumber
-
num
;
i
--)
{
Build
tempBuild
=
job
.
getBuildByNumber
(
i
);
if
(
tempBuild
==
null
)
{
return
buildList
;
}
else
{
buildList
.
add
(
job
.
getBuildByNumber
(
i
));
}
}
return
buildList
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
* 根据参数获取对应的build
*/
public
List
<
Build
>
getJobBuildList
(
String
jobName
,
Integer
num
,
String
project
)
{
try
{
// 获取 Job 信息
JobWithDetails
job
=
jenkinsServer
.
getJob
(
jobName
);
int
lastBuildNumber
=
job
.
getLastBuild
().
getNumber
();
List
<
Build
>
buildList
=
new
ArrayList
<>();
int
caculator
=
0
;
while
(
buildList
.
size
()
!=
num
)
{
Build
build
=
job
.
getBuildByNumber
(
lastBuildNumber
-
caculator
);
if
(
build
==
null
)
{
return
buildList
;
}
if
(
build
.
details
().
getParameters
().
get
(
"GIT_REPO"
).
equals
(
project
))
{
buildList
.
add
(
build
);
}
caculator
+=
1
;
}
return
buildList
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
JenkinsApi
jenkinsApi
=
new
JenkinsApi
();
List
<
Build
>
buildList
=
jenkinsApi
.
getJobBuildList
(
"tke-java"
,
1
,
"kdsp"
);
List
<
String
>
userList
=
new
ArrayList
<>();
for
(
Build
build:
buildList
)
{
System
.
out
.
println
(
build
.
details
().
getParameters
().
get
(
"BRANCH_NAME"
));
System
.
out
.
println
(
build
.
details
().
getParameters
().
get
(
"NAMESPACE"
));
System
.
out
.
println
(
build
.
details
().
getCauses
().
get
(
0
).
getUserName
());
userList
.
add
(
build
.
details
().
getCauses
().
get
(
0
).
getUserName
());
BuildResult
buildResult
=
build
.
details
().
getResult
();
System
.
out
.
println
(
buildResult
);
}
System
.
out
.
println
(
userList
.
size
());
}
}
src/main/java/cn/qg/qaplatform/stools/utils/kdsp/AESUtil.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
stools
.
utils
.
kdsp
;
import
javax.crypto.Cipher
;
import
javax.crypto.spec.IvParameterSpec
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.util.Base64
;
/**
* kdsp
* AES对称加密工具类
*/
public
class
AESUtil
{
private
static
final
String
CHAR_LIBRARY
=
"1234567890abcdefghijklmnopqrstuvwxyz"
;
private
static
final
int
KEY_SIZE
=
16
;
/**
* 生成16位随机密钥
*
* @return
*/
public
static
String
getRandomKey
()
{
StringBuilder
result
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
KEY_SIZE
;
i
++)
{
int
randomIdx
=
(
int
)
(
Math
.
random
()
*
(
CHAR_LIBRARY
.
length
()
-
1
));
result
.
append
(
CHAR_LIBRARY
.
charAt
(
randomIdx
));
}
return
result
.
toString
();
}
// 加密
public
static
String
encryptToBase64
(
String
sSrc
,
String
sKey
)
throws
Exception
{
if
(
sKey
==
null
)
{
System
.
out
.
print
(
"Key为空null"
);
return
null
;
}
// 判断Key是否为16位
if
(
sKey
.
length
()
!=
16
)
{
System
.
out
.
println
(
sKey
);
System
.
out
.
print
(
"Key长度不是16位"
);
return
null
;
}
byte
[]
raw
=
sKey
.
getBytes
(
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
for
(
byte
b
:
raw
)
{
System
.
out
.
println
(
"======"
+
b
);
}
SecretKeySpec
skeySpec
=
new
SecretKeySpec
(
raw
,
"AES"
);
Cipher
cipher
=
Cipher
.
getInstance
(
ConfigureEncryptAndDecrypt
.
AES_ALGORITHM
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
skeySpec
);
byte
[]
encrypted
=
cipher
.
doFinal
(
sSrc
.
getBytes
(
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
));
// 此处使用BASE64做转码功能,同时能起到2次加密的作用。
return
new
String
(
Base64
.
getEncoder
().
encode
(
encrypted
),
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
}
// 解密
public
static
String
decryptFromBase64
(
String
sSrc
,
String
sKey
)
throws
Exception
{
// 判断Key是否正确
if
(
sKey
==
null
)
{
System
.
out
.
print
(
"Key为空null"
);
return
null
;
}
// 判断Key是否为16位
if
(
sKey
.
length
()
!=
16
)
{
System
.
out
.
print
(
"Key长度不是16位"
);
return
null
;
}
// byte[] raw = sKey.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING);
byte
[]
raw
=
sKey
.
getBytes
();
// byte[] raw = sKey.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING);
SecretKeySpec
skeySpec
=
new
SecretKeySpec
(
raw
,
"AES"
);
Cipher
cipher
=
Cipher
.
getInstance
(
ConfigureEncryptAndDecrypt
.
AES_ALGORITHM
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
skeySpec
,
new
IvParameterSpec
(
raw
));
// 先用base64解密
byte
[]
encrypted1
=
Base64
.
getDecoder
().
decode
(
sSrc
.
getBytes
());
byte
[]
original
=
cipher
.
doFinal
(
encrypted1
);
return
new
String
(
original
);
// return new String(original, ConfigureEncryptAndDecrypt.CHAR_ENCODING);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
System
.
out
.
println
(
getRandomKey
());
}
/*
* 此处使用AES-128-ECB加密模式,key需要为16位。
String cKey = "12345678901a3456";
// 需要加密的字串
String cSrc = "www.gowhere.so中文";
System.out.println(cSrc);
// 加密
String enString = AES.encryptToBase64(cSrc, cKey);
System.out.println("加密后的字串是:" + enString);
// 解密
String DeString = AES.decryptFromBase64(enString, cKey);
System.out.println("解密后的字串是:" + DeString);*/
}
}
src/main/java/cn/qg/qaplatform/stools/utils/kdsp/ConfigureEncryptAndDecrypt.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
stools
.
utils
.
kdsp
;
public
class
ConfigureEncryptAndDecrypt
{
public
static
final
String
CHAR_ENCODING
=
"UTF-8"
;
// public static final String AES_ALGORITHM = "AES/ECB/PKCS5Padding"; // "算法/模式/补码方式"
public
static
final
String
AES_ALGORITHM
=
"AES/CBC/PKCS5Padding"
;
// "算法/模式/补码方式"
// public static final String AES_ALGORITHM = "AES/CBC/PKCS7Padding"; // "算法/模式/补码方式"
public
static
final
String
RSA_ALGORITHM
=
"RSA/ECB/PKCS1Padding"
;
// "算法/模式/补码方式"
}
\ No newline at end of file
src/main/java/cn/qg/qaplatform/stools/utils/kdsp/RSA.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
stools
.
utils
.
kdsp
;
import
java.security.Key
;
import
java.security.KeyFactory
;
import
java.security.KeyPair
;
import
java.security.KeyPairGenerator
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.security.SecureRandom
;
import
java.security.Signature
;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.security.spec.X509EncodedKeySpec
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.crypto.Cipher
;
/**
* kdsp
* RSA非对称加密工具类
*/
public
class
RSA
{
/** 指定key的大小 */
private
static
int
KEYSIZE
=
1024
;
/**
* 生成密钥对
*/
public
static
Map
<
String
,
String
>
generateKeyPair
()
throws
Exception
{
/** RSA算法要求有一个可信任的随机数源 */
SecureRandom
sr
=
new
SecureRandom
();
/** 为RSA算法创建一个KeyPairGenerator对象 */
KeyPairGenerator
kpg
=
KeyPairGenerator
.
getInstance
(
"RSA"
);
/** 利用上面的随机数据源初始化这个KeyPairGenerator对象 */
kpg
.
initialize
(
KEYSIZE
,
sr
);
/** 生成密匙对 */
KeyPair
kp
=
kpg
.
generateKeyPair
();
/** 得到公钥 */
Key
publicKey
=
kp
.
getPublic
();
byte
[]
publicKeyBytes
=
publicKey
.
getEncoded
();
String
pub
=
new
String
(
Base64
.
getEncoder
().
encode
(
publicKeyBytes
),
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
/** 得到私钥 */
Key
privateKey
=
kp
.
getPrivate
();
byte
[]
privateKeyBytes
=
privateKey
.
getEncoded
();
String
pri
=
new
String
(
Base64
.
getEncoder
().
encode
(
privateKeyBytes
),
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"publicKey"
,
pub
);
map
.
put
(
"privateKey"
,
pri
);
return
map
;
}
/**
* 使用私钥生成签名
* @param content
* @param privateKey
* @return
* @throws Exception
*/
public
static
String
sign
(
String
content
,
String
privateKey
)
throws
Exception
{
PrivateKey
priKey
=
getPrivateKey
(
privateKey
);
Signature
signature
=
Signature
.
getInstance
(
"SHA1WithRSA"
);
signature
.
initSign
(
priKey
);
signature
.
update
(
content
.
getBytes
(
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
));
byte
[]
signed
=
signature
.
sign
();
return
new
String
(
Base64
.
getEncoder
().
encode
(
signed
),
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
}
/**
* 使用公钥验证签名
* @param content
* @param sign 签名
* @param publicKey
* @return
* @throws Exception
*/
public
static
boolean
checkSign
(
String
content
,
String
sign
,
String
publicKey
)
throws
Exception
{
PublicKey
pubKey
=
getPublicKey
(
publicKey
);
Signature
signature
=
Signature
.
getInstance
(
"SHA1WithRSA"
);
signature
.
initVerify
(
pubKey
);
signature
.
update
(
content
.
getBytes
(
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
));
return
signature
.
verify
(
Base64
.
getDecoder
().
decode
(
sign
));
}
/**
* 加密方法
* @param source 明文
* @param publicKey 公钥
* @return
* @throws Exception
*/
public
static
String
encryptToBase64
(
String
source
,
String
publicKey
)
throws
Exception
{
Key
key
=
getPublicKey
(
publicKey
);
/** 得到Cipher对象来实现对源数据的RSA加密 */
Cipher
cipher
=
Cipher
.
getInstance
(
ConfigureEncryptAndDecrypt
.
RSA_ALGORITHM
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
key
);
byte
[]
b
=
source
.
getBytes
(
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
/** 执行加密操作 */
byte
[]
b1
=
cipher
.
doFinal
(
b
);
return
new
String
(
Base64
.
getEncoder
().
encode
(
b1
),
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
);
}
/**
* 解密算法
* @param cryptograph 密文
* @param privateKey 私钥
* @return
* @throws Exception
*/
public
static
String
decryptFromBase64
(
String
cryptograph
,
String
privateKey
)
throws
Exception
{
Key
key
=
getPrivateKey
(
privateKey
);
/** 得到Cipher对象对已用公钥加密的数据进行RSA解密 */
Cipher
cipher
=
Cipher
.
getInstance
(
ConfigureEncryptAndDecrypt
.
RSA_ALGORITHM
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
key
);
byte
[]
b1
=
Base64
.
getDecoder
().
decode
(
cryptograph
.
getBytes
());
/** 执行解密操作 */
byte
[]
b
=
cipher
.
doFinal
(
b1
);
return
new
String
(
b
);
}
/**
* 得到私钥
* @param key 密钥字符串(经过base64编码)
* @throws Exception
*/
private
static
PrivateKey
getPrivateKey
(
String
key
)
throws
Exception
{
PKCS8EncodedKeySpec
keySpec
=
new
PKCS8EncodedKeySpec
(
Base64
.
getDecoder
().
decode
(
key
.
getBytes
(
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
)));
KeyFactory
keyFactory
=
KeyFactory
.
getInstance
(
"RSA"
);
PrivateKey
privateKey
=
keyFactory
.
generatePrivate
(
keySpec
);
return
privateKey
;
}
/**
* 得到公钥
* @param key 密钥字符串(经过base64编码)
* @throws Exception
*/
private
static
PublicKey
getPublicKey
(
String
key
)
throws
Exception
{
X509EncodedKeySpec
keySpec
=
new
X509EncodedKeySpec
(
Base64
.
getDecoder
().
decode
(
key
.
getBytes
(
ConfigureEncryptAndDecrypt
.
CHAR_ENCODING
)));
KeyFactory
keyFactory
=
KeyFactory
.
getInstance
(
"RSA"
);
PublicKey
publicKey
=
keyFactory
.
generatePublic
(
keySpec
);
return
publicKey
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
KeyPairGenerator
kpg
=
KeyPairGenerator
.
getInstance
(
"RSA"
);
kpg
.
initialize
(
KEYSIZE
);
KeyPair
kp
=
kpg
.
generateKeyPair
();
String
privateKey
=
new
String
(
Base64
.
getEncoder
().
encode
(
kp
.
getPrivate
().
getEncoded
()));
String
publicKey
=
new
String
(
Base64
.
getEncoder
().
encode
(
kp
.
getPublic
().
getEncoded
()));
System
.
out
.
println
(
privateKey
);
System
.
out
.
println
(
publicKey
);
}
}
src/main/java/cn/qg/qaplatform/stools/vo/EncryptRequest.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
stools
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* kdsp提交订单加密相关
*/
@Data
public
class
EncryptRequest
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1660123609661052319L
;
private
String
appId
;
private
String
sign
;
private
String
nonce
;
private
String
timestamp
;
private
String
encryptKey
;
private
String
body
;
/**
* 下面是解密后的请求报文
*/
private
String
decBody
;
}
src/main/java/cn/qg/qaplatform/stools/vo/JenkinsBuildInfo.java
0 → 100644
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
stools
.
vo
;
import
lombok.Data
;
import
java.util.Date
;
/**
* Jenkins 构建信息
*/
@Data
public
class
JenkinsBuildInfo
{
public
String
namespace
;
public
String
project
;
public
String
branch
;
public
String
userName
;
public
String
result
;
public
Date
createAt
;
}
src/main/java/cn/qg/qaplatform/utils/DBUtils.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
utils
;
package
cn
.
qg
.
qaplatform
.
utils
;
import
cn.qg.qaplatform.
common.
enums.Namespace
;
import
cn.qg.qaplatform.enums.Namespace
;
import
org.apache.commons.dbutils.QueryRunner
;
import
org.apache.commons.dbutils.QueryRunner
;
import
java.sql.*
;
import
java.sql.*
;
...
...
src/main/java/cn/qg/qaplatform/
common
/JsonResult.java
→
src/main/java/cn/qg/qaplatform/
utils
/JsonResult.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
common
;
package
cn
.
qg
.
qaplatform
.
utils
;
import
cn.qg.qaplatform.
common.
enums.ErrorType
;
import
cn.qg.qaplatform.enums.ErrorType
;
import
lombok.Data
;
import
lombok.Data
;
/**
/**
...
...
src/main/java/cn/qg/qaplatform/
utils
/Encrypt/LexinEncrypt.java
→
src/main/java/cn/qg/qaplatform/
zdata
/Encrypt/LexinEncrypt.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
utils
.
Encrypt
;
package
cn
.
qg
.
qaplatform
.
zdata
.
Encrypt
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
src/main/java/cn/qg/qaplatform/zdata/controller/
GenVcc
Controller.java
→
src/main/java/cn/qg/qaplatform/zdata/controller/
vcc/VccGen
Controller.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
controller
;
package
cn
.
qg
.
qaplatform
.
zdata
.
controller
.
vcc
;
import
cn.qg.qaplatform.
common
.JsonResult
;
import
cn.qg.qaplatform.
utils
.JsonResult
;
import
cn.qg.qaplatform.zdata.
domain.GenVccUser
;
import
cn.qg.qaplatform.zdata.
entity.VccOpenResultVo
;
import
cn.qg.qaplatform.zdata.service.VccDataService
;
import
cn.qg.qaplatform.zdata.service.
vcc.
VccDataService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.*;
...
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RestController
@RequestMapping
(
"vcc"
)
@RequestMapping
(
"vcc"
)
@Api
(
tags
=
"vcc造数据"
)
@Api
(
tags
=
"vcc造数据"
)
public
class
GenVcc
Controller
{
public
class
VccGen
Controller
{
@Autowired
@Autowired
VccDataService
vccDataService
;
VccDataService
vccDataService
;
...
@@ -29,7 +29,7 @@ public class GenVccController {
...
@@ -29,7 +29,7 @@ public class GenVccController {
if
(!
channel
.
equals
(
"214"
)
&&
!
channel
.
equals
(
"217"
))
{
if
(!
channel
.
equals
(
"214"
)
&&
!
channel
.
equals
(
"217"
))
{
return
JsonResult
.
clientFailed
(
"渠道必须为214或217"
);
return
JsonResult
.
clientFailed
(
"渠道必须为214或217"
);
}
}
GenVccUser
result
=
vccDataService
.
makeVccUser
(
namespace
,
phoneNo
,
channel
,
status
);
VccOpenResultVo
result
=
vccDataService
.
makeVccUser
(
namespace
,
phoneNo
,
channel
,
status
);
if
(
result
==
null
)
{
if
(
result
==
null
)
{
return
JsonResult
.
serverFailed
();
return
JsonResult
.
serverFailed
();
}
}
...
...
src/main/java/cn/qg/qaplatform/zdata/controller/
QueryVcc
Controller.java
→
src/main/java/cn/qg/qaplatform/zdata/controller/
vcc/VccQuery
Controller.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
controller
;
package
cn
.
qg
.
qaplatform
.
zdata
.
controller
.
vcc
;
import
cn.qg.qaplatform.
common
.JsonResult
;
import
cn.qg.qaplatform.
utils
.JsonResult
;
import
cn.qg.qaplatform.zdata.enums.VccStatusEnum
;
import
cn.qg.qaplatform.zdata.enums.VccStatusEnum
;
import
cn.qg.qaplatform.zdata.
domain.QueryVccUser
;
import
cn.qg.qaplatform.zdata.
entity.VccUserEntity
;
import
cn.qg.qaplatform.zdata.service.VccDataService
;
import
cn.qg.qaplatform.zdata.service.
vcc.
VccDataService
;
import
cn.qg.qaplatform.utils.page.PageResult
;
import
cn.qg.qaplatform.utils.page.PageResult
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -12,9 +13,10 @@ import java.util.HashMap;
...
@@ -12,9 +13,10 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Map
;
@CrossOrigin
@CrossOrigin
@Api
(
tags
=
"vcc查询"
)
@RestController
@RestController
@RequestMapping
(
"/vcc"
)
@RequestMapping
(
"/vcc"
)
public
class
QueryVcc
Controller
{
public
class
VccQuery
Controller
{
@Autowired
@Autowired
VccDataService
vccDataService
;
VccDataService
vccDataService
;
...
@@ -30,27 +32,27 @@ public class QueryVccController {
...
@@ -30,27 +32,27 @@ public class QueryVccController {
@GetMapping
(
"/getStatus"
)
@GetMapping
(
"/getStatus"
)
public
JsonResult
getUserStatus
(
String
namespace
,
String
phoneNo
)
{
public
JsonResult
getUserStatus
(
String
namespace
,
String
phoneNo
)
{
QueryVccUser
queryVccUser
=
vccDataService
.
queryUserVccStatus
(
namespace
,
phoneNo
);
VccUserEntity
vccUserEntity
=
vccDataService
.
queryUserVccStatus
(
namespace
,
phoneNo
);
if
(
queryVccUser
==
null
)
{
if
(
vccUserEntity
==
null
)
{
return
JsonResult
.
serverFailed
(
"该用户不存在!"
);
return
JsonResult
.
serverFailed
(
"该用户不存在!"
);
}
}
return
JsonResult
.
success
(
queryVccUser
);
return
JsonResult
.
success
(
vccUserEntity
);
}
}
@GetMapping
(
"/checkData"
)
@GetMapping
(
"/checkData"
)
public
JsonResult
checkUserData
(
String
namespace
,
String
phoneNo
,
String
idCardNo
)
{
public
JsonResult
checkUserData
(
String
namespace
,
String
phoneNo
,
String
idCardNo
)
{
QueryVccUser
queryVccUser
=
vccDataService
.
queryUserVccStatus
(
namespace
,
phoneNo
);
VccUserEntity
vccUserEntity
=
vccDataService
.
queryUserVccStatus
(
namespace
,
phoneNo
);
if
(
queryVccUser
==
null
)
{
if
(
vccUserEntity
==
null
)
{
return
JsonResult
.
serverFailed
(
"该用户不存在!"
);
return
JsonResult
.
serverFailed
(
"该用户不存在!"
);
}
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"phoneNo"
,
queryVccUser
.
getPhoneNo
());
map
.
put
(
"phoneNo"
,
vccUserEntity
.
getPhoneNo
());
map
.
put
(
"userId"
,
queryVccUser
.
getUserId
());
map
.
put
(
"userId"
,
vccUserEntity
.
getUserId
());
map
.
put
(
"uuid"
,
queryVccUser
.
getUuid
());
map
.
put
(
"uuid"
,
vccUserEntity
.
getUuid
());
map
.
put
(
"registeredFrom"
,
queryVccUser
.
getRegisteredFrom
());
map
.
put
(
"registeredFrom"
,
vccUserEntity
.
getRegisteredFrom
());
map
.
put
(
"nextApplyTime"
,
queryVccUser
.
getNextApplyTime
());
map
.
put
(
"nextApplyTime"
,
vccUserEntity
.
getNextApplyTime
());
map
.
put
(
"createdAt"
,
queryVccUser
.
getCreatedAt
());
map
.
put
(
"createdAt"
,
vccUserEntity
.
getCreatedAt
());
map
.
put
(
"status"
,
VccStatusEnum
.
getDescByCode
(
queryVccUser
.
getStatus
()));
map
.
put
(
"status"
,
VccStatusEnum
.
getDescByCode
(
vccUserEntity
.
getStatus
()));
return
JsonResult
.
success
(
map
);
return
JsonResult
.
success
(
map
);
}
}
}
}
src/main/java/cn/qg/qaplatform/zdata/controller/
GenLoanUserData
Controller.java
→
src/main/java/cn/qg/qaplatform/zdata/controller/
xyqb/XyqbGen
Controller.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
controller
;
package
cn
.
qg
.
qaplatform
.
zdata
.
controller
.
xyqb
;
import
cn.qg.qaplatform.
common
.JsonResult
;
import
cn.qg.qaplatform.
utils
.JsonResult
;
import
cn.qg.qaplatform.zdata.enums.ChannelEnum
;
import
cn.qg.qaplatform.zdata.enums.ChannelEnum
;
import
cn.qg.qaplatform.zdata.enums.FundEnum
;
import
cn.qg.qaplatform.zdata.enums.FundEnum
;
import
cn.qg.qaplatform.zdata.
domain.
ApplyDataVo
;
import
cn.qg.qaplatform.zdata.
entity.Xyqb
ApplyDataVo
;
import
cn.qg.qaplatform.zdata.
domain.GenLoanUser
;
import
cn.qg.qaplatform.zdata.
entity.XjfqGenProcessVo
;
import
cn.qg.qaplatform.zdata.service.LexinDataService
;
import
cn.qg.qaplatform.zdata.service.
xyqb.
LexinDataService
;
import
cn.qg.qaplatform.zdata.service.
Xyqb
DataService
;
import
cn.qg.qaplatform.zdata.service.
xyqb.XyqbGen
DataService
;
import
cn.qg.qaplatform.zdata.service.
QueryBasicLoanStatusData
Service
;
import
cn.qg.qaplatform.zdata.service.
xyqb.XyqbBasicQuery
Service
;
import
cn.qg.qaplatform.utils.EnumUtils
;
import
cn.qg.qaplatform.utils.EnumUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -21,29 +21,29 @@ import java.util.Map;
...
@@ -21,29 +21,29 @@ import java.util.Map;
@RestController
@RestController
@CrossOrigin
@CrossOrigin
@RequestMapping
(
"/gen"
)
@RequestMapping
(
"/
xyqb/
gen"
)
@Api
(
tags
=
"造数据相关接口"
)
@Api
(
tags
=
"造数据相关接口"
)
public
class
GenLoanUserData
Controller
{
public
class
XyqbGen
Controller
{
@Autowired
@Autowired
Xyqb
DataService
xyqb
DataService
;
Xyqb
GenDataService
xyqbGen
DataService
;
@Autowired
@Autowired
LexinDataService
lexinDataService
;
LexinDataService
lexinDataService
;
@Autowired
@Autowired
QueryBasicLoanStatusDataService
queryBasicLoanStatusData
Service
;
XyqbBasicQueryService
xyqbBasicQuery
Service
;
@ApiOperation
(
value
=
"造数据接口"
)
@ApiOperation
(
value
=
"造数据接口"
)
@PostMapping
(
"/data"
)
@PostMapping
(
"/data"
)
public
JsonResult
genLoanUserData
(
@RequestBody
ApplyDataVo
a
pplyDataVo
)
throws
Exception
{
public
JsonResult
genLoanUserData
(
@RequestBody
XyqbApplyDataVo
xyqbA
pplyDataVo
)
throws
Exception
{
boolean
result
=
false
;
boolean
result
=
false
;
if
(
applyDataVo
.
getChannel
().
equals
(
ChannelEnum
.
XYQB
.
getChannelId
()))
{
if
(
xyqbApplyDataVo
.
getChannel
().
equals
(
ChannelEnum
.
XYQB
.
getChannelId
()))
{
result
=
xyqbDataService
.
genLoanUser
(
applyDataVo
);
result
=
xyqbGenDataService
.
genLoanUser
(
xyqbApplyDataVo
);
}
if
(
applyDataVo
.
getChannel
().
equals
(
ChannelEnum
.
LEXIN
.
getChannelId
()))
{
result
=
lexinDataService
.
genLexinData
(
applyDataVo
);
}
}
// if (xyqbApplyDataVo.getChannel().equals(ChannelEnum.LEXIN.getChannelId())) {
// result = lexinDataService.genLexinData(xyqbApplyDataVo);
// }
return
JsonResult
.
success
(
result
);
return
JsonResult
.
success
(
result
);
}
}
...
@@ -62,8 +62,8 @@ public class GenLoanUserDataController {
...
@@ -62,8 +62,8 @@ public class GenLoanUserDataController {
@GetMapping
(
"/userStatus"
)
@GetMapping
(
"/userStatus"
)
public
JsonResult
queryUserStatus
(
@RequestParam
String
namespace
,
public
JsonResult
queryUserStatus
(
@RequestParam
String
namespace
,
@RequestParam
String
phoneNo
)
{
@RequestParam
String
phoneNo
)
{
GenLoanUser
genLoanUser
=
xyqb
DataService
.
queryUserStatus
(
namespace
,
phoneNo
);
XjfqGenProcessVo
xjfqGenProcessVo
=
xyqbGen
DataService
.
queryUserStatus
(
namespace
,
phoneNo
);
return
JsonResult
.
success
(
genLoanUser
);
return
JsonResult
.
success
(
xjfqGenProcessVo
);
}
}
@GetMapping
(
"/channelMappedFund"
)
@GetMapping
(
"/channelMappedFund"
)
...
...
src/main/java/cn/qg/qaplatform/zdata/controller/
QueryLoanUserData
Controller.java
→
src/main/java/cn/qg/qaplatform/zdata/controller/
xyqb/XyqbQuery
Controller.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
controller
;
package
cn
.
qg
.
qaplatform
.
zdata
.
controller
.
xyqb
;
import
cn.qg.qaplatform.zdata.service.
QueryLoanUserData
Service
;
import
cn.qg.qaplatform.zdata.service.
xyqb.XyqbQuery
Service
;
import
cn.qg.qaplatform.
common
.JsonResult
;
import
cn.qg.qaplatform.
utils
.JsonResult
;
import
cn.qg.qaplatform.zdata.service.
QueryBasicLoanStatusData
Service
;
import
cn.qg.qaplatform.zdata.service.
xyqb.XyqbBasicQuery
Service
;
import
cn.qg.qaplatform.utils.page.PageResult
;
import
cn.qg.qaplatform.utils.page.PageResult
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
...
@@ -16,15 +16,15 @@ import java.util.Map;
...
@@ -16,15 +16,15 @@ import java.util.Map;
@CrossOrigin
@CrossOrigin
@RestController
@RestController
@RequestMapping
(
"query"
)
@RequestMapping
(
"
/xyqb/
query"
)
@Api
(
tags
=
"捞数据相关接口"
)
@Api
(
tags
=
"捞数据相关接口"
)
public
class
QueryLoanUserData
Controller
{
public
class
XyqbQuery
Controller
{
@Autowired
@Autowired
private
QueryBasicLoanStatusData
Service
basicLoanStatusDataService
;
private
XyqbBasicQuery
Service
basicLoanStatusDataService
;
@Autowired
@Autowired
private
QueryLoanUserData
Service
loanUserDataService
;
private
XyqbQuery
Service
loanUserDataService
;
/**
/**
* @return 获取所有借款用户状态
* @return 获取所有借款用户状态
...
...
src/main/java/cn/qg/qaplatform/zdata/
domain/GenVccUser
.java
→
src/main/java/cn/qg/qaplatform/zdata/
entity/VccOpenResultVo
.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
domain
;
package
cn
.
qg
.
qaplatform
.
zdata
.
entity
;
import
lombok.Data
;
import
lombok.Data
;
/**
* vcc造数据结果页信息
*/
@Data
@Data
public
class
GenVccUser
{
public
class
VccOpenResultVo
{
/**
/**
* 手机号
* 手机号
*/
*/
...
...
src/main/java/cn/qg/qaplatform/zdata/
domain/QueryVccUser
.java
→
src/main/java/cn/qg/qaplatform/zdata/
entity/VccUserEntity
.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
domain
;
package
cn
.
qg
.
qaplatform
.
zdata
.
entity
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -8,27 +8,27 @@ import java.util.Date;
...
@@ -8,27 +8,27 @@ import java.util.Date;
* 捞数据返回的享花卡用户实体类
* 捞数据返回的享花卡用户实体类
*/
*/
@Data
@Data
public
class
QueryVccUser
{
public
class
VccUserEntity
{
p
ublic
String
phoneNo
;
p
rivate
String
phoneNo
;
p
ublic
String
userId
;
p
rivate
String
userId
;
p
ublic
String
uuid
;
p
rivate
String
uuid
;
/**
/**
* 注册渠道
* 注册渠道
*/
*/
p
ublic
Long
registeredFrom
;
p
rivate
Long
registeredFrom
;
/**
/**
* 过期时间
* 过期时间
*/
*/
p
ublic
Date
nextApplyTime
;
p
rivate
Date
nextApplyTime
;
/**
/**
* 创建时间
* 创建时间
*/
*/
p
ublic
Date
createdAt
;
p
rivate
Date
createdAt
;
/**
/**
* CREATED("初始状态"), // 0
* CREATED("初始状态"), // 0
...
@@ -40,5 +40,10 @@ public class QueryVccUser {
...
@@ -40,5 +40,10 @@ public class QueryVccUser {
* XYQB_OPEN_SUCC("信用钱包开户成功"), // 6
* XYQB_OPEN_SUCC("信用钱包开户成功"), // 6
* XYQB_OPEN_FAILED("信用钱包开户失败"), // 7
* XYQB_OPEN_FAILED("信用钱包开户失败"), // 7
*/
*/
public
Integer
status
;
private
Integer
status
;
/**
* 账号类别:vcc/scacard/xyqb_mall'
*/
private
String
type
;
}
}
src/main/java/cn/qg/qaplatform/zdata/
domain/GenLoanUser
.java
→
src/main/java/cn/qg/qaplatform/zdata/
entity/XjfqGenProcessVo
.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
domain
;
package
cn
.
qg
.
qaplatform
.
zdata
.
entity
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.Date
;
/**
* 现金分期造数据过程中
*/
@Data
@Data
public
class
GenLoanUser
{
public
class
XjfqGenProcessVo
{
/**
/**
* 手机号
* 手机号
*/
*/
...
...
src/main/java/cn/qg/qaplatform/zdata/
domain/QueryLoanUser
.java
→
src/main/java/cn/qg/qaplatform/zdata/
entity/XjfqUserEntity
.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
domain
;
package
cn
.
qg
.
qaplatform
.
zdata
.
entity
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -7,7 +7,7 @@ import java.util.Date;
...
@@ -7,7 +7,7 @@ import java.util.Date;
* 捞数据返回的用户实体类
* 捞数据返回的用户实体类
*/
*/
@Data
@Data
public
class
QueryLoanUser
{
public
class
XjfqUserEntity
{
/**
/**
* 手机号
* 手机号
*/
*/
...
...
src/main/java/cn/qg/qaplatform/zdata/
domain/
ApplyDataVo.java
→
src/main/java/cn/qg/qaplatform/zdata/
entity/Xyqb
ApplyDataVo.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
domain
;
package
cn
.
qg
.
qaplatform
.
zdata
.
entity
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull;
...
@@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull;
* 造数据传递的参数实体类
* 造数据传递的参数实体类
*/
*/
@Data
@Data
public
class
ApplyDataVo
{
public
class
Xyqb
ApplyDataVo
{
@NotNull
(
message
=
"借款状态不能为空!"
)
@NotNull
(
message
=
"借款状态不能为空!"
)
private
Integer
status
;
private
Integer
status
;
...
...
src/main/java/cn/qg/qaplatform/zdata/enums/ChannelEnum.java
View file @
88e47805
...
@@ -5,8 +5,8 @@ package cn.qg.qaplatform.zdata.enums;
...
@@ -5,8 +5,8 @@ package cn.qg.qaplatform.zdata.enums;
*/
*/
public
enum
ChannelEnum
{
public
enum
ChannelEnum
{
XYQB
(
"信用钱包"
,
1
)
,
XYQB
(
"信用钱包"
,
1
)
;
LEXIN
(
"乐信"
,
159886
);
//
LEXIN("乐信", 159886);
private
String
name
;
private
String
name
;
private
Integer
channelId
;
private
Integer
channelId
;
...
...
src/main/java/cn/qg/qaplatform/zdata/enums/FundEnum.java
View file @
88e47805
...
@@ -7,8 +7,8 @@ public enum FundEnum {
...
@@ -7,8 +7,8 @@ public enum FundEnum {
GYXD
(
"广达小贷"
,
480
),
GYXD
(
"广达小贷"
,
480
),
YNXT
(
"云南信托"
,
1040
),
YNXT
(
"云南信托"
,
1040
),
PDSB
(
"平顶山银行"
,
1030
)
,
PDSB
(
"平顶山银行"
,
1030
)
;
GDLX
(
"广达乐信"
,
1010
);
//
GDLX("广达乐信",1010);
private
String
name
;
private
String
name
;
private
Integer
fundId
;
private
Integer
fundId
;
...
...
src/main/java/cn/qg/qaplatform/zdata/mapper/
Query
VccDataMapper.java
→
src/main/java/cn/qg/qaplatform/zdata/mapper/VccDataMapper.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
mapper
;
package
cn
.
qg
.
qaplatform
.
zdata
.
mapper
;
import
cn.qg.qaplatform.zdata.
domain.QueryVccUser
;
import
cn.qg.qaplatform.zdata.
entity.VccUserEntity
;
import
java.util.List
;
import
java.util.List
;
public
interface
Query
VccDataMapper
{
public
interface
VccDataMapper
{
/**
/**
* 根据状态获取vcc用户
* 根据状态获取vcc用户
*/
*/
List
<
QueryVccUser
>
queryVccDataByStatus
(
Integer
status
);
List
<
VccUserEntity
>
queryVccDataByStatus
(
Integer
status
);
/**
/**
* 查看用户vcc状态
* 查看用户vcc状态
*/
*/
QueryVccUser
queryUserVccStatus
(
String
phoneNo
);
VccUserEntity
queryUserVccStatus
(
String
phoneNo
);
}
}
src/main/java/cn/qg/qaplatform/zdata/mapper/
QueryBasicLoanStatus
DataMapper.java
→
src/main/java/cn/qg/qaplatform/zdata/mapper/
XyqbLoan
DataMapper.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
mapper
;
package
cn
.
qg
.
qaplatform
.
zdata
.
mapper
;
import
cn.qg.qaplatform.zdata.
domain.GenLoanUser
;
import
cn.qg.qaplatform.zdata.
entity.XjfqGenProcessVo
;
import
cn.qg.qaplatform.zdata.
domain.QueryLoanUser
;
import
cn.qg.qaplatform.zdata.
entity.XjfqUserEntity
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
public
interface
QueryBasicLoanStatus
DataMapper
{
public
interface
XyqbLoan
DataMapper
{
/**
/**
* 根据uuidList获取用户数据信息
* 根据uuidList获取用户数据信息
* @param uuidList
* @param uuidList
* @return
* @return
*/
*/
List
<
QueryLoanUser
>
getUserDataListByUuidList
(
List
<
String
>
uuidList
);
List
<
XjfqUserEntity
>
getUserDataListByUuidList
(
List
<
String
>
uuidList
);
/**
/**
* 获取未申请用户数据uuidList
* 获取未申请用户数据uuidList
...
@@ -32,7 +32,7 @@ public interface QueryBasicLoanStatusDataMapper {
...
@@ -32,7 +32,7 @@ public interface QueryBasicLoanStatusDataMapper {
* @param userIdList
* @param userIdList
* @return
* @return
*/
*/
List
<
QueryLoanUser
>
getUserDataListByUserIdList
(
List
<
String
>
userIdList
);
List
<
XjfqUserEntity
>
getUserDataListByUserIdList
(
List
<
String
>
userIdList
);
/**
/**
* 根据审核状态获取用户Id列表
* 根据审核状态获取用户Id列表
...
@@ -69,7 +69,7 @@ public interface QueryBasicLoanStatusDataMapper {
...
@@ -69,7 +69,7 @@ public interface QueryBasicLoanStatusDataMapper {
*/
*/
Integer
getAssignFundIdByUserId
(
String
userId
);
Integer
getAssignFundIdByUserId
(
String
userId
);
GenLoanUser
getUserInfoByPhoneNo
(
String
phoneNo
);
XjfqGenProcessVo
getUserInfoByPhoneNo
(
String
phoneNo
);
Integer
getLoanProgressByUserId
(
String
userId
);
Integer
getLoanProgressByUserId
(
String
userId
);
}
}
src/main/java/cn/qg/qaplatform/zdata/process/Common.java
View file @
88e47805
...
@@ -2,7 +2,7 @@ package cn.qg.qaplatform.zdata.process;
...
@@ -2,7 +2,7 @@ package cn.qg.qaplatform.zdata.process;
import
cn.qg.qaplatform.config.WebSocketServer
;
import
cn.qg.qaplatform.config.WebSocketServer
;
import
cn.qg.qaplatform.utils.DBUtils
;
import
cn.qg.qaplatform.utils.DBUtils
;
import
cn.qg.qaplatform.
utils
.Encrypt.LexinEncrypt
;
import
cn.qg.qaplatform.
zdata
.Encrypt.LexinEncrypt
;
import
cn.qg.qaplatform.utils.HttpClientUtils
;
import
cn.qg.qaplatform.utils.HttpClientUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
...
src/main/java/cn/qg/qaplatform/zdata/process/Lexin.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
process
;
package
cn
.
qg
.
qaplatform
.
zdata
.
process
;
import
cn.qg.qaplatform.config.WebSocketServer
;
import
cn.qg.qaplatform.config.WebSocketServer
;
import
cn.qg.qaplatform.zdata.
domain.
ApplyDataVo
;
import
cn.qg.qaplatform.zdata.
entity.Xyqb
ApplyDataVo
;
import
cn.qg.qaplatform.
utils
.Encrypt.LexinEncrypt
;
import
cn.qg.qaplatform.
zdata
.Encrypt.LexinEncrypt
;
import
cn.qg.qaplatform.utils.HttpClientUtils
;
import
cn.qg.qaplatform.utils.HttpClientUtils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -24,17 +24,17 @@ public class Lexin {
...
@@ -24,17 +24,17 @@ public class Lexin {
/**
/**
* 进件
* 进件
*/
*/
public
static
boolean
createOrder
(
ApplyDataVo
a
pplyDataVo
)
{
public
static
boolean
createOrder
(
XyqbApplyDataVo
xyqbA
pplyDataVo
)
{
String
namespace
=
a
pplyDataVo
.
getNamespace
();
String
namespace
=
xyqbA
pplyDataVo
.
getNamespace
();
String
phoneNo
=
a
pplyDataVo
.
getPhoneNo
();
String
phoneNo
=
xyqbA
pplyDataVo
.
getPhoneNo
();
String
userName
=
a
pplyDataVo
.
getName
();
String
userName
=
xyqbA
pplyDataVo
.
getName
();
String
idCardNo
=
a
pplyDataVo
.
getIdCardNo
();
String
idCardNo
=
xyqbA
pplyDataVo
.
getIdCardNo
();
Integer
amount
=
a
pplyDataVo
.
getAmount
();
Integer
amount
=
xyqbA
pplyDataVo
.
getAmount
();
Integer
term
=
a
pplyDataVo
.
getTerm
();
Integer
term
=
xyqbA
pplyDataVo
.
getTerm
();
String
rate
=
a
pplyDataVo
.
getRate
();
String
rate
=
xyqbA
pplyDataVo
.
getRate
();
String
fixedBillDay
=
a
pplyDataVo
.
getFixedBillDay
();
String
fixedBillDay
=
xyqbA
pplyDataVo
.
getFixedBillDay
();
String
fixedRepayDay
=
a
pplyDataVo
.
getFixedRepayDay
();
String
fixedRepayDay
=
xyqbA
pplyDataVo
.
getFixedRepayDay
();
String
symbol
=
a
pplyDataVo
.
getSymbol
();
String
symbol
=
xyqbA
pplyDataVo
.
getSymbol
();
String
orderNo
=
"channel_order"
+
phoneNo
+
"_"
+
random
.
nextInt
(
9999
);
String
orderNo
=
"channel_order"
+
phoneNo
+
"_"
+
random
.
nextInt
(
9999
);
String
url
=
"http://qapi-"
+
namespace
+
".liangkebang.net/ex/api/v2/applyLoan/LEXIN"
;
String
url
=
"http://qapi-"
+
namespace
+
".liangkebang.net/ex/api/v2/applyLoan/LEXIN"
;
...
...
src/main/java/cn/qg/qaplatform/zdata/process/Vcc.java
View file @
88e47805
...
@@ -194,7 +194,7 @@ public class Vcc {
...
@@ -194,7 +194,7 @@ public class Vcc {
/**
/**
* 授信结果查询
* 授信结果查询
*/
*/
public
static
void
searchCreditResult
(
String
namespace
,
String
token
,
String
vccChannel
)
throws
URISyntaxException
{
public
static
Map
<
String
,
Object
>
searchCreditResult
(
String
namespace
,
String
token
,
String
vccChannel
)
throws
URISyntaxException
{
String
url
=
"https://talos-"
+
namespace
+
".liangkebang.net/vcc/xyqb_mall/credit_info"
;
String
url
=
"https://talos-"
+
namespace
+
".liangkebang.net/vcc/xyqb_mall/credit_info"
;
Map
<
String
,
Object
>
headers
=
new
HashMap
<>();
Map
<
String
,
Object
>
headers
=
new
HashMap
<>();
headers
.
put
(
"x-auth-token"
,
token
);
headers
.
put
(
"x-auth-token"
,
token
);
...
@@ -202,6 +202,8 @@ public class Vcc {
...
@@ -202,6 +202,8 @@ public class Vcc {
headers
.
put
(
"content-type"
,
"application/x-www-form-urlencoded"
);
headers
.
put
(
"content-type"
,
"application/x-www-form-urlencoded"
);
JSONObject
result
=
HttpClientUtils
.
doGetReturnJson
(
url
,
null
,
headers
);
JSONObject
result
=
HttpClientUtils
.
doGetReturnJson
(
url
,
null
,
headers
);
log
.
info
(
"授信结果查询:"
+
result
);
log
.
info
(
"授信结果查询:"
+
result
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
result
.
get
(
"data"
);
return
map
;
}
}
/**
/**
...
@@ -217,15 +219,15 @@ public class Vcc {
...
@@ -217,15 +219,15 @@ public class Vcc {
/**
/**
* vcc风控授信回调
* vcc风控授信回调
*/
*/
public
static
void
vccWindControlCreditCallback
(
String
namespace
,
String
uuid
,
String
riskNo
)
{
public
static
void
vccWindControlCreditCallback
(
String
namespace
,
String
uuid
,
String
riskNo
,
boolean
auditResult
)
{
String
url
=
"https://talos-"
+
namespace
+
".liangkebang.net/ex/vcc/risk/auth_amount_completion"
;
String
url
=
"https://talos-"
+
namespace
+
".liangkebang.net/ex/vcc/risk/auth_amount_completion"
;
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
Calendar
.
DAY_OF_YEAR
,
calendar
.
get
(
Calendar
.
DAY_OF_YEAR
)
+
15
);
calendar
.
set
(
Calendar
.
DAY_OF_YEAR
,
calendar
.
get
(
Calendar
.
DAY_OF_YEAR
)
+
15
);
long
openingDeadLine
=
calendar
.
getTimeInMillis
();
long
openingDeadLine
=
calendar
.
getTimeInMillis
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"amount"
,
10000
);
params
.
put
(
"amount"
,
10000
);
params
.
put
(
"auditResult"
,
true
);
params
.
put
(
"auditResult"
,
auditResult
);
params
.
put
(
"bizChannel"
,
1
);
params
.
put
(
"bizChannel"
,
1
59904
);
params
.
put
(
"bizNo"
,
riskNo
);
params
.
put
(
"bizNo"
,
riskNo
);
params
.
put
(
"code"
,
0
);
params
.
put
(
"code"
,
0
);
params
.
put
(
"deadLine"
,
"1640966399000"
);
params
.
put
(
"deadLine"
,
"1640966399000"
);
...
@@ -345,7 +347,10 @@ public class Vcc {
...
@@ -345,7 +347,10 @@ public class Vcc {
return
true
;
return
true
;
}
}
public
static
void
main
(
String
[]
args
)
throws
SQLException
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
vccWindControlCreditCallback
(
"vc2"
,
"1"
,
""
);
Map
<
String
,
String
>
loginResult
=
login
(
"vcc3"
,
"18300000418"
,
"214"
,
"214"
);
String
uuid
=
loginResult
.
get
(
"uuid"
);
String
riskNo
=
getRiskNo
(
"vcc3"
,
uuid
);
vccWindControlCreditCallback
(
"vcc3"
,
"1"
,
riskNo
,
true
);
}
}
}
}
src/main/java/cn/qg/qaplatform/zdata/service/RuleEngineService.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
risk/
RuleEngineService.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
risk
;
/**
/**
* 风控相关
接口
* 风控相关
服务
*/
*/
public
interface
RuleEngineService
{
public
interface
RuleEngineService
{
/**
/**
...
...
src/main/java/cn/qg/qaplatform/zdata/service/impl/RuleEngineServiceImpl.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
risk/
impl/RuleEngineServiceImpl.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
impl
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
risk
.
impl
;
import
cn.qg.qaplatform.co
mmon
.SwitchDataSource
;
import
cn.qg.qaplatform.co
nfig
.SwitchDataSource
;
import
cn.qg.qaplatform.zdata.mapper.RuleEngineMapper
;
import
cn.qg.qaplatform.zdata.mapper.RuleEngineMapper
;
import
cn.qg.qaplatform.zdata.service.RuleEngineService
;
import
cn.qg.qaplatform.zdata.service.
risk.
RuleEngineService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
/**
* 风控相关服务
*/
@Service
@Service
public
class
RuleEngineServiceImpl
implements
RuleEngineService
{
public
class
RuleEngineServiceImpl
implements
RuleEngineService
{
@Autowired
@Autowired
RuleEngineMapper
ruleEngineMapper
;
RuleEngineMapper
ruleEngineMapper
;
/**
* 添加授信黑名单
* @param uuid uuid
* @return 成功与否
*/
@Override
@Override
public
boolean
addBlackList
(
String
uuid
)
{
public
boolean
addBlackList
(
String
uuid
)
{
SwitchDataSource
.
dataSourceSwitch
(
"fe"
,
"workflow"
);
SwitchDataSource
.
dataSourceSwitch
(
"fe"
,
"workflow"
);
...
...
src/main/java/cn/qg/qaplatform/zdata/service/VccDataService.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
vcc/
VccDataService.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
vcc
;
import
cn.qg.qaplatform.zdata.
domain.GenVccUser
;
import
cn.qg.qaplatform.zdata.
entity.VccOpenResultVo
;
import
cn.qg.qaplatform.zdata.
domain.QueryVccUser
;
import
cn.qg.qaplatform.zdata.
entity.VccUserEntity
;
import
cn.qg.qaplatform.utils.page.PageResult
;
import
cn.qg.qaplatform.utils.page.PageResult
;
...
@@ -10,9 +10,18 @@ import cn.qg.qaplatform.utils.page.PageResult;
...
@@ -10,9 +10,18 @@ import cn.qg.qaplatform.utils.page.PageResult;
* @author libo
* @author libo
*/
*/
public
interface
VccDataService
{
public
interface
VccDataService
{
GenVccUser
makeVccUser
(
String
namespace
,
String
phoneNo
,
String
openedChannel
,
Integer
status
)
throws
Exception
;
/**
* vcc造数据
*/
VccOpenResultVo
makeVccUser
(
String
namespace
,
String
phoneNo
,
String
openedChannel
,
Integer
status
)
throws
Exception
;
/**
* 根据状态批量获取vcc数据
*/
PageResult
getVccData
(
String
namespace
,
Integer
status
,
Integer
pageNum
,
Integer
pageSize
);
PageResult
getVccData
(
String
namespace
,
Integer
status
,
Integer
pageNum
,
Integer
pageSize
);
QueryVccUser
queryUserVccStatus
(
String
namespace
,
String
phoneNo
);
/**
* 根据手机号获取用户vcc状态
*/
VccUserEntity
queryUserVccStatus
(
String
namespace
,
String
phoneNo
);
}
}
src/main/java/cn/qg/qaplatform/zdata/service/impl/VccDataServiceImpl.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
vcc/
impl/VccDataServiceImpl.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
impl
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
vcc
.
impl
;
import
cn.qg.qaplatform.co
mmon
.SwitchDataSource
;
import
cn.qg.qaplatform.co
nfig
.SwitchDataSource
;
import
cn.qg.qaplatform.zdata.enums.VccStatusEnum
;
import
cn.qg.qaplatform.zdata.enums.VccStatusEnum
;
import
cn.qg.qaplatform.zdata.mapper.
Query
VccDataMapper
;
import
cn.qg.qaplatform.zdata.mapper.VccDataMapper
;
import
cn.qg.qaplatform.zdata.
domain.GenVccUser
;
import
cn.qg.qaplatform.zdata.
entity.VccOpenResultVo
;
import
cn.qg.qaplatform.zdata.
domain.QueryVccUser
;
import
cn.qg.qaplatform.zdata.
entity.VccUserEntity
;
import
cn.qg.qaplatform.zdata.process.Vcc
;
import
cn.qg.qaplatform.zdata.process.Vcc
;
import
cn.qg.qaplatform.zdata.service.RuleEngineService
;
import
cn.qg.qaplatform.zdata.service.
risk.
RuleEngineService
;
import
cn.qg.qaplatform.zdata.service.VccDataService
;
import
cn.qg.qaplatform.zdata.service.
vcc.
VccDataService
;
import
cn.qg.qaplatform.utils.page.PageResult
;
import
cn.qg.qaplatform.utils.page.PageResult
;
import
cn.qg.qaplatform.utils.page.PageUtil
;
import
cn.qg.qaplatform.utils.page.PageUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -26,7 +26,7 @@ import java.util.Map;
...
@@ -26,7 +26,7 @@ import java.util.Map;
public
class
VccDataServiceImpl
implements
VccDataService
{
public
class
VccDataServiceImpl
implements
VccDataService
{
@Autowired
@Autowired
QueryVccDataMapper
queryV
ccDataMapper
;
VccDataMapper
v
ccDataMapper
;
@Autowired
@Autowired
RuleEngineService
ruleEngineService
;
RuleEngineService
ruleEngineService
;
...
@@ -41,10 +41,10 @@ public class VccDataServiceImpl implements VccDataService {
...
@@ -41,10 +41,10 @@ public class VccDataServiceImpl implements VccDataService {
* @throws Exception
* @throws Exception
*/
*/
@Override
@Override
public
GenVccUser
makeVccUser
(
String
namespace
,
String
phoneNo
,
String
openedChannel
,
Integer
status
)
throws
Exception
{
public
VccOpenResultVo
makeVccUser
(
String
namespace
,
String
phoneNo
,
String
openedChannel
,
Integer
status
)
throws
Exception
{
GenVccUser
genVccUser
=
new
GenVccUser
();
VccOpenResultVo
vccOpenResultVo
=
new
VccOpenResultVo
();
genVccUser
.
setPhoneNo
(
phoneNo
);
vccOpenResultVo
.
setPhoneNo
(
phoneNo
);
genVccUser
.
setOpenedChannel
(
openedChannel
);
vccOpenResultVo
.
setOpenedChannel
(
openedChannel
);
String
vccChannel
=
null
;
String
vccChannel
=
null
;
if
(
openedChannel
.
equals
(
"214"
))
{
if
(
openedChannel
.
equals
(
"214"
))
{
vccChannel
=
"159904"
;
vccChannel
=
"159904"
;
...
@@ -67,8 +67,8 @@ public class VccDataServiceImpl implements VccDataService {
...
@@ -67,8 +67,8 @@ public class VccDataServiceImpl implements VccDataService {
// 检查用户是否已有额度
// 检查用户是否已有额度
boolean
haveQuota
=
Vcc
.
checkIfAlreadyHaveQuota
(
namespace
,
uuid
);
boolean
haveQuota
=
Vcc
.
checkIfAlreadyHaveQuota
(
namespace
,
uuid
);
if
(
haveQuota
)
{
if
(
haveQuota
)
{
genVccUser
.
setMsg
(
"该用户已申请过,请更换新用户申请!"
);
vccOpenResultVo
.
setMsg
(
"该用户已申请过,请更换新用户申请!"
);
return
genVccUser
;
return
vccOpenResultVo
;
}
}
// credit url
// credit url
String
vccToken
=
Vcc
.
creditUrl
(
namespace
,
token
,
vccChannel
);
String
vccToken
=
Vcc
.
creditUrl
(
namespace
,
token
,
vccChannel
);
...
@@ -85,13 +85,33 @@ public class VccDataServiceImpl implements VccDataService {
...
@@ -85,13 +85,33 @@ public class VccDataServiceImpl implements VccDataService {
// 提交授信
// 提交授信
Vcc
.
submitCredit
(
namespace
,
token
,
vccChannel
);
Vcc
.
submitCredit
(
namespace
,
token
,
vccChannel
);
// 授信结果查询
// 授信结果查询
Vcc
.
searchCreditResult
(
namespace
,
token
,
vccChannel
);
int
searchCreditCount
=
0
;
while
(
true
)
{
try
{
Thread
.
sleep
(
1000
);
searchCreditCount
++;
Map
<
String
,
Object
>
creditResult
=
Vcc
.
searchCreditResult
(
namespace
,
token
,
vccChannel
);
if
(
creditResult
.
get
(
"status"
).
equals
(
"1"
)
||
creditResult
.
get
(
"status"
).
equals
(
"2"
))
{
break
;
}
else
if
(
creditResult
.
get
(
"status"
).
equals
(
"0"
)
&&
searchCreditCount
==
10
)
{
String
riskNo
=
Vcc
.
getRiskNo
(
namespace
,
uuid
);
if
(
status
==
2
)
{
Vcc
.
vccWindControlCreditCallback
(
namespace
,
uuid
,
riskNo
,
false
);
}
else
{
Vcc
.
vccWindControlCreditCallback
(
namespace
,
uuid
,
riskNo
,
true
);
}
break
;
}
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
if
(
status
==
1
||
status
==
2
)
{
if
(
status
==
1
||
status
==
2
)
{
log
.
info
(
"提交授信成功!"
);
log
.
info
(
"提交授信成功!"
);
Thread
.
sleep
(
2000
);
Thread
.
sleep
(
2000
);
QueryVccUser
userInfo
=
queryUserVccStatus
(
namespace
,
phoneNo
);
VccUserEntity
userInfo
=
queryUserVccStatus
(
namespace
,
phoneNo
);
genVccUser
.
setMsg
(
VccStatusEnum
.
getDescByCode
(
userInfo
.
getStatus
()));
vccOpenResultVo
.
setMsg
(
VccStatusEnum
.
getDescByCode
(
userInfo
.
getStatus
()));
return
genVccUser
;
return
vccOpenResultVo
;
}
}
// 人脸识别回调
// 人脸识别回调
Vcc
.
appFaceCallback
(
namespace
,
token
,
vccChannel
);
Vcc
.
appFaceCallback
(
namespace
,
token
,
vccChannel
);
...
@@ -107,19 +127,19 @@ public class VccDataServiceImpl implements VccDataService {
...
@@ -107,19 +127,19 @@ public class VccDataServiceImpl implements VccDataService {
Map
data
=
(
Map
)
result
.
get
(
"data"
);
Map
data
=
(
Map
)
result
.
get
(
"data"
);
String
amount
=
data
.
get
(
"amount"
).
toString
();
String
amount
=
data
.
get
(
"amount"
).
toString
();
String
eacctNo
=
data
.
get
(
"eacctNo"
).
toString
();
String
eacctNo
=
data
.
get
(
"eacctNo"
).
toString
();
genVccUser
.
setAmount
(
amount
);
vccOpenResultVo
.
setAmount
(
amount
);
genVccUser
.
setEacctNo
(
eacctNo
);
vccOpenResultVo
.
setEacctNo
(
eacctNo
);
genVccUser
.
setMsg
(
"开户成功"
);
vccOpenResultVo
.
setMsg
(
"开户成功"
);
}
}
if
(
status
==
4
)
{
if
(
status
==
4
)
{
Map
data
=
(
Map
)
quotaActivationResult
.
get
(
"data"
);
Map
data
=
(
Map
)
quotaActivationResult
.
get
(
"data"
);
if
(
data
.
get
(
"status"
).
equals
(
"2"
))
{
if
(
data
.
get
(
"status"
).
equals
(
"2"
))
{
genVccUser
.
setMsg
(
"开户失败"
);
vccOpenResultVo
.
setMsg
(
"开户失败"
);
}
else
{
}
else
{
genVccUser
.
setMsg
(
"请找开发手动设置结果为开户失败!"
);
vccOpenResultVo
.
setMsg
(
"请找开发手动设置结果为开户失败!"
);
}
}
}
}
return
genVccUser
;
return
vccOpenResultVo
;
}
}
/**
/**
...
@@ -132,8 +152,8 @@ public class VccDataServiceImpl implements VccDataService {
...
@@ -132,8 +152,8 @@ public class VccDataServiceImpl implements VccDataService {
public
PageResult
getVccData
(
String
namespace
,
Integer
status
,
Integer
pageNum
,
Integer
pageSize
)
{
public
PageResult
getVccData
(
String
namespace
,
Integer
status
,
Integer
pageNum
,
Integer
pageSize
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"vcc_talos"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"vcc_talos"
);
PageHelper
.
startPage
(
pageNum
,
pageSize
);
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
QueryVccUser
>
result
=
queryV
ccDataMapper
.
queryVccDataByStatus
(
status
);
List
<
VccUserEntity
>
result
=
v
ccDataMapper
.
queryVccDataByStatus
(
status
);
PageInfo
<
QueryVccUser
>
pageList
=
new
PageInfo
<>(
result
);
PageInfo
<
VccUserEntity
>
pageList
=
new
PageInfo
<>(
result
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
return
pageResult
;
return
pageResult
;
}
}
...
@@ -145,8 +165,8 @@ public class VccDataServiceImpl implements VccDataService {
...
@@ -145,8 +165,8 @@ public class VccDataServiceImpl implements VccDataService {
* @return QueryVccUser实体
* @return QueryVccUser实体
*/
*/
@Override
@Override
public
QueryVccUser
queryUserVccStatus
(
String
namespace
,
String
phoneNo
)
{
public
VccUserEntity
queryUserVccStatus
(
String
namespace
,
String
phoneNo
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"vcc_talos"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"vcc_talos"
);
return
queryV
ccDataMapper
.
queryUserVccStatus
(
phoneNo
);
return
v
ccDataMapper
.
queryUserVccStatus
(
phoneNo
);
}
}
}
}
src/main/java/cn/qg/qaplatform/zdata/service/LexinDataService.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
xyqb/
LexinDataService.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
;
import
cn.qg.qaplatform.zdata.
domain.
ApplyDataVo
;
import
cn.qg.qaplatform.zdata.
entity.Xyqb
ApplyDataVo
;
/**
/**
* 乐信数据
* 乐信数据
...
@@ -8,5 +8,5 @@ import cn.qg.qaplatform.zdata.domain.ApplyDataVo;
...
@@ -8,5 +8,5 @@ import cn.qg.qaplatform.zdata.domain.ApplyDataVo;
*/
*/
public
interface
LexinDataService
{
public
interface
LexinDataService
{
boolean
genLexinData
(
ApplyDataVo
a
pplyDataVo
)
throws
Exception
;
boolean
genLexinData
(
XyqbApplyDataVo
xyqbA
pplyDataVo
)
throws
Exception
;
}
}
src/main/java/cn/qg/qaplatform/zdata/service/QueryInProcessStatusService.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
xyqb/
QueryInProcessStatusService.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
;
/**
/**
* 查询造数据流程中的状态
* 查询造数据流程中的状态
...
...
src/main/java/cn/qg/qaplatform/zdata/service/
QueryBasicLoanStatusData
Service.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
xyqb/XyqbBasicQuery
Service.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
;
import
cn.qg.qaplatform.zdata.
domain.GenLoanUser
;
import
cn.qg.qaplatform.zdata.
entity.XjfqGenProcessVo
;
import
cn.qg.qaplatform.zdata.
domain.QueryLoanUser
;
import
cn.qg.qaplatform.zdata.
entity.XjfqUserEntity
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -9,7 +9,7 @@ import java.util.Map;
...
@@ -9,7 +9,7 @@ import java.util.Map;
/**
/**
* 单个状态数据查询
* 单个状态数据查询
*/
*/
public
interface
QueryBasicLoanStatusData
Service
{
public
interface
XyqbBasicQuery
Service
{
/**
/**
* 获取所有的用户状态
* 获取所有的用户状态
*/
*/
...
@@ -23,7 +23,7 @@ public interface QueryBasicLoanStatusDataService {
...
@@ -23,7 +23,7 @@ public interface QueryBasicLoanStatusDataService {
/**
/**
* 根据uuid获取用户信息
* 根据uuid获取用户信息
*/
*/
List
<
QueryLoanUser
>
getUserDataListByUuidList
(
String
namespace
,
List
<
String
>
uuidList
);
List
<
XjfqUserEntity
>
getUserDataListByUuidList
(
String
namespace
,
List
<
String
>
uuidList
);
/**
/**
* 获取未申请用户
* 获取未申请用户
...
@@ -49,7 +49,7 @@ public interface QueryBasicLoanStatusDataService {
...
@@ -49,7 +49,7 @@ public interface QueryBasicLoanStatusDataService {
/**
/**
* 根据userIdList获取用户信息列表
* 根据userIdList获取用户信息列表
*/
*/
List
<
QueryLoanUser
>
getUserDataListByUserIdList
(
String
namespace
,
List
<
String
>
userIdList
);
List
<
XjfqUserEntity
>
getUserDataListByUserIdList
(
String
namespace
,
List
<
String
>
userIdList
);
/**
/**
* 获取不同放款状态的用户
* 获取不同放款状态的用户
...
@@ -69,7 +69,7 @@ public interface QueryBasicLoanStatusDataService {
...
@@ -69,7 +69,7 @@ public interface QueryBasicLoanStatusDataService {
/**
/**
* 根据手机号查询用户信息
* 根据手机号查询用户信息
*/
*/
GenLoanUser
getUserInfoByPhoneNo
(
String
namespace
,
String
phoneNo
);
XjfqGenProcessVo
getUserInfoByPhoneNo
(
String
namespace
,
String
phoneNo
);
/**
/**
* 根据userId获取用户放款状态
* 根据userId获取用户放款状态
...
...
src/main/java/cn/qg/qaplatform/zdata/service/
Xyqb
DataService.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
xyqb/XyqbGen
DataService.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
;
import
cn.qg.qaplatform.zdata.
domain.
ApplyDataVo
;
import
cn.qg.qaplatform.zdata.
entity.Xyqb
ApplyDataVo
;
import
cn.qg.qaplatform.zdata.
domain.GenLoanUser
;
import
cn.qg.qaplatform.zdata.
entity.XjfqGenProcessVo
;
import
java.io.IOException
;
import
java.io.IOException
;
public
interface
XyqbDataService
{
public
interface
Xyqb
Gen
DataService
{
/**
/**
* 分配资金方
* 分配资金方
...
@@ -14,32 +14,32 @@ public interface XyqbDataService {
...
@@ -14,32 +14,32 @@ public interface XyqbDataService {
/**
/**
* 授信
* 授信
* @param
a
pplyDataVo 造数据的相关信息
* @param
xyqbA
pplyDataVo 造数据的相关信息
* @return 成功或失败
* @return 成功或失败
*/
*/
boolean
quotaAuth
(
ApplyDataVo
a
pplyDataVo
,
boolean
auditResult
)
throws
Exception
;
boolean
quotaAuth
(
XyqbApplyDataVo
xyqbA
pplyDataVo
,
boolean
auditResult
)
throws
Exception
;
/**
/**
* 提现
* 提现
* @param
a
pplyDataVo 造数据相关信息
* @param
xyqbA
pplyDataVo 造数据相关信息
* @return 成功或失败
* @return 成功或失败
*/
*/
boolean
withDraw
(
ApplyDataVo
a
pplyDataVo
,
boolean
auditResult
)
throws
Exception
;
boolean
withDraw
(
XyqbApplyDataVo
xyqbA
pplyDataVo
,
boolean
auditResult
)
throws
Exception
;
/**
/**
* 放款
* 放款
* @param
a
pplyDataVo
* @param
xyqbA
pplyDataVo
* @return
* @return
*/
*/
boolean
makeLoan
(
ApplyDataVo
a
pplyDataVo
,
boolean
payStatus
)
throws
Exception
;
boolean
makeLoan
(
XyqbApplyDataVo
xyqbA
pplyDataVo
,
boolean
payStatus
)
throws
Exception
;
/**
/**
* 造数据
* 造数据
* @param
a
pplyDataVo
* @param
xyqbA
pplyDataVo
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
boolean
genLoanUser
(
ApplyDataVo
a
pplyDataVo
)
throws
Exception
;
boolean
genLoanUser
(
XyqbApplyDataVo
xyqbA
pplyDataVo
)
throws
Exception
;
/**
/**
* 获取用户状态
* 获取用户状态
...
@@ -47,6 +47,6 @@ public interface XyqbDataService {
...
@@ -47,6 +47,6 @@ public interface XyqbDataService {
* @param phoneNo
* @param phoneNo
* @return
* @return
*/
*/
GenLoanUser
queryUserStatus
(
String
namespace
,
String
phoneNo
);
XjfqGenProcessVo
queryUserStatus
(
String
namespace
,
String
phoneNo
);
}
}
src/main/java/cn/qg/qaplatform/zdata/service/
QueryLoanUserData
Service.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
xyqb/XyqbQuery
Service.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
;
import
cn.qg.qaplatform.utils.page.PageResult
;
import
cn.qg.qaplatform.utils.page.PageResult
;
/**
/**
* 多个状态结合查询
* 多个状态结合查询
*/
*/
public
interface
QueryLoanUserData
Service
{
public
interface
XyqbQuery
Service
{
/**
/**
* 获取已有用户状态数据
* 获取已有用户状态数据
* @param status 用户状态
* @param status 用户状态
...
...
src/main/java/cn/qg/qaplatform/zdata/service/impl/LexinDataServiceImpl.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
xyqb/
impl/LexinDataServiceImpl.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
impl
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
.
impl
;
import
cn.qg.qaplatform.zdata.enums.ChannelEnum
;
import
cn.qg.qaplatform.zdata.enums.ChannelEnum
;
import
cn.qg.qaplatform.zdata.
domain.
ApplyDataVo
;
import
cn.qg.qaplatform.zdata.
entity.Xyqb
ApplyDataVo
;
import
cn.qg.qaplatform.zdata.process.Common
;
import
cn.qg.qaplatform.zdata.process.Common
;
import
cn.qg.qaplatform.zdata.process.Lexin
;
import
cn.qg.qaplatform.zdata.process.Lexin
;
import
cn.qg.qaplatform.zdata.process.Xyqb
;
import
cn.qg.qaplatform.zdata.process.Xyqb
;
import
cn.qg.qaplatform.zdata.service.QueryInProcessStatusService
;
import
cn.qg.qaplatform.zdata.service.
xyqb.
QueryInProcessStatusService
;
import
cn.qg.qaplatform.zdata.service.LexinDataService
;
import
cn.qg.qaplatform.zdata.service.
xyqb.
LexinDataService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
@@ -24,22 +24,22 @@ public class LexinDataServiceImpl implements LexinDataService {
...
@@ -24,22 +24,22 @@ public class LexinDataServiceImpl implements LexinDataService {
RedisTemplate
redisTemplate
;
RedisTemplate
redisTemplate
;
@Override
@Override
public
boolean
genLexinData
(
ApplyDataVo
a
pplyDataVo
)
throws
Exception
{
public
boolean
genLexinData
(
XyqbApplyDataVo
xyqbA
pplyDataVo
)
throws
Exception
{
String
namespace
=
a
pplyDataVo
.
getNamespace
();
String
namespace
=
xyqbA
pplyDataVo
.
getNamespace
();
String
phoneNo
=
a
pplyDataVo
.
getPhoneNo
();
String
phoneNo
=
xyqbA
pplyDataVo
.
getPhoneNo
();
String
bankCardNo
=
a
pplyDataVo
.
getBankCardNo
();
String
bankCardNo
=
xyqbA
pplyDataVo
.
getBankCardNo
();
String
bankCode
=
a
pplyDataVo
.
getBankCode
();
String
bankCode
=
xyqbA
pplyDataVo
.
getBankCode
();
String
bankName
=
a
pplyDataVo
.
getBankName
();
String
bankName
=
xyqbA
pplyDataVo
.
getBankName
();
Integer
fundId
=
a
pplyDataVo
.
getFundId
();
Integer
fundId
=
xyqbA
pplyDataVo
.
getFundId
();
String
symbol
=
a
pplyDataVo
.
getSymbol
();
String
symbol
=
xyqbA
pplyDataVo
.
getSymbol
();
Integer
amount
=
a
pplyDataVo
.
getAmount
();
Integer
amount
=
xyqbA
pplyDataVo
.
getAmount
();
Integer
term
=
a
pplyDataVo
.
getTerm
();
Integer
term
=
xyqbA
pplyDataVo
.
getTerm
();
Xyqb
.
symbol
=
symbol
;
Xyqb
.
symbol
=
symbol
;
Common
.
symbol
=
symbol
;
Common
.
symbol
=
symbol
;
// 分配资产计划
// 分配资产计划
boolean
fundAssignResult
=
Common
.
assignFundCorp
(
namespace
,
fundId
);
boolean
fundAssignResult
=
Common
.
assignFundCorp
(
namespace
,
fundId
);
// 进件
// 进件
boolean
createOrderResult
=
Lexin
.
createOrder
(
a
pplyDataVo
);
boolean
createOrderResult
=
Lexin
.
createOrder
(
xyqbA
pplyDataVo
);
if
(!
createOrderResult
)
{
if
(!
createOrderResult
)
{
return
false
;
return
false
;
}
}
...
@@ -47,7 +47,8 @@ public class LexinDataServiceImpl implements LexinDataService {
...
@@ -47,7 +47,8 @@ public class LexinDataServiceImpl implements LexinDataService {
Map
userInfoResult
=
Xyqb
.
checkUserId
(
namespace
,
phoneNo
);
Map
userInfoResult
=
Xyqb
.
checkUserId
(
namespace
,
phoneNo
);
String
uuid
=
userInfoResult
.
get
(
"uuid"
).
toString
();
String
uuid
=
userInfoResult
.
get
(
"uuid"
).
toString
();
String
userId
=
userInfoResult
.
get
(
"id"
).
toString
();
String
userId
=
userInfoResult
.
get
(
"id"
).
toString
();
String
channelOrderNo
=
Common
.
queryChannelOrderNoByPhone
(
namespace
,
phoneNo
,
ChannelEnum
.
LEXIN
.
getChannelId
());
// String channelOrderNo = Common.queryChannelOrderNoByPhone(namespace, phoneNo, ChannelEnum.LEXIN.getChannelId());
String
channelOrderNo
=
Common
.
queryChannelOrderNoByPhone
(
namespace
,
phoneNo
,
159886
);
Common
.
channelOrderApprove
(
namespace
,
channelOrderNo
,
amount
,
"0"
,
true
,
term
);
Common
.
channelOrderApprove
(
namespace
,
channelOrderNo
,
amount
,
"0"
,
true
,
term
);
// 风控授信回调
// 风控授信回调
// Xyqb.creditAuthNotify(namespace, token, uuid, ChannelEnum.LEXIN.getChannelId(), fundId, channelOrderNo, 0, true, amount, term);
// Xyqb.creditAuthNotify(namespace, token, uuid, ChannelEnum.LEXIN.getChannelId(), fundId, channelOrderNo, 0, true, amount, term);
...
@@ -61,7 +62,8 @@ public class LexinDataServiceImpl implements LexinDataService {
...
@@ -61,7 +62,8 @@ public class LexinDataServiceImpl implements LexinDataService {
}
}
setUserStatusRedisValue
(
namespace
,
phoneNo
,
2
);
setUserStatusRedisValue
(
namespace
,
phoneNo
,
2
);
// 二次风控
// 二次风控
Integer
loanId
=
Common
.
queryLoanId
(
namespace
,
phoneNo
,
ChannelEnum
.
LEXIN
.
getChannelId
());
// Integer loanId = Common.queryLoanId(namespace, phoneNo, ChannelEnum.LEXIN.getChannelId());
Integer
loanId
=
Common
.
queryLoanId
(
namespace
,
phoneNo
,
159886
);
boolean
secondWindControlResult
=
Xyqb
.
externalQuotaOrderAuditNotify
(
namespace
,
1
,
token
,
uuid
,
loanId
,
11
,
true
);
boolean
secondWindControlResult
=
Xyqb
.
externalQuotaOrderAuditNotify
(
namespace
,
1
,
token
,
uuid
,
loanId
,
11
,
true
);
Xyqb
.
modifyContactStatus
(
namespace
,
userId
);
Xyqb
.
modifyContactStatus
(
namespace
,
userId
);
...
...
src/main/java/cn/qg/qaplatform/zdata/service/impl/QueryInProcessStatusServiceImpl.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
xyqb/
impl/QueryInProcessStatusServiceImpl.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
impl
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
.
impl
;
import
cn.qg.qaplatform.config.WebSocketServer
;
import
cn.qg.qaplatform.config.WebSocketServer
;
import
cn.qg.qaplatform.zdata.service.
QueryBasicLoanStatusData
Service
;
import
cn.qg.qaplatform.zdata.service.
xyqb.XyqbBasicQuery
Service
;
import
cn.qg.qaplatform.zdata.service.QueryInProcessStatusService
;
import
cn.qg.qaplatform.zdata.service.
xyqb.
QueryInProcessStatusService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -13,13 +13,13 @@ import org.springframework.stereotype.Service;
...
@@ -13,13 +13,13 @@ import org.springframework.stereotype.Service;
public
class
QueryInProcessStatusServiceImpl
implements
QueryInProcessStatusService
{
public
class
QueryInProcessStatusServiceImpl
implements
QueryInProcessStatusService
{
@Autowired
@Autowired
QueryBasicLoanStatusDataService
queryBasicLoanStatusData
Service
;
XyqbBasicQueryService
xyqbBasicQuery
Service
;
@Override
@Override
public
void
queryFundingAssignProgress
(
String
namespace
,
String
phoneNo
,
Integer
fundId
,
String
symbol
)
throws
InterruptedException
{
public
void
queryFundingAssignProgress
(
String
namespace
,
String
phoneNo
,
Integer
fundId
,
String
symbol
)
throws
InterruptedException
{
String
userId
=
queryBasicLoanStatusData
Service
.
getUserInfoByPhoneNo
(
namespace
,
phoneNo
).
getUserId
();
String
userId
=
xyqbBasicQuery
Service
.
getUserInfoByPhoneNo
(
namespace
,
phoneNo
).
getUserId
();
while
(
true
)
{
while
(
true
)
{
Integer
searchResult
=
queryBasicLoanStatusData
Service
.
getAssignFundIdByUserId
(
namespace
,
userId
);
Integer
searchResult
=
xyqbBasicQuery
Service
.
getAssignFundIdByUserId
(
namespace
,
userId
);
log
.
info
(
searchResult
.
toString
());
log
.
info
(
searchResult
.
toString
());
if
(
fundId
.
equals
(
searchResult
))
{
if
(
fundId
.
equals
(
searchResult
))
{
log
.
info
(
"用户:"
+
userId
+
"资方分配成功!"
);
log
.
info
(
"用户:"
+
userId
+
"资方分配成功!"
);
...
@@ -38,9 +38,9 @@ public class QueryInProcessStatusServiceImpl implements QueryInProcessStatusServ
...
@@ -38,9 +38,9 @@ public class QueryInProcessStatusServiceImpl implements QueryInProcessStatusServ
@Override
@Override
public
void
queryLoanProgress
(
String
namespace
,
String
phoneNo
,
String
symbol
)
throws
InterruptedException
{
public
void
queryLoanProgress
(
String
namespace
,
String
phoneNo
,
String
symbol
)
throws
InterruptedException
{
String
userId
=
queryBasicLoanStatusData
Service
.
getUserInfoByPhoneNo
(
namespace
,
phoneNo
).
getUserId
();
String
userId
=
xyqbBasicQuery
Service
.
getUserInfoByPhoneNo
(
namespace
,
phoneNo
).
getUserId
();
while
(
true
)
{
while
(
true
)
{
Integer
progress
=
queryBasicLoanStatusData
Service
.
getLoanProgressByUserId
(
namespace
,
userId
);
Integer
progress
=
xyqbBasicQuery
Service
.
getLoanProgressByUserId
(
namespace
,
userId
);
if
(
progress
==
15
)
{
if
(
progress
==
15
)
{
log
.
info
(
"用户:"
+
userId
+
"放款成功!"
);
log
.
info
(
"用户:"
+
userId
+
"放款成功!"
);
if
(!
StringUtils
.
isEmpty
(
symbol
))
{
if
(!
StringUtils
.
isEmpty
(
symbol
))
{
...
...
src/main/java/cn/qg/qaplatform/zdata/service/
impl/QueryBasicLoanStatusData
ServiceImpl.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
xyqb/impl/XyqbBasicQuery
ServiceImpl.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
impl
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
.
impl
;
import
cn.qg.qaplatform.zdata.enums.LoanStatus
;
import
cn.qg.qaplatform.zdata.enums.LoanStatus
;
import
cn.qg.qaplatform.
common.
enums.Namespace
;
import
cn.qg.qaplatform.enums.Namespace
;
import
cn.qg.qaplatform.zdata.mapper.
QueryBasicLoanStatus
DataMapper
;
import
cn.qg.qaplatform.zdata.mapper.
XyqbLoan
DataMapper
;
import
cn.qg.qaplatform.zdata.
domain.GenLoanUser
;
import
cn.qg.qaplatform.zdata.
entity.XjfqGenProcessVo
;
import
cn.qg.qaplatform.zdata.
domain.QueryLoanUser
;
import
cn.qg.qaplatform.zdata.
entity.XjfqUserEntity
;
import
cn.qg.qaplatform.co
mmon
.SwitchDataSource
;
import
cn.qg.qaplatform.co
nfig
.SwitchDataSource
;
import
cn.qg.qaplatform.zdata.service.
QueryBasicLoanStatusData
Service
;
import
cn.qg.qaplatform.zdata.service.
xyqb.XyqbBasicQuery
Service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -16,10 +16,10 @@ import java.util.List;
...
@@ -16,10 +16,10 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
@Service
@Service
public
class
QueryBasicLoanStatusDataServiceImpl
implements
QueryBasicLoanStatusData
Service
{
public
class
XyqbBasicQueryServiceImpl
implements
XyqbBasicQuery
Service
{
@Autowired
@Autowired
QueryBasicLoanStatusDataMapper
basicLoanStatus
DataMapper
;
XyqbLoanDataMapper
xyqbLoan
DataMapper
;
/**
/**
* 获取所有用户状态
* 获取所有用户状态
...
@@ -59,9 +59,9 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
...
@@ -59,9 +59,9 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
* @return
* @return
*/
*/
@Override
@Override
public
List
<
QueryLoanUser
>
getUserDataListByUuidList
(
String
namespace
,
List
<
String
>
uuidList
)
{
public
List
<
XjfqUserEntity
>
getUserDataListByUuidList
(
String
namespace
,
List
<
String
>
uuidList
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb_user"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb_user"
);
return
basicLoanStatus
DataMapper
.
getUserDataListByUuidList
(
uuidList
);
return
xyqbLoan
DataMapper
.
getUserDataListByUuidList
(
uuidList
);
}
}
/**
/**
...
@@ -71,7 +71,7 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
...
@@ -71,7 +71,7 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
@Override
@Override
public
List
<
String
>
getUnApplyUserUuidList
(
String
namespace
,
Integer
channel
)
{
public
List
<
String
>
getUnApplyUserUuidList
(
String
namespace
,
Integer
channel
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"business_flow"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"business_flow"
);
return
basicLoanStatus
DataMapper
.
getUnApplyLoanUserUuidList
(
channel
);
return
xyqbLoan
DataMapper
.
getUnApplyLoanUserUuidList
(
channel
);
}
}
/**
/**
...
@@ -82,7 +82,7 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
...
@@ -82,7 +82,7 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
@Override
@Override
public
boolean
queryIfPhoneExist
(
String
namespace
,
String
phone
)
{
public
boolean
queryIfPhoneExist
(
String
namespace
,
String
phone
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb_user"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb_user"
);
if
(
basicLoanStatus
DataMapper
.
queryIfPhoneExist
(
phone
)
!=
null
)
{
if
(
xyqbLoan
DataMapper
.
queryIfPhoneExist
(
phone
)
!=
null
)
{
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
@@ -98,13 +98,13 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
...
@@ -98,13 +98,13 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
public
List
<
String
>
getAuditStatusUserIdList
(
String
namespace
,
Integer
status
,
Integer
channel
)
{
public
List
<
String
>
getAuditStatusUserIdList
(
String
namespace
,
Integer
status
,
Integer
channel
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb"
);
if
(
status
==
0
)
{
if
(
status
==
0
)
{
return
basicLoanStatus
DataMapper
.
getAuditStatusUserIdList
(
0
,
channel
);
return
xyqbLoan
DataMapper
.
getAuditStatusUserIdList
(
0
,
channel
);
}
}
if
(
status
==
1
)
{
if
(
status
==
1
)
{
return
basicLoanStatus
DataMapper
.
getAuditStatusUserIdList
(
1
,
channel
);
return
xyqbLoan
DataMapper
.
getAuditStatusUserIdList
(
1
,
channel
);
}
}
if
(
status
==
2
)
{
if
(
status
==
2
)
{
return
basicLoanStatus
DataMapper
.
getAuditStatusUserIdList
(
2
,
channel
);
return
xyqbLoan
DataMapper
.
getAuditStatusUserIdList
(
2
,
channel
);
}
}
return
null
;
return
null
;
}
}
...
@@ -119,7 +119,7 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
...
@@ -119,7 +119,7 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
@Override
@Override
public
List
<
String
>
queryAuthAndUnWithdraw
(
String
namespace
,
Integer
channel
,
Integer
fundId
)
{
public
List
<
String
>
queryAuthAndUnWithdraw
(
String
namespace
,
Integer
channel
,
Integer
fundId
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb"
);
List
<
String
>
userIdList
=
basicLoanStatus
DataMapper
.
queryAuthAndUnWithdraw
(
channel
,
fundId
);
List
<
String
>
userIdList
=
xyqbLoan
DataMapper
.
queryAuthAndUnWithdraw
(
channel
,
fundId
);
return
userIdList
;
return
userIdList
;
}
}
...
@@ -130,9 +130,9 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
...
@@ -130,9 +130,9 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
* @return
* @return
*/
*/
@Override
@Override
public
List
<
QueryLoanUser
>
getUserDataListByUserIdList
(
String
namespace
,
List
<
String
>
userIdList
)
{
public
List
<
XjfqUserEntity
>
getUserDataListByUserIdList
(
String
namespace
,
List
<
String
>
userIdList
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb_user"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb_user"
);
List
<
QueryLoanUser
>
result
=
basicLoanStatus
DataMapper
.
getUserDataListByUserIdList
(
userIdList
);
List
<
XjfqUserEntity
>
result
=
xyqbLoan
DataMapper
.
getUserDataListByUserIdList
(
userIdList
);
return
result
;
return
result
;
}
}
...
@@ -146,10 +146,10 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
...
@@ -146,10 +146,10 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
public
List
<
String
>
getLoanStatusUserIdList
(
String
namespace
,
Integer
status
,
Integer
channel
,
Integer
fundId
)
{
public
List
<
String
>
getLoanStatusUserIdList
(
String
namespace
,
Integer
status
,
Integer
channel
,
Integer
fundId
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb"
);
if
(
status
==
0
)
{
if
(
status
==
0
)
{
return
basicLoanStatus
DataMapper
.
getLoanStatusUserIdList
(
23
,
channel
,
fundId
);
return
xyqbLoan
DataMapper
.
getLoanStatusUserIdList
(
23
,
channel
,
fundId
);
}
}
if
(
status
==
1
)
{
if
(
status
==
1
)
{
return
basicLoanStatus
DataMapper
.
getLoanStatusUserIdList
(
15
,
channel
,
fundId
);
return
xyqbLoan
DataMapper
.
getLoanStatusUserIdList
(
15
,
channel
,
fundId
);
}
}
return
null
;
return
null
;
}
}
...
@@ -162,24 +162,24 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
...
@@ -162,24 +162,24 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
@Override
@Override
public
List
<
String
>
getMultiOrderUserDataList
(
String
namespace
)
{
public
List
<
String
>
getMultiOrderUserDataList
(
String
namespace
)
{
SwitchDataSource
.
dataSourceSwitch
(
"fe"
,
"workflow"
);
SwitchDataSource
.
dataSourceSwitch
(
"fe"
,
"workflow"
);
return
basicLoanStatus
DataMapper
.
getMultiOrderuuidList
();
return
xyqbLoan
DataMapper
.
getMultiOrderuuidList
();
}
}
@Override
@Override
public
Integer
getAssignFundIdByUserId
(
String
namespace
,
String
userId
)
{
public
Integer
getAssignFundIdByUserId
(
String
namespace
,
String
userId
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb"
);
return
basicLoanStatus
DataMapper
.
getAssignFundIdByUserId
(
userId
);
return
xyqbLoan
DataMapper
.
getAssignFundIdByUserId
(
userId
);
}
}
@Override
@Override
public
GenLoanUser
getUserInfoByPhoneNo
(
String
namespace
,
String
phoneNo
)
{
public
XjfqGenProcessVo
getUserInfoByPhoneNo
(
String
namespace
,
String
phoneNo
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb_user"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb_user"
);
return
basicLoanStatus
DataMapper
.
getUserInfoByPhoneNo
(
phoneNo
);
return
xyqbLoan
DataMapper
.
getUserInfoByPhoneNo
(
phoneNo
);
}
}
@Override
@Override
public
Integer
getLoanProgressByUserId
(
String
namespace
,
String
userId
)
{
public
Integer
getLoanProgressByUserId
(
String
namespace
,
String
userId
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb"
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb"
);
return
basicLoanStatus
DataMapper
.
getLoanProgressByUserId
(
userId
);
return
xyqbLoan
DataMapper
.
getLoanProgressByUserId
(
userId
);
}
}
}
}
src/main/java/cn/qg/qaplatform/zdata/service/
impl/Xyqb
DataServiceImpl.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
xyqb/impl/XyqbGen
DataServiceImpl.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
impl
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
.
impl
;
import
cn.qg.qaplatform.config.WebSocketServer
;
import
cn.qg.qaplatform.config.WebSocketServer
;
import
cn.qg.qaplatform.utils.RedisUtil
;
import
cn.qg.qaplatform.zdata.entity.XyqbApplyDataVo
;
import
cn.qg.qaplatform.zdata.domain.ApplyDataVo
;
import
cn.qg.qaplatform.zdata.entity.XjfqGenProcessVo
;
import
cn.qg.qaplatform.zdata.domain.GenLoanUser
;
import
cn.qg.qaplatform.zdata.process.Xyqb
;
import
cn.qg.qaplatform.zdata.process.Xyqb
;
import
cn.qg.qaplatform.zdata.service.
QueryBasicLoanStatusData
Service
;
import
cn.qg.qaplatform.zdata.service.
xyqb.QueryInProcessStatus
Service
;
import
cn.qg.qaplatform.zdata.service.
QueryInProcessStatus
Service
;
import
cn.qg.qaplatform.zdata.service.
xyqb.XyqbGenData
Service
;
import
cn.qg.qaplatform.zdata.service.
XyqbData
Service
;
import
cn.qg.qaplatform.zdata.service.
xyqb.XyqbBasicQuery
Service
;
import
com.alibaba.fastjson.JSONException
;
import
com.alibaba.fastjson.JSONException
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.net.URISyntaxException
;
import
java.net.URISyntaxException
;
import
java.util.Map
;
import
java.util.Map
;
@Service
@Service
@Slf4j
@Slf4j
public
class
Xyqb
DataServiceImpl
implements
Xyqb
DataService
{
public
class
Xyqb
GenDataServiceImpl
implements
XyqbGen
DataService
{
@
Autowired
@
Resource
QueryBasicLoanStatusDataService
queryBasicLoanStatusDataServic
e
;
RedisTemplate
redisTemplat
e
;
@Autowired
@Autowired
QueryInProcessStatusService
queryInProcessStatus
Service
;
XyqbBasicQueryService
xyqbBasicQuery
Service
;
@Autowired
@Autowired
RedisUtil
redisUtil
;
QueryInProcessStatusService
queryInProcessStatusService
;
/**
/**
* 分配资产计划
* 分配资产计划
...
@@ -70,21 +71,21 @@ public class XyqbDataServiceImpl implements XyqbDataService {
...
@@ -70,21 +71,21 @@ public class XyqbDataServiceImpl implements XyqbDataService {
/**
/**
* 授信
* 授信
* @param
a
pplyDataVo 造数据的相关信息
* @param
xyqbA
pplyDataVo 造数据的相关信息
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
@Override
@Override
public
boolean
quotaAuth
(
ApplyDataVo
a
pplyDataVo
,
boolean
auditResult
)
throws
Exception
{
public
boolean
quotaAuth
(
XyqbApplyDataVo
xyqbA
pplyDataVo
,
boolean
auditResult
)
throws
Exception
{
String
namespace
=
a
pplyDataVo
.
getNamespace
();
String
namespace
=
xyqbA
pplyDataVo
.
getNamespace
();
String
phoneNo
=
a
pplyDataVo
.
getPhoneNo
();
String
phoneNo
=
xyqbA
pplyDataVo
.
getPhoneNo
();
Integer
channelId
=
a
pplyDataVo
.
getChannel
();
Integer
channelId
=
xyqbA
pplyDataVo
.
getChannel
();
Integer
fundId
=
a
pplyDataVo
.
getFundId
();
Integer
fundId
=
xyqbA
pplyDataVo
.
getFundId
();
Integer
amount
=
a
pplyDataVo
.
getAmount
();
Integer
amount
=
xyqbA
pplyDataVo
.
getAmount
();
Integer
term
=
a
pplyDataVo
.
getTerm
();
Integer
term
=
xyqbA
pplyDataVo
.
getTerm
();
String
symbol
=
a
pplyDataVo
.
getSymbol
();
String
symbol
=
xyqbA
pplyDataVo
.
getSymbol
();
String
name
=
a
pplyDataVo
.
getName
();
String
name
=
xyqbA
pplyDataVo
.
getName
();
String
idCardNo
=
a
pplyDataVo
.
getIdCardNo
();
String
idCardNo
=
xyqbA
pplyDataVo
.
getIdCardNo
();
// 登录
// 登录
String
token
=
Xyqb
.
login
(
namespace
,
channelId
,
phoneNo
);
String
token
=
Xyqb
.
login
(
namespace
,
channelId
,
phoneNo
);
...
@@ -129,21 +130,21 @@ public class XyqbDataServiceImpl implements XyqbDataService {
...
@@ -129,21 +130,21 @@ public class XyqbDataServiceImpl implements XyqbDataService {
/**
/**
* 提现
* 提现
* @param
a
pplyDataVo 造数据相关信息
* @param
xyqbA
pplyDataVo 造数据相关信息
* @param auditResult 二次风控成功or失败
* @param auditResult 二次风控成功or失败
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
@Override
@Override
public
boolean
withDraw
(
ApplyDataVo
a
pplyDataVo
,
boolean
auditResult
)
throws
Exception
{
public
boolean
withDraw
(
XyqbApplyDataVo
xyqbA
pplyDataVo
,
boolean
auditResult
)
throws
Exception
{
String
namespace
=
a
pplyDataVo
.
getNamespace
();
String
namespace
=
xyqbA
pplyDataVo
.
getNamespace
();
String
phoneNo
=
a
pplyDataVo
.
getPhoneNo
();
String
phoneNo
=
xyqbA
pplyDataVo
.
getPhoneNo
();
Integer
channelId
=
a
pplyDataVo
.
getChannel
();
Integer
channelId
=
xyqbA
pplyDataVo
.
getChannel
();
Integer
fundId
=
a
pplyDataVo
.
getFundId
();
Integer
fundId
=
xyqbA
pplyDataVo
.
getFundId
();
Integer
amount
=
a
pplyDataVo
.
getAmount
();
Integer
amount
=
xyqbA
pplyDataVo
.
getAmount
();
Integer
term
=
a
pplyDataVo
.
getTerm
();
Integer
term
=
xyqbA
pplyDataVo
.
getTerm
();
String
bankCardNo
=
a
pplyDataVo
.
getBankCardNo
();
String
bankCardNo
=
xyqbA
pplyDataVo
.
getBankCardNo
();
String
bankCode
=
a
pplyDataVo
.
getBankCode
();
String
bankCode
=
xyqbA
pplyDataVo
.
getBankCode
();
// 登录
// 登录
String
token
=
Xyqb
.
login
(
namespace
,
channelId
,
phoneNo
);
String
token
=
Xyqb
.
login
(
namespace
,
channelId
,
phoneNo
);
...
@@ -190,17 +191,17 @@ public class XyqbDataServiceImpl implements XyqbDataService {
...
@@ -190,17 +191,17 @@ public class XyqbDataServiceImpl implements XyqbDataService {
/**
/**
* 放款
* 放款
* @param
a
pplyDataVo
* @param
xyqbA
pplyDataVo
* @return
* @return
*/
*/
@Override
@Override
public
boolean
makeLoan
(
ApplyDataVo
a
pplyDataVo
,
boolean
payStatus
)
throws
Exception
{
public
boolean
makeLoan
(
XyqbApplyDataVo
xyqbA
pplyDataVo
,
boolean
payStatus
)
throws
Exception
{
String
namespace
=
a
pplyDataVo
.
getNamespace
();
String
namespace
=
xyqbA
pplyDataVo
.
getNamespace
();
String
phoneNo
=
a
pplyDataVo
.
getPhoneNo
();
String
phoneNo
=
xyqbA
pplyDataVo
.
getPhoneNo
();
Integer
channelId
=
a
pplyDataVo
.
getChannel
();
Integer
channelId
=
xyqbA
pplyDataVo
.
getChannel
();
Integer
fundId
=
a
pplyDataVo
.
getFundId
();
Integer
fundId
=
xyqbA
pplyDataVo
.
getFundId
();
Integer
amount
=
a
pplyDataVo
.
getAmount
();
Integer
amount
=
xyqbA
pplyDataVo
.
getAmount
();
Integer
term
=
a
pplyDataVo
.
getTerm
();
Integer
term
=
xyqbA
pplyDataVo
.
getTerm
();
// 登录
// 登录
String
token
=
Xyqb
.
login
(
namespace
,
channelId
,
phoneNo
);
String
token
=
Xyqb
.
login
(
namespace
,
channelId
,
phoneNo
);
...
@@ -240,21 +241,20 @@ public class XyqbDataServiceImpl implements XyqbDataService {
...
@@ -240,21 +241,20 @@ public class XyqbDataServiceImpl implements XyqbDataService {
*/
*/
public
void
setUserStatusRedisValue
(
String
namespace
,
String
phoneNo
,
Integer
status
)
{
public
void
setUserStatusRedisValue
(
String
namespace
,
String
phoneNo
,
Integer
status
)
{
String
redisKey
=
namespace
+
"_"
+
phoneNo
;
String
redisKey
=
namespace
+
"_"
+
phoneNo
;
redisUtil
.
set
(
redisKey
,
status
);
redisTemplate
.
opsForValue
().
set
(
redisKey
,
status
);
redisUtil
.
expire
(
redisKey
,
300
);
}
}
@Override
@Override
public
boolean
genLoanUser
(
ApplyDataVo
a
pplyDataVo
)
throws
Exception
{
public
boolean
genLoanUser
(
XyqbApplyDataVo
xyqbA
pplyDataVo
)
throws
Exception
{
Integer
status
=
a
pplyDataVo
.
getStatus
();
Integer
status
=
xyqbA
pplyDataVo
.
getStatus
();
String
namespace
=
a
pplyDataVo
.
getNamespace
();
String
namespace
=
xyqbA
pplyDataVo
.
getNamespace
();
Integer
fundId
=
a
pplyDataVo
.
getFundId
();
Integer
fundId
=
xyqbA
pplyDataVo
.
getFundId
();
String
symbol
=
a
pplyDataVo
.
getSymbol
();
String
symbol
=
xyqbA
pplyDataVo
.
getSymbol
();
String
phoneNo
=
a
pplyDataVo
.
getPhoneNo
();
String
phoneNo
=
xyqbA
pplyDataVo
.
getPhoneNo
();
WebSocketServer
.
sendInfo
(
"本次请求的参数为:"
+
a
pplyDataVo
.
toString
(),
symbol
);
WebSocketServer
.
sendInfo
(
"本次请求的参数为:"
+
xyqbA
pplyDataVo
.
toString
(),
symbol
);
log
.
info
(
"本次请求的参数为:"
+
a
pplyDataVo
.
toString
());
log
.
info
(
"本次请求的参数为:"
+
xyqbA
pplyDataVo
.
toString
());
boolean
assignFundResult
=
assignFundCorp
(
namespace
,
fundId
,
symbol
);
boolean
assignFundResult
=
assignFundCorp
(
namespace
,
fundId
,
symbol
);
log
.
info
(
"分配资金方的结果为:"
+
assignFundResult
);
log
.
info
(
"分配资金方的结果为:"
+
assignFundResult
);
...
@@ -267,40 +267,40 @@ public class XyqbDataServiceImpl implements XyqbDataService {
...
@@ -267,40 +267,40 @@ public class XyqbDataServiceImpl implements XyqbDataService {
* 0 - 审核通过
* 0 - 审核通过
*/
*/
if
(
status
==
0
)
{
if
(
status
==
0
)
{
return
quotaAuth
(
a
pplyDataVo
,
true
);
return
quotaAuth
(
xyqbA
pplyDataVo
,
true
);
}
}
/**
/**
* 1 - 审核拒绝
* 1 - 审核拒绝
*/
*/
if
(
status
==
1
)
{
if
(
status
==
1
)
{
return
quotaAuth
(
a
pplyDataVo
,
false
);
return
quotaAuth
(
xyqbA
pplyDataVo
,
false
);
}
}
/**
/**
* 2 - 放款中
* 2 - 放款中
*/
*/
if
(
status
==
2
)
{
if
(
status
==
2
)
{
boolean
result
=
quotaAuth
(
a
pplyDataVo
,
true
);
boolean
result
=
quotaAuth
(
xyqbA
pplyDataVo
,
true
);
if
(!
result
)
{
if
(!
result
)
{
return
false
;
return
false
;
}
}
// 查询资方审核进度,如未分配成功,则阻塞下一步
// 查询资方审核进度,如未分配成功,则阻塞下一步
queryInProcessStatusService
.
queryFundingAssignProgress
(
namespace
,
phoneNo
,
fundId
,
symbol
);
queryInProcessStatusService
.
queryFundingAssignProgress
(
namespace
,
phoneNo
,
fundId
,
symbol
);
return
withDraw
(
a
pplyDataVo
,
true
);
return
withDraw
(
xyqbA
pplyDataVo
,
true
);
}
}
/**
/**
* 3 - 放款成功
* 3 - 放款成功
*/
*/
if
(
status
==
3
)
{
if
(
status
==
3
)
{
boolean
quotaAuthResult
=
quotaAuth
(
a
pplyDataVo
,
true
);
boolean
quotaAuthResult
=
quotaAuth
(
xyqbA
pplyDataVo
,
true
);
if
(!
quotaAuthResult
)
{
if
(!
quotaAuthResult
)
{
return
false
;
return
false
;
}
}
// 查询资方审核进度,如未分配成功,则阻塞下一步
// 查询资方审核进度,如未分配成功,则阻塞下一步
queryInProcessStatusService
.
queryFundingAssignProgress
(
namespace
,
phoneNo
,
fundId
,
symbol
);
queryInProcessStatusService
.
queryFundingAssignProgress
(
namespace
,
phoneNo
,
fundId
,
symbol
);
boolean
withDrawResult
=
withDraw
(
a
pplyDataVo
,
true
);
boolean
withDrawResult
=
withDraw
(
xyqbA
pplyDataVo
,
true
);
if
(!
withDrawResult
)
{
if
(!
withDrawResult
)
{
WebSocketServer
.
sendInfo
(
"提现失败!"
,
symbol
);
WebSocketServer
.
sendInfo
(
"提现失败!"
,
symbol
);
return
false
;
return
false
;
...
@@ -321,7 +321,7 @@ public class XyqbDataServiceImpl implements XyqbDataService {
...
@@ -321,7 +321,7 @@ public class XyqbDataServiceImpl implements XyqbDataService {
WebSocketServer
.
sendInfo
(
"提现成功,10秒后放款!"
,
symbol
);
WebSocketServer
.
sendInfo
(
"提现成功,10秒后放款!"
,
symbol
);
Thread
.
sleep
(
10000
);
Thread
.
sleep
(
10000
);
// 广达小贷-手动放款
// 广达小贷-手动放款
boolean
makeLoanResult
=
makeLoan
(
a
pplyDataVo
,
true
);
boolean
makeLoanResult
=
makeLoan
(
xyqbA
pplyDataVo
,
true
);
if
(
makeLoanResult
)
{
if
(
makeLoanResult
)
{
WebSocketServer
.
sendInfo
(
"放款成功!"
,
symbol
);
WebSocketServer
.
sendInfo
(
"放款成功!"
,
symbol
);
}
else
{
}
else
{
...
@@ -334,7 +334,7 @@ public class XyqbDataServiceImpl implements XyqbDataService {
...
@@ -334,7 +334,7 @@ public class XyqbDataServiceImpl implements XyqbDataService {
* 4 - 放款失败
* 4 - 放款失败
*/
*/
if
(
status
==
4
)
{
if
(
status
==
4
)
{
boolean
quotaAuthResult
=
quotaAuth
(
a
pplyDataVo
,
true
);
boolean
quotaAuthResult
=
quotaAuth
(
xyqbA
pplyDataVo
,
true
);
if
(!
quotaAuthResult
)
{
if
(!
quotaAuthResult
)
{
return
false
;
return
false
;
}
}
...
@@ -342,19 +342,19 @@ public class XyqbDataServiceImpl implements XyqbDataService {
...
@@ -342,19 +342,19 @@ public class XyqbDataServiceImpl implements XyqbDataService {
queryInProcessStatusService
.
queryFundingAssignProgress
(
namespace
,
phoneNo
,
fundId
,
symbol
);
queryInProcessStatusService
.
queryFundingAssignProgress
(
namespace
,
phoneNo
,
fundId
,
symbol
);
// 云南信托:二次风控失败,即代表放款失败
// 云南信托:二次风控失败,即代表放款失败
if
(
fundId
==
1040
||
fundId
==
1030
)
{
if
(
fundId
==
1040
||
fundId
==
1030
)
{
withDraw
(
a
pplyDataVo
,
false
);
withDraw
(
xyqbA
pplyDataVo
,
false
);
WebSocketServer
.
sendInfo
(
"放款失败!"
,
symbol
);
WebSocketServer
.
sendInfo
(
"放款失败!"
,
symbol
);
setUserStatusRedisValue
(
namespace
,
phoneNo
,
4
);
setUserStatusRedisValue
(
namespace
,
phoneNo
,
4
);
return
true
;
return
true
;
}
}
boolean
withDrawResult
=
withDraw
(
a
pplyDataVo
,
true
);
boolean
withDrawResult
=
withDraw
(
xyqbA
pplyDataVo
,
true
);
if
(!
withDrawResult
)
{
if
(!
withDrawResult
)
{
WebSocketServer
.
sendInfo
(
"提现失败!"
,
symbol
);
WebSocketServer
.
sendInfo
(
"提现失败!"
,
symbol
);
return
false
;
return
false
;
}
}
WebSocketServer
.
sendInfo
(
"提现成功,10秒后放款!"
,
symbol
);
WebSocketServer
.
sendInfo
(
"提现成功,10秒后放款!"
,
symbol
);
Thread
.
sleep
(
10000
);
Thread
.
sleep
(
10000
);
boolean
makeLoanResult
=
makeLoan
(
a
pplyDataVo
,
false
);
boolean
makeLoanResult
=
makeLoan
(
xyqbA
pplyDataVo
,
false
);
if
(
makeLoanResult
)
{
if
(
makeLoanResult
)
{
WebSocketServer
.
sendInfo
(
"放款失败!"
,
symbol
);
WebSocketServer
.
sendInfo
(
"放款失败!"
,
symbol
);
}
}
...
@@ -365,44 +365,44 @@ public class XyqbDataServiceImpl implements XyqbDataService {
...
@@ -365,44 +365,44 @@ public class XyqbDataServiceImpl implements XyqbDataService {
}
}
@Override
@Override
public
GenLoanUser
queryUserStatus
(
String
namespace
,
String
phoneNo
)
{
public
XjfqGenProcessVo
queryUserStatus
(
String
namespace
,
String
phoneNo
)
{
String
redisResult
=
redis
Util
.
get
(
namespace
+
"_"
+
phoneNo
).
toString
();
String
redisResult
=
redis
Template
.
opsForValue
()
.
get
(
namespace
+
"_"
+
phoneNo
).
toString
();
log
.
info
(
"获取redis key结果为:"
+
redisResult
);
log
.
info
(
"获取redis key结果为:"
+
redisResult
);
GenLoanUser
genLoanUser
=
new
GenLoanUser
();
XjfqGenProcessVo
xjfqGenProcessVo
=
new
XjfqGenProcessVo
();
genLoanUser
=
queryBasicLoanStatusData
Service
.
getUserInfoByPhoneNo
(
namespace
,
phoneNo
);
xjfqGenProcessVo
=
xyqbBasicQuery
Service
.
getUserInfoByPhoneNo
(
namespace
,
phoneNo
);
genLoanUser
.
setFundId
(
queryBasicLoanStatusDataService
.
getAssignFundIdByUserId
(
namespace
,
genLoanUser
.
getUserId
()));
xjfqGenProcessVo
.
setFundId
(
xyqbBasicQueryService
.
getAssignFundIdByUserId
(
namespace
,
xjfqGenProcessVo
.
getUserId
()));
// 授信审核中
// 授信审核中
if
(
redisResult
.
equals
(
"0"
))
{
if
(
redisResult
.
equals
(
"0"
))
{
genLoanUser
.
setStatus
(
0
);
xjfqGenProcessVo
.
setStatus
(
0
);
genLoanUser
.
setDesc
(
"授信审核中"
);
xjfqGenProcessVo
.
setDesc
(
"授信审核中"
);
}
}
// 授信审核失败
// 授信审核失败
if
(
redisResult
.
equals
(
"1"
))
{
if
(
redisResult
.
equals
(
"1"
))
{
genLoanUser
.
setStatus
(
1
);
xjfqGenProcessVo
.
setStatus
(
1
);
genLoanUser
.
setDesc
(
"授信审核失败"
);
xjfqGenProcessVo
.
setDesc
(
"授信审核失败"
);
}
}
// 提现成功
// 提现成功
if
(
redisResult
.
equals
(
"2"
))
{
if
(
redisResult
.
equals
(
"2"
))
{
// 设置资方id
// 设置资方id
genLoanUser
.
setStatus
(
2
);
xjfqGenProcessVo
.
setStatus
(
2
);
genLoanUser
.
setDesc
(
"提现成功"
);
xjfqGenProcessVo
.
setDesc
(
"提现成功"
);
}
}
// 提现失败
// 提现失败
if
(
redisResult
.
equals
(
"10"
))
{
if
(
redisResult
.
equals
(
"10"
))
{
genLoanUser
.
equals
(
"10"
);
xjfqGenProcessVo
.
equals
(
"10"
);
genLoanUser
.
setDesc
(
"资方分配失败"
);
xjfqGenProcessVo
.
setDesc
(
"资方分配失败"
);
}
}
// 放款成功
// 放款成功
if
(
redisResult
.
equals
(
"3"
))
{
if
(
redisResult
.
equals
(
"3"
))
{
genLoanUser
.
setStatus
(
3
);
xjfqGenProcessVo
.
setStatus
(
3
);
genLoanUser
.
setDesc
(
"放款成功"
);
xjfqGenProcessVo
.
setDesc
(
"放款成功"
);
}
}
// 放款失败
// 放款失败
if
(
redisResult
.
equals
(
"4"
))
{
if
(
redisResult
.
equals
(
"4"
))
{
genLoanUser
.
setStatus
(
4
);
xjfqGenProcessVo
.
setStatus
(
4
);
genLoanUser
.
setDesc
(
"放款失败"
);
xjfqGenProcessVo
.
setDesc
(
"放款失败"
);
}
}
return
genLoanUser
;
return
xjfqGenProcessVo
;
}
}
...
...
src/main/java/cn/qg/qaplatform/zdata/service/
impl/QueryLoanUserData
ServiceImpl.java
→
src/main/java/cn/qg/qaplatform/zdata/service/
xyqb/impl/XyqbQuery
ServiceImpl.java
View file @
88e47805
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
impl
;
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
.
impl
;
import
cn.qg.qaplatform.zdata.
domain.QueryLoanUser
;
import
cn.qg.qaplatform.zdata.
entity.XjfqUserEntity
;
import
cn.qg.qaplatform.zdata.service.
QueryLoanUserData
Service
;
import
cn.qg.qaplatform.zdata.service.
xyqb.XyqbQuery
Service
;
import
cn.qg.qaplatform.zdata.service.
QueryBasicLoanStatusData
Service
;
import
cn.qg.qaplatform.zdata.service.
xyqb.XyqbBasicQuery
Service
;
import
cn.qg.qaplatform.utils.page.PageResult
;
import
cn.qg.qaplatform.utils.page.PageResult
;
import
cn.qg.qaplatform.utils.page.PageUtil
;
import
cn.qg.qaplatform.utils.page.PageUtil
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
...
@@ -19,10 +19,10 @@ import java.util.List;
...
@@ -19,10 +19,10 @@ import java.util.List;
*/
*/
@Service
@Service
@Slf4j
@Slf4j
public
class
QueryLoanUserDataServiceImpl
implements
QueryLoanUserData
Service
{
public
class
XyqbQueryServiceImpl
implements
XyqbQuery
Service
{
@Autowired
@Autowired
private
QueryBasicLoanStatusData
Service
basicLoanStatusDataService
;
private
XyqbBasicQuery
Service
basicLoanStatusDataService
;
/**
/**
* 筛选某个状态的用户(0-注册未申请,1-授信中,2-审核通过,3-审核拒绝,4-审核通过未提现,5-放款成功,6-放款失败,7-多订单)
* 筛选某个状态的用户(0-注册未申请,1-授信中,2-审核通过,3-审核拒绝,4-审核通过未提现,5-放款成功,6-放款失败,7-多订单)
...
@@ -36,7 +36,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
...
@@ -36,7 +36,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
@Override
@Override
public
PageResult
getLoanUserData
(
String
namespace
,
Integer
status
,
Integer
channel
,
Integer
fundId
,
Integer
pageNum
,
Integer
pageSize
)
{
public
PageResult
getLoanUserData
(
String
namespace
,
Integer
status
,
Integer
channel
,
Integer
fundId
,
Integer
pageNum
,
Integer
pageSize
)
{
List
<
QueryLoanUser
>
result
=
new
ArrayList
<>();
List
<
XjfqUserEntity
>
result
=
new
ArrayList
<>();
/**
/**
* 0-注册未申请
* 0-注册未申请
...
@@ -49,7 +49,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
...
@@ -49,7 +49,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
}
}
PageHelper
.
startPage
(
pageNum
,
pageSize
);
PageHelper
.
startPage
(
pageNum
,
pageSize
);
result
=
basicLoanStatusDataService
.
getUserDataListByUuidList
(
namespace
,
uuidList
);
result
=
basicLoanStatusDataService
.
getUserDataListByUuidList
(
namespace
,
uuidList
);
PageInfo
<
QueryLoanUser
>
pageList
=
new
PageInfo
<>(
result
);
PageInfo
<
XjfqUserEntity
>
pageList
=
new
PageInfo
<>(
result
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
return
pageResult
;
return
pageResult
;
}
}
...
@@ -65,7 +65,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
...
@@ -65,7 +65,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
}
}
PageHelper
.
startPage
(
pageNum
,
pageSize
);
PageHelper
.
startPage
(
pageNum
,
pageSize
);
result
=
basicLoanStatusDataService
.
getUserDataListByUserIdList
(
namespace
,
userIdList
);
result
=
basicLoanStatusDataService
.
getUserDataListByUserIdList
(
namespace
,
userIdList
);
PageInfo
<
QueryLoanUser
>
pageList
=
new
PageInfo
<>(
result
);
PageInfo
<
XjfqUserEntity
>
pageList
=
new
PageInfo
<>(
result
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
return
pageResult
;
return
pageResult
;
}
}
...
@@ -86,7 +86,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
...
@@ -86,7 +86,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
}
else
{
}
else
{
result
.
forEach
((
item
)
->
item
.
setFundId
(
fundId
));
result
.
forEach
((
item
)
->
item
.
setFundId
(
fundId
));
}
}
PageInfo
<
QueryLoanUser
>
pageList
=
new
PageInfo
<>(
result
);
PageInfo
<
XjfqUserEntity
>
pageList
=
new
PageInfo
<>(
result
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
return
pageResult
;
return
pageResult
;
}
}
...
@@ -107,7 +107,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
...
@@ -107,7 +107,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
}
else
{
}
else
{
result
.
forEach
((
item
)
->
item
.
setFundId
(
fundId
));
result
.
forEach
((
item
)
->
item
.
setFundId
(
fundId
));
}
}
PageInfo
<
QueryLoanUser
>
pageList
=
new
PageInfo
<>(
result
);
PageInfo
<
XjfqUserEntity
>
pageList
=
new
PageInfo
<>(
result
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
return
pageResult
;
return
pageResult
;
}
}
...
@@ -124,7 +124,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
...
@@ -124,7 +124,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
PageHelper
.
startPage
(
pageNum
,
pageSize
);
PageHelper
.
startPage
(
pageNum
,
pageSize
);
result
=
basicLoanStatusDataService
.
getUserDataListByUserIdList
(
namespace
,
userIdList
);
result
=
basicLoanStatusDataService
.
getUserDataListByUserIdList
(
namespace
,
userIdList
);
result
.
forEach
((
item
)
->
item
.
setFundId
(
fundId
));
result
.
forEach
((
item
)
->
item
.
setFundId
(
fundId
));
PageInfo
<
QueryLoanUser
>
pageList
=
new
PageInfo
<>(
result
);
PageInfo
<
XjfqUserEntity
>
pageList
=
new
PageInfo
<>(
result
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
return
pageResult
;
return
pageResult
;
}
}
...
@@ -145,7 +145,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
...
@@ -145,7 +145,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
}
else
{
}
else
{
result
.
forEach
((
item
)
->
item
.
setFundId
(
fundId
));
result
.
forEach
((
item
)
->
item
.
setFundId
(
fundId
));
}
}
PageInfo
<
QueryLoanUser
>
pageList
=
new
PageInfo
<>(
result
);
PageInfo
<
XjfqUserEntity
>
pageList
=
new
PageInfo
<>(
result
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
return
pageResult
;
return
pageResult
;
}
}
...
@@ -167,7 +167,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
...
@@ -167,7 +167,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
}
else
{
}
else
{
result
.
forEach
((
item
)
->
item
.
setFundId
(
fundId
));
result
.
forEach
((
item
)
->
item
.
setFundId
(
fundId
));
}
}
PageInfo
<
QueryLoanUser
>
pageList
=
new
PageInfo
<>(
result
);
PageInfo
<
XjfqUserEntity
>
pageList
=
new
PageInfo
<>(
result
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
return
pageResult
;
return
pageResult
;
}
}
...
@@ -183,7 +183,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
...
@@ -183,7 +183,7 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
}
}
PageHelper
.
startPage
(
pageNum
,
pageSize
);
PageHelper
.
startPage
(
pageNum
,
pageSize
);
result
=
basicLoanStatusDataService
.
getUserDataListByUuidList
(
namespace
,
uuidList
);
result
=
basicLoanStatusDataService
.
getUserDataListByUuidList
(
namespace
,
uuidList
);
PageInfo
<
QueryLoanUser
>
pageList
=
new
PageInfo
<>(
result
);
PageInfo
<
XjfqUserEntity
>
pageList
=
new
PageInfo
<>(
result
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
PageResult
pageResult
=
PageUtil
.
getPageResult
(
pageList
,
pageNum
,
pageSize
);
return
pageResult
;
return
pageResult
;
}
}
...
...
src/main/resources/application.yml
View file @
88e47805
...
@@ -6,6 +6,9 @@ spring:
...
@@ -6,6 +6,9 @@ spring:
password
:
qatest
password
:
qatest
driver-class-name
:
com.mysql.jdbc.Driver
driver-class-name
:
com.mysql.jdbc.Driver
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
break-after-acquire-failure
:
true
# 连接失败后不重试
connection-error-retry-attempts
:
1
jackson
:
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
time-zone
:
GMT+8
...
@@ -19,6 +22,8 @@ spring:
...
@@ -19,6 +22,8 @@ spring:
max-active
:
8
max-active
:
8
max-wait
:
-1
max-wait
:
-1
max-idle
:
8
max-idle
:
8
application
:
name
:
qa-platform
server
:
server
:
port
:
8082
port
:
8082
...
@@ -26,7 +31,7 @@ server:
...
@@ -26,7 +31,7 @@ server:
# mybatis-plus 配置
# mybatis-plus 配置
mybatis-plus
:
mybatis-plus
:
mapper-locations
:
classpath:mapper/*/*.xml
mapper-locations
:
classpath:mapper/*/*.xml
type-aliases-package
:
cn.qg.qaplatform.*.
domain
type-aliases-package
:
cn.qg.qaplatform.*.
entity
configuration
:
configuration
:
map-underscore-to-camel-case
:
true
map-underscore-to-camel-case
:
true
...
@@ -38,9 +43,9 @@ pagehelper:
...
@@ -38,9 +43,9 @@ pagehelper:
params
:
count=countSql
params
:
count=countSql
# 日志配置
# 日志配置
logging
:
#
logging:
level
:
#
level:
root
:
info
#
root: info
cn.qg.qaplatform
:
info
#
cn.qg.qaplatform: info
file
:
#
file:
name
:
/home/quant_group/logs/qa-platform.log
#
name: /home/quant_group/logs/qa-platform.log
src/main/resources/logback-dev.xml
0 → 100644
View file @
88e47805
<?xml version="1.0" encoding="UTF-8" ?>
<!-- 日志配置 -->
<configuration>
<property
name=
"DEV_HOME"
value=
"."
/>
<springProperty
name=
"spring.application.name"
source=
"spring.application.name"
/>
<property
name=
"LOG_LEVEL_PATTERN"
value=
"%clr(%5p) %clr([${spring.application.name:-},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}]){yellow}"
/>
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"${CONSOLE_LOG_PATTERN:-%clr(%d{MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%10.10t]){faint} [%40.40file:%4.4line] %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"
/>
<!-- 这里面定义了 CONSOLE_LOG_PATTERN, FILE_LOG_PATTERN 等日志格式, 还定义了一些日志级别 -->
<include
resource=
"org/springframework/boot/logging/logback/defaults.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/console-appender.xml"
/>
<!--滚动文件日志-->
<appender
name=
"fileLog"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
${DEV_HOME}/debug.log
</file>
<append>
true
</append>
<encoder>
<!--日志输出格式-->
<pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!-- rollover daily -->
<fileNamePattern>
${DEV_HOME}/debug.%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
300MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
<logger
name=
"com.example.demo"
level=
"DEBUG"
/>
<logger
name=
"org.apache"
level=
"warn"
/>
<logger
name=
"org.springframework"
level=
"warn"
/>
<logger
name=
"ch.qos.logback"
level=
"warn"
/>
<!--基础的日志输出-->
<root
level=
"INFO"
>
<appender-ref
ref=
"CONSOLE"
/>
<appender-ref
ref=
"fileLog"
/>
</root>
</configuration>
\ No newline at end of file
src/main/resources/logback-pro.xml
0 → 100644
View file @
88e47805
<?xml version="1.0" encoding="UTF-8" ?>
<!-- 日志配置 -->
<configuration>
<springProperty
name=
"spring.application.name"
source=
"spring.application.name"
/>
<property
name=
"LOG_LEVEL_PATTERN"
value=
"%5p [${spring.application.name:-},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}]"
/>
<property
name=
"FILE_LOG_PATTERN"
value=
"${FILE_LOG_PATTERN:-%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} --- [%thread] [%file:%line] %logger - %msg%n}"
/>
<appender
name=
"FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
/home/quant_group/logs/qa-platform.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
/home/quant_group/logs/qa-platform.log.%d{yyyy-MM-dd}
</fileNamePattern>
<maxHistory>
30
</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
${FILE_LOG_PATTERN}
</pattern>
</encoder>
</appender>
<appender
name=
"Sentry"
class=
"cn.quantgroup.sentry.appender.StandardSentryAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
WARN
</level>
<!-- level:基本建议ERROR or WARN -->
</filter>
</appender>
<logger
name=
"org.springframework"
level=
"warn"
/>
<logger
name=
"org.hibernate"
level=
"warn"
/>
<logger
name=
"org.apache"
level=
"warn"
/>
<logger
name=
"ch.qos.logback"
level=
"warn"
/>
<!--基础的日志输出-->
<root
level=
"INFO"
>
<appender-ref
ref=
"FILE"
/>
<appender-ref
ref=
"Sentry"
/>
</root>
</configuration>
\ No newline at end of file
src/main/resources/mapper/zdata/
Query
VccDataMapper.xml
→
src/main/resources/mapper/zdata/VccDataMapper.xml
View file @
88e47805
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"cn.qg.qaplatform.zdata.mapper.
Query
VccDataMapper"
>
<mapper
namespace=
"cn.qg.qaplatform.zdata.mapper.VccDataMapper"
>
<select
id=
"queryVccDataByStatus"
resultType=
"cn.qg.qaplatform.zdata.
domain.QueryVccUser
"
>
<select
id=
"queryVccDataByStatus"
resultType=
"cn.qg.qaplatform.zdata.
entity.VccUserEntity
"
>
select
select
`phone_no` as phoneNo,
`phone_no` as phoneNo,
`user_id` as userId,
`user_id` as userId,
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
order by id desc
order by id desc
</select>
</select>
<select
id=
"queryUserVccStatus"
resultType=
"cn.qg.qaplatform.zdata.
domain.QueryVccUser
"
>
<select
id=
"queryUserVccStatus"
resultType=
"cn.qg.qaplatform.zdata.
entity.VccUserEntity
"
>
select
select
`phone_no` as phoneNo,
`phone_no` as phoneNo,
`user_id` as userId,
`user_id` as userId,
...
...
src/main/resources/mapper/zdata/
QueryBasicLoanStatus
DataMapper.xml
→
src/main/resources/mapper/zdata/
XyqbLoan
DataMapper.xml
View file @
88e47805
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"cn.qg.qaplatform.zdata.mapper.
QueryBasicLoanStatus
DataMapper"
>
<mapper
namespace=
"cn.qg.qaplatform.zdata.mapper.
XyqbLoan
DataMapper"
>
<!-- 注册未申请 -->
<!-- 注册未申请 -->
<select
id=
"getUnApplyLoanUserUuidList"
resultType=
"java.lang.String"
>
<select
id=
"getUnApplyLoanUserUuidList"
resultType=
"java.lang.String"
>
SELECT `uuid` FROM `apply_list`
SELECT `uuid` FROM `apply_list`
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
</select>
</select>
<!-- 根据uuidList获取用户信息列表 -->
<!-- 根据uuidList获取用户信息列表 -->
<select
id=
"getUserDataListByUuidList"
parameterType=
"java.util.List"
resultType=
"cn.qg.qaplatform.zdata.
domain.QueryLoanUser
"
>
<select
id=
"getUserDataListByUuidList"
parameterType=
"java.util.List"
resultType=
"cn.qg.qaplatform.zdata.
entity.XjfqUserEntity
"
>
SELECT `id` as userId, `phone_no` as phoneNo, `uuid`, `registered_from` as registeredFrom, `enable`, `created_at` as createdAt FROM `user`
SELECT `id` as userId, `phone_no` as phoneNo, `uuid`, `registered_from` as registeredFrom, `enable`, `created_at` as createdAt FROM `user`
where `uuid` in
where `uuid` in
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
</select>
</select>
<!-- 根据userIdList获取用户信息List -->
<!-- 根据userIdList获取用户信息List -->
<select
id=
"getUserDataListByUserIdList"
resultType=
"cn.qg.qaplatform.zdata.
domain.QueryLoanUser
"
>
<select
id=
"getUserDataListByUserIdList"
resultType=
"cn.qg.qaplatform.zdata.
entity.XjfqUserEntity
"
>
SELECT `id` as userId, `uuid`, `phone_no` as phoneNo, `registered_from` as registeredFrom, `enable`, `created_at` as createdAt FROM `user`
SELECT `id` as userId, `uuid`, `phone_no` as phoneNo, `registered_from` as registeredFrom, `enable`, `created_at` as createdAt FROM `user`
where `id` in
where `id` in
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
...
@@ -94,7 +94,7 @@
...
@@ -94,7 +94,7 @@
</select>
</select>
<!-- 根据手机号获取用户信息-->
<!-- 根据手机号获取用户信息-->
<select
id=
"getUserInfoByPhoneNo"
resultType=
"cn.qg.qaplatform.zdata.
domain.GenLoanUser
"
>
<select
id=
"getUserInfoByPhoneNo"
resultType=
"cn.qg.qaplatform.zdata.
entity.XjfqGenProcessVo
"
>
SELECT `id` as userId, `phone_no` as phoneNo, `uuid`, `registered_from` as registeredFrom, `created_at` as createdAt FROM `user`
SELECT `id` as userId, `phone_no` as phoneNo, `uuid`, `registered_from` as registeredFrom, `created_at` as createdAt FROM `user`
WHERE `phone_no` = #{phoneNo}
WHERE `phone_no` = #{phoneNo}
</select>
</select>
...
...
src/test/java/cn/qg/qaplatform/test/Lexin.java
View file @
88e47805
...
@@ -3,7 +3,7 @@ package cn.qg.qaplatform.test;
...
@@ -3,7 +3,7 @@ package cn.qg.qaplatform.test;
import
cn.qg.qaplatform.zdata.process.Common
;
import
cn.qg.qaplatform.zdata.process.Common
;
import
cn.qg.qaplatform.zdata.process.Xyqb
;
import
cn.qg.qaplatform.zdata.process.Xyqb
;
import
cn.qg.qaplatform.utils.DBUtils
;
import
cn.qg.qaplatform.utils.DBUtils
;
import
cn.qg.qaplatform.
utils
.Encrypt.LexinEncrypt
;
import
cn.qg.qaplatform.
zdata
.Encrypt.LexinEncrypt
;
import
cn.qg.qaplatform.utils.HttpClientUtils
;
import
cn.qg.qaplatform.utils.HttpClientUtils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.util.DigestUtils
;
...
...
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