Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
asset-distribution
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
asset-distribution
Commits
f251d841
Commit
f251d841
authored
Sep 14, 2021
by
王业雄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加四个页面接口
parent
73dc6773
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
1797 additions
and
18 deletions
+1797
-18
pom.xml
pom.xml
+31
-0
InitAreaCode.java
...antgroup/asset/distribution/config/code/InitAreaCode.java
+1
-1
ChannelRouteController.java
...controller/route/channelroute/ChannelRouteController.java
+171
-0
FundProductController.java
...n/controller/route/fundproduct/FundProductController.java
+186
-0
RouteRecordController.java
...n/controller/route/routerecord/RouteRecordController.java
+36
-0
WhiteListController.java
...ution/controller/route/whitelist/WhiteListController.java
+63
-0
ChannelConfigInfoVo.java
.../model/entity/route/channelroute/ChannelConfigInfoVo.java
+24
-0
ChannelRouteQueryVo.java
.../model/entity/route/channelroute/ChannelRouteQueryVo.java
+17
-0
ChannelRouteResultVo.java
...model/entity/route/channelroute/ChannelRouteResultVo.java
+27
-0
ChannelRouteSaveVo.java
...n/model/entity/route/channelroute/ChannelRouteSaveVo.java
+30
-0
FundProInfoVo.java
...bution/model/entity/route/channelroute/FundProInfoVo.java
+17
-0
AreaCodeVo.java
...stribution/model/entity/route/fundproduct/AreaCodeVo.java
+13
-0
FundProductQueryResultVo.java
...el/entity/route/fundproduct/FundProductQueryResultVo.java
+20
-0
FundProductQueryVo.java
...on/model/entity/route/fundproduct/FundProductQueryVo.java
+16
-0
FundProductSaveVo.java
...ion/model/entity/route/fundproduct/FundProductSaveVo.java
+33
-0
FundProductVo.java
...ibution/model/entity/route/fundproduct/FundProductVo.java
+35
-0
TypeVo.java
...t/distribution/model/entity/route/fundproduct/TypeVo.java
+12
-0
RouteRecordQueryVo.java
...on/model/entity/route/routerecord/RouteRecordQueryVo.java
+16
-0
RouteRecordResultVo.java
...n/model/entity/route/routerecord/RouteRecordResultVo.java
+17
-0
WhiteListQueryVo.java
...bution/model/entity/route/whitelist/WhiteListQueryVo.java
+15
-0
WhiteListResultVo.java
...ution/model/entity/route/whitelist/WhiteListResultVo.java
+24
-0
WhiteListSaveVo.java
...ibution/model/entity/route/whitelist/WhiteListSaveVo.java
+23
-0
FundModuleServiceImpl.java
...tribution/service/funding/impl/FundModuleServiceImpl.java
+0
-1
ChannelRuleEntity.java
...et/distribution/service/jpa/entity/ChannelRuleEntity.java
+2
-2
FundProductEntity.java
...et/distribution/service/jpa/entity/FundProductEntity.java
+11
-9
ProductRuleEntity.java
...et/distribution/service/jpa/entity/ProductRuleEntity.java
+12
-0
IChannelRuleRepository.java
...bution/service/jpa/repository/IChannelRuleRepository.java
+11
-2
IFundProductRepository.java
...bution/service/jpa/repository/IFundProductRepository.java
+13
-1
IProductRuleRepository.java
...bution/service/jpa/repository/IProductRuleRepository.java
+7
-0
IRoutingRecordRepository.java
...tion/service/jpa/repository/IRoutingRecordRepository.java
+3
-1
IWhiteListRepository.java
...ribution/service/jpa/repository/IWhiteListRepository.java
+2
-1
IChannelRouteService.java
...sset/distribution/service/route/IChannelRouteService.java
+31
-0
IFundProductService.java
...asset/distribution/service/route/IFundProductService.java
+19
-0
IRouteRecordService.java
...asset/distribution/service/route/IRouteRecordService.java
+8
-0
IWhiteListService.java
...p/asset/distribution/service/route/IWhiteListService.java
+14
-0
ChannelRouteServiceImpl.java
...tribution/service/route/impl/ChannelRouteServiceImpl.java
+188
-0
FundProductServiceImpl.java
...stribution/service/route/impl/FundProductServiceImpl.java
+372
-0
RouteRecordServiceImpl.java
...stribution/service/route/impl/RouteRecordServiceImpl.java
+80
-0
WhiteListServiceImpl.java
...distribution/service/route/impl/WhiteListServiceImpl.java
+99
-0
AllRecords.java
...va/com/quantgroup/asset/distribution/util/AllRecords.java
+36
-0
PageVo.java
...n/java/com/quantgroup/asset/distribution/util/PageVo.java
+62
-0
No files found.
pom.xml
View file @
f251d841
...
...
@@ -72,6 +72,23 @@
<encoding>
${project.build.sourceEncoding}
</encoding>
</configuration>
</plugin>
<plugin>
<groupId>
com.mysema.maven
</groupId>
<artifactId>
apt-maven-plugin
</artifactId>
<version>
1.1.3
</version>
<executions>
<execution>
<goals>
<goal>
process
</goal>
</goals>
<configuration>
<outputDirectory>
target/generated-sources/java
</outputDirectory>
<processor>
com.querydsl.apt.jpa.JPAAnnotationProcessor
</processor>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
...
@@ -367,6 +384,19 @@
<artifactId>
aws-java-sdk-s3
</artifactId>
<version>
${amazonaws.version}
</version>
</dependency>
<dependency>
<groupId>
com.querydsl
</groupId>
<artifactId>
querydsl-jpa
</artifactId>
<version>
${querydsl.version}
</version>
</dependency>
<dependency>
<groupId>
com.querydsl
</groupId>
<artifactId>
querydsl-apt
</artifactId>
<version>
${querydsl.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
com.googlecode.aviator
</groupId>
<artifactId>
aviator
</artifactId>
...
...
@@ -389,4 +419,5 @@
<version>
1.6.3
</version>
</dependency>
</dependencies>
</project>
src/main/java/com/quantgroup/asset/distribution/config/code/InitAreaCode.java
View file @
f251d841
...
...
@@ -38,7 +38,7 @@ public class InitAreaCode {
logger
.
info
(
"初始化区域码end:code{},name{}"
,
concurrentHashMap
.
size
(),
concurrentNameHashMap
.
size
());
}
p
rivate
static
String
getString
(
InputStream
in
)
throws
IOException
{
p
ublic
static
String
getString
(
InputStream
in
)
throws
IOException
{
Throwable
var3
=
null
;
String
var4
;
try
{
...
...
src/main/java/com/quantgroup/asset/distribution/controller/route/channelroute/ChannelRouteController.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
controller
.
route
.
channelroute
;
import
com.quantgroup.asset.distribution.enums.route.SystemType
;
import
com.quantgroup.asset.distribution.enums.route.UserLevel
;
import
com.quantgroup.asset.distribution.enums.route.UserTag
;
import
com.quantgroup.asset.distribution.model.entity.route.channelroute.ChannelConfigInfoVo
;
import
com.quantgroup.asset.distribution.model.entity.route.channelroute.ChannelRouteQueryVo
;
import
com.quantgroup.asset.distribution.model.entity.route.channelroute.ChannelRouteSaveVo
;
import
com.quantgroup.asset.distribution.model.entity.route.channelroute.FundProInfoVo
;
import
com.quantgroup.asset.distribution.model.entity.route.fundproduct.TypeVo
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.service.route.IChannelRouteService
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
import
lombok.extern.slf4j.Slf4j
;
import
org.hibernate.validator.constraints.NotEmpty
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
javax.validation.constraints.NotNull
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 渠道路由配置接口
* @author wyx 2021-08-28
*/
@Slf4j
@RestController
@RequestMapping
(
"/channelroute"
)
public
class
ChannelRouteController
{
@Autowired
private
IChannelRouteService
channelRouteService
;
/**
* 分页查询
* @param channelRouteQueryVo
* @return
*/
@RequestMapping
(
value
=
"/queryPage"
,
method
=
RequestMethod
.
POST
)
public
GlobalResponse
queryPage
(
@RequestBody
ChannelRouteQueryVo
channelRouteQueryVo
){
AllRecords
allRecords
=
channelRouteService
.
queryPage
(
channelRouteQueryVo
);
return
GlobalResponse
.
success
(
allRecords
);
}
/**
* 查询已经配置过的渠道,下拉框
* @return
*/
@RequestMapping
(
"/queryConfigChannelIds"
)
public
GlobalResponse
queryConfigChannelIds
(){
List
<
Long
>
channelIdList
=
channelRouteService
.
queryConfigChannelIds
();
return
GlobalResponse
.
success
(
channelIdList
);
}
/**
* 根据渠道号查询渠道配置过的渠道路由信息
* @param channelId
* @return
*/
@RequestMapping
(
"/queryConfigChannelInfo"
)
public
GlobalResponse
queryConfigChannelInfo
(
@NotNull
Long
channelId
){
return
channelRouteService
.
queryConfigChannelInfo
(
channelId
);
}
/**
* 选择资金编号下拉框
* @return
*/
@RequestMapping
(
"/getFundIds"
)
public
GlobalResponse
getFundIds
(){
List
<
Long
>
fundIdList
=
channelRouteService
.
getFundIds
();
return
GlobalResponse
.
success
(
fundIdList
);
}
/**
* 根据资金编号查询资金产品编号
* @param fundId
* @return
*/
@RequestMapping
(
"/getFundCorpIdByFundId"
)
public
GlobalResponse
getFundCorpIdByFundId
(
@NotNull
Long
fundId
){
List
<
Long
>
fundCorpIdList
=
channelRouteService
.
getFundCorpIdByFundId
(
fundId
);
return
GlobalResponse
.
success
(
fundCorpIdList
);
}
/**
* 根据资金编号+资金产品编号查询资金名称、资金类型、机构类型、业务类型、业务系统
* @param fundId
* @param fundCorpId
* @return
*/
@RequestMapping
(
"/getFundProductInfo"
)
public
GlobalResponse
getFundProductInfo
(
@NotNull
Long
fundId
,
@NotNull
Long
fundCorpId
){
FundProInfoVo
fundProInfoVo
=
channelRouteService
.
getFundProductInfo
(
fundId
,
fundCorpId
);
return
GlobalResponse
.
success
(
fundProInfoVo
);
}
/**
* 获取用户标签下拉框
* @return
*/
@RequestMapping
(
"/getUserTag"
)
public
GlobalResponse
getUserTag
(){
List
<
TypeVo
>
list
=
new
ArrayList
<>();
for
(
UserTag
userTag:
UserTag
.
values
()){
TypeVo
typeVo
=
new
TypeVo
();
typeVo
.
setCode
(
userTag
.
getValue
());
typeVo
.
setName
(
userTag
.
getDesc
());
list
.
add
(
typeVo
);
}
return
GlobalResponse
.
success
(
list
);
}
/**
* 获取用户等级下拉框
* @return
*/
@RequestMapping
(
"/getUserLevel"
)
public
GlobalResponse
getUserLevel
(){
List
<
TypeVo
>
list
=
new
ArrayList
<>();
for
(
UserLevel
userLevel:
UserLevel
.
values
()){
TypeVo
typeVo
=
new
TypeVo
();
typeVo
.
setCode
(
userLevel
.
getValue
());
typeVo
.
setName
(
userLevel
.
getDesc
());
list
.
add
(
typeVo
);
}
return
GlobalResponse
.
success
(
list
);
}
/**
* 新增渠道配置信息
* @param channelRouteSaveVoList
* @param type 0表示新增 1表示编辑
* @return
*/
@RequestMapping
(
"/addChannelConfig"
)
public
GlobalResponse
addChannelConfig
(
@RequestBody@Valid@NotEmpty
List
<
ChannelRouteSaveVo
>
channelRouteSaveVoList
,
@NotNull
Integer
type
,
BindingResult
bindingResult
){
if
(
bindingResult
.
hasErrors
()){
return
GlobalResponse
.
error
(
bindingResult
.
getFieldError
().
getDefaultMessage
());
}
channelRouteService
.
addChannelConfig
(
channelRouteSaveVoList
,
type
);
return
GlobalResponse
.
success
();
}
/**
* 发布渠道配置信息
* @return
*/
@RequestMapping
(
"/publishChannelConfig"
)
public
GlobalResponse
publishChannelConfig
(
@RequestBody
List
<
Long
>
ids
){
channelRouteService
.
publishChannelConfig
(
ids
);
return
GlobalResponse
.
success
();
}
/**
* 更新渠道配置信息,未更新前使用原有配置
* @param channelId
* @return
*/
@RequestMapping
(
"/updateChannelConfig"
)
public
GlobalResponse
updateChannelConfig
(
Long
channelId
){
channelRouteService
.
updateChannelConfig
(
channelId
);
return
GlobalResponse
.
success
();
}
}
src/main/java/com/quantgroup/asset/distribution/controller/route/fundproduct/FundProductController.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
controller
.
route
.
fundproduct
;
import
com.quantgroup.asset.distribution.enums.route.BusinessType
;
import
com.quantgroup.asset.distribution.enums.route.FundType
;
import
com.quantgroup.asset.distribution.enums.route.OrganizationType
;
import
com.quantgroup.asset.distribution.enums.route.SystemType
;
import
com.quantgroup.asset.distribution.model.entity.route.fundproduct.FundProductQueryVo
;
import
com.quantgroup.asset.distribution.model.entity.route.fundproduct.FundProductSaveVo
;
import
com.quantgroup.asset.distribution.model.entity.route.fundproduct.FundProductVo
;
import
com.quantgroup.asset.distribution.model.entity.route.fundproduct.TypeVo
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.service.newrule.pojo.enums.AreaEnum
;
import
com.quantgroup.asset.distribution.service.newrule.pojo.enums.IdCardExpireEnum
;
import
com.quantgroup.asset.distribution.service.route.IFundProductService
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 资金产品列表
* @author wyx 2021-08-29
*/
@Slf4j
@RestController
@RequestMapping
(
"/fundproduct"
)
public
class
FundProductController
{
@Autowired
private
IFundProductService
fundProductService
;
/**
* 分页查询
* @param fundProductQueryVo
* @return
*/
@RequestMapping
(
value
=
"/queryPage"
,
method
=
RequestMethod
.
POST
)
public
GlobalResponse
queryPage
(
@RequestBody
FundProductQueryVo
fundProductQueryVo
){
AllRecords
allRecords
=
fundProductService
.
queryPage
(
fundProductQueryVo
);
return
GlobalResponse
.
success
(
allRecords
);
}
/**
* 资金类型下拉框
* @return
*/
@RequestMapping
(
"/getFundType"
)
public
GlobalResponse
getFundType
(){
List
<
TypeVo
>
list
=
new
ArrayList
<>();
for
(
FundType
fundType:
FundType
.
values
()){
TypeVo
typeVo
=
new
TypeVo
();
typeVo
.
setCode
(
fundType
.
getValue
());
typeVo
.
setName
(
fundType
.
getDesc
());
list
.
add
(
typeVo
);
}
return
GlobalResponse
.
success
(
list
);
}
/**
* 机构类型下拉框
* @return
*/
@RequestMapping
(
"/getOrganizationType"
)
public
GlobalResponse
getOrganizationType
(){
List
<
TypeVo
>
list
=
new
ArrayList
<>();
for
(
OrganizationType
organizationType:
OrganizationType
.
values
()){
TypeVo
typeVo
=
new
TypeVo
();
typeVo
.
setCode
(
organizationType
.
getValue
());
typeVo
.
setName
(
organizationType
.
getDesc
());
list
.
add
(
typeVo
);
}
return
GlobalResponse
.
success
(
list
);
}
/**
* 业务类型下拉框
* @return
*/
@RequestMapping
(
"/getBusinessType"
)
public
GlobalResponse
getBusinessType
(){
List
<
TypeVo
>
list
=
new
ArrayList
<>();
for
(
BusinessType
businessType:
BusinessType
.
values
()){
TypeVo
typeVo
=
new
TypeVo
();
typeVo
.
setCode
(
businessType
.
getValue
());
typeVo
.
setName
(
businessType
.
getDesc
());
list
.
add
(
typeVo
);
}
return
GlobalResponse
.
success
(
list
);
}
/**
* 业务系统下拉框
* @return
*/
@RequestMapping
(
"/getSystemType"
)
public
GlobalResponse
getSystemType
(){
List
<
TypeVo
>
list
=
new
ArrayList
<>();
for
(
SystemType
systemType:
SystemType
.
values
()){
TypeVo
typeVo
=
new
TypeVo
();
typeVo
.
setCode
(
systemType
.
getValue
());
typeVo
.
setName
(
systemType
.
getDesc
());
list
.
add
(
typeVo
);
}
return
GlobalResponse
.
success
(
list
);
}
/**
* 编辑或查看资金产品信息
* @param id
* @return
*/
@RequestMapping
(
"/lookFundProduct"
)
public
GlobalResponse
lookFundProduct
(
Long
id
){
FundProductVo
fundProductVo
=
fundProductService
.
lookFundProduct
(
id
);
return
GlobalResponse
.
success
(
fundProductVo
);
}
/**
* 地区要求下拉框
* @return
*/
@RequestMapping
(
"/getAreaRequire"
)
public
GlobalResponse
getAreaRequire
(){
List
<
TypeVo
>
list
=
new
ArrayList
<>();
for
(
AreaEnum
areaEnum:
AreaEnum
.
values
()){
TypeVo
typeVo
=
new
TypeVo
();
typeVo
.
setCode
(
String
.
valueOf
(
areaEnum
.
getCode
()));
typeVo
.
setName
(
areaEnum
.
getDesc
());
list
.
add
(
typeVo
);
}
return
GlobalResponse
.
success
(
list
);
}
/**
* 身份证有效期下拉框
* @return
*/
@RequestMapping
(
"/getIdCardExpire"
)
public
GlobalResponse
getIdCardExpire
(){
List
<
TypeVo
>
list
=
new
ArrayList
<>();
for
(
IdCardExpireEnum
idCardExpireEnum:
IdCardExpireEnum
.
values
()){
TypeVo
typeVo
=
new
TypeVo
();
typeVo
.
setCode
(
String
.
valueOf
(
idCardExpireEnum
.
getCode
()));
typeVo
.
setName
(
idCardExpireEnum
.
getDesc
());
list
.
add
(
typeVo
);
}
return
GlobalResponse
.
success
(
list
);
}
/**
* 保存接口
* @param fundProductSaveVo
* @param bindingResult
* @return
*/
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
public
GlobalResponse
save
(
@RequestBody@Valid
FundProductSaveVo
fundProductSaveVo
,
BindingResult
bindingResult
){
if
(
bindingResult
.
hasErrors
()){
return
GlobalResponse
.
error
(
bindingResult
.
getFieldError
().
getDefaultMessage
());
}
return
fundProductService
.
save
(
fundProductSaveVo
);
}
/**
* 获取省市区分级数据
* @return
*/
@RequestMapping
(
"/getArea"
)
public
GlobalResponse
getArea
(){
try
{
return
fundProductService
.
getArea
();
}
catch
(
Exception
e
){
log
.
error
(
"获取省市区信息异常"
,
e
);
return
GlobalResponse
.
error
(
"获取省市区信息异常"
);
}
}
}
src/main/java/com/quantgroup/asset/distribution/controller/route/routerecord/RouteRecordController.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
controller
.
route
.
routerecord
;
import
com.quantgroup.asset.distribution.model.entity.route.routerecord.RouteRecordQueryVo
;
import
com.quantgroup.asset.distribution.model.entity.route.whitelist.WhiteListQueryVo
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.service.route.IRouteRecordService
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 路由记录查询页面
*/
@Slf4j
@RestController
@RequestMapping
(
"/routerecord"
)
public
class
RouteRecordController
{
@Autowired
private
IRouteRecordService
routeRecordService
;
/**
* 分页查询
* @param routeRecordQueryVo
* @return
*/
@RequestMapping
(
value
=
"/queryPage"
,
method
=
RequestMethod
.
POST
)
public
GlobalResponse
queryPage
(
@RequestBody
RouteRecordQueryVo
routeRecordQueryVo
){
AllRecords
allRecords
=
routeRecordService
.
queryPage
(
routeRecordQueryVo
);
return
GlobalResponse
.
success
(
allRecords
);
}
}
src/main/java/com/quantgroup/asset/distribution/controller/route/whitelist/WhiteListController.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
controller
.
route
.
whitelist
;
import
com.quantgroup.asset.distribution.model.entity.route.whitelist.WhiteListQueryVo
;
import
com.quantgroup.asset.distribution.model.entity.route.whitelist.WhiteListSaveVo
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.service.route.IWhiteListService
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
javax.validation.constraints.NotNull
;
/**
* 白名单配置页面接口
*/
@Slf4j
@RestController
@RequestMapping
(
"/whitelist"
)
public
class
WhiteListController
{
@Autowired
private
IWhiteListService
whiteListService
;
/**
* 分页查询
* @param whiteListQueryVo
* @return
*/
@RequestMapping
(
value
=
"/queryPage"
,
method
=
RequestMethod
.
POST
)
public
GlobalResponse
queryPage
(
@RequestBody
WhiteListQueryVo
whiteListQueryVo
){
AllRecords
allRecords
=
whiteListService
.
queryPage
(
whiteListQueryVo
);
return
GlobalResponse
.
success
(
allRecords
);
}
/**
* 启用停用
* @param id
* @param status
* @return
*/
@RequestMapping
(
"/updateStatus"
)
public
GlobalResponse
updateStatus
(
@NotNull
Long
id
,
@NotNull
Byte
status
){
return
whiteListService
.
updateStatus
(
id
,
status
);
}
/**
* 新增白名单配置
* @param whiteListSaveVo
* @return
*/
@RequestMapping
(
"/save"
)
public
GlobalResponse
save
(
@RequestBody@Valid
WhiteListSaveVo
whiteListSaveVo
,
BindingResult
bindingResult
){
if
(
bindingResult
.
hasErrors
()){
return
GlobalResponse
.
error
(
bindingResult
.
getFieldError
().
getDefaultMessage
());
}
return
whiteListService
.
save
(
whiteListSaveVo
);
}
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/channelroute/ChannelConfigInfoVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
channelroute
;
import
lombok.Data
;
import
java.sql.Timestamp
;
/**
* 通过渠道号查询渠道配置信息返回值
*/
@Data
public
class
ChannelConfigInfoVo
{
private
Long
fundId
;
private
Long
fundCorpId
;
private
String
fundName
;
private
String
fundType
;
private
String
orgType
;
private
String
businessType
;
private
String
systermType
;
private
Integer
creditResult
;
private
String
userTag
;
private
String
userLevel
;
private
Integer
priority
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/channelroute/ChannelRouteQueryVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
channelroute
;
import
com.quantgroup.asset.distribution.util.PageVo
;
import
lombok.Data
;
/**
* 渠道路由配置查询条件
*/
@Data
public
class
ChannelRouteQueryVo
extends
PageVo
{
private
Long
channelId
;
private
Long
fundId
;
private
String
fundName
;
private
Byte
publishStatus
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/channelroute/ChannelRouteResultVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
channelroute
;
import
lombok.Data
;
import
java.sql.Timestamp
;
/**
* 渠道路由配置查询结果
*/
@Data
public
class
ChannelRouteResultVo
{
private
Long
id
;
private
Long
channelId
;
private
Byte
publishStatus
;
private
Long
fundId
;
private
Long
fundProId
;
private
String
fundName
;
private
String
fundType
;
private
String
orgType
;
private
String
businessType
;
private
Integer
creditResult
;
private
String
userTag
;
private
String
userLevel
;
private
Integer
priority
;
private
Timestamp
updatedAt
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/channelroute/ChannelRouteSaveVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
channelroute
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
/**
* 保存渠道路由信息
*/
@Data
public
class
ChannelRouteSaveVo
{
@NotNull
(
message
=
"路由等待不能为空"
)
private
Byte
routeWait
;
@NotNull
(
message
=
"渠道号不能为空"
)
private
Long
channelId
;
@NotNull
(
message
=
"资金编号不能为空"
)
private
Long
fundId
;
@NotNull
(
message
=
"资金产品编号不能为空"
)
private
Long
fundProId
;
private
String
fundName
;
private
String
fundType
;
private
String
orgType
;
private
String
businessType
;
@NotNull
(
message
=
"授信结果不能为空"
)
private
Integer
creditResult
;
private
String
userTag
;
private
String
userLevel
;
private
Integer
priority
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/channelroute/FundProInfoVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
channelroute
;
import
lombok.Data
;
/**
* 通过资金编号和产品编号查询资金产品信息
*/
@Data
public
class
FundProInfoVo
{
private
String
fundName
;
private
String
fundType
;
private
String
orgType
;
private
String
businessType
;
private
String
systermType
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/fundproduct/AreaCodeVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
fundproduct
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
public
class
AreaCodeVo
{
private
String
adcode
;
private
String
name
;
private
List
<
AreaCodeVo
>
nodes
=
new
ArrayList
<>();
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/fundproduct/FundProductQueryResultVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
fundproduct
;
import
lombok.Data
;
import
java.sql.Timestamp
;
@Data
public
class
FundProductQueryResultVo
{
private
Integer
seqNo
;
private
Long
fundId
;
private
Long
fundProId
;
private
String
fundName
;
private
String
fundType
;
private
String
orgType
;
private
String
businessType
;
private
String
systermType
;
private
Timestamp
updatedAt
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/fundproduct/FundProductQueryVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
fundproduct
;
import
com.quantgroup.asset.distribution.util.PageVo
;
import
lombok.Data
;
@Data
public
class
FundProductQueryVo
extends
PageVo
{
private
Long
fundId
;
private
Long
fundProId
;
private
String
fundName
;
private
String
fundType
;
private
String
orgType
;
private
String
businessType
;
private
String
systermType
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/fundproduct/FundProductSaveVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
fundproduct
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.NotBlank
;
import
org.hibernate.validator.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.util.Map
;
@Data
public
class
FundProductSaveVo
{
@NotNull
(
message
=
"id不能为空"
)
private
Long
id
;
@NotNull
(
message
=
"资金编号不能为空"
)
private
Long
fundId
;
@NotNull
(
message
=
"资金产品编号不能为空"
)
private
Long
fundProId
;
@NotBlank
(
message
=
"资金名称不能为空"
)
private
String
fundName
;
@NotBlank
(
message
=
"资金类型不能为空"
)
private
String
fundType
;
@NotBlank
(
message
=
"机构类型不能为空"
)
private
String
orgType
;
@NotBlank
(
message
=
"业务类型不能为空"
)
private
String
businessType
;
@NotBlank
(
message
=
"业务系统不能为空"
)
private
String
systermType
;
/**
* 基本信息和其他信息字段,对应的value
*/
@NotEmpty
(
message
=
"规则集不能为空"
)
private
Map
<
Long
,
String
>
ruleValueMap
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/fundproduct/FundProductVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
fundproduct
;
import
com.quantgroup.asset.distribution.service.jpa.entity.ProductRuleEntity
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Map
;
/**
* 资金产品页面返回结果
*/
@Data
public
class
FundProductVo
{
/**
* 资金信息-value 字段由前端写死
*/
private
Long
fundId
;
private
Long
fundProId
;
private
String
fundName
;
private
String
systermType
;
private
String
fundType
;
private
String
orgType
;
private
String
businessType
;
/**
* 基本信息和其他信息字段
*/
private
List
<
ProductRuleEntity
>
productRuleEntityList
;
/**
* 基本信息和其他信息字段,对应的value
*/
private
Map
<
Long
,
String
>
ruleValueMap
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/fundproduct/TypeVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
fundproduct
;
import
lombok.Data
;
/**
* 存放下拉框对应的code及名称name
*/
@Data
public
class
TypeVo
{
private
String
code
;
private
String
name
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/routerecord/RouteRecordQueryVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
routerecord
;
import
com.quantgroup.asset.distribution.util.PageVo
;
import
lombok.Data
;
import
java.sql.Timestamp
;
@Data
public
class
RouteRecordQueryVo
extends
PageVo
{
private
String
creditNo
;
private
String
uuid
;
private
Byte
status
;
private
Timestamp
routedAtMin
;
private
Timestamp
routedAtMax
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/routerecord/RouteRecordResultVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
routerecord
;
import
lombok.Data
;
import
java.sql.Timestamp
;
@Data
public
class
RouteRecordResultVo
{
private
String
creditNo
;
private
String
uuid
;
private
String
phone
;
private
Byte
status
;
private
String
routedResult
;
private
Timestamp
routedAt
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/whitelist/WhiteListQueryVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
whitelist
;
import
com.quantgroup.asset.distribution.util.PageVo
;
import
lombok.Data
;
/**
* 白名单分页查询参数
*/
@Data
public
class
WhiteListQueryVo
extends
PageVo
{
private
String
phone
;
private
String
fundName
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/whitelist/WhiteListResultVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
whitelist
;
import
lombok.Data
;
import
java.sql.Timestamp
;
/**
* 分页查询返回结果
*/
@Data
public
class
WhiteListResultVo
{
private
long
id
;
private
String
phone
;
private
long
fundId
;
private
long
fundProId
;
private
String
fundName
;
private
String
fundType
;
private
String
orgType
;
private
String
businessType
;
private
Byte
status
;
private
Timestamp
createdAt
;
}
src/main/java/com/quantgroup/asset/distribution/model/entity/route/whitelist/WhiteListSaveVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
route
.
whitelist
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
/**
* 白名单配置保存参数
*/
@Data
public
class
WhiteListSaveVo
{
@NotBlank
(
message
=
"手机号不能为空"
)
private
String
phone
;
@NotNull
(
message
=
"资金编号不能为空"
)
private
Long
fundId
;
@NotNull
(
message
=
"资金产品编号不能为空"
)
private
Long
fundProId
;
private
String
fundType
;
private
String
orgType
;
private
String
businessType
;
}
src/main/java/com/quantgroup/asset/distribution/service/funding/impl/FundModuleServiceImpl.java
View file @
f251d841
...
...
@@ -20,7 +20,6 @@ import com.quantgroup.asset.distribution.service.rule.IRuleService;
import
com.quantgroup.asset.distribution.service.rule.vo.BaseRuleVO
;
import
com.quantgroup.asset.distribution.service.rule.vo.IRuleVO
;
import
com.quantgroup.asset.distribution.service.rule.vo.UnionRuleVO
;
import
com.sun.org.apache.bcel.internal.generic.NEW
;
import
org.apache.commons.collections.Bag
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.bag.HashBag
;
...
...
src/main/java/com/quantgroup/asset/distribution/service/jpa/entity/ChannelRuleEntity.java
View file @
f251d841
...
...
@@ -22,10 +22,10 @@ public class ChannelRuleEntity {
private
String
fundType
;
private
String
orgType
;
private
String
businessType
;
private
int
creditResult
;
private
Integer
creditResult
;
private
String
userTag
;
private
String
userLevel
;
private
int
priority
;
private
Integer
priority
;
private
Byte
routeWait
;
private
Byte
enable
;
private
Timestamp
createdAt
;
...
...
src/main/java/com/quantgroup/asset/distribution/service/jpa/entity/FundProductEntity.java
View file @
f251d841
...
...
@@ -12,14 +12,15 @@ import java.util.Objects;
@Entity
@Table
(
name
=
"fund_product"
,
schema
=
"asset-distribution"
,
catalog
=
""
)
public
class
FundProductEntity
{
private
l
ong
id
;
private
l
ong
fundId
;
private
l
ong
fundProId
;
private
L
ong
id
;
private
L
ong
fundId
;
private
L
ong
fundProId
;
private
String
fundName
;
private
String
fundType
;
private
String
orgType
;
private
String
businessType
;
private
String
systermType
;
private
String
basicRule
;
private
int
areaTerm
;
private
int
cardLimit
;
...
...
@@ -31,32 +32,33 @@ public class FundProductEntity {
private
Timestamp
updatedAt
;
@Id
@GeneratedValue
@Column
(
name
=
"id"
,
nullable
=
false
)
public
l
ong
getId
()
{
public
L
ong
getId
()
{
return
id
;
}
public
void
setId
(
l
ong
id
)
{
public
void
setId
(
L
ong
id
)
{
this
.
id
=
id
;
}
@Basic
@Column
(
name
=
"fund_id"
,
nullable
=
false
)
public
l
ong
getFundId
()
{
public
L
ong
getFundId
()
{
return
fundId
;
}
public
void
setFundId
(
l
ong
fundId
)
{
public
void
setFundId
(
L
ong
fundId
)
{
this
.
fundId
=
fundId
;
}
@Basic
@Column
(
name
=
"fund_pro_id"
,
nullable
=
false
)
public
l
ong
getFundProId
()
{
public
L
ong
getFundProId
()
{
return
fundProId
;
}
public
void
setFundProId
(
l
ong
fundProId
)
{
public
void
setFundProId
(
L
ong
fundProId
)
{
this
.
fundProId
=
fundProId
;
}
...
...
src/main/java/com/quantgroup/asset/distribution/service/jpa/entity/ProductRuleEntity.java
View file @
f251d841
...
...
@@ -18,6 +18,7 @@ public class ProductRuleEntity {
private
String
ruleEngine
;
private
String
ruleChinese
;
private
String
textType
;
private
String
ruleType
;
private
Byte
enable
;
private
Timestamp
createdAt
;
private
Timestamp
updatedAt
;
...
...
@@ -82,6 +83,17 @@ public class ProductRuleEntity {
this
.
textType
=
textType
;
}
@Basic
@Column
(
name
=
"rule_type"
,
nullable
=
true
,
length
=
50
)
public
String
getRuleType
()
{
return
ruleType
;
}
public
void
setRuleType
(
String
ruleType
)
{
this
.
ruleType
=
ruleType
;
}
@Basic
@Column
(
name
=
"enable"
,
nullable
=
true
)
public
Byte
getEnable
()
{
...
...
src/main/java/com/quantgroup/asset/distribution/service/jpa/repository/IChannelRuleRepository.java
View file @
f251d841
...
...
@@ -2,12 +2,21 @@ package com.quantgroup.asset.distribution.service.jpa.repository;
import
com.quantgroup.asset.distribution.service.jpa.entity.ChannelRuleEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.querydsl.QueryDslPredicateExecutor
;
import
java.util.List
;
public
interface
IChannelRuleRepository
extends
JpaRepository
<
ChannelRuleEntity
,
Long
>{
public
interface
IChannelRuleRepository
extends
JpaRepository
<
ChannelRuleEntity
,
Long
>,
QueryDslPredicateExecutor
<
ChannelRuleEntity
>
{
ChannelRuleEntity
getByFundProductIdEquals
(
long
fundProductId
);
List
<
ChannelRuleEntity
>
getByChannelId
(
long
channelId
);
List
<
ChannelRuleEntity
>
getAllByEnableEquals
(
Byte
enable
);
List
<
ChannelRuleEntity
>
getAllByChannelIdEqualsAndEnableEquals
(
Long
channelId
,
Byte
enable
);
List
<
ChannelRuleEntity
>
getAllByIdIn
(
List
<
Long
>
ids
);
Boolean
deleteAllByChannelIdEqualsAndEnableEquals
(
Long
channelId
,
Byte
enable
);
}
src/main/java/com/quantgroup/asset/distribution/service/jpa/repository/IFundProductRepository.java
View file @
f251d841
...
...
@@ -2,8 +2,20 @@ package com.quantgroup.asset.distribution.service.jpa.repository;
import
com.quantgroup.asset.distribution.service.jpa.entity.FundProductEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.querydsl.QueryDslPredicateExecutor
;
import
java.util.List
;
public
interface
IFundProductRepository
extends
JpaRepository
<
FundProductEntity
,
Long
>{
public
interface
IFundProductRepository
extends
JpaRepository
<
FundProductEntity
,
Long
>,
QueryDslPredicateExecutor
<
FundProductEntity
>
{
FundProductEntity
getByIdEquals
(
Long
id
);
List
<
FundProductEntity
>
getAllByEnableEquals
(
Byte
enable
);
List
<
FundProductEntity
>
getAllByFundIdEqualsAndEnableEquals
(
Long
fundId
,
Byte
enable
);
FundProductEntity
getByFundIdEqualsAndFundProIdEqualsAndEnableEquals
(
Long
fundId
,
Long
fundProId
,
Byte
enable
);
FundProductEntity
getByFundIdEqualsAndFundProIdEquals
(
Long
fundId
,
Long
fundProId
);
}
src/main/java/com/quantgroup/asset/distribution/service/jpa/repository/IProductRuleRepository.java
View file @
f251d841
...
...
@@ -3,7 +3,14 @@ package com.quantgroup.asset.distribution.service.jpa.repository;
import
com.quantgroup.asset.distribution.service.jpa.entity.ProductRuleEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.List
;
public
interface
IProductRuleRepository
extends
JpaRepository
<
ProductRuleEntity
,
Long
>{
ProductRuleEntity
getByRuleNameEquals
(
String
ruleName
);
List
<
ProductRuleEntity
>
getAllByRuleTypeEqualsAndEnableEquals
(
String
ruleType
,
Byte
enable
);
List
<
ProductRuleEntity
>
getAllByEnableEquals
(
Byte
enable
);
}
src/main/java/com/quantgroup/asset/distribution/service/jpa/repository/IRoutingRecordRepository.java
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
jpa
.
repository
;
import
com.quantgroup.asset.distribution.service.jpa.entity.RoutingRecordEntity
;
import
com.quantgroup.asset.distribution.service.jpa.entity.WhiteListEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.querydsl.QueryDslPredicateExecutor
;
public
interface
IRoutingRecordRepository
extends
JpaRepository
<
RoutingRecordEntity
,
Long
>{
public
interface
IRoutingRecordRepository
extends
JpaRepository
<
RoutingRecordEntity
,
Long
>
,
QueryDslPredicateExecutor
<
RoutingRecordEntity
>
{
}
src/main/java/com/quantgroup/asset/distribution/service/jpa/repository/IWhiteListRepository.java
View file @
f251d841
...
...
@@ -2,8 +2,9 @@ package com.quantgroup.asset.distribution.service.jpa.repository;
import
com.quantgroup.asset.distribution.service.jpa.entity.WhiteListEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.querydsl.QueryDslPredicateExecutor
;
public
interface
IWhiteListRepository
extends
JpaRepository
<
WhiteListEntity
,
Long
>{
public
interface
IWhiteListRepository
extends
JpaRepository
<
WhiteListEntity
,
Long
>
,
QueryDslPredicateExecutor
<
WhiteListEntity
>
{
WhiteListEntity
getByPhoneEquals
(
String
phone
);
}
src/main/java/com/quantgroup/asset/distribution/service/route/IChannelRouteService.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
route
;
import
com.quantgroup.asset.distribution.model.entity.route.channelroute.ChannelConfigInfoVo
;
import
com.quantgroup.asset.distribution.model.entity.route.channelroute.ChannelRouteQueryVo
;
import
com.quantgroup.asset.distribution.model.entity.route.channelroute.ChannelRouteSaveVo
;
import
com.quantgroup.asset.distribution.model.entity.route.channelroute.FundProInfoVo
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
import
java.util.List
;
public
interface
IChannelRouteService
{
AllRecords
queryPage
(
ChannelRouteQueryVo
channelRouteQueryVo
);
List
<
Long
>
queryConfigChannelIds
();
GlobalResponse
queryConfigChannelInfo
(
Long
channelId
);
List
<
Long
>
getFundIds
();
List
<
Long
>
getFundCorpIdByFundId
(
Long
fundId
);
FundProInfoVo
getFundProductInfo
(
Long
fundId
,
Long
fundCorpId
);
void
addChannelConfig
(
List
<
ChannelRouteSaveVo
>
channelRouteSaveVoList
,
Integer
type
);
void
publishChannelConfig
(
List
<
Long
>
ids
);
void
updateChannelConfig
(
Long
channelId
);
}
src/main/java/com/quantgroup/asset/distribution/service/route/IFundProductService.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
route
;
import
com.quantgroup.asset.distribution.model.entity.route.fundproduct.FundProductQueryVo
;
import
com.quantgroup.asset.distribution.model.entity.route.fundproduct.FundProductSaveVo
;
import
com.quantgroup.asset.distribution.model.entity.route.fundproduct.FundProductVo
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
import
java.io.IOException
;
public
interface
IFundProductService
{
AllRecords
queryPage
(
FundProductQueryVo
fundProductQueryVo
);
FundProductVo
lookFundProduct
(
Long
id
);
GlobalResponse
save
(
FundProductSaveVo
fundProductSaveVo
);
GlobalResponse
getArea
()
throws
IOException
;
}
src/main/java/com/quantgroup/asset/distribution/service/route/IRouteRecordService.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
route
;
import
com.quantgroup.asset.distribution.model.entity.route.routerecord.RouteRecordQueryVo
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
public
interface
IRouteRecordService
{
AllRecords
queryPage
(
RouteRecordQueryVo
routeRecordQueryVo
);
}
src/main/java/com/quantgroup/asset/distribution/service/route/IWhiteListService.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
route
;
import
com.quantgroup.asset.distribution.model.entity.route.whitelist.WhiteListQueryVo
;
import
com.quantgroup.asset.distribution.model.entity.route.whitelist.WhiteListSaveVo
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
public
interface
IWhiteListService
{
AllRecords
queryPage
(
WhiteListQueryVo
whiteListQueryVo
);
GlobalResponse
updateStatus
(
Long
id
,
Byte
status
);
GlobalResponse
save
(
WhiteListSaveVo
whiteListSaveVo
);
}
src/main/java/com/quantgroup/asset/distribution/service/route/impl/ChannelRouteServiceImpl.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
route
.
impl
;
import
com.quantgroup.asset.distribution.model.entity.route.channelroute.*
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.service.jpa.entity.ChannelRuleEntity
;
import
com.quantgroup.asset.distribution.service.jpa.entity.FundProductEntity
;
import
com.quantgroup.asset.distribution.service.jpa.entity.QChannelRuleEntity
;
import
com.quantgroup.asset.distribution.service.jpa.repository.IChannelRuleRepository
;
import
com.quantgroup.asset.distribution.service.jpa.repository.IFundProductRepository
;
import
com.quantgroup.asset.distribution.service.route.IChannelRouteService
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
import
com.querydsl.core.types.dsl.BooleanExpression
;
import
com.querydsl.core.types.dsl.Expressions
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
@Service
public
class
ChannelRouteServiceImpl
implements
IChannelRouteService
{
@Autowired
IChannelRuleRepository
channelRuleRepository
;
@Autowired
IFundProductRepository
fundProductRepository
;
@Override
public
AllRecords
queryPage
(
ChannelRouteQueryVo
channelRouteQueryVo
)
{
//索引 和 每页大小 排序 条件
BooleanExpression
booleanExpression
=
Expressions
.
asBoolean
(
true
).
isTrue
();
if
(
Objects
.
nonNull
(
channelRouteQueryVo
.
getChannelId
())){
booleanExpression
=
booleanExpression
.
and
(
QChannelRuleEntity
.
channelRuleEntity
.
channelId
.
like
(
String
.
valueOf
(
channelRouteQueryVo
.
getChannelId
())));
}
if
(
Objects
.
nonNull
(
channelRouteQueryVo
.
getFundId
())){
booleanExpression
=
booleanExpression
.
and
(
QChannelRuleEntity
.
channelRuleEntity
.
fundId
.
like
(
String
.
valueOf
(
channelRouteQueryVo
.
getFundId
())));
}
if
(!
StringUtils
.
isEmpty
(
channelRouteQueryVo
.
getFundName
())){
booleanExpression
=
booleanExpression
.
and
(
QChannelRuleEntity
.
channelRuleEntity
.
fundName
.
like
(
String
.
valueOf
(
channelRouteQueryVo
.
getFundName
())));
}
if
(
Objects
.
nonNull
(
channelRouteQueryVo
.
getPublishStatus
())){
booleanExpression
=
booleanExpression
.
and
(
QChannelRuleEntity
.
channelRuleEntity
.
publishStatus
.
eq
(
channelRouteQueryVo
.
getPublishStatus
()));
}
//只查有效数据
booleanExpression
=
booleanExpression
.
and
(
QChannelRuleEntity
.
channelRuleEntity
.
enable
.
eq
(
Byte
.
valueOf
(
"1"
)));
//1.查询条件,2.索引和每页的大小,3.排序根据某个字段进行排序
//查询总条数
long
count
=
channelRuleRepository
.
count
(
booleanExpression
);
//查询数据
Page
<
ChannelRuleEntity
>
plantPage
=
channelRuleRepository
.
findAll
(
booleanExpression
,
new
PageRequest
(
channelRouteQueryVo
.
getOffset
(),
channelRouteQueryVo
.
getPageSize
(),
new
Sort
(
Sort
.
Direction
.
DESC
,
"createdAt"
)));
List
<
ChannelRuleEntity
>
channelRuleEntities
=
new
ArrayList
<>();
channelRuleEntities
=
plantPage
.
getContent
();
List
<
ChannelRouteResultVo
>
channelRouteResultVos
=
new
ArrayList
<>();
channelRuleEntities
.
stream
().
forEach
(
channelRuleEntity
->
{
ChannelRouteResultVo
channelRouteResultVo
=
new
ChannelRouteResultVo
();
BeanUtils
.
copyProperties
(
channelRuleEntity
,
channelRouteResultVo
);
channelRouteResultVos
.
add
(
channelRouteResultVo
);
});
AllRecords
allRecords
=
new
AllRecords
();
allRecords
.
setPageIndex
(
channelRouteQueryVo
.
getPageIndex
());
allRecords
.
setPageSize
(
channelRouteQueryVo
.
getPageSize
());
allRecords
.
setDataList
(
channelRouteResultVos
);
allRecords
.
setTotalNumber
(
count
);
allRecords
.
resetTotalNumber
(
count
);
return
allRecords
;
}
@Override
public
List
<
Long
>
queryConfigChannelIds
()
{
List
<
ChannelRuleEntity
>
allByEnableEquals
=
channelRuleRepository
.
getAllByEnableEquals
(
Byte
.
valueOf
(
"1"
));
List
<
Long
>
channelIds
=
new
ArrayList
<>();
allByEnableEquals
.
stream
().
forEach
(
channelRuleEntity
->
{
if
(!
channelIds
.
contains
(
channelRuleEntity
.
getChannelId
())){
channelIds
.
add
(
channelRuleEntity
.
getChannelId
());
}
});
return
channelIds
;
}
@Override
public
GlobalResponse
queryConfigChannelInfo
(
Long
channelId
)
{
List
<
ChannelConfigInfoVo
>
channelConfigInfoVos
=
new
ArrayList
<>();
List
<
ChannelRuleEntity
>
allByChannelIdEqualsaAndEnableEquals
=
channelRuleRepository
.
getAllByChannelIdEqualsAndEnableEquals
(
channelId
,
Byte
.
valueOf
(
"1"
));
if
(
CollectionUtils
.
isEmpty
(
allByChannelIdEqualsaAndEnableEquals
)){
return
GlobalResponse
.
error
(
"该渠道没有对应的路由配置信息"
);
}
else
{
allByChannelIdEqualsaAndEnableEquals
.
stream
().
forEach
(
channelRuleEntity
->
{
ChannelConfigInfoVo
configInfoVo
=
new
ChannelConfigInfoVo
();
BeanUtils
.
copyProperties
(
channelRuleEntity
,
configInfoVo
);
FundProductEntity
one
=
fundProductRepository
.
findOne
(
channelRuleEntity
.
getFundProductId
());
if
(
Objects
.
nonNull
(
one
)){
configInfoVo
.
setSystermType
(
one
.
getSystermType
());
channelConfigInfoVos
.
add
(
configInfoVo
);
}
});
return
GlobalResponse
.
success
(
channelConfigInfoVos
);
}
}
@Override
public
List
<
Long
>
getFundIds
()
{
List
<
FundProductEntity
>
fundProductEntityList
=
fundProductRepository
.
getAllByEnableEquals
(
Byte
.
valueOf
(
"1"
));
List
<
Long
>
fundIdList
=
new
ArrayList
<>();
fundProductEntityList
.
stream
().
forEach
(
fundProductEntity
->
{
if
(!
fundIdList
.
contains
(
fundProductEntity
.
getFundId
())){
fundIdList
.
add
(
fundProductEntity
.
getFundId
());
}
});
return
fundIdList
;
}
@Override
public
List
<
Long
>
getFundCorpIdByFundId
(
Long
fundId
)
{
List
<
FundProductEntity
>
fundProductEntityList
=
fundProductRepository
.
getAllByFundIdEqualsAndEnableEquals
(
fundId
,
Byte
.
valueOf
(
"1"
));
List
<
Long
>
fundCorpList
=
new
ArrayList
<>();
fundProductEntityList
.
stream
().
forEach
(
fundProductEntity
->
{
if
(!
fundCorpList
.
contains
(
fundProductEntity
.
getFundProId
())){
fundCorpList
.
add
(
fundProductEntity
.
getFundProId
());
}
});
return
fundCorpList
;
}
@Override
public
FundProInfoVo
getFundProductInfo
(
Long
fundId
,
Long
fundCorpId
)
{
FundProductEntity
fundProductEntity
=
fundProductRepository
.
getByFundIdEqualsAndFundProIdEqualsAndEnableEquals
(
fundId
,
fundCorpId
,
Byte
.
valueOf
(
"1"
));
FundProInfoVo
fundProInfoVo
=
new
FundProInfoVo
();
BeanUtils
.
copyProperties
(
fundProductEntity
,
fundProInfoVo
);
return
fundProInfoVo
;
}
@Override
public
void
addChannelConfig
(
List
<
ChannelRouteSaveVo
>
channelRouteSaveVoList
,
Integer
type
)
{
/**
* 编辑时要去掉所有该渠道有效性为0的其他配置(覆盖之前的未更新编辑信息)
*/
if
(
0
!=
type
){
channelRuleRepository
.
deleteAllByChannelIdEqualsAndEnableEquals
(
channelRouteSaveVoList
.
get
(
0
).
getChannelId
(),
Byte
.
valueOf
(
"0"
));
}
channelRouteSaveVoList
.
stream
().
forEach
(
channelRouteSaveVo
->
{
ChannelRuleEntity
channelRuleEntity
=
new
ChannelRuleEntity
();
BeanUtils
.
copyProperties
(
channelRouteSaveVo
,
channelRuleEntity
);
FundProductEntity
fundProductEntity
=
fundProductRepository
.
getByFundIdEqualsAndFundProIdEqualsAndEnableEquals
(
channelRouteSaveVo
.
getFundId
(),
channelRouteSaveVo
.
getFundProId
(),
Byte
.
valueOf
(
"1"
));
if
(
Objects
.
nonNull
(
fundProductEntity
)){
channelRuleEntity
.
setFundProductId
(
fundProductEntity
.
getId
());
channelRuleEntity
.
setPublishStatus
(
Byte
.
valueOf
(
"0"
));
if
(
0
==
type
){
channelRuleEntity
.
setEnable
(
Byte
.
valueOf
(
"1"
));
}
else
{
channelRuleEntity
.
setEnable
(
Byte
.
valueOf
(
"0"
));
}
channelRuleRepository
.
save
(
channelRuleEntity
);
}
});
}
@Override
public
void
publishChannelConfig
(
List
<
Long
>
ids
)
{
List
<
ChannelRuleEntity
>
allByIdIn
=
channelRuleRepository
.
getAllByIdIn
(
ids
);
allByIdIn
.
stream
().
forEach
(
channelRuleEntity
->
{
channelRuleEntity
.
setPublishStatus
(
Byte
.
valueOf
(
"1"
));
channelRuleRepository
.
save
(
channelRuleEntity
);
});
}
@Override
public
void
updateChannelConfig
(
Long
channelId
)
{
Boolean
aBoolean
=
channelRuleRepository
.
deleteAllByChannelIdEqualsAndEnableEquals
(
channelId
,
Byte
.
valueOf
(
"1"
));
if
(
aBoolean
){
List
<
ChannelRuleEntity
>
allByChannelIdEqualsAndEnableEquals
=
channelRuleRepository
.
getAllByChannelIdEqualsAndEnableEquals
(
channelId
,
Byte
.
valueOf
(
"0"
));
allByChannelIdEqualsAndEnableEquals
.
stream
().
forEach
(
channelRuleEntity
->
{
channelRuleEntity
.
setEnable
(
Byte
.
valueOf
(
"1"
));
channelRuleRepository
.
save
(
channelRuleEntity
);
});
}
}
}
src/main/java/com/quantgroup/asset/distribution/service/route/impl/FundProductServiceImpl.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
route
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.quantgroup.asset.distribution.config.code.AreaCode
;
import
com.quantgroup.asset.distribution.config.code.InitAreaCode
;
import
com.quantgroup.asset.distribution.enums.route.SystemType
;
import
com.quantgroup.asset.distribution.model.entity.route.fundproduct.*
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.service.httpclient.IHttpService
;
import
com.quantgroup.asset.distribution.service.jpa.entity.FundProductEntity
;
import
com.quantgroup.asset.distribution.service.jpa.entity.ProductRuleEntity
;
import
com.quantgroup.asset.distribution.service.jpa.entity.QFundProductEntity
;
import
com.quantgroup.asset.distribution.service.jpa.repository.IFundProductRepository
;
import
com.quantgroup.asset.distribution.service.jpa.repository.IProductRuleRepository
;
import
com.quantgroup.asset.distribution.service.newrule.pojo.funds.RuleParam
;
import
com.quantgroup.asset.distribution.service.route.IFundProductService
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
import
com.querydsl.core.types.dsl.BooleanExpression
;
import
com.querydsl.core.types.dsl.Expressions
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.sql.Timestamp
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
@Service
@Slf4j
public
class
FundProductServiceImpl
implements
IFundProductService
{
@Autowired
private
IFundProductRepository
fundProductRepository
;
@Autowired
private
IProductRuleRepository
productRuleRepository
;
@Autowired
private
IHttpService
httpService
;
@Value
(
"${mo-sidecar.http}"
)
private
String
modsidecarurl
;
/**
* 数据来源为QG底层资金运营服务,载入页面后,资金路由优先查询底层资金运营服务产品信息,再查询本地存储产品信息,然后进行去重展示;
* @param fundProductQueryVo
* @return
*/
@Override
public
AllRecords
queryPage
(
FundProductQueryVo
fundProductQueryVo
)
{
//1.资金路由优先查询底层资金运营服务产品信息
List
<
FundProductEntity
>
fundProductFromMoFund
=
getFundProductFromMoFund
();
if
(
CollectionUtils
.
isEmpty
(
fundProductFromMoFund
)){
log
.
error
(
"queryPage | 资金底层服务没有查到资金产品信息"
);
return
new
AllRecords
();
}
fundProductFromMoFund
.
stream
().
forEach
(
fundProductEntity
->
{
FundProductEntity
byFundIdEqualsAndFundProIdEquals
=
fundProductRepository
.
getByFundIdEqualsAndFundProIdEquals
(
fundProductEntity
.
getFundId
(),
fundProductEntity
.
getFundProId
());
if
(
Objects
.
isNull
(
byFundIdEqualsAndFundProIdEquals
)){
fundProductEntity
.
setEnable
(
Byte
.
valueOf
(
"1"
));
fundProductEntity
.
setFundType
(
""
);
fundProductEntity
.
setOrgType
(
""
);
fundProductEntity
.
setBusinessType
(
""
);
fundProductEntity
.
setBasicRule
(
""
);
fundProductEntity
.
setAreaTerm
(
0
);
fundProductEntity
.
setCardLimit
(
0
);
fundProductEntity
.
setTelRule
(
""
);
fundProductEntity
.
setAreaRule
(
""
);
fundProductEntity
.
setRuleList
(
""
);
fundProductEntity
.
setCreatedAt
(
Timestamp
.
valueOf
(
LocalDateTime
.
now
()));
fundProductEntity
.
setUpdatedAt
(
Timestamp
.
valueOf
(
LocalDateTime
.
now
()));
fundProductRepository
.
save
(
fundProductEntity
);
}
});
//2.查询本地数据库
//索引 和 每页大小 排序 条件
BooleanExpression
booleanExpression
=
Expressions
.
asBoolean
(
true
).
isTrue
();
if
(
Objects
.
nonNull
(
fundProductQueryVo
.
getFundId
())){
booleanExpression
=
booleanExpression
.
and
(
QFundProductEntity
.
fundProductEntity
.
fundId
.
like
(
String
.
valueOf
(
fundProductQueryVo
.
getFundId
())));
}
if
(
Objects
.
nonNull
(
fundProductQueryVo
.
getFundProId
())){
booleanExpression
=
booleanExpression
.
and
(
QFundProductEntity
.
fundProductEntity
.
fundProId
.
like
(
String
.
valueOf
(
fundProductQueryVo
.
getFundProId
())));
}
if
(!
StringUtils
.
isEmpty
(
fundProductQueryVo
.
getFundName
())){
booleanExpression
=
booleanExpression
.
and
(
QFundProductEntity
.
fundProductEntity
.
fundName
.
like
(
fundProductQueryVo
.
getFundName
()));
}
if
(!
StringUtils
.
isEmpty
(
fundProductQueryVo
.
getFundType
())){
booleanExpression
=
booleanExpression
.
and
(
QFundProductEntity
.
fundProductEntity
.
fundType
.
eq
(
fundProductQueryVo
.
getFundType
()));
}
if
(!
StringUtils
.
isEmpty
(
fundProductQueryVo
.
getOrgType
())){
booleanExpression
=
booleanExpression
.
and
(
QFundProductEntity
.
fundProductEntity
.
orgType
.
eq
(
fundProductQueryVo
.
getOrgType
()));
}
if
(!
StringUtils
.
isEmpty
(
fundProductQueryVo
.
getBusinessType
())){
booleanExpression
=
booleanExpression
.
and
(
QFundProductEntity
.
fundProductEntity
.
businessType
.
eq
(
fundProductQueryVo
.
getBusinessType
()));
}
if
(!
StringUtils
.
isEmpty
(
fundProductQueryVo
.
getSystermType
())){
booleanExpression
=
booleanExpression
.
and
(
QFundProductEntity
.
fundProductEntity
.
systermType
.
eq
(
fundProductQueryVo
.
getSystermType
()));
}
//只查有效数据
booleanExpression
=
booleanExpression
.
and
(
QFundProductEntity
.
fundProductEntity
.
enable
.
eq
(
Byte
.
valueOf
(
"1"
)));
//1.查询条件,2.索引和每页的大小,3.排序根据某个字段进行排序
//查询总条数
long
count
=
fundProductRepository
.
count
(
booleanExpression
);
//查询数据
Page
<
FundProductEntity
>
plantPage
=
fundProductRepository
.
findAll
(
booleanExpression
,
new
PageRequest
(
fundProductQueryVo
.
getOffset
(),
fundProductQueryVo
.
getPageSize
(),
new
Sort
(
Sort
.
Direction
.
DESC
,
"createdAt"
)));
List
<
FundProductEntity
>
fundProductEntities
=
new
ArrayList
<>();
fundProductEntities
=
plantPage
.
getContent
();
List
<
FundProductQueryResultVo
>
fundProductResultVos
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
fundProductEntities
.
size
();
i
++){
FundProductQueryResultVo
fundProductResultVo
=
new
FundProductQueryResultVo
();
BeanUtils
.
copyProperties
(
fundProductEntities
.
get
(
i
),
fundProductResultVo
);
fundProductResultVo
.
setSeqNo
(
fundProductEntities
.
size
()-
i
);
fundProductResultVos
.
add
(
fundProductResultVo
);
}
AllRecords
allRecords
=
new
AllRecords
();
allRecords
.
setPageIndex
(
fundProductQueryVo
.
getPageIndex
());
allRecords
.
setPageSize
(
fundProductQueryVo
.
getPageSize
());
allRecords
.
setDataList
(
fundProductResultVos
);
allRecords
.
setTotalNumber
(
count
);
allRecords
.
resetTotalNumber
(
count
);
return
allRecords
;
}
private
List
<
FundProductEntity
>
getFundProductFromMoFund
(){
List
<
FundProductEntity
>
fundProductEntityList
=
new
ArrayList
<>();
String
post
=
httpService
.
post
(
modsidecarurl
+
"/middle_office/financeProduct/infoList"
);
if
(
Objects
.
nonNull
(
post
)
&&
JSON
.
parseObject
(
post
).
getInteger
(
"code"
)
==
0
){
JSONArray
data
=
JSON
.
parseObject
(
post
).
getJSONArray
(
"data"
);
if
(
Objects
.
nonNull
(
data
)
&&
!
data
.
isEmpty
()){
for
(
int
i
=
0
;
i
<
data
.
size
()
;
i
++){
FundProductEntity
fundProductEntity
=
new
FundProductEntity
();
fundProductEntity
.
setFundId
(
data
.
getJSONObject
(
i
).
getLong
(
"fundCorpId"
));
fundProductEntity
.
setFundProId
(
data
.
getJSONObject
(
i
).
getLong
(
"financeProductId"
));
fundProductEntity
.
setFundName
(
data
.
getJSONObject
(
i
).
getString
(
"fundName"
));
Integer
systemNo
=
data
.
getJSONObject
(
i
).
getInteger
(
"systemNo"
);
if
(
systemNo
==
1
){
fundProductEntity
.
setSystermType
(
SystemType
.
XYQB
.
getValue
());
}
else
if
(
systemNo
==
2
){
fundProductEntity
.
setSystermType
(
SystemType
.
MO
.
getValue
());
}
fundProductEntityList
.
add
(
fundProductEntity
);
}
}
}
return
fundProductEntityList
;
}
@Override
public
FundProductVo
lookFundProduct
(
Long
id
)
{
FundProductVo
fundProductVo
=
new
FundProductVo
();
FundProductEntity
one
=
fundProductRepository
.
findOne
(
id
);
//1.资金信息-value
BeanUtils
.
copyProperties
(
one
,
fundProductVo
);
//2.基本信息和其他信息字段
//所有的BASIC规则
List
<
ProductRuleEntity
>
basic
=
productRuleRepository
.
getAllByRuleTypeEqualsAndEnableEquals
(
"BASIC"
,
Byte
.
valueOf
(
"1"
));
//所有的其他规则
List
<
ProductRuleEntity
>
orther
=
productRuleRepository
.
getAllByRuleTypeEqualsAndEnableEquals
(
"ORTHER"
,
Byte
.
valueOf
(
"1"
));
basic
.
addAll
(
orther
);
fundProductVo
.
setProductRuleEntityList
(
basic
);
//3.基本信息和其他信息字段,对应的value
Map
<
Long
,
String
>
map
=
new
HashMap
<>();
//3.1解析基本规则10 <= age && age <= 50 && 10 <= amount && amount <= 20000 && term == 12 && ! include(not_permit_tels,tel)
//获取资金产品存的value
String
basicRule
=
one
.
getBasicRule
();
//解析value
String
[]
split
=
basicRule
.
split
(
"&&"
);
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++){
for
(
ProductRuleEntity
productRuleEntity:
basic
){
//在value中寻找对应的规则
if
(
"not_permit_tels"
.
equals
(
productRuleEntity
.
getRuleVal
())){
map
.
put
(
productRuleEntity
.
getId
(),
one
.
getTelRule
());
break
;
}
if
(
split
[
i
].
contains
(
productRuleEntity
.
getRuleVal
())){
//取出value中的值
String
numeric
=
getNumeric
(
split
[
i
]);
String
s
=
map
.
get
(
productRuleEntity
.
getId
());
if
(
StringUtils
.
isEmpty
(
s
)){
map
.
put
(
productRuleEntity
.
getId
(),
numeric
);
}
else
{
map
.
put
(
productRuleEntity
.
getId
(),
s
.
concat
(
","
).
concat
(
numeric
));
}
break
;
}
}
}
//3.2基本规则剩下的字段
//区域类型的规则
String
areaRule
=
one
.
getAreaRule
();
RuleParam
.
AreaRuleConcrete
areaRuleConcrete
=
JSONObject
.
parseObject
(
areaRule
,
RuleParam
.
AreaRuleConcrete
.
class
);
//其它规则
String
ruleList
=
one
.
getRuleList
();
for
(
ProductRuleEntity
productRuleEntity:
basic
){
switch
(
productRuleEntity
.
getRuleVal
()){
case
"area_term"
:
//地区要求
map
.
put
(
productRuleEntity
.
getId
(),
String
.
valueOf
(
one
.
getAreaTerm
()));
break
;
case
"card_limit"
:
//身份证有效期
map
.
put
(
productRuleEntity
.
getId
(),
String
.
valueOf
(
one
.
getCardLimit
()));
break
;
case
"tel_area_list"
:
//手机号区域限制
if
(
Objects
.
nonNull
(
areaRuleConcrete
)){
map
.
put
(
productRuleEntity
.
getId
(),
areaRuleConcrete
.
getTelAreaNameList
());
}
break
;
case
"residence_list"
:
//居住地区限制
if
(
Objects
.
nonNull
(
areaRuleConcrete
)){
map
.
put
(
productRuleEntity
.
getId
(),
areaRuleConcrete
.
getResidenceList
());
}
break
;
case
"native_list"
:
//户籍地区限制(身份证)
if
(
Objects
.
nonNull
(
areaRuleConcrete
)){
map
.
put
(
productRuleEntity
.
getId
(),
areaRuleConcrete
.
getNativeList
());
}
break
;
case
"name_same"
:
case
"tel_same"
:
case
"tel_no_same"
:
//联系人手机号不正确
//联系人手机号相同
//联系人姓名相同
map
.
put
(
productRuleEntity
.
getId
(),
ruleList
.
contains
(
String
.
valueOf
(
productRuleEntity
.
getId
()))?
"1"
:
"0"
);
break
;
}
}
fundProductVo
.
setRuleValueMap
(
map
);
return
fundProductVo
;
}
@Override
public
GlobalResponse
save
(
FundProductSaveVo
fundProductSaveVo
)
{
FundProductEntity
one
=
fundProductRepository
.
findOne
(
fundProductSaveVo
.
getId
());
if
(
Objects
.
isNull
(
one
)){
return
GlobalResponse
.
error
(
"没有这个资金产品"
);
}
BeanUtils
.
copyProperties
(
fundProductSaveVo
,
one
);
StringBuffer
basicRule
=
new
StringBuffer
();
StringBuffer
ruleList
=
new
StringBuffer
();
RuleParam
.
AreaRuleConcrete
areaRuleConcrete
=
new
RuleParam
.
AreaRuleConcrete
();
Map
<
Long
,
String
>
ruleValueMap
=
fundProductSaveVo
.
getRuleValueMap
();
List
<
ProductRuleEntity
>
allByEnableEquals
=
productRuleRepository
.
getAllByEnableEquals
(
Byte
.
valueOf
(
"1"
));
allByEnableEquals
.
stream
().
forEach
(
productRuleEntity
->
{
String
value
=
ruleValueMap
.
get
(
productRuleEntity
.
getId
());
if
(!
StringUtils
.
isEmpty
(
value
)){
//10 <= age && age <= 50 && 10 <= amount && amount <= 20000 && term == 12 && ! include(not_permit_tels,tel)
switch
(
productRuleEntity
.
getRuleVal
()){
case
"age"
:
basicRule
.
append
(
value
.
replace
(
","
,
" <= age && age <= "
)).
append
(
" && "
);
break
;
case
"amount"
:
basicRule
.
append
(
value
.
replace
(
","
,
" <= amount && amount <= "
)).
append
(
" && "
);
break
;
case
"term"
:
basicRule
.
append
(
"term == "
).
append
(
value
).
append
(
" && "
);
break
;
case
"not_permit_tels"
:
basicRule
.
append
(
"! include(not_permit_tels,tel)"
).
append
(
" && "
);
one
.
setTelRule
(
value
);
break
;
case
"name_same"
:
case
"tel_same"
:
case
"tel_no_same"
:
ruleList
.
append
(
productRuleEntity
.
getId
()).
append
(
","
);
break
;
case
"area_term"
:
one
.
setAreaTerm
(
Integer
.
getInteger
(
value
));
break
;
case
"card_limit"
:
one
.
setCardLimit
(
Integer
.
getInteger
(
value
));
break
;
case
"tel_area_list"
:
areaRuleConcrete
.
setTelAreaNameList
(
value
);
break
;
case
"residence_list"
:
areaRuleConcrete
.
setResidenceList
(
value
);
break
;
case
"native_list"
:
areaRuleConcrete
.
setNativeList
(
value
);
break
;
}
}
});
one
.
setBasicRule
(
basicRule
.
substring
(
0
,
basicRule
.
lastIndexOf
(
" && "
)));
one
.
setRuleList
(
ruleList
.
substring
(
0
,
ruleList
.
lastIndexOf
(
","
)));
one
.
setAreaRule
(
JSONObject
.
toJSONString
(
areaRuleConcrete
));
fundProductRepository
.
save
(
one
);
return
GlobalResponse
.
success
();
}
@Override
public
GlobalResponse
getArea
()
throws
IOException
{
AreaCodeVo
areaCodeVo
=
new
AreaCodeVo
();
InputStream
in
=
this
.
getClass
().
getResourceAsStream
(
"/phone/gbt.txt"
);
String
var4
=
InitAreaCode
.
getString
(
in
);
List
<
AreaCode
>
list
=
new
ArrayList
<
AreaCode
>();
list
=
JSONObject
.
parseArray
(
var4
,
AreaCode
.
class
);
for
(
AreaCode
country
:
list
)
{
if
(
"100000"
.
equals
(
country
.
getAdcode
())){
BeanUtils
.
copyProperties
(
country
,
areaCodeVo
);
//获取省
for
(
AreaCode
province
:
list
){
if
(
country
.
getAdcode
().
equals
(
province
.
getParent
())){
AreaCodeVo
provinceVo
=
new
AreaCodeVo
();
BeanUtils
.
copyProperties
(
province
,
provinceVo
);
//获取市
for
(
AreaCode
city
:
list
)
{
if
(
province
.
getAdcode
().
equals
(
city
.
getParent
())){
AreaCodeVo
cityVo
=
new
AreaCodeVo
();
BeanUtils
.
copyProperties
(
city
,
cityVo
);
//获取区
for
(
AreaCode
district
:
list
)
{
if
(
city
.
getAdcode
().
equals
(
district
.
getParent
())){
AreaCodeVo
districtVo
=
new
AreaCodeVo
();
BeanUtils
.
copyProperties
(
district
,
districtVo
);
cityVo
.
getNodes
().
add
(
districtVo
);
}
}
provinceVo
.
getNodes
().
add
(
cityVo
);
}
}
areaCodeVo
.
getNodes
().
add
(
provinceVo
);
}
}
}
}
return
GlobalResponse
.
success
(
areaCodeVo
);
}
/**
* 过滤非数字
* @param str
* @return
*/
public
static
String
getNumeric
(
String
str
)
{
String
regEx
=
"[^0-9]"
;
Pattern
p
=
Pattern
.
compile
(
regEx
);
Matcher
m
=
p
.
matcher
(
str
);
return
m
.
replaceAll
(
""
).
trim
();
}
}
src/main/java/com/quantgroup/asset/distribution/service/route/impl/RouteRecordServiceImpl.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
route
.
impl
;
import
com.quantgroup.asset.distribution.model.entity.route.routerecord.RouteRecordQueryVo
;
import
com.quantgroup.asset.distribution.model.entity.route.routerecord.RouteRecordResultVo
;
import
com.quantgroup.asset.distribution.model.entity.route.whitelist.WhiteListResultVo
;
import
com.quantgroup.asset.distribution.service.jpa.entity.QRoutingRecordEntity
;
import
com.quantgroup.asset.distribution.service.jpa.entity.QWhiteListEntity
;
import
com.quantgroup.asset.distribution.service.jpa.entity.RoutingRecordEntity
;
import
com.quantgroup.asset.distribution.service.jpa.entity.WhiteListEntity
;
import
com.quantgroup.asset.distribution.service.jpa.repository.IRoutingRecordRepository
;
import
com.quantgroup.asset.distribution.service.route.IRouteRecordService
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
import
com.querydsl.core.types.dsl.BooleanExpression
;
import
com.querydsl.core.types.dsl.Expressions
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
@Service
public
class
RouteRecordServiceImpl
implements
IRouteRecordService
{
@Autowired
private
IRoutingRecordRepository
routingRecordRepository
;
@Override
public
AllRecords
queryPage
(
RouteRecordQueryVo
routeRecordQueryVo
)
{
//索引 和 每页大小 排序 条件
BooleanExpression
booleanExpression
=
Expressions
.
asBoolean
(
true
).
isTrue
();
if
(!
StringUtils
.
isEmpty
(
routeRecordQueryVo
.
getCreditNo
())){
booleanExpression
=
booleanExpression
.
and
(
QRoutingRecordEntity
.
routingRecordEntity
.
creditNo
.
eq
(
routeRecordQueryVo
.
getCreditNo
()));
}
if
(!
StringUtils
.
isEmpty
(
routeRecordQueryVo
.
getUuid
())){
booleanExpression
=
booleanExpression
.
and
(
QRoutingRecordEntity
.
routingRecordEntity
.
uuid
.
eq
(
routeRecordQueryVo
.
getUuid
()));
}
if
(
Objects
.
nonNull
(
routeRecordQueryVo
.
getStatus
())){
booleanExpression
=
booleanExpression
.
and
(
QRoutingRecordEntity
.
routingRecordEntity
.
status
.
eq
(
routeRecordQueryVo
.
getStatus
()));
}
if
(
Objects
.
nonNull
(
routeRecordQueryVo
.
getRoutedAtMin
())
&&
Objects
.
nonNull
(
routeRecordQueryVo
.
getRoutedAtMax
())){
booleanExpression
=
booleanExpression
.
and
(
QRoutingRecordEntity
.
routingRecordEntity
.
routedAt
.
between
(
routeRecordQueryVo
.
getRoutedAtMin
(),
routeRecordQueryVo
.
getRoutedAtMax
()));
}
else
if
(
Objects
.
nonNull
(
routeRecordQueryVo
.
getRoutedAtMin
())){
booleanExpression
=
booleanExpression
.
and
(
QRoutingRecordEntity
.
routingRecordEntity
.
routedAt
.
after
(
routeRecordQueryVo
.
getRoutedAtMin
()));
}
else
if
(
Objects
.
nonNull
(
routeRecordQueryVo
.
getRoutedAtMax
())){
booleanExpression
=
booleanExpression
.
and
(
QRoutingRecordEntity
.
routingRecordEntity
.
routedAt
.
before
(
routeRecordQueryVo
.
getRoutedAtMax
()));
}
//1.查询条件,2.索引和每页的大小,3.排序根据某个字段进行排序
//查询总条数
long
count
=
routingRecordRepository
.
count
(
booleanExpression
);
//查询数据
Page
<
RoutingRecordEntity
>
plantPage
=
routingRecordRepository
.
findAll
(
booleanExpression
,
new
PageRequest
(
routeRecordQueryVo
.
getOffset
(),
routeRecordQueryVo
.
getPageSize
(),
new
Sort
(
Sort
.
Direction
.
DESC
,
"createdAt"
)));
List
<
RoutingRecordEntity
>
routingRecordEntityList
=
new
ArrayList
<>();
routingRecordEntityList
=
plantPage
.
getContent
();
List
<
RouteRecordResultVo
>
routeRecordResultVoList
=
new
ArrayList
<>();
routingRecordEntityList
.
stream
().
forEach
(
routingRecordEntity
->
{
RouteRecordResultVo
routeRecordResultVo
=
new
RouteRecordResultVo
();
BeanUtils
.
copyProperties
(
routingRecordEntity
,
routeRecordResultVo
);
if
(
StringUtils
.
isEmpty
(
routeRecordResultVo
.
getRoutedResult
())){
routeRecordResultVo
.
setRoutedResult
(
"无"
);
}
routeRecordResultVoList
.
add
(
routeRecordResultVo
);
});
AllRecords
allRecords
=
new
AllRecords
();
allRecords
.
setPageIndex
(
routeRecordQueryVo
.
getPageIndex
());
allRecords
.
setPageSize
(
routeRecordQueryVo
.
getPageSize
());
allRecords
.
setDataList
(
routeRecordResultVoList
);
allRecords
.
setTotalNumber
(
count
);
allRecords
.
resetTotalNumber
(
count
);
return
allRecords
;
}
}
src/main/java/com/quantgroup/asset/distribution/service/route/impl/WhiteListServiceImpl.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
route
.
impl
;
import
com.quantgroup.asset.distribution.model.entity.route.whitelist.WhiteListQueryVo
;
import
com.quantgroup.asset.distribution.model.entity.route.whitelist.WhiteListResultVo
;
import
com.quantgroup.asset.distribution.model.entity.route.whitelist.WhiteListSaveVo
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.service.jpa.entity.FundProductEntity
;
import
com.quantgroup.asset.distribution.service.jpa.entity.QWhiteListEntity
;
import
com.quantgroup.asset.distribution.service.jpa.entity.WhiteListEntity
;
import
com.quantgroup.asset.distribution.service.jpa.repository.IFundProductRepository
;
import
com.quantgroup.asset.distribution.service.jpa.repository.IWhiteListRepository
;
import
com.quantgroup.asset.distribution.service.route.IWhiteListService
;
import
com.quantgroup.asset.distribution.util.AllRecords
;
import
com.querydsl.core.types.dsl.BooleanExpression
;
import
com.querydsl.core.types.dsl.Expressions
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
@Service
public
class
WhiteListServiceImpl
implements
IWhiteListService
{
@Autowired
private
IWhiteListRepository
whiteListRepository
;
@Autowired
IFundProductRepository
fundProductRepository
;
@Override
public
AllRecords
queryPage
(
WhiteListQueryVo
whiteListQueryVo
)
{
//索引 和 每页大小 排序 条件
BooleanExpression
booleanExpression
=
Expressions
.
asBoolean
(
true
).
isTrue
();
if
(!
StringUtils
.
isEmpty
(
whiteListQueryVo
.
getPhone
())){
booleanExpression
=
booleanExpression
.
and
(
QWhiteListEntity
.
whiteListEntity
.
phone
.
eq
(
String
.
valueOf
(
whiteListQueryVo
.
getPhone
())));
}
if
(!
StringUtils
.
isEmpty
(
whiteListQueryVo
.
getFundName
())){
booleanExpression
=
booleanExpression
.
and
(
QWhiteListEntity
.
whiteListEntity
.
fundName
.
like
(
String
.
valueOf
(
whiteListQueryVo
.
getFundName
())));
}
//1.查询条件,2.索引和每页的大小,3.排序根据某个字段进行排序
//查询总条数
long
count
=
whiteListRepository
.
count
(
booleanExpression
);
//查询数据
Page
<
WhiteListEntity
>
plantPage
=
whiteListRepository
.
findAll
(
booleanExpression
,
new
PageRequest
(
whiteListQueryVo
.
getOffset
(),
whiteListQueryVo
.
getPageSize
(),
new
Sort
(
Sort
.
Direction
.
DESC
,
"createdAt"
)));
List
<
WhiteListEntity
>
whiteListEntityList
=
new
ArrayList
<>();
whiteListEntityList
=
plantPage
.
getContent
();
List
<
WhiteListResultVo
>
whiteListResultVoArrayList
=
new
ArrayList
<>();
whiteListEntityList
.
stream
().
forEach
(
whiteListEntity
->
{
WhiteListResultVo
whiteListResultVo
=
new
WhiteListResultVo
();
BeanUtils
.
copyProperties
(
whiteListEntity
,
whiteListResultVo
);
whiteListResultVoArrayList
.
add
(
whiteListResultVo
);
});
AllRecords
allRecords
=
new
AllRecords
();
allRecords
.
setPageIndex
(
whiteListQueryVo
.
getPageIndex
());
allRecords
.
setPageSize
(
whiteListQueryVo
.
getPageSize
());
allRecords
.
setDataList
(
whiteListResultVoArrayList
);
allRecords
.
setTotalNumber
(
count
);
allRecords
.
resetTotalNumber
(
count
);
return
allRecords
;
}
@Override
public
GlobalResponse
updateStatus
(
Long
id
,
Byte
status
)
{
WhiteListEntity
one
=
whiteListRepository
.
findOne
(
id
);
if
(
Objects
.
nonNull
(
one
)){
one
.
setStatus
(
status
);
whiteListRepository
.
save
(
one
);
return
GlobalResponse
.
success
();
}
else
{
return
GlobalResponse
.
error
(
"该条记录不存在"
);
}
}
@Override
public
GlobalResponse
save
(
WhiteListSaveVo
whiteListSaveVo
)
{
WhiteListEntity
whiteListEntity
=
new
WhiteListEntity
();
BeanUtils
.
copyProperties
(
whiteListSaveVo
,
whiteListEntity
);
FundProductEntity
fundProductEntity
=
fundProductRepository
.
getByFundIdEqualsAndFundProIdEqualsAndEnableEquals
(
whiteListSaveVo
.
getFundId
(),
whiteListSaveVo
.
getFundProId
(),
Byte
.
valueOf
(
"1"
));
if
(
Objects
.
nonNull
(
fundProductEntity
)){
whiteListEntity
.
setFundProductId
(
fundProductEntity
.
getId
());
whiteListEntity
.
setFundName
(
fundProductEntity
.
getFundName
());
whiteListEntity
.
setStatus
(
Byte
.
valueOf
(
"0"
));
whiteListRepository
.
save
(
whiteListEntity
);
return
GlobalResponse
.
success
();
}
else
{
return
GlobalResponse
.
error
(
"要保存的白名单对应的资金产品不存在"
);
}
}
}
src/main/java/com/quantgroup/asset/distribution/util/AllRecords.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
util
;
import
lombok.Data
;
import
java.util.List
;
/**
*
*/
@Data
public
class
AllRecords
<
T
>
{
//总页数
private
long
totalPage
;
//总数量
private
long
totalNumber
;
//索引
private
int
pageIndex
;
//每页条数
private
long
pageSize
;
//分页的列表数据
private
List
<
T
>
dataList
;
//计算总页数
public
void
resetTotalNumber
(
long
totalNumber
)
{
if
(
totalNumber
!=
0
){
this
.
totalNumber
=
totalNumber
;
this
.
totalPage
=
totalNumber
/
this
.
pageSize
;
if
(
totalNumber
%
this
.
pageSize
!=
0L
)
{
++
this
.
totalPage
;
}
}
}
}
src/main/java/com/quantgroup/asset/distribution/util/PageVo.java
0 → 100644
View file @
f251d841
package
com
.
quantgroup
.
asset
.
distribution
.
util
;
import
lombok.Data
;
/**
*
* 分页参数VO,所有用到分页的实体继承此类,接受分页参数
* Created by wyx
*/
@Data
public
class
PageVo
{
//当前页数
private
int
pageIndex
;
//索引
private
int
offset
;
//默认每页条数
private
int
pageSize
;
public
void
setPageIndex
(
int
pageIndex
){
this
.
pageIndex
=
pageIndex
;
initParamter
();
}
public
void
setPageSize
(
int
pageSize
){
this
.
pageSize
=
pageSize
;
initParamter
();
}
public
int
getOffset
()
{
return
offset
;
}
public
void
setOffset
(
int
offset
)
{
this
.
offset
=
offset
;
}
public
int
getPageIndex
()
{
return
pageIndex
;
}
public
int
getPageSize
()
{
return
pageSize
;
}
/**
* 根据前端传值,计算分页参数
*/
private
void
initParamter
(){
if
(
pageIndex
<
1
){
pageIndex
=
1
;
//默认第一页
}
if
(
this
.
pageSize
==
0
)
{
this
.
pageSize
=
10
;
//默认每页显示10条
}
final
int
offset
=
(
this
.
pageIndex
-
1
)
*
this
.
pageSize
;
setOffset
(
offset
);
}
}
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