技术监督管理

This commit is contained in:
2023-06-27 16:47:16 +08:00
parent 916b68d307
commit aca47f35ff
19 changed files with 812 additions and 39 deletions

View File

@@ -26,6 +26,13 @@ public class DeptGetBase implements Serializable {
*/
private String unitName;
/**
* 部门层级 1.全国 2.省级 3.市级 4.县级 (具体根据单位层级调整)
* @author cdf
* @date 2023/6/26
*/
private Integer deptLevel;
/**
* 所有子级单位索引
*/

View File

@@ -1,6 +1,7 @@
package com.njcn.device.pms.service.ledgerManger.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.enums.common.ServerEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
@@ -99,6 +100,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
List<String> deptChildren = deptDTOList.stream().filter(deptDTO -> deptDTO.getPids().contains(it.getId())).map(DeptDTO::getCode).collect(Collectors.toList());
deptChildren.add(it.getId());
deptGetBase.setUnitChildrenList(deptChildren);
deptGetBase.setDeptLevel(it.getPids().split(StrUtil.COMMA).length);
result.add(deptGetBase);
});
//redisUtil.saveByKey(commTerminal + deptGetLineParam.getDeptId(),result);

View File

@@ -10,9 +10,9 @@ import lombok.Data;
* @createTime 2022/11/11 10:34
*/
@Data
public class PublicDTO {
public class ProcessPublicDTO {
private String id;
private String date;
private Integer value;
}

View File

@@ -92,9 +92,21 @@ public class SupvPlanParam extends BaseParam {
* 关联电站
*/
@ApiModelProperty(value = "关联电站")
@NotBlank(message = "关联电站不可为空")
private String objRelationStation;
@ApiModelProperty(value = "关联电站电压等级")
private String substationVoltageLevel;
@ApiModelProperty(value = "监督对象属性")
private String objType;
@ApiModelProperty(value = "监督对象属性名称")
private String objTypeName;
@ApiModelProperty(value = "监督对象协议容量(MVA)")
private Double objCapacity;
/**
* 计划执行开始时间
*/
@@ -123,6 +135,7 @@ public class SupvPlanParam extends BaseParam {
*/
@ApiModelProperty(value = "电能质量问题发生时间",required = true)
@DateTimeStrValid(message = "电能质量问题发生时间格式有误",format = "yyyy-MM-dd HH:mm:ss")
@NotBlank(message = "电能质量问题发生时间不可为空")
private String problemOcTime;
/**
@@ -132,6 +145,15 @@ public class SupvPlanParam extends BaseParam {
private String planRemark;
/**
* 计划编制单位id
*/
@ApiModelProperty(value = "计划编制单位id")
@NotBlank(message = "计划编制单位id不可为空")
private String planOrgId;
@EqualsAndHashCode(callSuper = true)
@Data

View File

@@ -120,6 +120,16 @@ public class SupvProblemParam extends BaseParam {
@NotBlank(message = "整改方案不可为空")
private String rectificationProgramme;
@ApiModelProperty(value = "整改措施")
private String rectificationMeasure;
/**
* 整改情况01已整改02未整改
*/
@ApiModelProperty(value = "整改情况",required = true)
@NotBlank(message = "整改情况不可为空")
private String rectificationStatus;
@EqualsAndHashCode(callSuper = true)
@Data
public static class UpdateSupvProblemParam extends SupvProblemParam{

View File

@@ -8,6 +8,7 @@ import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@@ -75,6 +76,28 @@ public class SupvPlan extends BaseEntity {
*/
private String objRelationStation;
/**
* 关联电站电压等级
*/
private String substationVoltageLevel;
/**
* 监督对象属性
*/
private String objType;
/**
* 监督对象属性名称
*/
private String objTypeName;
/**
* 监督对象协议容量(MVA)
*/
private Double objCapacity;
/**
* 计划执行开始时间
*/
@@ -104,6 +127,18 @@ public class SupvPlan extends BaseEntity {
*/
private String planRemark;
/**
* 计划编制人id
*/
private String planUserId;
/**
* 计划编制单位id
*/
private String planOrgId;
/**
* 0.未上送 1.上送 2.取消上送
*/

View File

@@ -1,5 +1,6 @@
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.njcn.db.bo.BaseEntity;
@@ -7,11 +8,14 @@ import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
/**
* <p>
*
@@ -40,6 +44,9 @@ public class SupvProblem extends BaseEntity {
*/
private String dutyOrgId;
@TableField(exist = false)
private String dutyOrgName;
/**
* 监测点类型 ,仅供电电压监督计划必填
*/
@@ -95,6 +102,17 @@ public class SupvProblem extends BaseEntity {
*/
private String rectificationProgramme;
/**
* 整改情况01已整改02未整改
*/
private String rectificationStatus;
/**
* 整改措施
*/
private String rectificationMeasure;
}

View File

@@ -0,0 +1,207 @@
package com.njcn.process.pojo.po;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import java.time.LocalDate;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
*
* </p>
*
* @author hongawen
* @since 2023-06-26
*/
@Data
@TableName("supv_report_m")
public class SupvReportM {
private static final long serialVersionUID = 1L;
@TableId
private String monthReportId;
@MppMultiId
private LocalDate statisticsDate;
@MppMultiId
private String statisticsDept;
private String statisticsLevel;
private String provinceId;
private String provinceName;
private String cityId;
private String cityName;
private String countyId;
private String countyName;
/**
* 特高压换流站本年计划监督数量
*/
private Integer convertYearSupvNum;
/**
* 特高压换流站月监督数量
*/
private Integer convertMonthSupvNum;
/**
* 特高压换流站累计监督数量
*/
private Integer convertTotalSupvNum;
/**
* 特高压换流站本月问题数量
*/
private Integer convertMonthQuesNum;
/**
* 特高压换流站累计问题数量
*/
private Integer convertTotalQuesNum;
/**
* 特高压换流站本月整改问题数量
*/
private Integer convertMonthReformNum;
/**
* 特高压换流站累计整改问题数量
*/
private Integer convertTotalReformNum;
/**
* 新能源场站本年计划监督数量
*/
private Integer energyYearSupvNum;
/**
* 新能源场站月监督数量
*/
private Integer energyMonthSupvNum;
/**
* 新能源场站累计监督数量
*/
private Integer energyTotalSupvNum;
/**
* 新能源场站本月问题数量
*/
private Integer energyMonthQuesNum;
/**
* 新能源场站累计问题数量
*/
private Integer energyTotalQuesNum;
/**
* 新能源场站本月整改问题数量
*/
private Integer energyMonthReformNum;
/**
* 新能源场站累计整改问题数量
*/
private Integer energyTotalReformNum;
/**
* 新能源场站本年计划监督新(改扩建)数量
*/
private Integer energyYearSupvNewNum;
/**
* 新能源场站本月监督新(改扩建)数量
*/
private Integer energyMonthSupvNewNum;
/**
* 新能源场站累计监督新(改扩建)数量
*/
private Integer energyTotalSupvNewNum;
/**
* 新能源场站本月问题新(改扩建)数量
*/
private Integer energyMonthQuesNewNum;
/**
* 新能源场站累计问题新(改扩建)数量
*/
private Integer energyTotalQuesNewNum;
/**
* 新能源场站本月新(改扩建)整改问题数量
*/
private Integer energyMonthReformNewNum;
/**
* 新能源场站累计新(改扩建)整改问题数量
*/
private Integer energyTotalReformNewNum;
/**
* 电能质量敏感用户本年计划监督数量
*/
private Integer sensitiveYearSupvNum;
/**
* 电能质量敏感用户本月监督数量
*/
private Integer sensitiveMonthSupvNum;
/**
* 电能质量敏感
*/
private Integer sensitiveTotalSupvNum;
/**
* 用户累计监督数量
*/
private Integer supvNum;
/**
* 电能质量敏感用户本月问题数量
*/
private Integer sensitiveMonthQuesNum;
/**
* 电能质量敏感用户累计问题数量
*/
private Integer sensitiveTotalQuesNum;
/**
* 电能质量敏感用户本月整改问题数量
*/
private Integer sensitiveMonthReformNum;
/**
* 电能质量敏感用户累计整改问题数量
*/
private Integer sensitiveTotalReformNum;
/**
* 供电电压计划本月前开展数量
*/
private Integer powerMonthPlanNum;
/**
* 供电电压本月前已开展数量
*/
private Integer powerTotalConductedNum;
}

View File

@@ -1,11 +1,13 @@
package com.njcn.process.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
import java.time.LocalDateTime;
/**
* pqs
@@ -34,6 +36,18 @@ public class SupvPlanVO {
@ApiModelProperty(value = "监督单位名称",required = true)
private String supvOrgName;
/**
* 计划编制单位id
*/
@ApiModelProperty(value = "计划编制单位id")
private String planOrgId;
/**
* 计划编制单位名字
*/
@ApiModelProperty(value = "计划编制单位名字")
private String planOrgName;
/**
* 监督类型
*/
@@ -76,6 +90,18 @@ public class SupvPlanVO {
@ApiModelProperty(value = "关联电站")
private String objRelationStation;
@ApiModelProperty(value = "关联电站电压等级")
private String substationVoltageLevel;
@ApiModelProperty(value = "监督对象属性")
private String objType;
@ApiModelProperty(value = "监督对象属性名称")
private String objTypeName;
@ApiModelProperty(value = "监督对象协议容量(MVA)")
private Double objCapacity;
/**
* 计划执行开始时间
*/
@@ -92,13 +118,15 @@ public class SupvPlanVO {
* 报告出具时间
*/
@ApiModelProperty(value = "报告出具时间",required = true)
private String reportIssueTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime reportIssueTime;
/**
* 电能质量问题发生时间
*/
@ApiModelProperty(value = "电能质量问题发生时间",required = true)
private String problemOcTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime problemOcTime;
/**
@@ -119,4 +147,10 @@ public class SupvPlanVO {
@ApiModelProperty(value = "附件名称")
private String attachmentName;
/**
* 0.未上送 1.上送 2.取消上送
*/
@ApiModelProperty(value = "0.未上送 1.上送 2.取消上送")
private Integer isUploadHead;
}

View File

@@ -1,5 +1,6 @@
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;
@@ -7,7 +8,10 @@ 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.SupvReportM;
import com.njcn.process.service.ISupvReportMService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@@ -18,6 +22,8 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import java.time.LocalDate;
/**
* pqs
* 月度统计
@@ -30,14 +36,37 @@ import springfox.documentation.annotations.ApiIgnore;
@RequiredArgsConstructor
public class SupvMonthStatisController extends BaseController {
private final ISupvReportMService iSupvReportMService;
/**
*
* @author cdf
* @date 2023/6/27
*/
@PostMapping("statisticReport")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiIgnore
public HttpResult<Object> statisticReport(@RequestBody @Validated SupvPlanParam supvPlanParam){
@ApiOperation("监督月报统计")
public HttpResult<Object> statisticReport(@RequestParam("timeId")String timeId){
String methodDescribe = getMethodDescribe("statisticReport");
LocalDate localDate = LocalDate.parse(timeId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
boolean flag = iSupvReportMService.statisticSuperviseReport(localDate);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
}
/**
* 查询阅读监督报告
* @author cdf
* @date 2023/6/27
*/
@PostMapping("statisticReportPage")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询监督月报")
public HttpResult<Page<SupvReportM>> statisticReportPage(BaseParam baseParam){
String methodDescribe = getMethodDescribe("statisticReportPage");
Page<SupvReportM> page = iSupvReportMService.statisticReportPage(baseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -13,6 +13,9 @@ 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 com.njcn.system.api.DicDataFeignClient;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@@ -26,6 +29,9 @@ import org.springframework.web.bind.annotation.RestController;
import com.njcn.web.controller.BaseController;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
@@ -44,6 +50,8 @@ public class SupvProblemController extends BaseController {
private final ISupvProblemService iSupvProblemService;
@PostMapping("addProblem")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("新增技术监督问题")
@@ -84,6 +92,7 @@ public class SupvProblemController extends BaseController {
throw new BusinessException("监督计划索引不可为空");
}
Page<SupvProblem> page = iSupvProblemService.pageProblem(supvProblemParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -0,0 +1,28 @@
package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.process.pojo.dto.ProcessPublicDTO;
import com.njcn.process.pojo.po.SupvReportM;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hongawen
* @since 2023-06-26
*/
public interface SupvReportMMapper extends MppBaseMapper<SupvReportM> {
List<ProcessPublicDTO> statisticPlanReport(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime, @Param("statisticType")String statisticType,@Param("objType")String objType);
List<ProcessPublicDTO> statisticQueReport(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime, @Param("statisticType")String statisticType,@Param("rectificationStatus")String rectificationStatus,@Param("objType")String objType);
}

View File

@@ -0,0 +1,34 @@
<?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.SupvReportMMapper">
<select id="statisticPlanReport" resultType="ProcessPublicDTO">
select count(1) value,supv_Org_Id id from supv_plan
where
supv_Type = #{statisticType}
<if test="startTime!=null and endTime!=null">
and plan_Supv_Date between #{startTime} and #{endTime}
</if>
<if test="objType !=null and objType!=''">
and obj_type = #{objType}
</if>
group by supv_Org_Id
</select>
<select id="statisticQueReport" resultType="ProcessPublicDTO">
select count(1) value,a.duty_Org_Id id from supv_problem a
inner join supv_plan b on a.plan_Id = b.plan_id
where
b.supv_Type = #{statisticType}
<if test="startTime!=null and endTime!=null">
and a.create_time between #{startTime} and #{endTime}
</if>
<if test="rectificationStatus !=null and rectificationStatus!=''">
and a.rectification_Status = #{rectificationStatus}
</if>
<if test="objType !=null and objType!=''">
and b.obj_type = #{objType}
</if>
group by a.duty_Org_Id
</select>
</mapper>

View File

@@ -0,0 +1,32 @@
package com.njcn.process.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.process.pojo.po.SupvReportM;
import com.njcn.web.pojo.param.BaseParam;
import java.time.LocalDate;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author hongawen
* @since 2023-06-26
*/
public interface ISupvReportMService extends IMppService<SupvReportM> {
/**
* 统计监督月报
* @author cdf
* @date 2023/6/26
*/
boolean statisticSuperviseReport(LocalDate timeId);
Page<SupvReportM> statisticReportPage(BaseParam baseParam);
}

View File

@@ -24,6 +24,7 @@ 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 com.njcn.web.utils.RequestUtil;
import liquibase.pro.packaged.L;
import liquibase.pro.packaged.S;
import lombok.RequiredArgsConstructor;
@@ -65,6 +66,7 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime()));
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
supvPlan.setIsUploadHead(0);
supvPlan.setPlanUserId(RequestUtil.getUserIndex());
this.save(supvPlan);
return true;
}
@@ -85,6 +87,12 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
@Override
public boolean delPlan(List<String> planIds) {
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvPlan::getIsUploadHead,1).eq(SupvPlan::getPlanId,planIds);
int count = this.count(lambdaQueryWrapper);
if(count > 0){
throw new BusinessException("请选择未上送国网的删除");
}
return this.removeByIds(planIds);
}
@@ -92,26 +100,38 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
public Page<SupvPlanVO> pagePlan(SupvPlanParam supvPlanParam) {
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(StrUtil.isNotBlank(supvPlanParam.getSupvOrgId())){
List<String> deptIds = deptChildrenList(supvPlanParam.getSupvOrgId());
List<String> deptIds = deptFeignClient.getDepSonSelfCodetByDeptId(supvPlanParam.getSupvOrgId()).getData();
lambdaQueryWrapper.in(SupvPlan::getSupvOrgId,deptIds);
}
Map<String,PvTerminalTreeVO> mapCode = deptAllCodeList();
Map<String,PvTerminalTreeVO> mapList = deptAllList();
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()));
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 pvTerminalTreeVO = null;
if(mapCode.containsKey(item.getSupvOrgId())) {
pvTerminalTreeVO = mapCode.get(item.getSupvOrgId());
item.setSupvOrgName(pvTerminalTreeVO.getName());
item.setCounty(pvTerminalTreeVO.getName());
if(mapList.containsKey(pvTerminalTreeVO.getPid())) {
PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid());
if (Objects.nonNull(pvTerminalTreeOne)) {
item.setCity(pvTerminalTreeOne.getName());
if(mapList.containsKey(pvTerminalTreeOne.getPid())) {
PvTerminalTreeVO pvTerminalTreeTwo = mapList.get(pvTerminalTreeOne.getPid());
if (Objects.nonNull(pvTerminalTreeTwo)) {
item.setProvince(pvTerminalTreeTwo.getName());
}
}
}
}
}
PvTerminalTreeVO pvTerminalTreeTwo = mapList.get(pvTerminalTreeOne.getPid());
if(Objects.nonNull(pvTerminalTreeTwo)){
item.setProvince(pvTerminalTreeTwo.getName());
if(mapCode.containsKey(item.getPlanOrgId())) {
item.setPlanOrgName(mapCode.get(item.getPlanOrgId()).getName());
}
SupvFile supvFile = supvFileMapper.selectOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,item.getPlanId()).eq(SupvFile::getType,0));
@@ -152,20 +172,5 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
}
@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

@@ -13,10 +13,17 @@ 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.system.api.DicDataFeignClient;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
@@ -27,8 +34,13 @@ import java.util.List;
* @since 2023-06-21
*/
@Service
@RequiredArgsConstructor
public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvProblem> implements ISupvProblemService {
private final DicDataFeignClient dicDataFeignClient;
private final DeptFeignClient deptFeignClient;
@Override
public boolean addProblem(SupvProblemParam supvProblemParam) {
SupvProblem supvProblem = new SupvProblem();
@@ -56,9 +68,21 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
@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);
Page<SupvProblem> page = this.page(new Page<>(PageFactory.getPageNum(supvProblemParam), PageFactory.getPageSize(supvProblemParam)),lambdaQueryWrapper);
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
Map<String,PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
for (SupvProblem item : page.getRecords()) {
if(mapCode.containsKey(item.getDutyOrgId())) {
item.setDutyOrgName(mapCode.get(item.getDutyOrgId()).getName());
}
}
return page;
}

View File

@@ -0,0 +1,256 @@
package com.njcn.process.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
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.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.common.utils.PubUtils;
import com.njcn.device.biz.commApi.CommLedgerDeptClient;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.DeptGetBase;
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.process.mapper.SupvReportMMapper;
import com.njcn.process.pojo.dto.ProcessPublicDTO;
import com.njcn.process.pojo.po.SupvReportM;
import com.njcn.process.service.ISupvReportMService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.pojo.param.BaseParam;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.TemporalAdjusters;
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;
/**
* <p>
* 服务实现类
* </p>
*
* @author hongawen
* @since 2023-06-26
*/
@Service
@RequiredArgsConstructor
public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, SupvReportM> implements ISupvReportMService {
private final CommTerminalGeneralClient commTerminalGeneralClient;
private final DeptFeignClient deptFeignClient;
private final DicDataFeignClient dicDataFeignClient;
@Override
public boolean statisticSuperviseReport(LocalDate timeId) {
//当月第一天
LocalDateTime firstDay = timeId.with(TemporalAdjusters.firstDayOfMonth()).atTime(0,0,0);
//当年第一天
LocalDateTime firstYearDay = timeId.with(TemporalAdjusters.firstDayOfYear()).atTime(0,0,0);
LocalDateTime endTime = timeId.atTime(23,59,59);
List<DictData> dictDataUhv = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPV_TYPE.getCode()).getData();
Map<String,DictData> mapStatistic = dictDataUhv.stream().collect(Collectors.toMap(DictData::getCode, Function.identity()));
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(deptFeignClient.getRootDept().getData().getId());
List<DeptGetBase> deptGetBaseList = commTerminalGeneralClient.getDeptChildrenByParent(deptGetLineParam).getData();
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<ProcessPublicDTO> processPublicDTOListM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null);
List<ProcessPublicDTO> processPublicDTOListY = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null);
List<ProcessPublicDTO> processPublicDTOListAll = this.baseMapper.statisticPlanReport(null,null,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null);
List<ProcessPublicDTO> processPublicDTOListNewM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),null);
List<ProcessPublicDTO> processPublicDTOListNewY = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),null);
List<ProcessPublicDTO> processPublicDTOListNewAll = this.baseMapper.statisticPlanReport(null,null,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),null);
List<ProcessPublicDTO> processPublicDTOListNewZM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02");
List<ProcessPublicDTO> processPublicDTOListNewZY = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02");
List<ProcessPublicDTO> processPublicDTOListNewZAll = this.baseMapper.statisticPlanReport(null,null,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02");
//换流站问题总数量
List<ProcessPublicDTO> processPublicDTOQesM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null,null);
List<ProcessPublicDTO> processPublicDTOQesAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null,null);
//换流站问题已整改数量
List<ProcessPublicDTO> processPublicDTOQesYesM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),"01",null);
List<ProcessPublicDTO> processPublicDTOQesYesAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),"01",null);
//新能源问题总数量
List<ProcessPublicDTO> processPublicDTOQesNewM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),null,null);
List<ProcessPublicDTO> processPublicDTOQesNewAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),null,null);
//新能源问题已整改数量
List<ProcessPublicDTO> processPublicDTOQesNewYesM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01",null);
List<ProcessPublicDTO> processPublicDTOQesNewYesAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01",null);
//新能源改扩建问题数量
List<ProcessPublicDTO> processPublicDTOQesNewGaiM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),null,"02");
List<ProcessPublicDTO> processPublicDTOQesNewGaiAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),null,"02");
List<ProcessPublicDTO> processPublicDTOQesNewGaiYesM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01","02");
List<ProcessPublicDTO> processPublicDTOQesNewGaiYesAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01","02");
//敏感用户
List<ProcessPublicDTO> processPublicDTOMingGanM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null);
List<ProcessPublicDTO> processPublicDTOMingGanY = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null);
List<ProcessPublicDTO> processPublicDTOMingGanAll = this.baseMapper.statisticPlanReport(null,null,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null);
//换流站问题总数量
List<ProcessPublicDTO> processPublicDTOQesMingGanM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null,null);
List<ProcessPublicDTO> processPublicDTOQesMingGanAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null,null);
//换流站问题已整改数量
List<ProcessPublicDTO> processPublicDTOQesMingGanYesM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),"01",null);
List<ProcessPublicDTO> processPublicDTOQesMingGanYesAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),"01",null);
List<SupvReportM> supvReportMBatch = new ArrayList<>();
for(DeptGetBase deptGetBase : deptGetBaseList){
if(deptGetBase.getDeptLevel() !=2 && deptGetBase.getDeptLevel() !=3 && deptGetBase.getDeptLevel() !=4){
continue;
}
SupvReportM supvReportM = new SupvReportM();
supvReportM.setStatisticsDate(timeId.with(TemporalAdjusters.firstDayOfMonth()));
supvReportM.setStatisticsDept(deptGetBase.getUnitId());
List<String> childrenDeptList = deptGetBase.getUnitChildrenList();
if(CollUtil.isNotEmpty(childrenDeptList)){
supvReportM.setConvertMonthSupvNum(dealData(childrenDeptList,processPublicDTOListM));
supvReportM.setConvertYearSupvNum(dealData(childrenDeptList,processPublicDTOListY));
supvReportM.setConvertTotalSupvNum(dealData(childrenDeptList,processPublicDTOListAll));
supvReportM.setEnergyMonthSupvNum(dealData(childrenDeptList,processPublicDTOListNewM));
supvReportM.setEnergyYearSupvNum(dealData(childrenDeptList,processPublicDTOListNewY));
supvReportM.setEnergyTotalSupvNum(dealData(childrenDeptList,processPublicDTOListNewAll));
supvReportM.setEnergyMonthSupvNewNum(dealData(childrenDeptList,processPublicDTOListNewZM));
supvReportM.setEnergyYearSupvNewNum(dealData(childrenDeptList,processPublicDTOListNewZY));
supvReportM.setEnergyTotalSupvNewNum(dealData(childrenDeptList,processPublicDTOListNewZAll));
supvReportM.setConvertMonthQuesNum(dealData(childrenDeptList,processPublicDTOQesM));
supvReportM.setConvertTotalQuesNum(dealData(childrenDeptList,processPublicDTOQesAll));
supvReportM.setConvertMonthReformNum(dealData(childrenDeptList,processPublicDTOQesYesM));
supvReportM.setConvertTotalReformNum(dealData(childrenDeptList,processPublicDTOQesYesAll));
supvReportM.setEnergyMonthQuesNum(dealData(childrenDeptList,processPublicDTOQesNewM));
supvReportM.setEnergyTotalQuesNum(dealData(childrenDeptList,processPublicDTOQesNewAll));
supvReportM.setEnergyMonthReformNum(dealData(childrenDeptList,processPublicDTOQesNewYesM));
supvReportM.setEnergyTotalReformNum(dealData(childrenDeptList,processPublicDTOQesNewYesAll));
supvReportM.setEnergyMonthQuesNewNum(dealData(childrenDeptList,processPublicDTOQesNewGaiM));
supvReportM.setEnergyTotalQuesNewNum(dealData(childrenDeptList,processPublicDTOQesNewGaiAll));
supvReportM.setEnergyMonthReformNewNum(dealData(childrenDeptList,processPublicDTOQesNewGaiYesM));
supvReportM.setEnergyTotalReformNewNum(dealData(childrenDeptList,processPublicDTOQesNewGaiYesAll));
//敏感用户
supvReportM.setSensitiveMonthSupvNum(dealData(childrenDeptList,processPublicDTOMingGanM));
supvReportM.setSensitiveYearSupvNum(dealData(childrenDeptList,processPublicDTOMingGanY));
supvReportM.setSensitiveTotalSupvNum(dealData(childrenDeptList,processPublicDTOMingGanAll));
supvReportM.setSensitiveMonthQuesNum(dealData(childrenDeptList,processPublicDTOQesMingGanM));
supvReportM.setSensitiveTotalQuesNum(dealData(childrenDeptList,processPublicDTOQesMingGanAll));
supvReportM.setSensitiveMonthReformNum(dealData(childrenDeptList,processPublicDTOQesMingGanYesM));
supvReportM.setSensitiveTotalReformNum(dealData(childrenDeptList,processPublicDTOQesMingGanYesAll));
supvReportM.setPowerMonthPlanNum(5);
supvReportM.setPowerTotalConductedNum(10);
}
if(deptGetBase.getDeptLevel() == 2){
//省级
supvReportM.setProvinceId(deptGetBase.getUnitId());
supvReportM.setProvinceName(deptGetBase.getUnitName());
supvReportM.setStatisticsLevel("3");
}else if(deptGetBase.getDeptLevel() == 3){
//市
PvTerminalTreeVO pvTerminalTreeVOOne = mapCode.get(deptGetBase.getUnitId());
if(Objects.nonNull(pvTerminalTreeVOOne)){
PvTerminalTreeVO pvTerminalTreeVOTwo = mapList.get(pvTerminalTreeVOOne.getPid());
supvReportM.setCityId(deptGetBase.getUnitId());
supvReportM.setCityName(deptGetBase.getUnitName());
supvReportM.setProvinceName(pvTerminalTreeVOTwo.getName());
supvReportM.setProvinceId(pvTerminalTreeVOTwo.getCode());
}
supvReportM.setStatisticsLevel("4");
}else if(deptGetBase.getDeptLevel() == 4){
//县
PvTerminalTreeVO pvTerminalTreeVOOne = mapCode.get(deptGetBase.getUnitId());
if(Objects.nonNull(pvTerminalTreeVOOne)) {
PvTerminalTreeVO pvTerminalTreeVOTwo = mapList.get(pvTerminalTreeVOOne.getPid());
if(Objects.nonNull(pvTerminalTreeVOTwo)){
PvTerminalTreeVO pvTerminalTreeVOThree = mapList.get(pvTerminalTreeVOTwo.getPid());
supvReportM.setCountyId(deptGetBase.getUnitId());
supvReportM.setCountyName(deptGetBase.getUnitName());
supvReportM.setCityId(pvTerminalTreeVOTwo.getCode());
supvReportM.setCityName(pvTerminalTreeVOTwo.getName());
supvReportM.setProvinceName(pvTerminalTreeVOThree.getName());
supvReportM.setProvinceId(pvTerminalTreeVOThree.getCode());
}
}
supvReportM.setStatisticsLevel("5");
}
supvReportM.setSupvNum(10);
supvReportMBatch.add(supvReportM);
}
this.saveOrUpdateBatchByMultiId(supvReportMBatch);
return true;
}
@Override
public Page<SupvReportM> statisticReportPage(BaseParam baseParam) {
LambdaQueryWrapper<SupvReportM> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(StrUtil.isNotBlank(baseParam.getSearchValue()),SupvReportM::getStatisticsDept,baseParam.getSearchValue())
.between(StrUtil.isNotBlank(baseParam.getSearchBeginTime()),SupvReportM::getStatisticsDate,baseParam.getSearchBeginTime(),baseParam.getSearchEndTime());
return this.page(new Page<SupvReportM>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam)),lambdaQueryWrapper);
}
private Integer dealData(List<String> childrenDeptList,List<ProcessPublicDTO> processPublicDTOList){
Integer count = 0;
for(ProcessPublicDTO processPublicDTO :processPublicDTOList) {
if (childrenDeptList.contains(processPublicDTO.getId())) {
count += processPublicDTO.getValue();
}
}
return count;
}
}

View File

@@ -443,7 +443,21 @@ public enum DicDataEnum {
* 设备使用性质代码
*/
DEDICATED("专用","dedicated"),
PUBLIC("公用","public");
PUBLIC("公用","public"),
/**
* 监督类型
*/
POWER_QUALITY("电能质量敏感用户监督","Power_Quality"),
UHV_Converter("特高压换流站监督","UHV_Converter"),
New_Energy("新能源场站监督","New_Energy"),
Technical_Super("供电电压质量技术监督","Technical_Super")
;
private final String name;
private final String code;

View File

@@ -84,7 +84,14 @@ public enum DicDataTypeEnum {
VOLTAGE_TRANSFORMER("电压互感器类型","Voltage_Transformer"),
Neutral_Point("中性点接地方式","Neutral_Point"),
DEVICE_REGIONLYPE("设备地区特征","Device_RegionLype"),
DEVICE_USERNATURE("设备使用性质代码","Device_UseNature");
DEVICE_USERNATURE("设备使用性质代码","Device_UseNature"),
SUPV_TYPE("监督类型","supv_type")
;