技术监督管理

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

@@ -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");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
LocalDate localDate = LocalDate.parse(timeId);
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;
}
}