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
ddd09f71
Commit
ddd09f71
authored
Apr 12, 2021
by
linruibiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口编写
parent
d1be6cdc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
182 additions
and
82 deletions
+182
-82
NetResponseUtils.java
...n/java/com/syc/slm/common/core/util/NetResponseUtils.java
+9
-4
R.java
src/main/java/com/syc/slm/common/core/util/R.java
+20
-1
SysMetaObjectHandler.java
...n/java/com/syc/slm/slmbi/config/SysMetaObjectHandler.java
+4
-1
BaseRestController.java
...java/com/syc/slm/slmbi/controller/BaseRestController.java
+14
-0
InstrumentPanelConfigController.java
...slm/slmbi/controller/InstrumentPanelConfigController.java
+1
-1
InstrumentPanelController.java
...m/syc/slm/slmbi/controller/InstrumentPanelController.java
+1
-1
InstrumentPanelGroupController.java
.../slm/slmbi/controller/InstrumentPanelGroupController.java
+1
-1
InstrumentPanelPermissionController.java
...slmbi/controller/InstrumentPanelPermissionController.java
+2
-2
InstrumentPanelTreeController.java
...c/slm/slmbi/controller/InstrumentPanelTreeController.java
+14
-2
BaseEntity.java
src/main/java/com/syc/slm/slmbi/entity/BaseEntity.java
+10
-10
InstrumentPanel.java
src/main/java/com/syc/slm/slmbi/entity/InstrumentPanel.java
+3
-5
InstrumentPanelConfig.java
.../java/com/syc/slm/slmbi/entity/InstrumentPanelConfig.java
+1
-1
InstrumentPanelDraft.java
...n/java/com/syc/slm/slmbi/entity/InstrumentPanelDraft.java
+0
-1
InstrumentPanelPermission.java
...a/com/syc/slm/slmbi/entity/InstrumentPanelPermission.java
+1
-2
PublishedStatus.java
src/main/java/com/syc/slm/slmbi/enums/PublishedStatus.java
+6
-6
InstrumentPanelConfigService.java
...m/syc/slm/slmbi/service/InstrumentPanelConfigService.java
+11
-4
InstrumentPanelPermissionService.java
...c/slm/slmbi/service/InstrumentPanelPermissionService.java
+6
-4
InstrumentPanelService.java
...ava/com/syc/slm/slmbi/service/InstrumentPanelService.java
+1
-1
InstrumentPanelTreeService.java
...com/syc/slm/slmbi/service/InstrumentPanelTreeService.java
+10
-0
InstrumentPanelConfigServiceImpl.java
.../slmbi/service/impl/InstrumentPanelConfigServiceImpl.java
+0
-0
InstrumentPanelDraftServiceImpl.java
...m/slmbi/service/impl/InstrumentPanelDraftServiceImpl.java
+1
-5
InstrumentPanelGroupServiceImpl.java
...m/slmbi/service/impl/InstrumentPanelGroupServiceImpl.java
+3
-0
InstrumentPanelPermissionImpl.java
...slm/slmbi/service/impl/InstrumentPanelPermissionImpl.java
+12
-6
InstrumentPanelServiceImpl.java
...yc/slm/slmbi/service/impl/InstrumentPanelServiceImpl.java
+9
-3
InstrumentPanelTreeServiceImpl.java
...lm/slmbi/service/impl/InstrumentPanelTreeServiceImpl.java
+40
-21
InstrumentPanelPermissionVo.java
...ava/com/syc/slm/slmbi/vo/InstrumentPanelPermissionVo.java
+2
-0
No files found.
src/main/java/com/syc/slm/common/core/util/NetResponseUtils.java
View file @
ddd09f71
package
com
.
syc
.
slm
.
common
.
core
.
util
;
import
com.syc.slm.common.core.constant.SlmConstants
;
import
com.syc.slm.slmbi.exception.SysException
;
import
com.syc.slm.slmbi.function.Action0
;
...
...
@@ -18,11 +19,11 @@ public final class NetResponseUtils {
return
R
.
ok
(
x
.
get
());
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
if
(
(
ex
.
getCause
()
instanceof
SysException
)
)
{
SysException
e
=
(
SysException
)
ex
.
getCause
()
;
if
(
ex
instanceof
SysException
)
{
SysException
e
=
(
SysException
)
ex
;
return
R
.
failed
(
e
.
getMsg
());
}
return
R
.
failed
(
ex
.
getMessage
());
return
R
.
failed
(
"出错啦请联系管理员"
,
ex
.
toString
());
}
}
...
...
@@ -32,7 +33,11 @@ public final class NetResponseUtils {
return
R
.
ok
();
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
return
R
.
failed
(
ex
.
getMessage
());
if
(
ex
instanceof
SysException
)
{
SysException
e
=
(
SysException
)
ex
;
return
R
.
failed
(
e
.
getMsg
());
}
return
R
.
bad
(
"出错啦请联系管理员"
,
ex
.
toString
());
}
}
}
src/main/java/com/syc/slm/common/core/util/R.java
View file @
ddd09f71
...
...
@@ -53,6 +53,11 @@ public class R<T> implements Serializable {
@ApiModelProperty
(
value
=
"返回信息"
)
private
String
msg
;
@Getter
@Setter
@ApiModelProperty
(
value
=
"调式异常"
)
private
String
debugMsg
;
@Getter
@Setter
@ApiModelProperty
(
value
=
"数据"
)
...
...
@@ -77,7 +82,9 @@ public class R<T> implements Serializable {
public
static
<
T
>
R
<
T
>
failed
(
String
msg
)
{
return
restResult
(
null
,
CommonConstants
.
FAIL
,
msg
);
}
public
static
<
T
>
R
<
T
>
failed
(
String
msg
,
String
debugMsg
)
{
return
restResult
(
null
,
CommonConstants
.
FAIL
,
msg
,
debugMsg
);
}
public
static
<
T
>
R
<
T
>
failed
(
T
data
)
{
return
restResult
(
data
,
CommonConstants
.
FAIL
,
null
);
}
...
...
@@ -86,6 +93,10 @@ public class R<T> implements Serializable {
return
restResult
(
data
,
CommonConstants
.
FAIL
,
msg
);
}
public
static
<
T
>
R
<
T
>
bad
(
String
msg
,
String
debugMsg
)
{
return
failed
(
msg
,
debugMsg
);
}
private
static
<
T
>
R
<
T
>
restResult
(
T
data
,
int
code
,
String
msg
)
{
R
<
T
>
apiResult
=
new
R
<>();
apiResult
.
setCode
(
code
);
...
...
@@ -93,5 +104,13 @@ public class R<T> implements Serializable {
apiResult
.
setMsg
(
msg
);
return
apiResult
;
}
private
static
<
T
>
R
<
T
>
restResult
(
T
data
,
int
code
,
String
msg
,
String
debugMsg
)
{
R
<
T
>
apiResult
=
new
R
<>();
apiResult
.
setCode
(
code
);
apiResult
.
setData
(
data
);
apiResult
.
setMsg
(
msg
);
apiResult
.
setDebugMsg
(
debugMsg
);
return
apiResult
;
}
}
src/main/java/com/syc/slm/slmbi/config/SysMetaObjectHandler.java
View file @
ddd09f71
...
...
@@ -18,7 +18,7 @@ import java.util.function.Supplier;
@Component
@Slf4j
public
class
SysMetaObjectHandler
implements
MetaObjectHandler
{
private
static
final
String
ID
=
"id"
;
private
static
final
String
APP_ID
=
"appId"
;
private
static
final
String
CREATOR
=
"creator"
;
private
static
final
String
CREATOR_NAME
=
"creatorName"
;
...
...
@@ -33,6 +33,9 @@ public class SysMetaObjectHandler implements MetaObjectHandler {
*/
@Override
public
void
insertFill
(
MetaObject
metaObject
)
{
fillValue
(
metaObject
,
ID
,
()
->
(
metaObject
.
getValue
(
ID
)
==
null
?
IdWorker
.
get32UUID
()
:
metaObject
.
getValue
(
ID
)));
fillValue
(
metaObject
,
APP_ID
,
()
->
(
metaObject
.
getValue
(
APP_ID
)
==
null
?
"68d61d7f990e11eb847e88d7f63cc98f"
:
metaObject
.
getValue
(
APP_ID
)));
...
...
src/main/java/com/syc/slm/slmbi/controller/BaseRestController.java
View file @
ddd09f71
package
com
.
syc
.
slm
.
slmbi
.
controller
;
import
com.syc.slm.common.core.constant.SlmConstants
;
import
com.syc.slm.common.core.util.NetResponseUtils
;
import
com.syc.slm.common.core.util.R
;
import
com.syc.slm.slmbi.function.Action0
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Enumeration
;
import
java.util.Map
;
import
java.util.function.Supplier
;
/**
...
...
@@ -13,7 +19,15 @@ import java.util.function.Supplier;
* @author : lin
* @date : 2021-04-06 09:09
**/
@Slf4j
public
class
BaseRestController
{
@ModelAttribute
public
void
onInit
(
HttpServletRequest
request
)
{
String
uri
=
request
.
getRequestURI
();
log
.
info
(
"请求url--->>>>"
+
uri
);
Map
<
String
,
String
[]>
parameterMap
=
request
.
getParameterMap
();
log
.
info
(
"请求参数--->>>>"
+
SlmConstants
.
gson
.
toJson
(
parameterMap
));
}
R
<
Object
>
call
(
Action0
action
)
{
return
NetResponseUtils
.
call
(
action
);
}
...
...
src/main/java/com/syc/slm/slmbi/controller/InstrumentPanelConfigController.java
View file @
ddd09f71
...
...
@@ -30,7 +30,7 @@ public class InstrumentPanelConfigController {
@PostMapping
@ApiOperation
(
"保存仪表板样式以及数据配置"
)
@ApiImplicitParam
(
name
=
"appId"
,
value
=
"租户id"
,
required
=
true
,
dataTypeClass
=
String
.
class
)
public
R
<
String
>
saveInstrumentPanelConfig
(
@PathVariable
String
appId
,
InstrumentPanelConfigDTO
config
)
{
public
R
<
String
>
saveInstrumentPanelConfig
(
@PathVariable
String
appId
,
@RequestBody
InstrumentPanelConfigDTO
config
)
{
return
R
.
ok
(
instrumentPanelConfigService
.
saveConfig
(
appId
,
config
));
}
...
...
src/main/java/com/syc/slm/slmbi/controller/InstrumentPanelController.java
View file @
ddd09f71
...
...
@@ -60,7 +60,7 @@ public class InstrumentPanelController extends BaseRestController {
required
=
true
,
dataTypeClass
=
Arrays
.
class
),
@ApiImplicitParam
(
name
=
"appId"
,
value
=
"租户id"
,
required
=
true
,
dataTypeClass
=
String
.
class
)})
public
R
<
Object
>
batchPublish
(
@PathVariable
String
appId
,
@RequestParam
List
<
String
>
ids
)
{
public
R
<
List
<
String
>
>
batchPublish
(
@PathVariable
String
appId
,
@RequestParam
List
<
String
>
ids
)
{
return
call
(()
->
instrumentPanelService
.
batchPublish
(
ids
));
}
...
...
src/main/java/com/syc/slm/slmbi/controller/InstrumentPanelGroupController.java
View file @
ddd09f71
...
...
@@ -48,7 +48,7 @@ public class InstrumentPanelGroupController extends BaseRestController{
}
@PutMapping
@ApiOperation
(
"更新仪表板分组"
)
@ApiOperation
(
"更新仪表板分组
(一级分组是初始化得,不允许修改,其他分组修改必须传parentId)
"
)
@ApiImplicitParam
(
name
=
"appId"
,
value
=
"租户id"
,
required
=
true
,
dataTypeClass
=
String
.
class
)
public
R
<
String
>
updateGroup
(
@PathVariable
String
appId
,
@RequestBody
InstrumentPanelGroupDTO
group
)
{
return
call
(()->
instrumentPanelGroupService
.
updateGroup
(
group
,
appId
));
...
...
src/main/java/com/syc/slm/slmbi/controller/InstrumentPanelPermissionController.java
View file @
ddd09f71
...
...
@@ -36,7 +36,7 @@ public class InstrumentPanelPermissionController extends BaseRestController {
return
call
(()
->
instrumentPanelPermissionService
.
savePermission
(
permission
));
}
@
Pu
tMapping
(
"/{panelId}/to-copy"
)
@
Ge
tMapping
(
"/{panelId}/to-copy"
)
@ApiOperation
(
"从其他仪表板复制配置"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"appId"
,
value
=
"租户id"
,
...
...
@@ -54,7 +54,7 @@ public class InstrumentPanelPermissionController extends BaseRestController {
value
=
"租户id"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@ApiImplicitParam
(
name
=
"panelId"
,
value
=
"其他仪表板id"
,
required
=
true
,
dataTypeClass
=
Arrays
.
class
)})
@ApiImplicitParam
(
name
=
"panelId
s
"
,
value
=
"其他仪表板id"
,
required
=
true
,
dataTypeClass
=
Arrays
.
class
)})
public
R
<
Object
>
saveCopyToOtherPermission
(
@PathVariable
String
appId
,
@RequestBody
InstrumentPanelPermissionDTO
permission
,
@RequestParam
List
<
String
>
panelIds
)
{
...
...
src/main/java/com/syc/slm/slmbi/controller/InstrumentPanelTreeController.java
View file @
ddd09f71
...
...
@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author liangbin
...
...
@@ -57,9 +58,9 @@ public class InstrumentPanelTreeController extends BaseRestController {
@ApiImplicitParam
(
name
=
"nodeId"
,
value
=
"分组id"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"分组名称或者仪表板名称"
,
dataTypeClass
=
String
.
class
)})
public
R
<
List
<
PanelTreeNodeVo
>>
children
(
@PathVariable
String
appId
,
@RequestParam
(
"nodeId"
)
String
group
Id
,
@RequestParam
(
"nodeId"
)
String
node
Id
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
)
{
return
call
(()
->
(
treeService
.
children
(
group
Id
,
name
)));
return
call
(()
->
(
treeService
.
children
(
node
Id
,
name
)));
}
@GetMapping
(
"/children-panel"
)
...
...
@@ -97,4 +98,15 @@ public class InstrumentPanelTreeController extends BaseRestController {
public
R
<
List
<
PanelTreeNodeVo
>>
cite
(
@PathVariable
String
appId
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
)
{
return
call
(()
->
(
treeService
.
citeTreeList
(
appId
,
name
)));
}
@GetMapping
(
"/cite-assembly"
)
@ApiOperation
(
"复用仪表板树点击组件获取配置(会返回一个map 优先从key为 wait_published 中匹配,如果找不到再从key 为published 中匹配 )"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"appId"
,
value
=
"租户id"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@ApiImplicitParam
(
name
=
"appId"
,
value
=
"租户id"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@ApiImplicitParam
(
name
=
"panelId"
,
value
=
"仪表板id"
,
required
=
true
,
dataTypeClass
=
String
.
class
)})
public
R
<
Map
<
String
,
String
>>
assembly
(
@PathVariable
String
appId
,
@RequestParam
(
value
=
"panelId"
,
required
=
false
)
String
panelId
)
{
return
call
(()
->
(
treeService
.
assembly
(
appId
,
panelId
)));
}
}
src/main/java/com/syc/slm/slmbi/entity/BaseEntity.java
View file @
ddd09f71
...
...
@@ -28,37 +28,37 @@ public class BaseEntity<T extends Model<?>> extends Model<T> {
*/
@TableId
@ApiModelProperty
(
value
=
"主键"
)
pr
ivate
String
id
;
pr
otected
String
id
;
/**
* 租户id
*/
@ApiModelProperty
(
value
=
"租户id"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
pr
ivate
String
appId
;
pr
otected
String
appId
;
@ApiModelProperty
(
value
=
"创建人主键"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
pr
ivate
String
creator
;
pr
otected
String
creator
;
@ApiModelProperty
(
value
=
"创建人名称"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
pr
ivate
String
creatorName
;
pr
otected
String
creatorName
;
@ApiModelProperty
(
value
=
"创建时间"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
pr
ivate
Date
createTime
;
pr
otected
Date
createTime
;
@ApiModelProperty
(
value
=
"修改人主键"
)
@TableField
(
fill
=
FieldFill
.
UPDATE
)
pr
ivate
String
updater
;
pr
otected
String
updater
;
@ApiModelProperty
(
value
=
"修改人名称"
)
@TableField
(
fill
=
FieldFill
.
UPDATE
)
pr
ivate
String
updaterName
;
pr
otected
String
updaterName
;
@ApiModelProperty
(
value
=
"修改时间"
)
@TableField
(
fill
=
FieldFill
.
UPDATE
)
pr
ivate
Date
updateTime
;
pr
otected
Date
updateTime
;
@ApiModelProperty
(
value
=
"状态"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
pr
ivate
Integer
recordStatus
;
pr
otected
Integer
recordStatus
;
@ApiModelProperty
(
value
=
"描述"
)
pr
ivate
String
description
;
pr
otected
String
description
;
@Override
protected
Serializable
pkVal
()
{
...
...
src/main/java/com/syc/slm/slmbi/entity/InstrumentPanel.java
View file @
ddd09f71
...
...
@@ -18,8 +18,6 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode
(
callSuper
=
true
)
@TableName
(
"instrument_panel"
)
public
class
InstrumentPanel
extends
BaseEntity
<
InstrumentPanel
>{
@ApiModelProperty
(
value
=
"仪表板主键"
)
private
String
id
;
@ApiModelProperty
(
value
=
"仪表板名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"仪表板归属分组"
)
...
...
@@ -27,13 +25,13 @@ public class InstrumentPanel extends BaseEntity<InstrumentPanel>{
@ApiModelProperty
(
value
=
"访问权限"
)
private
String
accessPermission
;
@ApiModelProperty
(
value
=
"发布状态"
)
private
Integer
published
;
private
String
published
;
public
InstrumentPanel
()
{
}
public
InstrumentPanel
(
String
id
,
String
name
,
String
groupId
,
String
accessPermission
,
Integer
published
)
{
this
.
id
=
id
;
public
InstrumentPanel
(
String
id
,
String
name
,
String
groupId
,
String
accessPermission
,
String
published
)
{
super
.
id
=
id
;
this
.
name
=
name
;
this
.
groupId
=
groupId
;
this
.
accessPermission
=
accessPermission
;
...
...
src/main/java/com/syc/slm/slmbi/entity/InstrumentPanelConfig.java
View file @
ddd09f71
...
...
@@ -24,5 +24,5 @@ public class InstrumentPanelConfig extends BaseEntity<InstrumentPanelConfig>{
@ApiModelProperty
(
value
=
"仪表板配置详情,包含了样式,数据配置"
)
private
String
configDetails
;
@ApiModelProperty
(
value
=
"发布状态"
)
private
Integer
published
;
private
String
published
;
}
src/main/java/com/syc/slm/slmbi/entity/InstrumentPanelDraft.java
View file @
ddd09f71
...
...
@@ -17,7 +17,6 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"仪表板草稿"
)
public
class
InstrumentPanelDraft
extends
BaseEntity
<
InstrumentPanelDraft
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 仪表板名字
...
...
src/main/java/com/syc/slm/slmbi/entity/InstrumentPanelPermission.java
View file @
ddd09f71
...
...
@@ -17,7 +17,6 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"仪表板权限"
)
public
class
InstrumentPanelPermission
extends
BaseEntity
<
InstrumentPanelPermission
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 仪表板id
*/
...
...
@@ -42,5 +41,5 @@ public class InstrumentPanelPermission extends BaseEntity<InstrumentPanelPermiss
* 1代表第一版数据,2代表保存发布再次保存得数据
*/
@ApiModelProperty
(
value
=
"1代表第一版数据,2代表保存发布再次保存得数据"
)
private
Integer
published
;
private
String
published
;
}
src/main/java/com/syc/slm/slmbi/enums/PublishedStatus.java
View file @
ddd09f71
...
...
@@ -8,18 +8,18 @@ public enum PublishedStatus {
/**
* 发布
*/
PUBLISHED
(
1
),
PUBLISHED
(
"published"
),
/**
* 待发布
*/
WAIT_PUBLISHED
(
2
),
WAIT_PUBLISHED
(
"wait_published"
),
/**
* 下线
*/
OFFLINE
(
3
),
DRAFT
(
4
);
public
Integer
value
;
OFFLINE
(
"offline"
),
DRAFT
(
"draft"
);
public
String
value
;
PublishedStatus
(
Integer
v
)
{
PublishedStatus
(
String
v
)
{
value
=
v
;
}}
src/main/java/com/syc/slm/slmbi/service/InstrumentPanelConfigService.java
View file @
ddd09f71
...
...
@@ -7,6 +7,7 @@ import com.syc.slm.slmbi.vo.InstrumentPanelConfigVo;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
import
java.util.Map
;
/**
* slm-bi
...
...
@@ -53,7 +54,7 @@ public interface InstrumentPanelConfigService extends IService<InstrumentPanelCo
* @param panelId
* @param publishedStatus
*/
void
delConfig
(
@NotNull
String
panelId
,
Integer
publishedStatus
);
void
delConfig
(
@NotNull
String
panelId
,
String
publishedStatus
);
/**
* 根据仪表板详情保存仪表盘配置
...
...
@@ -61,7 +62,7 @@ public interface InstrumentPanelConfigService extends IService<InstrumentPanelCo
* @param configDetails
* @param publishStatus
*/
void
savePanelConfig
(
String
panelId
,
String
configDetails
,
Integer
publishStatus
);
void
savePanelConfig
(
String
panelId
,
String
configDetails
,
String
publishStatus
);
/**
* 发布仪表板把对应配置状态修改为发布
...
...
@@ -75,12 +76,18 @@ public interface InstrumentPanelConfigService extends IService<InstrumentPanelCo
* @param publishStatus
* @return
*/
List
<
InstrumentPanelConfig
>
getConfigByPanelIdAndPublishStatus
(
String
panelId
,
Integer
publishStatus
);
List
<
InstrumentPanelConfig
>
getConfigByPanelIdAndPublishStatus
(
String
panelId
,
String
publishStatus
);
/**
* 下线仪表盘配置
* @param panelId
* @param publishStatus
*/
void
offlineConfig
(
String
panelId
,
Integer
publishStatus
);
void
offlineConfig
(
String
panelId
,
String
publishStatus
);
/**
* 根据仪表id获取仪表板配置
* @param panelId
*/
Map
<
String
,
String
>
getAssemblyConfig
(
@NotNull
String
panelId
);
}
src/main/java/com/syc/slm/slmbi/service/InstrumentPanelPermissionService.java
View file @
ddd09f71
...
...
@@ -53,15 +53,17 @@ public interface InstrumentPanelPermissionService extends IService<InstrumentPan
/**
* 根据仪表板id删除仪表板权限
* @param panelId
* @param publishStatus
*/
void
delPermissionByPanelId
(
@NonNull
String
panelId
,
Integer
publishStatus
);
void
delPermissionByPanelId
(
@NonNull
String
panelId
,
String
publishStatus
);
/**
* 根据仪表板id获取已经发布的配置
* @param panelId
* @param publishStatus
* @return
*/
List
<
CustomPermissionVo
>
getPublishPermissionByPanelId
(
@NonNull
String
panelId
,
@NonNull
Integer
publishStatus
);
List
<
CustomPermissionVo
>
getPublishPermissionByPanelId
(
@NonNull
String
panelId
,
@NonNull
String
publishStatus
);
/**
* 根据仪表板详情保存仪表板配置
...
...
@@ -70,7 +72,7 @@ public interface InstrumentPanelPermissionService extends IService<InstrumentPan
* @param accessType
* @param publishStatus
*/
void
savePanelPermission
(
List
<
CustomPermissionDTO
>
customPermissions
,
String
panelId
,
String
accessType
,
Integer
publishStatus
);
void
savePanelPermission
(
List
<
CustomPermissionDTO
>
customPermissions
,
String
panelId
,
String
accessType
,
String
publishStatus
);
/**
* 批量发布把对应配置状态更改为发布状态
...
...
@@ -84,7 +86,7 @@ public interface InstrumentPanelPermissionService extends IService<InstrumentPan
* @param publishStatus
* @return
*/
List
<
InstrumentPanelPermission
>
getPermissionByPanelIdAndPublishStatus
(
String
panelId
,
Integer
publishStatus
);
List
<
InstrumentPanelPermission
>
getPermissionByPanelIdAndPublishStatus
(
String
panelId
,
String
publishStatus
);
/**
* 下线仪表板对应权限
...
...
src/main/java/com/syc/slm/slmbi/service/InstrumentPanelService.java
View file @
ddd09f71
...
...
@@ -43,7 +43,7 @@ public interface InstrumentPanelService extends IService<InstrumentPanel> {
* @param ids
* @return
*/
void
batchPublish
(
List
<
String
>
ids
);
List
<
String
>
batchPublish
(
List
<
String
>
ids
);
/**
* 删除仪表板
...
...
src/main/java/com/syc/slm/slmbi/service/InstrumentPanelTreeService.java
View file @
ddd09f71
...
...
@@ -3,9 +3,11 @@ package com.syc.slm.slmbi.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.syc.slm.slmbi.dto.InstrumentPanelAssemblyDTO
;
import
com.syc.slm.slmbi.entity.InstrumentPanelTree
;
import
com.syc.slm.slmbi.vo.InstrumentPanelConfigVo
;
import
com.syc.slm.slmbi.vo.PanelTreeNodeVo
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
...
...
@@ -104,4 +106,12 @@ public interface InstrumentPanelTreeService extends IService<InstrumentPanelTree
* @return
*/
List
<
PanelTreeNodeVo
>
citeTreeList
(
String
appId
,
String
name
);
/**
* 点击仪表板组件获取对应配置
* @param appId
* @param panelId
* @return
*/
Map
<
String
,
String
>
assembly
(
String
appId
,
String
panelId
);
}
src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelConfigServiceImpl.java
View file @
ddd09f71
This diff is collapsed.
Click to expand it.
src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelDraftServiceImpl.java
View file @
ddd09f71
...
...
@@ -62,11 +62,7 @@ public class InstrumentPanelDraftServiceImpl extends ServiceImpl<InstrumentPanel
}
@Override
public
List
<
InstrumentPanelDraft
>
selectDraftList
(
String
appId
,
Set
<
String
>
panelIds
,
String
officeIds
,
String
userId
,
String
roleId
)
{
public
List
<
InstrumentPanelDraft
>
selectDraftList
(
String
appId
,
Set
<
String
>
panelIds
,
String
officeIds
,
String
userId
,
String
roleId
)
{
return
baseMapper
.
selectDraftList
(
appId
,
panelIds
,
officeIds
,
userId
,
roleId
);
}
...
...
src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelGroupServiceImpl.java
View file @
ddd09f71
...
...
@@ -117,6 +117,9 @@ public class InstrumentPanelGroupServiceImpl extends ServiceImpl<InstrumentPanel
if
(
StringUtils
.
isEmpty
(
group
.
getName
())){
throw
new
SysException
(
"仪表板分组名称必填"
);
}
if
(
StringUtils
.
isEmpty
(
group
.
getParentId
())){
throw
new
SysException
(
"父级分组必填"
);
}
log
.
info
(
"检查分组名字是否重复"
);
checkedRepeatName
.
call
(
group
,
appId
);
InstrumentPanelGroup
entity
=
new
InstrumentPanelGroup
();
...
...
src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelPermissionImpl.java
View file @
ddd09f71
...
...
@@ -70,7 +70,8 @@ public class InstrumentPanelPermissionImpl
InstrumentPanel
panel
=
panelService
.
getById
(
permissions
.
getPanelId
());
panel
.
setName
(
permissions
.
getPanelName
());
panel
.
setGroupId
(
permissions
.
getGroupId
());
permissions
.
setAccessType
(
permissions
.
getAccessType
());
panel
.
setAccessPermission
(
permissions
.
getAccessType
());
panel
.
setDescription
(
permissions
.
getDescription
());
log
.
info
(
"删除原本的权限"
);
delPermissionByPanelId
(
permissions
.
getPanelId
(),
PublishedStatus
.
WAIT_PUBLISHED
.
value
);
...
...
@@ -97,10 +98,14 @@ public class InstrumentPanelPermissionImpl
throw
new
SysException
(
"访问权限类型必填"
);
}
List
<
InstrumentPanel
>
panels
=
panelService
.
getByIds
(
Sets
.
newHashSet
(
otherInstrumentPanelIds
));
if
(
CollectionUtils
.
isEmpty
(
panels
)){
throw
new
SysException
(
"查找不到对应的仪表板,请联系管理员"
);
}
panels
.
forEach
(
panel
->{
panel
.
setAccessPermission
(
permissions
.
getAccessType
());
panel
.
setDescription
(
permissions
.
getDescription
());
log
.
info
(
"删除原本的权限"
);
delPermissionByPanelId
(
p
ermissions
.
getPanel
Id
(),
PublishedStatus
.
WAIT_PUBLISHED
.
value
);
delPermissionByPanelId
(
p
anel
.
get
Id
(),
PublishedStatus
.
WAIT_PUBLISHED
.
value
);
log
.
info
(
"插入现有的权限"
);
savePanelPermission
(
permissions
.
getCustomPermissions
(),
panel
.
getId
(),
panel
.
getAccessPermission
(),
PublishedStatus
.
WAIT_PUBLISHED
.
value
);
...
...
@@ -116,6 +121,7 @@ public class InstrumentPanelPermissionImpl
InstrumentPanelPermissionVo
vo
=
new
InstrumentPanelPermissionVo
();
InstrumentPanel
panel
=
panelService
.
getById
(
instrumentPanelId
);
vo
.
setAccessType
(
panel
.
getAccessPermission
());
vo
.
setDescription
(
panel
.
getDescription
());
List
<
CustomPermissionVo
>
vos
=
getPublishPermissionByPanelId
(
instrumentPanelId
,
PublishedStatus
.
WAIT_PUBLISHED
.
value
);
if
(
CollectionUtils
.
isEmpty
(
vos
)){
vos
=
getPublishPermissionByPanelId
(
instrumentPanelId
,
PublishedStatus
.
PUBLISHED
.
value
);
...
...
@@ -125,7 +131,7 @@ public class InstrumentPanelPermissionImpl
}
@Override
public
void
delPermissionByPanelId
(
@NonNull
String
panelId
,
Integer
publishStatus
)
{
public
void
delPermissionByPanelId
(
@NonNull
String
panelId
,
String
publishStatus
)
{
List
<
InstrumentPanelPermission
>
permissions
=
getPermissionByPanelIdAndPublishStatus
(
panelId
,
publishStatus
);
if
(
CollectionUtils
.
isNotEmpty
(
permissions
))
{
permissions
.
forEach
(
x
->
{
...
...
@@ -138,7 +144,7 @@ public class InstrumentPanelPermissionImpl
@Override
@Transactional
(
readOnly
=
true
)
public
List
<
CustomPermissionVo
>
getPublishPermissionByPanelId
(
@NonNull
String
panelId
,
@NonNull
Integer
publishStatus
)
{
@NonNull
String
publishStatus
)
{
List
<
InstrumentPanelPermission
>
permissions
=
getPermissionByPanelIdAndPublishStatus
(
panelId
,
publishStatus
);
return
CollectionUtils
.
isNotEmpty
(
permissions
)
?
SlmConstants
.
gson
.
fromJson
(
SlmConstants
.
gson
.
toJson
(
permissions
),
new
TypeToken
<
List
<
CustomPermissionVo
>>()
{}.
getType
())
:
null
;
}
...
...
@@ -147,7 +153,7 @@ public class InstrumentPanelPermissionImpl
public
void
savePanelPermission
(
List
<
CustomPermissionDTO
>
customPermissions
,
String
panelId
,
String
accessType
,
Integer
publishStatus
)
{
String
publishStatus
)
{
if
(
CollectionUtils
.
isNotEmpty
(
customPermissions
))
{
if
(
AccessType
.
CUSTOM
.
value
.
equals
(
accessType
))
{
if
(
CollectionUtils
.
isNotEmpty
(
customPermissions
))
{
...
...
@@ -195,7 +201,7 @@ public class InstrumentPanelPermissionImpl
}
@Override
public
List
<
InstrumentPanelPermission
>
getPermissionByPanelIdAndPublishStatus
(
String
panelId
,
Integer
publishStatus
)
{
public
List
<
InstrumentPanelPermission
>
getPermissionByPanelIdAndPublishStatus
(
String
panelId
,
String
publishStatus
)
{
LambdaQueryWrapper
<
InstrumentPanelPermission
>
where
=
new
LambdaQueryWrapper
<>();
where
.
eq
(
InstrumentPanelPermission:
:
getPanelId
,
panelId
);
where
.
eq
(
InstrumentPanelPermission:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
...
...
src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelServiceImpl.java
View file @
ddd09f71
...
...
@@ -61,7 +61,13 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
public
IPage
<
InstrumentPanelVo
>
selectInstrumentPanelList
(
String
appId
,
QueryInstrumentPanelDTO
query
)
{
IPage
<
InstrumentPanelVo
>
page
=
new
Page
<>(
query
.
getCurrent
(),
query
.
getSize
());
QueryWrapper
<
InstrumentPanel
>
where
=
new
QueryWrapper
<>();
if
(
StringUtils
.
isEmpty
(
appId
)){
throw
new
SysException
(
"appId必须传入"
);
}
where
.
eq
(
"p.app_id"
,
appId
);
if
(
StringUtils
.
isEmpty
(
query
.
getGroupId
())){
throw
new
SysException
(
"必须选择需要查询的仪表板分组"
);
}
where
.
eq
(
"p.group_id"
,
query
.
getGroupId
());
where
.
eq
(
"p.record_status"
,
SlmConstants
.
DATA_VALID
);
if
(
StringUtils
.
isNotEmpty
(
query
.
getName
()))
{
...
...
@@ -94,7 +100,7 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
batchPublish
(
List
<
String
>
ids
)
{
public
List
<
String
>
batchPublish
(
List
<
String
>
ids
)
{
if
(
CollectionUtils
.
isEmpty
(
ids
))
{
throw
new
SysException
(
"请选择你要操作的数据"
);
}
...
...
@@ -111,7 +117,7 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
log
.
info
(
"复制一份草稿"
);
draftService
.
saveDrafts
(
panels
);
}
return
ids
;
}
@Override
...
...
@@ -201,7 +207,7 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
wrapper
.
eq
(
InstrumentPanel:
:
getAppId
,
appId
);
wrapper
.
eq
(
InstrumentPanel:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
if
(
StringUtils
.
isNotEmpty
(
panelId
))
{
wrapper
.
eq
(
InstrumentPanel:
:
getId
,
panelId
);
wrapper
.
ne
(
InstrumentPanel:
:
getId
,
panelId
);
}
if
(
baseMapper
.
selectCount
(
wrapper
)
>
0
)
{
throw
new
SysException
(
"仪表板名字:"
+
panelName
+
"已存在!"
);
...
...
src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelTreeServiceImpl.java
View file @
ddd09f71
...
...
@@ -2,10 +2,12 @@ package com.syc.slm.slmbi.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
import
com.baomidou.mybatisplus.core.toolkit.ObjectUtils
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Sets
;
import
com.google.gson.reflect.TypeToken
;
import
com.syc.slm.common.core.constant.SlmConstants
;
...
...
@@ -13,15 +15,15 @@ import com.syc.slm.slmbi.dao.InstrumentPanelTreeMapper;
import
com.syc.slm.slmbi.dto.InstrumentPanelAssemblyDTO
;
import
com.syc.slm.slmbi.entity.*
;
import
com.syc.slm.slmbi.enums.NodeType
;
import
com.syc.slm.slmbi.enums.PublishedStatus
;
import
com.syc.slm.slmbi.exception.SysException
;
import
com.syc.slm.slmbi.service.InstrumentPanelDraftService
;
import
com.syc.slm.slmbi.service.InstrumentPanelGroupService
;
import
com.syc.slm.slmbi.service.InstrumentPanelService
;
import
com.syc.slm.slmbi.service.InstrumentPanelTreeService
;
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.InstrumentPanelGroupVo
;
import
com.syc.slm.slmbi.vo.PanelTreeNodeVo
;
import
lombok.NonNull
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.filefilter.FalseFileFilter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -37,6 +39,7 @@ import java.util.stream.Collectors;
* @date 2021-04-01 10:52:44
*/
@Service
@Slf4j
public
class
InstrumentPanelTreeServiceImpl
extends
ServiceImpl
<
InstrumentPanelTreeMapper
,
InstrumentPanelTree
>
implements
InstrumentPanelTreeService
{
...
...
@@ -45,6 +48,8 @@ public class InstrumentPanelTreeServiceImpl extends ServiceImpl<InstrumentPanelT
@Autowired
private
InstrumentPanelGroupService
groupService
;
@Autowired
private
InstrumentPanelConfigService
configService
;
@Autowired
private
InstrumentPanelService
panelService
;
...
...
@@ -87,19 +92,20 @@ public class InstrumentPanelTreeServiceImpl extends ServiceImpl<InstrumentPanelT
@Override
public
void
savePanelAssemblyTree
(
InstrumentPanelTree
tree
,
List
<
InstrumentPanelAssemblyDTO
>
assembly
,
String
panelId
)
{
if
(
CollectionUtils
.
isNotEmpty
(
assembly
))
{
for
(
int
i
=
0
;
i
<
assembly
.
size
();
i
++)
{
if
(
StringUtils
.
isBlank
(
assembly
.
get
(
i
).
getName
())
||
StringUtils
.
isBlank
(
assembly
.
get
(
i
).
getKey
())){
throw
new
SysException
(
"主键名称或者key不能为空,请联系管理员"
);
}
InstrumentPanelTree
t
=
new
InstrumentPanelTree
();
t
.
setId
(
tree
.
getId
()
+
"_"
+
i
);
t
.
setNodeType
(
NodeType
.
ASSEMBLY
.
value
);
t
.
setFullId
(
tree
.
getFullId
()
+
"."
+
t
.
getId
());
t
.
setFullName
(
tree
.
getFullName
()
+
"."
+
assembly
.
get
(
i
).
getName
());
t
.
setAssemblyKey
(
assembly
.
get
(
i
).
getKey
());
t
.
setName
(
assembly
.
get
(
i
).
getName
());
baseMapper
.
insert
(
t
);
}
assembly
.
forEach
(
x
->{
if
(
StringUtils
.
isBlank
(
x
.
getName
())
||
StringUtils
.
isBlank
(
x
.
getKey
())){
log
.
info
(
"不要传入空得组件树"
);
}
else
{
InstrumentPanelTree
t
=
new
InstrumentPanelTree
();
t
.
setId
(
IdWorker
.
get32UUID
());
t
.
setNodeType
(
NodeType
.
ASSEMBLY
.
value
);
t
.
setFullId
(
tree
.
getFullId
()
+
"."
+
t
.
getId
());
t
.
setFullName
(
tree
.
getFullName
()
+
"."
+
x
.
getName
());
t
.
setAssemblyKey
(
x
.
getKey
());
t
.
setName
(
x
.
getName
());
baseMapper
.
insert
(
t
);
}
});
}
}
...
...
@@ -318,16 +324,24 @@ public class InstrumentPanelTreeServiceImpl extends ServiceImpl<InstrumentPanelT
InstrumentPanelTree
panelTree
=
baseMapper
.
selectById
(
panelId
);
String
beforeFullName
=
panelTree
.
getFullName
();
String
beforeFullId
=
panelTree
.
getFullId
();
log
.
info
(
"更新自身的树状结构"
);
panelTree
.
setFullName
(
group
.
getFullName
()+
"."
+
panelName
);
panelTree
.
setFullId
(
group
.
getFullId
()+
"."
+
panelId
);
panelTree
.
setName
(
panelName
);
baseMapper
.
updateById
(
panelTree
);
if
(
ObjectUtils
.
isNotEmpty
(
group
)){
log
.
info
(
"更新组件的树状结构"
);
LambdaQueryWrapper
<
InstrumentPanelTree
>
where
=
new
LambdaQueryWrapper
<>();
where
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
where
.
likeRight
(
InstrumentPanelTree:
:
getFullId
,
group
.
getFullId
()
+
"."
);
where
.
likeRight
(
InstrumentPanelTree:
:
getFullId
,
beforeFullId
+
"."
);
List
<
InstrumentPanelTree
>
trees
=
baseMapper
.
selectList
(
where
);
if
(
CollectionUtils
.
isNotEmpty
(
trees
)){
trees
.
forEach
(
x
->{
x
.
setFullId
(
x
.
getFullId
().
replace
(
beforeFullId
,
group
.
getFullId
()));
String
name
=
x
.
getFullName
().
substring
(
x
.
getFullName
().
lastIndexOf
(
beforeFullName
)
);
x
.
setFullName
(
group
.
getFullName
()+
"."
+
name
);
x
.
setFullId
(
x
.
getFullId
().
replace
(
beforeFullId
,
panelTree
.
getFullId
()));
String
name
=
x
.
getFullName
().
substring
(
beforeFullName
.
length
()+
1
);
x
.
setFullName
(
panelTree
.
getFullName
()+
"."
+
name
);
x
.
setName
(
name
);
baseMapper
.
updateById
(
x
);
});
...
...
@@ -347,6 +361,11 @@ public class InstrumentPanelTreeServiceImpl extends ServiceImpl<InstrumentPanelT
return
getCopyAndCiteTrees
(
appId
,
name
,
true
);
}
@Override
public
Map
<
String
,
String
>
assembly
(
String
appId
,
String
panelId
)
{
return
configService
.
getAssemblyConfig
(
panelId
);
}
private
List
<
PanelTreeNodeVo
>
getCopyAndCiteTrees
(
String
appId
,
String
name
,
boolean
showAssembly
)
{
LambdaQueryWrapper
<
InstrumentPanelTree
>
where
=
new
LambdaQueryWrapper
<>();
where
.
eq
(
BaseEntity:
:
getAppId
,
appId
);
...
...
src/main/java/com/syc/slm/slmbi/vo/InstrumentPanelPermissionVo.java
View file @
ddd09f71
...
...
@@ -22,6 +22,8 @@ public class InstrumentPanelPermissionVo {
@ApiModelProperty
(
value
=
"访问权限类型"
,
required
=
true
)
private
String
accessType
;
@ApiModelProperty
(
value
=
"描述"
,
required
=
true
)
private
String
description
;
@ApiModelProperty
(
value
=
"自定义权限配置,当访问类型为CUSTOM时必填"
)
private
List
<
CustomPermissionVo
>
customPermissions
;
...
...
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