Prechádzať zdrojové kódy

修改了时间计算表
现在还要再储存一张截图
对应每段时间开始时的第一字张截图
以便异常查看时使用

Reiskuchen 5 rokov pred
rodič
commit
47b4548825

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

@@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author 吴涛涛
- * @since 2020-01-16
+ * @since 2020-02-06
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -39,7 +39,7 @@ public class TimeCalculation extends Model<TimeCalculation> {
     private String userId;
 
     /**
-     * 行为代码 等价于screenshot表中的pic_type
+     * 行为代码 -1-其他 0-编程 1-上网 2-文档 3-设计 4-美工 5-运营 6-小说 7-娱乐 8-音乐
      */
     @TableField("action_type")
     private Integer actionType;
@@ -68,6 +68,12 @@ public class TimeCalculation extends Model<TimeCalculation> {
     @TableField("duration")
     private Integer duration;
 
+    /**
+     * 开始时的第一张截图
+     */
+    @TableField("pic_url")
+    private String picUrl;
+
 
     @Override
     protected Serializable pkVal() {

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

@@ -10,7 +10,6 @@ import com.management.platform.entity.TimeCalculation;
 import com.management.platform.entity.TimeCalculationShow;
 import com.management.platform.entity.vo.ScreenshotVO;
 import com.management.platform.mapper.*;
-import com.management.platform.mapper.PicContentKeywordsMapper;
 import com.management.platform.service.ScreenshotService;
 import com.management.platform.util.*;
 import org.apache.log4j.Logger;
@@ -128,7 +127,8 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
                         .setStartTime(currentTime)
                         .setEndTime(currentTime)
                         //第一次的持续时间默认为最少单位1秒
-                        .setDuration(1);
+                        .setDuration(1)
+                        .setPicUrl(screenshot.getPicUrl());
                 timeCalculationMapper.insert(timeCalculation);
                 if (isConsecutive) {
                     //然后如果只是类型不同但是能连上的话
@@ -255,7 +255,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
     @Override
     public HttpRespMsg saveAndProcessImage(ScreenshotVO screenshotvo) {
         Map<String, Object> fileMap = UploadFileToFileNameUtil.uploadFile(screenshotvo.getFile(), path);
-        String filePath = (String)fileMap.get("sqlFilePath");
+        String filePath = (String) fileMap.get("sqlFilePath");
         Screenshot screenshot = new Screenshot();
         BeanUtils.copyProperties(screenshotvo, screenshot);
         screenshot.setPicUrl(filePath);
@@ -291,7 +291,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
 //            //由于存入数据库的对象被序列化成了json字符串,所以从redis里拿方便
 //            members = redisUtil.members(Constant.COMMON_SOFTWARE_KEYWORDS);
 //        }
-        File picFile = new File((String)fileMap.get("newFile"));
+        File picFile = new File((String) fileMap.get("newFile"));
         if (isNovel(textContents)) {
             screenshot.setPicType(6);
         } else if (isDocument(textContents)) {
@@ -309,7 +309,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
                 File f = new File(prePath);
                 if (f.exists()) {
                     ImageCompare comp = new ImageCompare();
-                    if (comp.isMoviePlay((String)fileMap.get("newFile"), prePath)) {
+                    if (comp.isMoviePlay((String) fileMap.get("newFile"), prePath)) {
                         screenshot.setPicType(7);
                         //前面那条也更新
                         if (preShot.getPicType() != null && preShot.getPicType() != 7) {
@@ -323,7 +323,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
         if (screenshot.getPicType() == null) {
             //默认设置为查资料
             try {
-                String browserName = isBrowser(new File((String)fileMap.get("newFile")));
+                String browserName = isBrowser(new File((String) fileMap.get("newFile")));
                 System.out.println(
                         "找到浏览器==" + browserName
                 );
@@ -344,8 +344,8 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
     @Override
     public HttpRespMsg updateRedisPicContentKeywords() {
         List<PicContentKeywords> picContentKeywords = picContentKeywordsMapper.selectList(null);
-        for (PicContentKeywords  keyWord : picContentKeywords) {
-            redisUtil.sSetJsonString("keyWords",keyWord);
+        for (PicContentKeywords keyWord : picContentKeywords) {
+            redisUtil.sSetJsonString("keyWords", keyWord);
         }
         HttpRespMsg msg = new HttpRespMsg();
         msg.data = redisUtil.members("keyWords");

+ 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("time_calculation_show");
+        strategy.setInclude("time_calculation");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);

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

@@ -4,23 +4,24 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.management.platform.entity.TimeCalculation">
-        <id column="id" property="id"/>
-        <result column="user_id" property="userId"/>
-        <result column="action_type" property="actionType"/>
-        <result column="date" property="date"/>
-        <result column="start_time" property="startTime"/>
-        <result column="end_time" property="endTime"/>
-        <result column="duration" property="duration"/>
+        <id column="id" property="id" />
+        <result column="user_id" property="userId" />
+        <result column="action_type" property="actionType" />
+        <result column="date" property="date" />
+        <result column="start_time" property="startTime" />
+        <result column="end_time" property="endTime" />
+        <result column="duration" property="duration" />
+        <result column="pic_url" property="picUrl" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, user_id, action_type, date, start_time, end_time, duration
+        id, user_id, action_type, date, start_time, end_time, duration, pic_url
     </sql>
 
     <!--分页获取异常记录-->
     <select id="getDevianceList" resultType="java.util.Map">
-        SELECT a.start_time AS time, b.name, a.action_type AS type, a.date
+        SELECT a.start_time AS time, b.name, a.action_type AS type, a.date, a.pic_url AS picUrl
         FROM time_calculation AS a
         LEFT JOIN user AS b ON a.user_id = b.id
         WHERE 1=1