ilePath=E:\\data\\DAHUA 77
#camera.filePath=D:\\data\\DAHUA
78 78
79 79
#AI\u05b4\ufffd\u043d\ufffd\ufffd
80 80
#kafka.topic.aitask=topicTaskTest

+ 15 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/config/MyCorsFilter.java

@ -4,6 +4,8 @@ import com.ai.sso.filter.SessionUserFilter;
4 4
import org.springframework.boot.web.servlet.FilterRegistrationBean;
5 5
import org.springframework.context.annotation.Bean;
6 6
import org.springframework.context.annotation.Configuration;
7
import org.springframework.core.task.TaskExecutor;
8
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
7 9
import org.springframework.web.cors.CorsConfiguration;
8 10
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
9 11
import org.springframework.web.filter.CorsFilter;
@ -11,6 +13,7 @@ import org.springframework.web.filter.CorsFilter;
11 13
import java.util.Arrays;
12 14
import java.util.HashMap;
13 15
import java.util.Map;
16
import java.util.concurrent.ThreadPoolExecutor;
14 17
15 18
/**
16 19
 * 解决接口跨域问题
@ -58,4 +61,16 @@ public class MyCorsFilter {
58 61
        registrationBean.setInitParameters(initParameters);
59 62
        return registrationBean;
60 63
    }
64
65
    @Bean
66
    public ThreadPoolTaskExecutor executor(){
67
        ThreadPoolTaskExecutor executor=new ThreadPoolTaskExecutor();
68
        executor.setCorePoolSize(10); //核心线程数
69
        executor.setMaxPoolSize(20);  //最大线程数
70
        executor.setQueueCapacity(1000); //队列大小
71
        executor.setKeepAliveSeconds(300); //线程最大空闲时间
72
        executor.setThreadNamePrefix("fsx-Executor-"); //指定用于新创建的线程名称的前缀。
73
        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
74
        return executor;
75
    }
61 76
}

+ 8 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/AiResultRecordKafkaTask.java

@ -2,11 +2,14 @@ package com.ai.bss.security.protection.service.task;
2 2
3 3
import java.util.List;
4 4
import java.util.Map;
5
import java.util.concurrent.FutureTask;
5 6
6 7
import org.apache.kafka.clients.consumer.ConsumerRecord;
7 8
import org.springframework.beans.factory.annotation.Autowired;
9
import org.springframework.core.task.TaskExecutor;
8 10
import org.springframework.kafka.annotation.KafkaListener;
9 11
import org.springframework.kafka.support.Acknowledgment;
12
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
10 13
import org.springframework.stereotype.Component;
11 14
import org.springframework.util.CollectionUtils;
12 15
@ -47,6 +50,7 @@ public class AiResultRecordKafkaTask {
47 50
	@Autowired
48 51
	private EmployeeService employeeService;
49 52
53
50 54
	@KafkaListener(containerFactory = "kafkaBatchListener6", topics = "${kafka.topic.aitask:topic_ai_task}", groupId = "ai_group")
51 55
	public void AiResultRecordListener(ConsumerRecord<String, String> records, Acknowledgment ack) throws Throwable {
52 56
	/*@KafkaListener(containerFactory = "kafkaBatchListener6", topics = "${kafka.topic.aitask:topicTaskTest}", groupId = "ai_group")
@ -60,6 +64,10 @@ public class AiResultRecordKafkaTask {
60 64
			AiIdenLog aiIdenLog = JSON.parseObject(message, new TypeReference<AiIdenLog>() {
61 65
			});
62 66
67
			//将结果使用一步方式用镜屏推送到前台
68
			FutureTask<Integer> integerFutureTask = new FutureTask<>(new MirrorSendAiDataThread(message));
69
			new Thread(integerFutureTask).start();
70
63 71
			JSONObject messageJson = JSONObject.parseObject(message);
64 72
			String resourceToolId = messageJson.getString("resourceToolId");
65 73
			String idenResultType = messageJson.getString("idenResultType");

+ 0 - 60
security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/AlarmMirrorTask.java

@ -1,60 +0,0 @@
1
package com.ai.bss.security.protection.service.task;
2
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.security.protection.service.interfaces.CharSpecService;
6
import com.ai.bss.security.protection.utils.EbcConstant;
7
import com.ai.bss.work.task.model.common.WorkTask;
8
import com.ai.bss.worker.service.api.EntityAlarmHandle;
9
import com.alibaba.fastjson.JSON;
10
import com.alibaba.fastjson.JSONObject;
11
import org.apache.commons.collections4.map.HashedMap;
12
import org.slf4j.Logger;
13
import org.slf4j.LoggerFactory;
14
import org.springframework.beans.factory.annotation.Autowired;
15
import org.springframework.stereotype.Component;
16
17
import java.util.Map;
18
19
@Component
20
public class AlarmMirrorTask implements EntityAlarmHandle {
21
	private Logger logger = LoggerFactory.getLogger(AlarmMirrorTask.class);
22
23
	@Autowired
24
	private CharSpecService charSpecService;
25
26
	/**
27
	 * 镜屏推送实时报警信息
28
	 *
29
	 * @param workTask
30
	 * @return
31
	 */
32
	@Override
33
	public CommonResponse<Map<String, Object>> alarmHandle(CommonRequest<WorkTask> workTask) {
34
		logger.debug("====================实时报警接收镜屏数据: " + JSON.toJSONString(workTask));
35
		try {
36
			String charValueSet = workTask.getData().getCharValueSet();
37
			JSONObject alarmJsonObj = JSONObject.parseObject(charValueSet);
38
39
			Map<String, String> resultMap = new HashedMap<String, String>();
40
41
42
			resultMap.put("workTaskId", workTask.getData().getWorkTaskId());
43
			resultMap.put("employeeName", workTask.getData().getTargetEmployeeRoleName());
44
			resultMap.put("longitude", alarmJsonObj.getString("longitude"));
45
			resultMap.put("latitude", alarmJsonObj.getString("latitude"));
46
47
			resultMap.put("businessType", alarmJsonObj.getString("businessType"));
48
49
50
			String msg = JSON.toJSONString(CommonResponse.ok(resultMap));
51
			logger.info("实时报警推送镜屏数据: " + msg);
52
			MirrorManagement.sendData(MirrorManagement.TOPIC_ALARM, msg);
53
54
		} catch (Exception e) {
55
			logger.error("实时报警推送镜屏失败: " + e.getMessage());
56
		}
57
58
		return null;
59
	}
60
}

+ 2 - 5
security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/MirrorManagement.java

@ -15,11 +15,8 @@ import org.slf4j.LoggerFactory;
15 15
public class MirrorManagement {
16 16
	private static Logger logger = LoggerFactory.getLogger(MirrorManagement.class);
17 17
18
	// 定位topic
19
	public static final String TOPIC_LOCATION = "personnel";
20
21
	// 报警topic
22
	public static final String TOPIC_ALARM = "alarm";
18
	// ai返回结果topic
19
	public static final String SEND_AI_DATA = "sendAiData";
23 20
24 21
	public static void sendData(String topic, String msg) {
25 22
		logger.debug("推送镜屏数据: topic=" + topic + " , data=" + msg);

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

@ -0,0 +1,54 @@
1
package com.ai.bss.security.protection.service.task;
2
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.security.protection.service.interfaces.CharSpecService;
6
import com.ai.bss.work.task.model.common.WorkTask;
7
import com.ai.bss.worker.service.api.EntityAlarmHandle;
8
import com.alibaba.fastjson.JSON;
9
import com.alibaba.fastjson.JSONObject;
10
import org.apache.commons.collections4.map.HashedMap;
11
import org.slf4j.Logger;
12
import org.slf4j.LoggerFactory;
13
import org.springframework.beans.factory.annotation.Autowired;
14
import org.springframework.beans.factory.annotation.Qualifier;
15
import org.springframework.stereotype.Component;
16
17
import java.util.Map;
18
import java.util.concurrent.Callable;
19
20
public class MirrorSendAiDataThread implements Callable<Integer> {
21
	private Logger logger = LoggerFactory.getLogger(MirrorSendAiDataThread.class);
22
23
	private String message;
24
25
	public MirrorSendAiDataThread(String aimessage) {
26
		this.message = aimessage;
27
	}
28
29
	@Override
30
	public Integer call() throws Exception {
31
		System.out.println("执行call。。。。。。。。。。。。。。方法");
32
		mirrorSendAiData(message);
33
		return null;
34
	}
35
36
	/**
37
	 * 镜屏推送ai识别数据
38
	 *
39
	 * @param message
40
	 * @return
41
	 */
42
	public Object mirrorSendAiData(String message) {
43
		logger.debug("====================实时报警接收镜屏数据: " + message);
44
		try {
45
			logger.info("实时报警推送镜屏数据: " + message);
46
			MirrorManagement.sendData(MirrorManagement.SEND_AI_DATA, message);
47
48
		} catch (Exception e) {
49
			logger.error("实时报警推送镜屏失败: " + e.getMessage());
50
		}
51
52
		return null;
53
	}
54
}

android-share - Nuosi Git Service

ipu的trunk版的android工程和服务端工程。

leijie c38f95af08 添加第三方Umeng统计分析jar包 9 年之前
..
doc 61ff9d2503 Merge branch 'master' of 9 年之前
libs c38f95af08 添加第三方Umeng统计分析jar包 9 年之前
res 61ff9d2503 Merge branch 'master' of 9 年之前
.classpath a8e55f0d85 修复 9 年之前
.gitignore a8e55f0d85 修复 9 年之前
.project 8aa85d121f 初始化 10 年之前
AndroidManifest.xml 443acf8859 使用15的版本 9 年之前
lint.xml 61ff9d2503 Merge branch 'master' of 9 年之前
proguard-project.txt 61ff9d2503 Merge branch 'master' of 9 年之前
project.properties 61ff9d2503 Merge branch 'master' of 9 年之前