|
@ -35,257 +35,266 @@ import com.alibaba.fastjson.JSONObject;
|
35
|
35
|
|
36
|
36
|
@Service
|
37
|
37
|
public class AlarmManagementServiceImpl implements AlarmManagementService {
|
38
|
|
Logger logger = LoggerFactory.getLogger(AlarmManagementServiceImpl.class);
|
39
|
|
|
40
|
|
@Autowired
|
41
|
|
private RescueCommand rescueCommand;
|
42
|
|
|
43
|
|
@Autowired
|
44
|
|
private RescueQueryService rescueQueryService;
|
45
|
|
|
46
|
|
@Autowired
|
47
|
|
private EntityPositionRepository entityPositionRepository;
|
48
|
|
|
49
|
|
@Autowired
|
50
|
|
private MapAreaTagQuery mapAreaTagQuery;
|
51
|
|
|
52
|
|
@Autowired
|
53
|
|
private MapAreaQuery mapAreaQuery;
|
54
|
|
|
55
|
|
@Autowired
|
56
|
|
private ResourceToolQuery resourceToolQuery;
|
57
|
|
|
58
|
|
@Autowired
|
59
|
|
private CharacteristicSpecService characteristicSpecService;
|
60
|
|
|
61
|
|
/**
|
62
|
|
* 初始化实时报警数据
|
63
|
|
*
|
64
|
|
* @return
|
65
|
|
* @throws Exception
|
66
|
|
*/
|
67
|
|
@Override
|
68
|
|
public CommonResponse<List<Map<String,Object>>> loadAlarmDetails() throws Exception {
|
69
|
|
Map<String, Object> param = new HashMap<String, Object>();
|
70
|
|
param.put("notStatus", WorkTask.END_STATUS);
|
71
|
|
CommonRequest<Map<String, Object>> request =new CommonRequest(param);
|
72
|
|
CommonResponse<List<Map<String,Object>>> response = rescueQueryService.queryWorkTaskRescue(request);
|
73
|
|
|
74
|
|
if (CollectionUtils.isEmpty(response.getData())) {
|
75
|
|
return CommonResponse.ok(new ArrayList<Map<String,Object>>());
|
76
|
|
}
|
77
|
|
|
78
|
|
CharacteristicSpec characteristicSpec = characteristicSpecService
|
79
|
|
.findBusinessSpecByCharSpecCode(EbcConstant.BUSINESS_SPEC_MAP_AREA_TYPE);
|
80
|
|
|
81
|
|
List<Map<String, Object>> alarmTaskList=new ArrayList<Map<String,Object>>();
|
82
|
|
|
83
|
|
for (Map<String, Object> responseMap : response.getData()) {
|
84
|
|
Map<String, Object> alarmMap=new HashMap<String, Object>();
|
85
|
|
JSONObject alarmJsonObj=JSONObject.parseObject(responseMap.get("charValueSet").toString());
|
86
|
|
|
87
|
|
alarmMap.put("workTaskId",responseMap.get("workTaskId"));
|
88
|
|
alarmMap.put("terminalId",responseMap.get("terminalId"));
|
89
|
|
long alarmTimeLong=Long.valueOf(alarmJsonObj.getString("alarmTime"));
|
90
|
|
alarmMap.put("alarmTime",DateUtil.formatDate(alarmTimeLong));
|
91
|
|
alarmMap.put("durationTime",DateUtil.getDifferenceString(alarmTimeLong,System.currentTimeMillis()));
|
92
|
|
|
93
|
|
//alarmMap.put("businessType", alarmJsonObj.getString("businessType"));
|
94
|
|
String businessType=alarmJsonObj.getString("businessType");
|
95
|
|
for (CharacteristicSpecValue characteristicSpecValue : characteristicSpec.getCharacteristicSpecValues()) {
|
96
|
|
if (characteristicSpecValue.getCode().equals(businessType)) {
|
97
|
|
alarmMap.put("businessType", characteristicSpecValue.getCode());
|
98
|
|
alarmMap.put("businessTypeZH", characteristicSpecValue.getValue());
|
99
|
|
break;
|
100
|
|
}
|
101
|
|
}
|
102
|
|
|
103
|
|
//EntityPosition aaa=(EntityPosition)responseMap.get("rescueTargetEntityPosition");
|
104
|
|
alarmMap.put("rescueTargetEntityPosition",responseMap.get("rescueTargetEntityPosition"));
|
105
|
|
|
106
|
|
if (responseMap.get("rescueWorkEmployeeRoleId")==null) {
|
107
|
|
alarmMap.put("isAssignAlarm",EbcConstant.IS_ASSIGN_RESCUER_FALSE);
|
108
|
|
}else {
|
109
|
|
alarmMap.put("rescueEntityPosition",responseMap.get("rescueEntityPosition"));
|
110
|
|
alarmMap.put("isAssignAlarm",EbcConstant.IS_ASSIGN_RESCUER_TRUE);
|
111
|
|
}
|
112
|
|
|
113
|
|
alarmTaskList.add(alarmMap);
|
114
|
|
}
|
115
|
|
|
116
|
|
return CommonResponse.ok(alarmTaskList);
|
117
|
|
}
|
118
|
|
|
119
|
|
/**
|
120
|
|
* 查询地图标记和设备信息
|
121
|
|
* @param dataMap
|
122
|
|
* @return
|
123
|
|
*/
|
124
|
|
@Override
|
125
|
|
public CommonResponse<Map<String, Object>> loadMapAreaTool(HashMap<String, Object> dataMap) throws Exception {
|
126
|
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
127
|
|
|
128
|
|
List<MapAreaBusinessType> mapAreaTypeList = mapAreaQuery.queryAllMapAreaBusinessType(new CommonRequest(null))
|
129
|
|
.getData();
|
130
|
|
List<ResourceToolType> toolTypeList = resourceToolQuery.loadAllResourceToolType(new CommonRequest(null))
|
131
|
|
.getData();
|
132
|
|
|
133
|
|
List<Map<String, Object>> mapAreaList = mapAreaTagQuery
|
134
|
|
.queryAllMapAreaByConditions(new CommonRequest<Map<String, Object>>(dataMap)).getData();
|
135
|
|
List<Map<String, Object>> toolList = resourceToolQuery
|
136
|
|
.queryWorkToolByOrgAndBindFlag(new CommonRequest<HashMap<String, Object>>(dataMap)).getData().getData();
|
137
|
|
|
138
|
|
resultMap.put("mapAreaTypeList", mapAreaTypeList);
|
139
|
|
resultMap.put("toolTypeList", toolTypeList);
|
140
|
|
|
141
|
|
resultMap.put("mapAreaList", mapAreaList);
|
142
|
|
resultMap.put("toolList", toolList);
|
143
|
|
|
144
|
|
return CommonResponse.ok(resultMap);
|
145
|
|
}
|
146
|
|
|
147
|
|
/**
|
148
|
|
* 指派救援
|
149
|
|
*
|
150
|
|
* @param workTaskRescue
|
151
|
|
* @return
|
152
|
|
* @throws Exception
|
153
|
|
*/
|
154
|
|
@Override
|
155
|
|
public CommonResponse<EntityPosition> assignRescuer(WorkTaskRescue workTaskRescue) throws Exception {
|
156
|
|
CommonRequest<WorkTaskRescue> commonRequest = new CommonRequest<WorkTaskRescue>(workTaskRescue);
|
157
|
|
CommonResponse<WorkTaskRescue> response=rescueCommand.assignRescueEmployee(commonRequest);
|
158
|
|
|
159
|
|
if (response.isSuccess()) {
|
160
|
|
List<EntityPosition> list = entityPositionRepository.findByEntityId(workTaskRescue.getRescueWorkEmployeeRoleId());
|
161
|
|
if (!CollectionUtils.isEmpty(list)) {
|
162
|
|
return CommonResponse.ok(list.get(0));
|
163
|
|
}else {
|
164
|
|
return CommonResponse.ok(null);
|
165
|
|
}
|
166
|
|
}else {
|
167
|
|
return CommonResponse.fail("505", "指派失败");
|
168
|
|
}
|
169
|
|
}
|
170
|
|
|
171
|
|
/**
|
172
|
|
* 关闭救援
|
173
|
|
*
|
174
|
|
* @param workTaskRescue
|
175
|
|
* @return
|
176
|
|
* @throws Exception
|
177
|
|
*/
|
178
|
|
@Override
|
179
|
|
public CommonResponse<WorkTaskRescue> closeRescue(WorkTaskRescue workTaskRescue, String isFalseAlarm)
|
180
|
|
throws Exception {
|
181
|
|
CommonRequest<WorkTaskRescue> commonRequest = new CommonRequest<WorkTaskRescue>(workTaskRescue);
|
182
|
|
if (EbcConstant.IS_ASSIGN_RESCUER_TRUE.equals(isFalseAlarm)) {
|
183
|
|
return rescueCommand.closeTask(commonRequest);
|
184
|
|
} else {
|
185
|
|
return rescueCommand.falseAlarm(commonRequest);
|
186
|
|
}
|
187
|
|
}
|
188
|
|
|
189
|
|
/**
|
190
|
|
* 分页查询历史报警数据
|
191
|
|
*
|
192
|
|
* @param dataMap
|
193
|
|
* @param pageNumber
|
194
|
|
* @param pageSize
|
195
|
|
* @return
|
196
|
|
* @throws Exception
|
197
|
|
*/
|
198
|
|
@Override
|
199
|
|
public CommonResponse<PageBean<Map<String, Object>>> queryPageCloseAlarmTask(Map<String, Object> dataMap, int pageNumber, int pageSize)
|
200
|
|
throws Exception {
|
201
|
|
CommonRequest<Map<String, Object>> request = new CommonRequest<Map<String, Object>>(dataMap,pageNumber, pageSize);
|
202
|
|
CommonResponse<PageBean<Map<String, Object>>> response = rescueQueryService.queryHisWorkTaskRescue(request);
|
203
|
|
|
204
|
|
if (CollectionUtils.isEmpty(response.getData().getData())) {
|
205
|
|
return response;
|
206
|
|
}
|
207
|
|
|
208
|
|
List<Map<String, Object>> alarmTaskList=new ArrayList<Map<String,Object>>();
|
209
|
|
|
210
|
|
for (Map<String, Object> responseMap : response.getData().getData()) {
|
211
|
|
Map<String, Object> alarmMap=new HashMap<String, Object>();
|
212
|
|
JSONObject alarmJsonObj=JSONObject.parseObject(responseMap.get("charValueSet").toString());
|
213
|
|
|
214
|
|
alarmMap.put("workTaskId",responseMap.get("workTaskId"));
|
215
|
|
alarmMap.put("terminalId",responseMap.get("terminalId"));
|
216
|
|
alarmMap.put("longitude",alarmJsonObj.getString("longitude"));
|
217
|
|
alarmMap.put("latitude",alarmJsonObj.getString("latitude"));
|
218
|
|
alarmMap.put("businessType", alarmJsonObj.getString("businessType"));
|
219
|
|
alarmMap.put("targetUserId",responseMap.get("targetEmployeeRoleId"));
|
220
|
|
alarmMap.put("targetUserName",responseMap.get("targetEmployeeRoleName"));
|
221
|
|
long alarmTimeLong=Long.valueOf(alarmJsonObj.getString("alarmTime"));
|
222
|
|
alarmMap.put("alarmTime",DateUtil.formatDate(alarmTimeLong));
|
223
|
|
|
224
|
|
if (responseMap.get("rescueWorkEmployeeRoleId")!=null) {
|
225
|
|
alarmMap.put("rescueUserId",responseMap.get("rescueWorkEmployeeRoleId"));
|
226
|
|
alarmMap.put("rescueUserName",responseMap.get("rescueWorkEmployeeRoleName"));
|
227
|
|
if (responseMap.get("rescueCloseTime")!=null) {
|
228
|
|
long rescueTimeLong=DateUtil.convertDate(responseMap.get("rescueCloseTime").toString()).getTime();
|
229
|
|
alarmMap.put("rescueTime",responseMap.get("rescueCloseTime").toString());
|
230
|
|
alarmMap.put("durationTime",DateUtil.getDifferenceString(alarmTimeLong, rescueTimeLong));
|
231
|
|
}else {
|
232
|
|
alarmMap.put("rescueTime","-");
|
233
|
|
alarmMap.put("durationTime","-");
|
234
|
|
}
|
235
|
|
alarmMap.put("isFalseAlarm",EbcConstant.IS_ASSIGN_RESCUER_TRUE);
|
236
|
|
|
237
|
|
}else {
|
238
|
|
alarmMap.put("rescueUserId",null);
|
239
|
|
alarmMap.put("rescueUserName","-");
|
240
|
|
alarmMap.put("rescueTime","-");
|
241
|
|
alarmMap.put("durationTime","-");
|
242
|
|
alarmMap.put("isFalseAlarm",EbcConstant.IS_ASSIGN_RESCUER_FALSE);
|
243
|
|
}
|
244
|
|
|
245
|
|
alarmTaskList.add(alarmMap);
|
246
|
|
}
|
247
|
|
|
248
|
|
response.getData().setData(alarmTaskList);
|
249
|
|
|
250
|
|
return response;
|
251
|
|
}
|
252
|
|
|
253
|
|
/**
|
254
|
|
* 获取报警类型下拉列表
|
255
|
|
* @return
|
256
|
|
* @throws Exception
|
257
|
|
*/
|
258
|
|
@Override
|
259
|
|
public List<Map<String, String>> queryAlarmTypeList() throws Exception {
|
260
|
|
CharacteristicSpec characteristicSpec = characteristicSpecService
|
261
|
|
.findBusinessSpecByCharSpecCode(EbcConstant.BUSINESS_SPEC_MAP_AREA_TYPE);
|
262
|
|
|
263
|
|
if (characteristicSpec == null||CollectionUtils.isEmpty(characteristicSpec.getCharacteristicSpecValues())) {
|
264
|
|
return new ArrayList<Map<String, String>>();
|
265
|
|
}
|
266
|
|
|
267
|
|
List<Map<String, String>> resultList = new ArrayList<Map<String, String>>();
|
268
|
|
for (CharacteristicSpecValue characteristicSpecValue : characteristicSpec.getCharacteristicSpecValues()) {
|
269
|
|
Map<String, String> map = new HashMap<String, String>();
|
270
|
|
map.put("alarmTypeId", characteristicSpecValue.getCode());
|
271
|
|
map.put("alarmTypeName", characteristicSpecValue.getValue());
|
272
|
|
resultList.add(map);
|
273
|
|
}
|
274
|
|
|
275
|
|
return resultList;
|
276
|
|
}
|
277
|
|
|
278
|
|
/**
|
279
|
|
* 删除历史报警
|
280
|
|
*
|
281
|
|
* @param workTaskRescue
|
282
|
|
* @return
|
283
|
|
* @throws Exception
|
284
|
|
*/
|
285
|
|
@Override
|
286
|
|
public CommonResponse<WorkTaskRescue> deleteCloseAlarm(WorkTaskRescue workTaskRescue) throws Exception {
|
287
|
|
CommonRequest<WorkTaskRescue> commonRequest=new CommonRequest(workTaskRescue);
|
288
|
|
return rescueCommand.deleteTask(commonRequest);
|
289
|
|
}
|
|
38
|
Logger logger = LoggerFactory.getLogger(AlarmManagementServiceImpl.class);
|
290
|
39
|
|
|
40
|
@Autowired
|
|
41
|
private RescueCommand rescueCommand;
|
|
42
|
|
|
43
|
@Autowired
|
|
44
|
private RescueQueryService rescueQueryService;
|
|
45
|
|
|
46
|
@Autowired
|
|
47
|
private EntityPositionRepository entityPositionRepository;
|
|
48
|
|
|
49
|
@Autowired
|
|
50
|
private MapAreaTagQuery mapAreaTagQuery;
|
|
51
|
|
|
52
|
@Autowired
|
|
53
|
private MapAreaQuery mapAreaQuery;
|
|
54
|
|
|
55
|
@Autowired
|
|
56
|
private ResourceToolQuery resourceToolQuery;
|
|
57
|
|
|
58
|
@Autowired
|
|
59
|
private CharacteristicSpecService characteristicSpecService;
|
|
60
|
|
|
61
|
/**
|
|
62
|
* 初始化实时报警数据
|
|
63
|
*
|
|
64
|
* @return
|
|
65
|
* @throws Exception
|
|
66
|
*/
|
|
67
|
@Override
|
|
68
|
public CommonResponse<List<Map<String, Object>>> loadAlarmDetails() throws Exception {
|
|
69
|
Map<String, Object> param = new HashMap<String, Object>();
|
|
70
|
param.put("notStatus", WorkTask.END_STATUS);
|
|
71
|
CommonRequest<Map<String, Object>> request = new CommonRequest(param);
|
|
72
|
CommonResponse<List<Map<String, Object>>> response = rescueQueryService.queryWorkTaskRescue(request);
|
|
73
|
|
|
74
|
if (CollectionUtils.isEmpty(response.getData())) {
|
|
75
|
return CommonResponse.ok(new ArrayList<Map<String, Object>>());
|
|
76
|
}
|
|
77
|
|
|
78
|
CharacteristicSpec characteristicSpec = characteristicSpecService
|
|
79
|
.findBusinessSpecByCharSpecCode(EbcConstant.BUSINESS_SPEC_MAP_AREA_TYPE);
|
|
80
|
|
|
81
|
List<Map<String, Object>> alarmTaskList = new ArrayList<Map<String, Object>>();
|
|
82
|
|
|
83
|
for (Map<String, Object> responseMap : response.getData()) {
|
|
84
|
Map<String, Object> alarmMap = new HashMap<String, Object>();
|
|
85
|
JSONObject alarmJsonObj = JSONObject.parseObject(responseMap.get("charValueSet").toString());
|
|
86
|
|
|
87
|
alarmMap.put("workTaskId", responseMap.get("workTaskId"));
|
|
88
|
alarmMap.put("terminalId", responseMap.get("terminalId"));
|
|
89
|
long alarmTimeLong = Long.valueOf(alarmJsonObj.getString("alarmTime"));
|
|
90
|
alarmMap.put("alarmTime", DateUtil.formatDate(alarmTimeLong));
|
|
91
|
alarmMap.put("durationTime", DateUtil.getDifferenceString(alarmTimeLong, System.currentTimeMillis()));
|
|
92
|
alarmMap.put("targetEmployeeRoleId", responseMap.get("targetEmployeeRoleId"));
|
|
93
|
alarmMap.put("rescueWorkEmployeeRoleId", responseMap.get("rescueWorkEmployeeRoleId"));
|
|
94
|
|
|
95
|
//alarmMap.put("businessType", alarmJsonObj.getString("businessType"));
|
|
96
|
String businessType = alarmJsonObj.getString("businessType");
|
|
97
|
for (CharacteristicSpecValue characteristicSpecValue : characteristicSpec.getCharacteristicSpecValues()) {
|
|
98
|
if (characteristicSpecValue.getCode().equals(businessType)) {
|
|
99
|
alarmMap.put("businessType", characteristicSpecValue.getCode());
|
|
100
|
alarmMap.put("businessTypeZH", characteristicSpecValue.getValue());
|
|
101
|
break;
|
|
102
|
}
|
|
103
|
}
|
|
104
|
|
|
105
|
//EntityPosition aaa=(EntityPosition)responseMap.get("rescueTargetEntityPosition");
|
|
106
|
alarmMap.put("rescueTargetEntityPosition", responseMap.get("rescueTargetEntityPosition"));
|
|
107
|
|
|
108
|
if (responseMap.get("rescueWorkEmployeeRoleId") == null) {
|
|
109
|
alarmMap.put("isAssignAlarm", EbcConstant.IS_ASSIGN_RESCUER_FALSE);
|
|
110
|
} else {
|
|
111
|
alarmMap.put("rescueEntityPosition", responseMap.get("rescueEntityPosition"));
|
|
112
|
alarmMap.put("isAssignAlarm", EbcConstant.IS_ASSIGN_RESCUER_TRUE);
|
|
113
|
}
|
|
114
|
|
|
115
|
alarmTaskList.add(alarmMap);
|
|
116
|
}
|
|
117
|
|
|
118
|
return CommonResponse.ok(alarmTaskList);
|
|
119
|
}
|
|
120
|
|
|
121
|
/**
|
|
122
|
* 查询地图标记和设备信息
|
|
123
|
*
|
|
124
|
* @param dataMap
|
|
125
|
* @return
|
|
126
|
*/
|
|
127
|
@Override
|
|
128
|
public CommonResponse<Map<String, Object>> loadMapAreaTool(HashMap<String, Object> dataMap) throws Exception {
|
|
129
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
|
130
|
|
|
131
|
List<MapAreaBusinessType> mapAreaTypeList = mapAreaQuery.queryAllMapAreaBusinessType(new CommonRequest(null))
|
|
132
|
.getData();
|
|
133
|
List<ResourceToolType> toolTypeList = resourceToolQuery.loadAllResourceToolType(new CommonRequest(null))
|
|
134
|
.getData();
|
|
135
|
|
|
136
|
List<Map<String, Object>> mapAreaList = mapAreaTagQuery
|
|
137
|
.queryAllMapAreaByConditions(new CommonRequest<Map<String, Object>>(dataMap)).getData();
|
|
138
|
List<Map<String, Object>> toolList = resourceToolQuery
|
|
139
|
.queryWorkToolByOrgAndBindFlag(new CommonRequest<HashMap<String, Object>>(dataMap)).getData().getData();
|
|
140
|
|
|
141
|
resultMap.put("mapAreaTypeList", mapAreaTypeList);
|
|
142
|
resultMap.put("toolTypeList", toolTypeList);
|
|
143
|
|
|
144
|
resultMap.put("mapAreaList", mapAreaList);
|
|
145
|
resultMap.put("toolList", toolList);
|
|
146
|
|
|
147
|
return CommonResponse.ok(resultMap);
|
|
148
|
}
|
|
149
|
|
|
150
|
/**
|
|
151
|
* 指派救援
|
|
152
|
*
|
|
153
|
* @param workTaskRescue
|
|
154
|
* @return
|
|
155
|
* @throws Exception
|
|
156
|
*/
|
|
157
|
@Override
|
|
158
|
public CommonResponse<EntityPosition> assignRescuer(WorkTaskRescue workTaskRescue) throws Exception {
|
|
159
|
CommonRequest<WorkTaskRescue> commonRequest = new CommonRequest<WorkTaskRescue>(workTaskRescue);
|
|
160
|
CommonResponse<WorkTaskRescue> response = rescueCommand.assignRescueEmployee(commonRequest);
|
|
161
|
|
|
162
|
if (response.isSuccess()) {
|
|
163
|
List<EntityPosition> list = entityPositionRepository.findByEntityId(workTaskRescue.getRescueWorkEmployeeRoleId());
|
|
164
|
if (!CollectionUtils.isEmpty(list)) {
|
|
165
|
return CommonResponse.ok(list.get(0));
|
|
166
|
} else {
|
|
167
|
return CommonResponse.ok(null);
|
|
168
|
}
|
|
169
|
} else {
|
|
170
|
return CommonResponse.fail("505", "指派失败");
|
|
171
|
}
|
|
172
|
}
|
|
173
|
|
|
174
|
/**
|
|
175
|
* 关闭救援
|
|
176
|
*
|
|
177
|
* @param workTaskRescue
|
|
178
|
* @return
|
|
179
|
* @throws Exception
|
|
180
|
*/
|
|
181
|
@Override
|
|
182
|
public CommonResponse<WorkTaskRescue> closeRescue(WorkTaskRescue workTaskRescue, String isFalseAlarm)
|
|
183
|
throws Exception {
|
|
184
|
CommonRequest<WorkTaskRescue> commonRequest = new CommonRequest<WorkTaskRescue>(workTaskRescue);
|
|
185
|
if (EbcConstant.IS_ASSIGN_RESCUER_TRUE.equals(isFalseAlarm)) {
|
|
186
|
return rescueCommand.closeTask(commonRequest);
|
|
187
|
} else {
|
|
188
|
return rescueCommand.falseAlarm(commonRequest);
|
|
189
|
}
|
|
190
|
}
|
|
191
|
|
|
192
|
/**
|
|
193
|
* 分页查询历史报警数据
|
|
194
|
*
|
|
195
|
* @param dataMap
|
|
196
|
* @param pageNumber
|
|
197
|
* @param pageSize
|
|
198
|
* @return
|
|
199
|
* @throws Exception
|
|
200
|
*/
|
|
201
|
@Override
|
|
202
|
public CommonResponse<PageBean<Map<String, Object>>> queryPageCloseAlarmTask(Map<String, Object> dataMap, int pageNumber, int pageSize)
|
|
203
|
throws Exception {
|
|
204
|
CommonRequest<Map<String, Object>> request = new CommonRequest<Map<String, Object>>(dataMap, pageNumber, pageSize);
|
|
205
|
CommonResponse<PageBean<Map<String, Object>>> response = rescueQueryService.queryHisWorkTaskRescue(request);
|
|
206
|
|
|
207
|
if (CollectionUtils.isEmpty(response.getData().getData())) {
|
|
208
|
return response;
|
|
209
|
}
|
|
210
|
|
|
211
|
List<Map<String, Object>> alarmTaskList = new ArrayList<Map<String, Object>>();
|
|
212
|
|
|
213
|
for (Map<String, Object> responseMap : response.getData().getData()) {
|
|
214
|
Map<String, Object> alarmMap = new HashMap<String, Object>();
|
|
215
|
JSONObject alarmJsonObj = JSONObject.parseObject(responseMap.get("charValueSet").toString());
|
|
216
|
|
|
217
|
alarmMap.put("workTaskId", responseMap.get("workTaskId"));
|
|
218
|
alarmMap.put("terminalId", responseMap.get("terminalId"));
|
|
219
|
alarmMap.put("longitude", alarmJsonObj.getString("longitude"));
|
|
220
|
alarmMap.put("latitude", alarmJsonObj.getString("latitude"));
|
|
221
|
alarmMap.put("businessType", alarmJsonObj.getString("businessType"));
|
|
222
|
alarmMap.put("targetUserId", responseMap.get("targetEmployeeRoleId"));
|
|
223
|
alarmMap.put("targetUserName", responseMap.get("targetEmployeeRoleName"));
|
|
224
|
long alarmTimeLong = Long.valueOf(alarmJsonObj.getString("alarmTime"));
|
|
225
|
alarmMap.put("alarmTime", DateUtil.formatDate(alarmTimeLong));
|
|
226
|
|
|
227
|
if (responseMap.get("rescueWorkEmployeeRoleId") != null) {
|
|
228
|
alarmMap.put("rescueUserId", responseMap.get("rescueWorkEmployeeRoleId"));
|
|
229
|
alarmMap.put("rescueUserName", responseMap.get("rescueWorkEmployeeRoleName"));
|
|
230
|
if (responseMap.get("rescueCloseTime") != null) {
|
|
231
|
long rescueTimeLong = DateUtil.convertDate(responseMap.get("rescueCloseTime").toString()).getTime();
|
|
232
|
alarmMap.put("rescueTime", responseMap.get("rescueCloseTime").toString());
|
|
233
|
alarmMap.put("durationTime", DateUtil.getDifferenceString(alarmTimeLong, rescueTimeLong));
|
|
234
|
} else {
|
|
235
|
alarmMap.put("rescueTime", "-");
|
|
236
|
alarmMap.put("durationTime", "-");
|
|
237
|
}
|
|
238
|
alarmMap.put("isFalseAlarm", EbcConstant.IS_ASSIGN_RESCUER_TRUE);
|
|
239
|
|
|
240
|
} else {
|
|
241
|
alarmMap.put("rescueUserId", null);
|
|
242
|
alarmMap.put("rescueUserName", "-");
|
|
243
|
alarmMap.put("rescueTime", "-");
|
|
244
|
alarmMap.put("durationTime", "-");
|
|
245
|
alarmMap.put("isFalseAlarm", EbcConstant.IS_ASSIGN_RESCUER_FALSE);
|
|
246
|
}
|
|
247
|
|
|
248
|
alarmTaskList.add(alarmMap);
|
|
249
|
}
|
|
250
|
|
|
251
|
response.getData().setData(alarmTaskList);
|
|
252
|
|
|
253
|
return response;
|
|
254
|
}
|
|
255
|
|
|
256
|
/**
|
|
257
|
* 获取报警类型下拉列表
|
|
258
|
*
|
|
259
|
* @return
|
|
260
|
* @throws Exception
|
|
261
|
*/
|
|
262
|
@Override
|
|
263
|
public List<Map<String, String>> queryAlarmTypeList() throws Exception {
|
|
264
|
CharacteristicSpec characteristicSpec = characteristicSpecService
|
|
265
|
.findBusinessSpecByCharSpecCode(EbcConstant.BUSINESS_SPEC_MAP_AREA_TYPE);
|
|
266
|
|
|
267
|
if (characteristicSpec == null || CollectionUtils.isEmpty(characteristicSpec.getCharacteristicSpecValues())) {
|
|
268
|
return new ArrayList<Map<String, String>>();
|
|
269
|
}
|
|
270
|
|
|
271
|
List<Map<String, String>> resultList = new ArrayList<Map<String, String>>();
|
|
272
|
for (CharacteristicSpecValue characteristicSpecValue : characteristicSpec.getCharacteristicSpecValues()) {
|
|
273
|
Map<String, String> map = new HashMap<String, String>();
|
|
274
|
map.put("alarmTypeId", characteristicSpecValue.getCode());
|
|
275
|
map.put("alarmTypeName", characteristicSpecValue.getValue());
|
|
276
|
resultList.add(map);
|
|
277
|
}
|
|
278
|
|
|
279
|
return resultList;
|
|
280
|
}
|
|
281
|
|
|
282
|
/**
|
|
283
|
* 删除历史报警
|
|
284
|
*
|
|
285
|
* @param workTaskRescue
|
|
286
|
* @return
|
|
287
|
* @throws Exception
|
|
288
|
*/
|
|
289
|
@Override
|
|
290
|
public CommonResponse<WorkTaskRescue> deleteCloseAlarm(WorkTaskRescue workTaskRescue) throws Exception {
|
|
291
|
CommonRequest<WorkTaskRescue> commonRequest = new CommonRequest(workTaskRescue);
|
|
292
|
return rescueCommand.deleteTask(commonRequest);
|
|
293
|
}
|
|
294
|
|
|
295
|
@Override
|
|
296
|
public CommonResponse<Map<String, Object>> queryAlarmWorkTaskTrace(String workTaskId) throws Exception {
|
|
297
|
CommonRequest<String> request = new CommonRequest(workTaskId);
|
|
298
|
return rescueQueryService.queryWorkTaskRescuePositionTrace(request);
|
|
299
|
}
|
291
|
300
|
}
|