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
3e648009
Commit
3e648009
authored
Jun 04, 2021
by
linruibiao
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelInitServiceImpl.java
parents
8cc93b56
13963b70
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
19 deletions
+57
-19
DataCenterConfig.java
src/main/java/com/syc/slm/slmbi/config/DataCenterConfig.java
+11
-0
InitController.java
...ain/java/com/syc/slm/slmbi/controller/InitController.java
+3
-7
TenantController.java
...n/java/com/syc/slm/slmbi/controller/TenantController.java
+1
-1
InstrumentPanelInitService.java
...com/syc/slm/slmbi/service/InstrumentPanelInitService.java
+3
-1
InstrumentPanelInitServiceImpl.java
...lm/slmbi/service/impl/InstrumentPanelInitServiceImpl.java
+39
-10
No files found.
src/main/java/com/syc/slm/slmbi/config/DataCenterConfig.java
View file @
3e648009
...
@@ -23,12 +23,16 @@ public class DataCenterConfig {
...
@@ -23,12 +23,16 @@ public class DataCenterConfig {
@Value
(
"${dc_client.interfaces.positionListUrl}"
)
@Value
(
"${dc_client.interfaces.positionListUrl}"
)
private
String
positionListUrl
;
private
String
positionListUrl
;
@Value
(
"${dc_client.interfaces.deptListUrl}"
)
@Value
(
"${dc_client.interfaces.deptListUrl}"
)
private
String
deptListUrl
;
private
String
deptListUrl
;
@Value
(
"${dc_client.interfaces.userTree}"
)
@Value
(
"${dc_client.interfaces.userTree}"
)
private
String
userTree
;
private
String
userTree
;
@Value
(
"${dc_client.interfaces.variableList}"
)
@Value
(
"${dc_client.interfaces.variableList}"
)
private
String
variableList
;
private
String
variableList
;
@Value
(
"${dc_client.interfaces.deviceList}"
)
@Value
(
"${dc_client.interfaces.deviceList}"
)
private
String
deviceList
;
private
String
deviceList
;
...
@@ -43,12 +47,16 @@ public class DataCenterConfig {
...
@@ -43,12 +47,16 @@ public class DataCenterConfig {
@Value
(
"${dc_client.interfaces.variableCodeHistoryList}"
)
@Value
(
"${dc_client.interfaces.variableCodeHistoryList}"
)
private
String
variableHistoryDataList
;
private
String
variableHistoryDataList
;
@Value
(
"${dc_client.interfaces.variableAllDataList}"
)
@Value
(
"${dc_client.interfaces.variableAllDataList}"
)
private
String
variableRealTimeDataList
;
private
String
variableRealTimeDataList
;
@Value
(
"${dc_client.interfaces.filedValue}"
)
@Value
(
"${dc_client.interfaces.filedValue}"
)
private
String
filedValue
;
private
String
filedValue
;
@Value
(
"${dc_client.interfaces.send}"
)
@Value
(
"${dc_client.interfaces.send}"
)
private
String
send
;
private
String
send
;
@Value
(
"${dc_client.interfaces.variableStatus}"
)
@Value
(
"${dc_client.interfaces.variableStatus}"
)
private
String
variableStatus
;
private
String
variableStatus
;
...
@@ -61,4 +69,7 @@ public class DataCenterConfig {
...
@@ -61,4 +69,7 @@ public class DataCenterConfig {
@Value
(
"${dc_client.interfaces.variableStatusRealTimeDataList}"
)
@Value
(
"${dc_client.interfaces.variableStatusRealTimeDataList}"
)
private
String
variableStatusRealTimeDataList
;
private
String
variableStatusRealTimeDataList
;
@Value
(
"${dc_client.interfaces.systemAdminByAppId}"
)
private
String
systemAdminByAppId
;
}
}
src/main/java/com/syc/slm/slmbi/controller/InitController.java
View file @
3e648009
...
@@ -34,8 +34,7 @@ public class InitController extends BaseRestController{
...
@@ -34,8 +34,7 @@ public class InitController extends BaseRestController{
@Autowired
@Autowired
private
InstrumentPanelInitService
panelInitService
;
private
InstrumentPanelInitService
panelInitService
;
@Autowired
private
InstrumentPanelGroupService
groupService
;
@GetMapping
(
"/app-id"
)
@GetMapping
(
"/app-id"
)
@ApiOperation
(
"测试"
)
@ApiOperation
(
"测试"
)
...
@@ -57,11 +56,8 @@ public class InitController extends BaseRestController{
...
@@ -57,11 +56,8 @@ public class InitController extends BaseRestController{
public
R
<
Object
>
initPanel
(
HttpServletRequest
request
,
@PathVariable
String
appId
)
{
public
R
<
Object
>
initPanel
(
HttpServletRequest
request
,
@PathVariable
String
appId
)
{
return
call
(()->{
return
call
(()->{
CurrentUser
currentUser
=
getCurrentUser
(
request
);
CurrentUser
currentUser
=
getCurrentUser
(
request
);
LambdaQueryWrapper
<
InstrumentPanelGroup
>
where
=
new
LambdaQueryWrapper
<>();
panelInitService
.
initBatchPanel
(
currentUser
.
getToken
(),
request
,
appId
);
where
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
where
.
eq
(
InstrumentPanelGroup:
:
getName
,
"全部分组"
);
List
<
InstrumentPanelGroup
>
list
=
groupService
.
list
(
where
);
list
.
forEach
(
x
->
panelInitService
.
initOnePanel
(
x
.
getAppId
(),
currentUser
.
getToken
(),
request
));
});
});
}
}
}
}
src/main/java/com/syc/slm/slmbi/controller/TenantController.java
View file @
3e648009
...
@@ -49,7 +49,7 @@ public class TenantController extends BaseRestController{
...
@@ -49,7 +49,7 @@ public class TenantController extends BaseRestController{
groupDTO
.
setParentId
(
null
);
groupDTO
.
setParentId
(
null
);
groupDTO
.
setName
(
"全部分组"
);
groupDTO
.
setName
(
"全部分组"
);
groupService
.
saveGroup
(
groupDTO
,
appId
);
groupService
.
saveGroup
(
groupDTO
,
appId
);
panelInitService
.
initOnePanel
(
appId
,
currentUser
.
getToken
(),
request
);
panelInitService
.
initOnePanel
(
appId
,
currentUser
.
getToken
(),
request
,
appId
);
});
});
}
}
...
...
src/main/java/com/syc/slm/slmbi/service/InstrumentPanelInitService.java
View file @
3e648009
...
@@ -14,5 +14,7 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -14,5 +14,7 @@ import javax.servlet.http.HttpServletRequest;
**/
**/
public
interface
InstrumentPanelInitService
extends
IService
<
InstrumentPanel
>
{
public
interface
InstrumentPanelInitService
extends
IService
<
InstrumentPanel
>
{
String
initOnePanel
(
String
appId
,
String
token
,
HttpServletRequest
request
);
String
initOnePanel
(
String
queryAppId
,
String
token
,
HttpServletRequest
request
,
String
appId
);
String
initBatchPanel
(
String
token
,
HttpServletRequest
request
,
String
appId
);
}
}
src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelInitServiceImpl.java
View file @
3e648009
...
@@ -4,13 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -4,13 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.toolkit.ObjectUtils
;
import
com.baomidou.mybatisplus.core.toolkit.ObjectUtils
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.gson.reflect.TypeToken
;
import
com.syc.slm.common.core.constant.SlmConstants
;
import
com.syc.slm.common.core.constant.SlmConstants
;
import
com.syc.slm.common.core.util.R
;
import
com.syc.slm.common.core.util.RestTemplateUtils
;
import
com.syc.slm.slmbi.config.DataCenterConfig
;
import
com.syc.slm.slmbi.dao.InstrumentPanelMapper
;
import
com.syc.slm.slmbi.dao.InstrumentPanelMapper
;
import
com.syc.slm.slmbi.dto.*
;
import
com.syc.slm.slmbi.dto.*
;
import
com.syc.slm.slmbi.entity.*
;
import
com.syc.slm.slmbi.entity.*
;
import
com.syc.slm.slmbi.enums.AccessType
;
import
com.syc.slm.slmbi.enums.AccessType
;
import
com.syc.slm.slmbi.exception.SysException
;
import
com.syc.slm.slmbi.exception.SysException
;
import
com.syc.slm.slmbi.service.*
;
import
com.syc.slm.slmbi.service.*
;
import
com.syc.slm.slmbi.vo.UserTreeVo
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -21,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -21,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
import
java.net.URLDecoder
;
import
java.net.URLDecoder
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* slm-bi
* slm-bi
...
@@ -34,7 +41,6 @@ import java.util.List;
...
@@ -34,7 +41,6 @@ import java.util.List;
public
class
InstrumentPanelInitServiceImpl
extends
ServiceImpl
<
InstrumentPanelMapper
,
InstrumentPanel
>
public
class
InstrumentPanelInitServiceImpl
extends
ServiceImpl
<
InstrumentPanelMapper
,
InstrumentPanel
>
implements
InstrumentPanelInitService
{
implements
InstrumentPanelInitService
{
@Value
(
"${initGroupName:默认模板}"
)
@Value
(
"${initGroupName:默认模板}"
)
private
String
initGroupName
;
private
String
initGroupName
;
...
@@ -43,48 +49,62 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM
...
@@ -43,48 +49,62 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM
@Value
(
"${initPanelName2:售后服务综合看板}"
)
@Value
(
"${initPanelName2:售后服务综合看板}"
)
private
String
initPanelName2
;
private
String
initPanelName2
;
@Value
(
"${initConfigId1:82752b5ba8b2bd379c771a72c83f4b3a}"
)
@Value
(
"${initConfigId1:82752b5ba8b2bd379c771a72c83f4b3a}"
)
private
String
initConfig1
;
private
String
initConfig1
;
@Value
(
"${initConfigId2:29727c771a6fcb492d206a9e811e585d}"
)
@Value
(
"${initConfigId2:29727c771a6fcb492d206a9e811e585d}"
)
private
String
initConfig2
;
private
String
initConfig2
;
@Autowired
@Autowired
private
InstrumentPanelConfigService
configService
;
private
InstrumentPanelConfigService
configService
;
@Autowired
@Autowired
private
InstrumentPanelGroupService
panelGroupService
;
private
InstrumentPanelGroupService
panelGroupService
;
@Autowired
@Autowired
private
InstrumentPanelService
panelService
;
private
InstrumentPanelService
panelService
;
@Autowired
@Autowired
private
InstrumentPanelTreeService
treeService
;
private
InstrumentPanelTreeService
treeService
;
@Autowired
private
DataCenterConfig
dataCenterConfig
;
@Autowired
private
InstrumentPanelGroupService
groupService
;
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
initOnePanel
(
String
appId
,
String
token
,
HttpServletRequest
request
)
{
public
String
initBatchPanel
(
String
token
,
HttpServletRequest
request
,
String
appId
)
{
CurrentUser
currentUser
=
new
CurrentUser
();
LambdaQueryWrapper
<
InstrumentPanelGroup
>
where
=
new
LambdaQueryWrapper
<>();
where
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
where
.
eq
(
InstrumentPanelGroup:
:
getName
,
"全部分组"
);
List
<
InstrumentPanelGroup
>
list
=
groupService
.
list
(
where
);
list
.
forEach
(
x
->
this
.
initOnePanel
(
x
.
getAppId
(),
token
,
request
,
appId
));
return
"true"
;
}
request
.
setAttribute
(
token
,
SlmConstants
.
gson
.
toJson
(
currentUser
));
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
initOnePanel
(
String
queryAppId
,
String
token
,
HttpServletRequest
request
,
String
appId
)
{
// 初始化request域
this
.
setRequestAttribute
(
token
,
queryAppId
,
appId
,
request
);
LambdaQueryWrapper
<
InstrumentPanelGroup
>
groupWhere
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
InstrumentPanelGroup
>
groupWhere
=
new
LambdaQueryWrapper
<>();
groupWhere
.
eq
(
InstrumentPanelGroup:
:
getName
,
initGroupName
);
groupWhere
.
eq
(
InstrumentPanelGroup:
:
getName
,
initGroupName
);
groupWhere
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
groupWhere
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
groupWhere
.
eq
(
BaseEntity:
:
getAppId
,
a
ppId
);
groupWhere
.
eq
(
BaseEntity:
:
getAppId
,
queryA
ppId
);
InstrumentPanelGroup
one
=
panelGroupService
.
getOne
(
groupWhere
);
InstrumentPanelGroup
one
=
panelGroupService
.
getOne
(
groupWhere
);
if
(
ObjectUtils
.
isEmpty
(
one
)){
if
(
ObjectUtils
.
isEmpty
(
one
)){
LambdaQueryWrapper
<
InstrumentPanelGroup
>
where
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
InstrumentPanelGroup
>
where
=
new
LambdaQueryWrapper
<>();
where
.
eq
(
InstrumentPanelGroup:
:
getName
,
"全部分组"
);
where
.
eq
(
InstrumentPanelGroup:
:
getName
,
"全部分组"
);
where
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
where
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
where
.
eq
(
BaseEntity:
:
getAppId
,
a
ppId
);
where
.
eq
(
BaseEntity:
:
getAppId
,
queryA
ppId
);
InstrumentPanelGroup
allGroup
=
panelGroupService
.
getOne
(
where
);
InstrumentPanelGroup
allGroup
=
panelGroupService
.
getOne
(
where
);
InstrumentPanelGroupDTO
cGroup
=
new
InstrumentPanelGroupDTO
();
InstrumentPanelGroupDTO
cGroup
=
new
InstrumentPanelGroupDTO
();
cGroup
.
setParentId
(
allGroup
.
getId
());
cGroup
.
setParentId
(
allGroup
.
getId
());
cGroup
.
setName
(
"默认模板"
);
cGroup
.
setName
(
"默认模板"
);
String
groupId
=
panelGroupService
.
saveGroup
(
cGroup
,
a
ppId
);
String
groupId
=
panelGroupService
.
saveGroup
(
cGroup
,
queryA
ppId
);
one
=
panelGroupService
.
getById
(
groupId
);
one
=
panelGroupService
.
getById
(
groupId
);
}
}
...
@@ -145,4 +165,13 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM
...
@@ -145,4 +165,13 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM
config
.
setPermission
(
permission
);
config
.
setPermission
(
permission
);
return
config
;
return
config
;
}
}
private
void
setRequestAttribute
(
String
token
,
String
queryAppId
,
String
appId
,
HttpServletRequest
request
){
Map
<
String
,
String
>
uriVariables
=
Maps
.
newHashMap
();
uriVariables
.
put
(
"queryAppId"
,
queryAppId
);
uriVariables
.
put
(
"appId"
,
appId
);
String
uri
=
dataCenterConfig
.
getDcClientHost
()
+
dataCenterConfig
.
getSystemAdminByAppId
();
R
<
CurrentUser
>
result
=
RestTemplateUtils
.
get
(
uri
,
new
TypeToken
<
R
<
CurrentUser
>>()
{}.
getType
(),
uriVariables
);
request
.
setAttribute
(
token
,
SlmConstants
.
gson
.
toJson
(
result
.
detach
()));
}
}
}
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