downgrade xxl-job release

This commit is contained in:
JiyangTang 2024-06-17 15:57:48 +08:00
parent 8e4dceb188
commit facabbf4ae
2 changed files with 7 additions and 6 deletions

View File

@ -112,7 +112,7 @@
<dependency> <dependency>
<groupId>com.xuxueli</groupId> <groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId> <artifactId>xxl-job-core</artifactId>
<version>2.3.0</version> <version>2.2.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -2,7 +2,8 @@ package top.baogutang.admin.schedule;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
@ -29,7 +30,7 @@ import java.util.Objects;
@Slf4j @Slf4j
@Component @Component
@RefreshScope @RefreshScope
public class NoticeScheduleHandler { public class NoticeScheduleHandler extends IJobHandler {
@Resource @Resource
private DingTalkMsgPushUtils dingTalkMsgPushUtils; private DingTalkMsgPushUtils dingTalkMsgPushUtils;
@ -37,9 +38,8 @@ public class NoticeScheduleHandler {
@Resource @Resource
private INoticeLogService noticeLogService; private INoticeLogService noticeLogService;
@Override
@XxlJob("NoticeScheduleHandler") public ReturnT<String> execute(String params) throws Exception {
public void noticeScheduleHandler() throws Exception {
Arrays.stream(NoticeTypeEnum.values()) Arrays.stream(NoticeTypeEnum.values())
.forEach(noticeType -> { .forEach(noticeType -> {
Results<PageUtil<AnnouncementsDto>> results = OkHttpUtil.get(noticeType.getListUrl(), null, null, new TypeReference<Results<PageUtil<AnnouncementsDto>>>() { Results<PageUtil<AnnouncementsDto>> results = OkHttpUtil.get(noticeType.getListUrl(), null, null, new TypeReference<Results<PageUtil<AnnouncementsDto>>>() {
@ -64,5 +64,6 @@ public class NoticeScheduleHandler {
dingTalkMsgPushUtils.robotMarkdownMsgPush(announcementsDto.getTitle(), "查看详情", noticeType.getDetailUrl() + announcementsDto.getId(), content); dingTalkMsgPushUtils.robotMarkdownMsgPush(announcementsDto.getTitle(), "查看详情", noticeType.getDetailUrl() + announcementsDto.getId(), content);
noticeLogService.saveNotice(noticeType, announcementsDto.getId(), announcementsDto.getType(), announcementsDto.getTitle(), announcementsDto.getCover(), noticeType.getDetailUrl() + announcementsDto.getId(), announcementsDto.getCreator(), announcementsDto.getCreatedAt()); noticeLogService.saveNotice(noticeType, announcementsDto.getId(), announcementsDto.getType(), announcementsDto.getTitle(), announcementsDto.getCover(), noticeType.getDetailUrl() + announcementsDto.getId(), announcementsDto.getCreator(), announcementsDto.getCreatedAt());
}); });
return ReturnT.SUCCESS;
} }
} }