记得上下班打卡 | git大法好,push需谨慎

Commit 02de99f9 authored by jiangxiulong's avatar jiangxiulong

定时任务

parent 899822a7
......@@ -32,7 +32,6 @@ public class SweetConstant {
public static final String REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_PRIZE_NUM = "sweet:integralActivity:prizeNum:activityId:";
public static final String REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_PRIZE_ID = ":prizeId:";
public static final String REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_ALL_LIST = "sweet:integralActivity:Draw:activityId:";
public static final String REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_USER = "sweet:integralActivity:Draw:activityId:";
public static final String REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_IN_USER = "sweet:integralActivity:DrawIn:activityId:";
public static final String REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_USER_KEY = ":userId:";
public static final String REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_INFO = "sweet:integralActivity:DrawInfo:drawId:";
......
......@@ -4,17 +4,20 @@ import com.liquidnet.service.base.ResponseDto;
import feign.hystrix.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Component
@FeignClient(name = "liquidnet-service-sweet",
contextId = "FeignSweetTaskClient", path = "",
contextId = "FeignSweetTaskClient", path = "sweet",
url = "${liquidnet.service.sweet.url}",
// url = "",
fallback = FallbackFactory.Default.class)
public interface FeignSweetTaskClient {
@PostMapping("sweet/sweetData/drawLuck/add")
@PostMapping("sweetData/drawLuck/add")
ResponseDto<Boolean> drawLuckAdd();
@GetMapping("integralActivity/setDrawAllList")
ResponseDto<Boolean> setDrawAllList(@RequestParam("integralActivityId") String integralActivityId);
}
......@@ -2,6 +2,7 @@ package com.liquidnet.service.executor.main.handler;
import com.liquidnet.service.feign.sweet.task.FeignSweetTaskClient;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -33,4 +34,29 @@ public class SweetTaskHandler {
return ReturnT.FAIL;
}
}
@XxlJob(value = "sev-sweet:setDrawAllList")
public ReturnT<String> setDrawAllListHandler() {
try {
String jobParam = XxlJobHelper.getJobParam();//执行参数
log.info("jobParam = " + jobParam);
String[] paramArray = jobParam.split(",");
ReturnT<String> success = ReturnT.SUCCESS;
for (String id : paramArray) {
log.info("id = " + id);
Boolean data = feignSweetTaskClient.setDrawAllList(id).getData();
log.info("setDrawAllListHandler:结果:{}", data);
success.setMsg(String.valueOf(data));
}
return success;
} catch (Exception e) {
log.error("exception of handler:{}", e.getMessage(), e);
ReturnT<String> fail = ReturnT.FAIL;
fail.setMsg(e.getLocalizedMessage());
return fail;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment