tr class="same-code nl-8 ol-8"> 514
	}
518
	}
561
            	log.error("吸烟识别异常");
565
            	log.error("吸烟识别异常");
562
			}
566
			}
563
        }catch(Exception e){
567
        }catch(Exception e){
564
        log.error("AI处理异常,吸烟识别");
568
        log.error("吸烟识别AI处理异常:"+e.getMessage());
565
        }
569
        }
566
        return aiIdenLogDto;
570
        return aiIdenLogDto;
567
    }
571
    }
618
		}
622
		}
619
623
620
	}catch(Exception e){
624
	}catch(Exception e){
621
	log.error("AI处理异常,工作服识别");
625
	log.error("工作服识别AI处理异常:"+e.getMessage());
622
	}
626
	}
623
	return aiIdenLogDto;
627
	return aiIdenLogDto;
624
}
628
}
651
			log.info("异常返回,异常原因为:"+jsonObjectpredictions.getString("Errors"));
655
			log.info("异常返回,异常原因为:"+jsonObjectpredictions.getString("Errors"));
652
		}
656
		}
653
	}catch(Exception e){
657
	}catch(Exception e){
654
		log.error("AI处理异常,仪表识别");
658
		log.error("仪表识别AI处理异常:"+e.getMessage());
655
	}
659
	}
656
	return aiIdenLogDto;
660
	return aiIdenLogDto;
657
}
661
}
675
			resourceToolInfoList = JSON.parseArray(resultData.getString("data"), Map.class);
679
			resourceToolInfoList = JSON.parseArray(resultData.getString("data"), Map.class);
676
			log.debug("getResourceToolAllInfo method return result: " + resultData.getString("data"));
680
			log.debug("getResourceToolAllInfo method return result: " + resultData.getString("data"));
677
		} catch (Exception e) {
681
		} catch (Exception e) {
678
			log.error("getResourceToolAllInfo is error");
682
			log.error("getResourceToolAllInfo is error:"+e.getMessage());
679
		}
683
		}
680
684
681
		return resourceToolInfoList;
685
		return resourceToolInfoList;

+ 65 - 28
monitor-manage-service/src/main/java/com/ai/bss/monitorManage/service/impl/ListeningFileDirectoryServiceImpl.java

1
package com.ai.bss.monitorManage.service.impl;
1
package com.ai.bss.monitorManage.service.impl;
2
2
3
3
4
import com.ai.bss.monitorManage.constant.MonitorManageConsts;
5
import com.ai.bss.monitorManage.service.interfaces.FileManageService;
6
import com.ai.bss.monitorManage.service.interfaces.KafkaProcess;
7
import com.ai.bss.monitorManage.service.interfaces.ListeningFileDirectoryService;
8
import com.ai.bss.monitorManage.utils.FileUtils;
9
import com.mzlion.core.lang.StringUtils;
4
import java.io.File;
5
import java.io.FileInputStream;
6
import java.io.IOException;
7
import java.io.OutputStream;
8
import java.nio.file.FileSystems;
9
import java.nio.file.Paths;
10
import java.nio.file.StandardWatchEventKinds;
11
import java.nio.file.WatchEvent;
12
import java.nio.file.WatchKey;
13
import java.nio.file.WatchService;
14
import java.util.ArrayList;
15
import java.util.HashMap;
16
import java.util.List;
17
import java.util.Map;
18
import java.util.Timer;
19
import java.util.TimerTask;
20
10
import org.apache.commons.fileupload.FileItem;
21
import org.apache.commons.fileupload.FileItem;
11
import org.apache.commons.fileupload.FileItemFactory;
22
import org.apache.commons.fileupload.FileItemFactory;
12
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
23
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
13
import org.springframework.beans.factory.annotation.Autowired;
24
import org.springframework.beans.factory.annotation.Autowired;
14
import org.springframework.beans.factory.annotation.Value;
25
import org.springframework.beans.factory.annotation.Value;
15
import org.springframework.stereotype.Service;
26
import org.springframework.stereotype.Service;
16
import org.springframework.web.multipart.MultipartFile;
17
import org.springframework.web.multipart.commons.CommonsMultipartFile;
18
27
19
import java.io.*;
20
import java.nio.file.*;
21
import java.util.*;
28
import com.ai.bss.monitorManage.constant.MonitorManageConsts;
29
import com.ai.bss.monitorManage.service.interfaces.KafkaProcess;
30
import com.ai.bss.monitorManage.service.interfaces.ListeningFileDirectoryService;
31
import com.ai.bss.monitorManage.utils.FileUtils;
32
import com.mzlion.core.lang.StringUtils;
33
34
import lombok.extern.slf4j.Slf4j;
22
35
36
@Slf4j
23
@Service
37
@Service
24
public class ListeningFileDirectoryServiceImpl  implements ListeningFileDirectoryService {
38
public class ListeningFileDirectoryServiceImpl  implements ListeningFileDirectoryService {
25
39
26
27
    @Value("${camera.filePath}")
40
    @Value("${camera.filePath}")
28
    private String baseFilePath;
41
    private String baseFilePath;
29
42
30
31
32
    @Autowired
33
    private FileManageService fileManageService;
43
    //@Autowired
44
    //private FileManageService fileManageService;
34
45
35
    @Autowired
46
    @Autowired
36
    private KafkaProcess kafkaProcess;
47
    private KafkaProcess kafkaProcess;
48
    
49
    private static Map<String,Timer> timerMap=new HashMap<String,Timer>();
50
    
51
    private String taskName="pictureTask";
37
52
38
    @Override
53
    @Override
39
    public void getFile(String filePath)  {
54
    public void getFile(String filePath)  {
40
//        if(){
55
//        if(){
41
        System.out.println("filePath:   " + filePath);
56
        //System.out.println("filePath:   " + filePath);
57
    	log.info("filePath:   " + filePath);
42
//        final Timer timer = new Timer();
58
//        final Timer timer = new Timer();
43
        new Timer().schedule(new TimerTask() {
59
    	
60
    	timerMap.put(taskName,new Timer());
61
    	
62
    	timerMap.get(taskName).schedule(new TimerTask() {
44
            @Override
63
            @Override
45
            public void run() {
64
            public void run() {
46
                WatchKey key;
65
                WatchKey key;
47
                System.out.println("filePath:   " + filePath);
66
                //System.out.println("filePath:   " + filePath);
67
                log.info("filePath:   " + filePath);
48
                String mapKey = "";
68
                String mapKey = "";
49
                try {
69
                try {
50
                    if(!StringUtils.isEmpty(filePath )){
70
                    if(!StringUtils.isEmpty(filePath )){
53
                        List fileList = new ArrayList();
73
                        List fileList = new ArrayList();
54
                        while (true) {
74
                        while (true) {
55
                            File file = new File(filePath);//path为监听文件夹
75
                            File file = new File(filePath);//path为监听文件夹
56
                            System.out.println("等待图片加载!");
76
                            //System.out.println("等待图片加载!");
77
                            log.info("等待图片加载!");
57
                            key = watchService.take();//没有文件增加时,阻塞在这里
78
                            key = watchService.take();//没有文件增加时,阻塞在这里
58
                            int i = 0;
79
                            int i = 0;
59
                            String[] fileContent = new String[3600];
80
                            String[] fileContent = new String[3600];
60
                            for (WatchEvent<?> event : key.pollEvents()) {
81
                            for (WatchEvent<?> event : key.pollEvents()) {
61
                                String fileName = filePath+MonitorManageConsts.getSystemSeparator()+event.context();
82
                                String fileName = filePath+MonitorManageConsts.getSystemSeparator()+event.context();
62
                                System.out.println("增加文件的文件夹路径== :"+fileName);
63
                                System.out.println("增加文件的名称== :"+event.context());
83
                                //System.out.println("增加文件的文件夹路径== :"+fileName);
84
                                //System.out.println("增加文件的名称== :"+event.context());
85
                                log.info("增加文件的文件夹路径== :"+fileName);
86
                                log.info("增加文件的名称== :"+event.context());
64
//                                mapKey = filePath.replace(baseFilePath+ MonitorManageConsts.getSystemSeparator(),"");
87
//                                mapKey = filePath.replace(baseFilePath+ MonitorManageConsts.getSystemSeparator(),"");
65
                                mapKey = filePath.replace(baseFilePath+ MonitorManageConsts.getSystemSeparator(),"");
88
                                mapKey = filePath.replace(baseFilePath+ MonitorManageConsts.getSystemSeparator(),"");
66
                                mapKey = mapKey.replace(MonitorManageConsts.getSystemSeparator(),"~!@");
89
                                mapKey = mapKey.replace(MonitorManageConsts.getSystemSeparator(),"~!@");
89
                                }
112
                                }
90
113
91
114
92
93
//                                Path filePath = (Path) event.context();
115
//                                Path filePath = (Path) event.context();
94
////                                //输出新增文件名
116
////                                //输出新增文件名
95
//
117
//
105
                        }
127
                        }
106
                    }
128
                    }
107
                }catch (Exception e) {
129
                }catch (Exception e) {
108
                    // TODO Auto-generated catch block
109
                    e.printStackTrace();
130
                	log.error("getFile is error :"+e.getMessage());    
131
                    //e.printStackTrace();
110
                }
132
                }
111
            }
133
            }
112
        }, 2000 , 3000);//第一个数字2000表示,2000ms以后开启定时器,第二个数字3000,表示3000ms后运行一次run
134
        //}, 2000 , 3000);//第一个数字2000表示,2000ms以后开启定时器,第二个数字3000,表示3000ms后运行一次run
135
        }, 500 , 500); //1秒钟扫描一次
113
    }
136
    }
114
137
115
116
    /*
138
    /*
117
    创建FileItem
139
    创建FileItem
118
     */
140
     */
130
            os.close();
152
            os.close();
131
            fis.close();
153
            fis.close();
132
        } catch (IOException e) {
154
        } catch (IOException e) {
133
            e.printStackTrace();
155
        	log.error("createFileItem is error :"+e.getMessage());       
134
        }
156
        }
135
        return item;
157
        return item;
136
    }
158
    }
159
    
160
    /**
161
     * 移除定时器
162
     * @param taskName
163
     */
164
    @Override
165
    public void removeTimer(){
166
        try{
167
        	timerMap.get(taskName).cancel();
168
        	timerMap.remove(taskName);           
169
        }catch(Exception e){
170
           log.error("removeTimer is error :"+e.getMessage());       
171
        }
172
    }
173
137
}
174
}

+ 41 - 48
monitor-manage-service/src/main/java/com/ai/bss/monitorManage/service/impl/MonitorManageServiceImpl.java

1
package com.ai.bss.monitorManage.service.impl;
1
package com.ai.bss.monitorManage.service.impl;
2
2
3
import cn.hutool.json.JSONUtil;
4
import com.ai.bss.components.common.util.ImageBase64Converter;
5
import com.ai.bss.components.ebcai.service.EbcAiService;
6
import com.ai.bss.monitorManage.constant.MonitorManageConsts;
7
import com.ai.bss.monitorManage.model.AiIdenLogDto;
8
import com.ai.bss.monitorManage.model.IdenResultDto;
9
import com.ai.bss.monitorManage.model.MonitorVideoLogDto;
10
import com.ai.bss.monitorManage.service.interfaces.FileManageService;
11
import com.ai.bss.monitorManage.service.interfaces.KafkaProcess;
12
import com.ai.bss.monitorManage.service.interfaces.ListeningFileDirectoryService;
13
import com.ai.bss.monitorManage.service.interfaces.MonitorManageService;
14
import com.ai.bss.monitorManage.utils.DateUtils;
15
import com.ai.bss.monitorManage.utils.FileUtils;
16
import com.ai.bss.monitorManage.utils.SecurityProtectionMinioConfig;
17
import com.alibaba.druid.sql.visitor.functions.Lcase;
18
import com.alibaba.fastjson.JSON;
19
import com.alibaba.fastjson.JSONArray;
20
import com.alibaba.fastjson.JSONObject;
21
import lombok.SneakyThrows;
22
import lombok.extern.slf4j.Slf4j;
23
import org.apache.commons.fileupload.FileItem;
24
import org.apache.commons.fileupload.FileItemFactory;
25
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
26
import org.apache.logging.log4j.util.Strings;
3
import java.io.File;
4
27
import org.springframework.beans.factory.annotation.Autowired;
5
import org.springframework.beans.factory.annotation.Autowired;
28
import org.springframework.beans.factory.annotation.Value;
6
import org.springframework.beans.factory.annotation.Value;
29
import org.springframework.stereotype.Service;
7
import org.springframework.stereotype.Service;
30
import org.springframework.web.multipart.MultipartFile;
31
import org.springframework.web.multipart.commons.CommonsMultipartFile;
32
8
33
import java.io.File;
34
import java.io.FileInputStream;
35
import java.io.IOException;
36
import java.io.OutputStream;
37
import java.util.*;
9
import com.ai.bss.monitorManage.service.interfaces.ListeningFileDirectoryService;
10
import com.ai.bss.monitorManage.service.interfaces.MonitorManageService;
11
12
import lombok.extern.slf4j.Slf4j;
38
13
39
@Slf4j
14
@Slf4j
40
@Service
15
@Service
41
public class MonitorManageServiceImpl implements MonitorManageService {
16
public class MonitorManageServiceImpl implements MonitorManageService {
42
43
	private final static String SPLIT_CHAR = "_";
17
	
18
	//private final static String SPLIT_CHAR = "_";
44
//	private static String bucketName =  "";
19
//	private static String bucketName =  "";
45
20
46
	@Autowired
47
	private FileManageService fileManageService;
21
	//@Autowired
22
	//private FileManageService fileManageService;
48
23
49
	@Autowired
24
	@Autowired
50
	private ListeningFileDirectoryService listeningFileDirectoryService;
25
	private ListeningFileDirectoryService listeningFileDirectoryService;
51
26
52
	@Autowired
53
	private KafkaProcess kafkaProcess;
27
	//@Autowired
28
	//private KafkaProcess kafkaProcess;
54
29
55
	@Autowired
56
	private EbcAiService ebcAiService;
30
	//@Autowired
31
	//private EbcAiService ebcAiService;
57
32
58
	@Value("${camera.filePath}")
33
	@Value("${camera.filePath}")
59
	private String baseFilePath;
34
	private String baseFilePath;
64
	@Value("${kafka.topic.aivideo}")
39
	@Value("${kafka.topic.aivideo}")
65
	private String topicAiVideo;
40
	private String topicAiVideo;
66
41
67
	@Autowired
68
	private SecurityProtectionMinioConfig minioConfig;
69
42
	//@Autowired
43
	//private SecurityProtectionMinioConfig minioConfig;
70
44
45
	private static boolean isBeginFlag=false;
71
46
72
	@Override
47
	@Override
73
	public void loadPictureFromDirectory() throws InterruptedException {
74
75
		//监听文件目录,加载文件
76
		loadFileList();
77
48
	public String loadPictureFromDirectory() throws InterruptedException {
49
		if (!isBeginFlag) {
50
			//监听文件目录,加载文件
51
			loadFileList();
52
			isBeginFlag=true;
53
			log.info("图片监听开启成功");
54
			return "开启成功";
55
		}
56
		
57
		log.info("图片监听无法重复开启");
58
		return "无法重复开启";
78
	}
59
	}
79
60
80
	private void loadFileList(){
61
	private void loadFileList(){
96
					break;
77
					break;
97
				}
78
				}
98
				File[] camerafiles = deviceFile.listFiles();
79
				File[] camerafiles = deviceFile.listFiles();
99
				System.out.println("deviceFilePath()   " + deviceFile.getPath());
80
				//System.out.println("deviceFilePath()   " + deviceFile.getPath());
81
				log.info("deviceFilePath()  " + deviceFile.getPath());
100
				listeningFileDirectoryService.getFile(deviceFile.getPath());
82
				listeningFileDirectoryService.getFile(deviceFile.getPath());
101
			}
83
			}
102
		}
84
		}
103
	}
85
	}
86
	
87
	/**
88
	 * 关闭监听
89
	 */
90
	public String closeListeningPicture() {
91
		listeningFileDirectoryService.removeTimer();
92
		
93
		isBeginFlag=false;
94
		log.info("图片监听关闭成功");
95
		return "关闭成功";
96
	}
104
97
105
}
98
}

+ 2 - 0
monitor-manage-service/src/main/java/com/ai/bss/monitorManage/service/interfaces/ListeningFileDirectoryService.java

4
public interface ListeningFileDirectoryService {
4
public interface ListeningFileDirectoryService {
5
5
6
    void getFile(String filePath) ;
6
    void getFile(String filePath) ;
7
    
8
    void removeTimer();
7
}
9
}

+ 12 - 1
monitor-manage-service/src/main/java/com/ai/bss/monitorManage/service/interfaces/MonitorManageService.java

2
2
3
public interface MonitorManageService {
3
public interface MonitorManageService {
4
4
5
    void loadPictureFromDirectory() throws InterruptedException;
5
	/**
6
	 * 开启监听
7
	 * @return
8
	 * @throws InterruptedException
9
	 */
10
    String loadPictureFromDirectory() throws InterruptedException;
11
    
12
    /**
13
     * 关闭监听
14
     * @return
15
     */
16
    String closeListeningPicture();
6
}
17
}

+ 6 - 3
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/UploadFileServiceImpl.java

52
			minioService.putObject(bucketName, meFile, minioFileName);
52
			minioService.putObject(bucketName, meFile, minioFileName);
53
		} catch (Exception e) {
53
		} catch (Exception e) {
54
			log.error("文件上传异常");
54
			log.error("文件上传异常");
55
			e.printStackTrace();
55
			//e.printStackTrace();
56
			return "";
56
		}
57
		}
57
58
58
		log.info("文件上传结束,minioFileName: " + minioFileName);
59
		log.info("文件上传结束,minioFileName: " + minioFileName);
84
			fileUrl = minioService.getObjectUrl(bucketName, minioFileName);
85
			fileUrl = minioService.getObjectUrl(bucketName, minioFileName);
85
		} catch (Exception e) {
86
		} catch (Exception e) {
86
			log.error("获取到文件的url路径异常,minioFileName: " + minioFileName);
87
			log.error("获取到文件的url路径异常,minioFileName: " + minioFileName);
87
			e.printStackTrace();
88
			//e.printStackTrace();
89
			return "";
88
		}
90
		}
89
91
90
		if (StringUtils.isEmpty(fileUrl)) {
92
		if (StringUtils.isEmpty(fileUrl)) {
238
			result = minioService.removeObject(bucketName, minioFileName);
240
			result = minioService.removeObject(bucketName, minioFileName);
239
		} catch (Exception e) {
241
		} catch (Exception e) {
240
			log.error("删除上传异常");
242
			log.error("删除上传异常");
241
			e.printStackTrace();
243
			//e.printStackTrace();
244
			return false;
242
		}
245
		}
243
246
244
		log.info("删除文件,minioFileName: " + minioFileName);
247
		log.info("删除文件,minioFileName: " + minioFileName);

+ 2 - 1
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/WorkOrderManagementServiceImpl.java

278
				|| CollectionUtils.isEmpty(resultResponse.getData().getData().get(0))
278
				|| CollectionUtils.isEmpty(resultResponse.getData().getData().get(0))
279
				|| resultResponse.getData().getData().get(0).get("id") == null) {
279
				|| resultResponse.getData().getData().get(0).get("id") == null) {
280
			log.error("员工不存在");
280
			log.error("员工不存在");
281
			new BaseException("员工不存在");
281
			//new BaseException("员工不存在");
282
			return CommonResponse.fail("504","员工不存在");
282
		}
283
		}
283
		String employOrgId = String.valueOf(resultResponse.getData().getData().get(0).get("id"));
284
		String employOrgId = String.valueOf(resultResponse.getData().getData().get(0).get("id"));
284
		log.info("输出参数:{}", JSON.toJSONString(resultResponse, SerializerFeature.PrettyFormat));
285
		log.info("输出参数:{}", JSON.toJSONString(resultResponse, SerializerFeature.PrettyFormat));

android-share - Nuosi Git Service

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

leijie c2152d0bec pathmenu时间变更0.3s&& 图标变更 8 years ago
..
drawable c2152d0bec pathmenu时间变更0.3s&& 图标变更 8 years ago
drawable-hdpi df1aaa934e 1 9 years ago
drawable-ldpi b4200357dc 【提交内容】:删除wade-mobile-common下的关于ipu-map地图资源文件!!!!!!!!!!!! 9 years ago
drawable-mdpi df1aaa934e 1 9 years ago
drawable-xhdpi df1aaa934e 1 9 years ago
menu 22bd19543c 初始化 10 years ago
raw 22bd19543c 初始化 10 years ago
values 97124557f0 add push adapter 9 years ago
values-sw600dp 22bd19543c 初始化 10 years ago
values-sw720dp-land 22bd19543c 初始化 10 years ago
values-v11 22bd19543c 初始化 10 years ago
values-v14 22bd19543c 初始化 10 years ago
xml c89111fe17 [提交内容]:nfc配置 9 years ago