技术监督管理

This commit is contained in:
2023-06-28 15:58:46 +08:00
parent 2eb2a41744
commit 970cd5b3dd
20 changed files with 765 additions and 47 deletions

View File

@@ -0,0 +1,37 @@
package com.njcn.process.pojo.dto.supv;
import lombok.Data;
import java.util.Date;
/**
* pqs
*
* @author cdf
* @date 2023/6/28
*/
@Data
public class PlanProblemData {
private String problemId;
private String planId;
private String dutyOrgId;
private String dutyOrgName;
private String monitorType;
private Date rectificationTime;
private Date planRectificationTime;
private String ifReleaseWarning;
private String simpleProblemDesc;
private String rectificationMeasure;
private String rectificationStatus;
private String createTime;
private String remark;
private String supvStandardSort;
private String supvStandard;
private String supvResouce;
private String problemLevel;
private String problemDesc;
private String problemLevelReason;
private String problemType;
private String rectificationProgramme;
}

View File

@@ -0,0 +1,186 @@
package com.njcn.process.pojo.dto.supv;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
/**
* pqs
*
* @author cdf
* @date 2023/6/28
*/
@Data
public class WorkPlanData {
private String planId;
private String provinceId;
private String provinceName;
private String cityId;
private String cityName;
private String countyId;
private String countyName;
/**
* 计划名称
*/
private String workPlanName;
/**
* 监督单位
*/
private String supvOrgId;
/**
* 监督单位名称
*/
private String supvOrgName;
/**
* 监督类型
*/
private String supvType;
/**
* 监督阶段
*/
private String supvStage;
/**
* 计划监督时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private String planSupvDate;
/**
* 计划编制人id
*/
private String planUserId;
/**
* 计划编制人名称
*/
private String planUserName;
/**
* 计划编制单位id
*/
private String planOrgId;
/**
* 计划编制单位名称
*/
private String planOrgName;
/**
* 创建时间
*/
private Date createTime;
/**
* 其他要求
*/
private String otherRemark;
/**
* 计划(实施)执行开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private String effectStartTime;
/**
* 计划(实施)执行结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate effectEndTime;
/**
* 实施状态
*/
private String effectStatus;
/**
* 监督对象id
*/
private String supvObjId;
/**
* 监督对象名称
*/
private String supvObjName;
/**
* 对象类型
*/
private String supvObjType;
/**
* 对象电压等级
*/
private String objVoltageLevel;
private String objVoltageLevelName;
/**
* 关联电站
*/
private String substationName;
/**
* 关联电站电压等级
*/
private String substationVoltageLevel;
/**
* 关联电站电压等级名称
*/
private String substationVoltageLevelName;
/**
* 监督对象属性
*/
private String objType;
/**
* 监督对象属性名称
*/
private String objTypeName;
/**
* 监督对象协议容量(MVA)
*/
private Double objCapacity;
/**
* 报告出具时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String reportIssueTime;
/**
* 电能质量问题发生时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String problemOcTime;
}

View File

@@ -92,7 +92,7 @@ public class SupvPlanParam extends BaseParam {
* 关联电站 * 关联电站
*/ */
@ApiModelProperty(value = "关联电站") @ApiModelProperty(value = "关联电站")
private String objRelationStation; private String substationName;
@ApiModelProperty(value = "关联电站电压等级") @ApiModelProperty(value = "关联电站电压等级")
private String substationVoltageLevel; private String substationVoltageLevel;
@@ -113,7 +113,7 @@ public class SupvPlanParam extends BaseParam {
@ApiModelProperty(value = "计划执行开始时间",required = true) @ApiModelProperty(value = "计划执行开始时间",required = true)
@NotNull(message = "计划执行开始时间不可为空") @NotNull(message = "计划执行开始时间不可为空")
@DateTimeStrValid(message = "计划执行开始时间格式有误") @DateTimeStrValid(message = "计划执行开始时间格式有误")
private String supvStartTime; private String effectStartTime;
/** /**
* 计划执行结束时间 * 计划执行结束时间
@@ -121,7 +121,7 @@ public class SupvPlanParam extends BaseParam {
@ApiModelProperty(value = "计划执行结束时间",required = true) @ApiModelProperty(value = "计划执行结束时间",required = true)
@NotNull(message = "计划执行结束时间不可为空") @NotNull(message = "计划执行结束时间不可为空")
@DateTimeStrValid(message = "计划执行结束时间格式有误") @DateTimeStrValid(message = "计划执行结束时间格式有误")
private String supvEndTime; private String effectEndTime;
/** /**
* 报告出具时间 * 报告出具时间
@@ -141,8 +141,8 @@ public class SupvPlanParam extends BaseParam {
/** /**
* 备注 * 备注
*/ */
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注(其他要求)")
private String planRemark; private String otherRemark;
/** /**
@@ -152,7 +152,8 @@ public class SupvPlanParam extends BaseParam {
@NotBlank(message = "计划编制单位id不可为空") @NotBlank(message = "计划编制单位id不可为空")
private String planOrgId; private String planOrgId;
@ApiModelProperty(value = "实施状态")
private String effectStatus;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@@ -113,6 +113,9 @@ public class SupvProblemParam extends BaseParam {
@NotBlank(message = "问题类型不可为空") @NotBlank(message = "问题类型不可为空")
private String problemType; private String problemType;
@ApiModelProperty(value = "备注")
private String remark;
/** /**
* 整改方案 * 整改方案
*/ */

View File

@@ -1,11 +1,16 @@
package com.njcn.process.pojo.po; package com.njcn.process.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity; import com.njcn.db.bo.BaseEntity;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.web.multipart.MultipartFile;
/** /**
* <p> * <p>
@@ -15,19 +20,22 @@ import lombok.Setter;
* @author hongawen * @author hongawen
* @since 2023-06-21 * @since 2023-06-21
*/ */
@Getter @Data
@Setter
@TableName("supv_file") @TableName("supv_file")
public class SupvFile extends BaseEntity { public class SupvFile {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String id; @TableId
private String uuid;
/** /**
* 附件路径 * 附件路径
*/ */
private String file; private String fileUrl;
@TableField(exist = false)
private MultipartFile file;
/** /**
* 附件名称 * 附件名称
@@ -47,5 +55,11 @@ public class SupvFile extends BaseEntity {
*/ */
private String busiId; private String busiId;
private String uploaderName;
private LocalDateTime uploadTime;
private String uploaderId;
} }

View File

@@ -74,7 +74,7 @@ public class SupvPlan extends BaseEntity {
/** /**
* 关联电站 * 关联电站
*/ */
private String objRelationStation; private String substationName;
/** /**
@@ -102,13 +102,13 @@ public class SupvPlan extends BaseEntity {
* 计划执行开始时间 * 计划执行开始时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate supvStartTime; private LocalDate effectStartTime;
/** /**
* 计划执行结束时间 * 计划执行结束时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate supvEndTime; private LocalDate effectEndTime;
/** /**
* 报告出具时间 * 报告出具时间
@@ -125,7 +125,7 @@ public class SupvPlan extends BaseEntity {
/** /**
* 备注 * 备注
*/ */
private String planRemark; private String otherRemark;
/** /**
* 计划编制人id * 计划编制人id
@@ -138,6 +138,10 @@ public class SupvPlan extends BaseEntity {
private String planOrgId; private String planOrgId;
/**
* 实施状态
*/
private String effectStatus;
/** /**
* 0.未上送 1.上送 2.取消上送 * 0.未上送 1.上送 2.取消上送

View File

@@ -114,5 +114,16 @@ public class SupvProblem extends BaseEntity {
private String rectificationMeasure; private String rectificationMeasure;
/**
* 0.以上送 1.未上送 2.取消上送
*/
private Integer isUploadHead;
/**
* 备注
*/
private String remark;
} }

View File

@@ -106,13 +106,13 @@ public class SupvPlanVO {
* 计划执行开始时间 * 计划执行开始时间
*/ */
@ApiModelProperty(value = "计划执行开始时间",required = true) @ApiModelProperty(value = "计划执行开始时间",required = true)
private String supvStartTime; private String effectStartTime;
/** /**
* 计划执行结束时间 * 计划执行结束时间
*/ */
@ApiModelProperty(value = "计划执行结束时间",required = true) @ApiModelProperty(value = "计划执行结束时间",required = true)
private String supvEndTime; private String effectEndTime;
/** /**
* 报告出具时间 * 报告出具时间
@@ -133,7 +133,7 @@ public class SupvPlanVO {
* 备注 * 备注
*/ */
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String planRemark; private String otherRemark;
@ApiModelProperty(value = "省部门") @ApiModelProperty(value = "省部门")
private String province; private String province;
@@ -153,4 +153,13 @@ public class SupvPlanVO {
*/ */
@ApiModelProperty(value = "0.未上送 1.上送 2.取消上送") @ApiModelProperty(value = "0.未上送 1.上送 2.取消上送")
private Integer isUploadHead; private Integer isUploadHead;
private String createBy;
/**
* 实施状态
*/
private String effectStatus;
private String createTime;
} }

View File

@@ -39,9 +39,9 @@ public class SupvFileController extends BaseController {
@PostMapping("planUpload") @PostMapping("planUpload")
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPLOAD) @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPLOAD)
@ApiOperation("监督计划问题附件上传") @ApiOperation("监督计划问题附件上传")
public HttpResult<Object> planUpload(@ApiParam(value = "文件", required = true) @RequestPart("files") MultipartFile file, @RequestParam("planId") String planId, @RequestParam("type") Integer type){ public HttpResult<Object> planUpload(@ApiParam(value = "文件", required = true) @RequestPart("files") MultipartFile file, @RequestParam("planId") String planId, @RequestParam("type") Integer type,@RequestParam("attachmentType")String attachmentType){
String methodDescribe = getMethodDescribe("planUpload"); String methodDescribe = getMethodDescribe("planUpload");
iSupvFileService.planUpload(file,planId,type); iSupvFileService.planUpload(file,planId,type,attachmentType);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} }

View File

@@ -11,6 +11,7 @@ import com.njcn.process.pojo.param.SupvPlanParam;
import com.njcn.process.pojo.po.SupvReportM; import com.njcn.process.pojo.po.SupvReportM;
import com.njcn.process.service.ISupvReportMService; import com.njcn.process.service.ISupvReportMService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import com.njcn.web.pojo.annotation.DateTimeStrValid;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@@ -47,11 +48,10 @@ public class SupvMonthStatisController extends BaseController {
@PostMapping("statisticReport") @PostMapping("statisticReport")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("监督月报统计") @ApiOperation("监督月报统计")
public HttpResult<Object> statisticReport(@RequestParam("timeId")String timeId){ public HttpResult<Object> statisticReport(@RequestParam("timeId") String timeId){
String methodDescribe = getMethodDescribe("statisticReport"); String methodDescribe = getMethodDescribe("statisticReport");
LocalDate localDate = LocalDate.parse(timeId); LocalDate localDate = LocalDate.parse(timeId);
boolean flag = iSupvReportMService.statisticSuperviseReport(localDate); boolean flag = iSupvReportMService.statisticSuperviseReport(localDate);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
} }

View File

@@ -0,0 +1,116 @@
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.process.service.SupvPushGwService;
import com.njcn.web.controller.BaseController;
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 java.util.List;
/**
* pqs
* 上送国网接口
* @author cdf
* @date 2023/6/28
*/
@RestController
@RequestMapping("/supv/push")
@Api(tags = "技术监督上送国网接口")
@RequiredArgsConstructor
public class SupvPushGwController extends BaseController {
private final SupvPushGwService supvPushGwService;
/**
* 接收电能质量技术监督工作计划数据接口
* @author cdf
* @date 2023/6/28
*/
@PostMapping("pushPlan")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("推送技术监督工作计划")
@ApiImplicitParam(name = "planIds",value = "请求体",required = true)
public HttpResult<Object> pushPlan(@RequestBody List<String> planIds){
String methodDescribe = getMethodDescribe("pushPlan");
supvPushGwService.pushPlan(planIds);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 接收电能质量技术监督工作计划数据接口
* @author cdf
* @date 2023/6/28
*/
@PostMapping("pushQuestion")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("推送技术监督实施问题")
@ApiImplicitParam(name = "problemIds",value = "请求体",required = true)
public HttpResult<Object> pushQuestion(@RequestBody List<String> problemIds){
String methodDescribe = getMethodDescribe("pushQuestion");
supvPushGwService.pushPlan(problemIds);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 电能质量技术监督实施问题整改数据接口
* @author cdf
* @date 2023/6/28
*/
@PostMapping("pushQueRem")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("推送电能质量技术监督实施问题整改数据接口")
@ApiImplicitParam(name = "planIds",value = "请求体",required = true)
public HttpResult<Object> pushQueRem(@RequestBody List<String> planIds){
String methodDescribe = getMethodDescribe("pushQueRem");
supvPushGwService.pushPlan(planIds);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 推送附件接口
* @author cdf
* @date 2023/6/28
*/
@PostMapping("pushFile")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("推送附件接口")
@ApiImplicitParam(name = "busIds",value = "请求体",required = true)
public HttpResult<Object> pushFile(@RequestBody List<String> busIds){
String methodDescribe = getMethodDescribe("pushFile");
supvPushGwService.pushFile(busIds);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 推送技术监督月报统计数据接口
* @author cdf
* @date 2023/6/28
*/
@PostMapping("pushMonthReportStatistic")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("推送技术监督月报统计数据接口")
@ApiImplicitParam(name = "monthReportId",value = "请求体",required = true)
public HttpResult<Object> pushMonthReportStatistic(@RequestBody List<String> monthReportId){
String methodDescribe = getMethodDescribe("pushMonthReportStatistic");
supvPushGwService.pushMonthReportStatistic(monthReportId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -22,7 +22,7 @@ public interface ISupvFileService extends IService<SupvFile> {
* @author cdf * @author cdf
* @date 2023/6/25 * @date 2023/6/25
*/ */
boolean planUpload(MultipartFile file,String planId, Integer type); boolean planUpload(MultipartFile file,String planId, Integer type,String attachmentType);
String detail(HttpServletResponse response,String busId,Integer type); String detail(HttpServletResponse response,String busId,Integer type);

View File

@@ -0,0 +1,50 @@
package com.njcn.process.service;
import java.util.List;
/**
* pqs
*
* @author cdf
* @date 2023/6/28
*/
public interface SupvPushGwService {
/**
*
* @author cdf
* @date 2023/6/28
*/
boolean pushPlan(List<String> planIds);
/**
*
* @author cdf
* @date 2023/6/28
*/
boolean pushQuestion(List<String> problemIds);
/**
*
* @author cdf
* @date 2023/6/28
*/
boolean pushFile(List<String> busIds);
/**
*
* @author cdf
* @date 2023/6/28
*/
boolean pushMonthReportStatistic(List<String> monthReportId);
/**
*
* @author cdf
* @date 2023/6/28
*/
boolean deletePlan(List<String> planIds);
}

View File

@@ -9,11 +9,13 @@ import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.mapper.SupvFileMapper; import com.njcn.process.mapper.SupvFileMapper;
import com.njcn.process.pojo.po.SupvFile; import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.service.ISupvFileService; import com.njcn.process.service.ISupvFileService;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.Objects; import java.util.Objects;
/** /**
@@ -34,20 +36,23 @@ public class SupvFileServiceImpl extends ServiceImpl<SupvFileMapper, SupvFile> i
private final SupvFileMapper supvFileMapper; private final SupvFileMapper supvFileMapper;
@Override @Override
public boolean planUpload(MultipartFile file, String planId, Integer type) { public boolean planUpload(MultipartFile file, String planId, Integer type,String attachmentType) {
SupvFile supvFile = this.getOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,planId).eq(SupvFile::getType,type)); SupvFile supvFile = this.getOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,planId).eq(SupvFile::getType,type));
String url = fileStorageUtil.uploadMultipart(file, OssPath.SURVEY_RESULT); String url = fileStorageUtil.uploadMultipart(file, OssPath.SURVEY_RESULT);
SupvFile supvFilePO = new SupvFile(); SupvFile supvFilePO = new SupvFile();
supvFilePO.setAttachmentName(file.getOriginalFilename()); supvFilePO.setAttachmentName(file.getOriginalFilename());
supvFilePO.setFile(url); supvFilePO.setFileUrl(url);
if(Objects.nonNull(supvFile)){ if(Objects.nonNull(supvFile)){
fileStorageUtil.deleteFile(supvFile.getFile()); fileStorageUtil.deleteFile(supvFile.getFileUrl());
supvFilePO.setId(supvFile.getId()); supvFilePO.setUuid(supvFile.getUuid());
return this.updateById(supvFilePO); return this.updateById(supvFilePO);
} }
supvFilePO.setAttachmentType("01"); supvFilePO.setAttachmentType(attachmentType);
supvFilePO.setBusiId(planId); supvFilePO.setBusiId(planId);
supvFilePO.setType(type); supvFilePO.setType(type);
supvFilePO.setUploaderId(RequestUtil.getUserIndex());
supvFilePO.setUploadTime(LocalDateTime.now());
supvFilePO.setUploaderName(RequestUtil.getUsername());
return this.save(supvFilePO); return this.save(supvFilePO);
} }
@@ -55,7 +60,7 @@ public class SupvFileServiceImpl extends ServiceImpl<SupvFileMapper, SupvFile> i
public String detail(HttpServletResponse response,String busId, Integer type) { public String detail(HttpServletResponse response,String busId, Integer type) {
SupvFile supvFile = this.getOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,busId).eq(SupvFile::getType,type)); SupvFile supvFile = this.getOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,busId).eq(SupvFile::getType,type));
if(Objects.nonNull(supvFile)){ if(Objects.nonNull(supvFile)){
fileStorageUtil.downloadStream(response,supvFile.getFile()); fileStorageUtil.downloadStream(response,supvFile.getFileUrl());
return null; return null;
}else { }else {
throw new BusinessException("不存在附件"); throw new BusinessException("不存在附件");

View File

@@ -22,6 +22,8 @@ import com.njcn.process.pojo.vo.SupvPlanVO;
import com.njcn.process.service.ISupvFileService; import com.njcn.process.service.ISupvFileService;
import com.njcn.process.service.ISupvPlanService; import com.njcn.process.service.ISupvPlanService;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.api.UserFeignClient;
import com.njcn.user.pojo.po.User;
import com.njcn.user.pojo.vo.PvTerminalTreeVO; import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
import com.njcn.web.utils.RequestUtil; import com.njcn.web.utils.RequestUtil;
@@ -54,6 +56,8 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
private final SupvFileMapper supvFileMapper; private final SupvFileMapper supvFileMapper;
private final UserFeignClient userFeignClient;
@Override @Override
public boolean addPlan(SupvPlanParam supvPlanParam) { public boolean addPlan(SupvPlanParam supvPlanParam) {
@@ -61,12 +65,13 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
SupvPlan supvPlan = new SupvPlan(); SupvPlan supvPlan = new SupvPlan();
BeanUtil.copyProperties(supvPlanParam,supvPlan); BeanUtil.copyProperties(supvPlanParam,supvPlan);
supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate())); supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate()));
supvPlan.setSupvEndTime(PubUtils.localDateFormat(supvPlanParam.getSupvEndTime())); supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime()));
supvPlan.setSupvStartTime(PubUtils.localDateFormat(supvPlanParam.getSupvStartTime())); supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime()));
supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime())); supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime()));
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime())); supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
supvPlan.setIsUploadHead(0); supvPlan.setIsUploadHead(0);
supvPlan.setPlanUserId(RequestUtil.getUserIndex()); supvPlan.setPlanUserId(RequestUtil.getUserIndex());
this.save(supvPlan); this.save(supvPlan);
return true; return true;
} }
@@ -77,8 +82,8 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
SupvPlan supvPlan = new SupvPlan(); SupvPlan supvPlan = new SupvPlan();
BeanUtil.copyProperties(supvPlanParam,supvPlan); BeanUtil.copyProperties(supvPlanParam,supvPlan);
supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate())); supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate()));
supvPlan.setSupvEndTime(PubUtils.localDateFormat(supvPlanParam.getSupvEndTime())); supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime()));
supvPlan.setSupvStartTime(PubUtils.localDateFormat(supvPlanParam.getSupvStartTime())); supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime()));
supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime())); supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime()));
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime())); supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
this.updateById(supvPlan); this.updateById(supvPlan);
@@ -100,7 +105,7 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
public Page<SupvPlanVO> pagePlan(SupvPlanParam supvPlanParam) { public Page<SupvPlanVO> pagePlan(SupvPlanParam supvPlanParam) {
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(StrUtil.isNotBlank(supvPlanParam.getSupvOrgId())){ if(StrUtil.isNotBlank(supvPlanParam.getSupvOrgId())){
List<String> deptIds = deptFeignClient.getDepSonSelfCodetByDeptId(supvPlanParam.getSupvOrgId()).getData(); List<String> deptIds = deptFeignClient.getDepSonSelfCodetByCode(supvPlanParam.getSupvOrgId()).getData();
lambdaQueryWrapper.in(SupvPlan::getSupvOrgId,deptIds); lambdaQueryWrapper.in(SupvPlan::getSupvOrgId,deptIds);
} }
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData(); List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
@@ -110,13 +115,27 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
Page<SupvPlan> page = this.page(new Page<>(PageFactory.getPageNum(supvPlanParam), PageFactory.getPageSize(supvPlanParam)),lambdaQueryWrapper); Page<SupvPlan> page = this.page(new Page<>(PageFactory.getPageNum(supvPlanParam), PageFactory.getPageSize(supvPlanParam)),lambdaQueryWrapper);
List<SupvPlanVO> supvPlanVOList = BeanUtil.copyToList(page.getRecords(),SupvPlanVO.class); List<SupvPlanVO> supvPlanVOList = BeanUtil.copyToList(page.getRecords(),SupvPlanVO.class);
List<String> userIds = supvPlanVOList.stream().map(SupvPlanVO::getCreateBy).distinct().collect(Collectors.toList());
supvPlanVOList.forEach(item->{ supvPlanVOList.forEach(item->{
PvTerminalTreeVO pvTerminalTreeVO = null; PvTerminalTreeVO pvTerminalTreeVO = null;
if(mapCode.containsKey(item.getSupvOrgId())) { if(mapCode.containsKey(item.getSupvOrgId())) {
pvTerminalTreeVO = mapCode.get(item.getSupvOrgId()); pvTerminalTreeVO = mapCode.get(item.getSupvOrgId());
item.setSupvOrgName(pvTerminalTreeVO.getName()); item.setSupvOrgName(pvTerminalTreeVO.getName());
item.setCounty(pvTerminalTreeVO.getName()); int deptLevel = pvTerminalTreeVO.getPids().split(StrUtil.COMMA).length;
if(deptLevel == 2){
//省
item.setProvince(pvTerminalTreeVO.getName());
}else if(deptLevel == 3){
//市
item.setCity(pvTerminalTreeVO.getName());
if(mapList.containsKey(pvTerminalTreeVO.getPid())) { if(mapList.containsKey(pvTerminalTreeVO.getPid())) {
PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid());
item.setProvince(pvTerminalTreeOne.getName());
}
}else if(deptLevel == 4){
//县
if(mapList.containsKey(pvTerminalTreeVO.getPid())) {
item.setCounty(pvTerminalTreeVO.getName());
PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid()); PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid());
if (Objects.nonNull(pvTerminalTreeOne)) { if (Objects.nonNull(pvTerminalTreeOne)) {
item.setCity(pvTerminalTreeOne.getName()); item.setCity(pvTerminalTreeOne.getName());
@@ -129,6 +148,7 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
} }
} }
} }
}
if(mapCode.containsKey(item.getPlanOrgId())) { if(mapCode.containsKey(item.getPlanOrgId())) {
item.setPlanOrgName(mapCode.get(item.getPlanOrgId()).getName()); item.setPlanOrgName(mapCode.get(item.getPlanOrgId()).getName());
@@ -138,6 +158,13 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
if(Objects.nonNull(supvFile)){ if(Objects.nonNull(supvFile)){
item.setAttachmentName(supvFile.getAttachmentName()); item.setAttachmentName(supvFile.getAttachmentName());
} }
List<User> userList= userFeignClient.getUserByIdList(userIds).getData();
Map<String, User> map = userList.stream().collect(Collectors.toMap(User::getId,Function.identity()));
if(map.containsKey(item.getCreateBy())) {
item.setCreateBy(map.get(item.getCreateBy()).getName());
}
}); });
Page<SupvPlanVO> pageVo = new Page<>(); Page<SupvPlanVO> pageVo = new Page<>();
pageVo.setTotal(page.getTotal()); pageVo.setTotal(page.getTotal());

View File

@@ -0,0 +1,240 @@
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.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.process.mapper.SupvFileMapper;
import com.njcn.process.mapper.SupvPlanMapper;
import com.njcn.process.mapper.SupvProblemMapper;
import com.njcn.process.mapper.SupvReportMMapper;
import com.njcn.process.pojo.dto.supv.PlanProblemData;
import com.njcn.process.pojo.dto.supv.WorkPlanData;
import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.po.SupvReportM;
import com.njcn.process.service.SupvPushGwService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.po.Dept;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import liquibase.pro.packaged.W;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* pqs
*
* @author cdf
* @date 2023/6/28
*/
@Service
@RequiredArgsConstructor
public class SupvPushGwServiceImpl implements SupvPushGwService {
private final SupvPlanMapper supvPlanMapper;
private final SupvProblemMapper supvProblemMapper;
private final SupvFileMapper supvFileMapper;
private final SupvReportMMapper supvReportMMapper;
private final DicDataFeignClient dicDataFeignClient;
private final DeptFeignClient deptFeignClient;
@Override
public boolean pushPlan(List<String> planIds) {
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(SupvPlan::getPlanId,planIds);
List<SupvPlan> supvPlanList = supvPlanMapper.selectList(lambdaQueryWrapper);
if(CollUtil.isEmpty(supvPlanList)){
return false;
}
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
Map<String,PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
Map<String,PvTerminalTreeVO> mapList = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity()));
List<DictData> supvDicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPV_TYPE.getCode()).getData();
Map<String, DictData> mapType = supvDicList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
List<DictData> supvStateDicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPV_STAGE.getCode()).getData();
Map<String, DictData> mapSupvState = supvStateDicList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
List<DictData> supveffectDicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EFFECT_STATUS.getCode()).getData();
Map<String, DictData> mapSupvEffect = supveffectDicList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
List<DictData> supvObjTypeDicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPV_OBJ_TYPE.getCode()).getData();
Map<String, DictData> mapObjType = supvObjTypeDicList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
List<DictData> supvVoltageDicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
Map<String, DictData> mapVoltage = supvVoltageDicList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
List<WorkPlanData> workPlanDataList = new ArrayList<>();
for(SupvPlan supvPlan:supvPlanList){
WorkPlanData workPlanData = new WorkPlanData();
BeanUtil.copyProperties(supvPlan,workPlanData);
PvTerminalTreeVO pvTerminalTreeVO = null;
if(mapCode.containsKey(supvPlan.getSupvOrgId())) {
pvTerminalTreeVO = mapCode.get(supvPlan.getSupvOrgId());
workPlanData.setSupvOrgName(pvTerminalTreeVO.getName());
int deptLevel = pvTerminalTreeVO.getPids().split(StrUtil.COMMA).length;
if(deptLevel == 2){
//省
workPlanData.setProvinceName(pvTerminalTreeVO.getName());
}else if(deptLevel == 3){
//市
workPlanData.setCityName(pvTerminalTreeVO.getName());
if(mapList.containsKey(pvTerminalTreeVO.getPid())) {
PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid());
workPlanData.setProvinceName(pvTerminalTreeOne.getName());
}
}else if(deptLevel == 4){
//县
if(mapList.containsKey(pvTerminalTreeVO.getPid())) {
workPlanData.setCountyName(pvTerminalTreeVO.getName());
PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid());
if (Objects.nonNull(pvTerminalTreeOne)) {
workPlanData.setCityName(pvTerminalTreeOne.getName());
if(mapList.containsKey(pvTerminalTreeOne.getPid())) {
PvTerminalTreeVO pvTerminalTreeTwo = mapList.get(pvTerminalTreeOne.getPid());
if (Objects.nonNull(pvTerminalTreeTwo)) {
workPlanData.setProvinceName(pvTerminalTreeTwo.getName());
}
}
}
}
}
}
//处理字典
//监督类型编码
if(mapType.containsKey(workPlanData.getSupvType())) {
workPlanData.setSupvType(String.format("%02d", mapType.get(workPlanData.getSupvType()).getAlgoDescribe()));
}
//监督类型编码
if(mapType.containsKey(workPlanData.getSupvStage())) {
workPlanData.setSupvStage(String.format("%02d", mapSupvState.get(workPlanData.getSupvType()).getAlgoDescribe()));
}
//监督阶段
if(mapType.containsKey(workPlanData.getEffectStatus())) {
workPlanData.setEffectStatus(String.format("%02d", mapSupvState.get(workPlanData.getEffectStatus()).getAlgoDescribe()));
}
//监督对象类型
if(mapType.containsKey(workPlanData.getSupvType())) {
workPlanData.setSupvType(String.format("%02d", mapSupvState.get(workPlanData.getSupvType()).getAlgoDescribe()));
}
//电站等级
if(mapType.containsKey(workPlanData.getSubstationVoltageLevel())) {
workPlanData.setSubstationVoltageLevel(String.format("%02d", mapSupvState.get(workPlanData.getSubstationVoltageLevel()).getAlgoDescribe()));
}
workPlanDataList.add(workPlanData);
}
if(workPlanDataList.size()>100){
throw new BusinessException("一次最多上送100条数据");
}
//TODO 调用国网接口
return true;
}
@Override
public boolean pushQuestion(List<String> problemIds) {
LambdaQueryWrapper<SupvProblem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(SupvProblem::getProblemId,problemIds);
List<SupvProblem> supvProblemList = supvProblemMapper.selectList(lambdaQueryWrapper);
List<DictData> monitorTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITOR_TYPE.getCode()).getData();
Map<String, DictData> mapMonitorType = monitorTypeList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
List<DictData> problemTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPV_PROBLEM_TYPE.getCode()).getData();
Map<String, DictData> mapProblemType = problemTypeList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
List<DictData> reList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.RECTIFICATION_MEASURE.getCode()).getData();
Map<String, DictData> mapRe = reList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
List<PlanProblemData> planProblemDataList = new ArrayList<>();
for(SupvProblem supvProblem : supvProblemList){
PlanProblemData planProblemData = new PlanProblemData();
BeanUtil.copyProperties(supvProblem,planProblemData);
Dept dept = deptFeignClient.getDeptByCode(planProblemData.getDutyOrgId()).getData();
planProblemData.setDutyOrgName(dept.getName());
if(mapMonitorType.containsKey(planProblemData.getMonitorType())){
planProblemData.setMonitorType(String.format("%02d",mapMonitorType.get(planProblemData.getMonitorType()).getAlgoDescribe()));
}
if(mapProblemType.containsKey(planProblemData.getProblemType())){
planProblemData.setProblemType(String.format("%02d",mapMonitorType.get(planProblemData.getMonitorType()).getAlgoDescribe()));
}
if(mapRe.containsKey(planProblemData.getRectificationMeasure())){
planProblemData.setRectificationMeasure(String.format("%02d",mapMonitorType.get(planProblemData.getRectificationMeasure()).getAlgoDescribe()));
}
planProblemDataList.add(planProblemData);
}
if(planProblemDataList.size()>100){
throw new BusinessException("一次最多上送100条数据");
}
//TODO
// 目前一个问题对应一个措施,上送一个问题需要调用问题接口和整改措施接口
return true;
}
@Override
public boolean pushFile(List<String> busIds) {
LambdaQueryWrapper<SupvFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvFile::getBusiId,busIds);
List<SupvFile> supvFiles = supvFileMapper.selectList(lambdaQueryWrapper);
if(supvFiles.size()>100){
throw new BusinessException("一次最多上送100条数据");
}
//TODO 调用上送接口
return true;
}
@Override
public boolean pushMonthReportStatistic(List<String> monthReportId) {
LambdaQueryWrapper<SupvReportM> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvReportM::getMonthReportId,monthReportId);
List<SupvReportM> supvReportMList = supvReportMMapper.selectList(lambdaQueryWrapper);
if(supvReportMList.size()>100){
throw new BusinessException("一次最多上送100条数据");
}
//TODO 调用上送接口
return true;
}
@Override
public boolean deletePlan(List<String> planIds) {
return false;
}
}

View File

@@ -235,10 +235,14 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
@Override @Override
public Page<SupvReportM> statisticReportPage(BaseParam baseParam) { public Page<SupvReportM> statisticReportPage(BaseParam baseParam) {
List<String> deptCodes = new ArrayList<>();
if(StrUtil.isNotBlank(baseParam.getSearchValue())){
deptCodes = deptFeignClient.getDepSonSelfCodetByCode(baseParam.getSearchValue()).getData();
}
LambdaQueryWrapper<SupvReportM> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvReportM> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(StrUtil.isNotBlank(baseParam.getSearchValue()),SupvReportM::getStatisticsDept,baseParam.getSearchValue()) lambdaQueryWrapper.in(StrUtil.isNotBlank(baseParam.getSearchValue()),SupvReportM::getStatisticsDept,deptCodes)
.between(StrUtil.isNotBlank(baseParam.getSearchBeginTime()),SupvReportM::getStatisticsDate,baseParam.getSearchBeginTime(),baseParam.getSearchEndTime()); .between(StrUtil.isNotBlank(baseParam.getSearchBeginTime()),SupvReportM::getStatisticsDate,baseParam.getSearchBeginTime(),baseParam.getSearchEndTime());
return this.page(new Page<SupvReportM>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam)),lambdaQueryWrapper); return this.page(new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam)),lambdaQueryWrapper);
} }

View File

@@ -85,7 +85,15 @@ public enum DicDataTypeEnum {
Neutral_Point("中性点接地方式","Neutral_Point"), Neutral_Point("中性点接地方式","Neutral_Point"),
DEVICE_REGIONLYPE("设备地区特征","Device_RegionLype"), DEVICE_REGIONLYPE("设备地区特征","Device_RegionLype"),
DEVICE_USERNATURE("设备使用性质代码","Device_UseNature"), DEVICE_USERNATURE("设备使用性质代码","Device_UseNature"),
SUPV_TYPE("监督类型","supv_type") SUPV_TYPE("监督类型","supv_type"),
SUPV_OBJ_TYPE("监督对象类型","supv_obj_type"),
SUPV_STAGE("监督阶段","supv_stage"),
EFFECT_STATUS("实施状态","effect_status"),
MONITOR_TYPE("监督监测点类型","monitor_type"),
SUPV_PROBLEM_TYPE("监督问题类型","problem_type"),
RECTIFICATION_MEASURE("整改方案","RectificationMeasure")

View File

@@ -21,6 +21,9 @@ public class PvTerminalTreeVO {
@ApiModelProperty(name = "pid",value = "父级id") @ApiModelProperty(name = "pid",value = "父级id")
private String pid; private String pid;
@ApiModelProperty(name = "pids",value = "父级ids")
private String pids;
@ApiModelProperty(name = "name",value = "名称") @ApiModelProperty(name = "name",value = "名称")
private String name; private String name;

View File

@@ -166,7 +166,7 @@
<select id="allDeptList" resultType="PvTerminalTreeVO"> <select id="allDeptList" resultType="PvTerminalTreeVO">
select id,name,pid,code from sys_dept where state = 1 order by sort select id,name,pid,pids,code from sys_dept where state = 1 order by sort
</select> </select>