Browse Source

周报导出修改

zx 6 months ago
parent
commit
ead920169d

+ 19 - 21
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/controller/WeeklyReportController.java

@@ -36,21 +36,19 @@ public class WeeklyReportController extends BaseController {
 
     @Value("${printReplenishmentPath}")
     private String printReplenishmentPath;
-
     @Autowired
-    private IPdmReportIllegalWeekService pdmReportIllegalWeekService;
-
+    private IPdmReportIllegalDayService pdmReportIllegalDayService;
     @Autowired
-    private IPdmReportPlanNextWeekService pdmReportPlanNextWeekService;
+    private IPdmReportPlanNextDayService pdmReportPlanNextDayService;
     @Autowired
     private IPdmWorkPlanService pdmWorkPlanService;
     @Autowired
-    private IPdmReportPlanNextDayService pdmReportPlanNextDayService;
+    private IPdmReportPlanDayService pdmReportPlanDayService;
 
     @Autowired
     private IPdmReportPlanWeekService pdmReportPlanWeekService;
     @Autowired
-    private IPdmReportAppointmentWeekService pdmReportAppointmentWeekService;
+    private IPdmReportAppointmentDayService pdmReportAppointmentDayService;
 
 
 
@@ -69,10 +67,10 @@ public class WeeklyReportController extends BaseController {
         dataMap.put("endDay",month+"月"+new SimpleDateFormat("dd").format(cvrtEndDate)+"日");//结束日
         //一.风险计划管控
         //1.本周计划执行情况
-        PdmReportPlanWeek pdmReportPlan = new PdmReportPlanWeek();
-        pdmReportPlan.setReportDate(beingDate);
-        pdmReportPlan.setReportEndDate(endDate);
-        List<PdmReportPlanWeek> planlist = pdmReportPlanWeekService.selectPdmReportPlanWeekList(pdmReportPlan);
+        PdmReportPlanDay pdmReportPlan = new PdmReportPlanDay();
+        pdmReportPlan.setStartDate(beingDate);
+        pdmReportPlan.setEndDate(endDate);
+        List<PdmReportPlanDay> planlist = pdmReportPlanDayService.selectPlanReport(pdmReportPlan);
         dataMap.put("planlist",planlist);//本周计划执行情况
         long jobRecNum=0;
         long weekPlanJobReNum=0;
@@ -151,10 +149,10 @@ public class WeeklyReportController extends BaseController {
         String fourLevelRiskNum="0";
         String fiveLevelRiskNum="0";
         long liveWorkingNum=0;
-        PdmReportPlanNextWeek next = new PdmReportPlanNextWeek();
+        PdmReportPlanNextDay next = new PdmReportPlanNextDay();
         next.setReportDate(nextMonday);
-        next.setReportEndDate(nextSunday);
-        List<PdmReportPlanNextWeek> nextList = pdmReportPlanNextWeekService.selectPdmReportPlanNextWeekList(next);
+        next.setEndDate(nextSunday);
+        List<PdmReportPlanNextDay> nextList = pdmReportPlanNextDayService.selectReportPlanNext(next);
         if(nextList!=null && nextList.size()>1){
             next=nextList.get(nextList.size()-1);
             nextWeekJobRecNum=next.getWorkTotal();
@@ -215,10 +213,10 @@ public class WeeklyReportController extends BaseController {
         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);
+        PdmReportIllegalDay pdmReportIllegal = new PdmReportIllegalDay();
+        pdmReportIllegal.setStartDate(beingDate);
+        pdmReportIllegal.setEndDate(endDate);
+        List<PdmReportIllegalDay> illegalList = pdmReportIllegalDayService.selectIllegalReport(pdmReportIllegal);
         if(illegalList!=null && illegalList.size()>1){
             pdmReportIllegal=illegalList.get(illegalList.size()-1);
             provinceInvestSeriousRecNum=pdmReportIllegal.getProvinceNum1();
@@ -248,10 +246,10 @@ public class WeeklyReportController extends BaseController {
         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);
+        PdmReportAppointmentDay pdmReportAppointment = new PdmReportAppointmentDay();
+        pdmReportAppointment.setStartDate(beingDate);
+        pdmReportAppointment.setEndDate(endDate);
+        List<PdmReportAppointmentDay> appointmentlist = pdmReportAppointmentDayService.selectAppointmentReport(pdmReportAppointment);
 
         if(appointmentlist!=null && appointmentlist.size()>1) {
             pdmReportAppointment=appointmentlist.get(appointmentlist.size()-1);

+ 11 - 0
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/service/impl/PdmStopTargeServiceImpl.java

@@ -1,11 +1,16 @@
 package com.ruoyi.powerdistribution.service.impl;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.powerdistribution.domain.PdmWorkOrgan;
 import com.ruoyi.powerdistribution.domain.vo.StopTargetAndRecords;
+import com.ruoyi.powerdistribution.service.IPdmWorkOrganService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.powerdistribution.mapper.PdmStopTargeMapper;
@@ -25,6 +30,9 @@ public class PdmStopTargeServiceImpl extends ServiceImpl<PdmStopTargeMapper,PdmS
     @Autowired
     private PdmStopTargeMapper pdmStopTargeMapper;
 
+    @Autowired
+    private IPdmWorkOrganService pdmWorkOrganService;
+
     /**
      * 查询停电预算
      *
@@ -103,8 +111,11 @@ public class PdmStopTargeServiceImpl extends ServiceImpl<PdmStopTargeMapper,PdmS
     @Transactional
     public boolean batchSaveOrUpdate(List<PdmStopTarge> list,String reportYear) {
         this.remove(new LambdaUpdateWrapper<PdmStopTarge>().eq(PdmStopTarge::getReportYear,reportYear));
+        List<PdmWorkOrgan> orgList = pdmWorkOrganService.selectPdmWorkOrganList(new PdmWorkOrgan());
+        Map<String,String> orgMap = orgList.stream().collect(Collectors.toMap(PdmWorkOrgan::getOrganName, PdmWorkOrgan::getOrganNo , (k1, k2) -> k1));
         for(PdmStopTarge target:list){
             target.setReportYear(reportYear);
+            target.setCompanyNo(orgMap.get(target.getCompanyName()));
             pdmStopTargeMapper.insertPdmStopTarge(target);
         }
         return true;

+ 19 - 19
ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmStopTargeMapper.xml

@@ -302,11 +302,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectTargetAndActual" parameterType="java.lang.String" resultType="com.ruoyi.powerdistribution.domain.vo.StopTargetAndRecords">
         select t1.*,
-               t2.stop_total_actual,
+               ifnull(t2.stop_total_actual,0) stop_total_actual,
                CONCAT(round(ifnull(t2.stop_total_actual,0)/t1.stop_time_total*100,2),'%')  stop_total_ratio,
-               t2.plan_stop_total_actual,
+               ifnull(t2.plan_stop_total_actual,0) plan_stop_total_actual,
                CONCAT(round(ifnull(t2.plan_stop_total_actual,0)/t1.plan_stop_time_total*100,2),'%') plan_stop_ratio,
-               t2.error_stop_total_actual,
+               ifnull(t2.error_stop_total_actual,0) error_stop_total_actual,
                CONCAT(round(ifnull(t2.error_stop_total_actual,0)/t1.error_stop_time_total*100,2),'%') error_stop_ratio,
                ifnull(stop_month_01_actual,0) stop_month_01_actual,
                ifnull(stop_month_02_actual,0) stop_month_02_actual,
@@ -387,9 +387,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         from pdm_stop_targe t1
         LEFT JOIN
         (
-        select std_county_org_nm org_name ,
+        select std_county_org_no,
         SUM(poweroff_duration_tm) stop_total_actual,
-        SUM(IF(poweroff_nature_cd in('2111','2112','2121','2122','2141'),poweroff_duration_tm,0)) as plan_stop_total_actual,
+        SUM(IF(poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241'),poweroff_duration_tm,0)) as plan_stop_total_actual,
         SUM(IF(poweroff_nature_cd in('1101','1202'),poweroff_duration_tm,0)) as error_stop_total_actual,
         SUM(IF(SUBSTRING(data_dt,5,2)='01',poweroff_duration_tm,0)) as stop_month_01_actual,
         SUM(IF(SUBSTRING(data_dt,5,2)='02',poweroff_duration_tm,0)) as stop_month_02_actual,
@@ -404,18 +404,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SUM(IF(SUBSTRING(data_dt,5,2)='11',poweroff_duration_tm,0)) as stop_month_11_actual,
         SUM(IF(SUBSTRING(data_dt,5,2)='12',poweroff_duration_tm,0)) as stop_month_12_actual,
 
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='01'),poweroff_duration_tm,0)) as plan_stop_month_01_actual,
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='02'),poweroff_duration_tm,0)) as plan_stop_month_02_actual,
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='03'),poweroff_duration_tm,0)) as plan_stop_month_03_actual,
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='04'),poweroff_duration_tm,0)) as plan_stop_month_04_actual,
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='05'),poweroff_duration_tm,0)) as plan_stop_month_05_actual,
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='06'),poweroff_duration_tm,0)) as plan_stop_month_06_actual,
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='07'),poweroff_duration_tm,0)) as plan_stop_month_07_actual,
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='08'),poweroff_duration_tm,0)) as plan_stop_month_08_actual,
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='09'),poweroff_duration_tm,0)) as plan_stop_month_09_actual,
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='10'),poweroff_duration_tm,0)) as plan_stop_month_10_actual,
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='11'),poweroff_duration_tm,0)) as plan_stop_month_11_actual,
-        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141') and SUBSTRING(data_dt,5,2)='12'),poweroff_duration_tm,0)) as plan_stop_month_12_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='01'),poweroff_duration_tm,0)) as plan_stop_month_01_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='02'),poweroff_duration_tm,0)) as plan_stop_month_02_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='03'),poweroff_duration_tm,0)) as plan_stop_month_03_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='04'),poweroff_duration_tm,0)) as plan_stop_month_04_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='05'),poweroff_duration_tm,0)) as plan_stop_month_05_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='06'),poweroff_duration_tm,0)) as plan_stop_month_06_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='07'),poweroff_duration_tm,0)) as plan_stop_month_07_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='08'),poweroff_duration_tm,0)) as plan_stop_month_08_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='09'),poweroff_duration_tm,0)) as plan_stop_month_09_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='10'),poweroff_duration_tm,0)) as plan_stop_month_10_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='11'),poweroff_duration_tm,0)) as plan_stop_month_11_actual,
+        SUM(IF((poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and SUBSTRING(data_dt,5,2)='12'),poweroff_duration_tm,0)) as plan_stop_month_12_actual,
 
         SUM(IF((poweroff_nature_cd in('1101','1202') and SUBSTRING(data_dt,5,2)='01'),poweroff_duration_tm,0)) as error_stop_month_01_actual,
         SUM(IF((poweroff_nature_cd in('1101','1202') and SUBSTRING(data_dt,5,2)='02'),poweroff_duration_tm,0)) as error_stop_month_02_actual,
@@ -431,8 +431,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SUM(IF((poweroff_nature_cd in('1101','1202') and SUBSTRING(data_dt,5,2)='12'),poweroff_duration_tm,0)) as error_stop_month_12_actual
         from pdm_stop_records
         where SUBSTRING(data_dt,1,4) = #{reportYear}
-        GROUP BY std_county_org_nm
-        ) t2 on t1.company_name = t2.org_name
+        GROUP BY std_county_org_no
+        ) t2 on t1.company_no = t2.std_county_org_no
         where  report_year = #{reportYear}
 
     </select>