技术监督管理

用户部门添加省级,市,县层级判断
This commit is contained in:
2023-06-26 09:14:39 +08:00
parent 3855accc61
commit c4cc262964
28 changed files with 1509 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ public interface PatternRegex {
/**
* 字典名称包括中文、数字、字母、罗马数字、括号以及点号
*/
String DIC_REGEX = "^[\\w\\u4E00-\\u9FA5()_/、\\- ]+\\.?[\\w\\u4E00-\\u9FA5()I II III IV V /]{0,125}$";
String DIC_REGEX = "^[\\w\\u4E00-\\u9FA5()_/、/, /\\- ]+\\.?[\\w\\u4E00-\\u9FA5()I II III IV V /]{0,125}$";
/**
* 密码有效期1-3月

View File

@@ -94,4 +94,6 @@ public interface OssPath {
String WIRING_DIAGRAM = "wiringDiagram/";
}

View File

@@ -22,6 +22,8 @@ public enum ProcessResponseEnum {
ENABLED_CANNOT_BE_DELETED("A00555","策略为启用状态不能删除!"),
THERE_IS_ONLY_ONE_STRATEGY("A00556","各个策略等级,通用策略只能有一条!"),
TERMINAL_ID_REPEAT("A00351","终端编号已存在"),
SUPV_PLAN_REPEAT("A00568","监督计划名称已存在")
;
private final String code;

View File

@@ -0,0 +1,43 @@
package com.njcn.process.pojo.param;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
*
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@Getter
@Setter
@TableName("supv_file")
public class SupvFileParam {
private String id;
/**
* 附件路径
*/
private String file;
/**
* 附件名称
*/
private String attachmentName;
private String attachmentType;
/**
* 计划问题id
*/
private String busiId;
}

View File

@@ -0,0 +1,145 @@
package com.njcn.process.pojo.param;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import com.njcn.web.pojo.annotation.DateTimeStrValid;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@Data
@TableName("supv_plan")
public class SupvPlanParam extends BaseParam {
/**
* 计划名称
*/
@ApiModelProperty(value = "计划名称",required = true)
@NotBlank(message = "计划名称不可为空")
private String workPlanName;
/**
* 监督单位
*/
@ApiModelProperty(value = "监督单位",required = true)
@NotBlank(message = "监督单位不可为空")
private String supvOrgId;
/**
* 监督类型
*/
@ApiModelProperty(value = "监督类型",required = true)
@NotBlank(message = "监督类型不可为空")
private String supvType;
/**
* 监督阶段
*/
@ApiModelProperty(value = "监督阶段",required = true)
@NotBlank(message = "监督阶段不可为空")
private String supvStage;
/**
* 计划监督时间
*/
@ApiModelProperty(value = "计划监督时间",required = true)
@NotNull(message = "计划监督时间不可为空")
@DateTimeStrValid(message = "计划监督时间格式有误")
private String planSupvDate;
/**
* 监督对象名称
*/
@ApiModelProperty(value = "监督对象名称")
@NotBlank(message = "监督对象名称不可为空")
private String supvObjName;
/**
* 对象类型
*/
@ApiModelProperty(value = "对象类型")
@NotBlank(message = "对象类型不可为空")
private String supvObjType;
/**
* 对象电压等级
*/
@ApiModelProperty(value = "对象电压等级")
@NotBlank(message = "对象电压等级不可为空")
private String objVoltageLevel;
/**
* 关联电站
*/
@ApiModelProperty(value = "关联电站")
@NotBlank(message = "关联电站不可为空")
private String objRelationStation;
/**
* 计划执行开始时间
*/
@ApiModelProperty(value = "计划执行开始时间",required = true)
@NotNull(message = "计划执行开始时间不可为空")
@DateTimeStrValid(message = "计划执行开始时间格式有误")
private String supvStartTime;
/**
* 计划执行结束时间
*/
@ApiModelProperty(value = "计划执行结束时间",required = true)
@NotNull(message = "计划执行结束时间不可为空")
@DateTimeStrValid(message = "计划执行结束时间格式有误")
private String supvEndTime;
/**
* 报告出具时间
*/
@ApiModelProperty(value = "报告出具时间",required = true)
@DateTimeStrValid(message = "报告出具时间格式有误",format = "yyyy-MM-dd HH:mm:ss")
private String reportIssueTime;
/**
* 电能质量问题发生时间
*/
@ApiModelProperty(value = "电能质量问题发生时间",required = true)
@DateTimeStrValid(message = "电能质量问题发生时间格式有误",format = "yyyy-MM-dd HH:mm:ss")
private String problemOcTime;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String planRemark;
@EqualsAndHashCode(callSuper = true)
@Data
public static class UpdateSupvPlanParam extends SupvPlanParam{
@ApiModelProperty(value = "索引",required = true)
@NotBlank(message = "计划索引不可为空")
private String planId;
}
}

View File

@@ -0,0 +1,132 @@
package com.njcn.process.pojo.param;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import com.njcn.web.pojo.annotation.DateTimeStrValid;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("supv_problem")
public class SupvProblemParam extends BaseParam {
/**
* 关联计划表
*/
@ApiModelProperty(value = "关联计划表id",required = true)
@NotBlank(message = "关联计划表不可为空")
private String planId;
/**
* 责任单位id取ISC平台上的组织id
*/
@ApiModelProperty(value = "责任单位id取ISC平台上的组织id",required = true)
@NotBlank(message = "责任单位id不可为空")
private String dutyOrgId;
/**
* 监测点类型 ,仅供电电压监督计划必填
*/
@ApiModelProperty(value = "监测点类型 ,仅供电电压监督计划必填")
private String monitorType;
/**
* 整改时间
*/
@ApiModelProperty(value = "整改时间",required = true)
@NotNull(message = "整改时间不可为空")
@DateTimeStrValid(message = "整改时间格式有误")
private String rectificationTime;
/**
* 计划整改时间
*/
@ApiModelProperty(value = "计划整改时间",required = true)
@NotNull(message = "计划整改时间不可为空")
@DateTimeStrValid(message = "计划整改时间格式有误")
private String planRectificationTime;
/**
* 是否发布预告警
*/
@ApiModelProperty(value = "是否发布预告警",required = true)
@NotNull(message = "是否发布预告警不可为空")
private Integer ifReleaseWarning;
/**
* 问题描述
*/
@ApiModelProperty(value = "问题描述")
private String simpleProblemDesc;
/**
* 监督标准
*/
@ApiModelProperty(value = "监督标准",required = true)
@NotBlank(message = "监督标准不可为空")
private String supvStandard;
/**
* 标准出处
*/
@ApiModelProperty(value = "标准出处",required = true)
@NotBlank(message = "标准出处不可为空")
private String supvResouce;
/**
* 问题等级 01 一般02 较大
*/
@ApiModelProperty(value = "问题等级",required = true)
@NotBlank(message = "问题等级不可为空")
private String problemLevel;
/**
* 定级依据
*/
@ApiModelProperty(value = "定级依据",required = true)
@NotBlank(message = "定级依据不可为空")
private String problemLevelReason;
/**
* 问题类型
*/
@ApiModelProperty(value = "问题类型",required = true)
@NotBlank(message = "问题类型不可为空")
private String problemType;
/**
* 整改方案
*/
@ApiModelProperty(value = "整改方案",required = true)
@NotBlank(message = "整改方案不可为空")
private String rectificationProgramme;
@EqualsAndHashCode(callSuper = true)
@Data
public static class UpdateSupvProblemParam extends SupvProblemParam{
@ApiModelProperty(value = "索引",required = true)
@NotBlank(message = "问题索引不可为空")
private String problemId;
}
}

View File

@@ -0,0 +1,51 @@
package com.njcn.process.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
*
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@Getter
@Setter
@TableName("supv_file")
public class SupvFile extends BaseEntity {
private static final long serialVersionUID = 1L;
private String id;
/**
* 附件路径
*/
private String file;
/**
* 附件名称
*/
private String attachmentName;
/**
* 0.计划 1.问题
*/
private Integer type;
private String attachmentType;
/**
* 计划问题id
*/
private String busiId;
}

View File

@@ -0,0 +1,115 @@
package com.njcn.process.pojo.po;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
*
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@Data
@TableName("supv_plan")
public class SupvPlan extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId
private String planId;
/**
* 计划名称
*/
private String workPlanName;
/**
* 监督单位
*/
private String supvOrgId;
/**
* 监督类型
*/
private String supvType;
/**
* 监督阶段
*/
private String supvStage;
/**
* 计划监督时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate planSupvDate;
/**
* 监督对象名称
*/
private String supvObjName;
/**
* 对象类型
*/
private String supvObjType;
/**
* 对象电压等级
*/
private String objVoltageLevel;
/**
* 关联电站
*/
private String objRelationStation;
/**
* 计划执行开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate supvStartTime;
/**
* 计划执行结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate supvEndTime;
/**
* 报告出具时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime reportIssueTime;
/**
* 电能质量问题发生时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime problemOcTime;
/**
* 备注
*/
private String planRemark;
/**
* 0.未上送 1.上送 2.取消上送
*/
private Integer isUploadHead;
}

View File

@@ -0,0 +1,100 @@
package com.njcn.process.pojo.po;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
*
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("supv_problem")
public class SupvProblem extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId
private String problemId;
/**
* 关联计划表
*/
private String planId;
/**
* 责任单位id取ISC平台上的组织id
*/
private String dutyOrgId;
/**
* 监测点类型 ,仅供电电压监督计划必填
*/
private String monitorType;
/**
* 整改时间
*/
private LocalDate rectificationTime;
/**
* 计划整改时间
*/
private LocalDate planRectificationTime;
/**
* 是否发布预告警
*/
private Integer ifReleaseWarning;
/**
* 问题描述
*/
private String simpleProblemDesc;
/**
* 监督标准
*/
private String supvStandard;
/**
* 标准出处
*/
private String supvResouce;
/**
* 问题等级 01 一般02 较大
*/
private String problemLevel;
/**
* 定级依据
*/
private String problemLevelReason;
/**
* 问题类型
*/
private String problemType;
/**
* 整改方案
*/
private String rectificationProgramme;
}

View File

@@ -0,0 +1,122 @@
package com.njcn.process.pojo.vo;
import com.njcn.web.pojo.annotation.DateTimeStrValid;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* pqs
*
* @author cdf
* @date 2023/6/25
*/
@Data
public class SupvPlanVO {
@ApiModelProperty(value = "索引",required = true)
private String planId;
/**
* 计划名称
*/
@ApiModelProperty(value = "计划名称",required = true)
private String workPlanName;
/**
* 监督单位
*/
@ApiModelProperty(value = "监督单位",required = true)
private String supvOrgId;
@ApiModelProperty(value = "监督单位名称",required = true)
private String supvOrgName;
/**
* 监督类型
*/
@ApiModelProperty(value = "监督类型",required = true)
private String supvType;
/**
* 监督阶段
*/
@ApiModelProperty(value = "监督阶段",required = true)
private String supvStage;
/**
* 计划监督时间
*/
@ApiModelProperty(value = "计划监督时间",required = true)
private String planSupvDate;
/**
* 监督对象名称
*/
@ApiModelProperty(value = "监督对象名称")
private String supvObjName;
/**
* 对象类型
*/
@ApiModelProperty(value = "对象类型")
private String supvObjType;
/**
* 对象电压等级
*/
@ApiModelProperty(value = "对象电压等级")
private String objVoltageLevel;
/**
* 关联电站
*/
@ApiModelProperty(value = "关联电站")
private String objRelationStation;
/**
* 计划执行开始时间
*/
@ApiModelProperty(value = "计划执行开始时间",required = true)
private String supvStartTime;
/**
* 计划执行结束时间
*/
@ApiModelProperty(value = "计划执行结束时间",required = true)
private String supvEndTime;
/**
* 报告出具时间
*/
@ApiModelProperty(value = "报告出具时间",required = true)
private String reportIssueTime;
/**
* 电能质量问题发生时间
*/
@ApiModelProperty(value = "电能质量问题发生时间",required = true)
private String problemOcTime;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String planRemark;
@ApiModelProperty(value = "省部门")
private String province;
@ApiModelProperty(value = "市部门")
private String city;
@ApiModelProperty(value = "县部门")
private String county;
@ApiModelProperty(value = "附件名称")
private String attachmentName;
}

View File

@@ -0,0 +1,57 @@
package com.njcn.process.controller;
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.process.service.ISupvFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import com.njcn.web.controller.BaseController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/**
* <p>
* 前端控制器
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@RestController
@RequestMapping("/supv/file")
@Api(tags = "技术监督附件控制器")
@RequiredArgsConstructor
public class SupvFileController extends BaseController {
private final ISupvFileService iSupvFileService;
@PostMapping("planUpload")
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPLOAD)
@ApiOperation("监督计划问题附件上传")
public HttpResult<Object> planUpload(@ApiParam(value = "文件", required = true) @RequestPart("files") MultipartFile file, @RequestParam("planId") String planId, @RequestParam("type") Integer type){
String methodDescribe = getMethodDescribe("planUpload");
iSupvFileService.planUpload(file,planId,type);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("detail")
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DOWNLOAD)
@ApiOperation("监督计划问题附件下载")
public HttpResult<Object> detail(HttpServletResponse response, @RequestParam("busId") String busId, @RequestParam("type") Integer type){
String methodDescribe = getMethodDescribe("detail");
iSupvFileService.detail(response,busId,type);
return null;
}
}

View File

@@ -0,0 +1,43 @@
package com.njcn.process.controller;
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.process.pojo.param.SupvPlanParam;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
/**
* pqs
* 月度统计
* @author cdf
* @date 2023/6/26
*/
@RestController
@RequestMapping("/supv/report")
@Api(tags = "技术监督月统计控制器")
@RequiredArgsConstructor
public class SupvMonthStatisController extends BaseController {
@PostMapping("statisticReport")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiIgnore
public HttpResult<Object> statisticReport(@RequestBody @Validated SupvPlanParam supvPlanParam){
String methodDescribe = getMethodDescribe("statisticReport");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -0,0 +1,91 @@
package com.njcn.process.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.process.pojo.param.SupvPlanParam;
import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.vo.SupvPlanVO;
import com.njcn.process.service.ISupvPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import liquibase.pro.packaged.S;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.njcn.web.controller.BaseController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@RestController
@RequestMapping("/supv/plan")
@Api(tags = "技术监督计划控制器")
@RequiredArgsConstructor
public class SupvPlanController extends BaseController {
private final ISupvPlanService iSupvPlanService;
@PostMapping("addPlan")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("新增技术监督计划")
@ApiImplicitParam(name = "supvPlanParam",value = "请求体",required = true)
public HttpResult<Object> addPlan(@RequestBody @Validated SupvPlanParam supvPlanParam){
String methodDescribe = getMethodDescribe("addPlan");
iSupvPlanService.addPlan(supvPlanParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("updatePlan")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("修改技术监督计划")
@ApiImplicitParam(name = "supvPlanParam",value = "请求体",required = true)
public HttpResult<Object> updatePlan(@RequestBody @Validated SupvPlanParam.UpdateSupvPlanParam supvPlanParam){
String methodDescribe = getMethodDescribe("updatePlan");
iSupvPlanService.updatePlan(supvPlanParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("delPlan")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("删除监督计划")
@ApiImplicitParam(name = "planIds",value = "监督计划索引集合",required = true)
public HttpResult<Object> delPlan(@RequestBody List<String> planIds){
String methodDescribe = getMethodDescribe("delPlan");
iSupvPlanService.delPlan(planIds);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("pagePlan")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("分页查询监督计划")
@ApiImplicitParam(name = "supvPlanParam",value = "请求体",required = true)
public HttpResult<Page<SupvPlanVO>> pagePlan(@RequestBody SupvPlanParam supvPlanParam){
String methodDescribe = getMethodDescribe("pagePlan");
Page<SupvPlanVO> page = iSupvPlanService.pagePlan(supvPlanParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -0,0 +1,90 @@
package com.njcn.process.controller;
import cn.hutool.core.util.StrUtil;
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.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.process.pojo.param.SupvProblemParam;
import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.service.ISupvProblemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.njcn.web.controller.BaseController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@RestController
@RequestMapping("/supv/problem")
@Api(tags = "技术监督实施问题控制器")
@RequiredArgsConstructor
public class SupvProblemController extends BaseController {
private final ISupvProblemService iSupvProblemService;
@PostMapping("addProblem")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("新增技术监督问题")
@ApiImplicitParam(name = "supvProblemParam",value = "请求体",required = true)
public HttpResult<Object> addProblem(@RequestBody @Validated SupvProblemParam supvProblemParam){
String methodDescribe = getMethodDescribe("addProblem");
iSupvProblemService.addProblem(supvProblemParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("updateProblem")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("修改技术监督问题")
@ApiImplicitParam(name = "supvProblemParam",value = "请求体",required = true)
public HttpResult<Object> updateProblem(@RequestBody @Validated SupvProblemParam.UpdateSupvProblemParam supvProblemParam){
String methodDescribe = getMethodDescribe("updateProblem");
iSupvProblemService.updateProblem(supvProblemParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("delProblem")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("删除监督问题")
@ApiImplicitParam(name = "problemIds",value = "监督问题计划索引集合",required = true)
public HttpResult<Object> delProblem(@RequestBody List<String> problemIds){
String methodDescribe = getMethodDescribe("delProblem");
iSupvProblemService.delProblem(problemIds);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("pageProblem")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("分页查询监督问题")
@ApiImplicitParam(name = "supvProblemParam",value = "请求体",required = true)
public HttpResult<Page<SupvProblem>> pageProblem(@RequestBody SupvProblemParam supvProblemParam){
String methodDescribe = getMethodDescribe("pageProblem");
if(StrUtil.isBlank(supvProblemParam.getPlanId())){
throw new BusinessException("监督计划索引不可为空");
}
Page<SupvProblem> page = iSupvProblemService.pageProblem(supvProblemParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -0,0 +1,17 @@
package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.process.pojo.po.SupvFile;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface SupvFileMapper extends BaseMapper<SupvFile> {
}

View File

@@ -0,0 +1,21 @@
package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.process.pojo.param.SupvPlanParam;
import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.vo.SupvPlanVO;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface SupvPlanMapper extends BaseMapper<SupvPlan> {
}

View File

@@ -0,0 +1,17 @@
package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.process.pojo.po.SupvProblem;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface SupvProblemMapper extends BaseMapper<SupvProblem> {
}

View File

@@ -0,0 +1,5 @@
<?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.process.mapper.SupvFileMapper">
</mapper>

View File

@@ -0,0 +1,6 @@
<?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.process.mapper.SupvPlanMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?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.process.mapper.SupvProblemMapper">
</mapper>

View File

@@ -0,0 +1,30 @@
package com.njcn.process.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.process.pojo.po.SupvFile;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/**
* <p>
* 服务类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface ISupvFileService extends IService<SupvFile> {
/**
*
* @author cdf
* @date 2023/6/25
*/
boolean planUpload(MultipartFile file,String planId, Integer type);
String detail(HttpServletResponse response,String busId,Integer type);
}

View File

@@ -0,0 +1,58 @@
package com.njcn.process.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.process.pojo.param.SupvPlanParam;
import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.vo.SupvPlanVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface ISupvPlanService extends IService<SupvPlan> {
/**
* 新增技术监督
* @author cdf
* @date 2023/6/21
*/
boolean addPlan(SupvPlanParam supvPlanParam);
/**
* 修改技术监督
* @author cdf
* @date 2023/6/21
*/
boolean updatePlan(SupvPlanParam supvPlanParam);
/**
* 删除技术监督
* @author cdf
* @date 2023/6/21
*/
boolean delPlan(List<String> planIds);
/**
* 分页查询技术监督
* @author cdf
* @date 2023/6/21
*/
Page<SupvPlanVO> pagePlan(SupvPlanParam supvPlanParam);
}

View File

@@ -0,0 +1,51 @@
package com.njcn.process.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.process.pojo.param.SupvProblemParam;
import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.po.SupvProblem;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface ISupvProblemService extends IService<SupvProblem> {
/**
* 新增技术监督问题
* @author cdf
* @date 2023/6/21
*/
boolean addProblem(SupvProblemParam supvProblemParam);
/**
* 修改技术监督问题
* @author cdf
* @date 2023/6/21
*/
boolean updateProblem(SupvProblemParam supvProblemParam);
/**
* 删除技术监督问题
* @author cdf
* @date 2023/6/21
*/
boolean delProblem(List<String> problemIds);
/**
* 分页查询技术监督问题
* @author cdf
* @date 2023/6/21
*/
Page<SupvProblem> pageProblem(SupvProblemParam supvProblemParam);
}

View File

@@ -0,0 +1,64 @@
package com.njcn.process.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.mapper.SupvFileMapper;
import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.service.ISupvFileService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.Objects;
/**
* <p>
* 服务实现类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@Service
@RequiredArgsConstructor
public class SupvFileServiceImpl extends ServiceImpl<SupvFileMapper, SupvFile> implements ISupvFileService {
private final FileStorageUtil fileStorageUtil;
private final SupvFileMapper supvFileMapper;
@Override
public boolean planUpload(MultipartFile file, String planId, Integer type) {
SupvFile supvFile = this.getOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,planId).eq(SupvFile::getType,type));
String url = fileStorageUtil.uploadMultipart(file, OssPath.SURVEY_RESULT);
SupvFile supvFilePO = new SupvFile();
supvFilePO.setAttachmentName(file.getOriginalFilename());
supvFilePO.setFile(url);
if(Objects.nonNull(supvFile)){
fileStorageUtil.deleteFile(supvFile.getFile());
supvFilePO.setId(supvFile.getId());
return this.updateById(supvFilePO);
}
supvFilePO.setAttachmentType("01");
supvFilePO.setBusiId(planId);
supvFilePO.setType(type);
return this.save(supvFilePO);
}
@Override
public String detail(HttpServletResponse response,String busId, Integer type) {
SupvFile supvFile = this.getOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,busId).eq(SupvFile::getType,type));
if(Objects.nonNull(supvFile)){
fileStorageUtil.downloadStream(response,supvFile.getFile());
return null;
}else {
throw new BusinessException("不存在附件");
}
}
}

View File

@@ -0,0 +1,171 @@
package com.njcn.process.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.enums.ProcessResponseEnum;
import com.njcn.process.mapper.SupvFileMapper;
import com.njcn.process.mapper.SupvPlanMapper;
import com.njcn.process.pojo.param.SupvPlanParam;
import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.vo.SupvPlanVO;
import com.njcn.process.service.ISupvFileService;
import com.njcn.process.service.ISupvPlanService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.web.factory.PageFactory;
import liquibase.pro.packaged.L;
import liquibase.pro.packaged.S;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@Service
@RequiredArgsConstructor
public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> implements ISupvPlanService {
private final DeptFeignClient deptFeignClient;
private final SupvFileMapper supvFileMapper;
@Override
public boolean addPlan(SupvPlanParam supvPlanParam) {
checkParam(supvPlanParam,false);
SupvPlan supvPlan = new SupvPlan();
BeanUtil.copyProperties(supvPlanParam,supvPlan);
supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate()));
supvPlan.setSupvEndTime(PubUtils.localDateFormat(supvPlanParam.getSupvEndTime()));
supvPlan.setSupvStartTime(PubUtils.localDateFormat(supvPlanParam.getSupvStartTime()));
supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime()));
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
supvPlan.setIsUploadHead(0);
this.save(supvPlan);
return true;
}
@Override
public boolean updatePlan(SupvPlanParam supvPlanParam) {
checkParam(supvPlanParam,true);
SupvPlan supvPlan = new SupvPlan();
BeanUtil.copyProperties(supvPlanParam,supvPlan);
supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate()));
supvPlan.setSupvEndTime(PubUtils.localDateFormat(supvPlanParam.getSupvEndTime()));
supvPlan.setSupvStartTime(PubUtils.localDateFormat(supvPlanParam.getSupvStartTime()));
supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime()));
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
this.updateById(supvPlan);
return true;
}
@Override
public boolean delPlan(List<String> planIds) {
return this.removeByIds(planIds);
}
@Override
public Page<SupvPlanVO> pagePlan(SupvPlanParam supvPlanParam) {
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(StrUtil.isNotBlank(supvPlanParam.getSupvOrgId())){
List<String> deptIds = deptChildrenList(supvPlanParam.getSupvOrgId());
lambdaQueryWrapper.in(SupvPlan::getSupvOrgId,deptIds);
}
Map<String,PvTerminalTreeVO> mapCode = deptAllCodeList();
Map<String,PvTerminalTreeVO> mapList = deptAllList();
Page<SupvPlan> page = this.page(new Page<>(PageFactory.getPageNum(supvPlanParam), PageFactory.getPageSize(supvPlanParam)),lambdaQueryWrapper);
List<SupvPlanVO> supvPlanVOList = BeanUtil.copyToList(page.getRecords(),SupvPlanVO.class);
supvPlanVOList.forEach(item->{
PvTerminalTreeVO pvTerminalTreeVO = mapCode.get(item.getSupvOrgId());
item.setSupvOrgName(pvTerminalTreeVO.getName());
item.setCounty(pvTerminalTreeVO.getName());
PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid());
if(Objects.nonNull(pvTerminalTreeOne)){
item.setCity(pvTerminalTreeOne.getName());
}
PvTerminalTreeVO pvTerminalTreeTwo = mapList.get(pvTerminalTreeOne.getPid());
if(Objects.nonNull(pvTerminalTreeTwo)){
item.setProvince(pvTerminalTreeTwo.getName());
}
SupvFile supvFile = supvFileMapper.selectOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,item.getPlanId()).eq(SupvFile::getType,0));
if(Objects.nonNull(supvFile)){
item.setAttachmentName(supvFile.getAttachmentName());
}
});
Page<SupvPlanVO> pageVo = new Page<>();
pageVo.setTotal(page.getTotal());
pageVo.setPages(page.getPages());
pageVo.setSize(page.getSize());
pageVo.setRecords(supvPlanVOList);
return pageVo;
}
private void checkParam(SupvPlanParam supvPlanParam,Boolean updateFlag){
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvPlan::getWorkPlanName,supvPlanParam.getWorkPlanName());
if(updateFlag) {
if (supvPlanParam instanceof SupvPlanParam.UpdateSupvPlanParam) {
//修改
lambdaQueryWrapper.ne(SupvPlan::getPlanId, ((SupvPlanParam.UpdateSupvPlanParam) supvPlanParam).getPlanId());
}
}
int count = this.count(lambdaQueryWrapper);
if(count>0){
throw new BusinessException(ProcessResponseEnum.SUPV_PLAN_REPEAT);
}
//判断监督对象类型
}
@DS("pms")
private List<String> deptChildrenList(String deptId){
return deptFeignClient.getDepSonSelfCodetByDeptId(deptId).getData();
}
@DS("pms")
private Map<String,PvTerminalTreeVO> deptAllList(){
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
return deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity()));
}
@DS("pms")
private Map<String,PvTerminalTreeVO> deptAllCodeList(){
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
return deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
}
}

View File

@@ -0,0 +1,66 @@
package com.njcn.process.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
import com.njcn.process.enums.ProcessResponseEnum;
import com.njcn.process.mapper.SupvProblemMapper;
import com.njcn.process.pojo.param.SupvProblemParam;
import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.service.ISupvProblemService;
import com.njcn.web.factory.PageFactory;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@Service
public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvProblem> implements ISupvProblemService {
@Override
public boolean addProblem(SupvProblemParam supvProblemParam) {
SupvProblem supvProblem = new SupvProblem();
BeanUtil.copyProperties(supvProblemParam,supvProblem);
supvProblem.setPlanRectificationTime(PubUtils.localDateFormat(supvProblemParam.getPlanRectificationTime()));
supvProblem.setRectificationTime(PubUtils.localDateFormat(supvProblemParam.getRectificationTime()));
this.save(supvProblem);
return true;
}
@Override
public boolean updateProblem(SupvProblemParam supvProblemParam) {
SupvProblem supvProblem = new SupvProblem();
BeanUtil.copyProperties(supvProblemParam,supvProblem);
supvProblem.setPlanRectificationTime(PubUtils.localDateFormat(supvProblemParam.getPlanRectificationTime()));
supvProblem.setRectificationTime(PubUtils.localDateFormat(supvProblemParam.getRectificationTime()));
this.updateById(supvProblem);
return true;
}
@Override
public boolean delProblem(List<String> problemIds) {
return this.removeByIds(problemIds);
}
@Override
public Page<SupvProblem> pageProblem(SupvProblemParam supvProblemParam) {
LambdaQueryWrapper<SupvProblem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvProblem::getPlanId,supvProblemParam.getPlanId());
return this.page(new Page<>(PageFactory.getPageNum(supvProblemParam), PageFactory.getPageSize(supvProblemParam)),lambdaQueryWrapper);
}
}

View File

@@ -43,6 +43,9 @@ public class UserVO extends UserParam implements Serializable {
@ApiModelProperty("区域名称")
private String areaName;
@ApiModelProperty("部门层级")
private Integer deptLevel;
@ApiModelProperty("角色id")
private List<String> roleList;

View File

@@ -263,6 +263,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
userVO.setDeptName(deptService.getNameByDeptId(user.getDeptId()));
userVO.setRoleList(roleService.getIdByUserId(id));
userVO.setRole(roleService.getNameByUserId(id));
userVO.setDeptLevel(dept.getPids().split(StrUtil.COMMA).length);
return userVO;
}