feat:江体小程序
This commit is contained in:
@@ -2,9 +2,11 @@ package com.xiang;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.xiang.common.enums.RedisKeyConstant;
|
||||||
import com.xiang.common.enums.ScheduleEnums;
|
import com.xiang.common.enums.ScheduleEnums;
|
||||||
import com.xiang.common.pojo.schedule.ScheduleOpeningConfigDO;
|
import com.xiang.common.pojo.schedule.ScheduleOpeningConfigDO;
|
||||||
import com.xiang.common.service.IScheduleOpeningConfigService;
|
import com.xiang.common.service.IScheduleOpeningConfigService;
|
||||||
|
import com.xiang.common.utils.RedisService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
@@ -28,6 +30,7 @@ import java.util.stream.Collectors;
|
|||||||
public class ApplicationInit implements ApplicationRunner {
|
public class ApplicationInit implements ApplicationRunner {
|
||||||
|
|
||||||
private final IScheduleOpeningConfigService scheduleOpeningConfigService;
|
private final IScheduleOpeningConfigService scheduleOpeningConfigService;
|
||||||
|
private final RedisService redisService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
@@ -35,6 +38,10 @@ public class ApplicationInit implements ApplicationRunner {
|
|||||||
log.info("开始加载任务配置!");
|
log.info("开始加载任务配置!");
|
||||||
loadScheduleTask();
|
loadScheduleTask();
|
||||||
log.info("任务配置加载完成!");
|
log.info("任务配置加载完成!");
|
||||||
|
|
||||||
|
log.info("redis key 加载开始!");
|
||||||
|
loadRedisKey();
|
||||||
|
log.info("redis key 加载结束!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadScheduleTask() {
|
private void loadScheduleTask() {
|
||||||
@@ -63,4 +70,8 @@ public class ApplicationInit implements ApplicationRunner {
|
|||||||
scheduleOpeningConfigService.saveBatch(list);
|
scheduleOpeningConfigService.saveBatch(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadRedisKey() {
|
||||||
|
redisService.set(RedisKeyConstant.JNTYZX_SUBSCRIBE_TIME_KEY, "18:00");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public class RedisKeyConstant {
|
|||||||
return JNTYZX_VENUE_SUBSCRIBE_KEY + placeName + ":" + getDate();
|
return JNTYZX_VENUE_SUBSCRIBE_KEY + placeName + ":" + getDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String JNTYZX_SUBSCRIBE_TIME_KEY = "jntyzx:subscribe:time";
|
||||||
|
|
||||||
public static String getDate() {
|
public static String getDate() {
|
||||||
LocalDate now = LocalDate.now();
|
LocalDate now = LocalDate.now();
|
||||||
return ":" + DateUtils.getDateFromDate(now);
|
return ":" + DateUtils.getDateFromDate(now);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.xiang.service.module.jntyzx.miniapp.schedule;
|
package com.xiang.service.module.jntyzx.miniapp.schedule;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.xiang.common.enums.RedisKeyConstant;
|
||||||
import com.xiang.common.enums.ScheduleEnums;
|
import com.xiang.common.enums.ScheduleEnums;
|
||||||
import com.xiang.common.factory.JntyzxDingTalkFactory;
|
import com.xiang.common.factory.JntyzxDingTalkFactory;
|
||||||
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
|
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
|
||||||
@@ -11,6 +13,7 @@ import com.xiang.common.pojo.schedule.TaskResult;
|
|||||||
import com.xiang.common.service.IScheduleOpeningConfigService;
|
import com.xiang.common.service.IScheduleOpeningConfigService;
|
||||||
import com.xiang.common.service.IScheduleRunLogService;
|
import com.xiang.common.service.IScheduleRunLogService;
|
||||||
import com.xiang.common.utils.DateUtils;
|
import com.xiang.common.utils.DateUtils;
|
||||||
|
import com.xiang.common.utils.RedisService;
|
||||||
import com.xiang.service.module.jntyzx.miniapp.service.IUserInfoService;
|
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.IUserTokenInfoService;
|
||||||
import com.xiang.service.module.jntyzx.miniapp.service.IVenueService;
|
import com.xiang.service.module.jntyzx.miniapp.service.IVenueService;
|
||||||
@@ -34,18 +37,21 @@ public class JntyzxUserInfoConfigTask extends BaseScheduleTaskTemplate {
|
|||||||
private final IVenueService venueService;
|
private final IVenueService venueService;
|
||||||
private final IUserInfoService userInfoService;
|
private final IUserInfoService userInfoService;
|
||||||
private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
|
private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
|
||||||
|
private final RedisService redisService;
|
||||||
|
|
||||||
public JntyzxUserInfoConfigTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
|
public JntyzxUserInfoConfigTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
|
||||||
IScheduleRunLogService scheduleRunLogService,
|
IScheduleRunLogService scheduleRunLogService,
|
||||||
IUserTokenInfoService userTokenInfoService,
|
IUserTokenInfoService userTokenInfoService,
|
||||||
IVenueService venueService,
|
IVenueService venueService,
|
||||||
IUserInfoService userInfoService,
|
IUserInfoService userInfoService,
|
||||||
JntyzxDingTalkFactory jntyzxDingTalkFactory) {
|
JntyzxDingTalkFactory jntyzxDingTalkFactory,
|
||||||
|
RedisService redisService) {
|
||||||
super(scheduleOpeningConfigService, scheduleRunLogService);
|
super(scheduleOpeningConfigService, scheduleRunLogService);
|
||||||
this.userTokenInfoService = userTokenInfoService;
|
this.userTokenInfoService = userTokenInfoService;
|
||||||
this.venueService = venueService;
|
this.venueService = venueService;
|
||||||
this.userInfoService = userInfoService;
|
this.userInfoService = userInfoService;
|
||||||
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
|
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
|
||||||
|
this.redisService = redisService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -72,14 +78,20 @@ public class JntyzxUserInfoConfigTask extends BaseScheduleTaskTemplate {
|
|||||||
taskResult.setSummary("无可用场地");
|
taskResult.setSummary("无可用场地");
|
||||||
return taskResult;
|
return taskResult;
|
||||||
}
|
}
|
||||||
venueInfoDOS = venueInfoDOS.stream()
|
|
||||||
.filter(VenueInfoUtils::get11213VenueInfo4Mor)
|
String time = (String) redisService.get(RedisKeyConstant.JNTYZX_SUBSCRIBE_TIME_KEY);
|
||||||
.sorted(Comparator.comparing(item -> VenueInfoUtils.sortVenueInfo(item.getPlaceName())))
|
if (StringUtils.isBlank(time)) {
|
||||||
.toList();
|
time = "18:00";
|
||||||
|
}
|
||||||
|
String finalTime = time;
|
||||||
|
venueInfoDOS = VenueInfoUtils.filterVenueList(finalTime, venueInfoDOS);
|
||||||
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
if (CollectionUtils.isEmpty(venueInfoDOS)) {
|
||||||
taskResult.setSummary("无可用场地");
|
taskResult.setSummary("无可用场地");
|
||||||
return taskResult;
|
return taskResult;
|
||||||
}
|
}
|
||||||
|
venueInfoDOS = venueInfoDOS.stream()
|
||||||
|
.sorted(Comparator.comparing(item -> VenueInfoUtils.sortVenueInfo(item.getPlaceName())))
|
||||||
|
.toList();
|
||||||
|
|
||||||
List<UserTokenInfoDO> users = userTokenInfoService.getCanOrderUser();
|
List<UserTokenInfoDO> users = userTokenInfoService.getCanOrderUser();
|
||||||
if (CollectionUtils.isEmpty(users)) {
|
if (CollectionUtils.isEmpty(users)) {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -108,9 +109,10 @@ public class JtVenueSubscribeTask extends BaseScheduleTaskTemplate {
|
|||||||
UserTokenInfoDO userTokenInfoDO = userMap.get(userInfoDO.getName());
|
UserTokenInfoDO userTokenInfoDO = userMap.get(userInfoDO.getName());
|
||||||
List<VenueInfoDO> venueInfoDOList = venueInfoMap.get(userInfoDO.getPlaceName());
|
List<VenueInfoDO> venueInfoDOList = venueInfoMap.get(userInfoDO.getPlaceName());
|
||||||
if (CollectionUtils.isEmpty(venueInfoDOList)) {
|
if (CollectionUtils.isEmpty(venueInfoDOList)) {
|
||||||
|
logger.info("用户:{}查询不到场地信息:{}", userInfoDO.getName(), userInfoDO.getPlaceName());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
venueInfoDOList = VenueInfoUtils.filterVenueList(userInfoDO.getSiteTimeName(), venueInfoDOS);
|
venueInfoDOList = VenueInfoUtils.filterVenueList(userInfoDO.getSiteTimeName(), venueInfoDOList);
|
||||||
if (CollectionUtils.isEmpty(venueInfoDOList)) {
|
if (CollectionUtils.isEmpty(venueInfoDOList)) {
|
||||||
logger.info("用户:{}无场地信息:{},时间:{}", userInfoDO.getName(), userInfoDO.getPlaceName(), userInfoDO.getSiteTimeName());
|
logger.info("用户:{}无场地信息:{},时间:{}", userInfoDO.getName(), userInfoDO.getPlaceName(), userInfoDO.getSiteTimeName());
|
||||||
continue;
|
continue;
|
||||||
@@ -125,9 +127,12 @@ public class JtVenueSubscribeTask extends BaseScheduleTaskTemplate {
|
|||||||
LocalTime targetTime = LocalTime.parse("09:00:10");
|
LocalTime targetTime = LocalTime.parse("09:00:10");
|
||||||
Duration duration = Duration.between(currentTime, targetTime);
|
Duration duration = Duration.between(currentTime, targetTime);
|
||||||
long milliseconds = duration.toMillis();
|
long milliseconds = duration.toMillis();
|
||||||
|
if (milliseconds <= 0) {
|
||||||
|
milliseconds = 0;
|
||||||
|
}
|
||||||
List<VenueInfoDO> finalVenueInfoDOList = venueInfoDOList;
|
List<VenueInfoDO> finalVenueInfoDOList = venueInfoDOList;
|
||||||
// executorService.schedule(() -> {
|
executorService.schedule(() -> {
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
String valid = (String) redisService.get(RedisKeyConstant.getVenueSubscribeKey(placeName));
|
String valid = (String) redisService.get(RedisKeyConstant.getVenueSubscribeKey(placeName));
|
||||||
if (StringUtils.isNotBlank(valid)) {
|
if (StringUtils.isNotBlank(valid)) {
|
||||||
break;
|
break;
|
||||||
@@ -137,12 +142,12 @@ public class JtVenueSubscribeTask extends BaseScheduleTaskTemplate {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1250);
|
Thread.sleep(2000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
log.error("睡眠失败~~~");
|
log.error("睡眠失败~~~");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }, milliseconds, TimeUnit.MILLISECONDS);
|
}, milliseconds, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,10 +76,10 @@ public class OrderInfoServiceImpl implements IJtOrderService {
|
|||||||
orderCreateInfoManage.save(orderInfoDO);
|
orderCreateInfoManage.save(orderInfoDO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
|
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "小程序预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
|
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "小程序预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
|
||||||
if (orderResp.getMessage().contains("锁卡")) {
|
if (orderResp.getMessage().contains("锁卡")) {
|
||||||
log.info("有锁卡风险,不在请求,用户:{}", userTokenInfoDO.getName());
|
log.info("有锁卡风险,不在请求,用户:{}", userTokenInfoDO.getName());
|
||||||
throw new BusinessException("即将锁卡,不再请求");
|
throw new BusinessException("即将锁卡,不再请求");
|
||||||
@@ -93,6 +93,10 @@ public class OrderInfoServiceImpl implements IJtOrderService {
|
|||||||
log.info("该场地已被人预定,更换场地, 用户:{}", userTokenInfoDO.getName());
|
log.info("该场地已被人预定,更换场地, 用户:{}", userTokenInfoDO.getName());
|
||||||
redisService.set(RedisKeyConstant.getVenueSubscribeKey(venueInfoDOS.get(0).getPlaceName()), "true");
|
redisService.set(RedisKeyConstant.getVenueSubscribeKey(venueInfoDOS.get(0).getPlaceName()), "true");
|
||||||
}
|
}
|
||||||
|
if (orderResp.getMessage().contains("预约场地不能超过2个")) {
|
||||||
|
log.info("用户:{}已经预约场地", userTokenInfoDO.getName());
|
||||||
|
throw new BusinessException("用户已经预约场地");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public class ZlbOrderTask extends BaseScheduleTaskTemplate {
|
|||||||
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);
|
||||||
@@ -149,7 +149,7 @@ public class ZlbOrderTask extends BaseScheduleTaskTemplate {
|
|||||||
}
|
}
|
||||||
if (jsonObject.getInteger("code") == 500) {
|
if (jsonObject.getInteger("code") == 500) {
|
||||||
if (jsonObject.getString("message").contains("已被售出")) {
|
if (jsonObject.getString("message").contains("已被售出")) {
|
||||||
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回失败❌❌❌场地号:" + placeName + "已被售出");
|
jntyzxDingTalkFactory.sendMsg(name + "zlb订单接口下单返回失败❌❌❌场地号:" + placeName + "已被售出");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
package com.xiang.service.module.jntyzx.zlb.schedule;
|
package com.xiang.service.module.jntyzx.zlb.schedule;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.xiang.common.enums.RedisKeyConstant;
|
||||||
import com.xiang.common.enums.ScheduleEnums;
|
import com.xiang.common.enums.ScheduleEnums;
|
||||||
import com.xiang.common.factory.JntyzxDingTalkFactory;
|
import com.xiang.common.factory.JntyzxDingTalkFactory;
|
||||||
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
|
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
|
||||||
|
import com.xiang.common.manage.jntyzx.zlb.ZlbSiteInfoService;
|
||||||
|
import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
|
||||||
|
import com.xiang.common.manage.jntyzx.zlb.ZlbUserInfoService;
|
||||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbSiteInfo;
|
import com.xiang.common.pojo.jntyzx.zlb.ZlbSiteInfo;
|
||||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;
|
import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;
|
||||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;
|
import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;
|
||||||
@@ -13,9 +18,7 @@ import com.xiang.common.pojo.schedule.TaskResult;
|
|||||||
import com.xiang.common.service.IScheduleOpeningConfigService;
|
import com.xiang.common.service.IScheduleOpeningConfigService;
|
||||||
import com.xiang.common.service.IScheduleRunLogService;
|
import com.xiang.common.service.IScheduleRunLogService;
|
||||||
import com.xiang.common.utils.DateUtils;
|
import com.xiang.common.utils.DateUtils;
|
||||||
import com.xiang.common.manage.jntyzx.zlb.ZlbSiteInfoService;
|
import com.xiang.common.utils.RedisService;
|
||||||
import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
|
|
||||||
import com.xiang.common.manage.jntyzx.zlb.ZlbUserInfoService;
|
|
||||||
import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils;
|
import com.xiang.service.module.jntyzx.miniapp.utils.VenueInfoUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
@@ -39,18 +42,21 @@ public class ZlbUserConfigTask extends BaseScheduleTaskTemplate {
|
|||||||
private final ZlbUserInfoService zlbUserInfoService;
|
private final ZlbUserInfoService zlbUserInfoService;
|
||||||
private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
|
private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
|
||||||
private final ZlbTokenInfoService zlbTokenInfoService;
|
private final ZlbTokenInfoService zlbTokenInfoService;
|
||||||
|
private final RedisService redisService;
|
||||||
|
|
||||||
public ZlbUserConfigTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
|
public ZlbUserConfigTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
|
||||||
IScheduleRunLogService scheduleRunLogService,
|
IScheduleRunLogService scheduleRunLogService,
|
||||||
ZlbSiteInfoService zlbSiteInfoService,
|
ZlbSiteInfoService zlbSiteInfoService,
|
||||||
ZlbUserInfoService zlbUserInfoService,
|
ZlbUserInfoService zlbUserInfoService,
|
||||||
ZlbTokenInfoService zlbTokenInfoService,
|
ZlbTokenInfoService zlbTokenInfoService,
|
||||||
JntyzxDingTalkFactory jntyzxDingTalkFactory) {
|
JntyzxDingTalkFactory jntyzxDingTalkFactory,
|
||||||
|
RedisService redisService) {
|
||||||
super(scheduleOpeningConfigService, scheduleRunLogService);
|
super(scheduleOpeningConfigService, scheduleRunLogService);
|
||||||
this.zlbSiteInfoService = zlbSiteInfoService;
|
this.zlbSiteInfoService = zlbSiteInfoService;
|
||||||
this.zlbUserInfoService = zlbUserInfoService;
|
this.zlbUserInfoService = zlbUserInfoService;
|
||||||
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
|
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
|
||||||
this.zlbTokenInfoService = zlbTokenInfoService;
|
this.zlbTokenInfoService = zlbTokenInfoService;
|
||||||
|
this.redisService = redisService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -127,7 +133,12 @@ public class ZlbUserConfigTask extends BaseScheduleTaskTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<ZlbSiteInfo> filterSiteInfo(List<ZlbSiteInfo> siteInfoList) {
|
private List<ZlbSiteInfo> filterSiteInfo(List<ZlbSiteInfo> siteInfoList) {
|
||||||
return siteInfoList.stream().filter(item -> Objects.equals(item.getDayEffectiveTimes(), "20:00")).toList();
|
String time = (String) redisService.get(RedisKeyConstant.JNTYZX_SUBSCRIBE_TIME_KEY);
|
||||||
|
if (StringUtils.isBlank(time)) {
|
||||||
|
time = "18:00";
|
||||||
|
}
|
||||||
|
String finalTime = time;
|
||||||
|
return siteInfoList.stream().filter(item -> Objects.equals(item.getDayEffectiveTimes(), finalTime)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ZlbSiteInfo> sortSiteInfo(List<ZlbSiteInfo> siteInfoList) {
|
private List<ZlbSiteInfo> sortSiteInfo(List<ZlbSiteInfo> siteInfoList) {
|
||||||
|
|||||||
Reference in New Issue
Block a user