Commit e309b0bb7f69c567981dff954497824ab01fb589
1 parent
4bb4092e
修复bug
Showing
1 changed file
with
24 additions
and
27 deletions
trash-workFlow/src/main/java/com/trash/casefile/kafka/Consumer.java
| @@ -141,38 +141,35 @@ public class Consumer { | @@ -141,38 +141,35 @@ public class Consumer { | ||
| 141 | String describe = ""; | 141 | String describe = ""; |
| 142 | String alarmTimeString = DateFormatUtils.format(alarmTime,"HH:mm"); | 142 | String alarmTimeString = DateFormatUtils.format(alarmTime,"HH:mm"); |
| 143 | //根据不同违规类型,走不同流程 | 143 | //根据不同违规类型,走不同流程 |
| 144 | - int count = 0; | ||
| 145 | switch (violationTypeCode) { | 144 | switch (violationTypeCode) { |
| 146 | case "44030020"://工地预警-未报开工作业 | 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 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + | 152 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + |
| 154 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); | 153 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); |
| 155 | }else{ | 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 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + | 156 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + |
| 158 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); | 157 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); |
| 159 | } | 158 | } |
| 160 | //报警次数等于5推送案卷 | 159 | //报警次数等于5推送案卷 |
| 161 | - if(count==5){ | 160 | + if(count44030020==5){ |
| 162 | violationWarningInformation.setViolationObjectType("0"); | 161 | violationWarningInformation.setViolationObjectType("0"); |
| 163 | violationWarningInformation.setSendObject("区管理部门"); | 162 | violationWarningInformation.setSendObject("区管理部门"); |
| 164 | violationWarningInformation.setProjectName(jsonObject.getString("siteName")); | 163 | violationWarningInformation.setProjectName(jsonObject.getString("siteName")); |
| 165 | - | ||
| 166 | - | ||
| 167 | violationWarningInformation.setCreateTime(alarmTime); | 164 | violationWarningInformation.setCreateTime(alarmTime); |
| 168 | violationWarningInformation.setDescribe(describe); | 165 | violationWarningInformation.setDescribe(describe); |
| 169 | // 业务逻辑 | 166 | // 业务逻辑 |
| 170 | violationWarningInformationService.insertViolationWarningInformation(null, violationWarningInformation); | 167 | violationWarningInformationService.insertViolationWarningInformation(null, violationWarningInformation); |
| 171 | } | 168 | } |
| 172 | //次数+1 | 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 | break; | 173 | break; |
| 177 | case "44030023"://工地预警-未按时间作业 | 174 | case "44030023"://工地预警-未按时间作业 |
| 178 | try{ | 175 | try{ |
| @@ -184,10 +181,10 @@ public class Consumer { | @@ -184,10 +181,10 @@ public class Consumer { | ||
| 184 | String startTime = manipulateTime(transportStartTime,-30); | 181 | String startTime = manipulateTime(transportStartTime,-30); |
| 185 | //获取结束运输报警次数 | 182 | //获取结束运输报警次数 |
| 186 | String countKey = nowDate+jsonObject.getString("siteId")+"44030023"+transportEndTime; | 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 | String describeKey = nowDate+jsonObject.getString("siteId")+"44030023describe"+transportEndTime; | 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 | String countEKey = nowDate+jsonObject.getString("siteId")+"44030023"+transportStartTime; | 189 | String countEKey = nowDate+jsonObject.getString("siteId")+"44030023"+transportStartTime; |
| 193 | int countE = redisCache.getCacheObject(countEKey)==null?1:Integer.parseInt(redisCache.getCacheObject(countEKey).toString())+1; | 190 | int countE = redisCache.getCacheObject(countEKey)==null?1:Integer.parseInt(redisCache.getCacheObject(countEKey).toString())+1; |
| @@ -195,17 +192,17 @@ public class Consumer { | @@ -195,17 +192,17 @@ public class Consumer { | ||
| 195 | String describeEKey = nowDate+jsonObject.getString("siteId")+"44030023describe"+transportStartTime; | 192 | String describeEKey = nowDate+jsonObject.getString("siteId")+"44030023describe"+transportStartTime; |
| 196 | String describeE = redisCache.getCacheObject(describeEKey)==null?"":redisCache.getCacheObject(describeEKey).toString(); | 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 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + | 197 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + |
| 201 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); | 198 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); |
| 202 | }else{ | 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 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + | 201 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + |
| 205 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); | 202 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); |
| 206 | } | 203 | } |
| 207 | //报警次数等于5推送案卷 | 204 | //报警次数等于5推送案卷 |
| 208 | - if(count==5){ | 205 | + if(count44030023==5){ |
| 209 | violationWarningInformation.setViolationObjectType("0"); | 206 | violationWarningInformation.setViolationObjectType("0"); |
| 210 | violationWarningInformation.setSendObject("区管理部门"); | 207 | violationWarningInformation.setSendObject("区管理部门"); |
| 211 | violationWarningInformation.setProjectName(jsonObject.getString("siteName")); | 208 | violationWarningInformation.setProjectName(jsonObject.getString("siteName")); |
| @@ -241,9 +238,9 @@ public class Consumer { | @@ -241,9 +238,9 @@ public class Consumer { | ||
| 241 | //判断结束运输 | 238 | //判断结束运输 |
| 242 | if(isTimeWithinRange(alarmTimeString,transportEndTime,endTime)){ | 239 | if(isTimeWithinRange(alarmTimeString,transportEndTime,endTime)){ |
| 243 | //次数+1 | 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 | }else if(isTimeWithinRange(alarmTimeString,startTime,transportStartTime)){ | 244 | }else if(isTimeWithinRange(alarmTimeString,startTime,transportStartTime)){ |
| 248 | //次数+1 | 245 | //次数+1 |
| 249 | redisCache.setCacheObject(countEKey,countE,12, TimeUnit.HOURS); | 246 | redisCache.setCacheObject(countEKey,countE,12, TimeUnit.HOURS); |
| @@ -275,20 +272,20 @@ public class Consumer { | @@ -275,20 +272,20 @@ public class Consumer { | ||
| 275 | 272 | ||
| 276 | case "44030024"://处理场所预警-未报开工作业 | 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 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + | 280 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + |
| 284 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); | 281 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); |
| 285 | }else{ | 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 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + | 284 | + violationWarningInformation.getCompanyName() + " " + jsonObject.get("licenseplateNo") + "在" + |
| 288 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); | 285 | jsonObject.get("siteName") + "出现" + violationWarningInformation.getViolationType(); |
| 289 | } | 286 | } |
| 290 | //报警次数等于5推送案卷 | 287 | //报警次数等于5推送案卷 |
| 291 | - if(count==5){ | 288 | + if(count44030024==5){ |
| 292 | violationWarningInformation.setViolationObjectType("1"); | 289 | violationWarningInformation.setViolationObjectType("1"); |
| 293 | violationWarningInformation.setSendObject("区管理部门"); | 290 | violationWarningInformation.setSendObject("区管理部门"); |
| 294 | violationWarningInformation.setProjectName(jsonObject.getString("siteName")); | 291 | violationWarningInformation.setProjectName(jsonObject.getString("siteName")); |
| @@ -301,9 +298,9 @@ public class Consumer { | @@ -301,9 +298,9 @@ public class Consumer { | ||
| 301 | 298 | ||
| 302 | 299 | ||
| 303 | //次数+1 | 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 | break; | 304 | break; |
| 308 | case "44030027"://处理场所预警-未到指定的处理场所作业 | 305 | case "44030027"://处理场所预警-未到指定的处理场所作业 |
| 309 | case "44030026"://处理场所预警-三无车辆进入处理场所 | 306 | case "44030026"://处理场所预警-三无车辆进入处理场所 |