瀏覽代碼

1,填充数据

zhaoyun 5 月之前
父節點
當前提交
b6b9982706

+ 147 - 46
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/controller/WeeklyReportController.java

@@ -3,6 +3,7 @@ package com.ruoyi.powerdistribution.controller;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.bean.BeanUtils;
 import com.ruoyi.common.utils.uuid.UUID;
 import com.ruoyi.powerdistribution.domain.*;
 import com.ruoyi.powerdistribution.domain.dto.PdmWorkPlanDTO;
@@ -24,6 +25,7 @@ import java.io.*;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 周报导出
@@ -67,44 +69,117 @@ public class WeeklyReportController extends BaseController {
         dataMap.put("endDay",month+"月"+new SimpleDateFormat("dd").format(cvrtEndDate)+"日");//结束日
         //一.风险计划管控
         //1.本周计划执行情况
-        dataMap.put("jobRecNum",0);//发布作业信息条数
-        dataMap.put("weekPlanJobReNum",0);//来源于周计划的作业条数
-        dataMap.put("cancelRecNum",0);//已取消
-        dataMap.put("implRate",0);//执行率
-        dataMap.put("lowImplUnit","");//较低的单位 ()
-        dataMap.put("lowImplRate","");//较低的单位执行率
-        dataMap.put("tmpPlanRecNum",0);//临时计划
-        dataMap.put("repairRecNum",0);//其中抢修
-        dataMap.put("operateRecNum",0);//操作条数
-        dataMap.put("maintenanceNum",0);//运维检修
-        dataMap.put("expanRelocationNum",0);//业扩
-        dataMap.put("networkReformNum",0);//网改
-        dataMap.put("tmpPlanRate",0);//临时计划率
-        dataMap.put("cancelTmpPlanRecNum",0);//临时取消计划数
-        dataMap.put("tmpPlanImplRate",0);//临时计划执行率
         PdmReportPlanWeek pdmReportPlan = new PdmReportPlanWeek();
         pdmReportPlan.setReportDate(beingDate);
         pdmReportPlan.setReportEndDate(endDate);
         List<PdmReportPlanWeek> planlist = pdmReportPlanWeekService.selectPdmReportPlanWeekList(pdmReportPlan);
         dataMap.put("planlist",planlist);//本周计划执行情况
+        long jobRecNum=0;
+        long weekPlanJobReNum=0;
+        long cancelRecNum=0;
+        String implRate="";
+        long tmpPlanRecNum=0;
+        String tmpPlanRate="";
+        long cancelTmpPlanRecNum=0;
+        String tmpPlanImplRate="";
+        String lowImplUnit="";
+        String lowImplRate="";
+
+       if(planlist!=null && planlist.size()>1){
+            pdmReportPlan=planlist.get(planlist.size()-1);
+            jobRecNum=pdmReportPlan.getTotal();
+            weekPlanJobReNum=pdmReportPlan.getWeekSum();
+            cancelRecNum=pdmReportPlan.getWeekCancelSum();
+            implRate=pdmReportPlan.getWeekRatio();
+            tmpPlanRecNum=pdmReportPlan.getTemporarySum();
+            tmpPlanRate=pdmReportPlan.getTemporaryPlanRatio();
+            cancelTmpPlanRecNum=pdmReportPlan.getTemporaryCancelSum();
+            tmpPlanImplRate=pdmReportPlan.getTemporaryRatio();
+           List<PdmReportPlanWeek> planlist2=new ArrayList<>();
+           planlist.forEach(plan->{
+               if(!plan.getCompany().equals("总计")){
+                   PdmReportPlanWeek planWeek=new PdmReportPlanWeek();
+                   BeanUtils.copyBeanProp(planWeek,plan);
+                   planlist2.add(planWeek);
+               }
+           });
+           Collections.sort(planlist2, new Comparator<PdmReportPlanWeek>(){
+               public int compare(PdmReportPlanWeek o1, PdmReportPlanWeek o2) {
+                   //按照周计划执行率行升序排列
+                   if((o1.getWeekSum()-o1.getWeekCancelSum())/o1.getWeekSum() > (o2.getWeekSum()-o2.getWeekCancelSum())/o2.getWeekSum()){
+                       return -1;
+                   }
+                   if((o1.getWeekSum()-o1.getWeekCancelSum())/o1.getWeekSum() < (o2.getWeekSum()-o2.getWeekCancelSum())/o2.getWeekSum()){
+                       return 1;
+                   }
+                   return 0;
+               }
+           });
+           PdmReportPlanWeek lowPdmReportPlan=planlist2.get(planlist2.size()-1);
+           lowImplUnit=lowPdmReportPlan.getCompany();
+           lowImplRate=lowPdmReportPlan.getWeekRatio();
+       }
+        dataMap.put("jobRecNum",jobRecNum);//发布作业信息条数
+        dataMap.put("weekPlanJobReNum",weekPlanJobReNum);//来源于周计划的作业条数
+        dataMap.put("cancelRecNum",cancelRecNum);//已取消
+        dataMap.put("implRate",implRate);//执行率
+        dataMap.put("lowImplUnit",lowImplUnit);//较低的单位 ()
+        dataMap.put("lowImplRate",lowImplRate);//较低的单位执行率
+        dataMap.put("tmpPlanRecNum",tmpPlanRecNum);//临时计划
+        dataMap.put("repairRecNum",0);//其中抢修
+        dataMap.put("operateRecNum",0);//操作条数
+        dataMap.put("maintenanceNum",0);//运维检修
+        dataMap.put("expanRelocationNum",0);//业扩
+        dataMap.put("networkReformNum",0);//网改
+        dataMap.put("tmpPlanRate",tmpPlanRate);//临时计划率
+        dataMap.put("cancelTmpPlanRecNum",cancelTmpPlanRecNum);//临时取消计划数
+        dataMap.put("tmpPlanImplRate",tmpPlanImplRate);//临时计划执行率
+
 
         //2.下周计划安排情况
         String nextMonday=DateUtils.getNextMonday(beingDate,"yyyyMMdd");
-        String nextSunday=DateUtils.getNextSunday(beingDate,"yyyyMMdd");
+        String nextSunday=DateUtils.getNextSunday(endDate,"yyyyMMdd");
         Date cvrtNextMonday = sdf.parse(nextMonday);
         Date cvrtNextSunday = sdf.parse(nextSunday);
+
+        long nextWeekJobRecNum=0;
+        long nextWeekSwitchingNum=0;
+        long distribuNetworkEngineNum=0;
+        long nextWeekExpanRelocationNum=0;
+        long nextWeekMaintenanceNum=0;
+        String threeLevelRiskNum="0";
+        String fourLevelRiskNum="0";
+        String fiveLevelRiskNum="0";
+        long liveWorkingNum=0;
+        PdmReportPlanNextWeek next = new PdmReportPlanNextWeek();
+        next.setReportDate(nextMonday);
+        next.setReportEndDate(nextSunday);
+        List<PdmReportPlanNextWeek> nextList = pdmReportPlanNextWeekService.selectPdmReportPlanNextWeekList(next);
+        if(nextList!=null && nextList.size()>1){
+            next=nextList.get(nextList.size()-1);
+            nextWeekJobRecNum=next.getWorkTotal();
+            nextWeekSwitchingNum=next.getWorkType1Sum();
+            distribuNetworkEngineNum=next.getWorkType2Sum();
+            nextWeekExpanRelocationNum=next.getWorkType3Sum();
+            nextWeekMaintenanceNum=next.getWorkType4Sum();
+            threeLevelRiskNum=next.getPlanLeve3();
+            fourLevelRiskNum=next.getPlanLeve4();
+            fiveLevelRiskNum=next.getPlanLeve5();
+            liveWorkingNum=next.getElePlanSum();
+        }
+
         month=new SimpleDateFormat("MM").format(cvrtNextMonday);
         dataMap.put("nextWeekBeginDay",month+"月"+new SimpleDateFormat("dd").format(cvrtNextMonday)+"日");//下周开始日
         dataMap.put("nextWeekEndDay",month+"月"+new SimpleDateFormat("dd").format(cvrtNextSunday)+"日");//下周结束日
-        dataMap.put("nextWeekJobRecNum",0);//配网专业计划总数
-        dataMap.put("nextWeekSwitchingNum",0);//倒闸操作
-        dataMap.put("distribuNetworkEngineNum",0);//配网工程
-        dataMap.put("nextWeekExpanRelocationNum",0);//业扩杆迁
-        dataMap.put("nextWeekMaintenanceNum",0);//运维检修
-        dataMap.put("threeLevelRiskNum",0);//三级风险作业
-        dataMap.put("fourLevelRiskNum",0);//四级风险作业
-        dataMap.put("fiveLevelRiskNum",0);//五级风险作业
-        dataMap.put("liveWorkingNum",0);//带电作业
+        dataMap.put("nextWeekJobRecNum",nextWeekJobRecNum);//配网专业计划总数
+        dataMap.put("nextWeekSwitchingNum",nextWeekSwitchingNum);//倒闸操作
+        dataMap.put("distribuNetworkEngineNum",distribuNetworkEngineNum);//配网工程
+        dataMap.put("nextWeekExpanRelocationNum",nextWeekExpanRelocationNum);//业扩杆迁
+        dataMap.put("nextWeekMaintenanceNum",nextWeekMaintenanceNum);//运维检修
+        dataMap.put("threeLevelRiskNum",threeLevelRiskNum);//三级风险作业
+        dataMap.put("fourLevelRiskNum",fourLevelRiskNum);//四级风险作业
+        dataMap.put("fiveLevelRiskNum",fiveLevelRiskNum);//五级风险作业
+        dataMap.put("liveWorkingNum",liveWorkingNum);//带电作业
         dataMap.put("liveDisconnectLeadNum",0);//带电断接引
         dataMap.put("assemDeviceNum",0);//带电消缺、装拆设备
         //三级风险作业内容:
@@ -126,46 +201,72 @@ public class WeeklyReportController extends BaseController {
         String fousMaintenanceInfo="";//重点关注检修面内容
         dataMap.put("fousMaintenanceInfo", StringUtils.isEmpty(fousMaintenanceInfo)?"无":fousMaintenanceInfo);//重点关注检修面内容
         //下周计划安排情况
-        PdmReportPlanNextWeek next = new PdmReportPlanNextWeek();
-        next.setReportDate(nextMonday);
-        next.setReportEndDate(nextSunday);
-        List<PdmReportPlanNextWeek> nextList = pdmReportPlanNextWeekService.selectPdmReportPlanNextWeekList(next);
         dataMap.put("nextWeekWorkList",nextList);//下周计划安排情况列表
 
         //二、专业反违章履职情况
         //1.本周违章查处情况
-        dataMap.put("investPunishRecAllNum",0);//配网专业共计查处违章
-        dataMap.put("provinceInvestPunishRecNum",0);//被省公司查处违章
-        dataMap.put("cityInvestPunishRecNum",0);//被市公司查处违章
-        dataMap.put("cityInvestSeriousRecNum",0);//严重违章
-        dataMap.put("cityInvestGeneralRecNum",0);//一般违章
-        dataMap.put("countyInvestPunishRecNum",0);//县区公司自查处违章
-        dataMap.put("countyInvestSeriousRecNum",0);//严重违章
-        dataMap.put("countyInvestGeneralRecNum",0);//一般违章
-
-        //本周违章查处情况列表
+        long provinceInvestSeriousRecNum=0;
+        long provinceInvestGeneralRecNum=0;
+        long cityInvestSeriousRecNum=0;
+        long cityInvestGeneralRecNum=0;
+        long countyInvestSeriousRecNum=0;
+        long countyInvestGeneralRecNum=0;
         PdmReportIllegalWeek pdmReportIllegal = new PdmReportIllegalWeek();
         pdmReportIllegal.setReportDate(beingDate);
         pdmReportIllegal.setReportEndDate(endDate);
         List<PdmReportIllegalWeek> illegalList = pdmReportIllegalWeekService.selectPdmReportIllegalWeekList(pdmReportIllegal);
+        if(illegalList!=null && illegalList.size()>1){
+            pdmReportIllegal=illegalList.get(illegalList.size()-1);
+            provinceInvestSeriousRecNum=pdmReportIllegal.getProvinceNum1();
+            provinceInvestGeneralRecNum=pdmReportIllegal.getProvinceNum2();
+            cityInvestSeriousRecNum=pdmReportIllegal.getCityNum1();
+            cityInvestGeneralRecNum=pdmReportIllegal.getCityNum2();
+            countyInvestSeriousRecNum=pdmReportIllegal.getCountyNum1();
+            countyInvestGeneralRecNum=pdmReportIllegal.getCountyNum2();
+        }
+        dataMap.put("investPunishRecAllNum",(provinceInvestSeriousRecNum+provinceInvestGeneralRecNum+cityInvestSeriousRecNum+cityInvestGeneralRecNum+countyInvestSeriousRecNum+countyInvestGeneralRecNum));//配网专业共计查处违章
+        dataMap.put("provinceInvestPunishRecNum",(provinceInvestSeriousRecNum+provinceInvestGeneralRecNum));//被省公司查处违章
+        dataMap.put("cityInvestPunishRecNum",(cityInvestSeriousRecNum+cityInvestGeneralRecNum));//被市公司查处违章
+        dataMap.put("cityInvestSeriousRecNum",cityInvestSeriousRecNum);//严重违章
+        dataMap.put("cityInvestGeneralRecNum",cityInvestGeneralRecNum);//一般违章
+        dataMap.put("countyInvestPunishRecNum",(countyInvestSeriousRecNum+countyInvestGeneralRecNum));//县区公司自查处违章
+        dataMap.put("countyInvestSeriousRecNum",countyInvestSeriousRecNum);//严重违章
+        dataMap.put("countyInvestGeneralRecNum",countyInvestGeneralRecNum);//一般违章
+        //本周违章查处情况列表
         dataMap.put("illegalList",illegalList);//违章列表明细
         String typicalIllegal="";//其中典型违章通报如下
         dataMap.put("typicalIllegal",StringUtils.isEmpty(typicalIllegal)?"无":typicalIllegal);//其中典型违章通报如下
 
 
         //2.本周人员到岗到位履职情况
-        dataMap.put("supervTimes",0);//督察共计次数
-        dataMap.put("leaderSupervTimes",0);//领导督察共计次数
-        dataMap.put("manageSupervTimes",0);//管理人员督察次数
-        dataMap.put("problemNum",0);//督察发现问题
-        dataMap.put("cityFindProblemNum",0);//市公司发现问题处数
-        dataMap.put("derelictionDutyNum",0);//履职不到位(应查未查)
-        //本周到岗到位履职情况
+        long leaderSupervTimes=0;
+        long manageSupervTimes=0;
+        long problemNum=0;
+        long cityFindProblemNum=0;
+        long derelictionDutyNum=0;
         PdmReportAppointmentWeek pdmReportAppointment = new PdmReportAppointmentWeek();
         pdmReportAppointment.setReportDate(beingDate);
         pdmReportAppointment.setReportEndDate(endDate);
         List<PdmReportAppointmentWeek> appointmentlist = pdmReportAppointmentWeekService.selectPdmReportAppointmentWeekList(pdmReportAppointment);
+
+        if(appointmentlist!=null && appointmentlist.size()>1) {
+            pdmReportAppointment=appointmentlist.get(appointmentlist.size()-1);
+            leaderSupervTimes=pdmReportAppointment.getBossSum();
+            manageSupervTimes=pdmReportAppointment.getManageSum();
+            problemNum=pdmReportAppointment.getProblemSum();
+            cityFindProblemNum=pdmReportAppointment.getCityCheckSum();
+            derelictionDutyNum=pdmReportAppointment.getAbsentSum();
+
+        }
         dataMap.put("appointmentlist",appointmentlist);//本周到岗到位履职情况
+        dataMap.put("supervTimes",(leaderSupervTimes+manageSupervTimes));//督察共计次数
+        dataMap.put("leaderSupervTimes",leaderSupervTimes);//领导督察共计次数
+        dataMap.put("manageSupervTimes",manageSupervTimes);//管理人员督察次数
+        dataMap.put("problemNum",problemNum);//督察发现问题
+        dataMap.put("cityFindProblemNum",cityFindProblemNum);//市公司发现问题处数
+        dataMap.put("derelictionDutyNum",derelictionDutyNum);//履职不到位(应查未查)
+
+
 
         File descFile=null;
         try {