feat(report): 迁移自定义报表功能模块
This commit is contained in:
@@ -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