Merge remote-tracking branch 'origin/master'
正在显示
11 个修改的文件
包含
194 行增加
和
54 行删除
... | @@ -2,7 +2,7 @@ package com.skua.modules.dataAnalysis.controller; | ... | @@ -2,7 +2,7 @@ package com.skua.modules.dataAnalysis.controller; |
2 | 2 | ||
3 | import com.skua.core.api.vo.Result; | 3 | import com.skua.core.api.vo.Result; |
4 | import com.skua.core.aspect.annotation.AutoLog; | 4 | import com.skua.core.aspect.annotation.AutoLog; |
5 | import com.skua.modules.dataAnalysis.service.impl.WaterAnalysisNewService; | 5 | import com.skua.modules.dataAnalysis.service.WaterAnalysisNewService; |
6 | import io.swagger.annotations.Api; | 6 | import io.swagger.annotations.Api; |
7 | import io.swagger.annotations.ApiOperation; | 7 | import io.swagger.annotations.ApiOperation; |
8 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; | ... | ... |
sk-module-datafill/src/main/java/com/skua/modules/dataAnalysis/mapper/xml/WaterAnalysisNewMapper.xml
... | @@ -343,7 +343,7 @@ | ... | @@ -343,7 +343,7 @@ |
343 | IFNULL( a.totalCount, 0 ) AS totalCount | 343 | IFNULL( a.totalCount, 0 ) AS totalCount |
344 | FROM | 344 | FROM |
345 | sys_factory_info sfi | 345 | sys_factory_info sfi |
346 | LEFT JOIN alarm_level_standard_config alsc ON alsc.alarm_standard_level_code = sfi.out_level | 346 | LEFT JOIN alarm_level_standard_config alsc ON alsc.id = sfi.out_level |
347 | LEFT JOIN sys_depart d ON sfi.depart_id = d.id | 347 | LEFT JOIN sys_depart d ON sfi.depart_id = d.id |
348 | LEFT JOIN ( | 348 | LEFT JOIN ( |
349 | SELECT | 349 | SELECT | ... | ... |
... | @@ -7,7 +7,7 @@ import com.skua.core.api.vo.DictModel; | ... | @@ -7,7 +7,7 @@ import com.skua.core.api.vo.DictModel; |
7 | import com.skua.core.context.BaseContextHandler; | 7 | import com.skua.core.context.BaseContextHandler; |
8 | import com.skua.core.util.DateUtils; | 8 | import com.skua.core.util.DateUtils; |
9 | import com.skua.modules.dataAnalysis.mapper.WaterAnalysisNewMapper; | 9 | import com.skua.modules.dataAnalysis.mapper.WaterAnalysisNewMapper; |
10 | import com.skua.modules.dataAnalysis.service.impl.WaterAnalysisNewService; | 10 | import com.skua.modules.dataAnalysis.service.WaterAnalysisNewService; |
11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
13 | 13 | ||
... | @@ -17,18 +17,14 @@ import java.util.concurrent.atomic.AtomicReference; | ... | @@ -17,18 +17,14 @@ import java.util.concurrent.atomic.AtomicReference; |
17 | @Service | 17 | @Service |
18 | public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { | 18 | public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { |
19 | private static String REPOART_ID_HY = "9bffaf9187093d6e6a4390e8c56acca8"; | 19 | private static String REPOART_ID_HY = "9bffaf9187093d6e6a4390e8c56acca8"; |
20 | private static String FACTORYIDS = "1519193830953553920,1519200041706954752,1816759403152666624,1818214145808531456,1818214519948836864," + | ||
21 | " 1818214642204409856,1818214704200417280,1818214745841467392,1818214781186867200,1818214830096646144,1818214870622011392," + | ||
22 | " 1818214905388597248,1818214961122508800,1818215007217909760,1818215052952600576,1818215093192753152,1818215141427249152," + | ||
23 | " 1818215178001580032,1818215228744269824,1818215268359471104,1818215307165171712,1818215363477897216,1818215411217465344"; | ||
24 | @Autowired | 20 | @Autowired |
25 | private WaterAnalysisNewMapper waterAnalysisNewMapper; | 21 | private WaterAnalysisNewMapper waterAnalysisNewMapper; |
26 | @Override | 22 | @Override |
27 | public Map<String, Object> queryTotalBySummary(String time) { | 23 | public Map<String, Object> queryTotalBySummary(String time) { |
28 | Map<String, Object> result = Maps.newHashMap(); | 24 | Map<String, Object> result = Maps.newHashMap(); |
29 | // String departIds = BaseContextHandler.getDeparts(); | 25 | String departIds = BaseContextHandler.getDeparts(); |
30 | List<Map<String, Object>> facs = waterAnalysisNewMapper.queryTotalBySummary(time,FACTORYIDS); | 26 | List<Map<String, Object>> facs = waterAnalysisNewMapper.queryTotalBySummary(time,departIds); |
31 | Long facCount = waterAnalysisNewMapper.queryTotalCount(FACTORYIDS); | 27 | Long facCount = waterAnalysisNewMapper.queryTotalCount(departIds); |
32 | Long summaryCount = facCount; | 28 | Long summaryCount = facCount; |
33 | Long noSummaryCount = 0L; | 29 | Long noSummaryCount = 0L; |
34 | StringBuilder facInfo = new StringBuilder(); | 30 | StringBuilder facInfo = new StringBuilder(); |
... | @@ -67,10 +63,10 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { | ... | @@ -67,10 +63,10 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { |
67 | 63 | ||
68 | @Override | 64 | @Override |
69 | public List<Map<String, Object>> queryFacListWaterQCL(String time) { | 65 | public List<Map<String, Object>> queryFacListWaterQCL(String time) { |
70 | // String factoryIds = BaseContextHandler.getDeparts(); | 66 | String departIds = BaseContextHandler.getDeparts(); |
71 | List<Map<String, Object>> result = Lists.newArrayList(); | 67 | List<Map<String, Object>> result = Lists.newArrayList(); |
72 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_HY,"CSCOD,CSTN,CSZL,CSAD,JSCOD,JSZD,JSZL,JSAD", FACTORYIDS, time); | 68 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_HY,"CSCOD,CSTN,CSZL,CSAD,JSCOD,JSZD,JSZL,JSAD", departIds, time); |
73 | List<Map<String, Object>> list = waterAnalysisNewMapper.queryAllFactoryList(time,FACTORYIDS,dataViewName); | 69 | List<Map<String, Object>> list = waterAnalysisNewMapper.queryAllFactoryList(time,departIds,dataViewName); |
74 | if (list != null) { | 70 | if (list != null) { |
75 | for (Map<String, Object> map : list) { | 71 | for (Map<String, Object> map : list) { |
76 | Double jsCODAvgSum = Double.parseDouble(map.get("jscod").toString()); | 72 | Double jsCODAvgSum = Double.parseDouble(map.get("jscod").toString()); |
... | @@ -110,9 +106,9 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { | ... | @@ -110,9 +106,9 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { |
110 | @Override | 106 | @Override |
111 | public Map<String, Object> queryWaterQCL(String time) { | 107 | public Map<String, Object> queryWaterQCL(String time) { |
112 | Map<String, Object> result = Maps.newHashMap(); | 108 | Map<String, Object> result = Maps.newHashMap(); |
113 | // String factoryIds = BaseContextHandler.getDeparts(); | 109 | String departIds = BaseContextHandler.getDeparts(); |
114 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_HY,"CSCOD,CSTN,CSZL,CSAD,JSCOD,JSZD,JSZL,JSAD", FACTORYIDS, time); | 110 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_HY,"CSCOD,CSTN,CSZL,CSAD,JSCOD,JSZD,JSZL,JSAD", departIds, time); |
115 | result = waterAnalysisNewMapper.queryAvgQcl(dataViewName, time, FACTORYIDS); | 111 | result = waterAnalysisNewMapper.queryAvgQcl(dataViewName, time, departIds); |
116 | if(result==null){ | 112 | if(result==null){ |
117 | result = new HashMap<>(); | 113 | result = new HashMap<>(); |
118 | result.put("COD", 0.00); | 114 | result.put("COD", 0.00); |
... | @@ -124,7 +120,7 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { | ... | @@ -124,7 +120,7 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { |
124 | } | 120 | } |
125 | @Override | 121 | @Override |
126 | public List<Map<String, Object>> queryCSAnalysis(String time) { | 122 | public List<Map<String, Object>> queryCSAnalysis(String time) { |
127 | // String factoryIds = BaseContextHandler.getDeparts(); | 123 | String departIds = BaseContextHandler.getDeparts(); |
128 | //获取负荷比例 | 124 | //获取负荷比例 |
129 | List<DictModel> fhData = waterAnalysisNewMapper.queryDictItemsByCode("water_analysis_proportion"); | 125 | List<DictModel> fhData = waterAnalysisNewMapper.queryDictItemsByCode("water_analysis_proportion"); |
130 | Double low = 0.0; | 126 | Double low = 0.0; |
... | @@ -143,7 +139,7 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { | ... | @@ -143,7 +139,7 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { |
143 | Double finalUp = up; | 139 | Double finalUp = up; |
144 | data.forEach(v -> { | 140 | data.forEach(v -> { |
145 | String code = (String) v.get("id"); | 141 | String code = (String) v.get("id"); |
146 | List<Double> datan = waterAnalysisNewMapper.queryAvgByCode(code, time, FACTORYIDS); | 142 | List<Double> datan = waterAnalysisNewMapper.queryAvgByCode(code, time, departIds); |
147 | if (datan != null && datan.size() > 0) { | 143 | if (datan != null && datan.size() > 0) { |
148 | DoubleSummaryStatistics statistics = datan.stream().mapToDouble(Number::doubleValue).summaryStatistics(); | 144 | DoubleSummaryStatistics statistics = datan.stream().mapToDouble(Number::doubleValue).summaryStatistics(); |
149 | //取最大值 | 145 | //取最大值 |
... | @@ -168,18 +164,18 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { | ... | @@ -168,18 +164,18 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { |
168 | @Override | 164 | @Override |
169 | public List<Map<String, Object>> queryNoSummaryList(String time) { | 165 | public List<Map<String, Object>> queryNoSummaryList(String time) { |
170 | Map<String, Map<String, Object>> tmpMap = Maps.newHashMap(); | 166 | Map<String, Map<String, Object>> tmpMap = Maps.newHashMap(); |
171 | // String factoryIds = BaseContextHandler.getDeparts(); | 167 | String departIds = BaseContextHandler.getDeparts(); |
172 | List<Map<String, Object>> facs = new ArrayList<>(); | 168 | List<Map<String, Object>> facs = new ArrayList<>(); |
173 | facs = waterAnalysisNewMapper.queryNewFacList(time,FACTORYIDS); | 169 | facs = waterAnalysisNewMapper.queryNewFacList(time,departIds); |
174 | return facs; | 170 | return facs; |
175 | } | 171 | } |
176 | 172 | ||
177 | @Override | 173 | @Override |
178 | public Map<String, Object> queryNewSummaryCount(String time) { | 174 | public Map<String, Object> queryNewSummaryCount(String time) { |
179 | // String factoryIds = BaseContextHandler.getDeparts(); | 175 | String departIds = BaseContextHandler.getDeparts(); |
180 | Map<String, Object> csbzCharData = Maps.newHashMap(); | 176 | Map<String, Object> csbzCharData = Maps.newHashMap(); |
181 | //上个月DateUtils.getLastMonthOfMonth(time) | 177 | //上个月DateUtils.getLastMonthOfMonth(time) |
182 | List<Map<String, Object>> maps = waterAnalysisNewMapper.queryNewSummaryCount(time,FACTORYIDS); | 178 | List<Map<String, Object>> maps = waterAnalysisNewMapper.queryNewSummaryCount(time,departIds); |
183 | List<String> names = Lists.newArrayList(); | 179 | List<String> names = Lists.newArrayList(); |
184 | List<Long> data = Lists.newArrayList(); | 180 | List<Long> data = Lists.newArrayList(); |
185 | List<Long> max = Lists.newArrayList(); | 181 | List<Long> max = Lists.newArrayList(); |
... | @@ -307,8 +303,8 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { | ... | @@ -307,8 +303,8 @@ public class WaterAnalysisNewServiceImpl implements WaterAnalysisNewService { |
307 | } | 303 | } |
308 | @Override | 304 | @Override |
309 | public List<Map<String, Object>> queryFacListBySummary(String time) { | 305 | public List<Map<String, Object>> queryFacListBySummary(String time) { |
310 | // String factoryIds = BaseContextHandler.getDeparts(); | 306 | String departIds = BaseContextHandler.getDeparts(); |
311 | List<Map<String, Object>> maps = waterAnalysisNewMapper.queryFacListBySummary(time, DateUtils.getDayCountOfMonth(time),FACTORYIDS); | 307 | List<Map<String, Object>> maps = waterAnalysisNewMapper.queryFacListBySummary(time, DateUtils.getDayCountOfMonth(time),departIds); |
312 | maps.forEach(v -> { | 308 | maps.forEach(v -> { |
313 | Double db = Double.parseDouble(String.valueOf(v.get("db"))); | 309 | Double db = Double.parseDouble(String.valueOf(v.get("db"))); |
314 | if (db < 90) { | 310 | if (db < 90) { | ... | ... |
... | @@ -20,25 +20,21 @@ import java.util.Map; | ... | @@ -20,25 +20,21 @@ import java.util.Map; |
20 | @Service | 20 | @Service |
21 | public class WaterCountAnalysisNewServiceImpl implements WaterCountAnalysisNewService { | 21 | public class WaterCountAnalysisNewServiceImpl implements WaterCountAnalysisNewService { |
22 | private static String REPOART_ID_SL = "2119ecbf53a1d2d0708258ff67cfd9e1"; | 22 | private static String REPOART_ID_SL = "2119ecbf53a1d2d0708258ff67cfd9e1"; |
23 | private static String FACTORYIDS = "1519193830953553920,1519200041706954752,1816759403152666624,1818214145808531456,1818214519948836864," + | ||
24 | " 1818214642204409856,1818214704200417280,1818214745841467392,1818214781186867200,1818214830096646144,1818214870622011392," + | ||
25 | " 1818214905388597248,1818214961122508800,1818215007217909760,1818215052952600576,1818215093192753152,1818215141427249152," + | ||
26 | " 1818215178001580032,1818215228744269824,1818215268359471104,1818215307165171712,1818215363477897216,1818215411217465344"; | ||
27 | @Autowired | 23 | @Autowired |
28 | private WaterCountAnalysisNewMapper waterCountAnalysisNewMapper; | 24 | private WaterCountAnalysisNewMapper waterCountAnalysisNewMapper; |
29 | @Autowired | 25 | @Autowired |
30 | private ISysMonitorMetricInfoService sysMonitorMetricInfoService; | 26 | private ISysMonitorMetricInfoService sysMonitorMetricInfoService; |
31 | @Override | 27 | @Override |
32 | public Map<String, Object> querySLDeatailList(String startTime, String endTime) { | 28 | public Map<String, Object> querySLDeatailList(String startTime, String endTime) { |
33 | // String factoryIds = BaseContextHandler.getDeparts(); | 29 | String departIds = BaseContextHandler.getDeparts(); |
34 | DecimalFormat df = new DecimalFormat("#.##"); | 30 | DecimalFormat df = new DecimalFormat("#.##"); |
35 | Map<String, Object> result = Maps.newHashMap(); | 31 | Map<String, Object> result = Maps.newHashMap(); |
36 | Map<String, List<Map<String, Object>>> tmp = Maps.newTreeMap(); | 32 | Map<String, List<Map<String, Object>>> tmp = Maps.newTreeMap(); |
37 | List<String> list = DateUtils.sliceUpDateRange(startTime, endTime, "year"); | 33 | List<String> list = DateUtils.sliceUpDateRange(startTime, endTime, "year"); |
38 | String dataViewName = ReportViewUtil.buildView(REPOART_ID_SL,"CSL", FACTORYIDS, startTime, endTime); | 34 | String dataViewName = ReportViewUtil.buildView(REPOART_ID_SL,"CSL", departIds, startTime, endTime); |
39 | //查询年度水量数据 | 35 | //查询年度水量数据 |
40 | List<Map<String, Object>> facLists = waterCountAnalysisNewMapper.queryFacLists("",FACTORYIDS); | 36 | List<Map<String, Object>> facLists = waterCountAnalysisNewMapper.queryFacLists("",departIds); |
41 | List<Map<String, Object>> data = waterCountAnalysisNewMapper.queryTimesSLDataByFac(dataViewName, startTime, endTime, FACTORYIDS); | 37 | List<Map<String, Object>> data = waterCountAnalysisNewMapper.queryTimesSLDataByFac(dataViewName, startTime, endTime, departIds); |
42 | if (data != null && data.size() > 0) { | 38 | if (data != null && data.size() > 0) { |
43 | data.forEach(v -> { | 39 | data.forEach(v -> { |
44 | String ti = (String) v.get("time"); | 40 | String ti = (String) v.get("time"); |
... | @@ -87,19 +83,19 @@ public class WaterCountAnalysisNewServiceImpl implements WaterCountAnalysisNewSe | ... | @@ -87,19 +83,19 @@ public class WaterCountAnalysisNewServiceImpl implements WaterCountAnalysisNewSe |
87 | 83 | ||
88 | @Override | 84 | @Override |
89 | public List<Map<String, Object>> queryZLSAnalysis(String time) { | 85 | public List<Map<String, Object>> queryZLSAnalysis(String time) { |
90 | // String factoryIds = BaseContextHandler.getDeparts(); | 86 | String departIds = BaseContextHandler.getDeparts(); |
91 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"JSL,CSL", FACTORYIDS, time); | 87 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"JSL,CSL", departIds, time); |
92 | List<Map<String, Object>> list = new ArrayList<>(); | 88 | List<Map<String, Object>> list = new ArrayList<>(); |
93 | list = waterCountAnalysisNewMapper.queryZLSAnalysis(dataViewName, time, FACTORYIDS); | 89 | list = waterCountAnalysisNewMapper.queryZLSAnalysis(dataViewName, time, departIds); |
94 | return list; | 90 | return list; |
95 | } | 91 | } |
96 | 92 | ||
97 | @Override | 93 | @Override |
98 | public Map<String, Object> querySLFHLAnalysis(String time) { | 94 | public Map<String, Object> querySLFHLAnalysis(String time) { |
99 | // String factoryIds = BaseContextHandler.getDeparts(); | 95 | String departIds = BaseContextHandler.getDeparts(); |
100 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", FACTORYIDS, time); | 96 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", departIds, time); |
101 | Map<String, Object> result = Maps.newHashMap(); | 97 | Map<String, Object> result = Maps.newHashMap(); |
102 | List<Map<String, Object>> mets = waterCountAnalysisNewMapper.queryWaterListAllByMonth(dataViewName, time, FACTORYIDS); | 98 | List<Map<String, Object>> mets = waterCountAnalysisNewMapper.queryWaterListAllByMonth(dataViewName, time, departIds); |
103 | List<Map<String, Object>> upList = Lists.newArrayList(); | 99 | List<Map<String, Object>> upList = Lists.newArrayList(); |
104 | List<Map<String, Object>> lowList = Lists.newArrayList(); | 100 | List<Map<String, Object>> lowList = Lists.newArrayList(); |
105 | List<Map<String, Object>> list = Lists.newArrayList(); | 101 | List<Map<String, Object>> list = Lists.newArrayList(); |
... | @@ -157,22 +153,22 @@ public class WaterCountAnalysisNewServiceImpl implements WaterCountAnalysisNewSe | ... | @@ -157,22 +153,22 @@ public class WaterCountAnalysisNewServiceImpl implements WaterCountAnalysisNewSe |
157 | } | 153 | } |
158 | @Override | 154 | @Override |
159 | public Map<String, Object> querySLAnalysis(String time) { | 155 | public Map<String, Object> querySLAnalysis(String time) { |
160 | // String factoryIds = BaseContextHandler.getDeparts(); | 156 | String departIds = BaseContextHandler.getDeparts(); |
161 | String thisDataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", FACTORYIDS, time); | 157 | String thisDataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", departIds, time); |
162 | String lastDataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", FACTORYIDS, DateUtils.getLastMonthOfMonth(time)); | 158 | String lastDataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", departIds, DateUtils.getLastMonthOfMonth(time)); |
163 | Map<String, Object> result = Maps.newHashMap(); | 159 | Map<String, Object> result = Maps.newHashMap(); |
164 | //增长率 | 160 | //增长率 |
165 | List<Map<String, Object>> upData = waterCountAnalysisNewMapper.queryUpFacList(thisDataViewName, lastDataViewName, time, DateUtils.getLastMonthOfMonth(time), FACTORYIDS); | 161 | List<Map<String, Object>> upData = waterCountAnalysisNewMapper.queryUpFacList(thisDataViewName, lastDataViewName, time, DateUtils.getLastMonthOfMonth(time), departIds); |
166 | //下降率 | 162 | //下降率 |
167 | List<Map<String, Object>> lowData = waterCountAnalysisNewMapper.queryLowFacList(thisDataViewName, lastDataViewName, time, DateUtils.getLastMonthOfMonth(time), FACTORYIDS); | 163 | List<Map<String, Object>> lowData = waterCountAnalysisNewMapper.queryLowFacList(thisDataViewName, lastDataViewName, time, DateUtils.getLastMonthOfMonth(time), departIds); |
168 | result.put("upData", upData); | 164 | result.put("upData", upData); |
169 | result.put("lowData", lowData); | 165 | result.put("lowData", lowData); |
170 | return result; | 166 | return result; |
171 | } | 167 | } |
172 | @Override | 168 | @Override |
173 | public Map<String, Object> queryTotalSLList(String time) { | 169 | public Map<String, Object> queryTotalSLList(String time) { |
174 | // String factoryIds = BaseContextHandler.getDeparts(); | 170 | String departIds = BaseContextHandler.getDeparts(); |
175 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", FACTORYIDS, time); | 171 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", departIds, time); |
176 | Map<String, Object> result = Maps.newHashMap(); | 172 | Map<String, Object> result = Maps.newHashMap(); |
177 | Map<String, List<Map<String, Object>>> tmp = Maps.newTreeMap(); | 173 | Map<String, List<Map<String, Object>>> tmp = Maps.newTreeMap(); |
178 | String nowYear = DateUtils.getDate("yyyy"); | 174 | String nowYear = DateUtils.getDate("yyyy"); |
... | @@ -183,8 +179,8 @@ public class WaterCountAnalysisNewServiceImpl implements WaterCountAnalysisNewSe | ... | @@ -183,8 +179,8 @@ public class WaterCountAnalysisNewServiceImpl implements WaterCountAnalysisNewSe |
183 | list = DateUtils.sliceUpDateRange(time + "-01", time + "-12", "year"); | 179 | list = DateUtils.sliceUpDateRange(time + "-01", time + "-12", "year"); |
184 | } | 180 | } |
185 | //查询年度水量数据 | 181 | //查询年度水量数据 |
186 | List<Map<String, Object>> facLists = waterCountAnalysisNewMapper.queryFacLists("",FACTORYIDS); | 182 | List<Map<String, Object>> facLists = waterCountAnalysisNewMapper.queryFacLists("",departIds); |
187 | List<Map<String, Object>> data = waterCountAnalysisNewMapper.queryTotalSLDataByFac(dataViewName, time, FACTORYIDS); | 183 | List<Map<String, Object>> data = waterCountAnalysisNewMapper.queryTotalSLDataByFac(dataViewName, time, departIds); |
188 | if (data != null && data.size() > 0) { | 184 | if (data != null && data.size() > 0) { |
189 | data.forEach(v -> { | 185 | data.forEach(v -> { |
190 | String ti = (String) v.get("time"); | 186 | String ti = (String) v.get("time"); |
... | @@ -219,16 +215,16 @@ public class WaterCountAnalysisNewServiceImpl implements WaterCountAnalysisNewSe | ... | @@ -219,16 +215,16 @@ public class WaterCountAnalysisNewServiceImpl implements WaterCountAnalysisNewSe |
219 | } | 215 | } |
220 | @Override | 216 | @Override |
221 | public Map<String, Object> queryTotalSLData(String time) { | 217 | public Map<String, Object> queryTotalSLData(String time) { |
222 | // String factoryIds = BaseContextHandler.getDeparts(); | 218 | String departIds = BaseContextHandler.getDeparts(); |
223 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", FACTORYIDS, time); | 219 | String dataViewName = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", departIds, time); |
224 | Map<String, Object> result = Maps.newHashMap(); | 220 | Map<String, Object> result = Maps.newHashMap(); |
225 | StringBuilder stringBuilder = new StringBuilder(); | 221 | StringBuilder stringBuilder = new StringBuilder(); |
226 | List<Map<String, Object>> data = waterCountAnalysisNewMapper.queryTotalSLData(dataViewName, time, FACTORYIDS); | 222 | List<Map<String, Object>> data = waterCountAnalysisNewMapper.queryTotalSLData(dataViewName, time, departIds); |
227 | 223 | ||
228 | String time2 = String.valueOf(Integer.parseInt(time) - 1); | 224 | String time2 = String.valueOf(Integer.parseInt(time) - 1); |
229 | 225 | ||
230 | String dataViewName2 = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", FACTORYIDS, time2); | 226 | String dataViewName2 = ReportViewUtil.buildViewLike(REPOART_ID_SL,"CSL", departIds, time2); |
231 | List<Map<String, Object>> lastData = waterCountAnalysisNewMapper.queryTotalSLData(dataViewName2, time2, FACTORYIDS); | 227 | List<Map<String, Object>> lastData = waterCountAnalysisNewMapper.queryTotalSLData(dataViewName2, time2, departIds); |
232 | 228 | ||
233 | for (int i =0 ;i<data.size();i++){ | 229 | for (int i =0 ;i<data.size();i++){ |
234 | Map<String, Object> map = data.get(i); | 230 | Map<String, Object> map = data.get(i); | ... | ... |
sk-module-datafill/src/main/java/com/skua/modules/report/controller/JmReportController.java
0 → 100644
1 | package com.skua.modules.report.controller; | ||
2 | |||
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
4 | import com.skua.core.api.vo.Result; | ||
5 | import com.skua.modules.report.entity.ReportDisplay; | ||
6 | import com.skua.modules.report.entity.ReportHeader; | ||
7 | import com.skua.modules.report.mapper.FReportManageMapper; | ||
8 | import com.skua.modules.report.mapper.ReportHeaderMapper; | ||
9 | import com.skua.modules.report.service.IJmReportService; | ||
10 | import com.skua.modules.report.service.IReportDisplayService; | ||
11 | import com.skua.modules.report.vo.ReportShow; | ||
12 | import com.skua.modules.util.ReportUtil; | ||
13 | import io.swagger.annotations.Api; | ||
14 | import io.swagger.annotations.ApiOperation; | ||
15 | import io.swagger.annotations.ApiParam; | ||
16 | import lombok.extern.slf4j.Slf4j; | ||
17 | import org.springframework.beans.factory.annotation.Autowired; | ||
18 | import org.springframework.util.CollectionUtils; | ||
19 | import org.springframework.web.bind.annotation.GetMapping; | ||
20 | import org.springframework.web.bind.annotation.RequestMapping; | ||
21 | import org.springframework.web.bind.annotation.RequestParam; | ||
22 | import org.springframework.web.bind.annotation.RestController; | ||
23 | |||
24 | import javax.servlet.http.HttpServletRequest; | ||
25 | import java.math.BigDecimal; | ||
26 | import java.util.*; | ||
27 | import java.util.stream.Collectors; | ||
28 | |||
29 | @Slf4j | ||
30 | @Api(tags = "积木 报表展示") | ||
31 | @RestController | ||
32 | @RequestMapping("/report/jmReport") | ||
33 | public class JmReportController { | ||
34 | @Autowired | ||
35 | ReportDisplayController reportDisplayController; | ||
36 | @Autowired | ||
37 | FReportManageMapper reportManageMapper; | ||
38 | @Autowired | ||
39 | IReportDisplayService reportDisplayService; | ||
40 | @Autowired | ||
41 | ReportHeaderMapper reportHeaderMapper; | ||
42 | @Autowired | ||
43 | IJmReportService jmReportService; | ||
44 | |||
45 | @ApiOperation(value = "化验日报-在线值", notes = "积木报表") | ||
46 | @GetMapping(value = "/hyrbZxz") | ||
47 | public Map trCount( | ||
48 | @RequestParam(name = "departId" ) String departId, | ||
49 | @RequestParam(name = "date" ) String date //yyyy-MM-dd | ||
50 | ) { | ||
51 | |||
52 | Map returnData = new HashMap(); | ||
53 | |||
54 | //查询【表头】 保持和[生产报表]一致 | ||
55 | QueryWrapper<ReportDisplay> reportDisplayQueryWrapper = new QueryWrapper<>(); | ||
56 | reportDisplayQueryWrapper.eq("depart_id",departId); | ||
57 | reportDisplayQueryWrapper.eq("report_name","生产报表"); | ||
58 | ReportDisplay reportDisplay = reportDisplayService.getOne(reportDisplayQueryWrapper); | ||
59 | if (reportDisplay == null) { | ||
60 | return returnData; | ||
61 | } | ||
62 | List<Map<String, String>> reportHeaderList = reportHeaderMapper.hyrbZxz(reportDisplay.getId()); | ||
63 | Map<String, String> reportHeaderMap = reportHeaderList.stream().collect(Collectors.toMap(v -> v.get("tag"), o -> o.get("metricId"))); | ||
64 | |||
65 | |||
66 | //查询【数据】 | ||
67 | ReportShow params = new ReportShow(); | ||
68 | params.setId(reportDisplay.getId()); | ||
69 | params.setDepartId(departId); | ||
70 | params.setStartDateTime(date + " 00:00:00"); | ||
71 | params.setEndDateTime(date + " 23:59:59"); | ||
72 | params.setReportType("day"); | ||
73 | Result<List<Map<String, Object>>> dataListResult = reportDisplayController.reprotShow(params); | ||
74 | List<Map<String, Object>> dataList = CollectionUtils.isEmpty(dataListResult.getResult()) ? new LinkedList<>() : dataListResult.getResult();//(正常情况下只有一条) | ||
75 | |||
76 | |||
77 | |||
78 | |||
79 | //查询【告警上限】 | ||
80 | List<Map<String, String>> limitList = reportHeaderMapper.queryLimit(departId); | ||
81 | Map<String, String> limitMap = limitList.stream().collect(Collectors.toMap(v -> v.get("tag"), o -> o.get("maxValue"))); | ||
82 | |||
83 | |||
84 | List<String> tagList = Arrays.asList("CSCOD","CSNH3N","CSPH","CSTN","CSTP","JSCOD","JSNH3N","JSPH","JSTN","JSTP","JSSS","CSSS"); | ||
85 | //组装数据 | ||
86 | for (Map<String, Object> dataMap : dataList) { | ||
87 | for (String tag : tagList) { | ||
88 | String metricId = reportHeaderMap.get(tag);//点位Id | ||
89 | dataMap.put(tag, dataMap.get(metricId)); | ||
90 | |||
91 | BigDecimal minValue = tag.contains("PH") ? new BigDecimal("6") : BigDecimal.ZERO; //PH的阈值固定为6~9 | ||
92 | BigDecimal maxValue = tag.contains("PH") ? new BigDecimal("9") : ReportUtil.getBigDecimalValue(tag, limitMap); | ||
93 | maxValue = maxValue == null ? new BigDecimal("9999999") : maxValue; | ||
94 | boolean flag = false; | ||
95 | BigDecimal valueBigDecimal = ReportUtil.newBigDecimal(metricId, null); | ||
96 | if(valueBigDecimal != null && (valueBigDecimal.compareTo(minValue) < 0 || valueBigDecimal.compareTo(maxValue) > 0)){ | ||
97 | flag = true; //超标! | ||
98 | } | ||
99 | |||
100 | dataMap.put(tag + "_是否超标", flag ? "yes" : "no"); //判断是否告警 | ||
101 | } | ||
102 | |||
103 | } | ||
104 | |||
105 | |||
106 | returnData.put("data",dataList); | ||
107 | return returnData; | ||
108 | } | ||
109 | |||
110 | } |
1 | package com.skua.modules.report.mapper; | 1 | package com.skua.modules.report.mapper; |
2 | 2 | ||
3 | import java.util.List; | 3 | import java.util.List; |
4 | import java.util.Map; | ||
4 | 5 | ||
5 | import org.apache.ibatis.annotations.Param; | 6 | import org.apache.ibatis.annotations.Param; |
6 | import com.skua.modules.report.entity.ReportHeader; | 7 | import com.skua.modules.report.entity.ReportHeader; |
... | @@ -15,4 +16,13 @@ public interface ReportHeaderMapper extends BaseMapper<ReportHeader> { | ... | @@ -15,4 +16,13 @@ public interface ReportHeaderMapper extends BaseMapper<ReportHeader> { |
15 | 16 | ||
16 | //查询报表信息 | 17 | //查询报表信息 |
17 | List<ReportHeader> headerAll(@Param("reportId") String reportId); | 18 | List<ReportHeader> headerAll(@Param("reportId") String reportId); |
19 | |||
20 | List<Map<String, String>> hyrbZxz(String id); | ||
21 | |||
22 | /** | ||
23 | * 查询告警上限值 | ||
24 | * @param depart | ||
25 | * @return | ||
26 | */ | ||
27 | List<Map<String, String>> queryLimit(String depart); | ||
18 | } | 28 | } | ... | ... |
... | @@ -30,4 +30,31 @@ | ... | @@ -30,4 +30,31 @@ |
30 | report_id =#{reportId} | 30 | report_id =#{reportId} |
31 | ORDER BY sort_num | 31 | ORDER BY sort_num |
32 | </select> | 32 | </select> |
33 | <select id="hyrbZxz" resultType="java.util.Map"> | ||
34 | select m.metric_uid_tag as 'tag', h.key_index as 'metricId', h.title | ||
35 | from report_header h | ||
36 | join sys_monitor_metric_info m on h.key_index = m.id | ||
37 | where | ||
38 | h.report_id = #{id} | ||
39 | and metric_uid_tag is not null | ||
40 | and metric_uid_tag != '' | ||
41 | </select> | ||
42 | <select id="queryLimit" resultType="java.util.Map"> | ||
43 | SELECT | ||
44 | b.alarm_param_code AS tag, | ||
45 | b.alarm_param_upper_limit AS `maxValue` | ||
46 | FROM | ||
47 | sys_factory_info a | ||
48 | LEFT JOIN alarm_param_standard_config b ON a.out_level = b.alarm_level_standard_id | ||
49 | WHERE | ||
50 | depart_id = #{depart} | ||
51 | UNION ALL | ||
52 | SELECT | ||
53 | index_code, | ||
54 | upper | ||
55 | FROM | ||
56 | water_quality_in_level | ||
57 | WHERE | ||
58 | depart_id = #{depart} | ||
59 | </select> | ||
33 | </mapper> | 60 | </mapper> | ... | ... |
此文件的差异被折叠,
点击展开。
... | @@ -11,7 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | ... | @@ -11,7 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
11 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 11 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
12 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
14 | import org.springframework.web.bind.annotation.*;; | 14 | import org.springframework.web.bind.annotation.*; |
15 | import io.swagger.annotations.Api; | 15 | import io.swagger.annotations.Api; |
16 | import io.swagger.annotations.ApiOperation; | 16 | import io.swagger.annotations.ApiOperation; |
17 | 17 | ... | ... |
... | @@ -49,6 +49,7 @@ public class ShiroConfig { | ... | @@ -49,6 +49,7 @@ public class ShiroConfig { |
49 | filterChainDefinitionMap.put("/sys/logout", "anon"); //登出接口排除 | 49 | filterChainDefinitionMap.put("/sys/logout", "anon"); //登出接口排除 |
50 | filterChainDefinitionMap.put("/sys/getEncryptedString", "anon"); //获取加密串 | 50 | filterChainDefinitionMap.put("/sys/getEncryptedString", "anon"); //获取加密串 |
51 | filterChainDefinitionMap.put("/sys/sms", "anon");//短信验证码 | 51 | filterChainDefinitionMap.put("/sys/sms", "anon");//短信验证码 |
52 | filterChainDefinitionMap.put("/report/jmReport/*", "anon");//积木报表 | ||
52 | filterChainDefinitionMap.put("/sys/phoneLogin", "anon");//手机登录 | 53 | filterChainDefinitionMap.put("/sys/phoneLogin", "anon");//手机登录 |
53 | filterChainDefinitionMap.put("/sys/user/checkOnlyUser", "anon");//校验用户是否存在 | 54 | filterChainDefinitionMap.put("/sys/user/checkOnlyUser", "anon");//校验用户是否存在 |
54 | filterChainDefinitionMap.put("/sys/user/register", "anon");//用户注册 | 55 | filterChainDefinitionMap.put("/sys/user/register", "anon");//用户注册 | ... | ... |
-
请 注册 或 登录 后发表评论