Parcourir la source

搭配船新部门的威力加强版

Reiskuchen il y a 5 ans
Parent
commit
f4ae7d6fd6
27 fichiers modifiés avec 311 ajouts et 108 suppressions
  1. 21 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/CompanyController.java
  2. 5 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java
  3. 5 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ScreenshotController.java
  4. 6 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TimeCalculationController.java
  5. 0 16
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TokenValidator.java
  6. 45 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Company.java
  7. 7 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Project.java
  8. 8 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/User.java
  9. 16 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/CompanyMapper.java
  10. 4 3
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ReportMapper.java
  11. 2 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ScreenshotMapper.java
  12. 7 4
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TimeCalculationMapper.java
  13. 16 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/CompanyService.java
  14. 3 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java
  15. 3 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ScreenshotService.java
  16. 5 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/TimeCalculationService.java
  17. 20 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/CompanyServiceImpl.java
  18. 16 7
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  19. 31 23
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java
  20. 41 30
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeCalculationServiceImpl.java
  21. 8 5
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java
  22. 16 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/CompanyMapper.xml
  23. 2 1
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml
  24. 9 6
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml
  25. 4 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ScreenshotMapper.xml
  26. 9 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeCalculationMapper.xml
  27. 2 1
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/UserMapper.xml

+ 21 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/CompanyController.java

@@ -0,0 +1,21 @@
+package com.management.platform.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2020-01-13
+ */
+@RestController
+@RequestMapping("/company")
+public class CompanyController {
+
+}
+

+ 5 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * <p>
  * 前端控制器
@@ -23,6 +25,8 @@ import org.springframework.web.bind.annotation.RestController;
 public class ReportController {
     @Autowired
     private ReportService reportService;
+    @Autowired
+    private HttpServletRequest request;
 
     /**
      * 根据时间 按照人分类 获取报告信息
@@ -30,7 +34,7 @@ public class ReportController {
      */
     @RequestMapping("/getReportList")
     public HttpRespMsg getReportList(@RequestParam String date) {
-        return reportService.getReportList(date);
+        return reportService.getReportList(date, request);
     }
 
     /**

+ 5 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ScreenshotController.java

@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * <p>
  * 前端控制器
@@ -22,13 +24,15 @@ import org.springframework.web.bind.annotation.RestController;
 public class ScreenshotController {
     @Autowired
     private ScreenshotService screenshotService;
+    @Autowired
+    private HttpServletRequest request;
 
     /**
      * 获取每个人最新的截图
      */
     @RequestMapping("/getLatestScreenshotList")
     public HttpRespMsg getLatestScreenshotList() {
-        return screenshotService.getLatestScreenshotList();
+        return screenshotService.getLatestScreenshotList(request);
     }
 
     /**

+ 6 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TimeCalculationController.java

@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * <p>
  * 前端控制器
@@ -23,6 +25,8 @@ public class TimeCalculationController {
 
     @Autowired
     private TimeCalculationService timeCalculationService;
+    @Autowired
+    private HttpServletRequest request;
 
     /**
      * 获取某人今日工作时间和其他信息
@@ -44,12 +48,12 @@ public class TimeCalculationController {
     @RequestMapping("/getDevianceList")
     public HttpRespMsg getDevianceList(@RequestParam Integer pageIndex, @RequestParam Integer pageSize,
                                        String userId, Integer actionCode, String date) {
-        return timeCalculationService.getDevianceList(pageIndex, pageSize, userId, actionCode, date);
+        return timeCalculationService.getDevianceList(pageIndex, pageSize, userId, actionCode, date, request);
     }
 
     @RequestMapping("/getTimeStatistics")
     public HttpRespMsg getTimeStatistics(@RequestParam String date) {
-        return timeCalculationService.getTimeStatistics(date);
+        return timeCalculationService.getTimeStatistics(date, request);
     }
 }
 

+ 0 - 16
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TokenValidator.java

@@ -1,16 +0,0 @@
-package com.management.platform.controller;
-
-import com.management.platform.mapper.UserMapper;
-import com.management.platform.util.HttpRespMsg;
-
-import javax.annotation.Resource;
-
-public class TokenValidator {
-
-    @Resource
-    private UserMapper userMapper;
-
-    public HttpRespMsg validator(HttpRespMsg httpRespMsg, String token) {
-        return new HttpRespMsg();
-    }
-}

+ 45 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Company.java

@@ -0,0 +1,45 @@
+package com.management.platform.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2020-01-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class Company extends Model<Company> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 公司表主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 公司名
+     */
+    @TableField("company_name")
+    private String companyName;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 7 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Project.java

@@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author 吴涛涛
- * @since 2020-01-08
+ * @since 2020-01-13
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -36,6 +36,12 @@ public class Project extends Model<Project> {
     @TableField("project_name")
     private String projectName;
 
+    /**
+     * 公司表外键
+     */
+    @TableField("company_id")
+    private Integer companyId;
+
 
     @Override
     protected Serializable pkVal() {

+ 8 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/User.java

@@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author 吴涛涛
- * @since 2020-01-08
+ * @since 2020-01-13
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -61,11 +61,17 @@ public class User extends Model<User> {
     private LocalDateTime createTime;
 
     /**
-     * 角色权限 0-员工 1-管理员
+     * 角色权限 0-员工 1-负责人 2-管理员
      */
     @TableField("role")
     private Integer role;
 
+    /**
+     * 公司表外键
+     */
+    @TableField("company_id")
+    private Integer companyId;
+
 
     @Override
     protected Serializable pkVal() {

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/CompanyMapper.java

@@ -0,0 +1,16 @@
+package com.management.platform.mapper;
+
+import com.management.platform.entity.Company;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2020-01-13
+ */
+public interface CompanyMapper extends BaseMapper<Company> {
+
+}

+ 4 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ReportMapper.java

@@ -10,13 +10,14 @@ import java.util.Map;
 
 /**
  * <p>
- *  Mapper 接口
+ * Mapper 接口
  * </p>
  *
  * @author 吴涛涛
  * @since 2019-12-31
  */
 public interface ReportMapper extends BaseMapper<Report> {
-    List<Map<String, Object>> getReportByDate(@Param("date")String date, @Param("id")String id);
-    List<Map<String, Object>> getReportNameByDate(@Param("date")String date);
+    List<Map<String, Object>> getReportByDate(@Param("date") String date, @Param("id") String id);
+
+    List<Map<String, Object>> getReportNameByDate(@Param("date") String date, @Param("companyId") Integer companyId);
 }

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ScreenshotMapper.java

@@ -4,6 +4,7 @@ import com.management.platform.entity.Screenshot;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.management.platform.entity.vo.ScreenshotVO;
 import com.management.platform.util.HttpRespMsg;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -17,7 +18,7 @@ import java.util.Map;
  * @since 2020-01-02
  */
 public interface ScreenshotMapper extends BaseMapper<Screenshot> {
-    List<Map<String, Object>> getLatestScreenshotList();
+    List<Map<String, Object>> getLatestScreenshotList(@Param("companyId")Integer companyId);
 
     HttpRespMsg saveAndProcessImage(ScreenshotVO screenshotvo);
 }

+ 7 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TimeCalculationMapper.java

@@ -20,14 +20,17 @@ 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("date") String date,
+                                              @Param("companyId") Integer companyId);
 
     Integer countDeviance(@Param("userId") String userId,
                           @Param("actionCode") Integer actionCode,
-                          @Param("date") String date);
+                          @Param("date") String date,
+                          @Param("companyId") Integer companyId);
 
-    List<Map<String, Object>> getTodayStatisticsUser(@Param("date") String date);
+    List<Map<String, Object>> getTodayStatisticsUser(@Param("date") String date, @Param("companyId") Integer companyId);
 
     List<Map<String, Object>> getTodayStatistics(@Param("userId") String userId,
-                                                 @Param("date") String date);
+                                                 @Param("date") String date,
+                                                 @Param("companyId") Integer companyId);
 }

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/CompanyService.java

@@ -0,0 +1,16 @@
+package com.management.platform.service;
+
+import com.management.platform.entity.Company;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2020-01-13
+ */
+public interface CompanyService extends IService<Company> {
+
+}

+ 3 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java

@@ -4,6 +4,8 @@ import com.management.platform.entity.Report;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.management.platform.util.HttpRespMsg;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * <p>
  * 服务类
@@ -13,7 +15,7 @@ import com.management.platform.util.HttpRespMsg;
  * @since 2019-12-31
  */
 public interface ReportService extends IService<Report> {
-    HttpRespMsg getReportList(String date);
+    HttpRespMsg getReportList(String date, HttpServletRequest request);
 
     HttpRespMsg editReport(Report report);
 

+ 3 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ScreenshotService.java

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.management.platform.entity.vo.ScreenshotVO;
 import com.management.platform.util.HttpRespMsg;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * <p>
  * 服务类
@@ -14,7 +16,7 @@ import com.management.platform.util.HttpRespMsg;
  * @since 2020-01-02
  */
 public interface ScreenshotService extends IService<Screenshot> {
-    HttpRespMsg getLatestScreenshotList();
+    HttpRespMsg getLatestScreenshotList(HttpServletRequest request);
 
     HttpRespMsg getTodayScreenshotList(String userId);
 

+ 5 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/TimeCalculationService.java

@@ -4,6 +4,8 @@ import com.management.platform.entity.TimeCalculation;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.management.platform.util.HttpRespMsg;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * <p>
  * 服务类
@@ -15,7 +17,8 @@ import com.management.platform.util.HttpRespMsg;
 public interface TimeCalculationService extends IService<TimeCalculation> {
     HttpRespMsg getTodayWorkingTime(String userId);
 
-    HttpRespMsg getDevianceList(Integer pageIndex, Integer pageSize, String userId, Integer actionCode, String date);
+    HttpRespMsg getDevianceList(Integer pageIndex, Integer pageSize,
+                                String userId, Integer actionCode, String date, HttpServletRequest request);
 
-    HttpRespMsg getTimeStatistics(String date);
+    HttpRespMsg getTimeStatistics(String date, HttpServletRequest request);
 }

+ 20 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/CompanyServiceImpl.java

@@ -0,0 +1,20 @@
+package com.management.platform.service.impl;
+
+import com.management.platform.entity.Company;
+import com.management.platform.mapper.CompanyMapper;
+import com.management.platform.service.CompanyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2020-01-13
+ */
+@Service
+public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements CompanyService {
+
+}

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.management.platform.entity.Report;
 import com.management.platform.mapper.ReportMapper;
+import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.ReportService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.util.HttpRespMsg;
@@ -18,6 +19,7 @@ import java.util.List;
 import java.util.Map;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * <p>
@@ -32,18 +34,25 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
 
     @Resource
     private ReportMapper reportMapper;
+    @Resource
+    private UserMapper userMapper;
 
     //获取报告列表
     @Override
-    public HttpRespMsg getReportList(String date) {
+    public HttpRespMsg getReportList(String date, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        //首先根据日期获取当天所有提交过日志的人
-        List<Map<String, Object>> nameList = reportMapper.getReportNameByDate(date);
-        for (Map<String, Object> map : nameList) {
-            //再根据人分别获取当天的报告
-            map.put("data", reportMapper.getReportByDate(date, (String) map.get("id")));
+        try {
+            //首先根据日期获取当天所有提交过日志的人
+            List<Map<String, Object>> nameList = reportMapper.getReportNameByDate(date,
+                    userMapper.selectById(request.getHeader("Token")).getCompanyId());
+            for (Map<String, Object> map : nameList) {
+                //再根据人分别获取当天的报告
+                map.put("data", reportMapper.getReportByDate(date, (String) map.get("id")));
+            }
+            httpRespMsg.data = nameList;
+        } catch (NullPointerException e) {
+            httpRespMsg.setError("验证失败");
         }
-        httpRespMsg.data = nameList;
         return httpRespMsg;
     }
 

+ 31 - 23
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java

@@ -9,11 +9,10 @@ import com.management.platform.constant.Parameter;
 import com.management.platform.entity.PicContentKeywords;
 import com.management.platform.entity.Screenshot;
 import com.management.platform.entity.TimeCalculation;
+import com.management.platform.entity.User;
 import com.management.platform.entity.vo.ScreenshotVO;
+import com.management.platform.mapper.*;
 import com.management.platform.mapper.PicContentKeywordsMapper;
-import com.management.platform.mapper.PicContentKeywordsMapper;
-import com.management.platform.mapper.ScreenshotMapper;
-import com.management.platform.mapper.TimeCalculationMapper;
 import com.management.platform.service.ScreenshotService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.util.*;
@@ -26,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletRequest;
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.text.SimpleDateFormat;
@@ -69,18 +69,26 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
     @Resource
     private TimeCalculationMapper timeCalculationMapper;
 
+    @Resource
+    private UserMapper userMapper;
+
     //获取所有人最新的截图
     @Override
-    public HttpRespMsg getLatestScreenshotList() {
+    public HttpRespMsg getLatestScreenshotList(HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         //获取每一个人最后一张截图
-        List<Map<String, Object>> resultMap = screenshotMapper.getLatestScreenshotList();
-        for (Map<String, Object> map : resultMap) {
-            //对于每一张图 将时间戳转换为时间
-            map.put("time", new SimpleDateFormat("HH:mm:ss").format(map.get("indate")));
-            map.remove("indate");
+        try {
+            List<Map<String, Object>> resultMap = screenshotMapper
+                    .getLatestScreenshotList(userMapper.selectById(request.getHeader("Token")).getCompanyId());
+            for (Map<String, Object> map : resultMap) {
+                //对于每一张图 将时间戳转换为时间
+                map.put("time", new SimpleDateFormat("HH:mm:ss").format(map.get("indate")));
+                map.remove("indate");
+            }
+            httpRespMsg.data = resultMap;
+        } catch (NullPointerException e) {
+            httpRespMsg.setError("验证失败");
         }
-        httpRespMsg.data = resultMap;
         return httpRespMsg;
     }
 
@@ -213,8 +221,8 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
         if (chWNum < 200) {
             return false;
         }
-        int percent = chWNum*100/total;
-        log.info("中文比例:"+percent);
+        int percent = chWNum * 100 / total;
+        log.info("中文比例:" + percent);
         if (percent < 60) {
             //英文太多,不是小说; 不考虑英文小说。
             return false;
@@ -235,7 +243,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
                 }
             }
             int totalKNum = 0;
-            for (String k: textContents) {
+            for (String k : textContents) {
                 int kNum = 0;
                 for (String nk : nKeyWordsList) {
                     if (k.contains(nk)) {
@@ -248,7 +256,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
                     totalKNum += 1;
                 }
             }
-            log.info("文章小说匹配得分为=="+totalKNum);
+            log.info("文章小说匹配得分为==" + totalKNum);
             if (totalKNum >= 5) {
                 return true;
             }
@@ -301,7 +309,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
             int maxCnt = 0;
             int key = 0;
             Set<Map.Entry<Integer, Integer>> entry2 = colorCntMap.entrySet();
-            for(Map.Entry<Integer, Integer> temp : entry2){
+            for (Map.Entry<Integer, Integer> temp : entry2) {
 //                System.out.println("sortedMap:"+temp.getKey()+" 值"+temp.getValue());
                 if (temp.getValue() > maxCnt) {
                     maxCnt = temp.getValue();
@@ -312,16 +320,16 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
             rgb[0] = (key & 0xff0000) >> 16;
             rgb[1] = (key & 0xff00) >> 8;
             rgb[2] = (key & 0xff);
-            System.out.println("色值为: " + rgb[0] + ", " + rgb[1]+", "+rgb[2]);
+            System.out.println("色值为: " + rgb[0] + ", " + rgb[1] + ", " + rgb[2]);
             //计算比例, 应该不低于50%
             int colorPercent = maxCnt * 100 / totalPixl;
-            System.out.println("底色比例=="+colorPercent);
+            System.out.println("底色比例==" + colorPercent);
             //计算底色是否是连续分布的
-            int windowSize=50;
+            int windowSize = 50;
             int pureColorBlockCnt = 0;
             int totalBlockCnt = 0;
-            for (int i = minx; i < width - windowSize; i+=windowSize) {
-                for (int j = miny; j < height - windowSize; j+=windowSize) {
+            for (int i = minx; i < width - windowSize; i += windowSize) {
+                for (int j = miny; j < height - windowSize; j += windowSize) {
                     totalBlockCnt++;
                     BufferedImage rect = img.getSubimage(i, j, windowSize, windowSize);
                     if (isPureColor(rect, key)) {
@@ -329,9 +337,9 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
                     }
                 }
             }
-            log.info("pureColorBlockCnt==="+pureColorBlockCnt);
+            log.info("pureColorBlockCnt===" + pureColorBlockCnt);
             int pureColorBlackPercent = pureColorBlockCnt * 100 / totalBlockCnt;
-            log.info("pureColorBlackPercent==="+pureColorBlackPercent);
+            log.info("pureColorBlackPercent===" + pureColorBlackPercent);
             if (colorPercent < 50 && pureColorBlackPercent < 30) {
                 return true;
             }
@@ -346,7 +354,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
         int with = img.getWidth();
         int height = img.getHeight();
         boolean hasDifferent = false;
-        for (int i=0;i<with; i++) {
+        for (int i = 0; i < with; i++) {
             for (int y = 0; y < height; y++) {
                 int pixel = img.getRGB(i, y); // 下面三行代码将一个数字转换为RGB数字
                 if (pixel != colorPixel) {

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

@@ -11,6 +11,7 @@ import com.management.platform.util.HttpRespMsg;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import java.time.LocalDate;
 import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
@@ -58,45 +59,55 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
     //分页获取今日全部异常信息
     @Override
     public HttpRespMsg getDevianceList(Integer pageIndex, Integer pageSize,
-                                       String userId, Integer actionCode, String date) {
+                                       String userId, Integer actionCode, String date, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        Map<String, Object> resultMap = new HashMap<>();
-        //注意这里目前把代码为0以外的行为全部计作异常 后续可能需要修改
-        resultMap.put("records", timeCalculationMapper
-                .getDevianceList(new Page<>(pageIndex, pageSize), userId, actionCode, date));
-        //返回总数
-        resultMap.put("total", timeCalculationMapper.countDeviance(userId, actionCode, date));
-        httpRespMsg.data = resultMap;
+        try {
+            Map<String, Object> resultMap = new HashMap<>();
+            Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
+            //注意这里目前把代码为0以外的行为全部计作异常 后续可能需要修改
+            resultMap.put("records", timeCalculationMapper
+                    .getDevianceList(new Page<>(pageIndex, pageSize), userId, actionCode, date, companyId));
+            //返回总数
+            resultMap.put("total", timeCalculationMapper.countDeviance(userId, actionCode, date, companyId));
+            httpRespMsg.data = resultMap;
+        } catch (NullPointerException e) {
+            httpRespMsg.setError("验证失败");
+        }
         return httpRespMsg;
     }
 
     //获取每日时间统计
     @Override
-    public HttpRespMsg getTimeStatistics(String date) {
+    public HttpRespMsg getTimeStatistics(String date, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        List<Map<String, Object>> resultList = new ArrayList<>();
-        //首先获取某日期有截图的人
-        for (Map<String, Object> userMap : timeCalculationMapper.getTodayStatisticsUser(date)) {
-            //对于每一个人 首先记录下姓名和电话号码
-            Map<String, Object> map = new HashMap<>();
-            map.put("name", userMap.get("name"));
-            map.put("phone", userMap.get("phone"));
-            //然后根据日期和用户id获取到所有的记录 然后手动累加在一起
-            Double[] doubleArray = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-            for (Map<String, Object> dataMap : timeCalculationMapper
-                    .getTodayStatistics((String) userMap.get("id"), date)) {
-                doubleArray[(int) dataMap.get("type")] += (Double) dataMap.get("duration");
-            }
-            map.put("statistics", doubleArray);
-            //最后是数组的和
-            Double sum = 0.0;
-            for (Double singleNumber : doubleArray) {
-                sum += singleNumber;
+        try {
+            List<Map<String, Object>> resultList = new ArrayList<>();
+            Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
+            //首先获取某日期有截图的人
+            for (Map<String, Object> userMap : timeCalculationMapper.getTodayStatisticsUser(date, companyId)) {
+                //对于每一个人 首先记录下姓名和电话号码
+                Map<String, Object> map = new HashMap<>();
+                map.put("name", userMap.get("name"));
+                map.put("phone", userMap.get("phone"));
+                //然后根据日期和用户id获取到所有的记录 然后手动累加在一起
+                Double[] doubleArray = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+                for (Map<String, Object> dataMap : timeCalculationMapper
+                        .getTodayStatistics((String) userMap.get("id"), date, companyId)) {
+                    doubleArray[(int) dataMap.get("type")] += (Double) dataMap.get("duration");
+                }
+                map.put("statistics", doubleArray);
+                //最后是数组的和
+                Double sum = 0.0;
+                for (Double singleNumber : doubleArray) {
+                    sum += singleNumber;
+                }
+                map.put("sum", sum);
+                resultList.add(map);
             }
-            map.put("sum", sum);
-            resultList.add(map);
+            httpRespMsg.data = resultList;
+        } catch (NullPointerException e) {
+            httpRespMsg.setError("验证失败");
         }
-        httpRespMsg.data = resultList;
         return httpRespMsg;
     }
 }

+ 8 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -11,9 +11,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * <p>
@@ -80,9 +78,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     @Override
     public HttpRespMsg getEmployeeList(HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        //先不检查身份了
-        String token = request.getHeader("Token");
-        httpRespMsg.data = userMapper.selectList(new QueryWrapper<User>().eq("role", 0));
+        try {
+            //获取本公司除负责人以外全部的信息
+            httpRespMsg.data = userMapper.selectList(new QueryWrapper<User>()
+                    .ne("role", 1)
+                    .eq("company_id", userMapper.selectById(request.getHeader("Token")).getCompanyId()));
+        } catch (NullPointerException e) {
+            httpRespMsg.setError("验证失败");
+        }
         return httpRespMsg;
     }
 

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/CompanyMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.management.platform.mapper.CompanyMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.Company">
+        <id column="id" property="id" />
+        <result column="company_name" property="companyName" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, company_name
+    </sql>
+
+</mapper>

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml

@@ -6,11 +6,12 @@
     <resultMap id="BaseResultMap" type="com.management.platform.entity.Project">
         <id column="id" property="id" />
         <result column="project_name" property="projectName" />
+        <result column="company_id" property="companyId" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, project_name
+        id, project_name, company_id
     </sql>
 
 </mapper>

+ 9 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -23,9 +23,9 @@
         SELECT b.project_name AS project, a.working_time AS time, a.content
         FROM report AS a
         JOIN project AS b ON a.project_id=b.id
-        WHERE 1=1 AND
+        WHERE 1=1
         <if test="date != null and date != ''">
-            a.create_date=#{date}
+            AND a.create_date=#{date}
         </if>
         AND a.creator_id=#{id}
         ORDER BY a.project_id ASC
@@ -33,12 +33,15 @@
 
     <!--根据日期获取报告上传人-->
     <select id="getReportNameByDate" resultType="java.util.Map">
-        SELECT DISTINCT c.id, c.name
+        SELECT DISTINCT b.id, b.name
         FROM report AS a
-        JOIN user AS c ON a.creator_id=c.id
-        WHERE 1=1 AND
+        JOIN user AS b ON a.creator_id=b.id
+        WHERE 1=1
         <if test="date != null and date != ''">
-            a.create_date=#{date}
+            AND a.create_date=#{date}
+        </if>
+        <if test="companyId != null and companyId != ''">
+            AND b.company_id=#{companyId}
         </if>
     </select>
 

+ 4 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ScreenshotMapper.xml

@@ -32,6 +32,10 @@
         ON a.uid = b.uid AND a.indate = b.max_indate
         LEFT JOIN USER AS c
         ON a.uid = c.id
+        WHERE 1=1
+        <if test="companyId != null and companyId != ''">
+            AND c.company_id=#{companyId}
+        </if>
     </select>
 
 </mapper>

+ 9 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeCalculationMapper.xml

@@ -24,6 +24,9 @@
         FROM time_calculation AS a
         LEFT JOIN user AS b ON a.user_id = b.id
         WHERE 1=1
+        <if test="companyId != null and companyId != ''">
+            AND b.company_id=#{companyId}
+        </if>
         <if test="userId != null and userId != ''">
             AND a.user_id = #{userId}
         </if>
@@ -44,6 +47,9 @@
         FROM time_calculation AS a
         LEFT JOIN user AS b ON a.user_id = b.id
         WHERE 1=1
+        <if test="companyId != null and companyId != ''">
+            AND b.company_id=#{companyId}
+        </if>
         <if test="userId != null and userId != ''">
             AND a.user_id = #{userId}
         </if>
@@ -65,6 +71,9 @@
         LEFT JOIN user AS b
         ON a.user_id = b.id
         WHERE 1=1
+        <if test="companyId != null and companyId != ''">
+            AND b.company_id=#{companyId}
+        </if>
         <if test="date != null and date != ''">
             AND a.date = #{date}
         </if>

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/UserMapper.xml

@@ -11,11 +11,12 @@
         <result column="portrait_url" property="portraitUrl" />
         <result column="create_time" property="createTime" />
         <result column="role" property="role" />
+        <result column="company_id" property="companyId" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, name, phone, password, portrait_url, create_time, role
+        id, name, phone, password, portrait_url, create_time, role, company_id
     </sql>
 
 </mapper>