Commit 051ad79d by 桂前礼 Committed by unknown

fix bug

parent f0e0802c
......@@ -46,13 +46,20 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
public void run(ApplicationArguments applicationArguments) throws Exception {
log.info("[项目启动后 定时检查引导与推送]");
if (!JedisClusterUtils.setnx(PCLOUD_GUIDE_LOCK, PCLOUD_GUIDE_LOCK)) {
JedisClusterUtils.expire(PCLOUD_GUIDE_LOCK, 15 * 60);
return;
if (!JedisClusterUtils.exists(PCLOUD_GUIDE_LOCK)) {
JedisClusterUtils.set(PCLOUD_GUIDE_LOCK, "1");
} else {
if ("1".equals(JedisClusterUtils.get(PCLOUD_GUIDE_LOCK))) {
JedisClusterUtils.set(PCLOUD_GUIDE_LOCK, "0");
return;
} else {
JedisClusterUtils.set(PCLOUD_GUIDE_LOCK, "1");
}
}
new Thread(() -> {
log.info("[PcloudGuideSilenceRunnerImpl] 线程启动成功");
while (true) {
try {
Thread.sleep(1000);
......@@ -100,11 +107,11 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
.spanTime((pcloudGuide.getTimeSpan() == null ? 0 : pcloudGuide.getTimeSpan())).num(pcloudGuideDelayDto.getNum() + 1)
.robotWxId(pcloudGuideDelayDto.getRobotWxId()).ip(pcloudGuideDelayDto.getIp()).code(pcloudGuideDelayDto.getCode()).msgList(messageVOList).build();
if (JSONObject.toJSONString(guideDelayDto)==null){
guideDelayDto = PcloudGuideDelayDto.builder().sendTime(new Date()).duration(0)
.spanTime((pcloudGuide.getTimeSpan() == null ? 0 : pcloudGuide.getTimeSpan())).num(pcloudGuideDelayDto.getNum() + 1)
.robotWxId(pcloudGuideDelayDto.getRobotWxId()).code(pcloudGuideDelayDto.getCode()).ip(pcloudGuideDelayDto.getIp()).build();
}
if (JSONObject.toJSONString(guideDelayDto) == null) {
guideDelayDto = PcloudGuideDelayDto.builder().sendTime(new Date()).duration(0)
.spanTime((pcloudGuide.getTimeSpan() == null ? 0 : pcloudGuide.getTimeSpan())).num(pcloudGuideDelayDto.getNum() + 1)
.robotWxId(pcloudGuideDelayDto.getRobotWxId()).code(pcloudGuideDelayDto.getCode()).ip(pcloudGuideDelayDto.getIp()).build();
}
JedisClusterUtils.hset(pcloudGuideDelayDto.getRobotWxId() + PCLOUD_GUIDE_SUFFIX, userId, JSONObject.toJSONString(guideDelayDto));
} else {
......@@ -118,6 +125,7 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
log.error("引导语延时发送,处理失败", e);
}
}
}).start();
}
}
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