Compare commits
12 Commits
d1584184ae
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c99bfc360 | ||
|
|
20a92a22bf | ||
|
|
3c6ce446c7 | ||
|
|
9d0ed87191 | ||
|
|
d7be3786c3 | ||
| 44efd5689b | |||
|
|
0f7af30789 | ||
|
|
b4ed93171c | ||
|
|
6902a16cfa | ||
|
|
60992dc4f6 | ||
|
|
cb21b38287 | ||
|
|
268b63e607 |
@@ -8,19 +8,27 @@ import lombok.Getter;
|
||||
public enum ScheduleEnums {
|
||||
|
||||
/**
|
||||
* 0:glados 1:芬玩岛 2:江体小程序 3:江体zlb 4:DDNS
|
||||
* 0:glados
|
||||
* 1:芬玩岛
|
||||
* 2:DDNS
|
||||
* 3:江体zlb
|
||||
* 4:江体小程序
|
||||
*/
|
||||
|
||||
/**
|
||||
* Aliyun DDNS任务
|
||||
*/
|
||||
DOMAIN_DYNAMIC_ANALYSIS_TASK(4, "domain", "domainDynamicAnalysisTask"),
|
||||
|
||||
/**
|
||||
* Glados任务
|
||||
*/
|
||||
GLADOS_CHECK_IN_TASK(0, "glados", "gladosCheckInTask"),
|
||||
|
||||
/**
|
||||
* Aliyun DDNS任务
|
||||
*/
|
||||
DOMAIN_DYNAMIC_ANALYSIS_TASK(2, "domain", "domainDynamicAnalysisTask"),
|
||||
|
||||
/**
|
||||
* 芬玩岛 任务
|
||||
*/
|
||||
|
||||
/**
|
||||
* 江体 ZLB任务
|
||||
*/
|
||||
@@ -30,14 +38,22 @@ public enum ScheduleEnums {
|
||||
ZLB_SITE_DAY_TASK(3, "zlb", "zlbSiteDayTask"),
|
||||
ZLB_ORDER_CREATE_TASK(3, "zlb", "zlbOrderCreateTask"),
|
||||
ZLB_USER_CONFIG_TASK(3, "zlb", "zlbUserConfigTask"),
|
||||
ZLB_ORDER_QUERY_TASK(3, "zlb", "zlbOrderQueryTask"),
|
||||
ZLB_ORDER_JL_TASK(3, "zlb", "zlbOrderJlTask"),
|
||||
|
||||
|
||||
/**
|
||||
* 江体 小程序任务
|
||||
*/
|
||||
JNTYZX_TOKEN_REFRESH_TASK(4, "jt-miniApp", "jntyzxTokenRefreshTask"),
|
||||
JNTYZX_VENUE_INFO_PULL_TASK(4, "jt-miniApp", "jntyzxVenuePullTask"),
|
||||
JNTYZX_ORDER_SUBSCRIBE_TASK(4, "jt-miniApp", "jntyzxOrderSubscribeTask"),
|
||||
JNTYZX_VENUE_TODAY_SUBSCRIBE_TASK(4, "jt-miniApp", "jntyzxVenueTodaySubscribeTask"),
|
||||
JNTYZX_VENUE_TOMORROW_PULL_TASK(4, "jt-miniApp", "jntyzxVenueTodayPullTask"),
|
||||
JNTYZX_USER_INFO_CONFIG(4, "jt-miniApp", "jntyzxUserInfoConfigTask"),
|
||||
JNTYZX_VENUE_INFO_TODAY_RESULT_TASK(4, "jt-miniApp", "jtVenueInfoTodayResultTask"),
|
||||
JNTYZX_VENUE_INFO_TOMORROW_RESULT_TASK(4, "jt-miniApp", "jtVenueInfoTomorrowResultTask"),
|
||||
|
||||
;
|
||||
|
||||
private final Integer moduleCode;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xiang.common.manage.jntyzx.zlb;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbJlUserInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-05-12 09:18
|
||||
*/
|
||||
public interface IZlbJlUserInfoManage extends IService<ZlbJlUserInfo> {
|
||||
|
||||
List<ZlbJlUserInfo> getJlUsers();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xiang.common.manage.jntyzx.zlb;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbPayOrder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-05-09 15:11
|
||||
*/
|
||||
public interface IZlbOrderInfoManage extends IService<ZlbPayOrder> {
|
||||
|
||||
List<ZlbPayOrder> queryOrder(LocalDate date);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xiang.common.manage.jntyzx.zlb;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xiang.common.mapper.ZlbJlUserInfoMapper;
|
||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbJlUserInfo;
|
||||
import com.xiang.common.utils.DateUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-05-12 09:18
|
||||
*/
|
||||
@Service
|
||||
public class ZlbJlUserInfoManageImpl extends ServiceImpl<ZlbJlUserInfoMapper, ZlbJlUserInfo> implements IZlbJlUserInfoManage {
|
||||
@Override
|
||||
public List<ZlbJlUserInfo> getJlUsers() {
|
||||
LambdaQueryWrapper<ZlbJlUserInfo> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(ZlbJlUserInfo::getDay, DateUtils.getDateFromDate(LocalDate.now()));
|
||||
lambdaQueryWrapper.eq(ZlbJlUserInfo::getDay, DateUtils.getWeekDay(LocalDate.now()));
|
||||
return baseMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xiang.common.manage.jntyzx.zlb;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xiang.common.mapper.ZlbOrderInfoMapper;
|
||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbPayOrder;
|
||||
import com.xiang.common.utils.DateUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-05-09 15:11
|
||||
*/
|
||||
@Service
|
||||
public class ZlbOrderInfoManageImpl extends ServiceImpl<ZlbOrderInfoMapper, ZlbPayOrder> implements IZlbOrderInfoManage {
|
||||
@Override
|
||||
public List<ZlbPayOrder> queryOrder(LocalDate date) {
|
||||
LambdaQueryWrapper<ZlbPayOrder> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(ZlbPayOrder::getDay, DateUtils.getDateFromDate(date));
|
||||
lambdaQueryWrapper.eq(ZlbPayOrder::getIsPay, 0);
|
||||
return baseMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.xiang.common.pojo.jntyzx.zlb;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-05-11 09:43
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ZlbOrderDetailResp {
|
||||
|
||||
private Integer state;
|
||||
private Integer blocId;
|
||||
private Integer stadiumId;
|
||||
private String stadiumArea;
|
||||
private String stadiumName;
|
||||
private String stadiumPhone;
|
||||
private String stadiumType;
|
||||
private String stadiumAddress;
|
||||
private String mapLongitude;
|
||||
private String mapLatitude;
|
||||
private String ticketImg;
|
||||
private String spName;
|
||||
private String siteName;
|
||||
private String siteAmount;
|
||||
// private String orderAmount;
|
||||
private Integer payNumber;
|
||||
// private String ticketInfos;
|
||||
private Integer orderId;
|
||||
private String orderNo;
|
||||
private String orderTime;
|
||||
private String payTime;
|
||||
private Integer payType;
|
||||
private String payAmount;
|
||||
private String discountPayAmount;
|
||||
private String totalDiscountAmount;
|
||||
private String isUseCoupon;
|
||||
private String isUseCard;
|
||||
private String name;
|
||||
private String idCard;
|
||||
private String phone;
|
||||
private String notice;
|
||||
private String blocNotice;
|
||||
private Integer isRefund;
|
||||
private String ticketCate;
|
||||
private String spreadAmout;
|
||||
private Integer isPreferential;
|
||||
private String doNotWatermarkFlag;
|
||||
}
|
||||
@@ -47,4 +47,9 @@ public class ZlbPayOrder {
|
||||
* 0-未付款,1-已付款
|
||||
*/
|
||||
private Integer isPay;
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private String orderId;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class HttpService {
|
||||
CloseableHttpResponse response = null;
|
||||
String result = "";
|
||||
try {
|
||||
log.info("HTTP请求,请求地址===>{}, 请求头===>{}, 请求参数===>{}", url, JSON.toJSONString(header), jsonParams);
|
||||
log.debug("HTTP请求,请求地址===>{}, 请求头===>{}, 请求参数===>{}", url, JSON.toJSONString(header), jsonParams);
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
httpPost.addHeader("Content-Type", "application/json");
|
||||
// 创建请求内容
|
||||
@@ -88,7 +88,7 @@ public class HttpService {
|
||||
}
|
||||
response = httpClient.execute(httpPost);
|
||||
result = EntityUtils.toString(response.getEntity(), "utf-8");
|
||||
log.info("【POST请求】 请求地址===>{}, 响应结果==={}", url, result);
|
||||
log.debug("【POST请求】 请求地址===>{}, 响应结果==={}", url, result);
|
||||
} catch (Exception e) {
|
||||
log.error("doPost异常", e);
|
||||
} finally {
|
||||
@@ -117,10 +117,10 @@ public class HttpService {
|
||||
httpGet.setHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
log.info("doGet请求:请求头:{},请求地址:{}", header, url + request);
|
||||
log.debug("doGet请求:请求头:{},请求地址:{}", header, url + request);
|
||||
response = httpClient.execute(httpGet);
|
||||
result = EntityUtils.toString(response.getEntity(), "utf-8");
|
||||
log.info("【GET请求】, 请求地址===>{}, 响应结果===>{}", url + request, result);
|
||||
log.debug("【GET请求】, 请求地址===>{}, 响应结果===>{}", url + request, result);
|
||||
} catch (Exception e) {
|
||||
log.error("doGet异常:", e);
|
||||
} finally {
|
||||
|
||||
@@ -15,7 +15,7 @@ public class DomainDynamicAnalysisTaskConfig {
|
||||
|
||||
private final DomainDynamicAnalysisTask domainDynamicAnalysisTask;
|
||||
|
||||
@Scheduled(cron = "0 0/30 * * * ? ")
|
||||
@Scheduled(cron = "0 15,45 * * * ? ")
|
||||
@GetMapping("/test")
|
||||
public void dynamicDomainSchedule() {
|
||||
domainDynamicAnalysisTask.run();
|
||||
|
||||
@@ -7,6 +7,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 定时任务配置器
|
||||
*
|
||||
* @Author: xiang
|
||||
* @Date: 2026-05-09 08:56
|
||||
*/
|
||||
@@ -20,35 +22,69 @@ public class JntyzxMiniappScheduleConfig {
|
||||
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 * * ?")
|
||||
/**
|
||||
* 每分钟场地信息更新
|
||||
*/
|
||||
@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 = "5 0 9 * * ?")
|
||||
/**
|
||||
* 下单定时任务
|
||||
*/
|
||||
@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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户场地配置任务 每日8:40运行
|
||||
*
|
||||
* @Author: xiang
|
||||
* @Date: 2026-05-09 09:58
|
||||
*/
|
||||
@@ -90,6 +92,7 @@ public class JntyzxUserInfoConfigTask extends BaseScheduleTaskTemplate {
|
||||
return taskResult;
|
||||
}
|
||||
venueInfoDOS = venueInfoDOS.stream()
|
||||
.filter(item -> !item.getPlaceName().contains("小馆"))
|
||||
.sorted(Comparator.comparing(item -> VenueInfoUtils.sortVenueInfo(item.getPlaceName())))
|
||||
.toList();
|
||||
|
||||
@@ -101,6 +104,7 @@ public class JntyzxUserInfoConfigTask extends BaseScheduleTaskTemplate {
|
||||
|
||||
List<UserInfoDO> list = Lists.newArrayList();
|
||||
int i = 0;
|
||||
userInfoService.delAll();
|
||||
for (UserTokenInfoDO user : users) {
|
||||
VenueInfoDO venueInfoDO = venueInfoDOS.get(i);
|
||||
UserInfoDO userInfoDO = new UserInfoDO();
|
||||
|
||||
@@ -11,6 +11,8 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 用户token刷新定时任务 每半个小时运行一次 在每个小时的20和50分
|
||||
*
|
||||
* @Author: xiang
|
||||
* @Date: 2026-01-15 17:29
|
||||
*/
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,15 +54,18 @@ public class JtVenuePullTask extends BaseScheduleTaskTemplate {
|
||||
this.msgSendUtils = msgSendUtils;
|
||||
}
|
||||
|
||||
private List<SitePositionList> handleMsgSendList(List<SitePositionList> sitePositionLists, int dayOfWeek) {
|
||||
// 过滤出来8-10的未订购的场地信息
|
||||
private List<SitePositionList> handleMsgSendList(List<SitePositionList> sitePositionLists, Integer type) {
|
||||
if (type == 1) {
|
||||
sitePositionLists = sitePositionLists.stream()
|
||||
.filter(VenueInfoUtils::get8210VenueInfo)
|
||||
.filter(item -> StringUtils.equals(item.getContacts(), "0")).toList();
|
||||
// 周六周日过滤小馆,不查询当天小馆信息
|
||||
if (dayOfWeek == 6 || dayOfWeek == 7) {
|
||||
return sitePositionLists.stream()
|
||||
.filter(item -> !item.getPlaceName().contains("小馆"))
|
||||
.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();
|
||||
@@ -91,7 +94,6 @@ public class JtVenuePullTask extends BaseScheduleTaskTemplate {
|
||||
|
||||
@Override
|
||||
protected TaskResult doExecute(Object validatedParams) throws Exception {
|
||||
|
||||
TaskResult taskResult = new TaskResult();
|
||||
taskResult.setSuccess(false);
|
||||
log.info("【Venue】江体小程序场地数据拉取定时任务启动!!!time:{}", System.currentTimeMillis());
|
||||
@@ -104,7 +106,6 @@ public class JtVenuePullTask extends BaseScheduleTaskTemplate {
|
||||
}
|
||||
String token;
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
int dayOfWeek = now.getDayOfWeek().getValue();
|
||||
|
||||
for (UserTokenInfoDO userTokenInfoDO : availableUser) {
|
||||
if (Objects.isNull(userTokenInfoDO)) {
|
||||
@@ -120,21 +121,23 @@ public class JtVenuePullTask extends BaseScheduleTaskTemplate {
|
||||
}
|
||||
venueService.saveOrUpdateTodayVenueInfo(sitePositionLists);
|
||||
|
||||
sitePositionLists = handleMsgSendList(sitePositionLists, dayOfWeek);
|
||||
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||
taskResult.setSuccess(true);
|
||||
taskResult.setSummary("当前无场地信息!");
|
||||
return taskResult;
|
||||
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"));
|
||||
}
|
||||
|
||||
StringBuffer msg = new StringBuffer(
|
||||
"查询到20:00-22:00空闲场地信息=====>\n时间:" + DateUtils.getDateFromDate(LocalDate.now()) + "\n");
|
||||
sitePositionLists.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;
|
||||
|
||||
@@ -32,6 +32,9 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 场地订阅定时任务 每日9:00:00
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RestController
|
||||
|
||||
@@ -26,6 +26,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 场地信息获取定时任务 每日8:30拉取第二天的场地信息
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class JtVenueTomorrowPullTask extends BaseScheduleTaskTemplate {
|
||||
@@ -96,11 +99,25 @@ public class JtVenueTomorrowPullTask extends BaseScheduleTaskTemplate {
|
||||
return taskResult;
|
||||
}
|
||||
venueService.saveTomorrowVenueInfo(sitePositionLists);
|
||||
sitePositionLists = sitePositionLists.stream().filter(VenueInfoUtils::get8210VenueInfo).toList();
|
||||
if (CollectionUtils.isEmpty(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())) {
|
||||
@@ -108,14 +125,10 @@ public class JtVenueTomorrowPullTask extends BaseScheduleTaskTemplate {
|
||||
}
|
||||
map.put(sitePositionList.getPlaceName(), sitePositionList);
|
||||
}
|
||||
StringBuffer msg = new StringBuffer("查询江体场地信息=====>\n时间:" + DateUtils.getDateFromDate(LocalDate.now().plusDays(1)) + " 20:00-22:00\n");
|
||||
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());
|
||||
|
||||
taskResult.setSuccess(Boolean.TRUE);
|
||||
taskResult.setSummary("场地信息获取成功!");
|
||||
return taskResult;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ 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;
|
||||
@@ -37,11 +38,11 @@ public class VenueServiceImpl implements IVenueService {
|
||||
|
||||
@Override
|
||||
public List<SitePositionList> queryVenueService() {
|
||||
String token = userTokenInfoService.getToken("Xiang");
|
||||
String token = userTokenInfoService.getToken("xiang");
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailable("1", token);
|
||||
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailable(WeekendUtils.isWeekend(), token);
|
||||
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
@@ -51,11 +52,11 @@ public class VenueServiceImpl implements IVenueService {
|
||||
|
||||
@Override
|
||||
public List<SitePositionList> queryTomorrowVenue() {
|
||||
String token = userTokenInfoService.getToken("Xiang");
|
||||
String token = userTokenInfoService.getToken("xiang");
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailableTomorrow("1", token);
|
||||
List<SitePositionList> sitePositionLists = jntyzxHttpService.queryAvailableTomorrow(WeekendUtils.isWeekend(), token);
|
||||
if (CollectionUtils.isEmpty(sitePositionLists)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class MsgSendUtils {
|
||||
String cache = (String) redisService.get(redisKey);
|
||||
if (StringUtils.isNotBlank(cache)) {
|
||||
int sendNum = Integer.parseInt(cache);
|
||||
if (sendNum >= 0 && sendNum <= 5) {
|
||||
if (sendNum >= 0 && sendNum < 5) {
|
||||
jtDingTalkFactory.sendMsg(msgContent);
|
||||
redisService.set(key, String.valueOf(++sendNum), 1, TimeUnit.HOURS);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ public class VenueInfoUtils {
|
||||
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");
|
||||
}
|
||||
@@ -35,19 +38,19 @@ public class VenueInfoUtils {
|
||||
}
|
||||
|
||||
public static int sortVenueInfo(String placeName) {
|
||||
if (placeName.contains("十号")) {
|
||||
if (placeName.contains("十号") || placeName.contains("10")) {
|
||||
return 0;
|
||||
}
|
||||
if (placeName.contains("九号")) {
|
||||
if (placeName.contains("九号") || placeName.contains("9")) {
|
||||
return 1;
|
||||
}
|
||||
if (placeName.contains("二号")) {
|
||||
if (placeName.contains("二号") || placeName.contains("2")) {
|
||||
return 2;
|
||||
}
|
||||
if (placeName.contains("八号")) {
|
||||
if (placeName.contains("八号") || placeName.contains("8")) {
|
||||
return 3;
|
||||
}
|
||||
if (placeName.contains("七号")) {
|
||||
if (placeName.contains("七号") || placeName.contains("7")) {
|
||||
return 4;
|
||||
}
|
||||
return 5;
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.xiang.service.module.jntyzx.zlb.schedule;
|
||||
|
||||
import com.xiang.common.enums.ScheduleEnums;
|
||||
import com.xiang.common.factory.JntyzxDingTalkFactory;
|
||||
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
|
||||
import com.xiang.common.manage.jntyzx.zlb.IZlbJlUserInfoManage;
|
||||
import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
|
||||
import com.xiang.common.pojo.schedule.TaskResult;
|
||||
import com.xiang.common.service.IScheduleOpeningConfigService;
|
||||
import com.xiang.common.service.IScheduleRunLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* zlb场地捡漏任务
|
||||
*
|
||||
* @Author: xiang
|
||||
* @Date: 2026-05-12 09:16
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ZlbJlTask extends BaseScheduleTaskTemplate {
|
||||
|
||||
private final ZlbTokenInfoService zlbTokenInfoService;
|
||||
private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
|
||||
private final IZlbJlUserInfoManage zlbJlUserInfoManage;
|
||||
|
||||
|
||||
public ZlbJlTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
|
||||
IScheduleRunLogService scheduleRunLogService,
|
||||
ZlbTokenInfoService zlbTokenInfoService,
|
||||
JntyzxDingTalkFactory jntyzxDingTalkFactory,
|
||||
IZlbJlUserInfoManage zlbJlUserInfoManage) {
|
||||
super(scheduleOpeningConfigService, scheduleRunLogService);
|
||||
this.zlbTokenInfoService = zlbTokenInfoService;
|
||||
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
|
||||
this.zlbJlUserInfoManage = zlbJlUserInfoManage;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTaskName() {
|
||||
return ScheduleEnums.ZLB_ORDER_JL_TASK.getTaskName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer getModule() {
|
||||
return ScheduleEnums.ZLB_ORDER_JL_TASK.getModuleCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getModuleName() {
|
||||
return ScheduleEnums.ZLB_ORDER_JL_TASK.getModule();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TaskResult doExecute(Object validatedParams) throws Exception {
|
||||
|
||||
// TaskResult taskResult = new TaskResult();
|
||||
// taskResult.setSuccess(Boolean.TRUE);
|
||||
// List<ZlbJlUserInfo> jlUsers = zlbJlUserInfoManage.getJlUsers();
|
||||
// if (CollectionUtils.isEmpty(jlUsers)) {
|
||||
// taskResult.setParams("暂无配置捡漏用户");
|
||||
// return taskResult;
|
||||
// }
|
||||
//
|
||||
// List<ZlbTokenInfo> allUsers = zlbTokenInfoService.getAllUsers();
|
||||
// if (CollectionUtils.isEmpty(allUsers)) {
|
||||
// taskResult.setParams("用户信息为空");
|
||||
// return taskResult;
|
||||
// }
|
||||
// Map<String, ZlbTokenInfo> userMap = allUsers.stream().collect(Collectors.toMap(ZlbTokenInfo::getName, Function.identity(), (a, b) -> a));
|
||||
// for (ZlbJlUserInfo jlUser : jlUsers) {
|
||||
// if (userMap.containsKey(jlUser.getName())) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.xiang.service.module.jntyzx.zlb.schedule;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.xiang.common.enums.ScheduleEnums;
|
||||
import com.xiang.common.factory.schedule.BaseScheduleTaskTemplate;
|
||||
import com.xiang.common.manage.jntyzx.zlb.IZlbOrderInfoManage;
|
||||
import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
|
||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbOrderDetailResp;
|
||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbPayOrder;
|
||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbTokenInfo;
|
||||
import com.xiang.common.pojo.schedule.TaskResult;
|
||||
import com.xiang.common.service.IScheduleOpeningConfigService;
|
||||
import com.xiang.common.service.IScheduleRunLogService;
|
||||
import com.xiang.common.utils.OkHttpUtil;
|
||||
import com.xiang.service.module.jntyzx.zlb.constants.ZlbUrlConstants;
|
||||
import com.xiang.service.module.jntyzx.zlb.service.ZlbService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-05-11 09:11
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ZlbOrderQueryTask extends BaseScheduleTaskTemplate {
|
||||
|
||||
private final IZlbOrderInfoManage zlbOrderInfoManage;
|
||||
private final ZlbTokenInfoService zlbTokenInfoService;
|
||||
private final ZlbService zlbService;
|
||||
|
||||
public ZlbOrderQueryTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
|
||||
IScheduleRunLogService scheduleRunLogService,
|
||||
IZlbOrderInfoManage zlbOrderInfoManage,
|
||||
ZlbTokenInfoService zlbTokenInfoService, ZlbService zlbService) {
|
||||
super(scheduleOpeningConfigService, scheduleRunLogService);
|
||||
this.zlbOrderInfoManage = zlbOrderInfoManage;
|
||||
this.zlbTokenInfoService = zlbTokenInfoService;
|
||||
this.zlbService = zlbService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTaskName() {
|
||||
return ScheduleEnums.ZLB_ORDER_QUERY_TASK.getTaskName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer getModule() {
|
||||
return ScheduleEnums.ZLB_ORDER_QUERY_TASK.getModuleCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getModuleName() {
|
||||
return ScheduleEnums.ZLB_ORDER_QUERY_TASK.getModule();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TaskResult doExecute(Object validatedParams) throws Exception {
|
||||
TaskResult taskResult = new TaskResult();
|
||||
taskResult.setSuccess(Boolean.TRUE);
|
||||
|
||||
List<ZlbPayOrder> orders = zlbOrderInfoManage.queryOrder(LocalDate.now().plusDays(1));
|
||||
if (CollectionUtils.isEmpty(orders)) {
|
||||
taskResult.setSummary("无可使用的订单");
|
||||
return taskResult;
|
||||
}
|
||||
List<ZlbTokenInfo> users = zlbTokenInfoService.getAllUsers();
|
||||
if (CollectionUtils.isEmpty(users)) {
|
||||
taskResult.setSummary("无可使用的用户");
|
||||
return taskResult;
|
||||
}
|
||||
Map<String, ZlbTokenInfo> userMap = users.stream().collect(Collectors.toMap(ZlbTokenInfo::getName, Function.identity(), (a, b) -> a));
|
||||
|
||||
OkHttpUtil client = OkHttpUtil.getInstance();
|
||||
List<ZlbPayOrder> result = Lists.newArrayList();
|
||||
for (ZlbPayOrder order : orders) {
|
||||
if (!userMap.containsKey(order.getName())) {
|
||||
continue;
|
||||
}
|
||||
ZlbTokenInfo zlbTokenInfo = userMap.get(order.getName());
|
||||
String orderDetailStr = client.postJson(String.format(ZlbUrlConstants.getOrderDetailUrl, order.getOrderId()), zlbService.getHeaders(zlbTokenInfo.getTokenId()),"{}");
|
||||
if (StringUtils.isBlank(orderDetailStr)) {
|
||||
log.info("订单:{}查询结果为空", order.getOrderId());
|
||||
continue;
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(orderDetailStr);
|
||||
ZlbOrderDetailResp data = JSON.parseObject(jsonObject.getString("data"), ZlbOrderDetailResp.class);
|
||||
if (Objects.isNull(data)) {
|
||||
continue;
|
||||
}
|
||||
if (Objects.equals(data.getState(), 2)) {
|
||||
order.setIsPay(1);
|
||||
result.add(order);
|
||||
} else {
|
||||
order.setIsPay(2);
|
||||
result.add(order);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(result)) {
|
||||
zlbOrderInfoManage.updateBatchById(result);
|
||||
}
|
||||
|
||||
taskResult.setSummary("订单查询成功!");
|
||||
return taskResult;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import com.xiang.common.enums.ScheduleEnums;
|
||||
import com.xiang.common.exception.BusinessException;
|
||||
import com.xiang.common.factory.JntyzxDingTalkFactory;
|
||||
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.ZlbUserInfo;
|
||||
import com.xiang.common.pojo.schedule.TaskResult;
|
||||
@@ -24,6 +26,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@@ -40,6 +43,7 @@ public class ZlbOrderTask extends BaseScheduleTaskTemplate {
|
||||
private final ZlbTokenInfoService zlbTokenInfoService;
|
||||
private final JntyzxDingTalkFactory jntyzxDingTalkFactory;
|
||||
private final RedisTemplate redisTemplate;
|
||||
private final IZlbOrderInfoManage zlbOrderInfoManage;
|
||||
|
||||
public ZlbOrderTask(IScheduleOpeningConfigService scheduleOpeningConfigService,
|
||||
IScheduleRunLogService scheduleRunLogService,
|
||||
@@ -47,13 +51,15 @@ public class ZlbOrderTask extends BaseScheduleTaskTemplate {
|
||||
ZlbService zlbService,
|
||||
ZlbTokenInfoService zlbTokenInfoService,
|
||||
JntyzxDingTalkFactory jntyzxDingTalkFactory,
|
||||
RedisTemplate redisTemplate) {
|
||||
RedisTemplate redisTemplate,
|
||||
IZlbOrderInfoManage zlbOrderInfoManage) {
|
||||
super(scheduleOpeningConfigService, scheduleRunLogService);
|
||||
this.zlbUserInfoService = zlbUserInfoService;
|
||||
this.zlbService = zlbService;
|
||||
this.zlbTokenInfoService = zlbTokenInfoService;
|
||||
this.jntyzxDingTalkFactory = jntyzxDingTalkFactory;
|
||||
this.redisTemplate = redisTemplate;
|
||||
this.zlbOrderInfoManage = zlbOrderInfoManage;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,11 +104,15 @@ public class ZlbOrderTask extends BaseScheduleTaskTemplate {
|
||||
String tokenId = zlbTokenInfo.getTokenId();
|
||||
String secretKey = zlbService.getKey(tokenId, client);
|
||||
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());
|
||||
String newOrderJson = zlbService.buildNewOrder(siteOrderDetailsStr, client);
|
||||
if (StringUtils.isBlank(newOrderJson)) {
|
||||
log.info("构建订单参数异常:{}", siteOrderDetailsStr);
|
||||
throw new BusinessException("");
|
||||
throw new BusinessException("构建订单参数异常");
|
||||
}
|
||||
ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
|
||||
//计算9点到现在的时间差
|
||||
@@ -138,18 +148,27 @@ public class ZlbOrderTask extends BaseScheduleTaskTemplate {
|
||||
log.info("订单接口返回结果==> \n {}", response);
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
if (jsonObject.getInteger("code") == 200) {
|
||||
jntyzxDingTalkFactory.sendMsg(name + "zlb订单接口下单返回成功请2分钟内付款√√√√√√场地号:" + placeName + "时间:" + siteTimeName);
|
||||
jntyzxDingTalkFactory.sendMsg(name + ":zlb订单接口下单返回成功请2分钟内付款√√√√√√场地号:" + placeName + "时间:" + siteTimeName);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String orderId = data.getString("orderId");
|
||||
log.info("{}订单{}创建成功", name, orderId);
|
||||
String redisKey = ZlbUrlConstants.REDIS_PREFIX + "_" + orderId + "_" + name;
|
||||
redisTemplate.opsForValue().set(redisKey, name);
|
||||
redisTemplate.expire(redisKey, 120, TimeUnit.SECONDS);
|
||||
ZlbPayOrder zlbPayOrder = new ZlbPayOrder();
|
||||
zlbPayOrder.setName(name);
|
||||
zlbPayOrder.setOrderId(orderId);
|
||||
zlbPayOrder.setDay(DateUtils.getDateFromDate(LocalDate.now().plusDays(1)));
|
||||
zlbPayOrder.setVenues("江体");
|
||||
zlbPayOrder.setPlaceName(placeName);
|
||||
zlbPayOrder.setTime(siteTimeName);
|
||||
zlbPayOrder.setIsPay(0);
|
||||
zlbOrderInfoManage.save(zlbPayOrder);
|
||||
return true;
|
||||
}
|
||||
if (jsonObject.getInteger("code") == 500) {
|
||||
if (jsonObject.getString("message").contains("已被售出")) {
|
||||
jntyzxDingTalkFactory.sendMsg(name + "zlb订单接口下单返回失败❌❌❌场地号:" + placeName + "已被售出");
|
||||
jntyzxDingTalkFactory.sendMsg(name + ":zlb订单接口下单返回失败❌❌❌场地号:" + placeName + "已被售出");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class ZlbSiteDayTask extends BaseScheduleTaskTemplate {
|
||||
String day = DateUtils.format(date, DateUtils.ENUM_FORMAT_YMD);
|
||||
LambdaQueryWrapper<ZlbPayOrder> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(ZlbPayOrder::getDay, day);
|
||||
wrapper.eq(ZlbPayOrder::getIsPay, 1);
|
||||
wrapper.orderByAsc(ZlbPayOrder::getTime);
|
||||
List<ZlbPayOrder> zlbPayOrders = zlbOrderInfoMapper.selectList(wrapper);
|
||||
if (!zlbPayOrders.isEmpty()){
|
||||
|
||||
@@ -17,42 +17,68 @@ public class ZlbTaskConfig {
|
||||
private final ZlbSiteDayTask zlbSiteDayTask;
|
||||
private final ZlbOrderTask zlbOrderTask;
|
||||
private final ZlbUserConfigTask zlbUserConfigTask;
|
||||
private final ZlbOrderQueryTask zlbOrderQueryTask;
|
||||
|
||||
@Scheduled(cron = "0 0/30 * * * ?")
|
||||
/**
|
||||
* token续期
|
||||
*/
|
||||
@Scheduled(cron = "0 10,40 * * * ?")
|
||||
@GetMapping("/zlbLoginTask")
|
||||
public void zlbLoginTask() {
|
||||
zlbLoginTask.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* token校验
|
||||
*/
|
||||
@Scheduled(cron = "0 0 8 * * *")
|
||||
@GetMapping("/zlbTokenRefresh")
|
||||
public void zlbTokenRefresh() {
|
||||
zlbTokenRefreshTask.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* 场地信息拉取 拉取后天的场地信息
|
||||
*/
|
||||
@GetMapping("/zlbSiteTask")
|
||||
@Scheduled(cron = "30 30 16 * * ?")
|
||||
public void zlbSiteTask() {
|
||||
zlbSiteTask.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当天场地订阅信息--数据库数据
|
||||
*/
|
||||
@GetMapping("/zlbSiteDayTask")
|
||||
@Scheduled(cron = "0 00 17 * * ?")
|
||||
public void zlbSiteDayTask() {
|
||||
zlbSiteDayTask.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下单
|
||||
*/
|
||||
@GetMapping("/zlbOrderCreateTask")
|
||||
@Scheduled(cron = "2 0 9 * * ?")
|
||||
public void zlbOrderCreateTask() {
|
||||
zlbOrderTask.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下单用户场地配置信息
|
||||
*/
|
||||
@Scheduled(cron = "30 35 16 * * ?")
|
||||
@GetMapping("/zlbUserConfig")
|
||||
public void zlbUserConfig() {
|
||||
zlbUserConfigTask.run();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 9:05查询订单是否已经支付
|
||||
*/
|
||||
@Scheduled(cron = "0 5 9 * * ?")
|
||||
@GetMapping("/zlbOrderQueryTask")
|
||||
public void zlbOrderQueryTask() {
|
||||
zlbOrderQueryTask.run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.xiang.service.module.jntyzx.zlb.server;
|
||||
|
||||
import com.xiang.service.module.jntyzx.zlb.service.ZlbService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-05-12 09:27
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class JtZlbController {
|
||||
|
||||
private final ZlbService zlbService;
|
||||
private static final ExecutorService executorService = Executors.newFixedThreadPool(1);
|
||||
|
||||
@GetMapping("/token")
|
||||
public void token(@RequestParam("name") String name, @RequestParam("token") String token) throws Exception {
|
||||
zlbService.token(token, name);
|
||||
}
|
||||
|
||||
@GetMapping("/zlbJl")
|
||||
public void zlbJlTask(@RequestParam("name") String name, @RequestParam("date") String date, @RequestParam("time") String time, @RequestParam("interval") Long interval) throws Exception {
|
||||
|
||||
log.info("[zlbJl] zlb自定义捡漏任务启动!用户:{}, 时间:{}", name, date);
|
||||
executorService.submit(() -> {
|
||||
try {
|
||||
zlbService.jianlou(name, date, time, interval);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -18,26 +18,16 @@ public interface ZlbService {
|
||||
|
||||
String getKey(String tokenId, OkHttpUtil client) throws IOException;
|
||||
|
||||
|
||||
void testJs(String token, String name) throws IOException;
|
||||
void token(String token, String name) throws IOException;
|
||||
|
||||
Map<String, String> getHeaders(String tokenId);
|
||||
|
||||
String buildSiteOrder(ZlbUserInfo zlbUserInfo, String secretKey, String day) throws Exception;
|
||||
|
||||
void createOrder(ZlbUserInfo zlbUserInfo) throws Exception;
|
||||
|
||||
String createOrderWq(ZlbUserInfo zlbUserInfo) throws Exception;
|
||||
|
||||
String buildNewOrder(String siteOrderDetailsStr, OkHttpUtil client) throws IOException;
|
||||
|
||||
void deleteRedis(String name);
|
||||
|
||||
void installRedis(String name);
|
||||
void jianlou(String name, String day, String time, long interval) throws Exception;
|
||||
|
||||
void jianlou(String name, String day,long time) throws Exception;
|
||||
|
||||
void refundOrder(String refundName, String day) throws Exception;
|
||||
|
||||
void cancelOrder(String cancelName, String day) throws Exception;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xiang.common.factory.JntyzxDingTalkFactory;
|
||||
import com.xiang.common.manage.jntyzx.zlb.ZlbSiteInfoService;
|
||||
import com.xiang.common.manage.jntyzx.zlb.ZlbTokenInfoService;
|
||||
import com.xiang.common.manage.jntyzx.zlb.ZlbUserInfoService;
|
||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbCaptchaResp;
|
||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbOrderInfo;
|
||||
import com.xiang.common.pojo.jntyzx.zlb.ZlbOrderJson;
|
||||
@@ -24,7 +23,6 @@ import com.xiang.common.pojo.jntyzx.zlb.ZlbUserInfo;
|
||||
import com.xiang.common.service.ICodeService;
|
||||
import com.xiang.common.utils.AESECBUtils;
|
||||
import com.xiang.common.utils.Base64ImageScaler;
|
||||
import com.xiang.common.utils.DateUtils;
|
||||
import com.xiang.common.utils.OkHttpUtil;
|
||||
import com.xiang.common.utils.ZlbCaptchaTrackUtil;
|
||||
import com.xiang.service.module.jntyzx.zlb.constants.ZlbUrlConstants;
|
||||
@@ -62,8 +60,6 @@ public class ZlbServiceImpl implements ZlbService {
|
||||
@Autowired
|
||||
private JntyzxDingTalkFactory jntyzxDingTalkFactory;
|
||||
@Autowired
|
||||
private ZlbUserInfoService zlbUserInfoService;
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
@Autowired
|
||||
private ICodeService codeService;
|
||||
@@ -219,34 +215,6 @@ public class ZlbServiceImpl implements ZlbService {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createOrder(ZlbUserInfo zlbUserInfo) throws Exception {
|
||||
Date date = DateUtils.addDate(new Date(), 1);
|
||||
String day = DateUtils.format(date, DateUtils.ENUM_FORMAT_YMD);
|
||||
String name = zlbUserInfo.getName();
|
||||
String placeName = zlbUserInfo.getPlaceName();
|
||||
String siteTimeName = zlbUserInfo.getSiteTimeName();
|
||||
//获取Token
|
||||
ZlbTokenInfo zlbTokenInfo = zlbTokenInfoService.queryByName(name);
|
||||
OkHttpUtil client = OkHttpUtil.getInstance();
|
||||
String tokenId = zlbTokenInfo.getTokenId();
|
||||
String secretKey = getKey(tokenId, client);
|
||||
//组装场地信息
|
||||
String siteOrderDetailsStr = buildSiteOrder(zlbUserInfo, secretKey, day);
|
||||
//加密
|
||||
|
||||
for (int i = 1; i < 12; i++) {
|
||||
String response1 = sendOrder(siteOrderDetailsStr, zlbTokenInfo.getTokenId(), client);
|
||||
String str = buildOrder(name, response1, placeName, siteTimeName);
|
||||
if ("下单成功".equals(str)) {
|
||||
return;
|
||||
}
|
||||
if ("您选择场地已被售出".equals(str)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String buildOrder(String name, String response, String placeName, String siteTimeName) throws InterruptedException {
|
||||
String orderId = "";
|
||||
log.info("订单接口返回结果==> \n {}", response);
|
||||
@@ -280,51 +248,6 @@ public class ZlbServiceImpl implements ZlbService {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createOrderWq(ZlbUserInfo zlbUserInfo) throws Exception {
|
||||
String orderId = "";
|
||||
Date date = DateUtils.addDate(new Date(), 3);
|
||||
String day = DateUtils.format(date, DateUtils.ENUM_FORMAT_YMD);
|
||||
String name = zlbUserInfo.getName();
|
||||
String placeName = zlbUserInfo.getPlaceName();
|
||||
String siteTimeName = zlbUserInfo.getSiteTimeName();
|
||||
//获取Token
|
||||
ZlbTokenInfo zlbTokenInfo = zlbTokenInfoService.queryByName(name);
|
||||
String siteOrderDetailsStr = buildSiteOrderList(zlbUserInfo, zlbTokenInfo.getSecretKey(), day);
|
||||
//组装参数加密
|
||||
for (int i = 1; i < 10; i++) {
|
||||
String response = sendOrderWq(siteOrderDetailsStr, zlbTokenInfo.getTokenId());
|
||||
log.info("订单接口返回结果==> \n {}", response);
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
if (jsonObject.getInteger("code") == 200) {
|
||||
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回成功请2分钟内付款√√√√√√场地号:" + placeName + "时间:" + siteTimeName);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
orderId = data.getString("orderId");
|
||||
return orderId;
|
||||
} else if (response.contains("下单失败")) {
|
||||
jntyzxDingTalkFactory.sendMsg(response);
|
||||
return "";
|
||||
} else if (response.contains("场地不在可售时间内")) {
|
||||
jntyzxDingTalkFactory.sendMsg(response);
|
||||
return "";
|
||||
} else if (response.contains("您选择场地已被售出")) {
|
||||
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回失败 \n" + response);
|
||||
return "";
|
||||
} else if (response.contains("此票超过用户每日订场次数")) {
|
||||
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回失败 \n" + response);
|
||||
return "";
|
||||
} else if (response.contains("您有一笔待支付的订场订单")) {
|
||||
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回失败 \n" + response);
|
||||
Thread.sleep(1500);
|
||||
} else if (response.contains("场地火爆")) {
|
||||
log.info("{}场地火爆下单返回失败暂停1s下单 \n{}", name, response);
|
||||
Thread.sleep(200);
|
||||
} else {
|
||||
jntyzxDingTalkFactory.sendMsg(name + "订单接口下单返回失败请检查日志重试第" + i + "次××××××==> \n" + response);
|
||||
}
|
||||
}
|
||||
return orderId;
|
||||
}
|
||||
|
||||
private String sendOrderWq(String siteOrderDetailsStr, String tokenId) throws IOException {
|
||||
OkHttpUtil client = OkHttpUtil.getInstance();
|
||||
@@ -450,15 +373,8 @@ public class ZlbServiceImpl implements ZlbService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installRedis(String name) {
|
||||
String redisKey = ZlbUrlConstants.REDIS_PREFIX + "_" + 123456 + "_" + name;
|
||||
redisTemplate.opsForValue().set(redisKey, name);
|
||||
redisTemplate.expire(redisKey, 1234, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jianlou(String name, String day, long time) throws Exception {
|
||||
jntyzxDingTalkFactory.sendMsg(name + "自定义捡漏开始捡漏时间:" + day + " 捡漏人:" + name + " 捡漏间隔:" + time + "ms");
|
||||
public void jianlou(String name, String day, String time, long interval) throws Exception {
|
||||
jntyzxDingTalkFactory.sendMsg(name + "自定义捡漏开始捡漏时间:" + day + " 捡漏人:" + name + " 捡漏间隔:" + interval + "ms");
|
||||
//获取Token
|
||||
ZlbTokenInfo zlbTokenInfo = zlbTokenInfoService.queryByName(name);
|
||||
String tokenId = zlbTokenInfo.getTokenId();
|
||||
@@ -496,6 +412,9 @@ public class ZlbServiceImpl implements ZlbService {
|
||||
String listString = data.getString("list");
|
||||
zlbSiteInfos = JSONArray.parseArray(listString, ZlbSiteInfo.class);
|
||||
for (ZlbSiteInfo zlbSiteInfo : zlbSiteInfos) {
|
||||
if (!StringUtils.equals(zlbSiteInfo.getDayEffectiveTimes(), time)) {
|
||||
continue;
|
||||
}
|
||||
Integer ticketType = zlbSiteInfo.getTicketType();
|
||||
if (ticketType == 1) {//代表可以抢的场地号
|
||||
jntyzxDingTalkFactory.sendMsg(day + "ZLb捡漏发现场地:" + zlbSiteInfo.getPlaceName() + "时间点:" + zlbSiteInfo.getDayEffectiveTimes());
|
||||
@@ -539,7 +458,7 @@ public class ZlbServiceImpl implements ZlbService {
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
//休息5s
|
||||
Thread.sleep(time);
|
||||
Thread.sleep(interval);
|
||||
} catch (Exception e) {
|
||||
log.error("请求场地信息异常:{}", e.getMessage());
|
||||
jntyzxDingTalkFactory.sendMsg(name + "ZLb自定义捡漏异常请查看日志");
|
||||
@@ -551,91 +470,6 @@ public class ZlbServiceImpl implements ZlbService {
|
||||
jntyzxDingTalkFactory.sendMsg("自定义捡漏结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refundOrder(String refundName, String day) throws Exception {
|
||||
//找到退款人的token
|
||||
ZlbTokenInfo zlbTokenInfo = zlbTokenInfoService.getOne(new LambdaQueryWrapper<ZlbTokenInfo>().eq(ZlbTokenInfo::getName, refundName));
|
||||
if (zlbTokenInfo == null) {
|
||||
jntyzxDingTalkFactory.sendMsg("退款失败,请检查是否录入退款人登录信息-->" + refundName);
|
||||
}
|
||||
OkHttpUtil client = OkHttpUtil.getInstance();
|
||||
//获取退款人的订单列表
|
||||
String s = client.postJson(ZlbUrlConstants.getOrderInfoUrl, getHeaders(zlbTokenInfo.getTokenId()), "{\"curPage\":1,\"maxPage\":10,\"state\":2,\"type\":2}");
|
||||
log.info("{}订单列表==> \n {}", refundName, s);
|
||||
//获取当前日期下的orderId
|
||||
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
if (data.getInteger("total").equals(0)) {
|
||||
jntyzxDingTalkFactory.sendMsg("退款失败,请检查是否存在待使用订单-->" + refundName);
|
||||
return;
|
||||
}
|
||||
JSONArray list = data.getJSONArray("list");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JSONObject jsonObject1 = list.getJSONObject(i);
|
||||
String orderId = jsonObject1.getString("orderId");
|
||||
Integer stadiumId = jsonObject1.getInteger("stadiumId");
|
||||
String validity = jsonObject1.getString("validity");
|
||||
log.info("stadiumId:{} ,validity:{},orderId:{}", stadiumId, validity, orderId);
|
||||
if (stadiumId.equals(49) && validity.contains(day)) {
|
||||
//拿到订单详情
|
||||
String orderDetailStr = client.postJson(String.format(ZlbUrlConstants.getOrderDetailUrl, orderId), getHeaders(zlbTokenInfo.getTokenId()), "{}");
|
||||
log.info("{}订单详情==> \n {}", orderId, orderDetailStr);
|
||||
JSONObject jsonObject2 = JSONObject.parseObject(orderDetailStr);
|
||||
JSONObject data1 = jsonObject2.getJSONObject("data");
|
||||
JSONArray ticketInfos = data1.getJSONArray("ticketInfos");
|
||||
for (int j = 0; j < ticketInfos.size(); j++) {
|
||||
JSONObject ticketInfo = ticketInfos.getJSONObject(j);
|
||||
String detailOrderId = ticketInfo.getString("detailOrderId");
|
||||
//取消订单
|
||||
String cancelOrder = client.postJson(ZlbUrlConstants.getOrderRefundUrl, getHeaders(zlbTokenInfo.getTokenId()), String.format(ZlbUrlConstants.refundStr, orderId, detailOrderId));
|
||||
log.info("{}退款订单==> \n {}", refundName, cancelOrder);
|
||||
if (cancelOrder.contains("退款成功")) {
|
||||
jntyzxDingTalkFactory.sendMsg(refundName + "退款成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelOrder(String cancelName, String day) throws Exception {
|
||||
//找到取消人的token
|
||||
ZlbTokenInfo zlbTokenInfo = zlbTokenInfoService.getOne(new LambdaQueryWrapper<ZlbTokenInfo>().eq(ZlbTokenInfo::getName, cancelName));
|
||||
if (zlbTokenInfo == null) {
|
||||
jntyzxDingTalkFactory.sendMsg("取消失败,请检查是否录入取消人登录信息-->" + cancelName);
|
||||
}
|
||||
OkHttpUtil client = OkHttpUtil.getInstance();
|
||||
//获取取消人的订单列表
|
||||
String s = client.postJson(ZlbUrlConstants.getOrderInfoUrl, getHeaders(zlbTokenInfo.getTokenId()), "{\"curPage\":1,\"maxPage\":10,\"state\":1,\"type\":2}");
|
||||
log.info("{}订单列表==> \n {}", cancelName, s);
|
||||
//获取当前日期下的orderId
|
||||
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
if (data.getInteger("total").equals(0)) {
|
||||
jntyzxDingTalkFactory.sendMsg("取消失败,请检查是否存在待使用订单-->" + cancelName);
|
||||
return;
|
||||
}
|
||||
JSONArray list = data.getJSONArray("list");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JSONObject jsonObject1 = list.getJSONObject(i);
|
||||
String orderId = jsonObject1.getString("orderId");
|
||||
Integer stadiumId = jsonObject1.getInteger("stadiumId");
|
||||
String validity = jsonObject1.getString("validity");
|
||||
log.info("stadiumId:{} ,validity:{},orderId:{}", stadiumId, validity, orderId);
|
||||
if (stadiumId.equals(49) && validity.contains(day)) {
|
||||
//取消订单,并直接删除redis相关信息
|
||||
String cancelOrder = client.postJson(ZlbUrlConstants.getOrderCancelUrl, getHeaders(zlbTokenInfo.getTokenId()), String.format(ZlbUrlConstants.cancelStr, orderId));
|
||||
deleteRedis(orderId);
|
||||
log.info("{}取消订单==> \n {}", cancelName, cancelOrder);
|
||||
if (cancelOrder.contains("取消成功")) {
|
||||
jntyzxDingTalkFactory.sendMsg(cancelName + "取消成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String sendPost(OkHttpUtil client, Map<String, String> headers, String encrypt) throws IOException {
|
||||
String newOrderJson = buildNewOrder(encrypt, client);
|
||||
String response = null;
|
||||
@@ -649,7 +483,7 @@ public class ZlbServiceImpl implements ZlbService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testJs(String token, String name) throws IOException {
|
||||
public void token(String token, String name) throws IOException {
|
||||
log.info("获取到name:{},token:{}", name, token);
|
||||
LambdaQueryWrapper<ZlbTokenInfo> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(ZlbTokenInfo::getName, name);
|
||||
|
||||
@@ -26,7 +26,7 @@ spring:
|
||||
|
||||
aliyun:
|
||||
dns:
|
||||
rootDomain: xiangtech.xyz
|
||||
rootDomain: xiangtech.top
|
||||
RR:
|
||||
- client
|
||||
- file
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<configuration scan="true">
|
||||
|
||||
<!-- 应用名称:和统一配置中的项目代码保持一致(小写) -->
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="X_APP" />
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="APP" />
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<!--日志文件保留天数 -->
|
||||
@@ -65,6 +65,23 @@
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="APP_WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<FileNamePattern>${LOG_HOME}/warn-%d{yyyy-MM-dd}.log</FileNamePattern>
|
||||
<MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%contextName: %d{yyyy-MM-dd HH:mm:ss.SSS} [%c][%t][%L][%p] [traceId:%X{traceId:-},spanId:%X{spanId:-},localIp:%X{localIp:-}] - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>warn</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
|
||||
<!-- 按照每天生成日志文件:主项目日志 -->
|
||||
<appender name="APP_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
@@ -90,12 +107,12 @@
|
||||
<root level="INFO">
|
||||
<appender-ref ref="APP_DEBUG"/>
|
||||
<appender-ref ref="APP_INFO"/>
|
||||
<appender-ref ref="APP_WARN"/>
|
||||
<appender-ref ref="APP_ERROR"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
|
||||
<!-- mybatis 日志级别 -->
|
||||
<logger name="com.xiang" level="INFO"/>
|
||||
<logger name="com.xiang" level="DEBUG"/>
|
||||
<!-- Spring 框架 -->
|
||||
<logger name="org.springframework" level="INFO"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user