Commit aa8e86e7 authored by shiyu's avatar shiyu

测试环境不发送专场通知

parent 8ba04be1
...@@ -78,6 +78,9 @@ public class SpecialPerformanceNoticeJob { ...@@ -78,6 +78,9 @@ public class SpecialPerformanceNoticeJob {
@Autowired @Autowired
UserDao userDao; UserDao userDao;
@Value("${spring.profiles.active}")
private String env;
private final static String SPECIAL_PERFORMANCE_URL = "/pages/saleSpecialList/index"; private final static String SPECIAL_PERFORMANCE_URL = "/pages/saleSpecialList/index";
/** /**
...@@ -85,6 +88,7 @@ public class SpecialPerformanceNoticeJob { ...@@ -85,6 +88,7 @@ public class SpecialPerformanceNoticeJob {
*/ */
@Scheduled(fixedDelay = 1000 * 60 * 10) @Scheduled(fixedDelay = 1000 * 60 * 10)
public void execute() { public void execute() {
RLock lock = redissonClient.getLock(SPECIAL_PERFORMANCE_SEND_MSG_KEY); RLock lock = redissonClient.getLock(SPECIAL_PERFORMANCE_SEND_MSG_KEY);
if (!lock.tryLock()) { if (!lock.tryLock()) {
logger.warn("专场即将开始通知任务,当前服务实例获取锁成功: {} 获取锁失败,锁被占用不执行", Thread.currentThread().getId()); logger.warn("专场即将开始通知任务,当前服务实例获取锁成功: {} 获取锁失败,锁被占用不执行", Thread.currentThread().getId());
...@@ -109,6 +113,10 @@ public class SpecialPerformanceNoticeJob { ...@@ -109,6 +113,10 @@ public class SpecialPerformanceNoticeJob {
SpecialPerformance specialPerformance = specialPerformanceList.get(0); SpecialPerformance specialPerformance = specialPerformanceList.get(0);
String abortStartKey = SPECIAL_PERFORMANCE_START_NOTICE_KEY + specialPerformance.getId(); String abortStartKey = SPECIAL_PERFORMANCE_START_NOTICE_KEY + specialPerformance.getId();
if (!redisUtils.hasKey(abortStartKey)) { if (!redisUtils.hasKey(abortStartKey)) {
if ("dev".equals(env)) {
logger.info(">>>>>>>>>>>>>>>>>>>>>>> dev环境, 不执行专场即将开始通知任务<<<<<<<<<<<<<<<<<<<<<");
return;
}
logger.info("当前即将开始的专场id:{}, 名称为 {} ", specialPerformance.getId(), specialPerformance.getTitle()); logger.info("当前即将开始的专场id:{}, 名称为 {} ", specialPerformance.getId(), specialPerformance.getTitle());
//发送短信通知 //发送短信通知
String url = wxAppletApi.getUrlLink(SPECIAL_PERFORMANCE_URL,"specialId=" + specialPerformance.getId()); String url = wxAppletApi.getUrlLink(SPECIAL_PERFORMANCE_URL,"specialId=" + specialPerformance.getId());
......
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