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
17a55781
Commit
17a55781
authored
May 24, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置表
parent
df5cc949
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
pom.xml
gic-platform-enterprise-service/pom.xml
+5
-0
CustomSettingApiServiceImpl.java
...prise/service/outer/impl/CustomSettingApiServiceImpl.java
+33
-0
No files found.
gic-platform-enterprise-service/pom.xml
View file @
17a55781
...
...
@@ -226,6 +226,11 @@
<artifactId>
gic-member-filter-api
</artifactId>
<version>
${gic-member-filter-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-dubbo-extension
</artifactId>
<version>
4.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/CustomSettingApiServiceImpl.java
View file @
17a55781
...
...
@@ -2,6 +2,8 @@ package com.gic.enterprise.service.outer.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.ConfigService
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.ToolUtil
;
...
...
@@ -11,6 +13,8 @@ import com.gic.dsmongo.api.dto.MongoQueryDTO;
import
com.gic.dsmongo.api.dto.MongoSaveDTO
;
import
com.gic.dsmongo.api.dto.MongoUpdateDTO
;
import
com.gic.dsmongo.api.service.MongoOperApiService
;
import
com.gic.dubbo.util.DubboContextUtil
;
import
com.gic.dubbo.util.DubboInvokeUtil
;
import
com.gic.enterprise.constant.FieldTypeEnum
;
import
com.gic.enterprise.dto.TableSettingDTO
;
import
com.gic.enterprise.dto.TableSettingFieldDTO
;
...
...
@@ -23,6 +27,7 @@ import com.gic.enterprise.service.TableSettingService;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.dubbo.rpc.service.GenericService
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -91,6 +96,10 @@ public class CustomSettingApiServiceImpl implements CustomSettingApiService {
ServiceResponse
<
Integer
>
update
=
mongoOperApiService
.
update
(
mongoUpdateDTO
);
log
.
info
(
"update:{},{}"
,
JSON
.
toJSONString
(
map
),
JSON
.
toJSONString
(
update
));
if
(
update
.
isSuccess
()){
String
saveExtInterface
=
tableSetting
.
getSaveExtInterface
();
if
(
StringUtils
.
isNotBlank
(
saveExtInterface
)){
extendInterface
(
saveExtInterface
,
params
);
}
return
ServiceResponse
.
success
();
}
else
{
return
ServiceResponse
.
failure
(
update
.
getCode
(),
update
.
getMessage
());
...
...
@@ -106,6 +115,10 @@ public class CustomSettingApiServiceImpl implements CustomSettingApiService {
ServiceResponse
<
String
>
save
=
mongoOperApiService
.
save
(
mongoSaveDTO
);
log
.
info
(
"save:{}"
,
JSON
.
toJSONString
(
save
));
if
(
save
.
isSuccess
()){
String
saveExtInterface
=
tableSetting
.
getSaveExtInterface
();
if
(
StringUtils
.
isNotBlank
(
saveExtInterface
)){
extendInterface
(
saveExtInterface
,
params
);
}
return
ServiceResponse
.
success
();
}
else
{
return
ServiceResponse
.
failure
(
save
.
getCode
(),
save
.
getMessage
());
...
...
@@ -113,6 +126,7 @@ public class CustomSettingApiServiceImpl implements CustomSettingApiService {
}
}
@Override
public
ServiceResponse
<
Map
<
String
,
Object
>>
getDetail
(
String
tableName
,
String
searchParams
)
{
Map
<
String
,
Object
>
map
=
JSON
.
parseObject
(
searchParams
,
Map
.
class
);
...
...
@@ -169,6 +183,12 @@ public class CustomSettingApiServiceImpl implements CustomSettingApiService {
mongoUpdateDTO
.
setDataBaseAndCollectionName
(
DATABASENAME
,
tableName
,
PRIMARYKEY
);
mongoUpdateDTO
.
setData
(
map
);
ServiceResponse
<
Integer
>
update
=
mongoOperApiService
.
update
(
mongoUpdateDTO
);
if
(
update
.
isSuccess
()){
TabTableSetting
tableSetting
=
tableSettingService
.
getTableSetting
(
tableName
);
if
(
StringUtils
.
isNotBlank
(
tableSetting
.
getDelExtInterface
())){
extendInterface
(
tableSetting
.
getDelExtInterface
(),
JSON
.
toJSONString
(
map
));
}
}
return
update
;
}
...
...
@@ -207,4 +227,17 @@ public class CustomSettingApiServiceImpl implements CustomSettingApiService {
criteriaList
.
add
(
criteria
);
return
criteriaList
;
}
private
void
extendInterface
(
String
extInterface
,
String
param
){
Config
config
=
ConfigService
.
getConfig
(
"COMMON.4.0-dubbo"
);
String
zookeeperHost
=
config
.
getProperty
(
"zookeeper_host"
,
""
);
String
host
=
zookeeperHost
.
substring
(
zookeeperHost
.
indexOf
(
"//"
)+
2
,
zookeeperHost
.
lastIndexOf
(
":"
));
String
port
=
zookeeperHost
.
substring
(
zookeeperHost
.
lastIndexOf
(
":"
)+
1
);
String
service
=
extInterface
.
substring
(
0
,
extInterface
.
lastIndexOf
(
"."
));
String
method
=
extInterface
.
substring
(
extInterface
.
lastIndexOf
(
"."
)+
1
);
DubboContextUtil
.
initRegistryConfig
(
host
,
Integer
.
valueOf
(
port
));
GenericService
genericService
=
DubboInvokeUtil
.
getGenericService
(
service
);
Object
o
=
genericService
.
$invoke
(
method
,
new
String
[]{
String
.
class
.
getName
()},
new
String
[]{
param
});
}
}
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