CommunitySyncJob.java 991 B

123456789101112131415161718192021222324252627282930
  1. package com.huaxu.zoniot.job;
  2. import com.alibaba.fastjson.JSON;
  3. import com.huaxu.zoniot.service.CommunitySyncService;
  4. import com.xxl.job.core.biz.model.ReturnT;
  5. import com.xxl.job.core.handler.annotation.XxlJob;
  6. import com.xxl.job.core.log.XxlJobLogger;
  7. import lombok.extern.slf4j.Slf4j;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.stereotype.Component;
  10. import java.util.Map;
  11. @Slf4j
  12. @Component
  13. public class CommunitySyncJob {
  14. @Autowired
  15. private CommunitySyncService communitySyncService;
  16. @XxlJob("deviceSyncJobHandler")
  17. public ReturnT<String> deviceSyncJobHandler(String param) throws Exception {
  18. XxlJobLogger.log("XXL-JOB, device Sync Job.Param = {}",param);
  19. Map<String,Object> paramMap = JSON.parseObject(param , Map.class);
  20. int total = communitySyncService.rabbitSync();
  21. XxlJobLogger.log("XXL-JOB, Meter File Sync Job Finished. Total = {}",total);
  22. return ReturnT.SUCCESS;
  23. }
  24. }