Commit 21d68d52f858f05a6ff9c0435a03998cbfc59a2c
1 parent
46d1c007
代码重构;
问题处理;
Showing
5 changed files
with
72 additions
and
99 deletions
src/main/java/com/objecteye/service/impl/LocusOrbitServiceImpl.java
@@ -124,6 +124,9 @@ public class LocusOrbitServiceImpl implements ILocusOrbitService { | @@ -124,6 +124,9 @@ public class LocusOrbitServiceImpl implements ILocusOrbitService { | ||
124 | Criteria criteria = new Criteria(); | 124 | Criteria criteria = new Criteria(); |
125 | // 车牌 | 125 | // 车牌 |
126 | criteria.and("vehicle_plate_hphm").is(locusOrbitQueryParams.getPlateNumber()); | 126 | criteria.and("vehicle_plate_hphm").is(locusOrbitQueryParams.getPlateNumber()); |
127 | + // 坐标值不能为空 | ||
128 | + criteria.and("longitude").ne(null); | ||
129 | + criteria.and("latitude").ne(null); | ||
127 | // 开始时间 | 130 | // 开始时间 |
128 | // 结束时间 | 131 | // 结束时间 |
129 | Long startTime = locusOrbitQueryParams.getStartTime(); | 132 | Long startTime = locusOrbitQueryParams.getStartTime(); |
@@ -161,26 +164,18 @@ public class LocusOrbitServiceImpl implements ILocusOrbitService { | @@ -161,26 +164,18 @@ public class LocusOrbitServiceImpl implements ILocusOrbitService { | ||
161 | // 倒序排列 | 164 | // 倒序排列 |
162 | rabbitMqVehicles.sort((o1, o2) -> (int) (o2.getPictime() - o1.getPictime())); | 165 | rabbitMqVehicles.sort((o1, o2) -> (int) (o2.getPictime() - o1.getPictime())); |
163 | 166 | ||
164 | - // 时间游标 | ||
165 | - Long lastPictime = Long.MAX_VALUE; | ||
166 | - | ||
167 | for (RabbitMQVehicle rabbitMqVehicle : rabbitMqVehicles) { | 167 | for (RabbitMQVehicle rabbitMqVehicle : rabbitMqVehicles) { |
168 | if (null == rabbitMqVehicle || null == rabbitMqVehicle.getPictime()) { | 168 | if (null == rabbitMqVehicle || null == rabbitMqVehicle.getPictime()) { |
169 | continue; | 169 | continue; |
170 | } | 170 | } |
171 | - Long currentPictime = rabbitMqVehicle.getPictime(); | ||
172 | - // 更新时间游标 | ||
173 | - if (lastPictime - currentPictime > DISTINCT_TIME_INTERVAL) { | ||
174 | - lastPictime = currentPictime; | ||
175 | - LocusOrbitResultParams locusOrbitResultParams = new LocusOrbitResultParams(); | ||
176 | - locusOrbitResultParams.setId(rabbitMqVehicle.getId()); | ||
177 | - locusOrbitResultParams.setPlateNumber(rabbitMqVehicle.getVehicle_plate_hphm()); | ||
178 | - locusOrbitResultParams.setPictime(DateUtil.format(new Date(currentPictime), "yyyy-MM-dd HH:mm:ss")); | ||
179 | - locusOrbitResultParams.setLongitude(rabbitMqVehicle.getLongitude()); | ||
180 | - locusOrbitResultParams.setLatitude(rabbitMqVehicle.getLatitude()); | ||
181 | - locusOrbitResultParams.setSnapshotUrl(rabbitMqVehicle.getSnapshoturl()); | ||
182 | - resultList.add(locusOrbitResultParams); | ||
183 | - } | 171 | + LocusOrbitResultParams locusOrbitResultParams = new LocusOrbitResultParams(); |
172 | + locusOrbitResultParams.setId(rabbitMqVehicle.getId()); | ||
173 | + locusOrbitResultParams.setPlateNumber(rabbitMqVehicle.getVehicle_plate_hphm()); | ||
174 | + locusOrbitResultParams.setPictime(DateUtil.format(new Date(rabbitMqVehicle.getPictime()), "yyyy-MM-dd HH:mm:ss")); | ||
175 | + locusOrbitResultParams.setLongitude(rabbitMqVehicle.getLongitude()); | ||
176 | + locusOrbitResultParams.setLatitude(rabbitMqVehicle.getLatitude()); | ||
177 | + locusOrbitResultParams.setSnapshotUrl(rabbitMqVehicle.getSnapshoturl()); | ||
178 | + resultList.add(locusOrbitResultParams); | ||
184 | } | 179 | } |
185 | // 重新排序 | 180 | // 重新排序 |
186 | resultList.sort((o1, o2) -> { | 181 | resultList.sort((o1, o2) -> { |
src/main/java/com/objecteye/service/impl/UploadFileServiceImpl.java
@@ -6,12 +6,12 @@ import com.objecteye.config.RabbitmqConfig; | @@ -6,12 +6,12 @@ import com.objecteye.config.RabbitmqConfig; | ||
6 | import com.objecteye.entity.ResponseParam; | 6 | import com.objecteye.entity.ResponseParam; |
7 | import com.objecteye.entity.UploadVehicleResult; | 7 | import com.objecteye.entity.UploadVehicleResult; |
8 | import com.objecteye.entity.VpAnalysisParam; | 8 | import com.objecteye.entity.VpAnalysisParam; |
9 | +import com.objecteye.exception.CustomXException; | ||
9 | import com.objecteye.service.IUploadFileService; | 10 | import com.objecteye.service.IUploadFileService; |
10 | import com.objecteye.utils.GlobalUtil; | 11 | import com.objecteye.utils.GlobalUtil; |
11 | import org.springframework.amqp.rabbit.core.RabbitTemplate; | 12 | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
12 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
13 | import org.springframework.beans.factory.annotation.Value; | 14 | import org.springframework.beans.factory.annotation.Value; |
14 | -import org.springframework.data.redis.core.RedisTemplate; | ||
15 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
16 | import org.springframework.web.multipart.MultipartFile; | 16 | import org.springframework.web.multipart.MultipartFile; |
17 | 17 | ||
@@ -21,12 +21,10 @@ import java.io.IOException; | @@ -21,12 +21,10 @@ import java.io.IOException; | ||
21 | @Component | 21 | @Component |
22 | public class UploadFileServiceImpl implements IUploadFileService { | 22 | public class UploadFileServiceImpl implements IUploadFileService { |
23 | @Autowired | 23 | @Autowired |
24 | - private RedisTemplate redisTemplate; | ||
25 | - @Autowired | ||
26 | private RabbitTemplate rabbitTemplate; | 24 | private RabbitTemplate rabbitTemplate; |
27 | 25 | ||
28 | @Value("${picture.storePath}") | 26 | @Value("${picture.storePath}") |
29 | - private String path2; | 27 | + private String storePath; |
30 | @Value("${picture.http}") | 28 | @Value("${picture.http}") |
31 | private String http; | 29 | private String http; |
32 | @Value("${requestFile}") | 30 | @Value("${requestFile}") |
@@ -42,8 +40,10 @@ public class UploadFileServiceImpl implements IUploadFileService { | @@ -42,8 +40,10 @@ public class UploadFileServiceImpl implements IUploadFileService { | ||
42 | public JSONObject uploadFile2Mongo(MultipartFile multipartFile) throws IOException { | 40 | public JSONObject uploadFile2Mongo(MultipartFile multipartFile) throws IOException { |
43 | // 格式化文件名由format开头, e.g. format-15321354564-12.12654_15.156567.jpg | 41 | // 格式化文件名由format开头, e.g. format-15321354564-12.12654_15.156567.jpg |
44 | String fileName = multipartFile.getOriginalFilename(); | 42 | String fileName = multipartFile.getOriginalFilename(); |
45 | - String picPath = GlobalUtil.dbPath1() + File.separator + "export" + File.separator + "vehicleProject" | ||
46 | - + File.separator + "picture" + File.separator + fileName; | 43 | + if (fileName == null || "".equals(fileName)) { |
44 | + throw new CustomXException("文件名不能不能为空", "201"); | ||
45 | + } | ||
46 | + String picPath = storePath + File.separator + fileName; | ||
47 | File newFile = new File(picPath); | 47 | File newFile = new File(picPath); |
48 | multipartFile.transferTo(newFile); | 48 | multipartFile.transferTo(newFile); |
49 | 49 |
src/main/java/com/objecteye/service/impl/VehicleCurrencyServiceImpl.java
@@ -118,7 +118,6 @@ public class VehicleCurrencyServiceImpl implements VehicleCurrencyService { | @@ -118,7 +118,6 @@ public class VehicleCurrencyServiceImpl implements VehicleCurrencyService { | ||
118 | c.and("vehicle_pendant_detect_njbnumber").is(njbgs); | 118 | c.and("vehicle_pendant_detect_njbnumber").is(njbgs); |
119 | } | 119 | } |
120 | 120 | ||
121 | - | ||
122 | //号牌类型检索 | 121 | //号牌类型检索 |
123 | if (hplx != null) { | 122 | if (hplx != null) { |
124 | c.and("vehicleplatetype").is(hplx); | 123 | c.and("vehicleplatetype").is(hplx); |
src/main/java/com/objecteye/utils/HttpClientUtils.java
@@ -26,8 +26,7 @@ public class HttpClientUtils { | @@ -26,8 +26,7 @@ public class HttpClientUtils { | ||
26 | private VehicleEngine vehicleEngine; | 26 | private VehicleEngine vehicleEngine; |
27 | 27 | ||
28 | public String VehicleAnalysis(String TPXX) { | 28 | public String VehicleAnalysis(String TPXX) { |
29 | - String result = VehicleAnalysis("", TPXX, "", ""); | ||
30 | - return result; | 29 | + return VehicleAnalysis("", TPXX, "", ""); |
31 | 30 | ||
32 | } | 31 | } |
33 | 32 | ||
@@ -41,7 +40,7 @@ public class HttpClientUtils { | @@ -41,7 +40,7 @@ public class HttpClientUtils { | ||
41 | 40 | ||
42 | Map<String, String> uriVariables = new HashMap<>(); | 41 | Map<String, String> uriVariables = new HashMap<>(); |
43 | uriVariables.put("GCXH", GCXH); | 42 | uriVariables.put("GCXH", GCXH); |
44 | - if (TPXX != null || TPXX.length() > 0) { | 43 | + if (TPXX != null && TPXX.length() > 0) { |
45 | uriVariables.put("TPXX", TPXX); | 44 | uriVariables.put("TPXX", TPXX); |
46 | } else { | 45 | } else { |
47 | uriVariables.put("TPXX", "/software/sy/vehicle-socket/c++/image/test.jpg"); | 46 | uriVariables.put("TPXX", "/software/sy/vehicle-socket/c++/image/test.jpg"); |
@@ -49,14 +48,12 @@ public class HttpClientUtils { | @@ -49,14 +48,12 @@ public class HttpClientUtils { | ||
49 | uriVariables.put("MRHPT", MRHPT); | 48 | uriVariables.put("MRHPT", MRHPT); |
50 | uriVariables.put("HPHM", HPHM); | 49 | uriVariables.put("HPHM", HPHM); |
51 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(requestUrl, uriVariables, String.class); | 50 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(requestUrl, uriVariables, String.class); |
52 | - String body = responseEntity.getBody(); | ||
53 | - return body; | 51 | + return responseEntity.getBody(); |
54 | } | 52 | } |
55 | 53 | ||
56 | //获取临时上传的图片数据信息 | 54 | //获取临时上传的图片数据信息 |
57 | public String VehicleAnalysisTmp(MultipartFile TPXX) { | 55 | public String VehicleAnalysisTmp(MultipartFile TPXX) { |
58 | - String analysis = VehicleAnalysisTmp("", TPXX, "", ""); | ||
59 | - return analysis; | 56 | + return VehicleAnalysisTmp("", TPXX, "", ""); |
60 | } | 57 | } |
61 | 58 | ||
62 | //获取临时上传的图片数据信息 | 59 | //获取临时上传的图片数据信息 |
src/main/java/com/objecteye/utils/RabbitMQVehicleTools.java
@@ -238,7 +238,7 @@ public class RabbitMQVehicleTools { | @@ -238,7 +238,7 @@ public class RabbitMQVehicleTools { | ||
238 | 238 | ||
239 | // vehicle_illegal_driver_person_status; | 239 | // vehicle_illegal_driver_person_status; |
240 | int vehicle_illegal_driver_person_status = rabbitMQVehicle.getVehicle_illegal_driver_person_status(); | 240 | int vehicle_illegal_driver_person_status = rabbitMQVehicle.getVehicle_illegal_driver_person_status(); |
241 | - String vehicleIllegalStatus3 = nullStatus; | 241 | + String vehicleIllegalStatus3; |
242 | if (vehicle_illegal_driver_person_status == 1003) { | 242 | if (vehicle_illegal_driver_person_status == 1003) { |
243 | vehicleIllegalStatus3 = "无人"; | 243 | vehicleIllegalStatus3 = "无人"; |
244 | } else if (vehicle_illegal_driver_person_status == 1004) { | 244 | } else if (vehicle_illegal_driver_person_status == 1004) { |
@@ -251,7 +251,7 @@ public class RabbitMQVehicleTools { | @@ -251,7 +251,7 @@ public class RabbitMQVehicleTools { | ||
251 | if ("有人".equals(vehicleIllegalStatus3)) { | 251 | if ("有人".equals(vehicleIllegalStatus3)) { |
252 | // vehicle_illegal_driver_smoke_status; | 252 | // vehicle_illegal_driver_smoke_status; |
253 | int vehicle_illegal_driver_smoke_status = rabbitMQVehicle.getVehicle_illegal_driver_smoke_status(); | 253 | int vehicle_illegal_driver_smoke_status = rabbitMQVehicle.getVehicle_illegal_driver_smoke_status(); |
254 | - String vehicleIllegalStatus = nullStatus; | 254 | + String vehicleIllegalStatus; |
255 | if (vehicle_illegal_driver_smoke_status == 1000) { | 255 | if (vehicle_illegal_driver_smoke_status == 1000) { |
256 | vehicleIllegalStatus = "吸烟"; | 256 | vehicleIllegalStatus = "吸烟"; |
257 | } else if (vehicle_illegal_driver_smoke_status == 1001) { | 257 | } else if (vehicle_illegal_driver_smoke_status == 1001) { |
@@ -263,7 +263,7 @@ public class RabbitMQVehicleTools { | @@ -263,7 +263,7 @@ public class RabbitMQVehicleTools { | ||
263 | 263 | ||
264 | // vehicle_illegal_driver_belt_status; | 264 | // vehicle_illegal_driver_belt_status; |
265 | int vehicle_illegal_driver_belt_status = rabbitMQVehicle.getVehicle_illegal_driver_belt_status(); | 265 | int vehicle_illegal_driver_belt_status = rabbitMQVehicle.getVehicle_illegal_driver_belt_status(); |
266 | - String vehicleIllegalStatus1 = nullStatus; | 266 | + String vehicleIllegalStatus1; |
267 | if (vehicle_illegal_driver_belt_status == 1000) { | 267 | if (vehicle_illegal_driver_belt_status == 1000) { |
268 | vehicleIllegalStatus1 = "未系安全带"; | 268 | vehicleIllegalStatus1 = "未系安全带"; |
269 | } else if (vehicle_illegal_driver_belt_status == 1001) { | 269 | } else if (vehicle_illegal_driver_belt_status == 1001) { |
@@ -275,7 +275,7 @@ public class RabbitMQVehicleTools { | @@ -275,7 +275,7 @@ public class RabbitMQVehicleTools { | ||
275 | 275 | ||
276 | // vehicle_illegal_driver_phone_status; | 276 | // vehicle_illegal_driver_phone_status; |
277 | int vehicle_illegal_driver_phone_status = rabbitMQVehicle.getVehicle_illegal_driver_phone_status(); | 277 | int vehicle_illegal_driver_phone_status = rabbitMQVehicle.getVehicle_illegal_driver_phone_status(); |
278 | - String vehicleIllegalStatus2 = nullStatus; | 278 | + String vehicleIllegalStatus2; |
279 | if (vehicle_illegal_driver_phone_status == 1000) { | 279 | if (vehicle_illegal_driver_phone_status == 1000) { |
280 | vehicleIllegalStatus2 = "打电话"; | 280 | vehicleIllegalStatus2 = "打电话"; |
281 | } else if (vehicle_illegal_driver_phone_status == 1001) { | 281 | } else if (vehicle_illegal_driver_phone_status == 1001) { |
@@ -293,7 +293,7 @@ public class RabbitMQVehicleTools { | @@ -293,7 +293,7 @@ public class RabbitMQVehicleTools { | ||
293 | 293 | ||
294 | // vehicle_illegal_copilot_person_status; | 294 | // vehicle_illegal_copilot_person_status; |
295 | int vehicle_illegal_copilot_person_status = rabbitMQVehicle.getVehicle_illegal_copilot_person_status(); | 295 | int vehicle_illegal_copilot_person_status = rabbitMQVehicle.getVehicle_illegal_copilot_person_status(); |
296 | - String vehicleIllegalStatus7 = nullStatus; | 296 | + String vehicleIllegalStatus7; |
297 | if (vehicle_illegal_copilot_person_status == 1003) { | 297 | if (vehicle_illegal_copilot_person_status == 1003) { |
298 | vehicleIllegalStatus7 = "无人"; | 298 | vehicleIllegalStatus7 = "无人"; |
299 | } else if (vehicle_illegal_copilot_person_status == 1004) { | 299 | } else if (vehicle_illegal_copilot_person_status == 1004) { |
@@ -308,7 +308,7 @@ public class RabbitMQVehicleTools { | @@ -308,7 +308,7 @@ public class RabbitMQVehicleTools { | ||
308 | // vehicle_illegal_copilot_smoke_status; | 308 | // vehicle_illegal_copilot_smoke_status; |
309 | int vehicle_illegal_copilot_smoke_status = rabbitMQVehicle.getVehicle_illegal_copilot_smoke_status(); | 309 | int vehicle_illegal_copilot_smoke_status = rabbitMQVehicle.getVehicle_illegal_copilot_smoke_status(); |
310 | System.out.println("副驾驶吸烟" + vehicle_illegal_copilot_smoke_status); | 310 | System.out.println("副驾驶吸烟" + vehicle_illegal_copilot_smoke_status); |
311 | - String vehicleIllegalStatus4 = nullStatus; | 311 | + String vehicleIllegalStatus4; |
312 | if (vehicle_illegal_copilot_smoke_status == 1000) { | 312 | if (vehicle_illegal_copilot_smoke_status == 1000) { |
313 | vehicleIllegalStatus4 = "吸烟"; | 313 | vehicleIllegalStatus4 = "吸烟"; |
314 | } else if (vehicle_illegal_copilot_smoke_status == 1001) { | 314 | } else if (vehicle_illegal_copilot_smoke_status == 1001) { |
@@ -320,7 +320,7 @@ public class RabbitMQVehicleTools { | @@ -320,7 +320,7 @@ public class RabbitMQVehicleTools { | ||
320 | 320 | ||
321 | // vehicle_illegal_copilot_belt_status; | 321 | // vehicle_illegal_copilot_belt_status; |
322 | int vehicle_illegal_copilot_belt_status = rabbitMQVehicle.getVehicle_illegal_copilot_belt_status(); | 322 | int vehicle_illegal_copilot_belt_status = rabbitMQVehicle.getVehicle_illegal_copilot_belt_status(); |
323 | - String vehicleIllegalStatus5 = nullStatus; | 323 | + String vehicleIllegalStatus5; |
324 | if (vehicle_illegal_copilot_belt_status == 1000) { | 324 | if (vehicle_illegal_copilot_belt_status == 1000) { |
325 | vehicleIllegalStatus5 = "未系安全带"; | 325 | vehicleIllegalStatus5 = "未系安全带"; |
326 | } else if (vehicle_illegal_copilot_belt_status == 1001) { | 326 | } else if (vehicle_illegal_copilot_belt_status == 1001) { |
@@ -332,7 +332,7 @@ public class RabbitMQVehicleTools { | @@ -332,7 +332,7 @@ public class RabbitMQVehicleTools { | ||
332 | 332 | ||
333 | // vehicle_illegal_copilot_phone_status; | 333 | // vehicle_illegal_copilot_phone_status; |
334 | int vehicle_illegal_copilot_phone_status = rabbitMQVehicle.getVehicle_illegal_copilot_phone_status(); | 334 | int vehicle_illegal_copilot_phone_status = rabbitMQVehicle.getVehicle_illegal_copilot_phone_status(); |
335 | - String vehicleIllegalStatus6 = nullStatus; | 335 | + String vehicleIllegalStatus6; |
336 | if (vehicle_illegal_copilot_phone_status == 1000) { | 336 | if (vehicle_illegal_copilot_phone_status == 1000) { |
337 | vehicleIllegalStatus6 = "打电话"; | 337 | vehicleIllegalStatus6 = "打电话"; |
338 | } else if (vehicle_illegal_copilot_phone_status == 1001) { | 338 | } else if (vehicle_illegal_copilot_phone_status == 1001) { |
@@ -470,30 +470,13 @@ public class RabbitMQVehicleTools { | @@ -470,30 +470,13 @@ public class RabbitMQVehicleTools { | ||
470 | 470 | ||
471 | } | 471 | } |
472 | 472 | ||
473 | - | ||
474 | - /*public List<FaceInfoParam> sdkToRabbitPeople(JSONObject jsonObject) { | ||
475 | - List<FaceInfoParam> rabbitMQPeoples = new ArrayList<>(); | ||
476 | - try { | ||
477 | - JSONArray peopleVehicleArr = jsonObject.containsKey("info") ? jsonObject.getJSONArray("info") : null; | ||
478 | - for (int i = 0; i < peopleVehicleArr.size(); i++) { | ||
479 | - JSONObject peopleVehicleSingle = peopleVehicleArr.getJSONObject(i); | ||
480 | - FaceInfoParam faceInfoParam = faceUtils.rabbitToFaceInfo(peopleVehicleSingle, nullStatus); | ||
481 | - rabbitMQPeoples.add(faceInfoParam); | ||
482 | - } | ||
483 | - return rabbitMQPeoples; | ||
484 | - } catch (Exception e) { | ||
485 | - System.out.println("不是规则的JSON格式"); | ||
486 | - return null; | ||
487 | - } | ||
488 | - }*/ | ||
489 | - | ||
490 | public RabbitMQVehicle sdkToOnlyVehicle(JSONObject vehicleSingleInfo) { | 473 | public RabbitMQVehicle sdkToOnlyVehicle(JSONObject vehicleSingleInfo) { |
491 | int count = 0;//在档案中的位置 | 474 | int count = 0;//在档案中的位置 |
492 | String longitude = nullStatus; | 475 | String longitude = nullStatus; |
493 | String latitude = nullStatus; | 476 | String latitude = nullStatus; |
494 | String picurl = nullStatus; //图片的路径 | 477 | String picurl = nullStatus; //图片的路径 |
495 | int recordid = 0; //车辆档案id | 478 | int recordid = 0; //车辆档案id |
496 | - Long pictime = 0l; //抓拍时间 | 479 | + Long pictime = 0L; //抓拍时间 |
497 | int flag = 0; //是否报警 | 480 | int flag = 0; //是否报警 |
498 | int tag = 0; //是否确认 | 481 | int tag = 0; //是否确认 |
499 | String personid = nullStatus; //人像id | 482 | String personid = nullStatus; //人像id |
@@ -556,12 +539,10 @@ public class RabbitMQVehicleTools { | @@ -556,12 +539,10 @@ public class RabbitMQVehicleTools { | ||
556 | } catch (Exception e) { | 539 | } catch (Exception e) { |
557 | RuntimeException exe = new RuntimeException("文件夹创建失败"); | 540 | RuntimeException exe = new RuntimeException("文件夹创建失败"); |
558 | e.printStackTrace(); | 541 | e.printStackTrace(); |
559 | - | ||
560 | } | 542 | } |
561 | 543 | ||
562 | JSONObject colorRes = vehicleSingleInfo.containsKey("vehicle_color_res") ? vehicleSingleInfo.getJSONObject("vehicle_color_res") : null; | 544 | JSONObject colorRes = vehicleSingleInfo.containsKey("vehicle_color_res") ? vehicleSingleInfo.getJSONObject("vehicle_color_res") : null; |
563 | if (colorRes != null) { | 545 | if (colorRes != null) { |
564 | - | ||
565 | vehicle_color_index = colorRes.getInteger("index"); | 546 | vehicle_color_index = colorRes.getInteger("index"); |
566 | vehicle_color_score = colorRes.getFloat("score"); | 547 | vehicle_color_score = colorRes.getFloat("score"); |
567 | } | 548 | } |
@@ -600,7 +581,7 @@ public class RabbitMQVehicleTools { | @@ -600,7 +581,7 @@ public class RabbitMQVehicleTools { | ||
600 | vehicle_illegal_driver_person_confidence = person.getFloat("confidence"); | 581 | vehicle_illegal_driver_person_confidence = person.getFloat("confidence"); |
601 | vehicle_illegal_driver_person_status = person.getInteger("status"); | 582 | vehicle_illegal_driver_person_status = person.getInteger("status"); |
602 | } | 583 | } |
603 | - if (vehicle_illegal_copilot_person_status == 1004) { | 584 | + if (vehicle_illegal_driver_person_status == 1004) { |
604 | JSONObject belt = driver.containsKey("belt") ? driver.getJSONObject("belt") : null; | 585 | JSONObject belt = driver.containsKey("belt") ? driver.getJSONObject("belt") : null; |
605 | if (belt != null) { | 586 | if (belt != null) { |
606 | vehicle_illegal_driver_belt_confidence = belt.getFloat("confidence"); | 587 | vehicle_illegal_driver_belt_confidence = belt.getFloat("confidence"); |
@@ -654,47 +635,48 @@ public class RabbitMQVehicleTools { | @@ -654,47 +635,48 @@ public class RabbitMQVehicleTools { | ||
654 | if (vehicle_pendant_det_res != null) { | 635 | if (vehicle_pendant_det_res != null) { |
655 | vehicle_pendant_count = vehicle_pendant_det_res.getInteger("count"); | 636 | vehicle_pendant_count = vehicle_pendant_det_res.getInteger("count"); |
656 | JSONArray vehiclePendantDetectInfoParams = vehicle_pendant_det_res.getJSONArray("vehiclePendantDetectInfoParams"); | 637 | JSONArray vehiclePendantDetectInfoParams = vehicle_pendant_det_res.getJSONArray("vehiclePendantDetectInfoParams"); |
657 | - int size = vehiclePendantDetectInfoParams.size(); | ||
658 | - if (vehiclePendantDetectInfoParams != null && size > 0) { | ||
659 | - for (int i = 0; i < vehiclePendantDetectInfoParams.size(); i++) { | ||
660 | - //获取到其中的一个车辆属性 | ||
661 | - JSONObject vehiclePendantOne = vehiclePendantDetectInfoParams.getJSONObject(i); | ||
662 | - Integer index = vehiclePendantOne.getInteger("index"); | ||
663 | - switch (index) { | ||
664 | - case 3: | ||
665 | - //是否有遮阳板 | ||
666 | - vehicle_pendant_detect_zybexis = 1; | ||
667 | - break; | ||
668 | - case 4: | ||
669 | - //获取年检标个数 | ||
670 | - vehicle_pendant_detect_njbnumber++; | ||
671 | - break; | ||
672 | - case 5: | ||
673 | - //是否有挂件 | ||
674 | - vehicle_pendant_detect_gjexis = 1; | ||
675 | - break; | ||
676 | - default: | 638 | + if (vehiclePendantDetectInfoParams != null) { |
639 | + int size = vehiclePendantDetectInfoParams.size(); | ||
640 | + if (vehiclePendantDetectInfoParams.size() > 0) { | ||
641 | + for (int i = 0; i < vehiclePendantDetectInfoParams.size(); i++) { | ||
642 | + //获取到其中的一个车辆属性 | ||
643 | + JSONObject vehiclePendantOne = vehiclePendantDetectInfoParams.getJSONObject(i); | ||
644 | + Integer index = vehiclePendantOne.getInteger("index"); | ||
645 | + switch (index) { | ||
646 | + case 3: | ||
647 | + //是否有遮阳板 | ||
648 | + vehicle_pendant_detect_zybexis = 1; | ||
649 | + break; | ||
650 | + case 4: | ||
651 | + //获取年检标个数 | ||
652 | + vehicle_pendant_detect_njbnumber++; | ||
653 | + break; | ||
654 | + case 5: | ||
655 | + //是否有挂件 | ||
656 | + vehicle_pendant_detect_gjexis = 1; | ||
657 | + break; | ||
658 | + default: | ||
659 | + } | ||
677 | } | 660 | } |
678 | 661 | ||
679 | - } | ||
680 | - | ||
681 | - vehicle_pendant_Params = new PendantParams[size]; | ||
682 | - for (int i = 0; i < size; i++) { | ||
683 | - JSONObject jsonObject = vehiclePendantDetectInfoParams.getJSONObject(i); | ||
684 | - float confidence = jsonObject.getFloat("confidence"); | ||
685 | - Integer index = jsonObject.getInteger("index"); | ||
686 | - int[] ints = new int[4]; | ||
687 | - JSONObject syRectParam = jsonObject.getJSONObject("syRectParam"); | ||
688 | - Integer height = syRectParam.getInteger("height"); | ||
689 | - Integer left = syRectParam.getInteger("left"); | ||
690 | - Integer top = syRectParam.getInteger("top"); | ||
691 | - Integer width = syRectParam.getInteger("width"); | ||
692 | - ints[0] = height; | ||
693 | - ints[1] = left; | ||
694 | - ints[2] = top; | ||
695 | - ints[3] = width; | ||
696 | - PendantParams pp = new PendantParams(index, ints, confidence); | ||
697 | - vehicle_pendant_Params[i] = pp; | 662 | + vehicle_pendant_Params = new PendantParams[size]; |
663 | + for (int i = 0; i < size; i++) { | ||
664 | + JSONObject jsonObject = vehiclePendantDetectInfoParams.getJSONObject(i); | ||
665 | + float confidence = jsonObject.getFloat("confidence"); | ||
666 | + Integer index = jsonObject.getInteger("index"); | ||
667 | + int[] ints = new int[4]; | ||
668 | + JSONObject syRectParam = jsonObject.getJSONObject("syRectParam"); | ||
669 | + Integer height = syRectParam.getInteger("height"); | ||
670 | + Integer left = syRectParam.getInteger("left"); | ||
671 | + Integer top = syRectParam.getInteger("top"); | ||
672 | + Integer width = syRectParam.getInteger("width"); | ||
673 | + ints[0] = height; | ||
674 | + ints[1] = left; | ||
675 | + ints[2] = top; | ||
676 | + ints[3] = width; | ||
677 | + PendantParams pp = new PendantParams(index, ints, confidence); | ||
678 | + vehicle_pendant_Params[i] = pp; | ||
679 | + } | ||
698 | } | 680 | } |
699 | } | 681 | } |
700 | } | 682 | } |
@@ -718,7 +700,7 @@ public class RabbitMQVehicleTools { | @@ -718,7 +700,7 @@ public class RabbitMQVehicleTools { | ||
718 | JSONArray plateNumParams = vehicle_plate_det_recg_res.getJSONArray("plateNumParams"); | 700 | JSONArray plateNumParams = vehicle_plate_det_recg_res.getJSONArray("plateNumParams"); |
719 | int size = plateNumParams.size(); | 701 | int size = plateNumParams.size(); |
720 | if (size > 0) { | 702 | if (size > 0) { |
721 | - StringBuffer sb = new StringBuffer(); | 703 | + StringBuilder sb = new StringBuilder(); |
722 | vehicle_plate_plateNumParams = new PlatePlateNumParams[size]; | 704 | vehicle_plate_plateNumParams = new PlatePlateNumParams[size]; |
723 | for (int i = 0; i < size; i++) { | 705 | for (int i = 0; i < size; i++) { |
724 | JSONObject jsonObject = plateNumParams.getJSONObject(i); | 706 | JSONObject jsonObject = plateNumParams.getJSONObject(i); |