Commit 1023f6af authored by linruibiao's avatar linruibiao

接口编写

parent 95fd45c3
...@@ -35,10 +35,10 @@ public class SysMetaObjectHandler implements MetaObjectHandler { ...@@ -35,10 +35,10 @@ public class SysMetaObjectHandler implements MetaObjectHandler {
public void insertFill(MetaObject metaObject) { public void insertFill(MetaObject metaObject) {
fillValue(metaObject, fillValue(metaObject,
APP_ID, APP_ID,
() -> (metaObject.getValue(APP_ID) == null ? IdWorker.get32UUID() : metaObject.getValue(APP_ID))); () -> (metaObject.getValue(APP_ID) == null ? "68d61d7f990e11eb847e88d7f63cc98f" : metaObject.getValue(APP_ID)));
fillValue(metaObject, fillValue(metaObject,
CREATOR, CREATOR,
() -> (metaObject.getValue(CREATOR) == null ? IdWorker.get32UUID() : metaObject.getValue(CREATOR))); () -> (metaObject.getValue(CREATOR) == null ? "68d61d7f990e11eb847e88d7f63cc98f" : metaObject.getValue(CREATOR)));
fillValue(metaObject, fillValue(metaObject,
CREATOR_NAME, CREATOR_NAME,
() -> (metaObject.getValue(CREATOR_NAME) == null ? "小明" : metaObject.getValue(CREATOR_NAME))); () -> (metaObject.getValue(CREATOR_NAME) == null ? "小明" : metaObject.getValue(CREATOR_NAME)));
...@@ -52,7 +52,7 @@ public class SysMetaObjectHandler implements MetaObjectHandler { ...@@ -52,7 +52,7 @@ public class SysMetaObjectHandler implements MetaObjectHandler {
@Override @Override
public void updateFill(MetaObject metaObject) { public void updateFill(MetaObject metaObject) {
setFieldValByName(UPDATER, IdWorker.get32UUID(), metaObject); setFieldValByName(UPDATER, "68d61d7f990e11eb847e88d7f63cc98f", metaObject);
setFieldValByName(UPDATER_NAME, "小明",metaObject); setFieldValByName(UPDATER_NAME, "小明",metaObject);
setFieldValByName(UPDATE_TIME, new Date(), metaObject); setFieldValByName(UPDATE_TIME, new Date(), metaObject);
} }
......
...@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
...@@ -57,9 +58,9 @@ public class InstrumentPanelController extends BaseRestController { ...@@ -57,9 +58,9 @@ public class InstrumentPanelController extends BaseRestController {
@ApiImplicitParams({@ApiImplicitParam(name = "ids", @ApiImplicitParams({@ApiImplicitParam(name = "ids",
value = "仪表板id集合", value = "仪表板id集合",
required = true, required = true,
dataTypeClass = String.class), dataTypeClass = Arrays.class),
@ApiImplicitParam(name = "appId", value = "租户id", required = true, dataTypeClass = String.class)}) @ApiImplicitParam(name = "appId", value = "租户id", required = true, dataTypeClass = String.class)})
public R<Object> batchPublish(@PathVariable String appId, @RequestBody List<String> ids) { public R<Object> batchPublish(@PathVariable String appId, @RequestParam List<String> ids) {
return call(() -> instrumentPanelService.batchPublish(ids)); return call(() -> instrumentPanelService.batchPublish(ids));
} }
......
...@@ -34,7 +34,7 @@ public class InstrumentPanelGroupController extends BaseRestController{ ...@@ -34,7 +34,7 @@ public class InstrumentPanelGroupController extends BaseRestController{
@ApiOperation("仪表板列表查询,仪表板分组增删改页面的分组树") @ApiOperation("仪表板列表查询,仪表板分组增删改页面的分组树")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class), @ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class),
@ApiImplicitParam(name = "name", value = "分组名称", required = true,dataTypeClass = String.class) @ApiImplicitParam(name = "name", value = "分组名称",dataTypeClass = String.class)
}) })
public R<List<InstrumentPanelGroupVo>> selectGroupList(@PathVariable String appId, @RequestParam(required = false,value = "name") String name) { public R<List<InstrumentPanelGroupVo>> selectGroupList(@PathVariable String appId, @RequestParam(required = false,value = "name") String name) {
return call(()->instrumentPanelGroupService.selectGroupList(appId,name)); return call(()->instrumentPanelGroupService.selectGroupList(appId,name));
...@@ -44,14 +44,14 @@ public class InstrumentPanelGroupController extends BaseRestController{ ...@@ -44,14 +44,14 @@ public class InstrumentPanelGroupController extends BaseRestController{
@ApiOperation("保存仪表板分组") @ApiOperation("保存仪表板分组")
@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class) @ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class)
public R<String> saveGroup(@PathVariable String appId, @RequestBody CreateInstrumentPanelGroupDTO group) { public R<String> saveGroup(@PathVariable String appId, @RequestBody CreateInstrumentPanelGroupDTO group) {
return call(()->instrumentPanelGroupService.saveGroup(group)); return call(()->instrumentPanelGroupService.saveGroup(group,appId));
} }
@PutMapping @PutMapping
@ApiOperation("更新仪表板分组") @ApiOperation("更新仪表板分组")
@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class) @ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class)
public R<String> updateGroup(@PathVariable String appId, @RequestBody InstrumentPanelGroupDTO group) { public R<String> updateGroup(@PathVariable String appId, @RequestBody InstrumentPanelGroupDTO group) {
return call(()->instrumentPanelGroupService.updateGroup(group)); return call(()->instrumentPanelGroupService.updateGroup(group,appId));
} }
@DeleteMapping("/{groupId}") @DeleteMapping("/{groupId}")
......
...@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
...@@ -23,43 +24,52 @@ import java.util.List; ...@@ -23,43 +24,52 @@ import java.util.List;
@Api(value = "仪表板权限控制", tags = "仪表板权限控制") @Api(value = "仪表板权限控制", tags = "仪表板权限控制")
@RestController @RestController
@RequestMapping("/{appId}/panel-permissions") @RequestMapping("/{appId}/panel-permissions")
public class InstrumentPanelPermissionController { public class InstrumentPanelPermissionController extends BaseRestController {
@Autowired @Autowired
private InstrumentPanelPermissionService instrumentPanelPermissionService; private InstrumentPanelPermissionService instrumentPanelPermissionService;
@PostMapping @PostMapping
@ApiOperation("保存仪表板权限(列表的属性保存)") @ApiOperation("保存仪表板权限(列表的属性保存)")
@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class) @ApiImplicitParam(name = "appId", value = "租户id", required = true, dataTypeClass = String.class)
public R<String> savePermission(@PathVariable String appId, @RequestBody InstrumentPanelPermissionDTO permission) { public R<String> savePermission(@PathVariable String appId, @RequestBody InstrumentPanelPermissionDTO permission) {
return R.ok(instrumentPanelPermissionService.savePermission(permission)); return call(() -> instrumentPanelPermissionService.savePermission(permission));
} }
@PostMapping("/{panelId}/to-copy") @PutMapping("/{panelId}/to-copy")
@ApiOperation("从其他仪表板复制配置") @ApiOperation("从其他仪表板复制配置")
@ApiImplicitParams({@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class), @ApiImplicitParams({@ApiImplicitParam(name = "appId",
@ApiImplicitParam(name = "panelId", value = "其他仪表板id", required = true,dataTypeClass = String.class)}) value = "租户id",
public R<List<InstrumentPanelPermissionVo>> saveCopyOtherPermission(@PathVariable String appId, required = true,
dataTypeClass = String.class),
@ApiImplicitParam(name = "panelId", value = "其他仪表板id", required = true, dataTypeClass = String.class)})
public R<InstrumentPanelPermissionVo> saveCopyOtherPermission(@PathVariable String appId,
@PathVariable String panelId) { @PathVariable String panelId) {
return R.ok(instrumentPanelPermissionService.saveCopyOtherPermission(panelId)); return call(() -> (instrumentPanelPermissionService.saveCopyOtherPermission(panelId)));
} }
@PostMapping("/{panelId}/copy-to") @PostMapping("/copy-to")
@ApiOperation("将仪表板权限复制给其他仪表板") @ApiOperation("将仪表板权限复制给其他仪表板")
@ApiImplicitParams({@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class), @ApiImplicitParams({@ApiImplicitParam(name = "appId",
@ApiImplicitParam(name = "panelId", value = "其他仪表板id", required = true,dataTypeClass = String.class)}) value = "租户id",
public R<String> saveCopyToOtherPermission(@PathVariable String appId, required = true,
dataTypeClass = String.class),
@ApiImplicitParam(name = "panelId", value = "其他仪表板id", required = true, dataTypeClass = Arrays.class)})
public R<Object> saveCopyToOtherPermission(@PathVariable String appId,
@RequestBody InstrumentPanelPermissionDTO permission, @RequestBody InstrumentPanelPermissionDTO permission,
@PathVariable String panelId) { @RequestParam List<String> panelIds) {
return R.ok(instrumentPanelPermissionService.saveCopyToOtherPermission(permission, panelId)); return call(() -> instrumentPanelPermissionService.saveCopyToOtherPermission(permission, panelIds));
} }
@GetMapping("/{panelId}") @GetMapping("/{panelId}")
@ApiOperation("根据仪表板id获取仪表板权限") @ApiOperation("根据仪表板id获取仪表板权限")
@ApiImplicitParams({@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class), @ApiImplicitParams({@ApiImplicitParam(name = "appId",
@ApiImplicitParam(name = "panelId", value = "其他仪表板id", required = true,dataTypeClass = String.class)}) value = "租户id",
public R<List<InstrumentPanelPermissionVo>> selectPermissionByPanelId(@PathVariable String appId, required = true,
dataTypeClass = String.class),
@ApiImplicitParam(name = "panelId", value = "其他仪表板id", required = true, dataTypeClass = String.class)})
public R<InstrumentPanelPermissionVo> selectPermissionByPanelId(@PathVariable String appId,
@PathVariable String panelId) { @PathVariable String panelId) {
return R.ok(instrumentPanelPermissionService.selectPermissionByPanelId(panelId)); return call(() -> (instrumentPanelPermissionService.selectPermissionByPanelId(panelId)));
} }
} }
package com.syc.slm.slmbi.controller; package com.syc.slm.slmbi.controller;
import com.syc.slm.common.core.util.R; import com.syc.slm.common.core.util.R;
import com.syc.slm.slmbi.service.InstrumentPanelGroupService; import com.syc.slm.slmbi.service.InstrumentPanelConfigService;
import com.syc.slm.slmbi.vo.InstrumentPanelGroupVo; import com.syc.slm.slmbi.service.InstrumentPanelTreeService;
import com.syc.slm.slmbi.vo.InstrumentPanelConfigVo;
import com.syc.slm.slmbi.vo.PanelTreeNodeVo; import com.syc.slm.slmbi.vo.PanelTreeNodeVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -20,36 +21,80 @@ import java.util.List; ...@@ -20,36 +21,80 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/{appId}/panel-tree") @RequestMapping("/{appId}/panel-tree")
@Api(value = "仪表板树接口", tags = "仪表板树接口") @Api(value = "仪表板树接口", tags = "仪表板树接口")
public class InstrumentPanelTreeController { public class InstrumentPanelTreeController extends BaseRestController {
@Autowired
private InstrumentPanelTreeService treeService;
@Autowired @Autowired
private InstrumentPanelGroupService instrumentPanelGroupService; private InstrumentPanelConfigService configService;
@GetMapping @GetMapping
@ApiOperation("第一次进入页面,或者点击查询,获取全部分组下的仪表板数据,以及分组数据") @ApiOperation("显示已发布仪表板树==》(刚进入页面)")
@ApiImplicitParams({@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class), @ApiImplicitParam(name = "appId", value = "租户id", required = true, dataTypeClass = String.class)
@ApiImplicitParam(name = "name", value = "分组名称或者仪表板名称",dataTypeClass = String.class)}) public R<List<PanelTreeNodeVo>> loadTrees(@PathVariable String appId) {
return call(() -> (treeService.loadTrees(appId)));
}
@GetMapping("/search")
@ApiOperation("显示已发布仪表板树==》(点击查询)")
@ApiImplicitParams({@ApiImplicitParam(name = "appId",
value = "租户id",
required = true,
dataTypeClass = String.class),
@ApiImplicitParam(name = "name", value = "分组名称或者仪表板名称", dataTypeClass = String.class)})
public R<List<PanelTreeNodeVo>> loadTrees(@PathVariable String appId, public R<List<PanelTreeNodeVo>> loadTrees(@PathVariable String appId,
@RequestParam(value = "name", required = false) String name) { @RequestParam(value = "name", required = false) String name) {
return R.ok(instrumentPanelGroupService.loadTrees(name)); return call(() -> (treeService.loadTrees(appId, name)));
} }
@GetMapping("/children") @GetMapping("/children")
@ApiOperation("点击节点获取,该分组下的仪表板信息,以及分组数据") @ApiOperation("点击节点,显示已发布仪表板树")
@ApiImplicitParams({@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class), @ApiImplicitParams({@ApiImplicitParam(name = "appId",
@ApiImplicitParam(name = "groupId", value = "分组id", required = true,dataTypeClass = String.class), value = "租户id",
@ApiImplicitParam(name = "name", value = "分组名称或者仪表板名称",dataTypeClass = String.class)}) required = true,
dataTypeClass = String.class),
@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, public R<List<PanelTreeNodeVo>> children(@PathVariable String appId,
@RequestParam("groupId") String groupId, @RequestParam("nodeId") String groupId,
@RequestParam(value = "name", required = false) String name) { @RequestParam(value = "name", required = false) String name) {
return R.ok(instrumentPanelGroupService.children(groupId, name)); return call(() -> (treeService.children(groupId, name)));
} }
// FIXME 使用场景? @GetMapping("/children-panel")
@GetMapping("/selectInstrumentPanelGroups") @ApiOperation("点击节点,显示已发布仪表板配置")
//@ApiOperation("获取所有的仪表板分组以及分组下的仪表板以及仪表板下的组件") @ApiImplicitParams({@ApiImplicitParam(name = "appId",
public R<List<InstrumentPanelGroupVo>> selectInstrumentPanelGroups() { value = "租户id",
return R.ok(); required = true,
dataTypeClass = String.class),
@ApiImplicitParam(name = "panelId", value = "仪表板id", required = true, dataTypeClass = String.class)})
public R<InstrumentPanelConfigVo> childrenPanel(@PathVariable String appId, @RequestParam("nodeId") String nodeId) {
return call(() -> (configService.getPublishConfigByPanelId(nodeId)));
} }
// TODO 树搜索
@GetMapping("/copy")
@ApiOperation("复制仪表板配置树")
@ApiImplicitParams({@ApiImplicitParam(name = "appId",
value = "租户id",
required = true,
dataTypeClass = String.class),
@ApiImplicitParam(name = "appId", value = "租户id", required = true, dataTypeClass = String.class),
@ApiImplicitParam(name = "name", value = "分组名称或者仪表板名称", dataTypeClass = String.class)})
public R<List<PanelTreeNodeVo>> copyTreeList(@PathVariable String appId,@RequestParam(value = "name", required = false) String name) {
return call(() -> (treeService.copyTreeList(appId,name)));
}
@GetMapping("/cite")
@ApiOperation("复用仪表板树")
@ApiImplicitParams({@ApiImplicitParam(name = "appId",
value = "租户id",
required = true,
dataTypeClass = String.class),
@ApiImplicitParam(name = "appId", value = "租户id", required = true, dataTypeClass = String.class),
@ApiImplicitParam(name = "name", value = "分组名称,仪表板名称,组件名称", dataTypeClass = String.class)})
public R<List<PanelTreeNodeVo>> cite(@PathVariable String appId,@RequestParam(value = "name", required = false) String name) {
return call(() -> (treeService.citeTreeList(appId,name)));
}
} }
package com.syc.slm.slmbi.dao; package com.syc.slm.slmbi.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.syc.slm.slmbi.entity.InstrumentPanelDraft; import com.syc.slm.slmbi.entity.InstrumentPanelDraft;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Set;
/** /**
* 仪表板草稿 * 仪表板草稿
* *
...@@ -12,4 +16,6 @@ import org.springframework.stereotype.Component; ...@@ -12,4 +16,6 @@ import org.springframework.stereotype.Component;
@Component @Component
public interface InstrumentPanelDraftMapper extends BaseMapper<InstrumentPanelDraft> { public interface InstrumentPanelDraftMapper extends BaseMapper<InstrumentPanelDraft> {
List<InstrumentPanelDraft> selectDraftList(@Param("appId") String appId,@Param("panelIds") Set<String> panelIds, @Param("officeIds") String officeIds, @Param(
"userId") String userId, @Param("roleId") String roleId);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.syc.slm.slmbi.entity.InstrumentPanelGroup; import com.syc.slm.slmbi.entity.InstrumentPanelGroup;
import com.syc.slm.slmbi.vo.InstrumentPanelGroupVo; import com.syc.slm.slmbi.vo.InstrumentPanelGroupVo;
import com.syc.slm.slmbi.vo.PanelTreeNodeVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -32,4 +33,6 @@ public interface InstrumentPanelGroupMapper extends BaseMapper<InstrumentPanelGr ...@@ -32,4 +33,6 @@ public interface InstrumentPanelGroupMapper extends BaseMapper<InstrumentPanelGr
* @return * @return
*/ */
List<InstrumentPanelGroupVo> selectGroupList(@Param("ew") LambdaQueryWrapper<InstrumentPanelGroup> where); List<InstrumentPanelGroupVo> selectGroupList(@Param("ew") LambdaQueryWrapper<InstrumentPanelGroup> where);
List<PanelTreeNodeVo> selectGroupByIds(@Param("finalPanelIds") Set<String> finalPanelIds, @Param("name") String name);
} }
...@@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.syc.slm.slmbi.entity.InstrumentPanel; import com.syc.slm.slmbi.entity.InstrumentPanel;
import com.syc.slm.slmbi.vo.InstrumentPanelVo; import com.syc.slm.slmbi.vo.InstrumentPanelVo;
import com.syc.slm.slmbi.vo.PanelTreeNodeVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
...@@ -25,4 +27,5 @@ public interface InstrumentPanelMapper extends BaseMapper<InstrumentPanel> { ...@@ -25,4 +27,5 @@ public interface InstrumentPanelMapper extends BaseMapper<InstrumentPanel> {
IPage<InstrumentPanelVo> selectInstrumentPanelList(@Param("page") IPage<InstrumentPanelVo> page, IPage<InstrumentPanelVo> selectInstrumentPanelList(@Param("page") IPage<InstrumentPanelVo> page,
@Param("ew") Wrapper<InstrumentPanel> wrapper); @Param("ew") Wrapper<InstrumentPanel> wrapper);
List<PanelTreeNodeVo> selectPanelByIds(@Param("finalPanelIds") Set<String> finalPanelIds, @Param("name") String name);
} }
...@@ -2,9 +2,11 @@ package com.syc.slm.slmbi.dao; ...@@ -2,9 +2,11 @@ package com.syc.slm.slmbi.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.syc.slm.slmbi.entity.InstrumentPanelTree; import com.syc.slm.slmbi.entity.InstrumentPanelTree;
import com.syc.slm.slmbi.vo.PanelTreeNodeVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
......
...@@ -19,8 +19,8 @@ import java.util.List; ...@@ -19,8 +19,8 @@ import java.util.List;
@ApiModel(value = "仪表板权限DTO", description = "仪表板权限DTO") @ApiModel(value = "仪表板权限DTO", description = "仪表板权限DTO")
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class InstrumentPanelPermissionDTO { public class InstrumentPanelPermissionDTO {
@ApiModelProperty(value = "主键id") @ApiModelProperty(value = "仪表板主键id")
private String id; private String panelId;
@ApiModelProperty(value = "仪表板名称", required = true) @ApiModelProperty(value = "仪表板名称", required = true)
private String panelName; private String panelName;
......
...@@ -13,8 +13,8 @@ import lombok.Data; ...@@ -13,8 +13,8 @@ import lombok.Data;
public class QueryPageDTO { public class QueryPageDTO {
@ApiModelProperty("页码") @ApiModelProperty("页码")
private Integer pageNum = 1; private Integer current = 1;
@ApiModelProperty("每页大小") @ApiModelProperty("每页大小")
private Integer pageSize = 10; private Integer size = 10;
} }
...@@ -40,4 +40,7 @@ public class InstrumentPanelDraft extends BaseEntity<InstrumentPanelDraft> { ...@@ -40,4 +40,7 @@ public class InstrumentPanelDraft extends BaseEntity<InstrumentPanelDraft> {
@ApiModelProperty(value = "状态(发布,下线)") @ApiModelProperty(value = "状态(发布,下线)")
private String published; private String published;
@ApiModelProperty(value = "仪表板id")
private String panelId;
} }
package com.syc.slm.slmbi.entity; package com.syc.slm.slmbi.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -24,6 +25,9 @@ public class InstrumentPanelTree extends BaseEntity<InstrumentPanelTree> { ...@@ -24,6 +25,9 @@ public class InstrumentPanelTree extends BaseEntity<InstrumentPanelTree> {
*/ */
@ApiModelProperty(value = "节点全路径id") @ApiModelProperty(value = "节点全路径id")
private String fullId; private String fullId;
@ApiModelProperty(value = "节点名字")
private String name;
/** /**
* 节点全路径 * 节点全路径
*/ */
...@@ -37,8 +41,11 @@ public class InstrumentPanelTree extends BaseEntity<InstrumentPanelTree> { ...@@ -37,8 +41,11 @@ public class InstrumentPanelTree extends BaseEntity<InstrumentPanelTree> {
@ApiModelProperty(value = "组件key") @ApiModelProperty(value = "组件key")
private String assemblyKey; private String assemblyKey;
/* @ApiModelProperty(value = "业务id") @ApiModelProperty(value = "父级id")
private String bizId;*/ @TableField(exist = false)
private String parentId;
} }
package com.syc.slm.slmbi.function;
import java.io.Serializable;
/**
* Created by Yeshirow on 2018-01-16.
*/
public interface Action1<T> extends Serializable {
void call(T t);
@SafeVarargs
static <T1>Action1<T1>[] of(Action1<T1>... funcs){
return funcs;
}
}
package com.syc.slm.slmbi.function;
import java.io.Serializable;
/**
* Created by Yeshirow on 2018-01-16.
*/
public interface Action2<T1,T2> extends Serializable {
void call(T1 t1, T2 t2);
@SafeVarargs
static <T1,T2>Action2<T1,T2>[] of(Action2<T1, T2>... funcs){
return funcs;
}
}
...@@ -31,8 +31,10 @@ public interface InstrumentPanelConfigService extends IService<InstrumentPanelCo ...@@ -31,8 +31,10 @@ public interface InstrumentPanelConfigService extends IService<InstrumentPanelCo
* @return * @return
*/ */
InstrumentPanelConfigVo getConfigByPanelId(@NotNull String instrumentPanelId); InstrumentPanelConfigVo getConfigByPanelId(@NotNull String instrumentPanelId);
/** /**
* 保存发布仪表板配置 * 保存发布仪表板配置
* @param appId
* @param config * @param config
* @return * @return
*/ */
...@@ -49,6 +51,7 @@ public interface InstrumentPanelConfigService extends IService<InstrumentPanelCo ...@@ -49,6 +51,7 @@ public interface InstrumentPanelConfigService extends IService<InstrumentPanelCo
/** /**
* 根据仪表板id删除仪表板配置 * 根据仪表板id删除仪表板配置
* @param panelId * @param panelId
* @param publishedStatus
*/ */
void delConfig(@NotNull String panelId,Integer publishedStatus); void delConfig(@NotNull String panelId,Integer publishedStatus);
...@@ -65,4 +68,19 @@ public interface InstrumentPanelConfigService extends IService<InstrumentPanelCo ...@@ -65,4 +68,19 @@ public interface InstrumentPanelConfigService extends IService<InstrumentPanelCo
* @param ids * @param ids
*/ */
void publishConfigByPanelIds(List<String> ids); void publishConfigByPanelIds(List<String> ids);
/**
* 根据仪表板id以及状态获取仪表板配置
* @param panelId
* @param publishStatus
* @return
*/
List<InstrumentPanelConfig> getConfigByPanelIdAndPublishStatus(String panelId,Integer publishStatus);
/**
* 下线仪表盘配置
* @param panelId
* @param publishStatus
*/
void offlineConfig(String panelId, Integer publishStatus);
} }
...@@ -5,6 +5,7 @@ import com.syc.slm.slmbi.entity.InstrumentPanel; ...@@ -5,6 +5,7 @@ import com.syc.slm.slmbi.entity.InstrumentPanel;
import com.syc.slm.slmbi.entity.InstrumentPanelDraft; import com.syc.slm.slmbi.entity.InstrumentPanelDraft;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 仪表板草稿 * 仪表板草稿
...@@ -19,4 +20,29 @@ public interface InstrumentPanelDraftService extends IService<InstrumentPanelDra ...@@ -19,4 +20,29 @@ public interface InstrumentPanelDraftService extends IService<InstrumentPanelDra
* @param panels * @param panels
*/ */
void saveDrafts(List<InstrumentPanel> panels); void saveDrafts(List<InstrumentPanel> panels);
/**
* 根据仪表板id获取 仪表板草稿
* @param panelIds
* @return
*/
List<InstrumentPanelDraft> getByIds(Set<String> panelIds);
/**
* 获取仪表板信息
* @param appId
* @param panelIds
* @param officeIds
* @param userId
* @param roleId
* @return
*/
List<InstrumentPanelDraft> selectDraftList(String appId,Set<String> panelIds, String officeIds, String userId, String roleId);
/**
* 根据仪表板id获取 仪表板草稿
* @param panelId
* @return
*/
InstrumentPanelDraft getByPanelId(String panelId);
} }
...@@ -8,6 +8,7 @@ import com.syc.slm.slmbi.vo.PanelTreeNodeVo; ...@@ -8,6 +8,7 @@ import com.syc.slm.slmbi.vo.PanelTreeNodeVo;
import lombok.NonNull; import lombok.NonNull;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* slm-bi * slm-bi
...@@ -20,12 +21,15 @@ public interface InstrumentPanelGroupService extends IService<InstrumentPanelGro ...@@ -20,12 +21,15 @@ public interface InstrumentPanelGroupService extends IService<InstrumentPanelGro
/** /**
* 查询仪表板分组 * 查询仪表板分组
* @param appId
* @param name
* @return * @return
*/ */
List<InstrumentPanelGroupVo> selectGroupList(String appId,String name); List<InstrumentPanelGroupVo> selectGroupList(String appId, String name);
/** /**
* 删除仪表板分组 * 删除仪表板分组
*
* @param groupId * @param groupId
* @return * @return
*/ */
...@@ -34,29 +38,24 @@ public interface InstrumentPanelGroupService extends IService<InstrumentPanelGro ...@@ -34,29 +38,24 @@ public interface InstrumentPanelGroupService extends IService<InstrumentPanelGro
/** /**
* 修改仪表板分组 * 修改仪表板分组
* @param group * @param group
* @param appId
* @return * @return
*/ */
String updateGroup(@NonNull InstrumentPanelGroupDTO group); String updateGroup(@NonNull InstrumentPanelGroupDTO group,String appId);
/** /**
* 保存仪表板分组 * 保存仪表板分组
* @param group * @param group
* @param appId
* @return * @return
*/ */
String saveGroup(@NonNull InstrumentPanelGroupDTO group); String saveGroup(@NonNull InstrumentPanelGroupDTO group,String appId);
/**
* 加载仪表板树
* @param name
* @return
*/
List<PanelTreeNodeVo> loadTrees(String name);
/** /**
* 查询下一节点分组 * 根据分组id集合 已经名称批量查询仪表板分组
* @param groupId * @param finalPanelIds
* @param name * @param name
* @return * @return
*/ */
List<PanelTreeNodeVo> children(String groupId, String name); List<PanelTreeNodeVo> selectGroupByIds(Set<String> finalPanelIds,String name);
} }
...@@ -31,16 +31,16 @@ public interface InstrumentPanelPermissionService extends IService<InstrumentPan ...@@ -31,16 +31,16 @@ public interface InstrumentPanelPermissionService extends IService<InstrumentPan
* @param instrumentPanelId * @param instrumentPanelId
* @return * @return
*/ */
List<InstrumentPanelPermissionVo> saveCopyOtherPermission(@NonNull String instrumentPanelId); InstrumentPanelPermissionVo saveCopyOtherPermission(@NonNull String instrumentPanelId);
/** /**
* 将仪表板权限复制给其他仪表板 * 将仪表板权限复制给其他仪表板
* *
* @param permissions * @param permissions
* @param otherInstrumentPanelId * @param otherInstrumentPanelIds
* @return * @return
*/ */
String saveCopyToOtherPermission(InstrumentPanelPermissionDTO permissions, String otherInstrumentPanelId); void saveCopyToOtherPermission(InstrumentPanelPermissionDTO permissions, List<String> otherInstrumentPanelIds);
/** /**
* 根据仪表板id获取仪表板权限 * 根据仪表板id获取仪表板权限
...@@ -48,7 +48,7 @@ public interface InstrumentPanelPermissionService extends IService<InstrumentPan ...@@ -48,7 +48,7 @@ public interface InstrumentPanelPermissionService extends IService<InstrumentPan
* @param instrumentPanelId * @param instrumentPanelId
* @return * @return
*/ */
List<InstrumentPanelPermissionVo> selectPermissionByPanelId(@NonNull String instrumentPanelId); InstrumentPanelPermissionVo selectPermissionByPanelId(@NonNull String instrumentPanelId);
/** /**
* 根据仪表板id删除仪表板权限 * 根据仪表板id删除仪表板权限
...@@ -77,4 +77,18 @@ public interface InstrumentPanelPermissionService extends IService<InstrumentPan ...@@ -77,4 +77,18 @@ public interface InstrumentPanelPermissionService extends IService<InstrumentPan
* @param ids * @param ids
*/ */
void publishPermissionByPanelIds(List<String> ids); void publishPermissionByPanelIds(List<String> ids);
/**
* 根据仪表板id 以及 状态获取仪表板对应权限
* @param panelId
* @param publishStatus
* @return
*/
List<InstrumentPanelPermission> getPermissionByPanelIdAndPublishStatus(String panelId, Integer publishStatus);
/**
* 下线仪表板对应权限
* @param panelId
*/
void offlinePermission(String panelId);
} }
...@@ -7,6 +7,7 @@ import com.syc.slm.slmbi.dto.QueryInstrumentPanelDTO; ...@@ -7,6 +7,7 @@ import com.syc.slm.slmbi.dto.QueryInstrumentPanelDTO;
import com.syc.slm.slmbi.entity.InstrumentPanel; import com.syc.slm.slmbi.entity.InstrumentPanel;
import com.syc.slm.slmbi.vo.InstrumentPanelConfigVo; import com.syc.slm.slmbi.vo.InstrumentPanelConfigVo;
import com.syc.slm.slmbi.vo.InstrumentPanelVo; import com.syc.slm.slmbi.vo.InstrumentPanelVo;
import com.syc.slm.slmbi.vo.PanelTreeNodeVo;
import lombok.NonNull; import lombok.NonNull;
import java.util.List; import java.util.List;
...@@ -98,4 +99,8 @@ public interface InstrumentPanelService extends IService<InstrumentPanel> { ...@@ -98,4 +99,8 @@ public interface InstrumentPanelService extends IService<InstrumentPanel> {
* @param panelName * @param panelName
*/ */
void checkName(@NonNull String appId,String panelId,@NonNull String panelName); void checkName(@NonNull String appId,String panelId,@NonNull String panelName);
List<InstrumentPanel> getByIds(Set<String> panelIds);
List<PanelTreeNodeVo> selectPanelByIds(Set<String> finalPanelIds,String name);
} }
...@@ -2,9 +2,8 @@ package com.syc.slm.slmbi.service; ...@@ -2,9 +2,8 @@ package com.syc.slm.slmbi.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.syc.slm.slmbi.dto.InstrumentPanelAssemblyDTO; import com.syc.slm.slmbi.dto.InstrumentPanelAssemblyDTO;
import com.syc.slm.slmbi.entity.InstrumentPanel;
import com.syc.slm.slmbi.entity.InstrumentPanelTree; import com.syc.slm.slmbi.entity.InstrumentPanelTree;
import lombok.NonNull; import com.syc.slm.slmbi.vo.PanelTreeNodeVo;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -58,4 +57,51 @@ public interface InstrumentPanelTreeService extends IService<InstrumentPanelTree ...@@ -58,4 +57,51 @@ public interface InstrumentPanelTreeService extends IService<InstrumentPanelTree
* @param groupId * @param groupId
*/ */
void updatePanelTreeFullName(String panelId,String panelName,String groupId) ; void updatePanelTreeFullName(String panelId,String panelName,String groupId) ;
/**
* 加载树
* @param appId
* @param name
* @return
*/
List<PanelTreeNodeVo> loadTrees(String appId, String name);
/**
* 加载树
* @param appId
* @return
*/
List<PanelTreeNodeVo> loadTrees(String appId);
/**
* 加载树节点下一节点
* @param groupId
* @param name
* @return
*/
List<PanelTreeNodeVo> children(String groupId, String name);
/**
* 根据仪表板分组id更新 fullId fullName
* @param groupId
* @param panelId
* @param panelName
*/
void updateFullNameByGroupId(String groupId, String panelId, String panelName);
/**
* 复制仪表板配置显示的仪表板树
* @param appId
* @param name
* @return
*/
List<PanelTreeNodeVo> copyTreeList(String appId,String name);
/**
* 复用仪表板树
* @param appId
* @param name
* @return
*/
List<PanelTreeNodeVo> citeTreeList(String appId, String name);
} }
...@@ -21,12 +21,15 @@ import org.springframework.beans.BeanUtils; ...@@ -21,12 +21,15 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.yaml.snakeyaml.events.Event;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -63,7 +66,7 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane ...@@ -63,7 +66,7 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public InstrumentPanelConfigVo getConfigByPanelId(String instrumentPanelId) { public InstrumentPanelConfigVo getConfigByPanelId(String instrumentPanelId) {
InstrumentPanelDraft draft = draftService.getById(instrumentPanelId); InstrumentPanelDraft draft = draftService.getByPanelId(instrumentPanelId);
return getInstrumentPanelConfigVo(instrumentPanelId, return getInstrumentPanelConfigVo(instrumentPanelId,
ObjectUtils.isNotEmpty(draft) ? PublishedStatus.PUBLISHED : ObjectUtils.isNotEmpty(draft) ? PublishedStatus.PUBLISHED :
PublishedStatus.WAIT_PUBLISHED); PublishedStatus.WAIT_PUBLISHED);
...@@ -92,7 +95,7 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane ...@@ -92,7 +95,7 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane
log.info("更新仪表板树"); log.info("更新仪表板树");
updateTree(config, panel); updateTree(config, panel);
InstrumentPanelDraft draft = draftService.getById(panel.getId()); InstrumentPanelDraft draft = draftService.getByPanelId(panel.getId());
if (ObjectUtils.isNotEmpty(draft)) { if (ObjectUtils.isNotEmpty(draft)) {
BeanUtils.copyProperties(panel, draft); BeanUtils.copyProperties(panel, draft);
draftService.updateById(draft); draftService.updateById(draft);
...@@ -115,7 +118,7 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane ...@@ -115,7 +118,7 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane
fillPanelProp(permission, panel); fillPanelProp(permission, panel);
//判断是否有发布版本 //判断是否有发布版本
InstrumentPanelDraft draft = draftService.getById(panel.getId()); InstrumentPanelDraft draft = draftService.getByPanelId(panel.getId());
if (ObjectUtils.isNotEmpty(draft)) { if (ObjectUtils.isNotEmpty(draft)) {
log.info("保存配置详情"); log.info("保存配置详情");
savePanelConfig(panel.getId(), config.getConfigDetails(), PublishedStatus.WAIT_PUBLISHED.value); savePanelConfig(panel.getId(), config.getConfigDetails(), PublishedStatus.WAIT_PUBLISHED.value);
...@@ -164,13 +167,7 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane ...@@ -164,13 +167,7 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane
@Override @Override
public void delConfig(@NotNull String panelId, Integer publishedStatus) { public void delConfig(@NotNull String panelId, Integer publishedStatus) {
LambdaQueryWrapper<InstrumentPanelConfig> where = new LambdaQueryWrapper<>(); List<InstrumentPanelConfig> configs = getConfigByPanelIdAndPublishStatus(panelId,publishedStatus);
where.eq(InstrumentPanelConfig::getRecordStatus, SlmConstants.DATA_VALID);
where.eq(InstrumentPanelConfig::getPanelId, panelId);
if (publishedStatus != null) {
where.eq(InstrumentPanelConfig::getPublished, publishedStatus);
}
List<InstrumentPanelConfig> configs = baseMapper.selectList(where);
if (CollectionUtils.isNotEmpty(configs)) { if (CollectionUtils.isNotEmpty(configs)) {
configs.forEach(x -> { configs.forEach(x -> {
x.setRecordStatus(SlmConstants.DATA_DELETED); x.setRecordStatus(SlmConstants.DATA_DELETED);
...@@ -201,20 +198,17 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane ...@@ -201,20 +198,17 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane
where.in(InstrumentPanelConfig::getPanelId, ids); where.in(InstrumentPanelConfig::getPanelId, ids);
List<InstrumentPanelConfig> configs = baseMapper.selectList(where); List<InstrumentPanelConfig> configs = baseMapper.selectList(where);
if (CollectionUtils.isNotEmpty(configs)) { if (CollectionUtils.isNotEmpty(configs)) {
List<InstrumentPanelConfig> waitPublishConfigs = Map<String, List<InstrumentPanelConfig>> configMaps = configs.stream().collect(Collectors.groupingBy(InstrumentPanelConfig::getPanelId));
configs.stream().filter(x -> PublishedStatus.WAIT_PUBLISHED.value.equals(x.getPublished())).collect( if(CollectionUtils.isNotEmpty(configMaps)){
Collectors.toList()); configMaps.forEach((k,v)->{
if (CollectionUtils.isNotEmpty(waitPublishConfigs)) { List<InstrumentPanelConfig> waitPublishConfigs = configs.stream().filter(x -> PublishedStatus.WAIT_PUBLISHED.value.equals(x.getPublished())).collect(Collectors.toList());
List<InstrumentPanelConfig> publishConfigs = configs.stream().filter(x -> PublishedStatus.PUBLISHED.value.equals(x.getPublished())).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(waitPublishConfigs)){
waitPublishConfigs.forEach(x -> { waitPublishConfigs.forEach(x -> {
x.setPublished(PublishedStatus.PUBLISHED.value); x.setPublished(PublishedStatus.PUBLISHED.value);
baseMapper.updateById(x); baseMapper.updateById(x);
}); });
} if(CollectionUtils.isNotEmpty(publishConfigs)){
List<InstrumentPanelConfig> publishConfigs =
configs.stream().filter(x -> PublishedStatus.PUBLISHED.value.equals(x.getPublished())).collect(
Collectors.toList());
if (CollectionUtils.isNotEmpty(publishConfigs)) {
publishConfigs.forEach(x -> { publishConfigs.forEach(x -> {
x.setRecordStatus(SlmConstants.DATA_DELETED); x.setRecordStatus(SlmConstants.DATA_DELETED);
baseMapper.updateById(x); baseMapper.updateById(x);
...@@ -222,6 +216,56 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane ...@@ -222,6 +216,56 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane
} }
} }
});
}
}
}
@Override
@Transactional(readOnly = true)
public List<InstrumentPanelConfig> getConfigByPanelIdAndPublishStatus(String panelId, Integer publishStatus) {
LambdaQueryWrapper<InstrumentPanelConfig> where = new LambdaQueryWrapper<>();
where.eq(BaseEntity::getRecordStatus, SlmConstants.DATA_VALID);
where.eq(InstrumentPanelConfig::getPanelId, panelId);
if(publishStatus!=null) {
where.eq(InstrumentPanelConfig::getPublished, publishStatus);
}
return baseMapper.selectList(where);
}
@Override
public void offlineConfig(String panelId, Integer publishStatus) {
List<InstrumentPanelConfig> configs = getConfigByPanelIdAndPublishStatus(panelId, publishStatus);
InstrumentPanelConfig waitConfig = configs.stream()
.filter(x -> PublishedStatus.WAIT_PUBLISHED.value.equals(x.getPublished()))
.findFirst()
.orElse(null);
if(ObjectUtils.isNotEmpty(waitConfig)){
InstrumentPanelConfig publishConfig =
configs.stream().filter(x -> PublishedStatus.PUBLISHED.value.equals(x.getPublished())).findFirst().orElse(null);
if(ObjectUtils.isNotEmpty(publishConfig)){
publishConfig.setRecordStatus(SlmConstants.DATA_DELETED);
baseMapper.updateById(publishConfig);
}
}else{
InstrumentPanelConfig pushConfig = configs.stream()
.filter(x -> PublishedStatus.PUBLISHED.value.equals(x.getPublished()))
.findFirst()
.orElse(null);
if(ObjectUtils.isNotEmpty(pushConfig)){
InstrumentPanelConfig config = new InstrumentPanelConfig();
BeanUtils.copyProperties(pushConfig,config);
config.setPublished(PublishedStatus.WAIT_PUBLISHED.value);
config.setId(IdWorker.get32UUID());
baseMapper.insert(config);
pushConfig.setRecordStatus(SlmConstants.DATA_DELETED);
baseMapper.updateById(pushConfig);
}
}
} }
private InstrumentPanelConfigVo getInstrumentPanelConfigVo(String instrumentPanelId, PublishedStatus published) { private InstrumentPanelConfigVo getInstrumentPanelConfigVo(String instrumentPanelId, PublishedStatus published) {
......
package com.syc.slm.slmbi.service.impl; 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.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.syc.slm.common.core.constant.SlmConstants; import com.syc.slm.common.core.constant.SlmConstants;
...@@ -13,6 +16,7 @@ import com.syc.slm.slmbi.service.InstrumentPanelDraftService; ...@@ -13,6 +16,7 @@ import com.syc.slm.slmbi.service.InstrumentPanelDraftService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -28,21 +32,47 @@ public class InstrumentPanelDraftServiceImpl extends ServiceImpl<InstrumentPanel ...@@ -28,21 +32,47 @@ public class InstrumentPanelDraftServiceImpl extends ServiceImpl<InstrumentPanel
@Override @Override
public void saveDrafts(List<InstrumentPanel> panels) { public void saveDrafts(List<InstrumentPanel> panels) {
if(CollectionUtils.isNotEmpty(panels)){ if (CollectionUtils.isNotEmpty(panels)) {
List<InstrumentPanelDraft> drafts= SlmConstants.gson.fromJson(SlmConstants.gson.toJson(panels), List<InstrumentPanelDraft> drafts = SlmConstants.gson.fromJson(SlmConstants.gson.toJson(panels), new TypeToken<List<InstrumentPanelDraft>>() {
new TypeToken<List<InstrumentPanelDraft>>() {
}.getType()); }.getType());
List<InstrumentPanelDraft> panelDrafts = baseMapper.selectBatchIds(panels.stream() if (CollectionUtils.isNotEmpty(drafts)) {
.map(InstrumentPanel::getId) List<InstrumentPanelDraft> panelDrafts = getByIds(panels.stream().map(InstrumentPanel::getId).collect(Collectors.toSet()));
.collect(Collectors.toList())); Map<String, String> maps = CollectionUtils.isNotEmpty(panelDrafts) ? panelDrafts.stream().collect(
Set<String> idSets= CollectionUtils.isNotEmpty(panelDrafts)?panelDrafts.stream().map(BaseEntity::getId).collect(Collectors.toSet()): Sets.newHashSet(); Collectors.toMap(InstrumentPanelDraft::getPanelId, BaseEntity::getId)) : Maps.newHashMap();
drafts.forEach(x->{ drafts.forEach(x -> {
if(idSets.contains(x.getId())){ x.setPanelId(x.getId());
if (maps.containsKey(x.getId())) {
x.setId(maps.get(x.getId()));
baseMapper.updateById(x); baseMapper.updateById(x);
}else{ } else {
x.setId(IdWorker.get32UUID());
baseMapper.insert(x); baseMapper.insert(x);
} }
}); });
} }
} }
}
@Override
public List<InstrumentPanelDraft> getByIds(Set<String> panelIds) {
LambdaQueryWrapper<InstrumentPanelDraft> where = new LambdaQueryWrapper<>();
where.eq(BaseEntity::getRecordStatus, SlmConstants.DATA_VALID);
where.in(InstrumentPanelDraft::getPanelId, panelIds);
return baseMapper.selectList(where);
}
@Override
public List<InstrumentPanelDraft> selectDraftList(String appId,
Set<String> panelIds,
String officeIds,
String userId,
String roleId) {
return baseMapper.selectDraftList(appId, panelIds, officeIds, userId, roleId);
}
@Override
public InstrumentPanelDraft getByPanelId(String panelId) {
List<InstrumentPanelDraft> drafts = getByIds(Sets.newHashSet(panelId));
return CollectionUtils.isNotEmpty(drafts)?drafts.get(0):null;
}
} }
...@@ -13,6 +13,7 @@ import com.syc.slm.slmbi.entity.InstrumentPanelGroup; ...@@ -13,6 +13,7 @@ import com.syc.slm.slmbi.entity.InstrumentPanelGroup;
import com.syc.slm.slmbi.entity.InstrumentPanelTree; import com.syc.slm.slmbi.entity.InstrumentPanelTree;
import com.syc.slm.slmbi.enums.NodeType; import com.syc.slm.slmbi.enums.NodeType;
import com.syc.slm.slmbi.exception.SysException; import com.syc.slm.slmbi.exception.SysException;
import com.syc.slm.slmbi.function.Action2;
import com.syc.slm.slmbi.service.InstrumentPanelGroupService; import com.syc.slm.slmbi.service.InstrumentPanelGroupService;
import com.syc.slm.slmbi.service.InstrumentPanelService; import com.syc.slm.slmbi.service.InstrumentPanelService;
import com.syc.slm.slmbi.service.InstrumentPanelTreeService; import com.syc.slm.slmbi.service.InstrumentPanelTreeService;
...@@ -93,49 +94,50 @@ public class InstrumentPanelGroupServiceImpl extends ServiceImpl<InstrumentPanel ...@@ -93,49 +94,50 @@ public class InstrumentPanelGroupServiceImpl extends ServiceImpl<InstrumentPanel
tree.setRecordStatus(SlmConstants.DATA_DELETED); tree.setRecordStatus(SlmConstants.DATA_DELETED);
treeService.updateById(tree); treeService.updateById(tree);
log.info("查询该仪表板树下的子节点"); log.info("查询该仪表板树下的子节点");
List<InstrumentPanelTree> instrumentPanelTrees = getInstrumentPanelTrees.apply(tree.getFullId()); List<InstrumentPanelTree> children = getInstrumentPanelTrees.apply(tree.getFullId());
if (CollectionUtils.isNotEmpty(instrumentPanelTrees)) { if (CollectionUtils.isNotEmpty(children)) {
Set<String> treeIds = instrumentPanelTrees.stream().map(BaseEntity::getId).collect(Collectors.toSet()); Set<String> childrenIds = children.stream().map(BaseEntity::getId).collect(Collectors.toSet());
log.info("删除该仪表板树下的子节点"); log.info("删除该仪表板树下的子节点");
treeService.batchUpdateTreeByIds(treeIds, SlmConstants.DATA_DELETED); treeService.batchUpdateTreeByIds(childrenIds, SlmConstants.DATA_DELETED);
log.info("删除子分组"); log.info("删除子分组");
delChildrenGroups.accept(instrumentPanelTrees); delChildrenGroups.accept(children);
log.info("删除各个分组下的仪表板"); log.info("删除各个分组下的仪表板");
delPanelByIds.accept(instrumentPanelTrees); delPanelByIds.accept(children);
} }
return groupId; return groupId;
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String updateGroup(@NonNull InstrumentPanelGroupDTO group) { public String updateGroup(@NonNull InstrumentPanelGroupDTO group,String appId) {
if(StringUtils.isEmpty(group.getName())){ if(StringUtils.isEmpty(group.getName())){
throw new SysException("仪表板分组名称必填"); throw new SysException("仪表板分组名称必填");
} }
log.info("检查分组名字是否重复"); log.info("检查分组名字是否重复");
checkedRepeatName.accept(group); checkedRepeatName.call(group,appId);
InstrumentPanelGroup instrumentPanelGroup = new InstrumentPanelGroup(); InstrumentPanelGroup entity = new InstrumentPanelGroup();
BeanUtils.copyProperties(group, instrumentPanelGroup); BeanUtils.copyProperties(group, entity);
baseMapper.updateById(instrumentPanelGroup); baseMapper.updateById(entity);
log.info("更新分组在仪表盘树中的全路径"); log.info("更新分组在仪表盘树中的全路径");
InstrumentPanelTree tree = treeService.getById(instrumentPanelGroup.getId()); InstrumentPanelTree tree = treeService.getById(entity.getId());
String beforeFullName = tree.getFullName(); String beforeFullName = tree.getFullName();
String beforeFullId = tree.getFullId(); String beforeFullId = tree.getFullId();
InstrumentPanelTree panelTree = treeService.getById(group.getParentId()); InstrumentPanelTree panelTree = treeService.getById(group.getParentId());
tree.setFullName(panelTree.getFullName() + "." + instrumentPanelGroup.getName()); tree.setFullName(panelTree.getFullName() + "." + entity.getName());
tree.setFullId(panelTree.getFullId() + "." + instrumentPanelGroup.getId()); tree.setFullId(panelTree.getFullId() + "." + entity.getId());
tree.setName(entity.getName());
treeService.updateById(tree); treeService.updateById(tree);
log.info("重新构建该分组下的仪表板树全路径"); log.info("重新构建该分组下的仪表板树全路径");
List<InstrumentPanelTree> instrumentPanelTrees = getInstrumentPanelTrees.apply(beforeFullId); List<InstrumentPanelTree> children = getInstrumentPanelTrees.apply(beforeFullId);
instrumentPanelTrees.forEach(x -> { children.forEach(x -> {
x.setFullId(x.getFullId().replace(beforeFullId, tree.getFullId())); x.setFullId(x.getFullId().replace(beforeFullId, tree.getFullId()));
x.setFullName(tree.getFullName()+"." + x.getFullName() x.setFullName(tree.getFullName()+"." + x.getFullName()
.substring(x.getFullName().lastIndexOf(beforeFullName))); .substring(beforeFullName.length()+1));
treeService.updateById(x); treeService.updateById(x);
}); });
...@@ -144,52 +146,49 @@ public class InstrumentPanelGroupServiceImpl extends ServiceImpl<InstrumentPanel ...@@ -144,52 +146,49 @@ public class InstrumentPanelGroupServiceImpl extends ServiceImpl<InstrumentPanel
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String saveGroup(@NonNull InstrumentPanelGroupDTO group) { public String saveGroup(@NonNull InstrumentPanelGroupDTO group,String appId) {
if(StringUtils.isEmpty(group.getName())){ if(StringUtils.isEmpty(group.getName())){
throw new SysException("仪表板分组名称必填"); throw new SysException("仪表板分组名称必填");
} }
log.info("校验名字是否重复"); log.info("校验名字是否重复");
checkedRepeatName.accept(group); checkedRepeatName.call(group,appId);
log.info("新增仪表板分组"); log.info("新增仪表板分组");
InstrumentPanelGroup instrumentPanelGroup = new InstrumentPanelGroup(); InstrumentPanelGroup entity = new InstrumentPanelGroup();
BeanUtils.copyProperties(group, instrumentPanelGroup); BeanUtils.copyProperties(group, entity);
instrumentPanelGroup.setId(IdWorker.get32UUID()); entity.setId(IdWorker.get32UUID());
baseMapper.insert(instrumentPanelGroup); baseMapper.insert(entity);
log.info("构建仪表板树 聚合表"); log.info("构建仪表板树 聚合表");
InstrumentPanelTree tree = new InstrumentPanelTree(); InstrumentPanelTree tree = new InstrumentPanelTree();
tree.setId(instrumentPanelGroup.getId()); tree.setId(entity.getId());
if (StringUtils.isNotEmpty(group.getParentId())) { if (StringUtils.isNotEmpty(group.getParentId())) {
InstrumentPanelTree panelTree = treeService.getById(group.getParentId()); InstrumentPanelTree panelTree = treeService.getById(group.getParentId());
if (SlmConstants.DATA_DELETED.equals(panelTree.getRecordStatus())) { if (SlmConstants.DATA_DELETED.equals(panelTree.getRecordStatus())) {
throw new SysException(panelTree.getFullName().substring(group.getParentId().lastIndexOf(".") + 1) throw new SysException(panelTree.getName() + ",已不存在,请刷新页面");
+ ",已不存在,请刷新页面");
} }
tree.setFullId(panelTree.getFullId() + "." + instrumentPanelGroup.getId()); tree.setFullId(panelTree.getFullId() + "." + entity.getId());
tree.setFullName(panelTree.getFullName() + "." + instrumentPanelGroup.getName()); tree.setFullName(panelTree.getFullName() + "." + entity.getName());
} else { } else {
//顶级分组 //顶级分组
log.info("重新构建该分组下的仪表板树全路径"); log.info("重新构建该分组下的仪表板树全路径");
tree.setFullId(instrumentPanelGroup.getId()); tree.setFullId(entity.getId());
tree.setFullName(instrumentPanelGroup.getName()); tree.setFullName(entity.getName());
} }
tree.setNodeType(NodeType.GROUP.value); tree.setNodeType(NodeType.GROUP.value);
tree.setName(entity.getName());
treeService.save(tree); treeService.save(tree);
return instrumentPanelGroup.getId(); return entity.getId();
} }
@Override @Override
public List<PanelTreeNodeVo> loadTrees(String name) { public List<PanelTreeNodeVo> selectGroupByIds(Set<String> finalPanelIds,String name) {
return null; return baseMapper.selectGroupByIds(finalPanelIds,name);
} }
@Override private Action2<InstrumentPanelGroupDTO,String> checkedRepeatName=(group,appId)-> {
public List<PanelTreeNodeVo> children(String groupId, String name) {
return null;
}
private Consumer<InstrumentPanelGroupDTO> checkedRepeatName = (group) -> {
LambdaQueryWrapper<InstrumentPanelGroup> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<InstrumentPanelGroup> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(InstrumentPanelGroup::getName, group.getName()); wrapper.eq(InstrumentPanelGroup::getName, group.getName());
wrapper.eq(BaseEntity::getAppId, appId);
wrapper.eq(BaseEntity::getRecordStatus, SlmConstants.DATA_VALID);
if (StringUtils.isNotEmpty(group.getId())) { if (StringUtils.isNotEmpty(group.getId())) {
wrapper.ne(InstrumentPanelGroup::getId, group.getId()); wrapper.ne(InstrumentPanelGroup::getId, group.getId());
} }
...@@ -198,8 +197,9 @@ public class InstrumentPanelGroupServiceImpl extends ServiceImpl<InstrumentPanel ...@@ -198,8 +197,9 @@ public class InstrumentPanelGroupServiceImpl extends ServiceImpl<InstrumentPanel
} }
}; };
private Consumer<List<InstrumentPanelTree>> delChildrenGroups = (instrumentPanelTrees) -> {
Set<String> groupIds = instrumentPanelTrees.stream() private Consumer<List<InstrumentPanelTree>> delChildrenGroups = (trees) -> {
Set<String> groupIds = trees.stream()
.filter(x -> NodeType.GROUP.value.equals(x.getNodeType())) .filter(x -> NodeType.GROUP.value.equals(x.getNodeType()))
.map(BaseEntity::getId) .map(BaseEntity::getId)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
...@@ -210,12 +210,14 @@ public class InstrumentPanelGroupServiceImpl extends ServiceImpl<InstrumentPanel ...@@ -210,12 +210,14 @@ public class InstrumentPanelGroupServiceImpl extends ServiceImpl<InstrumentPanel
} }
}; };
private Consumer<List<InstrumentPanelTree>> delPanelByIds = (instrumentPanelTrees) -> { private Consumer<List<InstrumentPanelTree>> delPanelByIds = (trees) -> {
Set<String> panelIds = instrumentPanelTrees.stream() Set<String> panelIds = trees.stream()
.filter(x -> NodeType.PANEL.value.equals(x.getNodeType())) .filter(x -> NodeType.PANEL.value.equals(x.getNodeType()))
.map(BaseEntity::getId) .map(BaseEntity::getId)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
if(CollectionUtils.isNotEmpty(panelIds)) {
panelService.batchUpdatePanelByIds(panelIds, SlmConstants.DATA_DELETED); panelService.batchUpdatePanelByIds(panelIds, SlmConstants.DATA_DELETED);
}
}; };
private Function<String, List<InstrumentPanelTree>> getInstrumentPanelTrees = (fullId) -> { private Function<String, List<InstrumentPanelTree>> getInstrumentPanelTrees = (fullId) -> {
......
...@@ -22,6 +22,7 @@ import com.syc.slm.slmbi.exception.SysException; ...@@ -22,6 +22,7 @@ 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.InstrumentPanelConfigVo; import com.syc.slm.slmbi.vo.InstrumentPanelConfigVo;
import com.syc.slm.slmbi.vo.InstrumentPanelVo; import com.syc.slm.slmbi.vo.InstrumentPanelVo;
import com.syc.slm.slmbi.vo.PanelTreeNodeVo;
import lombok.NonNull; import lombok.NonNull;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -57,31 +58,31 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe ...@@ -57,31 +58,31 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public IPage<InstrumentPanelVo> selectInstrumentPanelList(String appId, QueryInstrumentPanelDTO where) { public IPage<InstrumentPanelVo> selectInstrumentPanelList(String appId, QueryInstrumentPanelDTO query) {
IPage<InstrumentPanelVo> page = new Page<>(where.getPageNum(), where.getPageSize()); IPage<InstrumentPanelVo> page = new Page<>(query.getCurrent(), query.getSize());
QueryWrapper<InstrumentPanel> wrapper = new QueryWrapper<>(); QueryWrapper<InstrumentPanel> where = new QueryWrapper<>();
wrapper.eq("p.app_id", appId); where.eq("p.app_id", appId);
wrapper.eq("p.group_id", where.getGroupId()); where.eq("p.group_id", query.getGroupId());
wrapper.eq("p.record_status", SlmConstants.DATA_VALID); where.eq("p.record_status", SlmConstants.DATA_VALID);
if (StringUtils.isNotEmpty(where.getName())) { if (StringUtils.isNotEmpty(query.getName())) {
wrapper.like("p.name", where.getName()); where.like("p.name", query.getName());
} }
if (StringUtils.isNotEmpty(where.getCreatorName())) { if (StringUtils.isNotEmpty(query.getCreatorName())) {
wrapper.like("p.creator_name", where.getCreatorName()); where.like("p.creator_name", query.getCreatorName());
} }
if (StringUtils.isNotEmpty(where.getUpdaterName())) { if (StringUtils.isNotEmpty(query.getUpdaterName())) {
wrapper.like("p.updater_name", where.getUpdaterName()); where.like("p.updater_name", query.getUpdaterName());
} }
if (where.getPublished() != null) { if (query.getPublished() != null) {
wrapper.eq("p.published", where.getPublished()); where.eq("p.published", query.getPublished());
} }
if (where.getUpdateTimeBegin() != null) { if (query.getUpdateTimeBegin() != null) {
wrapper.gt("p.update_time", where.getUpdateTimeBegin()); where.ge("p.update_time", query.getUpdateTimeBegin());
} }
if (where.getUpdateTimeEnd() != null) { if (query.getUpdateTimeEnd() != null) {
wrapper.lt("p.update_time", where.getUpdateTimeEnd()); where.le("p.update_time", query.getUpdateTimeEnd());
} }
return baseMapper.selectInstrumentPanelList(page, wrapper); return baseMapper.selectInstrumentPanelList(page, where);
} }
@Override @Override
...@@ -129,9 +130,8 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe ...@@ -129,9 +130,8 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
log.info("删除该仪表板下的配置"); log.info("删除该仪表板下的配置");
delAllSetting(id); delAllSetting(id);
log.info("删除仪表板草稿表"); log.info("删除仪表板草稿表");
InstrumentPanelDraft draft = new InstrumentPanelDraft(); InstrumentPanelDraft draft =draftService.getByPanelId(id);
draft.setRecordStatus(SlmConstants.DATA_DELETED); draft.setRecordStatus(SlmConstants.DATA_DELETED);
draft.setId(id);
draftService.updateById(draft); draftService.updateById(draft);
return id; return id;
} }
...@@ -146,7 +146,7 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe ...@@ -146,7 +146,7 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Boolean showRecoveryBtn(String id) { public Boolean showRecoveryBtn(String id) {
return draftService.getById(id) != null; return draftService.getByPanelId(id) != null;
} }
@Override @Override
...@@ -168,14 +168,22 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe ...@@ -168,14 +168,22 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
if (SlmConstants.DATA_DELETED.equals(panel.getRecordStatus())) { if (SlmConstants.DATA_DELETED.equals(panel.getRecordStatus())) {
throw new SysException("该数据已被删除,请刷新页面"); throw new SysException("该数据已被删除,请刷新页面");
} }
panel.setPublished(PublishedStatus.OFFLINE.value); if(PublishedStatus.WAIT_PUBLISHED.value.equals(panel.getPublished())){
// panel.setRecordStatus(SlmConstants.DATA_DELETED); throw new SysException("该仪表板已被下线,请刷新页面");
}
panel.setPublished(PublishedStatus.WAIT_PUBLISHED.value);
baseMapper.updateById(panel); baseMapper.updateById(panel);
// log.info("删除配置"); log.info("删除草稿");
// log.info("删除权限"); InstrumentPanelDraft draft = draftService.getByPanelId(panel.getId());
// log.info("删除草稿"); if(ObjectUtils.isNotEmpty(draft)){
// log.info("删除仪表板树"); draft.setRecordStatus(SlmConstants.DATA_DELETED);
// delAllSetting(id); draftService.updateById(draft);
}
log.info("更新仪表板配置为待发布状态");
configService.offlineConfig(panel.getId(), null);
log.info("更新仪表板权限为待发布状态");
permissionService.offlinePermission(panel.getId());
return id; return id;
} }
...@@ -200,6 +208,16 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe ...@@ -200,6 +208,16 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
} }
} }
@Override
public List<InstrumentPanel> getByIds(Set<String> panelIds) {
return baseMapper.selectBatchIds(panelIds);
}
@Override
public List<PanelTreeNodeVo> selectPanelByIds(Set<String> finalPanelIds,String name) {
return baseMapper.selectPanelByIds(finalPanelIds,name);
}
private String savePanelData(String appId, SaveInstrumentPanelDTO panel) { private String savePanelData(String appId, SaveInstrumentPanelDTO panel) {
if (StringUtils.isEmpty(panel.getName())) { if (StringUtils.isEmpty(panel.getName())) {
throw new SysException("仪表板名字必填"); throw new SysException("仪表板名字必填");
...@@ -213,21 +231,11 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe ...@@ -213,21 +231,11 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
log.info("保存仪表板访问权限"); log.info("保存仪表板访问权限");
String panelId = IdWorker.get32UUID(); String panelId = IdWorker.get32UUID();
String accessType = AccessType.PUBLIC.value; String accessType = AccessType.PUBLIC.value;
if (ObjectUtils.isNotEmpty(panel.getPermission()) && StringUtils.isNotEmpty(panel.getPermission() if (ObjectUtils.isNotEmpty(panel.getPermission()) && StringUtils.isNotEmpty(panel.getPermission().getAccessType())) {
.getAccessType())) {
accessType = panel.getPermission().getAccessType(); accessType = panel.getPermission().getAccessType();
permissionService.savePanelPermission(panel.getPermission().getCustomPermissions(), permissionService.savePanelPermission(panel.getPermission().getCustomPermissions(),panelId,panel.getPermission().getAccessType(),PublishedStatus.WAIT_PUBLISHED.value);
panelId,
panel.getPermission().getAccessType(),
PublishedStatus.WAIT_PUBLISHED.value);
} }
InstrumentPanel entity = new InstrumentPanel(panelId,panel.getName(),panel.getGroupId(),accessType,PublishedStatus.WAIT_PUBLISHED.value);
InstrumentPanel instrumentPanel = new InstrumentPanel(panelId,
panel.getName(),
panel.getGroupId(),
accessType,
PublishedStatus.WAIT_PUBLISHED.value);
log.info("保存仪表板配置"); log.info("保存仪表板配置");
if (StringUtils.isNotEmpty(panel.getConfigDetails())) { if (StringUtils.isNotEmpty(panel.getConfigDetails())) {
...@@ -235,20 +243,17 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe ...@@ -235,20 +243,17 @@ public class InstrumentPanelServiceImpl extends ServiceImpl<InstrumentPanelMappe
} }
log.info("初始化仪表板树"); log.info("初始化仪表板树");
treeService.initTree(instrumentPanel.getGroupId(), treeService.initTree(entity.getGroupId(),NodeType.PANEL.value,entity.getId(),entity.getName());
NodeType.PANEL.value,
instrumentPanel.getId(),
instrumentPanel.getName());
if (CollectionUtils.isNotEmpty(panel.getAssemblys())) { if (CollectionUtils.isNotEmpty(panel.getAssemblys())) {
InstrumentPanelTree tree = treeService.getById(instrumentPanel.getId()); InstrumentPanelTree tree = treeService.getById(entity.getId());
log.info("保存仪表板组件树"); log.info("保存仪表板组件树");
treeService.savePanelAssemblyTree(tree, panel.getAssemblys(), instrumentPanel.getId()); treeService.savePanelAssemblyTree(tree, panel.getAssemblys(), entity.getId());
} else { } else {
log.info("前端没有构建组件树"); log.info("前端没有构建组件树");
} }
log.info("保存仪表板数据"); log.info("保存仪表板数据");
baseMapper.insert(instrumentPanel); baseMapper.insert(entity);
return panelId; return panelId;
} }
......
package com.syc.slm.slmbi.vo; package com.syc.slm.slmbi.vo;
import com.syc.slm.slmbi.dto.CustomPermissionDTO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.List;
/** /**
* slm-bi * slm-bi
* 仪表板权限vo * 仪表板权限vo
...@@ -16,10 +19,10 @@ import lombok.EqualsAndHashCode; ...@@ -16,10 +19,10 @@ import lombok.EqualsAndHashCode;
@ApiModel(value = "仪表板权限Vo",description = "仪表板权限Vo") @ApiModel(value = "仪表板权限Vo",description = "仪表板权限Vo")
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper=false)
public class InstrumentPanelPermissionVo { public class InstrumentPanelPermissionVo {
@ApiModelProperty(value = "存储类型,1代表岗位,2代表部门,3 代表个体用户") @ApiModelProperty(value = "访问权限类型", required = true)
private Integer permissionType; private String accessType;
@ApiModelProperty(value = "代表岗位,部门,个体用户id")
private String bizId;
@ApiModelProperty(value = "代表岗位,部门,个体用户名称") @ApiModelProperty(value = "自定义权限配置,当访问类型为CUSTOM时必填")
private String bizName; private List<CustomPermissionVo> customPermissions;
} }
...@@ -24,5 +24,7 @@ public class PanelTreeNodeVo { ...@@ -24,5 +24,7 @@ public class PanelTreeNodeVo {
@ApiModelProperty(value = "节点名称") @ApiModelProperty(value = "节点名称")
private String name; private String name;
@ApiModelProperty(value = "节点类型") @ApiModelProperty(value = "节点类型")
private PanelTreeNodeType type; private String nodeType;
@ApiModelProperty(value = "组件对应key,分组跟仪表板该字段为空")
private String assemblyKey;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment