kangwei:指挥中心,修改公式
正在显示
8 个修改的文件
包含
87 行增加
和
68 行删除
... | @@ -2,6 +2,7 @@ package com.skua.tool.util; | ... | @@ -2,6 +2,7 @@ package com.skua.tool.util; |
2 | 2 | ||
3 | import com.skua.constant.BaseConstant; | 3 | import com.skua.constant.BaseConstant; |
4 | import java.math.BigDecimal; | 4 | import java.math.BigDecimal; |
5 | import java.text.ParseException; | ||
5 | import java.text.ParsePosition; | 6 | import java.text.ParsePosition; |
6 | import java.text.SimpleDateFormat; | 7 | import java.text.SimpleDateFormat; |
7 | import java.time.DayOfWeek; | 8 | import java.time.DayOfWeek; |
... | @@ -25,6 +26,32 @@ public class DateUtils { | ... | @@ -25,6 +26,32 @@ public class DateUtils { |
25 | SimpleDateFormat sdf = new SimpleDateFormat(format); | 26 | SimpleDateFormat sdf = new SimpleDateFormat(format); |
26 | return sdf.format(str2Date(date,format)); | 27 | return sdf.format(str2Date(date,format)); |
27 | } | 28 | } |
29 | |||
30 | public static void main(String[] args) { | ||
31 | System.out.println( formatDate("2024-01-01","yyyy-MM")); | ||
32 | } | ||
33 | /*** | ||
34 | * 字符串日期格式化 | ||
35 | * @param date | ||
36 | * @param format | ||
37 | * @return | ||
38 | */ | ||
39 | public static String formatDate(String date , String format){ | ||
40 | if(format == null ){ | ||
41 | format = "yyyy-MM-dd"; | ||
42 | } | ||
43 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
44 | |||
45 | SimpleDateFormat formatSDF = new SimpleDateFormat(format); | ||
46 | // 转化成日期类型 | ||
47 | try { | ||
48 | Date startDate = sdf.parse(date); | ||
49 | date = formatSDF.format(startDate); | ||
50 | } catch (ParseException e) { | ||
51 | e.printStackTrace(); | ||
52 | } | ||
53 | return date; | ||
54 | } | ||
28 | public static Date str2Date(String str, String pattern) { | 55 | public static Date str2Date(String str, String pattern) { |
29 | Date d = null; | 56 | Date d = null; |
30 | SimpleDateFormat sdf = new SimpleDateFormat(pattern); | 57 | SimpleDateFormat sdf = new SimpleDateFormat(pattern); | ... | ... |
... | @@ -39,10 +39,10 @@ public class AjhWasteSolidContract { | ... | @@ -39,10 +39,10 @@ public class AjhWasteSolidContract { |
39 | @ApiModelProperty(value = "水厂名称") | 39 | @ApiModelProperty(value = "水厂名称") |
40 | private String departName; | 40 | private String departName; |
41 | 41 | ||
42 | @Excel(name = "处理单位", width = 15) | 42 | @Excel(name = "关联处置点", width = 15) |
43 | @ApiModelProperty(value = "处理单位") | 43 | @ApiModelProperty(value = "关联处置点") |
44 | @Dict(dictTable = "ajh_safe_handle_point", dicCode="id", dicText = "company_name") | 44 | @Dict(dictTable = "ajh_safe_handle_point", dicCode="id", dicText = "company_name") |
45 | private String handleDepartName; | 45 | private String handlePointId; |
46 | /**合同签订时间*/ | 46 | /**合同签订时间*/ |
47 | @Excel(name = "合同签订时间", width = 15) | 47 | @Excel(name = "合同签订时间", width = 15) |
48 | @ApiModelProperty(value = "合同签订时间") | 48 | @ApiModelProperty(value = "合同签订时间") | ... | ... |
... | @@ -40,10 +40,10 @@ public class AjhWasteSolidTransport { | ... | @@ -40,10 +40,10 @@ public class AjhWasteSolidTransport { |
40 | @ApiModelProperty(value = "水厂名称") | 40 | @ApiModelProperty(value = "水厂名称") |
41 | private String departName; | 41 | private String departName; |
42 | 42 | ||
43 | @Excel(name = "处理单位", width = 15) | 43 | @Excel(name = "关联处置点", width = 15) |
44 | @ApiModelProperty(value = "处理单位") | 44 | @ApiModelProperty(value = "关联处置点") |
45 | @Dict(dictTable = "ajh_safe_handle_point", dicCode="id", dicText = "company_name") | 45 | @Dict(dictTable = "ajh_safe_handle_point", dicCode="id", dicText = "company_name") |
46 | private String handleDepartName; | 46 | private String handlePointId; |
47 | /**车牌号*/ | 47 | /**车牌号*/ |
48 | @Excel(name = "车牌号", width = 15) | 48 | @Excel(name = "车牌号", width = 15) |
49 | @ApiModelProperty(value = "车牌号") | 49 | @ApiModelProperty(value = "车牌号") | ... | ... |
1 | package com.skua.modules.algorithm.controller; | 1 | package com.skua.modules.algorithm.controller; |
2 | 2 | ||
3 | 3 | ||
4 | import com.skua.common.constant.ReportConstant; | ||
4 | import com.skua.core.api.vo.Result; | 5 | import com.skua.core.api.vo.Result; |
5 | import com.skua.core.aspect.annotation.AutoLog; | 6 | import com.skua.core.aspect.annotation.AutoLog; |
6 | import com.skua.core.context.BaseContextHandler; | 7 | import com.skua.core.context.BaseContextHandler; |
8 | import com.skua.core.util.ConvertUtils; | ||
7 | import com.skua.modules.algorithm.service.ICommandCentreService; | 9 | import com.skua.modules.algorithm.service.ICommandCentreService; |
8 | import com.skua.modules.algorithm.service.impl.ReportItemvService; | 10 | import com.skua.modules.algorithm.service.impl.ReportItemvService; |
9 | import com.skua.modules.algorithm.vo.*; | 11 | import com.skua.modules.algorithm.vo.*; |
... | @@ -155,7 +157,7 @@ public class SysCommandCentreController { | ... | @@ -155,7 +157,7 @@ public class SysCommandCentreController { |
155 | @GetMapping(value = "/statisticsByElectricity") | 157 | @GetMapping(value = "/statisticsByElectricity") |
156 | public Result<List<FRportlCommandCenterVO>> statisticsByElectricity(ReportItemvParam reportItemvParam) throws Exception { | 158 | public Result<List<FRportlCommandCenterVO>> statisticsByElectricity(ReportItemvParam reportItemvParam) throws Exception { |
157 | Result<List<FRportlCommandCenterVO>> result = new Result(); | 159 | Result<List<FRportlCommandCenterVO>> result = new Result(); |
158 | String departId = "1818214519948836864,1711662624459804674"; | 160 | String departId = BaseContextHandler.getDeparts(); |
159 | List<FRportlCommandCenterVO> dataList = reportItemvService.statisticsByElectricity(departId,reportItemvParam.getStartDate(),reportItemvParam.getEndDate()); | 161 | List<FRportlCommandCenterVO> dataList = reportItemvService.statisticsByElectricity(departId,reportItemvParam.getStartDate(),reportItemvParam.getEndDate()); |
160 | result.setResult(dataList ); | 162 | result.setResult(dataList ); |
161 | return result; | 163 | return result; |
... | @@ -186,6 +188,7 @@ public class SysCommandCentreController { | ... | @@ -186,6 +188,7 @@ public class SysCommandCentreController { |
186 | //水集合 | 188 | //水集合 |
187 | reportItemvParam.setReitId( reitId ); | 189 | reportItemvParam.setReitId( reitId ); |
188 | List<ReportDateTrendVO> waterMapList = commandCentreService.getReportItemvByReitIdAndDate7Day(reportItemvParam ); | 190 | List<ReportDateTrendVO> waterMapList = commandCentreService.getReportItemvByReitIdAndDate7Day(reportItemvParam ); |
191 | |||
189 | List<String > dateList = new ArrayList<>();//日期数据 | 192 | List<String > dateList = new ArrayList<>();//日期数据 |
190 | List<String> electricityList = new ArrayList<>();//电能数据数据; | 193 | List<String> electricityList = new ArrayList<>();//电能数据数据; |
191 | List<String> waterList = new ArrayList<>();// 水集合 | 194 | List<String> waterList = new ArrayList<>();// 水集合 |
... | @@ -196,12 +199,12 @@ public class SysCommandCentreController { | ... | @@ -196,12 +199,12 @@ public class SysCommandCentreController { |
196 | Map<String,String > waterMap = new HashMap<String,String >();//水 | 199 | Map<String,String > waterMap = new HashMap<String,String >();//水 |
197 | if(electricityMapList != null){ | 200 | if(electricityMapList != null){ |
198 | for( ReportDateTrendVO reportDateTrendVO : electricityMapList){ | 201 | for( ReportDateTrendVO reportDateTrendVO : electricityMapList){ |
199 | electricityMap.put(reportDateTrendVO.getDate(),reportDateTrendVO.getValue() ); | 202 | electricityMap.put(reportDateTrendVO.getTime(),reportDateTrendVO.getValue() ); |
200 | } | 203 | } |
201 | } | 204 | } |
202 | if(waterMapList != null){ | 205 | if(waterMapList != null){ |
203 | for( ReportDateTrendVO reportDateTrendVO : waterMapList){ | 206 | for( ReportDateTrendVO reportDateTrendVO : waterMapList){ |
204 | waterMap.put(reportDateTrendVO.getDate(),reportDateTrendVO.getValue() ); | 207 | waterMap.put(reportDateTrendVO.getTime(),reportDateTrendVO.getValue() ); |
205 | } | 208 | } |
206 | } | 209 | } |
207 | 210 | ||
... | @@ -268,72 +271,50 @@ public class SysCommandCentreController { | ... | @@ -268,72 +271,50 @@ public class SysCommandCentreController { |
268 | return commandCenterVOList; | 271 | return commandCenterVOList; |
269 | } | 272 | } |
270 | 273 | ||
271 | |||
272 | /* private SysCommandCentreResultVO convertSysAlgorithmStatisticsResultNumberVO(FReportItemv currenteportItemv, FReportItemv lastMonthReportItemv ,FReportItemv lastYearReportItemv ){ | ||
273 | SysCommandCentreResultVO commandCentreResultVO = new SysCommandCentreResultVO(); | ||
274 | FRportlCommandCenterVO monthData = new FRportlCommandCenterVO();//当月数据 | ||
275 | FRportlCommandCenterVO dayData = new FRportlCommandCenterVO();//日数据 | ||
276 | //FRportlCommandCenterVO yearData = new FRportlCommandCenterVO();//年数据 | ||
277 | |||
278 | monthData.setValue( DigitalUtils.division(currenteportItemv.getSumValue() ,"10000") ); | ||
279 | monthData.setValueHb( DigitalUtils.division( lastMonthReportItemv.getSumValue(),"10000"));//上月同期; | ||
280 | monthData.setValueTb( DigitalUtils.division( lastYearReportItemv.getSumValue(),"10000") );//去年同期 | ||
281 | |||
282 | dayData.setValue( DigitalUtils.division( currenteportItemv.getAvgValue(),"10000")); | ||
283 | dayData.setValueHb( DigitalUtils.division( lastMonthReportItemv.getAvgValue(),"10000"));//上月同期; | ||
284 | dayData.setValueTb( DigitalUtils.division( lastYearReportItemv.getAvgValue(),"10000") );//去年同期 | ||
285 | //dayData.setValue(currenteportItemv.getAvgValue());lastMonthReportItemv.getAvgValue(); lastYearReportItemv.getAvgValue(); | ||
286 | // yearData.setValue();yearData.setValueHb(); yearData.setValueTb(); | ||
287 | commandCentreResultVO.setMonthData( monthData ) ; | ||
288 | commandCentreResultVO.setDayData( dayData ); | ||
289 | return commandCentreResultVO; | ||
290 | }*/ | ||
291 | |||
292 | @AutoLog(value = "指挥中心-费用趋势") | 274 | @AutoLog(value = "指挥中心-费用趋势") |
293 | @ApiOperation(value="指挥中心-费用趋势", notes="指挥中心-费用趋势") | 275 | @ApiOperation(value="指挥中心-费用趋势", notes="指挥中心-费用趋势") |
294 | @GetMapping(value = "/statisticsByFy") | 276 | @GetMapping(value = "/statisticsByFy") |
295 | public Result<StackedAreaChartDataVO> statisticsByFy(ReportItemvParam reportItemvParam) { | 277 | public Result<StackedAreaChartDataVO> statisticsByFy(ReportItemvParam reportItemvParam) { |
296 | //费用 | 278 | //费用 |
297 | List<ReportDateTrendVO> fyMapList = commandCentreService.getFyData(reportItemvParam); | 279 | String startDate = reportItemvParam.getStartDate(); |
298 | String reitId = sysConfigService.queryValueByKey("REIT_ID_CSL"); | 280 | String endDate = reportItemvParam.getEndDate(); |
281 | reportItemvParam.setStartDate( DateUtils.formatDate(startDate ,"YYYY-MM")); | ||
282 | reportItemvParam.setEndDate( DateUtils.formatDate(endDate ,"YYYY-MM")); | ||
283 | String departIds = BaseContextHandler.getDeparts(); | ||
284 | reportItemvParam.setDepartIds( JSUtils.quoteEach(departIds,",")); | ||
285 | List<ReportDateTrendVO> fyDataList = commandCentreService.getFyData(reportItemvParam); | ||
286 | |||
287 | List<ReportDateTrendVO> waterDataList = reportItemvService.getDateFieldList(ReportConstant.view2119,"CSL", departIds, startDate,endDate); | ||
299 | //水集合 | 288 | //水集合 |
300 | reportItemvParam.setReitId( reitId ); | ||
301 | List<ReportDateTrendVO> waterMapList = commandCentreService.getClslData(reportItemvParam); | ||
302 | 289 | ||
303 | List<String > dateList = new ArrayList<>();//日期数据 | ||
304 | List<String> fyList = new ArrayList<>();//电能数据数据; | 290 | List<String> fyList = new ArrayList<>();//电能数据数据; |
305 | List<String> waterList = new ArrayList<>();// 水集合 | 291 | List<String> waterList = new ArrayList<>();// 水集合 |
306 | 292 | ||
307 | List<String> dateTimeList = getMonthsBetween(reportItemvParam.getStartDate(),reportItemvParam.getEndDate()); | 293 | String electricity = null; String water = null; |
308 | Map<String,String > electricityMap = new HashMap<String,String >();//电能数据数据; | 294 | List<String> dateTimeList = getMonthsBetween(startDate,endDate); |
309 | Map<String,String > waterMap = new HashMap<String,String >();//水 | 295 | for(String dateTime : dateTimeList){ |
310 | if(fyMapList != null){ | 296 | if(fyDataList != null ){ |
311 | for( ReportDateTrendVO reportDateTrendVO : fyMapList){ | 297 | for( ReportDateTrendVO dateTrendVO : fyDataList){ |
312 | electricityMap.put(reportDateTrendVO.getDate(),reportDateTrendVO.getValue() ); | 298 | if( dateTime.equals( dateTrendVO.getTime() )){ |
299 | fyList.add(ConvertUtils.getString( dateTrendVO.getValue() ,"0")) ; | ||
300 | break; | ||
313 | } | 301 | } |
314 | } | 302 | } |
315 | if(waterMapList != null){ | 303 | } |
316 | for( ReportDateTrendVO reportDateTrendVO : waterMapList){ | 304 | if(waterDataList != null ){ |
317 | waterMap.put(reportDateTrendVO.getDate(),reportDateTrendVO.getValue() ); | 305 | for( ReportDateTrendVO dateTrendVO : waterDataList){ |
306 | if( dateTime.equals( dateTrendVO.getTime() )){ | ||
307 | waterList.add(ConvertUtils.getString( dateTrendVO.getValue() ,"0")) ; | ||
308 | break; | ||
318 | } | 309 | } |
319 | } | 310 | } |
320 | String electricity = null; String water = null; | ||
321 | for(String dateTime : dateTimeList){ | ||
322 | electricity = electricityMap.get(dateTime ) ; | ||
323 | water = waterMap.get(dateTime ) ; | ||
324 | if(electricity == null) electricity = "0"; | ||
325 | if(water == null ){ | ||
326 | water = "0"; | ||
327 | } | 311 | } |
328 | fyList.add( electricity ) ; waterList.add(water) ; | ||
329 | dateList.add(dateTime) ; | ||
330 | } | 312 | } |
331 | StackedAreaChartDataVO stackedAreaChartDataVO = new StackedAreaChartDataVO(); | 313 | StackedAreaChartDataVO stackedAreaChartDataVO = new StackedAreaChartDataVO(); |
332 | stackedAreaChartDataVO.setElectricityList(fyList);//费用集合 | 314 | stackedAreaChartDataVO.setElectricityList(fyList);//费用集合 |
333 | stackedAreaChartDataVO.setWaterList(waterList);//水集合 | 315 | stackedAreaChartDataVO.setWaterList(waterList);//水集合 |
334 | stackedAreaChartDataVO.setDateList(dateList);//日期集合 | 316 | stackedAreaChartDataVO.setDateList(dateTimeList);//日期集合 |
335 | 317 | stackedAreaChartDataVO.setXAxis(dateTimeList); | |
336 | stackedAreaChartDataVO.setXAxis(dateList); | ||
337 | 318 | ||
338 | List<String> yaXisList = new ArrayList<String>(); | 319 | List<String> yaXisList = new ArrayList<String>(); |
339 | yaXisList.addAll(fyList) ;//费用 | 320 | yaXisList.addAll(fyList) ;//费用 | ... | ... |
... | @@ -11,6 +11,7 @@ import com.skua.modules.common.vo.DateVO; | ... | @@ -11,6 +11,7 @@ import com.skua.modules.common.vo.DateVO; |
11 | import com.skua.modules.quartz.util.BaseUtil; | 11 | import com.skua.modules.quartz.util.BaseUtil; |
12 | import com.skua.modules.report.vo.DepartLoadRateVO; | 12 | import com.skua.modules.report.vo.DepartLoadRateVO; |
13 | import com.skua.modules.report.vo.FRportlCommandCenterVO; | 13 | import com.skua.modules.report.vo.FRportlCommandCenterVO; |
14 | import com.skua.modules.report.vo.ReportDateTrendVO; | ||
14 | import com.skua.tool.util.DateUtils; | 15 | import com.skua.tool.util.DateUtils; |
15 | import com.skua.tool.util.JSUtils; | 16 | import com.skua.tool.util.JSUtils; |
16 | import org.apache.commons.lang.StringUtils; | 17 | import org.apache.commons.lang.StringUtils; |
... | @@ -60,8 +61,8 @@ public class ReportItemvService { | ... | @@ -60,8 +61,8 @@ public class ReportItemvService { |
60 | FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总数据(", JSUtils.format(nowMonthValue), JSUtils.format(lastMonthValue), JSUtils.format(lastYearValue)); | 61 | FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总数据(", JSUtils.format(nowMonthValue), JSUtils.format(lastMonthValue), JSUtils.format(lastYearValue)); |
61 | //日均数据:/环比/同比 | 62 | //日均数据:/环比/同比 |
62 | FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均数据",JSUtils.divide( nowMonthValue ,nowDifferDay ) ,JSUtils.divide( lastMonthValue ,lastMonthDifferDay ),JSUtils.divide( lastYearValue ,lastYearDifferDay ) ); | 63 | FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均数据",JSUtils.divide( nowMonthValue ,nowDifferDay ) ,JSUtils.divide( lastMonthValue ,lastMonthDifferDay ),JSUtils.divide( lastYearValue ,lastYearDifferDay ) ); |
63 | //吨水消耗 | 64 | //吨水消耗=万吨水产泥量 |
64 | FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水数据",JSUtils.divide( nowMonthValue ,nowMonthCSL ) ,JSUtils.divide( lastMonthValue ,lastMonthCSL ),JSUtils.divide( lastYearValue ,lastYearCSL )); | 65 | FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("万吨水产泥量",JSUtils.divide( nowMonthValue ,JSUtils.divide(nowMonthCSL,10000) ) ,JSUtils.divide( lastMonthValue , JSUtils.divide(lastMonthCSL,10000)),JSUtils.divide( lastYearValue , JSUtils.divide(lastYearCSL,10000) )); |
65 | fRportlCommandCenterVOList.add( nowMonthVO) ; | 66 | fRportlCommandCenterVOList.add( nowMonthVO) ; |
66 | fRportlCommandCenterVOList.add( lastMonthVO) ; | 67 | fRportlCommandCenterVOList.add( lastMonthVO) ; |
67 | fRportlCommandCenterVOList.add( lastYearVo) ; | 68 | fRportlCommandCenterVOList.add( lastYearVo) ; |
... | @@ -83,7 +84,7 @@ public class ReportItemvService { | ... | @@ -83,7 +84,7 @@ public class ReportItemvService { |
83 | List<FRportlCommandCenterVO> fRportlCommandCenterVOList = new ArrayList<>(); | 84 | List<FRportlCommandCenterVO> fRportlCommandCenterVOList = new ArrayList<>(); |
84 | DateVO dateVO = new DateVO(startTime); | 85 | DateVO dateVO = new DateVO(startTime); |
85 | String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departId, startTime,endTime); | 86 | String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departId, startTime,endTime); |
86 | String sql = "select sum(aaa.DLHJ) from " + dataViewName3a24+ "aaa"; | 87 | String sql = "select ROUND( SUM( IFNULL(aaa.DLHJ,0) ), 2 ) AS DLHJ from " + dataViewName3a24+ "aaa"; |
87 | 88 | ||
88 | String nowMonthValue = getSumDLHJ(departId,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); | 89 | String nowMonthValue = getSumDLHJ(departId,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); |
89 | String lastMonthValue = getSumDLHJ(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()); | 90 | String lastMonthValue = getSumDLHJ(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()); |
... | @@ -98,9 +99,9 @@ public class ReportItemvService { | ... | @@ -98,9 +99,9 @@ public class ReportItemvService { |
98 | long lastYearDifferDay = DateUtils.differenceDay(dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()); | 99 | long lastYearDifferDay = DateUtils.differenceDay(dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()); |
99 | 100 | ||
100 | //当月数据/环比、同比 | 101 | //当月数据/环比、同比 |
101 | FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总电耗(", JSUtils.format(nowMonthValue), JSUtils.format(lastMonthValue), JSUtils.format(lastYearValue)); | 102 | FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总电耗(", JSUtils.divide(nowMonthValue,10000), JSUtils.divide(lastMonthValue,10000), JSUtils.divide(lastYearValue,10000)); |
102 | //日均数据:/环比/同比 | 103 | //日均数据:/环比/同比 |
103 | FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均电耗",JSUtils.divide( nowMonthValue ,nowDifferDay ) ,JSUtils.divide( lastMonthValue ,lastMonthDifferDay ),JSUtils.divide( lastYearValue ,lastYearDifferDay ) ); | 104 | FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均电耗",JSUtils.divide( nowMonthValue ,nowDifferDay*10000 ) ,JSUtils.divide( lastMonthValue ,lastMonthDifferDay*10000 ),JSUtils.divide( lastYearValue ,lastYearDifferDay*10000 ) ); |
104 | //吨水消耗 | 105 | //吨水消耗 |
105 | FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水电耗",JSUtils.divide( nowMonthValue ,nowMonthCSL ) ,JSUtils.divide( lastMonthValue ,lastMonthCSL ),JSUtils.divide( lastYearValue ,lastYearCSL )); | 106 | FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水电耗",JSUtils.divide( nowMonthValue ,nowMonthCSL ) ,JSUtils.divide( lastMonthValue ,lastMonthCSL ),JSUtils.divide( lastYearValue ,lastYearCSL )); |
106 | fRportlCommandCenterVOList.add( nowMonthVO) ; | 107 | fRportlCommandCenterVOList.add( nowMonthVO) ; |
... | @@ -238,7 +239,7 @@ public class ReportItemvService { | ... | @@ -238,7 +239,7 @@ public class ReportItemvService { |
238 | private Map<String,String> commonQueryByField(String departIds ,String startTime ,String endTime,String dataViewName,String field){ | 239 | private Map<String,String> commonQueryByField(String departIds ,String startTime ,String endTime,String dataViewName,String field){ |
239 | Map<String,String> cslMap = new HashMap<>(); | 240 | Map<String,String> cslMap = new HashMap<>(); |
240 | String dataViewNameSql = ReportViewUtil.buildViewLike(dataViewName,field, departIds, startTime,endTime); | 241 | String dataViewNameSql = ReportViewUtil.buildViewLike(dataViewName,field, departIds, startTime,endTime); |
241 | System.out.println("dataViewNameSql ="+dataViewNameSql ); | 242 | //System.out.println("dataViewNameSql ="+dataViewNameSql ); |
242 | List<Map<String, Object>> dataMapList = getJdbcTemplate().queryForList(dataViewNameSql); | 243 | List<Map<String, Object>> dataMapList = getJdbcTemplate().queryForList(dataViewNameSql); |
243 | if(dataMapList != null){ | 244 | if(dataMapList != null){ |
244 | for(Map<String, Object> dataMap : dataMapList){ | 245 | for(Map<String, Object> dataMap : dataMapList){ |
... | @@ -254,6 +255,12 @@ public class ReportItemvService { | ... | @@ -254,6 +255,12 @@ public class ReportItemvService { |
254 | * @param endTime | 255 | * @param endTime |
255 | * @return | 256 | * @return |
256 | */ | 257 | */ |
258 | |||
259 | public List<ReportDateTrendVO> getDateFieldList(String reportId, String field, String departId , String startTime , String endTime){ | ||
260 | String dataViewName2119 = ReportViewUtil.buildView(reportId,field, departId, startTime,endTime); | ||
261 | String sql = "select aaa.time, sum(aaa."+field+") 'value' from " + dataViewName2119+ "aaa group by aaa.time"; | ||
262 | return getJdbcTemplate().query(sql,new BeanPropertyRowMapper<ReportDateTrendVO>(ReportDateTrendVO.class)); | ||
263 | } | ||
257 | public String getSumCSL(String departId ,String startTime ,String endTime){ | 264 | public String getSumCSL(String departId ,String startTime ,String endTime){ |
258 | String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, startTime,endTime); | 265 | String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, startTime,endTime); |
259 | String sql = "select sum(aaa.CSL) from " + dataViewName2119+ "aaa"; | 266 | String sql = "select sum(aaa.CSL) from " + dataViewName2119+ "aaa"; | ... | ... |
... | @@ -137,13 +137,14 @@ | ... | @@ -137,13 +137,14 @@ |
137 | 137 | ||
138 | <select id="getFyData" resultType="com.skua.modules.report.vo.ReportDateTrendVO"> | 138 | <select id="getFyData" resultType="com.skua.modules.report.vo.ReportDateTrendVO"> |
139 | SELECT | 139 | SELECT |
140 | month AS date, | 140 | t.month AS time, |
141 | SUM( cost ) AS value | 141 | ROUND( SUM( IFNULL(t.cost,0) ), 2 ) AS value |
142 | FROM | 142 | FROM |
143 | report_electric_cost | 143 | report_electric_cost t |
144 | WHERE | 144 | WHERE |
145 | month BETWEEN #{startDate} AND ${endDate} | 145 | t.depart_id in(${departIds}) |
146 | GROUP BY month | 146 | and t.month BETWEEN #{startDate} AND ${endDate} |
147 | GROUP BY t.month | ||
147 | </select> | 148 | </select> |
148 | 149 | ||
149 | <select id="getClslData" resultType="com.skua.modules.report.vo.ReportDateTrendVO"> | 150 | <select id="getClslData" resultType="com.skua.modules.report.vo.ReportDateTrendVO"> | ... | ... |
... | @@ -14,7 +14,7 @@ import java.io.Serializable; | ... | @@ -14,7 +14,7 @@ import java.io.Serializable; |
14 | public class ReportDateTrendVO implements Serializable{ | 14 | public class ReportDateTrendVO implements Serializable{ |
15 | 15 | ||
16 | @ApiModelProperty(value = "当前月数据") | 16 | @ApiModelProperty(value = "当前月数据") |
17 | private String date; | 17 | private String time; |
18 | @ApiModelProperty(value = "当前月数据") | 18 | @ApiModelProperty(value = "当前月数据") |
19 | private String value; | 19 | private String value; |
20 | } | 20 | } | ... | ... |
... | @@ -19,6 +19,9 @@ public class ReportItemvParam implements Serializable{ | ... | @@ -19,6 +19,9 @@ public class ReportItemvParam implements Serializable{ |
19 | @ApiModelProperty(value = "报表数据项id") | 19 | @ApiModelProperty(value = "报表数据项id") |
20 | public String reitId; | 20 | public String reitId; |
21 | 21 | ||
22 | @ApiModelProperty(value = "部门集合") | ||
23 | public String departIds ; | ||
24 | |||
22 | @ApiModelProperty(value = "报表编号") | 25 | @ApiModelProperty(value = "报表编号") |
23 | private java.lang.String reportId; | 26 | private java.lang.String reportId; |
24 | 27 | ... | ... |
-
请 注册 或 登录 后发表评论