|
@@ -123,7 +123,9 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg saveAndProcessImage(ScreenshotVO screenshotvo) {
|
|
public HttpRespMsg saveAndProcessImage(ScreenshotVO screenshotvo) {
|
|
System.out.println("uid===" + screenshotvo.getUid());
|
|
System.out.println("uid===" + screenshotvo.getUid());
|
|
- String filePath = UploadFileToFileNameUtil.uploadFile(screenshotvo.getFile(), path);
|
|
|
|
|
|
+ System.out.println("path===" + path);
|
|
|
|
+ Map<String, Object> fileMap = UploadFileToFileNameUtil.uploadFile(screenshotvo.getFile(), path);
|
|
|
|
+ String filePath = (String)fileMap.get("sqlFilePath");
|
|
Screenshot screenshot = new Screenshot();
|
|
Screenshot screenshot = new Screenshot();
|
|
BeanUtils.copyProperties(screenshotvo, screenshot);
|
|
BeanUtils.copyProperties(screenshotvo, screenshot);
|
|
screenshot.setPicUrl(filePath);
|
|
screenshot.setPicUrl(filePath);
|
|
@@ -198,14 +200,14 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
screenshot.setIsHandle(1);
|
|
screenshot.setIsHandle(1);
|
|
if (screenshot.getPicType() == null) {
|
|
if (screenshot.getPicType() == null) {
|
|
//判断是否是娱乐:看电影, 打游戏
|
|
//判断是否是娱乐:看电影, 打游戏
|
|
- if (isEntertainment(new File(filePath))) {
|
|
|
|
|
|
+ if (isEntertainment(new File((String)fileMap.get("newFile")))) {
|
|
screenshot.setPicType(7);
|
|
screenshot.setPicType(7);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (screenshot.getPicType() == null) {
|
|
if (screenshot.getPicType() == null) {
|
|
//默认设置为查资料
|
|
//默认设置为查资料
|
|
try {
|
|
try {
|
|
- String browserName = isBrowser(new File(filePath));
|
|
|
|
|
|
+ String browserName = isBrowser(new File((String)fileMap.get("newFile")));
|
|
System.out.println(
|
|
System.out.println(
|
|
"找到浏览器==" + browserName
|
|
"找到浏览器==" + browserName
|
|
);
|
|
);
|
|
@@ -315,6 +317,11 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
public static boolean isEntertainment(File pic) {
|
|
public static boolean isEntertainment(File pic) {
|
|
try {
|
|
try {
|
|
int[] rgb = new int[3];
|
|
int[] rgb = new int[3];
|
|
|
|
+ if (!pic.exists()) {
|
|
|
|
+ System.err.println("文件不存在" + pic.getAbsolutePath());
|
|
|
|
+ } else {
|
|
|
|
+ System.out.println("找到文件" + pic.getAbsolutePath());
|
|
|
|
+ }
|
|
BufferedImage img = ImageIO.read(pic);
|
|
BufferedImage img = ImageIO.read(pic);
|
|
int width = img.getWidth();
|
|
int width = img.getWidth();
|
|
int height = img.getHeight();
|
|
int height = img.getHeight();
|
|
@@ -442,9 +449,9 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
//每次获取到截屏后计算并处理
|
|
//每次获取到截屏后计算并处理
|
|
private void calculateTime(Screenshot screenshot) {
|
|
private void calculateTime(Screenshot screenshot) {
|
|
try {
|
|
try {
|
|
- //如果图片类型为空 则认为是0-编程
|
|
|
|
- if(screenshot.getPicType() == null){
|
|
|
|
- screenshot.setPicType(0);
|
|
|
|
|
|
+ //如果图片类型为空 则认为是-1-其他
|
|
|
|
+ if(null == screenshot.getPicType()){
|
|
|
|
+ screenshot.setPicType(-1);
|
|
}
|
|
}
|
|
//默认状态为不连续 如果下面判断是连续才会修改为true
|
|
//默认状态为不连续 如果下面判断是连续才会修改为true
|
|
Boolean isConsecutive = false;
|
|
Boolean isConsecutive = false;
|