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
af7d3fde
Commit
af7d3fde
authored
May 14, 2021
by
linruibiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口编写
parent
0cf33171
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
11 deletions
+52
-11
InstrumentPanelConfigServiceImpl.java
.../slmbi/service/impl/InstrumentPanelConfigServiceImpl.java
+50
-11
InstrumentPanelServiceImpl.java
...yc/slm/slmbi/service/impl/InstrumentPanelServiceImpl.java
+2
-0
No files found.
src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelConfigServiceImpl.java
View file @
af7d3fde
...
...
@@ -14,6 +14,7 @@ import com.syc.slm.slmbi.entity.*;
import
com.syc.slm.slmbi.enums.PublishedStatus
;
import
com.syc.slm.slmbi.exception.SysException
;
import
com.syc.slm.slmbi.service.*
;
import
com.syc.slm.slmbi.vo.CustomPermissionVo
;
import
com.syc.slm.slmbi.vo.InstrumentPanelConfigVo
;
import
com.syc.slm.slmbi.vo.InstrumentPanelVo
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -22,7 +23,6 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.yaml.snakeyaml.events.Event
;
import
javax.validation.constraints.NotNull
;
import
java.net.URLDecoder
;
...
...
@@ -30,7 +30,6 @@ import java.net.URLEncoder;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -69,10 +68,48 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane
@Override
@Transactional
(
readOnly
=
true
)
public
InstrumentPanelConfigVo
getConfigByPanelId
(
String
instrumentPanelId
)
{
InstrumentPanelDraft
draft
=
draftService
.
getByPanelId
(
instrumentPanelId
);
return
getInstrumentPanelConfigVo
(
instrumentPanelId
,
ObjectUtils
.
isNotEmpty
(
draft
)
?
PublishedStatus
.
PUBLISHED
:
PublishedStatus
.
WAIT_PUBLISHED
);
LambdaQueryWrapper
<
InstrumentPanelConfig
>
where
=
new
LambdaQueryWrapper
<>();
where
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
where
.
eq
(
InstrumentPanelConfig:
:
getPanelId
,
instrumentPanelId
);
where
.
eq
(
InstrumentPanelConfig:
:
getPublished
,
PublishedStatus
.
WAIT_PUBLISHED
.
value
);
InstrumentPanelConfig
config
=
baseMapper
.
selectOne
(
where
);
String
status
=
PublishedStatus
.
WAIT_PUBLISHED
.
value
;
if
(
ObjectUtils
.
isEmpty
(
config
)){
status
=
PublishedStatus
.
PUBLISHED
.
value
;
where
=
new
LambdaQueryWrapper
<>();
where
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
where
.
eq
(
InstrumentPanelConfig:
:
getPanelId
,
instrumentPanelId
);
where
.
eq
(
InstrumentPanelConfig:
:
getPublished
,
PublishedStatus
.
PUBLISHED
.
value
);
config
=
baseMapper
.
selectOne
(
where
);
}
InstrumentPanelConfigVo
vo
=
new
InstrumentPanelConfigVo
();
BeanUtils
.
copyProperties
(
config
,
vo
);
if
(
StringUtils
.
isNotEmpty
(
vo
.
getConfigDetails
()))
{
if
(
ObjectUtils
.
isNotEmpty
(
vo
))
{
try
{
vo
.
setConfigDetails
(
URLDecoder
.
decode
(
vo
.
getConfigDetails
(),
StandardCharsets
.
UTF_8
.
name
()));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
SysException
(
"仪表板配置详情解密异常"
);
}
}
}
List
<
CustomPermissionVo
>
permission
=
permissionService
.
getPublishPermissionByPanelId
(
instrumentPanelId
,
PublishedStatus
.
WAIT_PUBLISHED
.
value
);
if
(
ObjectUtils
.
isEmpty
(
permission
)){
permission
=
permissionService
.
getPublishPermissionByPanelId
(
instrumentPanelId
,
PublishedStatus
.
PUBLISHED
.
value
);
}
vo
.
setPermissions
(
permission
);
InstrumentPanel
panel
=
panelService
.
getById
(
instrumentPanelId
);
InstrumentPanelVo
panelVo
=
new
InstrumentPanelVo
();
BeanUtils
.
copyProperties
(
panel
,
panelVo
);
vo
.
setPanelId
(
instrumentPanelId
);
panelVo
.
setGroupName
(
panelGroupService
.
getById
(
panel
.
getGroupId
()).
getName
());
vo
.
setPanel
(
panelVo
);
return
vo
;
}
@Override
...
...
@@ -193,11 +230,13 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane
panelConfig
.
setId
(
IdWorker
.
get32UUID
());
panelConfig
.
setPanelId
(
panelId
);
panelConfig
.
setPublished
(
publishStatus
);
try
{
panelConfig
.
setConfigDetails
(
URLEncoder
.
encode
(
configDetails
,
StandardCharsets
.
UTF_8
.
name
()));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
SysException
(
"仪表板配置详情加密异常"
);
if
(
StringUtils
.
isNotEmpty
(
configDetails
))
{
try
{
panelConfig
.
setConfigDetails
(
URLEncoder
.
encode
(
configDetails
,
StandardCharsets
.
UTF_8
.
name
()));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
SysException
(
"仪表板配置详情加密异常"
);
}
}
baseMapper
.
insert
(
panelConfig
);
}
...
...
src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelServiceImpl.java
View file @
af7d3fde
...
...
@@ -272,6 +272,8 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
log
.
info
(
"保存仪表板配置"
);
if
(
StringUtils
.
isNotEmpty
(
panel
.
getConfigDetails
()))
{
configService
.
savePanelConfig
(
panelId
,
panel
.
getConfigDetails
(),
PublishedStatus
.
WAIT_PUBLISHED
.
value
);
}
else
{
configService
.
savePanelConfig
(
panelId
,
panel
.
getConfigDetails
(),
PublishedStatus
.
WAIT_PUBLISHED
.
value
);
}
log
.
info
(
"初始化仪表板树"
);
...
...
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