Merge remote-tracking branch 'origin/master'
正在显示
11 个修改的文件
包含
213 行增加
和
43 行删除
... | @@ -11,7 +11,7 @@ public interface ReportConstant { | ... | @@ -11,7 +11,7 @@ public interface ReportConstant { |
11 | //能源日报 | 11 | //能源日报 |
12 | public static final String view3a24 = "3a243d5715b9e1a3753c180872ca0df9"; | 12 | public static final String view3a24 = "3a243d5715b9e1a3753c180872ca0df9"; |
13 | 13 | ||
14 | //上产月报 | 14 | //生产月报 |
15 | public static final String view4411 = "4411ed3d78634bcdcd700f6e33724025"; | 15 | public static final String view4411 = "4411ed3d78634bcdcd700f6e33724025"; |
16 | 16 | ||
17 | //化验日报 | 17 | //化验日报 | ... | ... |
... | @@ -138,6 +138,7 @@ public class JSUtils { | ... | @@ -138,6 +138,7 @@ public class JSUtils { |
138 | Double aDouble = executeExpression( expression ); | 138 | Double aDouble = executeExpression( expression ); |
139 | DecimalFormat df = new DecimalFormat(decimalFormat); | 139 | DecimalFormat df = new DecimalFormat(decimalFormat); |
140 | result = df.format(aDouble); | 140 | result = df.format(aDouble); |
141 | result = convertStringToInt(result);//去掉.00后缀 | ||
141 | }catch(Exception e ){ | 142 | }catch(Exception e ){ |
142 | // e.printStackTrace(); | 143 | // e.printStackTrace(); |
143 | } | 144 | } | ... | ... |
... | @@ -9,6 +9,7 @@ import com.skua.modules.algorithm.vo.DepartLoadRateResultVO; | ... | @@ -9,6 +9,7 @@ import com.skua.modules.algorithm.vo.DepartLoadRateResultVO; |
9 | import com.skua.modules.algorithm.vo.WaterTreatmentVO; | 9 | import com.skua.modules.algorithm.vo.WaterTreatmentVO; |
10 | import com.skua.modules.common.vo.DateVO; | 10 | import com.skua.modules.common.vo.DateVO; |
11 | import com.skua.modules.equipment.vo.DrugConsumptionDisplayVO; | 11 | import com.skua.modules.equipment.vo.DrugConsumptionDisplayVO; |
12 | import com.skua.modules.guest.util.DateUtil; | ||
12 | import com.skua.modules.quartz.util.BaseUtil; | 13 | import com.skua.modules.quartz.util.BaseUtil; |
13 | import com.skua.modules.report.vo.DepartLoadRateVO; | 14 | import com.skua.modules.report.vo.DepartLoadRateVO; |
14 | import com.skua.modules.report.vo.FRportlCommandCenterVO; | 15 | import com.skua.modules.report.vo.FRportlCommandCenterVO; |
... | @@ -106,7 +107,7 @@ public class ReportItemvService { | ... | @@ -106,7 +107,7 @@ public class ReportItemvService { |
106 | // long lastYearDifferDay = DateUtils.differenceDay(dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()); | 107 | // long lastYearDifferDay = DateUtils.differenceDay(dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()); |
107 | 108 | ||
108 | //当月数据/环比、同比 | 109 | //当月数据/环比、同比 |
109 | FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总电耗(", JSUtils.divide(dlhjData.getValue(),10000), JSUtils.divide(dlhjData.getValueTb(),10000), JSUtils.divide(dlhjData.getValueHb(),10000)); | 110 | FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总电耗", JSUtils.divide(dlhjData.getValue(),10000), JSUtils.divide(dlhjData.getValueTb(),10000), JSUtils.divide(dlhjData.getValueHb(),10000)); |
110 | //日均数据:/环比/同比 | 111 | //日均数据:/环比/同比 |
111 | FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均电耗",JSUtils.divide(dlhj_avg_value,10000) ,JSUtils.divide(dlhj_avg_valueTB,10000) ,JSUtils.divide(dlhj_avg_valueHB,10000)); | 112 | FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均电耗",JSUtils.divide(dlhj_avg_value,10000) ,JSUtils.divide(dlhj_avg_valueTB,10000) ,JSUtils.divide(dlhj_avg_valueHB,10000)); |
112 | //吨水消耗 | 113 | //吨水消耗 |
... | @@ -365,23 +366,73 @@ public class ReportItemvService { | ... | @@ -365,23 +366,73 @@ public class ReportItemvService { |
365 | return sql ; | 366 | return sql ; |
366 | } | 367 | } |
367 | 368 | ||
369 | |||
370 | /*** | ||
371 | * 能耗分析*(新) | ||
372 | * @return | ||
373 | */ | ||
374 | public List<FRportlCommandCenterVO> statisticsByElectricityNew(String departId, String startTime, String endTime) { | ||
375 | List<FRportlCommandCenterVO> fRportlCommandCenterVOList = new ArrayList<>(); | ||
376 | DateVO dateVO = new DateVO(startTime); | ||
377 | |||
378 | ReportItemVO dlhjData = ReportViewUtil.getSumValueByTBHB(ReportConstant.view3a24, "DLHJ", departId, startTime, endTime); | ||
379 | |||
380 | String dsdh_value = ReportViewUtil.getValueByDSDH(departId,startTime, endTime) ; | ||
381 | String dsdh_value_Hb = ReportViewUtil.getValueByDSDH(departId,dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()) ; | ||
382 | String dsdh_value_Tb = ReportViewUtil.getValueByDSDH(departId,dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()) ; | ||
383 | |||
384 | |||
385 | String dfValueSql = "select sum(cost) cost from report_electric_cost t where t.month >='"+DateUtils.formatDate(startTime,"yyyy-MM")+"' and t.month<='"+DateUtils.formatDate(endTime,"yyyy-MM")+"' "; | ||
386 | dfValueSql += " and t.depart_id in ("+JSUtils.quoteEach(departId,",")+")"; | ||
387 | String dfValue = getJdbcTemplate().queryForObject(dfValueSql,String.class); | ||
388 | |||
389 | String dfTBValueSql = "select sum(cost) cost from report_electric_cost t where t.month >='"+DateUtils.formatDate(DateUtils.getTbDate(startTime),"yyyy-MM")+"' and t.month<='"+DateUtils.formatDate(DateUtils.getTbDate(endTime),"yyyy-MM")+"' "; | ||
390 | dfTBValueSql += " and t.depart_id in ("+JSUtils.quoteEach(departId,",")+")"; | ||
391 | String dfTBValue = getJdbcTemplate().queryForObject(dfTBValueSql,String.class); | ||
392 | |||
393 | String dfHBValueSql = "select sum(cost) cost from report_electric_cost t where t.month >='"+DateUtils.formatDate(DateUtils.getHbDate(startTime),"yyyy-MM")+"' and t.month<='"+DateUtils.formatDate(DateUtils.getHbDate(endTime),"yyyy-MM")+"' "; | ||
394 | dfHBValueSql += " and t.depart_id in ("+JSUtils.quoteEach(departId,",")+")"; | ||
395 | String dfHBValue = getJdbcTemplate().queryForObject(dfHBValueSql,String.class); | ||
396 | //出水量:+同比+环比 | ||
397 | ReportItemVO csl_reportVO = ReportViewUtil.getSumValueByTBHB(ReportConstant.view2119,ReportConstant.field_CSL, departId, startTime, endTime); | ||
398 | |||
399 | //当月数据/环比、同比 | ||
400 | FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总电耗", JSUtils.divide(dlhjData.getValue(),10000), JSUtils.divide(dlhjData.getValueTb(),10000), JSUtils.divide(dlhjData.getValueHb(),10000)); | ||
401 | //日均数据:/环比/同比 | ||
402 | FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("吨水电费",JSUtils.divide(dfValueSql,csl_reportVO.getValue()) ,JSUtils.divide(dfTBValue,csl_reportVO.getValueTb()) ,JSUtils.divide(dfHBValue,csl_reportVO.getValueHb())); | ||
403 | //吨水消耗 | ||
404 | FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水电耗",dsdh_value ,dsdh_value_Tb,dsdh_value_Hb ); | ||
405 | fRportlCommandCenterVOList.add( nowMonthVO) ; | ||
406 | fRportlCommandCenterVOList.add( lastMonthVO) ; | ||
407 | fRportlCommandCenterVOList.add( lastYearVo) ; | ||
408 | |||
409 | return fRportlCommandCenterVOList; | ||
410 | } | ||
411 | |||
412 | |||
413 | /*** | ||
414 | * 药耗分析 | ||
415 | * @param departIds | ||
416 | * @param startDate | ||
417 | * @param endDate | ||
418 | * @return | ||
419 | */ | ||
368 | public List<FRportlCommandCenterVO> statisticsByYh(String departIds, String startDate, String endDate) { | 420 | public List<FRportlCommandCenterVO> statisticsByYh(String departIds, String startDate, String endDate) { |
369 | //出水量:+同比+环比 | 421 | //出水量:+同比+环比 |
370 | ReportItemVO csl_reportVO = ReportViewUtil.getSumValueByTBHB(ReportConstant.view2119,ReportConstant.field_CSL, departIds, startDate, endDate); | 422 | ReportItemVO csl_reportVO = ReportViewUtil.getSumValueByTBHB(ReportConstant.view2119,ReportConstant.field_CSL, departIds, startDate, endDate); |
371 | //总药耗:value ; 同比 环比 | 423 | //总药耗:value ; 同比 环比 |
372 | ReportItemVO zyhReportVO = ReportViewUtil.getSumValueByTBHB( ReportConstant.view3a24,ReportConstant.fieldYj, departIds, startDate,endDate); | 424 | ReportItemVO zyhReportVO = ReportViewUtil.getSumValueByTBHB( ReportConstant.view3a24,ReportConstant.fieldYj, departIds, startDate,endDate); |
373 | //日均药耗 value ,同比,环比 | 425 | //日均 value ,同比,环比 |
374 | ReportItemVO zyhReportAVG = ReportViewUtil.getSumValueByTBHB( ReportConstant.view3a24,ReportConstant.fieldYj, departIds, startDate,endDate,"avg"); | 426 | //ReportItemVO zyhReportAVG = ReportViewUtil.getSumValueByTBHB( ReportConstant.view3a24,ReportConstant.fieldYj, departIds, startDate,endDate,"avg"); |
427 | //月吨水药费 | ||
428 | ReportItemVO dsyfReportVO = ReportViewUtil.getSumValueByTBHB( ReportConstant.view4411,"yyh", departIds, startDate,endDate); | ||
375 | 429 | ||
376 | //计算药耗 | ||
377 | DrugConsumptionDisplayVO displayVO = new DrugConsumptionDisplayVO(ConvertUtils.getDouble(csl_reportVO.getValue(),0d) , ConvertUtils.getDouble(csl_reportVO.getValueHb(),0d), ConvertUtils.getDouble(csl_reportVO.getValueTb(),0d), | ||
378 | ConvertUtils.getDouble(zyhReportVO.getValue(),0d), ConvertUtils.getDouble(zyhReportVO.getValueHb(),0d), ConvertUtils.getDouble(zyhReportVO.getValueTb(),0d)); | ||
379 | 430 | ||
380 | List<FRportlCommandCenterVO> dataList = new ArrayList<>(); | 431 | List<FRportlCommandCenterVO> dataList = new ArrayList<>(); |
381 | 432 | dataList.add( new FRportlCommandCenterVO("月总药耗" ,"monthValue","万吨",JSUtils.divide(zyhReportVO.getValue(),"10000"),JSUtils.divide(zyhReportVO.getValueTb(),"10000"),JSUtils.divide(zyhReportVO.getValueHb(),"10000")) ); | |
382 | dataList.add( new FRportlCommandCenterVO("月总药耗" ,zyhReportVO.getValue(),zyhReportVO.getValueTb(),zyhReportVO.getValueHb()) ); | 433 | dataList.add( new FRportlCommandCenterVO("吨水药费" ,"dsyfValue","元/吨",dsyfReportVO.getValue(),dsyfReportVO.getValueTb(),dsyfReportVO.getValueHb()) ); |
383 | dataList.add( new FRportlCommandCenterVO("日均药耗" ,zyhReportAVG.getValue(),zyhReportAVG.getValueTb(),zyhReportAVG.getValueHb()) ); | 434 | dataList.add( new FRportlCommandCenterVO("吨水药耗" ,"dsyhValue","kg/吨",JSUtils.divide(zyhReportVO.getValue(), csl_reportVO.getValue()),JSUtils.divide(zyhReportVO.getValueTb(), csl_reportVO.getValueTb()),JSUtils.divide(zyhReportVO.getValueHb(), csl_reportVO.getValueHb())) ); |
384 | dataList.add( new FRportlCommandCenterVO("吨水药耗" ,displayVO.getDsyh()+"",displayVO.getTbqndsyh()+"",displayVO.getHbsydsyh()+"") ); | 435 | return dataList; |
385 | return null; | ||
386 | } | 436 | } |
437 | |||
387 | } | 438 | } | ... | ... |
sk-module-biz/src/main/java/com/skua/modules/dataAnalysis/controller/DataAnalysisController.java
0 → 100644
1 | package com.skua.modules.dataAnalysis.controller; | ||
2 | |||
3 | /** | ||
4 | * @auther kangwei | ||
5 | * @create 2025-02-20-10:27 | ||
6 | */ | ||
7 | |||
8 | import com.skua.core.api.vo.Result; | ||
9 | import com.skua.core.aspect.annotation.AutoLog; | ||
10 | import com.skua.core.context.BaseContextHandler; | ||
11 | import com.skua.modules.algorithm.service.impl.ReportItemvService; | ||
12 | import com.skua.modules.custom.service.IFCustomReportDatasetService; | ||
13 | import com.skua.modules.report.vo.FRportlCommandCenterVO; | ||
14 | import com.skua.modules.report.vo.ReportItemvParam; | ||
15 | import com.skua.modules.report.vo.largeScreen.ResultNumberVO; | ||
16 | import io.swagger.annotations.Api; | ||
17 | import io.swagger.annotations.ApiOperation; | ||
18 | import lombok.extern.slf4j.Slf4j; | ||
19 | import org.apache.commons.lang3.StringUtils; | ||
20 | import org.springframework.beans.factory.annotation.Autowired; | ||
21 | import org.springframework.web.bind.annotation.GetMapping; | ||
22 | import org.springframework.web.bind.annotation.RequestMapping; | ||
23 | import org.springframework.web.bind.annotation.RestController; | ||
24 | |||
25 | import java.util.List; | ||
26 | |||
27 | /** | ||
28 | * 报表数据分析 | ||
29 | */ | ||
30 | @Slf4j | ||
31 | @Api(tags="报表数据分析") | ||
32 | @RestController | ||
33 | @RequestMapping("/v1/dataAnalysis") | ||
34 | public class DataAnalysisController { | ||
35 | |||
36 | @Autowired | ||
37 | private ReportItemvService reportItemvService; | ||
38 | @Autowired | ||
39 | private IFCustomReportDatasetService reportDatasetService; | ||
40 | |||
41 | |||
42 | } |
sk-module-biz/src/main/java/com/skua/modules/dataAnalysis/controller/SysCommandCentreController.java
... | @@ -5,6 +5,7 @@ import com.skua.core.api.vo.Result; | ... | @@ -5,6 +5,7 @@ import com.skua.core.api.vo.Result; |
5 | import com.skua.core.aspect.annotation.AutoLog; | 5 | import com.skua.core.aspect.annotation.AutoLog; |
6 | import com.skua.core.context.BaseContextHandler; | 6 | import com.skua.core.context.BaseContextHandler; |
7 | import com.skua.core.util.ConvertUtils; | 7 | import com.skua.core.util.ConvertUtils; |
8 | import com.skua.modules.custom.service.IFCustomReportDatasetService; | ||
8 | import com.skua.modules.dataAnalysis.service.ICommandCentreService; | 9 | import com.skua.modules.dataAnalysis.service.ICommandCentreService; |
9 | import com.skua.modules.algorithm.service.impl.ReportItemvService; | 10 | import com.skua.modules.algorithm.service.impl.ReportItemvService; |
10 | import com.skua.modules.algorithm.vo.DepartLoadRateResultVO; | 11 | import com.skua.modules.algorithm.vo.DepartLoadRateResultVO; |
... | @@ -17,12 +18,14 @@ import com.skua.modules.report.vo.DepartDrugResult; | ... | @@ -17,12 +18,14 @@ import com.skua.modules.report.vo.DepartDrugResult; |
17 | import com.skua.modules.report.vo.FRportlCommandCenterVO; | 18 | import com.skua.modules.report.vo.FRportlCommandCenterVO; |
18 | import com.skua.modules.report.vo.ReportDateTrendVO; | 19 | import com.skua.modules.report.vo.ReportDateTrendVO; |
19 | import com.skua.modules.report.vo.ReportItemvParam; | 20 | import com.skua.modules.report.vo.ReportItemvParam; |
21 | import com.skua.modules.report.vo.largeScreen.ResultNumberVO; | ||
20 | import com.skua.modules.system.service.ISysFactoryInfoService; | 22 | import com.skua.modules.system.service.ISysFactoryInfoService; |
21 | import com.skua.tool.util.DateUtils; | 23 | import com.skua.tool.util.DateUtils; |
22 | import com.skua.tool.util.JSUtils; | 24 | import com.skua.tool.util.JSUtils; |
23 | import io.swagger.annotations.Api; | 25 | import io.swagger.annotations.Api; |
24 | import io.swagger.annotations.ApiOperation; | 26 | import io.swagger.annotations.ApiOperation; |
25 | import lombok.extern.slf4j.Slf4j; | 27 | import lombok.extern.slf4j.Slf4j; |
28 | import org.apache.commons.lang3.StringUtils; | ||
26 | import org.springframework.beans.factory.annotation.Autowired; | 29 | import org.springframework.beans.factory.annotation.Autowired; |
27 | import org.springframework.web.bind.annotation.GetMapping; | 30 | import org.springframework.web.bind.annotation.GetMapping; |
28 | import org.springframework.web.bind.annotation.RequestMapping; | 31 | import org.springframework.web.bind.annotation.RequestMapping; |
... | @@ -51,6 +54,9 @@ public class SysCommandCentreController { | ... | @@ -51,6 +54,9 @@ public class SysCommandCentreController { |
51 | private ICommandCentreService commandCentreService; | 54 | private ICommandCentreService commandCentreService; |
52 | @Autowired | 55 | @Autowired |
53 | private ReportItemvService reportItemvService; | 56 | private ReportItemvService reportItemvService; |
57 | @Autowired | ||
58 | private IFCustomReportDatasetService reportDatasetService; | ||
59 | |||
54 | 60 | ||
55 | /** | 61 | /** |
56 | * 分页列表查询 | 62 | * 分页列表查询 |
... | @@ -156,7 +162,33 @@ public class SysCommandCentreController { | ... | @@ -156,7 +162,33 @@ public class SysCommandCentreController { |
156 | result.setResult(dataList ); | 162 | result.setResult(dataList ); |
157 | return result; | 163 | return result; |
158 | } | 164 | } |
165 | @AutoLog(value = "消减量(同比、环比)") | ||
166 | @ApiOperation(value="消减量(同比、环比)", notes="消减量(同比、环比)") | ||
167 | @GetMapping(value = "/xjlByTbHb") | ||
168 | public Result<List<ResultNumberVO>> queryXjlByTbHb(String departId , String startDate, String endDate) { | ||
169 | Result<List<ResultNumberVO>> result = new Result(); | ||
170 | String departIds = departId; | ||
171 | if(StringUtils.isEmpty(departId)){ | ||
172 | departIds = BaseContextHandler.getDeparts(); | ||
173 | } | ||
174 | List<ResultNumberVO> dataList = reportDatasetService.queryXjlByTbHb(departId,startDate,endDate); | ||
175 | result.setResult(dataList); | ||
176 | return result; | ||
177 | } | ||
159 | 178 | ||
179 | @AutoLog(value = "指挥中心-药耗分析") | ||
180 | @ApiOperation(value="指挥中心-药耗分析", notes="指挥中心-药耗分析") | ||
181 | @GetMapping(value = "/statisticsByYhfx") | ||
182 | public Result<List<FRportlCommandCenterVO>> statisticsByYh(ReportItemvParam reportItemvParam) { | ||
183 | Result<List<FRportlCommandCenterVO>> result = new Result(); | ||
184 | String departId = BaseContextHandler.getDeparts(); | ||
185 | if(reportItemvParam.getDepartIds()!=null){ | ||
186 | departId = reportItemvParam.getDepartIds(); | ||
187 | } | ||
188 | List<FRportlCommandCenterVO> dataList = reportItemvService.statisticsByYh(departId,reportItemvParam.getStartDate(),reportItemvParam.getEndDate()); | ||
189 | result.setResult(dataList); | ||
190 | return result; | ||
191 | } | ||
160 | 192 | ||
161 | //cement水泥 electricity | 193 | //cement水泥 electricity |
162 | @AutoLog(value = "指挥中心-能耗分析") | 194 | @AutoLog(value = "指挥中心-能耗分析") |
... | @@ -172,21 +204,21 @@ public class SysCommandCentreController { | ... | @@ -172,21 +204,21 @@ public class SysCommandCentreController { |
172 | result.setResult(dataList ); | 204 | result.setResult(dataList ); |
173 | return result; | 205 | return result; |
174 | } | 206 | } |
175 | 207 | @AutoLog(value = "指挥中心-能耗分析(新)") | |
176 | @AutoLog(value = "指挥中心-药耗分析") | 208 | @ApiOperation(value="指挥中心-能耗分析(新)", notes="指挥中心-能耗分析(新)") |
177 | @ApiOperation(value="指挥中心-药耗分析", notes="指挥中心-药耗分析") | 209 | @GetMapping(value = "/statisticsByElectricityNew") |
178 | @GetMapping(value = "/statisticsByYh") | 210 | public Result<List<FRportlCommandCenterVO>> statisticsByElectricityNew(ReportItemvParam reportItemvParam) { |
179 | public Result<List<FRportlCommandCenterVO>> statisticsByYh(ReportItemvParam reportItemvParam) { | ||
180 | Result<List<FRportlCommandCenterVO>> result = new Result(); | 211 | Result<List<FRportlCommandCenterVO>> result = new Result(); |
181 | String departId = BaseContextHandler.getDeparts(); | 212 | String departId = BaseContextHandler.getDeparts(); |
182 | if(reportItemvParam.getDepartIds()!=null){ | 213 | if(reportItemvParam.getDepartIds()!=null){ |
183 | departId = reportItemvParam.getDepartIds(); | 214 | departId = reportItemvParam.getDepartIds(); |
184 | } | 215 | } |
185 | List<FRportlCommandCenterVO> dataList = reportItemvService.statisticsByYh(departId,reportItemvParam.getStartDate(),reportItemvParam.getEndDate()); | 216 | List<FRportlCommandCenterVO> dataList = reportItemvService.statisticsByElectricityNew(departId,reportItemvParam.getStartDate(),reportItemvParam.getEndDate()); |
186 | result.setResult(dataList); | 217 | result.setResult(dataList ); |
187 | return result; | 218 | return result; |
188 | } | 219 | } |
189 | 220 | ||
221 | |||
190 | @AutoLog(value = "指挥中心-能耗分析") | 222 | @AutoLog(value = "指挥中心-能耗分析") |
191 | @ApiOperation(value="指挥中心-能耗分析--详情列表", notes="指挥中心-能耗分析--详情列表") | 223 | @ApiOperation(value="指挥中心-能耗分析--详情列表", notes="指挥中心-能耗分析--详情列表") |
192 | @GetMapping(value = "/statisticsByElectricityList") | 224 | @GetMapping(value = "/statisticsByElectricityList") | ... | ... |
sk-module-biz/src/main/java/com/skua/modules/dataAnalysis/service/impl/CommandCentreServiceImpl.java
... | @@ -136,7 +136,10 @@ public class CommandCentreServiceImpl implements ICommandCentreService { | ... | @@ -136,7 +136,10 @@ public class CommandCentreServiceImpl implements ICommandCentreService { |
136 | startDate = startDate+" 00:00:00"; | 136 | startDate = startDate+" 00:00:00"; |
137 | endDate = endDate+" 23:59:59"; | 137 | endDate = endDate+" 23:59:59"; |
138 | String sql = "select round( ifnull(sum( er.total_cost),0) ,2) 'cost' from equipment_repair er where er.reality_maintenance_end_time >='"+startDate+"' and er.reality_maintenance_end_time <='"+endDate+"'"; | 138 | String sql = "select round( ifnull(sum( er.total_cost),0) ,2) 'cost' from equipment_repair er where er.reality_maintenance_end_time >='"+startDate+"' and er.reality_maintenance_end_time <='"+endDate+"'"; |
139 | String totalCost = getJdbcTemplate().queryForObject(sql,String.class); | 139 | String repairCost = getJdbcTemplate().queryForObject(sql,String.class);//维修费用 |
140 | sql = "select round( ifnull(sum( t.maintenance_cost),0) ,2) 'cost' from equipment_maintain_task t where t.real_end_time >='"+startDate+"' and t.real_end_time <='"+endDate+"'"; | ||
141 | String maintainCost = getJdbcTemplate().queryForObject(sql,String.class);//维护费用 | ||
142 | |||
140 | sql = "select aaa.* from ( select er.depart_id,d.depart_name, ei.equipment_name,er.fault_content,er.fault_library_id ,ei.equipment_level from equipment_repair er "; | 143 | sql = "select aaa.* from ( select er.depart_id,d.depart_name, ei.equipment_name,er.fault_content,er.fault_library_id ,ei.equipment_level from equipment_repair er "; |
141 | sql += " left join equipment_info ei on er.info_id = ei.id "; | 144 | sql += " left join equipment_info ei on er.info_id = ei.id "; |
142 | sql +=" left join sys_depart d on d.id = er.depart_id"; | 145 | sql +=" left join sys_depart d on d.id = er.depart_id"; |
... | @@ -144,7 +147,7 @@ public class CommandCentreServiceImpl implements ICommandCentreService { | ... | @@ -144,7 +147,7 @@ public class CommandCentreServiceImpl implements ICommandCentreService { |
144 | sql += " where aaa.equipment_level = '6bf727eb7e7cca6a95c694dab0036b2c'";//A类设备 | 147 | sql += " where aaa.equipment_level = '6bf727eb7e7cca6a95c694dab0036b2c'";//A类设备 |
145 | List<EquipmentRepairAnalysisVO> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<EquipmentRepairAnalysisVO>(EquipmentRepairAnalysisVO.class));; | 148 | List<EquipmentRepairAnalysisVO> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<EquipmentRepairAnalysisVO>(EquipmentRepairAnalysisVO.class));; |
146 | 149 | ||
147 | dataMap.put("totalCost",totalCost); | 150 | dataMap.put("totalCost",JSUtils.multiply(repairCost,maintainCost)); |
148 | dataMap.put("dataList",dataList); | 151 | dataMap.put("dataList",dataList); |
149 | return dataMap; | 152 | return dataMap; |
150 | } | 153 | } | ... | ... |
... | @@ -27,10 +27,10 @@ import javax.servlet.http.HttpServletRequest; | ... | @@ -27,10 +27,10 @@ import javax.servlet.http.HttpServletRequest; |
27 | @RestController("testReportController") | 27 | @RestController("testReportController") |
28 | public class TestReportSqlController { | 28 | public class TestReportSqlController { |
29 | 29 | ||
30 | @AutoLog(value = "测试报表") | 30 | @AutoLog(value = "测试报表like") |
31 | @ApiOperation(value="测试报表", notes="测试报表") | 31 | @ApiOperation(value="测试报表like", notes="测试报表") |
32 | @GetMapping(value = "/testReportSql") | 32 | @GetMapping(value = "/testReportLikeSql") |
33 | public Result<String> testReportSql( | 33 | public Result<String> testReportLikeSql( |
34 | @RequestParam(name="reportId") String reportId, | 34 | @RequestParam(name="reportId") String reportId, |
35 | @RequestParam(name="fields") String fields, | 35 | @RequestParam(name="fields") String fields, |
36 | @RequestParam(name="departIds") String departIds , | 36 | @RequestParam(name="departIds") String departIds , |
... | @@ -43,4 +43,21 @@ public class TestReportSqlController { | ... | @@ -43,4 +43,21 @@ public class TestReportSqlController { |
43 | result.setResult(dataViewName2); | 43 | result.setResult(dataViewName2); |
44 | return result; | 44 | return result; |
45 | } | 45 | } |
46 | |||
47 | @AutoLog(value = "测试报表") | ||
48 | @ApiOperation(value="测试报表", notes="测试报表") | ||
49 | @GetMapping(value = "/testReportSql") | ||
50 | public Result<String> testReportSql( | ||
51 | @RequestParam(name="reportId") String reportId, | ||
52 | @RequestParam(name="fields") String fields, | ||
53 | @RequestParam(name="departIds") String departIds , | ||
54 | @RequestParam(name="startTime") String startTime, | ||
55 | @RequestParam(name="endTime") String endTime, | ||
56 | HttpServletRequest req) { | ||
57 | Result<String> result = new Result(); | ||
58 | String dataViewName2 = ReportViewUtil.buildView(reportId,fields,departIds, startTime, endTime); | ||
59 | result.setSuccess(true); | ||
60 | result.setResult(dataViewName2); | ||
61 | return result; | ||
62 | } | ||
46 | } | 63 | } | ... | ... |
1 | package com.skua.modules.erp.controller; | 1 | package com.skua.modules.erp.controller; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 3 | |
4 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
6 | import com.skua.core.api.vo.Result; | 4 | import com.skua.core.api.vo.Result; |
7 | import com.skua.core.aspect.annotation.AutoLog; | 5 | import com.skua.core.aspect.annotation.AutoLog; |
8 | import com.skua.core.context.SpringContextUtils; | 6 | import com.skua.core.context.SpringContextUtils; |
... | @@ -15,11 +13,7 @@ import lombok.extern.slf4j.Slf4j; | ... | @@ -15,11 +13,7 @@ import lombok.extern.slf4j.Slf4j; |
15 | import org.springframework.jdbc.core.JdbcTemplate; | 13 | import org.springframework.jdbc.core.JdbcTemplate; |
16 | import org.springframework.web.bind.annotation.GetMapping; | 14 | import org.springframework.web.bind.annotation.GetMapping; |
17 | import org.springframework.web.bind.annotation.RequestMapping; | 15 | import org.springframework.web.bind.annotation.RequestMapping; |
18 | import org.springframework.web.bind.annotation.RequestParam; | ||
19 | import org.springframework.web.bind.annotation.RestController; | 16 | import org.springframework.web.bind.annotation.RestController; |
20 | |||
21 | import javax.servlet.http.HttpServletRequest; | ||
22 | |||
23 | /** | 17 | /** |
24 | * 采购数据分析 | 18 | * 采购数据分析 |
25 | * @auther kangwei | 19 | * @auther kangwei | ... | ... |
... | @@ -16,6 +16,15 @@ import com.skua.modules.report.vo.largeScreen.ResultNumberVO; | ... | @@ -16,6 +16,15 @@ import com.skua.modules.report.vo.largeScreen.ResultNumberVO; |
16 | */ | 16 | */ |
17 | public interface IFCustomReportDatasetService extends IService<FCustomReportDataset> { | 17 | public interface IFCustomReportDatasetService extends IService<FCustomReportDataset> { |
18 | 18 | ||
19 | |||
20 | /*** | ||
21 | * 消减量同比环比 | ||
22 | * @param departIds | ||
23 | * @param startDate | ||
24 | * @param endDate | ||
25 | * @return | ||
26 | */ | ||
27 | public List<ResultNumberVO> queryXjlByTbHb(String departIds, String startDate,String endDate); | ||
19 | /** | 28 | /** |
20 | * <pre> | 29 | * <pre> |
21 | * 获取填报报表数据集 | 30 | * 获取填报报表数据集 | ... | ... |
... | @@ -415,16 +415,21 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -415,16 +415,21 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
415 | public List<ResultNumberVO> jnhbLargeScreenShowResultNumber(String departIds, String time){ | 415 | public List<ResultNumberVO> jnhbLargeScreenShowResultNumber(String departIds, String time){ |
416 | long startTime = System.currentTimeMillis(); | 416 | long startTime = System.currentTimeMillis(); |
417 | DateVO dataVO = new DateVO(time); | 417 | DateVO dataVO = new DateVO(time); |
418 | return queryXjlByTbHb(departIds,dataVO.getNowMonthStartDate(),dataVO.getNowMonthEndDate()); | ||
419 | } | ||
420 | |||
421 | public List<ResultNumberVO> queryXjlByTbHb(String departIds, String startDate,String endDate){ | ||
422 | long startTime = System.currentTimeMillis(); | ||
418 | List<ResultNumberVO> reduceStatisticsList = new ArrayList<>(4); | 423 | List<ResultNumberVO> reduceStatisticsList = new ArrayList<>(4); |
419 | //头部统计数据 | 424 | //头部统计数据 |
420 | JnhbReportData nowMonthData = getJnhbReportSumDataByResultNumber(departIds,dataVO.getNowMonthStartDate(),dataVO.getNowMonthEndDate()); | 425 | JnhbReportData valueData = getJnhbReportSumDataByResultNumber(departIds,startDate,endDate); |
421 | JnhbReportData lastMonthData = getJnhbReportSumDataByResultNumber(departIds,dataVO.getLastMonthStartTime(),dataVO.getLastMonthEndTime()); | 426 | JnhbReportData valueHbDate = getJnhbReportSumDataByResultNumber(departIds,DateUtils.getHbDate(startDate),DateUtils.getHbDate(endDate)); |
422 | JnhbReportData lastYearMonthData = getJnhbReportSumDataByResultNumber(departIds,dataVO.getLastYearMonthStartTime(),dataVO.getLastYearMonthEndTime()); | 427 | JnhbReportData valueTbData = getJnhbReportSumDataByResultNumber(departIds,DateUtils.getTbDate(startDate),DateUtils.getTbDate(endDate)); |
423 | //ResultNumberVO(tring name, String unit, String value, String valueTb, String valueHb) | 428 | //ResultNumberVO(tring name, String unit, String value, String valueTb, String valueHb) |
424 | reduceStatisticsList.add( new ResultNumberVO( "COD", "吨",nowMonthData.getCodxjl(),lastMonthData.getCodxjl(),lastYearMonthData.getCodxjl() ) );//COD消减量(吨) codxjl | 429 | reduceStatisticsList.add( new ResultNumberVO( "COD", "吨",valueData.getCodxjl(),valueTbData.getCodxjl(),valueHbDate.getCodxjl() ) );//COD消减量(吨) codxjl |
425 | reduceStatisticsList.add( new ResultNumberVO( "NH₃-N","吨",nowMonthData.getAdxjl(),lastMonthData.getAdxjl(),lastYearMonthData.getAdxjl() ));//NH3-N消减量(吨)adxjl | 430 | reduceStatisticsList.add( new ResultNumberVO( "NH₃-N","吨",valueData.getAdxjl(),valueTbData.getAdxjl(),valueHbDate.getAdxjl() ));//NH3-N消减量(吨)adxjl |
426 | reduceStatisticsList.add( new ResultNumberVO( "TP","吨",nowMonthData.getTpxjl(),lastMonthData.getTpxjl(),lastYearMonthData.getTpxjl() ));//TP消减量(吨)tpxjl | 431 | reduceStatisticsList.add( new ResultNumberVO( "TP","吨",valueData.getTpxjl(),valueTbData.getTpxjl(),valueHbDate.getTpxjl() ));//TP消减量(吨)tpxjl |
427 | reduceStatisticsList.add( new ResultNumberVO( "TN","吨",nowMonthData.getTnxjl(),lastMonthData.getTnxjl(),lastYearMonthData.getTnxjl() ));//TN消减量(吨)tnxjl | 432 | reduceStatisticsList.add( new ResultNumberVO( "TN","吨",valueData.getTnxjl(),valueTbData.getTnxjl(),valueHbDate.getTnxjl() ));//TN消减量(吨)tnxjl |
428 | 433 | ||
429 | long endTime = System.currentTimeMillis(); | 434 | long endTime = System.currentTimeMillis(); |
430 | long elapsedTime = endTime - startTime; | 435 | long elapsedTime = endTime - startTime; |
... | @@ -432,6 +437,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -432,6 +437,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
432 | return reduceStatisticsList; | 437 | return reduceStatisticsList; |
433 | } | 438 | } |
434 | 439 | ||
440 | |||
435 | @Override | 441 | @Override |
436 | public List<Map<String, Object>> querySzYynbReport(String dataViewName2119, String startTime, String endTime, String departId) { | 442 | public List<Map<String, Object>> querySzYynbReport(String dataViewName2119, String startTime, String endTime, String departId) { |
437 | List<Map<String, Object>> list = mapper.querySzYynbReport(dataViewName2119, startTime, endTime, departId); | 443 | List<Map<String, Object>> list = mapper.querySzYynbReport(dataViewName2119, startTime, endTime, departId); | ... | ... |
... | @@ -12,8 +12,14 @@ import java.io.Serializable; | ... | @@ -12,8 +12,14 @@ import java.io.Serializable; |
12 | @Data | 12 | @Data |
13 | @ApiModel(value="控制中心报表结果接收对象", description="控制中心报表结果接收对象") | 13 | @ApiModel(value="控制中心报表结果接收对象", description="控制中心报表结果接收对象") |
14 | public class FRportlCommandCenterVO implements Serializable { | 14 | public class FRportlCommandCenterVO implements Serializable { |
15 | @ApiModelProperty(value = "标题") | 15 | @ApiModelProperty(value = "label描述") |
16 | private String title; | 16 | private String label; |
17 | |||
18 | @ApiModelProperty(value = "code") | ||
19 | private String code; | ||
20 | |||
21 | @ApiModelProperty(value = "单位") | ||
22 | private String unit; | ||
17 | 23 | ||
18 | @ApiModelProperty(value = "结果") | 24 | @ApiModelProperty(value = "结果") |
19 | private String value; | 25 | private String value; |
... | @@ -35,8 +41,17 @@ public class FRportlCommandCenterVO implements Serializable { | ... | @@ -35,8 +41,17 @@ public class FRportlCommandCenterVO implements Serializable { |
35 | this.valueTb = valueTb; | 41 | this.valueTb = valueTb; |
36 | this.valueHb = valueHb; | 42 | this.valueHb = valueHb; |
37 | } | 43 | } |
38 | public FRportlCommandCenterVO(String title ,String value, String valueTb, String valueHb) { | 44 | public FRportlCommandCenterVO(String label ,String value, String valueTb, String valueHb) { |
39 | this.title = title; | 45 | this.label = label; |
46 | this.value = value; | ||
47 | this.valueTb = valueTb; | ||
48 | this.valueHb = valueHb; | ||
49 | } | ||
50 | |||
51 | public FRportlCommandCenterVO(String label, String code, String unit, String value, String valueTb, String valueHb) { | ||
52 | this.label = label; | ||
53 | this.code = code; | ||
54 | this.unit = unit; | ||
40 | this.value = value; | 55 | this.value = value; |
41 | this.valueTb = valueTb; | 56 | this.valueTb = valueTb; |
42 | this.valueHb = valueHb; | 57 | this.valueHb = valueHb; | ... | ... |
-
请 注册 或 登录 后发表评论