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
}

+ 28 - 1
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/MonitorSceneTerminalServiceImpl.java

@ -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

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

@ -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);

+ 13 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/ResourceToolManageServiceImpl.java

@ -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
}

+ 18 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/SysConfigAiTaskServiceImpl.java

@ -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
}

+ 8 - 11
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/UploadFileServiceImpl.java

@ -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

+ 55 - 44
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/WorkOrderManagementServiceImpl.java

@ -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;

+ 8 - 6
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/AiAlarmManageService.java

@ -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
}

+ 79 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/AiIdenLogManageService.java

@ -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
}

+ 2 - 2
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/AttendanceCommonService.java

@ -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过滤)

+ 106 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/EmployeeManagementService.java

@ -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
}

+ 22 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/LoginService.java

@ -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
}

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

@ -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

+ 8 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/ResourceToolManageService.java

@ -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
}

+ 6 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/SysConfigAiTaskService.java

@ -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
}

+ 51 - 54
security-protection-service/src/main/java/com/ai/bss/security/protection/service/task/AiResultRecordKafkaTask.java

@ -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
			}

+ 11 - 1
security-protection-service/src/main/java/com/ai/bss/security/protection/utils/DateUtil.java

@ -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
}

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

@ -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

+ 295 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/utils/HttpServiceUtil.java

@ -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
}

+ 33 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/utils/IDUtils.java

@ -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
}

+ 12 - 0
security-protection-service/src/main/resources/application-iot.properties

@ -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

+ 21 - 0
security-protection-service/src/main/resources/application-minio.properties

@ -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

+ 9 - 20
security-protection-service/src/main/resources/application.properties

@ -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

+ 81 - 0
security-protection-service/src/main/resources/sso.properties

@ -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

ipu-guide - Nuosi Git Service

包括IPU基础客户端、基础服务端、IPU秀等IPU入门功能。 同android-share、ios-share一样,都是开放的仓库。

zhanglong7 40a2028ebf 添加不带java源码的插件工程,ipu-map-bd ipu-scan ipu-push-jpush 6 年之前
..
.settings 40a2028ebf 添加不带java源码的插件工程,ipu-map-bd ipu-scan ipu-push-jpush 6 年之前
libs 40a2028ebf 添加不带java源码的插件工程,ipu-map-bd ipu-scan ipu-push-jpush 6 年之前
res 40a2028ebf 添加不带java源码的插件工程,ipu-map-bd ipu-scan ipu-push-jpush 6 年之前
.classpath 40a2028ebf 添加不带java源码的插件工程,ipu-map-bd ipu-scan ipu-push-jpush 6 年之前
.project 40a2028ebf 添加不带java源码的插件工程,ipu-map-bd ipu-scan ipu-push-jpush 6 年之前
AndroidManifest.xml 40a2028ebf 添加不带java源码的插件工程,ipu-map-bd ipu-scan ipu-push-jpush 6 年之前
lint.xml 40a2028ebf 添加不带java源码的插件工程,ipu-map-bd ipu-scan ipu-push-jpush 6 年之前
proguard-project.txt 40a2028ebf 添加不带java源码的插件工程,ipu-map-bd ipu-scan ipu-push-jpush 6 年之前
project.properties 40a2028ebf 添加不带java源码的插件工程,ipu-map-bd ipu-scan ipu-push-jpush 6 年之前
readme.md 40a2028ebf 添加不带java源码的插件工程,ipu-map-bd ipu-scan ipu-push-jpush 6 年之前

readme.md

使用eclipse依赖,需要将这个目录下的AndroidManifest中的极光推送所需的权限和组件复制到主工程中。 appkey需要到官网申请。

@IPU_FIXBUG_2022@设置组件版本和ipu-restful3.1保持一致 · 2a220fe86a - Nuosi Git Service
瀏覽代碼

@IPU_FIXBUG_2022@设置组件版本和ipu-restful3.1保持一致

weihf 3 年之前
父節點
當前提交
2a220fe86a
共有 1 個文件被更改,包括 5 次插入20 次删除
  1. 5 20
      ipu-server-libs/pom.xml

+ 5 - 20
ipu-server-libs/pom.xml

@ -30,7 +30,7 @@
30 30
31 31
	<properties>
32 32
		<webapp-path>${basedir}/src/main/resources/webapp</webapp-path>
33
33
        <logback.version>1.2.9</logback.version>
34 34
		<!-- 公共插件 -->
35 35
		<!--
36 36
		<maven-clean-plugin>3.0.0</maven-clean-plugin>
@ -42,35 +42,25 @@
42 42
	</properties>
43 43
44 44
	<dependencies>
45
<!-- 
45 46
		<dependency>
46 47
			<groupId>org.apache.logging.log4j</groupId>
47 48
			<artifactId>log4j-core</artifactId>
48 49
			<version>2.8.2</version>
49
		</dependency>
50
		</dependency> -->
50 51
		<dependency>
51 52
			<groupId>ch.qos.logback</groupId>
52 53
			<artifactId>logback-classic</artifactId>
53
			<version>1.2.3</version>
54
		</dependency>
55
		<dependency>
56
			<groupId>org.springframework</groupId>
57
			<artifactId>spring-web</artifactId>
58
			<version>4.2.7.RELEASE</version>
59
		</dependency>
60
		<dependency>
61
			<groupId>org.springframework</groupId>
62
			<artifactId>spring-webmvc</artifactId>
63
			<version>4.3.20.RELEASE</version>
54
			<version>${logback.version}</version>
64 55
		</dependency>
56
65 57
		<dependency>
66 58
			<groupId>commons-fileupload</groupId>
67 59
			<artifactId>commons-fileupload</artifactId>
68
			<version>1.4</version>
69 60
		</dependency>
70 61
		<dependency>
71 62
			<groupId>dom4j</groupId>
72 63
			<artifactId>dom4j</artifactId>
73
			<version>1.6</version>
74 64
		</dependency>
75 65
		<dependency>
76 66
			<groupId>org.apache.poi</groupId>
@ -80,22 +70,18 @@
80 70
		<dependency>
81 71
			<groupId>org.springframework</groupId>
82 72
			<artifactId>spring-core</artifactId>
83
			<version>4.3.22.RELEASE</version>
84 73
		</dependency>
85 74
		<dependency>
86 75
			<groupId>mysql</groupId>
87 76
			<artifactId>mysql-connector-java</artifactId>
88
			<version>5.1.42</version>
89 77
		</dependency>
90 78
		<dependency>
91 79
			<groupId>commons-codec</groupId>
92 80
			<artifactId>commons-codec</artifactId>
93
			<version>1.12</version>
94 81
		</dependency>
95 82
		<dependency>
96 83
			<groupId>org.apache.httpcomponents</groupId>
97 84
			<artifactId>httpclient</artifactId>
98
			<version>4.5.5</version>
99 85
		</dependency>
100 86
		<dependency>
101 87
			<artifactId>jsoup</artifactId>
@ -105,7 +91,6 @@
105 91
		<dependency>
106 92
			<groupId>commons-beanutils</groupId>
107 93
			<artifactId>commons-beanutils</artifactId>
108
			<version>1.9.4</version>
109 94
		</dependency>
110 95
111 96
<!--		<dependency>-->

[FE]统计AI报警未处理的数据 · b9c49e6225 - Nuosi Git Service
Parcourir la Source

[FE]统计AI报警未处理的数据

liuwenxun 4 ans auparavant
Parent
commit
b9c49e6225

+ 4 - 1
security-protection-platform/src/api/aialarm/index.js

@ -7,7 +7,7 @@ const api = {
7 7
    return $default.get('/sp/aiAlarmManage/queryPageAiAlarm', params)
8 8
  },
9 9
  // 获取报警列表详情信息
10
  getAlarmDetail(id) {
10
  getAlarmDetail (id) {
11 11
    return $default.get('/sp/aiAlarmManage/queryOneAiAlarmInfo', id).catch((err) => { return err })
12 12
  },
13 13
  // 获取报警类型查询下拉框
@ -19,6 +19,9 @@ const api = {
19 19
  },
20 20
  dispose (params) {
21 21
    return $default.post('/sp/aiAlarmManage/changeTaskStatus', params)
22
  },
23
  getAiAlarmCount () {
24
    return $default.get('/sp/aiAlarmManage/queryAiAlarmCount')
22 25
  }
23 26

24 27
}

+ 25 - 4
security-protection-platform/src/layout/components/Sidebar/SidebarItem.vue

@ -6,6 +6,17 @@ import FixiOSBug from './FixiOSBug'
6 6
7 7
let onlyOneChild = null
8 8
9
// async function getAiAlarmCount () {
10
//   // let res = await aialarmapi.getAiAlarmCount()
11
12
//   const res = await new Promise((resolve) => {
13
//     return resolve(aialarmapi.getAiAlarmCount())
14
//   })
15
16
//   // console.log('数据是', res)
17
//   return res
18
// }
19
9 20
function hasOneShowingChild (children = [], parent) {
10 21
  const showingChildren = children.filter(item => {
11 22
    if (item.hidden) {
@ -59,12 +70,18 @@ export default {
59 70
    basePath: {
60 71
      type: String,
61 72
      default: ''
73
    },
74
75
    AiAlarmCount: {
76
      type: Array,
77
      default: null
62 78
    }
63 79
  },
80
64 81
  render (h, { props }) {
65 82
    const item = props.item
66 83
67
    // AI报警里的数字可以通过meta来传
84
    const AiAlarmCount = props.AiAlarmCount
68 85
69 86
    const defaultTitle = 'No Title'
70 87
    if (item.hidden) return null
@ -72,9 +89,13 @@ export default {
72 89
      const icon = onlyOneChild.meta && onlyOneChild.meta.icon ? <t-icon icon={onlyOneChild.meta.icon} /> : ''
73 90
74 91
      if (item.path === '/alarm') {
75
        // console.log(item.children[0].meta)
76
        const confirmedCount = item.children[0].meta.confirmedCount
77
        const unconfirmedCount = item.children[0].meta.unconfirmedCount
92
        var confirmedCount = 0
93
        var unconfirmedCount = 0
94
        if (AiAlarmCount.length > 0) {
95
          confirmedCount = AiAlarmCount[1].value
96
          unconfirmedCount = AiAlarmCount[0].value
97
        }
98
78 99
        return (
79 100
          <t-menu-item name={resolvePath(props.basePath, onlyOneChild.path)}>
80 101
            { icon}

+ 17 - 1
security-protection-platform/src/layout/components/Sidebar/index.vue

@ -6,7 +6,7 @@
6 6
    </div>
7 7
    <t-scroll-bar style="height:100%">
8 8
      <t-menu :active-name="activeMenu" :collapse="isCollapse" mode="vertical" type="light" @on-select="handleMenuSelect">
9
        <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" />
9
        <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" :ai-alarm-count="AiAlarmCount" />
10 10
      </t-menu>
11 11
    </t-scroll-bar>
12 12
  </div>
@ -17,9 +17,16 @@ import { mapGetters } from 'vuex'
17 17
import Logo from './Logo'
18 18
import SidebarItem from './SidebarItem'
19 19
import variables from '@/styles/variables.scss'
20
import aialarmapi from '@/api/aialarm'
20 21
21 22
export default {
22 23
  components: { SidebarItem, Logo },
24
  data () {
25
    return {
26
      AiAlarmCount: []
27
    }
28
  },
29
23 30
  computed: {
24 31
    ...mapGetters([
25 32
      'permission_routes',
@ -43,6 +50,10 @@ export default {
43 50
    isCollapse () {
44 51
      return !this.sidebar.opened
45 52
    }
53
54
  },
55
  created () {
56
    this.getAiAlarmCount()
46 57
  },
47 58
  methods: {
48 59
    handleMenuSelect (name) {
@ -50,6 +61,11 @@ export default {
50 61
    },
51 62
    handleSidebarCollapse () {
52 63
      this.$store.dispatch('app/toggleSideBar')
64
    },
65
    async getAiAlarmCount () {
66
      let res = await aialarmapi.getAiAlarmCount()
67
68
      this.AiAlarmCount = res.data.data
53 69
    }
54 70
  }
55 71
}

+ 1 - 1
security-protection-platform/src/modules/aialarm/index.vue

@ -347,7 +347,7 @@ export default {
347 347
      if (res.status === 200) {
348 348
        this.$Message.success('操作成功')
349 349
        this.data[this.currentdata.index].status = res.data.data.status
350
        if (res.data.data.status == 'END') {
350
        if (res.data.data.status === 'END') {
351 351
          this.data[this.currentdata.index].processTime = res.data.data.doneDate
352 352
        }
353 353
      } else {

+ 1 - 1
security-protection-platform/src/routes.js

@ -102,7 +102,7 @@ export const constantRoutes = [
102 102
        name: 'ai_alarm',
103 103
        path: '',
104 104
        component: () => import(/* webpackChunkName: "alarm" */ './modules/aialarm/index.vue'),
105
        meta: { title: 'AI报警', icon: 'bell', unconfirmedCount: 10, confirmedCount: 100 }
105
        meta: { title: 'AI报警', icon: 'bell' }
106 106
      }
107 107
    ]
108 108
  }, {