Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
ka-code-generator
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
QG
ka-code-generator
Commits
abd84ff5
Commit
abd84ff5
authored
Jun 12, 2020
by
xiaozhe.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v
parent
ca6c9738
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
266 additions
and
651 deletions
+266
-651
codegenerator.iml
codegenerator.iml
+0
-72
FreemarkerTool.java
...java/cn/quantgroup/codegenerator/util/FreemarkerTool.java
+6
-6
XmlParseUtil.java
...n/java/cn/quantgroup/codegenerator/util/XmlParseUtil.java
+1
-1
GenerateConf.xml
src/main/resources/GenerateConf.xml
+6
-6
SignStatusEnum.ftl
...sources/templates/code-generator/enums/SignStatusEnum.ftl
+0
-13
UserAccessResultEnum.ftl
...s/templates/code-generator/enums/UserAccessResultEnum.ftl
+0
-14
EventHandler.ftl
...es/templates/code-generator/eventhandler/EventHandler.ftl
+107
-142
ApplyLoanRequest.ftl
...urces/templates/code-generator/model/ApplyLoanRequest.ftl
+5
-0
CreditApplyRequest.ftl
...ces/templates/code-generator/model/CreditApplyRequest.ftl
+4
-4
VerifyBindSmsResult.ftl
...es/templates/code-generator/model/VerifyBindSmsResult.ftl
+0
-2
Service.ftl
...in/resources/templates/code-generator/service/Service.ftl
+12
-12
ServiceImpl.ftl
...esources/templates/code-generator/service/ServiceImpl.ftl
+118
-132
CodeEnum.ftl
...main/resources/templates/code-generator/util/CodeEnum.ftl
+7
-172
ResultUtils.ftl
...n/resources/templates/code-generator/util/ResultUtils.ftl
+0
-75
No files found.
codegenerator.iml
deleted
100644 → 0
View file @
ca6c9738
<?xml version="1.0" encoding="UTF-8"?>
<module
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=
"true"
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"FacetManager"
>
<facet
type=
"Spring"
name=
"Spring"
>
<configuration
/>
</facet>
</component>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_8"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/java"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/resources"
type=
"java-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/java"
isTestSource=
"true"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter:2.3.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot:2.3.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-context:5.2.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-aop:5.2.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-expression:5.2.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-logging:2.3.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: ch.qos.logback:logback-classic:1.2.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: ch.qos.logback:logback-core:1.2.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.logging.log4j:log4j-to-slf4j:2.13.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.logging.log4j:log4j-api:2.13.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.slf4j:jul-to-slf4j:1.7.30"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: jakarta.annotation:jakarta.annotation-api:1.3.5"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-core:5.2.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-jcl:5.2.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.yaml:snakeyaml:1.26"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-freemarker:2.3.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.freemarker:freemarker:2.3.30"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-context-support:5.2.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-beans:5.2.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.commons:commons-lang3:3.8"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: cn.hutool:hutool-all:5.0.6"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.projectlombok:lombok:1.18.12"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework.boot:spring-boot-starter-test:2.3.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework.boot:spring-boot-test:2.3.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.3.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: com.jayway.jsonpath:json-path:2.4.0"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: net.minidev:json-smart:2.3"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: net.minidev:accessors-smart:1.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.ow2.asm:asm:5.0.4"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.slf4j:slf4j-api:1.7.30"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: jakarta.activation:jakarta.activation-api:1.2.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.assertj:assertj-core:3.16.1"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.hamcrest:hamcrest:2.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.junit.jupiter:junit-jupiter:5.6.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.junit.jupiter:junit-jupiter-api:5.6.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.apiguardian:apiguardian-api:1.1.0"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.opentest4j:opentest4j:1.2.0"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.junit.platform:junit-platform-commons:1.6.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.junit.jupiter:junit-jupiter-params:5.6.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.junit.jupiter:junit-jupiter-engine:5.6.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.junit.platform:junit-platform-engine:1.6.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.mockito:mockito-core:3.3.3"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: net.bytebuddy:byte-buddy:1.10.10"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: net.bytebuddy:byte-buddy-agent:1.10.10"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.objenesis:objenesis:2.6"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.mockito:mockito-junit-jupiter:3.3.3"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.skyscreamer:jsonassert:1.5.0"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework:spring-test:5.2.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.xmlunit:xmlunit-core:2.7.0"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
src/main/java/cn/quantgroup/codegenerator/util/FreemarkerTool.java
View file @
abd84ff5
...
...
@@ -66,12 +66,12 @@ public class FreemarkerTool {
}
public
void
processFile
(){
String
modelPath
=
System
.
getProperty
(
"user.dir"
)
+
"
\\src\\main\\resources\\templates\\code-generator\\
model"
;
String
servicePath
=
System
.
getProperty
(
"user.dir"
)
+
"
\\src\\main\\resources\\templates\\code-generator\\
service"
;
String
callbackPath
=
System
.
getProperty
(
"user.dir"
)
+
"
\\src\\main\\resources\\templates\\code-generator\\
callback"
;
String
eventHandlerPath
=
System
.
getProperty
(
"user.dir"
)
+
"
\\src\\main\\resources\\templates\\code-generator\\
eventhandler"
;
String
enumsPath
=
System
.
getProperty
(
"user.dir"
)
+
"
\\src\\main\\resources\\templates\\code-generator\\
enums"
;
String
utilPath
=
System
.
getProperty
(
"user.dir"
)
+
"
\\src\\main\\resources\\templates\\code-generator\\
util"
;
String
modelPath
=
System
.
getProperty
(
"user.dir"
)
+
"
/src/main/resources/templates/code-generator/
model"
;
String
servicePath
=
System
.
getProperty
(
"user.dir"
)
+
"
/src/main/resources/templates/code-generator/
service"
;
String
callbackPath
=
System
.
getProperty
(
"user.dir"
)
+
"
/src/main/resources/templates/code-generator/
callback"
;
String
eventHandlerPath
=
System
.
getProperty
(
"user.dir"
)
+
"
/src/main/resources/templates/code-generator/
eventhandler"
;
String
enumsPath
=
System
.
getProperty
(
"user.dir"
)
+
"
/src/main/resources/templates/code-generator/
enums"
;
String
utilPath
=
System
.
getProperty
(
"user.dir"
)
+
"
/src/main/resources/templates/code-generator/
util"
;
try
{
...
...
src/main/java/cn/quantgroup/codegenerator/util/XmlParseUtil.java
View file @
abd84ff5
...
...
@@ -22,7 +22,7 @@ public class XmlParseUtil {
Map
<
String
,
String
>
node
=
new
HashMap
<>();
File
xmlFile
=
new
File
(
System
.
getProperty
(
"user.dir"
),
"
\\src\\main\\resources\\
GenerateConf.xml"
);
File
xmlFile
=
new
File
(
System
.
getProperty
(
"user.dir"
),
"
/src/main/resources/
GenerateConf.xml"
);
DocumentBuilderFactory
builderFactory
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilder
builder
=
builderFactory
.
newDocumentBuilder
();
Document
doc
=
builder
.
parse
(
xmlFile
);
...
...
src/main/resources/GenerateConf.xml
View file @
abd84ff5
...
...
@@ -6,27 +6,27 @@
<author>
WangXiangwei
</author>
<prefix>
TestChannel
</prefix>
<model
path=
"
E:\testchannel\dto\
model"
>
<model
path=
"
/Users/chenxiaozhe/quantgroup/ka-code-generator/testchannel/dto/
model"
>
<packageName>
cn.quantgroup.clf.api.testchannel.dto.model
</packageName>
</model>
<util
path=
"
E:\testchannel\dto\
util"
>
<util
path=
"
/Users/chenxiaozhe/quantgroup/ka-code-generator/testchannel/dto/
util"
>
<packageName>
cn.quantgroup.clf.api.testchannel.dto.util
</packageName>
</util>
<enums
path=
"
E:\testchannel\dto\
enums"
>
<enums
path=
"
/Users/chenxiaozhe/quantgroup/ka-code-generator/testchannel/dto/
enums"
>
<packageName>
cn.quantgroup.clf.api.testchannel.dto.enums
</packageName>
</enums>
<callback
path=
"
E:\testchannel\dto\
callback"
>
<callback
path=
"
/Users/chenxiaozhe/quantgroup/ka-code-generator/testchannel/dto/
callback"
>
<packageName>
cn.quantgroup.clf.api.testchannel.dto.callback
</packageName>
</callback>
<service
path=
"
E:\testchannel\
service"
>
<service
path=
"
/Users/chenxiaozhe/quantgroup/ka-code-generator/testchannel/
service"
>
<packageName>
cn.quantgroup.clf.api.testchannel.service
</packageName>
</service>
<eventHandler
path=
"
E:\testchannel\
eventhandler"
>
<eventHandler
path=
"
/Users/chenxiaozhe/quantgroup/ka-code-generator/testchannel/
eventhandler"
>
<packageName>
cn.quantgroup.clf.api.testchannel.eventhandler
</packageName>
</eventHandler>
...
...
src/main/resources/templates/code-generator/enums/SignStatusEnum.ftl
deleted
100644 → 0
View file @
ca6c9738
package
${
enumsPackage
};
/**
*
绑卡状态:
*
SUCCESS
:成功
;
*
FAIL
:
失败
*
*
@
author
${
author
}
*
@
date
${.
now
?
string
(
'yyyy-MM-dd HH:mm:ss'
)}
*/
public
enum
${
prefix
}
SignStatusEnum
{
SUCCESS
,
FAIL
}
\ No newline at end of file
src/main/resources/templates/code-generator/enums/UserAccessResultEnum.ftl
deleted
100644 → 0
View file @
ca6c9738
package
${
enumsPackage
};
/**
*
准入接口返回值
*
包括
“
CONTINUE
”
和
“
BREAK
”
两种返回结果。
*
CONTINUE
代表该用户可以继续进行后面的注册等操作,
*
BREAK
代表该用户不予以接受,不能进行后续的注册等操作
*
@
author
${
author
}
*
@
date
${.
now
?
string
(
'yyyy-MM-dd HH:mm:ss'
)}
*/
public
enum
${
prefix
}
UserAccessResultEnum
{
CONTINUE
,
BREAK
;
}
\ No newline at end of file
src/main/resources/templates/code-generator/eventhandler/EventHandler.ftl
View file @
abd84ff5
This diff is collapsed.
Click to expand it.
src/main/resources/templates/code-generator/model/ApplyLoanRequest.ftl
View file @
abd84ff5
...
...
@@ -24,6 +24,11 @@ public class ${prefix}ApplyLoanRequest {
*/
private
String
channelOrderNo
;
/**
*
渠道借款订单号
*/
private
String
channelLoanNo
;
/**
*
绑卡
Id
*/
...
...
src/main/resources/templates/code-generator/model/CreditApplyRequest.ftl
View file @
abd84ff5
...
...
@@ -5,7 +5,7 @@ import cn.quantgroup.cashloanflow.model.standard.apply.StandardApplyLoanData;
import
cn
.
quantgroup
.
cashloanflow
.
model
.
standard
.
apply
.
StandardpicModelTypeEnum
;
import
cn
.
quantgroup
.
cashloanflow
.
util
.
RegisterFrom
;
import
cn
.
quantgroup
.
cashloanflow
.
util
.
Utils
;
import
cn
.
quantgroup
.
loanflow
.
application
.
model
.
ApplyLoanData
;
import
cn
.
quantgroup
.
loanflow
.
risk
.
model
.
RiskInfo
;
import
cn
.
quantgroup
.
loanflow
.
risk
.
model
.
StandardOcrData
;
...
...
@@ -184,15 +184,14 @@ public class ${prefix}CreditApplyRequest {
/**
*
标准
API
转换
*
*
@
param
registerFrom
*
@
param
data
*/
public
static
ApplyLoanData
getApplyLoanData
(${
prefix
}
CreditApplyRequest
data
)
{
ApplyLoanData
applyLoanData
=
new
ApplyLoanData
();
applyLoanData
.
setRegisterFrom
(
RegisterFrom
.
JINSHAN
)
applyLoanData
.
setRegisterFrom
(
RegisterFrom
.
JINSHAN
)
;
applyLoanData
.
setUserName
(
data
.
getUserName
());
applyLoanData
.
setPhone
(
data
.
getPhone
());
applyLoanData
.
setPhone
No
(
data
.
getPhoneNo
());
applyLoanData
.
setIdNo
(
data
.
getIdNo
());
applyLoanData
.
setChannelUserId
(
data
.
getChannelUserId
());
applyLoanData
.
setQq
(
data
.
getQq
());
...
...
@@ -219,6 +218,7 @@ public class ${prefix}CreditApplyRequest {
applyLoanData
.
setPurposeEnum
(
data
.
getPurposeEnum
());
applyLoanData
.
setOrderExtData
(
data
.
getOrderExtData
());
applyLoanData
.
setRiskInfo
(
data
.
getRiskInfo
());
return
applyLoanData
;
}
...
...
src/main/resources/templates/code-generator/model/VerifyBindSmsResult.ftl
View file @
abd84ff5
package
${
modelPackage
};
import
${
enumsPackage
}.${
prefix
}
SignStatusEnum
;
import
lombok
.
Data
;
/**
...
...
@@ -12,7 +11,6 @@ import lombok.Data;
@
Data
public
class
${
prefix
}
VerifyBindSmsResult
{
private
${
prefix
}
SignStatusEnum
signStatus
;
private
String
bindId
;
}
\ No newline at end of file
src/main/resources/templates/code-generator/service/Service.ftl
View file @
abd84ff5
package
${
servicePackage
};
import
${
modelPackage
}.${
prefix
}
CreditApplyRequest
;
import
${
modelPackage
}.${
prefix
}
QueryCreditApplyRequest
;
import
${
modelPackage
}.${
prefix
}
UserAccessRequest
;
import
${
modelPackage
}.${
prefix
}
QuerySupportBankcardsRequest
;
...
...
@@ -28,7 +28,7 @@ public interface ${prefix}Service {
*
@
param
userAccessRequest
*
@
return
*/
String
userAccess
(${
prefix
}
UserAccessRequest
userAccessRequest
);
void
userAccess
(${
prefix
}
UserAccessRequest
userAccessRequest
);
/**
*
提交授信
...
...
@@ -36,7 +36,7 @@ public interface ${prefix}Service {
*
@
param
request
*
@
return
*/
String
creditApply
(
ApplyLoanData
request
);
void
creditApply
(${
prefix
}
CreditApplyRequest
request
);
...
...
@@ -46,7 +46,7 @@ public interface ${prefix}Service {
*
@
param
request
*
@
return
*/
String
queryCreditApply
(${
prefix
}
QueryCreditApplyRequest
request
);
void
queryCreditApply
(${
prefix
}
QueryCreditApplyRequest
request
);
/**
...
...
@@ -55,7 +55,7 @@ public interface ${prefix}Service {
*
@
param
request
*
@
return
*/
String
querySupportBankcards
(${
prefix
}
QuerySupportBankcardsRequest
request
);
void
querySupportBankcards
(${
prefix
}
QuerySupportBankcardsRequest
request
);
/**
*
借款试算
...
...
@@ -63,7 +63,7 @@ public interface ${prefix}Service {
*
@
param
request
*
@
return
*/
String
queryLoanTrial
(${
prefix
}
QueryLoanTrialRequest
request
);
void
queryLoanTrial
(${
prefix
}
QueryLoanTrialRequest
request
);
/**
...
...
@@ -72,7 +72,7 @@ public interface ${prefix}Service {
*
@
param
request
*
@
return
*/
String
bindBankCardSms
(${
prefix
}
BindBankCardSmsRequest
request
);
void
bindBankCardSms
(${
prefix
}
BindBankCardSmsRequest
request
);
/**
*
验卡
...
...
@@ -80,7 +80,7 @@ public interface ${prefix}Service {
*
@
param
request
*
@
return
*/
String
verifyBindSms
(${
prefix
}
VerifyBindSmsRequest
request
);
void
verifyBindSms
(${
prefix
}
VerifyBindSmsRequest
request
);
/**
...
...
@@ -89,7 +89,7 @@ public interface ${prefix}Service {
*
@
param
request
*
@
return
*/
String
applyWithdraw
(${
prefix
}
ApplyLoanRequest
request
);
void
applyWithdraw
(${
prefix
}
ApplyLoanRequest
request
);
/**
...
...
@@ -98,7 +98,7 @@ public interface ${prefix}Service {
*
@
param
request
*
@
return
*/
String
queryLoanResult
(${
prefix
}
QueryLoanRequest
request
);
void
queryLoanResult
(${
prefix
}
QueryLoanRequest
request
);
/**
...
...
@@ -107,7 +107,7 @@ public interface ${prefix}Service {
*
@
param
request
*
@
return
*/
String
repayByPlan
(${
prefix
}
RepayByPlanRequest
request
);
void
repayByPlan
(${
prefix
}
RepayByPlanRequest
request
);
/**
*
查询还款结果
...
...
@@ -115,7 +115,7 @@ public interface ${prefix}Service {
*
@
param
request
*
@
return
*/
String
queryRepayResult
(${
prefix
}
QueryRepayRequest
request
);
void
queryRepayResult
(${
prefix
}
QueryRepayRequest
request
);
}
...
...
src/main/resources/templates/code-generator/service/ServiceImpl.ftl
View file @
abd84ff5
This diff is collapsed.
Click to expand it.
src/main/resources/templates/code-generator/util/CodeEnum.ftl
View file @
abd84ff5
...
...
@@ -9,181 +9,16 @@ import org.apache.commons.lang3.StringUtils;
*
@
date
${.
now
?
string
(
'yyyy-MM-dd HH:mm:ss'
)}
*/
public
enum
${
prefix
}
CodeEnum
implements
ApplicationServiceCode
{
SUCCESS
(
"100000"
,
"成功"
),
ERROR
(
"200000"
,
"异常"
),
SIGN_ERROR
(
"200001"
,
"加签失败"
),
VERIFY_SIGN_ERROR
(
"200002"
,
"验签失败"
),
DECRYPT_ERROR
(
"200003"
,
"解密失败"
),
ENCRYPTION_ERROR
(
"200004"
,
"加密失败"
),
TIME_OUT_ERROR
(
"200005"
,
"系统超时"
),
SYSTEM_ERROR
(
"200006"
,
"系统异常"
),
PARAM_ERROR
(
"200007"
,
"无效的请求参数"
),
AGREEMENT_NULL
(
"200900"
,
"查询没有数据"
),
//
准入
USER_ACCESS_NO
(
"200100"
,
"准入失败"
),
USER_REPEAT
(
"200101"
,
"重复用户"
),
//
联合注册
USER_REGISTER_ERROR
(
"200200"
,
"注册失败(非准入失败导致)"
),
USER_REGISTER_ACCESS_ERROR
(
"200201"
,
"注册失败(准入失败导致)"
),
//
绑卡
BIND_PHONE_ERROR
(
"200300"
,
"预留手机号错误"
),
BIND_IDNO_ERROR
(
"200301"
,
"身份证验证失败"
),
BIND_BANKCARDNO_ERROR
(
"200302"
,
"银行卡已绑定"
),
BIND_OVERDUE_ERROR
(
"200303"
,
"验证码过期"
),
BIND_NAME_ERROR
(
"301204"
,
"实名认证不通过"
),
BIND_NAME_AND_ID_ERROR
(
"301205"
,
"姓名身份证号码不一致"
),
BIND_BANKCARDNO_PHONE_ERROR
(
"301206"
,
"银行卡预留手机不一致"
),
BIND_BANKCARDNO_SUPPORT_ERROR
(
"301207"
,
"银行卡不支持"
),
BIND_SEND_FREQUENTLY_ERROR
(
"301208"
,
"发送短信过于频繁"
),
//
提现
;
@
Getter
private
String
code
;
@
Getter
private
String
msg
;
${
prefix
}
CodeEnum
(
String
value
,
String
msg
)
{
this
.
code
=
value
;
this
.
msg
=
msg
;
@
Override
public
String
getCode
()
{
return
null
;
}
/**
*
预审
*
REVIEW_USER_ERROR
(
"0100"
,
"复申用户"
),
*
BLACKLIST_USER_ERROR
(
"0200"
,
"黑名单用户"
),
*
EXIST_LOAN_USER_ERROR
(
"0300"
,
"在贷用户,不允许进件"
),
*
OVERDUE_ERROR
(
"0400"
,
"逾期记录"
),
*
REFUSE_ERROR
(
"0500"
,
"30天内拒绝"
),
*
EXIST_LOANING_ERROR
(
"0600"
,
"存在申请订单"
),
*
AGE_ERROR
(
"0701"
,
"年龄不符合要求"
),
*
NOT_WITHDRAW_ERROR
(
"0702"
,
"审核已通过未提现"
),
*
BLACKLIST_USERS_ERROR
(
"0703"
,
"黑名单用户"
),
*
*
@
param
code
*
@
return
*/
public
static
ApplicationServiceCode
getUserAccessCode
(
String
code
)
{
if
(
StringUtils
.
isEmpty
(
code
))
{
return
USER_ACCESS_NO
;
}
switch
(
code
)
{
case
"0300"
:
return
USER_REPEAT
;
case
"0100"
:
case
"0200"
:
case
"0400"
:
case
"0500"
:
case
"0600"
:
case
"0701"
:
case
"0702"
:
case
"0703"
:
return
USER_ACCESS_NO
;
default
:
return
USER_ACCESS_NO
;
}
@
Override
public
String
getMsg
()
{
return
null
;
}
/**
*
绑卡
*
*
@
param
code
*
@
return
*/
public
static
ApplicationServiceCode
getBindSmsCode
(
String
code
)
{
if
(
StringUtils
.
isEmpty
(
code
))
{
return
ERROR
;
}
switch
(
code
)
{
case
"0010"
:
return
ERROR
;
case
"0011"
:
return
ERROR
;
case
"0100"
:
return
ERROR
;
case
"0101"
:
return
BIND_BANKCARDNO_SUPPORT_ERROR
;
case
"0102"
:
return
BIND_PHONE_ERROR
;
case
"0103"
:
return
ERROR
;
default
:
return
ERROR
;
}
}
/**
*
验卡
*
*
@
param
code
*
@
return
*/
public
static
ApplicationServiceCode
getVerifySmsCode
(
String
code
)
{
if
(
StringUtils
.
isEmpty
(
code
))
{
return
ERROR
;
}
switch
(
code
)
{
case
"0101"
:
return
ERROR
;
case
"0010"
:
return
BIND_OVERDUE_ERROR
;
default
:
return
ERROR
;
}
}
/**
*
提现
*
200500
*
借款金额超限
*
<
p
>
*
200501
*
当日放款总额超限
*
<
p
>
*
200502
*
贷款期数不支持
*
<
p
>
*
200503
*
额度审批未通过
*
*
@
param
code
*
@
return
*/
public
static
ApplicationServiceCode
getApplyWithdraw
(
String
code
)
{
switch
(
code
)
{
case
"0003"
:
case
"1001"
:
return
ERROR
;
case
"0004"
:
return
ERROR
;
case
"0101"
:
return
ERROR
;
case
"0200"
:
return
ERROR
;
default
:
return
ERROR
;
}
}
/**
*
如果
code
==
ERROR
(
"200000"
,
"异常"
),
则取内部系统具体的错误信息
*
*
@
param
code
根据内部系统返回的
code
转换成金山的
code
*
@
param
msg
内部系统详细的
msg
*
@
return
返回给金山的
msg
*/
public
static
String
getReturnMsg
(
ApplicationServiceCode
code
,
String
msg
)
{
if
(${
prefix
}
CodeEnum
.
ERROR
.
equals
(
code
))
{
return
msg
;
}
return
code
.
getMsg
();
}
}
}
src/main/resources/templates/code-generator/util/ResultUtils.ftl
deleted
100644 → 0
View file @
ca6c9738
package
${
utilPackage
};
import
cn
.
quantgroup
.
loanflow
.
infrastructure
.
code
.
ApplicationServiceCode
;
import
lombok
.
Data
;
import
java
.
io
.
Serializable
;
public
class
${
prefix
}
ResultUtils
{
public
static
ResultDTO
success
(
String
msg
,
Object
data
)
{
return
new
ResultDTO
(
msg
,
data
);
}
public
static
ResultDTO
success
(
Object
data
)
{
return
new
ResultDTO
(
data
);
}
public
static
ResultDTO
success
()
{
return
new
ResultDTO
();
}
public
static
ResultDTO
fail
(
String
code
,
String
msg
,
Object
data
)
{
return
new
ResultDTO
(
code
,
msg
,
data
);
}
public
static
ResultDTO
fail
(
String
code
,
String
msg
)
{
return
new
ResultDTO
(
code
,
msg
,
null
);
}
public
static
ResultDTO
fail
(
ApplicationServiceCode
code
)
{
return
new
ResultDTO
(
code
.
getCode
(),
code
.
getMsg
(),
null
);
}
@
Data
public
static
class
ResultDTO
implements
Serializable
{
private
String
code
;
private
String
message
;
private
Object
data
;
public
ResultDTO
()
{
this
.
code
=
"100000"
;
this
.
message
=
"成功"
;
}
public
ResultDTO
(
Object
data
)
{
this
.
data
=
data
;
this
.
code
=
"100000"
;
this
.
message
=
"成功"
;
}
public
ResultDTO
(
String
msg
)
{
this
.
code
=
"100000"
;
this
.
message
=
msg
;
}
public
ResultDTO
(
String
message
,
Object
data
)
{
this
.
code
=
"100000"
;
this
.
message
=
message
;
this
.
data
=
data
;
}
public
ResultDTO
(
String
code
,
String
message
,
Object
data
)
{
this
.
code
=
code
;
this
.
message
=
message
;
this
.
data
=
data
;
}
public
boolean
checkSuccess
()
{
return
"100000"
.
equals
(
code
);
}
}
}
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