feat:下单定时任务
This commit is contained in:
@@ -36,7 +36,7 @@ public class VenueQuerySchedule {
|
||||
@Scheduled(cron = "0 30 8 * * ?")
|
||||
public void venueQueryTask() {
|
||||
log.info("每日8:30拉取江体小程序数据定时任务");
|
||||
List<SitePositionList> sitePositionLists = venueService.queryVenueService();
|
||||
List<SitePositionList> sitePositionLists = venueService.queryTomorrowVenue();
|
||||
// 6-8场地
|
||||
Map<String, List<SitePositionList>> map1 = Maps.newLinkedHashMap();
|
||||
// 8-10场地
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.xiang.xservice.application.script.jntyzx.schedule;
|
||||
|
||||
import com.xiang.xservice.application.script.jntyzx.entity.pojo.VenueInfoDO;
|
||||
import com.xiang.xservice.application.script.jntyzx.service.DingTalkScriptVenueService;
|
||||
import com.xiang.xservice.application.script.jntyzx.service.IJntyzxHttpService;
|
||||
import com.xiang.xservice.application.script.jntyzx.service.IUserTokenInfoService;
|
||||
import com.xiang.xservice.application.script.jntyzx.service.IVenueService;
|
||||
import com.xiang.xservice.application.script.jntyzx.utils.VenueInfoUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-12-16 14:26
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class VenueSubscribeSchedule {
|
||||
private final IVenueService venueService;
|
||||
private final IJntyzxHttpService jntyzxHttpService;
|
||||
private final IUserTokenInfoService userTokenInfoService;
|
||||
private final DingTalkScriptVenueService dingTalkScriptVenueService;
|
||||
@Scheduled(cron = "0 0 9 * * ?")
|
||||
public void subscribe() {
|
||||
List<VenueInfoDO> venueInfoDOS = venueService.queryCanBuyVenue();
|
||||
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
||||
return;
|
||||
}
|
||||
Map<String, List<VenueInfoDO>> map = venueInfoDOS.stream().filter(VenueInfoUtils::get1221VenueInfo4Mor).collect(Collectors.groupingBy(VenueInfoDO::getPlaceName));
|
||||
String token = userTokenInfoService.getToken("Xiang");
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return;
|
||||
}
|
||||
map.keySet().parallelStream().forEach(placeName -> {
|
||||
List<VenueInfoDO> venueInfoDOList = map.get(placeName);
|
||||
Boolean order = jntyzxHttpService.createOrder(venueInfoDOList, token);
|
||||
if (order) {
|
||||
dingTalkScriptVenueService.sendScriptMsg("场地:" + placeName + "下单成功,请付款!时间:" + LocalDateTime.now());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user