Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-data-cloud
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-data-cloud
Commits
f56b60e8
Commit
f56b60e8
authored
Jul 10, 2020
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发布小红点
parent
2b9bacdb
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
184 additions
and
14 deletions
+184
-14
DataExplainApiService.java
...ain/java/com/gic/cloud/service/DataExplainApiService.java
+20
-0
IndexApiService.java
.../src/main/java/com/gic/cloud/service/IndexApiService.java
+21
-0
DataExplainController.java
...cloud/operation/web/controller/DataExplainController.java
+13
-0
IndexController.java
...m/gic/cloud/operation/web/controller/IndexController.java
+12
-0
TabIndexModuleRelMapper.java
...ava/com/gic/cloud/dao/mapper/TabIndexModuleRelMapper.java
+5
-2
DataExplainService.java
...c/main/java/com/gic/cloud/service/DataExplainService.java
+2
-0
IndexModuleRelService.java
...ain/java/com/gic/cloud/service/IndexModuleRelService.java
+7
-2
IndexService.java
...ice/src/main/java/com/gic/cloud/service/IndexService.java
+2
-0
DataExplainServiceImpl.java
...va/com/gic/cloud/service/impl/DataExplainServiceImpl.java
+8
-0
IndexModuleRelServiceImpl.java
...com/gic/cloud/service/impl/IndexModuleRelServiceImpl.java
+19
-6
IndexServiceImpl.java
...ain/java/com/gic/cloud/service/impl/IndexServiceImpl.java
+8
-0
DataExplainApiServiceImpl.java
...c/cloud/service/outer/impl/DataExplainApiServiceImpl.java
+19
-0
IndexApiServiceImpl.java
...com/gic/cloud/service/outer/impl/IndexApiServiceImpl.java
+33
-1
TabIndexModuleRelMapper.xml
...ice/src/main/resources/mapper/TabIndexModuleRelMapper.xml
+15
-3
No files found.
gic-data-cloud-api/src/main/java/com/gic/cloud/service/DataExplainApiService.java
View file @
f56b60e8
...
...
@@ -50,4 +50,24 @@ public interface DataExplainApiService {
* @throws
*/
ServiceResponse
<
Page
<
DataExplainDTO
>>
listDataExplain
(
DataExplainQO
dataExplainQO
);
/**
* @Title: delete
* @Description:
* @author zhiwj
* @param dataExplainId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse
<
Void
>
delete
(
Integer
dataExplainId
);
/**
* @Title: publish
* @Description:
* @author zhiwj
* @param dataExplainId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse
<
Void
>
publish
(
Integer
dataExplainId
);
}
gic-data-cloud-api/src/main/java/com/gic/cloud/service/IndexApiService.java
View file @
f56b60e8
...
...
@@ -50,4 +50,25 @@ public interface IndexApiService {
* @throws
*/
ServiceResponse
<
Page
<
IndexDTO
>>
listIndex
(
IndexQO
indexQO
);
/**
* @Title: delete
* @Description:
* @author zhiwj
* @param indexId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse
<
Void
>
delete
(
Integer
indexId
);
/**
* 发布指标
* @Title: publish
* @Description:
* @author zhiwj
* @param indexId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse
<
Void
>
publish
(
Integer
indexId
);
}
gic-data-cloud-operation-web/src/main/java/com/gic/cloud/operation/web/controller/DataExplainController.java
View file @
f56b60e8
...
...
@@ -63,4 +63,16 @@ public class DataExplainController {
return
ResultControllerUtils
.
commonResult
(
serviceResponse
);
}
@RequestMapping
(
"/deleteDataExplain"
)
public
RestResponse
delete
(
Integer
dataExplainId
)
{
ServiceResponse
<
Void
>
serviceResponse
=
dataExplainApiService
.
delete
(
dataExplainId
);
return
ResultControllerUtils
.
commonResult
(
serviceResponse
);
}
@RequestMapping
(
"/publishDataExplain"
)
public
RestResponse
publishIndex
(
Integer
dataExplainId
)
{
ServiceResponse
<
Void
>
serviceResponse
=
dataExplainApiService
.
publish
(
dataExplainId
);
return
ResultControllerUtils
.
commonResult
(
serviceResponse
);
}
}
\ No newline at end of file
gic-data-cloud-operation-web/src/main/java/com/gic/cloud/operation/web/controller/IndexController.java
View file @
f56b60e8
...
...
@@ -75,4 +75,15 @@ public class IndexController {
return
ResultControllerUtils
.
commonResult
(
serviceResponse
);
}
@RequestMapping
(
"/deleteIndex"
)
public
RestResponse
delete
(
Integer
indexId
)
{
ServiceResponse
<
Void
>
serviceResponse
=
indexApiService
.
delete
(
indexId
);
return
ResultControllerUtils
.
commonResult
(
serviceResponse
);
}
@RequestMapping
(
"/publishIndex"
)
public
RestResponse
publishIndex
(
Integer
indexId
)
{
ServiceResponse
<
Void
>
serviceResponse
=
indexApiService
.
publish
(
indexId
);
return
ResultControllerUtils
.
commonResult
(
serviceResponse
);
}
}
\ No newline at end of file
gic-data-cloud-service/src/main/java/com/gic/cloud/dao/mapper/TabIndexModuleRelMapper.java
View file @
f56b60e8
...
...
@@ -60,7 +60,9 @@ public interface TabIndexModuleRelMapper {
void
updateStatusByBusinessIds
(
@Param
(
"businessId"
)
Integer
businessId
,
@Param
(
"ids"
)
List
<
Integer
>
moduleIdList
,
@Param
(
"type"
)
Integer
type
);
List
<
Integer
>
listModuleIdBy
IndexId
(
@Param
(
"indexId"
)
Integer
indexId
);
List
<
Integer
>
listModuleIdBy
BusinessId
(
@Param
(
"businessId"
)
Integer
businessId
,
@Param
(
"type"
)
Integer
type
);
List
<
Integer
>
listIndexIdByModuleId
(
@Param
(
"moduleId"
)
Integer
moduleId
);
List
<
Integer
>
listBusinessIdByModuleId
(
@Param
(
"moduleId"
)
Integer
moduleId
);
List
<
TabIndexModuleRel
>
listModuleIdByBusinessIds
(
@Param
(
"ids"
)
List
<
Integer
>
businessIdList
,
@Param
(
"type"
)
Integer
type
);
}
\ No newline at end of file
gic-data-cloud-service/src/main/java/com/gic/cloud/service/DataExplainService.java
View file @
f56b60e8
...
...
@@ -25,4 +25,6 @@ public interface DataExplainService {
Page
<
TabDataExplain
>
listDataExplain
(
DataExplainQO
dataExplainQO
);
List
<
TabDataExplain
>
listAllDataExplain
();
void
deleteById
(
Integer
dataExplainId
);
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/IndexModuleRelService.java
View file @
f56b60e8
package
com
.
gic
.
cloud
.
service
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author zhiwj
...
...
@@ -10,7 +11,11 @@ import java.util.List;
public
interface
IndexModuleRelService
{
void
save
(
Integer
indexId
,
List
<
Integer
>
moduleId
,
Integer
type
);
List
<
Integer
>
listModuleIdBy
IndexId
(
Integer
indexId
);
List
<
Integer
>
listModuleIdBy
BusinessId
(
Integer
indexId
,
Integer
type
);
List
<
Integer
>
listIndexIdByModuleId
(
Integer
moduleId
);
List
<
Integer
>
listBusinessIdByModuleId
(
Integer
moduleId
);
void
deleteByBusinessId
(
Integer
businessId
,
Integer
type
);
Map
<
Integer
,
List
<
Integer
>>
groupModuleIdByBusinessIds
(
List
<
Integer
>
indexIdList
,
Integer
type
);
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/IndexService.java
View file @
f56b60e8
...
...
@@ -27,4 +27,6 @@ public interface IndexService {
Page
<
TabIndex
>
listIndex
(
IndexQO
indexQO
);
List
<
TabIndex
>
listAllIndex
();
void
deleteById
(
Integer
indexId
);
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/impl/DataExplainServiceImpl.java
View file @
f56b60e8
...
...
@@ -63,4 +63,12 @@ public class DataExplainServiceImpl implements DataExplainService {
public
List
<
TabDataExplain
>
listAllDataExplain
()
{
return
tabDataExplainMapper
.
listDataExplain
(
new
DataExplainQO
());
}
@Override
public
void
deleteById
(
Integer
dataExplainId
)
{
TabDataExplain
dataExplain
=
new
TabDataExplain
();
dataExplain
.
setDataExplainId
(
dataExplainId
);
dataExplain
.
setStatus
(
0
);
tabDataExplainMapper
.
updateByPrimaryKeySelective
(
dataExplain
);
}
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/impl/IndexModuleRelServiceImpl.java
View file @
f56b60e8
...
...
@@ -6,8 +6,8 @@ import com.gic.cloud.service.IndexModuleRelService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.
Date
;
import
java.util.
List
;
import
java.util.
*
;
import
java.util.
stream.Collectors
;
/**
* @author zhiwj
...
...
@@ -40,12 +40,25 @@ public class IndexModuleRelServiceImpl implements IndexModuleRelService {
}
@Override
public
List
<
Integer
>
listModuleIdBy
IndexId
(
Integer
indexId
)
{
return
tabIndexModuleRelMapper
.
listModuleIdBy
IndexId
(
indexId
);
public
List
<
Integer
>
listModuleIdBy
BusinessId
(
Integer
businessId
,
Integer
type
)
{
return
tabIndexModuleRelMapper
.
listModuleIdBy
BusinessId
(
businessId
,
type
);
}
@Override
public
List
<
Integer
>
listIndexIdByModuleId
(
Integer
moduleId
)
{
return
tabIndexModuleRelMapper
.
listIndexIdByModuleId
(
moduleId
);
public
List
<
Integer
>
listBusinessIdByModuleId
(
Integer
moduleId
)
{
return
tabIndexModuleRelMapper
.
listBusinessIdByModuleId
(
moduleId
);
}
@Override
public
void
deleteByBusinessId
(
Integer
businessId
,
Integer
type
)
{
tabIndexModuleRelMapper
.
delByBusinessId
(
businessId
,
type
);
}
@Override
public
Map
<
Integer
,
List
<
Integer
>>
groupModuleIdByBusinessIds
(
List
<
Integer
>
businessIdList
,
Integer
type
)
{
List
<
TabIndexModuleRel
>
relList
=
tabIndexModuleRelMapper
.
listModuleIdByBusinessIds
(
businessIdList
,
type
);
return
Optional
.
ofNullable
(
relList
).
orElse
(
Collections
.
emptyList
()).
stream
()
.
collect
(
Collectors
.
groupingBy
(
TabIndexModuleRel:
:
getBusinessId
,
Collectors
.
mapping
(
TabIndexModuleRel:
:
getIndexModuleRelId
,
Collectors
.
toList
())));
}
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/impl/IndexServiceImpl.java
View file @
f56b60e8
...
...
@@ -68,4 +68,12 @@ public class IndexServiceImpl implements IndexService {
public
List
<
TabIndex
>
listAllIndex
()
{
return
tabIndexMapper
.
listIndex
(
new
IndexQO
());
}
@Override
public
void
deleteById
(
Integer
indexId
)
{
TabIndex
index
=
new
TabIndex
();
index
.
setIndexId
(
indexId
);
index
.
setStatus
(
0
);
tabIndexMapper
.
updateByPrimaryKeySelective
(
index
);
}
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/outer/impl/DataExplainApiServiceImpl.java
View file @
f56b60e8
...
...
@@ -81,4 +81,23 @@ public class DataExplainApiServiceImpl implements DataExplainApiService {
Page
<
DataExplainDTO
>
dtoPage
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
listDataExplain
,
DataExplainDTO
.
class
);
return
EnterpriseServiceResponse
.
success
(
dtoPage
);
}
@Override
public
ServiceResponse
<
Void
>
delete
(
Integer
dataExplainId
)
{
TabDataExplain
dataExplain
=
this
.
dataExplainService
.
getByDataExplainId
(
dataExplainId
);
if
(
dataExplain
==
null
)
{
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"数据解读不存在或已删除"
);
}
if
(
dataExplain
.
getModuleId
()
==
null
)
{
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"不能删除被引用的指标"
);
}
this
.
dataExplainService
.
deleteById
(
dataExplainId
);
return
EnterpriseServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Void
>
publish
(
Integer
dataExplainId
)
{
this
.
updateTipService
.
publish
(
dataExplainId
,
LogAndUpdateTipsTypeEnum
.
DATA_EXPLAIN
.
getCode
());
return
EnterpriseServiceResponse
.
success
();
}
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/outer/impl/IndexApiServiceImpl.java
View file @
f56b60e8
...
...
@@ -12,10 +12,13 @@ import com.gic.commons.util.EntityUtil;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.response.EnterpriseServiceResponse
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author zhiwj
...
...
@@ -86,7 +89,7 @@ public class IndexApiServiceImpl implements IndexApiService {
public
ServiceResponse
<
IndexDTO
>
getByIndexId
(
Integer
indexId
)
{
TabIndex
index
=
this
.
indexService
.
getByIndexId
(
indexId
);
IndexDTO
indexDTO
=
EntityUtil
.
changeEntityByJSON
(
IndexDTO
.
class
,
index
);
List
<
Integer
>
moduleIdList
=
this
.
indexModuleRelService
.
listModuleIdBy
IndexId
(
indexDTO
.
getIndexId
());
List
<
Integer
>
moduleIdList
=
this
.
indexModuleRelService
.
listModuleIdBy
BusinessId
(
indexDTO
.
getIndexId
(),
LogAndUpdateTipsTypeEnum
.
INDEX
.
getCode
());
indexDTO
.
setRelModuleIdList
(
moduleIdList
);
return
EnterpriseServiceResponse
.
success
(
indexDTO
);
}
...
...
@@ -95,6 +98,35 @@ public class IndexApiServiceImpl implements IndexApiService {
public
ServiceResponse
<
Page
<
IndexDTO
>>
listIndex
(
IndexQO
indexQO
)
{
com
.
github
.
pagehelper
.
Page
<
TabIndex
>
indexList
=
indexService
.
listIndex
(
indexQO
);
Page
<
IndexDTO
>
indexDTOPage
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
indexList
,
IndexDTO
.
class
);
if
(
CollectionUtils
.
isNotEmpty
(
indexList
))
{
List
<
Integer
>
indexIdList
=
indexList
.
stream
().
map
(
TabIndex:
:
getIndexId
).
collect
(
Collectors
.
toList
());
Map
<
Integer
,
List
<
Integer
>>
moduleIdByBusinessIdMap
=
indexModuleRelService
.
groupModuleIdByBusinessIds
(
indexIdList
,
LogAndUpdateTipsTypeEnum
.
INDEX
.
getCode
());
List
<
IndexDTO
>
indexDTOList
=
indexDTOPage
.
getResult
();
for
(
IndexDTO
indexDTO
:
indexDTOList
)
{
indexDTO
.
setRelModuleIdList
(
moduleIdByBusinessIdMap
.
get
(
indexDTO
.
getIndexId
()));
}
}
return
EnterpriseServiceResponse
.
success
(
indexDTOPage
);
}
@Override
public
ServiceResponse
<
Void
>
delete
(
Integer
indexId
)
{
TabIndex
index
=
this
.
indexService
.
getByIndexId
(
indexId
);
if
(
index
==
null
)
{
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"指标不存在或已删除"
);
}
List
<
Integer
>
moduleIdList
=
indexModuleRelService
.
listModuleIdByBusinessId
(
indexId
,
LogAndUpdateTipsTypeEnum
.
INDEX
.
getCode
());
if
(
CollectionUtils
.
isNotEmpty
(
moduleIdList
))
{
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"不能删除被引用的指标"
);
}
this
.
indexService
.
deleteById
(
indexId
);
this
.
indexModuleRelService
.
deleteByBusinessId
(
indexId
,
LogAndUpdateTipsTypeEnum
.
INDEX
.
getCode
());
return
EnterpriseServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Void
>
publish
(
Integer
indexId
)
{
this
.
updateTipService
.
publish
(
indexId
,
LogAndUpdateTipsTypeEnum
.
INDEX
.
getCode
());
return
EnterpriseServiceResponse
.
success
();
}
}
gic-data-cloud-service/src/main/resources/mapper/TabIndexModuleRelMapper.xml
View file @
f56b60e8
...
...
@@ -156,16 +156,27 @@
</foreach>
</if>
</update>
<select
id=
"listModuleIdBy
Index
Id"
resultType=
"int"
>
<select
id=
"listModuleIdBy
Business
Id"
resultType=
"int"
>
select
module_id
from tab_index_module_rel
where status = 1 and index_id = #{
indexId
}
where status = 1 and index_id = #{
businessId} and type = #{type
}
</select>
<select
id=
"list
Index
IdByModuleId"
resultType=
"int"
>
<select
id=
"list
Business
IdByModuleId"
resultType=
"int"
>
select
module_id
from tab_index_module_rel
where status = 1 and module_id = #{moduleId}
</select>
<select
id=
"listModuleIdByBusinessIds"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_index_module_rel where status = 1 and type = #{type}
<if
test=
"null != ids and ids.size > 0"
>
and business_id in
<foreach
collection=
"ids"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
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