f0e48d8a 张雷

禅道BUG修改

1 个父辈 d36bf3f5
...@@ -75,7 +75,7 @@ public class ReportViewUtil { ...@@ -75,7 +75,7 @@ public class ReportViewUtil {
75 sb.append("`a`.`depart_id` AS `depart_id`,`a`.`data_id` AS `id`,`a`.`data_time` AS `time` from (( "); 75 sb.append("`a`.`depart_id` AS `depart_id`,`a`.`data_id` AS `id`,`a`.`data_time` AS `time` from (( ");
76 76
77 sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv v WHERE 1=1 "); 77 sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv v WHERE 1=1 ");
78 if(StringUtils.isNotEmpty(inSqlPart)){ 78 if(StringUtils.isNotEmpty(departIds)){
79 sb.append(" and depart_id in ("+inSqlPart+") "); 79 sb.append(" and depart_id in ("+inSqlPart+") ");
80 } 80 }
81 if(!StringUtils.isEmpty(startTime)) { 81 if(!StringUtils.isEmpty(startTime)) {
...@@ -139,7 +139,10 @@ public class ReportViewUtil { ...@@ -139,7 +139,10 @@ public class ReportViewUtil {
139 itemIds = itemIds.substring(1); 139 itemIds = itemIds.substring(1);
140 } 140 }
141 sb.append("`a`.`depart_id` AS `depart_id`,`a`.`data_id` AS `id`,`a`.`data_time` AS `time` from (( "); 141 sb.append("`a`.`depart_id` AS `depart_id`,`a`.`data_id` AS `id`,`a`.`data_time` AS `time` from (( ");
142 sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE depart_id in ("+inSqlPart+")"); 142 sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE 1=1 ");
143 if(StringUtils.isNotEmpty(departIds)){
144 sb.append("and depart_id in ("+inSqlPart+")");
145 }
143 if(!StringUtils.isEmpty(dataTime)) { 146 if(!StringUtils.isEmpty(dataTime)) {
144 sb.append("and data_time like'"+dataTime+"%'"); 147 sb.append("and data_time like'"+dataTime+"%'");
145 } 148 }
...@@ -198,7 +201,7 @@ public class ReportViewUtil { ...@@ -198,7 +201,7 @@ public class ReportViewUtil {
198 sb.append("`a`.`depart_id` AS `depart_id` from (( "); 201 sb.append("`a`.`depart_id` AS `depart_id` from (( ");
199 sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE 1=1 "); 202 sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE 1=1 ");
200 203
201 if(!StringUtils.isEmpty(inSqlPart)) { 204 if(!StringUtils.isEmpty(departIds)) {
202 sb.append(" and depart_id in ("+inSqlPart+")"); 205 sb.append(" and depart_id in ("+inSqlPart+")");
203 } 206 }
204 if(!StringUtils.isEmpty(startTime)) { 207 if(!StringUtils.isEmpty(startTime)) {
......
...@@ -6,6 +6,7 @@ import java.math.BigDecimal; ...@@ -6,6 +6,7 @@ import java.math.BigDecimal;
6 import java.text.ParsePosition; 6 import java.text.ParsePosition;
7 import java.text.SimpleDateFormat; 7 import java.text.SimpleDateFormat;
8 import java.time.DayOfWeek; 8 import java.time.DayOfWeek;
9 import java.time.LocalDate;
9 import java.time.LocalDateTime; 10 import java.time.LocalDateTime;
10 import java.time.YearMonth; 11 import java.time.YearMonth;
11 import java.time.format.DateTimeFormatter; 12 import java.time.format.DateTimeFormatter;
...@@ -317,6 +318,10 @@ public class DateUtils { ...@@ -317,6 +318,10 @@ public class DateUtils {
317 return simpleDateFormat.format(date); 318 return simpleDateFormat.format(date);
318 } 319 }
319 320
321 public static String date2Str(Date date, SimpleDateFormat date_sdf) {
322 return null == date ? null : date_sdf.format(date);
323 }
324
320 /** 325 /**
321 * <pre> 326 * <pre>
322 * 日期字符串转秒 327 * 日期字符串转秒
...@@ -451,4 +456,66 @@ public class DateUtils { ...@@ -451,4 +456,66 @@ public class DateUtils {
451 return new String[]{hbStartTime, hbEndTime}; 456 return new String[]{hbStartTime, hbEndTime};
452 } 457 }
453 458
459 /**
460 * 同比
461 * @param month
462 * @return
463 */
464 public static String getTbMonth(String month) {
465 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
466 YearMonth yearMonth = YearMonth.parse(month, formatter);
467 YearMonth sameMonthLastYear = yearMonth.minusYears(1);
468 return sameMonthLastYear.format(formatter); // 同比
469 }
470
471 /**
472 * 环比
473 * @param month
474 * @return
475 */
476 public static String getHbMonth(String month) {
477 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
478 YearMonth yearMonth = YearMonth.parse(month, formatter);
479 YearMonth previousMonth = yearMonth.minusMonths(1);
480 return previousMonth.format(formatter); // 环比
481 }
482
483 /**
484 * 获取同比时间
485 * @param date
486 * @return
487 */
488 public static String getTbDate(String date) {
489 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
490 Calendar calendar = Calendar.getInstance();
491 try{
492 Date dateTime = sdf.parse(date);
493 calendar.setTime(dateTime);
494 }catch (Exception e){
495 calendar.setTime(new Date());
496 }
497 calendar.add(Calendar.YEAR, -1);
498 Date preDate = calendar.getTime();
499 return sdf.format(preDate);
500 }
501
502 /**
503 * 获取环比时间
504 * @param date
505 * @return
506 */
507 public static String getHbDate(String date) {
508 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
509 Calendar calendar = Calendar.getInstance();
510 try{
511 Date dateTime = sdf.parse(date);
512 calendar.setTime(dateTime);
513 }catch (Exception e){
514 calendar.setTime(new Date());
515 }
516 calendar.add(Calendar.MONTH, -1);
517 Date preDate = calendar.getTime();
518 return sdf.format(preDate);
519 }
520
454 } 521 }
......
...@@ -78,6 +78,19 @@ ...@@ -78,6 +78,19 @@
78 <orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.14.v20181114" level="project" /> 78 <orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.14.v20181114" level="project" />
79 <orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.14.v20181114" level="project" /> 79 <orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.14.v20181114" level="project" />
80 <orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.55" level="project" /> 80 <orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.55" level="project" />
81 <orderEntry type="library" name="Maven: com.itextpdf:itextpdf:5.5.11" level="project" />
82 <orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
83 <orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
84 <orderEntry type="library" name="Maven: com.itextpdf:html2pdf:4.0.3" level="project" />
85 <orderEntry type="library" name="Maven: com.itextpdf:forms:7.2.3" level="project" />
86 <orderEntry type="library" name="Maven: com.itextpdf:kernel:7.2.3" level="project" />
87 <orderEntry type="library" name="Maven: com.itextpdf:io:7.2.3" level="project" />
88 <orderEntry type="library" name="Maven: com.itextpdf:commons:7.2.3" level="project" />
89 <orderEntry type="library" name="Maven: com.itextpdf:layout:7.2.3" level="project" />
90 <orderEntry type="library" name="Maven: com.itextpdf:svg:7.2.3" level="project" />
91 <orderEntry type="library" name="Maven: com.itextpdf:styled-xml-parser:7.2.3" level="project" />
92 <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
93 <orderEntry type="library" name="Maven: com.itextpdf:font-asian:7.2.3" level="project" />
81 <orderEntry type="library" name="Maven: com.kingtroldata:core:2.0.3" level="project" /> 94 <orderEntry type="library" name="Maven: com.kingtroldata:core:2.0.3" level="project" />
82 <orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.0.1" level="project" /> 95 <orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.0.1" level="project" />
83 <orderEntry type="library" name="Maven: org.lz4:lz4-java:1.4.1" level="project" /> 96 <orderEntry type="library" name="Maven: org.lz4:lz4-java:1.4.1" level="project" />
...@@ -193,7 +206,6 @@ ...@@ -193,7 +206,6 @@
193 <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" /> 206 <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" />
194 <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" /> 207 <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" />
195 <orderEntry type="library" name="Maven: joda-time:joda-time:2.10.1" level="project" /> 208 <orderEntry type="library" name="Maven: joda-time:joda-time:2.10.1" level="project" />
196 <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
197 <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" /> 209 <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />
198 <orderEntry type="library" name="Maven: xerces:xercesImpl:2.12.0" level="project" /> 210 <orderEntry type="library" name="Maven: xerces:xercesImpl:2.12.0" level="project" />
199 <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" /> 211 <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
...@@ -339,7 +351,6 @@ ...@@ -339,7 +351,6 @@
339 <orderEntry type="library" name="Maven: com.googlecode.aviator:aviator:4.2.7" level="project" /> 351 <orderEntry type="library" name="Maven: com.googlecode.aviator:aviator:4.2.7" level="project" />
340 <orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" /> 352 <orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
341 <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" /> 353 <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
342 <orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
343 <orderEntry type="library" name="Maven: com.github.stuxuhai:jpinyin:1.1.8" level="project" /> 354 <orderEntry type="library" name="Maven: com.github.stuxuhai:jpinyin:1.1.8" level="project" />
344 </component> 355 </component>
345 </module> 356 </module>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -88,7 +88,6 @@ public class SysCommandCentreController { ...@@ -88,7 +88,6 @@ public class SysCommandCentreController {
88 } 88 }
89 } 89 }
90 90
91
92 /* FReportItemv currenteportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode,startDate , endDate ); 91 /* FReportItemv currenteportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode,startDate , endDate );
93 //上月数据 92 //上月数据
94 FReportItemv lastMonthReportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode,reportItemvParam.getLastMonthStartDate() , reportItemvParam.getLastMonthEndDate() ); 93 FReportItemv lastMonthReportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode,reportItemvParam.getLastMonthStartDate() , reportItemvParam.getLastMonthEndDate() );
...@@ -98,10 +97,10 @@ public class SysCommandCentreController { ...@@ -98,10 +97,10 @@ public class SysCommandCentreController {
98 //整理数据 97 //整理数据
99 List<FRportlCommandCenterVO> fReportItemvList = arrangeFRportlCommandCenterVO(currenteportItemv , lastMonthReportItemv,lastYearReportItemv);*/ 98 List<FRportlCommandCenterVO> fReportItemvList = arrangeFRportlCommandCenterVO(currenteportItemv , lastMonthReportItemv,lastYearReportItemv);*/
100 99
101
102 //年数据统计: 100 //年数据统计:
103 String total = factoryInfoService.querySumProScale(); 101 String total = factoryInfoService.querySumProScale();
104 total = DigitalUtils.multiply(total,"10000"); 102 total = String.format("%.2f", Double.parseDouble(total));
103 // total = DigitalUtils.multiply(total,"10000");
105 fReportItemvList.add( new FRportlCommandCenterVO( total,"0","0")); 104 fReportItemvList.add( new FRportlCommandCenterVO( total,"0","0"));
106 105
107 //todo 演示暂时注释 106 //todo 演示暂时注释
......
...@@ -7,6 +7,7 @@ import com.skua.modules.report.entity.FReportItemv; ...@@ -7,6 +7,7 @@ import com.skua.modules.report.entity.FReportItemv;
7 import com.skua.modules.report.mapper.FReportItemMapper; 7 import com.skua.modules.report.mapper.FReportItemMapper;
8 import com.skua.modules.report.vo.*; 8 import com.skua.modules.report.vo.*;
9 import com.skua.modules.report.mapper.FReportItemvMapper; 9 import com.skua.modules.report.mapper.FReportItemvMapper;
10 import com.skua.tool.util.DateUtils;
10 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
11 12
12 import javax.annotation.Resource; 13 import javax.annotation.Resource;
...@@ -120,29 +121,27 @@ public class CommandCentreServiceImpl implements ICommandCentreService { ...@@ -120,29 +121,27 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
120 121
121 @Override 122 @Override
122 public DepartDrugResult getYhTotal(String month) { 123 public DepartDrugResult getYhTotal(String month) {
123 String monthTb = getTbMonth(month);//同比时间 124 String monthTb = DateUtils.getTbMonth(month);//同比时间
124 String monthHb = getHbMonth(month);//环比时间 125 String monthHb = DateUtils.getHbMonth(month);//环比时间
125 // String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1"; 126 String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
126 // String view3a24 = "3a243d5715b9e1a3753c180872ca0df9"; 127 String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
127 // String departId = "1519193830953553920,1519200041706954752,1816759403152666624,1818214145808531456,1818214519948836864," + 128 String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", "", month);
128 // " 1818214642204409856,1818214704200417280,1818214745841467392,1818214781186867200,1818214830096646144,1818214870622011392," + 129 String dataViewName2119tb = ReportViewUtil.buildViewLike(view2119,"CSL", "", monthTb);
129 // " 1818214905388597248,1818214961122508800,1818215007217909760,1818215052952600576,1818215093192753152,1818215141427249152," + 130 String dataViewName2119hb = ReportViewUtil.buildViewLike(view2119,"CSL", "", monthHb);
130 // " 1818215178001580032,1818215228744269824,1818215268359471104,1818215307165171712,1818215363477897216,1818215411217465344"; 131 String field3a24 = "PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," +
131 // String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, month); 132 "YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2";
132 // String dataViewName2119tb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, monthTb); 133 String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,field3a24, "", month);
133 // String dataViewName2119hb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, monthHb); 134 String dataViewName3a24tb = ReportViewUtil.buildViewLike(view3a24,field3a24, "", monthTb);
134 // 135 String dataViewName3a24hb = ReportViewUtil.buildViewLike(view3a24,field3a24, "", monthHb);
135 // String field3a24 = "PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," + 136 DepartDrugResult departDrugResult = fReportItemvMapper.getYhData(month,monthTb,monthHb,
136 // "YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2"; 137 dataViewName3a24,dataViewName3a24tb,dataViewName3a24hb);
137 // String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,field3a24, departId, month); 138 if(departDrugResult == null){
138 // String dataViewName3a24tb = ReportViewUtil.buildViewLike(view3a24,field3a24, departId, monthTb); 139 departDrugResult = new DepartDrugResult();
139 // String dataViewName3a24hb = ReportViewUtil.buildViewLike(view3a24,field3a24, departId, monthHb); 140 }
140 DepartDrugResult departDrugResult = new DepartDrugResult();
141 departDrugResult.setZyh("0");
142 departDrugResult.setZyhHb("0");
143 departDrugResult.setZyhTb("0");
144 List<DepartDrugDataVO> drugList = new ArrayList<>(); 141 List<DepartDrugDataVO> drugList = new ArrayList<>();
145 drugList = fReportItemvMapper.getYhList(month,monthTb,monthHb); 142 drugList = fReportItemvMapper.getYhList(month,monthTb,monthHb,
143 dataViewName2119,dataViewName2119tb,dataViewName2119hb,
144 dataViewName3a24,dataViewName3a24tb,dataViewName3a24hb);
146 departDrugResult.setDrugList(drugList); 145 departDrugResult.setDrugList(drugList);
147 return departDrugResult; 146 return departDrugResult;
148 } 147 }
......
...@@ -663,6 +663,8 @@ public class ScreenDataController { ...@@ -663,6 +663,8 @@ public class ScreenDataController {
663 String dataDepartId = sysFactoryInfoVO.getDepartId(); 663 String dataDepartId = sysFactoryInfoVO.getDepartId();
664 if (ConvertUtils.isNotEmpty(dataDepartId)) { 664 if (ConvertUtils.isNotEmpty(dataDepartId)) {
665 queryWrapper.in("d.id", dataDepartId.split(",")); 665 queryWrapper.in("d.id", dataDepartId.split(","));
666 } else{
667 queryWrapper.in("d.id", BaseContextHandler.getDeparts().split(","));
666 } 668 }
667 queryWrapper.orderByAsc("d.depart_order"); 669 queryWrapper.orderByAsc("d.depart_order");
668 List<SysFactoryInfoVO> factoryInfoVOS = sysFactoryInfoService.getFactoryListByWrapper(queryWrapper); 670 List<SysFactoryInfoVO> factoryInfoVOS = sysFactoryInfoService.getFactoryListByWrapper(queryWrapper);
......
...@@ -30,6 +30,8 @@ public class ScreenDataServiceImpl implements IScreenDataService { ...@@ -30,6 +30,8 @@ public class ScreenDataServiceImpl implements IScreenDataService {
30 private IFactoryInfoService factoryInfoService; 30 private IFactoryInfoService factoryInfoService;
31 @Resource 31 @Resource
32 private ScreenMapper screenMapper; 32 private ScreenMapper screenMapper;
33 private static String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
34 private static String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
33 35
34 @Override 36 @Override
35 public Map<String, Object> getDifferData(String startDate, String itemTags, String departId, String type, JdbcTemplate masterDB) { 37 public Map<String, Object> getDifferData(String startDate, String itemTags, String departId, String type, JdbcTemplate masterDB) {
...@@ -211,8 +213,6 @@ public class ScreenDataServiceImpl implements IScreenDataService { ...@@ -211,8 +213,6 @@ public class ScreenDataServiceImpl implements IScreenDataService {
211 213
212 @Override 214 @Override
213 public List<Map<String, Object>> getYhdlqs(StatisticsParams statisticsParams) { 215 public List<Map<String, Object>> getYhdlqs(StatisticsParams statisticsParams) {
214 String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
215 String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
216 List<Map<String, Object>> list = new ArrayList<>(); 216 List<Map<String, Object>> list = new ArrayList<>();
217 String startDate = statisticsParams.getStartDate(); 217 String startDate = statisticsParams.getStartDate();
218 String endDate = statisticsParams.getEndDate(); 218 String endDate = statisticsParams.getEndDate();
...@@ -256,8 +256,6 @@ public class ScreenDataServiceImpl implements IScreenDataService { ...@@ -256,8 +256,6 @@ public class ScreenDataServiceImpl implements IScreenDataService {
256 256
257 @Override 257 @Override
258 public List<Map<String, Object>> getYhylqs(StatisticsParams statisticsParams) { 258 public List<Map<String, Object>> getYhylqs(StatisticsParams statisticsParams) {
259 String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
260 String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
261 List<Map<String, Object>> list = new ArrayList<>(); 259 List<Map<String, Object>> list = new ArrayList<>();
262 String startDate = statisticsParams.getStartDate(); 260 String startDate = statisticsParams.getStartDate();
263 String endDate = statisticsParams.getEndDate(); 261 String endDate = statisticsParams.getEndDate();
......
...@@ -169,12 +169,12 @@ skua: ...@@ -169,12 +169,12 @@ skua:
169 #消息推送 169 #消息推送
170 push: 170 push:
171 #是否开启流程消息推送 171 #是否开启流程消息推送
172 process-enable: false 172 process-enable: true
173 mob: 173 mob:
174 appSecret: 4e21ddb344233a5a3ec6b3446310efe1 174 appSecret: fd97aba79649a0322934a9c88bfceff3
175 appKey: 35e7ed05966f2 175 appKey: 3a2653ad36727
176 pushHostName: http://api.push.mob.com/v3/push/createPush 176 pushHostName: http://api.push.mob.com/v3/push/createPush
177 packageName: com.kingtrol.flutter_factoryApp 177 packageName: com.kingtrol.flutter_zhongye
178 iosProduction: 0 178 iosProduction: 0
179 # 自定义逻辑,以','分割(e.g: messagePush:消息推送完后处理) 179 # 自定义逻辑,以','分割(e.g: messagePush:消息推送完后处理)
180 flow: 180 flow:
......
...@@ -166,10 +166,10 @@ skua: ...@@ -166,10 +166,10 @@ skua:
166 #是否开启流程消息推送 166 #是否开启流程消息推送
167 process-enable: false 167 process-enable: false
168 mob: 168 mob:
169 appSecret: 4e21ddb344233a5a3ec6b3446310efe1 169 appSecret: fd97aba79649a0322934a9c88bfceff3
170 appKey: 35e7ed05966f2 170 appKey: 3a2653ad36727
171 pushHostName: http://api.push.mob.com/v3/push/createPush 171 pushHostName: http://api.push.mob.com/v3/push/createPush
172 packageName: com.kingtrol.flutter_factoryApp 172 packageName: com.kingtrol.flutter_zhongye
173 iosProduction: 0 173 iosProduction: 0
174 # 自定义逻辑,以','分割(e.g: messagePush:消息推送完后处理) 174 # 自定义逻辑,以','分割(e.g: messagePush:消息推送完后处理)
175 flow: 175 flow:
......
...@@ -88,6 +88,17 @@ public class FactoryCenterController { ...@@ -88,6 +88,17 @@ public class FactoryCenterController {
88 return result; 88 return result;
89 } 89 }
90 90
91 //厂区削减量统计
92 @ApiOperation(value="厂区削减量统计", notes="厂区削减量统计")
93 @GetMapping(value = "/getSzXjltj")
94 public Result<List<Map<String, Object>>> getSzXjltj(StatisticsParam statisticsParam) {
95 Result<List<Map<String, Object>>> result = new Result<List<Map<String, Object>>>();
96 List<Map<String, Object>> list = factoryCenterService.getYhtj(statisticsParam);
97 result.setSuccess(true);
98 result.setResult(list);
99 return result;
100 }
101
91 /** 102 /**
92 * <pre> 103 * <pre>
93 * <获取指定厂站报警阈值 104 * <获取指定厂站报警阈值
......
...@@ -16,15 +16,25 @@ ...@@ -16,15 +16,25 @@
16 FROM 16 FROM
17 ${view2119tb} v2119 17 ${view2119tb} v2119
18 WHERE 18 WHERE
19 v2119.depart_id = #{departId} 19 v2119.time &gt;= #{startDateTb}
20 AND v2119.time &gt;= #{startDateTb}
21 AND v2119.time &lt;= #{endDateTb} 20 AND v2119.time &lt;= #{endDateTb}
21 <if test="departId!=null and departId!=''">
22 AND v2119.depart_id in
23 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
24 '${item}'
25 </foreach>
26 </if>
22 GROUP BY 27 GROUP BY
23 LEFT ( v2119.time, 7 ) 28 LEFT ( v2119.time, 7 )
24 ) v2 on RIGHT( LEFT ( v.time, 7 ), 2 ) = v2.time 29 ) v2 on RIGHT( LEFT ( v.time, 7 ), 2 ) = v2.time
25 WHERE v.depart_id = #{departId} 30 WHERE v.time &gt;= #{startDate}
26 AND v.time &gt;= #{startDate}
27 AND v.time &lt;= #{endDate} 31 AND v.time &lt;= #{endDate}
32 <if test="departId!=null and departId!=''">
33 AND v.depart_id in
34 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
35 '${item}'
36 </foreach>
37 </if>
28 GROUP BY 38 GROUP BY
29 LEFT ( v.time, 7 ) 39 LEFT ( v.time, 7 )
30 </select> 40 </select>
...@@ -47,9 +57,14 @@ ...@@ -47,9 +57,14 @@
47 FROM 57 FROM
48 ${view2119} v2119 58 ${view2119} v2119
49 WHERE 59 WHERE
50 v2119.depart_id = #{departId} 60 v2119.time &gt;= #{startDate}
51 AND v2119.time &gt;= #{startDate}
52 AND v2119.time &lt;= #{endDate} 61 AND v2119.time &lt;= #{endDate}
62 <if test="departId!=null and departId!=''">
63 AND v2119.depart_id in
64 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
65 '${item}'
66 </foreach>
67 </if>
53 GROUP BY LEFT ( v2119.time, 7 ) 68 GROUP BY LEFT ( v2119.time, 7 )
54 ) v2 on LEFT(v3.time,7) = v2.time 69 ) v2 on LEFT(v3.time,7) = v2.time
55 left join ( 70 left join (
...@@ -67,21 +82,36 @@ ...@@ -67,21 +82,36 @@
67 FROM 82 FROM
68 ${view2119tb} v2119 83 ${view2119tb} v2119
69 WHERE 84 WHERE
70 v2119.depart_id = #{departId} 85 time &gt;= #{startDateTb}
71 AND time &gt;= #{startDateTb}
72 AND time &lt;= #{endDateTb} 86 AND time &lt;= #{endDateTb}
87 <if test="departId!=null and departId!=''">
88 AND v2119.depart_id in
89 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
90 '${item}'
91 </foreach>
92 </if>
73 GROUP BY LEFT ( v2119.time, 7 ) 93 GROUP BY LEFT ( v2119.time, 7 )
74 ) v2 on LEFT(v3.time,7) = v2.time 94 ) v2 on LEFT(v3.time,7) = v2.time
75 WHERE 95 WHERE
76 v3.depart_id = #{departId} 96 v3.time &gt;= #{startDateTb}
77 AND v3.time &gt;= #{startDateTb}
78 AND v3.time &lt;= #{endDateTb} 97 AND v3.time &lt;= #{endDateTb}
98 <if test="departId!=null and departId!=''">
99 AND v3.depart_id in
100 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
101 '${item}'
102 </foreach>
103 </if>
79 GROUP BY LEFT ( v3.time, 7 ) 104 GROUP BY LEFT ( v3.time, 7 )
80 ) pre on right(pre.time,2) = right(LEFT(v3.time,7),2) 105 ) pre on right(pre.time,2) = right(LEFT(v3.time,7),2)
81 WHERE 106 WHERE
82 v3.depart_id = #{departId} 107 v3.time &gt;= #{startDate}
83 AND v3.time &gt;= #{startDate}
84 AND v3.time &lt;= #{endDate} 108 AND v3.time &lt;= #{endDate}
109 <if test="departId!=null and departId!=''">
110 AND v3.depart_id in
111 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
112 '${item}'
113 </foreach>
114 </if>
85 GROUP BY LEFT ( v3.time, 7 ) 115 GROUP BY LEFT ( v3.time, 7 )
86 </select> 116 </select>
87 117
...@@ -103,9 +133,14 @@ ...@@ -103,9 +133,14 @@
103 FROM 133 FROM
104 ${view2119} v2119 134 ${view2119} v2119
105 WHERE 135 WHERE
106 v2119.depart_id = #{departId} 136 v2119.time &gt;= #{startDate}
107 AND v2119.time &gt;= #{startDate}
108 AND v2119.time &lt;= #{endDate} 137 AND v2119.time &lt;= #{endDate}
138 <if test="departId!=null and departId!=''">
139 AND v2119.depart_id in
140 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
141 '${item}'
142 </foreach>
143 </if>
109 GROUP BY LEFT ( v2119.time, 7 ) 144 GROUP BY LEFT ( v2119.time, 7 )
110 ) v2 on LEFT(v3.time,7) = v2.time 145 ) v2 on LEFT(v3.time,7) = v2.time
111 left join ( 146 left join (
...@@ -123,21 +158,36 @@ ...@@ -123,21 +158,36 @@
123 FROM 158 FROM
124 ${view2119tb} v2119 159 ${view2119tb} v2119
125 WHERE 160 WHERE
126 v2119.depart_id = #{departId} 161 v2119.time &gt;= #{startDateTb}
127 AND v2119.time &gt;= #{startDateTb}
128 AND v2119.time &lt;= #{endDateTb} 162 AND v2119.time &lt;= #{endDateTb}
163 <if test="departId!=null and departId!=''">
164 AND v2119.depart_id in
165 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
166 '${item}'
167 </foreach>
168 </if>
129 GROUP BY LEFT ( v2119.time, 7 ) 169 GROUP BY LEFT ( v2119.time, 7 )
130 ) v2 on LEFT(v3.time,7) = v2.time 170 ) v2 on LEFT(v3.time,7) = v2.time
131 WHERE 171 WHERE
132 v3.depart_id = #{departId} 172 v3.time &gt;= #{startDateTb}
133 AND v3.time &gt;= #{startDateTb}
134 AND v3.time &lt;= #{endDateTb} 173 AND v3.time &lt;= #{endDateTb}
174 <if test="departId!=null and departId!=''">
175 AND v3.depart_id in
176 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
177 '${item}'
178 </foreach>
179 </if>
135 GROUP BY LEFT ( v3.time, 7 ) 180 GROUP BY LEFT ( v3.time, 7 )
136 ) pre on right(pre.time,2) = right(LEFT(v3.time,7),2) 181 ) pre on right(pre.time,2) = right(LEFT(v3.time,7),2)
137 WHERE 182 WHERE
138 v3.depart_id = #{departId} 183 v3.time &gt;= #{startDate}
139 AND v3.time &gt;= #{startDate}
140 AND v3.time &lt;= #{endDate} 184 AND v3.time &lt;= #{endDate}
185 <if test="departId!=null and departId!=''">
186 AND v3.depart_id in
187 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
188 '${item}'
189 </foreach>
190 </if>
141 GROUP BY LEFT ( v3.time, 7 ) 191 GROUP BY LEFT ( v3.time, 7 )
142 </select> 192 </select>
143 193
...@@ -180,15 +230,25 @@ ...@@ -180,15 +230,25 @@
180 FROM 230 FROM
181 ${view3a24tb} v3 231 ${view3a24tb} v3
182 WHERE 232 WHERE
183 v3.depart_id = #{departId} 233 v3.time &gt;= #{startDateTb}
184 AND v3.time &gt;= #{startDateTb}
185 AND v3.time &lt;= #{endDateTb} 234 AND v3.time &lt;= #{endDateTb}
235 <if test="departId!=null and departId!=''">
236 AND v3.depart_id in
237 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
238 '${item}'
239 </foreach>
240 </if>
186 GROUP BY 241 GROUP BY
187 LEFT ( v3.time, 7 ) 242 LEFT ( v3.time, 7 )
188 ) v2 on RIGHT( LEFT ( v.time, 7 ), 2 ) = v2.time 243 ) v2 on RIGHT( LEFT ( v.time, 7 ), 2 ) = v2.time
189 WHERE v.depart_id = #{departId} 244 WHERE v.time &gt;= #{startDate}
190 AND v.time &gt;= #{startDate}
191 AND v.time &lt;= #{endDate} 245 AND v.time &lt;= #{endDate}
246 <if test="departId!=null and departId!=''">
247 AND v.depart_id in
248 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
249 '${item}'
250 </foreach>
251 </if>
192 GROUP BY 252 GROUP BY
193 LEFT ( v.time, 7 ) 253 LEFT ( v.time, 7 )
194 </select> 254 </select>
......
...@@ -6,7 +6,6 @@ import com.skua.core.context.SpringContextUtils; ...@@ -6,7 +6,6 @@ import com.skua.core.context.SpringContextUtils;
6 import com.skua.core.service.IFactoryInfoService; 6 import com.skua.core.service.IFactoryInfoService;
7 import com.skua.core.service.IPgQueryService; 7 import com.skua.core.service.IPgQueryService;
8 import com.skua.core.util.ConvertUtils; 8 import com.skua.core.util.ConvertUtils;
9 import com.skua.core.util.DateUtils;
10 import com.skua.core.util.DoubleOperaUtils; 9 import com.skua.core.util.DoubleOperaUtils;
11 import com.skua.modules.dataAnalysis.mapper.FactoryCenterMapper; 10 import com.skua.modules.dataAnalysis.mapper.FactoryCenterMapper;
12 import com.skua.modules.dataAnalysis.service.IFactoryCenterService; 11 import com.skua.modules.dataAnalysis.service.IFactoryCenterService;
...@@ -14,6 +13,7 @@ import com.skua.modules.dataAnalysis.vo.StatisticsParam; ...@@ -14,6 +13,7 @@ import com.skua.modules.dataAnalysis.vo.StatisticsParam;
14 import com.skua.modules.dataAnalysis.vo.WaterQualityMonitoringDetailVO; 13 import com.skua.modules.dataAnalysis.vo.WaterQualityMonitoringDetailVO;
15 import com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo; 14 import com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo;
16 import com.skua.modules.system.datestandard.service.ISysMonitorMetricInfoService; 15 import com.skua.modules.system.datestandard.service.ISysMonitorMetricInfoService;
16 import com.skua.tool.util.DateUtils;
17 import org.apache.commons.lang3.StringUtils; 17 import org.apache.commons.lang3.StringUtils;
18 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
19 import org.springframework.jdbc.core.JdbcTemplate; 19 import org.springframework.jdbc.core.JdbcTemplate;
...@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service; ...@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
21 import org.springframework.util.CollectionUtils; 21 import org.springframework.util.CollectionUtils;
22 22
23 import javax.annotation.Resource; 23 import javax.annotation.Resource;
24 import java.text.SimpleDateFormat;
24 import java.time.LocalDate; 25 import java.time.LocalDate;
25 import java.time.YearMonth; 26 import java.time.YearMonth;
26 import java.time.format.DateTimeFormatter; 27 import java.time.format.DateTimeFormatter;
...@@ -39,6 +40,9 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { ...@@ -39,6 +40,9 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
39 @Autowired 40 @Autowired
40 private ISysMonitorMetricInfoService sysMonitorMetricInfoService; 41 private ISysMonitorMetricInfoService sysMonitorMetricInfoService;
41 42
43 private static String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
44 private static String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
45
42 @Override 46 @Override
43 public List<WaterQualityMonitoringDetailVO> queryMonitoringData(String departId) { 47 public List<WaterQualityMonitoringDetailVO> queryMonitoringData(String departId) {
44 List<WaterQualityMonitoringDetailVO> list = new ArrayList<>(); 48 List<WaterQualityMonitoringDetailVO> list = new ArrayList<>();
...@@ -188,11 +192,9 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { ...@@ -188,11 +192,9 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
188 192
189 @Override 193 @Override
190 public Map<String, Object> getData(String departId,String month) { 194 public Map<String, Object> getData(String departId,String month) {
191 String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
192 String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
193 Map<String, Object> map = new HashMap<>(); 195 Map<String, Object> map = new HashMap<>();
194 String monthTb = getTbMonth(month); 196 String monthTb = DateUtils.getTbMonth(month);
195 String monthHb = getHbMonth(month); 197 String monthHb = DateUtils.getHbMonth(month);
196 String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,"DLHJ,WNL", departId, month); 198 String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,"DLHJ,WNL", departId, month);
197 String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, month); 199 String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, month);
198 Map<String, Object> valueMap = factoryCenterMapper.getData(month, departId, dataViewName3a24, dataViewName2119); 200 Map<String, Object> valueMap = factoryCenterMapper.getData(month, departId, dataViewName3a24, dataViewName2119);
...@@ -285,45 +287,19 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { ...@@ -285,45 +287,19 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
285 return map; 287 return map;
286 } 288 }
287 289
288 /**
289 * 同比
290 * @param month
291 * @return
292 */
293 public static String getTbMonth(String month) {
294 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
295 YearMonth yearMonth = YearMonth.parse(month, formatter);
296 YearMonth sameMonthLastYear = yearMonth.minusYears(1);
297 return sameMonthLastYear.format(formatter); // 同比
298 }
299
300 /**
301 * 环比
302 * @param month
303 * @return
304 */
305 public static String getHbMonth(String month) {
306 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
307 YearMonth yearMonth = YearMonth.parse(month, formatter);
308 YearMonth previousMonth = yearMonth.minusMonths(1);
309 return previousMonth.format(formatter); // 环比
310 }
311
312 @Override 290 @Override
313 public List<Map<String, Object>> getCnltj(StatisticsParam statisticsParam) { 291 public List<Map<String, Object>> getCnltj(StatisticsParam statisticsParam) {
314 String wnReport = "3a243d5715b9e1a3753c180872ca0df9";
315 String slReport = "2119ecbf53a1d2d0708258ff67cfd9e1";
316 List<Map<String, Object>> list = new ArrayList<>(); 292 List<Map<String, Object>> list = new ArrayList<>();
317 String startDate = statisticsParam.getStartDate(); 293 String startDate = statisticsParam.getStartDate();
318 String endDate = statisticsParam.getEndDate(); 294 String endDate = statisticsParam.getEndDate();
319 String startDateTb = "2023-01-01"; 295 String startDateTb = DateUtils.getTbDate(startDate);
320 String endDateTb = "2023-09-31"; 296 String endDateTb = DateUtils.getTbDate(endDate);
321 String view3a24 = ReportViewUtil.buildView(wnReport, "WNL", statisticsParam.getDepartId(), startDate,endDate); 297 String dataView3a24 = ReportViewUtil.buildView(view3a24, "WNL", statisticsParam.getDepartId(), startDate,endDate);
322 String view3a24tb = ReportViewUtil.buildView(wnReport, "WNL", statisticsParam.getDepartId(), startDateTb,endDateTb); 298 String dataView3a24tb = ReportViewUtil.buildView(view3a24, "WNL", statisticsParam.getDepartId(), startDateTb,endDateTb);
323 String view2119 = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDate,endDate); 299 String dataView2119 = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDate,endDate);
324 String view2119tb = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb); 300 String dataView2119tb = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
325 list = factoryCenterMapper.getCnltj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(), 301 list = factoryCenterMapper.getCnltj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),
326 view3a24,view3a24tb,view2119,view2119tb); 302 dataView3a24,dataView3a24tb,dataView2119,dataView2119tb);
327 if(list.size() == 0){ 303 if(list.size() == 0){
328 List<String> monthList = getMonthsBetween(startDate,endDate); 304 List<String> monthList = getMonthsBetween(startDate,endDate);
329 for ( String month : monthList ) { 305 for ( String month : monthList ) {
...@@ -341,19 +317,17 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { ...@@ -341,19 +317,17 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
341 317
342 @Override 318 @Override
343 public List<Map<String, Object>> getHdltj(StatisticsParam statisticsParam) { 319 public List<Map<String, Object>> getHdltj(StatisticsParam statisticsParam) {
344 String wnReport = "3a243d5715b9e1a3753c180872ca0df9";
345 String slReport = "2119ecbf53a1d2d0708258ff67cfd9e1";
346 List<Map<String, Object>> list = new ArrayList<>(); 320 List<Map<String, Object>> list = new ArrayList<>();
347 String startDate = statisticsParam.getStartDate(); 321 String startDate = statisticsParam.getStartDate();
348 String endDate = statisticsParam.getEndDate(); 322 String endDate = statisticsParam.getEndDate();
349 String startDateTb = "2023-01-01"; 323 String startDateTb = DateUtils.getTbDate(startDate);
350 String endDateTb = "2023-09-31"; 324 String endDateTb = DateUtils.getTbDate(endDate);
351 String view3a24 = ReportViewUtil.buildView(wnReport, "DLHJ", statisticsParam.getDepartId(), startDate,endDate); 325 String dataView3a24 = ReportViewUtil.buildView(view3a24, "DLHJ", statisticsParam.getDepartId(), startDate,endDate);
352 String view3a24tb = ReportViewUtil.buildView(wnReport, "DLHJ", statisticsParam.getDepartId(), startDateTb,endDateTb); 326 String dataView3a24tb = ReportViewUtil.buildView(view3a24, "DLHJ", statisticsParam.getDepartId(), startDateTb,endDateTb);
353 String view2119 = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDate,endDate); 327 String dataView2119 = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDate,endDate);
354 String view2119tb = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb); 328 String dataView2119tb = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
355 list = factoryCenterMapper.getHdltj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(), 329 list = factoryCenterMapper.getHdltj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),
356 view3a24,view3a24tb,view2119,view2119tb); 330 dataView3a24,dataView3a24tb,dataView2119,dataView2119tb);
357 if(list.size() == 0){ 331 if(list.size() == 0){
358 List<String> monthList = getMonthsBetween(startDate,endDate); 332 List<String> monthList = getMonthsBetween(startDate,endDate);
359 for ( String month : monthList ) { 333 for ( String month : monthList ) {
...@@ -371,15 +345,14 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { ...@@ -371,15 +345,14 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
371 345
372 @Override 346 @Override
373 public List<Map<String, Object>> getWssltj(StatisticsParam statisticsParam) { 347 public List<Map<String, Object>> getWssltj(StatisticsParam statisticsParam) {
374 String slReport = "2119ecbf53a1d2d0708258ff67cfd9e1";
375 List<Map<String, Object>> list = new ArrayList<>(); 348 List<Map<String, Object>> list = new ArrayList<>();
376 String startDate = statisticsParam.getStartDate(); 349 String startDate = statisticsParam.getStartDate();
377 String endDate = statisticsParam.getEndDate(); 350 String endDate = statisticsParam.getEndDate();
378 String startDateTb = "2023-01-01"; 351 String startDateTb = DateUtils.getTbDate(startDate);
379 String endDateTb = "2023-12-31"; 352 String endDateTb = DateUtils.getTbDate(endDate);
380 String view2119 = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDate,endDate); 353 String dataView2119 = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDate,endDate);
381 String view2119tb = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb); 354 String dataView2119tb = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
382 list = factoryCenterMapper.getWssltj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),view2119,view2119tb); 355 list = factoryCenterMapper.getWssltj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),dataView2119,dataView2119tb);
383 if(list.size() == 0){ 356 if(list.size() == 0){
384 List<String> monthList = getMonthsBetween(startDate,endDate); 357 List<String> monthList = getMonthsBetween(startDate,endDate);
385 for ( String month : monthList ) { 358 for ( String month : monthList ) {
...@@ -395,16 +368,15 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { ...@@ -395,16 +368,15 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
395 368
396 @Override 369 @Override
397 public List<Map<String, Object>> getYhtj(StatisticsParam statisticsParam) { 370 public List<Map<String, Object>> getYhtj(StatisticsParam statisticsParam) {
398 String yjReport = "3a243d5715b9e1a3753c180872ca0df9";
399 List<Map<String, Object>> list = new ArrayList<>(); 371 List<Map<String, Object>> list = new ArrayList<>();
400 String startDate = statisticsParam.getStartDate(); 372 String startDate = statisticsParam.getStartDate();
401 String endDate = statisticsParam.getEndDate(); 373 String endDate = statisticsParam.getEndDate();
402 String startDateTb = "2023-01-01"; 374 String startDateTb = DateUtils.getTbDate(startDate);
403 String endDateTb = "2023-12-31"; 375 String endDateTb = DateUtils.getTbDate(endDate);
404 String yjField = "PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ,YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2"; 376 String yjField = "PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ,YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2";
405 String view3a24 = ReportViewUtil.buildView(yjReport, yjField, statisticsParam.getDepartId(), startDate,endDate); 377 String dataView3a24 = ReportViewUtil.buildView(view3a24, yjField, statisticsParam.getDepartId(), startDate,endDate);
406 String view3a24tb = ReportViewUtil.buildView(yjReport, yjField, statisticsParam.getDepartId(), startDateTb,endDateTb); 378 String dataView3a24tb = ReportViewUtil.buildView(view3a24, yjField, statisticsParam.getDepartId(), startDateTb,endDateTb);
407 list = factoryCenterMapper.getYhtj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),view3a24,view3a24tb); 379 list = factoryCenterMapper.getYhtj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),dataView3a24,dataView3a24tb);
408 if(list.size() == 0){ 380 if(list.size() == 0){
409 List<String> monthList = getMonthsBetween(startDate,endDate); 381 List<String> monthList = getMonthsBetween(startDate,endDate);
410 for ( String month : monthList ) { 382 for ( String month : monthList ) {
...@@ -453,6 +425,7 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { ...@@ -453,6 +425,7 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
453 425
454 @Override 426 @Override
455 public Map<String, Object> getHourWaterData(StatisticsParam statisticsParam) { 427 public Map<String, Object> getHourWaterData(StatisticsParam statisticsParam) {
428 SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
456 Map<String, Object> map = new HashMap<>(); 429 Map<String, Object> map = new HashMap<>();
457 Map<String, Object> dataMap = new HashMap<>(); 430 Map<String, Object> dataMap = new HashMap<>();
458 Map<String, Object> chartsMap = new HashMap<>(); 431 Map<String, Object> chartsMap = new HashMap<>();
...@@ -489,7 +462,7 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { ...@@ -489,7 +462,7 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
489 if (!CollectionUtils.isEmpty(list1)) { 462 if (!CollectionUtils.isEmpty(list1)) {
490 // Map<String, Object> map1 = list1.get(0); 463 // Map<String, Object> map1 = list1.get(0);
491 for (Map<String, Object> map1 : list1) { 464 for (Map<String, Object> map1 : list1) {
492 String time = DateUtils.date2Str(new Date(Long.parseLong(map1.get("time").toString()) * 1000), DateUtils.datetimeFormat); 465 String time = DateUtils.date2Str(new Date(Long.parseLong(map1.get("time").toString()) * 1000), datetimeFormat);
493 xlist.add(time); 466 xlist.add(time);
494 String jscod; 467 String jscod;
495 if (!org.apache.commons.lang3.StringUtils.isEmpty(jscod = fieldsMap.get("JSCOD"))) { 468 if (!org.apache.commons.lang3.StringUtils.isEmpty(jscod = fieldsMap.get("JSCOD"))) {
...@@ -581,4 +554,5 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { ...@@ -581,4 +554,5 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
581 } 554 }
582 return months; 555 return months;
583 } 556 }
557
584 } 558 }
......
...@@ -109,5 +109,12 @@ public interface FReportItemvMapper extends BaseMapper<FReportItemv> { ...@@ -109,5 +109,12 @@ public interface FReportItemvMapper extends BaseMapper<FReportItemv> {
109 * @param monthHb 109 * @param monthHb
110 * @return 110 * @return
111 */ 111 */
112 List<DepartDrugDataVO> getYhList(String month, String monthTb, String monthHb); 112 List<DepartDrugDataVO> getYhList(@Param("month") String month, @Param("monthTb") String monthTb, @Param("monthHb") String monthHb,
113 @Param("dataViewName2119") String dataViewName2119, @Param("dataViewName2119tb") String dataViewName2119tb,
114 @Param("dataViewName2119hb") String dataViewName2119hb, @Param("dataViewName3a24") String dataViewName3a24,
115 @Param("dataViewName3a24tb") String dataViewName3a24tb, @Param("dataViewName3a24hb") String dataViewName3a24hb);
116
117 DepartDrugResult getYhData(@Param("month") String month, @Param("monthTb") String monthTb, @Param("monthHb") String monthHb,
118 @Param("dataViewName3a24") String dataViewName3a24,@Param("dataViewName3a24tb") String dataViewName3a24tb,
119 @Param("dataViewName3a24hb") String dataViewName3a24hb);
113 } 120 }
......
...@@ -153,8 +153,150 @@ ...@@ -153,8 +153,150 @@
153 </select> 153 </select>
154 154
155 <select id="getYhList" resultType="com.skua.modules.report.vo.DepartDrugDataVO"> 155 <select id="getYhList" resultType="com.skua.modules.report.vo.DepartDrugDataVO">
156 select d.id AS depart_id,d.depart_name,'0' as yjdh,'0' as yjdh_tb,'0' as yjdh_hb from sys_depart d 156 SELECT
157 where d.depart_type = '1' 157 d.id AS depart_id,
158 d.depart_name,
159 IFNULL(dh.yjdh,0) AS yjdh,
160 IFNULL(dhtb.yjdh,0) AS yjdh_tb,
161 IFNULL(dhhb.yjdh,0) AS yjdh_hb
162 FROM
163 sys_depart d
164 LEFT JOIN (
165 SELECT
166 v3.depart_id,
167 ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
168 SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+
169 SUM( IFNULL( v3.PFS, 0 ) )+SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+
170 SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+SUM( IFNULL( v3.CH3COONA, 0 ) )+
171 SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
172 SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
173 SUM( IFNULL( v3.H2O2, 0 ) ))/v2.clsl,4) AS yjdh
174 FROM
175 ${dataViewName3a24} v3
176 LEFT JOIN (
177 SELECT
178 v.depart_id,
179 SUM( IFNULL( v.CSL, 0 ) ) AS clsl
180 FROM
181 ${dataViewName2119} v
182 WHERE
183 LEFT ( v.time, 7 ) = #{month}
184 GROUP BY
185 v.depart_id
186 ) v2 ON v2.depart_id = v3.depart_id
187 WHERE
188 LEFT ( v3.time, 7 ) = #{month}
189 GROUP BY
190 v3.depart_id
191 ) dh ON dh.depart_id = d.id
192 LEFT JOIN (
193 SELECT
194 v3.depart_id,
195 ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
196 SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+
197 SUM( IFNULL( v3.PFS, 0 ) )+SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+
198 SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+SUM( IFNULL( v3.CH3COONA, 0 ) )+
199 SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
200 SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
201 SUM( IFNULL( v3.H2O2, 0 ) ))/v2.clsl,4) AS yjdh
202 FROM
203 ${dataViewName3a24tb} v3
204 LEFT JOIN (
205 SELECT
206 v.depart_id,
207 SUM( IFNULL( v.CSL, 0 ) ) AS clsl
208 FROM
209 ${dataViewName2119tb} v
210 WHERE
211 LEFT ( v.time, 7 ) = #{monthTb}
212 GROUP BY
213 v.depart_id
214 ) v2 ON v2.depart_id = v3.depart_id
215 WHERE
216 LEFT ( v3.time, 7 ) = #{monthTb}
217 GROUP BY
218 v3.depart_id
219 ) dhtb ON dhtb.depart_id = d.id
220 LEFT JOIN (
221 SELECT
222 v3.depart_id,
223 ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
224 SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+SUM( IFNULL( v3.PFS, 0 ) )+
225 SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+
226 SUM( IFNULL( v3.CH3COONA, 0 ) )+SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
227 SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
228 SUM( IFNULL( v3.H2O2, 0 ) ))/v2.clsl,4) AS yjdh
229 FROM
230 ${dataViewName3a24hb} v3
231 LEFT JOIN (
232 SELECT
233 v.depart_id,
234 SUM( IFNULL( v.CSL, 0 ) ) AS clsl
235 FROM
236 ${dataViewName2119hb} v
237 WHERE
238 LEFT ( v.time, 7 ) = #{monthHb}
239 GROUP BY
240 v.depart_id
241 ) v2 ON v2.depart_id = v3.depart_id
242 WHERE
243 LEFT ( v3.time, 7 ) = #{monthHb}
244 GROUP BY
245 v3.depart_id
246 ) dhhb ON dhhb.depart_id = d.id
247 WHERE
248 d.depart_type = '1'
249 ORDER BY dh.yjdh desc,d.depart_order
250 </select>
251 <select id="getYhData" resultType="com.skua.modules.report.vo.DepartDrugResult">
252 SELECT
253 IFNULL(dh.yjdh,0) AS zyh,
254 IFNULL(dhtb.yjdh,0) AS zyh_tb,
255 IFNULL(dhhb.yjdh,0) AS zyh_hb
256 FROM
257 (
258 SELECT
259 'zyh' type,
260 ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
261 SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+
262 SUM( IFNULL( v3.PFS, 0 ) )+SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+
263 SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+SUM( IFNULL( v3.CH3COONA, 0 ) )+
264 SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
265 SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
266 SUM( IFNULL( v3.H2O2, 0 ) )),0) AS yjdh
267 FROM
268 ${dataViewName3a24} v3
269 WHERE
270 LEFT ( v3.time, 7 ) = #{month}
271 ) dh
272 LEFT JOIN (
273 SELECT
274 'zyh' type,
275 ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
276 SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+
277 SUM( IFNULL( v3.PFS, 0 ) )+SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+
278 SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+SUM( IFNULL( v3.CH3COONA, 0 ) )+
279 SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
280 SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
281 SUM( IFNULL( v3.H2O2, 0 ) )),0) AS yjdh
282 FROM
283 ${dataViewName3a24tb} v3
284 WHERE
285 LEFT ( v3.time, 7 ) = #{monthTb}
286 ) dhtb ON dhtb.type = dh.type
287 LEFT JOIN (
288 SELECT
289 'zyh' type,
290 ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
291 SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+SUM( IFNULL( v3.PFS, 0 ) )+
292 SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+
293 SUM( IFNULL( v3.CH3COONA, 0 ) )+SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
294 SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
295 SUM( IFNULL( v3.H2O2, 0 ) )),0) AS yjdh
296 FROM
297 ${dataViewName3a24hb} v3
298 WHERE
299 LEFT ( v3.time, 7 ) = #{monthHb}
300 ) dhhb ON dhhb.type = dh.type
158 </select> 301 </select>
159
160 </mapper> 302 </mapper>
......
...@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
9 import com.skua.modules.alarmtmp.entity.AlarmParamStandardConfig; 9 import com.skua.modules.alarmtmp.entity.AlarmParamStandardConfig;
10 import com.skua.modules.system.vo.SysFactoryInfo.*; 10 import com.skua.modules.system.vo.SysFactoryInfo.*;
11 import com.skua.modules.system.vo.SysFactoryInfoNewVO; 11 import com.skua.modules.system.vo.SysFactoryInfoNewVO;
12 import com.skua.tool.annotation.Anonymous;
12 import org.apache.ibatis.annotations.Param; 13 import org.apache.ibatis.annotations.Param;
13 14
14 import com.baomidou.mybatisplus.core.mapper.BaseMapper; 15 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -88,6 +89,7 @@ public interface SysFactoryInfoMapper extends BaseMapper<SysFactoryInfo> { ...@@ -88,6 +89,7 @@ public interface SysFactoryInfoMapper extends BaseMapper<SysFactoryInfo> {
88 89
89 List<Map<String, Object>> queryUpLow(@Param("id") String id); 90 List<Map<String, Object>> queryUpLow(@Param("id") String id);
90 91
92 @Anonymous
91 @Select("SELECT d.id as depart_id, d.depart_name AS name,d.depart_name AS depart_name,d.depart_type," + 93 @Select("SELECT d.id as depart_id, d.depart_name AS name,d.depart_name AS depart_name,d.depart_type," +
92 "(select depart_name from sys_depart sd where d.parent_id = sd.id ) areaName,f.* " + 94 "(select depart_name from sys_depart sd where d.parent_id = sd.id ) areaName,f.* " +
93 "FROM sys_depart d " + 95 "FROM sys_depart d " +
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!