Merge remote-tracking branch 'origin/master'
正在显示
3 个修改的文件
包含
149 行增加
和
23 行删除
... | @@ -26,4 +26,7 @@ public interface FactoryOperateCenterMapper { | ... | @@ -26,4 +26,7 @@ public interface FactoryOperateCenterMapper { |
26 | 26 | ||
27 | List<Map<String, String>> getReportCount(@Param("departId") String departId, @Param("month") String month, | 27 | List<Map<String, String>> getReportCount(@Param("departId") String departId, @Param("month") String month, |
28 | @Param("reportName") String reportName); | 28 | @Param("reportName") String reportName); |
29 | |||
30 | Map<String, Object> getSdyData(@Param("view2119") String view2119, @Param("view3a24") String view3a24, | ||
31 | @Param("departId") String departId, @Param("dateTime") String dateTime); | ||
29 | } | 32 | } | ... | ... |
... | @@ -128,4 +128,21 @@ | ... | @@ -128,4 +128,21 @@ |
128 | depart_id = #{departId} | 128 | depart_id = #{departId} |
129 | AND time LIKE CONCAT(#{month},'%') | 129 | AND time LIKE CONCAT(#{month},'%') |
130 | </select> | 130 | </select> |
131 | |||
132 | <select id="getSdyData" resultType="java.util.HashMap"> | ||
133 | select | ||
134 | ROUND(SUM(v.CSL)/10000,2) AS CLSL, | ||
135 | v3.DLHJ, | ||
136 | v3.YJHJ | ||
137 | from ${view2119} v | ||
138 | LEFT JOIN (select ROUND(SUM(v.DLHJ),2) AS DLHJ,ROUND(SUM(IFNULL(v.PAMRJ,0)+ | ||
139 | IFNULL(v.SCLPAMZ,0)+IFNULL(v.SCLPAMF,0)+IFNULL(v.NACLO,0)+IFNULL(v.PACGT,0)+ | ||
140 | IFNULL(v.PACYT,0)+IFNULL(v.PFS,0)+IFNULL(v.FHTY,0)+IFNULL(v.RYXNJ,0)+IFNULL(v.YWL,0)+ | ||
141 | IFNULL(v.GXCLJ,0)+IFNULL(v.CH3COONA,0)+IFNULL(v.HXT,0)+IFNULL(v.FECL3,0)+IFNULL(v.SH,0)+ | ||
142 | IFNULL(v.CH3COOH,0)+IFNULL(v.FESO4G,0)+IFNULL(v.FESO4Y,0)+IFNULL(v.H2O2,0)),2) AS YJHJ, | ||
143 | v.depart_id,v.time | ||
144 | from ${view3a24} v where v.depart_id = #{departId} and v.time like CONCAT(#{dateTime},'%')) v3 | ||
145 | ON v.depart_id = v3.depart_id | ||
146 | where v.depart_id = #{departId} and v.time like CONCAT(#{dateTime},'%') | ||
147 | </select> | ||
131 | </mapper> | 148 | </mapper> | ... | ... |
1 | package com.skua.modules.dataAnalysis.service.impl; | 1 | package com.skua.modules.dataAnalysis.service.impl; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
3 | import com.skua.common.constant.ReportConstant; | 4 | import com.skua.common.constant.ReportConstant; |
4 | import com.skua.common.report.ReportViewUtil; | 5 | import com.skua.common.report.ReportViewUtil; |
5 | import com.skua.core.util.DoubleOperaUtils; | 6 | import com.skua.core.util.DoubleOperaUtils; |
... | @@ -9,9 +10,13 @@ import com.skua.modules.dataAnalysis.vo.ArchivesWarnVO; | ... | @@ -9,9 +10,13 @@ import com.skua.modules.dataAnalysis.vo.ArchivesWarnVO; |
9 | import com.skua.modules.dataAnalysis.vo.EquipAlarmVO; | 10 | import com.skua.modules.dataAnalysis.vo.EquipAlarmVO; |
10 | import com.skua.modules.dataAnalysis.vo.EquipRunTimeVO; | 11 | import com.skua.modules.dataAnalysis.vo.EquipRunTimeVO; |
11 | import com.skua.modules.dataAnalysis.vo.EquipWarnVO; | 12 | import com.skua.modules.dataAnalysis.vo.EquipWarnVO; |
13 | import com.skua.modules.report.entity.ReportTargetConfig; | ||
14 | import com.skua.modules.report.mapper.ReportTargetConfigMapper; | ||
12 | import com.skua.tool.util.DateUtils; | 15 | import com.skua.tool.util.DateUtils; |
16 | import org.springframework.beans.factory.annotation.Autowired; | ||
13 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
14 | import javax.annotation.Resource; | 18 | import javax.annotation.Resource; |
19 | import java.text.DecimalFormat; | ||
15 | import java.util.ArrayList; | 20 | import java.util.ArrayList; |
16 | import java.util.HashMap; | 21 | import java.util.HashMap; |
17 | import java.util.List; | 22 | import java.util.List; |
... | @@ -22,19 +27,60 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer | ... | @@ -22,19 +27,60 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer |
22 | 27 | ||
23 | @Resource | 28 | @Resource |
24 | private FactoryOperateCenterMapper factoryOperateCenterMapper; | 29 | private FactoryOperateCenterMapper factoryOperateCenterMapper; |
30 | @Resource | ||
31 | private ReportTargetConfigMapper reportTargetMapper; | ||
25 | 32 | ||
26 | @Override | 33 | @Override |
27 | public Map<String, Object> getData(String departId, String month) { | 34 | public Map<String, Object> getData(String departId, String month) { |
35 | DecimalFormat df = new DecimalFormat("#.##"); | ||
28 | String tbMonth = DateUtils.getTbMonth(month); | 36 | String tbMonth = DateUtils.getTbMonth(month); |
29 | String hbMonth = DateUtils.getHbMonth(month); | 37 | String hbMonth = DateUtils.getHbMonth(month); |
30 | String year = month.substring(0,4); | 38 | String year = month.substring(0,4); |
31 | String tbYear = String.valueOf(Integer.parseInt(year) - 1); | 39 | String tbYear = String.valueOf(Integer.parseInt(year) - 1); |
40 | //目标 | ||
41 | double yearClslMb = 0.00;double yearDlhjMb = 0.00;double yearYjhjMb = 0.00; | ||
42 | double yearTbClslMb = 0.00;double yearTbDlhjMb = 0.00;double yearTbYjhjMb = 0.00; | ||
43 | //实际 | ||
44 | double yearClsl = 0.00;double yearDlhj = 0.00;double yearYjhj = 0.00; | ||
45 | double yearTbClsl = 0.00;double yearTbDlhj = 0.00;double yearTbYjhj = 0.00; | ||
46 | double monthClsl = 0.00;double monthDlhj = 0.00;double monthYjhj = 0.00; | ||
47 | double monthTbClsl = 0.00;double monthTbDlhj = 0.00;double monthTbYjhj = 0.00; | ||
48 | double monthHbClsl = 0.00;double monthHbDlhj = 0.00;double monthHbYjhj = 0.00; | ||
49 | LambdaQueryWrapper<ReportTargetConfig> queryWrapper = new LambdaQueryWrapper<ReportTargetConfig>(); | ||
50 | queryWrapper.eq(ReportTargetConfig::getDepartId,departId); | ||
51 | queryWrapper.eq(ReportTargetConfig::getTargetYear,year); | ||
52 | List<ReportTargetConfig> yearTargetList = reportTargetMapper.selectList(queryWrapper); | ||
53 | if(yearTargetList.size() > 0){ | ||
54 | ReportTargetConfig target = yearTargetList.get(0); | ||
55 | if(target.getTargetWater()!=null){ | ||
56 | yearClslMb = Double.parseDouble(target.getTargetWater()); | ||
57 | } | ||
58 | if(target.getTargetPower()!=null){ | ||
59 | yearDlhjMb = Double.parseDouble(target.getTargetPower()); | ||
60 | } | ||
61 | if(target.getTargetDrug()!=null){ | ||
62 | yearYjhjMb = Double.parseDouble(target.getTargetDrug()); | ||
63 | } | ||
64 | } | ||
65 | queryWrapper.eq(ReportTargetConfig::getTargetYear,tbYear); | ||
66 | List<ReportTargetConfig> yearTbTargetList = reportTargetMapper.selectList(queryWrapper); | ||
67 | if(yearTbTargetList.size() > 0){ | ||
68 | ReportTargetConfig target = yearTbTargetList.get(0); | ||
69 | if(target.getTargetWater()!=null){ | ||
70 | yearTbClslMb = Double.parseDouble(target.getTargetWater()); | ||
71 | } | ||
72 | if(target.getTargetPower()!=null){ | ||
73 | yearTbDlhjMb = Double.parseDouble(target.getTargetPower()); | ||
74 | } | ||
75 | if(target.getTargetDrug()!=null){ | ||
76 | yearTbYjhjMb = Double.parseDouble(target.getTargetDrug()); | ||
77 | } | ||
78 | } | ||
32 | String dataViewName2119Year = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, year); | 79 | String dataViewName2119Year = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, year); |
33 | String dataViewName2119YearTb = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, tbYear); | 80 | String dataViewName2119YearTb = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, tbYear); |
34 | String dataViewName2119Month = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, month); | 81 | String dataViewName2119Month = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, month); |
35 | String dataViewName2119MonthTb = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, tbMonth); | 82 | String dataViewName2119MonthTb = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, tbMonth); |
36 | String dataViewName2119MonthHb = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, hbMonth); | 83 | String dataViewName2119MonthHb = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, hbMonth); |
37 | |||
38 | String field3a24 = "DLHJ,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," + | 84 | String field3a24 = "DLHJ,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," + |
39 | "YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2"; | 85 | "YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2"; |
40 | String dataViewName3a24Year = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, year); | 86 | String dataViewName3a24Year = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, year); |
... | @@ -42,41 +88,101 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer | ... | @@ -42,41 +88,101 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer |
42 | String dataViewName3a24Month = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, month); | 88 | String dataViewName3a24Month = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, month); |
43 | String dataViewName3a24MonthTb = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, tbMonth); | 89 | String dataViewName3a24MonthTb = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, tbMonth); |
44 | String dataViewName3a24MonthHb = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, hbMonth); | 90 | String dataViewName3a24MonthHb = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, hbMonth); |
45 | 91 | //CLSL,DLHJ,YJHJ | |
92 | Map<String,Object> yearMap = factoryOperateCenterMapper.getSdyData(dataViewName2119Year, dataViewName3a24Year, departId, year); | ||
93 | if(yearMap != null){ | ||
94 | if(yearMap.get("CLSL") != null){ | ||
95 | yearClsl = Double.parseDouble(yearMap.get("CLSL").toString()); | ||
96 | } | ||
97 | if(yearMap.get("DLHJ") != null){ | ||
98 | yearDlhj = Double.parseDouble(yearMap.get("DLHJ").toString()); | ||
99 | } | ||
100 | if(yearMap.get("YJHJ") != null){ | ||
101 | yearYjhj = Double.parseDouble(yearMap.get("YJHJ").toString()); | ||
102 | } | ||
103 | } | ||
104 | Map<String,Object> yearTbMap = factoryOperateCenterMapper.getSdyData(dataViewName2119YearTb, dataViewName3a24YearTb, departId, tbYear); | ||
105 | if(yearTbMap != null){ | ||
106 | if(yearTbMap.get("CLSL") != null){ | ||
107 | yearTbClsl = Double.parseDouble(yearTbMap.get("CLSL").toString()); | ||
108 | } | ||
109 | if(yearMap.get("DLHJ") != null){ | ||
110 | yearTbDlhj = Double.parseDouble(yearTbMap.get("DLHJ").toString()); | ||
111 | } | ||
112 | if(yearMap.get("YJHJ") != null){ | ||
113 | yearTbYjhj = Double.parseDouble(yearTbMap.get("YJHJ").toString()); | ||
114 | } | ||
115 | } | ||
116 | Map<String,Object> monthMap = factoryOperateCenterMapper.getSdyData(dataViewName2119Month, dataViewName3a24Month, departId, month); | ||
117 | if(monthMap != null){ | ||
118 | if(yearMap.get("CLSL") != null){ | ||
119 | monthClsl = Double.parseDouble(monthMap.get("CLSL").toString()); | ||
120 | } | ||
121 | if(monthMap.get("DLHJ") != null){ | ||
122 | monthDlhj = Double.parseDouble(monthMap.get("DLHJ").toString()); | ||
123 | } | ||
124 | if(monthMap.get("YJHJ") != null){ | ||
125 | monthYjhj = Double.parseDouble(monthMap.get("YJHJ").toString()); | ||
126 | } | ||
127 | } | ||
128 | Map<String,Object> monthTbMap = factoryOperateCenterMapper.getSdyData(dataViewName2119MonthTb, dataViewName3a24MonthTb, departId, tbMonth); | ||
129 | if(monthTbMap != null){ | ||
130 | if(monthTbMap.get("CLSL") != null){ | ||
131 | monthTbClsl = Double.parseDouble(monthTbMap.get("CLSL").toString()); | ||
132 | } | ||
133 | if(monthTbMap.get("DLHJ") != null){ | ||
134 | monthTbDlhj = Double.parseDouble(monthTbMap.get("DLHJ").toString()); | ||
135 | } | ||
136 | if(monthTbMap.get("YJHJ") != null){ | ||
137 | monthTbYjhj = Double.parseDouble(monthTbMap.get("YJHJ").toString()); | ||
138 | } | ||
139 | } | ||
140 | Map<String,Object> monthHbMap = factoryOperateCenterMapper.getSdyData(dataViewName2119MonthHb, dataViewName3a24MonthHb, departId, hbMonth); | ||
141 | if(monthHbMap != null){ | ||
142 | if(monthHbMap.get("CLSL") != null){ | ||
143 | monthHbClsl = Double.parseDouble(monthHbMap.get("CLSL").toString()); | ||
144 | } | ||
145 | if(monthHbMap.get("DLHJ") != null){ | ||
146 | monthHbDlhj = Double.parseDouble(monthHbMap.get("DLHJ").toString()); | ||
147 | } | ||
148 | if(monthHbMap.get("YJHJ") != null){ | ||
149 | monthHbYjhj = Double.parseDouble(monthHbMap.get("YJHJ").toString()); | ||
150 | } | ||
151 | } | ||
46 | Map<String, Object> map = new HashMap<>(); | 152 | Map<String, Object> map = new HashMap<>(); |
47 | map.put("nclsl",new HashMap<>()); | 153 | map.put("nclsl",new HashMap<>()); |
48 | Map<String, Object> nclslMap = new HashMap<>(); | 154 | Map<String, Object> nclslMap = new HashMap<>(); |
49 | nclslMap.put("nsjsl","1267"); | 155 | nclslMap.put("nsjsl", yearClsl); |
50 | nclslMap.put("wcbfb","80"); | 156 | nclslMap.put("wcbfb", df.format(100*yearClsl/yearClslMb)); |
51 | nclslMap.put("nmb","1678"); | 157 | nclslMap.put("nmb", yearClslMb); |
52 | nclslMap.put("nmbTb","1"); | 158 | nclslMap.put("nmbTb", df.format((yearClslMb-yearTbClslMb)/yearClslMb)); |
53 | nclslMap.put("nwcd","1234"); | 159 | nclslMap.put("nwcd", df.format(100*yearClsl/yearClslMb)); |
54 | nclslMap.put("nwcdTb","3"); | 160 | nclslMap.put("nwcdTb", "1"); |
55 | 161 | ||
56 | map.put("yclsl",new HashMap<>()); | 162 | map.put("yclsl",new HashMap<>()); |
57 | Map<String, Object> yclslMap = new HashMap<>(); | 163 | Map<String, Object> yclslMap = new HashMap<>(); |
58 | yclslMap.put("ysjsl","185"); | 164 | yclslMap.put("ysjsl", monthClsl); |
59 | yclslMap.put("wcbfb","80"); | 165 | yclslMap.put("wcbfb", df.format(100*monthClsl/(yearClslMb/12))); |
60 | yclslMap.put("ymb","161"); | 166 | yclslMap.put("ymb", df.format(yearClslMb/12)); |
61 | yclslMap.put("ymbTb","5"); | 167 | yclslMap.put("ymbTb", "0"); |
62 | yclslMap.put("ywcd","161"); | 168 | yclslMap.put("ywcd", df.format(100*monthClsl/(yearClslMb/12))); |
63 | yclslMap.put("ywcdTb","2"); | 169 | yclslMap.put("ywcdTb", "0"); |
64 | 170 | ||
65 | map.put("ndsdh",new HashMap<>()); | 171 | map.put("ndsdh",new HashMap<>()); |
66 | Map<String, Object> ndsdhMap = new HashMap<>(); | 172 | Map<String, Object> ndsdhMap = new HashMap<>(); |
67 | ndsdhMap.put("ndsdh","0.5"); | 173 | ndsdhMap.put("ndsdh", df.format(yearDlhj/(10000*yearClsl))); |
68 | ndsdhMap.put("nmb","0.45"); | 174 | ndsdhMap.put("nmb", yearDlhjMb); |
69 | ndsdhMap.put("nmbTb","1"); | 175 | ndsdhMap.put("nmbTb", yearTbDlhjMb); |
70 | ndsdhMap.put("ydsdh","0.32"); | 176 | ndsdhMap.put("ydsdh", "0.32"); |
71 | ndsdhMap.put("ydsdhTb","0"); | 177 | ndsdhMap.put("ydsdhTb", "0"); |
72 | 178 | ||
73 | map.put("ndsyf",new HashMap<>()); | 179 | map.put("ndsyf",new HashMap<>()); |
74 | Map<String, Object> ndsyfMap = new HashMap<>(); | 180 | Map<String, Object> ndsyfMap = new HashMap<>(); |
75 | ndsyfMap.put("ndsyf","0.8"); | 181 | ndsyfMap.put("ndsyf", df.format(yearYjhj/(10000*yearClsl))); |
76 | ndsyfMap.put("nmb","0.65"); | 182 | ndsyfMap.put("nmb", yearYjhjMb); |
77 | ndsyfMap.put("nmbTb","2"); | 183 | ndsyfMap.put("nmbTb", yearTbYjhjMb); |
78 | ndsyfMap.put("ydsyf","0.68"); | 184 | ndsyfMap.put("ydsyf","0.68"); |
79 | ndsyfMap.put("ydsyfTb","1"); | 185 | ndsyfMap.put("ydsyfTb","0"); |
80 | 186 | ||
81 | map.put("zhpf",new HashMap<>()); | 187 | map.put("zhpf",new HashMap<>()); |
82 | Map<String, Object> zhpfMap = new HashMap<>(); | 188 | Map<String, Object> zhpfMap = new HashMap<>(); | ... | ... |
-
请 注册 或 登录 后发表评论