a1f8032c 康伟

kangwei :采购计划,去年数量类型改为string

           到货记录,添加供应商名称
1 个父辈 1aa71f8e
1 package com.skua.modules.algorithm.controller; 1 package com.skua.modules.algorithm.controller;
2 2
3 import com.skua.common.report.ReportViewUtil; 3
4 import com.skua.core.api.vo.Result; 4 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.context.SpringContextUtils;
8 import com.skua.modules.algorithm.service.ICommandCentreService; 7 import com.skua.modules.algorithm.service.ICommandCentreService;
9 import com.skua.modules.algorithm.service.impl.ReportItemvService; 8 import com.skua.modules.algorithm.service.impl.ReportItemvService;
10 import com.skua.modules.algorithm.vo.*; 9 import com.skua.modules.algorithm.vo.*;
...@@ -21,9 +20,9 @@ import io.swagger.annotations.Api; ...@@ -21,9 +20,9 @@ import io.swagger.annotations.Api;
21 import io.swagger.annotations.ApiOperation; 20 import io.swagger.annotations.ApiOperation;
22 import lombok.extern.slf4j.Slf4j; 21 import lombok.extern.slf4j.Slf4j;
23 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
24 import org.springframework.jdbc.core.JdbcTemplate;
25 import org.springframework.web.bind.annotation.GetMapping; 23 import org.springframework.web.bind.annotation.GetMapping;
26 import org.springframework.web.bind.annotation.RequestMapping; 24 import org.springframework.web.bind.annotation.RequestMapping;
25 import org.springframework.web.bind.annotation.RequestParam;
27 import org.springframework.web.bind.annotation.RestController; 26 import org.springframework.web.bind.annotation.RestController;
28 import java.time.LocalDate; 27 import java.time.LocalDate;
29 import java.time.YearMonth; 28 import java.time.YearMonth;
...@@ -89,161 +88,77 @@ public class SysCommandCentreController { ...@@ -89,161 +88,77 @@ public class SysCommandCentreController {
89 88
90 @AutoLog(value = "指挥中心-运行负荷率分析") 89 @AutoLog(value = "指挥中心-运行负荷率分析")
91 @ApiOperation(value="指挥中心-运行负荷率分析", notes="指挥中心-运行负荷率分析") 90 @ApiOperation(value="指挥中心-运行负荷率分析", notes="指挥中心-运行负荷率分析")
91 //指挥中心-运行负荷率分析
92 @GetMapping(value = "/statisticsByLoadRate") 92 @GetMapping(value = "/statisticsByLoadRate")
93 public Result<DepartLoadRateResultVO> statisticsByLoadRate(ReportItemvParam reportItemvParam) throws Exception { 93 public Result<DepartLoadRateResultVO > statisticsByLoadRate(String startTime , String endTime,Integer loadRateType) throws Exception {
94 DepartLoadRateResultVO loadRateResultVO = new DepartLoadRateResultVO(); 94 Result<DepartLoadRateResultVO > result = new Result<>();
95 //SysAlgorithmStatisticsLibraryVO sysAlgorithmLibraryVO = JSONObject.toJavaObject(jsonObject, SysAlgorithmStatisticsLibraryVO.class); 95 String departIds = BaseContextHandler.getDeparts();//1818214519948836864,1711662624459804674
96 // 运行负荷率分析 = CSL/规模 96 if(loadRateType == null ) loadRateType = 1;
97 String departId = BaseContextHandler.getDeparts(); 97 DepartLoadRateResultVO departLoadRateResultVO = reportItemvService.statisticsByLoadRate( departIds,startTime , endTime, loadRateType);
98 String startTime = reportItemvParam.getStartDate(); 98 result.setSuccess(true);
99 String endTime = reportItemvParam.getEndDate(); 99 result.setResult(departLoadRateResultVO);
100 String dataViewName2119 = ReportViewUtil.buildView(ReportViewUtil.view2119,"CSL", departId, startTime,endTime);// 部门、时间 100 return result;
101 //报表数据项值 101 }
102 String reitId = sysConfigService.queryValueByKey("REIT_ID_CSL");
103 102
104 reportItemvParam.setReitId( reitId );
105 if(reportItemvParam.getLoadRateType() == null){
106 reportItemvParam.setLoadRateType(1);////默认查询
107 }
108 List<DepartLoadRateVO> departLoadRateVOList = commandCentreService.statisticsByLoadRate(reportItemvParam);
109 103
110 if(departLoadRateVOList != null && !departLoadRateVOList.isEmpty()){ 104 @AutoLog(value = "指挥中心-运行负荷率分析")
111 for( DepartLoadRateVO departLoadRateVO : departLoadRateVOList){ 105 @ApiOperation(value="指挥中心-运行负荷率分析---列表详情", notes="指挥中心-运行负荷率分析----列表详情")
112 departLoadRateVO.accuracy();//计算精度 106 //指挥中心-运行负荷率分析
113 } 107 @GetMapping(value = "/statisticsByLoadRateList")
114 } 108 public Result< List<DepartLoadRateVO> > statisticsByLoadRateList(String startTime , String endTime) throws Exception {
115 loadRateResultVO.setDepartLoadRateVOList(departLoadRateVOList ); 109 Result< List<DepartLoadRateVO> > result = new Result<>();
116 //统计总数 110 String departIds = BaseContextHandler.getDeparts();//1818214519948836864,1711662624459804674
117 int normalNum = commandCentreService.statisticsByLoadRateNum(1, reitId,reportItemvParam.getStartDate(), reportItemvParam.getEndDate());//正常 111 List<DepartLoadRateVO> departLoadRateResultVO = reportItemvService.statisticsByLoadRateList( departIds,startTime , endTime,null);
118 int lowLoadNum = commandCentreService.statisticsByLoadRateNum(3 ,reitId , reportItemvParam.getStartDate(), reportItemvParam.getEndDate());//低负荷
119 int overloadNum = commandCentreService.statisticsByLoadRateNum(2 , reitId,reportItemvParam.getStartDate(), reportItemvParam.getEndDate());//超负荷
120 loadRateResultVO.setNormalNum( normalNum );
121 loadRateResultVO.setLowLoadNum( lowLoadNum );
122 loadRateResultVO.setOverloadNum( overloadNum );
123
124 Result<DepartLoadRateResultVO> result = new Result<>();
125 result.setSuccess(true); 112 result.setSuccess(true);
126 result.setResult(loadRateResultVO); 113 result.setResult(departLoadRateResultVO);
127 return result; 114 return result;
128 } 115 }
129 116
130 //cement水泥 electricity 117 //cement水泥 electricity
131 @AutoLog(value = "指挥中心-泥量统计") 118 @AutoLog(value = "指挥中心-泥量统计")
132 @ApiOperation(value="指挥中心-泥量统计", notes="指挥中心-泥量统计") 119 @ApiOperation(value="指挥中心-泥量统计", notes="指挥中心-泥量统计")
133 @GetMapping(value = "/statisticsByCement") 120 @GetMapping(value = "/statisticsByCement")
134 public Result<List<FRportlCommandCenterVO>> statisticsByCement( ReportItemvParam reportItemvParam) throws Exception { 121 public Result<List<FRportlCommandCenterVO>> statisticsByCement(String startTime , String endTime) throws Exception {
135 Result<List<FRportlCommandCenterVO>> result = new Result<>(); 122 Result<List<FRportlCommandCenterVO>> result = new Result();
136 //将jsonObject转sysAlgorithmStatisticsLibraryVO对象 123 String departIds = BaseContextHandler.getDeparts();//1818214519948836864,1711662624459804674
137 //SysAlgorithmStatisticsLibraryVO sysAlgorithmLibraryVO = JSONObject.toJavaObject(jsonObject, SysAlgorithmStatisticsLibraryVO.class); 124 List<FRportlCommandCenterVO> dataList = reportItemvService.statisticsByCement(departIds,startTime,endTime);
138 //String reportId = "3a243d5715b9e1a3753c180872ca0df9";//报表编号 125 result.setResult(dataList );
139 //String reportItemCode = "WNL";//查询字段
140 //报表数据项值
141 String reitId = sysConfigService.queryValueByKey("REIT_ID_WNL");
142 // reportItemvParam.setReportItemCode(reportItemCode);
143 //reportItemvParam.setReportId(reportId);
144
145 //初始化查询参数
146 reportItemvParam.initData(reitId ,reportItemvParam.getStartDate() ,reportItemvParam.getEndDate());
147
148 //ReportItemvParam reportItemvParam = new ReportItemvParam(reportId,reportItemCode ,sysAlgorithmLibraryVO.getStartDate() ,sysAlgorithmLibraryVO.getEndDate());
149
150 List<FRportlCommandCenterVO> fReportItemvList = new ArrayList<>();//返回集合对象
151 //月统计
152 FRportlCommandCenterVO reportMonthData = commandCentreService.getReportItemvMonthDataByReitId(reportItemvParam );
153 fReportItemvList.add( reportMonthData );
154 // 日均统计
155 FRportlCommandCenterVO reportDayData = commandCentreService.getReportItemvDayDataByReitId(reportItemvParam );
156 fReportItemvList.add( reportDayData );
157 //单位换算
158 if(fReportItemvList != null && !fReportItemvList.isEmpty()){
159 String value = null ;
160 String valueHb = null;
161 String valueTb = null;
162 for( FRportlCommandCenterVO reportDayData3 : fReportItemvList){
163 value = DigitalUtils.division(reportDayData3.getValue(),"1");
164 reportDayData3.setValue( value );
165 valueHb = DigitalUtils.division(reportDayData3.getValueHb(),"1");
166 reportDayData3.setValueHb(valueHb );
167
168 valueTb = DigitalUtils.division(reportDayData3.getValueTb(),"1");
169 reportDayData3.setValueTb( valueTb );
170 }
171 }
172 /* FReportItemv currenteportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode,startDate , endDate );
173 //上月数据
174 FReportItemv lastMonthReportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode,reportItemvParam.getLastMonthStartDate() , reportItemvParam.getLastMonthEndDate() );
175 //去年数据
176 FReportItemv lastYearReportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode, reportItemvParam.getLastYearStartDate() , reportItemvParam.getLastYearEndDate() );
177
178 //整理数据
179 // SysCommandCentreResultVO commandCentreResultVO = convertSysAlgorithmStatisticsResultNumberVO(currenteportItemv , lastMonthReportItemv,lastYearReportItemv);
180 List<FRportlCommandCenterVO> fReportItemvList = arrangeFRportlCommandCenterVO(currenteportItemv , lastMonthReportItemv,lastYearReportItemv);*/
181 //
182 // FReportItemv waterCurrenteportItemv = ifReportItemvService.getReportItemvByReitIdAndDate(reportId, reportItemCode,startDate , endDate );
183 //commandCentreResultVO.setTotalData( factoryInfoService.querySumProScale() );
184
185 //出水量 月统计、上月统计、去年同期统计
186 //String waterReportId = "2119ecbf53a1d2d0708258ff67cfd9e1";//报表编号
187 //String waterReportItemCode = "CSL";//查询字段
188
189 reitId = sysConfigService.queryValueByKey("REIT_ID_CSL");
190 reportItemvParam.setReitId(reitId);
191 // 出水量 月统计
192 FRportlCommandCenterVO waterReportMonthData = commandCentreService.getReportItemvMonthDataByReitId(reportItemvParam );
193
194 FRportlCommandCenterVO statisticsData = new FRportlCommandCenterVO("0.0","0.0","0.0");
195 //需要查询统计数据 = 公式== 污泥量 / 出水量
196 if(reportMonthData != null && waterReportMonthData != null){
197
198 waterReportMonthData.setValue( DigitalUtils.division( reportMonthData.getValue() , waterReportMonthData.getValue() )); // 当月统计 污泥量 / 出水量
199 waterReportMonthData.setValueTb( DigitalUtils.division( reportMonthData.getValueTb() , waterReportMonthData.getValueTb() )); // 上月同期 统计
200 waterReportMonthData.setValueHb(DigitalUtils.division( reportMonthData.getValueHb() , waterReportMonthData.getValueHb() ) ); //去年同期 统计
201 }
202 fReportItemvList.add(statisticsData);
203
204 //todo 演示暂时注释
205 result.setSuccess(true);
206 result.setResult(fReportItemvList);
207 return result; 126 return result;
208 } 127 }
128 @AutoLog(value = "指挥中心-泥量统计")
129 @ApiOperation(value="指挥中心-泥量统计--详情列表", notes="指挥中心-泥量统计--详情列表")
130 //指挥中心-泥量统计--详情列表
131 @GetMapping(value = "/statisticsByCementList")
132 public Result<List<ReportItemVO>> statisticsByCementList(String startTime , String endTime) throws Exception {
133 Result<List<ReportItemVO>> result = new Result();
134 String departIds = BaseContextHandler.getDeparts();//1818214519948836864,1711662624459804674
135 List<ReportItemVO> dataList = reportItemvService.statisticsByCementList(departIds,startTime,endTime);
136 result.setResult(dataList );
137 return result;
138 }
139
209 140
210 //cement水泥 electricity 141 //cement水泥 electricity
211 @AutoLog(value = "指挥中心-能耗分析") 142 @AutoLog(value = "指挥中心-能耗分析")
212 @ApiOperation(value="指挥中心-能耗分析", notes="指挥中心-能耗分析") 143 @ApiOperation(value="指挥中心-能耗分析", notes="指挥中心-能耗分析")
213 @GetMapping(value = "/statisticsByElectricity") 144 @GetMapping(value = "/statisticsByElectricity")
214 public Result<List<FRportlCommandCenterVO>> statisticsByElectricity( ReportItemvParam reportItemvParam) throws Exception { 145 public Result<List<FRportlCommandCenterVO>> statisticsByElectricity(String startTime ,String endTime) throws Exception {
215 Result<List<FRportlCommandCenterVO>> result = new Result<>(); 146 Result<List<FRportlCommandCenterVO>> result = new Result();
216 List<FRportlCommandCenterVO> fRportlCommandCenterVOList = new ArrayList<>(); 147 String departId = "1818214519948836864,1711662624459804674";
217 DateVO dateVO = new DateVO(reportItemvParam.getStartDate()); 148 List<FRportlCommandCenterVO> dataList = reportItemvService.statisticsByElectricity(departId,startTime,endTime);
218 //电耗 149 result.setResult(dataList );
219 String nowMonthValue = reportItemvService.getSumDLHJ(null,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); 150 return result;
220 String lastMonthValue = reportItemvService.getSumDLHJ(null, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()); 151 }
221 String lastYearValue = reportItemvService.getSumDLHJ(null, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()); 152 @AutoLog(value = "指挥中心-能耗分析")
222 //出水量 153 @ApiOperation(value="指挥中心-能耗分析--详情列表", notes="指挥中心-能耗分析--详情列表")
223 String nowMonthCSL = reportItemvService.getSumCSL(null,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); 154 @GetMapping(value = "/statisticsByElectricityList")
224 String lastMonthCSL = reportItemvService.getSumCSL(null, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()); 155 public Result<List<ReportItemVO>> statisticsByElectricityList(String startTime ,String endTime) throws Exception {
225 String lastYearCSL = reportItemvService.getSumCSL(null, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()); 156 Result<List<ReportItemVO>> result = new Result();
226 157 String departIds = BaseContextHandler.getDeparts();//1818214519948836864,1711662624459804674
227 long nowDifferDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); 158 List<ReportItemVO> dataList = reportItemvService.statisticsByElectricityList(departIds,startTime,endTime);
228 long lastMonthDifferDay = DateUtils.differenceDay(dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()); 159 result.setResult(dataList );
229 long lastYearDifferDay = DateUtils.differenceDay(dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
230
231 //当月数据/环比、同比
232 FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总电耗(", JSUtils.format(nowMonthValue), JSUtils.format(lastMonthValue), JSUtils.format(lastYearValue));
233 //日均数据:/环比/同比
234 FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均电耗",JSUtils.divide( nowMonthValue ,nowDifferDay ) ,JSUtils.divide( lastMonthValue ,lastMonthDifferDay ),JSUtils.divide( lastYearValue ,lastYearDifferDay ) );
235 //吨水消耗
236 FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水电耗",JSUtils.divide( nowMonthValue ,nowMonthCSL ) ,JSUtils.divide( lastMonthValue ,lastMonthCSL ),JSUtils.divide( lastYearValue ,lastYearCSL ));
237 fRportlCommandCenterVOList.add( nowMonthVO) ;
238 fRportlCommandCenterVOList.add( lastMonthVO) ;
239 fRportlCommandCenterVOList.add( lastYearVo) ;
240 //todo 演示暂时注释
241 result.setSuccess(true);
242 result.setResult(fRportlCommandCenterVOList);
243 return result; 160 return result;
244 } 161 }
245
246
247 //cement水泥 electricity 162 //cement水泥 electricity
248 @AutoLog(value = "指挥中心-水量电耗趋势") 163 @AutoLog(value = "指挥中心-水量电耗趋势")
249 @ApiOperation(value="指挥中心-水量电耗趋势", notes="指挥中心-水量电耗趋势") 164 @ApiOperation(value="指挥中心-水量电耗趋势", notes="指挥中心-水量电耗趋势")
...@@ -256,30 +171,22 @@ public class SysCommandCentreController { ...@@ -256,30 +171,22 @@ public class SysCommandCentreController {
256 171
257 //报表数据项值 172 //报表数据项值
258 String reitId = sysConfigService.queryValueByKey("REIT_ID_DLHJ"); 173 String reitId = sysConfigService.queryValueByKey("REIT_ID_DLHJ");
259
260 //reportItemvParam.setReportItemCode(reportItemCode);
261 //reportItemvParam.setReportId(reportId); 174 //reportItemvParam.setReportId(reportId);
262 reportItemvParam.setReitId( reitId ); 175 reportItemvParam.setReitId( reitId );
263 //电 176 //电
264 List<ReportDateTrendVO> electricityMapList = commandCentreService.getReportItemvByReitIdAndDate7Day(reportItemvParam ); 177 List<ReportDateTrendVO> electricityMapList = commandCentreService.getReportItemvByReitIdAndDate7Day(reportItemvParam );
265
266 //reportId = "2119ecbf53a1d2d0708258ff67cfd9e1";//报表编号 178 //reportId = "2119ecbf53a1d2d0708258ff67cfd9e1";//报表编号
267 //reportItemCode = "CSL";//查询字段 179 //reportItemCode = "CSL";//查询字段
268
269 reitId = sysConfigService.queryValueByKey("REIT_ID_CSL"); 180 reitId = sysConfigService.queryValueByKey("REIT_ID_CSL");
270 //水集合 181 //水集合
271 reportItemvParam.setReitId( reitId ); 182 reportItemvParam.setReitId( reitId );
272 List<ReportDateTrendVO> waterMapList = commandCentreService.getReportItemvByReitIdAndDate7Day(reportItemvParam ); 183 List<ReportDateTrendVO> waterMapList = commandCentreService.getReportItemvByReitIdAndDate7Day(reportItemvParam );
273
274
275 List<String > dateList = new ArrayList<>();//日期数据 184 List<String > dateList = new ArrayList<>();//日期数据
276 List<String> electricityList = new ArrayList<>();//电能数据数据; 185 List<String> electricityList = new ArrayList<>();//电能数据数据;
277 List<String> waterList = new ArrayList<>();// 水集合 186 List<String> waterList = new ArrayList<>();// 水集合
278 List<String> consumeList = new ArrayList<>();//电小号集合 187 List<String> consumeList = new ArrayList<>();//电小号集合
279 188
280 List<String > dateTimeList = DateUtil.getInstance().getBetweenDate(reportItemvParam.getStartDate(),reportItemvParam.getEndDate(),null); 189 List<String > dateTimeList = DateUtil.getInstance().getBetweenDate(reportItemvParam.getStartDate(),reportItemvParam.getEndDate(),null);
281
282
283 Map<String,String > electricityMap = new HashMap<String,String >();//电能数据数据; 190 Map<String,String > electricityMap = new HashMap<String,String >();//电能数据数据;
284 Map<String,String > waterMap = new HashMap<String,String >();//水 191 Map<String,String > waterMap = new HashMap<String,String >();//水
285 if(electricityMapList != null){ 192 if(electricityMapList != null){
...@@ -329,8 +236,6 @@ public class SysCommandCentreController { ...@@ -329,8 +236,6 @@ public class SysCommandCentreController {
329 return result; 236 return result;
330 } 237 }
331 238
332
333
334 /*** 239 /***
335 * 整理数据: 月统计数据、日统计数据,添加去年月数据、日数据、年数据 240 * 整理数据: 月统计数据、日统计数据,添加去年月数据、日数据、年数据
336 * @param currenteportItemv 241 * @param currenteportItemv
...@@ -383,10 +288,8 @@ public class SysCommandCentreController { ...@@ -383,10 +288,8 @@ public class SysCommandCentreController {
383 @ApiOperation(value="指挥中心-费用趋势", notes="指挥中心-费用趋势") 288 @ApiOperation(value="指挥中心-费用趋势", notes="指挥中心-费用趋势")
384 @GetMapping(value = "/statisticsByFy") 289 @GetMapping(value = "/statisticsByFy")
385 public Result<StackedAreaChartDataVO> statisticsByFy(ReportItemvParam reportItemvParam) { 290 public Result<StackedAreaChartDataVO> statisticsByFy(ReportItemvParam reportItemvParam) {
386
387 //费用 291 //费用
388 List<ReportDateTrendVO> fyMapList = commandCentreService.getFyData(reportItemvParam); 292 List<ReportDateTrendVO> fyMapList = commandCentreService.getFyData(reportItemvParam);
389
390 String reitId = sysConfigService.queryValueByKey("REIT_ID_CSL"); 293 String reitId = sysConfigService.queryValueByKey("REIT_ID_CSL");
391 //水集合 294 //水集合
392 reportItemvParam.setReitId( reitId ); 295 reportItemvParam.setReitId( reitId );
...@@ -397,7 +300,6 @@ public class SysCommandCentreController { ...@@ -397,7 +300,6 @@ public class SysCommandCentreController {
397 List<String> waterList = new ArrayList<>();// 水集合 300 List<String> waterList = new ArrayList<>();// 水集合
398 301
399 List<String> dateTimeList = getMonthsBetween(reportItemvParam.getStartDate(),reportItemvParam.getEndDate()); 302 List<String> dateTimeList = getMonthsBetween(reportItemvParam.getStartDate(),reportItemvParam.getEndDate());
400
401 Map<String,String > electricityMap = new HashMap<String,String >();//电能数据数据; 303 Map<String,String > electricityMap = new HashMap<String,String >();//电能数据数据;
402 Map<String,String > waterMap = new HashMap<String,String >();//水 304 Map<String,String > waterMap = new HashMap<String,String >();//水
403 if(fyMapList != null){ 305 if(fyMapList != null){
...@@ -421,7 +323,6 @@ public class SysCommandCentreController { ...@@ -421,7 +323,6 @@ public class SysCommandCentreController {
421 fyList.add( electricity ) ; waterList.add(water) ; 323 fyList.add( electricity ) ; waterList.add(water) ;
422 dateList.add(dateTime) ; 324 dateList.add(dateTime) ;
423 } 325 }
424
425 StackedAreaChartDataVO stackedAreaChartDataVO = new StackedAreaChartDataVO(); 326 StackedAreaChartDataVO stackedAreaChartDataVO = new StackedAreaChartDataVO();
426 stackedAreaChartDataVO.setElectricityList(fyList);//费用集合 327 stackedAreaChartDataVO.setElectricityList(fyList);//费用集合
427 stackedAreaChartDataVO.setWaterList(waterList);//水集合 328 stackedAreaChartDataVO.setWaterList(waterList);//水集合
...@@ -441,12 +342,12 @@ public class SysCommandCentreController { ...@@ -441,12 +342,12 @@ public class SysCommandCentreController {
441 } 342 }
442 343
443 344
444
445 @AutoLog(value = "指挥中心-药剂趋势") 345 @AutoLog(value = "指挥中心-药剂趋势")
446 @ApiOperation(value="指挥中心-药剂趋势", notes="指挥中心-药剂趋势") 346 @ApiOperation(value="指挥中心-药剂趋势", notes="指挥中心-药剂趋势")
447 @GetMapping(value = "/statisticsByYjqs") 347 @GetMapping(value = "/statisticsByYjqs")
448 public Result<DepartDrugResult> statisticsByYjqs(String month) { 348 public Result<DepartDrugResult> statisticsByYjqs(@RequestParam(name = "month", required = true)String month) {
449 DepartDrugResult departDrugResult = commandCentreService.getYhTotal(month); 349 DateVO dateVO = new DateVO(month);
350 DepartDrugResult departDrugResult = commandCentreService.getYhTotal(dateVO.getNowMonth());
450 Result<DepartDrugResult> result = new Result<>(); 351 Result<DepartDrugResult> result = new Result<>();
451 result.setSuccess(true); 352 result.setSuccess(true);
452 result.setResult(departDrugResult); 353 result.setResult(departDrugResult);
...@@ -454,10 +355,10 @@ public class SysCommandCentreController { ...@@ -454,10 +355,10 @@ public class SysCommandCentreController {
454 } 355 }
455 356
456 //指挥中心----运行负荷率分析----处理水量详情 357 //指挥中心----运行负荷率分析----处理水量详情
457 @AutoLog(value = "指挥中心-药剂趋势") 358 @AutoLog(value = "指挥中心-处理水量详情")
458 @ApiOperation(value="指挥中心-运行负荷率分析-处理水量详情", notes="指挥中心-运行负荷率分析-处理水量详情") 359 @ApiOperation(value="指挥中心-处理水量详情")
459 @GetMapping("/getCLSLXQ") 360 @GetMapping("/getCLSLXQ")
460 public Result<List<WaterTreatmentVO>> getCLSLXQ(String time){ 361 public Result<List<WaterTreatmentVO>> getCLSLXQ(@RequestParam(name = "time", required = true)String time){
461 Result<List<WaterTreatmentVO>> result = new Result<>(); 362 Result<List<WaterTreatmentVO>> result = new Result<>();
462 //String departIds = "1818215093192753152,1818214519948836864,1818214145808531456"; 363 //String departIds = "1818215093192753152,1818214519948836864,1818214145808531456";
463 List<WaterTreatmentVO> waterTrendVOList = commandCentreService.statisticsCLSLXQ(time, BaseContextHandler.getDeparts()); 364 List<WaterTreatmentVO> waterTrendVOList = commandCentreService.statisticsCLSLXQ(time, BaseContextHandler.getDeparts());
......
...@@ -2,9 +2,26 @@ package com.skua.modules.algorithm.service.impl; ...@@ -2,9 +2,26 @@ package com.skua.modules.algorithm.service.impl;
2 2
3 import com.skua.common.report.ReportViewUtil; 3 import com.skua.common.report.ReportViewUtil;
4 import com.skua.core.context.SpringContextUtils; 4 import com.skua.core.context.SpringContextUtils;
5 import com.skua.core.util.ConvertUtils;
6 import com.skua.modules.algorithm.vo.DepartLoadRateResultVO;
7 import com.skua.modules.algorithm.vo.ReportItemVO;
8 import com.skua.modules.algorithm.vo.WaterTreatmentVO;
9 import com.skua.modules.common.vo.DateVO;
10 import com.skua.modules.quartz.util.BaseUtil;
11 import com.skua.modules.report.vo.DepartLoadRateVO;
12 import com.skua.modules.report.vo.FRportlCommandCenterVO;
13 import com.skua.tool.util.DateUtils;
14 import com.skua.tool.util.JSUtils;
15 import org.apache.commons.lang.StringUtils;
16 import org.springframework.jdbc.core.BeanPropertyRowMapper;
5 import org.springframework.jdbc.core.JdbcTemplate; 17 import org.springframework.jdbc.core.JdbcTemplate;
6 import org.springframework.stereotype.Service; 18 import org.springframework.stereotype.Service;
7 19
20 import java.util.ArrayList;
21 import java.util.HashMap;
22 import java.util.List;
23 import java.util.Map;
24
8 25
9 /** 26 /**
10 * @auther kangwei 27 * @auther kangwei
...@@ -12,25 +29,238 @@ import org.springframework.stereotype.Service; ...@@ -12,25 +29,238 @@ import org.springframework.stereotype.Service;
12 */ 29 */
13 @Service("reportItemvService") 30 @Service("reportItemvService")
14 public class ReportItemvService { 31 public class ReportItemvService {
15 32 String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";// 水 COD TP TN NH3H
16 33 String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";//能耗报表
17
18 34
19 private JdbcTemplate getJdbcTemplate(){ 35 private JdbcTemplate getJdbcTemplate(){
20 //主库数据源 36 //主库数据源
21 JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); 37 JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
22 return masterDB; 38 return masterDB;
23 } 39 }
40 //指挥中心-泥量统计
41 public List<FRportlCommandCenterVO> statisticsByCement(String departIds, String startTime, String endTime) {
42
43 List<FRportlCommandCenterVO> fRportlCommandCenterVOList = new ArrayList<>();
44 DateVO dateVO = new DateVO(startTime);
45 String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,"WNL", departIds, startTime,endTime);
46 String sql = "select sum(aaa.WNL) from " + dataViewName3a24+ "aaa";
47
48 String nowMonthValue = getSumValue(view3a24,"WNL",departIds,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
49 String lastMonthValue = getSumValue(view3a24,"WNL",departIds, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
50 String lastYearValue = getSumValue(view3a24,"WNL",departIds, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
51
52 String nowMonthCSL = getSumCSL(departIds,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
53 String lastMonthCSL = getSumCSL(departIds, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
54 String lastYearCSL = getSumCSL(departIds, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
55
56 long nowDifferDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
57 long lastMonthDifferDay = DateUtils.differenceDay(dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
58 long lastYearDifferDay = DateUtils.differenceDay(dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
59
60 //当月数据/环比、同比
61 FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总数据(", JSUtils.format(nowMonthValue), JSUtils.format(lastMonthValue), JSUtils.format(lastYearValue));
62 //日均数据:/环比/同比
63 FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均数据",JSUtils.divide( nowMonthValue ,nowDifferDay ) ,JSUtils.divide( lastMonthValue ,lastMonthDifferDay ),JSUtils.divide( lastYearValue ,lastYearDifferDay ) );
64 //吨水消耗
65 FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水数据",JSUtils.divide( nowMonthValue ,nowMonthCSL ) ,JSUtils.divide( lastMonthValue ,lastMonthCSL ),JSUtils.divide( lastYearValue ,lastYearCSL ));
66 fRportlCommandCenterVOList.add( nowMonthVO) ;
67 fRportlCommandCenterVOList.add( lastMonthVO) ;
68 fRportlCommandCenterVOList.add( lastYearVo) ;
69
70 return fRportlCommandCenterVOList;
71
72 }
73 //指挥中心-泥量统计
74 public List<ReportItemVO> statisticsByCementList(String departIds, String startTime, String endTime) {
75 List<ReportItemVO> dateList = statisticsByField(departIds,startTime,endTime,view3a24,"WNL");
76 return dateList;
77 }
78
79 /***
80 * 能耗分析
81 * @param endTime
82 */
83 public List<FRportlCommandCenterVO> statisticsByElectricity(String departId, String startTime, String endTime) {
84 List<FRportlCommandCenterVO> fRportlCommandCenterVOList = new ArrayList<>();
85 DateVO dateVO = new DateVO(startTime);
86 String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,"DLHJ", departId, startTime,endTime);
87 String sql = "select sum(aaa.DLHJ) from " + dataViewName3a24+ "aaa";
88
89 String nowMonthValue = getSumDLHJ(departId,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
90 String lastMonthValue = getSumDLHJ(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
91 String lastYearValue = getSumDLHJ(departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
92
93 String nowMonthCSL = getSumCSL(departId,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
94 String lastMonthCSL = getSumCSL(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
95 String lastYearCSL = getSumCSL(departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
96
97 long nowDifferDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
98 long lastMonthDifferDay = DateUtils.differenceDay(dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
99 long lastYearDifferDay = DateUtils.differenceDay(dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
100
101 //当月数据/环比、同比
102 FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总电耗(", JSUtils.format(nowMonthValue), JSUtils.format(lastMonthValue), JSUtils.format(lastYearValue));
103 //日均数据:/环比/同比
104 FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均电耗",JSUtils.divide( nowMonthValue ,nowDifferDay ) ,JSUtils.divide( lastMonthValue ,lastMonthDifferDay ),JSUtils.divide( lastYearValue ,lastYearDifferDay ) );
105 //吨水消耗
106 FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水电耗",JSUtils.divide( nowMonthValue ,nowMonthCSL ) ,JSUtils.divide( lastMonthValue ,lastMonthCSL ),JSUtils.divide( lastYearValue ,lastYearCSL ));
107 fRportlCommandCenterVOList.add( nowMonthVO) ;
108 fRportlCommandCenterVOList.add( lastMonthVO) ;
109 fRportlCommandCenterVOList.add( lastYearVo) ;
110
111 return fRportlCommandCenterVOList;
112 }
113 /***
114 * 能耗分析--详情列表
115 * @param endTime
116 */
117 public List<ReportItemVO> statisticsByElectricityList(String departIds, String startTime, String endTime) {
118 List<ReportItemVO> dateList = statisticsByField(departIds,startTime,endTime,view3a24,"DLHJ");
119 return dateList;
120 }
121 /***
122 * 指挥中心----运行负荷率分析----处理水量详情
123 * @param time
124 * @return
125 */
126 public List<WaterTreatmentVO> statisticsCLSLXQ(String time, String departIds){
127 List<WaterTreatmentVO> dateList = null;
128 DateVO dateVO = new DateVO(time);//转换后的时间参数
129
130 long differenceDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(), dateVO.getNowMonthEndDate());
131 String departIdsParam = BaseUtil.quoteEach(departIds , ",");
132 String factorySql = "select group_concat(fi.depart_id) from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 ";
133 if(departIdsParam != null ){
134 factorySql += " and d.id in("+departIdsParam+") ";
135 }
136 //水厂部门编号集合
137 departIds =getJdbcTemplate().queryForObject(factorySql,String.class);
138 //月产水量
139 Map<String,String> cslMap = commonQueryCsl(departIds, dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
140 String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departIds, dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
141 String sql = "select aaa.CSL 'csl' ,aaa.depart_id , d.depart_name, fi.pro_scale*10000 'pro_scale' from "+ dataViewName2119 +" aaa";
142 sql += " left join sys_factory_info fi on fi.depart_id = aaa.depart_id";
143 sql += " left join sys_depart d on d.id = aaa.depart_id";
144 sql += " order by aaa.CSL desc ";
145 dateList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<WaterTreatmentVO>(WaterTreatmentVO.class));
146
147
148 //环比:月产水量
149 Map<String,String> hbCslMap = commonQueryCsl(departIds, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
150 //同比:月产水量
151 Map<String,String> tbCslMap = commonQueryCsl(departIds, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
152
153 int index =1;
154 if(dateList != null ){
155 for(WaterTreatmentVO waterTreatmentVO : dateList){
156 waterTreatmentVO.setRank(index++);//设置排名
157 if(waterTreatmentVO.getCSL() != null ){
158 waterTreatmentVO.setDayCsl( waterTreatmentVO.getCSL() / differenceDay );
159 }
160 /* waterTreatmentVO.setRank( index++);//设置排名
161 if(cslMap.get(waterTreatmentVO.getDepartId()) != null ){
162 waterTreatmentVO.setCsl(Double.parseDouble(cslMap.get(waterTreatmentVO.getDepartId())) );
163 waterTreatmentVO.setDayCsl( waterTreatmentVO.getCsl() / differenceDay );
164 }*/
165 if(hbCslMap.get(waterTreatmentVO.getDepartId()) != null ){
166 waterTreatmentVO.setHbcsl(Double.parseDouble(hbCslMap.get(waterTreatmentVO.getDepartId())) );
167 }
168 if(tbCslMap.get(waterTreatmentVO.getDepartId()) != null ){
169 waterTreatmentVO.setTbcsl(Double.parseDouble(tbCslMap.get(waterTreatmentVO.getDepartId())) );
170 }
171 }
172 }
173 return dateList;
174 }
175 /***
176 * 通用方法
177 * @param departIds
178 * @param startTime
179 * @param endTime
180 * @param dataViewName
181 * @param field
182 * @return
183 */
184 public List<ReportItemVO> statisticsByField(String departIds, String startTime, String endTime,String dataViewName,String field) {
185 List<ReportItemVO> dateList = null;
186 DateVO dateVO = new DateVO(startTime);//转换后的时间参数
187
188 long differenceDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(), dateVO.getNowMonthEndDate());
189
190 String departIdsParam = BaseUtil.quoteEach(departIds , ",");
191 String factorySql = "select fi.depart_id, d.depart_name from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 ";
192 if(StringUtils.isNotEmpty(departIdsParam)){
193 factorySql += " and d.id in("+departIdsParam+") ";
194 }
195 //水厂部门编号集合
196 dateList =getJdbcTemplate().query(factorySql,new BeanPropertyRowMapper<ReportItemVO>(ReportItemVO.class));
197
198
199 //月产水量 Map<部门编号,环比数据>
200 Map<String,String> valueMap = commonQueryByField(departIds, dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate(),dataViewName,field);
201 //环比:月产水量 Map<部门编号,环比数据>
202 Map<String,String> hbValueMap = commonQueryByField(departIds, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime(),dataViewName,field);
203 //同比:月产水量 Map<部门编号,同比比数据>
204 Map<String,String> tbValueMap = commonQueryByField(departIds, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime(),dataViewName,field);
205
206 //月产水量
207 Map<String,String> cslMap = commonQueryCsl(departIds, dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
208 if(dateList != null ) {
209 for (ReportItemVO reportItemVO : dateList) {
210 //月数据
211 reportItemVO.setValue( JSUtils.format(valueMap.get( reportItemVO.getDepartId())) );
212 //日均
213 reportItemVO.setAvgDayValue( JSUtils.divide( valueMap.get(reportItemVO.getDepartId()),differenceDay ) );
214 //环比
215 reportItemVO.setValueHb(JSUtils.format(hbValueMap.get( reportItemVO.getDepartId())) );
216 //同比
217 reportItemVO.setValueTb(JSUtils.format(tbValueMap.get( reportItemVO.getDepartId())) );
218 //吨水泥产量
219 reportItemVO.setDscnl( JSUtils.divide( reportItemVO.getValue(),cslMap.get( reportItemVO.getDepartId() ) ) );
220 }
221 }
222 return dateList;
223 }
24 224
225 //通用csl查询,返回Map<部门编号,CSL出水量>
226 private Map<String,String> commonQueryCsl(String departIds ,String startTime ,String endTime){
227 Map<String,String> cslMap = new HashMap<>();
228 String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departIds, startTime,endTime);
229 // System.out.println("dataViewName2119 ="+dataViewName2119 );
230 List<Map<String, Object>> dataMapList = getJdbcTemplate().queryForList(dataViewName2119);
231 if(dataMapList != null){
232 for(Map<String, Object> dataMap : dataMapList){
233 cslMap.put(ConvertUtils.getString(dataMap.get("depart_id")) ,ConvertUtils.getString(dataMap.get("CSL")));
234 }
235 }
236 return cslMap;
237 }
238
239 private Map<String,String> commonQueryByField(String departIds ,String startTime ,String endTime,String dataViewName,String field){
240 Map<String,String> cslMap = new HashMap<>();
241 String dataViewNameSql = ReportViewUtil.buildViewLike(dataViewName,field, departIds, startTime,endTime);
242 System.out.println("dataViewNameSql ="+dataViewNameSql );
243 List<Map<String, Object>> dataMapList = getJdbcTemplate().queryForList(dataViewNameSql);
244 if(dataMapList != null){
245 for(Map<String, Object> dataMap : dataMapList){
246 cslMap.put(ConvertUtils.getString(dataMap.get("depart_id")) ,ConvertUtils.getString(dataMap.get(field)));
247 }
248 }
249 return cslMap;
250 }
251 /***
252 * 获取CSL
253 * @param departId
254 * @param startTime
255 * @param endTime
256 * @return
257 */
25 public String getSumCSL(String departId ,String startTime ,String endTime){ 258 public String getSumCSL(String departId ,String startTime ,String endTime){
26 String dataViewName2119 = ReportViewUtil.buildViewLike(ReportViewUtil.view2119,"CSL", departId, startTime,endTime); 259 String dataViewName2119 = ReportViewUtil.buildViewLike(ReportViewUtil.view2119,"CSL", departId, startTime,endTime);
27 String sql = "select sum(aaa.CSL) from " + dataViewName2119+ "aaa"; 260 String sql = "select sum(aaa.CSL) from " + dataViewName2119+ "aaa";
28 String csl = getJdbcTemplate().queryForObject(sql,String.class); 261 String csl = getJdbcTemplate().queryForObject(sql,String.class);
29 return csl; 262 return csl;
30 } 263 }
31 /* public List<Map<String,Object>> getDeptCSL(String departId , String startTime , String endTime){
32
33 }*/
34 264
35 public String getSumDLHJ(String departId ,String startTime ,String endTime){ 265 public String getSumDLHJ(String departId ,String startTime ,String endTime){
36 String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportViewUtil.view3a24,"DLHJ", departId, startTime,endTime); 266 String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportViewUtil.view3a24,"DLHJ", departId, startTime,endTime);
...@@ -38,6 +268,67 @@ public class ReportItemvService { ...@@ -38,6 +268,67 @@ public class ReportItemvService {
38 String dlhj = getJdbcTemplate().queryForObject(sql,String.class); 268 String dlhj = getJdbcTemplate().queryForObject(sql,String.class);
39 return dlhj; 269 return dlhj;
40 } 270 }
271 public String getSumValue(String viewName,String fileds,String departId ,String startTime ,String endTime){
272 String dataViewName3a24 = ReportViewUtil.buildViewLike(viewName,fileds, departId, startTime,endTime);
273 String sql = "select sum(aaa."+fileds+") from " + dataViewName3a24+ "aaa";
274 String dlhj = getJdbcTemplate().queryForObject(sql,String.class);
275 return dlhj;
276 }
277 //指挥中心-运行负荷率分析
278 public DepartLoadRateResultVO statisticsByLoadRate(String departIds,String startTime, String endTime, Integer loadRateType) {
279 DepartLoadRateResultVO departLoadRateResultVO = new DepartLoadRateResultVO();
280 //int loadRateType = 1;
281 String dataViewName2119 = ReportViewUtil.buildView(view2119,"CSL", departIds, startTime,endTime);// 部门、时间
282 //列表数据
283 List<DepartLoadRateVO> dataList = statisticsByLoadRateList(departIds, startTime,endTime,loadRateType);
284
285 //统计总数
286 int normalNum = getJdbcTemplate().queryForObject( getStatisticsByLoadRate( dataViewName2119,1 ),Integer.class);//正常
287 int lowLoadNum = getJdbcTemplate().queryForObject( getStatisticsByLoadRate( dataViewName2119,3 ),Integer.class);//低负荷
288 int overloadNum = getJdbcTemplate().queryForObject( getStatisticsByLoadRate( dataViewName2119,2 ),Integer.class);//超负荷
289
290 departLoadRateResultVO.setLowLoadNum( lowLoadNum );
291 departLoadRateResultVO.setNormalNum( normalNum );
292 departLoadRateResultVO.setOverloadNum( overloadNum );
293 departLoadRateResultVO.setDepartLoadRateVOList( dataList );
294 return departLoadRateResultVO;
295 }
296 //指挥中心-运行负荷率分析---列表详情
297 public List<DepartLoadRateVO> statisticsByLoadRateList(String departIds, String startTime, String endTime ,Integer loadRateType) {
298 String dataViewName2119 = ReportViewUtil.buildView(view2119,"CSL", departIds, startTime,endTime);// 部门、时间
299 // 运行负荷率分析 = CSL/规模
300 String sql = " select round(sum(aaa.CSL),2) 'waterYieldMonth' ,aaa.depart_id , d.depart_name , round( (sum(aaa.CSL)/(fi.pro_scale*10000) ),2) 'loadRate' from "+ dataViewName2119 +" aaa";
301 sql += " left join sys_factory_info fi on fi.depart_id = aaa.depart_id ";
302 sql += " left join sys_depart d on d.id = aaa.depart_id group by aaa.depart_id";
303
304 if(loadRateType != null ){
305 if(1 ==loadRateType ) sql += " having loadRate <=120 and loadRate>=60";
306 if(2 ==loadRateType ) sql += " having loadRate > 120 ";
307 if(3 ==loadRateType ) sql += " having loadRate <60";
308 }
309
310 //System.out.println("sql = "+sql);
311 List<DepartLoadRateVO> dataList = getJdbcTemplate().query( sql,new BeanPropertyRowMapper<DepartLoadRateVO>(DepartLoadRateVO.class));
312 return dataList;
313 }
314
315
316 private String getStatisticsByLoadRate(String dataViewName2119 ,Integer loadRateType ){
317 String sql = "select count(1) from ( ";
318 sql += " select aaa.depart_id , round( (sum(aaa.CSL)/(fi.pro_scale*10000) ),2) 'loadRate' from "+ dataViewName2119 +" aaa";
319 sql += " left join sys_factory_info fi on fi.depart_id = aaa.depart_id ";
320 sql += " group by aaa.depart_id ";
321 if(loadRateType != null ){
322 if( 1 ==loadRateType ) sql += " having loadRate <=120 and loadRate>=60";
323 if(2 ==loadRateType ) sql += " having loadRate > 120 ";
324 if(3 ==loadRateType ) sql += " having loadRate <60";
325 }
326
327 sql += " ) bbb ";
328 //System.out.println("sql = "+sql);
329 return sql ;
330 }
331
41 /* public List<Map<String,Object>> getDeptDLHJ(String departId , String startTime , String endTime){ 332 /* public List<Map<String,Object>> getDeptDLHJ(String departId , String startTime , String endTime){
42 333
43 }*/ 334 }*/
......
1 package com.skua.modules.algorithm.vo;
2
3 import com.skua.tool.util.JSUtils;
4 import io.swagger.annotations.ApiModel;
5 import io.swagger.annotations.ApiModelProperty;
6 import lombok.Data;
7
8 @Data
9 @ApiModel(value="指挥中心:ReportItemVO", description="指挥中心:ReportItemVO详情类)")
10 public class ReportItemVO {
11
12 @ApiModelProperty(value = "厂站编号")
13 private String departId;
14 @ApiModelProperty(value = "厂站名称")
15 private String departName;
16
17 @ApiModelProperty(value = "时间")
18 private String time;
19 @ApiModelProperty(value = "label描述")
20 private String label;
21 @ApiModelProperty(value = "结果")
22 private String value;
23 @ApiModelProperty(value = "日均数据")
24 private String avgDayValue;
25
26 @ApiModelProperty(value = "同比")
27 private String valueTb;
28 @ApiModelProperty(value = "同比比例")
29 private String valueTbBl;
30
31 /* @ApiModelProperty(value = "同比差值")
32 private String valueTbDifference;*/
33 @ApiModelProperty(value = "环比")
34 private String valueHb;
35 @ApiModelProperty(value = "环比比例")
36 private String valueHbBl;
37
38
39 @ApiModelProperty(value = "吨水产泥量")
40 private String dscnl;
41 /* @ApiModelProperty(value = "环比差值")
42 private String valueHbDifference;
43 @ApiModelProperty(value = "单位")
44 private String unit;
45 */
46
47 public String getValueTbBl() {
48 valueTbBl = JSUtils.executeExpression("("+this.getValue() + " - " + this.getValueTb() + ") / " +this.getValueTb(),"0.00") ;
49 return valueTbBl;
50 }
51
52 public String getValueHbBl() {
53 valueHbBl = JSUtils.executeExpression("("+this.getValue() + " - " + this.getValueHb() + ") / " +this.getValueHb(),"0.00") ;
54 return valueHbBl;
55 }
56 }
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
142 FROM 142 FROM
143 report_electric_cost 143 report_electric_cost
144 WHERE 144 WHERE
145 month BETWEEN '2024-01' AND '2024-10' 145 month BETWEEN #{startDate} AND ${endDate}
146 GROUP BY month 146 GROUP BY month
147 </select> 147 </select>
148 148
......
...@@ -74,7 +74,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -74,7 +74,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
74 74
75 Map<String, Object> dsyhMap = queryForMap(sql.toString());// getJdbcTemplate().queryForMap(sql.toString()); 75 Map<String, Object> dsyhMap = queryForMap(sql.toString());// getJdbcTemplate().queryForMap(sql.toString());
76 if(dsyhMap != null ){ 76 if(dsyhMap != null ){
77 displayVO.setLszddsyh( dsyhMap.get("dsyh")+"" ); 77 displayVO.setLszddsyh( ConvertUtils.getString( dsyhMap.get("dsyh"),"0") );
78 displayVO.setLszddsyhyf( dsyhMap.get("time")+"" ); 78 displayVO.setLszddsyhyf( dsyhMap.get("time")+"" );
79 } 79 }
80 80
......
...@@ -102,6 +102,8 @@ public interface ISysFactoryInfoService extends IService<SysFactoryInfo> { ...@@ -102,6 +102,8 @@ public interface ISysFactoryInfoService extends IService<SysFactoryInfo> {
102 102
103 List<SysFactoryInfoVO> getFactoryListByWrapper(QueryWrapper<SysFactoryInfoVO> queryWrapper); 103 List<SysFactoryInfoVO> getFactoryListByWrapper(QueryWrapper<SysFactoryInfoVO> queryWrapper);
104 104
105
106
105 /** 107 /**
106 * 获取总的设计规模 108 * 获取总的设计规模
107 * @return 109 * @return
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!