feat(report): 迁移自定义报表功能模块
This commit is contained in:
@@ -20,7 +20,18 @@ public enum CsHarmonicResponseEnum {
|
|||||||
RECORD_MISSING("A00602","record.bin文件缺失,补召失败"),
|
RECORD_MISSING("A00602","record.bin文件缺失,补召失败"),
|
||||||
|
|
||||||
EVENT_FILE_NOT_SAME("A00603","cfg、dat文件名称不一致"),
|
EVENT_FILE_NOT_SAME("A00603","cfg、dat文件名称不一致"),
|
||||||
|
CUSTOM_REPORT_REPEAT("A00552","自定义报表模板名称已存在"),
|
||||||
|
|
||||||
|
CUSTOM_REPORT_JSON("A00553","模板非严格json数据"),
|
||||||
|
|
||||||
|
CUSTOM_REPORT_DEPT("A00554","该部门已存在绑定报表模板"),
|
||||||
|
CUSTOM_TYPE("A00555","字典中未查询到报表模板类型"),
|
||||||
|
CUSTOM_REPORT_ACTIVE("A00556","不存在激活的自定义报告模板"),
|
||||||
|
CUSTOM_REPORT_EMPTY("A00557","自定义报表模板异常,模板数据为空"),
|
||||||
|
CUSTOM_REPORT_FILE("A00558","上传文件服务器错误,请检查数据"),
|
||||||
|
|
||||||
|
REPORT_DOWNLOAD_ERROR("A00559","报表文件下载异常"),
|
||||||
|
REPORT_TEMPLATE_DOWNLOAD_ERROR("A00560","报表模板下载异常")
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.njcn.csharmonic.param;
|
||||||
|
|
||||||
|
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SensitiveUserReportQueryParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "lineId",value = "监测对象id")
|
||||||
|
private String sensitiveUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "tempId",value = "模板ID")
|
||||||
|
private String tempId;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "searchBeginTime", value = "开始时间")
|
||||||
|
@NotBlank(message = "起始时间不可为空")
|
||||||
|
@DateTimeStrValid(message = "起始时间格式出错")
|
||||||
|
private String searchBeginTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "searchEndTime", value = "结束时间")
|
||||||
|
@NotBlank(message = "结束时间不可为空")
|
||||||
|
private String searchEndTime;
|
||||||
|
|
||||||
|
//目前用于区分不同系统资源,null默认 1.无线系统,配合cs-device
|
||||||
|
private Integer resourceType;
|
||||||
|
|
||||||
|
//浙江无线报表特殊标识 null为通用报表 1.浙江无线报表
|
||||||
|
private Integer customType;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/8/22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ReportTemplateDTO {
|
||||||
|
/**
|
||||||
|
* $HA[_25]#B#max#classId#resourceId$
|
||||||
|
*/
|
||||||
|
private String itemName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对应influxdb数据库中字段
|
||||||
|
*/
|
||||||
|
private String templateName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对应限值字段
|
||||||
|
*/
|
||||||
|
private String limitName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相别
|
||||||
|
*/
|
||||||
|
private String phase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* max min avg cp95
|
||||||
|
*/
|
||||||
|
private String statMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对应influxdb数据库的表名
|
||||||
|
*/
|
||||||
|
private String classId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对应mysql数据库的表名
|
||||||
|
*/
|
||||||
|
private String resourceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标识指标是否越限 0.否 1.是
|
||||||
|
*/
|
||||||
|
private Integer overLimitFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 填入的value值
|
||||||
|
*/
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.param;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板动态更新数据
|
||||||
|
*
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ReportSearchParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "lineId",value = "监测点id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "tempId",value = "模板ID")
|
||||||
|
private String tempId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "activation",value = "激活状态")
|
||||||
|
private Integer activation;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "type",value = "报表类型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "startTime",value = "开始时间")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "endTime",value = "结束时间")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "deptId",value = "部门ID")
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
//目前用于区分不同系统资源,null默认 1.无线系统,配合cs-device
|
||||||
|
private Integer resourceType;
|
||||||
|
|
||||||
|
//浙江无线报表特殊标识 null为通用报表 1.浙江无线报表
|
||||||
|
private Integer customType;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.param;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
|
import com.njcn.web.constant.ValidMessage;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/8/16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ReportTemplateParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "name",value = "模板名称",required = true)
|
||||||
|
@NotBlank(message = "模板名称不可为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "fileContent",value = "json文件",required = true)
|
||||||
|
@NotNull(message = "模板文件不可为空")
|
||||||
|
private MultipartFile fileContent;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "content",value = "json文件内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "deptId",value = "部门id")
|
||||||
|
private List<String> deptId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "valueTitle",value = "存取库中")
|
||||||
|
private String valueTitle;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "reportType",value = "模板类型",required = true)
|
||||||
|
@NotBlank(message = "模板类型不可为空")
|
||||||
|
private String reportType;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "reportForm",value = "报表类型",required = true)
|
||||||
|
private String reportForm;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public static class UpdateReportTemplateParam extends ReportTemplateParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id",required = true)
|
||||||
|
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||||
|
private String id;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
* 自定义报表
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/8/16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName(value = "sys_excel_rpt_temp")
|
||||||
|
public class ExcelRptTemp extends BaseEntity {
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
private Integer activation;
|
||||||
|
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
private String valueTitle;
|
||||||
|
|
||||||
|
private String reportType;
|
||||||
|
|
||||||
|
private String reportForm;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
* 自定义报表
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/8/16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class ReportTemplateVO extends BaseEntity {
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
private Integer activation;
|
||||||
|
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
private String reportType;
|
||||||
|
|
||||||
|
private String reportForm;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/8/18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ReportTreeVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id",value = "模板索引")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "name",value = "模板字段名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "showName",value = "模板中文展示名")
|
||||||
|
private String showName;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "flag",value = "用于标识最底层对象 1.表示已经没有子级")
|
||||||
|
private Integer flag;
|
||||||
|
|
||||||
|
private List<ReportTreeVO> children;
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author qijian
|
||||||
|
* @since 2022-10-19 09:31:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysDeptTempVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = -35391150359300949L;
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 部门主键
|
||||||
|
*/
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板主键
|
||||||
|
*/
|
||||||
|
private String tempId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 激活状态
|
||||||
|
*/
|
||||||
|
private Integer activation;
|
||||||
|
|
||||||
|
//部门名称
|
||||||
|
private String deptName;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.njcn.csharmonic.utils;
|
||||||
|
|
||||||
|
public class DataChangeUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用来将二次值转成一次值
|
||||||
|
*/
|
||||||
|
public static double secondaryToPrimary(String formula, Double data,Double pt, Double ct) {
|
||||||
|
switch (formula) {
|
||||||
|
|
||||||
|
case "*PT":
|
||||||
|
data = data * pt;
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
data = data * ct;
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
data = data * pt * ct;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用来将一次值转成二次值
|
||||||
|
*/
|
||||||
|
public static double primaryToSecondary(String formula, Double data,Double pt, Double ct) {
|
||||||
|
switch (formula) {
|
||||||
|
case "*PT":
|
||||||
|
data = data / pt;
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
data = data / ct;
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
data = data / pt / ct;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,282 @@
|
|||||||
|
package com.njcn.csharmonic.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
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.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csharmonic.param.SensitiveUserReportQueryParam;
|
||||||
|
import com.njcn.csharmonic.pojo.param.ReportSearchParam;
|
||||||
|
import com.njcn.csharmonic.pojo.param.ReportTemplateParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.ExcelRptTemp;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.ReportTemplateVO;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.ReportTreeVO;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.SysDeptTempVO;
|
||||||
|
import com.njcn.csharmonic.service.CustomReportService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
* 用户自定义报表
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/8/15
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/customReport")
|
||||||
|
@Api(tags = "用户自定义报表")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CustomReportController extends BaseController {
|
||||||
|
|
||||||
|
private final CustomReportService customReportService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 替换报表数据并返回
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/19
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getCustomReport")
|
||||||
|
@ApiOperation("获取报表")
|
||||||
|
@ApiImplicitParam(name = "reportSearchParam", value = "查询体", required = false)
|
||||||
|
public void getCustomReport(@RequestBody ReportSearchParam reportSearchParam, HttpServletResponse response) {
|
||||||
|
customReportService.getCustomReport(reportSearchParam,response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增自定义报表模板
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/10/19
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.ADD)
|
||||||
|
@PostMapping("/addTemplate")
|
||||||
|
@ApiOperation("新增自定义报表模板")
|
||||||
|
public HttpResult<Boolean> addCustomReportTemplate(@Validated ReportTemplateParam reportTemplateParam){
|
||||||
|
String methodDescribe = getMethodDescribe("addCustomReportTemplate");
|
||||||
|
boolean res = customReportService.addCustomReportTemplate(reportTemplateParam);
|
||||||
|
if(res){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有模板
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/14
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getTemplateList")
|
||||||
|
@ApiOperation("查询报表模板")
|
||||||
|
@ApiImplicitParam(name = "reportSearchParam", value = "实体参数", required = false)
|
||||||
|
public HttpResult<List<ReportTemplateVO>> getTemplateList(@RequestBody ReportSearchParam reportSearchParam){
|
||||||
|
String methodDescribe = getMethodDescribe("getTemplateList");
|
||||||
|
List<ReportTemplateVO> list = customReportService.getTemplateList(reportSearchParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门查询模板
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/19
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getTemplateByDept")
|
||||||
|
@ApiOperation("根据部门查询模板")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
|
public HttpResult<List<ReportTemplateVO>> getTemplateByDept(@RequestParam("id") String id){
|
||||||
|
String methodDescribe = getMethodDescribe("getTemplateList");
|
||||||
|
List<ReportTemplateVO> list = customReportService.getTemplateByDept(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除模板
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.DELETE)
|
||||||
|
@PostMapping("/delTemplate")
|
||||||
|
@ApiOperation("删除报表模板")
|
||||||
|
@ApiImplicitParam(name = "reportSearchParam", value = "实体参数", required = false)
|
||||||
|
public HttpResult<Boolean> delTemplate(@RequestBody ReportSearchParam reportSearchParam){
|
||||||
|
String methodDescribe = getMethodDescribe("delTemplate");
|
||||||
|
boolean res = customReportService.delTemplate(reportSearchParam);
|
||||||
|
if(res){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询模板详情
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/14
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getCustomReportTemplateById")
|
||||||
|
@ApiOperation("根据id查询模板详情")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
|
public HttpResult<ExcelRptTemp> getCustomReportTemplateById(@RequestParam("id") String id){
|
||||||
|
String methodDescribe = getMethodDescribe("getCustomReportTemplateById");
|
||||||
|
ExcelRptTemp excelRptTemp = customReportService.getCustomReportTemplateById(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, excelRptTemp, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id回显模板
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/14
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/viewCustomReportTemplateById")
|
||||||
|
@ApiOperation("根据id查询模板详情")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
|
public void viewCustomReportTemplateById(@RequestParam("id") String id,HttpServletResponse response){
|
||||||
|
customReportService.viewCustomReportTemplateById(id,response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改自定义报表模板
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.UPDATE)
|
||||||
|
@PostMapping("/updateTemplate")
|
||||||
|
@ApiOperation("修改自定义报表模板")
|
||||||
|
public HttpResult<Boolean> updateCustomReportTemplate(@Validated ReportTemplateParam.UpdateReportTemplateParam reportTemplateParam){
|
||||||
|
String methodDescribe = getMethodDescribe("updateCustomReportTemplate");
|
||||||
|
boolean res = customReportService.updateCustomReportTemplate(reportTemplateParam);
|
||||||
|
if(res){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定/解绑模板数据
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/19
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.UPDATE)
|
||||||
|
@PostMapping("/updateBindTemplate")
|
||||||
|
@ApiOperation("绑定/解绑模板数据")
|
||||||
|
@ApiImplicitParam(name = "reportSearchParams", value = "实体参数", required = false)
|
||||||
|
public HttpResult<Boolean> updateBindTemplate(@RequestBody List<ReportSearchParam> reportSearchParams){
|
||||||
|
String methodDescribe = getMethodDescribe("updateBindTemplate");
|
||||||
|
boolean res = customReportService.updateBindTemplate(reportSearchParams);
|
||||||
|
if(res){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板ID查询数据
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/19
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getDataByTempId")
|
||||||
|
@ApiOperation("根据模板ID查询数据")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
|
public HttpResult<List<SysDeptTempVO>> getDataByTempId(@RequestParam("id")String id){
|
||||||
|
String methodDescribe = getMethodDescribe("getDataByTempId");
|
||||||
|
List<SysDeptTempVO> list = customReportService.getDataByTempId(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改激活状态
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/17
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.UPDATE)
|
||||||
|
@PostMapping("/updateTemplateActive")
|
||||||
|
@ApiOperation("修改激活状态")
|
||||||
|
@ApiImplicitParam(name = "reportSearchParam", value = "实体参数", required = false)
|
||||||
|
public HttpResult<Page<ExcelRptTemp>> updateTemplateActive(@RequestBody ReportSearchParam reportSearchParam){
|
||||||
|
String methodDescribe = getMethodDescribe("updateTemplateActive");
|
||||||
|
boolean res = customReportService.updateStatus(reportSearchParam);
|
||||||
|
if(res){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取报表模板树
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/8/16
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/reportChooseTree")
|
||||||
|
@ApiOperation("获取报表模板树")
|
||||||
|
public HttpResult<List<ReportTreeVO>> reportChooseTree(){
|
||||||
|
String methodDescribe = getMethodDescribe("reportChooseTree");
|
||||||
|
List<ReportTreeVO> res = customReportService.reportChooseTree();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取报表指标是否合格模板树
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/10/11
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/targetLimitChooseTree")
|
||||||
|
@ApiOperation("获取报表指标是否合格模板树")
|
||||||
|
public HttpResult<List<ReportTreeVO>> targetLimitChooseTree(){
|
||||||
|
String methodDescribe = getMethodDescribe("targetLimitChooseTree");
|
||||||
|
List<ReportTreeVO> res = customReportService.targetLimitChooseTree();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取报表台账模板树
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/10/11
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/terminalChooseTree")
|
||||||
|
@ApiOperation("获取报表台账模板树")
|
||||||
|
public HttpResult<List<ReportTreeVO>> terminalChooseTree(){
|
||||||
|
String methodDescribe = getMethodDescribe("terminalChooseTree");
|
||||||
|
List<ReportTreeVO> res = customReportService.terminalChooseTree();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getSensitiveUserReport")
|
||||||
|
@ApiOperation("获取监测对象治理报表")
|
||||||
|
@ApiImplicitParam(name = "queryParam", value = "查询体", required = true)
|
||||||
|
public void getSensitiveUserReport(@RequestBody SensitiveUserReportQueryParam queryParam, HttpServletResponse response) {
|
||||||
|
customReportService.getSensitiveUserReport(queryParam,response);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.njcn.csharmonic.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.csharmonic.pojo.param.ReportSearchParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.ExcelRptTemp;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.ReportTemplateVO;
|
||||||
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/8/16
|
||||||
|
*/
|
||||||
|
public interface ExcelRptTempMapper extends BaseMapper<ExcelRptTemp> {
|
||||||
|
|
||||||
|
Page<ReportTemplateVO> getReportTemplateListPage(Page<BaseParam> page, @Param("baseParam")BaseParam baseParam);
|
||||||
|
|
||||||
|
List<ReportTemplateVO> getReportTemplateList(@Param("reportSearchParam")ReportSearchParam reportSearchParam);
|
||||||
|
|
||||||
|
List<ReportTemplateVO> getReportTemplateByDept(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
|
||||||
|
@Select("${sqlStr}")
|
||||||
|
StatisticalDataDTO dynamicSql(@Param("sqlStr")String sql);
|
||||||
|
|
||||||
|
@Select("${sqlStr}")
|
||||||
|
Map<String, Float> dynamicSqlMap(@Param("sqlStr")String sql);
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?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.csharmonic.mapper.ExcelRptTempMapper">
|
||||||
|
|
||||||
|
<select id="getReportTemplateListPage" resultType="com.njcn.csharmonic.pojo.vo.ReportTemplateVO">
|
||||||
|
select
|
||||||
|
a.id,
|
||||||
|
a.name,
|
||||||
|
a.dept_id,
|
||||||
|
b.name deptName,
|
||||||
|
a.activation,
|
||||||
|
a.update_time,
|
||||||
|
c.name updateBy
|
||||||
|
from sys_excel_rpt_temp a
|
||||||
|
left join sys_dept b on a.dept_id = b.id
|
||||||
|
left join sys_user c on a.update_by = c.id
|
||||||
|
where a.state = 1
|
||||||
|
<if test="baseParam.searchValue!=null and baseParam.searchValue!=''">
|
||||||
|
and (
|
||||||
|
a.name like CONCAT('%', #{baseParam.searchValue},'%') or
|
||||||
|
b.name like CONCAT('%', #{baseParam.searchValue},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getReportTemplateList" resultType="com.njcn.csharmonic.pojo.vo.ReportTemplateVO">
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.NAME,
|
||||||
|
a.update_time,
|
||||||
|
a.create_time,
|
||||||
|
a.update_by,
|
||||||
|
a.Activation,
|
||||||
|
a.Report_Type,
|
||||||
|
a.Report_Form
|
||||||
|
FROM
|
||||||
|
sys_excel_rpt_temp a
|
||||||
|
WHERE
|
||||||
|
a.state = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getReportTemplateByDept" resultType="com.njcn.csharmonic.pojo.vo.ReportTemplateVO">
|
||||||
|
SELECT
|
||||||
|
DISTINCT
|
||||||
|
a.id,
|
||||||
|
a.NAME,
|
||||||
|
a.activation,
|
||||||
|
a.report_form,
|
||||||
|
a.sort
|
||||||
|
FROM
|
||||||
|
sys_excel_rpt_temp a
|
||||||
|
LEFT JOIN sys_dept_temp b ON a.Id = b.temp_id
|
||||||
|
WHERE
|
||||||
|
a.activation = 1
|
||||||
|
and b.dept_id in
|
||||||
|
<foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
order by a.sort asc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
package com.njcn.csharmonic.service;
|
||||||
|
|
||||||
|
import com.njcn.csharmonic.param.SensitiveUserReportQueryParam;
|
||||||
|
import com.njcn.csharmonic.pojo.param.ReportSearchParam;
|
||||||
|
import com.njcn.csharmonic.pojo.param.ReportTemplateParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.ExcelRptTemp;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.ReportTemplateVO;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.ReportTreeVO;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.SysDeptTempVO;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
* 自定义报表
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/8/16
|
||||||
|
*/
|
||||||
|
public interface CustomReportService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增自定义报表模板
|
||||||
|
*
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
boolean addCustomReportTemplate(ReportTemplateParam reportTemplateParam);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改自定义报表模板
|
||||||
|
*
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
boolean updateCustomReportTemplate(ReportTemplateParam.UpdateReportTemplateParam reportTemplateParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id获取模板
|
||||||
|
*
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
ExcelRptTemp getCustomReportTemplateById(String id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板列表
|
||||||
|
*
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
List<ReportTemplateVO> getTemplateList(ReportSearchParam reportSearchParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除模板
|
||||||
|
*
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
boolean delTemplate(ReportSearchParam reportSearchParam);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换模板激活状态
|
||||||
|
*
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
boolean updateStatus(ReportSearchParam reportSearchParam);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 替换报表数据并返回
|
||||||
|
*
|
||||||
|
* @param reportSearchParam 请求参数
|
||||||
|
* @param response
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
void getCustomReport(ReportSearchParam reportSearchParam, HttpServletResponse response);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报告模板树节点
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/8/26
|
||||||
|
*/
|
||||||
|
List<ReportTreeVO> reportChooseTree();
|
||||||
|
|
||||||
|
List<ReportTreeVO> targetLimitChooseTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 台账类型树
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/10/23
|
||||||
|
*/
|
||||||
|
List<ReportTreeVO> terminalChooseTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定/解绑模板数据
|
||||||
|
*
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
boolean updateBindTemplate(List<ReportSearchParam> reportSearchParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板ID查询数据
|
||||||
|
*
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
List<SysDeptTempVO> getDataByTempId(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门查询模板
|
||||||
|
*
|
||||||
|
* @author qijian
|
||||||
|
* @date 2022/10/18
|
||||||
|
*/
|
||||||
|
List<ReportTemplateVO> getTemplateByDept(String id);
|
||||||
|
|
||||||
|
void viewCustomReportTemplateById(String id, HttpServletResponse response);
|
||||||
|
|
||||||
|
|
||||||
|
void getSensitiveUserReport(SensitiveUserReportQueryParam queryParam, HttpServletResponse response);
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user