|
@@ -292,6 +292,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
// members = redisUtil.members(Constant.COMMON_SOFTWARE_KEYWORDS);
|
|
// members = redisUtil.members(Constant.COMMON_SOFTWARE_KEYWORDS);
|
|
// }
|
|
// }
|
|
File picFile = new File((String)fileMap.get("newFile"));
|
|
File picFile = new File((String)fileMap.get("newFile"));
|
|
|
|
+ System.out.println("File:"+picFile.getAbsolutePath());
|
|
if (isNovel(textContents)) {
|
|
if (isNovel(textContents)) {
|
|
screenshot.setPicType(6);
|
|
screenshot.setPicType(6);
|
|
} else if (isDocument(textContents)) {
|
|
} else if (isDocument(textContents)) {
|
|
@@ -323,10 +324,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
if (screenshot.getPicType() == null) {
|
|
if (screenshot.getPicType() == null) {
|
|
//默认设置为查资料
|
|
//默认设置为查资料
|
|
try {
|
|
try {
|
|
- String browserName = isBrowser(new File((String)fileMap.get("newFile")));
|
|
|
|
- System.out.println(
|
|
|
|
- "找到浏览器==" + browserName
|
|
|
|
- );
|
|
|
|
|
|
+ String browserName = isBrowser(picFile);
|
|
if (browserName != null) {
|
|
if (browserName != null) {
|
|
screenshot.setPicType(1);
|
|
screenshot.setPicType(1);
|
|
}
|
|
}
|
|
@@ -341,6 +339,29 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
return new HttpRespMsg();
|
|
return new HttpRespMsg();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg reTestPicMatch(int id) {
|
|
|
|
+ Screenshot item = screenshotMapper.selectById(id);
|
|
|
|
+ String fileName = item.getPicUrl().replaceAll("/upload/", "");
|
|
|
|
+ String filePath = path + fileName;
|
|
|
|
+ File pic = new File(filePath);
|
|
|
|
+ String devName = isDevelop(pic);
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+ if(devName != null) {
|
|
|
|
+ msg.data = devName;
|
|
|
|
+ } else {
|
|
|
|
+ try {
|
|
|
|
+ String browserName = isBrowser(pic);
|
|
|
|
+ if (browserName != null) {
|
|
|
|
+ msg.data = browserName;
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg updateRedisPicContentKeywords() {
|
|
public HttpRespMsg updateRedisPicContentKeywords() {
|
|
List<PicContentKeywords> picContentKeywords = picContentKeywordsMapper.selectList(null);
|
|
List<PicContentKeywords> picContentKeywords = picContentKeywordsMapper.selectList(null);
|
|
@@ -423,10 +444,12 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
public static void main(String[] args) throws Exception {
|
|
-// String b = isDevelop(new File("C:\\Users\\seya\\Desktop\\wtt.jpg"));
|
|
|
|
|
|
+// String b = isDevelop(new File("C:\\Users\\seya\\Desktop\\ljn2.jpg"));
|
|
// System.out.println("结果:"+b);
|
|
// System.out.println("结果:"+b);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
private static boolean isPureColor(BufferedImage img, int colorPixel) {
|
|
private static boolean isPureColor(BufferedImage img, int colorPixel) {
|
|
int with = img.getWidth();
|
|
int with = img.getWidth();
|
|
int height = img.getHeight();
|
|
int height = img.getHeight();
|
|
@@ -476,7 +499,6 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
File[] targetFile = subFolder.listFiles();
|
|
File[] targetFile = subFolder.listFiles();
|
|
boolean isMatch = false;
|
|
boolean isMatch = false;
|
|
for (File targetPic : targetFile) {
|
|
for (File targetPic : targetFile) {
|
|
-// System.out.println("targetPic==" + targetPic.getAbsolutePath());
|
|
|
|
boolean matchPic = ImageReconizeUtil.isTemplateMatch(pic.getAbsolutePath(), targetPic.getAbsolutePath());
|
|
boolean matchPic = ImageReconizeUtil.isTemplateMatch(pic.getAbsolutePath(), targetPic.getAbsolutePath());
|
|
if (matchPic) {
|
|
if (matchPic) {
|
|
isMatch = true;
|
|
isMatch = true;
|
|
@@ -493,7 +515,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
}
|
|
}
|
|
|
|
|
|
//判断是否是开发
|
|
//判断是否是开发
|
|
- private String isDevelop(File pic) {
|
|
|
|
|
|
+ private String isDevelop(File pic) {
|
|
File folder = new File(developFolder);
|
|
File folder = new File(developFolder);
|
|
// File folder = new File("C:\\picrecongnize\\develop\\");
|
|
// File folder = new File("C:\\picrecongnize\\develop\\");
|
|
if (!folder.exists()) {
|
|
if (!folder.exists()) {
|
|
@@ -529,11 +551,11 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
boolean find = false;
|
|
boolean find = false;
|
|
for (int i = 0; i < textContents.size() && i <= 2; i++) {//出现在前三行
|
|
for (int i = 0; i < textContents.size() && i <= 2; i++) {//出现在前三行
|
|
String text = textContents.get(i).trim();
|
|
String text = textContents.get(i).trim();
|
|
- if (text.endsWith("Word")
|
|
|
|
- || text.endsWith("Excel")
|
|
|
|
- || text.endsWith("Ecel")
|
|
|
|
- || text.endsWith("Power Point")
|
|
|
|
- || text.endsWith("Adobe Reader")) {
|
|
|
|
|
|
+ if (text.contains("Word")
|
|
|
|
+ || text.contains("Excel")
|
|
|
|
+ || text.contains("Ecel")
|
|
|
|
+ || text.contains("Power Point")
|
|
|
|
+ || text.contains("Adobe Reader")) {
|
|
find = true;
|
|
find = true;
|
|
break;
|
|
break;
|
|
}
|
|
}
|