b4b75dce 张雷

禅道BUG修改

1 个父辈 6256fe9c
...@@ -99,9 +99,14 @@ public interface FCustomReportDatasetMapper extends BaseMapper<FCustomReportData ...@@ -99,9 +99,14 @@ public interface FCustomReportDatasetMapper extends BaseMapper<FCustomReportData
99 * @return 99 * @return
100 */ 100 */
101 Map<String, Object> getWeekReport(@Param(value="dataTime") String dataTime, @Param(value="departId") String departId, 101 Map<String, Object> getWeekReport(@Param(value="dataTime") String dataTime, @Param(value="departId") String departId,
102 @Param(value="week") String week,@Param(value="startDate") String startDate,@Param(value="endDate") String endDate); 102 @Param(value="week") String week,@Param(value="startDate") String startDate,@Param(value="endDate") String endDate,
103 103 @Param(value="dataViewName3a24") String dataViewName3a24,
104 List<DepartWeekReportVO> getWeekReportData(@Param(value="startDate") String startDate, @Param(value="endDate") String endDate); 104 @Param(value="dataViewName2119") String dataViewName2119,
105 @Param(value="dataViewName9bff") String dataViewName9bff);
106
107 List<DepartWeekReportVO> getWeekReportData(@Param(value="startDate") String startDate, @Param(value="endDate") String endDate,
108 @Param(value="dataViewName3a24") String dataViewName3a24,
109 @Param(value="dataViewName2119") String dataViewName2119);
105 110
106 List<JnhbReportData> getJnhbReport(@Param(value="dataViewName2") String dataViewName2, @Param(value="dataViewName3") String dataViewName3, 111 List<JnhbReportData> getJnhbReport(@Param(value="dataViewName2") String dataViewName2, @Param(value="dataViewName3") String dataViewName3,
107 @Param(value="start") String start, @Param(value="end") String end, @Param(value="departIds") String departIds); 112 @Param(value="start") String start, @Param(value="end") String end, @Param(value="departIds") String departIds);
......
...@@ -208,23 +208,28 @@ ...@@ -208,23 +208,28 @@
208 sys_depart d 208 sys_depart d
209 LEFT JOIN (SELECT * FROM view_30a8 WHERE depart_id = #{departId} AND time = #{dataTime} AND zs = #{week}) v3 on v3.depart_id = d.id 209 LEFT JOIN (SELECT * FROM view_30a8 WHERE depart_id = #{departId} AND time = #{dataTime} AND zs = #{week}) v3 on v3.depart_id = d.id
210 LEFT JOIN (SELECT 210 LEFT JOIN (SELECT
211 ROUND(AVG(JSCOD),2) JSCOD,ROUND(AVG(JSAD),2) JSAD,ROUND(AVG(JSPH),2) JSPH,ROUND(AVG(JSZD),2) JSZD,ROUND(AVG(JSZL),2) JSZL,ROUND(AVG(JSSS),2) JSSS, 211 ROUND(AVG(v.JSCOD),2) JSCOD,ROUND(AVG(v.JSAD),2) JSAD,ROUND(AVG(v.JSPH),2) JSPH,
212 ROUND(AVG(CSCOD),2) CSCOD,ROUND(AVG(CSAD),2) CSAD,ROUND(AVG(CSPH),2) CSPH,ROUND(AVG(CSTN),2) CSTN,ROUND(AVG(CSZL),2) CSZL,ROUND(AVG(CSSS),2) CSSS, 212 ROUND(AVG(v.JSZD),2) JSZD,ROUND(AVG(v.JSZL),2) JSZL,ROUND(AVG(v.JSSS),2) JSSS,
213 depart_id 213 ROUND(AVG(v.CSCOD),2) CSCOD,ROUND(AVG(v.CSAD),2) CSAD,ROUND(AVG(v.CSPH),2) CSPH,
214 FROM view_9bff 214 ROUND(AVG(v.CSTN),2) CSTN,ROUND(AVG(v.CSZL),2) CSZL,ROUND(AVG(v.CSSS),2) CSSS,
215 WHERE depart_id = #{departId} AND time &gt;= #{startDate} AND time &lt;= #{endDate} ) v9 on v9.depart_id = d.id 215 v.depart_id
216 FROM ${dataViewName9bff} v
217 WHERE v.depart_id = #{departId} AND v.time &gt;= #{startDate} AND v.time &lt;= #{endDate} ) v9 on v9.depart_id = d.id
216 LEFT JOIN (SELECT 218 LEFT JOIN (SELECT
217 SUM(DLHJ) dlhj,(SUM( PAMRJ ) + SUM( SCLPAMZ ) + SUM( SCLPAMF ) + SUM( NACLO ) + SUM( PACGT ) + SUM( PACYT ) + SUM( PFS ) + SUM( FHTY ) + 219 SUM(IFNULL(v.DLHJ,0)) dlhj,(SUM( IFNULL(v.PAMRJ,0) ) + SUM( IFNULL(v.SCLPAMZ,0) ) +
218 SUM( RYXNJ ) + SUM( YWL ) + SUM( GXCLJ ) + SUM( CH3COONA ) + SUM( HXT ) + SUM( FECL3 ) + SUM( SH ) + SUM( CH3COOH ) + SUM( FESO4G ) + 220 SUM( IFNULL(v.SCLPAMF,0) ) + SUM( IFNULL(v.NACLO,0) ) + SUM( IFNULL(v.PACGT,0) ) +
219 SUM( FESO4Y ) + SUM( H2O2 )) yjhl,SUM(WNL) wnl,depart_id 221 SUM( IFNULL(v.PACYT,0) ) + SUM( IFNULL(v.PFS,0) ) + SUM( IFNULL(v.FHTY,0) ) +SUM( IFNULL(v.RYXNJ,0) ) +
220 FROM view_3a24 222 SUM( IFNULL(v.YWL,0) ) + SUM( IFNULL(v.GXCLJ,0) ) + SUM( IFNULL(v.CH3COONA,0) ) + SUM( IFNULL(v.HXT,0) ) +
221 WHERE depart_id = #{departId} AND time &gt;= #{startDate} AND time &lt;= #{endDate} ) v8 on v8.depart_id = d.id 223 SUM( IFNULL(v.FECL3,0) ) + SUM( IFNULL(v.SH,0) ) + SUM( IFNULL(v.CH3COOH,0) ) + SUM( IFNULL(v.FESO4G,0) ) +
224 SUM( IFNULL(v.FESO4Y,0) ) + SUM( IFNULL(v.H2O2,0) )) yjhl,SUM(IFNULL(v.WNL,0)) wnl,v.depart_id
225 FROM ${dataViewName3a24} v
226 WHERE v.depart_id = #{departId} AND v.time &gt;= #{startDate} AND v.time &lt;= #{endDate} ) v8 on v8.depart_id = d.id
222 LEFT JOIN (SELECT 227 LEFT JOIN (SELECT
223 SUM(CSL) zclsl, 228 SUM(v.CSL) zclsl,
224 ROUND(AVG(CSL),2) rjclsl, 229 ROUND(AVG(v.CSL),2) rjclsl,
225 depart_id 230 v.depart_id
226 FROM view_2119 231 FROM ${dataViewName2119} v
227 WHERE depart_id = #{departId} AND time &gt;= #{startDate} AND time &lt;= #{endDate} ) v2 on v2.depart_id = d.id 232 WHERE v.depart_id = #{departId} AND v.time &gt;= #{startDate} AND v.time &lt;= #{endDate} ) v2 on v2.depart_id = d.id
228 LEFT JOIN sys_factory_info f on f.depart_id = d.id 233 LEFT JOIN sys_factory_info f on f.depart_id = d.id
229 LEFT JOIN report_target_config t on t.depart_id = d.id 234 LEFT JOIN report_target_config t on t.depart_id = d.id
230 WHERE 235 WHERE
...@@ -242,12 +247,12 @@ ...@@ -242,12 +247,12 @@
242 FROM 247 FROM
243 sys_depart d 248 sys_depart d
244 left join sys_factory_info f on f.depart_id = d.id 249 left join sys_factory_info f on f.depart_id = d.id
245 left join (select depart_id,ROUND(SUM(WNL),2) wnl,ROUND(SUM(DLHJ),2) hdl 250 left join (select v.depart_id,ROUND(SUM(v.WNL),2) wnl,ROUND(SUM(v.DLHJ),2) hdl
246 from view_3a24 251 from ${dataViewName3a24} v
247 where time &gt;= #{startDate} AND time &lt;= #{endDate} GROUP BY depart_id) v3 on v3.depart_id = d.id 252 where v.time &gt;= #{startDate} AND v.time &lt;= #{endDate} GROUP BY v.depart_id) v3 on v3.depart_id = d.id
248 left join (select depart_id, ROUND(AVG(CSL)/10000,2) AS rjclsl, ROUND(SUM(CSL),2) AS zclsl 253 left join (select v.depart_id, ROUND(AVG(v.CSL)/10000,2) AS rjclsl, ROUND(SUM(v.CSL),2) AS zclsl
249 from view_2119 254 from ${dataViewName2119} v
250 where time &gt;= #{startDate} AND time &lt;= #{endDate} GROUP BY depart_id) v2 on v2.depart_id = d.id 255 where v.time &gt;= #{startDate} AND v.time &lt;= #{endDate} GROUP BY v.depart_id) v2 on v2.depart_id = d.id
251 WHERE 256 WHERE
252 d.depart_type = 1 257 d.depart_type = 1
253 ORDER BY 258 ORDER BY
......
...@@ -24,6 +24,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -24,6 +24,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
24 */ 24 */
25 @Service 25 @Service
26 public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDatasetMapper, FCustomReportDataset> implements IFCustomReportDatasetService { 26 public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDatasetMapper, FCustomReportDataset> implements IFCustomReportDatasetService {
27
28 private static String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
29 private static String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
30 private static String view9bff = "9bffaf9187093d6e6a4390e8c56acca8";
31 private static String view4411 = "4411ed3d78634bcdcd700f6e33724025";
27 @Autowired 32 @Autowired
28 private FCustomReportDatasetMapper mapper; 33 private FCustomReportDatasetMapper mapper;
29 /* (non-Javadoc) 34 /* (non-Javadoc)
...@@ -68,9 +73,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -68,9 +73,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
68 public List<Map<String, Object>> getDataFromHY(String dataTime, String departId) { 73 public List<Map<String, Object>> getDataFromHY(String dataTime, String departId) {
69 List<Map<String, Object>> valueMapList = new ArrayList<>(); 74 List<Map<String, Object>> valueMapList = new ArrayList<>();
70 String tbYear = String.valueOf(Integer.parseInt(dataTime) - 1); 75 String tbYear = String.valueOf(Integer.parseInt(dataTime) - 1);
71 String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
72 String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
73 String view4411 = "4411ed3d78634bcdcd700f6e33724025";
74 String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, dataTime); 76 String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, dataTime);
75 String dataViewName2119tb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, tbYear); 77 String dataViewName2119tb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, tbYear);
76 78
...@@ -158,45 +160,19 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -158,45 +160,19 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
158 return valueMapList; 160 return valueMapList;
159 } 161 }
160 162
161 /*public List<Map<String, Object>> getDataFromHY(String year, String departId,String startTime,String endTime) {
162 List<Map<String, Object>> valueMapList = new ArrayList<>();
163 String tbYear = String.valueOf(Integer.parseInt(year) - 1);
164 String tbStartTime = startTime.replaceAll( year , tbYear ) ;//去年开始时间
165 String tbEndTime = endTime.replaceAll( year , tbYear ) ;//去年结束时间
166 String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
167 String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
168 String view4411 = "4411ed3d78634bcdcd700f6e33724025";
169 String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, startTime,endTime);
170 String dataViewName2119tb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, tbStartTime,tbEndTime);
171
172 String field3a24 = "DLHJ,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," +
173 "YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2";
174 String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,field3a24, departId, dataTime);
175 String dataViewName3a24tb = ReportViewUtil.buildViewLike(view3a24,field3a24, departId, tbYear);
176
177 String field4411 = "yslwcbl,ysjsldyqntqyy,qntqsfsl,ysfsl,sfsldbbhl,sldyyqyy,dhgyqntqyy,yyf,yhgyqntqyy,dhcmbzyy,yhcyqyy";
178 String dataViewName4411 = ReportViewUtil.buildViewLike(view4411,field4411, departId, dataTime);
179 String dataViewName4411tb = ReportViewUtil.buildViewLike(view4411,"qntqsfsl", departId, tbYear);
180 //主库数据源
181 JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
182
183
184
185
186 valueMapList = masterDB.queryForList(sql);
187 if(valueMapList==null){
188 valueMapList = new ArrayList<>();
189 }
190 return valueMapList;
191 }*/
192
193 @Override 163 @Override
194 public Map<String, Object> getWeekReport(String dataTime, String departId, String week) { 164 public Map<String, Object> getWeekReport(String dataTime, String departId, String week) {
195 Map<String, Object> valueMap = new HashMap<>(); 165 Map<String, Object> valueMap = new HashMap<>();
196 Map<String,String> weekMap = getWeekDate(dataTime,week); 166 Map<String,String> weekMap = getWeekDate(dataTime,week);
197 String startDate = weekMap.get("start"); 167 String startDate = weekMap.get("start");
198 String endDate = weekMap.get("end"); 168 String endDate = weekMap.get("end");
199 valueMap = mapper.getWeekReport(dataTime, departId, week, startDate, endDate); 169 String field3a24 = "DLHJ,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," +
170 "YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2,WNL";
171 String dataViewName3a24 = ReportViewUtil.buildView(view3a24, field3a24, "", startDate, endDate);
172 String dataViewName2119 = ReportViewUtil.buildView(view2119,"CSL", "", startDate, endDate);
173 String field9bff = "JSCOD,JSAD,JSPH,JSZD,JSZL,JSSS,CSCOD,CSAD,CSPH,CSTN,CSZL,CSSS";
174 String dataViewName9bff = ReportViewUtil.buildView(view9bff, field9bff, "", startDate, endDate);
175 valueMap = mapper.getWeekReport(dataTime, departId, week, startDate, endDate, dataViewName3a24, dataViewName2119, dataViewName9bff);
200 if(valueMap==null){ 176 if(valueMap==null){
201 valueMap = new HashMap<>(); 177 valueMap = new HashMap<>();
202 valueMap.put("depart_id", departId); 178 valueMap.put("depart_id", departId);
...@@ -226,10 +202,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -226,10 +202,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
226 // 计算目标周的开始和结束日期 202 // 计算目标周的开始和结束日期
227 LocalDate startOfWeek = firstMondayOfMonth.plusWeeks(weekOfMonth - 1).plusDays(1); 203 LocalDate startOfWeek = firstMondayOfMonth.plusWeeks(weekOfMonth - 1).plusDays(1);
228 LocalDate endOfWeek = startOfWeek.plusDays(6); 204 LocalDate endOfWeek = startOfWeek.plusDays(6);
229 // 如果结束日期超出本月,调整结束日期
230 if (endOfWeek.getMonth() != firstOfMonth.getMonth()) {
231 endOfWeek = firstOfMonth.withDayOfMonth(firstOfMonth.lengthOfMonth());
232 }
233 DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); 205 DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
234 map.put("start", startOfWeek.format(dateFormatter)); 206 map.put("start", startOfWeek.format(dateFormatter));
235 map.put("end", endOfWeek.format(dateFormatter)); 207 map.put("end", endOfWeek.format(dateFormatter));
...@@ -245,8 +217,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -245,8 +217,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
245 String start = month.substring(0,4)+"-01-31"; 217 String start = month.substring(0,4)+"-01-31";
246 String end = month + "-31"; 218 String end = month + "-31";
247 String departIds = mapper.getChildDepartId(departId); 219 String departIds = mapper.getChildDepartId(departId);
248 String dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", departIds, start, end); 220 String dataViewName2 = ReportViewUtil.buildView(view2119,"CSL", departIds, start, end);
249 String dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", departIds, start, end); 221 String dataViewName3 = ReportViewUtil.buildView(view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", departIds, start, end);
250 List<JnhbReportData> list = mapper.getJnhbReport(dataViewName2, dataViewName3, start, end, departIds); 222 List<JnhbReportData> list = mapper.getJnhbReport(dataViewName2, dataViewName3, start, end, departIds);
251 return list; 223 return list;
252 } 224 }
...@@ -258,8 +230,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -258,8 +230,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
258 List<JnhbReportDetailsJs> jsList = new ArrayList<>(); 230 List<JnhbReportDetailsJs> jsList = new ArrayList<>();
259 List<JnhbReportDetailsHj> hjList = new ArrayList<>(); 231 List<JnhbReportDetailsHj> hjList = new ArrayList<>();
260 String year = month.substring(0,4); 232 String year = month.substring(0,4);
261 String dataViewName2 = ReportViewUtil.buildViewLike("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", departId, year); 233 String dataViewName2 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, year);
262 String dataViewName3 = ReportViewUtil.buildViewLike("3a243d5715b9e1a3753c180872ca0df9","", departId, year); 234 String dataViewName3 = ReportViewUtil.buildViewLike(view3a24,"", departId, year);
263 dyList = mapper.getDyList(dataViewName2, dataViewName3, departId, year); 235 dyList = mapper.getDyList(dataViewName2, dataViewName3, departId, year);
264 jsList = mapper.getJsList(dataViewName2, dataViewName3, departId, year); 236 jsList = mapper.getJsList(dataViewName2, dataViewName3, departId, year);
265 hjList = mapper.getHjList(dataViewName2, dataViewName3, departId, year); 237 hjList = mapper.getHjList(dataViewName2, dataViewName3, departId, year);
...@@ -274,21 +246,21 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -274,21 +246,21 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
274 long startTime = System.nanoTime(); 246 long startTime = System.nanoTime();
275 JnhbLargeScreenVO largeScreenVO = new JnhbLargeScreenVO(); 247 JnhbLargeScreenVO largeScreenVO = new JnhbLargeScreenVO();
276 //当月数据 248 //当月数据
277 String dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime()); 249 String dataViewName2 = ReportViewUtil.buildView(view2119,"CSL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime());
278 String dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime()); 250 String dataViewName3 = ReportViewUtil.buildView(view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime());
279 List<JnhbReportData> jnhbReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getNowStartTime(), dataVO.getNowEndTime(), null); 251 List<JnhbReportData> jnhbReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getNowStartTime(), dataVO.getNowEndTime(), null);
280 //System.out.println("1111---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds"); 252 //System.out.println("1111---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
281 253
282 // 上月数据 同比 254 // 上月数据 同比
283 dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime()); 255 dataViewName2 = ReportViewUtil.buildView(view2119,"CSL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime());
284 dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime()); 256 dataViewName3 = ReportViewUtil.buildView(view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime());
285 List<JnhbReportData> lastMonthReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime(), null); 257 List<JnhbReportData> lastMonthReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime(), null);
286 258
287 //System.out.println("2222---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds"); 259 //System.out.println("2222---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
288 Map<String,JnhbReportData> lastMonthMapData= convertJnhbReportDataMap(lastMonthReportDataList); 260 Map<String,JnhbReportData> lastMonthMapData= convertJnhbReportDataMap(lastMonthReportDataList);
289 // 去年数据 环比 261 // 去年数据 环比
290 dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime()); 262 dataViewName2 = ReportViewUtil.buildView(view2119,"CSL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime());
291 dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime()); 263 dataViewName3 = ReportViewUtil.buildView(view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime());
292 List<JnhbReportData> lastYearReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime(), null); 264 List<JnhbReportData> lastYearReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime(), null);
293 Map<String,JnhbReportData> lastYearMapData= convertJnhbReportDataMap(lastYearReportDataList); 265 Map<String,JnhbReportData> lastYearMapData= convertJnhbReportDataMap(lastYearReportDataList);
294 266
...@@ -406,33 +378,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -406,33 +378,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
406 int count2 = masterDB.queryForObject("select count(1) from equipment_info where energy_level = 2",Integer.class); 378 int count2 = masterDB.queryForObject("select count(1) from equipment_info where energy_level = 2",Integer.class);
407 largeScreenVO.setEquipmentL2( count2 ); 379 largeScreenVO.setEquipmentL2( count2 );
408 //System.out.println("666666---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds"); 380 //System.out.println("666666---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
409
410 // 各站点系统负荷率排名:负荷率排序、设置排名
411 /* if(largeScreenVO.getLoadRateVOList() != null && !largeScreenVO.getLoadRateVOList().isEmpty()){
412 // 根据分数排序
413 Collections.sort(largeScreenVO.getLoadRateVOList(), new Comparator<LoadRateVO>() {
414 public int compare(LoadRateVO s1, LoadRateVO s2) {
415 return Double.compare(ConvertUtils.getDouble(s1.getWsfhl(),0d), ConvertUtils.getDouble(s1.getWsfhl(),0d)); // 降序排序
416 }
417 });
418 *//*int rank = 1; // 设置排名
419 for( LoadRateVO loadRateVORank: largeScreenVO.getLoadRateVOList()){
420 loadRateVORank.setRank( rank++);
421 }*//*
422 }*/
423 //各站点能源消耗排名 吨水电耗
424 /*if(largeScreenVO.getPowerConsumeVOList() != null && !largeScreenVO.getPowerConsumeVOList().isEmpty()) {
425 // 根据分数排序
426 Collections.sort(largeScreenVO.getPowerConsumeVOList(), new Comparator<PowerConsumeVO>() {
427 public int compare(PowerConsumeVO s1, PowerConsumeVO s2) {
428 return Double.compare(ConvertUtils.getDouble(s1.getDh(), 0d), ConvertUtils.getDouble(s1.getDh(), 0d)); // 降序排序
429 }
430 });
431 *//*int rank = 1; // 设置排名
432 for( LoadRateVO loadRateVORank: largeScreenVO.getLoadRateVOList()){
433 loadRateVORank.setRank( rank++);
434 }*//*
435 }*/
436 return largeScreenVO; 381 return largeScreenVO;
437 } 382 }
438 /**转换为Map<部门编号,JnhbReportData> */ 383 /**转换为Map<部门编号,JnhbReportData> */
...@@ -452,7 +397,13 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -452,7 +397,13 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
452 Map<String,String> weekMap = getWeekDate(dataTime,week); 397 Map<String,String> weekMap = getWeekDate(dataTime,week);
453 String startDate = weekMap.get("start"); 398 String startDate = weekMap.get("start");
454 String endDate = weekMap.get("end"); 399 String endDate = weekMap.get("end");
455 list = mapper.getWeekReportData(startDate, endDate); 400 String field3a24 = "DLHJ,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," +
401 "YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2,WNL";
402 String dataViewName3a24 = ReportViewUtil.buildView(view3a24, field3a24, "", startDate, endDate);
403 String dataViewName2119 = ReportViewUtil.buildView(view2119,"CSL", "", startDate, endDate);
404 String field9bff = "JSCOD,JSAD,JSPH,JSZD,JSZL,JSSS,CSCOD,CSAD,CSPH,CSTN,CSZL,CSSS";
405 String dataViewName9bff = ReportViewUtil.buildView(view9bff, field9bff, "", startDate, endDate);
406 list = mapper.getWeekReportData(startDate, endDate, dataViewName3a24, dataViewName2119);
456 map.put("start", startDate);//开始时间 407 map.put("start", startDate);//开始时间
457 map.put("end", endDate);//结束时间 408 map.put("end", endDate);//结束时间
458 map.put("zclsl", "776");//处理水量合计 409 map.put("zclsl", "776");//处理水量合计
......
...@@ -70,15 +70,8 @@ public class ReportElectricCostController { ...@@ -70,15 +70,8 @@ public class ReportElectricCostController {
70 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, 70 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
71 HttpServletRequest req) { 71 HttpServletRequest req) {
72 Result<IPage<ReportElectricCost>> result = new Result<IPage<ReportElectricCost>>(); 72 Result<IPage<ReportElectricCost>> result = new Result<IPage<ReportElectricCost>>();
73 QueryWrapper<ReportElectricCost> queryWrapper = QueryGenerator.initQueryWrapper(reportElectricCost, req.getParameterMap());
74 if(reportElectricCost.getDepartId()!=null){
75 queryWrapper.eq("depart_id",reportElectricCost.getDepartId());
76 }
77 if(reportElectricCost.getMonth()!=null){
78 queryWrapper.like("month",reportElectricCost.getMonth());
79 }
80 Page<ReportElectricCost> page = new Page<ReportElectricCost>(pageNo, pageSize); 73 Page<ReportElectricCost> page = new Page<ReportElectricCost>(pageNo, pageSize);
81 IPage<ReportElectricCost> pageList = reportElectricCostService.page(page, queryWrapper); 74 IPage<ReportElectricCost> pageList = reportElectricCostService.getPage(page, reportElectricCost);
82 result.setSuccess(true); 75 result.setSuccess(true);
83 result.setResult(pageList); 76 result.setResult(pageList);
84 return result; 77 return result;
......
...@@ -2,6 +2,7 @@ package com.skua.modules.report.mapper; ...@@ -2,6 +2,7 @@ package com.skua.modules.report.mapper;
2 2
3 import java.util.List; 3 import java.util.List;
4 4
5 import com.skua.tool.annotation.Anonymous;
5 import org.apache.ibatis.annotations.Param; 6 import org.apache.ibatis.annotations.Param;
6 import com.skua.modules.report.entity.ReportElectricCost; 7 import com.skua.modules.report.entity.ReportElectricCost;
7 import com.baomidou.mybatisplus.core.mapper.BaseMapper; 8 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -11,4 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
11 */ 12 */
12 public interface ReportElectricCostMapper extends BaseMapper<ReportElectricCost> { 13 public interface ReportElectricCostMapper extends BaseMapper<ReportElectricCost> {
13 14
15 @Anonymous
16 List<ReportElectricCost> getPage(@Param("reportElectricCost") ReportElectricCost reportElectricCost);
17
14 } 18 }
......
...@@ -2,4 +2,14 @@ ...@@ -2,4 +2,14 @@
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 <mapper namespace="com.skua.modules.report.mapper.ReportElectricCostMapper"> 3 <mapper namespace="com.skua.modules.report.mapper.ReportElectricCostMapper">
4 4
5 <select id="getPage" resultType="com.skua.modules.report.entity.ReportElectricCost" parameterType="com.skua.modules.report.entity.ReportElectricCost">
6 select * from report_electric_cost where 1=1
7 <if test="reportElectricCost.departId!=null and reportElectricCost.departId!=''">
8 AND depart_id = #{reportElectricCost.departId}
9 </if>
10 <if test="reportElectricCost.month!=null and reportElectricCost.month!=''">
11 AND month like CONCAT(#{reportElectricCost.month},'%')
12 </if>
13 </select>
14
5 </mapper> 15 </mapper>
......
1 package com.skua.modules.report.service; 1 package com.skua.modules.report.service;
2 2
3 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 import com.baomidou.mybatisplus.core.metadata.IPage;
5 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
3 import com.skua.modules.report.entity.ReportElectricCost; 6 import com.skua.modules.report.entity.ReportElectricCost;
4 import com.baomidou.mybatisplus.extension.service.IService; 7 import com.baomidou.mybatisplus.extension.service.IService;
5 8
...@@ -8,4 +11,6 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -8,4 +11,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
8 */ 11 */
9 public interface IReportElectricCostService extends IService<ReportElectricCost> { 12 public interface IReportElectricCostService extends IService<ReportElectricCost> {
10 13
14 IPage<ReportElectricCost> getPage(Page<ReportElectricCost> page, ReportElectricCost reportElectricCost);
15
11 } 16 }
......
1 package com.skua.modules.report.service.impl; 1 package com.skua.modules.report.service.impl;
2 2
3 import com.baomidou.mybatisplus.core.metadata.IPage;
4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
3 import com.skua.modules.report.entity.ReportElectricCost; 5 import com.skua.modules.report.entity.ReportElectricCost;
4 import com.skua.modules.report.mapper.ReportElectricCostMapper; 6 import com.skua.modules.report.mapper.ReportElectricCostMapper;
5 import com.skua.modules.report.service.IReportElectricCostService; 7 import com.skua.modules.report.service.IReportElectricCostService;
8 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
7 10
8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 11 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 12
13 import java.util.ArrayList;
14 import java.util.List;
15
10 /** 16 /**
11 * 月度电费报表 17 * 月度电费报表
12 */ 18 */
13 @Service 19 @Service
14 public class ReportElectricCostServiceImpl extends ServiceImpl<ReportElectricCostMapper, ReportElectricCost> implements IReportElectricCostService { 20 public class ReportElectricCostServiceImpl extends ServiceImpl<ReportElectricCostMapper, ReportElectricCost> implements IReportElectricCostService {
15 21
22 @Autowired
23 private ReportElectricCostMapper reportElectricCostMapper;
24
25 @Override
26 public IPage<ReportElectricCost> getPage(Page<ReportElectricCost> page, ReportElectricCost reportElectricCost) {
27 // if(reportElectricCost.getDepartId()!=null){
28 // queryWrapper.eq("depart_id",reportElectricCost.getDepartId());
29 // }
30 // if(reportElectricCost.getMonth()!=null){
31 // queryWrapper.like("month",reportElectricCost.getMonth());
32 // }
33 List<ReportElectricCost> list = new ArrayList<>();
34 list = reportElectricCostMapper.getPage(reportElectricCost);
35 page.setRecords(list);
36 return page;
37 }
16 } 38 }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!