Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-bi
Project
Project
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
林锐标
slm-bi
Commits
20337d30
Commit
20337d30
authored
Jun 04, 2021
by
linruibiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口编写
parent
e666515e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
27 deletions
+48
-27
InstrumentPanelInitServiceImpl.java
...lm/slmbi/service/impl/InstrumentPanelInitServiceImpl.java
+48
-27
No files found.
src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelInitServiceImpl.java
View file @
20337d30
...
...
@@ -4,19 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.toolkit.ObjectUtils
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.google.gson.reflect.TypeToken
;
import
com.syc.slm.common.core.constant.SlmConstants
;
import
com.syc.slm.slmbi.dao.InstrumentPanelMapper
;
import
com.syc.slm.slmbi.dto.*
;
import
com.syc.slm.slmbi.entity.BaseEntity
;
import
com.syc.slm.slmbi.entity.CurrentUser
;
import
com.syc.slm.slmbi.entity.InstrumentPanel
;
import
com.syc.slm.slmbi.entity.InstrumentPanelGroup
;
import
com.syc.slm.slmbi.entity.*
;
import
com.syc.slm.slmbi.enums.AccessType
;
import
com.syc.slm.slmbi.service.InstrumentPanelConfigService
;
import
com.syc.slm.slmbi.service.InstrumentPanelGroupService
;
import
com.syc.slm.slmbi.service.InstrumentPanelInitService
;
import
com.syc.slm.slmbi.service.InstrumentPanelService
;
import
com.syc.slm.slmbi.exception.SysException
;
import
com.syc.slm.slmbi.service.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -24,8 +18,9 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.servlet.http.HttpServletRequest
;
import
java.net.URLDecoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
import
java.util.Map
;
/**
* slm-bi
...
...
@@ -40,15 +35,18 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM
implements
InstrumentPanelInitService
{
@Value
(
"${initGroupName}"
)
@Value
(
"${initGroupName
:默认模板
}"
)
private
String
initGroupName
;
@Value
(
"${initPanelName1}"
)
@Value
(
"${initPanelName1:业务情况综合看板}"
)
private
String
initPanelName1
;
@Value
(
"${initPanelName2}"
)
@Value
(
"${initPanelName2:售后服务综合看板}"
)
private
String
initPanelName2
;
@Value
(
"${initConfig1}"
)
private
String
initConfig1
;
@Value
(
"${initConfig2}"
)
@Value
(
"${initConfigId1:82752b5ba8b2bd379c771a72c83f4b3a}"
)
private
String
initConfig1
;
@Value
(
"${initConfigId2:29727c771a6fcb492d206a9e811e585d}"
)
private
String
initConfig2
;
...
...
@@ -61,6 +59,10 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM
private
InstrumentPanelGroupService
panelGroupService
;
@Autowired
private
InstrumentPanelService
panelService
;
@Autowired
private
InstrumentPanelTreeService
treeService
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -93,7 +95,15 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM
where1
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
InstrumentPanel
panel
=
baseMapper
.
selectOne
(
where1
);
if
(
ObjectUtils
.
isEmpty
(
panel
)){
configService
.
publish
(
appId
,
setConfig
(
one
,
appId
,
initPanelName2
,
initConfig2
));
InstrumentPanelConfig
panelConfig
=
configService
.
getById
(
initConfig1
);
String
config
=
null
;
try
{
config
=
URLDecoder
.
decode
(
panelConfig
.
getConfigDetails
(),
StandardCharsets
.
UTF_8
.
name
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
SysException
(
"仪表板配置详情解密异常"
);
}
configService
.
publish
(
appId
,
setConfig
(
one
,
appId
,
initPanelName1
,
config
));
}
...
...
@@ -104,7 +114,15 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM
where2
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
InstrumentPanel
panel2
=
baseMapper
.
selectOne
(
where2
);
if
(
ObjectUtils
.
isEmpty
(
panel2
)){
configService
.
publish
(
appId
,
setConfig
(
one
,
appId
,
initPanelName2
,
initConfig2
));
InstrumentPanelConfig
panelConfig
=
configService
.
getById
(
initConfig2
);
String
config
=
null
;
try
{
config
=
URLDecoder
.
decode
(
panelConfig
.
getConfigDetails
(),
StandardCharsets
.
UTF_8
.
name
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
SysException
(
"仪表板配置详情解密异常"
);
}
configService
.
publish
(
appId
,
setConfig
(
one
,
appId
,
initPanelName2
,
config
));
}
return
null
;
...
...
@@ -117,16 +135,19 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM
String
panelId
=
panelService
.
savePanel
(
appId
,
panelDto
);
InstrumentPanel
instrumentPanel
=
baseMapper
.
selectById
(
panelId
);
InstrumentPanelConfigDTO
config
=
new
InstrumentPanelConfigDTO
();
Map
<
String
,
Object
>
map
=
SlmConstants
.
gson
.
fromJson
(
panelConfig
,
new
TypeToken
<
Map
<
String
,
Object
>>(){}.
getType
());
List
<
Object
>
controlList
=
(
List
<
Object
>)
map
.
get
(
"ControlList"
);
List
<
InstrumentPanelAssemblyDTO
>
assemblys
=
Lists
.
newArrayList
();
for
(
int
i
=
0
;
i
<
controlList
.
size
();
i
++)
{
Map
<
String
,
Object
>
controlMap
=
SlmConstants
.
gson
.
fromJson
(
SlmConstants
.
gson
.
toJson
(
controlList
.
get
(
i
)),
new
TypeToken
<
Map
<
String
,
Object
>>(){}.
getType
());
Map
<
String
,
String
>
propertyList
=
SlmConstants
.
gson
.
fromJson
(
SlmConstants
.
gson
.
toJson
(
controlMap
.
get
(
"PropertyList"
)),
new
TypeToken
<
Map
<
String
,
String
>>(){}.
getType
());
InstrumentPanelAssemblyDTO
instrumentPanelAssemblyDTO
=
new
InstrumentPanelAssemblyDTO
();
instrumentPanelAssemblyDTO
.
setKey
(
i
+
""
);
instrumentPanelAssemblyDTO
.
setName
(
propertyList
.
get
(
"ComName"
));
}
InstrumentPanelTree
tree
=
treeService
.
getById
(
panelId
);
LambdaQueryWrapper
<
InstrumentPanelTree
>
where
=
new
LambdaQueryWrapper
<>();
where
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
where
.
likeRight
(
InstrumentPanelTree:
:
getFullId
,
tree
.
getFullId
()
+
"."
);
where
.
orderByAsc
(
InstrumentPanelTree:
:
getAssemblyKey
);
List
<
InstrumentPanelTree
>
panelTrees
=
treeService
.
list
(
where
);
panelTrees
.
forEach
(
x
->{
InstrumentPanelAssemblyDTO
dto
=
new
InstrumentPanelAssemblyDTO
();
dto
.
setName
(
x
.
getName
());
dto
.
setKey
(
x
.
getAssemblyKey
());
assemblys
.
add
(
dto
);
});
config
.
setAssemblys
(
assemblys
);
config
.
setConfigDetails
(
panelConfig
);
config
.
setPanelId
(
instrumentPanel
.
getId
());
...
...
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