feat:新增当天场地信息拉取
This commit is contained in:
@@ -10,7 +10,6 @@ import java.util.List;
|
|||||||
* @Date: 2025-12-16 09:19
|
* @Date: 2025-12-16 09:19
|
||||||
*/
|
*/
|
||||||
public interface IUserTokenInfoManage extends IService<UserTokenInfoDO> {
|
public interface IUserTokenInfoManage extends IService<UserTokenInfoDO> {
|
||||||
|
|
||||||
List<UserTokenInfoDO> listUser();
|
List<UserTokenInfoDO> listUser();
|
||||||
UserTokenInfoDO getByName(String name);
|
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.IJntyzxHttpService;
|
||||||
import com.xiang.app.modules.jntyzx.service.IJtOrderService;
|
import com.xiang.app.modules.jntyzx.service.IJtOrderService;
|
||||||
import com.xiang.xmc.service.cache.service.IRedisService;
|
import com.xiang.xmc.service.cache.service.IRedisService;
|
||||||
import com.xiang.xservice.basic.utils.JsonUtils;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -78,6 +76,9 @@ public class OrderInfoServiceImpl implements IJtOrderService {
|
|||||||
if (orderResp.getMessage().contains("锁卡")) {
|
if (orderResp.getMessage().contains("锁卡")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (orderResp.getMessage().contains("限制")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean flushToken() {
|
public boolean flushToken() {
|
||||||
List<UserTokenInfoDO> userTokenInfoDOS = userTokenInfoManage.listUser();
|
List<UserTokenInfoDO> userTokenInfoDOS = userTokenInfoManage.list();
|
||||||
if (CollectionUtils.isEmpty(userTokenInfoDOS)) {
|
if (CollectionUtils.isEmpty(userTokenInfoDOS)) {
|
||||||
log.info("【心跳监测】查询用户信息为空,无需操作");
|
log.info("【心跳监测】查询用户信息为空,无需操作");
|
||||||
return true;
|
return true;
|
||||||
@@ -85,8 +85,12 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
|||||||
boolean flag = StringUtils.contains(jntyzxResponse.getMessage(), "已存在");
|
boolean flag = StringUtils.contains(jntyzxResponse.getMessage(), "已存在");
|
||||||
if (flag) {
|
if (flag) {
|
||||||
log.info("用户名:{}心跳成功✅✅✅✅✅✅", userTokenInfoDO.getName());
|
log.info("用户名:{}心跳成功✅✅✅✅✅✅", userTokenInfoDO.getName());
|
||||||
|
userTokenInfoDO.setStatus(1);
|
||||||
|
userTokenInfoManage.updateById(userTokenInfoDO);
|
||||||
} else {
|
} else {
|
||||||
jtDingTalkFactory.sendMsg("用户名:" + userTokenInfoDO.getName() + "心跳失败,消息:" + jntyzxResponse.getMessage());
|
jtDingTalkFactory.sendMsg("用户名:" + userTokenInfoDO.getName() + "心跳失败,消息:" + jntyzxResponse.getMessage());
|
||||||
|
userTokenInfoDO.setStatus(0);
|
||||||
|
userTokenInfoManage.updateById(userTokenInfoDO);
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class JtVenuePullTask {
|
|||||||
return;
|
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 -> {
|
sitePositionLists.forEach(item -> {
|
||||||
msg.append(item.getPlaceName()).append("\n");
|
msg.append(item.getPlaceName()).append("\n");
|
||||||
});
|
});
|
||||||
@@ -78,17 +78,16 @@ public class JtVenuePullTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<SitePositionList> handleMsgSendList(List<SitePositionList> sitePositionLists, int dayOfWeek) {
|
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) {
|
if (dayOfWeek == 6 || dayOfWeek == 7) {
|
||||||
return sitePositionLists.stream()
|
return sitePositionLists.stream()
|
||||||
.filter(VenueInfoUtils::get8210VenueInfo)
|
|
||||||
.filter(item -> StringUtils.equals(item.getContacts(), "0"))
|
|
||||||
.filter(item -> !item.getPlaceName().contains("小馆"))
|
.filter(item -> !item.getPlaceName().contains("小馆"))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
return sitePositionLists.stream()
|
return sitePositionLists;
|
||||||
.filter(VenueInfoUtils::get8210VenueInfo)
|
|
||||||
.filter(item -> StringUtils.equals(item.getContacts(), "0"))
|
|
||||||
.toList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@@ -73,7 +70,7 @@ public class JtVenueTomorrowPullTask {
|
|||||||
}
|
}
|
||||||
map.put(sitePositionList.getPlaceName(), sitePositionList);
|
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) -> {
|
map.forEach((placeName, sitePositionList) -> {
|
||||||
msg.append(placeName).append("订购人:").append(sitePositionList.getContacts()).append("\n");
|
msg.append(placeName).append("订购人:").append(sitePositionList.getContacts()).append("\n");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user