Commit e309b0bb7f69c567981dff954497824ab01fb589

Authored by 273548560@qq.com
1 parent 4bb4092e

修复bug

trash-workFlow/src/main/java/com/trash/casefile/kafka/Consumer.java
... ... @@ -141,38 +141,35 @@ public class Consumer {
141 141 String describe = "";
142 142 String alarmTimeString = DateFormatUtils.format(alarmTime,"HH:mm");
143 143 //根据不同违规类型,走不同流程
144   - int count = 0;
145 144 switch (violationTypeCode) {
146 145 case "44030020"://工地预警-未报开工作业
147 146 //获取报警次数
148   - count = redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030020")==null?1:Integer.parseInt(redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030020").toString())+1;
  147 + int count44030020 = redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030020")==null?1:Integer.parseInt(redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030020").toString())+1;
149 148 //获取累计报警描述
150   - describe = redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030020describe")==null?"":redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030020describe").toString();
151   - if(!StringUtils.isEmpty(describe)){
152   - describe = describe + ";\n" + DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
  149 + String describe44030020 = redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030020describe")==null?"":redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030020describe").toString();
  150 + if(!StringUtils.isEmpty(describe44030020)){
  151 + describe44030020 = describe44030020 + ";\n" + DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
153 152 + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" +
154 153 jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType();
155 154 }else{
156   - describe = DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
  155 + describe44030020 = DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
157 156 + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" +
158 157 jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType();
159 158 }
160 159 //报警次数等于5推送案卷
161   - if(count==5){
  160 + if(count44030020==5){
162 161 violationWarningInformation.setViolationObjectType("0");
163 162 violationWarningInformation.setSendObject("区管理部门");
164 163 violationWarningInformation.setProjectName(jsonObject.getString("siteName"));
165   -
166   -
167 164 violationWarningInformation.setCreateTime(alarmTime);
168 165 violationWarningInformation.setDescribe(describe);
169 166 // 业务逻辑
170 167 violationWarningInformationService.insertViolationWarningInformation(null, violationWarningInformation);
171 168 }
172 169 //次数+1
173   - redisCache.setCacheObject(nowDate+jsonObject.getString("siteId")+"44030020",count,1, TimeUnit.DAYS);
  170 + redisCache.setCacheObject(nowDate+jsonObject.getString("siteId")+"44030020",count44030020,1, TimeUnit.DAYS);
174 171 //累计描述
175   - redisCache.setCacheObject(nowDate+jsonObject.getString("siteId")+"44030020describe",describe,1, TimeUnit.DAYS);
  172 + redisCache.setCacheObject(nowDate+jsonObject.getString("siteId")+"44030020describe",describe44030020,1, TimeUnit.DAYS);
176 173 break;
177 174 case "44030023"://工地预警-未按时间作业
178 175 try{
... ... @@ -184,10 +181,10 @@ public class Consumer {
184 181 String startTime = manipulateTime(transportStartTime,-30);
185 182 //获取结束运输报警次数
186 183 String countKey = nowDate+jsonObject.getString("siteId")+"44030023"+transportEndTime;
187   - count = redisCache.getCacheObject(countKey)==null?1:Integer.parseInt(redisCache.getCacheObject(countKey).toString())+1;
  184 + int count44030023 = redisCache.getCacheObject(countKey)==null?1:Integer.parseInt(redisCache.getCacheObject(countKey).toString())+1;
188 185 //获取结束运输累计报警描述
189 186 String describeKey = nowDate+jsonObject.getString("siteId")+"44030023describe"+transportEndTime;
190   - describe = redisCache.getCacheObject(describeKey)==null?"":redisCache.getCacheObject(describeKey).toString();
  187 + String describe44030023 = redisCache.getCacheObject(describeKey)==null?"":redisCache.getCacheObject(describeKey).toString();
191 188 //获取结束运输报警次数
192 189 String countEKey = nowDate+jsonObject.getString("siteId")+"44030023"+transportStartTime;
193 190 int countE = redisCache.getCacheObject(countEKey)==null?1:Integer.parseInt(redisCache.getCacheObject(countEKey).toString())+1;
... ... @@ -195,17 +192,17 @@ public class Consumer {
195 192 String describeEKey = nowDate+jsonObject.getString("siteId")+"44030023describe"+transportStartTime;
196 193 String describeE = redisCache.getCacheObject(describeEKey)==null?"":redisCache.getCacheObject(describeEKey).toString();
197 194  
198   - if(!StringUtils.isEmpty(describe)){
199   - describe = describe + ";\n" + DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
  195 + if(!StringUtils.isEmpty(describe44030023)){
  196 + describe44030023 = describe44030023 + ";\n" + DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
200 197 + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" +
201 198 jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType();
202 199 }else{
203   - describe = DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
  200 + describe44030023 = DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
204 201 + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" +
205 202 jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType();
206 203 }
207 204 //报警次数等于5推送案卷
208   - if(count==5){
  205 + if(count44030023==5){
209 206 violationWarningInformation.setViolationObjectType("0");
210 207 violationWarningInformation.setSendObject("区管理部门");
211 208 violationWarningInformation.setProjectName(jsonObject.getString("siteName"));
... ... @@ -241,9 +238,9 @@ public class Consumer {
241 238 //判断结束运输
242 239 if(isTimeWithinRange(alarmTimeString,transportEndTime,endTime)){
243 240 //次数+1
244   - redisCache.setCacheObject(countKey,count,12, TimeUnit.HOURS);
  241 + redisCache.setCacheObject(countKey,count44030023,12, TimeUnit.HOURS);
245 242 //累计描述
246   - redisCache.setCacheObject(describeKey,describe,12, TimeUnit.HOURS);
  243 + redisCache.setCacheObject(describeKey,describe44030023,12, TimeUnit.HOURS);
247 244 }else if(isTimeWithinRange(alarmTimeString,startTime,transportStartTime)){
248 245 //次数+1
249 246 redisCache.setCacheObject(countEKey,countE,12, TimeUnit.HOURS);
... ... @@ -275,20 +272,20 @@ public class Consumer {
275 272  
276 273 case "44030024"://处理场所预警-未报开工作业
277 274 //获取报警次数
278   - count = redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030024")==null?1:Integer.parseInt(redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030024").toString())+1;
  275 + int count44030024 = redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030024")==null?1:Integer.parseInt(redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030024").toString())+1;
279 276 //获取累计报警描述
280   - describe = redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030024describe")==null?"":redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030024describe").toString();
281   - if(!StringUtils.isEmpty(describe)){
282   - describe = describe + ";\n" + DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
  277 + String describe44030024 = redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030024describe")==null?"":redisCache.getCacheObject(nowDate+jsonObject.getString("siteId")+"44030024describe").toString();
  278 + if(!StringUtils.isEmpty(describe44030024)){
  279 + describe44030024 = describe44030024 + ";\n" + DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
283 280 + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" +
284 281 jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType();
285 282 }else{
286   - describe = DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
  283 + describe44030024 = DateFormatUtils.format(alarmTime, "yyyy/MM/dd HH:mm:ss") + " "
287 284 + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" +
288 285 jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType();
289 286 }
290 287 //报警次数等于5推送案卷
291   - if(count==5){
  288 + if(count44030024==5){
292 289 violationWarningInformation.setViolationObjectType("1");
293 290 violationWarningInformation.setSendObject("区管理部门");
294 291 violationWarningInformation.setProjectName(jsonObject.getString("siteName"));
... ... @@ -301,9 +298,9 @@ public class Consumer {
301 298  
302 299  
303 300 //次数+1
304   - redisCache.setCacheObject(nowDate+jsonObject.getString("siteId")+"44030024",count,1, TimeUnit.DAYS);
  301 + redisCache.setCacheObject(nowDate+jsonObject.getString("siteId")+"44030024",count44030024,1, TimeUnit.DAYS);
305 302 //累计描述
306   - redisCache.setCacheObject(nowDate+jsonObject.getString("siteId")+"44030024describe",describe,1, TimeUnit.DAYS);
  303 + redisCache.setCacheObject(nowDate+jsonObject.getString("siteId")+"44030024describe",describe44030024,1, TimeUnit.DAYS);
307 304 break;
308 305 case "44030027"://处理场所预警-未到指定的处理场所作业
309 306 case "44030026"://处理场所预警-三无车辆进入处理场所
... ...