Browse Source

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

sunyadv 5 years ago
parent
commit
ddf724c3c7

+ 6 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TimeCalculationMapper.java

@@ -1,5 +1,6 @@
 package com.management.platform.mapper;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.management.platform.entity.TimeCalculation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -17,11 +18,11 @@ import java.util.Map;
  * @since 2020-01-09
  */
 public interface TimeCalculationMapper extends BaseMapper<TimeCalculation> {
-    List<Map<String, Object>> getDevianceList(Page page,
-                                              @Param("userId") String userId,
-                                              @Param("actionCode") Integer actionCode,
-                                              @Param("date") String date,
-                                              @Param("companyId") Integer companyId);
+    IPage<Map<String, Object>> getDevianceList(Page page,
+                                               @Param("userId") String userId,
+                                               @Param("actionCode") Integer actionCode,
+                                               @Param("date") String date,
+                                               @Param("companyId") Integer companyId);
 
     Integer countDeviance(@Param("userId") String userId,
                           @Param("actionCode") Integer actionCode,

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -165,7 +165,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             //顺便再获取一下可分配时间
             Integer totalWorkingTime = 0;
             //以下区间被认为是工作时间
-            Integer[] workType = {0, 1, 2, 3, 4, 5};
+            Integer[] workType = {-1, 0, 1, 2, 3, 4, 5};
             //工作时间筛选
             for (TimeCalculation timeCalculation : timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
                     .eq("date", LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd")))

+ 13 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java

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

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeCalculationServiceImpl.java

@@ -136,7 +136,7 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
             LocalDate start = LocalDate.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
             LocalDate end = LocalDate.parse(endDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
             //获取时间段内本人全部的工作记录 娱乐6 7 8不计入
-            Integer[] workType = {0, 1, 2, 3, 4, 5};
+            Integer[] workType = {-1, 0, 1, 2, 3, 4, 5};
             List<TimeCalculation> dataList = timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
                     .eq("user_id", request.getHeader("Token"))
                     .in("action_type", workType)

+ 1 - 10
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/test/TestApplicationTests.java

@@ -1,23 +1,13 @@
 package com.management.platform.test;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.management.platform.constant.Constant;
-import com.management.platform.constant.Parameter;
-import com.management.platform.entity.PicContentKeywords;
 import com.management.platform.mapper.PicContentKeywordsMapper;
-import com.management.platform.util.AuthService;
 import com.management.platform.util.RedisUtil;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
-
 import javax.annotation.Resource;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest
@@ -59,6 +49,7 @@ public class TestApplicationTests {
 //            redisUtil.sSet("keyWords",keyWord);
 //        }
         System.out.println(redisUtil.members("keyWords").toString());
+
     }
 
 }

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

@@ -127,7 +127,7 @@ public class CheckPicUtil {
     }
 
     public static void main(String[] args) {
-//        CheckPicUtil.generalPicTextContent("D:\\360MoveData\\Users\\Administrator\\Desktop\\idea.jpg",(String)AuthService.getAuth().get("access_token"));
+        CheckPicUtil.generalPicTextContent("D:\\xlsx1.jpg",(String)AuthService.getAuth().get("accessToken"));
 
         System.out.println("m]- IntelliJ IDEA(Administrator)".contains("Intellij IDEA"));
 

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

@@ -1,8 +1,6 @@
 package com.management.platform.util;
 
 import org.opencv.core.*;
-import org.opencv.features2d.DescriptorMatcher;
-import org.opencv.highgui.HighGui;
 import org.opencv.imgcodecs.Imgcodecs;
 import org.opencv.imgproc.Imgproc;
 

+ 8 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/UploadFileToFileNameUtil.java

@@ -4,6 +4,8 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.UUID;
 
 /**
@@ -14,7 +16,8 @@ import java.util.UUID;
  */
 public class UploadFileToFileNameUtil {
 
-    public static String uploadFile(MultipartFile file, String path) {
+    public static Map<String, Object> uploadFile(MultipartFile file, String path) {
+        Map<String,Object> map = new HashMap<String, Object>();
         String afterUploadFileName = "";
         if (file != null) {
             File dir = null;
@@ -32,10 +35,12 @@ public class UploadFileToFileNameUtil {
                 String sufix = fileName.substring(pos);
                 fileName = rand + sufix;
                 afterUploadFileName = "/upload/" + fileName;
+                map.put("sqlFilePath",afterUploadFileName);
                 File saveFile = new File(dir, fileName);
                 try {
                     saveFile.createNewFile();
                     file.transferTo(saveFile);
+                    map.put("newFile",saveFile.getAbsolutePath());
                 } catch (IOException e) {
                     e.printStackTrace();
                 } catch (Exception e) {
@@ -43,6 +48,7 @@ public class UploadFileToFileNameUtil {
                 }
             }
         }
-        return afterUploadFileName;
+
+        return map;
     }
 }