15 Commits

Author SHA1 Message Date
Xiang
5c99bfc360 fix:修改域名解析 2026-06-04 15:21:05 +08:00
Xiang
20a92a22bf fix:修改定时任务时间 2026-05-13 15:57:39 +08:00
Xiang
3c6ce446c7 fix:捡漏任务 2026-05-12 10:08:16 +08:00
Xiang
9d0ed87191 fix:zlb订单查询 2026-05-11 09:59:58 +08:00
Xiang
d7be3786c3 feat:zlb场地排序 2026-05-11 08:45:22 +08:00
44efd5689b Merge pull request '江体小程序和zlb接口开发' (#1) from feat/script_v1 into master
Reviewed-on: https://gitea.xiangtech.xyz/XiangZ/script/pulls/1
2026-05-10 09:06:33 +00:00
Xiang
0f7af30789 feat:zlb场地排序 2026-05-09 16:43:55 +08:00
Xiang
b4ed93171c feat:日志打印优化 2026-05-09 15:42:21 +08:00
Xiang
6902a16cfa feat:日志打印优化 2026-05-09 15:24:44 +08:00
Xiang
60992dc4f6 feat:zlb江体优化 2026-05-09 15:17:12 +08:00
Xiang
cb21b38287 feat:江体小程序定时任务优化 2026-05-09 14:58:07 +08:00
Xiang
268b63e607 feat:江体小程序定时任务优化 2026-05-09 14:35:54 +08:00
Xiang
d1584184ae feat:江体小程序 2026-05-09 11:41:03 +08:00
Xiang
fea069d795 feat:江体小程序 2026-05-09 10:56:26 +08:00
Xiang
b30af008e0 feat:江体小程序 2026-05-09 10:21:03 +08:00
76 changed files with 1808 additions and 574 deletions

View File

@@ -2,9 +2,11 @@ package com.xiang;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xiang.common.enums.RedisKeyConstant;
import com.xiang.common.enums.ScheduleEnums; import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.pojo.schedule.ScheduleOpeningConfigDO; import com.xiang.common.pojo.schedule.ScheduleOpeningConfigDO;
import com.xiang.common.service.IScheduleOpeningConfigService; import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.utils.RedisService;
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.collections4.CollectionUtils;
@@ -28,6 +30,7 @@ import java.util.stream.Collectors;
public class ApplicationInit implements ApplicationRunner { public class ApplicationInit implements ApplicationRunner {
private final IScheduleOpeningConfigService scheduleOpeningConfigService; private final IScheduleOpeningConfigService scheduleOpeningConfigService;
private final RedisService redisService;
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
@@ -35,6 +38,10 @@ public class ApplicationInit implements ApplicationRunner {
log.info("开始加载任务配置!"); log.info("开始加载任务配置!");
loadScheduleTask(); loadScheduleTask();
log.info("任务配置加载完成!"); log.info("任务配置加载完成!");
log.info("redis key 加载开始!");
loadRedisKey();
log.info("redis key 加载结束!");
} }
private void loadScheduleTask() { private void loadScheduleTask() {
@@ -54,7 +61,7 @@ public class ApplicationInit implements ApplicationRunner {
continue; continue;
} }
ScheduleOpeningConfigDO scheduleOpeningConfigDO = new ScheduleOpeningConfigDO(); ScheduleOpeningConfigDO scheduleOpeningConfigDO = new ScheduleOpeningConfigDO();
scheduleOpeningConfigDO.setModule(scheduleEnum.getModeleCode()); scheduleOpeningConfigDO.setModule(scheduleEnum.getModuleCode());
scheduleOpeningConfigDO.setBeanName(scheduleEnum.getTaskName()); scheduleOpeningConfigDO.setBeanName(scheduleEnum.getTaskName());
scheduleOpeningConfigDO.setStatus(1); scheduleOpeningConfigDO.setStatus(1);
list.add(scheduleOpeningConfigDO); list.add(scheduleOpeningConfigDO);
@@ -63,4 +70,8 @@ public class ApplicationInit implements ApplicationRunner {
scheduleOpeningConfigService.saveBatch(list); scheduleOpeningConfigService.saveBatch(list);
} }
} }
private void loadRedisKey() {
redisService.set(RedisKeyConstant.JNTYZX_SUBSCRIBE_TIME_KEY, "18:00");
}
} }

View File

@@ -7,11 +7,17 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisPassword;
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer;
import java.time.Duration;
@Configuration @Configuration
public class RedisConfig { public class RedisConfig {
@Bean @Bean
@@ -35,7 +41,6 @@ public class RedisConfig {
template.setValueSerializer(jackson2JsonRedisSerializer); template.setValueSerializer(jackson2JsonRedisSerializer);
template.setHashValueSerializer(jackson2JsonRedisSerializer); template.setHashValueSerializer(jackson2JsonRedisSerializer);
template.afterPropertiesSet(); template.afterPropertiesSet();
return template; return template;
} }
@@ -44,4 +49,18 @@ public class RedisConfig {
public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory factory) { public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory factory) {
return new StringRedisTemplate(factory); return new StringRedisTemplate(factory);
} }
@Bean
public RedisConnectionFactory redisConnectionFactory(RedisProperties props) {
RedisStandaloneConfiguration config = new RedisStandaloneConfiguration();
config.setHostName(props.getHost());
config.setPort(Integer.parseInt(props.getPort()));
config.setPassword(RedisPassword.of(props.getPassword()));
config.setDatabase(props.getDatabase());
LettuceClientConfiguration clientConfig = LettuceClientConfiguration.builder()
.commandTimeout(Duration.ofSeconds(3))
.build();
return new LettuceConnectionFactory(config, clientConfig);
}
} }

View File

@@ -14,7 +14,7 @@ public class RedisProperties {
private String host; private String host;
private String port; private String port;
private String password; private String password;
private Integer database = 0; private Integer database;
public String getAddress() { public String getAddress() {
return "redis://" + host + ":" + port; return "redis://" + host + ":" + port;

View File

@@ -1,10 +1,10 @@
package com.xiang.service.module.jntyzx.miniapp.constants; package com.xiang.common.enums;
/** /**
* @Author: xiang * @Author: xiang
* @Date: 2025-12-15 13:46 * @Date: 2025-12-15 13:46
*/ */
public class UrlConstant { public class JntyzxUrlConstant {
/** /**
* 江南体育中心基础URL * 江南体育中心基础URL

View File

@@ -1,6 +1,8 @@
package com.xiang.service.module.jntyzx.miniapp.constants; package com.xiang.common.enums;
import com.xiang.common.utils.DateUtils;
import java.time.LocalDate; import java.time.LocalDate;
/** /**
@@ -27,6 +29,8 @@ public class RedisKeyConstant {
return JNTYZX_VENUE_SUBSCRIBE_KEY + placeName + ":" + getDate(); return JNTYZX_VENUE_SUBSCRIBE_KEY + placeName + ":" + getDate();
} }
public static final String JNTYZX_SUBSCRIBE_TIME_KEY = "jntyzx:subscribe:time";
public static String getDate() { public static String getDate() {
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
return ":" + DateUtils.getDateFromDate(now); return ":" + DateUtils.getDateFromDate(now);

View File

@@ -8,19 +8,27 @@ import lombok.Getter;
public enum ScheduleEnums { public enum ScheduleEnums {
/** /**
* 0glados 1芬玩岛 2江体小程序 3江体zlb 4DDNS * 0glados
* 1芬玩岛
* 2DDNS
* 3江体zlb
* 4江体小程序
*/ */
/**
* Aliyun DDNS任务
*/
DOMAIN_DYNAMIC_ANALYSIS_TASK(4, "domain", "domainDynamicAnalysisTask"),
/** /**
* Glados任务 * Glados任务
*/ */
GLADOS_CHECK_IN_TASK(0, "glados", "gladosCheckInTask"), GLADOS_CHECK_IN_TASK(0, "glados", "gladosCheckInTask"),
/**
* Aliyun DDNS任务
*/
DOMAIN_DYNAMIC_ANALYSIS_TASK(2, "domain", "domainDynamicAnalysisTask"),
/**
* 芬玩岛 任务
*/
/** /**
* 江体 ZLB任务 * 江体 ZLB任务
*/ */
@@ -30,10 +38,25 @@ public enum ScheduleEnums {
ZLB_SITE_DAY_TASK(3, "zlb", "zlbSiteDayTask"), ZLB_SITE_DAY_TASK(3, "zlb", "zlbSiteDayTask"),
ZLB_ORDER_CREATE_TASK(3, "zlb", "zlbOrderCreateTask"), ZLB_ORDER_CREATE_TASK(3, "zlb", "zlbOrderCreateTask"),
ZLB_USER_CONFIG_TASK(3, "zlb", "zlbUserConfigTask"), ZLB_USER_CONFIG_TASK(3, "zlb", "zlbUserConfigTask"),
ZLB_ORDER_QUERY_TASK(3, "zlb", "zlbOrderQueryTask"),
ZLB_ORDER_JL_TASK(3, "zlb", "zlbOrderJlTask"),
/**
* 江体 小程序任务
*/
JNTYZX_TOKEN_REFRESH_TASK(4, "jt-miniApp", "jntyzxTokenRefreshTask"),
JNTYZX_VENUE_INFO_PULL_TASK(4, "jt-miniApp", "jntyzxVenuePullTask"),
JNTYZX_ORDER_SUBSCRIBE_TASK(4, "jt-miniApp", "jntyzxOrderSubscribeTask"),
JNTYZX_VENUE_TODAY_SUBSCRIBE_TASK(4, "jt-miniApp", "jntyzxVenueTodaySubscribeTask"),
JNTYZX_VENUE_TOMORROW_PULL_TASK(4, "jt-miniApp", "jntyzxVenueTodayPullTask"),
JNTYZX_USER_INFO_CONFIG(4, "jt-miniApp", "jntyzxUserInfoConfigTask"),
JNTYZX_VENUE_INFO_TODAY_RESULT_TASK(4, "jt-miniApp", "jtVenueInfoTodayResultTask"),
JNTYZX_VENUE_INFO_TOMORROW_RESULT_TASK(4, "jt-miniApp", "jtVenueInfoTomorrowResultTask"),
; ;
private final Integer modeleCode; private final Integer moduleCode;
private final String module; private final String module;
private final String taskName; private final String taskName;
} }

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.miniapp.manage; package com.xiang.common.manage.jntyzx.miniapp;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO;

View File

@@ -0,0 +1,12 @@
package com.xiang.common.manage.jntyzx.miniapp;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserInfoDO;
/**
* @Author: xiang
* @Date: 2026-05-09 10:17
*/
public interface IUserInfoManage extends IService<UserInfoDO> {
boolean delAll();
}

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.miniapp.manage; package com.xiang.common.manage.jntyzx.miniapp;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo; import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo;

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.miniapp.manage; package com.xiang.common.manage.jntyzx.miniapp;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;

View File

@@ -1,9 +1,7 @@
package com.xiang.service.module.jntyzx.miniapp.manage; package com.xiang.common.manage.jntyzx.miniapp;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.req.VenueInfoQueryRequest;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
@@ -17,6 +15,4 @@ public interface IVenueInfoManage extends IService<VenueInfoDO> {
List<VenueInfoDO> queryByDate(LocalDate date); List<VenueInfoDO> queryByDate(LocalDate date);
List<VenueInfoDO> queryByType(LocalDate date, Integer type); List<VenueInfoDO> queryByType(LocalDate date, Integer type);
Page<VenueInfoDO> page(VenueInfoQueryRequest request);
} }

View File

@@ -1,10 +1,10 @@
package com.xiang.service.module.jntyzx.miniapp.manage; package com.xiang.common.manage.jntyzx.miniapp;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO;
import com.xiang.service.module.jntyzx.miniapp.mapper.JntyzxOrderCreateInfoMapper; import com.xiang.common.mapper.JntyzxOrderCreateInfoMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;

View File

@@ -0,0 +1,18 @@
package com.xiang.common.manage.jntyzx.miniapp;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiang.common.mapper.JntyzxUserInfoMapper;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserInfoDO;
import org.springframework.stereotype.Service;
/**
* @Author: xiang
* @Date: 2026-05-09 10:17
*/
@Service
public class UserInfoManageImpl extends ServiceImpl<JntyzxUserInfoMapper, UserInfoDO> implements IUserInfoManage {
@Override
public boolean delAll() {
return baseMapper.delAll() > 0;
}
}

View File

@@ -1,10 +1,10 @@
package com.xiang.service.module.jntyzx.miniapp.manage; package com.xiang.common.manage.jntyzx.miniapp;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo; import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo;
import com.xiang.service.module.jntyzx.miniapp.mapper.JntyzxUserRestrictionInfoMapper; import com.xiang.common.mapper.JntyzxUserRestrictionInfoMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.miniapp.manage; package com.xiang.common.manage.jntyzx.miniapp;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.req.UserQueryReq; import com.xiang.common.pojo.jntyzx.miniapp.req.UserQueryReq;
import com.xiang.service.module.jntyzx.miniapp.mapper.JntyzxUserTokenInfoMapper; import com.xiang.common.mapper.JntyzxUserTokenInfoMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;

View File

@@ -1,13 +1,10 @@
package com.xiang.service.module.jntyzx.miniapp.manage; package com.xiang.common.manage.jntyzx.miniapp;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.req.VenueInfoQueryRequest; import com.xiang.common.mapper.JntyzxVenueInfoMapper;
import com.xiang.service.module.jntyzx.miniapp.mapper.JntyzxVenueInfoMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate; import java.time.LocalDate;
@@ -33,18 +30,4 @@ public class VenueInfoManageImpl extends ServiceImpl<JntyzxVenueInfoMapper, Venu
lqw.eq(VenueInfoDO::getType, type); lqw.eq(VenueInfoDO::getType, type);
return baseMapper.selectList(lqw); return baseMapper.selectList(lqw);
} }
@Override
public Page<VenueInfoDO> page(VenueInfoQueryRequest request) {
Page<VenueInfoDO> page = new Page<>(request.getCurrent(), request.getPageSize());
LambdaQueryWrapper<VenueInfoDO> lqw = Wrappers.lambdaQuery();
lqw.eq(VenueInfoDO::getDate, request.getDate());
if (StringUtils.isNotBlank(request.getSj())) {
lqw.eq(VenueInfoDO::getSjName, request.getSj());
}
if (StringUtils.isNotBlank(request.getPlaceName())) {
lqw.like(VenueInfoDO::getPlaceName, request.getPlaceName());
}
return baseMapper.selectPage(page, lqw);
}
} }

View File

@@ -0,0 +1,15 @@
package com.xiang.common.manage.jntyzx.zlb;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xiang.common.pojo.jntyzx.zlb.ZlbJlUserInfo;
import java.util.List;
/**
* @Author: xiang
* @Date: 2026-05-12 09:18
*/
public interface IZlbJlUserInfoManage extends IService<ZlbJlUserInfo> {
List<ZlbJlUserInfo> getJlUsers();
}

View File

@@ -0,0 +1,16 @@
package com.xiang.common.manage.jntyzx.zlb;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xiang.common.pojo.jntyzx.zlb.ZlbPayOrder;
import java.time.LocalDate;
import java.util.List;
/**
* @Author: xiang
* @Date: 2026-05-09 15:11
*/
public interface IZlbOrderInfoManage extends IService<ZlbPayOrder> {
List<ZlbPayOrder> queryOrder(LocalDate date);
}

View File

@@ -0,0 +1,27 @@
package com.xiang.common.manage.jntyzx.zlb;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiang.common.mapper.ZlbJlUserInfoMapper;
import com.xiang.common.pojo.jntyzx.zlb.ZlbJlUserInfo;
import com.xiang.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List;
/**
* @Author: xiang
* @Date: 2026-05-12 09:18
*/
@Service
public class ZlbJlUserInfoManageImpl extends ServiceImpl<ZlbJlUserInfoMapper, ZlbJlUserInfo> implements IZlbJlUserInfoManage {
@Override
public List<ZlbJlUserInfo> getJlUsers() {
LambdaQueryWrapper<ZlbJlUserInfo> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(ZlbJlUserInfo::getDay, DateUtils.getDateFromDate(LocalDate.now()));
lambdaQueryWrapper.eq(ZlbJlUserInfo::getDay, DateUtils.getWeekDay(LocalDate.now()));
return baseMapper.selectList(lambdaQueryWrapper);
}
}

View File

@@ -0,0 +1,27 @@
package com.xiang.common.manage.jntyzx.zlb;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiang.common.mapper.ZlbOrderInfoMapper;
import com.xiang.common.pojo.jntyzx.zlb.ZlbPayOrder;
import com.xiang.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List;
/**
* @Author: xiang
* @Date: 2026-05-09 15:11
*/
@Service
public class ZlbOrderInfoManageImpl extends ServiceImpl<ZlbOrderInfoMapper, ZlbPayOrder> implements IZlbOrderInfoManage {
@Override
public List<ZlbPayOrder> queryOrder(LocalDate date) {
LambdaQueryWrapper<ZlbPayOrder> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(ZlbPayOrder::getDay, DateUtils.getDateFromDate(date));
lambdaQueryWrapper.eq(ZlbPayOrder::getIsPay, 0);
return baseMapper.selectList(lambdaQueryWrapper);
}
}

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.zlb.service; package com.xiang.common.manage.jntyzx.zlb;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xiang.common.pojo.jntyzx.zlb.ZlbSiteInfo; import com.xiang.common.pojo.jntyzx.zlb.ZlbSiteInfo;

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.zlb.service; package com.xiang.common.manage.jntyzx.zlb;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiang.common.mapper.ZlbSiteInfoMapper; import com.xiang.common.mapper.ZlbSiteInfoMapper;

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.zlb.service; package com.xiang.common.manage.jntyzx.zlb;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo; import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.zlb.service; package com.xiang.common.manage.jntyzx.zlb;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.zlb.service; package com.xiang.common.manage.jntyzx.zlb;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo; import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.zlb.service; package com.xiang.common.manage.jntyzx.zlb;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiang.common.mapper.ZlbUserInfoMapper; import com.xiang.common.mapper.ZlbUserInfoMapper;

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.miniapp.mapper; package com.xiang.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO;

View File

@@ -0,0 +1,20 @@
package com.xiang.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserInfoDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @Author: xiang
* @Date: 2026-05-09 10:16
*/
@Mapper
@Repository
public interface JntyzxUserInfoMapper extends BaseMapper<UserInfoDO> {
@Delete("delete from jntyzx_user_info where 1=1")
int delAll();
}

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.miniapp.mapper; package com.xiang.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo; import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo;

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.miniapp.mapper; package com.xiang.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;

View File

@@ -1,4 +1,4 @@
package com.xiang.service.module.jntyzx.miniapp.mapper; package com.xiang.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;

View File

@@ -0,0 +1,53 @@
package com.xiang.common.pojo.jntyzx.miniapp.pojo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @Author: xiang
* @Date: 2026-05-09 09:54
*/
@Data
@TableName("jntyzx_user_info")
public class UserInfoDO {
/**
*
*/
@TableId(type = IdType.AUTO)
private Integer id;
private Integer loginInfoId;
/**
* 名称
*/
private String name;
/**
* 星期几
*/
private String week;
/**
* 分配的任务参数
*/
private String type;
/**
* 场地信息
*/
private String placeName;
/**
* 时间id111
*/
private String siteTimeName;
/**
* 是否开抢0-抢,1-不抢
*/
private Integer isBook;
}

View File

@@ -16,7 +16,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class SubscribeRequest { public class SubscribeRequest {
private JSONObject jsonObject; private JSONObject jsonObject;
private List<com.xiang.service.module.jntyzx.miniapp.entity.req.SubscribeVo> subscribeVos; private List<SubscribeVo> subscribeVos;
private String bookTime; private String bookTime;
private Integer paymentMethod; private Integer paymentMethod;
private String svCiphertext; private String svCiphertext;

View File

@@ -1,3 +1,4 @@
package com.xiang.common.pojo.jntyzx.miniapp.resp.query;
import lombok.Data; import lombok.Data;

View File

@@ -0,0 +1,51 @@
package com.xiang.common.pojo.jntyzx.zlb;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* @Author: xiang
* @Date: 2026-05-11 09:43
*/
@Data
@AllArgsConstructor
public class ZlbOrderDetailResp {
private Integer state;
private Integer blocId;
private Integer stadiumId;
private String stadiumArea;
private String stadiumName;
private String stadiumPhone;
private String stadiumType;
private String stadiumAddress;
private String mapLongitude;
private String mapLatitude;
private String ticketImg;
private String spName;
private String siteName;
private String siteAmount;
// private String orderAmount;
private Integer payNumber;
// private String ticketInfos;
private Integer orderId;
private String orderNo;
private String orderTime;
private String payTime;
private Integer payType;
private String payAmount;
private String discountPayAmount;
private String totalDiscountAmount;
private String isUseCoupon;
private String isUseCard;
private String name;
private String idCard;
private String phone;
private String notice;
private String blocNotice;
private Integer isRefund;
private String ticketCate;
private String spreadAmout;
private Integer isPreferential;
private String doNotWatermarkFlag;
}

View File

@@ -47,4 +47,9 @@ public class ZlbPayOrder {
* 0-未付款,1-已付款 * 0-未付款,1-已付款
*/ */
private Integer isPay; private Integer isPay;
/**
* 订单id
*/
private String orderId;
} }

View File

@@ -26,75 +26,20 @@ import java.util.concurrent.TimeUnit;
*/ */
public class DateUtils { public class DateUtils {
private static final String defaultDateFormatter = "yyyy-MM-dd"; private static final Logger logger = LoggerFactory.getLogger(DateUtils.class);
private static final String defaultDateTimeFormatter = "yyyy-MM-dd HH:mm:ss";
/**
* 构造函数.
*/
public void DateUtil() {
throw new RuntimeException("this is a util class,can not instance!");
}
/**
* 添加字段注释.
*/
public static final String ENUM_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static final String ENUM_FORMAT = "yyyy-MM-dd HH:mm:ss";
/**
* 添加字段注释.
*/
public static final String ASCM_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; public static final String ASCM_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
/**
* 添加字段注释.
*/
public static final String ENUM_FORMAT_YMD = "yyyy-MM-dd"; public static final String ENUM_FORMAT_YMD = "yyyy-MM-dd";
public static final String ENUM_FORMAT_YMD_1 = "yyyyMMdd"; public static final String ENUM_FORMAT_YMD_1 = "yyyyMMdd";
/**
* 添加字段注释.
*/
public static final String ENUM_FORMAT_YMDS = "yyyy-MM-dd HH:mm:ss.S"; public static final String ENUM_FORMAT_YMDS = "yyyy-MM-dd HH:mm:ss.S";
/**
* 添加字段注释.
*/
public static final String ENUM_FORMAT_SLASH = "yyyy/MM/dd HH:mm:ss"; public static final String ENUM_FORMAT_SLASH = "yyyy/MM/dd HH:mm:ss";
/**
* 添加字段注释.
*/
public static final String ENUM_FORMAT_YMDS_SLASH = "yyyy/MM/dd HH:mm:ss.S"; public static final String ENUM_FORMAT_YMDS_SLASH = "yyyy/MM/dd HH:mm:ss.S";
/**
* 添加字段注释.
*/
public static final String LEVEL_DAY = "day"; // 粒度级别 public static final String LEVEL_DAY = "day"; // 粒度级别
/**
* 添加字段注释.
*/
public static final String LEVEL_HOUR = "hour"; public static final String LEVEL_HOUR = "hour";
/**
* 添加字段注释.
*/
public static final String LEVEL_MINUTE = "minute"; public static final String LEVEL_MINUTE = "minute";
/**
* 添加字段注释.
*/
public static final String LEVEL_SECOND = "second"; public static final String LEVEL_SECOND = "second";
/**
* 日期特殊字符对应.
*/
private static Map<String, String> mapSign = new HashMap<>(); private static Map<String, String> mapSign = new HashMap<>();
/**
* 使用ThreadLocal保证SimpleDateFormat线程安全.
*/
private static ThreadLocal<Map<String, SimpleDateFormat>> threadLocalDateFormat = new ThreadLocal<>(); private static ThreadLocal<Map<String, SimpleDateFormat>> threadLocalDateFormat = new ThreadLocal<>();
/** /**
@@ -141,6 +86,11 @@ public class DateUtils {
return convertToChinese(dayOfWeek); return convertToChinese(dayOfWeek);
} }
public static String getWeekDay(LocalDate date) {
DayOfWeek dayOfWeek = date.getDayOfWeek();
return convertToChinese(dayOfWeek);
}
private static String convertToChinese(DayOfWeek dayOfWeek) { private static String convertToChinese(DayOfWeek dayOfWeek) {
switch (dayOfWeek) { switch (dayOfWeek) {
case MONDAY: case MONDAY:
@@ -658,7 +608,7 @@ public class DateUtils {
boolean inAfternoon = now.isAfter(LocalTime.of(12, 59)) && now.isBefore(LocalTime.of(15, 1)); boolean inAfternoon = now.isAfter(LocalTime.of(12, 59)) && now.isBefore(LocalTime.of(15, 1));
return !inAfternoon && !inMorning ? true : false; return !inAfternoon && !inMorning ? true : false;
} else { } else {
log.info("当前时间为:{}", LocalDateTime.now()); logger.info("当前时间为:{}", LocalDateTime.now());
return true; return true;
} }
} }

View File

@@ -73,7 +73,7 @@ public class HttpService {
CloseableHttpResponse response = null; CloseableHttpResponse response = null;
String result = ""; String result = "";
try { try {
log.info("HTTP请求请求地址===>{}, 请求头===>{}, 请求参数===>{}", url, JSON.toJSONString(header), jsonParams); log.debug("HTTP请求请求地址===>{}, 请求头===>{}, 请求参数===>{}", url, JSON.toJSONString(header), jsonParams);
HttpPost httpPost = new HttpPost(url); HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", "application/json"); httpPost.addHeader("Content-Type", "application/json");
// 创建请求内容 // 创建请求内容
@@ -88,7 +88,7 @@ public class HttpService {
} }
response = httpClient.execute(httpPost); response = httpClient.execute(httpPost);
result = EntityUtils.toString(response.getEntity(), "utf-8"); result = EntityUtils.toString(response.getEntity(), "utf-8");
log.info("【POST请求】 请求地址===>{}, 响应结果==={}", url, result); log.debug("【POST请求】 请求地址===>{}, 响应结果==={}", url, result);
} catch (Exception e) { } catch (Exception e) {
log.error("doPost异常", e); log.error("doPost异常", e);
} finally { } finally {
@@ -117,10 +117,10 @@ public class HttpService {
httpGet.setHeader(entry.getKey(), entry.getValue()); httpGet.setHeader(entry.getKey(), entry.getValue());
} }
} }
log.info("doGet请求请求头:{},请求地址:{}", header, url + request); log.debug("doGet请求请求头:{},请求地址:{}", header, url + request);
response = httpClient.execute(httpGet); response = httpClient.execute(httpGet);
result = EntityUtils.toString(response.getEntity(), "utf-8"); result = EntityUtils.toString(response.getEntity(), "utf-8");
log.info("【GET请求】, 请求地址===>{}, 响应结果===>{}", url + request, result); log.debug("【GET请求】, 请求地址===>{}, 响应结果===>{}", url + request, result);
} catch (Exception e) { } catch (Exception e) {
log.error("doGet异常", e); log.error("doGet异常", e);
} finally { } finally {

View File

@@ -0,0 +1,18 @@
package com.xiang.common.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
/**
* @Author: xiang
* @Date: 2025-07-25 15:58
*/
public class JsonUtils {
public static String toJsonString(Object obj) {
return JSON.toJSONString(obj, SerializerFeature.WriteMapNullValue);
}
public static <T> T parse(String json, Class<T> clazz) {
return JSON.parseObject(json, clazz);
}
}

View File

@@ -23,7 +23,7 @@ public class DomainDynamicAnalysisTask extends BaseScheduleTaskTemplate {
@Override @Override
protected Integer getModule() { protected Integer getModule() {
return ScheduleEnums.DOMAIN_DYNAMIC_ANALYSIS_TASK.getModeleCode(); return ScheduleEnums.DOMAIN_DYNAMIC_ANALYSIS_TASK.getModuleCode();
} }
@Override @Override

View File

@@ -15,7 +15,7 @@ public class DomainDynamicAnalysisTaskConfig {
private final DomainDynamicAnalysisTask domainDynamicAnalysisTask; private final DomainDynamicAnalysisTask domainDynamicAnalysisTask;
@Scheduled(cron = "0 0/30 * * * ? ") @Scheduled(cron = "0 15,45 * * * ? ")
@GetMapping("/test") @GetMapping("/test")
public void dynamicDomainSchedule() { public void dynamicDomainSchedule() {
domainDynamicAnalysisTask.run(); domainDynamicAnalysisTask.run();

View File

@@ -31,7 +31,7 @@ public class GladosCheckInTask extends BaseScheduleTaskTemplate {
@Override @Override
protected Integer getModule() { protected Integer getModule() {
return ScheduleEnums.GLADOS_CHECK_IN_TASK.getModeleCode(); return ScheduleEnums.GLADOS_CHECK_IN_TASK.getModuleCode();
} }
@Override @Override

View File

@@ -1,32 +0,0 @@
package com.xiang.service.module.jntyzx.miniapp.converts;
import com.xiang.common.pojo.jntyzx.miniapp.resp.JtUserVo;
import com.xiang.service.module.jntyzx.miniapp.entity.pojo.UserTokenInfoDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;
import java.util.List;
import java.util.Objects;
@Mapper(componentModel = "spring")
public interface UserConverter {
UserConverter INSTANCE = Mappers.getMapper(UserConverter.class);
@Mapping(source = "id", target = "userId")
@Mapping(source = "isOrder", target = "isOrder", qualifiedByName = "isOrder")
@Mapping(source = "isRestriction", target = "isRestriction", qualifiedByName = "isRestrict")
JtUserVo convert(UserTokenInfoDO userTokenInfoDO);
List<JtUserVo> convert(List<UserTokenInfoDO> userTokenInfoDOs);
@Named("isOrder")
default Boolean isOrder(Integer value) {
return Objects.nonNull(value) && Objects.equals(value, 1);
}
@Named("isRestrict")
default Boolean isRestrict(Integer value) {
return Objects.nonNull(value) && Objects.equals(value, 0);
}
}

View File

@@ -1,16 +0,0 @@
package com.xiang.service.module.jntyzx.miniapp.converts;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiang.common.pojo.jntyzx.miniapp.resp.VenueInfoQueryResp;
import com.xiang.service.module.jntyzx.miniapp.entity.pojo.VenueInfoDO;
import org.mapstruct.Mapper;
/**
* @Author: xiang
* @Date: 2026-04-09 09:54
*/
@Mapper(componentModel = "spring")
public interface VenueInfoConverter {
Page<VenueInfoQueryResp> toPage(Page<VenueInfoDO> page);
}

View File

@@ -0,0 +1,90 @@
package com.xiang.service.module.jntyzx.miniapp.schedule;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 定时任务配置器
*
* @Author: xiang
* @Date: 2026-05-09 08:56
*/
@Component
@RequiredArgsConstructor
@RestController
public class JntyzxMiniappScheduleConfig {
private final JtTokenRefreshTask jtTokenRefreshTask;
private final JtVenuePullTask jtVenuePullTask;
private final JtVenueSubscribeTask jtVenueSubscribeTask;
private final JtVenueTomorrowPullTask jtVenueTomorrowPullTask;
private final JntyzxUserInfoConfigTask jntyzxUserInfoConfigTask;
private final JtVenueInfoTodayResultTask jtVenueInfoTodayResultTask;
private final JtVenueInfoTomorrowResultTask jtVenueInfoTomorrowResultTask;
/**
* token刷新
*/
@Scheduled(cron = "0 20,50 * * * ?")
@GetMapping("/jtTokenRefreshTask")
public void jtTokenRefreshTask() {
jtTokenRefreshTask.run();
}
/**
* 每分钟场地信息更新
*/
@Scheduled(cron = "0 0/1 10-18 * * ?")
@GetMapping("/jtVenuePullTask")
public void jtVenuePullTask() {
jtVenuePullTask.run();
}
/**
* 拉取第二天场地信息
*/
@Scheduled(cron = "0 30 8 * * ?")
@GetMapping("/jtVenueTomorrowPullTask")
public void jtVenueTomorrowPullTask() {
jtVenueTomorrowPullTask.run();
}
/**
* 配置下单用户场地数据
*/
@Scheduled(cron = "0 40 8 * * ?")
@GetMapping("/jtUserInfoConfig")
public void jtUserInfoConfig() {
jntyzxUserInfoConfigTask.run();
}
/**
* 下单定时任务
*/
@Scheduled(cron = "0 0 9 * * ?")
@GetMapping("/jtVenueSubscribeTask")
public void jtVenueSubscribeTask() {
jtVenueSubscribeTask.run();
}
/**
* 当天场地订阅结果
*/
@Scheduled(cron = "0 0 17 * * ?")
@GetMapping("/jtVenueInfoTodayResultTask")
public void jtVenueInfoTodayResultTask() {
jtVenueInfoTodayResultTask.run();
}
/**
* 第二天场地订阅结果
*/
@Scheduled(cron = "0 10 9 * * ?")
@GetMapping("/jtVenueInfoTomorrowResultTask")
public void jtVenueInfoTomorrowResultTask() {
jtVenueInfoTomorrowResultTask.run();
}
}

View File

@@ -0,0 +1,136 @@
package com.xiang.service.module.jntyzx.miniapp.schedule;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.google.common.collect.Lists;
import com.xiang.common.enums.RedisKeyConstant;
import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService;
import com.xiang.common.utils.DateUtils;
import com.xiang.common.utils.RedisService;
import com.xiang.service.module.jntyzx.miniapp.service.IUserInfoService;
import com.xiang.service.module.jntyzx.miniapp.service.IUserTokenInfoService;
import com.xiang.service.module.jntyzx.miniapp.service.IVenueService;
import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import java.util.Comparator;
import java.util.List;
/**
* 用户场地配置任务 每日8:40运行
*
* @Author: xiang
* @Date: 2026-05-09 09:58
*/
@Component
@Slf4j
public class JntyzxUserInfoConfigTask extends BaseScheduleTaskTemplate {
private final IUserTokenInfoService userTokenInfoService;
private final IVenueService venueService;
private final IUserInfoService userInfoService;
private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
private final RedisService redisService;
public JntyzxUserInfoConfigTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
IScheduleRunLogService scheduleRunLogService,
IUserTokenInfoService userTokenInfoService,
IVenueService venueService,
IUserInfoService userInfoService,
JntyzxDingTalkFactory jntyzxDingTalkFactory,
RedisService redisService) {
super(scheduleOpeningConfigService, scheduleRunLogService);
this.userTokenInfoService = userTokenInfoService;
this.venueService = venueService;
this.userInfoService = userInfoService;
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
this.redisService = redisService;
}
@Override
protected String getTaskName() {
return ScheduleEnums.JNTYZX_USER_INFO_CONFIG.getTaskName();
}
@Override
protected Integer getModule() {
return ScheduleEnums.JNTYZX_USER_INFO_CONFIG.getModuleCode();
}
@Override
protected String getModuleName() {
return ScheduleEnums.JNTYZX_USER_INFO_CONFIG.getModule();
}
@Override
protected TaskResult doExecute(Object validatedParams) throws Exception {
TaskResult taskResult = new TaskResult();
taskResult.setSuccess(false);
List<VenueInfoDO> venueInfoDOS = venueService.queryTomorrowCanBuyVenue();
if (CollectionUtils.isEmpty(venueInfoDOS)) {
taskResult.setSummary("无可用场地");
return taskResult;
}
String time = (String) redisService.get(RedisKeyConstant.JNTYZX_SUBSCRIBE_TIME_KEY);
if (StringUtils.isBlank(time)) {
time = "18:00";
}
String finalTime = time;
venueInfoDOS = VenueInfoUtils.filterVenueList(finalTime, venueInfoDOS);
if (CollectionUtils.isEmpty(venueInfoDOS)) {
taskResult.setSummary("无可用场地");
return taskResult;
}
venueInfoDOS = venueInfoDOS.stream()
.filter(item -> !item.getPlaceName().contains("小馆"))
.sorted(Comparator.comparing(item -> VenueInfoUtils.sortVenueInfo(item.getPlaceName())))
.toList();
List<UserTokenInfoDO> users = userTokenInfoService.getCanOrderUser();
if (CollectionUtils.isEmpty(users)) {
taskResult.setSummary("无可用用户");
return taskResult;
}
List<UserInfoDO> list = Lists.newArrayList();
int i = 0;
userInfoService.delAll();
for (UserTokenInfoDO user : users) {
VenueInfoDO venueInfoDO = venueInfoDOS.get(i);
UserInfoDO userInfoDO = new UserInfoDO();
userInfoDO.setName(user.getName());
userInfoDO.setWeek(DateUtils.getWeekDay(venueInfoDO.getDate()));
userInfoDO.setType("1");
userInfoDO.setPlaceName(venueInfoDO.getPlaceName());
userInfoDO.setSiteTimeName(venueInfoDO.getSjName().split("-")[0]);
userInfoDO.setIsBook(0);
list.add(userInfoDO);
i++;
if (i == venueInfoDOS.size()) {
i = 0;
}
}
if (CollectionUtils.isNotEmpty(list)) {
userInfoService.batchSave(list);
StringBuilder stringBuilder = new StringBuilder();
for (UserInfoDO user : list) {
stringBuilder.append(user.getName()).append("配置预约:").append(user.getPlaceName()).append("\n");
}
jntyzxDingTalkFactory.sendMsg(stringBuilder.toString());
taskResult.setSuccess(Boolean.TRUE);
taskResult.setSummary(stringBuilder.toString());
}
return taskResult;
}
}

View File

@@ -0,0 +1,59 @@
package com.xiang.service.module.jntyzx.miniapp.schedule;
import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService;
import com.xiang.service.module.jntyzx.miniapp.service.IUserTokenInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RestController;
/**
* 用户token刷新定时任务 每半个小时运行一次 在每个小时的20和50分
*
* @Author: xiang
* @Date: 2026-01-15 17:29
*/
@Slf4j
@Component
@RestController
public class JtTokenRefreshTask extends BaseScheduleTaskTemplate {
private final IUserTokenInfoService userTokenInfoService;
public JtTokenRefreshTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
IScheduleRunLogService scheduleRunLogService,
IUserTokenInfoService userTokenInfoService) {
super(scheduleOpeningConfigService, scheduleRunLogService);
this.userTokenInfoService = userTokenInfoService;
}
@Override
protected String getTaskName() {
return ScheduleEnums.JNTYZX_TOKEN_REFRESH_TASK.getTaskName();
}
@Override
protected Integer getModule() {
return ScheduleEnums.JNTYZX_TOKEN_REFRESH_TASK.getModuleCode();
}
@Override
protected String getModuleName() {
return ScheduleEnums.JNTYZX_TOKEN_REFRESH_TASK.getModule();
}
@Override
protected TaskResult doExecute(Object validatedParams) throws Exception {
TaskResult taskResult = new TaskResult();
log.info("【Token】江南体育中心token续期定时任务启动!!!time:{}", System.currentTimeMillis());
userTokenInfoService.flushToken();
taskResult.setSuccess(true);
taskResult.setSummary("江体小程序token刷新成功");
return taskResult;
}
}

View File

@@ -0,0 +1,94 @@
package com.xiang.service.module.jntyzx.miniapp.schedule;
import com.google.common.collect.Maps;
import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService;
import com.xiang.common.utils.DateUtils;
import com.xiang.service.module.jntyzx.miniapp.service.IVenueService;
import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
/**
* 17:00查询当天的场地预定结果
*
* @Author: xiang
* @Date: 2026-05-09 14:17
*/
@Component
@Slf4j
public class JtVenueInfoTodayResultTask extends BaseScheduleTaskTemplate {
private final IVenueService venueService;
private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
public JtVenueInfoTodayResultTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
IScheduleRunLogService scheduleRunLogService,
IVenueService venueService,
JntyzxDingTalkFactory jntyzxDingTalkFactory) {
super(scheduleOpeningConfigService, scheduleRunLogService);
this.venueService = venueService;
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
}
@Override
protected String getTaskName() {
return ScheduleEnums.JNTYZX_VENUE_INFO_TODAY_RESULT_TASK.getTaskName();
}
@Override
protected Integer getModule() {
return ScheduleEnums.JNTYZX_VENUE_INFO_TODAY_RESULT_TASK.getModuleCode();
}
@Override
protected String getModuleName() {
return ScheduleEnums.JNTYZX_VENUE_INFO_TODAY_RESULT_TASK.getModule();
}
@Override
protected TaskResult doExecute(Object validatedParams) throws Exception {
TaskResult taskResult = new TaskResult();
taskResult.setSuccess(false);
List<SitePositionList> sitePositionLists = venueService.queryVenueService();
if (CollectionUtils.isEmpty(sitePositionLists)) {
taskResult.setSummary("场地信息为空");
return taskResult;
}
List<SitePositionList> positionListList6_8 = sitePositionLists.stream().filter(VenueInfoUtils::get628VenueInfo).toList();
sendMsg(positionListList6_8, "18:00-20:00");
List<SitePositionList> positionListList8_10 = sitePositionLists.stream().filter(VenueInfoUtils::get8210VenueInfo).toList();
sendMsg(positionListList8_10, "20:00-22:00");
taskResult.setSuccess(true);
taskResult.setSummary("场地信息查询定时任务成功");
return taskResult;
}
private void sendMsg(List<SitePositionList> positionListList, String time) {
if (CollectionUtils.isNotEmpty(positionListList)) {
Map<String, SitePositionList> map = Maps.newLinkedHashMap();
for (SitePositionList sitePositionList : positionListList) {
if (map.containsKey(sitePositionList.getPlaceName())) {
continue;
}
map.put(sitePositionList.getPlaceName(), sitePositionList);
}
StringBuilder sb = new StringBuilder(DateUtils.getDateFromDate(LocalDate.now()) + "==>"+ time +"场地信息如下:\n");
map.forEach((placeName, sitePositionList) -> {
sb.append(placeName).append("订购人:").append(sitePositionList.getContacts()).append("\n");
});
jntyzxDingTalkFactory.sendMsg(sb.toString());
}
}
}

View File

@@ -0,0 +1,94 @@
package com.xiang.service.module.jntyzx.miniapp.schedule;
import com.google.common.collect.Maps;
import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService;
import com.xiang.common.utils.DateUtils;
import com.xiang.service.module.jntyzx.miniapp.service.IVenueService;
import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
/**
* 9:10分查询第二天的场地预定结果
*
* @Author: xiang
* @Date: 2026-05-09 14:17
*/
@Component
@Slf4j
public class JtVenueInfoTomorrowResultTask extends BaseScheduleTaskTemplate {
private final IVenueService venueService;
private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
public JtVenueInfoTomorrowResultTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
IScheduleRunLogService scheduleRunLogService,
IVenueService venueService,
JntyzxDingTalkFactory jntyzxDingTalkFactory) {
super(scheduleOpeningConfigService, scheduleRunLogService);
this.venueService = venueService;
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
}
@Override
protected String getTaskName() {
return ScheduleEnums.JNTYZX_VENUE_INFO_TOMORROW_RESULT_TASK.getTaskName();
}
@Override
protected Integer getModule() {
return ScheduleEnums.JNTYZX_VENUE_INFO_TOMORROW_RESULT_TASK.getModuleCode();
}
@Override
protected String getModuleName() {
return ScheduleEnums.JNTYZX_VENUE_INFO_TOMORROW_RESULT_TASK.getModule();
}
@Override
protected TaskResult doExecute(Object validatedParams) throws Exception {
TaskResult taskResult = new TaskResult();
taskResult.setSuccess(false);
List<SitePositionList> sitePositionLists = venueService.queryTomorrowVenue();
if (CollectionUtils.isEmpty(sitePositionLists)) {
taskResult.setSummary("场地信息为空");
return taskResult;
}
List<SitePositionList> positionListList6_8 = sitePositionLists.stream().filter(VenueInfoUtils::get628VenueInfo).toList();
sendMsg(positionListList6_8, "18:00-20:00");
List<SitePositionList> positionListList8_10 = sitePositionLists.stream().filter(VenueInfoUtils::get8210VenueInfo).toList();
sendMsg(positionListList8_10, "20:00-22:00");
taskResult.setSuccess(true);
taskResult.setSummary("场地信息查询定时任务成功");
return taskResult;
}
private void sendMsg(List<SitePositionList> positionListList, String time) {
if (CollectionUtils.isNotEmpty(positionListList)) {
Map<String, SitePositionList> map = Maps.newLinkedHashMap();
for (SitePositionList sitePositionList : positionListList) {
if (map.containsKey(sitePositionList.getPlaceName())) {
continue;
}
map.put(sitePositionList.getPlaceName(), sitePositionList);
}
StringBuilder sb = new StringBuilder(DateUtils.getDateFromDate(LocalDate.now().plusDays(1)) + "==>"+ time +"场地信息如下:\n");
map.forEach((placeName, sitePositionList) -> {
sb.append(placeName).append("订购人:").append(sitePositionList.getContacts()).append("\n");
});
jntyzxDingTalkFactory.sendMsg(sb.toString());
}
}
}

View File

@@ -0,0 +1,147 @@
package com.xiang.service.module.jntyzx.miniapp.schedule;
import com.google.common.collect.Maps;
import com.xiang.common.enums.RedisKeyConstant;
import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService;
import com.xiang.common.utils.DateUtils;
import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService;
import com.xiang.service.module.jntyzx.miniapp.service.IUserTokenInfoService;
import com.xiang.service.module.jntyzx.miniapp.service.IVenueService;
import com.xiang.service.module.jntyzx.miniapp.utils.MsgSendUtils;
import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils;
import com.xiang.service.module.jntyzx.miniapp.utils.WeekendUtils;
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.RestController;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 每日9:00-19:00场地更新信息查询
*/
@Component
@Slf4j
@RestController
public class JtVenuePullTask extends BaseScheduleTaskTemplate {
private final IUserTokenInfoService userTokenInfoService;
private final IJntyzxHttpService jntyzxHttpService;
private final IVenueService venueService;
private final MsgSendUtils msgSendUtils;
public JtVenuePullTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
IScheduleRunLogService scheduleRunLogService,
IUserTokenInfoService userTokenInfoService,
IJntyzxHttpService jntyzxHttpService,
IVenueService venueService,
MsgSendUtils msgSendUtils) {
super(scheduleOpeningConfigService, scheduleRunLogService);
this.userTokenInfoService = userTokenInfoService;
this.jntyzxHttpService = jntyzxHttpService;
this.venueService = venueService;
this.msgSendUtils = msgSendUtils;
}
private List<SitePositionList> handleMsgSendList(List<SitePositionList> sitePositionLists, Integer type) {
if (type == 1) {
sitePositionLists = sitePositionLists.stream()
.filter(item -> !item.getPlaceName().contains("小馆"))
.filter(VenueInfoUtils::get628VenueInfo)
.filter(item -> StringUtils.equals(item.getContacts(), "0"))
.toList();
} else {
sitePositionLists = sitePositionLists.stream()
.filter(item -> !item.getPlaceName().contains("小馆"))
.filter(VenueInfoUtils::get8210VenueInfo)
.filter(item -> StringUtils.equals(item.getContacts(), "0"))
.toList();
}
Map<String, SitePositionList> mapByName = Maps.newLinkedHashMap();
for (SitePositionList sitePositionList : sitePositionLists) {
if (!mapByName.containsKey(sitePositionList.getPlaceName())) {
mapByName.put(sitePositionList.getPlaceName(), sitePositionList);
}
}
return mapByName.values().stream().toList();
}
@Override
protected String getTaskName() {
return ScheduleEnums.JNTYZX_VENUE_INFO_PULL_TASK.getTaskName();
}
@Override
protected Integer getModule() {
return ScheduleEnums.JNTYZX_VENUE_INFO_PULL_TASK.getModuleCode();
}
@Override
protected String getModuleName() {
return ScheduleEnums.JNTYZX_VENUE_INFO_PULL_TASK.getModule();
}
@Override
protected TaskResult doExecute(Object validatedParams) throws Exception {
TaskResult taskResult = new TaskResult();
taskResult.setSuccess(false);
log.info("【Venue】江体小程序场地数据拉取定时任务启动!!!time:{}", System.currentTimeMillis());
List<UserTokenInfoDO> availableUser = userTokenInfoService.getAvailableUser();
if (CollectionUtils.isEmpty(availableUser)) {
log.info("当前无可用用户查询场地信息!");
taskResult.setSuccess(true);
taskResult.setSummary("当前无可用用户查询场地信息!");
return taskResult;
}
String token;
LocalDateTime now = LocalDateTime.now();
for (UserTokenInfoDO userTokenInfoDO : availableUser) {
if (Objects.isNull(userTokenInfoDO)) {
continue;
}
token = userTokenInfoDO.getToken();
if (StringUtils.isBlank(token)) {
continue;
}
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailable(WeekendUtils.isWeekend(), token);
if (CollectionUtils.isEmpty(sitePositionLists)) {
continue;
}
venueService.saveOrUpdateTodayVenueInfo(sitePositionLists);
StringBuffer msg = new StringBuffer();
List<SitePositionList> sitePositionLists6_8 = handleMsgSendList(sitePositionLists, 1);
if (CollectionUtils.isNotEmpty(sitePositionLists6_8)) {
msg.append("查询到18:00-20:00空闲场地信息=====>\n时间:").append(DateUtils.getDateFromDate(LocalDate.now())).append("\n");
sitePositionLists6_8.forEach(item -> msg.append(item.getPlaceName()).append("\n"));
}
List<SitePositionList> sitePositionLists8_10 = handleMsgSendList(sitePositionLists, 2);
if (CollectionUtils.isNotEmpty(sitePositionLists8_10)) {
msg.append("查询到20:00-22:00空闲场地信息=====>\n时间:").append(DateUtils.getDateFromDate(LocalDate.now())).append("\n");
sitePositionLists8_10.forEach(item -> msg.append(item.getPlaceName()).append("\n"));
}
if (StringUtils.isNotBlank(msg)) {
String key = RedisKeyConstant.JNTYZX_VENUE_MSG_SEND_KEY + RedisKeyConstant.getDate();
msgSendUtils.sendMsgRestrict1Hours(key, msg.toString());
}
taskResult.setSuccess(true);
taskResult.setSummary("查询场地信息成功!时间:" + now);
return taskResult;
}
return taskResult;
}
}

View File

@@ -0,0 +1,161 @@
package com.xiang.service.module.jntyzx.miniapp.schedule;
import com.xiang.common.enums.RedisKeyConstant;
import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService;
import com.xiang.common.utils.RedisService;
import com.xiang.service.module.jntyzx.miniapp.service.IJtOrderService;
import com.xiang.service.module.jntyzx.miniapp.service.IUserInfoService;
import com.xiang.service.module.jntyzx.miniapp.service.IUserTokenInfoService;
import com.xiang.service.module.jntyzx.miniapp.service.IVenueService;
import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils;
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.RestController;
import java.time.Duration;
import java.time.LocalTime;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 场地订阅定时任务 每日9:00:00
*/
@Slf4j
@Component
@RestController
public class JtVenueSubscribeTask extends BaseScheduleTaskTemplate {
private final IUserTokenInfoService userTokenInfoService;
private final IJtOrderService jtOrderService;
private final IVenueService venueService;
private final JntyzxDingTalkFactory jtDingTalkFactory;
private final RedisService redisService;
private final IUserInfoService userInfoService;
public JtVenueSubscribeTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
IScheduleRunLogService scheduleRunLogService,
IUserTokenInfoService userTokenInfoService,
IJtOrderService jtOrderService,
IVenueService venueService,
JntyzxDingTalkFactory jtDingTalkFactory,
RedisService redisService,
IUserInfoService userInfoService) {
super(scheduleOpeningConfigService, scheduleRunLogService);
this.userTokenInfoService = userTokenInfoService;
this.jtOrderService = jtOrderService;
this.venueService = venueService;
this.jtDingTalkFactory = jtDingTalkFactory;
this.redisService = redisService;
this.userInfoService = userInfoService;
}
@Override
protected String getTaskName() {
return ScheduleEnums.JNTYZX_ORDER_SUBSCRIBE_TASK.getTaskName();
}
@Override
protected Integer getModule() {
return ScheduleEnums.JNTYZX_ORDER_SUBSCRIBE_TASK.getModuleCode();
}
@Override
protected String getModuleName() {
return ScheduleEnums.JNTYZX_ORDER_SUBSCRIBE_TASK.getModule();
}
@Override
protected TaskResult doExecute(Object validatedParams) throws Exception {
TaskResult taskResult = new TaskResult();
taskResult.setSuccess(false);
log.info("【Subscribe】 江体场地预定定时任务启动!!! time:{}", System.currentTimeMillis());
List<UserTokenInfoDO> users = userTokenInfoService.getCanOrderUser();
if (CollectionUtils.isEmpty(users)) {
log.info("暂无可下单用户, time:{}", System.currentTimeMillis());
jtDingTalkFactory.sendMsg("暂无可下单用户, time:" + System.currentTimeMillis());
taskResult.setSummary("无可下单用户");
return taskResult;
}
Map<String, UserTokenInfoDO> userMap = users.stream().collect(Collectors.toMap(UserTokenInfoDO::getName, Function.identity(), (a, b) -> a));
List<VenueInfoDO> venueInfoDOS = venueService.queryTomorrowCanBuyVenue();
Map<String, List<VenueInfoDO>> venueInfoMap = venueInfoDOS.stream()
.collect(Collectors.groupingByConcurrent(VenueInfoDO::getPlaceName));
List<UserInfoDO> userInfoDOS = userInfoService.selectAll();
if (CollectionUtils.isEmpty(userInfoDOS)) {
log.info("暂无可下单用户, time:{}", System.currentTimeMillis());
jtDingTalkFactory.sendMsg("暂无可下单用户配置信息, time:" + System.currentTimeMillis());
taskResult.setSummary("无可下单用户配置信息");
return taskResult;
}
for (UserInfoDO userInfoDO : userInfoDOS) {
if (venueInfoMap.containsKey(userInfoDO.getPlaceName()) && userMap.containsKey(userInfoDO.getName())) {
UserTokenInfoDO userTokenInfoDO = userMap.get(userInfoDO.getName());
List<VenueInfoDO> venueInfoDOList = venueInfoMap.get(userInfoDO.getPlaceName());
if (CollectionUtils.isEmpty(venueInfoDOList)) {
logger.info("用户:{}查询不到场地信息:{}", userInfoDO.getName(), userInfoDO.getPlaceName());
continue;
}
venueInfoDOList = VenueInfoUtils.filterVenueList(userInfoDO.getSiteTimeName(), venueInfoDOList);
if (CollectionUtils.isEmpty(venueInfoDOList)) {
logger.info("用户:{}无场地信息:{},时间:{}", userInfoDO.getName(), userInfoDO.getPlaceName(), userInfoDO.getSiteTimeName());
continue;
}
String placeName = userInfoDO.getPlaceName();
ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
//计算9点到现在的时间差
//获取江体当前时间
LocalTime currentTime = LocalTime.now();
LocalTime targetTime = LocalTime.parse("09:00:10");
Duration duration = Duration.between(currentTime, targetTime);
long milliseconds = duration.toMillis();
if (milliseconds <= 0) {
milliseconds = 0;
}
List<VenueInfoDO> finalVenueInfoDOList = venueInfoDOList;
executorService.schedule(() -> {
for (int i = 0; i < 3; i++) {
String valid = (String) redisService.get(RedisKeyConstant.getVenueSubscribeKey(placeName));
if (StringUtils.isNotBlank(valid)) {
break;
}
boolean order = jtOrderService.createOrder(finalVenueInfoDOList, userTokenInfoDO);
if (order) {
break;
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
log.error("睡眠失败~~~");
}
}
}, milliseconds, TimeUnit.MILLISECONDS);
}
}
taskResult.setSuccess(true);
taskResult.setSummary("下单执行成功!");
return taskResult;
}
}

View File

@@ -0,0 +1,134 @@
package com.xiang.service.module.jntyzx.miniapp.schedule;
import com.google.common.collect.Maps;
import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.resp.JntyzxResponse;
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService;
import com.xiang.common.utils.DateUtils;
import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService;
import com.xiang.service.module.jntyzx.miniapp.service.IUserTokenInfoService;
import com.xiang.service.module.jntyzx.miniapp.service.IVenueService;
import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils;
import com.xiang.service.module.jntyzx.miniapp.utils.WeekendUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 场地信息获取定时任务 每日8:30拉取第二天的场地信息
*/
@Slf4j
@Component
public class JtVenueTomorrowPullTask extends BaseScheduleTaskTemplate {
private final IUserTokenInfoService userTokenInfoService;
private final IJntyzxHttpService jntyzxHttpService;
private final JntyzxDingTalkFactory jtDingTalkFactory;
private final IVenueService venueService;
public JtVenueTomorrowPullTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
IScheduleRunLogService scheduleRunLogService,
IUserTokenInfoService userTokenInfoService,
IJntyzxHttpService jntyzxHttpService,
JntyzxDingTalkFactory jtDingTalkFactory,
IVenueService venueService) {
super(scheduleOpeningConfigService, scheduleRunLogService);
this.userTokenInfoService = userTokenInfoService;
this.jntyzxHttpService = jntyzxHttpService;
this.jtDingTalkFactory = jtDingTalkFactory;
this.venueService = venueService;
}
@Override
protected String getTaskName() {
return ScheduleEnums.JNTYZX_VENUE_TOMORROW_PULL_TASK.getTaskName();
}
@Override
protected Integer getModule() {
return ScheduleEnums.JNTYZX_VENUE_TOMORROW_PULL_TASK.getModuleCode();
}
@Override
protected String getModuleName() {
return ScheduleEnums.JNTYZX_VENUE_TOMORROW_PULL_TASK.getModule();
}
@Override
protected TaskResult doExecute(Object validatedParams) throws Exception {
TaskResult taskResult = new TaskResult();
taskResult.setSuccess(Boolean.FALSE);
log.info("【Venue】江体小程序场地拉取定时任务启动!!!time:{}", System.currentTimeMillis());
List<UserTokenInfoDO> availableUser = userTokenInfoService.getAvailableUser();
if (CollectionUtils.isEmpty(availableUser)) {
log.info("当前无可用用户查询场地信息!");
taskResult.setSummary("当前无可用用户查询场地信息");
return taskResult;
}
// 用户信息
StringBuffer userMsg = new StringBuffer();
availableUser.forEach(item -> {
JntyzxResponse jntyzxResponse = jntyzxHttpService.checkDefaultNums(item.getToken(), item.getMemberCardNo());
if (Objects.nonNull(jntyzxResponse)) {
if (jntyzxResponse.getSuccess()) {
userMsg.append("订购人:").append(item.getName()).append("正常下单\n");
} else {
userMsg.append("订购人:").append(item.getName()).append(jntyzxResponse.getMessage()).append("\n");
}
}
});
jtDingTalkFactory.sendMsg(userMsg.toString());
// 场地信息
UserTokenInfoDO userTokenInfoDO = availableUser.get(0);
String token = userTokenInfoDO.getToken();
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailableTomorrow(WeekendUtils.isWeekend(), token);
if (CollectionUtils.isEmpty(sitePositionLists)) {
taskResult.setSummary("当前无可用场地信息");
return taskResult;
}
venueService.saveTomorrowVenueInfo(sitePositionLists);
List<SitePositionList> sitePositionLists6_8 = sitePositionLists.stream().filter(VenueInfoUtils::get628VenueInfo).toList();
if (CollectionUtils.isEmpty(sitePositionLists6_8)) {
taskResult.setSummary("当前无可用场地信息");
return taskResult;
}
buildMsg(sitePositionLists6_8, "18:00-20:00");
List<SitePositionList> sitePositionLists8_10 = sitePositionLists.stream().filter(VenueInfoUtils::get8210VenueInfo).toList();
if (CollectionUtils.isEmpty(sitePositionLists8_10)) {
taskResult.setSummary("当前无可用场地信息");
return taskResult;
}
buildMsg(sitePositionLists8_10, "20:00-22:00");
taskResult.setSuccess(Boolean.TRUE);
taskResult.setSummary("场地信息获取成功!");
return taskResult;
}
private void buildMsg(List<SitePositionList> sitePositionLists, String time) {
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().plusDays(1)) + " " + time + "\n");
map.forEach((placeName, sitePositionList) -> {
msg.append(placeName).append("订购人:").append(sitePositionList.getContacts()).append("\n");
});
jtDingTalkFactory.sendMsg(msg.toString());
}
}

View File

@@ -0,0 +1,18 @@
package com.xiang.service.module.jntyzx.miniapp.service;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserInfoDO;
import java.util.List;
/**
* @Author: xiang
* @Date: 2026-05-09 10:00
*/
public interface IUserInfoService {
boolean delAll();
boolean batchSave(List<UserInfoDO> list);
List<UserInfoDO> selectAll();
}

View File

@@ -2,9 +2,6 @@ package com.xiang.service.module.jntyzx.miniapp.service;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.req.UserAddReq;
import com.xiang.common.pojo.jntyzx.miniapp.req.UserQueryReq;
import com.xiang.common.pojo.jntyzx.miniapp.resp.JtUserVo;
import java.util.List; import java.util.List;
@@ -20,14 +17,4 @@ public interface IUserTokenInfoService {
boolean flushSingleToken(String name); boolean flushSingleToken(String name);
boolean flushToken(); boolean flushToken();
boolean updateTokenByName(String name, String token); boolean updateTokenByName(String name, String token);
List<JtUserVo> list(UserQueryReq req);
Boolean updateStatusByUserName(String username, Integer status);
Boolean refreshToken(String username);
Boolean save(UserAddReq req);
JtUserVo info(Long userId);
} }

View File

@@ -1,10 +1,7 @@
package com.xiang.service.module.jntyzx.miniapp.service; package com.xiang.service.module.jntyzx.miniapp.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.req.VenueInfoQueryRequest;
import com.xiang.common.pojo.jntyzx.miniapp.resp.VenueInfoQueryResp;
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList; import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
import java.util.List; import java.util.List;
@@ -34,11 +31,4 @@ public interface IVenueService {
* @return * @return
*/ */
boolean saveTomorrowVenueInfo(List<SitePositionList> sitePositionLists); boolean saveTomorrowVenueInfo(List<SitePositionList> sitePositionLists);
/**
* 查询场地列表信息
* @param request
* @return
*/
Page<VenueInfoQueryResp> list(VenueInfoQueryRequest request);
} }

View File

@@ -13,9 +13,11 @@ import com.xiang.common.pojo.jntyzx.miniapp.resp.OrderCreateResp;
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList; import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.UserInfoResponse; import com.xiang.common.pojo.jntyzx.miniapp.resp.query.UserInfoResponse;
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.VenueList; import com.xiang.common.pojo.jntyzx.miniapp.resp.query.VenueList;
import com.xiang.common.utils.HttpService;
import com.xiang.common.utils.JsonUtils;
import com.xiang.common.utils.RedisService; import com.xiang.common.utils.RedisService;
import com.xiang.service.module.jntyzx.miniapp.constants.UrlConstant; import com.xiang.common.enums.JntyzxUrlConstant;
import com.xiang.service.module.jntyzx.miniapp.manage.IOrderCreateInfoManage; import com.xiang.common.manage.jntyzx.miniapp.IOrderCreateInfoManage;
import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService; import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService;
import com.xiang.service.module.jntyzx.miniapp.utils.JntyzxSaltEncodeUtils; import com.xiang.service.module.jntyzx.miniapp.utils.JntyzxSaltEncodeUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -43,7 +45,7 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
@Override @Override
public List<SitePositionList> queryAvailable(String isWeekend, String token) { public List<SitePositionList> queryAvailable(String isWeekend, String token) {
String url = UrlConstant.QUERY_TODAY_SUBSCRIBE_URL; String url = JntyzxUrlConstant.QUERY_TODAY_SUBSCRIBE_URL;
return querySitePositionInfo(isWeekend, token, url); return querySitePositionInfo(isWeekend, token, url);
} }
@@ -56,7 +58,7 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
params.put("gid", "03"); params.put("gid", "03");
params.put("isWeekend", isWeekend); params.put("isWeekend", isWeekend);
try { try {
resp = HttpHelper.doGet(url, header, params); resp = HttpService.doGet(url, header, params);
} catch (Exception e) { } catch (Exception e) {
log.error("[doGet] 江南体育中心查询当天场地 请求失败, url:{}", url); log.error("[doGet] 江南体育中心查询当天场地 请求失败, url:{}", url);
return Lists.newArrayList(); return Lists.newArrayList();
@@ -98,7 +100,7 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
@Override @Override
public List<SitePositionList> queryAvailableTomorrow(String isWeekend, String token) { public List<SitePositionList> queryAvailableTomorrow(String isWeekend, String token) {
String url = UrlConstant.QUERY_TOMORROW_SUBSCRIBE_URL; String url = JntyzxUrlConstant.QUERY_TOMORROW_SUBSCRIBE_URL;
return querySitePositionInfo(isWeekend, token, url); return querySitePositionInfo(isWeekend, token, url);
} }
@@ -143,7 +145,7 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
Map<String, String> params = Maps.newHashMap(); Map<String, String> params = Maps.newHashMap();
params.put("X-Access-Token", token); params.put("X-Access-Token", token);
String resp = HttpHelper.doPost(UrlConstant.ADD_SUBSCRIBE, params, JsonUtils.toJsonString(subscribeRequest)); String resp = HttpService.doPost(JntyzxUrlConstant.ADD_SUBSCRIBE, params, JsonUtils.toJsonString(subscribeRequest));
log.info("[江体小程序] 羽毛球场地下单响应结果:{}", resp); log.info("[江体小程序] 羽毛球场地下单响应结果:{}", resp);
if (StringUtils.isBlank(resp)) { if (StringUtils.isBlank(resp)) {
log.info("[resp] 请求结果为空"); log.info("[resp] 请求结果为空");
@@ -164,7 +166,7 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
Map<String, String> params = Maps.newHashMap(); Map<String, String> params = Maps.newHashMap();
params.put("openId", openId); params.put("openId", openId);
String respStr = HttpHelper.doGet(UrlConstant.HEALTH_DECLARATION, headers, params); String respStr = HttpService.doGet(JntyzxUrlConstant.HEALTH_DECLARATION, headers, params);
if (StringUtils.isBlank(respStr)) { if (StringUtils.isBlank(respStr)) {
return null; return null;
} }
@@ -178,7 +180,7 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
Map<String, String> headers = Maps.newHashMap(); Map<String, String> headers = Maps.newHashMap();
headers.put("X-Access-Token", token); headers.put("X-Access-Token", token);
String resp = HttpHelper.doGet(UrlConstant.QUERY_BY_OPEN_ID, headers, params); String resp = HttpService.doGet(JntyzxUrlConstant.QUERY_BY_OPEN_ID, headers, params);
JntyzxResponse<UserInfoResponse> response = JSON.parseObject(resp, new TypeReference<JntyzxResponse<UserInfoResponse>>() { JntyzxResponse<UserInfoResponse> response = JSON.parseObject(resp, new TypeReference<JntyzxResponse<UserInfoResponse>>() {
}); });
if (Objects.isNull(response)) { if (Objects.isNull(response)) {
@@ -195,7 +197,7 @@ public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
Map<String, String> headers = Maps.newHashMap(); Map<String, String> headers = Maps.newHashMap();
headers.put("X-Access-Token", token); headers.put("X-Access-Token", token);
String resp = HttpHelper.doGet(UrlConstant.CHECK_NUM, headers, params); String resp = HttpService.doGet(JntyzxUrlConstant.CHECK_NUM, headers, params);
if (StringUtils.isBlank(resp)) { if (StringUtils.isBlank(resp)) {
return null; return null;
} }

View File

@@ -2,14 +2,15 @@ package com.xiang.service.module.jntyzx.miniapp.service.impl;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.xiang.common.exception.BusinessException; import com.xiang.common.exception.BusinessException;
import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.resp.JntyzxResponse; import com.xiang.common.pojo.jntyzx.miniapp.resp.JntyzxResponse;
import com.xiang.common.pojo.jntyzx.miniapp.resp.OrderCreateResp; import com.xiang.common.pojo.jntyzx.miniapp.resp.OrderCreateResp;
import com.xiang.common.utils.RedisService; import com.xiang.common.utils.RedisService;
import com.xiang.service.module.jntyzx.miniapp.constants.RedisKeyConstant; import com.xiang.common.enums.RedisKeyConstant;
import com.xiang.service.module.jntyzx.miniapp.manage.IOrderCreateInfoManage; import com.xiang.common.manage.jntyzx.miniapp.IOrderCreateInfoManage;
import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService; import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService;
import com.xiang.service.module.jntyzx.miniapp.service.IJtOrderService; import com.xiang.service.module.jntyzx.miniapp.service.IJtOrderService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -34,7 +35,7 @@ public class OrderInfoServiceImpl implements IJtOrderService {
private final IOrderCreateInfoManage orderCreateInfoManage; private final IOrderCreateInfoManage orderCreateInfoManage;
private final IJntyzxHttpService jntyzxHttpService; private final IJntyzxHttpService jntyzxHttpService;
private final RedisService redisService; private final RedisService redisService;
private final JntyzxHttpServiceImpl dingTalkFactory; private final JntyzxDingTalkFactory dingTalkFactory;
@Override @Override
public List<OrderInfoDO> queryNoPayOrder() { public List<OrderInfoDO> queryNoPayOrder() {
return orderCreateInfoManage.queryNoPayOrder(); return orderCreateInfoManage.queryNoPayOrder();
@@ -75,10 +76,10 @@ public class OrderInfoServiceImpl implements IJtOrderService {
orderCreateInfoManage.save(orderInfoDO); orderCreateInfoManage.save(orderInfoDO);
} }
} }
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp)); dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "小程序预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
return true; return true;
} else { } else {
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp)); dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "小程序预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
if (orderResp.getMessage().contains("锁卡")) { if (orderResp.getMessage().contains("锁卡")) {
log.info("有锁卡风险,不在请求,用户:{}", userTokenInfoDO.getName()); log.info("有锁卡风险,不在请求,用户:{}", userTokenInfoDO.getName());
throw new BusinessException("即将锁卡,不再请求"); throw new BusinessException("即将锁卡,不再请求");
@@ -92,6 +93,10 @@ public class OrderInfoServiceImpl implements IJtOrderService {
log.info("该场地已被人预定,更换场地, 用户:{}", userTokenInfoDO.getName()); log.info("该场地已被人预定,更换场地, 用户:{}", userTokenInfoDO.getName());
redisService.set(RedisKeyConstant.getVenueSubscribeKey(venueInfoDOS.get(0).getPlaceName()), "true"); redisService.set(RedisKeyConstant.getVenueSubscribeKey(venueInfoDOS.get(0).getPlaceName()), "true");
} }
if (orderResp.getMessage().contains("预约场地不能超过2个")) {
log.info("用户:{}已经预约场地", userTokenInfoDO.getName());
throw new BusinessException("用户已经预约场地");
}
return false; return false;
} }
} }

View File

@@ -0,0 +1,37 @@
package com.xiang.service.module.jntyzx.miniapp.service.impl;
import com.xiang.common.manage.jntyzx.miniapp.IUserInfoManage;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserInfoDO;
import com.xiang.service.module.jntyzx.miniapp.service.IUserInfoService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author: xiang
* @Date: 2026-05-09 10:18
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class UserInfoServiceImpl implements IUserInfoService {
private final IUserInfoManage userInfoManage;
@Override
public boolean delAll() {
return userInfoManage.delAll();
}
@Override
public boolean batchSave(List<UserInfoDO> list) {
return userInfoManage.saveBatch(list);
}
@Override
public List<UserInfoDO> selectAll() {
return userInfoManage.list();
}
}

View File

@@ -1,20 +1,15 @@
package com.xiang.service.module.jntyzx.miniapp.service.impl; package com.xiang.service.module.jntyzx.miniapp.service.impl;
import com.google.common.collect.Lists; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import com.xiang.common.exception.BusinessException; import com.xiang.common.exception.BusinessException;
import com.xiang.common.factory.JntyzxDingTalkFactory; import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.manage.jntyzx.miniapp.IUserRestrictionManage;
import com.xiang.common.manage.jntyzx.miniapp.IUserTokenInfoManage;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo; import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.req.UserAddReq;
import com.xiang.common.pojo.jntyzx.miniapp.req.UserQueryReq;
import com.xiang.common.pojo.jntyzx.miniapp.resp.JntyzxResponse; import com.xiang.common.pojo.jntyzx.miniapp.resp.JntyzxResponse;
import com.xiang.common.pojo.jntyzx.miniapp.resp.JtUserVo;
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.UserInfoResponse; import com.xiang.common.pojo.jntyzx.miniapp.resp.query.UserInfoResponse;
import com.xiang.common.utils.DateUtils; import com.xiang.common.utils.DateUtils;
import com.xiang.service.module.jntyzx.miniapp.converts.UserConverter;
import com.xiang.service.module.jntyzx.miniapp.manage.IUserRestrictionManage;
import com.xiang.service.module.jntyzx.miniapp.manage.IUserTokenInfoManage;
import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService; import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService;
import com.xiang.service.module.jntyzx.miniapp.service.IUserTokenInfoService; import com.xiang.service.module.jntyzx.miniapp.service.IUserTokenInfoService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -23,12 +18,8 @@ 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;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* @Author: xiang * @Author: xiang
@@ -43,7 +34,6 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
private final IJntyzxHttpService jntyzxHttpService; private final IJntyzxHttpService jntyzxHttpService;
private final JntyzxDingTalkFactory jtDingTalkFactory; private final JntyzxDingTalkFactory jtDingTalkFactory;
private final IUserRestrictionManage userRestrictionManage; private final IUserRestrictionManage userRestrictionManage;
private final UserConverter userConverter;
@Override @Override
@@ -103,6 +93,10 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
} }
private boolean healthDeclaration(UserTokenInfoDO userTokenInfoDO) { private boolean healthDeclaration(UserTokenInfoDO userTokenInfoDO) {
if (StringUtils.isBlank(userTokenInfoDO.getToken()) || StringUtils.isBlank(userTokenInfoDO.getOpenId())) {
log.info("用户信息异常:{}", JSONObject.toJSONString(userTokenInfoDO));
return false;
}
JntyzxResponse jntyzxResponse = jntyzxHttpService.healthDeclaration(userTokenInfoDO.getToken(), userTokenInfoDO.getOpenId()); JntyzxResponse jntyzxResponse = jntyzxHttpService.healthDeclaration(userTokenInfoDO.getToken(), userTokenInfoDO.getOpenId());
if (Objects.isNull(jntyzxResponse)) { if (Objects.isNull(jntyzxResponse)) {
log.info("用户名:{}心跳监测失败!", userTokenInfoDO.getName()); log.info("用户名:{}心跳监测失败!", userTokenInfoDO.getName());
@@ -120,97 +114,6 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
return flag; return flag;
} }
@Override
public List<JtUserVo> list(UserQueryReq req) {
List<UserTokenInfoDO> userTokenInfoDOS = userTokenInfoManage.queryByList(req);
if (CollectionUtils.isEmpty(userTokenInfoDOS)) {
return Lists.newArrayList();
}
List<Long> idList = userTokenInfoDOS.stream().map(UserTokenInfoDO::getId).toList();
List<UserRestrictionInfo> userRestrictionInfos = userRestrictionManage.queryByIdList(idList);
Map<Long, UserRestrictionInfo> userRestrictionInfoMap = Maps.newHashMap();
if (CollectionUtils.isNotEmpty(userRestrictionInfos)) {
userRestrictionInfoMap.putAll(
userRestrictionInfos.stream().collect(Collectors.toMap(
UserRestrictionInfo::getUserId, Function.identity(), (a, b) -> a)));
}
List<JtUserVo> jtUserVoList = userConverter.convert(userTokenInfoDOS);
jtUserVoList.forEach(item -> {
if (userRestrictionInfoMap.containsKey(item.getUserId())) {
UserRestrictionInfo userRestrictionInfo = userRestrictionInfoMap.get(item.getUserId());
if (Objects.nonNull(userRestrictionInfo)) {
if (userRestrictionInfo.getRestrictionDeadline().isAfter(LocalDateTime.now())) {
item.setRestrictionDeadline(userRestrictionInfo.getRestrictionDeadline());
item.setRestrictionDesc(userRestrictionInfo.getRestrictionDesc());
}
}
}
});
return jtUserVoList;
}
@Override
public Boolean updateStatusByUserName(String username, Integer status) {
if (StringUtils.isEmpty(username)) {
log.error("用户名为空");
return false;
}
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(username);
if (Objects.isNull(userTokenInfoDO)) {
throw new BusinessException("用户不存在!");
}
userTokenInfoDO.setStatus(status);
return userTokenInfoManage.updateById(userTokenInfoDO);
}
@Override
public Boolean refreshToken(String username) {
if (StringUtils.isEmpty(username)) {
log.error("用户名为空");
return false;
}
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(username);
if (Objects.isNull(userTokenInfoDO)) {
throw new BusinessException("用户不存在!");
}
return healthDeclaration(userTokenInfoDO);
}
@Override
public Boolean save(UserAddReq req) {
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(req.getName());
if (Objects.nonNull(userTokenInfoDO)) {
throw new BusinessException("用户名已存在!");
}
userTokenInfoDO = new UserTokenInfoDO();
userTokenInfoDO.setName(req.getName());
userTokenInfoDO.setToken(req.getToken());
userTokenInfoDO.setOpenId(req.getOpenId());
userTokenInfoDO.setStatus(req.getStatus());
userTokenInfoDO.setIsOrder(1);
userTokenInfoDO.setMemberCardNo(req.getMemberCardNo());
userTokenInfoDO.setIsRestriction(0);
userTokenInfoDO.setUpdateTime(LocalDateTime.now());
return userTokenInfoManage.save(userTokenInfoDO);
}
@Override
public JtUserVo info(Long userId) {
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getById(userId);
if (Objects.isNull(userTokenInfoDO)) {
throw new BusinessException("用户不存在!");
}
JtUserVo jtUserVo = userConverter.convert(userTokenInfoDO);
UserRestrictionInfo userRestrictionInfo = userRestrictionManage.queryByUserId(userId);
if (Objects.nonNull(userRestrictionInfo)) {
if (userRestrictionInfo.getRestrictionDeadline().isAfter(LocalDateTime.now())) {
jtUserVo.setRestrictionDeadline(userRestrictionInfo.getRestrictionDeadline());
jtUserVo.setRestrictionDesc(userRestrictionInfo.getRestrictionDesc());
}
}
return jtUserVo;
}
/** /**
* 查询用户信息 * 查询用户信息
* *
@@ -219,6 +122,10 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
* @return * @return
*/ */
private void queryMemberCardInfo(UserTokenInfoDO userTokenInfoDO) { private void queryMemberCardInfo(UserTokenInfoDO userTokenInfoDO) {
if (StringUtils.isBlank(userTokenInfoDO.getToken()) || StringUtils.isBlank(userTokenInfoDO.getOpenId())) {
log.info("用户信息异常:{}", JSONObject.toJSONString(userTokenInfoDO));
return;
}
JntyzxResponse<UserInfoResponse> response = jntyzxHttpService.queryByOpenId(userTokenInfoDO.getToken(), userTokenInfoDO.getOpenId()); JntyzxResponse<UserInfoResponse> response = jntyzxHttpService.queryByOpenId(userTokenInfoDO.getToken(), userTokenInfoDO.getOpenId());
if (Objects.isNull(response)) { if (Objects.isNull(response)) {
return; return;

View File

@@ -1,19 +1,16 @@
package com.xiang.service.module.jntyzx.miniapp.service.impl; package com.xiang.service.module.jntyzx.miniapp.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO; import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.req.VenueInfoQueryRequest;
import com.xiang.common.pojo.jntyzx.miniapp.resp.VenueInfoQueryResp;
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList; import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
import com.xiang.common.utils.DateUtils; import com.xiang.common.utils.DateUtils;
import com.xiang.service.module.jntyzx.miniapp.converts.VenueInfoConverter; import com.xiang.common.manage.jntyzx.miniapp.IVenueInfoManage;
import com.xiang.service.module.jntyzx.miniapp.manage.IVenueInfoManage;
import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService; import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService;
import com.xiang.service.module.jntyzx.miniapp.service.IUserTokenInfoService; import com.xiang.service.module.jntyzx.miniapp.service.IUserTokenInfoService;
import com.xiang.service.module.jntyzx.miniapp.service.IVenueService; import com.xiang.service.module.jntyzx.miniapp.service.IVenueService;
import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils; import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils;
import com.xiang.service.module.jntyzx.miniapp.utils.WeekendUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -38,15 +35,14 @@ public class VenueServiceImpl implements IVenueService {
private final IJntyzxHttpService jntyzxHttpService; private final IJntyzxHttpService jntyzxHttpService;
private final IVenueInfoManage venueInfoManage; private final IVenueInfoManage venueInfoManage;
private final IUserTokenInfoService userTokenInfoService; private final IUserTokenInfoService userTokenInfoService;
private final VenueInfoConverter venueInfoConverter;
@Override @Override
public List<SitePositionList> queryVenueService() { public List<SitePositionList> queryVenueService() {
String token = userTokenInfoService.getToken("Xiang"); String token = userTokenInfoService.getToken("xiang");
if (StringUtils.isBlank(token)) { if (StringUtils.isBlank(token)) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailable("1", token); List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailable(WeekendUtils.isWeekend(), token);
if (CollectionUtils.isEmpty(sitePositionLists)) { if (CollectionUtils.isEmpty(sitePositionLists)) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
@@ -56,11 +52,11 @@ public class VenueServiceImpl implements IVenueService {
@Override @Override
public List<SitePositionList> queryTomorrowVenue() { public List<SitePositionList> queryTomorrowVenue() {
String token = userTokenInfoService.getToken("Xiang"); String token = userTokenInfoService.getToken("xiang");
if (StringUtils.isBlank(token)) { if (StringUtils.isBlank(token)) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailableTomorrow("1", token); List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailableTomorrow(WeekendUtils.isWeekend(), token);
if (CollectionUtils.isEmpty(sitePositionLists)) { if (CollectionUtils.isEmpty(sitePositionLists)) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
@@ -160,12 +156,6 @@ public class VenueServiceImpl implements IVenueService {
return true; return true;
} }
@Override
public Page<VenueInfoQueryResp> list(VenueInfoQueryRequest request) {
Page<VenueInfoDO> page = venueInfoManage.page(request);
return venueInfoConverter.toPage(page);
}
private void updateDatabase(List<SitePositionList> list, boolean isToday) { private void updateDatabase(List<SitePositionList> list, boolean isToday) {
List<VenueInfoDO> venueInfoDOS = Lists.newArrayList(); List<VenueInfoDO> venueInfoDOS = Lists.newArrayList();
if (isToday) { if (isToday) {

View File

@@ -2,7 +2,7 @@ package com.xiang.service.module.jntyzx.miniapp.utils;
import com.xiang.common.factory.JntyzxDingTalkFactory; import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.utils.RedisService; import com.xiang.common.utils.RedisService;
import com.xiang.service.module.jntyzx.miniapp.constants.RedisKeyConstant; import com.xiang.common.enums.RedisKeyConstant;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -30,7 +30,7 @@ public class MsgSendUtils {
String cache = (String) redisService.get(redisKey); String cache = (String) redisService.get(redisKey);
if (StringUtils.isNotBlank(cache)) { if (StringUtils.isNotBlank(cache)) {
int sendNum = Integer.parseInt(cache); int sendNum = Integer.parseInt(cache);
if (sendNum >= 0 && sendNum <= 5) { if (sendNum >= 0 && sendNum < 5) {
jtDingTalkFactory.sendMsg(msgContent); jtDingTalkFactory.sendMsg(msgContent);
redisService.set(key, String.valueOf(++sendNum), 1, TimeUnit.HOURS); redisService.set(key, String.valueOf(++sendNum), 1, TimeUnit.HOURS);
} }

View File

@@ -4,12 +4,20 @@ import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList; import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* @Author: xiang * @Author: xiang
* @Date: 2025-12-16 09:55 * @Date: 2025-12-16 09:55
*/ */
public class VenueInfoUtils { public class VenueInfoUtils {
public static boolean get11213VenueInfo4Mor(VenueInfoDO venueInfoDO) {
return StringUtils.equals(venueInfoDO.getSjName(), "11:00-12:00") || StringUtils.equals(venueInfoDO.getSjName(), "12:00-13:00");
}
public static boolean get123VenueInfo4Mor(VenueInfoDO venueInfoDO) { public static boolean get123VenueInfo4Mor(VenueInfoDO venueInfoDO) {
return StringUtils.equals(venueInfoDO.getSjName(), "13:00-14:00") || StringUtils.equals(venueInfoDO.getSjName(), "14:00-15:00"); return StringUtils.equals(venueInfoDO.getSjName(), "13:00-14:00") || StringUtils.equals(venueInfoDO.getSjName(), "14:00-15:00");
} }
@@ -19,6 +27,9 @@ public class VenueInfoUtils {
public static boolean get628VenueInfo(VenueInfoDO venueInfoDO) { public static boolean get628VenueInfo(VenueInfoDO venueInfoDO) {
return StringUtils.equals(venueInfoDO.getSjName(), "18:00-19:00") || StringUtils.equals(venueInfoDO.getSjName(), "19:00-20:00"); return StringUtils.equals(venueInfoDO.getSjName(), "18:00-19:00") || StringUtils.equals(venueInfoDO.getSjName(), "19:00-20:00");
} }
public static boolean get628VenueInfo(SitePositionList sitePositionList) {
return StringUtils.equals(sitePositionList.getSjName(), "18:00-19:00") || StringUtils.equals(sitePositionList.getSjName(), "19:00-20:00");
}
public static boolean get8210VenueInfo(VenueInfoDO venueInfoDO) { public static boolean get8210VenueInfo(VenueInfoDO venueInfoDO) {
return StringUtils.equals(venueInfoDO.getSjName(), "20:00-21:00") || StringUtils.equals(venueInfoDO.getSjName(), "21:00-22:00"); return StringUtils.equals(venueInfoDO.getSjName(), "20:00-21:00") || StringUtils.equals(venueInfoDO.getSjName(), "21:00-22:00");
} }
@@ -27,15 +38,49 @@ public class VenueInfoUtils {
} }
public static int sortVenueInfo(String placeName) { public static int sortVenueInfo(String placeName) {
if (placeName.contains("十号")) { if (placeName.contains("十号") || placeName.contains("10")) {
return 0; return 0;
} }
if (placeName.contains("二号")) { if (placeName.contains("九号") || placeName.contains("9")) {
return 1; return 1;
} }
if (placeName.contains("九号")) { if (placeName.contains("二号") || placeName.contains("2")) {
return 2; return 2;
} }
if (placeName.contains("八号") || placeName.contains("8")) {
return 3; return 3;
} }
if (placeName.contains("七号") || placeName.contains("7")) {
return 4;
}
return 5;
}
public static List<VenueInfoDO> filterVenueList(String siteTimeName, List<VenueInfoDO> venueInfoDOS) {
if (StringUtils.equals(siteTimeName, "18:00")) {
return venueInfoDOS.stream().filter(VenueInfoUtils::get628VenueInfo).collect(Collectors.toList());
}
if (StringUtils.equals(siteTimeName, "20:00")) {
return venueInfoDOS.stream().filter(VenueInfoUtils::get8210VenueInfo).collect(Collectors.toList());
}
if (StringUtils.equals(siteTimeName, "12:00")) {
return venueInfoDOS.stream().filter(item -> Objects.equals(item.getSjName(), "12:00-13:00")).collect(Collectors.toList());
}
if (StringUtils.equals(siteTimeName, "13:00")) {
return venueInfoDOS.stream().filter(item -> Objects.equals(item.getSjName(), "13:00-14:00")).collect(Collectors.toList());
}
if (StringUtils.equals(siteTimeName, "14:00")) {
return venueInfoDOS.stream().filter(item -> Objects.equals(item.getSjName(), "14:00-15:00")).collect(Collectors.toList());
}
if (StringUtils.equals(siteTimeName, "15:00")) {
return venueInfoDOS.stream().filter(item -> Objects.equals(item.getSjName(), "15:00-16:00")).collect(Collectors.toList());
}
if (StringUtils.equals(siteTimeName, "16:00")) {
return venueInfoDOS.stream().filter(item -> Objects.equals(item.getSjName(), "16:00-17:00")).collect(Collectors.toList());
}
if (StringUtils.equals(siteTimeName, "17:00")) {
return venueInfoDOS.stream().filter(item -> Objects.equals(item.getSjName(), "17:00-18:00")).collect(Collectors.toList());
}
return null;
}
} }

View File

@@ -0,0 +1,80 @@
package com.xiang.service.module.jntyzx.zlb.schedule;
import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
import com.xiang.common.manage.jntyzx.zlb.IZlbJlUserInfoManage;
import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* zlb场地捡漏任务
*
* @Author: xiang
* @Date: 2026-05-12 09:16
*/
@Component
@Slf4j
public class ZlbJlTask extends BaseScheduleTaskTemplate {
private final ZlbTokenInfoService zlbTokenInfoService;
private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
private final IZlbJlUserInfoManage zlbJlUserInfoManage;
public ZlbJlTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
IScheduleRunLogService scheduleRunLogService,
ZlbTokenInfoService zlbTokenInfoService,
JntyzxDingTalkFactory jntyzxDingTalkFactory,
IZlbJlUserInfoManage zlbJlUserInfoManage) {
super(scheduleOpeningConfigService, scheduleRunLogService);
this.zlbTokenInfoService = zlbTokenInfoService;
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
this.zlbJlUserInfoManage = zlbJlUserInfoManage;
}
@Override
protected String getTaskName() {
return ScheduleEnums.ZLB_ORDER_JL_TASK.getTaskName();
}
@Override
protected Integer getModule() {
return ScheduleEnums.ZLB_ORDER_JL_TASK.getModuleCode();
}
@Override
protected String getModuleName() {
return ScheduleEnums.ZLB_ORDER_JL_TASK.getModule();
}
@Override
protected TaskResult doExecute(Object validatedParams) throws Exception {
// TaskResult taskResult = new TaskResult();
// taskResult.setSuccess(Boolean.TRUE);
// List<ZlbJlUserInfo> jlUsers = zlbJlUserInfoManage.getJlUsers();
// if (CollectionUtils.isEmpty(jlUsers)) {
// taskResult.setParams("暂无配置捡漏用户");
// return taskResult;
// }
//
// List<ZlbTokenInfo> allUsers = zlbTokenInfoService.getAllUsers();
// if (CollectionUtils.isEmpty(allUsers)) {
// taskResult.setParams("用户信息为空");
// return taskResult;
// }
// Map<String, ZlbTokenInfo> userMap = allUsers.stream().collect(Collectors.toMap(ZlbTokenInfo::getName, Function.identity(), (a, b) -> a));
// for (ZlbJlUserInfo jlUser : jlUsers) {
// if (userMap.containsKey(jlUser.getName())) {
//
// }
// }
return null;
}
}

View File

@@ -13,7 +13,7 @@ import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;
import com.xiang.common.pojo.schedule.TaskResult; import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService; import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService; import com.xiang.common.service.IScheduleRunLogService;
import com.xiang.service.module.jntyzx.zlb.service.ZlbTokenInfoService; import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
@@ -53,7 +53,7 @@ public class ZlbLoginTask extends BaseScheduleTaskTemplate {
@Override @Override
protected Integer getModule() { protected Integer getModule() {
return ScheduleEnums.ZLB_LOGIN_TASK.getModeleCode(); return ScheduleEnums.ZLB_LOGIN_TASK.getModuleCode();
} }
@Override @Override

View File

@@ -0,0 +1,117 @@
package com.xiang.service.module.jntyzx.zlb.schedule;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.Lists;
import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
import com.xiang.common.manage.jntyzx.zlb.IZlbOrderInfoManage;
import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
import com.xiang.common.pojo.jntyzx.zlb.ZlbOrderDetailResp;
import com.xiang.common.pojo.jntyzx.zlb.ZlbPayOrder;
import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;
import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService;
import com.xiang.common.utils.OkHttpUtil;
import com.xiang.service.module.jntyzx.zlb.constants.ZlbUrlConstants;
import com.xiang.service.module.jntyzx.zlb.service.ZlbService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Author: xiang
* @Date: 2026-05-11 09:11
*/
@Component
@Slf4j
public class ZlbOrderQueryTask extends BaseScheduleTaskTemplate {
private final IZlbOrderInfoManage zlbOrderInfoManage;
private final ZlbTokenInfoService zlbTokenInfoService;
private final ZlbService zlbService;
public ZlbOrderQueryTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
IScheduleRunLogService scheduleRunLogService,
IZlbOrderInfoManage zlbOrderInfoManage,
ZlbTokenInfoService zlbTokenInfoService, ZlbService zlbService) {
super(scheduleOpeningConfigService, scheduleRunLogService);
this.zlbOrderInfoManage = zlbOrderInfoManage;
this.zlbTokenInfoService = zlbTokenInfoService;
this.zlbService = zlbService;
}
@Override
protected String getTaskName() {
return ScheduleEnums.ZLB_ORDER_QUERY_TASK.getTaskName();
}
@Override
protected Integer getModule() {
return ScheduleEnums.ZLB_ORDER_QUERY_TASK.getModuleCode();
}
@Override
protected String getModuleName() {
return ScheduleEnums.ZLB_ORDER_QUERY_TASK.getModule();
}
@Override
protected TaskResult doExecute(Object validatedParams) throws Exception {
TaskResult taskResult = new TaskResult();
taskResult.setSuccess(Boolean.TRUE);
List<ZlbPayOrder> orders = zlbOrderInfoManage.queryOrder(LocalDate.now().plusDays(1));
if (CollectionUtils.isEmpty(orders)) {
taskResult.setSummary("无可使用的订单");
return taskResult;
}
List<ZlbTokenInfo> users = zlbTokenInfoService.getAllUsers();
if (CollectionUtils.isEmpty(users)) {
taskResult.setSummary("无可使用的用户");
return taskResult;
}
Map<String, ZlbTokenInfo> userMap = users.stream().collect(Collectors.toMap(ZlbTokenInfo::getName, Function.identity(), (a, b) -> a));
OkHttpUtil client = OkHttpUtil.getInstance();
List<ZlbPayOrder> result = Lists.newArrayList();
for (ZlbPayOrder order : orders) {
if (!userMap.containsKey(order.getName())) {
continue;
}
ZlbTokenInfo zlbTokenInfo = userMap.get(order.getName());
String orderDetailStr = client.postJson(String.format(ZlbUrlConstants.getOrderDetailUrl, order.getOrderId()), zlbService.getHeaders(zlbTokenInfo.getTokenId()),"{}");
if (StringUtils.isBlank(orderDetailStr)) {
log.info("订单:{}查询结果为空", order.getOrderId());
continue;
}
JSONObject jsonObject = JSON.parseObject(orderDetailStr);
ZlbOrderDetailResp data = JSON.parseObject(jsonObject.getString("data"), ZlbOrderDetailResp.class);
if (Objects.isNull(data)) {
continue;
}
if (Objects.equals(data.getState(), 2)) {
order.setIsPay(1);
result.add(order);
} else {
order.setIsPay(2);
result.add(order);
}
}
if (CollectionUtils.isNotEmpty(result)) {
zlbOrderInfoManage.updateBatchById(result);
}
taskResult.setSummary("订单查询成功!");
return taskResult;
}
}

View File

@@ -8,6 +8,8 @@ import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.exception.BusinessException; import com.xiang.common.exception.BusinessException;
import com.xiang.common.factory.JntyzxDingTalkFactory; import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate; import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
import com.xiang.common.manage.jntyzx.zlb.IZlbOrderInfoManage;
import com.xiang.common.pojo.jntyzx.zlb.ZlbPayOrder;
import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo; import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;
import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo; import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;
import com.xiang.common.pojo.schedule.TaskResult; import com.xiang.common.pojo.schedule.TaskResult;
@@ -17,13 +19,14 @@ import com.xiang.common.utils.DateUtils;
import com.xiang.common.utils.OkHttpUtil; import com.xiang.common.utils.OkHttpUtil;
import com.xiang.service.module.jntyzx.zlb.constants.ZlbUrlConstants; import com.xiang.service.module.jntyzx.zlb.constants.ZlbUrlConstants;
import com.xiang.service.module.jntyzx.zlb.service.ZlbService; import com.xiang.service.module.jntyzx.zlb.service.ZlbService;
import com.xiang.service.module.jntyzx.zlb.service.ZlbTokenInfoService; import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
import com.xiang.service.module.jntyzx.zlb.service.ZlbUserInfoService; import com.xiang.common.manage.jntyzx.zlb.ZlbUserInfoService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@@ -40,6 +43,7 @@ public class ZlbOrderTask extends BaseScheduleTaskTemplate {
private final ZlbTokenInfoService zlbTokenInfoService; private final ZlbTokenInfoService zlbTokenInfoService;
private final JntyzxDingTalkFactory jntyzxDingTalkFactory; private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final IZlbOrderInfoManage zlbOrderInfoManage;
public ZlbOrderTask(IScheduleOpeningConfigService scheduleOpeningConfigService, public ZlbOrderTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
IScheduleRunLogService scheduleRunLogService, IScheduleRunLogService scheduleRunLogService,
@@ -47,13 +51,15 @@ public class ZlbOrderTask extends BaseScheduleTaskTemplate {
ZlbService zlbService, ZlbService zlbService,
ZlbTokenInfoService zlbTokenInfoService, ZlbTokenInfoService zlbTokenInfoService,
JntyzxDingTalkFactory jntyzxDingTalkFactory, JntyzxDingTalkFactory jntyzxDingTalkFactory,
RedisTemplate redisTemplate) { RedisTemplate redisTemplate,
IZlbOrderInfoManage zlbOrderInfoManage) {
super(scheduleOpeningConfigService, scheduleRunLogService); super(scheduleOpeningConfigService, scheduleRunLogService);
this.zlbUserInfoService = zlbUserInfoService; this.zlbUserInfoService = zlbUserInfoService;
this.zlbService = zlbService; this.zlbService = zlbService;
this.zlbTokenInfoService = zlbTokenInfoService; this.zlbTokenInfoService = zlbTokenInfoService;
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory; this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
this.redisTemplate = redisTemplate; this.redisTemplate = redisTemplate;
this.zlbOrderInfoManage = zlbOrderInfoManage;
} }
@Override @Override
@@ -63,7 +69,7 @@ public class ZlbOrderTask extends BaseScheduleTaskTemplate {
@Override @Override
protected Integer getModule() { protected Integer getModule() {
return ScheduleEnums.ZLB_ORDER_CREATE_TASK.getModeleCode(); return ScheduleEnums.ZLB_ORDER_CREATE_TASK.getModuleCode();
} }
@Override @Override
@@ -98,43 +104,74 @@ public class ZlbOrderTask extends BaseScheduleTaskTemplate {
String tokenId = zlbTokenInfo.getTokenId(); String tokenId = zlbTokenInfo.getTokenId();
String secretKey = zlbService.getKey(tokenId, client); String secretKey = zlbService.getKey(tokenId, client);
String siteOrderDetailsStr = zlbService.buildSiteOrder(zlbUserInfo, secretKey, day); String siteOrderDetailsStr = zlbService.buildSiteOrder(zlbUserInfo, secretKey, day);
if (StringUtils.isEmpty(siteOrderDetailsStr)) {
log.info("构建订单参数异常:{}", siteOrderDetailsStr);
throw new BusinessException("构建订单参数异常");
}
Map<String, String> headers = zlbService.getHeaders(zlbTokenInfo.getTokenId()); Map<String, String> headers = zlbService.getHeaders(zlbTokenInfo.getTokenId());
String newOrderJson = zlbService.buildNewOrder(siteOrderDetailsStr, client); String newOrderJson = zlbService.buildNewOrder(siteOrderDetailsStr, client);
if (StringUtils.isBlank(newOrderJson)) { if (StringUtils.isBlank(newOrderJson)) {
log.info("构建订单参数异常:{}", siteOrderDetailsStr); log.info("构建订单参数异常:{}", siteOrderDetailsStr);
throw new BusinessException(""); throw new BusinessException("构建订单参数异常");
} }
ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
//计算9点到现在的时间差 //计算9点到现在的时间差
//获取江体当前时间 //获取江体当前时间
LocalTime currentTime = LocalTime.now(); LocalTime currentTime = LocalTime.now();
LocalTime targetTime = LocalTime.parse("09:00:11.800"); LocalTime targetTime = LocalTime.parse("09:00:12.500");
Duration duration = Duration.between(currentTime, targetTime); Duration duration = Duration.between(currentTime, targetTime);
long milliseconds = duration.toMillis(); long milliseconds = duration.toMillis();
executorService.schedule(() -> { executorService.schedule(() -> {
for (int i = 0; i < 3; i++) {
String response = null; String response = null;
try { try {
response = client.postJson(ZlbUrlConstants.newOrderUrl, headers, newOrderJson); response = client.postJson(ZlbUrlConstants.newOrderUrl, headers, newOrderJson);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
buildOrder(name, response, placeName, siteTimeName); boolean b = buildOrder(name, response, placeName, siteTimeName);
if (b) {
break;
}
try {
Thread.sleep(1250);
} catch (InterruptedException e) {
logger.error("线程暂停异常");
}
}
}, milliseconds, TimeUnit.MILLISECONDS); }, milliseconds, TimeUnit.MILLISECONDS);
return taskResult; return taskResult;
} }
private void buildOrder(String name, String response, String placeName, String siteTimeName) { private boolean buildOrder(String name, String response, String placeName, String siteTimeName) {
log.info("订单接口返回结果==> \n {}", response); log.info("订单接口返回结果==> \n {}", response);
JSONObject jsonObject = JSONObject.parseObject(response); JSONObject jsonObject = JSONObject.parseObject(response);
if (jsonObject.getInteger("code") == 200) { if (jsonObject.getInteger("code") == 200) {
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回成功请2分钟内付款√√√√√√场地号:" + placeName + "时间:" + siteTimeName); jntyzxDingTalkFactory.sendMsg(name + ":zlb订单接口下单返回成功请2分钟内付款√√√√√√场地号:" + placeName + "时间:" + siteTimeName);
JSONObject data = jsonObject.getJSONObject("data"); JSONObject data = jsonObject.getJSONObject("data");
String orderId = data.getString("orderId"); String orderId = data.getString("orderId");
log.info("{}订单{}创建成功", name, orderId); log.info("{}订单{}创建成功", name, orderId);
String redisKey = ZlbUrlConstants.REDIS_PREFIX + "_" + orderId + "_" + name; String redisKey = ZlbUrlConstants.REDIS_PREFIX + "_" + orderId + "_" + name;
redisTemplate.opsForValue().set(redisKey, name); redisTemplate.opsForValue().set(redisKey, name);
redisTemplate.expire(redisKey, 120, TimeUnit.SECONDS); redisTemplate.expire(redisKey, 120, TimeUnit.SECONDS);
ZlbPayOrder zlbPayOrder = new ZlbPayOrder();
zlbPayOrder.setName(name);
zlbPayOrder.setOrderId(orderId);
zlbPayOrder.setDay(DateUtils.getDateFromDate(LocalDate.now().plusDays(1)));
zlbPayOrder.setVenues("江体");
zlbPayOrder.setPlaceName(placeName);
zlbPayOrder.setTime(siteTimeName);
zlbPayOrder.setIsPay(0);
zlbOrderInfoManage.save(zlbPayOrder);
return true;
} }
if (jsonObject.getInteger("code") == 500) {
if (jsonObject.getString("message").contains("已被售出")) {
jntyzxDingTalkFactory.sendMsg(name + ":zlb订单接口下单返回失败❌❌❌场地号:" + placeName + "已被售出");
return true;
}
}
return false;
} }
} }

View File

@@ -14,7 +14,6 @@ import com.xiang.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -40,7 +39,7 @@ public class ZlbSiteDayTask extends BaseScheduleTaskTemplate {
@Override @Override
protected Integer getModule() { protected Integer getModule() {
return ScheduleEnums.ZLB_SITE_DAY_TASK.getModeleCode(); return ScheduleEnums.ZLB_SITE_DAY_TASK.getModuleCode();
} }
@Override @Override
@@ -57,6 +56,7 @@ public class ZlbSiteDayTask extends BaseScheduleTaskTemplate {
String day = DateUtils.format(date, DateUtils.ENUM_FORMAT_YMD); String day = DateUtils.format(date, DateUtils.ENUM_FORMAT_YMD);
LambdaQueryWrapper<ZlbPayOrder> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<ZlbPayOrder> wrapper = Wrappers.lambdaQuery();
wrapper.eq(ZlbPayOrder::getDay, day); wrapper.eq(ZlbPayOrder::getDay, day);
wrapper.eq(ZlbPayOrder::getIsPay, 1);
wrapper.orderByAsc(ZlbPayOrder::getTime); wrapper.orderByAsc(ZlbPayOrder::getTime);
List<ZlbPayOrder> zlbPayOrders = zlbOrderInfoMapper.selectList(wrapper); List<ZlbPayOrder> zlbPayOrders = zlbOrderInfoMapper.selectList(wrapper);
if (!zlbPayOrders.isEmpty()){ if (!zlbPayOrders.isEmpty()){

View File

@@ -30,7 +30,7 @@ public class ZlbSiteTask extends BaseScheduleTaskTemplate {
@Override @Override
protected Integer getModule() { protected Integer getModule() {
return ScheduleEnums.ZLB_SITE_QUERY_TASK.getModeleCode(); return ScheduleEnums.ZLB_SITE_QUERY_TASK.getModuleCode();
} }
@Override @Override

View File

@@ -17,42 +17,68 @@ public class ZlbTaskConfig {
private final ZlbSiteDayTask zlbSiteDayTask; private final ZlbSiteDayTask zlbSiteDayTask;
private final ZlbOrderTask zlbOrderTask; private final ZlbOrderTask zlbOrderTask;
private final ZlbUserConfigTask zlbUserConfigTask; private final ZlbUserConfigTask zlbUserConfigTask;
private final ZlbOrderQueryTask zlbOrderQueryTask;
@Scheduled(cron = "0 0/30 * * * ?") /**
* token续期
*/
@Scheduled(cron = "0 10,40 * * * ?")
@GetMapping("/zlbLoginTask") @GetMapping("/zlbLoginTask")
public void zlbLoginTask() { public void zlbLoginTask() {
zlbLoginTask.run(); zlbLoginTask.run();
} }
/**
* token校验
*/
@Scheduled(cron = "0 0 8 * * *") @Scheduled(cron = "0 0 8 * * *")
@GetMapping("/zlbTokenRefresh") @GetMapping("/zlbTokenRefresh")
public void zlbTokenRefresh() { public void zlbTokenRefresh() {
zlbTokenRefreshTask.run(); zlbTokenRefreshTask.run();
} }
/**
* 场地信息拉取 拉取后天的场地信息
*/
@GetMapping("/zlbSiteTask") @GetMapping("/zlbSiteTask")
@Scheduled(cron = "30 30 16 * * ?") @Scheduled(cron = "30 30 16 * * ?")
public void zlbSiteTask() { public void zlbSiteTask() {
zlbSiteTask.run(); zlbSiteTask.run();
} }
/**
* 当天场地订阅信息--数据库数据
*/
@GetMapping("/zlbSiteDayTask") @GetMapping("/zlbSiteDayTask")
@Scheduled(cron = "0 00 17 * * ?") @Scheduled(cron = "0 00 17 * * ?")
public void zlbSiteDayTask() { public void zlbSiteDayTask() {
zlbSiteDayTask.run(); zlbSiteDayTask.run();
} }
/**
* 下单
*/
@GetMapping("/zlbOrderCreateTask") @GetMapping("/zlbOrderCreateTask")
@Scheduled(cron = "55 59 8 * * ?") @Scheduled(cron = "2 0 9 * * ?")
public void zlbOrderCreateTask() { public void zlbOrderCreateTask() {
zlbOrderTask.run(); zlbOrderTask.run();
} }
/**
* 下单用户场地配置信息
*/
@Scheduled(cron = "30 35 16 * * ?") @Scheduled(cron = "30 35 16 * * ?")
@GetMapping("/zlbUserConfig") @GetMapping("/zlbUserConfig")
public void zlbUserConfig() { public void zlbUserConfig() {
zlbUserConfigTask.run(); zlbUserConfigTask.run();
} }
/**
* 9:05查询订单是否已经支付
*/
@Scheduled(cron = "0 5 9 * * ?")
@GetMapping("/zlbOrderQueryTask")
public void zlbOrderQueryTask() {
zlbOrderQueryTask.run();
}
} }

View File

@@ -9,12 +9,11 @@ import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;
import com.xiang.common.pojo.schedule.TaskResult; import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService; import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService; import com.xiang.common.service.IScheduleRunLogService;
import com.xiang.service.module.jntyzx.zlb.service.ZlbTokenInfoService; import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -41,7 +40,7 @@ public class ZlbTokenRefreshTask extends BaseScheduleTaskTemplate {
@Override @Override
protected Integer getModule() { protected Integer getModule() {
return ScheduleEnums.ZLB_TOKEN_CHECK_TASK.getModeleCode(); return ScheduleEnums.ZLB_TOKEN_CHECK_TASK.getModuleCode();
} }
@Override @Override

View File

@@ -1,11 +1,16 @@
package com.xiang.service.module.jntyzx.zlb.schedule; package com.xiang.service.module.jntyzx.zlb.schedule;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.xiang.common.enums.RedisKeyConstant;
import com.xiang.common.enums.ScheduleEnums; import com.xiang.common.enums.ScheduleEnums;
import com.xiang.common.factory.JntyzxDingTalkFactory; import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate; import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
import com.xiang.common.manage.jntyzx.zlb.ZlbSiteInfoService;
import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
import com.xiang.common.manage.jntyzx.zlb.ZlbUserInfoService;
import com.xiang.common.pojo.jntyzx.zlb.ZlbSiteInfo; import com.xiang.common.pojo.jntyzx.zlb.ZlbSiteInfo;
import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo; import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;
import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo; import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;
@@ -13,9 +18,8 @@ import com.xiang.common.pojo.schedule.TaskResult;
import com.xiang.common.service.IScheduleOpeningConfigService; import com.xiang.common.service.IScheduleOpeningConfigService;
import com.xiang.common.service.IScheduleRunLogService; import com.xiang.common.service.IScheduleRunLogService;
import com.xiang.common.utils.DateUtils; import com.xiang.common.utils.DateUtils;
import com.xiang.service.module.jntyzx.zlb.service.ZlbSiteInfoService; import com.xiang.common.utils.RedisService;
import com.xiang.service.module.jntyzx.zlb.service.ZlbTokenInfoService; import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils;
import com.xiang.service.module.jntyzx.zlb.service.ZlbUserInfoService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -38,18 +42,21 @@ public class ZlbUserConfigTask extends BaseScheduleTaskTemplate {
private final ZlbUserInfoService zlbUserInfoService; private final ZlbUserInfoService zlbUserInfoService;
private final JntyzxDingTalkFactory jntyzxDingTalkFactory; private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
private final ZlbTokenInfoService zlbTokenInfoService; private final ZlbTokenInfoService zlbTokenInfoService;
private final RedisService redisService;
public ZlbUserConfigTask(IScheduleOpeningConfigService scheduleOpeningConfigService, public ZlbUserConfigTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
IScheduleRunLogService scheduleRunLogService, IScheduleRunLogService scheduleRunLogService,
ZlbSiteInfoService zlbSiteInfoService, ZlbSiteInfoService zlbSiteInfoService,
ZlbUserInfoService zlbUserInfoService, ZlbUserInfoService zlbUserInfoService,
ZlbTokenInfoService zlbTokenInfoService, ZlbTokenInfoService zlbTokenInfoService,
JntyzxDingTalkFactory jntyzxDingTalkFactory) { JntyzxDingTalkFactory jntyzxDingTalkFactory,
RedisService redisService) {
super(scheduleOpeningConfigService, scheduleRunLogService); super(scheduleOpeningConfigService, scheduleRunLogService);
this.zlbSiteInfoService = zlbSiteInfoService; this.zlbSiteInfoService = zlbSiteInfoService;
this.zlbUserInfoService = zlbUserInfoService; this.zlbUserInfoService = zlbUserInfoService;
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory; this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
this.zlbTokenInfoService = zlbTokenInfoService; this.zlbTokenInfoService = zlbTokenInfoService;
this.redisService = redisService;
} }
@Override @Override
@@ -59,7 +66,7 @@ public class ZlbUserConfigTask extends BaseScheduleTaskTemplate {
@Override @Override
protected Integer getModule() { protected Integer getModule() {
return ScheduleEnums.ZLB_USER_CONFIG_TASK.getModeleCode(); return ScheduleEnums.ZLB_USER_CONFIG_TASK.getModuleCode();
} }
@Override @Override
@@ -126,33 +133,18 @@ public class ZlbUserConfigTask extends BaseScheduleTaskTemplate {
} }
private List<ZlbSiteInfo> filterSiteInfo(List<ZlbSiteInfo> siteInfoList) { private List<ZlbSiteInfo> filterSiteInfo(List<ZlbSiteInfo> siteInfoList) {
return siteInfoList.stream().filter(item -> Objects.equals(item.getDayEffectiveTimes(), "20:00")).toList(); String time = (String) redisService.get(RedisKeyConstant.JNTYZX_SUBSCRIBE_TIME_KEY);
if (StringUtils.isBlank(time)) {
time = "18:00";
}
String finalTime = time;
return siteInfoList.stream().filter(item -> Objects.equals(item.getDayEffectiveTimes(), finalTime)).toList();
} }
private List<ZlbSiteInfo> sortSiteInfo(List<ZlbSiteInfo> siteInfoList) { private List<ZlbSiteInfo> sortSiteInfo(List<ZlbSiteInfo> siteInfoList) {
if (CollectionUtils.isEmpty(siteInfoList)) { if (CollectionUtils.isEmpty(siteInfoList)) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
return siteInfoList.stream().sorted(Comparator.comparing(this::sort)).collect(Collectors.toList()); return siteInfoList.stream().sorted(Comparator.comparing(item -> VenueInfoUtils.sortVenueInfo(item.getPlaceName()))).collect(Collectors.toList());
}
private int sort(ZlbSiteInfo siteInfo) {
String placeName = siteInfo.getPlaceName();
if (placeName.contains("十号")) {
return 0;
}
if (placeName.contains("九号")) {
return 1;
}
if (placeName.contains("二号")) {
return 2;
}
if (placeName.contains("八号")) {
return 3;
}
if (placeName.contains("七号")) {
return 4;
}
return 5;
} }
} }

View File

@@ -0,0 +1,42 @@
package com.xiang.service.module.jntyzx.zlb.server;
import com.xiang.service.module.jntyzx.zlb.service.ZlbService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @Author: xiang
* @Date: 2026-05-12 09:27
*/
@Slf4j
@RestController
@RequiredArgsConstructor
public class JtZlbController {
private final ZlbService zlbService;
private static final ExecutorService executorService = Executors.newFixedThreadPool(1);
@GetMapping("/token")
public void token(@RequestParam("name") String name, @RequestParam("token") String token) throws Exception {
zlbService.token(token, name);
}
@GetMapping("/zlbJl")
public void zlbJlTask(@RequestParam("name") String name, @RequestParam("date") String date, @RequestParam("time") String time, @RequestParam("interval") Long interval) throws Exception {
log.info("[zlbJl] zlb自定义捡漏任务启动用户:{}, 时间:{}", name, date);
executorService.submit(() -> {
try {
zlbService.jianlou(name, date, time, interval);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
}

View File

@@ -14,30 +14,20 @@ import java.util.Map;
* @Description*** * @Description***
*/ */
public interface ZlbService { public interface ZlbService {
void queryZLbSiteInfo(String ymdDate,Integer type) throws Exception; void queryZLbSiteInfo(String ymdDate, Integer type) throws Exception;
String getKey(String tokenId, OkHttpUtil client) throws IOException; String getKey(String tokenId, OkHttpUtil client) throws IOException;
void token(String token, String name) throws IOException;
void testJs(String token, String name) throws IOException;
Map<String, String> getHeaders(String tokenId); Map<String, String> getHeaders(String tokenId);
String buildSiteOrder(ZlbUserInfo zlbUserInfo, String secretKey, String day) throws Exception; String buildSiteOrder(ZlbUserInfo zlbUserInfo, String secretKey, String day) throws Exception;
void createOrder(ZlbUserInfo zlbUserInfo) throws Exception;
String createOrderWq(ZlbUserInfo zlbUserInfo) throws Exception;
String buildNewOrder(String siteOrderDetailsStr, OkHttpUtil client) throws IOException; String buildNewOrder(String siteOrderDetailsStr, OkHttpUtil client) throws IOException;
void deleteRedis(String name); void deleteRedis(String name);
void installRedis(String name); void jianlou(String name, String day, String time, long interval) throws Exception;
void jianlou(String name, String day,long time) throws Exception;
void refundOrder(String refundName, String day) throws Exception;
void cancelOrder(String cancelName, String day) throws Exception;
} }

View File

@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xiang.common.factory.JntyzxDingTalkFactory; import com.xiang.common.factory.JntyzxDingTalkFactory;
import com.xiang.common.manage.jntyzx.zlb.ZlbSiteInfoService;
import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
import com.xiang.common.pojo.jntyzx.zlb.ZlbCaptchaResp; import com.xiang.common.pojo.jntyzx.zlb.ZlbCaptchaResp;
import com.xiang.common.pojo.jntyzx.zlb.ZlbOrderInfo; import com.xiang.common.pojo.jntyzx.zlb.ZlbOrderInfo;
import com.xiang.common.pojo.jntyzx.zlb.ZlbOrderJson; import com.xiang.common.pojo.jntyzx.zlb.ZlbOrderJson;
@@ -21,7 +23,6 @@ import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;
import com.xiang.common.service.ICodeService; import com.xiang.common.service.ICodeService;
import com.xiang.common.utils.AESECBUtils; import com.xiang.common.utils.AESECBUtils;
import com.xiang.common.utils.Base64ImageScaler; import com.xiang.common.utils.Base64ImageScaler;
import com.xiang.common.utils.DateUtils;
import com.xiang.common.utils.OkHttpUtil; import com.xiang.common.utils.OkHttpUtil;
import com.xiang.common.utils.ZlbCaptchaTrackUtil; import com.xiang.common.utils.ZlbCaptchaTrackUtil;
import com.xiang.service.module.jntyzx.zlb.constants.ZlbUrlConstants; import com.xiang.service.module.jntyzx.zlb.constants.ZlbUrlConstants;
@@ -59,8 +60,6 @@ public class ZlbServiceImpl implements ZlbService {
@Autowired @Autowired
private JntyzxDingTalkFactory jntyzxDingTalkFactory; private JntyzxDingTalkFactory jntyzxDingTalkFactory;
@Autowired @Autowired
private ZlbUserInfoService zlbUserInfoService;
@Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Autowired @Autowired
private ICodeService codeService; private ICodeService codeService;
@@ -216,34 +215,6 @@ public class ZlbServiceImpl implements ZlbService {
return ""; return "";
} }
@Override
public void createOrder(ZlbUserInfo zlbUserInfo) throws Exception {
Date date = DateUtils.addDate(new Date(), 1);
String day = DateUtils.format(date, DateUtils.ENUM_FORMAT_YMD);
String name = zlbUserInfo.getName();
String placeName = zlbUserInfo.getPlaceName();
String siteTimeName = zlbUserInfo.getSiteTimeName();
//获取Token
ZlbTokenInfo zlbTokenInfo = zlbTokenInfoService.queryByName(name);
OkHttpUtil client = OkHttpUtil.getInstance();
String tokenId = zlbTokenInfo.getTokenId();
String secretKey = getKey(tokenId, client);
//组装场地信息
String siteOrderDetailsStr = buildSiteOrder(zlbUserInfo, secretKey, day);
//加密
for (int i = 1; i < 12; i++) {
String response1 = sendOrder(siteOrderDetailsStr, zlbTokenInfo.getTokenId(), client);
String str = buildOrder(name, response1, placeName, siteTimeName);
if ("下单成功".equals(str)) {
return;
}
if ("您选择场地已被售出".equals(str)) {
return;
}
}
}
public String buildOrder(String name, String response, String placeName, String siteTimeName) throws InterruptedException { public String buildOrder(String name, String response, String placeName, String siteTimeName) throws InterruptedException {
String orderId = ""; String orderId = "";
log.info("订单接口返回结果==> \n {}", response); log.info("订单接口返回结果==> \n {}", response);
@@ -277,51 +248,6 @@ public class ZlbServiceImpl implements ZlbService {
return orderId; return orderId;
} }
@Override
public String createOrderWq(ZlbUserInfo zlbUserInfo) throws Exception {
String orderId = "";
Date date = DateUtils.addDate(new Date(), 3);
String day = DateUtils.format(date, DateUtils.ENUM_FORMAT_YMD);
String name = zlbUserInfo.getName();
String placeName = zlbUserInfo.getPlaceName();
String siteTimeName = zlbUserInfo.getSiteTimeName();
//获取Token
ZlbTokenInfo zlbTokenInfo = zlbTokenInfoService.queryByName(name);
String siteOrderDetailsStr = buildSiteOrderList(zlbUserInfo, zlbTokenInfo.getSecretKey(), day);
//组装参数加密
for (int i = 1; i < 10; i++) {
String response = sendOrderWq(siteOrderDetailsStr, zlbTokenInfo.getTokenId());
log.info("订单接口返回结果==> \n {}", response);
JSONObject jsonObject = JSONObject.parseObject(response);
if (jsonObject.getInteger("code") == 200) {
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回成功请2分钟内付款√√√√√√场地号:" + placeName + "时间:" + siteTimeName);
JSONObject data = jsonObject.getJSONObject("data");
orderId = data.getString("orderId");
return orderId;
} else if (response.contains("下单失败")) {
jntyzxDingTalkFactory.sendMsg(response);
return "";
} else if (response.contains("场地不在可售时间内")) {
jntyzxDingTalkFactory.sendMsg(response);
return "";
} else if (response.contains("您选择场地已被售出")) {
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回失败 \n" + response);
return "";
} else if (response.contains("此票超过用户每日订场次数")) {
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回失败 \n" + response);
return "";
} else if (response.contains("您有一笔待支付的订场订单")) {
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回失败 \n" + response);
Thread.sleep(1500);
} else if (response.contains("场地火爆")) {
log.info("{}场地火爆下单返回失败暂停1s下单 \n{}", name, response);
Thread.sleep(200);
} else {
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回失败请检查日志重试第" + i + "次××××××==> \n" + response);
}
}
return orderId;
}
private String sendOrderWq(String siteOrderDetailsStr, String tokenId) throws IOException { private String sendOrderWq(String siteOrderDetailsStr, String tokenId) throws IOException {
OkHttpUtil client = OkHttpUtil.getInstance(); OkHttpUtil client = OkHttpUtil.getInstance();
@@ -447,15 +373,8 @@ public class ZlbServiceImpl implements ZlbService {
} }
@Override @Override
public void installRedis(String name) { public void jianlou(String name, String day, String time, long interval) throws Exception {
String redisKey = ZlbUrlConstants.REDIS_PREFIX + "_" + 123456 + "_" + name; jntyzxDingTalkFactory.sendMsg(name + "自定义捡漏开始捡漏时间:" + day + " 捡漏人:" + name + " 捡漏间隔:" + interval + "ms");
redisTemplate.opsForValue().set(redisKey, name);
redisTemplate.expire(redisKey, 1234, TimeUnit.SECONDS);
}
@Override
public void jianlou(String name, String day, long time) throws Exception {
jntyzxDingTalkFactory.sendMsg(name + "自定义捡漏开始捡漏时间:" + day + " 捡漏人:" + name + " 捡漏间隔:" + time + "ms");
//获取Token //获取Token
ZlbTokenInfo zlbTokenInfo = zlbTokenInfoService.queryByName(name); ZlbTokenInfo zlbTokenInfo = zlbTokenInfoService.queryByName(name);
String tokenId = zlbTokenInfo.getTokenId(); String tokenId = zlbTokenInfo.getTokenId();
@@ -487,12 +406,15 @@ public class ZlbServiceImpl implements ZlbService {
if (StringUtils.isEmpty(siteInfo)) { if (StringUtils.isEmpty(siteInfo)) {
return; return;
} }
// log.info("请求场地返回信息: \n {}", siteInfo); // log.info("请求场地返回信息: \n {}", siteInfo);
jsonObject = JSONObject.parseObject(siteInfo); jsonObject = JSONObject.parseObject(siteInfo);
JSONObject data = jsonObject.getJSONObject("data"); JSONObject data = jsonObject.getJSONObject("data");
String listString = data.getString("list"); String listString = data.getString("list");
zlbSiteInfos = JSONArray.parseArray(listString, ZlbSiteInfo.class); zlbSiteInfos = JSONArray.parseArray(listString, ZlbSiteInfo.class);
for (ZlbSiteInfo zlbSiteInfo : zlbSiteInfos) { for (ZlbSiteInfo zlbSiteInfo : zlbSiteInfos) {
if (!StringUtils.equals(zlbSiteInfo.getDayEffectiveTimes(), time)) {
continue;
}
Integer ticketType = zlbSiteInfo.getTicketType(); Integer ticketType = zlbSiteInfo.getTicketType();
if (ticketType == 1) {//代表可以抢的场地号 if (ticketType == 1) {//代表可以抢的场地号
jntyzxDingTalkFactory.sendMsg(day + "ZLb捡漏发现场地:" + zlbSiteInfo.getPlaceName() + "时间点:" + zlbSiteInfo.getDayEffectiveTimes()); jntyzxDingTalkFactory.sendMsg(day + "ZLb捡漏发现场地:" + zlbSiteInfo.getPlaceName() + "时间点:" + zlbSiteInfo.getDayEffectiveTimes());
@@ -536,7 +458,7 @@ public class ZlbServiceImpl implements ZlbService {
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
} }
//休息5s //休息5s
Thread.sleep(time); Thread.sleep(interval);
} catch (Exception e) { } catch (Exception e) {
log.error("请求场地信息异常:{}", e.getMessage()); log.error("请求场地信息异常:{}", e.getMessage());
jntyzxDingTalkFactory.sendMsg(name + "ZLb自定义捡漏异常请查看日志"); jntyzxDingTalkFactory.sendMsg(name + "ZLb自定义捡漏异常请查看日志");
@@ -548,91 +470,6 @@ public class ZlbServiceImpl implements ZlbService {
jntyzxDingTalkFactory.sendMsg("自定义捡漏结束"); jntyzxDingTalkFactory.sendMsg("自定义捡漏结束");
} }
@Override
public void refundOrder(String refundName, String day) throws Exception {
//找到退款人的token
ZlbTokenInfo zlbTokenInfo = zlbTokenInfoService.getOne(new LambdaQueryWrapper<ZlbTokenInfo>().eq(ZlbTokenInfo::getName, refundName));
if (zlbTokenInfo == null) {
jntyzxDingTalkFactory.sendMsg("退款失败,请检查是否录入退款人登录信息-->" + refundName);
}
OkHttpUtil client = OkHttpUtil.getInstance();
//获取退款人的订单列表
String s = client.postJson(ZlbUrlConstants.getOrderInfoUrl, getHeaders(zlbTokenInfo.getTokenId()), "{\"curPage\":1,\"maxPage\":10,\"state\":2,\"type\":2}");
log.info("{}订单列表==> \n {}", refundName, s);
//获取当前日期下的orderId
JSONObject jsonObject = JSONObject.parseObject(s);
JSONObject data = jsonObject.getJSONObject("data");
if (data.getInteger("total").equals(0)) {
jntyzxDingTalkFactory.sendMsg("退款失败,请检查是否存在待使用订单-->" + refundName);
return;
}
JSONArray list = data.getJSONArray("list");
for (int i = 0; i < list.size(); i++) {
JSONObject jsonObject1 = list.getJSONObject(i);
String orderId = jsonObject1.getString("orderId");
Integer stadiumId = jsonObject1.getInteger("stadiumId");
String validity = jsonObject1.getString("validity");
log.info("stadiumId:{} ,validity:{},orderId:{}", stadiumId, validity, orderId);
if (stadiumId.equals(49) && validity.contains(day)) {
//拿到订单详情
String orderDetailStr = client.postJson(String.format(ZlbUrlConstants.getOrderDetailUrl, orderId), getHeaders(zlbTokenInfo.getTokenId()), "{}");
log.info("{}订单详情==> \n {}", orderId, orderDetailStr);
JSONObject jsonObject2 = JSONObject.parseObject(orderDetailStr);
JSONObject data1 = jsonObject2.getJSONObject("data");
JSONArray ticketInfos = data1.getJSONArray("ticketInfos");
for (int j = 0; j < ticketInfos.size(); j++) {
JSONObject ticketInfo = ticketInfos.getJSONObject(j);
String detailOrderId = ticketInfo.getString("detailOrderId");
//取消订单
String cancelOrder = client.postJson(ZlbUrlConstants.getOrderRefundUrl, getHeaders(zlbTokenInfo.getTokenId()), String.format(ZlbUrlConstants.refundStr, orderId, detailOrderId));
log.info("{}退款订单==> \n {}", refundName, cancelOrder);
if (cancelOrder.contains("退款成功")) {
jntyzxDingTalkFactory.sendMsg(refundName + "退款成功");
}
}
}
}
}
@Override
public void cancelOrder(String cancelName, String day) throws Exception {
//找到取消人的token
ZlbTokenInfo zlbTokenInfo = zlbTokenInfoService.getOne(new LambdaQueryWrapper<ZlbTokenInfo>().eq(ZlbTokenInfo::getName, cancelName));
if (zlbTokenInfo == null) {
jntyzxDingTalkFactory.sendMsg("取消失败,请检查是否录入取消人登录信息-->" + cancelName);
}
OkHttpUtil client = OkHttpUtil.getInstance();
//获取取消人的订单列表
String s = client.postJson(ZlbUrlConstants.getOrderInfoUrl, getHeaders(zlbTokenInfo.getTokenId()), "{\"curPage\":1,\"maxPage\":10,\"state\":1,\"type\":2}");
log.info("{}订单列表==> \n {}", cancelName, s);
//获取当前日期下的orderId
JSONObject jsonObject = JSONObject.parseObject(s);
JSONObject data = jsonObject.getJSONObject("data");
if (data.getInteger("total").equals(0)) {
jntyzxDingTalkFactory.sendMsg("取消失败,请检查是否存在待使用订单-->" + cancelName);
return;
}
JSONArray list = data.getJSONArray("list");
for (int i = 0; i < list.size(); i++) {
JSONObject jsonObject1 = list.getJSONObject(i);
String orderId = jsonObject1.getString("orderId");
Integer stadiumId = jsonObject1.getInteger("stadiumId");
String validity = jsonObject1.getString("validity");
log.info("stadiumId:{} ,validity:{},orderId:{}", stadiumId, validity, orderId);
if (stadiumId.equals(49) && validity.contains(day)) {
//取消订单,并直接删除redis相关信息
String cancelOrder = client.postJson(ZlbUrlConstants.getOrderCancelUrl, getHeaders(zlbTokenInfo.getTokenId()), String.format(ZlbUrlConstants.cancelStr, orderId));
deleteRedis(orderId);
log.info("{}取消订单==> \n {}", cancelName, cancelOrder);
if (cancelOrder.contains("取消成功")) {
jntyzxDingTalkFactory.sendMsg(cancelName + "取消成功");
}
}
}
}
private String sendPost(OkHttpUtil client, Map<String, String> headers, String encrypt) throws IOException { private String sendPost(OkHttpUtil client, Map<String, String> headers, String encrypt) throws IOException {
String newOrderJson = buildNewOrder(encrypt, client); String newOrderJson = buildNewOrder(encrypt, client);
String response = null; String response = null;
@@ -646,7 +483,7 @@ public class ZlbServiceImpl implements ZlbService {
} }
@Override @Override
public void testJs(String token, String name) throws IOException { public void token(String token, String name) throws IOException {
log.info("获取到name:{},token:{}", name, token); log.info("获取到name:{},token:{}", name, token);
LambdaQueryWrapper<ZlbTokenInfo> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<ZlbTokenInfo> wrapper = Wrappers.lambdaQuery();
wrapper.eq(ZlbTokenInfo::getName, name); wrapper.eq(ZlbTokenInfo::getName, name);

View File

@@ -26,7 +26,7 @@ spring:
aliyun: aliyun:
dns: dns:
rootDomain: xiangtech.xyz rootDomain: xiangtech.top
RR: RR:
- client - client
- file - file

View File

@@ -2,7 +2,7 @@
<configuration scan="true"> <configuration scan="true">
<!-- 应用名称:和统一配置中的项目代码保持一致(小写) --> <!-- 应用名称:和统一配置中的项目代码保持一致(小写) -->
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="X_APP" /> <springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="APP" />
<contextName>${APP_NAME}</contextName> <contextName>${APP_NAME}</contextName>
<!--日志文件保留天数 --> <!--日志文件保留天数 -->
@@ -65,6 +65,23 @@
</filter> </filter>
</appender> </appender>
<appender name="APP_WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${LOG_HOME}/warn-%d{yyyy-MM-dd}.log</FileNamePattern>
<MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%contextName: %d{yyyy-MM-dd HH:mm:ss.SSS} [%c][%t][%L][%p] [traceId:%X{traceId:-},spanId:%X{spanId:-},localIp:%X{localIp:-}] - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 按照每天生成日志文件:主项目日志 --> <!-- 按照每天生成日志文件:主项目日志 -->
<appender name="APP_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="APP_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@@ -90,12 +107,12 @@
<root level="INFO"> <root level="INFO">
<appender-ref ref="APP_DEBUG"/> <appender-ref ref="APP_DEBUG"/>
<appender-ref ref="APP_INFO"/> <appender-ref ref="APP_INFO"/>
<appender-ref ref="APP_WARN"/>
<appender-ref ref="APP_ERROR"/> <appender-ref ref="APP_ERROR"/>
<appender-ref ref="CONSOLE"/> <appender-ref ref="CONSOLE"/>
</root> </root>
<!-- mybatis 日志级别 --> <logger name="com.xiang" level="DEBUG"/>
<logger name="com.xiang" level="INFO"/>
<!-- Spring 框架 --> <!-- Spring 框架 -->
<logger name="org.springframework" level="INFO"/> <logger name="org.springframework" level="INFO"/>