|
@@ -0,0 +1,50 @@
|
|
|
|
+package com.fdkankan.task.jobhandler.rtk;
|
|
|
|
+
|
|
|
|
+import com.fdkankan.dingtalk.DingTalkSendUtils;
|
|
|
|
+import com.fdkankan.redis.util.RedisUtil;
|
|
|
|
+import com.fdkankan.task.entity.Repair;
|
|
|
|
+import com.fdkankan.task.jobhandler.sale.SaleXxlJobUtil;
|
|
|
|
+import com.fdkankan.task.mapper.RepairMapper;
|
|
|
|
+import com.mybatisflex.core.query.QueryWrapper;
|
|
|
|
+import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Set;
|
|
|
|
+import java.util.UUID;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * XxlJob开发示例(Bean模式)
|
|
|
|
+ *
|
|
|
|
+ * 开发步骤:
|
|
|
|
+ * 1、任务开发:在Spring Bean实例中,开发Job方法;
|
|
|
|
+ * 2、注解配置:为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法", destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
|
|
|
|
+ * 3、执行日志:需要通过 "XxlJobHelper.log" 打印执行日志;
|
|
|
|
+ * 4、任务结果:默认任务结果为 "成功" 状态,不需要主动设置;如有诉求,比如设置任务结果为失败,可以通过 "XxlJobHelper.handleFail/handleSuccess" 自主设置任务结果;
|
|
|
|
+ *
|
|
|
|
+ * @author xuxueli 2019-12-11 21:52:51
|
|
|
|
+ */
|
|
|
|
+@Component
|
|
|
|
+public class RtkXxlJob {
|
|
|
|
+ private static Logger logger = LoggerFactory.getLogger(RtkXxlJob.class);
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ RedisUtil redisUtil;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取同时使用rtk数量
|
|
|
|
+ */
|
|
|
|
+ @XxlJob("rtkAccountCount")
|
|
|
|
+ public void rtkAccountCount(){
|
|
|
|
+ String redisKey = "4dkankan:rtk:snCode:*";
|
|
|
|
+ Set<String> keys = redisUtil.keys(redisKey);
|
|
|
|
+ logger.info("rtk在线数量为4dkankan:rtk:snCode:count{}",keys.size());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|