Merge remote-tracking branch 'origin/master'
正在显示
17 个修改的文件
包含
316 行增加
和
78 行删除
... | @@ -651,18 +651,17 @@ public class ScreenDataController { | ... | @@ -651,18 +651,17 @@ public class ScreenDataController { |
651 | @AutoLog(value = "厂区详细信息-厂区信息自定义查询") | 651 | @AutoLog(value = "厂区详细信息-厂区信息自定义查询") |
652 | @ApiOperation(value = "厂区详细信息-厂区信息自定义查询", notes = "厂区详细信息-厂区信息自定义查询") | 652 | @ApiOperation(value = "厂区详细信息-厂区信息自定义查询", notes = "厂区详细信息-厂区信息自定义查询") |
653 | @RequestMapping(value = "/getFactoryListByWrapper", method = RequestMethod.GET) | 653 | @RequestMapping(value = "/getFactoryListByWrapper", method = RequestMethod.GET) |
654 | public Result<List<SysFactoryInfoVO>> getFactoryListByWrapper(SysFactoryInfoVO | 654 | public Result<List<SysFactoryInfoVO>> getFactoryListByWrapper(SysFactoryInfoVO sysFactoryInfoVO) { |
655 | sysFactoryInfoVO, HttpServletRequest request) { | ||
656 | Result<List<SysFactoryInfoVO>> result = new Result<>(); | 655 | Result<List<SysFactoryInfoVO>> result = new Result<>(); |
657 | QueryWrapper<SysFactoryInfoVO> queryWrapper = new QueryWrapper<>(); | 656 | QueryWrapper<SysFactoryInfoVO> queryWrapper = new QueryWrapper<>(); |
658 | 657 | ||
659 | String departType = sysFactoryInfoVO.getDepartType(); | 658 | String departType = sysFactoryInfoVO.getDepartType(); |
660 | if (org.apache.commons.lang3.StringUtils.isNotBlank(departType)) { | 659 | if (ConvertUtils.isNotEmpty(departType)) { |
661 | queryWrapper.in("d.depart_type", departType.split(",")); | 660 | queryWrapper.in("d.depart_type", departType.split(",")); |
662 | } | 661 | } |
663 | 662 | ||
664 | String dataDepartId = sysFactoryInfoVO.getDepartId(); | 663 | String dataDepartId = sysFactoryInfoVO.getDepartId(); |
665 | if (org.apache.commons.lang3.StringUtils.isNotBlank(dataDepartId)) { | 664 | if (ConvertUtils.isNotEmpty(dataDepartId)) { |
666 | queryWrapper.in("d.id", dataDepartId.split(",")); | 665 | queryWrapper.in("d.id", dataDepartId.split(",")); |
667 | } | 666 | } |
668 | queryWrapper.orderByAsc("d.depart_order"); | 667 | queryWrapper.orderByAsc("d.depart_order"); | ... | ... |
... | @@ -3,6 +3,7 @@ package com.skua.modules.custom.mapper; | ... | @@ -3,6 +3,7 @@ package com.skua.modules.custom.mapper; |
3 | import java.util.List; | 3 | import java.util.List; |
4 | import java.util.Map; | 4 | import java.util.Map; |
5 | 5 | ||
6 | import com.skua.modules.custom.vo.DepartWeekReportVO; | ||
6 | import org.apache.ibatis.annotations.Param; | 7 | import org.apache.ibatis.annotations.Param; |
7 | 8 | ||
8 | import com.skua.modules.custom.entity.FCustomReportDataset; | 9 | import com.skua.modules.custom.entity.FCustomReportDataset; |
... | @@ -82,4 +83,9 @@ public interface FCustomReportDatasetMapper extends BaseMapper<FCustomReportData | ... | @@ -82,4 +83,9 @@ public interface FCustomReportDatasetMapper extends BaseMapper<FCustomReportData |
82 | 83 | ||
83 | List<Map<String, Object>> getDataFromHY(@Param(value="tbYear")String tbYear, @Param(value="year")String year, | 84 | List<Map<String, Object>> getDataFromHY(@Param(value="tbYear")String tbYear, @Param(value="year")String year, |
84 | @Param(value="departId")String departId); | 85 | @Param(value="departId")String departId); |
86 | |||
87 | Map<String, Object> getWeekReport(@Param(value="dataTime") String dataTime, @Param(value="departId") String departId, | ||
88 | @Param(value="week") String week,@Param(value="startDate") String startDate,@Param(value="endDate") String endDate); | ||
89 | |||
90 | List<DepartWeekReportVO> getWeekReportData(@Param(value="startDate") String startDate, @Param(value="endDate") String endDate); | ||
85 | } | 91 | } | ... | ... |
... | @@ -172,4 +172,75 @@ | ... | @@ -172,4 +172,75 @@ |
172 | where v1.time like CONCAT(#{year},'%') and v1.depart_id = #{departId} GROUP BY v1.depart_id,left(v1.time,7) | 172 | where v1.time like CONCAT(#{year},'%') and v1.depart_id = #{departId} GROUP BY v1.depart_id,left(v1.time,7) |
173 | </select> | 173 | </select> |
174 | 174 | ||
175 | <select id="getWeekReport" resultType="java.util.HashMap"> | ||
176 | SELECT | ||
177 | d.id AS depart_id, | ||
178 | #{week} as zs, | ||
179 | #{dataTime} as time, | ||
180 | #{startDate} as startdate, | ||
181 | #{endDate} as enddate, | ||
182 | v9.JSCOD as jscod, | ||
183 | v9.JSAD as jsnh3n, | ||
184 | v9.JSPH as jsph, | ||
185 | v9.JSZD as jstn, | ||
186 | v9.JSZL as jstp, | ||
187 | v9.CSCOD as cscod, | ||
188 | v9.CSAD as csnh3n, | ||
189 | v9.CSPH as csph, | ||
190 | v9.CSTN as cstn, | ||
191 | v9.CSZL as cstp, | ||
192 | v3.qt5,v3.qt4,v3.qt3,v3.qt2,v3.qt1, | ||
193 | v3.scqk5,v3.scqk4,v3.scqk3,v3.scqk2,v3.scqk1, | ||
194 | v3.id,v3.zwncb,v3.tnlgyy,v3.sjtnl, | ||
195 | v3.lltnl,v3.wnndgyy,v3.zsjwnnd,v3.llwnnd,v3.yjyy,v3.dhyy, | ||
196 | v8.dlhj,v8.yjhl,v8.wnl, | ||
197 | v2.zclsl,v2.rjclsl | ||
198 | FROM | ||
199 | sys_depart d | ||
200 | LEFT JOIN (SELECT * FROM view_30a8 WHERE depart_id = #{departId} AND time = #{dataTime} AND zs = #{week}) v3 on v3.depart_id = d.id | ||
201 | LEFT JOIN (SELECT | ||
202 | 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, | ||
203 | 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, | ||
204 | depart_id | ||
205 | FROM view_9bff | ||
206 | WHERE depart_id = #{departId} AND time >= #{startDate} AND time <= #{endDate} ) v9 on v9.depart_id = d.id | ||
207 | LEFT JOIN (SELECT | ||
208 | SUM(DLHJ) dlhj,(SUM( PAMRJ ) + SUM( SCLPAMZ ) + SUM( SCLPAMF ) + SUM( NACLO ) + SUM( PACGT ) + SUM( PACYT ) + SUM( PFS ) + SUM( FHTY ) + | ||
209 | SUM( RYXNJ ) + SUM( YWL ) + SUM( GXCLJ ) + SUM( CH3COONA ) + SUM( HXT ) + SUM( FECL3 ) + SUM( SH ) + SUM( CH3COOH ) + SUM( FESO4G ) + | ||
210 | SUM( FESO4Y ) + SUM( H2O2 )) yjhl,SUM(WNL) wnl,depart_id | ||
211 | FROM view_3a24 | ||
212 | WHERE depart_id = #{departId} AND time >= #{startDate} AND time <= #{endDate} ) v8 on v8.depart_id = d.id | ||
213 | LEFT JOIN (SELECT | ||
214 | SUM(CSL) zclsl, | ||
215 | ROUND(AVG(CSL),2) rjclsl, | ||
216 | depart_id | ||
217 | FROM view_2119 | ||
218 | WHERE depart_id = #{departId} AND time >= #{startDate} AND time <= #{endDate} ) v2 on v2.depart_id = d.id | ||
219 | WHERE | ||
220 | d.id = #{departId} | ||
221 | </select> | ||
222 | |||
223 | <select id="getWeekReportData" resultType="com.skua.modules.custom.vo.DepartWeekReportVO"> | ||
224 | SELECT | ||
225 | d.depart_order AS num, | ||
226 | d.depart_name, | ||
227 | f.pro_scale AS sjsl, | ||
228 | v2.rjclsl AS clsl, | ||
229 | v3.wnl AS wnl, | ||
230 | ROUND(v3.hdl/v2.zclsl,4) AS dsdh | ||
231 | FROM | ||
232 | sys_depart d | ||
233 | left join sys_factory_info f on f.depart_id = d.id | ||
234 | left join (select depart_id,ROUND(SUM(WNL),2) wnl,ROUND(SUM(DLHJ),2) hdl | ||
235 | from view_3a24 | ||
236 | where time >= #{startDate} AND time <= #{endDate} GROUP BY depart_id) v3 on v3.depart_id = d.id | ||
237 | left join (select depart_id, ROUND(AVG(CSL)/10000,2) AS rjclsl, ROUND(SUM(CSL),2) AS zclsl | ||
238 | from view_2119 | ||
239 | where time >= #{startDate} AND time <= #{endDate} GROUP BY depart_id) v2 on v2.depart_id = d.id | ||
240 | WHERE | ||
241 | d.depart_type = 1 | ||
242 | ORDER BY | ||
243 | d.depart_order | ||
244 | </select> | ||
245 | |||
175 | </mapper> | 246 | </mapper> | ... | ... |
... | @@ -81,4 +81,14 @@ public interface IFCustomReportDatasetService extends IService<FCustomReportData | ... | @@ -81,4 +81,14 @@ public interface IFCustomReportDatasetService extends IService<FCustomReportData |
81 | * @return | 81 | * @return |
82 | */ | 82 | */ |
83 | List<Map<String, Object>> getDataFromHY(String dataTime, String departId); | 83 | List<Map<String, Object>> getDataFromHY(String dataTime, String departId); |
84 | |||
85 | /** | ||
86 | * 运营周报 | ||
87 | * @param dataTime | ||
88 | * @param departId | ||
89 | * @return | ||
90 | */ | ||
91 | Map<String, Object> getWeekReport(String dataTime, String departId, String week); | ||
92 | |||
93 | Map<String, Object> reportWeekShow(String dataTime, String week); | ||
84 | } | 94 | } | ... | ... |
... | @@ -4,11 +4,14 @@ import com.skua.common.report.ReportViewUtil; | ... | @@ -4,11 +4,14 @@ import com.skua.common.report.ReportViewUtil; |
4 | import com.skua.modules.custom.entity.FCustomReportDataset; | 4 | import com.skua.modules.custom.entity.FCustomReportDataset; |
5 | import com.skua.modules.custom.mapper.FCustomReportDatasetMapper; | 5 | import com.skua.modules.custom.mapper.FCustomReportDatasetMapper; |
6 | import com.skua.modules.custom.service.IFCustomReportDatasetService; | 6 | import com.skua.modules.custom.service.IFCustomReportDatasetService; |
7 | import com.skua.modules.custom.vo.DepartWeekReportVO; | ||
7 | import com.skua.modules.custom.vo.FCustomReportDatasetVO; | 8 | import com.skua.modules.custom.vo.FCustomReportDatasetVO; |
8 | 9 | ||
9 | import java.util.ArrayList; | 10 | import java.time.LocalDate; |
10 | import java.util.List; | 11 | import java.time.format.DateTimeFormatter; |
11 | import java.util.Map; | 12 | import java.time.temporal.TemporalAdjusters; |
13 | import java.time.temporal.WeekFields; | ||
14 | import java.util.*; | ||
12 | 15 | ||
13 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
14 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
... | @@ -71,4 +74,76 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -71,4 +74,76 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
71 | return valueMapList; | 74 | return valueMapList; |
72 | } | 75 | } |
73 | 76 | ||
77 | @Override | ||
78 | public Map<String, Object> getWeekReport(String dataTime, String departId, String week) { | ||
79 | Map<String, Object> valueMap = new HashMap<>(); | ||
80 | Map<String,String> weekMap = getWeekDate(dataTime,week); | ||
81 | String startDate = weekMap.get("start"); | ||
82 | String endDate = weekMap.get("end"); | ||
83 | valueMap = mapper.getWeekReport(dataTime, departId, week, startDate, endDate); | ||
84 | if(valueMap==null){ | ||
85 | valueMap = new HashMap<>(); | ||
86 | valueMap.put("depart_id", departId); | ||
87 | valueMap.put("time", dataTime); | ||
88 | valueMap.put("zs", week); | ||
89 | valueMap.put("startdate", startDate); | ||
90 | valueMap.put("enddate", endDate); | ||
91 | } | ||
92 | return valueMap; | ||
93 | } | ||
94 | |||
95 | /** | ||
96 | * 获取周开始结束时间 | ||
97 | * @param yearMonth | ||
98 | * @param week | ||
99 | * @return | ||
100 | */ | ||
101 | public static Map<String,String> getWeekDate(String yearMonth,String week) { | ||
102 | Map<String,String> map = new HashMap<>(); | ||
103 | int weekOfMonth = Integer.valueOf(week); // 输入的第几周 | ||
104 | try { | ||
105 | // 解析年月并构造本月的第一天日期 | ||
106 | LocalDate firstOfMonth = LocalDate.parse(yearMonth + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); | ||
107 | // 获取本月的第一个星期一 | ||
108 | WeekFields weekFields = WeekFields.of(Locale.getDefault()); | ||
109 | LocalDate firstMondayOfMonth = firstOfMonth.with(TemporalAdjusters.firstInMonth(weekFields.getFirstDayOfWeek())); | ||
110 | // 计算目标周的开始和结束日期 | ||
111 | LocalDate startOfWeek = firstMondayOfMonth.plusWeeks(weekOfMonth - 1).plusDays(1); | ||
112 | LocalDate endOfWeek = startOfWeek.plusDays(6); | ||
113 | // 如果结束日期超出本月,调整结束日期 | ||
114 | if (endOfWeek.getMonth() != firstOfMonth.getMonth()) { | ||
115 | endOfWeek = firstOfMonth.withDayOfMonth(firstOfMonth.lengthOfMonth()); | ||
116 | } | ||
117 | DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | ||
118 | map.put("start", startOfWeek.format(dateFormatter)); | ||
119 | map.put("end", endOfWeek.format(dateFormatter)); | ||
120 | } catch (Exception e) { | ||
121 | map.put("start", ""); | ||
122 | map.put("end", ""); | ||
123 | } | ||
124 | return map; | ||
125 | } | ||
126 | |||
127 | @Override | ||
128 | public Map<String, Object> reportWeekShow(String dataTime, String week) { | ||
129 | Map<String, Object> map = new HashMap<>(); | ||
130 | List<DepartWeekReportVO> list = new ArrayList<>(); | ||
131 | Map<String,String> weekMap = getWeekDate(dataTime,week); | ||
132 | String startDate = weekMap.get("start"); | ||
133 | String endDate = weekMap.get("end"); | ||
134 | list = mapper.getWeekReportData(startDate, endDate); | ||
135 | map.put("zclsl", "776");//处理水量合计 | ||
136 | map.put("rjclsl", "110.7");//日均处理水量 | ||
137 | map.put("rjclsl_hb", "2");//较上周增减量 | ||
138 | map.put("dsdh", "0.329");//吨水电耗 | ||
139 | map.put("dsdh_hb", "0.002");//吨水电耗较上周增减量 | ||
140 | map.put("cnl", "3978.8");//产泥量 | ||
141 | map.put("list", list); | ||
142 | map.put("scqk", "(1)本周暂无生产情况说明");//生产情况 | ||
143 | map.put("wxqk", "(1)本周暂无设备大修、更新情况");// | ||
144 | map.put("aqgz", "(1)本周暂无生产情况说明");//安全工作 | ||
145 | map.put("qt", "(1)本周暂无其他情况说明");//其他 | ||
146 | return map; | ||
147 | } | ||
148 | |||
74 | } | 149 | } | ... | ... |
1 | package com.skua.modules.custom.vo; | ||
2 | |||
3 | import io.swagger.annotations.ApiModel; | ||
4 | import io.swagger.annotations.ApiModelProperty; | ||
5 | import lombok.Data; | ||
6 | |||
7 | import java.util.ArrayList; | ||
8 | import java.util.List; | ||
9 | import java.util.Map; | ||
10 | |||
11 | /** | ||
12 | * 周运行统计VO对象 | ||
13 | */ | ||
14 | @Data | ||
15 | @ApiModel(value="周运行统计VO对象", description="周运行统计VO对象") | ||
16 | public class DepartWeekReportVO { | ||
17 | /**编号*/ | ||
18 | @ApiModelProperty(value = "编号") | ||
19 | private String num; | ||
20 | /**厂区名称*/ | ||
21 | @ApiModelProperty(value = "厂区名称") | ||
22 | private String departName; | ||
23 | /**设计规模*/ | ||
24 | @ApiModelProperty(value = "设计规模") | ||
25 | private String sjsl; | ||
26 | /**实际水量*/ | ||
27 | @ApiModelProperty(value = "实际水量") | ||
28 | private String clsl; | ||
29 | /**污泥量*/ | ||
30 | @ApiModelProperty(value = "污泥量") | ||
31 | private String wnl; | ||
32 | /**吨水电耗*/ | ||
33 | @ApiModelProperty(value = "吨水电耗") | ||
34 | private String dsdh; | ||
35 | } |
1 | package com.skua.modules.dataAnalysis.mapper; | 1 | package com.skua.modules.dataAnalysis.mapper; |
2 | 2 | ||
3 | import com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo; | ||
4 | import org.apache.ibatis.annotations.Param; | ||
5 | |||
6 | import java.util.List; | ||
7 | import java.util.Map; | ||
8 | |||
9 | public interface FactoryCenterMapper { | 3 | public interface FactoryCenterMapper { |
10 | 4 | ||
11 | List<SysMonitorMetricInfo> getMonitorListByDepart(@Param("departId") String departId); | ||
12 | |||
13 | List<Map<String, Object>> getHourWaterData(@Param("departId") String departId, @Param("startDate") String startDate, @Param("endDate") String endDate); | ||
14 | } | 5 | } | ... | ... |
... | @@ -2,17 +2,4 @@ | ... | @@ -2,17 +2,4 @@ |
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.dataAnalysis.mapper.FactoryCenterMapper"> | 3 | <mapper namespace="com.skua.modules.dataAnalysis.mapper.FactoryCenterMapper"> |
4 | 4 | ||
5 | <select id="getMonitorListByDepart" resultType="com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo"> | ||
6 | SELECT | ||
7 | * | ||
8 | FROM | ||
9 | sys_monitor_metric_info | ||
10 | WHERE | ||
11 | depart_id = #{departId} | ||
12 | AND metric_uid_tag IN ( 'JSTP', 'JSTN', 'JSPH', 'JSNH3N', 'JSCOD', 'CSTP', 'CSTN', 'CSPH', 'CSNH3N', 'CSCOD' ) | ||
13 | </select> | ||
14 | <select id="getHourWaterData" resultType="java.util.HashMap"> | ||
15 | select * from sys_monitor_metric_info | ||
16 | </select> | ||
17 | |||
18 | </mapper> | 5 | </mapper> | ... | ... |
... | @@ -2,6 +2,7 @@ package com.skua.modules.dataAnalysis.service.impl; | ... | @@ -2,6 +2,7 @@ package com.skua.modules.dataAnalysis.service.impl; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
4 | import com.skua.core.context.SpringContextUtils; | 4 | import com.skua.core.context.SpringContextUtils; |
5 | import com.skua.core.service.IFactoryInfoService; | ||
5 | import com.skua.core.service.IPgQueryService; | 6 | import com.skua.core.service.IPgQueryService; |
6 | import com.skua.core.util.ConvertUtils; | 7 | import com.skua.core.util.ConvertUtils; |
7 | import com.skua.core.util.DateUtils; | 8 | import com.skua.core.util.DateUtils; |
... | @@ -33,33 +34,28 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { | ... | @@ -33,33 +34,28 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { |
33 | @Autowired | 34 | @Autowired |
34 | private IPgQueryService pgQueryService; | 35 | private IPgQueryService pgQueryService; |
35 | @Autowired | 36 | @Autowired |
37 | IFactoryInfoService factoryInfoService; | ||
38 | @Autowired | ||
36 | private ISysMonitorMetricInfoService sysMonitorMetricInfoService; | 39 | private ISysMonitorMetricInfoService sysMonitorMetricInfoService; |
37 | 40 | ||
38 | @Override | 41 | @Override |
39 | public List<WaterQualityMonitoringDetailVO> queryMonitoringData(String departId) { | 42 | public List<WaterQualityMonitoringDetailVO> queryMonitoringData(String departId) { |
40 | List<WaterQualityMonitoringDetailVO> list = new ArrayList<>(); | 43 | List<WaterQualityMonitoringDetailVO> list = new ArrayList<>(); |
41 | Map<String, Object> monitorTagMap = new HashMap<String,Object>(); | 44 | Map<String, Object> monitorTagMap = new HashMap<String,Object>(); |
42 | monitorTagMap.put("CSCOD","BXWSCLC_PLC1_Tag386"); | 45 | QueryWrapper<SysMonitorMetricInfo> qw = new QueryWrapper<>(); |
43 | monitorTagMap.put("CSNH3N","BXWSCLC_PLC1_Tag387"); | 46 | qw.in("metric_uid_tag", "JSTP,JSTN,JSPH,JSNH3N,JSCOD,CSTP,CSTN,CSPH,CSNH3N,CSCOD".split(",")); |
44 | monitorTagMap.put("CSPH","BXWSCLC_PLC1_Tag385"); | 47 | qw.eq("depart_id", departId); |
45 | monitorTagMap.put("CSTN","BXWSCLC_PLC1_Tag392"); | 48 | qw.groupBy("depart_id","metric_uid_tag"); |
46 | monitorTagMap.put("CSTP","BXWSCLC_PLC1_Tag388"); | 49 | List<SysMonitorMetricInfo> monitorList = sysMonitorMetricInfoService.list(qw); |
47 | monitorTagMap.put("JSCOD","BXWSCLC_PLC1_Tag381"); | ||
48 | monitorTagMap.put("JSNH3N","BXWSCLC_PLC1_Tag382"); | ||
49 | monitorTagMap.put("JSPH","BXWSCLC_PLC1_Tag1"); | ||
50 | monitorTagMap.put("JSTN","BXWSCLC_PLC1_Tag3"); | ||
51 | monitorTagMap.put("JSTP","BXWSCLC_PLC1_Tag2"); | ||
52 | // List<SysMonitorMetricInfo> monitorList = factoryCenterMapper.getMonitorListByDepart(departId); | ||
53 | //获取实时指标 | 50 | //获取实时指标 |
54 | String fields = ""; | 51 | String fields = ""; |
55 | // for(SysMonitorMetricInfo monitorInfo : monitorList) { | 52 | for(SysMonitorMetricInfo monitorInfo : monitorList) { |
56 | // fields = fields+","+monitorInfo.getId(); | 53 | fields = fields+","+monitorInfo.getId(); |
57 | // } | 54 | monitorTagMap.put(monitorInfo.getMetricUidTag(), monitorInfo.getId()); |
58 | // if(!StringUtils.isEmpty(fields)) { | 55 | } |
59 | // fields = fields.substring(1); | 56 | if(!StringUtils.isEmpty(fields)) { |
60 | // } | 57 | fields = fields.substring(1); |
61 | fields = "BXWSCLC_PLC1_Tag386,BXWSCLC_PLC1_Tag387,BXWSCLC_PLC1_Tag385,BXWSCLC_PLC1_Tag392,BXWSCLC_PLC1_Tag388," + | 58 | } |
62 | "BXWSCLC_PLC1_Tag381,BXWSCLC_PLC1_Tag382,BXWSCLC_PLC1_Tag1,BXWSCLC_PLC1_Tag3,BXWSCLC_PLC1_Tag2,"; | ||
63 | //获取实时数据 | 59 | //获取实时数据 |
64 | List<Map<String, Object>> pgDataList = pgQueryService.queryFactoryMonitorFromRealTimeData(departId, fields); | 60 | List<Map<String, Object>> pgDataList = pgQueryService.queryFactoryMonitorFromRealTimeData(departId, fields); |
65 | Map<String, Object> dataMap = new HashMap<String,Object>(); | 61 | Map<String, Object> dataMap = new HashMap<String,Object>(); |
... | @@ -344,40 +340,28 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { | ... | @@ -344,40 +340,28 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { |
344 | List<Object> csphList = new ArrayList<>(); | 340 | List<Object> csphList = new ArrayList<>(); |
345 | map.put("number",new HashMap<>()); | 341 | map.put("number",new HashMap<>()); |
346 | map.put("realTime",new HashMap<>()); | 342 | map.put("realTime",new HashMap<>()); |
347 | // List<Map<String, Object>> list = factoryCenterMapper.getHourWaterData(statisticsParam.getDepartId(), | ||
348 | // statisticsParam.getStartDate(), statisticsParam.getEndDate()); | ||
349 | // for (Map<String, Object> newMap: list) { | ||
350 | // xlist.add(newMap.get("dataTime")); | ||
351 | // jscodList.add(newMap.get("jscod")); | ||
352 | // jsadList.add(newMap.get("jsad")); | ||
353 | // jstnList.add(newMap.get("jstn")); | ||
354 | // jstpList.add(newMap.get("jstp")); | ||
355 | // jsphList.add(newMap.get("jsph")); | ||
356 | // cscodList.add(newMap.get("cscod")); | ||
357 | // csadList.add(newMap.get("csad")); | ||
358 | // cstnList.add(newMap.get("cstn")); | ||
359 | // cstpList.add(newMap.get("cstp")); | ||
360 | // csphList.add(newMap.get("csph")); | ||
361 | // } | ||
362 | //追加实时数据 | ||
363 | /******************************/ | ||
364 | QueryWrapper<SysMonitorMetricInfo> qw = new QueryWrapper<>(); | 343 | QueryWrapper<SysMonitorMetricInfo> qw = new QueryWrapper<>(); |
344 | // 使用 split() 将字符串分割成数组并传递给 in() 方法 | ||
365 | qw.in("metric_uid_tag", "CSPH,CSCOD,CSNH3N,CSTN,CSTP,JSCOD,JSNH3N,JSPH,JSTN,JSTP".split(",")); | 345 | qw.in("metric_uid_tag", "CSPH,CSCOD,CSNH3N,CSTN,CSTP,JSCOD,JSNH3N,JSPH,JSTN,JSTP".split(",")); |
366 | qw.eq("depart_id",statisticsParam.getDepartId()); | 346 | // 进行等值匹配 |
367 | qw.groupBy("depart_id","metric_uid_tag"); | 347 | qw.eq("depart_id", statisticsParam.getDepartId()); |
348 | // 使用 groupBy 进行分组 | ||
349 | qw.groupBy("depart_id", "metric_uid_tag"); | ||
350 | // 执行查询并获取结果 | ||
368 | List<SysMonitorMetricInfo> metricInfos = sysMonitorMetricInfoService.list(qw); | 351 | List<SysMonitorMetricInfo> metricInfos = sysMonitorMetricInfoService.list(qw); |
369 | if (!CollectionUtils.isEmpty(metricInfos)){ | 352 | if (!CollectionUtils.isEmpty(metricInfos)){ |
370 | String fields = metricInfos.stream().map(SysMonitorMetricInfo::getId).collect(Collectors.joining(",")); | 353 | String fields = metricInfos.stream().map(SysMonitorMetricInfo::getId).collect(Collectors.joining(",")); |
371 | 354 | ||
372 | Map<String, String> fieldsMap = metricInfos.stream().collect(Collectors.toMap(SysMonitorMetricInfo::getMetricUidTag, SysMonitorMetricInfo::getId)); | 355 | Map<String, String> fieldsMap = metricInfos.stream().collect(Collectors.toMap(SysMonitorMetricInfo::getMetricUidTag, SysMonitorMetricInfo::getId)); |
373 | 356 | ||
374 | List<Map<String, Object>> list1 = pgQueryService.queryFactoryMonitorFromRealTimeData(statisticsParam.getDepartId(), fields); | 357 | // List<Map<String, Object>> list1 = pgQueryService.queryFactoryMonitorFromRealTimeData(statisticsParam.getDepartId(), fields); |
375 | 358 | List<Map<String, Object>> list1 = factoryInfoService.queryFactoryInfos(statisticsParam.getDepartId(),fields, | |
359 | statisticsParam.getStartDate(),statisticsParam.getEndDate(),"1"); | ||
376 | if (!CollectionUtils.isEmpty(list1)) { | 360 | if (!CollectionUtils.isEmpty(list1)) { |
377 | Map<String, Object> map1 = list1.get(0); | 361 | // Map<String, Object> map1 = list1.get(0); |
362 | for (Map<String, Object> map1 : list1) { | ||
378 | String time = DateUtils.date2Str(new Date(Long.parseLong(map1.get("time").toString()) * 1000), DateUtils.datetimeFormat); | 363 | String time = DateUtils.date2Str(new Date(Long.parseLong(map1.get("time").toString()) * 1000), DateUtils.datetimeFormat); |
379 | xlist.add(time); | 364 | xlist.add(time); |
380 | |||
381 | String jscod; | 365 | String jscod; |
382 | if (!org.apache.commons.lang3.StringUtils.isEmpty(jscod = fieldsMap.get("JSCOD"))) { | 366 | if (!org.apache.commons.lang3.StringUtils.isEmpty(jscod = fieldsMap.get("JSCOD"))) { |
383 | jscodList.add(DoubleOperaUtils.bigDecimalRound(Double.parseDouble(map1.get(jscod).toString()),2)); | 367 | jscodList.add(DoubleOperaUtils.bigDecimalRound(Double.parseDouble(map1.get(jscod).toString()),2)); |
... | @@ -427,6 +411,7 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { | ... | @@ -427,6 +411,7 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService { |
427 | } | 411 | } |
428 | } | 412 | } |
429 | } | 413 | } |
414 | } | ||
430 | /******************************/ | 415 | /******************************/ |
431 | dataMap.put("jscod",jscodList); | 416 | dataMap.put("jscod",jscodList); |
432 | dataMap.put("jsad",jsadList); | 417 | dataMap.put("jsad",jsadList); | ... | ... |
... | @@ -112,4 +112,58 @@ public class ReportDataController { | ... | @@ -112,4 +112,58 @@ public class ReportDataController { |
112 | return Result.ok(valueMapList); | 112 | return Result.ok(valueMapList); |
113 | } | 113 | } |
114 | 114 | ||
115 | /** | ||
116 | * 功能描述: 运营周报 | ||
117 | * @Author: zhanglei | ||
118 | * @Date: 2022/1/19 17:57 | ||
119 | */ | ||
120 | @AutoLog(value = "运营周报展示") | ||
121 | @ApiOperation(value = "运营周报展示", notes = "运营周报展示") | ||
122 | @GetMapping(value = "/reportWeekData") | ||
123 | public Result reportWeekData(HttpServletRequest req) { | ||
124 | String departId = ConvertUtils.getString(req.getParameter("departId")); | ||
125 | String reportId = ConvertUtils.getString(req.getParameter("reportId")); | ||
126 | String dataTime = ConvertUtils.getString(req.getParameter("time")); | ||
127 | String week = ConvertUtils.getString(req.getParameter("week")); | ||
128 | Map<String, Object> valueMap = new HashMap<>(); | ||
129 | valueMap = fCustomReportDatasetService.getWeekReport(dataTime, departId, week); | ||
130 | Map<String, Map<String, Object>> time2Val = Maps.newHashMap(); | ||
131 | Map<String, Object> tmp = Maps.newHashMap(); | ||
132 | valueMap.forEach((key, val) -> { | ||
133 | if (val != null) { | ||
134 | double v = 0; | ||
135 | try { | ||
136 | v = Double.parseDouble(val.toString()); | ||
137 | if (StringUtils.isNotBlank(val.toString())) { | ||
138 | String bigDecimal = new BigDecimal(v).setScale(2, RoundingMode.HALF_UP).stripTrailingZeros().toPlainString(); | ||
139 | tmp.put(key, bigDecimal); | ||
140 | } else { | ||
141 | tmp.put(key, val); | ||
142 | } | ||
143 | } catch (NumberFormatException e) { | ||
144 | tmp.put(key, val); | ||
145 | } | ||
146 | } else { | ||
147 | tmp.put(key, val); | ||
148 | } | ||
149 | }); | ||
150 | String time = ConvertUtils.getString(valueMap.get("time")); | ||
151 | tmp.put("departId", ConvertUtils.getString(valueMap.get("depart_id"))); | ||
152 | tmp.put("reportId", reportId); | ||
153 | time2Val.put(time, tmp); | ||
154 | return Result.ok(valueMap); | ||
155 | } | ||
156 | |||
157 | @AutoLog(value = "运营周报展示") | ||
158 | @ApiOperation(value = "运营周报展示", notes = "运营周报展示") | ||
159 | @GetMapping(value = "/reportWeekShow") | ||
160 | public Result<Map<String,Object>> reportWeekShow(HttpServletRequest req) { | ||
161 | Result<Map<String,Object>> result = new Result<>(); | ||
162 | String dataTime = ConvertUtils.getString(req.getParameter("time")); | ||
163 | String week = ConvertUtils.getString(req.getParameter("week")); | ||
164 | Map<String,Object> map = fCustomReportDatasetService.reportWeekShow(dataTime,week); | ||
165 | result.setResult(map); | ||
166 | return result; | ||
167 | } | ||
168 | |||
115 | } | 169 | } | ... | ... |
... | @@ -753,12 +753,20 @@ public class ReportShowController { | ... | @@ -753,12 +753,20 @@ public class ReportShowController { |
753 | @GetMapping(value = "/isExitData") | 753 | @GetMapping(value = "/isExitData") |
754 | public Result<Map<String,Object>> isExitData(@RequestParam(name="time",required=true) String time, | 754 | public Result<Map<String,Object>> isExitData(@RequestParam(name="time",required=true) String time, |
755 | @RequestParam(name="reportId",required=true) String reportId, | 755 | @RequestParam(name="reportId",required=true) String reportId, |
756 | @RequestParam(name="departId",required=true) String departId) { | 756 | @RequestParam(name="departId",required=true) String departId,String week) { |
757 | Result<Map<String,Object>> result = new Result<Map<String,Object>>(); | 757 | Result<Map<String,Object>> result = new Result<Map<String,Object>>(); |
758 | Map<String,Object> map = new HashMap<>(); | 758 | Map<String,Object> map = new HashMap<>(); |
759 | boolean ok = true; | 759 | boolean ok = true; |
760 | try { | 760 | try { |
761 | if("30a80f54ff288ede9d2df2ddd073b6c3".equals(reportId)){ | ||
762 | if(ConvertUtils.isEmpty(week)){ | ||
763 | map.put("flag",false); | ||
764 | return result; | ||
765 | } | ||
766 | ok = fReportItemvService.isExitDataByTimeAndWeek(reportId,time,departId,week); | ||
767 | }else{ | ||
761 | ok = fReportItemvService.isExitDataByTime(reportId,time,departId); | 768 | ok = fReportItemvService.isExitDataByTime(reportId,time,departId); |
769 | } | ||
762 | } catch (Exception e) { | 770 | } catch (Exception e) { |
763 | ok = false; | 771 | ok = false; |
764 | } | 772 | } | ... | ... |
... | @@ -33,4 +33,5 @@ public interface IFReportItemvService extends IService<FReportItemv> { | ... | @@ -33,4 +33,5 @@ public interface IFReportItemvService extends IService<FReportItemv> { |
33 | List<FReportItemv> getReportItemvByReitId(ReportItemvParam reportItemvParam); | 33 | List<FReportItemv> getReportItemvByReitId(ReportItemvParam reportItemvParam); |
34 | 34 | ||
35 | 35 | ||
36 | boolean isExitDataByTimeAndWeek(String reportId, String time, String departId, String week); | ||
36 | } | 37 | } | ... | ... |
... | @@ -87,7 +87,18 @@ public class FReportItemvServiceImpl extends ServiceImpl<FReportItemvMapper, FRe | ... | @@ -87,7 +87,18 @@ public class FReportItemvServiceImpl extends ServiceImpl<FReportItemvMapper, FRe |
87 | return fReportItemvMapper.getReportItemvByReitId(reportItemvParam); | 87 | return fReportItemvMapper.getReportItemvByReitId(reportItemvParam); |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | @Override | |
91 | public boolean isExitDataByTimeAndWeek(String reportId, String dataTime, String departId, String week) { | ||
92 | List<Map<String,Object>> list = new ArrayList<>(); | ||
93 | String tableName = ReportViewUtil.buildView(reportId,"",departId,dataTime,dataTime); | ||
94 | String sql = "select * from "+tableName+" aa where time = '"+dataTime+"' and depart_id = '"+departId+"' and zs = '"+week+"'"; | ||
95 | list = fReportItemvMapper.getListByTime(sql); | ||
96 | if(list.size()>0){ | ||
97 | return false; | ||
98 | }else{ | ||
99 | return true; | ||
100 | } | ||
101 | } | ||
91 | 102 | ||
92 | 103 | ||
93 | } | 104 | } | ... | ... |
... | @@ -136,6 +136,7 @@ public class ShiroConfig { | ... | @@ -136,6 +136,7 @@ public class ShiroConfig { |
136 | // 压测demo | 136 | // 压测demo |
137 | filterChainDefinitionMap.put("/jmeter/**", "anon"); | 137 | filterChainDefinitionMap.put("/jmeter/**", "anon"); |
138 | filterChainDefinitionMap.put("/jmReport/**", "anon"); | 138 | filterChainDefinitionMap.put("/jmReport/**", "anon"); |
139 | filterChainDefinitionMap.put("/v1/factoryCenter/**", "anon"); | ||
139 | 140 | ||
140 | //哈工大报表填报数据 | 141 | //哈工大报表填报数据 |
141 | filterChainDefinitionMap.put("/harbinTechnology/fillReport/**", "anon"); //哈工大报表填报数据 | 142 | filterChainDefinitionMap.put("/harbinTechnology/fillReport/**", "anon"); //哈工大报表填报数据 | ... | ... |
... | @@ -4,6 +4,7 @@ import java.util.List; | ... | @@ -4,6 +4,7 @@ import java.util.List; |
4 | import java.util.Map; | 4 | import java.util.Map; |
5 | 5 | ||
6 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 6 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
7 | import com.baomidou.mybatisplus.core.toolkit.Constants; | ||
7 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 8 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
8 | import com.skua.modules.alarmtmp.entity.AlarmParamStandardConfig; | 9 | import com.skua.modules.alarmtmp.entity.AlarmParamStandardConfig; |
9 | import com.skua.modules.system.vo.SysFactoryInfo.*; | 10 | import com.skua.modules.system.vo.SysFactoryInfo.*; |
... | @@ -67,7 +68,6 @@ public interface SysFactoryInfoMapper extends BaseMapper<SysFactoryInfo> { | ... | @@ -67,7 +68,6 @@ public interface SysFactoryInfoMapper extends BaseMapper<SysFactoryInfo> { |
67 | */ | 68 | */ |
68 | List<SysFactoryInfoVO> queryFactoryListByExport(@Param("departIds")String departIds); | 69 | List<SysFactoryInfoVO> queryFactoryListByExport(@Param("departIds")String departIds); |
69 | 70 | ||
70 | |||
71 | void updFacStatus(@Param("lineStatus") Integer lineStatus, @Param("departId") String departId, @Param("endTime") String endTime); | 71 | void updFacStatus(@Param("lineStatus") Integer lineStatus, @Param("departId") String departId, @Param("endTime") String endTime); |
72 | 72 | ||
73 | List<Map<String, Object>> getAllFacListStatus(); | 73 | List<Map<String, Object>> getAllFacListStatus(); |
... | @@ -88,8 +88,11 @@ public interface SysFactoryInfoMapper extends BaseMapper<SysFactoryInfo> { | ... | @@ -88,8 +88,11 @@ public interface SysFactoryInfoMapper extends BaseMapper<SysFactoryInfo> { |
88 | 88 | ||
89 | List<Map<String, Object>> queryUpLow(@Param("id") String id); | 89 | List<Map<String, Object>> queryUpLow(@Param("id") String id); |
90 | 90 | ||
91 | @Select("SELECT d.id as depart_id, d.depart_name AS NAME,d.depart_name AS depart_name,d.depart_type,(select depart_name from sys_depart sd where d.parent_id = sd.id )areaName,f.* FROM sys_depart d LEFT JOIN sys_factory_info f ON f.depart_id = d.id ${customSqlSegment}") | 91 | @Select("SELECT d.id as depart_id, d.depart_name AS name,d.depart_name AS depart_name,d.depart_type," + |
92 | List<SysFactoryInfoVO> getFactoryListByWrapper(QueryWrapper queryWrapper); | 92 | "(select depart_name from sys_depart sd where d.parent_id = sd.id ) areaName,f.* " + |
93 | "FROM sys_depart d " + | ||
94 | "LEFT JOIN sys_factory_info f ON f.depart_id = d.id ${ew.customSqlSegment}") | ||
95 | List<SysFactoryInfoVO> getFactoryListByWrapper(@Param(Constants.WRAPPER) QueryWrapper queryWrapper); | ||
93 | 96 | ||
94 | /** | 97 | /** |
95 | * 获取总的设计规模 | 98 | * 获取总的设计规模 | ... | ... |
... | @@ -65,7 +65,8 @@ public class SysFactoryInfoVO { | ... | @@ -65,7 +65,8 @@ public class SysFactoryInfoVO { |
65 | private String proImgs; | 65 | private String proImgs; |
66 | @ApiModelProperty(value = "水厂介绍") | 66 | @ApiModelProperty(value = "水厂介绍") |
67 | private String factoryInfo; | 67 | private String factoryInfo; |
68 | 68 | @ApiModelProperty(value = "厂站工艺主图") | |
69 | private String proMonitorMainImg; | ||
69 | /** | 70 | /** |
70 | * 水厂类型 | 71 | * 水厂类型 |
71 | */ | 72 | */ | ... | ... |
-
请 注册 或 登录 后发表评论