|
@@ -55,6 +55,8 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
|
private String browserFolder;
|
|
|
@Value(value = "${picrecongnize.develop}")
|
|
|
private String developFolder;
|
|
|
+ @Value(value = "${picrecongnize.im}")
|
|
|
+ private String imFolder;
|
|
|
|
|
|
@Value("classpath:novel_words.data")
|
|
|
private org.springframework.core.io.Resource novelWords;
|
|
@@ -292,7 +294,9 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
|
// }
|
|
|
File picFile = new File((String)fileMap.get("newFile"));
|
|
|
System.out.println("File:"+picFile.getAbsolutePath());
|
|
|
- if (isNovel(textContents)) {
|
|
|
+ if (isIM(picFile) != null) {
|
|
|
+ screenshot.setPicType(9);//聊天
|
|
|
+ } if (isNovel(textContents)) {
|
|
|
screenshot.setPicType(6);
|
|
|
} else if (isDocument(textContents)) {
|
|
|
screenshot.setPicType(2);//看文档
|
|
@@ -443,7 +447,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
-// String b = isDevelop(new File("C:\\Users\\seya\\Desktop\\wtt.jpg"));
|
|
|
+// String b = isIM(new File("C:\\Users\\seya\\Desktop\\im.jpg"));
|
|
|
// System.out.println("结果:"+b);
|
|
|
}
|
|
|
|
|
@@ -540,6 +544,33 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ //判断是否是聊天
|
|
|
+ private String isIM(File pic) {
|
|
|
+ File folder = new File(imFolder);
|
|
|
+// File folder = new File("C:\\picrecongnize\\im\\");
|
|
|
+ if (!folder.exists()) {
|
|
|
+ try {
|
|
|
+ throw new Exception("没有设置图片上传的聊天比对模板库");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ File[] files = folder.listFiles();
|
|
|
+ String toolName = null;
|
|
|
+ boolean isMatch = false;
|
|
|
+ for (File targetPic : files) {
|
|
|
+// System.out.println("targetPic==" + targetPic.getAbsolutePath());
|
|
|
+ boolean matchPic = ImageReconizeUtil.isWholeTemplateMatch(pic.getAbsolutePath(), targetPic.getAbsolutePath());
|
|
|
+ if (matchPic) {
|
|
|
+ toolName = targetPic.getName();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return toolName;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 判断是否是看文档, 具体类型为word, excel, pdf, ppt
|
|
|
*
|