Compare commits
3 Commits
906a1d84fa
...
14f64e94ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14f64e94ad | ||
|
|
286190ff0b | ||
|
|
ec8826508a |
@@ -10,7 +10,6 @@ import java.util.List;
|
||||
* @Date: 2025-12-16 09:19
|
||||
*/
|
||||
public interface IUserTokenInfoManage extends IService<UserTokenInfoDO> {
|
||||
|
||||
List<UserTokenInfoDO> listUser();
|
||||
UserTokenInfoDO getByName(String name);
|
||||
}
|
||||
|
||||
@@ -12,10 +12,8 @@ import com.xiang.app.modules.jntyzx.manage.IOrderCreateInfoManage;
|
||||
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
||||
import com.xiang.app.modules.jntyzx.service.IJtOrderService;
|
||||
import com.xiang.xmc.service.cache.service.IRedisService;
|
||||
import com.xiang.xservice.basic.utils.JsonUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -78,6 +76,9 @@ public class OrderInfoServiceImpl implements IJtOrderService {
|
||||
if (orderResp.getMessage().contains("锁卡")) {
|
||||
return true;
|
||||
}
|
||||
if (orderResp.getMessage().contains("限制")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
||||
|
||||
@Override
|
||||
public boolean flushToken() {
|
||||
List<UserTokenInfoDO> userTokenInfoDOS = userTokenInfoManage.listUser();
|
||||
List<UserTokenInfoDO> userTokenInfoDOS = userTokenInfoManage.list();
|
||||
if (CollectionUtils.isEmpty(userTokenInfoDOS)) {
|
||||
log.info("【心跳监测】查询用户信息为空,无需操作");
|
||||
return true;
|
||||
@@ -85,8 +85,12 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
||||
boolean flag = StringUtils.contains(jntyzxResponse.getMessage(), "已存在");
|
||||
if (flag) {
|
||||
log.info("用户名:{}心跳成功✅✅✅✅✅✅", userTokenInfoDO.getName());
|
||||
userTokenInfoDO.setStatus(1);
|
||||
userTokenInfoManage.updateById(userTokenInfoDO);
|
||||
} else {
|
||||
jtDingTalkFactory.sendMsg("用户名:" + userTokenInfoDO.getName() + "心跳失败,消息:" + jntyzxResponse.getMessage());
|
||||
userTokenInfoDO.setStatus(0);
|
||||
userTokenInfoManage.updateById(userTokenInfoDO);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -47,6 +47,8 @@ public class JtVenuePullTask {
|
||||
return;
|
||||
}
|
||||
String token;
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
int dayOfWeek = now.getDayOfWeek().getValue();
|
||||
|
||||
for (UserTokenInfoDO userTokenInfoDO : availableUser) {
|
||||
if (Objects.isNull(userTokenInfoDO)) {
|
||||
@@ -62,19 +64,30 @@ public class JtVenuePullTask {
|
||||
}
|
||||
venueService.saveOrUpdateTodayVenueInfo(sitePositionLists);
|
||||
|
||||
sitePositionLists = sitePositionLists.stream().filter(VenueInfoUtils::get8210VenueInfo).toList();
|
||||
sitePositionLists = handleMsgSendList(sitePositionLists, dayOfWeek);
|
||||
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||
return;
|
||||
}
|
||||
sitePositionLists = sitePositionLists.stream().filter(item -> StringUtils.equals(item.getContacts(), "0")).toList();
|
||||
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||
return;
|
||||
}
|
||||
StringBuffer msg = new StringBuffer("查询到20:00-22:00空闲场地信息===>时间:" + DateUtils.getDateFromDate(LocalDate.now()) + "\n");
|
||||
|
||||
StringBuffer msg = new StringBuffer("查询到20:00-22:00空闲场地信息===>\n时间:" + DateUtils.getDateFromDate(LocalDate.now()));
|
||||
sitePositionLists.forEach(item -> {
|
||||
msg.append(item.getPlaceName()).append("\n");
|
||||
});
|
||||
jtDingTalkFactory.sendMsg(msg.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private List<SitePositionList> handleMsgSendList(List<SitePositionList> sitePositionLists, int dayOfWeek) {
|
||||
// 过滤出来8-10的未订购的场地信息
|
||||
sitePositionLists = sitePositionLists.stream()
|
||||
.filter(VenueInfoUtils::get8210VenueInfo)
|
||||
.filter(item -> StringUtils.equals(item.getContacts(), "0")).toList();
|
||||
// 周六周日过滤小馆,不查询当天小馆信息
|
||||
if (dayOfWeek == 6 || dayOfWeek == 7) {
|
||||
return sitePositionLists.stream()
|
||||
.filter(item -> !item.getPlaceName().contains("小馆"))
|
||||
.toList();
|
||||
}
|
||||
return sitePositionLists;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.xiang.app.schedule.jntyzx;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.xiang.app.common.service.dingtalk.JtDingTalkFactory;
|
||||
import com.xiang.app.modules.jntyzx.entity.resp.query.SitePositionList;
|
||||
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
||||
import com.xiang.app.modules.jntyzx.service.IUserTokenInfoService;
|
||||
import com.xiang.app.modules.jntyzx.utils.VenueInfoUtils;
|
||||
import com.xiang.app.modules.jntyzx.utils.WeekendUtils;
|
||||
import com.xiang.core.quartz.annotation.XxzJob;
|
||||
import com.xiang.xservice.basic.utils.DateUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-01-19 14:00
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class JtVenueTodaySubscribeTask {
|
||||
|
||||
private final IJntyzxHttpService jntyzxHttpService;
|
||||
private final IUserTokenInfoService userTokenInfoService;
|
||||
private final JtDingTalkFactory jtDingTalkFactory;
|
||||
|
||||
@XxzJob(name = "jtVenueTodaySubscribeTask")
|
||||
@GetMapping("/jtVenueTodaySubscribeTask")
|
||||
public void handle() {
|
||||
String token = userTokenInfoService.getToken("Xiang");
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return;
|
||||
}
|
||||
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailable(WeekendUtils.isWeekend(), token);
|
||||
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||
return;
|
||||
}
|
||||
sitePositionLists = sitePositionLists.stream().filter(VenueInfoUtils::get8210VenueInfo).toList();
|
||||
Map<String, SitePositionList> map = Maps.newLinkedHashMap();
|
||||
for (SitePositionList sitePositionList : sitePositionLists) {
|
||||
if (map.containsKey(sitePositionList.getPlaceName())) {
|
||||
continue;
|
||||
}
|
||||
map.put(sitePositionList.getPlaceName(), sitePositionList);
|
||||
}
|
||||
StringBuffer msg = new StringBuffer("查询江体场地信息=====>\n时间:" + DateUtils.getDateFromDate(LocalDate.now()) + " 20:00-22:00\n");
|
||||
map.forEach((placeName, sitePositionList) -> {
|
||||
msg.append(placeName).append("订购人:").append(sitePositionList.getContacts()).append("\n");
|
||||
});
|
||||
jtDingTalkFactory.sendMsg(msg.toString());
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,9 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -73,7 +70,7 @@ public class JtVenueTomorrowPullTask {
|
||||
}
|
||||
map.put(sitePositionList.getPlaceName(), sitePositionList);
|
||||
}
|
||||
StringBuffer msg = new StringBuffer("查询场地信息===>时间:\n" + DateUtils.getDateFromDate(LocalDate.now()) + " 20:00-22:00\n");
|
||||
StringBuffer msg = new StringBuffer("查询江体场地信息===>时间:\n" + DateUtils.getDateFromDate(LocalDate.now().plusDays(1)) + " 20:00-22:00\n");
|
||||
map.forEach((placeName, sitePositionList) -> {
|
||||
msg.append(placeName).append("订购人:").append(sitePositionList.getContacts()).append("\n");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user