Pārlūkot izejas kodu

修改代码生成器输出路径

wutt 5 gadi atpakaļ
vecāks
revīzija
71451ad0c1

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

@@ -1,14 +1,20 @@
 package com.management.platform.constant;
 
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
 /**
  * Author: 吴涛涛
  * Date : 2019 - 07 - 24 16:00
  * Description:<描述>常量配置类
  * Version: 1.0
  */
+@Component
 public class Constant {
     public static final String API_KEY = "gtImOYhgcFBzwuT29tB7tM0Z";//百度文字识别apiKey
     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 ACCESS_KEY = "280d6f0e4a774117905ba789a9f0b978";//百度图像识别accessKey
 //    public static final String SECRET_KEY = "43b460e124eb474c8cdb7441dc30d66d";//百度图像识别secretKey
 }

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

@@ -6,6 +6,8 @@ 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;

+ 27 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -1,13 +1,25 @@
 package com.management.platform.task;
+import	java.time.format.DateTimeFormatter;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.constant.Constant;
+import com.management.platform.entity.Screenshot;
+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.RedisUtil;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAccessor;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -22,6 +34,12 @@ public class TimingTask {
     @Autowired
     private RedisUtil redisUtil;
 
+    @Resource
+    private ScreenshotMapper screenshotMapper;
+
+    @Value(value = "${upload.path}")
+    private String  path;
+
 //    @Scheduled(cron = "0 */5 * * * ?")//配置时间段触发(每五分钟触发一次)
     public void pictureDetectionTask(){
         String accessToken = "";
@@ -35,6 +53,15 @@ public class TimingTask {
             redisUtil.setKeyWithExpireTime("accessToken",accessToken,expiresTimeOut);
         }
         //利用token去检测
+//        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//        LocalDateTime l = LocalDateTime.parse("2019-02-03",dateTimeFormatter);
+        List<Screenshot> screenshots = screenshotMapper.selectList(new QueryWrapper<Screenshot>()
+                .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);
+        }
+
 
     }
 }

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

@@ -5,6 +5,7 @@ import com.management.platform.util.AuthService;
 import com.management.platform.util.RedisUtil;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
@@ -16,13 +17,16 @@ import java.util.Map;
 public class TestApplicationTests {
     @Resource
     private RedisUtil redisUtil;
+    @Value(value = "${upload.path}")
+    private String  path;
     @Test
     public void contextLoads() {
 //        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");
 //        redisUtil.setKeyWithExpireTime("accessToken",accessToken,expiresTimeOut);
-        System.out.println(redisUtil.getKey("accessToken"));
+//        System.out.println(redisUtil.getKey("accessToken"));
+//        System.out.println(path);
 
     }
 

+ 16 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/application-prod.yml

@@ -33,6 +33,16 @@ spring:
         maxIdle: 10
         maxWait: 3
         maxActive: 8
+    ####全局配置时间返回格式#####
+  jackson:
+    #参数意义:
+    #JsonInclude.Include.ALWAYS       默认
+    #JsonInclude.Include.NON_DEFAULT   属性为默认值不序列化
+    #JsonInclude.Include.NON_EMPTY     属性为 空(””) 或者为 NULL 都不序列化
+    #JsonInclude.Include.NON_NULL      属性为NULL  不序列化
+    default-property-inclusion: ALWAYS
+    time-zone: GMT+8
+    date-format: yyyy-MM-dd HH:mm:ss
 
 ##########日志配置
 logging:
@@ -63,8 +73,13 @@ mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
     cache-enabled: false
+######mybstis配置#######
 mybatis:
   type-aliases-package: com.management.platform.entity
   mapper-locations: mappers/*Mapper.xml
-######mybstis配置#######
+#####配置图片上传路径####
+upload:
+  path: E:/staticproject/manhourhousekeeper/upload/
+
+
 

+ 15 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/application.yml

@@ -33,6 +33,16 @@ spring:
         maxIdle: 10
         maxWait: 3
         maxActive: 8
+  ####全局配置时间返回格式#####
+  jackson:
+    #参数意义:
+    #JsonInclude.Include.ALWAYS       默认
+    #JsonInclude.Include.NON_DEFAULT   属性为默认值不序列化
+    #JsonInclude.Include.NON_EMPTY     属性为 空(””) 或者为 NULL 都不序列化
+    #JsonInclude.Include.NON_NULL      属性为NULL  不序列化
+    default-property-inclusion: ALWAYS
+    time-zone: GMT+8
+    date-format: yyyy-MM-dd HH:mm:ss
 
 ##########日志配置
 logging:
@@ -63,8 +73,12 @@ mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
     cache-enabled: false
+######mybstis配置#######
 mybatis:
   type-aliases-package: com.management.platform.entity
   mapper-locations: mappers/*Mapper.xml
-######mybstis配置#######
+#####配置图片上传路径####
+upload:
+  path: D:/upload/
+
 

+ 16 - 1
fhKeeper/formulahousekeeper/management-platform/target/classes/application-prod.yml

@@ -33,6 +33,16 @@ spring:
         maxIdle: 10
         maxWait: 3
         maxActive: 8
+    ####全局配置时间返回格式#####
+  jackson:
+    #参数意义:
+    #JsonInclude.Include.ALWAYS       默认
+    #JsonInclude.Include.NON_DEFAULT   属性为默认值不序列化
+    #JsonInclude.Include.NON_EMPTY     属性为 空(””) 或者为 NULL 都不序列化
+    #JsonInclude.Include.NON_NULL      属性为NULL  不序列化
+    default-property-inclusion: ALWAYS
+    time-zone: GMT+8
+    date-format: yyyy-MM-dd HH:mm:ss
 
 ##########日志配置
 logging:
@@ -63,8 +73,13 @@ mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
     cache-enabled: false
+######mybstis配置#######
 mybatis:
   type-aliases-package: com.management.platform.entity
   mapper-locations: mappers/*Mapper.xml
-######mybstis配置#######
+#####配置图片上传路径####
+upload:
+  path: E:/staticproject/manhourhousekeeper/upload/
+
+
 

+ 15 - 1
fhKeeper/formulahousekeeper/management-platform/target/classes/application.yml

@@ -33,6 +33,16 @@ spring:
         maxIdle: 10
         maxWait: 3
         maxActive: 8
+  ####全局配置时间返回格式#####
+  jackson:
+    #参数意义:
+    #JsonInclude.Include.ALWAYS       默认
+    #JsonInclude.Include.NON_DEFAULT   属性为默认值不序列化
+    #JsonInclude.Include.NON_EMPTY     属性为 空(””) 或者为 NULL 都不序列化
+    #JsonInclude.Include.NON_NULL      属性为NULL  不序列化
+    default-property-inclusion: ALWAYS
+    time-zone: GMT+8
+    date-format: yyyy-MM-dd HH:mm:ss
 
 ##########日志配置
 logging:
@@ -63,8 +73,12 @@ mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
     cache-enabled: false
+######mybstis配置#######
 mybatis:
   type-aliases-package: com.management.platform.entity
   mapper-locations: mappers/*Mapper.xml
-######mybstis配置#######
+#####配置图片上传路径####
+upload:
+  path: D:/upload/
+
 

BIN
fhKeeper/formulahousekeeper/management-platform/target/classes/com/management/platform/constant/Constant.class


BIN
fhKeeper/formulahousekeeper/management-platform/target/classes/com/management/platform/task/TimingTask.class


BIN
fhKeeper/formulahousekeeper/management-platform/target/classes/com/management/platform/test/TestApplicationTests.class