Explorar o código

新增 获取虫情指定害虫预警功能

zhaiyifei hai 9 meses
pai
achega
8ca6197e34

+ 4 - 3
src/main/java/com/yunfeiyun/agmp/iots/warn/service/WarnPestService.java

@@ -37,8 +37,8 @@ public class WarnPestService {
     @Autowired
     @Autowired
     private IIotPestService iotPestService;
     private IIotPestService iotPestService;
 
 
-    @Value("warn.cbdDateDiff:1")
-    private int cbdDateDiff;
+    @Value("${warn.cbdDateDiff:1}")
+    private String cbdDateDiff;
 
 
     /**
     /**
      * 虫害处理入口
      * 虫害处理入口
@@ -108,7 +108,8 @@ public class WarnPestService {
     }
     }
 
 
     String getDateBefore() {
     String getDateBefore() {
-        return DateUtils.parseDateToStr("yyyy-MM-dd", DateUtils.addDays(new Date(), -cbdDateDiff));
+        int cbdDateDiffInt = Integer.parseInt(cbdDateDiff);
+        return DateUtils.parseDateToStr("yyyy-MM-dd", DateUtils.addDays(new Date(), -cbdDateDiffInt));
     }
     }
 
 
     /**
     /**