diff --git a/sk-module-biz/src/main/java/com/skua/modules/report/controller/OperationDailyController.java b/sk-module-biz/src/main/java/com/skua/modules/report/controller/OperationDailyController.java index 06e0073..a41c7c8 100644 --- a/sk-module-biz/src/main/java/com/skua/modules/report/controller/OperationDailyController.java +++ b/sk-module-biz/src/main/java/com/skua/modules/report/controller/OperationDailyController.java @@ -88,11 +88,12 @@ public class OperationDailyController { dataMap = commonSqlService.queryForMap(sql); operationDailyVO.setIncreaseDsdh(JSUtils.subtract(operationDailyVO.getDsdh(), dataMap.get("dsdh"))); + // 5 污泥脱水公司 dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"WNL", departIds, previousDay,previousDay); sql = " select GROUP_CONCAT( d.depart_name SEPARATOR ',' ) AS depart_name from "+dataViewName3a24+ " aaa left join sys_depart d on d.id = aaa.depart_id where ifnull(aaa.WNL,0) = 0"; dataMap = commonSqlService.queryForMap(sql); - operationDailyVO.setWnDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") ); + operationDailyVO.setWnDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无").replaceAll(",",",") ); // 6 污泥浓度公司 String dataViewName9bff = ReportViewUtil.buildView(ReportConstant.view9bff,"AYHGMLSS,BYHGMLSS,CYHGMLSS,DYHGMLSS,EYHGMLSS,FYHGMLSS", departIds, dateTIme,dateTIme); @@ -108,7 +109,7 @@ public class OperationDailyController { sql += " left join sys_factory_info bbb on bbb.depart_id = aaa.depart_id ) ccc "; sql += " left join sys_depart d on ccc.depart_id = d.id where ccc.result = 1"; dataMap = commonSqlService.queryForMap(sql); - operationDailyVO.setMlssDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") ); + operationDailyVO.setMlssDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无").replaceAll(",",",") ); // 7 进水超标公司 // JSZL,JSCOD,JSAD,JSZD,JSPH @@ -127,7 +128,7 @@ public class OperationDailyController { sql += ") bbb on bbb.depart_id = aaa.depart_id "; sql += " ) ccc left join sys_depart d on ccc.depart_id = d.id where ccc.result = 1"; dataMap = commonSqlService.queryForMap(sql); - operationDailyVO.setJsDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") ); + operationDailyVO.setJsDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无").replaceAll(",",",") ); // 8 出水超标部门 dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.field_2119_CS, departIds, dateTIme,dateTIme); sql = " select ifnull(GROUP_CONCAT(d.depart_name),'无') depart_name from ( select aaa.depart_id,"; @@ -144,15 +145,15 @@ public class OperationDailyController { sql += " ) bbb on bbb.depart_id = aaa.depart_id "; sql += " ) ccc left join sys_depart d on ccc.depart_id = d.id where ccc.result = 1"; dataMap = commonSqlService.queryForMap(sql); - operationDailyVO.setCsDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") ); + operationDailyVO.setCsDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无").replaceAll(",",",") ); // 9 电耗超标公司 dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, dateTIme,dateTIme); dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ", departIds, dateTIme,dateTIme); - sql ="select GROUP_CONCAT(d.depart_name,',') depart_name from "+dataViewName3a24+ " aaa left join "+dataViewName2119+ " bbb on aaa.depart_id = bbb.depart_id and aaa.time = bbb.time "; + sql ="select GROUP_CONCAT(d.depart_name) depart_name from "+dataViewName3a24+ " aaa left join "+dataViewName2119+ " bbb on aaa.depart_id = bbb.depart_id and aaa.time = bbb.time "; sql += " left join report_target_config rtc on rtc.depart_id = aaa.depart_id and rtc.target_year = "+DateUtils.getDateYear(dateTIme); sql += " left join sys_depart d on d.id = aaa.depart_id where (aaa.DLHJ/bbb.CSL ) > ifnull(rtc.target_power,999999999.99)"; dataMap = commonSqlService.queryForMap(sql); - operationDailyVO.setDhDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") ); + operationDailyVO.setDhDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无").replaceAll(",",",") ); //10 药剂单耗公司 dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,ReportConstant.fieldYj, departIds, dateTIme,dateTIme); @@ -184,7 +185,7 @@ public class OperationDailyController { sql += " left join report_target_config rtc on rtc.depart_id = aa.depart_id and rtc.target_year = '"+ DateUtils.getDateYear(dateTIme)+"'"; sql += " ) ccc left join sys_depart d on d.id = ccc.depart_id where ccc.result =1 "; dataMap = commonSqlService.queryForMap(sql); - operationDailyVO.setYhDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") ); + operationDailyVO.setYhDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无").replaceAll(",",",") ); if("1818215543140909056".equals(departId)){ String dataViewName6643 = ReportViewUtil.buildView(ReportConstant.view6643,"GSL", departIds, dateTIme,dateTIme); @@ -200,4 +201,5 @@ public class OperationDailyController { return operationDailyVO; } + } diff --git a/sk-module-datafill/src/main/java/com/skua/modules/report/controller/OperationReportController.java b/sk-module-datafill/src/main/java/com/skua/modules/report/controller/OperationReportController.java index 5c24ae0..5a14267 100644 --- a/sk-module-datafill/src/main/java/com/skua/modules/report/controller/OperationReportController.java +++ b/sk-module-datafill/src/main/java/com/skua/modules/report/controller/OperationReportController.java @@ -37,10 +37,12 @@ public class OperationReportController { public Result<ProductDataVO> reportDataInfo( @RequestParam(name="year") Integer year, @RequestParam(name="season") Integer season, + @RequestParam(name="startDate") String startDate, + @RequestParam(name="endDate") String endDate, HttpServletRequest req) { Result<ProductDataVO> result = new Result<ProductDataVO>(); String departIds = BaseContextHandler.getDeparts();//1818214519948836864,1711662624459804674 - ProductDataVO productDataVO = operationReportService.handeReportMonthData(departIds,year,season); + ProductDataVO productDataVO = operationReportService.handeReportMonthData(departIds,year,season,startDate,endDate); result.setResult( productDataVO ); return result; } diff --git a/sk-module-datafill/src/main/java/com/skua/modules/report/service/IOperationReportService.java b/sk-module-datafill/src/main/java/com/skua/modules/report/service/IOperationReportService.java index f413b03..aadb903 100644 --- a/sk-module-datafill/src/main/java/com/skua/modules/report/service/IOperationReportService.java +++ b/sk-module-datafill/src/main/java/com/skua/modules/report/service/IOperationReportService.java @@ -13,5 +13,5 @@ public interface IOperationReportService { * @param season * @return */ - ProductDataVO handeReportMonthData(String departIds,Integer year, Integer season); + ProductDataVO handeReportMonthData(String departIds,Integer year, Integer season,String startDate,String endDate); } diff --git a/sk-module-datafill/src/main/java/com/skua/modules/report/service/impl/OperationReportServiceImpl.java b/sk-module-datafill/src/main/java/com/skua/modules/report/service/impl/OperationReportServiceImpl.java index 91f1e51..1e1f713 100644 --- a/sk-module-datafill/src/main/java/com/skua/modules/report/service/impl/OperationReportServiceImpl.java +++ b/sk-module-datafill/src/main/java/com/skua/modules/report/service/impl/OperationReportServiceImpl.java @@ -44,7 +44,7 @@ public class OperationReportServiceImpl implements IOperationReportService { * @param season * @return */ - public ProductDataVO handeReportMonthData(String departId,Integer year, Integer season){ + public ProductDataVO handeReportMonthData(String departId,Integer year, Integer season,String startDate,String endDate){ ProductDataVO productDataVO = new ProductDataVO();//返回结果 int lastYear = year - 1;//去年 productDataVO.setLastYear(lastYear); @@ -54,16 +54,23 @@ public class OperationReportServiceImpl implements IOperationReportService { productDataVO.setSeansonEndDay(seasonTimeVO.getEndTime());//季度最后一天 productDataVO.setStartTime(seasonTimeVO.getStartTime());//季度开始时间 productDataVO.setEndTime( seasonTimeVO.getEndTime());//季度结束时间 + if(StringUtils.isNotEmpty(startDate)){ + productDataVO.setStartTime(startDate);//开始时间 + } + if(StringUtils.isNotEmpty(endDate)){ + productDataVO.setEndTime( endDate);//结束时间 + } + //水务公司总数 String sql = "select count(1) from sys_depart where depart_type = 1 and id in ("+JSUtils.quoteEach(departId,",")+")"; String deptartCount = getJdbcTemplate().queryForObject(sql,String.class); productDataVO.setDeptartCount( deptartCount ); - long dayNum = DateUtils.differenceDay(seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime());//天数 + long dayNum = DateUtils.differenceDay(productDataVO.getStartTime(),productDataVO.getEndTime());//天数 // String departId = BaseContextHandler.getDeparts(); productDataVO.setSequentialProgress("基本满足时序进度"); // ysfsl:月收费水量 ; yyf:月药费 ; ysjsl:月实际水量 - String dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysfsl,ysjsl,yyf", departId, seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime()); + String dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysfsl,ysjsl,yyf", departId, productDataVO.getStartTime(),productDataVO.getEndTime()); sql = "select round(sum(aaa.ysfsl),2) 'ysfsl' , round(sum(aaa.yyf),2) 'yyf' ,round(sum(aaa.ysjsl),2) 'ysjsl' from "+ dataViewName4411 + " aaa"; String ysfsl = null;//月收费水量 ; String ysjsl = null;//月实际水量; @@ -88,7 +95,7 @@ public class OperationReportServiceImpl implements IOperationReportService { productDataVO.setSequentialProgress("超额完成时序进度"); } /****************去年同期数据处理************************/ - dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysfsl,ysjsl,yyf", departId, DateUtils.getTbDate(seasonTimeVO.getStartTime()), DateUtils.getTbDate(seasonTimeVO.getEndTime())); + dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysfsl,ysjsl,yyf", departId, DateUtils.getTbDate(productDataVO.getStartTime()), DateUtils.getTbDate(productDataVO.getEndTime())); sql = "select sum(aaa.ysfsl) 'ysfsl' , sum(aaa.yyf) 'yyf' ,sum(aaa.ysjsl) 'ysjsl' from "+ dataViewName4411 + " aaa"; String ysfslTB = null;//月收费水量 ; String ysjslTB = null;//月实际水量; @@ -100,12 +107,12 @@ public class OperationReportServiceImpl implements IOperationReportService { String expression = " 100 * ( "+ysfsl+" - "+ysfslTB+")/ "+ysfslTB; productDataVO.setChargeWaterRatio(JSUtils.executeExpression(expression,"0")); - productDataVO.setAvgYsjslWaterVolume(JSUtils.divide(ysjsl,DateUtils.differenceDay(DateUtils.getTbDate(seasonTimeVO.getStartTime()),DateUtils.getTbDate(seasonTimeVO.getEndTime()))));//实际处理水量-日均值 + productDataVO.setAvgYsjslWaterVolume(JSUtils.divide(ysjsl,DateUtils.differenceDay(DateUtils.getTbDate(productDataVO.getStartTime()),DateUtils.getTbDate(productDataVO.getEndTime()))));//实际处理水量-日均值 expression = " 100 * ( "+ysjsl+" - "+ysjslTB+")/ "+ysjslTB; productDataVO.setYsjslWaterRatio( JSUtils.executeExpression(expression,"0"));//实际处理水量--同比增长 /***************** 实际水量同比下降水务公司原因分析一览表************************/ - dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysjsl,tqysjsl,ysjsldyqntqyy", departId, seasonTimeVO.getStartTime(), seasonTimeVO.getEndTime()); + dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysjsl,tqysjsl,ysjsldyqntqyy", departId, productDataVO.getStartTime(), productDataVO.getEndTime()); sql = " select aaa.depart_id , d.depart_name departName, round(100*(sum(ifnull(aaa.ysjsl,0)) - sum(ifnull(aaa.tqysjsl,0)) )/ sum(ifnull(aaa.tqysjsl,0)),2) 'ratio', "; sql += " round( sum(ifnull(aaa.ysjsl,0)),2 ) 'ysjsl' ,round( sum(ifnull(aaa.tqysjsl,0)),2 ) 'tqysjsl' ,GROUP_CONCAT(aaa.ysjsldyqntqyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa"; sql += " left join sys_depart d on d.id = aaa.depart_id"; @@ -114,7 +121,7 @@ public class OperationReportServiceImpl implements IOperationReportService { productDataVO.setWaterDeptartList(waterMonthDataList); //水电耗高于控制目标--水务公司列表 - dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ydh,dhcmbzyy", departId, seasonTimeVO.getStartTime(), seasonTimeVO.getEndTime()); + dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ydh,dhcmbzyy", departId, productDataVO.getStartTime(), productDataVO.getEndTime()); sql = "select * from ( "; sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.ydh),2) realConsume , IFNULL(tc.target_power,2) 'targetConsume' ,GROUP_CONCAT(aaa.dhcmbzyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";; sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')"; @@ -125,7 +132,7 @@ public class OperationReportServiceImpl implements IOperationReportService { /** ysjsl:月实际水量 ; 月药耗 yyh; 去年同期药耗 qntqyh; 月药费 yyf;药耗高于去年同期原因 yhgyqntqyy;药耗超预期原因 yhcyqyy; 本年实际药耗 bnsjyh; 本年药耗目标 bnyhmb*/ //药剂成本高于控制目标--水务公司列表 - dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"yyh,yhcyqyy", departId, seasonTimeVO.getStartTime(), seasonTimeVO.getEndTime()); + dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"yyh,yhcyqyy", departId, productDataVO.getStartTime(), productDataVO.getEndTime()); sql = "select * from ( "; sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.yyh),2) realConsume , IFNULL(tc.target_drug,2) 'targetConsume' ,GROUP_CONCAT(aaa.yhcyqyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";; sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')";