소스 검색

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

# Conflicts:
#	fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java
seyason 5 년 전
부모
커밋
d4663446ab

+ 26 - 18
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java

@@ -274,13 +274,6 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
         //利用token去检测
 //        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 //        LocalDateTime l = LocalDateTime.parse("2019-02-03",dateTimeFormatter);
-        Map<String, Object> picResultMap = CheckPicUtil.generalPicTextContentMap(path + filePath.substring("/upload/".length()), accessToken);
-        List<String> textContents = new ArrayList<String>();
-        if (picResultMap != null) {
-            textContents = (List<String>) picResultMap.get("wordsList");
-            screenshot.setPicContext((String) picResultMap.get("picContent"));
-        }
-
 //        Set<Object> members = new HashSet<>();
 //        if (redisUtil.existsKey(Constant.COMMON_SOFTWARE_KEYWORDS)) {
 //            members = redisUtil.members(Constant.COMMON_SOFTWARE_KEYWORDS);
@@ -294,9 +287,19 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
 //        }
         File picFile = new File((String)fileMap.get("newFile"));
         System.out.println("File:"+picFile.getAbsolutePath());
+
+        List<String> textContents = new ArrayList<String>();
+
         if (isIM(picFile) != null) {
             screenshot.setPicType(9);//聊天
-        } if (isNovel(textContents)) {
+        } else {
+            Map<String, Object> picResultMap = CheckPicUtil.generalPicTextContentMap(path + filePath.substring("/upload/".length()), accessToken);
+            if (picResultMap != null) {
+                textContents = (List<String>) picResultMap.get("wordsList");
+                screenshot.setPicContext((String) picResultMap.get("picContent"));
+            }
+        }
+        if (isNovel(textContents)) {
             screenshot.setPicType(6);
         } else if (isDocument(textContents)) {
             screenshot.setPicType(2);//看文档
@@ -348,18 +351,23 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
         String fileName = item.getPicUrl().replaceAll("/upload/", "");
         String filePath = path + fileName;
         File pic = new File(filePath);
-        String devName = isDevelop(pic);
+        String imName = isIM(pic);
         HttpRespMsg msg = new HttpRespMsg();
-        if(devName != null) {
-            msg.data = devName;
+        if (imName != null) {
+            msg.data = imName;
         } else {
-            try {
-                String browserName = isBrowser(pic);
-                if (browserName != null) {
-                    msg.data = browserName;
+            String devName = isDevelop(pic);
+            if(devName != null) {
+                msg.data = devName;
+            } else {
+                try {
+                    String browserName = isBrowser(pic);
+                    if (browserName != null) {
+                        msg.data = browserName;
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
                 }
-            } catch (Exception e) {
-                e.printStackTrace();
             }
         }
         return msg;
@@ -447,7 +455,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\\chat.jpg"));
 //        System.out.println("结果:"+b);
     }
 

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/ImageReconizeUtil.java

@@ -48,7 +48,7 @@ public class ImageReconizeUtil {
     public static boolean isWholeTemplateMatch(String sourcePic, String targetPic) {
         double matchVal = templete(Imgproc.TM_SQDIFF_NORMED, sourcePic, targetPic, false);
         if (Math.abs(matchVal) < YUZHI) {
-            System.out.println("找到啦");
+            System.out.println("找到啦"+targetPic);
             return true;
         } else {
             System.out.println("没匹配上");