Compare commits
22 Commits
8a302db65a
...
feat/jntyz
| Author | SHA1 | Date | |
|---|---|---|---|
| 44efd5689b | |||
|
|
0f7af30789 | ||
|
|
b4ed93171c | ||
|
|
6902a16cfa | ||
|
|
60992dc4f6 | ||
|
|
cb21b38287 | ||
|
|
268b63e607 | ||
|
|
d1584184ae | ||
|
|
fea069d795 | ||
|
|
b30af008e0 | ||
|
|
76ec2c8b3c | ||
|
|
c61343a238 | ||
|
|
a78da44f23 | ||
|
|
3b596bfa91 | ||
|
|
f1f3268e84 | ||
|
|
9d3db5e1b3 | ||
|
|
833b6fc208 | ||
|
|
04862d861a | ||
|
|
0a8e853753 | ||
|
|
4eeacf8c52 | ||
|
|
c0647b69e2 | ||
|
|
8c4ea440b6 |
23
pom.xml
23
pom.xml
@@ -170,4 +170,27 @@
|
|||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>2.3.0.RELEASE</version>
|
||||||
|
<configuration>
|
||||||
|
<classifier>exec</classifier>
|
||||||
|
<!-- 指定该Main Class为全局的唯一入口 -->
|
||||||
|
<mainClass>com.xiang.Application</mainClass>
|
||||||
|
<layout>ZIP</layout>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -4,8 +4,10 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableScheduling
|
||||||
public class Application {
|
public class Application {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(Application.class);
|
private static final Logger log = LoggerFactory.getLogger(Application.class);
|
||||||
|
|||||||
77
src/main/java/com/xiang/ApplicationInit.java
Normal file
77
src/main/java/com/xiang/ApplicationInit.java
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
package com.xiang;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.xiang.common.enums.RedisKeyConstant;
|
||||||
|
import com.xiang.common.enums.ScheduleEnums;
|
||||||
|
import com.xiang.common.pojo.schedule.ScheduleOpeningConfigDO;
|
||||||
|
import com.xiang.common.service.IScheduleOpeningConfigService;
|
||||||
|
import com.xiang.common.utils.RedisService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.springframework.boot.ApplicationArguments;
|
||||||
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-05-08 14:32
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ApplicationInit implements ApplicationRunner {
|
||||||
|
|
||||||
|
private final IScheduleOpeningConfigService scheduleOpeningConfigService;
|
||||||
|
private final RedisService redisService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
|
|
||||||
|
log.info("开始加载任务配置!");
|
||||||
|
loadScheduleTask();
|
||||||
|
log.info("任务配置加载完成!");
|
||||||
|
|
||||||
|
log.info("redis key 加载开始!");
|
||||||
|
loadRedisKey();
|
||||||
|
log.info("redis key 加载结束!");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadScheduleTask() {
|
||||||
|
List<ScheduleOpeningConfigDO> allSchedules = scheduleOpeningConfigService.getAll();
|
||||||
|
Map<String, ScheduleOpeningConfigDO> map = Maps.newHashMap();
|
||||||
|
if (CollectionUtils.isNotEmpty(allSchedules)) {
|
||||||
|
map.putAll(allSchedules.stream().collect(Collectors.toMap(ScheduleOpeningConfigDO::getBeanName, Function.identity(), (a, b) -> a)));
|
||||||
|
}
|
||||||
|
ScheduleEnums[] enums = ScheduleEnums.values();
|
||||||
|
if (ArrayUtils.isEmpty(enums)) {
|
||||||
|
log.info("暂无需要配置的");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<ScheduleOpeningConfigDO> list = Lists.newArrayList();
|
||||||
|
for (ScheduleEnums scheduleEnum : enums) {
|
||||||
|
if (map.containsKey(scheduleEnum.getTaskName())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ScheduleOpeningConfigDO scheduleOpeningConfigDO = new ScheduleOpeningConfigDO();
|
||||||
|
scheduleOpeningConfigDO.setModule(scheduleEnum.getModuleCode());
|
||||||
|
scheduleOpeningConfigDO.setBeanName(scheduleEnum.getTaskName());
|
||||||
|
scheduleOpeningConfigDO.setStatus(1);
|
||||||
|
list.add(scheduleOpeningConfigDO);
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
scheduleOpeningConfigService.saveBatch(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadRedisKey() {
|
||||||
|
redisService.set(RedisKeyConstant.JNTYZX_SUBSCRIBE_TIME_KEY, "18:00");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
47
src/main/java/com/xiang/common/enums/JntyzxUrlConstant.java
Normal file
47
src/main/java/com/xiang/common/enums/JntyzxUrlConstant.java
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package com.xiang.common.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 13:46
|
||||||
|
*/
|
||||||
|
public class JntyzxUrlConstant {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 江南体育中心基础URL
|
||||||
|
*/
|
||||||
|
private final static String GNTYZX_BASE_URL = "https://jntyzx.cn:8443";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当天的场地信息
|
||||||
|
*/
|
||||||
|
public final static String QUERY_TODAY_SUBSCRIBE_URL = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/getSubscribeByToday";
|
||||||
|
/**
|
||||||
|
* 查询明天场地信息
|
||||||
|
*/
|
||||||
|
public final static String QUERY_TOMORROW_SUBSCRIBE_URL = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/getSubscribeByTomorrow";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅场地
|
||||||
|
*/
|
||||||
|
public final static String ADD_SUBSCRIBE = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/addSubscribe";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单信息
|
||||||
|
*/
|
||||||
|
public final static String ORDER_INFO = GNTYZX_BASE_URL + "/GYM-JN/multi/busiOrder/queryOrderInfo";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 心跳监测接口
|
||||||
|
*/
|
||||||
|
public final static String HEALTH_DECLARATION = GNTYZX_BASE_URL + "/GYM-JN//busi/healthDeclaration/addUserPrivacy";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验会员卡状态
|
||||||
|
*/
|
||||||
|
public final static String CHECK_NUM = GNTYZX_BASE_URL + "/GYM-JN/multi/Subscribe/checkDefaultsNum";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据openId查询会员卡信息
|
||||||
|
*/
|
||||||
|
public final static String QUERY_BY_OPEN_ID = GNTYZX_BASE_URL + "/GYM-JN/multi/xfConsumer/queryByOpenId";
|
||||||
|
}
|
||||||
38
src/main/java/com/xiang/common/enums/RedisKeyConstant.java
Normal file
38
src/main/java/com/xiang/common/enums/RedisKeyConstant.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package com.xiang.common.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xiang.common.utils.DateUtils;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:43
|
||||||
|
*/
|
||||||
|
public class RedisKeyConstant {
|
||||||
|
|
||||||
|
public static final String JNTYZX_ORDER_CREATE_KEY = "jntyzx:order:create:orderId:";
|
||||||
|
|
||||||
|
public static final String JNTUZX_ORDER_PEEK_KEY = "jntyzx:order:peek:user:";
|
||||||
|
|
||||||
|
public static final String JNTYZX_VENUE_MSG_SEND_KEY = "jntyzx:order:venue:msg:send";
|
||||||
|
|
||||||
|
private static final String JNTYZX_VENUE_SUBSCRIBE_KEY = "jntyzx:venue:subscribe:";
|
||||||
|
|
||||||
|
private static final String JNTYZX_ORDER_CLOSE_CARD_KEY = "jntyzx:order:close:card:";
|
||||||
|
|
||||||
|
public static String getCloseCardKey(String username) {
|
||||||
|
return JNTYZX_ORDER_CLOSE_CARD_KEY + username + ":" +getDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getVenueSubscribeKey(String placeName) {
|
||||||
|
return JNTYZX_VENUE_SUBSCRIBE_KEY + placeName + ":" + getDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String JNTYZX_SUBSCRIBE_TIME_KEY = "jntyzx:subscribe:time";
|
||||||
|
|
||||||
|
public static String getDate() {
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
return ":" + DateUtils.getDateFromDate(now);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,18 +10,40 @@ public enum ScheduleEnums {
|
|||||||
/**
|
/**
|
||||||
* 0:glados 1:芬玩岛 2:江体小程序 3:江体zlb 4:DDNS
|
* 0:glados 1:芬玩岛 2:江体小程序 3:江体zlb 4:DDNS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aliyun DDNS任务
|
||||||
|
*/
|
||||||
DOMAIN_DYNAMIC_ANALYSIS_TASK(4, "domain", "domainDynamicAnalysisTask"),
|
DOMAIN_DYNAMIC_ANALYSIS_TASK(4, "domain", "domainDynamicAnalysisTask"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Glados任务
|
||||||
|
*/
|
||||||
GLADOS_CHECK_IN_TASK(0, "glados", "gladosCheckInTask"),
|
GLADOS_CHECK_IN_TASK(0, "glados", "gladosCheckInTask"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 江体 ZLB任务
|
||||||
|
*/
|
||||||
ZLB_LOGIN_TASK(3, "zlb", "zlbLoginTask"),
|
ZLB_LOGIN_TASK(3, "zlb", "zlbLoginTask"),
|
||||||
ZLB_TOKEN_CHECK_TASK(3, "zlb", "zlbTokenCheckTask"),
|
ZLB_TOKEN_CHECK_TASK(3, "zlb", "zlbTokenCheckTask"),
|
||||||
ZLB_SITE_QUERY_TASK(3, "zlb", "zlbSiteQueryTask"),
|
ZLB_SITE_QUERY_TASK(3, "zlb", "zlbSiteQueryTask"),
|
||||||
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"),
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.xiang.common.manage.jntyzx.miniapp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:59
|
||||||
|
*/
|
||||||
|
public interface IOrderCreateInfoManage extends IService<OrderInfoDO> {
|
||||||
|
|
||||||
|
|
||||||
|
List<OrderInfoDO> queryNoPayOrder();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.xiang.common.manage.jntyzx.miniapp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IUserRestrictionManage extends IService<UserRestrictionInfo> {
|
||||||
|
|
||||||
|
UserRestrictionInfo queryByUserId(Long userId);
|
||||||
|
|
||||||
|
List<UserRestrictionInfo> queryByIdList(List<Long> idList);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xiang.common.manage.jntyzx.miniapp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.UserQueryReq;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:19
|
||||||
|
*/
|
||||||
|
public interface IUserTokenInfoManage extends IService<UserTokenInfoDO> {
|
||||||
|
List<UserTokenInfoDO> listUser();
|
||||||
|
UserTokenInfoDO getByName(String name);
|
||||||
|
|
||||||
|
List<UserTokenInfoDO> listCanOrder();
|
||||||
|
|
||||||
|
List<UserTokenInfoDO> queryByList(UserQueryReq req);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.xiang.common.manage.jntyzx.miniapp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 15:50
|
||||||
|
*/
|
||||||
|
public interface IVenueInfoManage extends IService<VenueInfoDO> {
|
||||||
|
|
||||||
|
List<VenueInfoDO> queryByDate(LocalDate date);
|
||||||
|
|
||||||
|
List<VenueInfoDO> queryByType(LocalDate date, Integer type);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.xiang.common.manage.jntyzx.miniapp;
|
||||||
|
|
||||||
|
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.pojo.jntyzx.miniapp.pojo.OrderInfoDO;
|
||||||
|
import com.xiang.common.mapper.JntyzxOrderCreateInfoMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:59
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OrderCreateInfoManageImpl extends ServiceImpl<JntyzxOrderCreateInfoMapper, OrderInfoDO> implements IOrderCreateInfoManage {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OrderInfoDO> queryNoPayOrder() {
|
||||||
|
LambdaQueryWrapper<OrderInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(OrderInfoDO::getOrderStatus, 0);
|
||||||
|
return baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.xiang.common.manage.jntyzx.miniapp;
|
||||||
|
|
||||||
|
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.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo;
|
||||||
|
import com.xiang.common.mapper.JntyzxUserRestrictionInfoMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UserRestrictionManageImpl extends ServiceImpl<JntyzxUserRestrictionInfoMapper, UserRestrictionInfo> implements IUserRestrictionManage {
|
||||||
|
@Override
|
||||||
|
public UserRestrictionInfo queryByUserId(Long userId) {
|
||||||
|
LambdaQueryWrapper<UserRestrictionInfo> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(UserRestrictionInfo::getUserId, userId);
|
||||||
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserRestrictionInfo> queryByIdList(List<Long> idList) {
|
||||||
|
LambdaQueryWrapper<UserRestrictionInfo> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.in(UserRestrictionInfo::getUserId, idList);
|
||||||
|
return baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.xiang.common.manage.jntyzx.miniapp;
|
||||||
|
|
||||||
|
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.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.UserQueryReq;
|
||||||
|
import com.xiang.common.mapper.JntyzxUserTokenInfoMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:19
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UserTokenInfoManageImpl extends ServiceImpl<JntyzxUserTokenInfoMapper, UserTokenInfoDO> implements IUserTokenInfoManage {
|
||||||
|
@Override
|
||||||
|
public List<UserTokenInfoDO> listUser() {
|
||||||
|
LambdaQueryWrapper<UserTokenInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getStatus, 1);
|
||||||
|
return baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserTokenInfoDO getByName(String name) {
|
||||||
|
LambdaQueryWrapper<UserTokenInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getStatus, 1);
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getName, name);
|
||||||
|
lambdaQueryWrapper.last("limit 1");
|
||||||
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserTokenInfoDO> listCanOrder() {
|
||||||
|
LambdaQueryWrapper<UserTokenInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getStatus, 1);
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getIsOrder, 1);
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getIsRestriction, 0);
|
||||||
|
return baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserTokenInfoDO> queryByList(UserQueryReq req) {
|
||||||
|
LambdaQueryWrapper<UserTokenInfoDO> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
if (StringUtils.isNotBlank(req.getName())) {
|
||||||
|
lambdaQueryWrapper.like(UserTokenInfoDO::getName, req.getName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(req.getOpenId())) {
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getOpenId, req.getOpenId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(req.getMemberCardNo())) {
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getMemberCardNo, req.getMemberCardNo());
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(req.getStatus())) {
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getStatus, req.getStatus());
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(req.getIsRestriction())) {
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getIsRestriction, req.getIsRestriction());
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(req.getIsOrder())) {
|
||||||
|
lambdaQueryWrapper.eq(UserTokenInfoDO::getIsOrder, req.getIsOrder());
|
||||||
|
}
|
||||||
|
return baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.xiang.common.manage.jntyzx.miniapp;
|
||||||
|
|
||||||
|
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.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.mapper.JntyzxVenueInfoMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 15:51
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class VenueInfoManageImpl extends ServiceImpl<JntyzxVenueInfoMapper, VenueInfoDO> implements IVenueInfoManage {
|
||||||
|
|
||||||
|
public List<VenueInfoDO> queryByDate(LocalDate date) {
|
||||||
|
LambdaQueryWrapper<VenueInfoDO> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(VenueInfoDO::getDate, date);
|
||||||
|
return baseMapper.selectList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VenueInfoDO> queryByType(LocalDate date, Integer type) {
|
||||||
|
LambdaQueryWrapper<VenueInfoDO> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(VenueInfoDO::getDate, date);
|
||||||
|
lqw.eq(VenueInfoDO::getType, type);
|
||||||
|
return baseMapper.selectList(lqw);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.xiang.common.manage.jntyzx.zlb;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.common.pojo.jntyzx.zlb.ZlbPayOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-05-09 15:11
|
||||||
|
*/
|
||||||
|
public interface IZlbOrderInfoManage extends IService<ZlbPayOrder> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.xiang.common.manage.jntyzx.zlb;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xiang.common.mapper.ZlbOrderInfoMapper;
|
||||||
|
import com.xiang.common.pojo.jntyzx.zlb.ZlbPayOrder;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-05-09 15:11
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ZlbOrderInfoManageImpl extends ServiceImpl<ZlbOrderInfoMapper, ZlbPayOrder> implements IZlbOrderInfoManage {
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
@@ -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;
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author a123
|
* @author a123
|
||||||
* @description 针对表【zlb_token_info】的数据库操作Service
|
* @description 针对表【zlb_token_info】的数据库操作Service
|
||||||
@@ -11,4 +13,6 @@ import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;
|
|||||||
public interface ZlbTokenInfoService extends IService<ZlbTokenInfo> {
|
public interface ZlbTokenInfoService extends IService<ZlbTokenInfo> {
|
||||||
|
|
||||||
ZlbTokenInfo queryByName(String name);
|
ZlbTokenInfo queryByName(String name);
|
||||||
|
|
||||||
|
List<ZlbTokenInfo> getAllUsers();
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
@@ -7,6 +7,8 @@ import com.xiang.common.mapper.ZlbTokenInfoMapper;
|
|||||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;
|
import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author a123
|
* @author a123
|
||||||
* @description 针对表【zlb_token_info】的数据库操作Service实现
|
* @description 针对表【zlb_token_info】的数据库操作Service实现
|
||||||
@@ -22,6 +24,13 @@ public class ZlbTokenInfoServiceImpl extends ServiceImpl<ZlbTokenInfoMapper, Zlb
|
|||||||
wrapper.eq(ZlbTokenInfo::getName, name);
|
wrapper.eq(ZlbTokenInfo::getName, name);
|
||||||
return this.getOne(wrapper);
|
return this.getOne(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ZlbTokenInfo> getAllUsers() {
|
||||||
|
LambdaQueryWrapper<ZlbTokenInfo> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(ZlbTokenInfo::getIsDel, 0);
|
||||||
|
return baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xiang.common.manage.jntyzx.zlb;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ZlbUserInfoService extends IService<ZlbUserInfo> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询日期内未预订的用户
|
||||||
|
* @param date
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ZlbUserInfo> getNoBookUsers(LocalDate date);
|
||||||
|
|
||||||
|
int delAll();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,14 +1,26 @@
|
|||||||
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;
|
||||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;
|
import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ZlbUserInfoServiceImpl extends ServiceImpl<ZlbUserInfoMapper, ZlbUserInfo>
|
public class ZlbUserInfoServiceImpl extends ServiceImpl<ZlbUserInfoMapper, ZlbUserInfo>
|
||||||
implements ZlbUserInfoService {
|
implements ZlbUserInfoService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ZlbUserInfo> getNoBookUsers(LocalDate date) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delAll() {
|
||||||
|
return baseMapper.deleteAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.xiang.common.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.OrderInfoDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:58
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface JntyzxOrderCreateInfoMapper extends BaseMapper<OrderInfoDO> {
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.xiang.common.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserRestrictionInfo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface JntyzxUserRestrictionInfoMapper extends BaseMapper<UserRestrictionInfo> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.xiang.common.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:18
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface JntyzxUserTokenInfoMapper extends BaseMapper<UserTokenInfoDO> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.xiang.common.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 15:48
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface JntyzxVenueInfoMapper extends BaseMapper<VenueInfoDO> {
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ 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.zlb.ZlbUserInfo;
|
import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@@ -9,6 +10,8 @@ import org.springframework.stereotype.Repository;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface ZlbUserInfoMapper extends BaseMapper<ZlbUserInfo> {
|
public interface ZlbUserInfoMapper extends BaseMapper<ZlbUserInfo> {
|
||||||
|
|
||||||
|
@Delete("delete from zlb_user_info where 1=1")
|
||||||
|
int deleteAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.xiang.common.pojo.glados.resp;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-05-08 15:47
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class GladosPointsHistoryResp {
|
||||||
|
|
||||||
|
private String asset;
|
||||||
|
private String balance;
|
||||||
|
private String business;
|
||||||
|
private String change;
|
||||||
|
private String detail;
|
||||||
|
private Long id;
|
||||||
|
private Long time;
|
||||||
|
@JSONField(name = "user_id")
|
||||||
|
private Long userId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.xiang.common.pojo.glados.resp;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-05-08 15:46
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GladosPointsResp {
|
||||||
|
private Integer code;
|
||||||
|
private List<GladosPointsHistoryResp> history;
|
||||||
|
private Plans plans;
|
||||||
|
private String points;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
class Plans {
|
||||||
|
|
||||||
|
private Plan plan100;
|
||||||
|
private Plan plan200;
|
||||||
|
private Plan plan500;
|
||||||
|
}
|
||||||
|
@Data
|
||||||
|
class Plan {
|
||||||
|
private Integer days;
|
||||||
|
private Integer points;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 13:55
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VenueListDTO {
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private String sjName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
private String contacts;
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:57
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("jntyzx_order_create_info")
|
||||||
|
public class OrderInfoDO {
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数
|
||||||
|
*/
|
||||||
|
private String params;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建人
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地号
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属日期
|
||||||
|
*/
|
||||||
|
private LocalDate date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态 (0:待付款,1:已付款)
|
||||||
|
*/
|
||||||
|
private Integer orderStatus;
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("jntyzx_user_restriction")
|
||||||
|
public class UserRestrictionInfo {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 封禁截止时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime restrictionDeadline;
|
||||||
|
/**
|
||||||
|
* 封禁原因
|
||||||
|
*/
|
||||||
|
private String restrictionDesc;
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("jntyzx_user_token_info")
|
||||||
|
public class UserTokenInfoDO {
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wx openid
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0:禁用 1:启用)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否可以下单 (0:否 1:是)
|
||||||
|
*/
|
||||||
|
private Integer isOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
@TableField("member_card_no")
|
||||||
|
private String memberCardNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否封禁 0:否 1:是
|
||||||
|
*/
|
||||||
|
@TableField("is_restriction")
|
||||||
|
private Integer isRestriction;
|
||||||
|
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 15:48
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("jntyzx_venue_info")
|
||||||
|
public class VenueInfoDO {
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 场地名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属日期
|
||||||
|
*/
|
||||||
|
private LocalDate date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地信息三方主键
|
||||||
|
*/
|
||||||
|
private Long placeMainId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地id
|
||||||
|
*/
|
||||||
|
private Integer placeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer scheduleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间范围
|
||||||
|
*/
|
||||||
|
private String sjName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private BigDecimal money;
|
||||||
|
private String className;
|
||||||
|
private String classCode;
|
||||||
|
private String appointments;
|
||||||
|
private String cTypeCode;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 16:34
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SubscribeRequest {
|
||||||
|
private JSONObject jsonObject;
|
||||||
|
private List<SubscribeVo> subscribeVos;
|
||||||
|
private String bookTime;
|
||||||
|
private Integer paymentMethod;
|
||||||
|
private String svCiphertext;
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 16:35
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SubscribeVo {
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private String ballCourtId;
|
||||||
|
|
||||||
|
private String sjName;
|
||||||
|
|
||||||
|
private String scheduleId;
|
||||||
|
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
private int placeId;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String className;
|
||||||
|
|
||||||
|
private String classCode;
|
||||||
|
|
||||||
|
private BigDecimal money;
|
||||||
|
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
private String contactNumber;
|
||||||
|
|
||||||
|
private String memberNumber;
|
||||||
|
|
||||||
|
private String appointments;
|
||||||
|
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
private String beginTime;
|
||||||
|
|
||||||
|
private int specOneTimes;
|
||||||
|
|
||||||
|
private String ctypeCode;
|
||||||
|
|
||||||
|
private int isWhole;
|
||||||
|
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
private int votesnum;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserAddReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
/**
|
||||||
|
* wx openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
private String memberCardNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 0:禁用 1:启用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-03-24 16:40
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserQueryReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wx openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
private String memberCardNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 0:禁用 1:启用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否可以下单 0:否 1:是
|
||||||
|
*/
|
||||||
|
private Integer isOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否封禁 0:否 1:是
|
||||||
|
*/
|
||||||
|
private Integer isRestriction;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserStatusUpdateReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* status
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserTokenUpdateReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UsernameReq {
|
||||||
|
private String username;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-04-09 09:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VenueInfoQueryRequest{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期
|
||||||
|
*/
|
||||||
|
private LocalDate date;
|
||||||
|
/**
|
||||||
|
* 时间段 例如 20:00-21:00
|
||||||
|
*/
|
||||||
|
private String sj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-04-09 10:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class VenueInfoSubscribeRequest {
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class JntyzxResponse<T> {
|
||||||
|
private Boolean success;
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
private T result;
|
||||||
|
|
||||||
|
private Long timestamp;
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-03-24 16:40
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class JtUserVo {
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
/**
|
||||||
|
* wx:openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
/**
|
||||||
|
* 账号状态:
|
||||||
|
* 状态(0:禁用 1:启用)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd Hh:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd Hh:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
/**
|
||||||
|
* 江南体育中心会员卡号
|
||||||
|
*/
|
||||||
|
private String memberCardNo;
|
||||||
|
/**
|
||||||
|
* 是否可以下单
|
||||||
|
*/
|
||||||
|
private Boolean isOrder;
|
||||||
|
/**
|
||||||
|
* 是否封禁
|
||||||
|
*/
|
||||||
|
private Boolean isRestriction;
|
||||||
|
/**
|
||||||
|
* 封禁结束时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd Hh:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd Hh:mm:ss")
|
||||||
|
private LocalDateTime restrictionDeadline;
|
||||||
|
/**
|
||||||
|
* 封禁缘由
|
||||||
|
*/
|
||||||
|
private String restrictionDesc;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 10:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class OrderCreateResp {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String countDownNum;
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-04-09 09:42
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VenueInfoQueryResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场地名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期
|
||||||
|
*/
|
||||||
|
private LocalDate date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间范围
|
||||||
|
*/
|
||||||
|
private String sjName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 价格
|
||||||
|
*/
|
||||||
|
private BigDecimal money;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0:可订购 2:zlb 4:已订购
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
private Long placeMainId;
|
||||||
|
private Integer placeId;
|
||||||
|
private Integer scheduleId;
|
||||||
|
private String className;
|
||||||
|
private String classCode;
|
||||||
|
private String appointments;
|
||||||
|
private String cTypeCode;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:37
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class QueryVenueResponse {
|
||||||
|
private List<TimeList> timeList;
|
||||||
|
|
||||||
|
private List<VenueList> venue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:45
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SitePositionList {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String ballCourtId;
|
||||||
|
|
||||||
|
private String sjName;
|
||||||
|
|
||||||
|
private String scheduleId;
|
||||||
|
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
private Integer placeId;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private String className;
|
||||||
|
|
||||||
|
private String classCode;
|
||||||
|
|
||||||
|
private BigDecimal money;
|
||||||
|
|
||||||
|
private String contacts;
|
||||||
|
|
||||||
|
private String contactNumber;
|
||||||
|
|
||||||
|
private String memberNumber;
|
||||||
|
|
||||||
|
private String appointments;
|
||||||
|
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
private String beginTime;
|
||||||
|
|
||||||
|
private Integer specOneTimes;
|
||||||
|
|
||||||
|
private String ctypeCode;
|
||||||
|
|
||||||
|
private String isWhole;
|
||||||
|
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
private Integer votesnum;
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TimeList {
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String beginTime;
|
||||||
|
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String isenable;
|
||||||
|
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
private String createtime;
|
||||||
|
|
||||||
|
private String remarks;
|
||||||
|
|
||||||
|
private String default01;
|
||||||
|
private String default02;
|
||||||
|
private String default03;
|
||||||
|
private String votesnum;
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp.query;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class UserInfoResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
private String consCard;
|
||||||
|
/**
|
||||||
|
* 姓名
|
||||||
|
*/
|
||||||
|
private String consName;
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
private String consSex;
|
||||||
|
/**
|
||||||
|
* 身份证号
|
||||||
|
*/
|
||||||
|
private String consIdCard;
|
||||||
|
/**
|
||||||
|
* 固定电话
|
||||||
|
*/
|
||||||
|
private String consTel;
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
private String consHandSet;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String consUnit;
|
||||||
|
/**
|
||||||
|
* 照片
|
||||||
|
*/
|
||||||
|
private String consPhoto;
|
||||||
|
private Integer consWaste;
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
private String consNumber;
|
||||||
|
private BigDecimal consMin;
|
||||||
|
private Integer consProp;
|
||||||
|
/**
|
||||||
|
* 注册年
|
||||||
|
*/
|
||||||
|
private String consYear;
|
||||||
|
/**
|
||||||
|
* 注册月
|
||||||
|
*/
|
||||||
|
private String consMonth;
|
||||||
|
/**
|
||||||
|
* 注册日
|
||||||
|
*/
|
||||||
|
private String consDay;
|
||||||
|
private boolean consIflag;
|
||||||
|
/**
|
||||||
|
* 注册时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime consTimes;
|
||||||
|
/**
|
||||||
|
* openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String photoUrl;
|
||||||
|
/**
|
||||||
|
* 会员
|
||||||
|
*/
|
||||||
|
private Integer consVip;
|
||||||
|
/**
|
||||||
|
* 会员等级号
|
||||||
|
*/
|
||||||
|
private String consVipCode;
|
||||||
|
|
||||||
|
private String eleCardNum;
|
||||||
|
private Integer appointmentEligibility;
|
||||||
|
/**
|
||||||
|
* 封禁截止日期
|
||||||
|
*/
|
||||||
|
@JSONField(name = "restrictionDeadline")
|
||||||
|
private String restrictionDeadline;
|
||||||
|
/**
|
||||||
|
* 封禁原因
|
||||||
|
*/
|
||||||
|
private String restrictionDescription;
|
||||||
|
/**
|
||||||
|
* 封禁截止日期
|
||||||
|
*/
|
||||||
|
@JSONField(name = "RestrictionDeadline")
|
||||||
|
private String RestrictionDeadline2;
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xiang.common.pojo.jntyzx.miniapp.resp.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class VenueList {
|
||||||
|
|
||||||
|
private Integer placeId;
|
||||||
|
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
private List<SitePositionList> sitePosition;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -20,6 +20,8 @@ public class ZlbTokenInfo {
|
|||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer loginInfoId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ public class ZlbUserInfo {
|
|||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer loginInfoId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface IScheduleOpeningConfigService extends IService<ScheduleOpeningConfigDO> {
|
public interface IScheduleOpeningConfigService extends IService<ScheduleOpeningConfigDO> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有未删除的任务
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ScheduleOpeningConfigDO> getAll();
|
||||||
/**
|
/**
|
||||||
* 根据模块id和任务名称查询
|
* 根据模块id和任务名称查询
|
||||||
* @param moduleCode
|
* @param moduleCode
|
||||||
|
|||||||
@@ -7,9 +7,16 @@ import com.xiang.common.mapper.ScheduleOpeningConfigDao;
|
|||||||
import com.xiang.common.pojo.schedule.ScheduleOpeningConfigDO;
|
import com.xiang.common.pojo.schedule.ScheduleOpeningConfigDO;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ScheduleOpeningConfigServiceImpl extends ServiceImpl<ScheduleOpeningConfigDao, ScheduleOpeningConfigDO> implements IScheduleOpeningConfigService {
|
public class ScheduleOpeningConfigServiceImpl extends ServiceImpl<ScheduleOpeningConfigDao, ScheduleOpeningConfigDO> implements IScheduleOpeningConfigService {
|
||||||
|
@Override
|
||||||
|
public List<ScheduleOpeningConfigDO> getAll() {
|
||||||
|
return baseMapper.selectList(Wrappers.lambdaQuery());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScheduleOpeningConfigDO getConfigByModule(Integer moduleCode, String taskName) {
|
public ScheduleOpeningConfigDO getConfigByModule(Integer moduleCode, String taskName) {
|
||||||
LambdaQueryWrapper<ScheduleOpeningConfigDO> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<ScheduleOpeningConfigDO> lqw = Wrappers.lambdaQuery();
|
||||||
|
|||||||
253
src/main/java/com/xiang/common/utils/Base64.java
Normal file
253
src/main/java/com/xiang/common/utils/Base64.java
Normal file
@@ -0,0 +1,253 @@
|
|||||||
|
package com.xiang.common.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base64工具类
|
||||||
|
*
|
||||||
|
* @author xiang
|
||||||
|
*/
|
||||||
|
public final class Base64 {
|
||||||
|
static private final int BASELENGTH = 128;
|
||||||
|
static private final int LOOKUPLENGTH = 64;
|
||||||
|
static private final int TWENTYFOURBITGROUP = 24;
|
||||||
|
static private final int EIGHTBIT = 8;
|
||||||
|
static private final int SIXTEENBIT = 16;
|
||||||
|
static private final int FOURBYTE = 4;
|
||||||
|
static private final int SIGN = -128;
|
||||||
|
static private final char PAD = '=';
|
||||||
|
static final private byte[] base64Alphabet = new byte[BASELENGTH];
|
||||||
|
static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH];
|
||||||
|
|
||||||
|
static {
|
||||||
|
for (int i = 0; i < BASELENGTH; ++i) {
|
||||||
|
base64Alphabet[i] = -1;
|
||||||
|
}
|
||||||
|
for (int i = 'Z'; i >= 'A'; i--) {
|
||||||
|
base64Alphabet[i] = (byte) (i - 'A');
|
||||||
|
}
|
||||||
|
for (int i = 'z'; i >= 'a'; i--) {
|
||||||
|
base64Alphabet[i] = (byte) (i - 'a' + 26);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = '9'; i >= '0'; i--) {
|
||||||
|
base64Alphabet[i] = (byte) (i - '0' + 52);
|
||||||
|
}
|
||||||
|
|
||||||
|
base64Alphabet['+'] = 62;
|
||||||
|
base64Alphabet['/'] = 63;
|
||||||
|
|
||||||
|
for (int i = 0; i <= 25; i++) {
|
||||||
|
lookUpBase64Alphabet[i] = (char) ('A' + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 26, j = 0; i <= 51; i++, j++) {
|
||||||
|
lookUpBase64Alphabet[i] = (char) ('a' + j);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 52, j = 0; i <= 61; i++, j++) {
|
||||||
|
lookUpBase64Alphabet[i] = (char) ('0' + j);
|
||||||
|
}
|
||||||
|
lookUpBase64Alphabet[62] = '+';
|
||||||
|
lookUpBase64Alphabet[63] = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isWhiteSpace(char octect) {
|
||||||
|
return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isPad(char octect) {
|
||||||
|
return (octect == PAD);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isData(char octect) {
|
||||||
|
return (octect < BASELENGTH && base64Alphabet[octect] != -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes hex octects into Base64
|
||||||
|
*
|
||||||
|
* @param binaryData Array containing binaryData
|
||||||
|
* @return Encoded Base64 array
|
||||||
|
*/
|
||||||
|
public static String encode(byte[] binaryData) {
|
||||||
|
if (binaryData == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lengthDataBits = binaryData.length * EIGHTBIT;
|
||||||
|
if (lengthDataBits == 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
|
||||||
|
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
|
||||||
|
int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
|
||||||
|
char[] encodedData = null;
|
||||||
|
|
||||||
|
encodedData = new char[numberQuartet * 4];
|
||||||
|
|
||||||
|
byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
|
||||||
|
|
||||||
|
int encodedIndex = 0;
|
||||||
|
int dataIndex = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < numberTriplets; i++) {
|
||||||
|
b1 = binaryData[dataIndex++];
|
||||||
|
b2 = binaryData[dataIndex++];
|
||||||
|
b3 = binaryData[dataIndex++];
|
||||||
|
|
||||||
|
l = (byte) (b2 & 0x0f);
|
||||||
|
k = (byte) (b1 & 0x03);
|
||||||
|
|
||||||
|
byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
|
||||||
|
byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
|
||||||
|
byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc);
|
||||||
|
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f];
|
||||||
|
}
|
||||||
|
|
||||||
|
// form integral number of 6-bit groups
|
||||||
|
if (fewerThan24bits == EIGHTBIT) {
|
||||||
|
b1 = binaryData[dataIndex];
|
||||||
|
k = (byte) (b1 & 0x03);
|
||||||
|
byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4];
|
||||||
|
encodedData[encodedIndex++] = PAD;
|
||||||
|
encodedData[encodedIndex++] = PAD;
|
||||||
|
} else if (fewerThan24bits == SIXTEENBIT) {
|
||||||
|
b1 = binaryData[dataIndex];
|
||||||
|
b2 = binaryData[dataIndex + 1];
|
||||||
|
l = (byte) (b2 & 0x0f);
|
||||||
|
k = (byte) (b1 & 0x03);
|
||||||
|
|
||||||
|
byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
|
||||||
|
byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
|
||||||
|
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
|
||||||
|
encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2];
|
||||||
|
encodedData[encodedIndex++] = PAD;
|
||||||
|
}
|
||||||
|
return new String(encodedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decodes Base64 data into octects
|
||||||
|
*
|
||||||
|
* @param encoded string containing Base64 data
|
||||||
|
* @return Array containind decoded data.
|
||||||
|
*/
|
||||||
|
public static byte[] decode(String encoded) {
|
||||||
|
if (encoded == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
char[] base64Data = encoded.toCharArray();
|
||||||
|
// remove white spaces
|
||||||
|
int len = removeWhiteSpace(base64Data);
|
||||||
|
|
||||||
|
if (len % FOURBYTE != 0) {
|
||||||
|
return null;// should be divisible by four
|
||||||
|
}
|
||||||
|
|
||||||
|
int numberQuadruple = (len / FOURBYTE);
|
||||||
|
|
||||||
|
if (numberQuadruple == 0) {
|
||||||
|
return new byte[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] decodedData = null;
|
||||||
|
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
|
||||||
|
char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
int encodedIndex = 0;
|
||||||
|
int dataIndex = 0;
|
||||||
|
decodedData = new byte[(numberQuadruple) * 3];
|
||||||
|
|
||||||
|
for (; i < numberQuadruple - 1; i++) {
|
||||||
|
|
||||||
|
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))
|
||||||
|
|| !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) {
|
||||||
|
return null;
|
||||||
|
} // if found "no data" just return null
|
||||||
|
|
||||||
|
b1 = base64Alphabet[d1];
|
||||||
|
b2 = base64Alphabet[d2];
|
||||||
|
b3 = base64Alphabet[d3];
|
||||||
|
b4 = base64Alphabet[d4];
|
||||||
|
|
||||||
|
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
|
||||||
|
decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
|
||||||
|
decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) {
|
||||||
|
return null;// if found "no data" just return null
|
||||||
|
}
|
||||||
|
|
||||||
|
b1 = base64Alphabet[d1];
|
||||||
|
b2 = base64Alphabet[d2];
|
||||||
|
|
||||||
|
d3 = base64Data[dataIndex++];
|
||||||
|
d4 = base64Data[dataIndex++];
|
||||||
|
if (!isData((d3)) || !isData((d4))) {// Check if they are PAD characters
|
||||||
|
if (isPad(d3) && isPad(d4)) {
|
||||||
|
if ((b2 & 0xf) != 0)// last 4 bits should be zero
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
byte[] tmp = new byte[i * 3 + 1];
|
||||||
|
System.arraycopy(decodedData, 0, tmp, 0, i * 3);
|
||||||
|
tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
|
||||||
|
return tmp;
|
||||||
|
} else if (!isPad(d3) && isPad(d4)) {
|
||||||
|
b3 = base64Alphabet[d3];
|
||||||
|
if ((b3 & 0x3) != 0)// last 2 bits should be zero
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
byte[] tmp = new byte[i * 3 + 2];
|
||||||
|
System.arraycopy(decodedData, 0, tmp, 0, i * 3);
|
||||||
|
tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
|
||||||
|
tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
|
||||||
|
return tmp;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else { // No PAD e.g 3cQl
|
||||||
|
b3 = base64Alphabet[d3];
|
||||||
|
b4 = base64Alphabet[d4];
|
||||||
|
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
|
||||||
|
decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
|
||||||
|
decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
|
||||||
|
|
||||||
|
}
|
||||||
|
return decodedData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remove WhiteSpace from MIME containing encoded Base64 data.
|
||||||
|
*
|
||||||
|
* @param data the byte array of base64 data (with WS)
|
||||||
|
* @return the new length
|
||||||
|
*/
|
||||||
|
private static int removeWhiteSpace(char[] data) {
|
||||||
|
if (data == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// count characters that's not whitespace
|
||||||
|
int newSize = 0;
|
||||||
|
int len = data.length;
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
if (!isWhiteSpace(data[i])) {
|
||||||
|
data[newSize++] = data[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ package com.xiang.common.utils;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.xiang.common.enums.DateFormatEnum;
|
import com.xiang.common.enums.DateFormatEnum;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.xml.datatype.DatatypeConfigurationException;
|
import javax.xml.datatype.DatatypeConfigurationException;
|
||||||
import javax.xml.datatype.DatatypeFactory;
|
import javax.xml.datatype.DatatypeFactory;
|
||||||
@@ -11,6 +13,8 @@ import java.text.ParseException;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -22,72 +26,20 @@ import java.util.concurrent.TimeUnit;
|
|||||||
*/
|
*/
|
||||||
public class DateUtils {
|
public class DateUtils {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(DateUtils.class);
|
||||||
|
|
||||||
/**
|
|
||||||
* 构造函数.
|
|
||||||
*/
|
|
||||||
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<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -134,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:
|
||||||
@@ -603,4 +560,56 @@ public class DateUtils {
|
|||||||
public static Date setModifiedDate(String key, Date date) {
|
public static Date setModifiedDate(String key, Date date) {
|
||||||
return modifiedDate.put(key, date);
|
return modifiedDate.put(key, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LocalDateTime getDateTimeFromStr(String dateStr) {
|
||||||
|
return getDateTimeFromStr(dateStr, "yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDateTime getDateTimeFromStr(String dateStr, String pattern) {
|
||||||
|
return LocalDateTime.parse(dateStr, DateTimeFormatter.ofPattern(pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDate getDateFromStr(String dataStr) {
|
||||||
|
return getDateFromStr(dataStr, "yyyy-MM-dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDate getDateFromStr(String dataStr, String pattern) {
|
||||||
|
return LocalDate.parse(dataStr, DateTimeFormatter.ofPattern(pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDateFromDate(LocalDate date) {
|
||||||
|
return getDateFromDate(date, "yyyy-MM-dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDateFromDate(LocalDate date, String pattern) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
return date.format(formatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDateTimeFromDateTime(LocalDateTime dateTime) {
|
||||||
|
return getDateTimeFromDateTime(dateTime, "yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDateTimeFromDateTime(LocalDateTime dateTime, String pattern) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
return dateTime.format(formatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDateTime getTimeFromStr(String date, String time) {
|
||||||
|
String dateTimeStr = date + " " + time;
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
return LocalDateTime.parse(dateTimeStr, formatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean validWeekTime() {
|
||||||
|
if (!Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) && !Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||||
|
LocalTime now = LocalTime.now();
|
||||||
|
boolean inMorning = now.isAfter(LocalTime.of(9, 29)) && now.isBefore(LocalTime.of(11, 31));
|
||||||
|
boolean inAfternoon = now.isAfter(LocalTime.of(12, 59)) && now.isBefore(LocalTime.of(15, 1));
|
||||||
|
return !inAfternoon && !inMorning ? true : false;
|
||||||
|
} else {
|
||||||
|
logger.info("当前时间为:{}", LocalDateTime.now());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
18
src/main/java/com/xiang/common/utils/JsonUtils.java
Normal file
18
src/main/java/com/xiang/common/utils/JsonUtils.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -20,4 +20,7 @@ public class GladosConstants {
|
|||||||
* 签到请求体
|
* 签到请求体
|
||||||
*/
|
*/
|
||||||
public static final String GLADOS_CHECK_IN_BODY = "{\"token\":\"glados.cloud\"}";
|
public static final String GLADOS_CHECK_IN_BODY = "{\"token\":\"glados.cloud\"}";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String GLADOS_POINTS_LIST_URL = GLADOS_URL_PREFIX + "/api/user/points";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -2,17 +2,15 @@ package com.xiang.service.module.glados.service;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.alibaba.fastjson2.TypeReference;
|
import com.alibaba.fastjson2.TypeReference;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.xiang.common.factory.ScriptDingTalkFactory;
|
import com.xiang.common.factory.ScriptDingTalkFactory;
|
||||||
import com.xiang.common.pojo.glados.GladosRunLogDO;
|
|
||||||
import com.xiang.common.pojo.glados.GladosUserDO;
|
import com.xiang.common.pojo.glados.GladosUserDO;
|
||||||
import com.xiang.common.pojo.glados.resp.CheckInResp;
|
import com.xiang.common.pojo.glados.resp.CheckInResp;
|
||||||
import com.xiang.common.pojo.glados.resp.GLaDOSResponse;
|
import com.xiang.common.pojo.glados.resp.GLaDOSResponse;
|
||||||
|
import com.xiang.common.pojo.glados.resp.GladosPointsResp;
|
||||||
import com.xiang.common.pojo.schedule.TaskResult;
|
import com.xiang.common.pojo.schedule.TaskResult;
|
||||||
import com.xiang.common.utils.HttpService;
|
import com.xiang.common.utils.HttpService;
|
||||||
import com.xiang.service.module.glados.constants.GladosConstants;
|
import com.xiang.service.module.glados.constants.GladosConstants;
|
||||||
import com.xiang.service.module.glados.manage.IGladosRunLogManage;
|
|
||||||
import com.xiang.service.module.glados.manage.IGladosUserManage;
|
import com.xiang.service.module.glados.manage.IGladosUserManage;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -86,14 +84,44 @@ public class GLaDOSServiceImpl implements IGLaDOSService {
|
|||||||
checkInV2(gladosUserDO, new StringBuilder());
|
checkInV2(gladosUserDO, new StringBuilder());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkInV2(GladosUserDO user, StringBuilder sb) {
|
private GladosPointsResp pointsList(GladosUserDO user) {
|
||||||
Map<String, String> header = Maps.newHashMap();
|
Map<String, String> header = Maps.newHashMap();
|
||||||
header.put("Cookie", user.getCookie());
|
header.put("Cookie", user.getCookie());
|
||||||
|
|
||||||
String response = null;
|
String response = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
response = HttpService.doGet(GladosConstants.GLADOS_POINTS_LIST_URL, header, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("http请求异常:{}", user.getEmail());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (org.apache.commons.lang3.StringUtils.isBlank(response)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
GladosPointsResp gLaDOSResponse = JSONObject.parseObject(response, new TypeReference<GladosPointsResp>() {
|
||||||
|
});
|
||||||
|
if (Objects.isNull(gLaDOSResponse)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == gLaDOSResponse.getCode()) {
|
||||||
|
// 成功请求
|
||||||
|
return gLaDOSResponse;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkInV2(GladosUserDO user, StringBuilder sb) {
|
||||||
|
Map<String, String> header = Maps.newHashMap();
|
||||||
|
header.put("Cookie", user.getCookie());
|
||||||
|
|
||||||
|
String response = null;
|
||||||
|
GladosPointsResp gladosPointsResp = null;
|
||||||
try {
|
try {
|
||||||
response = HttpService.doPost(GladosConstants.GLADOS_CHECK_IN_URL, header, GladosConstants.GLADOS_CHECK_IN_BODY);
|
response = HttpService.doPost(GladosConstants.GLADOS_CHECK_IN_URL, header, GladosConstants.GLADOS_CHECK_IN_BODY);
|
||||||
|
gladosPointsResp = pointsList(user);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("http请求异常:{}", user.getEmail());
|
log.error("http请求异常:{}", user.getEmail());
|
||||||
return false;
|
return false;
|
||||||
@@ -113,9 +141,13 @@ public class GLaDOSServiceImpl implements IGLaDOSService {
|
|||||||
if (0 == gLaDOSResponse.getCode()) {
|
if (0 == gLaDOSResponse.getCode()) {
|
||||||
// 成功请求
|
// 成功请求
|
||||||
if (Objects.nonNull(gLaDOSResponse.getPoints()) && 0 != gLaDOSResponse.getPoints()) {
|
if (Objects.nonNull(gLaDOSResponse.getPoints()) && 0 != gLaDOSResponse.getPoints()) {
|
||||||
|
String points = null;
|
||||||
|
if (Objects.nonNull(gladosPointsResp)) {
|
||||||
|
points = gladosPointsResp.getPoints();
|
||||||
|
}
|
||||||
// 签到成功
|
// 签到成功
|
||||||
dingTalkService.sendMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
|
dingTalkService.sendMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
|
||||||
user.getEmail() + "签到成功,获得积分:" + gLaDOSResponse.getPoints());
|
user.getEmail() + "签到成功,获得积分:" + gLaDOSResponse.getPoints() + ",可用积分数量:" + points);
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.xiang.service.module.glados.service;
|
package com.xiang.service.module.glados.service;
|
||||||
|
|
||||||
import com.xiang.common.pojo.glados.GladosUserDO;
|
|
||||||
import com.xiang.common.pojo.schedule.TaskResult;
|
import com.xiang.common.pojo.schedule.TaskResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service;
|
||||||
|
|
||||||
|
|
||||||
|
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.OrderCreateResp;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.UserInfoResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 14:47
|
||||||
|
*/
|
||||||
|
public interface IJntyzxHttpService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询今日可用场地
|
||||||
|
*/
|
||||||
|
List<SitePositionList> queryAvailable(String isWeekend, String token);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询明日可用场地
|
||||||
|
* @param isWeekend
|
||||||
|
* @param token
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SitePositionList> queryAvailableTomorrow(String isWeekend, String token);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JntyzxResponse<OrderCreateResp> createOrder(List<VenueInfoDO> venueInfos, String token, String openId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 心跳监测
|
||||||
|
* @param token token
|
||||||
|
* @param openId openid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JntyzxResponse healthDeclaration(String token, String openId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据openid查询
|
||||||
|
* @param token token
|
||||||
|
* @param openId openId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JntyzxResponse<UserInfoResponse> queryByOpenId(String token, String openId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验会员卡状态
|
||||||
|
* @param token token
|
||||||
|
* @param cardNo 会员卡号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JntyzxResponse checkDefaultNums(String token, String cardNo);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service;
|
||||||
|
|
||||||
|
|
||||||
|
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.VenueInfoDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 16:17
|
||||||
|
*/
|
||||||
|
public interface IJtOrderService {
|
||||||
|
|
||||||
|
boolean createOrder(List<VenueInfoDO> venueInfoDOS, UserTokenInfoDO userTokenInfoDO);
|
||||||
|
|
||||||
|
List<OrderInfoDO> queryNoPayOrder();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.UserTokenInfoDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:22
|
||||||
|
*/
|
||||||
|
public interface IUserTokenInfoService {
|
||||||
|
|
||||||
|
List<UserTokenInfoDO> getAvailableUser();
|
||||||
|
List<UserTokenInfoDO> getCanOrderUser();
|
||||||
|
String getToken(String name);
|
||||||
|
boolean flushSingleToken(String name);
|
||||||
|
boolean flushToken();
|
||||||
|
boolean updateTokenByName(String name, String token);
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-15 16:07
|
||||||
|
*/
|
||||||
|
public interface IVenueService {
|
||||||
|
|
||||||
|
List<SitePositionList> queryVenueService();
|
||||||
|
List<SitePositionList> queryTomorrowVenue();
|
||||||
|
List<VenueInfoDO> queryCanBuyVenue();
|
||||||
|
List<VenueInfoDO> queryTomorrowCanBuyVenue();
|
||||||
|
List<VenueInfoDO> queryToday6210VenueInfo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新场地信息
|
||||||
|
* @param sitePositionLists
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean saveOrUpdateTodayVenueInfo(List<SitePositionList> sitePositionLists);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新第二天的场地信息
|
||||||
|
* @param sitePositionLists
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean saveTomorrowVenueInfo(List<SitePositionList> sitePositionLists);
|
||||||
|
}
|
||||||
@@ -0,0 +1,227 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.alibaba.fastjson2.TypeReference;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.SubscribeRequest;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.req.SubscribeVo;
|
||||||
|
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.query.SitePositionList;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.UserInfoResponse;
|
||||||
|
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.enums.JntyzxUrlConstant;
|
||||||
|
import com.xiang.common.manage.jntyzx.miniapp.IOrderCreateInfoManage;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.service.IJntyzxHttpService;
|
||||||
|
import com.xiang.service.module.jntyzx.miniapp.utils.JntyzxSaltEncodeUtils;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-05-14 14:07
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class JntyzxHttpServiceImpl implements IJntyzxHttpService {
|
||||||
|
|
||||||
|
private final RedisService redisService;
|
||||||
|
private final IOrderCreateInfoManage orderCreateInfoManage;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SitePositionList> queryAvailable(String isWeekend, String token) {
|
||||||
|
String url = JntyzxUrlConstant.QUERY_TODAY_SUBSCRIBE_URL;
|
||||||
|
return querySitePositionInfo(isWeekend, token, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static List<SitePositionList> querySitePositionInfo(String isWeekend, String token, String url) {
|
||||||
|
Map<String, String> header = Maps.newHashMap();
|
||||||
|
header.put("X-Access-Token", token);
|
||||||
|
String resp = null;
|
||||||
|
Map<String, String> params = Maps.newHashMap();
|
||||||
|
params.put("gid", "03");
|
||||||
|
params.put("isWeekend", isWeekend);
|
||||||
|
try {
|
||||||
|
resp = HttpService.doGet(url, header, params);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("[doGet] 江南体育中心查询当天场地 请求失败, url:{}", url);
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(resp)) {
|
||||||
|
log.warn("[查询场地] 江南体育中心查询当天场地 请求结果为空, url:{}, resp:{}", url, resp);
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSON.parseObject(resp);
|
||||||
|
if (Objects.isNull(jsonObject)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
String resultStr = JSON.toJSONString(jsonObject.get("result"));
|
||||||
|
if (StringUtils.isBlank(resultStr)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
JSONObject result = JSON.parseObject(resultStr);
|
||||||
|
if (Objects.isNull(result)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
String venueStr = JSON.toJSONString(result.get("venue"));
|
||||||
|
if (StringUtils.isBlank(venueStr)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
List<VenueList> venueLists = JSON.parseArray(venueStr, VenueList.class);
|
||||||
|
if (CollectionUtils.isEmpty(venueLists)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
List<SitePositionList> res = Lists.newArrayList();
|
||||||
|
for (VenueList venueList : venueLists) {
|
||||||
|
List<SitePositionList> sitePositionList = venueList.getSitePosition();
|
||||||
|
if (CollectionUtils.isEmpty(sitePositionList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
res.addAll(sitePositionList);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SitePositionList> queryAvailableTomorrow(String isWeekend, String token) {
|
||||||
|
String url = JntyzxUrlConstant.QUERY_TOMORROW_SUBSCRIBE_URL;
|
||||||
|
return querySitePositionInfo(isWeekend, token, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JntyzxResponse<OrderCreateResp> createOrder(List<VenueInfoDO> venueInfos, String token, String openId) {
|
||||||
|
List<SubscribeVo> vos = Lists.newArrayList();
|
||||||
|
for (VenueInfoDO venueInfo : venueInfos) {
|
||||||
|
SubscribeVo subscribeVo = new SubscribeVo();
|
||||||
|
subscribeVo.setId(0);
|
||||||
|
subscribeVo.setBallCourtId("03");
|
||||||
|
subscribeVo.setSjName(venueInfo.getSjName());
|
||||||
|
subscribeVo.setScheduleId(String.valueOf(venueInfo.getScheduleId()));
|
||||||
|
subscribeVo.setPlaceName(venueInfo.getPlaceName());
|
||||||
|
subscribeVo.setPlaceId(venueInfo.getPlaceId());
|
||||||
|
subscribeVo.setType("0");
|
||||||
|
subscribeVo.setClassName(venueInfo.getClassName());
|
||||||
|
subscribeVo.setClassCode(venueInfo.getClassCode());
|
||||||
|
subscribeVo.setMoney(venueInfo.getMoney().setScale(0));
|
||||||
|
subscribeVo.setContacts("0");
|
||||||
|
subscribeVo.setContactNumber(null);
|
||||||
|
subscribeVo.setMemberNumber(null);
|
||||||
|
subscribeVo.setAppointments(venueInfo.getAppointments());
|
||||||
|
subscribeVo.setOperator(null);
|
||||||
|
subscribeVo.setEndTime(null);
|
||||||
|
subscribeVo.setBeginTime(null);
|
||||||
|
subscribeVo.setSpecOneTimes(3);
|
||||||
|
subscribeVo.setCtypeCode(venueInfo.getCTypeCode());
|
||||||
|
subscribeVo.setIsWhole(0);
|
||||||
|
subscribeVo.setOrderId(null);
|
||||||
|
subscribeVo.setVotesnum(1);
|
||||||
|
vos.add(subscribeVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject jsonObject = buildParamJsonObj(openId);
|
||||||
|
SubscribeRequest subscribeRequest = new SubscribeRequest();
|
||||||
|
|
||||||
|
subscribeRequest.setSubscribeVos(vos);
|
||||||
|
subscribeRequest.setBookTime(venueInfos.get(0).getAppointments());
|
||||||
|
subscribeRequest.setPaymentMethod(1);
|
||||||
|
subscribeRequest.setSvCiphertext(JntyzxSaltEncodeUtils.sonAddSalt(JsonUtils.toJsonString(vos)));
|
||||||
|
subscribeRequest.setJsonObject(jsonObject);
|
||||||
|
|
||||||
|
Map<String, String> params = Maps.newHashMap();
|
||||||
|
params.put("X-Access-Token", token);
|
||||||
|
String resp = HttpService.doPost(JntyzxUrlConstant.ADD_SUBSCRIBE, params, JsonUtils.toJsonString(subscribeRequest));
|
||||||
|
log.info("[江体小程序] 羽毛球场地下单响应结果:{}", resp);
|
||||||
|
if (StringUtils.isBlank(resp)) {
|
||||||
|
log.info("[resp] 请求结果为空");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
JntyzxResponse<OrderCreateResp> response = JSON.parseObject(resp, new TypeReference<JntyzxResponse<OrderCreateResp>>() {
|
||||||
|
});
|
||||||
|
if (Objects.isNull(response)) {
|
||||||
|
log.info("[res ==> response] 请求结果为空");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public JntyzxResponse healthDeclaration(String token, String openId) {
|
||||||
|
Map<String, String> headers = Maps.newHashMap();
|
||||||
|
headers.put("X-Access-Token", token);
|
||||||
|
Map<String, String> params = Maps.newHashMap();
|
||||||
|
params.put("openId", openId);
|
||||||
|
|
||||||
|
String respStr = HttpService.doGet(JntyzxUrlConstant.HEALTH_DECLARATION, headers, params);
|
||||||
|
if (StringUtils.isBlank(respStr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSON.parseObject(respStr, JntyzxResponse.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JntyzxResponse<UserInfoResponse> queryByOpenId(String token, String openId) {
|
||||||
|
Map<String, String> params = Maps.newHashMap();
|
||||||
|
params.put("openId", openId);
|
||||||
|
Map<String, String> headers = Maps.newHashMap();
|
||||||
|
headers.put("X-Access-Token", token);
|
||||||
|
|
||||||
|
String resp = HttpService.doGet(JntyzxUrlConstant.QUERY_BY_OPEN_ID, headers, params);
|
||||||
|
JntyzxResponse<UserInfoResponse> response = JSON.parseObject(resp, new TypeReference<JntyzxResponse<UserInfoResponse>>() {
|
||||||
|
});
|
||||||
|
if (Objects.isNull(response)) {
|
||||||
|
log.info("请求结果为空!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JntyzxResponse checkDefaultNums(String token, String cardNo) {
|
||||||
|
Map<String, String> params = Maps.newHashMap();
|
||||||
|
params.put("consNumber", cardNo);
|
||||||
|
Map<String, String> headers = Maps.newHashMap();
|
||||||
|
headers.put("X-Access-Token", token);
|
||||||
|
|
||||||
|
String resp = HttpService.doGet(JntyzxUrlConstant.CHECK_NUM, headers, params);
|
||||||
|
if (StringUtils.isBlank(resp)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSON.parseObject(resp, JntyzxResponse.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JSONObject buildParamJsonObj(String openId) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("id", "1702581215097257986");
|
||||||
|
jsonObject.put("createBy", null);
|
||||||
|
jsonObject.put("createTime", "2023-09-15 15:12:48");
|
||||||
|
jsonObject.put("updateBy", null);
|
||||||
|
jsonObject.put("updateTime", null);
|
||||||
|
jsonObject.put("sysOrgCode", null);
|
||||||
|
jsonObject.put("openId", openId);
|
||||||
|
jsonObject.put("nickName", "1");
|
||||||
|
jsonObject.put("unionId", null);
|
||||||
|
jsonObject.put("avatarUrl", "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132");
|
||||||
|
jsonObject.put("remarks", null);
|
||||||
|
jsonObject.put("default01", null);
|
||||||
|
jsonObject.put("default02", null);
|
||||||
|
jsonObject.put("default03", null);
|
||||||
|
jsonObject.put("default04", null);
|
||||||
|
jsonObject.put("default05", null);
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
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.UserTokenInfoDO;
|
||||||
|
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.OrderCreateResp;
|
||||||
|
import com.xiang.common.utils.RedisService;
|
||||||
|
import com.xiang.common.enums.RedisKeyConstant;
|
||||||
|
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.IJtOrderService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 16:17
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class OrderInfoServiceImpl implements IJtOrderService {
|
||||||
|
|
||||||
|
private final IOrderCreateInfoManage orderCreateInfoManage;
|
||||||
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
|
private final RedisService redisService;
|
||||||
|
private final JntyzxDingTalkFactory dingTalkFactory;
|
||||||
|
@Override
|
||||||
|
public List<OrderInfoDO> queryNoPayOrder() {
|
||||||
|
return orderCreateInfoManage.queryNoPayOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createOrder(List<VenueInfoDO> venueInfoDOS, UserTokenInfoDO userTokenInfoDO) {
|
||||||
|
|
||||||
|
String order = (String) redisService.get(RedisKeyConstant.JNTYZX_ORDER_CREATE_KEY + userTokenInfoDO.getName() + LocalDate.now());
|
||||||
|
if (StringUtils.isNotBlank(order)) {
|
||||||
|
log.info("用户:{}已经有成功预订了场地", userTokenInfoDO.getName());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String user = (String) redisService.get(RedisKeyConstant.getCloseCardKey(userTokenInfoDO.getName()));
|
||||||
|
if (StringUtils.isNotBlank(user)) {
|
||||||
|
log.info("用户:{}有锁卡风险,不在请求接口!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
JntyzxResponse<OrderCreateResp> orderResp = jntyzxHttpService.createOrder(venueInfoDOS, userTokenInfoDO.getToken(), userTokenInfoDO.getOpenId());
|
||||||
|
if (Objects.isNull(orderResp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (orderResp.getSuccess()) {
|
||||||
|
OrderCreateResp result = orderResp.getResult();
|
||||||
|
if (Objects.nonNull(result)) {
|
||||||
|
String orderId = result.getId();
|
||||||
|
if (StringUtils.isNotBlank(orderId)) {
|
||||||
|
redisService.set(RedisKeyConstant.JNTYZX_ORDER_CREATE_KEY + userTokenInfoDO.getName() + LocalDate.now(), orderId);
|
||||||
|
OrderInfoDO orderInfoDO = new OrderInfoDO();
|
||||||
|
orderInfoDO.setOrderId(orderId);
|
||||||
|
orderInfoDO.setCreateTime(LocalDateTime.now());
|
||||||
|
orderInfoDO.setUsername(userTokenInfoDO.getName());
|
||||||
|
orderInfoDO.setPlaceName(venueInfoDOS.get(0).getPlaceName());
|
||||||
|
orderInfoDO.setDate(LocalDate.now());
|
||||||
|
orderInfoDO.setOrderStatus(0);
|
||||||
|
orderCreateInfoManage.save(orderInfoDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "小程序预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "小程序预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
|
||||||
|
if (orderResp.getMessage().contains("锁卡")) {
|
||||||
|
log.info("有锁卡风险,不在请求,用户:{}", userTokenInfoDO.getName());
|
||||||
|
throw new BusinessException("即将锁卡,不再请求");
|
||||||
|
}
|
||||||
|
if (orderResp.getMessage().contains("限制")) {
|
||||||
|
log.info("改会员卡被限制,不在请求,用户:{}", userTokenInfoDO.getName());
|
||||||
|
redisService.set(RedisKeyConstant.getCloseCardKey(userTokenInfoDO.getName()), "true");
|
||||||
|
throw new BusinessException("会员卡被限制,不在请求");
|
||||||
|
}
|
||||||
|
if (orderResp.getMessage().contains("已有人预订")) {
|
||||||
|
log.info("该场地已被人预定,更换场地, 用户:{}", userTokenInfoDO.getName());
|
||||||
|
redisService.set(RedisKeyConstant.getVenueSubscribeKey(venueInfoDOS.get(0).getPlaceName()), "true");
|
||||||
|
}
|
||||||
|
if (orderResp.getMessage().contains("预约场地不能超过2个")) {
|
||||||
|
log.info("用户:{}已经预约场地", userTokenInfoDO.getName());
|
||||||
|
throw new BusinessException("用户已经预约场地");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.xiang.common.exception.BusinessException;
|
||||||
|
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.UserTokenInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.JntyzxResponse;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.UserInfoResponse;
|
||||||
|
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 lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:22
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
||||||
|
|
||||||
|
private final IUserTokenInfoManage userTokenInfoManage;
|
||||||
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
|
private final JntyzxDingTalkFactory jtDingTalkFactory;
|
||||||
|
private final IUserRestrictionManage userRestrictionManage;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserTokenInfoDO> getAvailableUser() {
|
||||||
|
return userTokenInfoManage.listUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getToken(String name) {
|
||||||
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(name);
|
||||||
|
if (Objects.isNull(userTokenInfoDO)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return userTokenInfoDO.getToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserTokenInfoDO> getCanOrderUser() {
|
||||||
|
return userTokenInfoManage.listCanOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean flushSingleToken(String name) {
|
||||||
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(name);
|
||||||
|
if (Objects.isNull(userTokenInfoDO)) {
|
||||||
|
log.info("用户信息不存在,无需进行监测!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return healthDeclaration(userTokenInfoDO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean flushToken() {
|
||||||
|
List<UserTokenInfoDO> userTokenInfoDOS = userTokenInfoManage.list();
|
||||||
|
if (CollectionUtils.isEmpty(userTokenInfoDOS)) {
|
||||||
|
log.info("【心跳监测】查询用户信息为空,无需操作");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
userTokenInfoDOS.forEach(this::healthDeclaration);
|
||||||
|
// 信息更新
|
||||||
|
userTokenInfoDOS = userTokenInfoManage.list();
|
||||||
|
userTokenInfoDOS.forEach(this::queryMemberCardInfo);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateTokenByName(String name, String token) {
|
||||||
|
UserTokenInfoDO userTokenInfoDO = userTokenInfoManage.getByName(name);
|
||||||
|
if (Objects.isNull(userTokenInfoDO)) {
|
||||||
|
throw new BusinessException("用户信息不存在!");
|
||||||
|
}
|
||||||
|
userTokenInfoDO.setToken(token);
|
||||||
|
boolean flag = userTokenInfoManage.updateById(userTokenInfoDO);
|
||||||
|
jtDingTalkFactory.sendMsg("用户:" + name + ",token更新成功!");
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
if (Objects.isNull(jntyzxResponse)) {
|
||||||
|
log.info("用户名:{}心跳监测失败!", userTokenInfoDO.getName());
|
||||||
|
}
|
||||||
|
boolean flag = StringUtils.contains(jntyzxResponse.getMessage(), "已存在");
|
||||||
|
if (flag) {
|
||||||
|
log.info("用户名:{}心跳成功✅✅✅✅✅✅", userTokenInfoDO.getName());
|
||||||
|
userTokenInfoDO.setStatus(1);
|
||||||
|
userTokenInfoManage.updateById(userTokenInfoDO);
|
||||||
|
} else {
|
||||||
|
jtDingTalkFactory.sendMsg("用户名:" + userTokenInfoDO.getName() + "心跳失败,消息:" + jntyzxResponse.getMessage());
|
||||||
|
userTokenInfoDO.setStatus(0);
|
||||||
|
userTokenInfoManage.updateById(userTokenInfoDO);
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户信息
|
||||||
|
*
|
||||||
|
* @param userTokenInfoDO 用户
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
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());
|
||||||
|
if (Objects.isNull(response)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (response.getSuccess()) {
|
||||||
|
UserInfoResponse userInfoResponse = response.getResult();
|
||||||
|
userTokenInfoDO.setMemberCardNo(userInfoResponse.getConsCard());
|
||||||
|
if (StringUtils.isNotBlank(userInfoResponse.getRestrictionDeadline2())) {
|
||||||
|
userTokenInfoDO.setIsRestriction(1);
|
||||||
|
userTokenInfoDO.setIsOrder(0);
|
||||||
|
UserRestrictionInfo userRestrictionInfo = userRestrictionManage.queryByUserId(userTokenInfoDO.getId());
|
||||||
|
if (Objects.isNull(userRestrictionInfo)) {
|
||||||
|
userRestrictionInfo = new UserRestrictionInfo();
|
||||||
|
userRestrictionInfo.setUserId(userTokenInfoDO.getId());
|
||||||
|
userRestrictionInfo.setRestrictionDeadline(DateUtils.getDateTimeFromStr(userInfoResponse.getRestrictionDeadline2()));
|
||||||
|
userRestrictionInfo.setRestrictionDesc(userInfoResponse.getRestrictionDescription());
|
||||||
|
userRestrictionManage.save(userRestrictionInfo);
|
||||||
|
} else {
|
||||||
|
userRestrictionInfo.setRestrictionDeadline(DateUtils.getDateTimeFromStr(userInfoResponse.getRestrictionDeadline2()));
|
||||||
|
userRestrictionInfo.setRestrictionDesc(userInfoResponse.getRestrictionDescription());
|
||||||
|
userRestrictionManage.updateById(userRestrictionInfo);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
userTokenInfoDO.setIsRestriction(0);
|
||||||
|
userTokenInfoDO.setIsOrder(1);
|
||||||
|
}
|
||||||
|
userTokenInfoManage.updateById(userTokenInfoDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,217 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.service.impl;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
|
||||||
|
import com.xiang.common.utils.DateUtils;
|
||||||
|
import com.xiang.common.manage.jntyzx.miniapp.IVenueInfoManage;
|
||||||
|
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.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
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: 2025-12-15 16:08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class VenueServiceImpl implements IVenueService {
|
||||||
|
|
||||||
|
private final IJntyzxHttpService jntyzxHttpService;
|
||||||
|
private final IVenueInfoManage venueInfoManage;
|
||||||
|
private final IUserTokenInfoService userTokenInfoService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SitePositionList> queryVenueService() {
|
||||||
|
String token = userTokenInfoService.getToken("xiang");
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailable(WeekendUtils.isWeekend(), token);
|
||||||
|
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
updateDatabase(sitePositionLists, true);
|
||||||
|
return sitePositionLists;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SitePositionList> queryTomorrowVenue() {
|
||||||
|
String token = userTokenInfoService.getToken("xiang");
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailableTomorrow(WeekendUtils.isWeekend(), token);
|
||||||
|
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
updateDatabase(sitePositionLists, false);
|
||||||
|
return sitePositionLists;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VenueInfoDO> queryCanBuyVenue() {
|
||||||
|
return venueInfoManage.queryByType(LocalDate.now(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VenueInfoDO> queryTomorrowCanBuyVenue() {
|
||||||
|
return venueInfoManage.queryByType(LocalDate.now().plusDays(1), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VenueInfoDO> queryToday6210VenueInfo() {
|
||||||
|
List<VenueInfoDO> venueInfoDOS = venueInfoManage.queryByDate(LocalDate.now());
|
||||||
|
return venueInfoDOS.stream().filter(item -> VenueInfoUtils.get628VenueInfo(item) || VenueInfoUtils.get8210VenueInfo(item)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveOrUpdateTodayVenueInfo(List<SitePositionList> sitePositionLists) {
|
||||||
|
List<VenueInfoDO> venueInfoDOS = venueInfoManage.queryByDate(LocalDate.now());
|
||||||
|
Map<String, Map<String, VenueInfoDO>> map = Maps.newHashMap();
|
||||||
|
if (CollectionUtils.isNotEmpty(sitePositionLists)) {
|
||||||
|
Map<String, List<VenueInfoDO>> map1 = venueInfoDOS.stream().collect(Collectors.groupingBy(VenueInfoDO::getPlaceName));
|
||||||
|
map1.forEach((placeName, venueInfos) -> {
|
||||||
|
Map<String, VenueInfoDO> venueInfoDOMap = venueInfoDOS.stream().collect(Collectors.toMap(VenueInfoDO::getSjName, Function.identity(), (a, b) -> a));
|
||||||
|
map.put(placeName, venueInfoDOMap);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (SitePositionList sitePositionList : sitePositionLists) {
|
||||||
|
if (map.containsKey(sitePositionList.getPlaceName())) {
|
||||||
|
Map<String, VenueInfoDO> venueInfoDOMap = map.get(sitePositionList.getPlaceName());
|
||||||
|
if (venueInfoDOMap.containsKey(sitePositionList.getSjName())) {
|
||||||
|
VenueInfoDO venueInfoDO = venueInfoDOMap.get(sitePositionList.getSjName());
|
||||||
|
venueInfoDO.setPlaceName(sitePositionList.getPlaceName());
|
||||||
|
venueInfoDO.setPlaceMainId(sitePositionList.getId());
|
||||||
|
venueInfoDO.setPlaceId(sitePositionList.getPlaceId());
|
||||||
|
venueInfoDO.setScheduleId(Integer.valueOf(sitePositionList.getScheduleId()));
|
||||||
|
venueInfoDO.setSjName(sitePositionList.getSjName());
|
||||||
|
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||||
|
venueInfoDO.setType(sitePositionList.getType());
|
||||||
|
venueInfoDO.setMoney(sitePositionList.getMoney());
|
||||||
|
venueInfoDO.setClassName(sitePositionList.getClassName());
|
||||||
|
venueInfoDO.setClassCode(sitePositionList.getClassCode());
|
||||||
|
venueInfoDO.setAppointments(sitePositionList.getAppointments());
|
||||||
|
venueInfoDO.setCTypeCode(sitePositionList.getCtypeCode());
|
||||||
|
venueInfoManage.updateById(venueInfoDO);
|
||||||
|
} else {
|
||||||
|
VenueInfoDO venueInfoDO = new VenueInfoDO();
|
||||||
|
venueInfoDO.setDate(LocalDate.now());
|
||||||
|
venueInfoDO.setCreateTime(LocalDateTime.now());
|
||||||
|
venueInfoDO.setPlaceName(sitePositionList.getPlaceName());
|
||||||
|
venueInfoDO.setPlaceMainId(sitePositionList.getId());
|
||||||
|
venueInfoDO.setPlaceId(sitePositionList.getPlaceId());
|
||||||
|
venueInfoDO.setScheduleId(Integer.valueOf(sitePositionList.getScheduleId()));
|
||||||
|
venueInfoDO.setSjName(sitePositionList.getSjName());
|
||||||
|
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||||
|
venueInfoDO.setType(sitePositionList.getType());
|
||||||
|
venueInfoDO.setMoney(sitePositionList.getMoney());
|
||||||
|
venueInfoDO.setClassName(sitePositionList.getClassName());
|
||||||
|
venueInfoDO.setClassCode(sitePositionList.getClassCode());
|
||||||
|
venueInfoDO.setAppointments(sitePositionList.getAppointments());
|
||||||
|
venueInfoDO.setCTypeCode(sitePositionList.getCtypeCode());
|
||||||
|
venueInfoManage.save(venueInfoDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveTomorrowVenueInfo(List<SitePositionList> sitePositionLists) {
|
||||||
|
for (SitePositionList sitePositionList : sitePositionLists) {
|
||||||
|
VenueInfoDO venueInfoDO = new VenueInfoDO();
|
||||||
|
venueInfoDO.setDate(LocalDate.now().plusDays(1));
|
||||||
|
venueInfoDO.setCreateTime(LocalDateTime.now());
|
||||||
|
venueInfoDO.setPlaceName(sitePositionList.getPlaceName());
|
||||||
|
venueInfoDO.setPlaceMainId(sitePositionList.getId());
|
||||||
|
venueInfoDO.setPlaceId(sitePositionList.getPlaceId());
|
||||||
|
venueInfoDO.setScheduleId(Integer.valueOf(sitePositionList.getScheduleId()));
|
||||||
|
venueInfoDO.setSjName(sitePositionList.getSjName());
|
||||||
|
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||||
|
venueInfoDO.setType(sitePositionList.getType());
|
||||||
|
venueInfoDO.setMoney(sitePositionList.getMoney());
|
||||||
|
venueInfoDO.setClassName(sitePositionList.getClassName());
|
||||||
|
venueInfoDO.setClassCode(sitePositionList.getClassCode());
|
||||||
|
venueInfoDO.setAppointments(sitePositionList.getAppointments());
|
||||||
|
venueInfoDO.setCTypeCode(sitePositionList.getCtypeCode());
|
||||||
|
venueInfoManage.save(venueInfoDO);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateDatabase(List<SitePositionList> list, boolean isToday) {
|
||||||
|
List<VenueInfoDO> venueInfoDOS = Lists.newArrayList();
|
||||||
|
if (isToday) {
|
||||||
|
venueInfoDOS.addAll(venueInfoManage.queryByDate(LocalDate.now()));
|
||||||
|
} else {
|
||||||
|
venueInfoDOS.addAll(venueInfoManage.queryByDate(LocalDate.now().plusDays(1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Integer, List<VenueInfoDO>> map = Maps.newHashMap();
|
||||||
|
if (CollectionUtils.isNotEmpty(venueInfoDOS)) {
|
||||||
|
map.putAll(venueInfoDOS.stream().filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.groupingBy(VenueInfoDO::getPlaceId)));
|
||||||
|
}
|
||||||
|
List<VenueInfoDO> insertList = Lists.newArrayList();
|
||||||
|
for (SitePositionList sitePositionList : list) {
|
||||||
|
if (map.containsKey(sitePositionList.getPlaceId())) {
|
||||||
|
List<VenueInfoDO> venueInfoDOList = map.get(sitePositionList.getPlaceId());
|
||||||
|
Map<String, VenueInfoDO> sjMap = venueInfoDOList.stream().collect(Collectors.toMap(VenueInfoDO::getSjName, Function.identity(), (a, b) -> a));
|
||||||
|
if (sjMap.containsKey(sitePositionList.getSjName())) {
|
||||||
|
VenueInfoDO venueInfoDO = sjMap.get(sitePositionList.getSjName());
|
||||||
|
if (!StringUtils.equals(venueInfoDO.getContacts(), sitePositionList.getContacts())
|
||||||
|
|| !Objects.equals(venueInfoDO.getType(), sitePositionList.getType())
|
||||||
|
|| !Objects.equals(venueInfoDO.getPlaceMainId(), sitePositionList.getId())) {
|
||||||
|
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||||
|
venueInfoDO.setType(sitePositionList.getType());
|
||||||
|
venueInfoDO.setPlaceMainId(sitePositionList.getId());
|
||||||
|
venueInfoManage.updateById(venueInfoDO);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
addIntoInsert(sitePositionList, insertList);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
addIntoInsert(sitePositionList, insertList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(insertList)) {
|
||||||
|
venueInfoManage.saveBatch(insertList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addIntoInsert(SitePositionList sitePositionList, List<VenueInfoDO> insertList) {
|
||||||
|
VenueInfoDO venueInfoDO = new VenueInfoDO();
|
||||||
|
venueInfoDO.setPlaceName(sitePositionList.getPlaceName());
|
||||||
|
venueInfoDO.setDate(DateUtils.getDateFromStr(sitePositionList.getAppointments()));
|
||||||
|
venueInfoDO.setPlaceMainId(sitePositionList.getId());
|
||||||
|
venueInfoDO.setPlaceId(sitePositionList.getPlaceId());
|
||||||
|
venueInfoDO.setScheduleId(Integer.valueOf(sitePositionList.getScheduleId()));
|
||||||
|
venueInfoDO.setSjName(sitePositionList.getSjName());
|
||||||
|
venueInfoDO.setCreateTime(LocalDateTime.now());
|
||||||
|
venueInfoDO.setContacts(sitePositionList.getContacts());
|
||||||
|
venueInfoDO.setType(sitePositionList.getType());
|
||||||
|
venueInfoDO.setMoney(sitePositionList.getMoney());
|
||||||
|
venueInfoDO.setClassName(sitePositionList.getClassName());
|
||||||
|
venueInfoDO.setClassCode(sitePositionList.getClassCode());
|
||||||
|
venueInfoDO.setAppointments(sitePositionList.getAppointments());
|
||||||
|
venueInfoDO.setCTypeCode(sitePositionList.getCtypeCode());
|
||||||
|
insertList.add(venueInfoDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xiang.common.utils.Base64;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class JntyzxSaltEncodeUtils {
|
||||||
|
|
||||||
|
private static int[] getMonthAndDay() {
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
int month = currentDate.getMonthValue();
|
||||||
|
int day = currentDate.getDayOfMonth();
|
||||||
|
return new int[]{month, day};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String sonAddSalt(String json) {
|
||||||
|
String svCiphertext = "";
|
||||||
|
String suiji = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
String token1 = String.valueOf(suiji.charAt((int) (Math.random() * (double) suiji.length())));
|
||||||
|
String token2 = String.valueOf(suiji.charAt((int) (Math.random() * (double) suiji.length())));
|
||||||
|
svCiphertext = Base64.encode(json.getBytes(StandardCharsets.UTF_8));
|
||||||
|
int[] monthAndDay = getMonthAndDay();
|
||||||
|
int month = monthAndDay[0];
|
||||||
|
int day = monthAndDay[1];
|
||||||
|
if (month == 1) {
|
||||||
|
svCiphertext = (svCiphertext = token1 + svCiphertext).substring(0, day - 1) + token2 + svCiphertext.substring(day - 1);
|
||||||
|
} else if (day == 1) {
|
||||||
|
svCiphertext = token2 + svCiphertext.substring(0, month - 1) + token1 + svCiphertext.substring(month - 1);
|
||||||
|
} else {
|
||||||
|
svCiphertext = (svCiphertext = svCiphertext.substring(0, month - 1) + token1 + svCiphertext.substring(month - 1)).substring(0, day - 1) + token2 + svCiphertext.substring(day - 1);
|
||||||
|
}
|
||||||
|
return svCiphertext;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.utils;
|
||||||
|
|
||||||
|
import com.xiang.common.factory.JntyzxDingTalkFactory;
|
||||||
|
import com.xiang.common.utils.RedisService;
|
||||||
|
import com.xiang.common.enums.RedisKeyConstant;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-01-26 09:14
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MsgSendUtils {
|
||||||
|
|
||||||
|
private final RedisService redisService;
|
||||||
|
private final JntyzxDingTalkFactory jtDingTalkFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限制钉钉消息发送 1小时最多5次
|
||||||
|
* @param redisKey redis缓存的key
|
||||||
|
* @param msgContent 消息内容
|
||||||
|
*/
|
||||||
|
public void sendMsgRestrict1Hours(String redisKey, String msgContent) {
|
||||||
|
String key = RedisKeyConstant.JNTYZX_VENUE_MSG_SEND_KEY + RedisKeyConstant.getDate();
|
||||||
|
String cache = (String) redisService.get(redisKey);
|
||||||
|
if (StringUtils.isNotBlank(cache)) {
|
||||||
|
int sendNum = Integer.parseInt(cache);
|
||||||
|
if (sendNum >= 0 && sendNum < 5) {
|
||||||
|
jtDingTalkFactory.sendMsg(msgContent);
|
||||||
|
redisService.set(key, String.valueOf(++sendNum), 1, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
jtDingTalkFactory.sendMsg(msgContent);
|
||||||
|
redisService.set(key, "0", 1, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.utils;
|
||||||
|
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.pojo.VenueInfoDO;
|
||||||
|
import com.xiang.common.pojo.jntyzx.miniapp.resp.query.SitePositionList;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2025-12-16 09:55
|
||||||
|
*/
|
||||||
|
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) {
|
||||||
|
return StringUtils.equals(venueInfoDO.getSjName(), "13:00-14:00") || StringUtils.equals(venueInfoDO.getSjName(), "14:00-15:00");
|
||||||
|
}
|
||||||
|
public static boolean get1221VenueInfo4Mor(VenueInfoDO venueInfoDO) {
|
||||||
|
return StringUtils.equals(venueInfoDO.getSjName(), "12:00-13:00") || StringUtils.equals(venueInfoDO.getSjName(), "13:00-14:00");
|
||||||
|
}
|
||||||
|
public static boolean get628VenueInfo(VenueInfoDO venueInfoDO) {
|
||||||
|
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) {
|
||||||
|
return StringUtils.equals(venueInfoDO.getSjName(), "20:00-21:00") || StringUtils.equals(venueInfoDO.getSjName(), "21:00-22:00");
|
||||||
|
}
|
||||||
|
public static boolean get8210VenueInfo(SitePositionList sitePositionList) {
|
||||||
|
return StringUtils.equals(sitePositionList.getSjName(), "20:00-21:00") || StringUtils.equals(sitePositionList.getSjName(), "21:00-22:00");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int sortVenueInfo(String placeName) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int sortVenueInfo4Zlb(String placeName) {
|
||||||
|
if (placeName.contains("10号")) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (placeName.contains("9号")) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (placeName.contains("2号")) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (placeName.contains("8号")) {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
if (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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.miniapp.utils;
|
||||||
|
|
||||||
|
import java.time.DayOfWeek;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class WeekendUtils {
|
||||||
|
|
||||||
|
public static String isWeekend() {
|
||||||
|
LocalDate tomorrow = LocalDate.now().plusDays(1);
|
||||||
|
DayOfWeek dayOfWeek = tomorrow.getDayOfWeek();
|
||||||
|
String isWeekend = "0";
|
||||||
|
if (dayOfWeek.getValue() == 6 || dayOfWeek.getValue() == 7 ) {
|
||||||
|
isWeekend = "1";
|
||||||
|
}
|
||||||
|
return isWeekend;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,9 +13,13 @@ 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.*;
|
import okhttp3.MediaType;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -49,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
|
||||||
@@ -68,7 +72,7 @@ public class ZlbLoginTask extends BaseScheduleTaskTemplate {
|
|||||||
return taskResult;
|
return taskResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
OkHttpClient client = new OkHttpClient.Builder()
|
OkHttpClient client = new OkHttpClient.Builder()
|
||||||
.connectTimeout(60, TimeUnit.SECONDS) // 连接超时时间
|
.connectTimeout(60, TimeUnit.SECONDS) // 连接超时时间
|
||||||
.readTimeout(60, TimeUnit.SECONDS) // 读取超时时间
|
.readTimeout(60, TimeUnit.SECONDS) // 读取超时时间
|
||||||
.writeTimeout(60, TimeUnit.SECONDS) // 写入超时时间
|
.writeTimeout(60, TimeUnit.SECONDS) // 写入超时时间
|
||||||
@@ -87,7 +91,6 @@ public class ZlbLoginTask extends BaseScheduleTaskTemplate {
|
|||||||
.addHeader("X-Timestamp", "1761122479")
|
.addHeader("X-Timestamp", "1761122479")
|
||||||
.addHeader("User-Agent", "000001@ZLB_iphone_7.28.0")
|
.addHeader("User-Agent", "000001@ZLB_iphone_7.28.0")
|
||||||
.addHeader("guc-accountType", "person")
|
.addHeader("guc-accountType", "person")
|
||||||
// .addHeader("aliyungf_tc", zlbLoginInfo.getAliyungfTc())
|
|
||||||
.addHeader("Biz-Session-Id", zlbLoginInfo.getBizSessionId())
|
.addHeader("Biz-Session-Id", zlbLoginInfo.getBizSessionId())
|
||||||
.addHeader("guc-platform", "app")
|
.addHeader("guc-platform", "app")
|
||||||
.addHeader("X-Access-Id", "szzj")
|
.addHeader("X-Access-Id", "szzj")
|
||||||
@@ -107,7 +110,7 @@ public class ZlbLoginTask extends BaseScheduleTaskTemplate {
|
|||||||
.build();
|
.build();
|
||||||
Response response = client.newCall(request).execute();
|
Response response = client.newCall(request).execute();
|
||||||
String string = response.body().string();
|
String string = response.body().string();
|
||||||
log.info("{}获取ticketId接口返回:{}", name,string);
|
log.info("{}获取ticketId接口返回:{}", name, string);
|
||||||
JSONObject jsonObject = JSON.parseObject(string
|
JSONObject jsonObject = JSON.parseObject(string
|
||||||
);
|
);
|
||||||
JSONObject data = jsonObject.getJSONObject("data");
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
|
|||||||
@@ -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,73 @@ 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(() -> {
|
||||||
String response = null;
|
for (int i = 0; i < 3; i++) {
|
||||||
try {
|
String response = null;
|
||||||
response = client.postJson(ZlbUrlConstants.newOrderUrl, headers, newOrderJson);
|
try {
|
||||||
} catch (Exception e) {
|
response = client.postJson(ZlbUrlConstants.newOrderUrl, headers, newOrderJson);
|
||||||
throw new RuntimeException(e);
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
boolean b = buildOrder(name, response, placeName, siteTimeName);
|
||||||
|
if (b) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(1250);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
logger.error("线程暂停异常");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
buildOrder(name, response, placeName, siteTimeName);
|
|
||||||
}, 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.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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -42,17 +42,11 @@ public class ZlbSiteTask extends BaseScheduleTaskTemplate {
|
|||||||
protected TaskResult doExecute(Object validatedParams) {
|
protected TaskResult doExecute(Object validatedParams) {
|
||||||
|
|
||||||
TaskResult taskResult = new TaskResult();
|
TaskResult taskResult = new TaskResult();
|
||||||
//获取当前时间的后一天
|
// 获取+2时间的场地信息,明天需要的是后天的场地信息
|
||||||
Date date1 = DateUtils.addDate(new Date(), 0);
|
Date date1 = DateUtils.addDate(new Date(), 2);
|
||||||
Date date2 = DateUtils.addDate(new Date(), 1);
|
|
||||||
Date date3 = DateUtils.addDate(new Date(), 2);
|
|
||||||
String day1 = DateUtils.format(date1, DateUtils.ENUM_FORMAT_YMD);
|
String day1 = DateUtils.format(date1, DateUtils.ENUM_FORMAT_YMD);
|
||||||
String day2 = DateUtils.format(date2, DateUtils.ENUM_FORMAT_YMD);
|
|
||||||
String day3 = DateUtils.format(date3, DateUtils.ENUM_FORMAT_YMD);
|
|
||||||
try {
|
try {
|
||||||
zlbService.queryZLbSiteInfo(day1, 1);
|
zlbService.queryZLbSiteInfo(day1, 1);
|
||||||
zlbService.queryZLbSiteInfo(day2, 1);
|
|
||||||
zlbService.queryZLbSiteInfo(day3, 1);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("site task error", e);
|
log.error("site task error", e);
|
||||||
taskResult.setSuccess(false);
|
taskResult.setSuccess(false);
|
||||||
|
|||||||
@@ -16,36 +16,59 @@ public class ZlbTaskConfig {
|
|||||||
private final ZlbSiteTask zlbSiteTask;
|
private final ZlbSiteTask zlbSiteTask;
|
||||||
private final ZlbSiteDayTask zlbSiteDayTask;
|
private final ZlbSiteDayTask zlbSiteDayTask;
|
||||||
private final ZlbOrderTask zlbOrderTask;
|
private final ZlbOrderTask zlbOrderTask;
|
||||||
|
private final ZlbUserConfigTask zlbUserConfigTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token续期
|
||||||
|
*/
|
||||||
@Scheduled(cron = "0 0/30 * * * ?")
|
@Scheduled(cron = "0 0/30 * * * ?")
|
||||||
@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 * * ?")
|
||||||
|
@GetMapping("/zlbUserConfig")
|
||||||
|
public void zlbUserConfig() {
|
||||||
|
zlbUserConfigTask.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
package com.xiang.service.module.jntyzx.zlb.schedule;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
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.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.ZlbTokenInfo;
|
||||||
|
import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;
|
||||||
|
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.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.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: xiang
|
||||||
|
* @Date: 2026-05-08 12:03
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class ZlbUserConfigTask extends BaseScheduleTaskTemplate {
|
||||||
|
|
||||||
|
private final ZlbSiteInfoService zlbSiteInfoService;
|
||||||
|
private final ZlbUserInfoService zlbUserInfoService;
|
||||||
|
private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
|
||||||
|
private final ZlbTokenInfoService zlbTokenInfoService;
|
||||||
|
private final RedisService redisService;
|
||||||
|
|
||||||
|
public ZlbUserConfigTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
|
||||||
|
IScheduleRunLogService scheduleRunLogService,
|
||||||
|
ZlbSiteInfoService zlbSiteInfoService,
|
||||||
|
ZlbUserInfoService zlbUserInfoService,
|
||||||
|
ZlbTokenInfoService zlbTokenInfoService,
|
||||||
|
JntyzxDingTalkFactory jntyzxDingTalkFactory,
|
||||||
|
RedisService redisService) {
|
||||||
|
super(scheduleOpeningConfigService, scheduleRunLogService);
|
||||||
|
this.zlbSiteInfoService = zlbSiteInfoService;
|
||||||
|
this.zlbUserInfoService = zlbUserInfoService;
|
||||||
|
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
|
||||||
|
this.zlbTokenInfoService = zlbTokenInfoService;
|
||||||
|
this.redisService = redisService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTaskName() {
|
||||||
|
return ScheduleEnums.ZLB_USER_CONFIG_TASK.getTaskName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Integer getModule() {
|
||||||
|
return ScheduleEnums.ZLB_USER_CONFIG_TASK.getModuleCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getModuleName() {
|
||||||
|
return ScheduleEnums.ZLB_USER_CONFIG_TASK.getModule();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TaskResult doExecute(Object validatedParams) throws Exception {
|
||||||
|
TaskResult taskResult = new TaskResult();
|
||||||
|
LocalDate date = LocalDate.now().plusDays(2);
|
||||||
|
LambdaQueryWrapper<ZlbSiteInfo> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.eq(ZlbSiteInfo::getBelongDate, date);
|
||||||
|
List<ZlbSiteInfo> siteInfoList = zlbSiteInfoService.list(lambdaQueryWrapper);
|
||||||
|
if (CollectionUtils.isEmpty(siteInfoList)) {
|
||||||
|
log.info("日期:{}无场地信息", date);
|
||||||
|
jntyzxDingTalkFactory.sendMsg("日期:" + date + "无场地信息配置");
|
||||||
|
taskResult.setSuccess(Boolean.FALSE);
|
||||||
|
taskResult.setSummary("日期:" + date + "无场地信息配置");
|
||||||
|
return taskResult;
|
||||||
|
}
|
||||||
|
siteInfoList = filterSiteInfo(siteInfoList);
|
||||||
|
siteInfoList = sortSiteInfo(siteInfoList);
|
||||||
|
|
||||||
|
|
||||||
|
List<ZlbTokenInfo> users = zlbTokenInfoService.getAllUsers();
|
||||||
|
if (CollectionUtils.isEmpty(users)) {
|
||||||
|
log.info("日期:{}无用户信息", date);
|
||||||
|
jntyzxDingTalkFactory.sendMsg("日期:" + date + "无用户信息");
|
||||||
|
taskResult.setSuccess(Boolean.FALSE);
|
||||||
|
taskResult.setSummary("日期:" + date + "无用户信息");
|
||||||
|
return taskResult;
|
||||||
|
}
|
||||||
|
zlbUserInfoService.delAll();
|
||||||
|
List<ZlbUserInfo> list = Lists.newArrayList();
|
||||||
|
int i = 0;
|
||||||
|
for (ZlbTokenInfo user : users) {
|
||||||
|
ZlbSiteInfo zlbSiteInfo = siteInfoList.get(i);
|
||||||
|
ZlbUserInfo zlbUserInfo = new ZlbUserInfo();
|
||||||
|
zlbUserInfo.setLoginInfoId(user.getLoginInfoId());
|
||||||
|
zlbUserInfo.setName(user.getName());
|
||||||
|
zlbUserInfo.setWeek(DateUtils.getWeekDayTwo(zlbSiteInfo.getBelongDate()));
|
||||||
|
zlbUserInfo.setType("1");
|
||||||
|
zlbUserInfo.setPlaceName(zlbSiteInfo.getPlaceName());
|
||||||
|
zlbUserInfo.setSiteTimeName(zlbSiteInfo.getDayEffectiveTimes());
|
||||||
|
zlbUserInfo.setIsBook(0);
|
||||||
|
list.add(zlbUserInfo);
|
||||||
|
i++;
|
||||||
|
if (i == siteInfoList.size()) {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
zlbUserInfoService.saveBatch(list);
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
for (ZlbUserInfo 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ZlbSiteInfo> filterSiteInfo(List<ZlbSiteInfo> siteInfoList) {
|
||||||
|
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) {
|
||||||
|
if (CollectionUtils.isEmpty(siteInfoList)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return siteInfoList.stream().sorted(Comparator.comparing(item -> VenueInfoUtils.sortVenueInfo4Zlb(item.getPlaceName()))).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user