Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-enterprise
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
base_platform_enterprise
gic-platform-enterprise
Commits
59088cfe
Commit
59088cfe
authored
Mar 09, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加应用字典:规则
parent
5054bc3b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
1 deletions
+54
-1
ConfigRuleApiService.java
...java/com/gic/enterprise/service/ConfigRuleApiService.java
+10
-0
ConfigRuleApiServiceImpl.java
...terprise/service/outer/impl/ConfigRuleApiServiceImpl.java
+39
-1
ConfigRuleController.java
...om/gic/operation/web/controller/ConfigRuleController.java
+5
-0
No files found.
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/ConfigRuleApiService.java
View file @
59088cfe
...
...
@@ -5,6 +5,7 @@ import com.gic.api.base.commons.ServiceResponse;
import
com.gic.enterprise.dto.rule.*
;
import
java.util.List
;
import
java.util.Map
;
/**
* 平台规则配置
...
...
@@ -146,6 +147,15 @@ public interface ConfigRuleApiService {
*/
ServiceResponse
<
List
<
EnterpriseListDTO
>>
getEnterpriseList
(
String
search
);
/**
* 获取应用列表字典数据
* @Title: getAppListByDict
* @Description:
* @author guojuxing
* @return com.gic.api.base.commons.ServiceResponse<java.util.Map<java.lang.String,java.lang.String>>
*/
ServiceResponse
<
Map
<
String
,
String
>>
getAppListByDict
();
/***************对接其他组*******************/
/**
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/ConfigRuleApiServiceImpl.java
View file @
59088cfe
package
com
.
gic
.
enterprise
.
service
.
outer
.
impl
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.bizdict.api.dto.BizdictDTO
;
import
com.gic.bizdict.api.service.BizdictService
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
...
...
@@ -30,6 +32,8 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
private
ConfigRuleEnterpriseService
configRuleEnterpriseService
;
@Autowired
private
EnterpriseService
enterpriseService
;
@Autowired
private
BizdictService
bizdictService
;
@Override
public
ServiceResponse
<
Integer
>
saveRule
(
RuleDTO
dto
)
{
...
...
@@ -42,6 +46,10 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
if
(
StringUtils
.
isBlank
(
dto
.
getAppCode
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"应用code不能为空"
);
}
//校验应用code是否存在
if
(!
getAppList
().
containsKey
(
dto
.
getAppCode
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"应用code不存在"
);
}
//名称唯一性校验
if
(
configRuleService
.
isRepeatName
(
null
,
1
,
dto
.
getRuleName
(),
null
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"规则名称重复"
);
...
...
@@ -51,6 +59,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"应用code重复"
);
}
//填充
dto
.
setRuleName
(
getAppList
().
get
(
dto
.
getAppCode
()));
dto
.
setParentRuleId
(
0
);
dto
.
setRuleLevel
(
1
);
Integer
ruleId
=
configRuleService
.
saveRule
(
dto
);
...
...
@@ -78,6 +87,10 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
if
(
StringUtils
.
isBlank
(
dto
.
getAppCode
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"应用code不能为空"
);
}
//校验应用code是否存在
if
(!
getAppList
().
containsKey
(
dto
.
getAppCode
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"应用code不存在"
);
}
//名称唯一性校验
if
(
configRuleService
.
isRepeatName
(
dto
.
getRuleId
(),
1
,
dto
.
getRuleName
(),
null
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"规则名称重复"
);
...
...
@@ -86,7 +99,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
if
(
configRuleService
.
isRepeatAppCode
(
dto
.
getRuleId
(),
dto
.
getAppCode
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"应用code重复"
);
}
record
.
setRuleName
(
dto
.
getRuleName
(
));
record
.
setRuleName
(
getAppList
().
get
(
dto
.
getAppCode
()
));
record
.
setAppCode
(
dto
.
getAppCode
());
record
.
setAppName
(
dto
.
getAppName
());
configRuleService
.
update
(
record
);
...
...
@@ -340,6 +353,10 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
//必有值,如果为空,则说明数据错误,需要修正
int
ruleLevel
=
rule
.
getRuleLevel
();
if
(
ruleLevel
==
1
)
{
if
(
StringUtils
.
isBlank
(
rule
.
getAppCode
()))
{
//复制的时候可能造成没有code
continue
;
}
result
.
add
(
new
RuleListDTO
().
setAppCode
(
rule
.
getAppCode
()).
setAppName
(
rule
.
getAppName
())
.
setRuleId
(
rule
.
getRuleId
()).
setRuleName
(
rule
.
getRuleName
()).
setSelect
(
select
));
}
else
if
(
ruleLevel
==
2
)
{
...
...
@@ -559,6 +576,11 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
return
ServiceResponse
.
success
(
Collections
.
emptyList
());
}
@Override
public
ServiceResponse
<
Map
<
String
,
String
>>
getAppListByDict
()
{
return
ServiceResponse
.
success
(
getAppList
());
}
private
ServiceResponse
<
Void
>
validRuleClassify
(
RuleClassifyDTO
dto
)
{
TabConfigRule
record
=
configRuleService
.
getByRuleId
(
dto
.
getParentRuleId
());
if
(
record
==
null
)
{
...
...
@@ -612,4 +634,20 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
}
return
ServiceResponse
.
success
();
}
/**
* 应用列表
* @return
*/
private
Map
<
String
,
String
>
getAppList
()
{
Map
<
String
,
String
>
result
=
new
HashMap
<>(
16
);
List
<
BizdictDTO
>
list
=
bizdictService
.
listByTypeDict
(
"applicaiton_module"
,
"marketing"
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
for
(
BizdictDTO
bizdictDTO
:
list
)
{
result
.
put
(
bizdictDTO
.
getCode
(),
bizdictDTO
.
getName
());
}
}
return
result
;
}
}
gic-platform-operation-web/src/main/java/com/gic/operation/web/controller/ConfigRuleController.java
View file @
59088cfe
...
...
@@ -42,6 +42,11 @@ public class ConfigRuleController {
return
ResultControllerUtils
.
commonResult
(
configRuleApiService
.
saveRule
(
dto
));
}
@RequestMapping
(
"/get-app-list"
)
public
RestResponse
listApp
()
{
return
ResultControllerUtils
.
commonResult
(
configRuleApiService
.
getAppListByDict
());
}
@RequestMapping
(
"/editRule"
)
public
RestResponse
editRule
(
RuleDTO
dto
)
{
return
ResultControllerUtils
.
commonResult
(
configRuleApiService
.
editRule
(
dto
));
...
...
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