فهرست منبع

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

sunyadv 5 سال پیش
والد
کامیت
8f307b4766
39فایلهای تغییر یافته به همراه956 افزوده شده و 110 حذف شده
  1. 21 6
      fhKeeper/formulahousekeeper/management-platform/pom.xml
  2. 27 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/PlatformStartApplication.java
  3. 67 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/aop/AopLogConfiguration.java
  4. 11 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/constant/Constant.java
  5. 53 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ImageProcessingController.java
  6. 21 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java
  7. 45 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java
  8. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ScreenshotController.java
  9. 16 9
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java
  10. 51 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/PicContentKeywords.java
  11. 45 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Project.java
  12. 14 6
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Report.java
  13. 5 5
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Screenshot.java
  14. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/User.java
  15. 16 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/ScreenshotVO.java
  16. 16 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/PicContentKeywordsMapper.java
  17. 16 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ProjectMapper.java
  18. 3 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ScreenshotMapper.java
  19. 16 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/PicContentKeywordsService.java
  20. 16 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ProjectService.java
  21. 6 3
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java
  22. 3 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ScreenshotService.java
  23. 4 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java
  24. 20 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/PicContentKeywordsServiceImpl.java
  25. 20 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java
  26. 35 30
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  27. 72 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java
  28. 29 9
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java
  29. 22 13
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java
  30. 31 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/test/TestApplicationTests.java
  31. 4 3
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/AuthService.java
  32. 98 4
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/CheckPicUtil.java
  33. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/CodeGenerator.java
  34. 59 9
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/FileUtil.java
  35. 35 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/RedisUtil.java
  36. 17 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/PicContentKeywordsMapper.xml
  37. 16 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml
  38. 3 2
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml
  39. 20 1
      fhKeeper/formulahousekeeper/pom.xml

+ 21 - 6
fhKeeper/formulahousekeeper/management-platform/pom.xml

@@ -81,13 +81,28 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
         </dependency>
+        <!--开启aop支持-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjweaver</artifactId>
+        </dependency>
 
-<!--        &lt;!&ndash; https://mvnrepository.com/artifact/at.bestsolution.efxclipse.eclipse/com.google.gson &ndash;&gt;-->
-<!--        <dependency>-->
-<!--            <groupId>at.bestsolution.efxclipse.eclipse</groupId>-->
-<!--            <artifactId>com.google.gson</artifactId>-->
-<!--            <version>2.2.4</version>-->
-<!--        </dependency>-->
+        <!--        &lt;!&ndash; https://mvnrepository.com/artifact/at.bestsolution.efxclipse.eclipse/com.google.gson &ndash;&gt;-->
+        <!--        <dependency>-->
+        <!--            <groupId>at.bestsolution.efxclipse.eclipse</groupId>-->
+        <!--            <artifactId>com.google.gson</artifactId>-->
+        <!--            <version>2.2.4</version>-->
+        <!--        </dependency>-->
 
 
     </dependencies>

+ 27 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/PlatformStartApplication.java

@@ -1,8 +1,20 @@
 package com.management.platform;
 
 import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import javax.activation.DataSource;
 
 /**
  * Author: 吴涛涛
@@ -12,8 +24,22 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
  */
 @SpringBootApplication
 @MapperScan("com.management.platform.mapper")
+@EnableTransactionManagement //开启事务支持
 public class PlatformStartApplication {
     public static void main(String[] args) {
-        SpringApplication.run(PlatformStartApplication.class,args);
+        SpringApplication.run(PlatformStartApplication.class, args);
+    }
+
+    //防止存入redis数据后乱码
+    @Bean(name = "redisTemplate")
+    public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory factory) {
+        RedisTemplate<String, String> template = new RedisTemplate<>();
+        template.setConnectionFactory(factory);
+        template.setKeySerializer(new StringRedisSerializer());
+        template.setValueSerializer(new GenericJackson2JsonRedisSerializer());
+        template.setHashKeySerializer(new GenericJackson2JsonRedisSerializer());
+        template.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
+        template.afterPropertiesSet();
+        return template;
     }
 }

+ 67 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/aop/AopLogConfiguration.java

@@ -0,0 +1,67 @@
+package com.management.platform.aop;
+
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.*;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 08 - 30 13:59
+ * Description:<描述> 开启aop配置
+ * Version: 1.0
+ */
+@Slf4j
+@Aspect
+@Configuration
+public class AopLogConfiguration {
+    //切入点表达式
+    @Pointcut("execution(public * com.management.*.service.*.*(..)) || execution(public * com.management.*.controller.*.*(..))")
+    public void logPointcut(){
+
+    }
+
+    /**
+     * 前置通知
+     */
+    @Before("logPointcut()")
+    public void  methodBefore(JoinPoint joinPoint){
+        ServletRequestAttributes requestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = requestAttributes.getRequest();
+        //打印请求内容
+        log.info("---------------请求内容---------------");
+        log.info("请求地址:"+request.getRequestURL().toString());
+        log.info("请求方式:"+request.getMethod());
+        log.info("请求类方法:"+joinPoint.getSignature().getName());
+        log.info("请求类方法参数:"+ Arrays.toString(joinPoint.getArgs()));
+        log.info("---------------请求内容---------------");
+    }
+
+    /**
+     * 后置通知
+     */
+    @AfterReturning(returning = "o",pointcut = "logPointcut()")
+    public void methodAfterReturning(Object o){
+        log.info("===============返回内容===============");
+        log.info("返回的内容:"+ o.toString());
+        log.info("===============返回内容===============");
+    }
+
+    /**
+     * 异常通知
+     */
+    @AfterThrowing(pointcut = "logPointcut()",throwing = "e")
+    public void logThrowing(JoinPoint joinPoint,Throwable e){
+        log.info("***************抛出异常***************");
+
+        log.info("请求类方法:"+joinPoint.getSignature().getName());
+        log.info("异常内容:"+e);
+        log.info("***************抛出异常***************");
+    }
+
+}

+ 11 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/constant/Constant.java

@@ -2,6 +2,9 @@ package com.management.platform.constant;
 
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Author: 吴涛涛
  * Date : 2019 - 07 - 24 16:00
@@ -14,6 +17,14 @@ public class Constant {
     public static final String SECRET_KEY = "RipT5kfF3Zqp7S2vTXPlNcMiYcA76jfq";//百度文字识别secretKey
     public static final Integer UN_HANDLE = 0;//定时任务未处理的状态码
     public static final String PIC_PATH_PREFIX = "";//定时任务未处理的状态码
+    public static final String COMMON_SOFTWARE_KEYWORDS = "keyWords";//常用软件关键字
+    public static final String[] keyWords = new String[]{"IntelliJ IDEA","Eclipse",
+            "Postman","MyEclipse","Visual Studio Code",
+            "Navicat","Pycharm","Android Studio",
+            "WebStorm","SQLyog","PhpStorm",
+            "JetBrains Datagrip","JetBrains Rider",
+            "Android Studio","Photoshop","Illustrator",
+            "Adobe After Effects","Axure RP","Sketch"};//定时任务未处理的状态码
 //    public static final String ACCESS_KEY = "280d6f0e4a774117905ba789a9f0b978";//百度图像识别accessKey
 //    public static final String SECRET_KEY = "43b460e124eb474c8cdb7441dc30d66d";//百度图像识别secretKey
 }

+ 53 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ImageProcessingController.java

@@ -0,0 +1,53 @@
+package com.management.platform.controller;
+import	java.lang.ref.Reference;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.management.platform.constant.Constant;
+import com.management.platform.entity.Screenshot;
+import com.management.platform.entity.vo.ScreenshotVO;
+import com.management.platform.mapper.ScreenshotMapper;
+import com.management.platform.service.ScreenshotService;
+import com.management.platform.util.AuthService;
+import com.management.platform.util.CheckPicUtil;
+import com.management.platform.util.HttpRespMsg;
+import com.management.platform.util.RedisUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Author: 吴涛涛
+ * Date : 2020 - 01 - 03 9:38
+ * Description:<描述>
+ * Version: 1.0
+ */
+@RestController
+@RequestMapping("/imageProcessing")
+public class ImageProcessingController {
+
+    @Resource
+    private ScreenshotService screenshotService;
+
+    /**
+     * 参数:uid 用户id
+     * indate 截图时间 如 "2018-08-01 22:32:57"
+     * file 上传的图片文件
+     */
+    @RequestMapping("/saveAndProcessImage")
+    public HttpRespMsg pictureDetectionTask(ScreenshotVO screenshotvo, String processList) {
+        System.out.println(processList);
+        return screenshotService.saveAndProcessImage(screenshotvo);
+    }
+
+}

+ 21 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.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-03
+ */
+@RestController
+@RequestMapping("/project")
+public class ProjectController {
+
+}
+

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

@@ -1,13 +1,18 @@
 package com.management.platform.controller;
 
 
+import com.management.platform.entity.Report;
+import com.management.platform.service.ReportService;
+import com.management.platform.util.HttpRespMsg;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
  * <p>
- *  前端控制器
+ * 前端控制器
  * </p>
  *
  * @author 吴涛涛
@@ -16,6 +21,45 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/report")
 public class ReportController {
+    @Autowired
+    private ReportService reportService;
 
+    /**
+     * 获取报告列表
+     * pageIndex 分页的页数
+     * pageSize 分页的大小
+     * userId 筛选的用户id 可传
+     * projectId 筛选的项目id 可传
+     * startDate 筛选时间段的开始时间 可传 yyyy-MM-dd
+     * endDate 筛选时间段的结束时间 可传 yyyy-MM-dd
+     */
+    @RequestMapping("/getReportList")
+    public HttpRespMsg getReportList(@RequestParam Integer pageIndex, @RequestParam Integer pageSize,
+                                     Integer userId, Integer projectId, String startDate, String endDate) {
+        return reportService.getReportList(pageIndex, pageSize, userId, projectId, startDate, endDate);
+    }
+
+    /**
+     * 新增或编辑报告
+     * id 报告id 编辑时传
+     * creatorId 报告上传者id 新增时不可为空
+     * projectId 报告相关项目id 新增时不可为空
+     * createDate 报告创建时间 新增时不可为空 yyyy-MM-dd
+     * workingTime 工作时间
+     * content 工作内容
+     */
+    @RequestMapping("/editReport")
+    public HttpRespMsg editReport(Report report) {
+        return reportService.editReport(report);
+    }
+
+    /**
+     * 删除报告
+     * id 要删除的报告的id
+     */
+    @RequestMapping("/deleteReport")
+    public HttpRespMsg deleteReport(@RequestParam Integer id) {
+        return reportService.deleteReport(id);
+    }
 }
 

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

@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
  * </p>
  *
  * @author 吴涛涛
- * @since 2020-01-02
+ * @since 2020-01-03
  */
 @RestController
 @RequestMapping("/screenshot")

+ 16 - 9
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java

@@ -4,15 +4,12 @@ package com.management.platform.controller;
 import com.management.platform.service.UserService;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Map;
-
 /**
  * <p>
- *  前端控制器
+ * 前端控制器
  * </p>
  *
  * @author 吴涛涛
@@ -26,12 +23,22 @@ public class UserController {
 
     /**
      * 管理员登录网页端
-     * @param map
-     * @return
+     * username 用户名
+     * password 密码
+     */
+    @RequestMapping("/loginAdmin")
+    public HttpRespMsg loginAdmin(@RequestParam String username, @RequestParam String password) {
+        return userService.loginAdmin(username, password);
+    }
+
+    /**
+     * 员工登录PC端
+     * username 用户名
+     * password 密码
      */
-    @RequestMapping("/login")
-    public HttpRespMsg login(@RequestBody Map<String,Object> map){
-        return userService.login((String)map.get("username"), (String)map.get("password"));
+    @RequestMapping("/loginEmployee")
+    public HttpRespMsg loginEmployee(@RequestParam String username, @RequestParam String password) {
+        return userService.loginEmployee(username, password);
     }
 }
 

+ 51 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/PicContentKeywords.java

@@ -0,0 +1,51 @@
+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-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PicContentKeywords extends Model<PicContentKeywords> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 图片内容关键词表主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 关键词内容
+     */
+    @TableField("content")
+    private String content;
+
+    /**
+     * 关键词所属类型:0-编程,1-查资料,2-看文档,3-做设计,4-美工,5-运营,6-看小说,7-打游戏,8-听音乐。
+     */
+    @TableField("type")
+    private Integer type;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 45 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Project.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-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class Project extends Model<Project> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 项目名称
+     */
+    @TableField("project_name")
+    private String projectName;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 14 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Report.java

@@ -11,6 +11,7 @@ import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * <p>
@@ -18,7 +19,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author 吴涛涛
- * @since 2020-01-02
+ * @since 2020-01-03
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -34,27 +35,34 @@ public class Report extends Model<Report> {
     private Integer id;
 
     /**
-     * user表外键
+     * user表外键 报告的作者
      */
     @TableField("creator_id")
     private Integer creatorId;
 
     /**
-     * 报告种类 0-日报 1-月报
+     * project表外键 相关项目
      */
-    @TableField("report_type")
-    private Integer reportType;
+    @TableField("project_id")
+    private Integer projectId;
 
     /**
      * 日期
      */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     @TableField("create_date")
     private LocalDate createDate;
 
+    /**
+     * 工作时间
+     */
+    @TableField("working_time")
+    private Integer workingTime;
+
     /**
      * 报告内容
      */
-    @TableField(value = "content", updateStrategy = FieldStrategy.IGNORED)
+    @TableField(value = "content", insertStrategy = FieldStrategy.IGNORED)
     private String content;
 
     /**

+ 5 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Screenshot.java

@@ -6,11 +6,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * <p>
@@ -18,7 +17,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author 吴涛涛
- * @since 2020-01-02
+ * @since 2020-01-03
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -49,6 +48,7 @@ public class Screenshot extends Model<Screenshot> {
      * 截图时间
      */
     @TableField("indate")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime indate;
 
     /**
@@ -58,7 +58,7 @@ public class Screenshot extends Model<Screenshot> {
     private Integer isNormal;
 
     /**
-     * 定时任务是否检测 0-否 1-是
+     * 是否检测 0-否 1-是
      */
     @TableField("is_handle")
     private Integer isHandle;
@@ -70,7 +70,7 @@ public class Screenshot extends Model<Screenshot> {
     private String dateStr;
 
     /**
-     * 图片类型(记录不同的方式)编程,查资料,看文档,做设计,美工,运营,看小说,打游戏,听音乐。
+     * 图片类型(记录不同的方式)0-编程,1-查资料,2-看文档,3-做设计,4-美工,5-运营,6-看小说,7-打游戏,8-听音乐。
      */
     @TableField("pic_type")
     private Integer picType;

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

@@ -16,7 +16,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author 吴涛涛
- * @since 2020-01-02
+ * @since 2020-01-03
  */
 @Data
 @EqualsAndHashCode(callSuper = false)

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/ScreenshotVO.java

@@ -0,0 +1,16 @@
+package com.management.platform.entity.vo;
+
+import com.management.platform.entity.Screenshot;
+import lombok.Data;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * Author: 吴涛涛
+ * Date : 2020 - 01 - 03 10:11
+ * Description:<描述>
+ * Version: 1.0
+ */
+@Data
+public class ScreenshotVO extends Screenshot {
+    private MultipartFile file;
+}

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

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

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

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

+ 3 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ScreenshotMapper.java

@@ -2,6 +2,8 @@ package com.management.platform.mapper;
 
 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;
 
 /**
  * <p>
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ScreenshotMapper extends BaseMapper<Screenshot> {
 
+    HttpRespMsg saveAndProcessImage(ScreenshotVO screenshotvo);
 }

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

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

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

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

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

@@ -6,14 +6,17 @@ import com.management.platform.util.HttpRespMsg;
 
 /**
  * <p>
- *  服务类
+ * 服务类
  * </p>
  *
  * @author 吴涛涛
  * @since 2019-12-31
  */
 public interface ReportService extends IService<Report> {
-    HttpRespMsg getReportList(Integer creatorId, Integer reportType, String startDate, String end);
-    HttpRespMsg editReport(Integer reportId, String content);
+    HttpRespMsg getReportList(Integer pageIndex, Integer pageSize, Integer creatorId, Integer projectId,
+                              String startDate, String endDate);
+
+    HttpRespMsg editReport(Report report);
+
     HttpRespMsg deleteReport(Integer reportId);
 }

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

@@ -2,6 +2,8 @@ package com.management.platform.service;
 
 import com.management.platform.entity.Screenshot;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.management.platform.entity.vo.ScreenshotVO;
+import com.management.platform.util.HttpRespMsg;
 
 /**
  * <p>
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ScreenshotService extends IService<Screenshot> {
 
+    HttpRespMsg saveAndProcessImage(ScreenshotVO screenshotvo);
 }

+ 4 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java

@@ -6,12 +6,14 @@ import com.management.platform.util.HttpRespMsg;
 
 /**
  * <p>
- *  服务类
+ * 服务类
  * </p>
  *
  * @author 吴涛涛
  * @since 2019-12-31
  */
 public interface UserService extends IService<User> {
-    HttpRespMsg login(String username, String password);
+    HttpRespMsg loginAdmin(String username, String password);
+
+    HttpRespMsg loginEmployee(String username, String password);
 }

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

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

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

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

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

@@ -1,6 +1,7 @@
 package com.management.platform.service.impl;
 
 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.service.ReportService;
@@ -8,6 +9,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+
 import javax.annotation.Resource;
 
 /**
@@ -24,51 +28,52 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     @Resource
     private ReportMapper reportMapper;
 
-
-    /**
-     * 获取报告列表
-     * 可以基于报告者id 报告种类 报告日期来筛选
-     * @param creatorId
-     * @param reportType
-     * @param startDate
-     * @param end
-     * @return
-     */
+    //获取报告列表
     @Override
-    public HttpRespMsg getReportList(Integer creatorId, Integer reportType, String startDate, String end) {
-        //以上筛选目前都没卵用
+    public HttpRespMsg getReportList(Integer pageIndex, Integer pageSize, Integer creatorId, Integer projectId,
+                                     String startDate, String endDate) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        httpRespMsg.data = reportMapper.selectList(new QueryWrapper<>());
+        QueryWrapper<Report> queryWrapper = new QueryWrapper<>();
+        if (creatorId != null) {
+            queryWrapper.eq("creator_id", creatorId);
+        }
+        if (projectId != null) {
+            queryWrapper.eq("project_id", projectId);
+        }
+        if (startDate != null && endDate != null) {
+            queryWrapper.between("create_date",
+                    LocalDate.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")),
+                    LocalDate.parse(endDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"))
+            );
+        }
+        httpRespMsg.data = reportMapper.selectPage(new Page<>(pageIndex, pageSize), new QueryWrapper<>());
         return httpRespMsg;
     }
 
-    /**
-     * 基于id修改报告内容
-     * @param reportId
-     * @param content
-     * @return
-     */
+    //新增或编辑报告
     @Override
-    public HttpRespMsg editReport(Integer reportId, String content) {
+    public HttpRespMsg editReport(Report report) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        Report report = reportMapper.selectById(reportId);
-        if (report != null) {
-            report.setContent(content);
+        if (report.getId() == null) {
+            //新增报告时 需要检查项目和人员id
+            if (report.getCreatorId() == null || report.getProjectId() == null) {
+                httpRespMsg.setError("请填写完整信息");
+            } else {
+                Integer impactedRows = reportMapper.insert(report);
+                if (impactedRows == 0) {
+                    httpRespMsg.setError("操作失败");
+                }
+            }
+        } else {
             Integer impactedRows = reportMapper.updateById(report);
             if (impactedRows == 0) {
                 httpRespMsg.setError("操作失败");
             }
-        } else {
-            httpRespMsg.setError("未找到相应报告");
         }
         return httpRespMsg;
     }
 
-    /**
-     * 基于id删除报告
-     * @param reportId
-     * @return
-     */
+    //删除报告
     @Override
     public HttpRespMsg deleteReport(Integer reportId) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();

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

@@ -1,20 +1,91 @@
 package com.management.platform.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.management.platform.constant.Constant;
+import com.management.platform.entity.PicContentKeywords;
 import com.management.platform.entity.Screenshot;
+import com.management.platform.entity.vo.ScreenshotVO;
 import com.management.platform.mapper.ScreenshotMapper;
 import com.management.platform.service.ScreenshotService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.management.platform.util.*;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import javax.annotation.Resources;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author 吴涛涛
  * @since 2020-01-02
  */
 @Service
+@Transactional
 public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screenshot> implements ScreenshotService {
 
+    @Value(value = "${upload.path}")
+    private String path;
+
+    @Autowired
+    private RedisUtil redisUtil;
+
+    @Resource
+    private ScreenshotMapper screenshotMapper;
+
+    @Override
+    public HttpRespMsg saveAndProcessImage(ScreenshotVO screenshotvo) {
+        String filePath = UploadFileToFileNameUtil.uploadFile(screenshotvo.getFile(), path);
+        Screenshot screenshot = new Screenshot();
+        BeanUtils.copyProperties(screenshotvo, screenshot);
+        screenshot.setPicUrl(filePath);
+        screenshot.setDateStr(DateTimeFormatter.ofPattern("yyyy-MM-dd").format(screenshotvo.getIndate()));
+        String accessToken = "";
+        if (redisUtil.existsKey("accessToken")) {
+            accessToken = redisUtil.getKey("accessToken");
+        } else {
+            Map<String, Object> map = AuthService.getAuth(Constant.API_KEY, Constant.SECRET_KEY);
+            accessToken = (String) map.get("access_token");
+            redisUtil.setKeyWithExpireTime("accessToken", accessToken, (Long) map.get("expires_in"));
+        }
+        //利用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 = (List<String>) picResultMap.get("wordsList");
+        screenshot.setPicContext((String) picResultMap.get("picContent"));
+        Set<Object> members = redisUtil.members(Constant.COMMON_SOFTWARE_KEYWORDS);
+        for (String textContent : textContents) {
+            for (Object member : members) {
+                //由于redis里存储的member是一个PicContentKeywords类型的json字符串,所以取出关键字内容比较
+                JSONObject jsonMember = JSON.parseObject((String) member);
+                System.out.println(jsonMember.getString("content"));
+                System.out.println("textContent----->"+textContent);
+                if (textContent.contains(jsonMember.getString("content"))) {
+                    System.out.println("进来了判断=====");
+                    System.out.println("content=====" + jsonMember.getString("content"));
+                    System.out.println("textContent=====" + textContent);
+                    //包含关键字们可以简单认为是在用常用开发软件
+                    //确定图片是哪个类型的图片
+                    screenshot.setPicType(jsonMember.getInteger("type"));
+                }
+            }
+        }
+        screenshot.setIsHandle(1);
+        screenshotMapper.insert(screenshot);
+        return new HttpRespMsg();
+    }
 }

+ 29 - 9
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -29,12 +29,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 
     /**
      * 管理员登录网页端
-     * @param username
-     * @param password
-     * @return
      */
     @Override
-    public HttpRespMsg login(String username, String password) {
+    public HttpRespMsg loginAdmin(String username, String password) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         //根据电话号码获取账号信息
         List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("phone", username));
@@ -44,15 +41,38 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         } else if (userList.size() > 1) {
             //检索到两个及以上账号时
             httpRespMsg.setError("账号重名");
-        } else if (userList.get(0).getRole().equals(1)) {
+        } else if (userList.get(0).getRole() != 1) {
             //检索的账号role不是1 即不是管理员时
             httpRespMsg.setError("非管理员不能登陆系统");
         } else if (MD5Util.getPassword(password).equals(userList.get(0).getPassword())) {
             //检测密码正确时
-            Map<String, Object> resultMap = new HashMap<>();
-            resultMap.put("portraitUrl", userList.get(0).getPortraitUrl());
-            //将头像的url返回回去
-            httpRespMsg.data = resultMap;
+            httpRespMsg.data = userList.get(0);
+        } else {
+            httpRespMsg.setError("密码错误");
+        }
+        return httpRespMsg;
+    }
+
+    /**
+     * 员工登录网页端
+     */
+    @Override
+    public HttpRespMsg loginEmployee(String username, String password) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        //根据电话号码获取账号信息
+        List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("phone", username));
+        if (userList.size() == 0) {
+            //未检索到账号时
+            httpRespMsg.setError("账号未注册");
+        } else if (userList.size() > 1) {
+            //检索到两个及以上账号时
+            httpRespMsg.setError("账号重名");
+        } else if (userList.get(0).getRole() != 0) {
+            //检索的账号role不是0 即不是普通用户时
+            httpRespMsg.setError("管理员无法登陆本端");
+        } else if (MD5Util.getPassword(password).equals(userList.get(0).getPassword())) {
+            //检测密码正确时
+            httpRespMsg.data = userList.get(0);
         } else {
             httpRespMsg.setError("密码错误");
         }

+ 22 - 13
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -1,5 +1,6 @@
 package com.management.platform.task;
-import	java.time.format.DateTimeFormatter;
+
+import java.time.format.DateTimeFormatter;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.constant.Constant;
@@ -21,6 +22,7 @@ import java.time.format.DateTimeFormatter;
 import java.time.temporal.TemporalAccessor;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * Author: 吴涛涛
@@ -38,19 +40,19 @@ public class TimingTask {
     private ScreenshotMapper screenshotMapper;
 
     @Value(value = "${upload.path}")
-    private String  path;
+    private String path;
 
-//    @Scheduled(cron = "0 */5 * * * ?")//配置时间段触发(每五分钟触发一次)
-    public void pictureDetectionTask(){
+    //    @Scheduled(cron = "0 */5 * * * ?")//配置时间段触发(每五分钟触发一次)
+    public void pictureDetectionTask() {
         String accessToken = "";
 
-        if(redisUtil.existsKey("accessToken")){
+        if (redisUtil.existsKey("accessToken")) {
             accessToken = redisUtil.getKey("accessToken");
-        }else{
-            Map<String,Object> map = AuthService.getAuth(Constant.API_KEY, Constant.SECRET_KEY);
-            accessToken = (String)map.get("access_token");
-            Long expiresTimeOut = (Long)map.get("expires_in");
-            redisUtil.setKeyWithExpireTime("accessToken",accessToken,expiresTimeOut);
+        } else {
+            Map<String, Object> map = AuthService.getAuth(Constant.API_KEY, Constant.SECRET_KEY);
+            accessToken = (String) map.get("access_token");
+            Long expiresTimeOut = (Long) map.get("expires_in");
+            redisUtil.setKeyWithExpireTime("accessToken", accessToken, expiresTimeOut);
         }
         //利用token去检测
 //        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -59,9 +61,16 @@ public class TimingTask {
                 .eq("date_str", DateTimeFormatter.ofPattern("yyyy-MM-dd").format(LocalDateTime.now()))
                 .eq("is_handle", Constant.UN_HANDLE));
         for (Screenshot screenshot : screenshots) {
-            String general = CheckPicUtil.general(path + screenshot.getPicUrl().substring("/upload/".length()), accessToken);
+            List<String> textContents = CheckPicUtil.generalPicTextContent(path + screenshot.getPicUrl().substring("/upload/".length()), accessToken);
+            Set<Object> members = redisUtil.members(Constant.COMMON_SOFTWARE_KEYWORDS);
+            for (String textContent : textContents) {
+                for (Object member : members) {
+                    if (textContent.contains((String) member)) {
+                        //包含关键字们可以简单认为是在用常用开发软件
+                        //to do 确定图片是哪个类型的图片
+                    }
+                }
+            }
         }
-
-
     }
 }

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

@@ -1,6 +1,10 @@
 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.entity.PicContentKeywords;
+import com.management.platform.mapper.PicContentKeywordsMapper;
 import com.management.platform.util.AuthService;
 import com.management.platform.util.RedisUtil;
 import org.junit.Test;
@@ -10,7 +14,9 @@ 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
@@ -19,15 +25,39 @@ public class TestApplicationTests {
     private RedisUtil redisUtil;
     @Value(value = "${upload.path}")
     private String  path;
+    @Resource
+    private PicContentKeywordsMapper picContentKeywordsMapper;
     @Test
     public void contextLoads() {
+//        //初始化redis关键词
+        redisUtil.deleteKey("keyWords");
+        List<PicContentKeywords> picContentKeywords = picContentKeywordsMapper.selectList(null);
+        for (PicContentKeywords  keyWord : picContentKeywords) {
+            redisUtil.sSetJsonString("keyWords",keyWord);
+        }
+
+        Set<Object> keyWords = redisUtil.members("keyWords");
+        System.out.println(keyWords.toString());
+//        for (Object keyWord : keyWords) {
+//            JSONObject jsonMember = JSON.parseObject((String)keyWord);
+//            System.out.println(jsonMember.getString("content"));
+//
+//        }
+
+
 //        Map<String,Object> map = AuthService.getAuth(Constant.API_KEY, Constant.SECRET_KEY);
 //        String accessToken = (String)map.get("access_token");
 //        Long expiresTimeOut = (Long)map.get("expires_in");
+//        System.out.println("accessToken:==="+accessToken);
+//        System.out.println("expiresTimeOut:==="+expiresTimeOut);
 //        redisUtil.setKeyWithExpireTime("accessToken",accessToken,expiresTimeOut);
+////        redisUtil.setString("wtt","aaa");
 //        System.out.println(redisUtil.getKey("accessToken"));
-//        System.out.println(path);
 
+//        for (String keyWord : Constant.keyWords) {
+//            redisUtil.sSet("keyWords",keyWord);
+//        }
+//        System.out.println(redisUtil.members("keyWords").toString());
     }
 
 }

+ 4 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/AuthService.java

@@ -2,8 +2,6 @@ package com.management.platform.util;
 
 import com.management.platform.constant.Constant;
 import org.json.JSONObject;
-import org.springframework.stereotype.Component;
-
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
@@ -13,7 +11,10 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * 获取token类
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 08 - 30 13:59
+ * Description:<描述> 百度api识别图片里的文字,获取token类工具类
+ * Version: 1.0
  */
 public class AuthService {
     /**

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

@@ -1,16 +1,27 @@
 package com.management.platform.util;
 
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baidu.aip.util.Base64Util;
 
 import java.net.URLEncoder;
+import java.util.*;
 
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 08 - 30 13:59
+ * Description:<描述> 百度文字识别api识别图片里的文字工具类
+ * Version: 1.0
+ */
 public class CheckPicUtil {
 
     /**
-    * 重要提示代码中所需工具类
-    * 下载
-    */
+     * 调用百度文字识别api识别图片里的文字
+     * @param path 图片路径
+     * @param token 调用百度文字识别api的access_token
+     * @return 返回调用api识别出来的内容字符串
+     */
     public static String general(String path,String token) {
         // 请求url
         String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general";
@@ -34,8 +45,91 @@ public class CheckPicUtil {
         }
         return null;
     }
+    /**
+     * 调用百度文字识别api识别图片里的文字
+     * @param path 图片路径
+     * @param token 调用百度文字识别api的access_token
+     * @return 返回调用api识别出来的内容的List集合
+     */
+    public static List<String>  generalPicTextContent (String path,String token) {
+        // 请求url
+        String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general";
+        try {
+            // 本地文件路径
+            String filePath = path;
+            byte[] imgData = FileUtil.readFileByBytes(filePath);
+            String imgStr = Base64Util.encode(imgData);
+            String imgParam = URLEncoder.encode(imgStr, "UTF-8");
+
+            String param = "image=" + imgParam;
+
+            // 注意这里仅为了简化编码每一次请求都去获取access_token,线上环境access_token有过期时间, 客户端可自行缓存,过期后重新获取。
+            String accessToken = token;
+
+            String result = HttpUtil.post(url, accessToken, param);
+            List<String> wordsList = new ArrayList<>();
+            JSONObject object = JSONArray.parseObject(result);
+            JSONArray resultArray = object.getJSONArray("words_result");
+            for (int i = 0; i < resultArray.size(); i++) {
+                JSONObject json  = resultArray.getJSONObject(i);
+                String words = (String)json.get("words");
+                System.out.println("words"+i+":"+words);
+                wordsList.add(words);
+            }
+            System.out.println(wordsList);
+            return wordsList;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 调用百度文字识别api识别图片里的文字
+     * @param path 图片路径
+     * @param token 调用百度文字识别api的access_token
+     * @return 返回调用api识别出来的内容的集合和json字符串的Map
+     */
+    public static Map<String,Object>  generalPicTextContentMap (String path,String token) {
+        // 请求url
+        String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general";
+        try {
+            // 本地文件路径
+            String filePath = path;
+            byte[] imgData = FileUtil.readFileByBytes(filePath);
+            String imgStr = Base64Util.encode(imgData);
+            String imgParam = URLEncoder.encode(imgStr, "UTF-8");
+
+            String param = "image=" + imgParam;
+
+            // 注意这里仅为了简化编码每一次请求都去获取access_token,线上环境access_token有过期时间, 客户端可自行缓存,过期后重新获取。
+            String accessToken = token;
+
+            String result = HttpUtil.post(url, accessToken, param);
+            List<String> wordsList = new ArrayList<>();
+            JSONObject object = JSONArray.parseObject(result);
+            JSONArray resultArray = object.getJSONArray("words_result");
+            for (int i = 0; i < resultArray.size(); i++) {
+                JSONObject json  = resultArray.getJSONObject(i);
+                String words = (String)json.get("words");
+                System.out.println("words"+i+":"+words);
+                wordsList.add(words);
+            }
+            System.out.println(wordsList);
+            Map<String,Object> map = new HashMap<>();
+            map.put("wordsList",wordsList);
+            map.put("picContent",object.toJSONString());
+            return map;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
 
     public static void main(String[] args) {
-        CheckPicUtil.general("D:\\1.png",(String)AuthService.getAuth().get("access_token"));
+//        CheckPicUtil.generalPicTextContent("D:\\360MoveData\\Users\\Administrator\\Desktop\\idea.jpg",(String)AuthService.getAuth().get("access_token"));
+
+        System.out.println("m]- IntelliJ IDEA(Administrator)".contains("Intellij IDEA"));
+
     }
 }

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

@@ -204,7 +204,7 @@ public class CodeGenerator {
         //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
 //        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
         //此处user是表名,多个英文逗号分割
-        strategy.setInclude("report");
+//        strategy.setInclude("report");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);

+ 59 - 9
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/FileUtil.java

@@ -1,5 +1,8 @@
 package com.management.platform.util;
 
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import org.springframework.web.multipart.MultipartFile;
+
 import java.io.*;
 
 /**
@@ -14,23 +17,23 @@ public class FileUtil {
         File file = new File(filePath);
         if (!file.exists()) {
             throw new FileNotFoundException(filePath);
-        } 
+        }
 
         if (file.length() > 1024 * 1024 * 1024) {
             throw new IOException("File is too large");
-        } 
+        }
 
         StringBuilder sb = new StringBuilder((int) (file.length()));
         // 创建字节输入流  
-        FileInputStream fis = new FileInputStream(filePath);  
+        FileInputStream fis = new FileInputStream(filePath);
         // 创建一个长度为10240的Buffer
-        byte[] bbuf = new byte[10240];  
+        byte[] bbuf = new byte[10240];
         // 用于保存实际读取的字节数  
-        int hasRead = 0;  
-        while ( (hasRead = fis.read(bbuf)) > 0 ) {  
-            sb.append(new String(bbuf, 0, hasRead));  
-        }  
-        fis.close();  
+        int hasRead = 0;
+        while ((hasRead = fis.read(bbuf)) > 0) {
+            sb.append(new String(bbuf, 0, hasRead));
+        }
+        fis.close();
         return sb.toString();
     }
 
@@ -69,4 +72,51 @@ public class FileUtil {
             }
         }
     }
+
+    /**
+     * 根据文件路径读取byte[] 数组
+     */
+    public static byte[] readFileByBytes(File file) throws IOException {
+        if (file == null) {
+            throw new FileNotFoundException("file is not null");
+        } else {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream((int) file.length());
+            BufferedInputStream in = null;
+            try {
+                in = new BufferedInputStream(new FileInputStream(file));
+                short bufSize = 1024;
+                byte[] buffer = new byte[bufSize];
+                int len1;
+                while (-1 != (len1 = in.read(buffer, 0, bufSize))) {
+                    bos.write(buffer, 0, len1);
+                }
+
+                byte[] var7 = bos.toByteArray();
+                return var7;
+            } finally {
+                try {
+                    if (in != null) {
+                        in.close();
+                    }
+                } catch (IOException var14) {
+                    var14.printStackTrace();
+                }
+
+                bos.close();
+            }
+        }
+    }
+
+    /**
+     * 删除
+     *
+     * @param files
+     */
+    private void deleteFile(File... files) {
+        for (File file : files) {
+            if (file.exists()) {
+                file.delete();
+            }
+        }
+    }
 }

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

@@ -1,8 +1,11 @@
 package com.management.platform.util;
 
+import com.alibaba.fastjson.JSON;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.connection.DataType;
+import org.springframework.data.redis.connection.RedisConnection;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.SetOperations;
 import org.springframework.data.redis.core.script.DefaultRedisScript;
 import org.springframework.data.redis.core.script.RedisScript;
 import org.springframework.stereotype.Component;
@@ -29,9 +32,40 @@ public class RedisUtil {
     }
 
     public void setKeyWithExpireTime(String key,String value,long timeout){
-        redisTemplate.opsForValue().set(key, value, timeout, TimeUnit.MILLISECONDS);
+        redisTemplate.opsForValue().set(key, value, timeout, TimeUnit.SECONDS);
     }
 
+    /**
+     * 将数据放入set缓存
+     *
+     * @param key 键
+     * @return
+     */
+    public void sSet(String key, String value) {
+        redisTemplate.opsForSet().add(key, value);
+    }
+    /**
+     * 将数据以json字符串的形式放入set缓存
+     *
+     * @param key 键
+     * @return
+     */
+    public void sSetJsonString(String key,Object object){
+        redisTemplate.opsForSet().add(key, JSON.toJSONString(object));
+    }
+
+
+    /**
+     * 获取变量中的值
+     *
+     * @param key 键
+     * @return
+     */
+    public Set<Object> members(String key) {
+        return redisTemplate.opsForSet().members(key);
+    }
+
+
     /**
      * 指定缓存失效时间
      *

+ 17 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/PicContentKeywordsMapper.xml

@@ -0,0 +1,17 @@
+<?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.PicContentKeywordsMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.PicContentKeywords">
+        <id column="id" property="id" />
+        <result column="content" property="content" />
+        <result column="type" property="type" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, content, type
+    </sql>
+
+</mapper>

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.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.ProjectMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.Project">
+        <id column="id" property="id" />
+        <result column="project_name" property="projectName" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, project_name
+    </sql>
+
+</mapper>

+ 3 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -6,15 +6,16 @@
     <resultMap id="BaseResultMap" type="com.management.platform.entity.Report">
         <id column="id" property="id" />
         <result column="creator_id" property="creatorId" />
-        <result column="report_type" property="reportType" />
+        <result column="project_id" property="projectId" />
         <result column="create_date" property="createDate" />
+        <result column="working_time" property="workingTime" />
         <result column="content" property="content" />
         <result column="create_time" property="createTime" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, creator_id, report_type, create_date, content, create_time
+        id, creator_id, project_id, create_date, working_time, content, create_time
     </sql>
 
 </mapper>

+ 20 - 1
fhKeeper/formulahousekeeper/pom.xml

@@ -40,6 +40,20 @@
         <fastjson.version>1.2.7</fastjson.version>
         <baidu.api.sdk.version>4.2.0</baidu.api.sdk.version>
     </properties>
+
+    <repositories>
+        <repository>
+            <id>alimaven</id>
+            <name>aliyun maven</name>
+            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
+        </repository>
+        <repository>
+            <id>alimaven2</id>
+            <name>aliyun maven 2</name>
+            <url>http://maven.aliyun.com/nexus/content/repositories/central</url>
+        </repository>
+    </repositories>
+
     <!--统一管理依赖-->
     <dependencyManagement>
         <dependencies>
@@ -160,9 +174,14 @@
                 <groupId>com.baidu.aip</groupId>
                 <artifactId>java-sdk</artifactId>
                 <version>${baidu.api.sdk.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-simple</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
 
-
         </dependencies>
     </dependencyManagement>
     <build>