|
@@ -89,52 +89,47 @@ public class ConsumeService implements ApplicationListener<ContextRefreshedEvent
|
|
|
while (true) {
|
|
|
|
|
|
ConsumerRecords<Integer, String> records = consumer.poll(Constants.WAIT_TIME);
|
|
|
-
|
|
|
if (records != null && records.count() > 0) {
|
|
|
for (ConsumerRecord<Integer, String> record : records) {
|
|
|
JSONObject message = JSONObject.parseObject(record.value());
|
|
|
-
|
|
|
-
|
|
|
- JSONObject oriField = message.getJSONObject("ORIFIELD");
|
|
|
-
|
|
|
- String warningInfoJSONStr = oriField.toJSONString();
|
|
|
-
|
|
|
JSONObject uniCtrl = message.getJSONObject("UNICTRL");
|
|
|
- String clueId = uniCtrl.getString("U_CLUEID");
|
|
|
+ String clueId = uniCtrl.getString("U_CLUEID");
|
|
|
String[] clueIdStrArr = clueId.split("_");
|
|
|
String taskId = clueIdStrArr[Constants.NUM_1];
|
|
|
String clueType = clueIdStrArr[Constants.NUM_2];
|
|
|
String clue = clueIdStrArr[Constants.NUM_3];
|
|
|
String resourceId = uniCtrl.getString("U_RESID");
|
|
|
-
|
|
|
- if(clueCodePhone.equals(clueType) && "134B102".equals(resourceId)){
|
|
|
+
|
|
|
+ JSONObject oriField = message.getJSONObject("ORIFIELD");
|
|
|
+ String warningInfoJSONStr = oriField.toJSONString();
|
|
|
+
|
|
|
+ String captureTime = TimeTool.timeStampToDateString(TimeTool.getNowTimeStamp());
|
|
|
+ if(Constants.TABLE_AUTH_RES_ID.equals(resourceId)){
|
|
|
+
|
|
|
String baseStationId = oriField.getString("BASE_STATION_ID");
|
|
|
-
|
|
|
if(StringUtils.isBlank(baseStationId)){
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
List<Map<String, Object>> ctrlAreaInfoList = ctrlDao.queryCtrlAreaInfo(taskId);
|
|
|
if(ctrlAreaInfoList.size() > 0){
|
|
|
String lon = oriField.getString("LONGITUDE");
|
|
|
String lat = oriField.getString("LATITUDE");
|
|
|
-
|
|
|
-
|
|
|
- String captureTime = TimeTool.timeStampToDateString(TimeTool.getNowTimeStamp());
|
|
|
for (Map<String, Object> ctrlAreaInfo : ctrlAreaInfoList) {
|
|
|
Integer areaGeoType = (Integer) ctrlAreaInfo.get("area_geo_type");
|
|
|
JSONArray location = JSON.parseArray((String) ctrlAreaInfo.get("location"));
|
|
|
|
|
|
-
|
|
|
+
|
|
|
if(Constants.NUM_0 == areaGeoType){
|
|
|
JSONObject loc = location.getJSONObject(0);
|
|
|
String centerLon = loc.getString("lon");
|
|
|
String centerLat = loc.getString("lat");
|
|
|
String radius = loc.getString("radius");
|
|
|
if(GeoUtils.isPointInCircle(Double.valueOf(lat), Double.valueOf(lon), Double.valueOf(centerLat), Double.valueOf(centerLon), Double.valueOf(radius))){
|
|
|
- warningInfoList.add(new Object[]{taskId, clue, clueType, warningInfoJSONStr, captureTime});
|
|
|
+ warningInfoList.add(new Object[]{taskId, resourceId, clue, clueType, warningInfoJSONStr, captureTime});
|
|
|
break;
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
List<Coordinate> coordinates = new ArrayList<>();
|
|
|
for (Object obj : location) {
|
|
|
JSONObject loc = (JSONObject) obj;
|
|
@@ -143,20 +138,20 @@ public class ConsumeService implements ApplicationListener<ContextRefreshedEvent
|
|
|
coordinates.add(new Coordinate(Double.valueOf(vertexLon), Double.valueOf(vertexLat)));
|
|
|
}
|
|
|
if(GeoUtils.isPointInPolygon(coordinates, new Coordinate(Double.valueOf(lon), Double.valueOf(lat)))){
|
|
|
- warningInfoList.add(new Object[]{taskId, clue, clueType, warningInfoJSONStr, captureTime});
|
|
|
+ warningInfoList.add(new Object[]{taskId, resourceId, clue, clueType, warningInfoJSONStr, captureTime});
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ warningInfoList.add(new Object[]{taskId, resourceId, clue, clueType, warningInfoJSONStr, captureTime});
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- String warningMsgId = String.valueOf(generator.nextId());
|
|
|
}
|
|
|
-
|
|
|
- ctrlDao.batchInsertWarningInfo(warningInfoList);
|
|
|
+
|
|
|
+ if(warningInfoList.size() > 0){
|
|
|
+ ctrlDao.batchInsertWarningInfo(warningInfoList);
|
|
|
+ }
|
|
|
log.info("【QBEQSJYCTRL - 消费者服务】 当次消费的数据量:{},符合条件的数据量:{}", records.count(), warningInfoList.size());
|
|
|
warningInfoList.clear();
|
|
|
}
|