报告模板配置
This commit is contained in:
@@ -6,24 +6,18 @@ import lombok.Getter;
|
|||||||
* @author hany
|
* @author hany
|
||||||
* @date 2022/09/21
|
* @date 2022/09/21
|
||||||
*/
|
*/
|
||||||
@Getter
|
|
||||||
public enum TemplateTreeEnum {
|
public interface TemplateTreeEnum {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 各层级描述
|
* 权限资源状态 0-删除;1-正常;默认正常
|
||||||
*/
|
*/
|
||||||
REPORT_LEVEL(0, "报告基础项"),
|
int DELETE = 0;
|
||||||
LINE_LEVEL(1, "监测点"),
|
|
||||||
DETAIL_LEVEL(2, "监测点详情"),
|
|
||||||
TRANS_LEVEL(2, "暂降事件列表表格"),
|
|
||||||
TRANS_D_LEVEL(2, "暂降密度图形"),
|
|
||||||
TRANS_R_LEVEL(2, "暂降原因表格");
|
|
||||||
|
|
||||||
private final Integer code;
|
int ENABLE = 1;
|
||||||
private final String message;
|
|
||||||
|
|
||||||
TemplateTreeEnum(Integer code, String message) {
|
/**
|
||||||
this.code = code;
|
* 顶层父类的pid
|
||||||
this.message = message;
|
*/
|
||||||
}
|
String FATHER_PID = "0";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.njcn.system.pojo.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DictDTO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("组件Id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("组件Id")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("组件Id")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("组件Id")
|
||||||
|
private String reportDescribe;
|
||||||
|
|
||||||
|
@ApiModelProperty("组件Id")
|
||||||
|
private String pid;
|
||||||
|
|
||||||
|
@ApiModelProperty("组件Id")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@ApiModelProperty("子级")
|
||||||
|
List<DictDTO> children;
|
||||||
|
}
|
||||||
@@ -6,31 +6,32 @@ import com.njcn.web.pojo.param.BaseParam;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.hibernate.validator.constraints.Range;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class EventDictParam {
|
public class EventDictParam {
|
||||||
|
|
||||||
/**
|
|
||||||
* 字典表字段名称
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "字典表字段名称")
|
@ApiModelProperty(value = "字典表字段名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
@ApiModelProperty(value = "类型")
|
||||||
* 字典表字段描述
|
private Integer type;
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "字典表字段描述")
|
@ApiModelProperty(value = "字典表字段描述")
|
||||||
private String describe;
|
private String reportDescribe;
|
||||||
|
|
||||||
/**
|
|
||||||
* 父级id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "父级id")
|
@ApiModelProperty(value = "父级id")
|
||||||
private String pid;
|
private String pid;
|
||||||
|
|
||||||
|
@ApiModelProperty("排序")
|
||||||
|
@NotNull
|
||||||
|
@Range(min = 0, max = 999)
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新操作实体
|
* 更新操作实体
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hany
|
* @author hany
|
||||||
@@ -22,15 +23,13 @@ public class EventTemplateParam {
|
|||||||
@Pattern(regexp = PatternRegex.DIC_REGEX, message = ValidMessage.NAME_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.DIC_REGEX, message = ValidMessage.NAME_FORMAT_ERROR)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty("模板名称")
|
@ApiModelProperty("模板描述")
|
||||||
@NotBlank(message = ValidMessage.CODE_NOT_BLANK)
|
@NotBlank(message = ValidMessage.CODE_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.DES64_REGEX, message = ValidMessage.CODE_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.DES64_REGEX, message = ValidMessage.CODE_FORMAT_ERROR)
|
||||||
private String mark;
|
private String mark;
|
||||||
|
|
||||||
@ApiModelProperty("类型")
|
@ApiModelProperty("类型")
|
||||||
@NotBlank(message = ValidMessage.CODE_NOT_BLANK)
|
private Integer type;
|
||||||
@Pattern(regexp = PatternRegex.TYPE_REGEX, message = ValidMessage.DICT_TYPE_ID_FORMAT_ERROR)
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新操作实体
|
* 更新操作实体
|
||||||
@@ -49,15 +48,25 @@ public class EventTemplateParam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据
|
* 查询数据实体
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public static class EventTemplateQueryParam extends BaseParam {
|
public static class EventTemplateQueryParam extends BaseParam {
|
||||||
@ApiModelProperty("pid")
|
/**
|
||||||
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
|
* 区分监测点与区域报告
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
*/
|
||||||
private String pid;
|
private String type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板的相关关联
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class TemplateRelevancy {
|
||||||
|
private String id;
|
||||||
|
private List<String> idList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class EventTemplate extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
*/
|
*/
|
||||||
private String type;
|
private Integer type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板名称
|
* 模板名称
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class ReportDict extends BaseEntity {
|
|||||||
|
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
private String describe;
|
private String reportDescribe;
|
||||||
|
|
||||||
private String pid;
|
private String pid;
|
||||||
|
|
||||||
@@ -29,7 +29,5 @@ public class ReportDict extends BaseEntity {
|
|||||||
|
|
||||||
private Integer state;
|
private Integer state;
|
||||||
|
|
||||||
private Integer level;
|
|
||||||
|
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.system.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("report_relevancy")
|
||||||
|
public class TemplateRel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板Id
|
||||||
|
*/
|
||||||
|
private String RtId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典Id
|
||||||
|
*/
|
||||||
|
private String RdId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.njcn.system.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DictVO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("Id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("类型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("描述")
|
||||||
|
private String reportDescribe;
|
||||||
|
|
||||||
|
@ApiModelProperty("父节点")
|
||||||
|
private String pid;
|
||||||
|
|
||||||
|
@ApiModelProperty("排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@ApiModelProperty("子级")
|
||||||
|
List<DictVO> children;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package com.njcn.system.pojo.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字典树实体
|
|
||||||
* @author hany
|
|
||||||
* @date 2022/09/09
|
|
||||||
*/
|
|
||||||
@ApiModel
|
|
||||||
@Data
|
|
||||||
public class EventTemplateTree implements Serializable {
|
|
||||||
private String id;
|
|
||||||
@ApiModelProperty(name = "parentId",value = "父id")
|
|
||||||
private String pid;
|
|
||||||
@ApiModelProperty(name = "level",value = "等级")
|
|
||||||
private Integer level;
|
|
||||||
@ApiModelProperty(name = "name",value = "名称")
|
|
||||||
private String name;
|
|
||||||
@ApiModelProperty(name = "describe",value = "描述")
|
|
||||||
private String describe;
|
|
||||||
@ApiModelProperty(name = "sort",value = "排序")
|
|
||||||
private Integer sort;
|
|
||||||
@ApiModelProperty(name = "state",value = "数据状态")
|
|
||||||
private Integer state;
|
|
||||||
@ApiModelProperty(name = "children",value = "子节点")
|
|
||||||
private List<EventTemplateTree> children = new ArrayList<>();
|
|
||||||
|
|
||||||
private String pids;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -15,33 +15,29 @@ public class EventTemplateVO implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典数据表Id
|
* 模板数据表Id
|
||||||
*/
|
*/
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称
|
* 模板名称
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父节点
|
* 类型
|
||||||
*/
|
*/
|
||||||
private String pid;
|
private Integer type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有父节点
|
* 模板描述
|
||||||
*/
|
*/
|
||||||
private String pids;
|
private String mark;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态:0-删除 1-正常
|
* 状态:0-删除 1-正常
|
||||||
*/
|
*/
|
||||||
private Integer state;
|
private Integer state;
|
||||||
|
|
||||||
/**
|
|
||||||
* 排序
|
|
||||||
*/
|
|
||||||
private Integer sort;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.system.controller;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
@@ -9,6 +10,7 @@ import com.njcn.common.utils.HttpResultUtil;
|
|||||||
import com.njcn.common.utils.LogUtil;
|
import com.njcn.common.utils.LogUtil;
|
||||||
import com.njcn.system.pojo.param.EventDictParam;
|
import com.njcn.system.pojo.param.EventDictParam;
|
||||||
import com.njcn.system.pojo.po.ReportDict;
|
import com.njcn.system.pojo.po.ReportDict;
|
||||||
|
import com.njcn.system.pojo.vo.DictVO;
|
||||||
import com.njcn.system.service.IEventDictService;
|
import com.njcn.system.service.IEventDictService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -17,16 +19,14 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hany
|
* @author hany
|
||||||
* @createTime 2022/09/27
|
* @createTime 2022/10/08
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@@ -42,18 +42,18 @@ public class EventDictController extends BaseController {
|
|||||||
* @param eventDictParam
|
* @param eventDictParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||||
@PostMapping("/addDict")
|
@PostMapping("/addDict")
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
|
||||||
@ApiOperation("新增字典表")
|
@ApiOperation("新增字典表")
|
||||||
@ApiImplicitParam(name = "eventDictParam", value = "字典表数据", required = true)
|
@ApiImplicitParam(name = "eventDictParam", value = "字典表数据", required = true)
|
||||||
public HttpResult<Boolean> addDict(@RequestBody EventDictParam eventDictParam) {
|
public HttpResult<Boolean> addDict(@RequestBody @Validated EventDictParam eventDictParam) {
|
||||||
String methodDescribe = getMethodDescribe("addDict");
|
String methodDescribe = getMethodDescribe("addDict");
|
||||||
LogUtil.njcnDebug(log, "{},字典表数据数据为:{}", methodDescribe, eventDictParam);
|
LogUtil.njcnDebug(log, "{},字典表数据数据为:{}", methodDescribe, eventDictParam);
|
||||||
boolean res = iEventDictService.addDict(eventDictParam);
|
boolean res = iEventDictService.addDict(eventDictParam);
|
||||||
if(res){
|
if(res){
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,null,methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,true,methodDescribe);
|
||||||
} else{
|
} else{
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null,methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false,methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,8 +62,8 @@ public class EventDictController extends BaseController {
|
|||||||
* @param dictUpdateParam
|
* @param dictUpdateParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updateDict")
|
@PutMapping("/updateDict")
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||||
@ApiOperation("更新字典表")
|
@ApiOperation("更新字典表")
|
||||||
@ApiImplicitParam(name = "dictUpdateParam", value = "更新字典表实体", required = true)
|
@ApiImplicitParam(name = "dictUpdateParam", value = "更新字典表实体", required = true)
|
||||||
public HttpResult<Boolean> updateDict(@RequestBody EventDictParam.DictUpdateParam dictUpdateParam){
|
public HttpResult<Boolean> updateDict(@RequestBody EventDictParam.DictUpdateParam dictUpdateParam){
|
||||||
@@ -71,9 +71,9 @@ public class EventDictController extends BaseController {
|
|||||||
LogUtil.njcnDebug(log, "{},字典表数据数据为:{}", methodDescribe, dictUpdateParam);
|
LogUtil.njcnDebug(log, "{},字典表数据数据为:{}", methodDescribe, dictUpdateParam);
|
||||||
boolean res = iEventDictService.updateDict(dictUpdateParam);
|
boolean res = iEventDictService.updateDict(dictUpdateParam);
|
||||||
if(res){
|
if(res){
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,null,methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,true,methodDescribe);
|
||||||
} else{
|
} else{
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null,methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false,methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,14 +82,19 @@ public class EventDictController extends BaseController {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/deleteDict")
|
@DeleteMapping("/deleteDict")
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@ApiOperation("删除字典表")
|
@ApiOperation("删除字典表")
|
||||||
@ApiImplicitParam(name = "id", value = "字典表索引", required = true)
|
@ApiImplicitParam(name = "id", value = "字典表索引", required = true)
|
||||||
public HttpResult<Boolean> delDict(@RequestBody String id){
|
public HttpResult<Boolean> deleteDict(@RequestParam @Validated String id){
|
||||||
String methodDescribe = getMethodDescribe("deleteDict");
|
String methodDescribe = getMethodDescribe("deleteDict");
|
||||||
iEventDictService.delete(id);
|
LogUtil.njcnDebug(log, "{},字典id为:{}", methodDescribe, id);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,null,methodDescribe);
|
boolean res = iEventDictService.delete(id);
|
||||||
|
if (res){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true,methodDescribe);
|
||||||
|
}else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false,methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,4 +129,13 @@ public class EventDictController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL,null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL,null, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@GetMapping("/DictTree")
|
||||||
|
@ApiOperation("字典树")
|
||||||
|
public HttpResult<List<DictVO>> getDictTree(){
|
||||||
|
String methodDescribe = getMethodDescribe("getDictTree");
|
||||||
|
List<DictVO> list = iEventDictService.getDictTree();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.njcn.system.controller;
|
package com.njcn.system.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.common.utils.LogUtil;
|
||||||
import com.njcn.system.pojo.param.EventTemplateParam;
|
import com.njcn.system.pojo.param.EventTemplateParam;
|
||||||
import com.njcn.system.pojo.po.EventTemplate;
|
import com.njcn.system.pojo.po.EventTemplate;
|
||||||
import com.njcn.system.service.IEventTemplateService;
|
import com.njcn.system.service.IEventTemplateService;
|
||||||
@@ -15,7 +17,6 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.ibatis.jdbc.Null;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -43,14 +44,15 @@ public class EventTemplateController extends BaseController{
|
|||||||
* 查询所有模板
|
* 查询所有模板
|
||||||
* @author hany
|
* @author hany
|
||||||
* @date 2022/09/09
|
* @date 2022/09/09
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/getList")
|
@GetMapping("/getList")
|
||||||
@ApiOperation("查询所有模板")
|
@ApiOperation("查询所有模板")
|
||||||
public HttpResult<List<EventTemplate>> getList() {
|
public HttpResult<List<EventTemplate>> getList() {
|
||||||
String methodDescribe = getMethodDescribe("getList");
|
String methodDescribe = getMethodDescribe("getList");
|
||||||
List<EventTemplate> list = iEventTemplateService.getList();
|
List<EventTemplate> res = iEventTemplateService.getList();
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,7 +103,7 @@ public class EventTemplateController extends BaseController{
|
|||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
|
||||||
@ApiOperation("修改模板")
|
@ApiOperation("修改模板")
|
||||||
@ApiImplicitParam(name = "eventUpdateParam", value = "模板更新实体", required = true)
|
@ApiImplicitParam(name = "eventUpdateParam", value = "模板更新实体", required = true)
|
||||||
public HttpResult<Boolean> update(@RequestBody @Validated EventTemplateParam.EventTemplateUpdateParam eventUpdateParam){
|
public HttpResult<Object> update(@RequestBody @Validated EventTemplateParam.EventTemplateUpdateParam eventUpdateParam){
|
||||||
String methodDescribe = getMethodDescribe("update");
|
String methodDescribe = getMethodDescribe("update");
|
||||||
boolean result = iEventTemplateService.update(eventUpdateParam);
|
boolean result = iEventTemplateService.update(eventUpdateParam);
|
||||||
if (result) {
|
if (result) {
|
||||||
@@ -118,7 +120,7 @@ public class EventTemplateController extends BaseController{
|
|||||||
* @date 2022/09/08
|
* @date 2022/09/08
|
||||||
*/
|
*/
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
|
||||||
@ApiOperation("删除模板")
|
@ApiOperation("删除模板")
|
||||||
@ApiImplicitParam(name = "ids", value = "模板索引", required = true)
|
@ApiImplicitParam(name = "ids", value = "模板索引", required = true)
|
||||||
public HttpResult<EventTemplate> delete(@RequestBody List<String> ids){
|
public HttpResult<EventTemplate> delete(@RequestBody List<String> ids){
|
||||||
@@ -130,4 +132,24 @@ public class EventTemplateController extends BaseController{
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板id查询关系
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
|
@PostMapping("/selectRelevance")
|
||||||
|
@ApiOperation("根据模板id查询关系")
|
||||||
|
@ApiImplicitParam(name = "ids", value = "角色索引", required = true)
|
||||||
|
public HttpResult<Object> selectRelevance(@RequestBody List<String> ids) {
|
||||||
|
String methodDescribe = getMethodDescribe("selectRelevance");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, ids);
|
||||||
|
boolean result = iEventTemplateService.selectRelevance(ids);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.DELETE_PID_EXIST, null, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.DELETE_PID_UNEXIST, null, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,28 @@
|
|||||||
package com.njcn.system.controller;
|
package com.njcn.system.controller;
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.system.pojo.vo.EventTemplateTree;
|
import com.njcn.common.utils.LogUtil;
|
||||||
|
import com.njcn.system.pojo.param.EventTemplateParam;
|
||||||
import com.njcn.system.service.IEventTreeService;
|
import com.njcn.system.service.IEventTreeService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Validated
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Api(tags = "字典树管理")
|
@Api(tags = "模板树节点管理")
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("/EventTree")
|
@RequestMapping("/EventTree")
|
||||||
@@ -28,16 +31,38 @@ public class EventTreeController extends BaseController {
|
|||||||
private final IEventTreeService iEventTreeService;
|
private final IEventTreeService iEventTreeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取字典树
|
* 根据模板id查询绑定的树节点
|
||||||
* @author hany
|
* @param idList
|
||||||
* @date 2022/09/09
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation("获取字典树")
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||||
@GetMapping("/getEventTree")
|
@PostMapping("/selectEventTree")
|
||||||
public HttpResult<List<EventTemplateTree>> getEventTemplateTree(){
|
@ApiOperation("模板节点树")
|
||||||
String methodDescribe = getMethodDescribe("getEventTree");
|
@ApiImplicitParam(name = "idList", value = "模板索引", required = true)
|
||||||
List<EventTemplateTree> tree = iEventTreeService.getEventTree();
|
public HttpResult<Object> selectEventTree(@RequestParam("idList") List<String> idList){
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, tree, methodDescribe);
|
String methodDescribe = getMethodDescribe("selectEventTree");
|
||||||
|
LogUtil.njcnDebug(log, "{},传入的模板id集合:{}", methodDescribe, idList);
|
||||||
|
List<String> res = iEventTreeService.selectEventTree(idList);
|
||||||
|
if (res.isEmpty()){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NO_DATA, res, methodDescribe);
|
||||||
|
}else{
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为模板分配字典节点
|
||||||
|
* @param templateRelevancy
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@OperateInfo(operateType = OperateType.UPDATE)
|
||||||
|
@PostMapping("/assignTemplate")
|
||||||
|
@ApiOperation("模板分配节点")
|
||||||
|
@ApiImplicitParam(name = "templateRelevancy", value = "模板信息", required = true)
|
||||||
|
public HttpResult<Boolean> assignTemplate(@RequestBody @Validated EventTemplateParam.TemplateRelevancy templateRelevancy) {
|
||||||
|
String methodDescribe = getMethodDescribe("assignTemplate");
|
||||||
|
LogUtil.njcnDebug(log, "{},传入的模板id:{},传入的集合为:{}", methodDescribe,templateRelevancy);
|
||||||
|
boolean result = iEventTreeService.updateTemplate(templateRelevancy);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
package com.njcn.system.mapper;
|
package com.njcn.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.system.pojo.dto.DictDTO;
|
||||||
import com.njcn.system.pojo.po.ReportDict;
|
import com.njcn.system.pojo.po.ReportDict;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface EventDictMapper extends BaseMapper<ReportDict> {
|
public interface EventDictMapper extends BaseMapper<ReportDict> {
|
||||||
|
|
||||||
|
List<DictDTO> getAllDict();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.njcn.system.mapper;
|
package com.njcn.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.system.pojo.po.EventTemplate;
|
import com.njcn.system.pojo.po.EventTemplate;
|
||||||
import com.njcn.system.pojo.vo.EventTemplateTree;
|
import com.njcn.system.pojo.vo.EventTemplateVO;
|
||||||
|
import com.njcn.user.pojo.vo.RoleVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,17 +17,18 @@ import java.util.List;
|
|||||||
public interface EventTemplateMapper extends BaseMapper<EventTemplate> {
|
public interface EventTemplateMapper extends BaseMapper<EventTemplate> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回所有树节点(全部report_template_dict表数据)
|
* 分页查询模板数据
|
||||||
* @author hany
|
* @param page
|
||||||
* @date 2022/09/21
|
* @param queryWrapper
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
List<EventTemplateTree> getAllList();
|
Page<EventTemplateVO> page(@Param("page")Page<EventTemplateVO> page, @Param("ew") QueryWrapper<EventTemplateVO> queryWrapper);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除模板和字典关系
|
* 删除模板和字典关系
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean deleteRelationship (@Param("ids")List<String> ids);
|
Boolean deleteRelevancy(@Param("ids")List<String> ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.system.pojo.po.TemplateRel;
|
||||||
|
import io.lettuce.core.dynamic.annotation.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper接口
|
||||||
|
* @author hany
|
||||||
|
* @date 2022/09/30
|
||||||
|
*/
|
||||||
|
public interface TemplateRelMapper extends BaseMapper<TemplateRel> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板id查询绑定关系
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TemplateRel> selectRelevance(@Param("ids")List<String> ids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.system.mapper.EventDictMapper">
|
||||||
|
|
||||||
|
<select id="getAllDict" resultType="DictDTO">
|
||||||
|
SELECT * from report_dict WHERE State = 1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -4,20 +4,21 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.njcn.system.mapper.EventTemplateMapper">
|
<mapper namespace="com.njcn.system.mapper.EventTemplateMapper">
|
||||||
|
|
||||||
<!--获取所有表数据-->
|
<!--获取模板分页列表-->
|
||||||
<select id="getAllList" resultType="com.njcn.system.pojo.vo.EventTemplateTree">
|
<select id="page" resultType="com.njcn.system.pojo.vo.EventTemplateVO">
|
||||||
select id, name, type ,code
|
SELECT report_template.*
|
||||||
from report_template
|
FROM report_template report_template
|
||||||
where state = 1
|
WHERE ${ew.sqlSegment}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--删除模板与字典关系-->
|
<!--删除模板与字典关系-->
|
||||||
<delete id="deleteRelationship">
|
<delete id="deleteRelevancy">
|
||||||
DELETE FROM report_rel where Rt_id in
|
DELETE FROM report_relevancy where Rt_Id in
|
||||||
<foreach item="item" index="index" collection="ids" open="("
|
<foreach item="item" index="index" collection="ids" open="("
|
||||||
separator="," close=")">
|
separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.system.mapper.TemplateRelMapper">
|
||||||
|
|
||||||
|
<select id="selectRelevance" resultType="TemplateRel">
|
||||||
|
select report_relevancy.*
|
||||||
|
from report_relevancy report_relevancy
|
||||||
|
where report_relevancy.Rt_id in
|
||||||
|
<foreach item="item" index="index" collection="ids" open="("
|
||||||
|
separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -3,10 +3,13 @@ package com.njcn.system.service;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.system.pojo.param.EventDictParam;
|
import com.njcn.system.pojo.param.EventDictParam;
|
||||||
import com.njcn.system.pojo.po.ReportDict;
|
import com.njcn.system.pojo.po.ReportDict;
|
||||||
|
import com.njcn.system.pojo.vo.DictVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hany
|
* @author hany
|
||||||
* @createTime 2022/09/27
|
* @createTime 2022/10/08
|
||||||
*/
|
*/
|
||||||
public interface IEventDictService {
|
public interface IEventDictService {
|
||||||
/**
|
/**
|
||||||
@@ -43,4 +46,10 @@ public interface IEventDictService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReportDict getDictById(String id);
|
ReportDict getDictById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典树
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<DictVO> getDictTree();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.njcn.system.service;
|
package com.njcn.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.system.pojo.param.EventTemplateParam;
|
import com.njcn.system.pojo.param.EventTemplateParam;
|
||||||
import com.njcn.system.pojo.po.EventTemplate;
|
import com.njcn.system.pojo.po.EventTemplate;
|
||||||
|
import com.njcn.system.pojo.vo.EventTemplateVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -10,7 +13,7 @@ import java.util.List;
|
|||||||
* @date: 2022/09/08
|
* @date: 2022/09/08
|
||||||
* @Description: <描述>
|
* @Description: <描述>
|
||||||
*/
|
*/
|
||||||
public interface IEventTemplateService {
|
public interface IEventTemplateService extends IService<EventTemplate> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询模板
|
* 查询模板
|
||||||
@@ -41,4 +44,11 @@ public interface IEventTemplateService {
|
|||||||
* @param ids 模板ids
|
* @param ids 模板ids
|
||||||
*/
|
*/
|
||||||
boolean delete(List<String> ids);
|
boolean delete(List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板id查询关系
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean selectRelevance(List<String> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,29 @@
|
|||||||
package com.njcn.system.service;
|
package com.njcn.system.service;
|
||||||
|
|
||||||
import com.njcn.system.pojo.vo.EventTemplateTree;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.system.pojo.param.EventTemplateParam;
|
||||||
|
import com.njcn.system.pojo.po.TemplateRel;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface IEventTreeService {
|
/**
|
||||||
|
* @author hany
|
||||||
|
* @since 2022/10/08
|
||||||
|
*/
|
||||||
|
public interface IEventTreeService extends IService<TemplateRel> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取字典树
|
* 根据模板id获取绑定树节点数据
|
||||||
*
|
*
|
||||||
* @author hany
|
* @author hany
|
||||||
* @date 2022/09/26
|
* @date 2022/09/26
|
||||||
*/
|
*/
|
||||||
List<EventTemplateTree> getEventTree();
|
List<String> selectEventTree(List<String> idList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配节点数据
|
||||||
|
* @param templateRelevancy
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean updateTemplate(EventTemplateParam.TemplateRelevancy templateRelevancy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.system.service.impl;
|
package com.njcn.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -11,24 +12,33 @@ import com.njcn.common.pojo.enums.common.DataStateEnum;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.db.constant.DbConstant;
|
import com.njcn.db.constant.DbConstant;
|
||||||
import com.njcn.system.enums.EventResponseEnum;
|
import com.njcn.system.enums.EventResponseEnum;
|
||||||
|
import com.njcn.system.enums.TemplateTreeEnum;
|
||||||
import com.njcn.system.mapper.EventDictMapper;
|
import com.njcn.system.mapper.EventDictMapper;
|
||||||
|
import com.njcn.system.pojo.dto.DictDTO;
|
||||||
import com.njcn.system.pojo.param.EventDictParam;
|
import com.njcn.system.pojo.param.EventDictParam;
|
||||||
import com.njcn.system.pojo.po.ReportDict;
|
import com.njcn.system.pojo.po.ReportDict;
|
||||||
|
import com.njcn.system.pojo.vo.DictVO;
|
||||||
import com.njcn.system.service.IEventDictService;
|
import com.njcn.system.service.IEventDictService;
|
||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hany
|
* @author hany
|
||||||
* @createTime 2022/09/27
|
* @createTime 2022/10/08
|
||||||
*/
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDict> implements IEventDictService {
|
public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDict> implements IEventDictService {
|
||||||
|
|
||||||
|
private final EventDictMapper eventDictMapper;
|
||||||
/**
|
/**
|
||||||
* 新增字典数据
|
* 新增字典数据
|
||||||
* @param eventDictParam
|
* @param eventDictParam
|
||||||
@@ -36,10 +46,21 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean addDict (EventDictParam eventDictParam){
|
public boolean addDict (EventDictParam eventDictParam){
|
||||||
checkName(eventDictParam,true);
|
checkName(eventDictParam,false);
|
||||||
ReportDict rptDict = new ReportDict();
|
ReportDict rptDict = new ReportDict();
|
||||||
BeanUtils.copyProperties(eventDictParam,rptDict);
|
BeanUtils.copyProperties(eventDictParam,rptDict);
|
||||||
rptDict.setState(DataStateEnum.ENABLE.getCode());
|
rptDict.setState(DataStateEnum.ENABLE.getCode());
|
||||||
|
if (Objects.equals(eventDictParam.getPid(), TemplateTreeEnum.FATHER_PID)){
|
||||||
|
rptDict.setPids(TemplateTreeEnum.FATHER_PID);
|
||||||
|
}else{
|
||||||
|
ReportDict fatherPid = this.lambdaQuery().eq(ReportDict::getId, eventDictParam.getPid()).one();
|
||||||
|
if (Objects.equals(fatherPid.getPid(), TemplateTreeEnum.FATHER_PID)) {
|
||||||
|
rptDict.setPids(eventDictParam.getPid());
|
||||||
|
} else {
|
||||||
|
String pidS = fatherPid.getPids();
|
||||||
|
rptDict.setPids(pidS + "," + eventDictParam.getPid());
|
||||||
|
}
|
||||||
|
}
|
||||||
return this.save(rptDict);
|
return this.save(rptDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +71,7 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean updateDict (EventDictParam.DictUpdateParam dictUpdateParam){
|
public boolean updateDict (EventDictParam.DictUpdateParam dictUpdateParam){
|
||||||
checkName(dictUpdateParam,false);
|
checkName(dictUpdateParam,true);
|
||||||
ReportDict rptDict = new ReportDict();
|
ReportDict rptDict = new ReportDict();
|
||||||
BeanUtils.copyProperties(dictUpdateParam,rptDict);
|
BeanUtils.copyProperties(dictUpdateParam,rptDict);
|
||||||
return this.updateById(rptDict);
|
return this.updateById(rptDict);
|
||||||
@@ -113,6 +134,34 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
|
|||||||
return this.getById(id);
|
return this.getById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典树
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DictVO> getDictTree() {
|
||||||
|
List<DictVO> list = new ArrayList<>();
|
||||||
|
List<DictDTO> dictList = eventDictMapper.getAllDict();
|
||||||
|
dictList.forEach(item -> {
|
||||||
|
DictVO dictVO = new DictVO();
|
||||||
|
BeanUtil.copyProperties(item, dictVO);
|
||||||
|
list.add(dictVO);
|
||||||
|
});
|
||||||
|
return list.stream()
|
||||||
|
.filter(fun -> Objects.equals(TemplateTreeEnum.FATHER_PID, fun.getPid()))
|
||||||
|
.peek(funS -> funS.setChildren(getChildList(funS, list)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递归组装字典表
|
||||||
|
*/
|
||||||
|
private List<DictVO> getChildList(DictVO dictMenu, List<DictVO> categories) {
|
||||||
|
return categories.stream().filter(o -> Objects.equals(o.getPid(), dictMenu.getId()))
|
||||||
|
.peek(o -> o.setChildren(getChildList(o, categories)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称重复校验
|
* 名称重复校验
|
||||||
* @author hany
|
* @author hany
|
||||||
@@ -124,14 +173,14 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
|
|||||||
.eq(ReportDict::getName,eventDictParam.getName())
|
.eq(ReportDict::getName,eventDictParam.getName())
|
||||||
.eq(ReportDict::getState, DataStateEnum.ENABLE.getCode());
|
.eq(ReportDict::getState, DataStateEnum.ENABLE.getCode());
|
||||||
//修改
|
//修改
|
||||||
if(!flag){
|
if(flag){
|
||||||
if(eventDictParam instanceof EventDictParam.DictUpdateParam ){
|
if(eventDictParam instanceof EventDictParam.DictUpdateParam ){
|
||||||
lambdaQueryWrapper.ne(ReportDict::getId, ((EventDictParam.DictUpdateParam) eventDictParam).getId());
|
lambdaQueryWrapper.ne(ReportDict::getId, ((EventDictParam.DictUpdateParam) eventDictParam).getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int res = this.count(lambdaQueryWrapper);
|
int resCount = this.count(lambdaQueryWrapper);
|
||||||
//大于等于1个则表示重复
|
//大于等于1个则表示重复
|
||||||
if (res >= 1) {
|
if (resCount >= 1) {
|
||||||
throw new BusinessException(EventResponseEnum.DIC_NAME_REPEAT);
|
throw new BusinessException(EventResponseEnum.DIC_NAME_REPEAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.system.service.impl;
|
package com.njcn.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -9,12 +10,15 @@ import com.njcn.common.pojo.enums.common.DataStateEnum;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.system.enums.EventResponseEnum;
|
import com.njcn.system.enums.EventResponseEnum;
|
||||||
import com.njcn.system.mapper.EventTemplateMapper;
|
import com.njcn.system.mapper.EventTemplateMapper;
|
||||||
|
import com.njcn.system.mapper.TemplateRelMapper;
|
||||||
import com.njcn.system.pojo.param.EventTemplateParam;
|
import com.njcn.system.pojo.param.EventTemplateParam;
|
||||||
import com.njcn.system.pojo.po.EventTemplate;
|
import com.njcn.system.pojo.po.EventTemplate;
|
||||||
|
import com.njcn.system.pojo.po.ReportTemplate;
|
||||||
|
import com.njcn.system.pojo.po.TemplateRel;
|
||||||
|
import com.njcn.system.pojo.vo.EventTemplateVO;
|
||||||
import com.njcn.system.service.IEventTemplateService;
|
import com.njcn.system.service.IEventTemplateService;
|
||||||
import com.njcn.user.pojo.po.Role;
|
import com.njcn.web.factory.PageFactory;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -27,9 +31,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Slf4j
|
|
||||||
public class EventTemplateServiceImpl extends ServiceImpl<EventTemplateMapper, EventTemplate> implements IEventTemplateService {
|
public class EventTemplateServiceImpl extends ServiceImpl<EventTemplateMapper, EventTemplate> implements IEventTemplateService {
|
||||||
|
|
||||||
|
private final TemplateRelMapper templateRelMapper;
|
||||||
/**
|
/**
|
||||||
* 查询所有模板
|
* 查询所有模板
|
||||||
* @author hany
|
* @author hany
|
||||||
@@ -61,6 +65,7 @@ public class EventTemplateServiceImpl extends ServiceImpl<EventTemplateMapper, E
|
|||||||
checkName(eventTemplateParam,true);
|
checkName(eventTemplateParam,true);
|
||||||
EventTemplate eventTemplate = new EventTemplate();
|
EventTemplate eventTemplate = new EventTemplate();
|
||||||
BeanUtils.copyProperties(eventTemplateParam,eventTemplate);
|
BeanUtils.copyProperties(eventTemplateParam,eventTemplate);
|
||||||
|
//设为正常状态
|
||||||
eventTemplate.setState(DataStateEnum.ENABLE.getCode());
|
eventTemplate.setState(DataStateEnum.ENABLE.getCode());
|
||||||
return this.save(eventTemplate);
|
return this.save(eventTemplate);
|
||||||
}
|
}
|
||||||
@@ -83,10 +88,27 @@ public class EventTemplateServiceImpl extends ServiceImpl<EventTemplateMapper, E
|
|||||||
@Override
|
@Override
|
||||||
public boolean delete(List<String> ids) {
|
public boolean delete(List<String> ids) {
|
||||||
//删除模板与字典的关系
|
//删除模板与字典的关系
|
||||||
this.baseMapper.deleteRelationship(ids);
|
this.baseMapper.deleteRelevancy(ids);
|
||||||
return this.lambdaUpdate().set(EventTemplate::getState, DataStateEnum.DELETED.getCode()).in(EventTemplate::getId, ids).update();
|
return this.lambdaUpdate().set(EventTemplate::getState, DataStateEnum.DELETED.getCode()).in(EventTemplate::getId, ids).update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板id查询关系
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean selectRelevance(List<String> ids) {
|
||||||
|
//判断模板是否和字典绑定
|
||||||
|
List<TemplateRel> templateRel = this.templateRelMapper.selectRelevance(ids);
|
||||||
|
|
||||||
|
if (templateRel.size() > 0){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称重复校验
|
* 名称重复校验
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,67 +1,53 @@
|
|||||||
package com.njcn.system.service.impl;
|
package com.njcn.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.njcn.system.enums.TemplateTreeEnum;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.system.mapper.EventTemplateMapper;
|
import com.njcn.system.mapper.TemplateRelMapper;
|
||||||
import com.njcn.system.pojo.vo.EventTemplateTree;
|
import com.njcn.system.pojo.param.EventTemplateParam;
|
||||||
|
import com.njcn.system.pojo.po.TemplateRel;
|
||||||
import com.njcn.system.service.IEventTreeService;
|
import com.njcn.system.service.IEventTreeService;
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
public class EventTreeServiceImpl extends ServiceImpl<TemplateRelMapper, TemplateRel> implements IEventTreeService {
|
||||||
public class EventTreeServiceImpl implements IEventTreeService {
|
|
||||||
|
|
||||||
private final EventTemplateMapper eventTemplateMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取字典树
|
* 根据模板id获取绑定树节点数据
|
||||||
* @author hany
|
* @author hany
|
||||||
* @date 2022/09/09
|
* @date 2022/09/09
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<EventTemplateTree> getEventTree() {
|
public List<String> selectEventTree(List<String> idList) {
|
||||||
List<EventTemplateTree> dictTree = new ArrayList<>();
|
return this.lambdaQuery().in(TemplateRel::getRtId,idList).list().stream().map(TemplateRel::getRdId).collect(Collectors.toList());
|
||||||
List<EventTemplateTree> allList = eventTemplateMapper.getAllList();
|
}
|
||||||
List<EventTemplateTree> reportList = allList.stream().filter(item -> item.getLevel().equals(TemplateTreeEnum.REPORT_LEVEL.getCode())).sorted(Comparator.comparing(EventTemplateTree::getSort)).collect(Collectors.toList());
|
|
||||||
List<EventTemplateTree> lineList = allList.stream().filter(item -> item.getLevel().equals(TemplateTreeEnum.LINE_LEVEL.getCode())).sorted(Comparator.comparing(EventTemplateTree::getSort)).collect(Collectors.toList());
|
|
||||||
List<EventTemplateTree> detailList = allList.stream().filter(item -> item.getLevel().equals(TemplateTreeEnum.DETAIL_LEVEL.getCode())).sorted(Comparator.comparing(EventTemplateTree::getSort)).collect(Collectors.toList());
|
|
||||||
List<EventTemplateTree> eventList = allList.stream().filter(item -> item.getLevel().equals(TemplateTreeEnum.TRANS_LEVEL.getCode())).sorted(Comparator.comparing(EventTemplateTree::getSort)).collect(Collectors.toList());
|
|
||||||
List<EventTemplateTree> densityList = allList.stream().filter(item -> item.getLevel().equals(TemplateTreeEnum.TRANS_D_LEVEL.getCode())).sorted(Comparator.comparing(EventTemplateTree::getSort)).collect(Collectors.toList());
|
|
||||||
List<EventTemplateTree> reasonList = allList.stream().filter(item -> item.getLevel().equals(TemplateTreeEnum.TRANS_R_LEVEL.getCode())).sorted(Comparator.comparing(EventTemplateTree::getSort)).collect(Collectors.toList());
|
|
||||||
|
|
||||||
lineList.forEach(line -> line.setChildren(getChildren(line, detailList)));
|
@Override
|
||||||
lineList.forEach(line -> line.setChildren(getChildren(line, eventList)));
|
public boolean updateTemplate(EventTemplateParam.TemplateRelevancy templateRelevancy) {
|
||||||
lineList.forEach(line -> line.setChildren(getChildren(line, densityList)));
|
deleteTemplate(templateRelevancy.getId());
|
||||||
lineList.forEach(line -> line.setChildren(getChildren(line, reasonList)));
|
if (!templateRelevancy.getIdList().isEmpty()){
|
||||||
reportList.forEach(report -> report.setChildren(getChildren(report, lineList)));
|
TemplateRel templateRel = new TemplateRel();
|
||||||
|
templateRel.setRtId(templateRelevancy.getId());
|
||||||
if (CollectionUtil.isNotEmpty(allList)) {
|
templateRelevancy.getIdList().forEach(
|
||||||
EventTemplateTree eventTemplateTree = new EventTemplateTree();
|
pojo->{
|
||||||
eventTemplateTree.setId("9999999");
|
templateRel.setRdId(pojo);
|
||||||
eventTemplateTree.setLevel(0);
|
this.baseMapper.insert(templateRel);
|
||||||
eventTemplateTree.setName("新增模板");
|
});
|
||||||
if (CollectionUtil.isNotEmpty(reportList)) {
|
|
||||||
eventTemplateTree.setChildren(reportList);
|
|
||||||
}
|
|
||||||
dictTree.add(eventTemplateTree);
|
|
||||||
}
|
}
|
||||||
return dictTree;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取全部子节点
|
*根据模板删除
|
||||||
*
|
* @param temIndex
|
||||||
* @author hany
|
* @return
|
||||||
* @date 2022/09/21
|
|
||||||
*/
|
*/
|
||||||
public List<EventTemplateTree> getChildren(EventTemplateTree item, List<EventTemplateTree> all) {
|
public boolean deleteTemplate(String temIndex) {
|
||||||
return all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList());
|
QueryWrapper<TemplateRel> templateRelQueryWrapper = new QueryWrapper<>();
|
||||||
|
templateRelQueryWrapper.eq("report_relevancy.Rt_Id",temIndex);
|
||||||
|
int row = this.baseMapper.delete(templateRelQueryWrapper);
|
||||||
|
return row > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user