Ver Código Fonte

Merge remote-tracking branch 'origin/master'

wangchao 4 anos atrás
pai
commit
1a8e2463b5
19 arquivos alterados com 729 adições e 139 exclusões
  1. 67 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/controller/HomePageController.java
  2. 129 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/controller/MonitorVideoLogManageController.java
  3. 10 1
      security-protection-service/src/main/java/com/ai/bss/security/protection/controller/ResourceToolManageController.java
  4. 21 1
      security-protection-service/src/main/java/com/ai/bss/security/protection/controller/UploadFileController.java
  5. 5 3
      security-protection-service/src/main/java/com/ai/bss/security/protection/model/SecurityProtectionMinioConfig.java
  6. 104 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/HomePageServiceImpl.java
  7. 55 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/MonitorVideoLogManageServiceImpl.java
  8. 44 10
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/ResourceToolManageServiceImpl.java
  9. 29 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/UploadFileServiceImpl.java
  10. 31 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/HomePageService.java
  11. 55 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/MonitorVideoLogManageService.java
  12. 16 5
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/ResourceToolManageService.java
  13. 17 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/UploadFileService.java
  14. 0 54
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/AIAlarmKafkaTask.java
  15. 0 54
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/AIAttendanceKafkaTask.java
  16. 50 6
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/AIResultRecordKafkaTask.java
  17. 70 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/AIVideoKafkaTask.java
  18. 15 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/utils/EbcConstant.java
  19. 11 5
      security-protection-service/src/main/resources/application.properties

+ 67 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/HomePageController.java

@ -0,0 +1,67 @@
1
package com.ai.bss.security.protection.controller;
2
3
import java.util.HashMap;
4
import java.util.List;
5
import java.util.Map;
6
7
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.stereotype.Controller;
9
import org.springframework.web.bind.annotation.RequestMapping;
10
import org.springframework.web.bind.annotation.ResponseBody;
11
12
import com.ai.abc.api.model.CommonResponse;
13
import com.ai.bss.security.protection.service.interfaces.HomePageService;
14
import com.ai.bss.security.protection.utils.DateUtil;
15
16
/**
17
 * 首页报表
18
 * @author konghl@asiainfo.com
19
 * 2020-12-15
20
 */
21
@Controller
22
@RequestMapping("/homePage")
23
public class HomePageController {
24
25
	@Autowired
26
	HomePageService homePageService;
27
28
	/**
29
	 * 获取当日出勤数据
30
	 * @return
31
	 * @throws Exception
32
	 */
33
	@ResponseBody
34
	@RequestMapping("/queryAttendanceChart")
35
	public CommonResponse<Map<String, Object>> queryAttendanceChart() throws Exception {
36
		Map<String, Object> resutList = homePageService.queryAttendanceChart();
37
		return CommonResponse.ok(resutList);
38
	}
39
40
	/**
41
	 * 获取所有的告警分析数据
42
	 * @return
43
	 * @throws Exception
44
	 */
45
	@ResponseBody
46
	@RequestMapping("/queryAlarmAnalysisChart")
47
	public CommonResponse<List<Map<String, Object>>> queryAlarmAnalysisChart() throws Exception {
48
		Map<String, String> params = new HashMap<String, String>();
49
50
		return homePageService.queryAlarmAnalysisList(params, 5);
51
	}
52
53
	/**
54
	 * 获取近24小时的告警分析数据
55
	 * @return
56
	 * @throws Exception
57
	 */
58
	@ResponseBody
59
	@RequestMapping("/queryAlarmAnalysisTopList")
60
	public CommonResponse<List<Map<String, Object>>> queryAlarmAnalysisTopList() throws Exception {
61
		Map<String, String> params = new HashMap<String, String>();
62
		params.put("beginTime", DateUtil.dateAddDay(DateUtil.getSysDateTime(), -1));
63
		params.put("endTime", DateUtil.getSysDateTime());
64
65
		return homePageService.queryAlarmAnalysisList(params, 4);
66
	}
67
}

+ 129 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/MonitorVideoLogManageController.java

@ -0,0 +1,129 @@
1
package com.ai.bss.security.protection.controller;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.apache.commons.lang.StringUtils;
7
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.stereotype.Controller;
9
import org.springframework.web.bind.annotation.ModelAttribute;
10
import org.springframework.web.bind.annotation.RequestBody;
11
import org.springframework.web.bind.annotation.RequestMapping;
12
import org.springframework.web.bind.annotation.RequestParam;
13
import org.springframework.web.bind.annotation.ResponseBody;
14
15
import com.ai.abc.api.model.CommonResponse;
16
import com.ai.bss.security.protection.model.AttendanceReport;
17
import com.ai.bss.security.protection.service.interfaces.MonitorVideoLogManageService;
18
import com.ai.bss.security.protection.utils.DateUtil;
19
import com.ai.bss.work.safety.model.MonitorVideoLog;
20
21
/**
22
 * 监控视频日志管理
23
 * @author konghl@asiainfo.com
24
 * 2020-12-10
25
 */
26
@Controller
27
@RequestMapping("/monitorVideoLog")
28
public class MonitorVideoLogManageController {
29
30
	@Autowired
31
	private MonitorVideoLogManageService monitorVideoLogManageService;
32
33
	/**
34
	 * 查询监控视频日志(按时间段)
35
	 * @param attendanceReport
36
	 * @return
37
	 * @throws Exception
38
	 */
39
	@ResponseBody
40
	@RequestMapping("/queryMonitorVideoLog")
41
	public CommonResponse<List<MonitorVideoLog>> queryMonitorVideoLog(@ModelAttribute AttendanceReport attendanceReport)
42
			throws Exception {
43
		MonitorVideoLog monitorVideoLogCondition = new MonitorVideoLog();
44
		monitorVideoLogCondition.setResourceToolId(attendanceReport.getId());
45
		monitorVideoLogCondition.setBeginTime(DateUtil.convertDate(attendanceReport.getBeginDay()));
46
		monitorVideoLogCondition.setEndTime(DateUtil.convertDate(attendanceReport.getEndDay()));
47
48
		return monitorVideoLogManageService.queryMonitorVideoLogByTime(monitorVideoLogCondition);
49
	}
50
51
	/**
52
	 * 查询单个监控视频日志
53
	 * @param resourceToolId
54
	 * @return
55
	 * @throws Exception
56
	 */
57
	@ResponseBody
58
	@RequestMapping("/queryOneMonitorVideoLog")
59
	public CommonResponse<MonitorVideoLog> queryOneMonitorVideoLog(@RequestParam String monitorVideoLogId)
60
			throws Exception {
61
		if (StringUtils.isEmpty(monitorVideoLogId)) {
62
			return CommonResponse.fail("500", "操作失败");
63
		}
64
65
		return monitorVideoLogManageService.queryMonitorVideoLogById(Long.valueOf(monitorVideoLogId));
66
	}
67
68
	/**
69
	 * 创建监控视频日志
70
	 * @param monitorVideoLog
71
	 * @return
72
	 * @throws Exception
73
	 */
74
	@ResponseBody
75
	@RequestMapping("/createMonitorVideoLog")
76
	public CommonResponse<MonitorVideoLog> createMonitorVideoLog(@RequestBody MonitorVideoLog monitorVideoLog)
77
			throws Exception {
78
		if (monitorVideoLog == null || StringUtils.isEmpty(monitorVideoLog.getVideoUrl())
79
				|| StringUtils.isEmpty(monitorVideoLog.getResourceToolId())) {
80
			return CommonResponse.fail("500", "新增失败");
81
		}
82
83
		return monitorVideoLogManageService.createMonitorVideoLog(monitorVideoLog);
84
	}
85
86
	/**
87
	 * 修改监控视频日志
88
	 * @param resourceTool
89
	 * @return
90
	 * @throws Exception
91
	 */
92
	@ResponseBody
93
	@RequestMapping("/modifyMonitorVideoLog")
94
	public CommonResponse<MonitorVideoLog> modifyMonitorVideoLog(@RequestBody MonitorVideoLog monitorVideoLog)
95
			throws Exception {
96
		if (monitorVideoLog == null || monitorVideoLog.getMonitorVideoLogId() == null
97
				|| StringUtils.isEmpty(monitorVideoLog.getVideoUrl())
98
				|| StringUtils.isEmpty(monitorVideoLog.getResourceToolId())) {
99
			return CommonResponse.fail("500", "修改失败");
100
		}
101
102
		return monitorVideoLogManageService.modifyMonitorVideoLog(monitorVideoLog);
103
	}
104
105
	/**
106
	 * 删除设备视频记录
107
	 * @param resourceToolId
108
	 * @return
109
	 * @throws Exception
110
	 */
111
	@ResponseBody
112
	@RequestMapping("/deleteMonitorVideoLog")
113
	public CommonResponse<Void> deleteMonitorVideoLog(@RequestParam String monitorVideoLogId) throws Exception {
114
		if (StringUtils.isEmpty(monitorVideoLogId)) {
115
			return CommonResponse.fail("500", "删除失败");
116
		}
117
118
		String[] monitorSceneIdArray = monitorVideoLogId.split(",");
119
		List<Long> monitorVideoLogIdList = new ArrayList<Long>();
120
		for (String monitorSceneIdString : monitorSceneIdArray) {
121
			if (!StringUtils.isBlank(monitorSceneIdString)) {
122
				monitorVideoLogIdList.add(Long.valueOf(monitorSceneIdString));
123
			}
124
		}
125
126
		return monitorVideoLogManageService.deleteMonitorVideoLog(monitorVideoLogIdList);
127
	}
128
129
}

+ 10 - 1
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/ResourceToolManageController.java

@ -8,6 +8,7 @@ import java.util.Map;
8 8
import org.apache.commons.lang.StringUtils;
9 9
import org.springframework.beans.factory.annotation.Autowired;
10 10
import org.springframework.stereotype.Controller;
11
import org.springframework.util.CollectionUtils;
11 12
import org.springframework.web.bind.annotation.ModelAttribute;
12 13
import org.springframework.web.bind.annotation.RequestBody;
13 14
import org.springframework.web.bind.annotation.RequestMapping;
@ -22,6 +23,8 @@ import com.ai.bss.security.protection.service.interfaces.ResourceToolManageServi
22 23
import com.ai.bss.security.protection.utils.EbcConstant;
23 24
import com.ai.bss.work.tool.model.ResourceTool;
24 25
26
import edu.umd.cs.findbugs.annotations.ReturnValuesAreNonnullByDefault;
27
25 28
/**
26 29
 * 设备管理
27 30
 * @author konghl@asiainfo.com
@ -82,7 +85,13 @@ public class ResourceToolManageController {
82 85
			return CommonResponse.fail("500", "操作失败");
83 86
		}
84 87
85
		return ResourceToolManageService.queryOneResourceTool(resourceToolId);
88
		Map<String, Object> resultMap= ResourceToolManageService.queryResourceToolById(resourceToolId);
89
		
90
		if (resultMap==null) {
91
			return CommonResponse.fail("504", "获取设备信息失败");
92
		}
93
		
94
		return CommonResponse.ok(resultMap);
86 95
	}
87 96
88 97
	/**

+ 21 - 1
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/UploadFileController.java

@ -1,8 +1,11 @@
1 1
package com.ai.bss.security.protection.controller;
2 2
3
import java.util.List;
4
3 5
import org.apache.commons.lang.StringUtils;
4 6
import org.springframework.beans.factory.annotation.Autowired;
5 7
import org.springframework.stereotype.Controller;
8
import org.springframework.util.CollectionUtils;
6 9
import org.springframework.web.bind.annotation.RequestMapping;
7 10
import org.springframework.web.bind.annotation.RequestParam;
8 11
import org.springframework.web.bind.annotation.ResponseBody;
@ -18,7 +21,7 @@ public class UploadFileController {
18 21
	private UploadFileService uploadFileService;
19 22
20 23
	/**
21
	 * 上传设备照片
24
	 * 获取单个文件地址
22 25
	 * @param meFile
23 26
	 * @return
24 27
	 * @throws Exception
@ -35,4 +38,21 @@ public class UploadFileController {
35 38
		return CommonResponse.ok(minioFileUrl);
36 39
	}
37 40
41
	/**
42
	 * 获取多个文件地址
43
	 * @param meFile
44
	 * @return
45
	 * @throws Exception
46
	 */
47
	@ResponseBody
48
	@RequestMapping("/getListFileUrl")
49
	public CommonResponse<List<String>> getListFileUrl(@RequestParam List<String> fileNameList) throws Exception {
50
		if (CollectionUtils.isEmpty(fileNameList)) {
51
			return CommonResponse.fail("501", "获取失败");
52
		}
53
54
		List<String> minioFileUrlList = uploadFileService.getFileUrlForList(fileNameList);
55
56
		return CommonResponse.ok(minioFileUrlList);
57
	}
38 58
}

+ 5 - 3
security-protection-service/src/main/java/com/ai/bss/security/protection/model/SecurityProtectionMinioConfig.java

@ -14,11 +14,13 @@ import lombok.Data;
14 14
15 15
@Data
16 16
@Component
17
@ConfigurationProperties(prefix = "myminio")
17
@ConfigurationProperties(prefix = "spminio")
18 18
public class SecurityProtectionMinioConfig {
19 19
20
	private String bucketWorkToolImage;
20
	private String bucketToolImage;
21 21
22
	private String bucketWorkToolView;
22
	private String bucketAiVideo;
23
	
24
	private String bucketAiImage;
23 25
24 26
}

+ 104 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/HomePageServiceImpl.java

@ -0,0 +1,104 @@
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.springframework.beans.factory.annotation.Autowired;
9
import org.springframework.stereotype.Service;
10
import org.springframework.util.CollectionUtils;
11
12
import com.ai.abc.api.model.CommonRequest;
13
import com.ai.abc.api.model.CommonResponse;
14
import com.ai.bss.security.protection.service.interfaces.CharSpecService;
15
import com.ai.bss.security.protection.service.interfaces.HomePageService;
16
import com.ai.bss.security.protection.utils.EbcConstant;
17
import com.ai.bss.work.attendance.service.api.AttendanceChartQuery;
18
import com.ai.bss.work.safety.service.api.AiTaskQuery;
19
20
@Service
21
public class HomePageServiceImpl implements HomePageService {
22
23
	@Autowired
24
	private AttendanceChartQuery attendanceChartQuery;
25
26
	@Autowired
27
	private AiTaskQuery aiTaskQuery;
28
29
	@Autowired
30
	private CharSpecService charSpecService;
31
32
	@Override
33
	public Map<String, Object> queryAttendanceChart() throws Exception {
34
		CommonRequest<Void> request = new CommonRequest<Void>(null);
35
		CommonResponse<Map<String, Integer>> Response = attendanceChartQuery.queryAttendanceChart(request);
36
37
		int totalNum = Response.getData().get("workEmployeeSize");
38
		int attendanceNum = Response.getData().get("currentDayAttendanceSize");
39
		int leaveNum = Response.getData().get("currentDayLeaveSize");
40
		int absenteeismNum = totalNum - attendanceNum - leaveNum;
41
		absenteeismNum = absenteeismNum < 0 ? 0 : absenteeismNum;
42
43
		Map<String, Object> resultMap = new HashMap<String, Object>();
44
		List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
45
46
		Map<String, Object> attendanceMap = new HashMap<String, Object>();
47
		attendanceMap.put("value", attendanceNum);
48
		attendanceMap.put("name", "在岗");
49
		dataList.add(attendanceMap);
50
51
		Map<String, Object> absenteeismMap = new HashMap<String, Object>();
52
		absenteeismMap.put("value", absenteeismNum);
53
		absenteeismMap.put("name", "缺勤");
54
		dataList.add(absenteeismMap);
55
56
		Map<String, Object> leaveMap = new HashMap<String, Object>();
57
		leaveMap.put("value", leaveNum);
58
		leaveMap.put("name", "请假");
59
		dataList.add(leaveMap);
60
61
		resultMap.put("totalSize", totalNum);
62
		resultMap.put("dataList", dataList);
63
		return resultMap;
64
	}
65
66
	@Override
67
	public CommonResponse<List<Map<String, Object>>> queryAlarmAnalysisList(Map<String, String> params, int dataSize)
68
			throws Exception {
69
		CommonRequest<Map<String, String>> request = new CommonRequest<Map<String, String>>(params);
70
		CommonResponse<List<Map<String, Object>>> response = aiTaskQuery.safetyAlarmAnalysis(request);
71
72
		if (CollectionUtils.isEmpty(response.getData())) {
73
			return CommonResponse.ok(new ArrayList<Map<String, Object>>());
74
		}
75
76
		Map<String, String> allAiAlarmTypeMap = charSpecService.getCharSpecMap(EbcConstant.BUSINESS_SPEC_AI_ALARM_TYPE);
77
78
		List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
79
		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());
82
			if (i >= dataSize) {
83
				// 其他
84
				otherNum += num;
85
				continue;
86
			}
87
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);
92
		}
93
94
		if (otherNum > 0) {
95
			Map<String, Object> dataMap = new HashMap<String, Object>();
96
			dataMap.put("value", otherNum);
97
			dataMap.put("name", "其他");
98
			resultList.add(dataMap);
99
		}
100
101
		return CommonResponse.ok(resultList);
102
	}
103
104
}

+ 55 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/MonitorVideoLogManageServiceImpl.java

@ -0,0 +1,55 @@
1
package com.ai.bss.security.protection.service.impl;
2
3
import java.util.List;
4
5
import org.springframework.beans.factory.annotation.Autowired;
6
import org.springframework.stereotype.Service;
7
8
import com.ai.abc.api.model.CommonRequest;
9
import com.ai.abc.api.model.CommonResponse;
10
import com.ai.bss.security.protection.service.interfaces.MonitorVideoLogManageService;
11
import com.ai.bss.work.safety.model.MonitorVideoLog;
12
import com.ai.bss.work.safety.service.api.MonitorSceneCommand;
13
import com.ai.bss.work.safety.service.api.MonitorSceneQuery;
14
15
@Service
16
public class MonitorVideoLogManageServiceImpl implements MonitorVideoLogManageService {
17
18
	@Autowired
19
	private MonitorSceneQuery monitorSceneQuery;
20
21
	@Autowired
22
	private MonitorSceneCommand monitorSceneCommand;
23
24
	@Override
25
	public CommonResponse<List<MonitorVideoLog>> queryMonitorVideoLogByTime(MonitorVideoLog monitorVideoLogCondition)
26
			throws Exception {
27
		CommonRequest<MonitorVideoLog> request = new CommonRequest<MonitorVideoLog>(monitorVideoLogCondition);
28
		return monitorSceneQuery.queryMonitorVideoLogByTime(request);
29
	}
30
31
	@Override
32
	public CommonResponse<MonitorVideoLog> queryMonitorVideoLogById(Long monitorVideoLogId) throws Exception {
33
		CommonRequest<Long> request = new CommonRequest<Long>(monitorVideoLogId);
34
		return monitorSceneQuery.loadMonitorVideoLog(request);
35
	}
36
37
	@Override
38
	public CommonResponse<MonitorVideoLog> createMonitorVideoLog(MonitorVideoLog monitorVideoLog) throws Exception {
39
		CommonRequest<MonitorVideoLog> request = new CommonRequest<MonitorVideoLog>(monitorVideoLog);
40
		return monitorSceneCommand.createMonitorVideoLog(request);
41
	}
42
43
	@Override
44
	public CommonResponse<MonitorVideoLog> modifyMonitorVideoLog(MonitorVideoLog monitorVideoLog) throws Exception {
45
		CommonRequest<MonitorVideoLog> request = new CommonRequest<MonitorVideoLog>(monitorVideoLog);
46
		return monitorSceneCommand.modifyMonitorVideoLog(request);
47
	}
48
49
	@Override
50
	public CommonResponse<Void> deleteMonitorVideoLog(List<Long> monitorVideoLogIdList) throws Exception {
51
		CommonRequest<List<Long>> request = new CommonRequest<List<Long>>(monitorVideoLogIdList);
52
		return monitorSceneCommand.deleteMonitorVideoLog(request);
53
	}
54
55
}

+ 44 - 10
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/ResourceToolManageServiceImpl.java

@ -89,19 +89,25 @@ public class ResourceToolManageServiceImpl implements ResourceToolManageService
89 89
	}
90 90
91 91
	@Override
92
	public CommonResponse<Map<String, Object>> queryOneResourceTool(String resourceToolId) throws Exception {
92
	public Map<String, Object> queryResourceToolById(String resourceToolId) throws Exception {
93
		if (StringUtils.isEmpty(resourceToolId)) {
94
			return null;
95
		}
96
93 97
		HashMap<String, Object> params = new HashMap<String, Object>();
94 98
		// 查询监控设备
95 99
		params.put("isMonitorSceneTool", "1");
96 100
		params.put("resourceToolId", resourceToolId);
101
97 102
		CommonRequest<HashMap<String, Object>> conditionMap = new CommonRequest<HashMap<String, Object>>(params, 1, 10);
98 103
		CommonResponse<PageBean<Map<String, Object>>> response = resourceToolQuery
99 104
				.queryWorkToolByConditions(conditionMap);
100 105
101 106
		if (CollectionUtils.isEmpty(response.getData().getData())
102 107
				|| CollectionUtils.isEmpty(response.getData().getData().get(0))) {
103
			return CommonResponse.fail("504", "获取设备信息失败");
108
			return null;
104 109
		}
110
105 111
		Map<String, Object> resultMap = response.getData().getData().get(0);
106 112
107 113
		List<CharacteristicSpecValue> characteristicSpecList = charSpecService
@ -117,16 +123,44 @@ public class ResourceToolManageServiceImpl implements ResourceToolManageService
117 123
			resultMap.put("isExistPicture", "0");
118 124
		} else {
119 125
			String toolPictureUrl = uploadFileService.getFileUrl(resultMap.get("pictureUrl").toString(),
120
					minioConfig.getBucketWorkToolImage());
126
					minioConfig.getBucketToolImage());
121 127
			resultMap.put("toolPictureUrl", toolPictureUrl);
122 128
			resultMap.put("isExistPicture", "1");
123 129
		}
124 130
125
		return CommonResponse.ok(resultMap);
131
		return resultMap;
126 132
	}
127 133
128 134
	@Override
129
	public CommonResponse<ResourceTool> createResourceTool(ResourceTool resourceTool) {
135
	public Map<String, Object> queryResourceToolByCode(String resourceToolCode) throws Exception {
136
		if (StringUtils.isEmpty(resourceToolCode)) {
137
			return null;
138
		}
139
140
		HashMap<String, Object> params = new HashMap<String, Object>();
141
		// 查询监控设备
142
		params.put("isMonitorSceneTool", "1");
143
		params.put("resourceToolCode", resourceToolCode);
144
145
		CommonRequest<HashMap<String, Object>> conditionMap = new CommonRequest<HashMap<String, Object>>(params, 1, 10);
146
		CommonResponse<PageBean<Map<String, Object>>> response = resourceToolQuery
147
				.queryWorkToolByConditions(conditionMap);
148
149
		if (CollectionUtils.isEmpty(response.getData().getData())
150
				|| CollectionUtils.isEmpty(response.getData().getData().get(0))) {
151
			return null;
152
		}
153
154
		return response.getData().getData().get(0);
155
	}
156
157
	@Override
158
	public CommonResponse<ResourceTool> createResourceTool(ResourceTool resourceTool) throws Exception {
159
		Map<String, Object> resourceToolMap=queryResourceToolByCode(resourceTool.getResourceToolName());
160
		if (resourceToolMap!=null) {
161
			return CommonResponse.fail("502", "设备编号已存在");
162
		}
163
		
130 164
		if (StringUtils.isEmpty(resourceTool.getPictureUrl())) {
131 165
			resourceTool.setPictureUrl("#");
132 166
		}
@ -138,13 +172,13 @@ public class ResourceToolManageServiceImpl implements ResourceToolManageService
138 172
	}
139 173
140 174
	@Override
141
	public CommonResponse<ResourceTool> modifyResourceTool(ResourceTool resourceTool) {
175
	public CommonResponse<ResourceTool> modifyResourceTool(ResourceTool resourceTool) throws Exception  {
142 176
		CommonRequest<ResourceTool> request = new CommonRequest<ResourceTool>(resourceTool);
143 177
		return resourceToolCommand.saveWorkToolWithNoMapArea(request);
144 178
	}
145 179
146 180
	@Override
147
	public CommonResponse<Void> deleteResourceTool(List<String> resourceToolIds) {
181
	public CommonResponse<Void> deleteResourceTool(List<String> resourceToolIds) throws Exception  {
148 182
		CommonRequest<List<String>> request = new CommonRequest<List<String>>(resourceToolIds);
149 183
		CommonResponse<ResourceTool> response = resourceToolCommand.deleteWorkTool(request);
150 184
@ -159,14 +193,14 @@ public class ResourceToolManageServiceImpl implements ResourceToolManageService
159 193
	public Map<String, String> uploadResourceToolPicture(MultipartFile meFile, String pictureUrl) throws Exception {
160 194
		/*if (StringUtils.isNotBlank(pictureUrl) && !"#".equals(pictureUrl)) {
161 195
		 	//删除照片
162
			uploadFileService.removeFile(pictureUrl, minioConfig.getBucketWorkToolImage());
196
			uploadFileService.removeFile(pictureUrl, minioConfig.getBucketToolImage());
163 197
		}*/
164 198
165 199
		// 上传
166
		String minioFileName = uploadFileService.uploadFile(meFile, minioConfig.getBucketWorkToolImage());
200
		String minioFileName = uploadFileService.uploadFile(meFile, minioConfig.getBucketToolImage());
167 201
168 202
		// 获取照片的url地址
169
		String toolPictureUrl = uploadFileService.getFileUrl(minioFileName, minioConfig.getBucketWorkToolImage());
203
		String toolPictureUrl = uploadFileService.getFileUrl(minioFileName, minioConfig.getBucketToolImage());
170 204
171 205
		// 返回信息
172 206
		Map<String, String> resultMap = new HashMap<String, String>();

+ 29 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/UploadFileServiceImpl.java

@ -91,6 +91,34 @@ public class UploadFileServiceImpl implements UploadFileService {
91 91
	}
92 92
93 93
	@Override
94
	public List<String> getFileUrlForList(List<String> minioFileNameList) throws Exception {
95
		if (CollectionUtils.isEmpty(minioFileNameList)) {
96
			log.debug("批量获取文件的url为空");
97
			return null;
98
		}
99
100
		String minioFileName = minioFileNameList.get(0);
101
102
		return getFileUrlForList(minioFileNameList, getBucketName(minioFileName));
103
	}
104
105
	@Override
106
	public List<String> getFileUrlForList(List<String> minioFileNameList, String bucketName) throws Exception {
107
		if (CollectionUtils.isEmpty(minioFileNameList)) {
108
			log.debug("批量获取文件的url为空");
109
			return null;
110
		}
111
		if (StringUtils.isEmpty(bucketName)) {
112
			log.error("删除文件的桶为空");
113
			throw new NullPointerException("bucketName is null");
114
		}
115
116
		List<String> urlList = minioService.getObjectsUrl(bucketName, minioFileNameList);
117
118
		return urlList;
119
	}
120
121
	@Override
94 122
	public List<Map<String, Object>> getFileUrlForListMap(List<Map<String, Object>> minioFileListMap, String mapkey,
95 123
			String minioFileUrlKey) throws Exception {
96 124
		if (CollectionUtils.isEmpty(minioFileListMap)) {
@ -171,4 +199,5 @@ public class UploadFileServiceImpl implements UploadFileService {
171 199
172 200
		return bucketName;
173 201
	}
202
174 203
}

+ 31 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/HomePageService.java

@ -0,0 +1,31 @@
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
8
/**
9
 * 首页报表
10
 * @author konghl@asiainfo.com
11
 * 2020-12-15
12
 */
13
public interface HomePageService {
14
15
	/**
16
	 * 获取当日出勤数据
17
	 * @return
18
	 * @throws Exception
19
	 */
20
	Map<String, Object> queryAttendanceChart() throws Exception;
21
22
	/**
23
	 * 获取告警分析数据
24
	 * @param params
25
	 * @param dataSize
26
	 * @return
27
	 * @throws Exception
28
	 */
29
	CommonResponse<List<Map<String, Object>>> queryAlarmAnalysisList(Map<String, String> params, int dataSize)
30
			throws Exception;
31
}

+ 55 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/MonitorVideoLogManageService.java

@ -0,0 +1,55 @@
1
package com.ai.bss.security.protection.service.interfaces;
2
3
import java.util.List;
4
5
import com.ai.abc.api.model.CommonResponse;
6
import com.ai.bss.work.safety.model.MonitorVideoLog;
7
8
/**
9
 * 监控视频日志管理
10
 * @author konghl@asiainfo.com
11
 * 2020-12-15
12
 */
13
public interface MonitorVideoLogManageService {
14
15
	/**
16
	 * 按时间段查询监控视频日志
17
	 * @param monitorVideoLogCondition
18
	 * @return
19
	 * @throws Exception
20
	 */
21
	CommonResponse<List<MonitorVideoLog>> queryMonitorVideoLogByTime(MonitorVideoLog monitorVideoLogCondition)
22
			throws Exception;
23
24
	/**
25
	 * 根据视频日志ID查询监控视频日志
26
	 * @param monitorVideoLogId
27
	 * @return
28
	 * @throws Exception
29
	 */
30
	CommonResponse<MonitorVideoLog> queryMonitorVideoLogById(Long monitorVideoLogId) throws Exception;
31
32
	/**
33
	 * 创建监控视频日志
34
	 * @param monitorVideoLog
35
	 * @return
36
	 * @throws Exception
37
	 */
38
	CommonResponse<MonitorVideoLog> createMonitorVideoLog(MonitorVideoLog monitorVideoLog) throws Exception;
39
40
	/**
41
	 * 修改监控视频日志
42
	 * @param monitorVideoLog
43
	 * @return
44
	 * @throws Exception
45
	 */
46
	CommonResponse<MonitorVideoLog> modifyMonitorVideoLog(MonitorVideoLog monitorVideoLog) throws Exception;
47
48
	/**
49
	 * 删除设备视频记录
50
	 * @param monitorVideoLogIdList
51
	 * @return
52
	 * @throws Exception
53
	 */
54
	CommonResponse<Void> deleteMonitorVideoLog(List<Long> monitorVideoLogIdList) throws Exception;
55
}

+ 16 - 5
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/ResourceToolManageService.java

@ -36,32 +36,43 @@ public interface ResourceToolManageService {
36 36
	List<Map<String, String>> queryResourceToolType();
37 37
38 38
	/**
39
	 * 设备Id查询单个设备
39
	 * 根据设备Id设备Id查询设备
40 40
	 * @param resourceToolId
41 41
	 * @return
42 42
	 */
43
	CommonResponse<Map<String, Object>> queryOneResourceTool(String resourceToolId) throws Exception;
43
	Map<String, Object> queryResourceToolById(String resourceToolId) throws Exception;
44
45
	/**
46
	 * 根据设备CODE查询设备
47
	 * @param resourceToolCode
48
	 * @return
49
	 * @throws Exception
50
	 */
51
	Map<String, Object> queryResourceToolByCode(String resourceToolCode) throws Exception;
44 52
45 53
	/**
46 54
	 * 创建设备信息
47 55
	 * @param resourceTool
48 56
	 * @return
57
	 * @throws Exception
49 58
	 */
50
	CommonResponse<ResourceTool> createResourceTool(ResourceTool resourceTool);
59
	CommonResponse<ResourceTool> createResourceTool(ResourceTool resourceTool) throws Exception ;
51 60
52 61
	/**
53 62
	 * 修改设备信息
54 63
	 * @param resourceTool
55 64
	 * @return
65
	 * @throws Exception
56 66
	 */
57
	CommonResponse<ResourceTool> modifyResourceTool(ResourceTool resourceTool);
67
	CommonResponse<ResourceTool> modifyResourceTool(ResourceTool resourceTool) throws Exception ;
58 68
59 69
	/**
60 70
	 * 删除设备信息
61 71
	 * @param resourceToolIds
62 72
	 * @return
73
	 * @throws Exception
63 74
	 */
64
	CommonResponse<Void> deleteResourceTool(List<String> resourceToolIds);
75
	CommonResponse<Void> deleteResourceTool(List<String> resourceToolIds) throws Exception ;
65 76
66 77
	/**
67 78
	 * 上传设备照片

+ 17 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/UploadFileService.java

@ -31,6 +31,23 @@ public interface UploadFileService {
31 31
32 32
	/**
33 33
	 * 批量获取文件的url地址
34
	 * @param minioFileNameList minio文件标识集合
35
	 * @return
36
	 * @throws Exception
37
	 */
38
	List<String> getFileUrlForList(List<String> minioFileNameList) throws Exception;
39
40
	/**
41
	 * 批量获取文件的url地址
42
	 * @param minioFileNameList minio文件标识集合
43
	 * @param bucketName 存储文件的桶名(文件夹)
44
	 * @return
45
	 * @throws Exception
46
	 */
47
	List<String> getFileUrlForList(List<String> minioFileNameList, String bucketName) throws Exception;
48
49
	/**
50
	 * 批量获取文件的url地址
34 51
	 * @param minioFileListMap 数据列表
35 52
	 * @param mapkey 数据列表中minioFileName的key
36 53
	 * @param minioFileUrlKey 数据列表中minioFileUrl的key

+ 0 - 54
security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/AIAlarmKafkaTask.java

@ -1,54 +0,0 @@
1
package com.ai.bss.security.protection.service.task;
2
3
import org.apache.kafka.clients.consumer.ConsumerRecord;
4
import org.junit.Assert;
5
import org.springframework.beans.factory.annotation.Autowired;
6
import org.springframework.kafka.annotation.KafkaListener;
7
import org.springframework.kafka.support.Acknowledgment;
8
import org.springframework.stereotype.Component;
9
10
import com.ai.abc.api.model.CommonRequest;
11
import com.ai.abc.api.model.CommonResponse;
12
import com.ai.abc.util.JsonUtils;
13
import com.ai.bss.work.safety.model.AiIdenLog;
14
import com.ai.bss.work.safety.service.api.AiTaskCommand;
15
import com.alibaba.fastjson.JSON;
16
import com.alibaba.fastjson.TypeReference;
17
18
import lombok.extern.slf4j.Slf4j;
19
20
/**
21
 * 监控报警事件触发违规处理
22
 * @author konghl@asiainfo.com
23
 * 2020-12-14
24
 */
25
@Component
26
@Slf4j
27
public class AIAlarmKafkaTask {
28
29
	@Autowired
30
	private AiTaskCommand aiTaskCommand;
31
32
	@KafkaListener(containerFactory = "kafkaBatchListener3", topics = "${kafka.topic.aialarm:topic_ai_alarm}", groupId = "alarm_group")
33
	public void alarmListener(ConsumerRecord<String, String> records, Acknowledgment ack) throws Throwable {
34
		try {
35
			log.info("----------------AI监控触发违规信息消费开始---------------------------");
36
37
			String message = records.value();
38
			log.info("已接AI报违规消息,消息为:" + message);
39
40
			CommonRequest<AiIdenLog> aiIdenLogRequest = JSON.parseObject(message,
41
					new TypeReference<CommonRequest<AiIdenLog>>() {
42
					});
43
44
			CommonResponse runningResult = aiTaskCommand.aiIdenLogTriggerEvent(aiIdenLogRequest);
45
			log.info("runningResult: \n{}", JsonUtils.toJSONStringByDateFormat(runningResult, true));
46
			Assert.assertTrue(runningResult.isSuccess());
47
48
		} catch (Exception e) {
49
			log.error("kafka消费异常" + e.getMessage(), e);
50
		} finally {
51
			ack.acknowledge();// 手动提交偏移量
52
		}
53
	}
54
}

+ 0 - 54
security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/AIAttendanceKafkaTask.java

@ -1,54 +0,0 @@
1
package com.ai.bss.security.protection.service.task;
2
3
import org.apache.kafka.clients.consumer.ConsumerRecord;
4
import org.junit.Assert;
5
import org.springframework.beans.factory.annotation.Autowired;
6
import org.springframework.kafka.annotation.KafkaListener;
7
import org.springframework.kafka.support.Acknowledgment;
8
import org.springframework.stereotype.Component;
9
10
import com.ai.abc.api.model.CommonRequest;
11
import com.ai.abc.api.model.CommonResponse;
12
import com.ai.abc.util.JsonUtils;
13
import com.ai.bss.work.safety.model.AiIdenLog;
14
import com.ai.bss.work.safety.service.api.AiTaskCommand;
15
import com.alibaba.fastjson.JSON;
16
import com.alibaba.fastjson.TypeReference;
17
18
import lombok.extern.slf4j.Slf4j;
19
20
/**
21
 * 人脸识别事件触发考勤
22
 * @author konghl@asiainfo.com
23
 * 2020-12-14
24
 */
25
@Component
26
@Slf4j
27
public class AIAttendanceKafkaTask {
28
29
	@Autowired
30
	private AiTaskCommand aiTaskCommand;
31
32
	@KafkaListener(containerFactory = "kafkaBatchListener3", topics = "${kafka.topic.alarm:Topic_IoT_IndividualAlarm}", groupId = "alarm_group")
33
	public void alarmListener(ConsumerRecord<String, String> records, Acknowledgment ack) throws Throwable {
34
		try {
35
			log.info("----------------AI人脸识别触发考勤信息消费开始---------------------------");
36
37
			String message = records.value();
38
			log.info("已接AI考勤信息,消息为:" + message);
39
40
			CommonRequest<AiIdenLog> aiIdenLogRequest = JSON.parseObject(message,
41
					new TypeReference<CommonRequest<AiIdenLog>>() {
42
					});
43
44
			CommonResponse runningResult = aiTaskCommand.aiIdenLogTriggerEvent(aiIdenLogRequest);
45
			log.info("runningResult: \n{}", JsonUtils.toJSONStringByDateFormat(runningResult, true));
46
			Assert.assertTrue(runningResult.isSuccess());
47
48
		} catch (Exception e) {
49
			log.error("kafka消费异常" + e.getMessage(), e);
50
		} finally {
51
			ack.acknowledge();// 手动提交偏移量
52
		}
53
	}
54
}

+ 50 - 6
security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/AIResultRecordKafkaTask.java

@ -1,24 +1,31 @@
1 1
package com.ai.bss.security.protection.service.task;
2 2
3
import java.util.List;
4
import java.util.Map;
5
3 6
import org.apache.kafka.clients.consumer.ConsumerRecord;
4 7
import org.junit.Assert;
5 8
import org.springframework.beans.factory.annotation.Autowired;
6 9
import org.springframework.kafka.annotation.KafkaListener;
7 10
import org.springframework.kafka.support.Acknowledgment;
8 11
import org.springframework.stereotype.Component;
12
import org.springframework.util.CollectionUtils;
9 13
10 14
import com.ai.abc.api.model.CommonRequest;
11 15
import com.ai.abc.api.model.CommonResponse;
12 16
import com.ai.abc.util.JsonUtils;
17
import com.ai.bss.security.protection.service.interfaces.ResourceToolManageService;
13 18
import com.ai.bss.work.safety.model.AiIdenLog;
14 19
import com.ai.bss.work.safety.service.api.AiTaskCommand;
20
import com.ai.bss.work.safety.service.api.MonitorSceneQuery;
15 21
import com.alibaba.fastjson.JSON;
22
import com.alibaba.fastjson.JSONObject;
16 23
import com.alibaba.fastjson.TypeReference;
17 24
18 25
import lombok.extern.slf4j.Slf4j;
19 26
20 27
/**
21
 * AI任务执行结果日志创建
28
 * 创建AI任务执行结果日志
22 29
 * @author konghl@asiainfo.com
23 30
 * 2020-12-14
24 31
 */
@ -29,7 +36,13 @@ public class AIResultRecordKafkaTask {
29 36
	@Autowired
30 37
	private AiTaskCommand aiTaskCommand;
31 38
32
	@KafkaListener(containerFactory = "kafkaBatchListener6", topics = "${kafka.topic.alarm:Topic_IoT_IndividualAlarm}", groupId = "alarm_group")
39
	@Autowired
40
	private ResourceToolManageService resourceToolManageService;
41
	
42
	@Autowired
43
	private MonitorSceneQuery monitorSceneQuery;
44
45
	@KafkaListener(containerFactory = "kafkaBatchListener6", topics = "${kafka.topic.aitask:topic_ai_task}", groupId = "ai_group")
33 46
	public void alarmListener(ConsumerRecord<String, String> records, Acknowledgment ack) throws Throwable {
34 47
		try {
35 48
			log.info("----------------AI任务执行结果信息消费开始---------------------------");
@ -37,11 +50,41 @@ public class AIResultRecordKafkaTask {
37 50
			String message = records.value();
38 51
			log.info("已接AI任务执行结果消息,消息为:" + message);
39 52
40
			CommonRequest<AiIdenLog> aiIdenLogRequest = JSON.parseObject(message,
41
					new TypeReference<CommonRequest<AiIdenLog>>() {
42
					});
53
			JSONObject messageJson = JSONObject.parseObject(message);
54
			Map<String, Object> resourceToolMap = resourceToolManageService
55
					.queryResourceToolByCode(messageJson.getString("resourceToolCode"));
43 56
44
			CommonResponse<AiIdenLog> runningResult = aiTaskCommand.createAiIdenLog(aiIdenLogRequest);
57
			if (resourceToolMap == null) {
58
				log.error("AI任务执行结果的设备CODE不存在:  resourceToolCode=" + messageJson.getString("resourceToolCode"));
59
				throw new NullPointerException("resourceToolCode not exist");
60
			}
61
			
62
			String resourceToolId=String.valueOf(resourceToolMap.get("resourceToolId"));
63
			
64
			CommonResponse<List<Map<String, Object>>> sceneTerminalRelResponse =monitorSceneQuery.selectSceneTerminalRel(new CommonRequest<Long>(Long.valueOf(resourceToolId)));
65
66
			if (sceneTerminalRelResponse == null||CollectionUtils.isEmpty(sceneTerminalRelResponse.getData())) {
67
				log.error("AI任务执行结果的关联场景不存在:  resourceToolId=" + resourceToolId);
68
				throw new NullPointerException("sceneTerminalRel not exist");
69
			}
70
			Map<String,Object> sceneTerminalRelMap=sceneTerminalRelResponse.getData().get(0);
71
			
72
			
73
			AiIdenLog aiIdenLog = JSON.parseObject(message, new TypeReference<AiIdenLog>() {
74
			});
75
			aiIdenLog.setResourceToolId(resourceToolId);
76
			aiIdenLog.setResourceToolName(String.valueOf(resourceToolMap.get("resourceToolName")));
77
			aiIdenLog.setMonitorSceneId(String.valueOf(sceneTerminalRelMap.get("monitorSceneId")));
78
			aiIdenLog.setMonitorSceneName(String.valueOf(sceneTerminalRelMap.get("monitorSceneName")));
79
			aiIdenLog.setEffectType(String.valueOf(sceneTerminalRelMap.get("effectType")));
80
			aiIdenLog.setTerminalPosition(String.valueOf(sceneTerminalRelMap.get("place")));
81
			
82
			
83
			
84
			
85
			
86
87
			CommonResponse<AiIdenLog> runningResult = aiTaskCommand.createAiIdenLog(new CommonRequest<AiIdenLog>(aiIdenLog));
45 88
			log.info("runningResult: \n{}", JsonUtils.toJSONStringByDateFormat(runningResult, true));
46 89
			Assert.assertTrue(runningResult.isSuccess());
47 90
@ -51,4 +94,5 @@ public class AIResultRecordKafkaTask {
51 94
			ack.acknowledge();// 手动提交偏移量
52 95
		}
53 96
	}
97
54 98
}

+ 70 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/AIVideoKafkaTask.java

@ -0,0 +1,70 @@
1
package com.ai.bss.security.protection.service.task;
2
3
import java.util.Map;
4
5
import org.apache.kafka.clients.consumer.ConsumerRecord;
6
import org.junit.Assert;
7
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.kafka.annotation.KafkaListener;
9
import org.springframework.kafka.support.Acknowledgment;
10
import org.springframework.stereotype.Component;
11
12
import com.ai.abc.api.model.CommonResponse;
13
import com.ai.abc.util.JsonUtils;
14
import com.ai.bss.security.protection.service.interfaces.MonitorVideoLogManageService;
15
import com.ai.bss.security.protection.service.interfaces.ResourceToolManageService;
16
import com.ai.bss.work.safety.model.MonitorVideoLog;
17
import com.alibaba.fastjson.JSON;
18
import com.alibaba.fastjson.JSONObject;
19
import com.alibaba.fastjson.TypeReference;
20
21
import lombok.extern.slf4j.Slf4j;
22
23
/**
24
 * 创建AI监控视频日志
25
 * @author konghl@asiainfo.com
26
 * 2020-12-14
27
 */
28
@Component
29
@Slf4j
30
public class AIVideoKafkaTask {
31
32
	@Autowired
33
	private MonitorVideoLogManageService monitorVideoLogManageService;
34
35
	@Autowired
36
	private ResourceToolManageService resourceToolManageService;
37
38
	@KafkaListener(containerFactory = "kafkaBatchListener6", topics = "${kafka.topic.aivideo:topic_ai_video}", groupId = "ai_group")
39
	public void alarmListener(ConsumerRecord<String, String> records, Acknowledgment ack) throws Throwable {
40
		try {
41
			log.info("----------------AI监控视频日志消费开始---------------------------");
42
43
			String message = records.value();
44
			log.info("已接AI监控视频日志消息,消息为:" + message);
45
46
			JSONObject messageJson = JSONObject.parseObject(message);
47
			Map<String, Object> resourceToolMap = resourceToolManageService
48
					.queryResourceToolByCode(messageJson.getString("resourceToolCode"));
49
50
			if (resourceToolMap==null) {
51
				log.error("AI监控视频日志的设备CODE不存在: " + messageJson.getString("resourceToolCode"));
52
				throw new NullPointerException("resourceToolCode not exist");
53
			}
54
			
55
			MonitorVideoLog monitorVideoLog = JSON.parseObject(message, new TypeReference<MonitorVideoLog>() {
56
			});
57
			monitorVideoLog.setResourceToolId(String.valueOf(resourceToolMap.get("resourceToolId")));
58
59
			CommonResponse<MonitorVideoLog> runningResult = monitorVideoLogManageService
60
					.createMonitorVideoLog(monitorVideoLog);
61
			log.info("kafka aivideo runningResult: \n{}", JsonUtils.toJSONStringByDateFormat(runningResult, true));
62
			Assert.assertTrue(runningResult.isSuccess());
63
64
		} catch (Exception e) {
65
			log.error("AI监控视频日志消息的kafka消费异常: " + e.getMessage(), e);
66
		} finally {
67
			ack.acknowledge();// 手动提交偏移量
68
		}
69
	}
70
}

+ 15 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/utils/EbcConstant.java

@ -39,6 +39,12 @@ public class EbcConstant {
39 39
	// 考勤查询:月
40 40
	public static final String AREA_IN_OUT_RECORD_MONTH = "month";
41 41
42
	//AI识别结果:违规
43
	public static final String AI_IDENTIFY_RESULT_ALARM= "AI_IDENTIFY_RESULT_ALARM";
44
	
45
	//AI识别结果:考勤
46
	public static final String AI_IDENTIFY_RESULT_ATTENDANCE= "AI_IDENTIFY_RESULT_ATTENDANCE";
47
	
42 48
	// 静态常量: 工单类型
43 49
	public static final String BUSINESS_SPEC_WORK_ORDER_TYPE = "WORK_ORDER_TYPE";
44 50
	
@ -47,6 +53,15 @@ public class EbcConstant {
47 53
	
48 54
	// 静态常量: 监控场景类型
49 55
	public static final String BUSINESS_SPEC_MONITOR_SCENE_TYPE = "MONITOR_SCENE_TYPE";
56
	
57
	// 静态常量: AI报警类型
58
	public static final String BUSINESS_SPEC_AI_ALARM_TYPE = "AI_ALARM_TYPE";
59
	
60
	// 静态常量: AI任务状态
61
	public static final String BUSINESS_SPEC_AI_TASK_STATUS = "AI_TASK_STATUS";
62
	
63
	// 静态常量: AI匹配模型
64
	public static final String BUSINESS_SPEC_AI_MATCHER_MODE = "AI_MATCHER_MODE";
50 65
51 66
	
52 67
	// 当前登录者的STAFF_ID

+ 11 - 5
security-protection-service/src/main/resources/application.properties

@ -28,8 +28,7 @@ spring.main.allow-bean-definition-overriding=true
28 28
#kafka.bootstrap-servers=47.105.160.21:9090
29 29
kafka.bootstrap-servers=10.19.90.34:9090
30 30
kafka.topic.aitask=topic_ai_task
31
kafka.topic.aialarm=topic_ai_alarm
32
kafka.topic.aiattendance=topic_ai_attendance
31
kafka.topic.aivideo=topic_ai_video
33 32
kafka.producer.batch-size=16785
34 33
kafka.producer.retries=1
35 34
kafka.producer.buffer-memory=33554432
@ -51,13 +50,20 @@ minio.port=19000
51 50
minio.accessKey=minioadmin
52 51
minio.secretKey=minioadmin
53 52
minio.secure=false
54
minio.bucketHeaderImage=prod-dev
55 53
minio.faceAddServiceUrl=http://10.21.10.28:9018/api/face/add
56 54
minio.face-del-service-url=http://10.21.10.28:9018/api/face/del
57 55
minio.face-recog-service-url=http://10.21.10.28:9018/api/face/recog
58 56
59
myminio.bucketWorkToolImage=tool-image
60
myminio.bucketWorkToolView=tool-view
57
# \u4eba\u8138\u8bc6\u522b
58
minio.bucketHeaderImage=prod-dev
59
60
# \u8bbe\u5907\u9ed8\u8ba4\u7167\u7247
61
spminio.bucketToolImage=tool-image
62
# \u76d1\u63a7\u89c6\u9891
63
spminio.bucketAiVideo=ai-video
64
# \u76d1\u63a7\u89c6\u9891\u622a\u56fe
65
spminio.bucketAiImage=ai-image
66
61 67
62 68
# CACHE
63 69
#spring.cache.type=ehcache