Browse Source

计算能源用量添加cron 表达式给定时任务

huangpeng 1 year ago
parent
commit
6dfa4dd9ec

+ 2 - 0
cx-equipment/cx-equipment-server/src/main/java/com/rongwei/bsserver/sys/controller/EquEnergyRecordController.java

@@ -5,6 +5,7 @@ import com.rongwei.rwcommon.base.R;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -29,6 +30,7 @@ public class EquEnergyRecordController {
      * @param
      * @return
      */
+    @Scheduled(cron = "0 0 6/8 1/1 * ? ")
     @RequestMapping("/calEnergyUsage")
     public R calEnergyUsage() {
         try {