Parcourir la source

1修改预计费

Xiaojh il y a 4 ans
Parent
commit
16ea55ee13

+ 0 - 5
smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/EstimateMsgSendService.java

@@ -9,10 +9,5 @@ import java.math.BigInteger;
  */
 public interface EstimateMsgSendService {
     void afterPropertiesSet();
-
-    void saveQrtzTask(BigInteger siteId, BigInteger customerId, String sendTime);
-
-    void deleteQrtzTask();
-
     void send(Integer siteId, Integer customerId);
 }

+ 0 - 5
smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/EstimatedDayService.java

@@ -10,10 +10,5 @@ import java.math.BigInteger;
 public interface EstimatedDayService {
 
     void afterPropertiesSet();
-
-    void saveQrtzTask(BigInteger siteId, BigInteger customerId);
-
-    void deleteQrtzTask();
-
     void start(Integer siteId,Integer customerId);
 }

+ 5 - 1
smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/impl/EstimateMsgSendServiceImpl.java

@@ -67,7 +67,11 @@ public class EstimateMsgSendServiceImpl implements EstimateMsgSendService, Initi
         // modify by pengdi ,判断定时任务是否存在,不存在才进行新增
 
         boolean exists = jobAndTriggerService.isExists(entity);
-        if(!exists) {
+        if(exists)
+            //先把之前Job删除
+            jobAndTriggerService.deleteJob(entity);
+
+        if(true) {
             String time = "";
             String minute = "";
             String second = "";

+ 6 - 6
smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/impl/EstimatedValveServiceImpl.java

@@ -60,10 +60,13 @@ public class EstimatedValveServiceImpl implements EstimatedValveService, Initial
         entity.setJobGroup("预计费推送阀控");
         entity.setJobName("EstimatedValveJob"+siteId );
         entity.setDescription("EstimatedValveJob"+customerId );
-        // modify by pengdi ,判断定时任务是否存在,不存在才进行新增
 
         boolean exists = jobAndTriggerService.isExists(entity);
-        if(!exists) {
+        if(exists)
+            //先把之前Job删除
+            jobAndTriggerService.deleteJob(entity);
+
+        if(true) {
             String time = "";
             String minute = "";
             String second = "";
@@ -74,12 +77,9 @@ public class EstimatedValveServiceImpl implements EstimatedValveService, Initial
                 String currTime = LocalDateTime.now().format(dfYmd) + " " + sendTime;;
                 DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                 LocalDateTime localDateTime = LocalDateTime.parse(currTime,df);
-                localDateTime = localDateTime.plusMinutes(30);
+                localDateTime = localDateTime.plusMinutes(60);
                 String cron = String.format("%s %s %s * * ?",localDateTime.getSecond(),localDateTime.getMinute(),localDateTime.getHour());
-                //String cron = "0 */2 * * * ?";
                 //String cron ="0 40 14 * * ?";
-                //String cron = "0 "+Integer.valueOf(minute)+" "+Integer.valueOf(time)+" * * ?";
-                //String cron = "0 22 15 * * ?";
                 log.info("预计费推送阀控:" + cron);
                 log.info("预计费推送阀控:" + "站点ID:"+siteId+"水司ID:"+customerId);
                 entity.setCronExpression(cron);