19 ol-19">
|
19
|
import com.ai.bss.security.protection.service.interfaces.AiIdenLogManageService;
|
|
20
|
import com.ai.bss.security.protection.service.interfaces.CharSpecService;
|
|
21
|
import com.ai.bss.security.protection.service.interfaces.MonitorVideoLogManageService;
|
|
22
|
import com.ai.bss.security.protection.service.interfaces.UploadFileService;
|
|
23
|
import com.ai.bss.security.protection.utils.DateUtil;
|
|
24
|
import com.ai.bss.security.protection.utils.EbcConstant;
|
|
25
|
import com.ai.bss.user.dto.EmployeeDto;
|
|
26
|
import com.ai.bss.user.service.api.EmployeeService;
|
|
27
|
import com.ai.bss.work.safety.model.AiIdenLog;
|
|
28
|
import com.ai.bss.work.safety.service.api.AiTaskCommand;
|
|
29
|
import com.ai.bss.work.safety.service.api.AiTaskQuery;
|
|
30
|
import com.alibaba.fastjson.JSON;
|
|
31
|
import com.alibaba.fastjson.JSONArray;
|
|
32
|
import com.alibaba.fastjson.JSONObject;
|
|
33
|
import com.alibaba.fastjson.TypeReference;
|
|
34
|
|
|
35
|
@Service
|
|
36
|
public class AiIdenLogManageServiceImpl implements AiIdenLogManageService {
|
|
37
|
|
|
38
|
@Autowired
|
|
39
|
private AiTaskQuery aiTaskQuery;
|
|
40
|
|
|
41
|
@Autowired
|
|
42
|
private AiTaskCommand aiTaskCommand;
|
|
43
|
|
|
44
|
@Autowired
|
|
45
|
private CharSpecService charSpecService;
|
|
46
|
|
|
47
|
@Autowired
|
|
48
|
private EmployeeService employeeService;
|
|
49
|
|
|
50
|
@Autowired
|
|
51
|
private UploadFileService uploadFileService;
|
|
52
|
|
|
53
|
@Autowired
|
|
54
|
private MonitorVideoLogManageService monitorVideoLogManageService;
|
|
55
|
|
|
56
|
@Autowired
|
|
57
|
private MinioConfig minioConfig;
|
|
58
|
|
|
59
|
@Override
|
|
60
|
public CommonResponse<PageBean<Map<String, Object>>> queryPageAiIdenLog(Map<String, Object> params, int pageNumber,
|
|
61
|
int pageSize) throws Exception {
|
|
62
|
CommonRequest<Map<String, Object>> conditionMapRequest = new CommonRequest<Map<String, Object>>(params,
|
|
63
|
pageNumber, pageSize);
|
|
64
|
|
|
65
|
CommonResponse<PageBean<Map<String, Object>>> response = aiTaskQuery.queryAiIdenLog(conditionMapRequest);
|
|
66
|
|
|
67
|
if (response == null || response.getData() == null || CollectionUtils.isEmpty(response.getData().getData())) {
|
|
68
|
return response;
|
|
69
|
}
|
|
70
|
|
|
71
|
Map<String, String> allPositionTypeMap = charSpecService
|
|
72
|
.getCharSpecMap(EbcConstant.BUSINESS_SPEC_EMPLOYEE_POSITION);
|
|
73
|
|
|
74
|
for (Map<String, Object> dataMap : response.getData().getData()) {
|
|
75
|
dataMap.put("taskExecuteTime", DateUtil.formatObjectToDate(dataMap.get("taskExecuteTime")));
|
|
76
|
dataMap.put("idenPictureSnapDate", DateUtil.formatObjectToDate(dataMap.get("idenPictureSnapDate")));
|
|
77
|
|
|
78
|
// 结果详情
|
|
79
|
String idenResultString = dataMap.get("idenResult") == null ? ""
|
|
80
|
: String.valueOf(dataMap.get("idenResult"));
|
|
81
|
if (StringUtils.isNotEmpty(idenResultString)) {
|
|
82
|
Object idenResultObject = JSON.parse(idenResultString);
|
|
83
|
if (idenResultObject instanceof JSONObject) {
|
|
84
|
Map<String, String> idenResultMap = JSON.parseObject(idenResultString, Map.class);
|
|
85
|
dataMap.putAll(idenResultMap);
|
|
86
|
|
|
87
|
if (idenResultMap.get("simi") != null) {
|
|
88
|
Object simiObject = idenResultMap.get("simi");
|
|
89
|
BigDecimal simiBigDecimal = new BigDecimal(String.valueOf(simiObject));
|
|
90
|
float simi = simiBigDecimal.multiply(new BigDecimal("100"))
|
|
91
|
.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
|
|
92
|
dataMap.put("simi", simi + "%");
|
|
93
|
}
|
|
94
|
|
|
95
|
} else if (idenResultObject instanceof JSONArray) {
|
|
96
|
List<Map<String, String>> idenResultList = JSONArray.parseObject(idenResultString, List.class);
|
|
97
|
if (!CollectionUtils.isEmpty(idenResultList)) {
|
|
98
|
dataMap.putAll(idenResultList.get(0));
|
|
99
|
}
|
|
100
|
}
|
|
101
|
}
|
|
102
|
|
|
103
|
// 员工信息
|
|
104
|
if (dataMap.get("relateEmployeeRoleId") != null) {
|
|
105
|
long relateEmployeeRoleId = Long.parseLong(String.valueOf(dataMap.get("relateEmployeeRoleId")));
|
|
106
|
|
|
107
|
EmployeeDto employeeDto = new EmployeeDto();
|
|
108
|
employeeDto.setId(relateEmployeeRoleId);
|
|
109
|
CommonRequest<EmployeeDto> request = CommonRequest.<EmployeeDto>builder().data(employeeDto).build();
|
|
110
|
CommonResponse<EmployeeDto> employeeResponse = employeeService.queryEmployee(request);
|
|
111
|
|
|
112
|
if (employeeResponse.getData() != null) {
|
|
113
|
dataMap.put("employeeName", employeeResponse.getData().getName());
|
|
114
|
dataMap.put("employeeCode", employeeResponse.getData().getCode());
|
|
115
|
|
|
116
|
dataMap.put("companyId", employeeResponse.getData().getField4());
|
|
117
|
dataMap.put("organizationCode", employeeResponse.getData().getOrganizeCode());
|
|
118
|
dataMap.put("organizationName", employeeResponse.getData().getOrgName());
|
|
119
|
|
|
120
|
String employeePosition = employeeResponse.getData().getMainJobPosition();
|
|
121
|
dataMap.put("employeePosition", employeePosition);
|
|
122
|
dataMap.put("employeePositionZh", allPositionTypeMap.get(employeePosition));
|
|
123
|
}
|
|
124
|
}
|
|
125
|
}
|
|
126
|
|
|
127
|
return response;
|
|
128
|
}
|
|
129
|
|
|
130
|
@Override
|
|
131
|
public CommonResponse<List<Map<String, Object>>> queryAllAiIdenLogPicture(Map<String, Object> params,
|
|
132
|
int pageNumber, int pageSize) throws Exception {
|
|
133
|
CommonRequest<Map<String, Object>> conditionMapRequest = new CommonRequest<Map<String, Object>>(params,
|
|
134
|
pageNumber, pageSize);
|
|
135
|
|
|
136
|
CommonResponse<PageBean<Map<String, Object>>> response = aiTaskQuery.queryAiIdenLog(conditionMapRequest);
|
|
137
|
|
|
138
|
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
|
139
|
if (response == null || response.getData() == null || CollectionUtils.isEmpty(response.getData().getData())) {
|
|
140
|
return CommonResponse.ok(list);
|
|
141
|
}
|
|
142
|
|
|
143
|
for (Map<String, Object> dataMap : response.getData().getData()) {
|
|
144
|
/*Map<String, String> pictureMap = uploadFileService.getFileUrlToMap(String.valueOf(dataMap.get("idenPictureUrl")));
|
|
145
|
|
|
146
|
if (!CollectionUtils.isEmpty(pictureMap)) {
|
|
147
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
148
|
map.putAll(pictureMap);
|
|
149
|
map.put("aiIdenLogId", dataMap.get("aiIdenLogId"));
|
|
150
|
map.put("idenPictureUrl", dataMap.get("idenPictureUrl"));
|
|
151
|
list.add(map);
|
|
152
|
}*/
|
|
153
|
|
|
154
|
String pictureUrl = String.valueOf(dataMap.get("idenPictureUrl"));
|
|
155
|
if (pictureUrl.length() > 20 && pictureUrl.lastIndexOf(".") > 18
|
|
156
|
&& pictureUrl.lastIndexOf(EbcConstant.AI_MONITOR_FILE_PREFIX_PICTURE) > 0) {
|
|
157
|
|
|
158
|
int picturePrefixIndex = pictureUrl.lastIndexOf(EbcConstant.AI_MONITOR_FILE_PREFIX_PICTURE)
|
|
159
|
+ EbcConstant.AI_MONITOR_FILE_PREFIX_PICTURE.length();
|
|
160
|
String fileName = pictureUrl.substring(picturePrefixIndex, picturePrefixIndex + 4) + "-"
|
|
161
|
+ pictureUrl.substring(picturePrefixIndex + 4, picturePrefixIndex + 6) + "-"
|
|
162
|
+ pictureUrl.substring(picturePrefixIndex + 6, picturePrefixIndex + 8);
|
|
163
|
|
|
164
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
165
|
map.put("aiIdenLogId", dataMap.get("aiIdenLogId"));
|
|
166
|
map.put("idenPictureUrl", pictureUrl);
|
|
167
|
map.put("fileName", fileName);
|
|
168
|
list.add(map);
|
|
169
|
}
|
|
170
|
}
|
|
171
|
|
|
172
|
return CommonResponse.ok(list);
|
|
173
|
}
|
|
174
|
|
|
175
|
@Override
|
|
176
|
public CommonResponse<Map<String, Object>> queryOneAiIdenLog(Long aiIdenLogId) throws Exception {
|
|
177
|
CommonRequest<Long> aiIdenLogIdRequest = new CommonRequest<Long>(aiIdenLogId);
|
|
178
|
CommonResponse<AiIdenLog> response = aiTaskQuery.loadAiIdenLog(aiIdenLogIdRequest);
|
|
179
|
|
|
180
|
if (response == null || response.getData() == null) {
|
|
181
|
return CommonResponse.fail("504", "未查到相关信息");
|
|
182
|
}
|
|
183
|
|
|
184
|
AiIdenLog aiIdenLog = response.getData();
|
|
185
|
Map<String, String> aiIdenLogInfoMap = JSON.parseObject(JSON.toJSONString(aiIdenLog),
|
|
186
|
new TypeReference<Map<String, String>>() {
|
|
187
|
});
|
|
188
|
|
|
189
|
aiIdenLogInfoMap.put("taskExecuteTime",
|
|
190
|
DateUtil.formatDate(Long.valueOf(aiIdenLogInfoMap.get("taskExecuteTime"))));
|
|
191
|
|
|
192
|
// 结果详情
|
|
193
|
if (StringUtils.isNotEmpty(aiIdenLog.getIdenResult())) {
|
|
194
|
Object idenResultObject = JSON.parse(aiIdenLog.getIdenResult());
|
|
195
|
if (idenResultObject instanceof JSONObject) {
|
|
196
|
Map<String, String> idenResultMap = JSON.parseObject(aiIdenLog.getIdenResult(), Map.class);
|
|
197
|
aiIdenLogInfoMap.putAll(idenResultMap);
|
|
198
|
|
|
199
|
if (idenResultMap.get("simi") != null) {
|
|
200
|
Object simiObject = idenResultMap.get("simi");
|
|
201
|
BigDecimal simiBigDecimal = new BigDecimal(String.valueOf(simiObject));
|
|
202
|
float simi = simiBigDecimal.multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP)
|
|
203
|
.floatValue();
|
|
204
|
aiIdenLogInfoMap.put("simi", simi + "%");
|
|
205
|
}
|
|
206
|
|
|
207
|
} else if (idenResultObject instanceof JSONArray) {
|
|
208
|
List<Map<String, String>> idenResultList = JSONArray.parseObject(aiIdenLog.getIdenResult(), List.class);
|
|
209
|
if (!CollectionUtils.isEmpty(idenResultList)) {
|
|
210
|
aiIdenLogInfoMap.putAll(idenResultList.get(0));
|
|
211
|
}
|
|
212
|
}
|
|
213
|
}
|
|
214
|
|
|
215
|
// 员工信息
|
|
216
|
if (StringUtils.isNotEmpty(aiIdenLog.getRelateEmployeeRoleId())) {
|
|
217
|
long relateEmployeeRoleId = Long.parseLong(aiIdenLog.getRelateEmployeeRoleId());
|
|
218
|
|
|
219
|
EmployeeDto employeeDto = new EmployeeDto();
|
|
220
|
employeeDto.setId(relateEmployeeRoleId);
|
|
221
|
CommonRequest<EmployeeDto> request = CommonRequest.<EmployeeDto>builder().data(employeeDto).build();
|
|
222
|
CommonResponse<EmployeeDto> employeeResponse = employeeService.queryEmployee(request);
|
|
223
|
|
|
224
|
if (employeeResponse.getData() != null) {
|
|
225
|
aiIdenLogInfoMap.put("employeeName", employeeResponse.getData().getName());
|
|
226
|
aiIdenLogInfoMap.put("employeeCode", employeeResponse.getData().getCode());
|
|
227
|
|
|
228
|
String headerImageName = employeeResponse.getData().getField1();
|
|
229
|
String headerImage = uploadFileService.getFileUrl(headerImageName, minioConfig.getBucketHeaderImage());
|
|
230
|
aiIdenLogInfoMap.put("headerImage", headerImage);
|
|
231
|
|
|
232
|
/*
|
|
233
|
String employeePosition = employeeResponse.getData().getMainJobPosition();
|
|
234
|
aiIdenLogInfoMap.put("employeePosition", employeePosition);
|
|
235
|
List<CharacteristicSpecValue> allPositionTypeList = charSpecService
|
|
236
|
.getCharSpecList(EbcConstant.BUSINESS_SPEC_EMPLOYEE_POSITION);
|
|
237
|
for (CharacteristicSpecValue characteristicSpecValue : allPositionTypeList) {
|
|
238
|
if (characteristicSpecValue.getCode().equals(employeePosition)) {
|
|
239
|
aiIdenLogInfoMap.put("employeePositionZh", characteristicSpecValue.getValue());
|
|
240
|
break;
|
|
241
|
}
|
|
242
|
}
|
|
243
|
|
|
244
|
aiIdenLogInfoMap.put("companyName", employeeResponse.getData().getField4());
|
|
245
|
aiIdenLogInfoMap.put("organizationCode", employeeResponse.getData().getOrganizeCode());
|
|
246
|
aiIdenLogInfoMap.put("organizationName", employeeResponse.getData().getOrgName());
|
|
247
|
*/
|
|
248
|
}
|
|
249
|
}
|
|
250
|
|
|
251
|
// 图片信息
|
|
252
|
Map<String, String> pictureMap = uploadFileService.getFileUrlToMap(aiIdenLog.getIdenPictureUrl());
|
|
253
|
|
|
254
|
// 视频信息
|
|
255
|
List<EbcMonitorVideoLog> logsList = monitorVideoLogManageService
|
|
256
|
.getMonitorVideoLogByPictureTime(pictureMap.get("fileDateTimeStr"), aiIdenLog.getResourceToolId())
|
|
257
|
.getData();
|
|
258
|
EbcMonitorVideoLog ebcMonitorVideoLog = null;
|
|
259
|
if (!CollectionUtils.isEmpty(logsList)) {
|
|
260
|
ebcMonitorVideoLog = logsList.get(0);
|
|
261
|
ebcMonitorVideoLog.setVideoFileUrl(uploadFileService.getFileUrl(ebcMonitorVideoLog.getVideoUrl()));
|
|
262
|
}
|
|
263
|
|
|
264
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
|
265
|
resultMap.put("alarmInfo", aiIdenLogInfoMap);
|
|
266
|
resultMap.put("pictureInfo", pictureMap);
|
|
267
|
resultMap.put("videoInfo", ebcMonitorVideoLog);
|
|
268
|
return CommonResponse.ok(resultMap);
|
|
269
|
}
|
|
270
|
|
|
271
|
@Override
|
|
272
|
public CommonResponse<List<Map<String, Object>>> selectLastAiIdenLog(Map<String, String> params) throws Exception {
|
|
273
|
CommonRequest<Map<String, String>> request = new CommonRequest<Map<String, String>>(params);
|
|
274
|
CommonResponse<List<Map<String, Object>>> response = aiTaskQuery
|
|
275
|
.selectAiIdenLogBySceneIdAndAiIdenModel(request);
|
|
276
|
|
|
277
|
if (response == null || response.getData() == null || CollectionUtils.isEmpty(response.getData())) {
|
|
278
|
return response;
|
|
279
|
}
|
|
280
|
|
|
281
|
for (Map<String, Object> dataMap : response.getData()) {
|
|
282
|
dataMap.put("taskExecuteTime", DateUtil.formatObjectToDate(dataMap.get("taskExecuteTime")));
|
|
283
|
|
|
284
|
String idenPictureName = String.valueOf(dataMap.get("idenPictureUrl"));
|
|
285
|
String idenPictureUrl = uploadFileService.getFileUrl(idenPictureName);
|
|
286
|
dataMap.put("idenPictureUrl", idenPictureUrl);
|
|
287
|
|
|
288
|
// 结果详情
|
|
289
|
String idenResultString = dataMap.get("idenResult") == null ? ""
|
|
290
|
: String.valueOf(dataMap.get("idenResult"));
|
|
291
|
if (StringUtils.isNotEmpty(idenResultString)) {
|
|
292
|
Object idenResultObject = JSON.parse(idenResultString);
|
|
293
|
if (idenResultObject instanceof JSONObject) {
|
|
294
|
Map<String, String> idenResultMap = JSON.parseObject(idenResultString, Map.class);
|
|
295
|
dataMap.putAll(idenResultMap);
|
|
296
|
|
|
297
|
if (idenResultMap.get("simi") != null) {
|
|
298
|
Object simiObject = idenResultMap.get("simi");
|
|
299
|
BigDecimal simiBigDecimal = new BigDecimal(String.valueOf(simiObject));
|
|
300
|
float simi = simiBigDecimal.multiply(new BigDecimal("100"))
|
|
301
|
.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
|
|
302
|
dataMap.put("simi", simi + "%");
|
|
303
|
}
|
|
304
|
|
|
305
|
} else if (idenResultObject instanceof JSONArray) {
|
|
306
|
List<Map<String, String>> idenResultList = JSONArray.parseObject(idenResultString, List.class);
|
|
307
|
if (!CollectionUtils.isEmpty(idenResultList)) {
|
|
308
|
dataMap.putAll(idenResultList.get(0));
|
|
309
|
}
|
|
310
|
}
|
|
311
|
}
|
|
312
|
|
|
313
|
// 员工信息
|
|
314
|
if (dataMap.get("relateEmployeeRoleId") != null) {
|
|
315
|
long relateEmployeeRoleId = Long.parseLong(String.valueOf(dataMap.get("relateEmployeeRoleId")));
|
|
316
|
|
|
317
|
EmployeeDto employeeDto = new EmployeeDto();
|
|
318
|
employeeDto.setId(relateEmployeeRoleId);
|
|
319
|
CommonRequest<EmployeeDto> requestEmployeeDto = CommonRequest.<EmployeeDto>builder().data(employeeDto)
|
|
320
|
.build();
|
|
321
|
CommonResponse<EmployeeDto> employeeResponse = employeeService.queryEmployee(requestEmployeeDto);
|
|
322
|
|
|
323
|
if (employeeResponse.getData() != null) {
|
|
324
|
dataMap.put("employeeName", employeeResponse.getData().getName());
|
|
325
|
dataMap.put("employeeCode", employeeResponse.getData().getCode());
|
|
326
|
|
|
327
|
String headerImageName = employeeResponse.getData().getField1();
|
|
328
|
String headerImage = uploadFileService.getFileUrl(headerImageName,
|
|
329
|
minioConfig.getBucketHeaderImage());
|
|
330
|
dataMap.put("headerImage", headerImage);
|
|
331
|
}
|
|
332
|
}
|
|
333
|
}
|
|
334
|
|
|
335
|
return response;
|
|
336
|
}
|
|
337
|
|
|
338
|
@Override
|
|
339
|
public CommonResponse<AiIdenLog> createAiIdenLog(AiIdenLog aiIdenLog) throws Exception {
|
|
340
|
CommonRequest<AiIdenLog> aiIdenLogRequest = new CommonRequest<AiIdenLog>(aiIdenLog);
|
|
341
|
return aiTaskCommand.createAiIdenLog(aiIdenLogRequest);
|
|
342
|
}
|
|
343
|
|
|
344
|
@Override
|
|
345
|
public CommonResponse<AiIdenLog> modifyAiIdenLog(AiIdenLog aiIdenLog) throws Exception {
|
|
346
|
CommonRequest<AiIdenLog> aiIdenLogRequest = new CommonRequest<AiIdenLog>(aiIdenLog);
|
|
347
|
return aiTaskCommand.modifyAiIdenLog(aiIdenLogRequest);
|
|
348
|
}
|
|
349
|
|
|
350
|
@Override
|
|
351
|
public CommonResponse<Void> deleteAiIdenLog(List<Long> aiIdenLogIdList) throws Exception {
|
|
352
|
CommonRequest<List<Long>> aiIdenLogIdListRequest = new CommonRequest<List<Long>>(aiIdenLogIdList);
|
|
353
|
return aiTaskCommand.deleteAiIdenLog(aiIdenLogIdListRequest);
|
|
354
|
}
|
|
355
|
|
|
356
|
}
|
|
@ -31,7 +31,7 @@ public class AttendanceCommonServiceImpl implements AttendanceCommonService {
|
31
|
31
|
private EmployeeService employeeService;
|
32
|
32
|
|
33
|
33
|
@Override
|
34
|
|
public CommonResponse<PageBean<UserDto>> queryWorkEmployee(Map<String, Object> params) {
|
|
34
|
public CommonResponse<PageBean<Map<String, Object>>> queryWorkEmployee(Map<String, Object> params) {
|
35
|
35
|
String orgCode = (!(params.get("orgCode") == null || "".equals(params.get("orgCode")))) ? (String) params.get("orgCode") : null;
|
36
|
36
|
String orgId = (!(params.get("orgId") == null || "".equals(params.get("orgId")))) ? (String) params.get("orgId") : null;
|
37
|
37
|
String employeeId = (!(params.get("employeeId") == null || "".equals(params.get("employeeId")))) ? (String) params.get("employeeId") : null;
|
|
@ -50,7 +50,7 @@ public class AttendanceCommonServiceImpl implements AttendanceCommonService {
|
50
|
50
|
}
|
51
|
51
|
|
52
|
52
|
@Override
|
53
|
|
public CommonResponse<PageBean<UserDto>> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception {
|
|
53
|
public CommonResponse<PageBean<Map<String, Object>>> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception {
|
54
|
54
|
// TODO 组织编码
|
55
|
55
|
//request.getData().setOrgCode("0000");
|
56
|
56
|
return userDtoQuery.queryWorkEmployee(request);
|
|
@ -0,0 +1,316 @@
|
|
1
|
package com.ai.bss.security.protection.service.impl;
|
|
2
|
|
|
3
|
import java.util.ArrayList;
|
|
4
|
import java.util.HashMap;
|
|
5
|
import java.util.List;
|
|
6
|
import java.util.Map;
|
|
7
|
|
|
8
|
import org.apache.commons.lang.StringUtils;
|
|
9
|
import org.slf4j.Logger;
|
|
10
|
import org.slf4j.LoggerFactory;
|
|
11
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
12
|
import org.springframework.stereotype.Service;
|
|
13
|
import org.springframework.util.CollectionUtils;
|
|
14
|
import org.springframework.web.multipart.MultipartFile;
|
|
15
|
|
|
16
|
import com.ai.abc.api.model.CommonRequest;
|
|
17
|
import com.ai.abc.api.model.CommonResponse;
|
|
18
|
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
|
|
19
|
import com.ai.bss.components.common.model.PageBean;
|
|
20
|
import com.ai.bss.components.minio.config.MinioConfig;
|
|
21
|
import com.ai.bss.person.model.Organization;
|
|
22
|
import com.ai.bss.person.service.api.OrganizationQuery;
|
|
23
|
import com.ai.bss.security.protection.service.interfaces.CharSpecService;
|
|
24
|
import com.ai.bss.security.protection.service.interfaces.EmployeeManagementService;
|
|
25
|
import com.ai.bss.security.protection.service.interfaces.UploadFileService;
|
|
26
|
import com.ai.bss.security.protection.utils.EbcConstant;
|
|
27
|
import com.ai.bss.user.dto.EmployeeDto;
|
|
28
|
import com.ai.bss.user.dto.UserDto;
|
|
29
|
import com.ai.bss.user.service.api.EmployeeService;
|
|
30
|
import com.ai.bss.user.service.api.UserDtoQuery;
|
|
31
|
|
|
32
|
@Service
|
|
33
|
public class EmployeeManagementServiceImpl implements EmployeeManagementService {
|
|
34
|
Logger logger = LoggerFactory.getLogger(EmployeeManagementServiceImpl.class);
|
|
35
|
|
|
36
|
@Autowired
|
|
37
|
private UserDtoQuery userDtoQuery;
|
|
38
|
|
|
39
|
@Autowired
|
|
40
|
private OrganizationQuery organizationQuery;
|
|
41
|
|
|
42
|
@Autowired
|
|
43
|
private EmployeeService employeeService;
|
|
44
|
|
|
45
|
@Autowired
|
|
46
|
private UploadFileService uploadFileService;
|
|
47
|
|
|
48
|
@Autowired
|
|
49
|
private MinioConfig minioConfig;
|
|
50
|
|
|
51
|
@Autowired
|
|
52
|
private CharSpecService charSpecService;
|
|
53
|
|
|
54
|
@Override
|
|
55
|
public CommonResponse<PageBean<Map<String, Object>>> queryEmployeeList(UserDto userDto, int pageNumber,
|
|
56
|
int pageSize) throws Exception {
|
|
57
|
CommonRequest<UserDto> request = new CommonRequest<UserDto>(userDto, pageNumber, pageSize);
|
|
58
|
CommonResponse<PageBean<Map<String, Object>>> response = userDtoQuery.queryWorkEmployee(request);
|
|
59
|
|
|
60
|
if (response == null || response.getData() == null || CollectionUtils.isEmpty(response.getData().getData())) {
|
|
61
|
return response;
|
|
62
|
}
|
|
63
|
|
|
64
|
Map<String, String> allPositionTypeMap = charSpecService
|
|
65
|
.getCharSpecMap(EbcConstant.BUSINESS_SPEC_EMPLOYEE_POSITION);
|
|
66
|
|
|
67
|
for (Map<String, Object> dataMap : response.getData().getData()) {
|
|
68
|
dataMap.put("employeePositionZh", allPositionTypeMap.get(String.valueOf(dataMap.get("mainJobPosition"))));
|
|
69
|
|
|
70
|
String status = String.valueOf(dataMap.get("field2"));
|
|
71
|
switch (status) {
|
|
72
|
case EbcConstant.AUDIT_STATUS_INI:
|
|
73
|
dataMap.put("status", "待审核");
|
|
74
|
break;
|
|
75
|
case EbcConstant.AUDIT_STATUS_ACC:
|
|
76
|
dataMap.put("status", "已生效");
|
|
77
|
break;
|
|
78
|
case EbcConstant.AUDIT_STATUS_DIS:
|
|
79
|
dataMap.put("status", "未通过");
|
|
80
|
break;
|
|
81
|
default:
|
|
82
|
dataMap.put("status", "待审核");
|
|
83
|
break;
|
|
84
|
}
|
|
85
|
}
|
|
86
|
|
|
87
|
return response;
|
|
88
|
}
|
|
89
|
|
|
90
|
@Override
|
|
91
|
public CommonResponse<Map<String, Object>> queryOneEmployee(Long employeeId) throws Exception {
|
|
92
|
EmployeeDto employeeDto = new EmployeeDto();
|
|
93
|
employeeDto.setId(employeeId);
|
|
94
|
CommonRequest<EmployeeDto> request = new CommonRequest<EmployeeDto>(employeeDto);
|
|
95
|
CommonResponse<EmployeeDto> response = employeeService.queryEmployee(request);
|
|
96
|
|
|
97
|
if (response == null || response.getData() == null) {
|
|
98
|
return CommonResponse.fail("504", "员工信息不存在");
|
|
99
|
}
|
|
100
|
|
|
101
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
|
102
|
resultMap.put("employeeId", response.getData().getId());
|
|
103
|
resultMap.put("employeeName", response.getData().getName());
|
|
104
|
resultMap.put("employeeCode", response.getData().getCode());
|
|
105
|
resultMap.put("organizationId", response.getData().getOrganizeId());
|
|
106
|
resultMap.put("organizationCode", response.getData().getOrganizeCode());
|
|
107
|
resultMap.put("organizationName", response.getData().getOrgName());
|
|
108
|
resultMap.put("age", response.getData().getAge());
|
|
109
|
resultMap.put("mainWirelessCall", response.getData().getMainWirelessCall());
|
|
110
|
resultMap.put("field1", response.getData().getField1()); // 头像标识
|
|
111
|
resultMap.put("field2", response.getData().getField2()); // 审核结果
|
|
112
|
resultMap.put("field3", response.getData().getField3()); // 审核意见
|
|
113
|
resultMap.put("field4", response.getData().getField4()); // 公司
|
|
114
|
|
|
115
|
resultMap.put("pictureUrl",
|
|
116
|
uploadFileService.getFileUrl(response.getData().getField1(), minioConfig.getBucketHeaderImage()));
|
|
117
|
|
|
118
|
String employeePosition = response.getData().getMainJobPosition();
|
|
119
|
resultMap.put("employeePosition", employeePosition);
|
|
120
|
|
|
121
|
List<CharacteristicSpecValue> allPositionTypeList = charSpecService
|
|
122
|
.getCharSpecList(EbcConstant.BUSINESS_SPEC_EMPLOYEE_POSITION);
|
|
123
|
allPositionTypeList.forEach(positionType -> {
|
|
124
|
if (positionType.getCode().equals(employeePosition)) {
|
|
125
|
resultMap.put("employeePositionZh", positionType.getValue());
|
|
126
|
}
|
|
127
|
});
|
|
128
|
|
|
129
|
return CommonResponse.ok(resultMap);
|
|
130
|
}
|
|
131
|
|
|
132
|
/**
|
|
133
|
* 是否存在用户编码
|
|
134
|
* @param code
|
|
135
|
* @param id
|
|
136
|
* @return
|
|
137
|
* @return true:存在,false:不存在
|
|
138
|
*/
|
|
139
|
private boolean isExistEmployeeCode(String code, String id) {
|
|
140
|
if (StringUtils.isBlank(code)) {
|
|
141
|
return false;
|
|
142
|
}
|
|
143
|
|
|
144
|
UserDto userDto = new UserDto();
|
|
145
|
userDto.setCode(code);
|
|
146
|
CommonRequest<UserDto> request = new CommonRequest<UserDto>(userDto);
|
|
147
|
CommonResponse<List<Map<String, Object>>> response = userDtoQuery.queryWorkEmployeeByUserCode(request);
|
|
148
|
|
|
149
|
boolean result = false;
|
|
150
|
if (!CollectionUtils.isEmpty(response.getData())) {
|
|
151
|
if (StringUtils.isNotBlank(id)) {
|
|
152
|
for (Map<String, Object> map : response.getData()) {
|
|
153
|
if (code.equals(String.valueOf(map.get("code"))) && !id.equals(String.valueOf(map.get("id")))) {
|
|
154
|
result = true;
|
|
155
|
break;
|
|
156
|
}
|
|
157
|
}
|
|
158
|
} else {
|
|
159
|
result = true;
|
|
160
|
}
|
|
161
|
}
|
|
162
|
|
|
163
|
return result;
|
|
164
|
}
|
|
165
|
|
|
166
|
@Override
|
|
167
|
public CommonResponse<Void> createEmployee(EmployeeDto employeeDto) throws Exception {
|
|
168
|
if (isExistEmployeeCode(employeeDto.getCode(), null)) {
|
|
169
|
return CommonResponse.fail("501", "编号已存在");
|
|
170
|
}
|
|
171
|
|
|
172
|
employeeDto.setField2(EbcConstant.AUDIT_STATUS_INI);
|
|
173
|
CommonRequest<EmployeeDto> request = new CommonRequest<EmployeeDto>(employeeDto);
|
|
174
|
return employeeService.createWorkEmployee(request);
|
|
175
|
}
|
|
176
|
|
|
177
|
@Override
|
|
178
|
public CommonResponse<Void> modifyEmployee(EmployeeDto employeeDto) {
|
|
179
|
if (isExistEmployeeCode(employeeDto.getCode(), String.valueOf(employeeDto.getId()))) {
|
|
180
|
return CommonResponse.fail("501", "编号已存在");
|
|
181
|
}
|
|
182
|
|
|
183
|
employeeDto.setField2(EbcConstant.AUDIT_STATUS_INI);
|
|
184
|
CommonRequest<EmployeeDto> request = CommonRequest.<EmployeeDto>builder().data(employeeDto).build();
|
|
185
|
return employeeService.modifyEmployee(request);
|
|
186
|
}
|
|
187
|
|
|
188
|
@Override
|
|
189
|
public CommonResponse<Void> deleteEmployee(String employeeId) {
|
|
190
|
boolean success = true;
|
|
191
|
|
|
192
|
String[] idsArray = employeeId.split(",");
|
|
193
|
EmployeeDto employeeDto = new EmployeeDto();
|
|
194
|
for (String id : idsArray) {
|
|
195
|
long lid = Long.parseLong(id);
|
|
196
|
employeeDto.setId(lid);
|
|
197
|
CommonRequest<EmployeeDto> request = CommonRequest.<EmployeeDto>builder().data(employeeDto).build();
|
|
198
|
CommonResponse<Void> response = employeeService.deleteWorkEmployee(request);
|
|
199
|
success = success && response.isSuccess();
|
|
200
|
}
|
|
201
|
|
|
202
|
if (success) {
|
|
203
|
return CommonResponse.ok(null);
|
|
204
|
} else {
|
|
205
|
return CommonResponse.fail("504", "删除失败");
|
|
206
|
}
|
|
207
|
}
|
|
208
|
|
|
209
|
@Override
|
|
210
|
public Map<String, String> uploadEmployeePicture(MultipartFile meFile, String pictureUrl) throws Exception {
|
|
211
|
/*if (StringUtils.isNotBlank(pictureUrl) && !"#".equals(pictureUrl)) {
|
|
212
|
//删除照片
|
|
213
|
uploadFileService.removeFile(pictureUrl, minioConfig.getBucketHeaderImage());
|
|
214
|
}*/
|
|
215
|
|
|
216
|
// 上传
|
|
217
|
String minioFileName = uploadFileService.uploadFile(meFile, minioConfig.getBucketHeaderImage());
|
|
218
|
|
|
219
|
// 获取照片的url地址
|
|
220
|
String headerPictureUrl = uploadFileService.getFileUrl(minioFileName, minioConfig.getBucketHeaderImage());
|
|
221
|
|
|
222
|
// 返回信息
|
|
223
|
Map<String, String> resultMap = new HashMap<String, String>();
|
|
224
|
resultMap.put("pictureUrl", minioFileName);
|
|
225
|
resultMap.put("headerPictureUrl", headerPictureUrl);
|
|
226
|
return resultMap;
|
|
227
|
}
|
|
228
|
|
|
229
|
@Override
|
|
230
|
public CommonResponse<Void> auditEmployeePicture(Long employeeId, String field2, String field3) throws Exception {
|
|
231
|
EmployeeDto employeeDto = new EmployeeDto();
|
|
232
|
employeeDto.setId(employeeId);
|
|
233
|
CommonResponse<EmployeeDto> response = employeeService
|
|
234
|
.queryEmployee(new CommonRequest<EmployeeDto>(employeeDto));
|
|
235
|
|
|
236
|
if (response == null || response.getData() == null) {
|
|
237
|
return CommonResponse.fail("504", "员工信息不存在");
|
|
238
|
}
|
|
239
|
|
|
240
|
employeeDto = response.getData();
|
|
241
|
if (EbcConstant.AUDIT_STATUS_ACC.equals(employeeDto.getField2())) {
|
|
242
|
if (StringUtils.isEmpty(employeeDto.getField1())) {
|
|
243
|
return CommonResponse.fail("505", "照片信息不存在");
|
|
244
|
}
|
|
245
|
|
|
246
|
CommonResponse<String> faceAiRegisterResponse = employeeService
|
|
247
|
.faceAiRegister(new CommonRequest<EmployeeDto>(employeeDto));
|
|
248
|
|
|
249
|
if (faceAiRegisterResponse == null || !faceAiRegisterResponse.isSuccess()) {
|
|
250
|
return CommonResponse.fail("501", "照片审核失败");
|
|
251
|
}
|
|
252
|
}
|
|
253
|
|
|
254
|
employeeDto.setField2(field2);
|
|
255
|
employeeDto.setField3(field3);
|
|
256
|
return employeeService.modifyEmployee(new CommonRequest<EmployeeDto>(employeeDto));
|
|
257
|
}
|
|
258
|
|
|
259
|
@Override
|
|
260
|
public List<CharacteristicSpecValue> queryJobPositionList() {
|
|
261
|
return charSpecService.getCharSpecList(EbcConstant.BUSINESS_SPEC_EMPLOYEE_POSITION);
|
|
262
|
}
|
|
263
|
|
|
264
|
@Override
|
|
265
|
public CommonResponse<List<Organization>> queryChildOrgById(Long orgId) {
|
|
266
|
CommonRequest<Long> organize = new CommonRequest<Long>(orgId);
|
|
267
|
return organizationQuery.querySubOrgByOrgId(organize);
|
|
268
|
}
|
|
269
|
|
|
270
|
@Override
|
|
271
|
public CommonResponse<List<Organization>> queryCycleChildOrg(Long orgId) {
|
|
272
|
CommonRequest<Long> request = new CommonRequest<Long>(orgId);
|
|
273
|
|
|
274
|
CommonResponse<Organization> orgParentResponse = organizationQuery.queryOrganizationById(request);
|
|
275
|
if (orgParentResponse == null || !orgParentResponse.isSuccess() || orgParentResponse.getData() == null) {
|
|
276
|
return CommonResponse.fail("504", "获取部门失败");
|
|
277
|
}
|
|
278
|
|
|
279
|
CommonResponse<List<Organization>> response = organizationQuery.queryAllSubOrgByOrgId(request);
|
|
280
|
if (response == null || CollectionUtils.isEmpty(response.getData())) {
|
|
281
|
return response;
|
|
282
|
}
|
|
283
|
|
|
284
|
String orgParentCode = orgParentResponse.getData().getCode();
|
|
285
|
response.getData().forEach(org -> {
|
|
286
|
if (orgParentCode.equals(org.getParentCode())) {
|
|
287
|
org.setParentCode("-1");
|
|
288
|
}
|
|
289
|
});
|
|
290
|
|
|
291
|
return response;
|
|
292
|
}
|
|
293
|
|
|
294
|
@Override
|
|
295
|
public List<Map<String, Object>> queryEmployeeListByOrgId(Long orgId, int pageNumber, int pageSize) {
|
|
296
|
CommonRequest<Long> request = new CommonRequest<Long>(orgId);
|
|
297
|
CommonResponse<Organization> orgResponse = organizationQuery.queryOrganizationById(request);
|
|
298
|
if (orgResponse == null || !orgResponse.isSuccess() || orgResponse.getData() == null) {
|
|
299
|
return new ArrayList<Map<String, Object>>();
|
|
300
|
}
|
|
301
|
|
|
302
|
Map<String, Object> requestMap = new HashMap<String, Object>();
|
|
303
|
requestMap.put("orgCode", orgResponse.getData().getCode());
|
|
304
|
CommonRequest<Map<String, Object>> conditionMapRequest = new CommonRequest<Map<String, Object>>(requestMap,
|
|
305
|
pageNumber, pageSize);
|
|
306
|
CommonResponse<PageBean<Map<String, Object>>> response = employeeService
|
|
307
|
.queryIndividualList(conditionMapRequest);
|
|
308
|
|
|
309
|
if (response == null || response.getData() == null || CollectionUtils.isEmpty(response.getData().getData())) {
|
|
310
|
return new ArrayList<Map<String, Object>>();
|
|
311
|
}
|
|
312
|
|
|
313
|
return response.getData().getData();
|
|
314
|
}
|
|
315
|
|
|
316
|
}
|
|
@ -2,6 +2,7 @@ package com.ai.bss.security.protection.service.impl;
|
2
|
2
|
|
3
|
3
|
import java.util.ArrayList;
|
4
|
4
|
import java.util.HashMap;
|
|
5
|
import java.util.Iterator;
|
5
|
6
|
import java.util.List;
|
6
|
7
|
import java.util.Map;
|
7
|
8
|
|
|
@ -11,6 +12,7 @@ import org.springframework.util.CollectionUtils;
|
11
|
12
|
|
12
|
13
|
import com.ai.abc.api.model.CommonRequest;
|
13
|
14
|
import com.ai.abc.api.model.CommonResponse;
|
|
15
|
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
|
14
|
16
|
import com.ai.bss.security.protection.service.interfaces.CharSpecService;
|
15
|
17
|
import com.ai.bss.security.protection.service.interfaces.HomePageService;
|
16
|
18
|
import com.ai.bss.security.protection.utils.EbcConstant;
|
|
@ -69,33 +71,68 @@ public class HomePageServiceImpl implements HomePageService {
|
69
|
71
|
CommonRequest<Map<String, String>> request = new CommonRequest<Map<String, String>>(params);
|
70
|
72
|
CommonResponse<List<Map<String, Object>>> response = aiTaskQuery.safetyAlarmAnalysis(request);
|
71
|
73
|
|
|
74
|
List<Map<String, Object>> dataList=null;
|
72
|
75
|
if (CollectionUtils.isEmpty(response.getData())) {
|
73
|
|
return CommonResponse.ok(new ArrayList<Map<String, Object>>());
|
|
76
|
dataList=new ArrayList<Map<String, Object>>();
|
|
77
|
}else {
|
|
78
|
dataList=response.getData();
|
74
|
79
|
}
|
75
|
80
|
|
76
|
|
Map<String, String> allAiAlarmTypeMap = charSpecService.getCharSpecMap(EbcConstant.BUSINESS_SPEC_AI_ALARM_TYPE);
|
|
81
|
// Map<String, String> allAiAlarmTypeMap = charSpecService.getCharSpecMap(EbcConstant.BUSINESS_SPEC_AI_ALARM_TYPE);
|
|
82
|
List<CharacteristicSpecValue> allAiAlarmTypeList = charSpecService
|
|
83
|
.getCharSpecList(EbcConstant.BUSINESS_SPEC_AI_ALARM_TYPE);
|
77
|
84
|
|
78
|
85
|
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
|
79
|
86
|
int otherNum = 0;
|
80
|
|
for (int i = 0; i < response.getData().size(); i++) {
|
81
|
|
int num = Integer.valueOf(response.getData().get(i).get("cn").toString());
|
|
87
|
for (int i = 0; i < dataList.size(); i++) {
|
|
88
|
int num = Integer.valueOf(dataList.get(i).get("cn").toString());
|
82
|
89
|
if (i >= dataSize) {
|
83
|
90
|
// 其他
|
84
|
91
|
otherNum += num;
|
85
|
92
|
continue;
|
86
|
93
|
}
|
87
|
94
|
|
88
|
|
Map<String, Object> dataMap = new HashMap<String, Object>();
|
89
|
|
dataMap.put("value", num);
|
90
|
|
dataMap.put("name", allAiAlarmTypeMap.get(response.getData().get(i).get("alarmTypeCode").toString()));
|
91
|
|
resultList.add(dataMap);
|
|
95
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
96
|
map.put("value", num);
|
|
97
|
|
|
98
|
// dataMap.put("name", allAiAlarmTypeMap.get(dataList.get(i).get("alarmTypeCode").toString()));
|
|
99
|
for (Iterator iterator = allAiAlarmTypeList.iterator(); iterator.hasNext();) {
|
|
100
|
CharacteristicSpecValue aiAlarmType = (CharacteristicSpecValue) iterator.next();
|
|
101
|
if (aiAlarmType.getCode().equals(dataList.get(i).get("alarmTypeCode").toString())) {
|
|
102
|
map.put("name", aiAlarmType.getValue());
|
|
103
|
iterator.remove();
|
|
104
|
break;
|
|
105
|
}
|
|
106
|
}
|
|
107
|
|
|
108
|
resultList.add(map);
|
92
|
109
|
}
|
93
|
110
|
|
94
|
|
if (otherNum > 0) {
|
|
111
|
/*if (otherNum > 0) {
|
95
|
112
|
Map<String, Object> dataMap = new HashMap<String, Object>();
|
96
|
113
|
dataMap.put("value", otherNum);
|
97
|
114
|
dataMap.put("name", "其他");
|
98
|
115
|
resultList.add(dataMap);
|
|
116
|
}*/
|
|
117
|
if (dataList.size() < dataSize) {
|
|
118
|
// 有数据的条数小于需显示的条数(填充的项目=0)
|
|
119
|
for (int i = 0; i < allAiAlarmTypeList.size(); i++) {
|
|
120
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
121
|
map.put("value", 0);
|
|
122
|
map.put("name", allAiAlarmTypeList.get(i).getValue());
|
|
123
|
resultList.add(map);
|
|
124
|
|
|
125
|
if (resultList.size() >= dataSize) {
|
|
126
|
break;
|
|
127
|
}
|
|
128
|
}
|
|
129
|
|
|
130
|
} else if (dataList.size() > dataSize){
|
|
131
|
// 有数据的条数大于需显示的条数(其他>0)
|
|
132
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
133
|
map.put("value", otherNum);
|
|
134
|
map.put("name", "其他");
|
|
135
|
resultList.add(map);
|
99
|
136
|
}
|
100
|
137
|
|
101
|
138
|
return CommonResponse.ok(resultList);
|
|
@ -0,0 +1,115 @@
|
|
1
|
package com.ai.bss.security.protection.service.impl;
|
|
2
|
|
|
3
|
|
|
4
|
import com.ai.bss.security.protection.model.User;
|
|
5
|
import com.ai.bss.security.protection.service.interfaces.LoginService;
|
|
6
|
import com.ai.bss.security.protection.utils.HttpServiceUtil;
|
|
7
|
import com.alibaba.fastjson.JSON;
|
|
8
|
import org.slf4j.Logger;
|
|
9
|
import org.slf4j.LoggerFactory;
|
|
10
|
import org.springframework.beans.factory.annotation.Value;
|
|
11
|
import org.springframework.stereotype.Service;
|
|
12
|
|
|
13
|
import javax.servlet.http.Cookie;
|
|
14
|
import javax.servlet.http.HttpServletRequest;
|
|
15
|
import java.nio.charset.Charset;
|
|
16
|
import java.util.HashMap;
|
|
17
|
import java.util.List;
|
|
18
|
import java.util.Map;
|
|
19
|
|
|
20
|
/**
|
|
21
|
* @Auther: 王超
|
|
22
|
* @Date: 2020/12/24 15:13
|
|
23
|
* @Description:
|
|
24
|
*/
|
|
25
|
|
|
26
|
@Service
|
|
27
|
public class LoginServiceImpl implements LoginService {
|
|
28
|
|
|
29
|
Logger logger = LoggerFactory.getLogger(LoginServiceImpl.class);
|
|
30
|
|
|
31
|
@Value("${uspa.login.vercode}")
|
|
32
|
private String verCode;
|
|
33
|
|
|
34
|
@Value("${uspa.login.url}")
|
|
35
|
private String url;
|
|
36
|
|
|
37
|
@Value("${uspa.login.menuUrl}")
|
|
38
|
private String menuUrl;
|
|
39
|
|
|
40
|
@Override
|
|
41
|
public Map<String, Object> login(User user) {
|
|
42
|
Map resultMap=null;
|
|
43
|
|
|
44
|
try {
|
|
45
|
HashMap<String, Object> paramsMap = new HashMap<>();
|
|
46
|
paramsMap.put("userCode",user.getUserCode());
|
|
47
|
paramsMap.put("passWord",user.getPassWord());
|
|
48
|
paramsMap.put("vercode",verCode);
|
|
49
|
|
|
50
|
// (1)设置字符集
|
|
51
|
Charset charset = Charset.forName("utf-8");
|
|
52
|
|
|
53
|
String result = HttpServiceUtil.sendPost(url, paramsMap, charset);
|
|
54
|
|
|
55
|
resultMap = JSON.parseObject(result, Map.class);
|
|
56
|
|
|
57
|
} catch (Exception e) {
|
|
58
|
logger.error("调用uspa登录接口失败: " + e.getMessage());
|
|
59
|
return resultMap;
|
|
60
|
}
|
|
61
|
|
|
62
|
|
|
63
|
return resultMap;
|
|
64
|
}
|
|
65
|
|
|
66
|
@Override
|
|
67
|
public Map<String, Object> findMenus(User user, HttpServletRequest request) {
|
|
68
|
Map resultMap=null;
|
|
69
|
|
|
70
|
try {
|
|
71
|
HashMap<String, Object> paramsMap = new HashMap<>();
|
|
72
|
paramsMap.put("root_module","0000");
|
|
73
|
paramsMap.put("userCode",user.getUserCode());
|
|
74
|
|
|
75
|
Map<String, String> headerMap=new HashMap<>();
|
|
76
|
// 取得cookie
|
|
77
|
Cookie[] cookies = request.getCookies();
|
|
78
|
if (cookies != null) {
|
|
79
|
for (Cookie cookie : cookies) {
|
|
80
|
if (cookie.getName().equals("session_id")) {
|
|
81
|
headerMap.put("session_id", cookie.getValue());
|
|
82
|
}
|
|
83
|
if (cookie.getName().equals("sign")) {
|
|
84
|
headerMap.put("sign", cookie.getValue());
|
|
85
|
}
|
|
86
|
if (cookie.getName().equals("sign_key")) {
|
|
87
|
headerMap.put("sign_key", cookie.getValue());
|
|
88
|
}
|
|
89
|
}
|
|
90
|
}
|
|
91
|
Map<String, String> headerMap1=new HashMap<>();
|
|
92
|
//将设置拼接cookie
|
|
93
|
headerMap1.put("Cookie","session_id="+headerMap.get("session_id")+";"+"sign="+headerMap.get("sign")+";"+"sign_key="+headerMap.get("sign_key"));
|
|
94
|
// (1)设置字符集
|
|
95
|
Charset charset = Charset.forName("utf-8");
|
|
96
|
|
|
97
|
String result = HttpServiceUtil.sendPost(menuUrl, paramsMap, charset,headerMap1 );
|
|
98
|
//将返回结果转为map
|
|
99
|
resultMap = JSON.parseObject(result, Map.class);
|
|
100
|
|
|
101
|
String result1 = (String)resultMap.get("RESULT");
|
|
102
|
if(null!=result1&&!"".equals(result1)){
|
|
103
|
//如果result有值返回正确,将返回结果转为List
|
|
104
|
List<Map<String,List<Map>>> list = JSON.parseObject(result1, List.class);
|
|
105
|
resultMap.put("RESULT",list);
|
|
106
|
}
|
|
107
|
} catch (Exception e) {
|
|
108
|
logger.error("调用uspa获取菜单接口失败: " + e.getMessage());
|
|
109
|
|
|
110
|
return resultMap;
|
|
111
|
}
|
|
112
|
return resultMap;
|
|
113
|
}
|
|
114
|
|
|
115
|
}
|
|
@ -7,6 +7,7 @@ import com.ai.bss.components.common.model.PageBean;
|
7
|
7
|
import com.ai.bss.components.common.util.JsonUtils;
|
8
|
8
|
import com.ai.bss.security.protection.service.interfaces.MonitorSceneTerminalService;
|
9
|
9
|
import com.ai.bss.work.safety.model.MonitorSceneTerminalRel;
|
|
10
|
import com.ai.bss.work.safety.service.api.AiTaskQuery;
|
10
|
11
|
import com.ai.bss.work.safety.service.api.MonitorSceneCommand;
|
11
|
12
|
import com.ai.bss.work.safety.service.api.MonitorSceneQuery;
|
12
|
13
|
import lombok.extern.slf4j.Slf4j;
|
|
@ -14,6 +15,8 @@ import org.apache.commons.lang.StringUtils;
|
14
|
15
|
import org.springframework.beans.factory.annotation.Autowired;
|
15
|
16
|
import org.springframework.stereotype.Service;
|
16
|
17
|
|
|
18
|
import java.util.ArrayList;
|
|
19
|
import java.util.HashMap;
|
17
|
20
|
import java.util.List;
|
18
|
21
|
import java.util.Map;
|
19
|
22
|
|
|
@ -26,6 +29,9 @@ public class MonitorSceneTerminalServiceImpl implements MonitorSceneTerminalServ
|
26
|
29
|
@Autowired
|
27
|
30
|
private MonitorSceneQuery monitorSceneQuery;
|
28
|
31
|
|
|
32
|
|
|
33
|
@Autowired
|
|
34
|
private AiTaskQuery aiTaskQuery;
|
29
|
35
|
@Override
|
30
|
36
|
public CommonResponse<MonitorSceneTerminalRel> createMonitorSceneTerminalRel(MonitorSceneTerminalRel monitorSceneTerminalRel) {
|
31
|
37
|
if(monitorSceneTerminalRel.getMonitorSceneId()==null){
|
|
@ -94,10 +100,31 @@ public class MonitorSceneTerminalServiceImpl implements MonitorSceneTerminalServ
|
94
|
100
|
String monitorSceneId = paramMap.get("monitorSceneId");
|
95
|
101
|
Integer pageNumber = paramMap.get("pageNumber")==null?1:Integer.parseInt(paramMap.get("pageNumber"));
|
96
|
102
|
Integer pageSize = paramMap.get("pageSize")==null?10:Integer.parseInt(paramMap.get("pageSize"));
|
97
|
|
CommonRequest<Long> request = CommonRequest.<Long>builder().data(3L).build();
|
|
103
|
CommonRequest<Long> request = CommonRequest.<Long>builder().data(Long.parseLong(monitorSceneId)).build();
|
98
|
104
|
request.setPageNumber(pageNumber);
|
99
|
105
|
request.setPageSize(pageSize);
|
100
|
106
|
CommonResponse<PageBean<Map<String, Object>>> result = monitorSceneQuery.selectSceneTerminalRelByPage(request);
|
|
107
|
List<Map<String, Object>> sceneTerminalRelList = result.getData().getData();
|
|
108
|
if(sceneTerminalRelList!=null&&sceneTerminalRelList.size()>0){
|
|
109
|
sceneTerminalRelList.forEach((sceneTerminalRel)->{
|
|
110
|
String resourceToolId = (String) sceneTerminalRel.get("resourceToolId");
|
|
111
|
if(resourceToolId!=null){
|
|
112
|
HashMap<String, Object> conditionMap = new HashMap<>();
|
|
113
|
conditionMap.put("resourceToolId", resourceToolId);
|
|
114
|
CommonResponse<List<Map<String,Object>>> aiTaskCommonResponse = aiTaskQuery.selectAiTaskDevice(CommonRequest.<Map<String,Object>>builder().data(conditionMap).build());
|
|
115
|
List<Map<String, Object>> aiTaskDeviceList = aiTaskCommonResponse.getData();
|
|
116
|
ArrayList<String> aiTaskNameList = new ArrayList<>();
|
|
117
|
aiTaskDeviceList.forEach((aiTaskDevice)->{
|
|
118
|
if(null!=aiTaskDevice.get("aiTaskName")){
|
|
119
|
aiTaskNameList.add((String) aiTaskDevice.get("aiTaskName"));
|
|
120
|
}
|
|
121
|
});
|
|
122
|
sceneTerminalRel.put("aiTaskNameList",aiTaskNameList);
|
|
123
|
sceneTerminalRel.put("aiTaskDeviceList",aiTaskDeviceList);
|
|
124
|
}
|
|
125
|
});
|
|
126
|
|
|
127
|
}
|
101
|
128
|
|
102
|
129
|
return result;
|
103
|
130
|
|
|
@ -1,11 +1,17 @@
|
1
|
1
|
package com.ai.bss.security.protection.service.impl;
|
2
|
2
|
|
|
3
|
import java.io.ByteArrayInputStream;
|
|
4
|
import java.io.InputStream;
|
3
|
5
|
import java.util.ArrayList;
|
4
|
6
|
import java.util.Date;
|
5
|
7
|
import java.util.HashMap;
|
6
|
8
|
import java.util.List;
|
7
|
9
|
import java.util.Map;
|
8
|
10
|
|
|
11
|
import cn.hutool.core.lang.UUID;
|
|
12
|
import com.ai.bss.components.minio.service.MinioService;
|
|
13
|
import com.ai.bss.security.protection.model.SecurityProtectionMinioConfig;
|
|
14
|
import com.ai.bss.security.protection.service.interfaces.UploadFileService;
|
9
|
15
|
import org.apache.commons.lang.StringUtils;
|
10
|
16
|
import org.springframework.beans.factory.annotation.Autowired;
|
11
|
17
|
import org.springframework.stereotype.Service;
|
|
@ -25,11 +31,19 @@ import com.ai.bss.work.safety.service.api.MonitorSceneQuery;
|
25
|
31
|
@Service
|
26
|
32
|
public class MonitorVideoLogManageServiceImpl implements MonitorVideoLogManageService {
|
27
|
33
|
|
|
34
|
public String SPLIT_CHAR = "_";
|
28
|
35
|
@Autowired
|
29
|
36
|
private MonitorSceneQuery monitorSceneQuery;
|
30
|
37
|
|
31
|
38
|
@Autowired
|
32
|
39
|
private MonitorSceneCommand monitorSceneCommand;
|
|
40
|
@Autowired
|
|
41
|
private MinioService minioService;
|
|
42
|
@Autowired
|
|
43
|
private UploadFileService uploadFileService;
|
|
44
|
|
|
45
|
@Autowired
|
|
46
|
private SecurityProtectionMinioConfig minioConfig;
|
33
|
47
|
|
34
|
48
|
@Override
|
35
|
49
|
public CommonResponse<List<EbcMonitorVideoLog>> queryMonitorVideoLogByTime(MonitorVideoLog monitorVideoLogCondition)
|
|
@ -51,6 +65,44 @@ public class MonitorVideoLogManageServiceImpl implements MonitorVideoLogManageSe
|
51
|
65
|
}
|
52
|
66
|
|
53
|
67
|
@Override
|
|
68
|
public CommonResponse<String> queryMonitorVideoLogByTimeForM3u8(MonitorVideoLog monitorVideoLogCondition)
|
|
69
|
throws Exception {
|
|
70
|
CommonRequest<MonitorVideoLog> request = new CommonRequest<MonitorVideoLog>(monitorVideoLogCondition);
|
|
71
|
CommonResponse<List<MonitorVideoLog>> response = monitorSceneQuery.queryMonitorVideoLogByTime(request);
|
|
72
|
|
|
73
|
List<EbcMonitorVideoLog> list = new ArrayList<EbcMonitorVideoLog>();
|
|
74
|
if (response == null || CollectionUtils.isEmpty(response.getData())) {
|
|
75
|
return CommonResponse.ok(null);
|
|
76
|
}
|
|
77
|
|
|
78
|
StringBuffer m3u8Str = new StringBuffer();
|
|
79
|
m3u8Str.append("#EXTM3U").append("\n");
|
|
80
|
m3u8Str.append("#EXT-X-VERSION:3").append("\n");
|
|
81
|
m3u8Str.append("#EXT-X-TARGETDURATION:65").append("\n");
|
|
82
|
m3u8Str.append("#EXT-X-MEDIA-SEQUENCE:0").append("\n");
|
|
83
|
String bucketName = minioConfig.getBucketM3U8();// "m3u8-index";
|
|
84
|
String fileType = ".m3u8";
|
|
85
|
String m3u8FileName = bucketName + SPLIT_CHAR + UUID.fastUUID().toString().replace("-", "") + fileType;
|
|
86
|
|
|
87
|
String videoUrl = "";
|
|
88
|
for (MonitorVideoLog monitorVideoLog : response.getData()) {
|
|
89
|
EbcMonitorVideoLog ebcMonitorVideoLog = getEbcMonitorVideoLog(monitorVideoLog);
|
|
90
|
list.add(ebcMonitorVideoLog);
|
|
91
|
videoUrl = uploadFileService.getFileUrl(monitorVideoLog.getVideoUrl());// minioService.getObjectUrl(videoFileIdArr[0],ebcMonitorVideoLog.getVideoFileUrl());
|
|
92
|
|
|
93
|
m3u8Str.append("#EXTINF:65,").append("\n");
|
|
94
|
m3u8Str.append(videoUrl).append("\n");
|
|
95
|
}
|
|
96
|
m3u8Str.append("#EXT-X-ENDLIST").append("\n");
|
|
97
|
InputStream is = new ByteArrayInputStream(m3u8Str.toString().getBytes());
|
|
98
|
minioService.putObject(bucketName, m3u8FileName, is, fileType);
|
|
99
|
|
|
100
|
String m3u8IndexFileUrl = uploadFileService.getFileUrl(m3u8FileName);
|
|
101
|
|
|
102
|
return CommonResponse.ok(m3u8IndexFileUrl);
|
|
103
|
}
|
|
104
|
|
|
105
|
@Override
|
54
|
106
|
public CommonResponse<EbcMonitorVideoLog> queryMonitorVideoLogById(Long monitorVideoLogId) throws Exception {
|
55
|
107
|
CommonRequest<Long> request = new CommonRequest<Long>(monitorVideoLogId);
|
56
|
108
|
CommonResponse<MonitorVideoLog> response = monitorSceneQuery.loadMonitorVideoLog(request);
|
|
@ -105,10 +157,9 @@ public class MonitorVideoLogManageServiceImpl implements MonitorVideoLogManageSe
|
105
|
157
|
String fileType = videoUrl.substring(videoUrl.lastIndexOf(".") + 1);
|
106
|
158
|
|
107
|
159
|
String newFileName = videoUrl.substring(videoUrl.lastIndexOf("_") + 1);
|
108
|
|
int videoPrefixIndex = newFileName.lastIndexOf(EbcConstant.AI_MONITOR_FILE_PREFIX_VIDEO);
|
109
|
|
String fileNameData = newFileName.substring(
|
110
|
|
videoPrefixIndex + EbcConstant.AI_MONITOR_FILE_PREFIX_VIDEO.length(),
|
111
|
|
videoPrefixIndex + EbcConstant.AI_MONITOR_FILE_PREFIX_VIDEO.length() + 14);
|
|
160
|
int videoPrefixIndex = newFileName.lastIndexOf(EbcConstant.AI_MONITOR_FILE_PREFIX_VIDEO)
|
|
161
|
+ EbcConstant.AI_MONITOR_FILE_PREFIX_VIDEO.length();
|
|
162
|
String fileNameData = newFileName.substring(videoPrefixIndex, videoPrefixIndex + 14);
|
112
|
163
|
Date fileDateTime = DateUtil.convertDate(fileNameData, DateUtil.PURE_DATETIME_PATTERN);
|
113
|
164
|
String newFileNameData = DateUtil.formatDate(fileDateTime, "MM月dd日 HH:mm");
|
114
|
165
|
String fileDateTimeStr = DateUtil.formatDate(fileDateTime);
|
|
@ -16,10 +16,12 @@ import com.ai.abc.api.model.CommonResponse;
|
16
|
16
|
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
|
17
|
17
|
import com.ai.bss.components.common.model.PageBean;
|
18
|
18
|
import com.ai.bss.security.protection.model.SecurityProtectionMinioConfig;
|
|
19
|
import com.ai.bss.security.protection.service.interfaces.AiAlarmManageService;
|
19
|
20
|
import com.ai.bss.security.protection.service.interfaces.CharSpecService;
|
20
|
21
|
import com.ai.bss.security.protection.service.interfaces.ResourceToolManageService;
|
21
|
22
|
import com.ai.bss.security.protection.service.interfaces.UploadFileService;
|
22
|
23
|
import com.ai.bss.security.protection.utils.EbcConstant;
|
|
24
|
import com.ai.bss.work.safety.service.api.AiTaskQuery;
|
23
|
25
|
import com.ai.bss.work.tool.model.ResourceTool;
|
24
|
26
|
import com.ai.bss.work.tool.service.api.ResourceToolCommand;
|
25
|
27
|
import com.ai.bss.work.tool.service.api.ResourceToolQuery;
|
|
@ -41,6 +43,9 @@ public class ResourceToolManageServiceImpl implements ResourceToolManageService
|
41
|
43
|
|
42
|
44
|
@Autowired
|
43
|
45
|
private CharSpecService charSpecService;
|
|
46
|
|
|
47
|
@Autowired
|
|
48
|
private AiTaskQuery aiTaskQuery;
|
44
|
49
|
|
45
|
50
|
@Override
|
46
|
51
|
public CommonResponse<PageBean<Map<String, Object>>> queryPageResourceTool(HashMap<String, Object> params,
|
|
@ -209,4 +214,12 @@ public class ResourceToolManageServiceImpl implements ResourceToolManageService
|
209
|
214
|
return resultMap;
|
210
|
215
|
}
|
211
|
216
|
|
|
217
|
@Override
|
|
218
|
public CommonResponse<List<Map<String, Object>>> getResourceToolAllInfo(String resourceToolCode) {
|
|
219
|
Map<String, Object> conditionMap = new HashMap<String, Object>();
|
|
220
|
conditionMap.put("resourceToolCode", resourceToolCode);
|
|
221
|
CommonRequest<Map<String, Object>> request=new CommonRequest<Map<String, Object>>(conditionMap);
|
|
222
|
return aiTaskQuery.selectAiTaskDevice(request);
|
|
223
|
}
|
|
224
|
|
212
|
225
|
}
|
|
@ -5,6 +5,7 @@ import com.ai.abc.api.model.CommonResponse;
|
5
|
5
|
import com.ai.bss.components.common.model.PageBean;
|
6
|
6
|
import com.ai.bss.security.protection.model.AiQuery;
|
7
|
7
|
import com.ai.bss.security.protection.service.interfaces.SysConfigAiTaskService;
|
|
8
|
import com.ai.bss.work.safety.model.AiModel;
|
8
|
9
|
import com.ai.bss.work.safety.model.AiTask;
|
9
|
10
|
import com.ai.bss.work.safety.service.api.AiTaskCommand;
|
10
|
11
|
import com.ai.bss.work.safety.service.api.AiTaskQuery;
|
|
@ -35,7 +36,19 @@ public class SysConfigAiTaskServiceImpl implements SysConfigAiTaskService {
|
35
|
36
|
|
36
|
37
|
@Override
|
37
|
38
|
public CommonResponse<PageBean<Map<String, Object>>> queryPageAiTask(Map<String, Object> params, int pageNumber, int pageSize) {
|
|
39
|
CommonResponse<List<AiModel>> aiModelList = aiTaskQuery.findAiModelList(new CommonRequest<Void>(null));
|
|
40
|
|
38
|
41
|
CommonResponse<PageBean<Map<String, Object>>> queryResult = aiTaskQuery.queryAiTask(new CommonRequest<>(params, pageNumber, pageSize));
|
|
42
|
List<Map<String, Object>> aiTaskList = queryResult.getData().getData();
|
|
43
|
if(null!=aiTaskList&&aiTaskList.size()>0){
|
|
44
|
aiTaskList.forEach((aiTask)->{
|
|
45
|
aiModelList.getData().forEach((aiModel)->{
|
|
46
|
if(null!=aiTask.get("aiIdenModel")&& aiTask.get("aiIdenModel").equals(aiModel.getAiIdenModel() )){
|
|
47
|
aiTask.put("aiIdenModel", aiModel.getName());
|
|
48
|
}
|
|
49
|
});
|
|
50
|
});
|
|
51
|
}
|
39
|
52
|
return queryResult;
|
40
|
53
|
}
|
41
|
54
|
|
|
@ -67,5 +80,10 @@ public class SysConfigAiTaskServiceImpl implements SysConfigAiTaskService {
|
67
|
80
|
CommonResponse<AiTask> runningResult = aiTaskCommand.modifyAiTask(aiTaskRequest);
|
68
|
81
|
return runningResult;
|
69
|
82
|
}
|
|
83
|
|
|
84
|
@Override
|
|
85
|
public CommonResponse<List<AiModel>> queryAiTaskModelList() {
|
|
86
|
return aiTaskQuery.findAiModelList(new CommonRequest<Void>(null));
|
|
87
|
}
|
70
|
88
|
|
71
|
89
|
}
|
|
@ -60,7 +60,7 @@ public class UploadFileServiceImpl implements UploadFileService {
|
60
|
60
|
|
61
|
61
|
@Override
|
62
|
62
|
public String getFileUrl(String minioFileName) throws Exception {
|
63
|
|
if (StringUtils.isEmpty(minioFileName)) {
|
|
63
|
if (StringUtils.isEmpty(minioFileName) || "null".equals(minioFileName)) {
|
64
|
64
|
log.debug("获取文件的url为空");
|
65
|
65
|
return "";
|
66
|
66
|
}
|
|
@ -180,26 +180,23 @@ public class UploadFileServiceImpl implements UploadFileService {
|
180
|
180
|
resultMap.put("fileType", fileType);
|
181
|
181
|
|
182
|
182
|
if (newFileName.lastIndexOf(EbcConstant.AI_MONITOR_FILE_PREFIX_VIDEO) > 0) {
|
183
|
|
int videoPrefixIndex = newFileName.lastIndexOf(EbcConstant.AI_MONITOR_FILE_PREFIX_VIDEO);
|
|
183
|
int videoPrefixIndex = newFileName.lastIndexOf(EbcConstant.AI_MONITOR_FILE_PREFIX_VIDEO)
|
|
184
|
+ EbcConstant.AI_MONITOR_FILE_PREFIX_VIDEO.length();
|
184
|
185
|
|
185
|
|
String fileNameData = newFileName.substring(
|
186
|
|
videoPrefixIndex + EbcConstant.AI_MONITOR_FILE_PREFIX_VIDEO.length(),
|
187
|
|
videoPrefixIndex + EbcConstant.AI_MONITOR_FILE_PREFIX_VIDEO.length() + 14);
|
|
186
|
String fileNameData = newFileName.substring(videoPrefixIndex, videoPrefixIndex + 14);
|
188
|
187
|
Date fileDataTime = DateUtil.convertDate(fileNameData, DateUtil.PURE_DATETIME_PATTERN);
|
189
|
188
|
String newFileNameData = DateUtil.formatDate(fileDataTime, "MM月dd日 HH:mm");
|
190
|
189
|
resultMap.put("fileName", newFileNameData);
|
191
|
190
|
resultMap.put("fileDateTimeStr", DateUtil.formatDate(fileDataTime));
|
192
|
191
|
|
193
|
192
|
} else if (newFileName.lastIndexOf(EbcConstant.AI_MONITOR_FILE_PREFIX_PICTURE) > 0) {
|
194
|
|
int picturePrefixIndex = newFileName.lastIndexOf(EbcConstant.AI_MONITOR_FILE_PREFIX_PICTURE);
|
|
193
|
int picturePrefixIndex = newFileName.lastIndexOf(EbcConstant.AI_MONITOR_FILE_PREFIX_PICTURE)
|
|
194
|
+ EbcConstant.AI_MONITOR_FILE_PREFIX_PICTURE.length();
|
195
|
195
|
|
196
|
|
String fileNameData = newFileName.substring(
|
197
|
|
picturePrefixIndex + EbcConstant.AI_MONITOR_FILE_PREFIX_PICTURE.length(),
|
198
|
|
picturePrefixIndex + EbcConstant.AI_MONITOR_FILE_PREFIX_PICTURE.length() + 14);
|
|
196
|
String fileNameData = newFileName.substring(picturePrefixIndex, picturePrefixIndex + 14);
|
199
|
197
|
Date fileDataTime = DateUtil.convertDate(fileNameData, DateUtil.PURE_DATETIME_PATTERN);
|
200
|
198
|
String newFileNameData = DateUtil.formatDate(fileDataTime, "MM月dd日 HH:mm:ss");
|
201
|
|
String pictureSerialNum = newFileName.substring(
|
202
|
|
picturePrefixIndex + EbcConstant.AI_MONITOR_FILE_PREFIX_PICTURE.length() + 14, fileNameIndex);
|
|
199
|
String pictureSerialNum = newFileName.substring(picturePrefixIndex + 14, fileNameIndex);
|
203
|
200
|
resultMap.put("fileName", newFileNameData + " " + pictureSerialNum);
|
204
|
201
|
resultMap.put("fileDateTimeStr", DateUtil.formatDate(fileDataTime));
|
205
|
202
|
|
|
@ -7,16 +7,7 @@ import java.util.HashMap;
|
7
|
7
|
import java.util.List;
|
8
|
8
|
import java.util.Map;
|
9
|
9
|
|
10
|
|
import com.ai.bss.components.common.util.JsonUtils;
|
11
|
|
import com.ai.bss.user.dto.UserDto;
|
12
|
|
import com.ai.bss.work.attendance.dto.LeaveApprovalDto;
|
13
|
|
import com.ai.bss.work.attendance.model.AttendanceTask;
|
14
|
|
import com.ai.bss.work.attendance.service.api.ApprovalImportCommand;
|
15
|
|
import com.alibaba.fastjson.TypeReference;
|
16
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
17
|
|
import com.google.common.collect.Lists;
|
18
|
10
|
import org.apache.logging.log4j.util.Strings;
|
19
|
|
import org.junit.Assert;
|
20
|
11
|
import org.springframework.beans.factory.annotation.Autowired;
|
21
|
12
|
import org.springframework.stereotype.Service;
|
22
|
13
|
import org.springframework.util.CollectionUtils;
|
|
@ -24,15 +15,20 @@ import org.springframework.web.multipart.MultipartFile;
|
24
|
15
|
|
25
|
16
|
import com.ai.abc.api.model.CommonRequest;
|
26
|
17
|
import com.ai.abc.api.model.CommonResponse;
|
|
18
|
import com.ai.abc.exception.BaseException;
|
27
|
19
|
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
|
28
|
20
|
import com.ai.bss.components.common.model.PageBean;
|
|
21
|
import com.ai.bss.components.common.util.JsonUtils;
|
29
|
22
|
import com.ai.bss.security.protection.service.interfaces.CharSpecService;
|
30
|
23
|
import com.ai.bss.security.protection.service.interfaces.WorkOrderManagementService;
|
31
|
24
|
import com.ai.bss.security.protection.utils.EbcConstant;
|
32
|
25
|
import com.ai.bss.security.protection.utils.ExcelException;
|
33
|
26
|
import com.ai.bss.security.protection.utils.ExcelUtil;
|
|
27
|
import com.ai.bss.user.dto.UserDto;
|
34
|
28
|
import com.ai.bss.user.service.api.UserDtoQuery;
|
|
29
|
import com.ai.bss.work.attendance.dto.LeaveApprovalDto;
|
35
|
30
|
import com.ai.bss.work.attendance.model.AttendanceTaskSpec;
|
|
31
|
import com.ai.bss.work.attendance.service.api.ApprovalImportCommand;
|
36
|
32
|
import com.ai.bss.work.attendance.service.api.ApprovalTaskQuery;
|
37
|
33
|
import com.ai.bss.work.service.api.EventHandleCommand;
|
38
|
34
|
import com.ai.bss.work.service.api.WorkOrderCommand;
|
|
@ -41,6 +37,8 @@ import com.ai.bss.work.task.model.common.WorkOrder;
|
41
|
37
|
import com.ai.bss.work.task.model.common.WorkTask;
|
42
|
38
|
import com.alibaba.fastjson.JSON;
|
43
|
39
|
import com.alibaba.fastjson.JSONObject;
|
|
40
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
41
|
import com.google.common.collect.Lists;
|
44
|
42
|
|
45
|
43
|
import lombok.extern.slf4j.Slf4j;
|
46
|
44
|
|
|
@ -217,7 +215,7 @@ public class WorkOrderManagementServiceImpl implements WorkOrderManagementServic
|
217
|
215
|
|
218
|
216
|
workEvent.setCharValueSet(JSON.toJSONString(params));
|
219
|
217
|
|
220
|
|
log.debug("申请工单: "+JSON.toJSONString(workEvent));
|
|
218
|
log.debug("申请工单: " + JSON.toJSONString(workEvent));
|
221
|
219
|
|
222
|
220
|
CommonRequest<WorkEvent> eventRequest = new CommonRequest<WorkEvent>(workEvent);
|
223
|
221
|
CommonResponse response = eventHandleCommand.handleEvent(eventRequest);
|
|
@ -244,7 +242,7 @@ public class WorkOrderManagementServiceImpl implements WorkOrderManagementServic
|
244
|
242
|
|
245
|
243
|
workOrder.setCharValueSet(JSON.toJSONString(charValueMap));
|
246
|
244
|
|
247
|
|
log.debug("审核工单: "+JSON.toJSONString(workOrder));
|
|
245
|
log.debug("审核工单: " + JSON.toJSONString(workOrder));
|
248
|
246
|
|
249
|
247
|
CommonRequest<WorkOrder> workOrderRequest = new CommonRequest<WorkOrder>(workOrder);
|
250
|
248
|
CommonResponse<WorkTask> response = workOrderCommand.reportWorkOrderResult(workOrderRequest);
|
|
@ -257,31 +255,46 @@ public class WorkOrderManagementServiceImpl implements WorkOrderManagementServic
|
257
|
255
|
}
|
258
|
256
|
|
259
|
257
|
@Override
|
260
|
|
public CommonResponse normalClocking(Map<String,String> map) throws Throwable {
|
|
258
|
public CommonResponse normalClocking(Map<String, String> map) throws Throwable {
|
261
|
259
|
|
262
|
260
|
String clockingType = map.get("clockingType");
|
263
|
261
|
String employId = map.get("employId");
|
264
|
262
|
|
265
|
263
|
UserDto userDto = new UserDto();
|
266
|
264
|
userDto.setId(employId);
|
267
|
|
CommonRequest<UserDto> request = CommonRequest.<UserDto>builder().data(userDto).pageNumber(1).pageSize(1).build();
|
268
|
|
CommonResponse<PageBean<UserDto>> result = userDtoQuery.queryWorkEmployee(request);
|
269
|
|
String employOrgId = result.getData().getData().get(0).getOrgId();
|
270
|
|
log.info("输出参数:{}",JSON.toJSONString(result , SerializerFeature.PrettyFormat));
|
271
|
|
|
|
265
|
CommonRequest<UserDto> request = CommonRequest.<UserDto>builder().data(userDto).pageNumber(1).pageSize(1)
|
|
266
|
.build();
|
|
267
|
CommonResponse<PageBean<Map<String, Object>>> resultResponse = userDtoQuery.queryWorkEmployee(request);
|
|
268
|
|
|
269
|
/*String employOrgId = "";
|
|
270
|
try {
|
|
271
|
employOrgId = result.getData().getData().get(0).get("id");
|
|
272
|
}catch (Exception e){
|
|
273
|
log.error("员工不存在");
|
|
274
|
new BaseException("员工不存在");
|
|
275
|
}*/
|
|
276
|
if (resultResponse == null || resultResponse.getData() == null
|
|
277
|
|| CollectionUtils.isEmpty(resultResponse.getData().getData())
|
|
278
|
|| CollectionUtils.isEmpty(resultResponse.getData().getData().get(0))
|
|
279
|
|| resultResponse.getData().getData().get(0).get("id") == null) {
|
|
280
|
log.error("员工不存在");
|
|
281
|
new BaseException("员工不存在");
|
|
282
|
}
|
|
283
|
String employOrgId = String.valueOf(resultResponse.getData().getData().get(0).get("id"));
|
|
284
|
log.info("输出参数:{}", JSON.toJSONString(resultResponse, SerializerFeature.PrettyFormat));
|
272
|
285
|
|
273
|
|
String clockingTime = map.get("clockingTime");
|
|
286
|
String clockingTime = map.get("clockingTime");
|
274
|
287
|
WorkEvent workEvent = new WorkEvent();
|
275
|
288
|
|
276
|
289
|
workEvent.setWorkEmployeeRoleId(employId);
|
277
|
290
|
workEvent.setWorkOrgRoleId(employOrgId);
|
278
|
291
|
workEvent.setEventSpecId(clockingType);
|
279
|
292
|
|
280
|
|
Map<String,String> charValueSet = new HashMap<>();
|
281
|
|
charValueSet.put("clockingTime",clockingTime);
|
282
|
|
charValueSet.put("clockingType","NORMAL");
|
283
|
|
charValueSet.put("clockingLongitude","121.545500");
|
284
|
|
charValueSet.put("clockingLatitude","31.281153");
|
|
293
|
Map<String, String> charValueSet = new HashMap<>();
|
|
294
|
charValueSet.put("clockingTime", clockingTime);
|
|
295
|
charValueSet.put("clockingType", "NORMAL");
|
|
296
|
charValueSet.put("clockingLongitude", "121.545500");
|
|
297
|
charValueSet.put("clockingLatitude", "31.281153");
|
285
|
298
|
workEvent.setCharValueSet(JSONObject.toJSONString(charValueSet));
|
286
|
299
|
// "clockingTime": "2020-10-15 08:00:00",
|
287
|
300
|
// "clockingType": "NORMAL",
|
|
@ -295,12 +308,9 @@ public class WorkOrderManagementServiceImpl implements WorkOrderManagementServic
|
295
|
308
|
// JSON.parseObject(JSONObject.toJSONString(workEvent), new TypeReference<CommonRequest<WorkEvent>>() {
|
296
|
309
|
// });
|
297
|
310
|
|
298
|
|
|
299
|
311
|
// CommonRequest<WorkEvent> requestWorkEvent = new CommonRequest<WorkEvent>(workEvent);
|
300
|
312
|
CommonRequest<WorkEvent> requestWorkEvent = CommonRequest.<WorkEvent>builder().data(workEvent).build();
|
301
|
313
|
|
302
|
|
|
303
|
|
|
304
|
314
|
log.info("WorkEvent: \n{}", JSON.toJSONString(requestWorkEvent, true));
|
305
|
315
|
CommonResponse runningResult = eventHandleCommand.handleEvent(requestWorkEvent);
|
306
|
316
|
log.info("success: \n{}", JsonUtils.toJSONStringByDateFormat(runningResult, true));
|
|
@ -318,24 +328,24 @@ public class WorkOrderManagementServiceImpl implements WorkOrderManagementServic
|
318
|
328
|
|
319
|
329
|
String orgCode = "0000";
|
320
|
330
|
CommonRequest<String> request = CommonRequest.<String>builder().data(Strings.EMPTY).build();
|
321
|
|
CommonResponse<Map<String,Map<String,Object>>> userMapresult = userDtoQuery.queryUserCodeWithId(request);
|
|
331
|
CommonResponse<Map<String, Map<String, Object>>> userMapresult = userDtoQuery.queryUserCodeWithId(request);
|
322
|
332
|
log.info(JSON.toJSONString(userMapresult));
|
323
|
333
|
|
324
|
334
|
List<LeaveApprovalDto> list = Lists.newArrayList();
|
325
|
335
|
// "approvalResult": "APPROVED",
|
326
|
336
|
// "approvalComment": "下次注意"
|
327
|
|
/* "workEmployeeRoleId": "201057520856",
|
328
|
|
"workOrgRoleId": "99",
|
329
|
|
"charValueSet": {
|
330
|
|
"approvalType": "ASK_LEAVE",
|
331
|
|
"approvalSubType": "ASK_LEAVE-YEA",
|
332
|
|
"approvalReason": "zt-test",
|
333
|
|
"approvalEmployeeRoleId": "1113",
|
334
|
|
"beginTime": "2020-10-12",
|
335
|
|
"endTime": "2020-10-13",
|
336
|
|
"duration": "2",
|
337
|
|
"leaveType": "YEA"
|
338
|
|
*/
|
|
337
|
/* "workEmployeeRoleId": "201057520856",
|
|
338
|
"workOrgRoleId": "99",
|
|
339
|
"charValueSet": {
|
|
340
|
"approvalType": "ASK_LEAVE",
|
|
341
|
"approvalSubType": "ASK_LEAVE-YEA",
|
|
342
|
"approvalReason": "zt-test",
|
|
343
|
"approvalEmployeeRoleId": "1113",
|
|
344
|
"beginTime": "2020-10-12",
|
|
345
|
"endTime": "2020-10-13",
|
|
346
|
"duration": "2",
|
|
347
|
"leaveType": "YEA"
|
|
348
|
*/
|
339
|
349
|
LeaveApprovalDto dto = new LeaveApprovalDto();
|
340
|
350
|
dto.setApprovalComment("同意");
|
341
|
351
|
|
|
@ -350,13 +360,14 @@ public class WorkOrderManagementServiceImpl implements WorkOrderManagementServic
|
350
|
360
|
dto.setApprovalReason(" no reason ");
|
351
|
361
|
dto.setApplyTime("2020-10-12 12:00:00");
|
352
|
362
|
dto.setBeginTime("2020-10-12");
|
353
|
|
dto.setEndTime( "2020-10-13");
|
|
363
|
dto.setEndTime("2020-10-13");
|
354
|
364
|
dto.setDuration("2");
|
355
|
365
|
dto.setLeaveType("YEA");
|
356
|
|
list.add( dto);
|
357
|
|
CommonRequest<List<LeaveApprovalDto>> conditionMapRequest = CommonRequest.<List<LeaveApprovalDto>>builder().data(list).build();
|
358
|
|
Object importResult = approvalImportCommand.leaveApprovalImport(conditionMapRequest);
|
359
|
|
log.info(JSON.toJSONString( importResult));
|
|
366
|
list.add(dto);
|
|
367
|
CommonRequest<List<LeaveApprovalDto>> conditionMapRequest = CommonRequest.<List<LeaveApprovalDto>>builder()
|
|
368
|
.data(list).build();
|
|
369
|
Object importResult = approvalImportCommand.leaveApprovalImport(conditionMapRequest);
|
|
370
|
log.info(JSON.toJSONString(importResult));
|
360
|
371
|
|
361
|
372
|
// saveAskLeaveOrder(listTerminal, file.getOriginalFilename());
|
362
|
373
|
return CommonResponse.OK_VOID;
|
|
@ -26,16 +26,18 @@ public interface AiAlarmManageService {
|
26
|
26
|
CommonResponse<Map<String,Object>> queryOneAiAlarmInfo(@RequestParam String workTaskId) throws Exception;
|
27
|
27
|
|
28
|
28
|
/**
|
29
|
|
* AI任务模型匹配下拉列表
|
30
|
|
* @return
|
31
|
|
*/
|
32
|
|
CommonResponse<List<AiModel>> queryAiTaskModelList();
|
33
|
|
|
34
|
|
/**
|
35
|
29
|
* 根据 设备id 和 匹配模型 查询 AI任务
|
36
|
30
|
* @param resourceToolId 设备id
|
37
|
31
|
* @param aiIdenModel 匹配模型
|
38
|
32
|
* @return
|
39
|
33
|
*/
|
40
|
34
|
CommonResponse<List<Map<String, Object>>> queryAiTaskByDevice(String resourceToolId, String aiIdenModel);
|
|
35
|
|
|
36
|
/**
|
|
37
|
* 查询AI告警信息数量
|
|
38
|
* @param params
|
|
39
|
* @return
|
|
40
|
* @throws Exception
|
|
41
|
*/
|
|
42
|
List<Map<String, Object>> queryAiAlarmCount(Map<String, Object> params) throws Exception;
|
41
|
43
|
}
|
|
@ -0,0 +1,79 @@
|
|
1
|
package com.ai.bss.security.protection.service.interfaces;
|
|
2
|
|
|
3
|
import java.util.List;
|
|
4
|
import java.util.Map;
|
|
5
|
|
|
6
|
import com.ai.abc.api.model.CommonResponse;
|
|
7
|
import com.ai.bss.components.common.model.PageBean;
|
|
8
|
import com.ai.bss.work.safety.model.AiIdenLog;
|
|
9
|
|
|
10
|
/**
|
|
11
|
* AI执行结果
|
|
12
|
* @author konghl@asiainfo.com
|
|
13
|
* 2020-12-24
|
|
14
|
*/
|
|
15
|
public interface AiIdenLogManageService {
|
|
16
|
|
|
17
|
/**
|
|
18
|
* 分页查询AI执行结果信息
|
|
19
|
* @param params
|
|
20
|
* @param pageNumber
|
|
21
|
* @param pageSize
|
|
22
|
* @return
|
|
23
|
* @throws Exception
|
|
24
|
*/
|
|
25
|
CommonResponse<PageBean<Map<String, Object>>> queryPageAiIdenLog(Map<String, Object> params, int pageNumber,
|
|
26
|
int pageSize) throws Exception;
|
|
27
|
|
|
28
|
/**
|
|
29
|
* 查询所有AI执行结果的图片列表
|
|
30
|
* @param params
|
|
31
|
* @param pageNumber
|
|
32
|
* @param pageSize
|
|
33
|
* @return
|
|
34
|
* @throws Exception
|
|
35
|
*/
|
|
36
|
CommonResponse<List<Map<String, Object>>> queryAllAiIdenLogPicture(Map<String, Object> params, int pageNumber,
|
|
37
|
int pageSize) throws Exception;
|
|
38
|
|
|
39
|
/**
|
|
40
|
* 查询单个AI执行结果详情
|
|
41
|
* @param aiIdenLogId
|
|
42
|
* @return
|
|
43
|
* @throws Exception
|
|
44
|
*/
|
|
45
|
CommonResponse<Map<String, Object>> queryOneAiIdenLog(Long aiIdenLogId) throws Exception;
|
|
46
|
|
|
47
|
/**
|
|
48
|
* 查询所有设备最后一个识别记录
|
|
49
|
* @param params
|
|
50
|
* @return
|
|
51
|
* @throws Exception
|
|
52
|
*/
|
|
53
|
CommonResponse<List<Map<String, Object>>> selectLastAiIdenLog(Map<String, String> params) throws Exception;
|
|
54
|
|
|
55
|
/**
|
|
56
|
* 创建AI执行结果
|
|
57
|
* @param aiIdenLog
|
|
58
|
* @return
|
|
59
|
* @throws Exception
|
|
60
|
*/
|
|
61
|
CommonResponse<AiIdenLog> createAiIdenLog(AiIdenLog aiIdenLog) throws Exception;
|
|
62
|
|
|
63
|
/**
|
|
64
|
* 修改AI执行结果
|
|
65
|
* @param aiIdenLog
|
|
66
|
* @return
|
|
67
|
* @throws Exception
|
|
68
|
*/
|
|
69
|
CommonResponse<AiIdenLog> modifyAiIdenLog(AiIdenLog aiIdenLog) throws Exception;
|
|
70
|
|
|
71
|
/**
|
|
72
|
* 删除AI执行结果
|
|
73
|
* @param aiIdenLogIdList
|
|
74
|
* @return
|
|
75
|
* @throws Exception
|
|
76
|
*/
|
|
77
|
CommonResponse<Void> deleteAiIdenLog(List<Long> aiIdenLogIdList) throws Exception;
|
|
78
|
|
|
79
|
}
|
|
@ -16,7 +16,7 @@ public interface AttendanceCommonService {
|
16
|
16
|
* @return
|
17
|
17
|
* @throws Exception
|
18
|
18
|
*/
|
19
|
|
CommonResponse<PageBean<UserDto>> queryWorkEmployee(Map<String, Object> params) ;
|
|
19
|
CommonResponse<PageBean<Map<String, Object>>> queryWorkEmployee(Map<String, Object> params) ;
|
20
|
20
|
|
21
|
21
|
|
22
|
22
|
|
|
@ -26,7 +26,7 @@ public interface AttendanceCommonService {
|
26
|
26
|
* @return
|
27
|
27
|
* @throws Exception
|
28
|
28
|
*/
|
29
|
|
CommonResponse<PageBean<UserDto>> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception;
|
|
29
|
CommonResponse<PageBean<Map<String, Object>>> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception;
|
30
|
30
|
|
31
|
31
|
/**
|
32
|
32
|
* 查询所有部门(课通过name过滤)
|
|
@ -0,0 +1,106 @@
|
|
1
|
package com.ai.bss.security.protection.service.interfaces;
|
|
2
|
|
|
3
|
import java.util.List;
|
|
4
|
import java.util.Map;
|
|
5
|
|
|
6
|
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
|
|
7
|
import org.springframework.web.multipart.MultipartFile;
|
|
8
|
|
|
9
|
import com.ai.abc.api.model.CommonResponse;
|
|
10
|
import com.ai.bss.components.common.model.PageBean;
|
|
11
|
import com.ai.bss.person.model.Organization;
|
|
12
|
import com.ai.bss.user.dto.EmployeeDto;
|
|
13
|
import com.ai.bss.user.dto.UserDto;
|
|
14
|
|
|
15
|
public interface EmployeeManagementService {
|
|
16
|
|
|
17
|
/**
|
|
18
|
* 分页查询用户信息
|
|
19
|
* @param userDto
|
|
20
|
* @param pageNumber
|
|
21
|
* @param pageSize
|
|
22
|
* @return
|
|
23
|
* @throws Exception
|
|
24
|
*/
|
|
25
|
CommonResponse<PageBean<Map<String, Object>>> queryEmployeeList(UserDto userDto, int pageNumber, int pageSize) throws Exception;
|
|
26
|
|
|
27
|
/**
|
|
28
|
* 查询单个用户信息
|
|
29
|
* @param employeeId
|
|
30
|
* @return
|
|
31
|
* @throws Exception
|
|
32
|
*/
|
|
33
|
CommonResponse<Map<String, Object>> queryOneEmployee(Long employeeId) throws Exception;
|
|
34
|
|
|
35
|
/**
|
|
36
|
* 新增用户信息
|
|
37
|
* @param employeeDto
|
|
38
|
* @return
|
|
39
|
* @throws Exception
|
|
40
|
*/
|
|
41
|
CommonResponse<Void> createEmployee(EmployeeDto employeeDto) throws Exception;
|
|
42
|
|
|
43
|
/**
|
|
44
|
* 修改用户信息
|
|
45
|
* @param employeeDto
|
|
46
|
* @return
|
|
47
|
* @throws Exception
|
|
48
|
*/
|
|
49
|
CommonResponse<Void> modifyEmployee(EmployeeDto employeeDto) throws Exception;
|
|
50
|
|
|
51
|
/**
|
|
52
|
* 删除用户信息
|
|
53
|
* @param employeeId
|
|
54
|
* @return
|
|
55
|
* @throws Exception
|
|
56
|
*/
|
|
57
|
CommonResponse<Void> deleteEmployee(String employeeId) throws Exception;
|
|
58
|
|
|
59
|
/**
|
|
60
|
* 上传用户照片
|
|
61
|
* @param meFile
|
|
62
|
* @param pictureUrl
|
|
63
|
* @return
|
|
64
|
* @throws Exception
|
|
65
|
*/
|
|
66
|
Map<String, String> uploadEmployeePicture(MultipartFile meFile, String pictureUrl) throws Exception;
|
|
67
|
|
|
68
|
/**
|
|
69
|
* 审核用户照片
|
|
70
|
* @param employeeId
|
|
71
|
* @param field2
|
|
72
|
* @param field3
|
|
73
|
* @return
|
|
74
|
* @throws Exception
|
|
75
|
*/
|
|
76
|
CommonResponse<Void> auditEmployeePicture(Long employeeId,String field2,String field3) throws Exception;
|
|
77
|
|
|
78
|
/**
|
|
79
|
* 获取职务下拉列表
|
|
80
|
* @return
|
|
81
|
*/
|
|
82
|
List<CharacteristicSpecValue> queryJobPositionList() throws Exception;
|
|
83
|
|
|
84
|
/**
|
|
85
|
* 根据部门ID查询子部门列表
|
|
86
|
* @param orgId
|
|
87
|
* @return
|
|
88
|
*/
|
|
89
|
CommonResponse<List<Organization>> queryChildOrgById(Long orgId);
|
|
90
|
|
|
91
|
/**
|
|
92
|
* 根据部门ID查询下级及下下级部门列表
|
|
93
|
* @param orgId
|
|
94
|
* @return
|
|
95
|
*/
|
|
96
|
CommonResponse<List<Organization>> queryCycleChildOrg(Long orgId);
|
|
97
|
|
|
98
|
/**
|
|
99
|
* 根据部门ID查询下级及下下级部门的员工列表
|
|
100
|
* @param orgId
|
|
101
|
* @param pageNumber
|
|
102
|
* @param pageSize
|
|
103
|
* @return
|
|
104
|
*/
|
|
105
|
List<Map<String, Object>> queryEmployeeListByOrgId(Long orgId, int pageNumber, int pageSize);
|
|
106
|
}
|
|
@ -0,0 +1,22 @@
|
|
1
|
package com.ai.bss.security.protection.service.interfaces;
|
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
import com.ai.bss.security.protection.model.User;
|
|
6
|
|
|
7
|
import javax.servlet.http.HttpServletRequest;
|
|
8
|
import java.util.Map;
|
|
9
|
|
|
10
|
/**
|
|
11
|
* @Auther: 王超
|
|
12
|
* @Date: 2020/12/24 15:12
|
|
13
|
* @Description:
|
|
14
|
*/
|
|
15
|
public interface LoginService {
|
|
16
|
|
|
17
|
|
|
18
|
Map<String, Object> findMenus(User user, HttpServletRequest request);
|
|
19
|
|
|
20
|
|
|
21
|
Map<String, Object> login(User user);
|
|
22
|
}
|
|
@ -22,6 +22,9 @@ public interface MonitorVideoLogManageService {
|
22
|
22
|
CommonResponse<List<EbcMonitorVideoLog>> queryMonitorVideoLogByTime(MonitorVideoLog monitorVideoLogCondition)
|
23
|
23
|
throws Exception;
|
24
|
24
|
|
|
25
|
|
|
26
|
CommonResponse<String> queryMonitorVideoLogByTimeForM3u8(MonitorVideoLog monitorVideoLogCondition) throws Exception;
|
|
27
|
|
25
|
28
|
/**
|
26
|
29
|
* 根据视频日志ID查询监控视频日志
|
27
|
30
|
* @param monitorVideoLogId
|
|
@ -82,4 +82,12 @@ public interface ResourceToolManageService {
|
82
|
82
|
* @throws Exception
|
83
|
83
|
*/
|
84
|
84
|
Map<String, String> uploadResourceToolPicture(MultipartFile meFile, String pictureUrl) throws Exception;
|
|
85
|
|
|
86
|
/**
|
|
87
|
* 根据设备CODE获取AI任务等相关信息
|
|
88
|
* @param resourceToolCode
|
|
89
|
* @return
|
|
90
|
*/
|
|
91
|
CommonResponse<List<Map<String, Object>>> getResourceToolAllInfo(String resourceToolCode);
|
|
92
|
|
85
|
93
|
}
|
|
@ -4,6 +4,7 @@ import com.ai.abc.api.model.CommonRequest;
|
4
|
4
|
import com.ai.abc.api.model.CommonResponse;
|
5
|
5
|
import com.ai.bss.components.common.model.PageBean;
|
6
|
6
|
import com.ai.bss.security.protection.model.AiQuery;
|
|
7
|
import com.ai.bss.work.safety.model.AiModel;
|
7
|
8
|
import com.ai.bss.work.safety.model.AiTask;
|
8
|
9
|
import com.ai.bss.work.task.model.common.WorkTask;
|
9
|
10
|
|
|
@ -21,4 +22,9 @@ public interface SysConfigAiTaskService {
|
21
|
22
|
|
22
|
23
|
CommonResponse<AiTask> modifyAiTask(AiTask aiTask);
|
23
|
24
|
|
|
25
|
/**
|
|
26
|
* AI任务模型匹配下拉列表
|
|
27
|
* @return
|
|
28
|
*/
|
|
29
|
CommonResponse<List<AiModel>> queryAiTaskModelList();
|
24
|
30
|
}
|
|
@ -3,7 +3,6 @@ package com.ai.bss.security.protection.service.task;
|
3
|
3
|
import java.util.List;
|
4
|
4
|
import java.util.Map;
|
5
|
5
|
|
6
|
|
import org.apache.commons.lang.StringUtils;
|
7
|
6
|
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
8
|
7
|
import org.springframework.beans.factory.annotation.Autowired;
|
9
|
8
|
import org.springframework.kafka.annotation.KafkaListener;
|
|
@ -14,9 +13,10 @@ import org.springframework.util.CollectionUtils;
|
14
|
13
|
import com.ai.abc.api.model.CommonRequest;
|
15
|
14
|
import com.ai.abc.api.model.CommonResponse;
|
16
|
15
|
import com.ai.abc.util.JsonUtils;
|
17
|
|
import com.ai.bss.security.protection.service.interfaces.AiAlarmManageService;
|
18
|
|
import com.ai.bss.security.protection.service.interfaces.ResourceToolManageService;
|
|
16
|
import com.ai.bss.security.protection.service.interfaces.AiIdenLogManageService;
|
19
|
17
|
import com.ai.bss.security.protection.utils.EbcConstant;
|
|
18
|
import com.ai.bss.user.dto.EmployeeDto;
|
|
19
|
import com.ai.bss.user.service.api.EmployeeService;
|
20
|
20
|
import com.ai.bss.work.safety.model.AiIdenLog;
|
21
|
21
|
import com.ai.bss.work.safety.service.api.AiTaskCommand;
|
22
|
22
|
import com.ai.bss.work.safety.service.api.MonitorSceneQuery;
|
|
@ -39,13 +39,13 @@ public class AiResultRecordKafkaTask {
|
39
|
39
|
private AiTaskCommand aiTaskCommand;
|
40
|
40
|
|
41
|
41
|
@Autowired
|
42
|
|
private ResourceToolManageService resourceToolManageService;
|
|
42
|
private MonitorSceneQuery monitorSceneQuery;
|
43
|
43
|
|
44
|
44
|
@Autowired
|
45
|
|
private MonitorSceneQuery monitorSceneQuery;
|
|
45
|
private AiIdenLogManageService aiIdenLogManageService;
|
46
|
46
|
|
47
|
47
|
@Autowired
|
48
|
|
private AiAlarmManageService aiAlarmManageService;
|
|
48
|
private EmployeeService employeeService;
|
49
|
49
|
|
50
|
50
|
@KafkaListener(containerFactory = "kafkaBatchListener6", topics = "${kafka.topic.aitask:topic_ai_task}", groupId = "ai_group")
|
51
|
51
|
public void AiResultRecordListener(ConsumerRecord<String, String> records, Acknowledgment ack) throws Throwable {
|
|
@ -55,75 +55,72 @@ public class AiResultRecordKafkaTask {
|
55
|
55
|
String message = records.value();
|
56
|
56
|
log.info("已接AI任务执行结果消息,消息为:" + message);
|
57
|
57
|
|
|
58
|
AiIdenLog aiIdenLog = JSON.parseObject(message, new TypeReference<AiIdenLog>() {
|
|
59
|
});
|
|
60
|
|
58
|
61
|
JSONObject messageJson = JSONObject.parseObject(message);
|
59
|
|
String resourceToolCod = messageJson.getString("resourceToolCode");
|
60
|
|
String aiIdenModel = messageJson.getString("aiIdenModel");
|
|
62
|
String resourceToolId = messageJson.getString("resourceToolId");
|
61
|
63
|
String idenResultType = messageJson.getString("idenResultType");
|
|
64
|
Long relateEmployeeRoleId = messageJson.getLong("relateEmployeeRoleId");
|
62
|
65
|
|
63
|
|
// 查询相关数据
|
64
|
|
Map<String, Object> resourceToolMap = resourceToolManageService.queryResourceToolByCode(resourceToolCod);
|
65
|
|
if (resourceToolMap == null) {
|
66
|
|
log.error("AI任务执行结果的设备CODE不存在: resourceToolCode=" + messageJson.getString("resourceToolCode"));
|
67
|
|
throw new NullPointerException("resourceToolCode not exist");
|
68
|
|
}
|
69
|
|
|
70
|
|
String resourceToolId = String.valueOf(resourceToolMap.get("resourceToolId"));
|
71
|
|
|
|
66
|
// 关联场景信息
|
72
|
67
|
CommonResponse<List<Map<String, Object>>> sceneTerminalRelResponse = monitorSceneQuery
|
73
|
68
|
.selectSceneTerminalRel(new CommonRequest<Long>(Long.valueOf(resourceToolId)));
|
74
|
69
|
if (sceneTerminalRelResponse == null || CollectionUtils.isEmpty(sceneTerminalRelResponse.getData())) {
|
75
|
70
|
log.error("AI任务执行结果的关联场景不存在: resourceToolId=" + resourceToolId);
|
76
|
71
|
throw new NullPointerException("sceneTerminalRel not exist");
|
77
|
72
|
}
|
78
|
|
Map<String, Object> sceneTerminalRelMap = sceneTerminalRelResponse.getData().get(0);
|
79
|
73
|
|
80
|
|
CommonResponse<List<Map<String, Object>>> aiTaskResponse = aiAlarmManageService
|
81
|
|
.queryAiTaskByDevice(resourceToolId, aiIdenModel);
|
82
|
|
if (aiTaskResponse == null || CollectionUtils.isEmpty(aiTaskResponse.getData())) {
|
83
|
|
log.error("AI任务执行结果的任务不存在: resourceToolId=" + resourceToolId + ", aiIdenModel=" + aiIdenModel);
|
84
|
|
throw new NullPointerException("aiTask not exist");
|
85
|
|
}
|
86
|
|
Map<String, Object> aiTaskMap = aiTaskResponse.getData().get(0);
|
|
74
|
Map<String, Object> sceneTerminalRelMap = sceneTerminalRelResponse.getData().get(0);
|
87
|
75
|
|
88
|
|
// 封装数据
|
89
|
|
AiIdenLog aiIdenLog = JSON.parseObject(message, new TypeReference<AiIdenLog>() {
|
90
|
|
});
|
91
|
|
aiIdenLog.setResourceToolId(resourceToolId);
|
92
|
|
aiIdenLog.setResourceToolName(
|
93
|
|
StringUtils.defaultIfBlank(String.valueOf(resourceToolMap.get("resourceToolName")), ""));
|
94
|
|
aiIdenLog.setMonitorSceneId(
|
95
|
|
StringUtils.defaultIfBlank(String.valueOf(sceneTerminalRelMap.get("monitorSceneId")), ""));
|
96
|
|
aiIdenLog.setMonitorSceneName(
|
97
|
|
StringUtils.defaultIfBlank(String.valueOf(sceneTerminalRelMap.get("monitorSceneName")), ""));
|
98
|
|
// aiIdenLog.setEffectType(StringUtils.defaultIfBlank(String.valueOf(sceneTerminalRelMap.get("effectType")),EbcConstant.TERMINAL_EFFECT_TYPE_OTH));
|
|
76
|
aiIdenLog.setMonitorSceneId(sceneTerminalRelMap.get("monitorSceneId") == null ? ""
|
|
77
|
: String.valueOf(sceneTerminalRelMap.get("monitorSceneId")));
|
|
78
|
aiIdenLog.setMonitorSceneName(sceneTerminalRelMap.get("monitorSceneName") == null ? ""
|
|
79
|
: String.valueOf(sceneTerminalRelMap.get("monitorSceneName")));
|
|
80
|
aiIdenLog.setEffectType(sceneTerminalRelMap.get("effectType") == null ? EbcConstant.TERMINAL_EFFECT_TYPE_OTH
|
|
81
|
: String.valueOf(sceneTerminalRelMap.get("effectType")));
|
99
|
82
|
aiIdenLog.setTerminalPosition(
|
100
|
|
StringUtils.defaultIfBlank(String.valueOf(sceneTerminalRelMap.get("place")), ""));
|
|
83
|
sceneTerminalRelMap.get("place") == null ? "" : String.valueOf(sceneTerminalRelMap.get("place")));
|
101
|
84
|
aiIdenLog.setOrganizationId(
|
102
|
|
StringUtils.defaultIfBlank(String.valueOf(sceneTerminalRelMap.get("orgId")), ""));
|
103
|
|
aiIdenLog.setAiTaskId(
|
104
|
|
aiTaskMap.get("aiTaskId") == null ? 0L : Long.valueOf(String.valueOf(aiTaskMap.get("aiTaskId"))));
|
105
|
|
|
106
|
|
// TODO 人员信息暂时默认
|
107
|
|
aiIdenLog.setRelateEmployeeRoleId("201613310867");
|
108
|
|
aiIdenLog.setRelateEmployeeRoleName("王浩");
|
|
85
|
sceneTerminalRelMap.get("orgId") == null ? "" : String.valueOf(sceneTerminalRelMap.get("orgId")));
|
|
86
|
|
|
87
|
// 关联员工信息
|
|
88
|
EmployeeDto employeeDto = null;
|
|
89
|
if (relateEmployeeRoleId != null) {
|
|
90
|
employeeDto = new EmployeeDto();
|
|
91
|
employeeDto.setId(relateEmployeeRoleId);
|
|
92
|
CommonRequest<EmployeeDto> employeeDtoRequest = new CommonRequest<EmployeeDto>(employeeDto);
|
|
93
|
CommonResponse<EmployeeDto> employeeDtoResponse = employeeService.queryEmployee(employeeDtoRequest);
|
|
94
|
if (employeeDtoResponse == null || employeeDtoResponse.getData() == null) {
|
|
95
|
employeeDto = null;
|
|
96
|
} else {
|
|
97
|
employeeDto = employeeDtoResponse.getData();
|
|
98
|
}
|
|
99
|
}
|
|
100
|
if (employeeDto != null) {
|
|
101
|
aiIdenLog.setRelateEmployeeRoleName(employeeDto.getName());
|
|
102
|
aiIdenLog.setOrganizationId(String.valueOf(employeeDto.getOrganizeId()));
|
|
103
|
} else {
|
|
104
|
aiIdenLog.setRelateEmployeeRoleId("-1");
|
|
105
|
aiIdenLog.setRelateEmployeeRoleName(null);
|
|
106
|
}
|
109
|
107
|
|
110
|
108
|
// 执行操作
|
111
|
|
CommonRequest<AiIdenLog> aiIdenLogRequest = new CommonRequest<AiIdenLog>(aiIdenLog);
|
112
|
|
|
113
|
|
CommonResponse<AiIdenLog> runningResult = aiTaskCommand.createAiIdenLog(aiIdenLogRequest);
|
114
|
|
log.debug("AI任务执行结果: \n{}", JsonUtils.toJSONStringByDateFormat(runningResult, true));
|
|
109
|
CommonResponse<AiIdenLog> aiIdenLogRunningResult = aiIdenLogManageService.createAiIdenLog(aiIdenLog);
|
|
110
|
log.debug("AI任务执行结果: \n{}", JsonUtils.toJSONStringByDateFormat(aiIdenLogRunningResult, true));
|
115
|
111
|
|
116
|
|
if (!runningResult.isSuccess()) {
|
117
|
|
log.error("AI任务执行结果异常: " + runningResult.getFail().getMessage());
|
|
112
|
if (!aiIdenLogRunningResult.isSuccess()) {
|
|
113
|
log.error("AI任务执行结果异常: " + aiIdenLogRunningResult.getFail().getMessage());
|
118
|
114
|
return;
|
119
|
115
|
}
|
120
|
116
|
|
121
|
117
|
if (!EbcConstant.AI_IDENTIFY_RESULT_NORMAL.equals(idenResultType)) {
|
122
|
|
CommonResponse runningResult1 = aiTaskCommand.aiIdenLogTriggerEvent(aiIdenLogRequest);
|
|
118
|
CommonRequest<AiIdenLog> aiIdenLogRequest = new CommonRequest<AiIdenLog>(aiIdenLog);
|
|
119
|
CommonResponse triggerEventRunningResult = aiTaskCommand.aiIdenLogTriggerEvent(aiIdenLogRequest);
|
123
|
120
|
|
124
|
|
log.debug("AI任务非正常情况的执行结果: \n{}", JsonUtils.toJSONStringByDateFormat(runningResult1, true));
|
125
|
|
if (!runningResult.isSuccess()) {
|
126
|
|
log.error("AI任务非正常情况的执行结果异常: " + runningResult.getFail().getMessage());
|
|
121
|
log.debug("AI任务触发事件的执行结果: \n{}", JsonUtils.toJSONStringByDateFormat(triggerEventRunningResult, true));
|
|
122
|
if (!triggerEventRunningResult.isSuccess()) {
|
|
123
|
log.error("AI任务触发事件的执行结果异常: " + triggerEventRunningResult.getFail().getMessage());
|
127
|
124
|
return;
|
128
|
125
|
}
|
129
|
126
|
}
|
|
@ -540,7 +540,7 @@ public class DateUtil {
|
540
|
540
|
/**
|
541
|
541
|
* 取得date中的纯日期部分
|
542
|
542
|
*
|
543
|
|
* @param date需要变动的日期
|
|
543
|
* @param date
|
544
|
544
|
* @return 变动后的日期
|
545
|
545
|
*/
|
546
|
546
|
public static Date getDateWithoutTime(Date date) {
|
|
@ -652,4 +652,14 @@ public class DateUtil {
|
652
|
652
|
return Integer.parseInt(lastDay);
|
653
|
653
|
}
|
654
|
654
|
|
|
655
|
|
|
656
|
public static String getDateTimeString(Date date){
|
|
657
|
if (date == null){
|
|
658
|
return null;
|
|
659
|
}
|
|
660
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat( NORM_DATETIME_PATTERN);
|
|
661
|
String dateString = simpleDateFormat.format(date);
|
|
662
|
return dateString;
|
|
663
|
}
|
|
664
|
|
655
|
665
|
}
|
|
@ -12,6 +12,9 @@ public class EbcConstant {
|
12
|
12
|
// 每页默认查询条数
|
13
|
13
|
public static final int DEFAULT_PAGE_SIZE = 20;
|
14
|
14
|
|
|
15
|
// 部门列表的根节点(部门的根节点为集团,集团的下一级为公司,公司的下一级为部门)
|
|
16
|
public static final Long ORGANIZE_ROOT_ID=1L;
|
|
17
|
|
15
|
18
|
// 异常考勤查询常量异常取值 abnormal,
|
16
|
19
|
public static final String ATTENDANCE_STATUSTYPE_ABNORMAL = "ABNORMAL";
|
17
|
20
|
|
|
@ -54,6 +57,9 @@ public class EbcConstant {
|
54
|
57
|
// 静态常量: AI任务状态
|
55
|
58
|
public static final String BUSINESS_SPEC_AI_TASK_STATUS = "AI_TASK_STATUS";
|
56
|
59
|
|
|
60
|
//静态常量: 职务类型
|
|
61
|
public static final String BUSINESS_SPEC_EMPLOYEE_POSITION="mainJobPosition";
|
|
62
|
|
57
|
63
|
// 视频监控保存视频文件固定前缀
|
58
|
64
|
public static final String AI_MONITOR_FILE_PREFIX_VIDEO= "-video";
|
59
|
65
|
|
|
@ -78,6 +84,23 @@ public class EbcConstant {
|
78
|
84
|
//场景关联设备的作用类别:其他
|
79
|
85
|
public static final String TERMINAL_EFFECT_TYPE_OTH="OTH";
|
80
|
86
|
|
|
87
|
//审核状态:待审核
|
|
88
|
public static final String AUDIT_STATUS_INI="0";
|
|
89
|
|
|
90
|
//审核状态:已生效(审核通过)
|
|
91
|
public static final String AUDIT_STATUS_ACC="5";
|
|
92
|
|
|
93
|
//审核状态:未生效(未审核通过)
|
|
94
|
public static final String AUDIT_STATUS_DIS="3";
|
|
95
|
|
|
96
|
//AI匹配模型:着装违规识别
|
|
97
|
public static final String AI_MODEL_CLOTHING_CODE="CLOTHING_CODE";
|
|
98
|
|
|
99
|
//AI匹配模型:人脸识别
|
|
100
|
public static final String AI_MODEL_FACE="FACE";
|
|
101
|
|
|
102
|
//AI匹配模型:陌生人识别
|
|
103
|
public static final String AI_MODEL_STRANGER="STRANGER";
|
81
|
104
|
|
82
|
105
|
|
83
|
106
|
// 当前登录者的STAFF_ID
|
|
@ -0,0 +1,295 @@
|
|
1
|
package com.ai.bss.security.protection.utils;
|
|
2
|
|
|
3
|
import com.alibaba.fastjson.JSONObject;
|
|
4
|
import org.apache.http.HttpEntity;
|
|
5
|
import org.apache.http.HttpStatus;
|
|
6
|
import org.apache.http.client.ClientProtocolException;
|
|
7
|
import org.apache.http.client.HttpClient;
|
|
8
|
import org.apache.http.client.config.RequestConfig;
|
|
9
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
|
10
|
import org.apache.http.client.methods.HttpGet;
|
|
11
|
import org.apache.http.client.methods.HttpPost;
|
|
12
|
import org.apache.http.client.methods.HttpPut;
|
|
13
|
import org.apache.http.entity.StringEntity;
|
|
14
|
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
|
15
|
import org.apache.http.impl.client.CloseableHttpClient;
|
|
16
|
import org.apache.http.impl.client.HttpClients;
|
|
17
|
import org.apache.http.protocol.HTTP;
|
|
18
|
import org.apache.http.util.EntityUtils;
|
|
19
|
import org.slf4j.Logger;
|
|
20
|
import org.slf4j.LoggerFactory;
|
|
21
|
import org.springframework.util.CollectionUtils;
|
|
22
|
|
|
23
|
import java.io.*;
|
|
24
|
import java.net.HttpURLConnection;
|
|
25
|
import java.net.URL;
|
|
26
|
import java.net.URLEncoder;
|
|
27
|
import java.nio.charset.Charset;
|
|
28
|
import java.util.Iterator;
|
|
29
|
import java.util.Map;
|
|
30
|
import java.util.Set;
|
|
31
|
|
|
32
|
/**
|
|
33
|
* http服务请求工具类
|
|
34
|
*
|
|
35
|
* @author chencai
|
|
36
|
*/
|
|
37
|
public class HttpServiceUtil {
|
|
38
|
static Logger log = LoggerFactory.getLogger(HttpServiceUtil.class);
|
|
39
|
|
|
40
|
private static final String HTTP_CONTENT_TYPE_JSON = "application/json; charset=utf-8";
|
|
41
|
|
|
42
|
public static String buildUrl(Map<String, String> paramMap, String serviceUrl) {
|
|
43
|
String url = null;
|
|
44
|
StringBuffer urlString = new StringBuffer();
|
|
45
|
urlString.append(serviceUrl);
|
|
46
|
|
|
47
|
if (!paramMap.isEmpty()) {
|
|
48
|
// 参数列表不为空,地址尾部增加'?'
|
|
49
|
urlString.append('?');
|
|
50
|
// 拼接参数
|
|
51
|
Set<Map.Entry<String, String>> entrySet = paramMap.entrySet();
|
|
52
|
for (Map.Entry<String, String> entry : entrySet) {
|
|
53
|
try {
|
|
54
|
urlString.append(entry.getKey()).append('=').append(URLEncoder.encode(entry.getValue(), "UTF-8"))
|
|
55
|
.append('&');
|
|
56
|
} catch (UnsupportedEncodingException e) {
|
|
57
|
log.error(" Exception: " + e);
|
|
58
|
}
|
|
59
|
}
|
|
60
|
// 去掉最后一个字符“&”
|
|
61
|
url = urlString.substring(0, urlString.length() - 1);
|
|
62
|
}
|
|
63
|
return url;
|
|
64
|
}
|
|
65
|
|
|
66
|
public static String sendRequest(String url) {
|
|
67
|
InputStream inputStream = null;
|
|
68
|
BufferedReader bufferedReader = null;
|
|
69
|
HttpURLConnection httpURLConnection = null;
|
|
70
|
try {
|
|
71
|
log.error("It's not error. request url: " + url);
|
|
72
|
URL requestURL = new URL(url);
|
|
73
|
// 获取连接
|
|
74
|
httpURLConnection = (HttpURLConnection) requestURL.openConnection();
|
|
75
|
httpURLConnection.setConnectTimeout(10000); // 建立连接的超时时间,毫秒
|
|
76
|
httpURLConnection.setReadTimeout(25000); // 获得返回的超时时间,毫秒
|
|
77
|
httpURLConnection.setRequestMethod("GET");
|
|
78
|
httpURLConnection.setRequestProperty("Content-type", "text/html;charset=UTF-8");
|
|
79
|
httpURLConnection.setRequestProperty("Accept",
|
|
80
|
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
|
|
81
|
// 通过输入流获取请求的内容
|
|
82
|
inputStream = httpURLConnection.getInputStream();
|
|
83
|
bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
|
|
84
|
String temp = null;
|
|
85
|
StringBuffer stringBuffer = new StringBuffer();
|
|
86
|
// 循环读取返回的结果
|
|
87
|
while ((temp = bufferedReader.readLine()) != null) {
|
|
88
|
stringBuffer.append(temp);
|
|
89
|
}
|
|
90
|
|
|
91
|
return stringBuffer.toString();
|
|
92
|
} catch (Exception e) {
|
|
93
|
log.error("sendRequest Exception: " + e);
|
|
94
|
} finally {
|
|
95
|
// 断开连接
|
|
96
|
if (httpURLConnection != null) {
|
|
97
|
httpURLConnection.disconnect();
|
|
98
|
}
|
|
99
|
// 关闭流
|
|
100
|
if (bufferedReader != null) {
|
|
101
|
try {
|
|
102
|
bufferedReader.close();
|
|
103
|
} catch (IOException e) {
|
|
104
|
log.error("bufferedReader Exception: " + e);
|
|
105
|
}
|
|
106
|
}
|
|
107
|
if (inputStream != null) {
|
|
108
|
try {
|
|
109
|
inputStream.close();
|
|
110
|
} catch (IOException e) {
|
|
111
|
log.error("inputStream Exception: " + e);
|
|
112
|
}
|
|
113
|
}
|
|
114
|
}
|
|
115
|
return null;
|
|
116
|
}
|
|
117
|
|
|
118
|
public static String sendPostRequest(String url, Map<String, String> map, String encoding) {
|
|
119
|
String retStr = "";
|
|
120
|
try {
|
|
121
|
retStr = sendPostRequest(url, map, encoding, 0, 0);
|
|
122
|
} catch (Exception ex) {
|
|
123
|
log.error("sendPostRequest error: " + ex);
|
|
124
|
}
|
|
125
|
|
|
126
|
return retStr;
|
|
127
|
}
|
|
128
|
|
|
129
|
public static String sendPostRequest(String url, Map<String, String> map, String encoding, int ebossConnectTimeout,
|
|
130
|
int ebossServiceTimeout) {
|
|
131
|
CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
132
|
HttpPost httpPost = new HttpPost(url);
|
|
133
|
String body = "";
|
|
134
|
|
|
135
|
try {
|
|
136
|
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
|
|
137
|
if (map != null) {
|
|
138
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
139
|
multipartEntityBuilder.addTextBody(entry.getKey(), entry.getValue());
|
|
140
|
}
|
|
141
|
}
|
|
142
|
|
|
143
|
log.debug("ebossConnectTimeout:" + ebossConnectTimeout);
|
|
144
|
log.debug("ebossServiceTimeout:" + ebossServiceTimeout);
|
|
145
|
|
|
146
|
httpPost.setEntity(multipartEntityBuilder.build());
|
|
147
|
if (ebossConnectTimeout != 0 && ebossServiceTimeout != 0) {
|
|
148
|
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(ebossServiceTimeout)
|
|
149
|
.setConnectTimeout(ebossConnectTimeout).build();// 设置请求和传输超时时间
|
|
150
|
httpPost.setConfig(requestConfig);
|
|
151
|
}
|
|
152
|
|
|
153
|
CloseableHttpResponse response = httpClient.execute(httpPost);
|
|
154
|
|
|
155
|
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
|
156
|
HttpEntity entity = response.getEntity();
|
|
157
|
if (entity != null) {
|
|
158
|
// 按指定编码转换结果实体为String类型
|
|
159
|
body = EntityUtils.toString(entity, encoding);
|
|
160
|
}
|
|
161
|
EntityUtils.consume(entity);
|
|
162
|
}
|
|
163
|
} catch (ClientProtocolException e) {
|
|
164
|
log.error("ClientProtocolException Exception: " + e);
|
|
165
|
} catch (UnsupportedEncodingException e) {
|
|
166
|
log.error("UnsupportedEncodingException Exception: " + e);
|
|
167
|
} catch (IOException e) {
|
|
168
|
log.error("IOException Exception: " + e);
|
|
169
|
// throw new BaseException("10", "调用Eboss超时");
|
|
170
|
} finally {
|
|
171
|
// 关闭连接,释放资源
|
|
172
|
try {
|
|
173
|
httpClient.close();
|
|
174
|
} catch (IOException e) {
|
|
175
|
log.error("httpClient Exception: " + e);
|
|
176
|
}
|
|
177
|
}
|
|
178
|
|
|
179
|
return body;
|
|
180
|
}
|
|
181
|
|
|
182
|
public static String sendGet(String url, Charset encoding, Map<String, String> headerMap) {
|
|
183
|
HttpClient httpClient = HttpClients.createDefault();
|
|
184
|
HttpGet httpGet = new HttpGet(url);
|
|
185
|
httpGet.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
|
|
186
|
CloseableHttpResponse response = null;
|
|
187
|
try {
|
|
188
|
log.debug("执行GET请求:url= " + url);
|
|
189
|
response = (CloseableHttpResponse) httpClient.execute(httpGet);
|
|
190
|
} catch (Exception e) {
|
|
191
|
log.error("sendGet Exception: " + e.getMessage());
|
|
192
|
return "{}";
|
|
193
|
}
|
|
194
|
return responseEx(httpClient, response, encoding);
|
|
195
|
}
|
|
196
|
|
|
197
|
public static String sendPost(String url, Map<String, Object> paramsMap, Charset encoding) {
|
|
198
|
HttpClient httpClient = HttpClients.createDefault();
|
|
199
|
HttpPost httpPost = new HttpPost(url);
|
|
200
|
httpPost.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
|
|
201
|
if (!CollectionUtils.isEmpty(paramsMap)) {
|
|
202
|
StringEntity se = new StringEntity(JSONObject.toJSONString(paramsMap), encoding);
|
|
203
|
httpPost.setEntity(se);
|
|
204
|
}
|
|
205
|
CloseableHttpResponse response = null;
|
|
206
|
try {
|
|
207
|
log.debug("执行POST无参请求:url= " + url);
|
|
208
|
response = (CloseableHttpResponse) httpClient.execute(httpPost);
|
|
209
|
} catch (Exception e) {
|
|
210
|
log.error("sendPost Exception: " + e.getMessage());
|
|
211
|
return "{}";
|
|
212
|
}
|
|
213
|
return responseEx(httpClient, response, encoding);
|
|
214
|
}
|
|
215
|
|
|
216
|
public static String sendPost(String url, Map<String, Object> paramsMap, Charset encoding,
|
|
217
|
Map<String, String> headerMap) {
|
|
218
|
HttpClient httpClient = HttpClients.createDefault();
|
|
219
|
HttpPost httpPost = new HttpPost(url);
|
|
220
|
|
|
221
|
Iterator<String> iter = headerMap.keySet().iterator();
|
|
222
|
String key = "";
|
|
223
|
String value = "";
|
|
224
|
while (iter.hasNext()) {
|
|
225
|
key = iter.next();
|
|
226
|
value = headerMap.get(key);
|
|
227
|
httpPost.setHeader(key, value);
|
|
228
|
}
|
|
229
|
|
|
230
|
httpPost.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
|
|
231
|
if (!CollectionUtils.isEmpty(paramsMap)) {
|
|
232
|
log.debug("执行POST请求:url= " + url + ",参数= " + JSONObject.toJSONString(paramsMap));
|
|
233
|
StringEntity se = new StringEntity(JSONObject.toJSONString(paramsMap), encoding);
|
|
234
|
httpPost.setEntity(se);
|
|
235
|
}
|
|
236
|
CloseableHttpResponse response = null;
|
|
237
|
try {
|
|
238
|
response = (CloseableHttpResponse) httpClient.execute(httpPost);
|
|
239
|
} catch (Exception e) {
|
|
240
|
log.error("sendPost Exception: " + e.getMessage());
|
|
241
|
return "{}";
|
|
242
|
}
|
|
243
|
return responseEx(httpClient, response, encoding);
|
|
244
|
}
|
|
245
|
|
|
246
|
public static String sendPut(String url, Map<String, Object> paramsMap, Charset encoding) {
|
|
247
|
HttpClient httpClient = HttpClients.createDefault();
|
|
248
|
String resp = "";
|
|
249
|
HttpPut httpPut = new HttpPut(url);
|
|
250
|
httpPut.addHeader(HTTP.CONTENT_TYPE, HTTP_CONTENT_TYPE_JSON);
|
|
251
|
if (!CollectionUtils.isEmpty(paramsMap)) {
|
|
252
|
StringEntity se = new StringEntity(JSONObject.toJSONString(paramsMap), encoding);
|
|
253
|
httpPut.setEntity(se);
|
|
254
|
}
|
|
255
|
CloseableHttpResponse response = null;
|
|
256
|
try {
|
|
257
|
log.debug("执行PUT请求:url= " + url + ",参数= " + JSONObject.toJSONString(paramsMap));
|
|
258
|
response = (CloseableHttpResponse) httpClient.execute(httpPut);
|
|
259
|
} catch (Exception e) {
|
|
260
|
log.error("sendPut Exception: " + e.getMessage());
|
|
261
|
return "{}";
|
|
262
|
}
|
|
263
|
|
|
264
|
return responseEx(httpClient, response, encoding);
|
|
265
|
}
|
|
266
|
|
|
267
|
private static String responseEx(HttpClient httpClient, CloseableHttpResponse response, Charset encoding) {
|
|
268
|
String resp = "";
|
|
269
|
try {
|
|
270
|
if (response == null) {
|
|
271
|
resp = "{}";
|
|
272
|
log.error("请求执行失败,无返回信息");
|
|
273
|
} else if (200 != response.getStatusLine().getStatusCode()) {
|
|
274
|
resp = "{}";
|
|
275
|
log.error("请求执行失败,状态码=" + response.getStatusLine().getStatusCode() + ",返回信息="
|
|
276
|
+ EntityUtils.toString(response.getEntity(), encoding));
|
|
277
|
} else {
|
|
278
|
log.debug("请求执行成功");
|
|
279
|
resp = EntityUtils.toString(response.getEntity(), encoding);
|
|
280
|
}
|
|
281
|
} catch (Exception e) {
|
|
282
|
log.error("responseEx Exception: " + e.getMessage());
|
|
283
|
} finally {
|
|
284
|
if (response != null) {
|
|
285
|
try {
|
|
286
|
response.close();
|
|
287
|
} catch (Exception e) {
|
|
288
|
log.error("responseEx Exception: " + e.getMessage());
|
|
289
|
}
|
|
290
|
}
|
|
291
|
}
|
|
292
|
return resp;
|
|
293
|
}
|
|
294
|
|
|
295
|
}
|
|
@ -0,0 +1,33 @@
|
|
1
|
package com.ai.bss.security.protection.utils;
|
|
2
|
|
|
3
|
/**
|
|
4
|
* @Auther: 王超
|
|
5
|
* @Date: 2020/12/30 13:57
|
|
6
|
* @Description:
|
|
7
|
*/
|
|
8
|
public class IDUtils {
|
|
9
|
|
|
10
|
private static byte[] lock = new byte[0];
|
|
11
|
|
|
12
|
// 位数,默认是8位
|
|
13
|
private final static long w = 100000000;
|
|
14
|
|
|
15
|
|
|
16
|
/**
|
|
17
|
* 创建不重复id
|
|
18
|
* @param
|
|
19
|
* timeSub 时间戳一共13位,截取前端的不需要的位数
|
|
20
|
* randSub 生成随机数一共9位,截取前端的不需要的位数
|
|
21
|
*
|
|
22
|
*/
|
|
23
|
public static String createID(int timeSub,int randSub) {
|
|
24
|
long r = 0;
|
|
25
|
synchronized (lock) {
|
|
26
|
r = (long) ((Math.random() + 1) * w);
|
|
27
|
}
|
|
28
|
long timeMillis = System.currentTimeMillis();
|
|
29
|
String time = String.valueOf(timeMillis);
|
|
30
|
return time.substring(timeSub) + String.valueOf(r).substring(randSub);
|
|
31
|
}
|
|
32
|
|
|
33
|
}
|
|
@ -0,0 +1,12 @@
|
|
1
|
#\u5317\u5411\u767b\u5f55\u8d26\u53f7\u548c\u5bc6\u7801
|
|
2
|
aap.iot.userCode=IOT_ADMIN
|
|
3
|
aap.iot.passWord=123456
|
|
4
|
|
|
5
|
#iot\u7684\u5317\u5411\u63a5\u53e3\u6ce8\u518c\u5730\u5740
|
|
6
|
#url.iot.login=http://60.205.219.67:80/sso/login
|
|
7
|
url.iot.login=http://47.105.130.83:80/sso/login
|
|
8
|
|
|
9
|
#iot\u7684\u5317\u5411\u63a5\u53e3\u7edf\u4e00\u5730\u5740
|
|
10
|
#url.iot.service=http://60.205.219.67:80/dmp/terminalNorthApi/
|
|
11
|
url.iot.service=http://47.105.130.83:80/dmp/terminalNorthApi/
|
|
12
|
|
|
@ -0,0 +1,21 @@
|
|
1
|
#minio
|
|
2
|
minio.endpoint=http://10.19.90.34
|
|
3
|
minio.port=19000
|
|
4
|
minio.accessKey=minioadmin
|
|
5
|
minio.secretKey=minioadmin
|
|
6
|
minio.secure=false
|
|
7
|
minio.faceAddServiceUrl=http://10.21.10.28:9018/api/face/add
|
|
8
|
minio.face-del-service-url=http://10.21.10.28:9018/api/face/del
|
|
9
|
minio.face-recog-service-url=http://10.21.10.28:9018/api/face/recog
|
|
10
|
|
|
11
|
# \u4eba\u8138\u8bc6\u522b
|
|
12
|
minio.bucketHeaderImage=prod-dev
|
|
13
|
|
|
14
|
# \u8bbe\u5907\u9ed8\u8ba4\u7167\u7247
|
|
15
|
spminio.bucketToolImage=tool-image
|
|
16
|
# \u76d1\u63a7\u89c6\u9891
|
|
17
|
spminio.bucketAiVideo=ai-video
|
|
18
|
# \u76d1\u63a7\u89c6\u9891\u622a\u56fe
|
|
19
|
spminio.bucketAiImage=ai-image
|
|
20
|
# \u76d1\u63a7\u89c6\u9891\u622a\u56fe
|
|
21
|
spminio.bucketM3U8=m3u8-index
|
|
@ -46,26 +46,6 @@ kafka.listener.batch-listener=false
|
46
|
46
|
kafka.listener.concurrencys=3,6
|
47
|
47
|
kafka.listener.poll-timeout=1500
|
48
|
48
|
|
49
|
|
#minio
|
50
|
|
minio.endpoint=http://10.19.90.34
|
51
|
|
minio.port=19000
|
52
|
|
minio.accessKey=minioadmin
|
53
|
|
minio.secretKey=minioadmin
|
54
|
|
minio.secure=false
|
55
|
|
minio.faceAddServiceUrl=http://10.21.10.28:9018/api/face/add
|
56
|
|
minio.face-del-service-url=http://10.21.10.28:9018/api/face/del
|
57
|
|
minio.face-recog-service-url=http://10.21.10.28:9018/api/face/recog
|
58
|
|
|
59
|
|
# \u4eba\u8138\u8bc6\u522b
|
60
|
|
minio.bucketHeaderImage=prod-dev
|
61
|
|
|
62
|
|
# \u8bbe\u5907\u9ed8\u8ba4\u7167\u7247
|
63
|
|
spminio.bucketToolImage=tool-image
|
64
|
|
# \u76d1\u63a7\u89c6\u9891
|
65
|
|
spminio.bucketAiVideo=ai-video
|
66
|
|
# \u76d1\u63a7\u89c6\u9891\u622a\u56fe
|
67
|
|
spminio.bucketAiImage=ai-image
|
68
|
|
|
69
|
49
|
|
70
|
50
|
# CACHE
|
71
|
51
|
#spring.cache.type=ehcache
|
|
@ -87,3 +67,12 @@ spring.servlet.multipart.resolve-lazily=false
|
87
|
67
|
# LOGGING
|
88
|
68
|
logging.level.com.ai=debug
|
89
|
69
|
logging.level.org.springframework.data=debug
|
|
70
|
|
|
71
|
uspa.login.url=http://10.19.90.34:20000/usermng/login
|
|
72
|
uspa.login.vercode=Hiz#8uAqkjhoPmXu8%aaa
|
|
73
|
|
|
74
|
uspa.login.menuUrl=http://10.19.90.34:20000/usermng/process/com.wframe.usermanager.services.impl.QueryMenuByUser
|
|
75
|
|
|
76
|
|
|
77
|
# \u5f15\u5165minio\u548ciot\u7684\u914d\u7f6e\u6587\u4ef6
|
|
78
|
spring.profiles.active=iot,minio
|
|
@ -0,0 +1,81 @@
|
|
1
|
#\u7cfb\u7edf\u57df
|
|
2
|
SYSTEM_DOMAIN=LOGIN_CACHE_ROUTE
|
|
3
|
|
|
4
|
#------------------------------cookie\u914d\u7f6e-------------#
|
|
5
|
##COOKIE\u7684\u6709\u6548\u57df,\u4e0d\u8bbe\u7f6e\uff0c\u5219\u81ea\u52a8\u8bbe\u7f6e
|
|
6
|
#COOKIE_DOMAIN=crm.chinapost.yw.com
|
|
7
|
|
|
8
|
COOKIE_PATH=/
|
|
9
|
|
|
10
|
##Session \u8d85\u65f6\u65f6\u95f4(\u79d2)
|
|
11
|
SESSION_TIMEOUT=3600
|
|
12
|
COOKIE_MAXAGE=-1
|
|
13
|
|
|
14
|
|
|
15
|
TENANT_REGISTER_CLASS=com.ai.customermanager.services.impl.CustRegisterVercodeImpl
|
|
16
|
|
|
17
|
|
|
18
|
##\u8fdc\u7a0b\u7f13\u5b58\u8c03\u7528\u7c7b\uff0c\u8fd9\u4e2a\u7c7b\u5fc5\u987b\u6709\u4e09\u4e2a\u51fd\u6570
|
|
19
|
## public boolean set(String key,String value)
|
|
20
|
## public String get(String key)
|
|
21
|
## public boolean del(String key);
|
|
22
|
COOKIE_CACHE_CLASS=com.ai.sso.util.SessionRedisCache
|
|
23
|
|
|
24
|
LOGGING_INTERFACE_CLASS=com.wframe.baseinfo.util.BaseInfoUtil
|
|
25
|
|
|
26
|
##COOKIE_IS_CACHE \u662f\u5426\u7f13\u5b58\u5230\u8fdc\u7aef\u3002
|
|
27
|
COOKIE_IS_CACHE=1
|
|
28
|
|
|
29
|
|
|
30
|
##IS_CHECK_LOGIN \u662f\u5426\u68c0\u67e5\u767b\u9646\u3002
|
|
31
|
IS_CHECK_LOGIN=1
|
|
32
|
|
|
33
|
|
|
34
|
LOGIN_SERVICE=uspa_IOrgmodelClientCSV_loginIn
|
|
35
|
LOGINNOPASS_SERVICE=uspa_IOrgmodelClientCSV_loginWithNoPassword
|
|
36
|
|
|
37
|
|
|
38
|
Access-Control-Allow-origin=http://crm.chinapost.yw.com:18080/
|
|
39
|
|
|
40
|
##\u68c0\u67e5SesisonId,sign \u662f\u5426\u6b63\u786e
|
|
41
|
SESSION_CHECK_SIGN=com.ai.sso.util.SessionCheckSign
|
|
42
|
SESSION_CHECK_LOGIN=com.ai.sso.util.SessionCheckLogin
|
|
43
|
#redis
|
|
44
|
|
|
45
|
##MAIN_PAGE
|
|
46
|
#MAIN_PAGE=http://crm.chinapost.com:18880/
|
|
47
|
##RETURN TAG \u8fd4\u56de\u5b57\u7b26\u4e32
|
|
48
|
|
|
49
|
RETURN_TAG={"MESSAGE":"NOLOGIN","CODE":999999,"FLAG":"FAIL","RESULT":{"URL":"http://crm.chinapost.yw.com:18080/"}}
|
|
50
|
#RETURN_TAG=<html><script language="javascript"> function init(){ if(window.parent!=null) { window.parent.location.href ="http://crm.chinapost.com:18880"; } else window.location.href ="http://crm.chinapost.com:18880"; } </script><body onload="init()"></body></html>
|
|
51
|
|
|
52
|
|
|
53
|
|
|
54
|
#redis.single=10.11.20.117:6379
|
|
55
|
#redis.password=luMZulgbotmo71aa
|
|
56
|
redis.single=10.19.90.34:6379
|
|
57
|
redis.password=Ipu@321!
|
|
58
|
|
|
59
|
redis.pool.maxTotal=1000
|
|
60
|
redis.pool.minIdle=5
|
|
61
|
redis.pool.maxIdle=100
|
|
62
|
redis.pool.testOnBorrow=false
|
|
63
|
redis.pool.maxWait=5000
|
|
64
|
redis.pool.testOnReturn=true
|
|
65
|
redis.pool.testWhileIdle=true
|
|
66
|
redis.pool.timeBetweenEvictionRunsMillis=10000
|
|
67
|
|
|
68
|
|
|
69
|
SESSION_DEFAULT_VERCODE=Hiz#8uAqkjhoPmXu8%aaa
|
|
70
|
|
|
71
|
#\u662f\u5426\u8fdb\u884c\u63a5\u53e3\u6743\u9650\u63a7\u5236 1 \u8fdb\u884c\u63a5\u53e3\u6743\u9650\u63a7\u5236
|
|
72
|
is_check_interface=0
|
|
73
|
|
|
74
|
|
|
75
|
#BJYM\u4f7f\u7528
|
|
76
|
#USER_LOGIN_AUTH_CLASS=com.wframe.msgmanager.services.impl.UserLoginAuth4TestImpl
|
|
77
|
##\u5c0f\u7a0b\u5e8f\u4f7f\u7528
|
|
78
|
USER_LOGIN_AUTH_CLASS=com.wframe.usermanager.services.impl.UserLoginAuthImpl
|
|
79
|
#USER_LOGIN_AUTH_CLASS=com.wframe.msgmanager.services.impl.UserLoginByTokenImpl
|
|
80
|
#USER_LOGIN_AUTH_CLASS=com.wframe.msgmanager.services.impl.UserLoginByToken4XblImpl
|
|
81
|
SIGN_KEY_CODE=TENANT_CODE
|