118
|
|
|
119
|
|
alarmTaskList.add(alarmMap);
|
120
|
|
}
|
121
|
|
|
122
|
|
return CommonResponse.ok(alarmTaskList);
|
123
|
|
}
|
124
|
|
|
125
|
|
/**
|
126
|
|
* 查询地图标记和设备信息
|
127
|
|
*
|
128
|
|
* @param dataMap
|
129
|
|
* @return
|
130
|
|
*/
|
131
|
|
@Override
|
132
|
|
public CommonResponse<Map<String, Object>> loadMapAreaTool(HashMap<String, Object> dataMap) throws Exception {
|
133
|
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
134
|
|
|
135
|
|
List<MapAreaBusinessType> mapAreaTypeList = mapTagManageService.queryMapAreaTypeList().getData();
|
136
|
|
List<ResourceToolType> toolTypeList = resourceToolQuery.loadAllResourceToolType(new CommonRequest(null))
|
137
|
|
.getData();
|
138
|
|
|
139
|
|
List<Map<String, Object>> mapAreaList = mapAreaTagQuery
|
140
|
|
.queryAllMapAreaByConditions(new CommonRequest<Map<String, Object>>(dataMap)).getData();
|
141
|
|
List<Map<String, Object>> toolList = resourceToolQuery
|
142
|
|
.queryWorkToolByOrgAndBindFlag(new CommonRequest<HashMap<String, Object>>(dataMap)).getData().getData();
|
143
|
|
|
144
|
|
resultMap.put("mapAreaTypeList", mapAreaTypeList);
|
145
|
|
resultMap.put("toolTypeList", toolTypeList);
|
146
|
|
|
147
|
|
resultMap.put("mapAreaList", mapAreaList);
|
148
|
|
resultMap.put("toolList", toolList);
|
149
|
|
|
150
|
|
return CommonResponse.ok(resultMap);
|
151
|
|
}
|
152
|
|
|
153
|
|
/**
|
154
|
|
* 指派救援
|
155
|
|
*
|
156
|
|
* @param workTaskRescue
|
157
|
|
* @return
|
158
|
|
* @throws Exception
|
159
|
|
*/
|
160
|
|
@Override
|
161
|
|
public CommonResponse<EntityPosition> assignRescuer(WorkTaskRescue workTaskRescue) throws Exception {
|
162
|
|
CommonRequest<WorkTaskRescue> commonRequest = new CommonRequest<WorkTaskRescue>(workTaskRescue);
|
163
|
|
CommonResponse<WorkTaskRescue> response = rescueCommand.assignRescueEmployee(commonRequest);
|
164
|
|
|
165
|
|
if (response.isSuccess()) {
|
166
|
|
List<EntityPosition> list = entityPositionRepository.findByEntityId(workTaskRescue.getRescueWorkEmployeeRoleId());
|
167
|
|
if (!CollectionUtils.isEmpty(list)) {
|
168
|
|
return CommonResponse.ok(list.get(0));
|
169
|
|
} else {
|
170
|
|
return CommonResponse.ok(null);
|
171
|
|
}
|
172
|
|
} else {
|
173
|
|
return CommonResponse.fail("505", "指派失败");
|
174
|
|
}
|
175
|
|
}
|
176
|
|
|
177
|
|
/**
|
178
|
|
* 关闭救援
|
179
|
|
*
|
180
|
|
* @param workTaskRescue
|
181
|
|
* @return
|
182
|
|
* @throws Exception
|
183
|
|
*/
|
184
|
|
@Override
|
185
|
|
public CommonResponse<WorkTaskRescue> closeRescue(WorkTaskRescue workTaskRescue, String isFalseAlarm)
|
186
|
|
throws Exception {
|
187
|
|
CommonRequest<WorkTaskRescue> commonRequest = new CommonRequest<WorkTaskRescue>(workTaskRescue);
|
188
|
|
if (EbcConstant.IS_ASSIGN_RESCUER_TRUE.equals(isFalseAlarm)) {
|
189
|
|
return rescueCommand.closeTask(commonRequest);
|
190
|
|
} else {
|
191
|
|
return rescueCommand.falseAlarm(commonRequest);
|
192
|
|
}
|
193
|
|
}
|
194
|
|
|
195
|
|
/**
|
196
|
|
* 分页查询历史报警数据
|
197
|
|
*
|
198
|
|
* @param dataMap
|
199
|
|
* @param pageNumber
|
200
|
|
* @param pageSize
|
201
|
|
* @return
|
202
|
|
* @throws Exception
|
203
|
|
*/
|
204
|
|
@Override
|
205
|
|
public CommonResponse<PageBean<Map<String, Object>>> queryPageCloseAlarmTask(Map<String, Object> dataMap, int pageNumber, int pageSize)
|
206
|
|
throws Exception {
|
207
|
|
CommonRequest<Map<String, Object>> request = new CommonRequest<Map<String, Object>>(dataMap, pageNumber, pageSize);
|
208
|
|
CommonResponse<PageBean<Map<String, Object>>> response = rescueQueryService.queryHisWorkTaskRescue(request);
|
209
|
|
|
210
|
|
if (CollectionUtils.isEmpty(response.getData().getData())) {
|
211
|
|
return response;
|
212
|
|
}
|
213
|
|
|
214
|
|
List<Map<String, Object>> alarmTaskList = new ArrayList<Map<String, Object>>();
|
215
|
|
|
216
|
|
for (Map<String, Object> responseMap : response.getData().getData()) {
|
217
|
|
Map<String, Object> alarmMap = new HashMap<String, Object>();
|
218
|
|
JSONObject alarmJsonObj = JSONObject.parseObject(responseMap.get("charValueSet").toString());
|
219
|
|
|
220
|
|
alarmMap.put("workTaskId", responseMap.get("workTaskId"));
|
221
|
|
alarmMap.put("terminalId", responseMap.get("terminalId"));
|
222
|
|
alarmMap.put("longitude", alarmJsonObj.getString("longitude"));
|
223
|
|
alarmMap.put("latitude", alarmJsonObj.getString("latitude"));
|
224
|
|
alarmMap.put("businessType", alarmJsonObj.getString("businessType"));
|
225
|
|
alarmMap.put("targetUserId", responseMap.get("targetEmployeeRoleId"));
|
226
|
|
alarmMap.put("targetUserName", responseMap.get("targetEmployeeRoleName"));
|
227
|
|
long alarmTimeLong = Long.valueOf(alarmJsonObj.getString("alarmTime"));
|
228
|
|
alarmMap.put("alarmTime", DateUtil.formatDate(alarmTimeLong));
|
229
|
|
|
230
|
|
if (responseMap.get("rescueWorkEmployeeRoleId") != null) {
|
231
|
|
alarmMap.put("rescueUserId", responseMap.get("rescueWorkEmployeeRoleId"));
|
232
|
|
alarmMap.put("rescueUserName", responseMap.get("rescueWorkEmployeeRoleName"));
|
233
|
|
if (responseMap.get("rescueCloseTime") != null) {
|
234
|
|
long rescueTimeLong = DateUtil.convertDate(responseMap.get("rescueCloseTime").toString()).getTime();
|
235
|
|
alarmMap.put("rescueTime", responseMap.get("rescueCloseTime").toString());
|
236
|
|
alarmMap.put("durationTime", DateUtil.getDifferenceString(alarmTimeLong, rescueTimeLong));
|
237
|
|
} else {
|
238
|
|
alarmMap.put("rescueTime", "-");
|
239
|
|
alarmMap.put("durationTime", "-");
|
240
|
|
}
|
241
|
|
alarmMap.put("isFalseAlarm", EbcConstant.IS_ASSIGN_RESCUER_TRUE);
|
242
|
|
|
243
|
|
} else {
|
244
|
|
alarmMap.put("rescueUserId", null);
|
245
|
|
alarmMap.put("rescueUserName", "-");
|
246
|
|
alarmMap.put("rescueTime", "-");
|
247
|
|
alarmMap.put("durationTime", "-");
|
248
|
|
alarmMap.put("isFalseAlarm", EbcConstant.IS_ASSIGN_RESCUER_FALSE);
|
249
|
|
}
|
250
|
|
|
251
|
|
alarmTaskList.add(alarmMap);
|
252
|
|
}
|
253
|
|
|
254
|
|
response.getData().setData(alarmTaskList);
|
255
|
|
|
256
|
|
return response;
|
257
|
|
}
|
258
|
|
|
259
|
|
/**
|
260
|
|
* 获取报警类型下拉列表
|
261
|
|
*
|
262
|
|
* @return
|
263
|
|
* @throws Exception
|
264
|
|
*/
|
265
|
|
@Override
|
266
|
|
public List<Map<String, String>> queryAlarmTypeList() throws Exception {
|
267
|
|
CharacteristicSpec characteristicSpec = characteristicSpecService
|
268
|
|
.findBusinessSpecByCharSpecCode(EbcConstant.BUSINESS_SPEC_MAP_AREA_TYPE);
|
269
|
|
|
270
|
|
if (characteristicSpec == null || CollectionUtils.isEmpty(characteristicSpec.getCharacteristicSpecValues())) {
|
271
|
|
return new ArrayList<Map<String, String>>();
|
272
|
|
}
|
273
|
|
|
274
|
|
List<Map<String, String>> resultList = new ArrayList<Map<String, String>>();
|
275
|
|
for (CharacteristicSpecValue characteristicSpecValue : characteristicSpec.getCharacteristicSpecValues()) {
|
276
|
|
Map<String, String> map = new HashMap<String, String>();
|
277
|
|
map.put("alarmTypeId", characteristicSpecValue.getCode());
|
278
|
|
map.put("alarmTypeName", characteristicSpecValue.getValue());
|
279
|
|
resultList.add(map);
|
280
|
|
}
|
281
|
|
|
282
|
|
return resultList;
|
283
|
|
}
|
284
|
|
|
285
|
|
/**
|
286
|
|
* 删除历史报警
|
287
|
|
*
|
288
|
|
* @param workTaskRescue
|
289
|
|
* @return
|
290
|
|
* @throws Exception
|
291
|
|
*/
|
292
|
|
@Override
|
293
|
|
public CommonResponse<WorkTaskRescue> deleteCloseAlarm(WorkTaskRescue workTaskRescue) throws Exception {
|
294
|
|
CommonRequest<WorkTaskRescue> commonRequest = new CommonRequest(workTaskRescue);
|
295
|
|
return rescueCommand.deleteTask(commonRequest);
|
296
|
|
}
|
297
|
|
|
298
|
|
@Override
|
299
|
|
public CommonResponse<Map<String, Object>> queryAlarmWorkTaskTrace(String workTaskId) throws Exception {
|
300
|
|
CommonRequest<String> request = new CommonRequest(workTaskId);
|
301
|
|
return rescueQueryService.queryWorkTaskRescuePositionTrace(request);
|
302
|
|
}
|
|
39
|
Logger logger = LoggerFactory.getLogger(AlarmManagementServiceImpl.class);
|
|
40
|
|
|
41
|
@Autowired
|
|
42
|
private RescueCommand rescueCommand;
|
|
43
|
|
|
44
|
@Autowired
|
|
45
|
private RescueQueryService rescueQueryService;
|
|
46
|
|
|
47
|
@Autowired
|
|
48
|
private EntityPositionRepository entityPositionRepository;
|
|
49
|
|
|
50
|
@Autowired
|
|
51
|
private MapAreaTagQuery mapAreaTagQuery;
|
|
52
|
|
|
53
|
@Autowired
|
|
54
|
private MapAreaQuery mapAreaQuery;
|
|
55
|
|
|
56
|
@Autowired
|
|
57
|
private ResourceToolQuery resourceToolQuery;
|
|
58
|
|
|
59
|
@Autowired
|
|
60
|
private CharacteristicSpecService characteristicSpecService;
|
|
61
|
|
|
62
|
@Autowired
|
|
63
|
MapTagManageService mapTagManageService;
|
|
64
|
|
|
65
|
/**
|
|
66
|
* 初始化实时报警数据
|
|
67
|
*
|
|
68
|
* @return
|
|
69
|
* @throws Exception
|
|
70
|
*/
|
|
71
|
@Override
|
|
72
|
public CommonResponse<List<Map<String, Object>>> loadAlarmDetails() throws Exception {
|
|
73
|
Map<String, Object> param = new HashMap<String, Object>();
|
|
74
|
param.put("notStatus", WorkTask.END_STATUS);
|
|
75
|
CommonRequest<Map<String, Object>> request = new CommonRequest(param);
|
|
76
|
CommonResponse<List<Map<String, Object>>> response = rescueQueryService.queryWorkTaskRescue(request);
|
|
77
|
|
|
78
|
if (CollectionUtils.isEmpty(response.getData())) {
|
|
79
|
return CommonResponse.ok(new ArrayList<Map<String, Object>>());
|
|
80
|
}
|
|
81
|
|
|
82
|
CharacteristicSpec characteristicSpec = characteristicSpecService
|
|
83
|
.findBusinessSpecByCharSpecCode(EbcConstant.BUSINESS_SPEC_MAP_AREA_TYPE);
|
|
84
|
|
|
85
|
List<Map<String, Object>> alarmTaskList = new ArrayList<Map<String, Object>>();
|
|
86
|
|
|
87
|
for (Map<String, Object> responseMap : response.getData()) {
|
|
88
|
Map<String, Object> alarmMap = new HashMap<String, Object>();
|
|
89
|
JSONObject alarmJsonObj = JSONObject.parseObject(responseMap.get("charValueSet").toString());
|
|
90
|
|
|
91
|
alarmMap.put("workTaskId", responseMap.get("workTaskId"));
|
|
92
|
alarmMap.put("terminalId", responseMap.get("terminalId"));
|
|
93
|
long alarmTimeLong = Long.valueOf(alarmJsonObj.getString("alarmTime"));
|
|
94
|
alarmMap.put("alarmTime", DateUtil.formatDate(alarmTimeLong));
|
|
95
|
alarmMap.put("durationTime", DateUtil.getDifferenceString(alarmTimeLong, System.currentTimeMillis()));
|
|
96
|
alarmMap.put("targetEmployeeRoleId", responseMap.get("targetEmployeeRoleId"));
|
|
97
|
alarmMap.put("rescueWorkEmployeeRoleId", responseMap.get("rescueWorkEmployeeRoleId"));
|
|
98
|
|
|
99
|
// alarmMap.put("businessType", alarmJsonObj.getString("businessType"));
|
|
100
|
String businessType = alarmJsonObj.getString("businessType");
|
|
101
|
for (CharacteristicSpecValue characteristicSpecValue : characteristicSpec.getCharacteristicSpecValues()) {
|
|
102
|
if (characteristicSpecValue.getCode().equals(businessType)) {
|
|
103
|
alarmMap.put("businessType", characteristicSpecValue.getCode());
|
|
104
|
alarmMap.put("businessTypeZH", characteristicSpecValue.getValue());
|
|
105
|
break;
|
|
106
|
}
|
|
107
|
}
|
|
108
|
|
|
109
|
// EntityPosition aaa=(EntityPosition)responseMap.get("rescueTargetEntityPosition");
|
|
110
|
alarmMap.put("rescueTargetEntityPosition", responseMap.get("rescueTargetEntityPosition"));
|
|
111
|
|
|
112
|
if (responseMap.get("rescueWorkEmployeeRoleId") == null) {
|
|
113
|
alarmMap.put("isAssignAlarm", EbcConstant.IS_ASSIGN_RESCUER_FALSE);
|
|
114
|
} else {
|
|
115
|
alarmMap.put("rescueEntityPosition", responseMap.get("rescueEntityPosition"));
|
|
116
|
alarmMap.put("isAssignAlarm", EbcConstant.IS_ASSIGN_RESCUER_TRUE);
|
|
117
|
}
|
|
118
|
|
|
119
|
alarmTaskList.add(alarmMap);
|
|
120
|
}
|
|
121
|
|
|
122
|
return CommonResponse.ok(alarmTaskList);
|
|
123
|
}
|
|
124
|
|
|
125
|
/**
|
|
126
|
* 查询地图标记和设备信息
|
|
127
|
*
|
|
128
|
* @param dataMap
|
|
129
|
* @return
|
|
130
|
*/
|
|
131
|
@Override
|
|
132
|
public CommonResponse<Map<String, Object>> loadMapAreaTool(HashMap<String, Object> dataMap) throws Exception {
|
|
133
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
|
134
|
|
|
135
|
List<MapAreaBusinessType> mapAreaTypeList = mapTagManageService.queryMapAreaTypeList().getData();
|
|
136
|
List<ResourceToolType> toolTypeList = resourceToolQuery.loadAllResourceToolType(new CommonRequest(null))
|
|
137
|
.getData();
|
|
138
|
|
|
139
|
List<Map<String, Object>> mapAreaList = mapAreaTagQuery
|
|
140
|
.queryAllMapAreaByConditions(new CommonRequest<Map<String, Object>>(dataMap)).getData();
|
|
141
|
List<Map<String, Object>> toolList = resourceToolQuery
|
|
142
|
.queryWorkToolByOrgAndBindFlag(new CommonRequest<HashMap<String, Object>>(dataMap)).getData().getData();
|
|
143
|
|
|
144
|
resultMap.put("mapAreaTypeList", mapAreaTypeList);
|
|
145
|
resultMap.put("toolTypeList", toolTypeList);
|
|
146
|
|
|
147
|
resultMap.put("mapAreaList", mapAreaList);
|
|
148
|
resultMap.put("toolList", toolList);
|
|
149
|
|
|
150
|
return CommonResponse.ok(resultMap);
|
|
151
|
}
|
|
152
|
|
|
153
|
/**
|
|
154
|
* 指派救援
|
|
155
|
*
|
|
156
|
* @param workTaskRescue
|
|
157
|
* @return
|
|
158
|
* @throws Exception
|
|
159
|
*/
|
|
160
|
@Override
|
|
161
|
public CommonResponse<EntityPosition> assignRescuer(WorkTaskRescue workTaskRescue) throws Exception {
|
|
162
|
CommonRequest<WorkTaskRescue> commonRequest = new CommonRequest<WorkTaskRescue>(workTaskRescue);
|
|
163
|
CommonResponse<WorkTaskRescue> response = rescueCommand.assignRescueEmployee(commonRequest);
|
|
164
|
|
|
165
|
if (response.isSuccess()) {
|
|
166
|
List<EntityPosition> list = entityPositionRepository
|
|
167
|
.findByEntityId(workTaskRescue.getRescueWorkEmployeeRoleId());
|
|
168
|
if (!CollectionUtils.isEmpty(list)) {
|
|
169
|
return CommonResponse.ok(list.get(0));
|
|
170
|
} else {
|
|
171
|
return CommonResponse.ok(null);
|
|
172
|
}
|
|
173
|
} else {
|
|
174
|
return CommonResponse.fail("505", "指派失败");
|
|
175
|
}
|
|
176
|
}
|
|
177
|
|
|
178
|
/**
|
|
179
|
* 关闭救援
|
|
180
|
*
|
|
181
|
* @param workTaskRescue
|
|
182
|
* @return
|
|
183
|
* @throws Exception
|
|
184
|
*/
|
|
185
|
@Override
|
|
186
|
public CommonResponse<WorkTaskRescue> closeRescue(WorkTaskRescue workTaskRescue, String isFalseAlarm)
|
|
187
|
throws Exception {
|
|
188
|
CommonRequest<WorkTaskRescue> commonRequest = new CommonRequest<WorkTaskRescue>(workTaskRescue);
|
|
189
|
if (EbcConstant.IS_ASSIGN_RESCUER_TRUE.equals(isFalseAlarm)) {
|
|
190
|
return rescueCommand.closeTask(commonRequest);
|
|
191
|
} else {
|
|
192
|
return rescueCommand.falseAlarm(commonRequest);
|
|
193
|
}
|
|
194
|
}
|
|
195
|
|
|
196
|
/**
|
|
197
|
* 分页查询历史报警数据
|
|
198
|
*
|
|
199
|
* @param dataMap
|
|
200
|
* @param pageNumber
|
|
201
|
* @param pageSize
|
|
202
|
* @return
|
|
203
|
* @throws Exception
|
|
204
|
*/
|
|
205
|
@Override
|
|
206
|
public CommonResponse<PageBean<Map<String, Object>>> queryPageCloseAlarmTask(Map<String, Object> dataMap,
|
|
207
|
int pageNumber, int pageSize) throws Exception {
|
|
208
|
CommonRequest<Map<String, Object>> request = new CommonRequest<Map<String, Object>>(dataMap, pageNumber,
|
|
209
|
pageSize);
|
|
210
|
CommonResponse<PageBean<Map<String, Object>>> response = rescueQueryService.queryHisWorkTaskRescue(request);
|
|
211
|
|
|
212
|
if (CollectionUtils.isEmpty(response.getData().getData())) {
|
|
213
|
return response;
|
|
214
|
}
|
|
215
|
|
|
216
|
List<Map<String, Object>> alarmTaskList = new ArrayList<Map<String, Object>>();
|
|
217
|
|
|
218
|
for (Map<String, Object> responseMap : response.getData().getData()) {
|
|
219
|
Map<String, Object> alarmMap = new HashMap<String, Object>();
|
|
220
|
JSONObject alarmJsonObj = JSONObject.parseObject(responseMap.get("charValueSet").toString());
|
|
221
|
|
|
222
|
alarmMap.put("workTaskId", responseMap.get("workTaskId"));
|
|
223
|
alarmMap.put("terminalId", responseMap.get("terminalId"));
|
|
224
|
alarmMap.put("longitude", alarmJsonObj.getString("longitude"));
|
|
225
|
alarmMap.put("latitude", alarmJsonObj.getString("latitude"));
|
|
226
|
alarmMap.put("businessType", alarmJsonObj.getString("businessType"));
|
|
227
|
alarmMap.put("targetUserId", responseMap.get("targetEmployeeRoleId"));
|
|
228
|
alarmMap.put("targetUserName", responseMap.get("targetEmployeeRoleName"));
|
|
229
|
long alarmTimeLong = Long.valueOf(alarmJsonObj.getString("alarmTime"));
|
|
230
|
alarmMap.put("alarmTime", DateUtil.formatDate(alarmTimeLong));
|
|
231
|
|
|
232
|
if (responseMap.get("rescueWorkEmployeeRoleId") != null) {
|
|
233
|
alarmMap.put("rescueUserId", responseMap.get("rescueWorkEmployeeRoleId"));
|
|
234
|
alarmMap.put("rescueUserName", responseMap.get("rescueWorkEmployeeRoleName"));
|
|
235
|
if (responseMap.get("rescueCloseTime") != null) {
|
|
236
|
long rescueTimeLong = DateUtil.convertDate(responseMap.get("rescueCloseTime").toString()).getTime();
|
|
237
|
alarmMap.put("rescueTime", responseMap.get("rescueCloseTime").toString());
|
|
238
|
alarmMap.put("durationTime", DateUtil.getDifferenceString(alarmTimeLong, rescueTimeLong));
|
|
239
|
} else {
|
|
240
|
alarmMap.put("rescueTime", "-");
|
|
241
|
alarmMap.put("durationTime", "-");
|
|
242
|
}
|
|
243
|
alarmMap.put("isAssignRescuer", EbcConstant.IS_ASSIGN_RESCUER_TRUE);
|
|
244
|
|
|
245
|
} else {
|
|
246
|
alarmMap.put("rescueUserId", null);
|
|
247
|
alarmMap.put("rescueUserName", "-");
|
|
248
|
alarmMap.put("rescueTime", "-");
|
|
249
|
alarmMap.put("durationTime", "-");
|
|
250
|
alarmMap.put("isAssignRescuer", EbcConstant.IS_ASSIGN_RESCUER_FALSE);
|
|
251
|
}
|
|
252
|
|
|
253
|
alarmTaskList.add(alarmMap);
|
|
254
|
}
|
|
255
|
|
|
256
|
response.getData().setData(alarmTaskList);
|
|
257
|
|
|
258
|
return response;
|
|
259
|
}
|
|
260
|
|
|
261
|
/**
|
|
262
|
* 获取报警类型下拉列表
|
|
263
|
*
|
|
264
|
* @return
|
|
265
|
* @throws Exception
|
|
266
|
*/
|
|
267
|
@Override
|
|
268
|
public List<Map<String, String>> queryAlarmTypeList() throws Exception {
|
|
269
|
CharacteristicSpec characteristicSpec = characteristicSpecService
|
|
270
|
.findBusinessSpecByCharSpecCode(EbcConstant.BUSINESS_SPEC_MAP_AREA_TYPE);
|
|
271
|
|
|
272
|
if (characteristicSpec == null || CollectionUtils.isEmpty(characteristicSpec.getCharacteristicSpecValues())) {
|
|
273
|
return new ArrayList<Map<String, String>>();
|
|
274
|
}
|
|
275
|
|
|
276
|
List<Map<String, String>> resultList = new ArrayList<Map<String, String>>();
|
|
277
|
for (CharacteristicSpecValue characteristicSpecValue : characteristicSpec.getCharacteristicSpecValues()) {
|
|
278
|
Map<String, String> map = new HashMap<String, String>();
|
|
279
|
map.put("alarmTypeId", characteristicSpecValue.getCode());
|
|
280
|
map.put("alarmTypeName", characteristicSpecValue.getValue());
|
|
281
|
resultList.add(map);
|
|
282
|
}
|
|
283
|
|
|
284
|
return resultList;
|
|
285
|
}
|
|
286
|
|
|
287
|
/**
|
|
288
|
* 删除历史报警
|
|
289
|
*
|
|
290
|
* @param workTaskRescue
|
|
291
|
* @return
|
|
292
|
* @throws Exception
|
|
293
|
*/
|
|
294
|
@Override
|
|
295
|
public CommonResponse<WorkTaskRescue> deleteCloseAlarm(WorkTaskRescue workTaskRescue) throws Exception {
|
|
296
|
CommonRequest<WorkTaskRescue> commonRequest = new CommonRequest(workTaskRescue);
|
|
297
|
return rescueCommand.deleteTask(commonRequest);
|
|
298
|
}
|
|
299
|
|
|
300
|
@Override
|
|
301
|
public CommonResponse<Map<String, Object>> queryAlarmWorkTaskTrace(String workTaskId) throws Exception {
|
|
302
|
CommonRequest<String> request = new CommonRequest(workTaskId);
|
|
303
|
CommonResponse<Map<String, Object>> response = rescueQueryService.queryWorkTaskRescuePositionTrace(request);
|
|
304
|
if (response == null || response.getData() == null) {
|
|
305
|
return CommonResponse.fail("505", "无救援轨迹");
|
|
306
|
} else {
|
|
307
|
return response;
|
|
308
|
}
|
|
309
|
}
|
303
|
310
|
}
|
|
@ -90,29 +90,35 @@ public class LocationManagementServiceImpl implements LocationManagementService
|
90
|
90
|
|
91
|
91
|
if (commonResponse != null && commonResponse.getData() != null) {
|
92
|
92
|
List<EntityPosition> entityPositionList = commonResponse.getData();
|
|
93
|
|
93
|
94
|
for (EntityPosition entityPosition : entityPositionList) {
|
94
|
|
switch (getEntityPositionStatus(entityPosition)) {
|
95
|
|
case EntityPosition.TAG_TYPE_LIMIT_PREPARE:
|
96
|
|
case EntityPosition.TAG_TYPE_NORMAL:
|
97
|
|
normalNum++;
|
98
|
|
break;
|
99
|
|
case EntityPosition.TAG_TYPE_FORBIDDEN:
|
100
|
|
case EntityPosition.TAG_TYPE_LIMIT:
|
101
|
|
violationNum++;
|
102
|
|
break;
|
103
|
|
case EntityPosition.TAG_TYPE_OFFLINE_BY_DEVICE_TURNOFF:
|
104
|
|
case EntityPosition.TAG_TYPE_OFFLINE_BY_OVERTIME:
|
105
|
|
offlineNum++;
|
106
|
|
break;
|
107
|
|
case EntityPosition.TAG_TYPE_SOS_AUTO:
|
108
|
|
case EntityPosition.TAG_TYPE_SOS_MANUAL:
|
109
|
|
sosNum++;
|
110
|
|
break;
|
111
|
|
default:
|
112
|
|
break;
|
|
95
|
if (MapArea.ENTITY_TYPE_WORKER.equals(entityPosition.getEntityType())) {
|
|
96
|
switch (getEntityPositionStatus(entityPosition)) {
|
|
97
|
case EntityPosition.TAG_TYPE_LIMIT_PREPARE:
|
|
98
|
case EntityPosition.TAG_TYPE_NORMAL:
|
|
99
|
case EntityPosition.TAG_TYPE_RESCUE:
|
|
100
|
normalNum++;
|
|
101
|
allNum++;
|
|
102
|
break;
|
|
103
|
case EntityPosition.TAG_TYPE_FORBIDDEN:
|
|
104
|
case EntityPosition.TAG_TYPE_LIMIT:
|
|
105
|
violationNum++;
|
|
106
|
allNum++;
|
|
107
|
break;
|
|
108
|
case EntityPosition.TAG_TYPE_OFFLINE_BY_DEVICE_TURNOFF:
|
|
109
|
case EntityPosition.TAG_TYPE_OFFLINE_BY_OVERTIME:
|
|
110
|
offlineNum++;
|
|
111
|
allNum++;
|
|
112
|
break;
|
|
113
|
case EntityPosition.TAG_TYPE_SOS_AUTO:
|
|
114
|
case EntityPosition.TAG_TYPE_SOS_MANUAL:
|
|
115
|
sosNum++;
|
|
116
|
allNum++;
|
|
117
|
break;
|
|
118
|
default:
|
|
119
|
break;
|
|
120
|
}
|
113
|
121
|
}
|
114
|
|
|
115
|
|
allNum++;
|
116
|
122
|
}
|
117
|
123
|
}
|
118
|
124
|
|
|
@ -242,8 +248,6 @@ public class LocationManagementServiceImpl implements LocationManagementService
|
242
|
248
|
String locationStatus = EntityPosition.TAG_TYPE_NORMAL;
|
243
|
249
|
List<EbcEntityPosition> ebcEntityPositionList = new ArrayList<EbcEntityPosition>();
|
244
|
250
|
|
245
|
|
// TODO 需判断不显示围栏(如考勤区、作业区)聚焦人员的信息
|
246
|
|
// if (CollectionUtils.isEmpty(EntityPositionList)||"ATT".equals(mapAreaType)||"WOR".equals(mapAreaType)) {
|
247
|
251
|
if (CollectionUtils.isEmpty(EntityPositionList)) {
|
248
|
252
|
resultMap.put("ebcEntityPositionList", ebcEntityPositionList);
|
249
|
253
|
resultMap.put("locationStatus", null);
|
|
@ -256,7 +260,7 @@ public class LocationManagementServiceImpl implements LocationManagementService
|
256
|
260
|
continue;
|
257
|
261
|
}
|
258
|
262
|
|
259
|
|
// TODO 需屏蔽非人员(如船)的实体信息
|
|
263
|
// 屏蔽非人员(如船)的实体信息
|
260
|
264
|
if (!MapArea.ENTITY_TYPE_WORKER.equals(entityPosition.getEntityType())) {
|
261
|
265
|
continue;
|
262
|
266
|
}
|
|
@ -264,8 +268,11 @@ public class LocationManagementServiceImpl implements LocationManagementService
|
264
|
268
|
EbcEntityPosition ebcEntityPosition = new EbcEntityPosition();
|
265
|
269
|
ComponentReflectionUtils.copyAttributeFromParent(entityPosition, ebcEntityPosition);
|
266
|
270
|
|
|
271
|
// 获取人员状态:如果为救援人员,则显示为正常人员
|
267
|
272
|
String maxStatus = getEntityPositionStatus(entityPosition);
|
|
273
|
maxStatus = EntityPosition.TAG_TYPE_RESCUE.equals(maxStatus) ? EntityPosition.TAG_TYPE_NORMAL : maxStatus;
|
268
|
274
|
ebcEntityPosition.setLocationStatus(maxStatus);
|
|
275
|
|
269
|
276
|
ebcEntityPosition.setCharValueSet(null);
|
270
|
277
|
ebcEntityPositionList.add(ebcEntityPosition);
|
271
|
278
|
|
|
@ -1,6 +1,5 @@
|
1
|
1
|
package com.ai.bss.location.rescue.service.task;
|
2
|
2
|
|
3
|
|
import java.util.HashMap;
|
4
|
3
|
import java.util.Map;
|
5
|
4
|
|
6
|
5
|
import org.apache.commons.collections4.map.HashedMap;
|
|
@ -28,7 +27,7 @@ public class AlarmMirrorTask implements EntityAlarmHandle {
|
28
|
27
|
|
29
|
28
|
@Autowired
|
30
|
29
|
private CharacteristicSpecService characteristicSpecService;
|
31
|
|
|
|
30
|
|
32
|
31
|
/**
|
33
|
32
|
* 镜屏推送实时报警信息
|
34
|
33
|
*
|
|
@ -49,13 +48,15 @@ public class AlarmMirrorTask implements EntityAlarmHandle {
|
49
|
48
|
resultMap.put("longitude", alarmJsonObj.getString("longitude"));
|
50
|
49
|
resultMap.put("latitude", alarmJsonObj.getString("latitude"));
|
51
|
50
|
resultMap.put("alarmTime", DateUtil.formatDate(Long.valueOf(alarmJsonObj.getString("alarmTime"))));
|
52
|
|
|
53
|
|
//resultMap.put("businessType", alarmInfJsonObj.getString("businessType"));
|
54
|
|
String businessType=alarmJsonObj.getString("businessType");
|
|
51
|
|
|
52
|
// resultMap.put("businessType", alarmInfJsonObj.getString("businessType"));
|
|
53
|
String businessType = alarmJsonObj.getString("businessType");
|
55
|
54
|
CharacteristicSpec characteristicSpec = characteristicSpecService
|
56
|
55
|
.findBusinessSpecByCharSpecCode(EbcConstant.BUSINESS_SPEC_MAP_AREA_TYPE);
|
57
|
|
if (characteristicSpec!=null&&!CollectionUtils.isEmpty(characteristicSpec.getCharacteristicSpecValues())) {
|
58
|
|
for (CharacteristicSpecValue characteristicSpecValue : characteristicSpec.getCharacteristicSpecValues()) {
|
|
56
|
if (characteristicSpec != null
|
|
57
|
&& !CollectionUtils.isEmpty(characteristicSpec.getCharacteristicSpecValues())) {
|
|
58
|
for (CharacteristicSpecValue characteristicSpecValue : characteristicSpec
|
|
59
|
.getCharacteristicSpecValues()) {
|
59
|
60
|
if (characteristicSpecValue.getCode().equals(businessType)) {
|
60
|
61
|
resultMap.put("businessType", characteristicSpecValue.getCode());
|
61
|
62
|
resultMap.put("businessTypeZH", characteristicSpecValue.getValue());
|
|
@ -63,7 +64,7 @@ public class AlarmMirrorTask implements EntityAlarmHandle {
|
63
|
64
|
}
|
64
|
65
|
}
|
65
|
66
|
}
|
66
|
|
|
|
67
|
|
67
|
68
|
String msg = JSON.toJSONString(CommonResponse.ok(resultMap));
|
68
|
69
|
logger.info("实时报警推送镜屏数据: " + msg);
|
69
|
70
|
MirrorManagement.sendData(MirrorManagement.TOPIC_ALARM, msg);
|
|
@ -30,11 +30,10 @@ import org.apache.http.protocol.HTTP;
|
30
|
30
|
import org.apache.http.util.EntityUtils;
|
31
|
31
|
import org.slf4j.Logger;
|
32
|
32
|
import org.slf4j.LoggerFactory;
|
|
33
|
import org.springframework.util.CollectionUtils;
|
33
|
34
|
|
34
|
35
|
import com.alibaba.fastjson.JSONObject;
|
35
|
36
|
|
36
|
|
import lombok.extern.slf4j.Slf4j;
|
37
|
|
|
38
|
37
|
/**
|
39
|
38
|
* http服务请求工具类
|
40
|
39
|
*
|
|
@ -185,13 +184,13 @@ public class HttpServiceUtil {
|
185
|
184
|
return body;
|
186
|
185
|
}
|
187
|
186
|
|
188
|
|
public static String sendGet(String url, Charset encoding,Map<String,String> headerMap) {
|
|
187
|
public static String sendGet(String url, Charset encoding, Map<String, String> headerMap) {
|
189
|
188
|
HttpClient httpClient = HttpClients.createDefault();
|
190
|
189
|
HttpGet httpGet = new HttpGet(url);
|
191
|
190
|
httpGet.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
|
192
|
191
|
CloseableHttpResponse response = null;
|
193
|
192
|
try {
|
194
|
|
log.debug("调用北向接口:url= " + url);
|
|
193
|
log.debug("执行GET请求:url= " + url);
|
195
|
194
|
response = (CloseableHttpResponse) httpClient.execute(httpGet);
|
196
|
195
|
} catch (Exception e) {
|
197
|
196
|
log.error("sendGet Exception: " + e.getMessage());
|
|
@ -204,12 +203,13 @@ public class HttpServiceUtil {
|
204
|
203
|
HttpClient httpClient = HttpClients.createDefault();
|
205
|
204
|
HttpPost httpPost = new HttpPost(url);
|
206
|
205
|
httpPost.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
|
207
|
|
if (paramsMap != null && paramsMap.size() > 0) {
|
|
206
|
if (!CollectionUtils.isEmpty(paramsMap)) {
|
208
|
207
|
StringEntity se = new StringEntity(JSONObject.toJSONString(paramsMap), encoding);
|
209
|
208
|
httpPost.setEntity(se);
|
210
|
209
|
}
|
211
|
210
|
CloseableHttpResponse response = null;
|
212
|
211
|
try {
|
|
212
|
log.debug("执行POST无参请求:url= " + url);
|
213
|
213
|
response = (CloseableHttpResponse) httpClient.execute(httpPost);
|
214
|
214
|
} catch (Exception e) {
|
215
|
215
|
log.error("sendPost Exception: " + e.getMessage());
|
|
@ -233,8 +233,8 @@ public class HttpServiceUtil {
|
233
|
233
|
}
|
234
|
234
|
|
235
|
235
|
httpPost.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
|
236
|
|
if (paramsMap != null && paramsMap.size() > 0) {
|
237
|
|
log.debug("调用北向接口:url= " + url + ",参数= " + JSONObject.toJSONString(paramsMap));
|
|
236
|
if (!CollectionUtils.isEmpty(paramsMap)) {
|
|
237
|
log.debug("执行POST请求:url= " + url + ",参数= " + JSONObject.toJSONString(paramsMap));
|
238
|
238
|
StringEntity se = new StringEntity(JSONObject.toJSONString(paramsMap), encoding);
|
239
|
239
|
httpPost.setEntity(se);
|
240
|
240
|
}
|
|
@ -248,17 +248,18 @@ public class HttpServiceUtil {
|
248
|
248
|
return responseEx(httpClient, response, encoding);
|
249
|
249
|
}
|
250
|
250
|
|
251
|
|
public static String sendPut(String url, Map<String, String> params, Charset encoding) {
|
|
251
|
public static String sendPut(String url, Map<String, Object> paramsMap, Charset encoding) {
|
252
|
252
|
HttpClient httpClient = HttpClients.createDefault();
|
253
|
253
|
String resp = "";
|
254
|
254
|
HttpPut httpPut = new HttpPut(url);
|
255
|
255
|
httpPut.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
|
256
|
|
if (params != null && params.size() > 0) {
|
257
|
|
StringEntity se = new StringEntity(JSONObject.toJSONString(params), encoding);
|
|
256
|
if (!CollectionUtils.isEmpty(paramsMap)) {
|
|
257
|
StringEntity se = new StringEntity(JSONObject.toJSONString(paramsMap), encoding);
|
258
|
258
|
httpPut.setEntity(se);
|
259
|
259
|
}
|
260
|
260
|
CloseableHttpResponse response = null;
|
261
|
261
|
try {
|
|
262
|
log.debug("执行PUT请求:url= " + url + ",参数= " + JSONObject.toJSONString(paramsMap));
|
262
|
263
|
response = (CloseableHttpResponse) httpClient.execute(httpPut);
|
263
|
264
|
} catch (Exception e) {
|
264
|
265
|
log.error("sendPut Exception: " + e.getMessage());
|
|
@ -271,7 +272,15 @@ public class HttpServiceUtil {
|
271
|
272
|
private static String responseEx(HttpClient httpClient, CloseableHttpResponse response, Charset encoding) {
|
272
|
273
|
String resp = "";
|
273
|
274
|
try {
|
274
|
|
if (response != null && 200 == response.getStatusLine().getStatusCode()) {
|
|
275
|
if (response == null) {
|
|
276
|
resp = "{}";
|
|
277
|
log.error("请求执行失败,无返回信息");
|
|
278
|
} else if (200 != response.getStatusLine().getStatusCode()) {
|
|
279
|
resp = "{}";
|
|
280
|
log.error("请求执行失败,状态码=" + response.getStatusLine().getStatusCode() + ",返回信息="
|
|
281
|
+ EntityUtils.toString(response.getEntity(), encoding));
|
|
282
|
} else {
|
|
283
|
log.debug("请求执行成功");
|
275
|
284
|
resp = EntityUtils.toString(response.getEntity(), encoding);
|
276
|
285
|
}
|
277
|
286
|
} catch (Exception e) {
|
|
@ -29,10 +29,10 @@ public class NorthboundInterfaceUtil {
|
29
|
29
|
@Value("${aap.iot.passWord:123456}")
|
30
|
30
|
private String passWord;
|
31
|
31
|
|
32
|
|
@Value("${url.iot.login:http://47.105.130.83:8083/sso/login}")
|
|
32
|
@Value("${url.iot.login:http://60.205.219.67:80/sso/login}")
|
33
|
33
|
private String iotLoginUrl;
|
34
|
34
|
|
35
|
|
@Value("${url.iot.service:http://47.105.130.83:8083/dmp/terminalNorthApi/}")
|
|
35
|
@Value("${url.iot.service:http://60.205.219.67:80/dmp/terminalNorthApi/}")
|
36
|
36
|
private String iotServiceUrl;
|
37
|
37
|
|
38
|
38
|
/**
|
|
@ -43,7 +43,7 @@ public class NorthboundInterfaceUtil {
|
43
|
43
|
* @throws Exception
|
44
|
44
|
*/
|
45
|
45
|
public Map<String, Object> iotGetCallUtil(String url) throws Exception {
|
46
|
|
logger.debug("GET调用北向接口");
|
|
46
|
logger.debug("GET方法调用北向接口");
|
47
|
47
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
48
|
48
|
Map<String, String> signMap = new HashMap<String, String>();
|
49
|
49
|
|
|
@ -133,8 +133,8 @@ public class NorthboundInterfaceUtil {
|
133
|
133
|
* @return
|
134
|
134
|
* @throws Exception
|
135
|
135
|
*/
|
136
|
|
public Map<String, Object> iotPostCallUtil(String url, Map<String, Object> paramsMap) throws Exception {
|
137
|
|
logger.debug("POSt调用北向接口");
|
|
136
|
public Map<String, Object> iotPostCallUtil(String url, Map<String, Object> paramsMap) throws Exception {
|
|
137
|
logger.debug("POST方法调用北向接口");
|
138
|
138
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
139
|
139
|
Map<String, String> signMap = new HashMap<String, String>();
|
140
|
140
|
|
|
@ -219,7 +219,7 @@ public class NorthboundInterfaceUtil {
|
219
|
219
|
* @return
|
220
|
220
|
*/
|
221
|
221
|
private Map<String, String> iotLogin() throws Exception {
|
222
|
|
logger.debug("登录北向接口");
|
|
222
|
logger.debug("调用登录北向接口");
|
223
|
223
|
HashMap<String, Object> loginParamMap = new HashMap<>();
|
224
|
224
|
|
225
|
225
|
// 调用登录接口获取sessionId与sign
|
|
@ -9,7 +9,7 @@
|
9
|
9
|
<!-- <server ip="121.42.183.206" port="7104" /> -->
|
10
|
10
|
<!-- <server ip="121.42.183.206" port="7105" /> -->
|
11
|
11
|
<!-- <server ip="121.42.183.206" port="7106" /> -->
|
12
|
|
<server ip="10.19.90.34" port="7106" />
|
|
12
|
<server ip="10.19.90.34" port="6379" />
|
13
|
13
|
</servers>
|
14
|
14
|
<!-- 客户端类型:Jedis,JedisCluster -->
|
15
|
15
|
<config name="clientType" value="Jedis"/>
|