28 Commits

Author SHA1 Message Date
Xiang
217dc6879d fix:glados签到脚本 2026-01-23 09:58:46 +08:00
Xiang
12728d5c84 fix:glados签到球服 2026-01-23 09:35:38 +08:00
Xiang
8928c076c5 fix:glados域名修复 2026-01-23 09:06:17 +08:00
xiang
ec6723070f feat:清理代码 2026-01-15 23:34:26 +08:00
xiang
5b9ac21ecf fix:消息重复发送 2025-12-18 19:21:42 +08:00
Xiang
f3637a80f2 feat:token 更新消息 2025-12-18 10:30:45 +08:00
Xiang
4bc549eebe fix:token接口,数据获取 2025-12-18 10:11:32 +08:00
Xiang
237fcc7139 fix:token接口,数据获取 2025-12-18 09:28:07 +08:00
Xiang
4277106d00 fix:数据拉取 2025-12-17 09:02:22 +08:00
Xiang
7932222f8e style:代码格式 2025-12-17 08:41:41 +08:00
Xiang
6d19b1a021 fix: 获取token 2025-12-17 08:41:10 +08:00
xiang
57a28b4049 fix:拉取jt场地数据 2025-12-16 22:38:54 +08:00
Xiang
a3c9e2eb51 feat:下单查询 2025-12-16 16:24:52 +08:00
Xiang
93969624c1 feat:下单定时任务 2025-12-16 14:38:52 +08:00
Xiang
4904be16da feat:捡漏下单 2025-12-16 11:28:21 +08:00
Xiang
c4915b17c8 feat:订单创建 2025-12-16 11:04:51 +08:00
Xiang
7fce8c91f2 feat:订单创建 2025-12-16 10:57:36 +08:00
Xiang
d942b31c8b feat:用户token更新 2025-12-16 09:49:40 +08:00
Xiang
d7b49281c1 feat:用户token更新 2025-12-16 09:48:50 +08:00
Xiang
c6817b23fc feat:用户token更新 2025-12-16 09:43:02 +08:00
Xiang
69257b5c80 feat:场地查询 2025-12-15 17:32:40 +08:00
Xiang
1cd24c78e7 feat:场地查询 2025-12-15 17:20:39 +08:00
Xiang
12c4ccdd5d fear:场地查询 2025-12-15 16:29:28 +08:00
Xiang
d5c096e7a5 fix:场地信息消息构建BUG 2025-12-15 15:37:04 +08:00
Xiang
b7ecbdfa7a feat:定时任务查询 2025-12-15 15:28:35 +08:00
Xiang
454d93b5cc feat:查询江体小程序场地信息 2025-12-15 14:47:14 +08:00
xiang
fd30c72a73 fix:修复 2025-12-13 18:29:55 +08:00
xiang
48590d5d26 fix:修复 2025-12-13 18:29:21 +08:00
32 changed files with 253 additions and 324 deletions

44
pom.xml
View File

@@ -28,39 +28,39 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.xiang.pom</groupId> <groupId>com.xiang</groupId>
<artifactId>xmc-mysql-starter</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.xiang</groupId>
<artifactId>xmc-cache-starter</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.xiang</groupId>
<artifactId>xmc-common</artifactId> <artifactId>xmc-common</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.xiang</groupId> <groupId>com.xiang</groupId>
<artifactId>xservice-common</artifactId> <artifactId>xmc-message-starter</artifactId>
<version>2.0</version> <version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.xiang.starter</groupId>
<artifactId>xmc-http-starter</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.xiang</groupId> <groupId>com.xiang</groupId>
<artifactId>xservice-message-starter</artifactId> <artifactId>xmc-logger-starter</artifactId>
<version>2.0</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.xiang</groupId> <groupId>com.xiang</groupId>
<artifactId>xservice-schedule-starter</artifactId> <artifactId>xmc-schedule-starter</artifactId>
<version>2.0</version> <version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.xiang</groupId>
<artifactId>xservice-cache-starter</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.xiang</groupId>
<artifactId>xservice-http-starter</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.xiang</groupId>
<artifactId>xservice-mysql-starter</artifactId>
<version>2.0</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -1,6 +1,6 @@
package com.xiang.xservice.application.script.domain.service; package com.xiang.xservice.application.script.domain.service;
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService; import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
import com.xiang.xservice.config.DingTalkRobotScriptConfig; import com.xiang.xservice.config.DingTalkRobotScriptConfig;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@@ -3,13 +3,17 @@ package com.xiang.xservice.application.script.fwd.schedule;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xiang.xservice.application.script.fwd.entity.pojo.FUserConfig; import com.xiang.xmc.service.schedule.core.DynamicTaskScheduler;
import com.xiang.xservice.basic.utils.DateUtils; import com.xiang.xmc.service.schedule.entity.ScheduledTaskEntity;
import com.xiang.xservice.basic.utils.PrimaryKeyUtils; import com.xiang.xmc.service.schedule.entity.TaskConfig;
import com.xiang.xmc.service.schedule.enums.TaskGroupEnum;
import com.xiang.xmc.service.schedule.enums.TaskStatusEnum;
import com.xiang.xmc.service.schedule.service.IDynamicTaskSchedulerService;
import com.xiang.xservice.application.script.fwd.entity.param.FwdOrderTaskParam; import com.xiang.xservice.application.script.fwd.entity.param.FwdOrderTaskParam;
import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformConfig; import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformConfig;
import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformProjectInfo; import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformProjectInfo;
import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformSeatInfo; import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformSeatInfo;
import com.xiang.xservice.application.script.fwd.entity.pojo.FUserConfig;
import com.xiang.xservice.application.script.fwd.entity.resp.http.perform.Perform; import com.xiang.xservice.application.script.fwd.entity.resp.http.perform.Perform;
import com.xiang.xservice.application.script.fwd.entity.resp.http.perform.PerformDetail; import com.xiang.xservice.application.script.fwd.entity.resp.http.perform.PerformDetail;
import com.xiang.xservice.application.script.fwd.entity.resp.http.perform.PerformInfo; import com.xiang.xservice.application.script.fwd.entity.resp.http.perform.PerformInfo;
@@ -23,14 +27,10 @@ import com.xiang.xservice.application.script.fwd.service.DingTalkScriptFWDServic
import com.xiang.xservice.application.script.fwd.service.IPerformService; import com.xiang.xservice.application.script.fwd.service.IPerformService;
import com.xiang.xservice.application.script.fwd.service.IPerformServiceHttp; import com.xiang.xservice.application.script.fwd.service.IPerformServiceHttp;
import com.xiang.xservice.application.script.fwd.utils.TimeSyncUtils; import com.xiang.xservice.application.script.fwd.utils.TimeSyncUtils;
import com.xiang.xservice.basic.utils.DateUtils;
import com.xiang.xservice.basic.utils.PrimaryKeyUtils;
import com.xiang.xservice.common.entity.SysConfigDO; import com.xiang.xservice.common.entity.SysConfigDO;
import com.xiang.xservice.common.mapper.SysConfigMapper; import com.xiang.xservice.common.mapper.SysConfigMapper;
import com.xiang.xservice.schedule.core.DynamicTaskScheduler;
import com.xiang.xservice.schedule.entity.ScheduledTaskEntity;
import com.xiang.xservice.schedule.entity.TaskConfig;
import com.xiang.xservice.schedule.enums.TaskGroupEnum;
import com.xiang.xservice.schedule.enums.TaskStatusEnum;
import com.xiang.xservice.schedule.service.IDynamicTaskSchedulerService;
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;

View File

@@ -1,6 +1,7 @@
package com.xiang.xservice.application.script.fwd.schedule; package com.xiang.xservice.application.script.fwd.schedule;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.xiang.xmc.service.http.helper.HttpRequestHelper;
import com.xiang.xservice.application.script.fwd.entity.pojo.FAudienceConfig; import com.xiang.xservice.application.script.fwd.entity.pojo.FAudienceConfig;
import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformProjectInfo; import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformProjectInfo;
import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformSeatInfo; import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformSeatInfo;
@@ -24,7 +25,6 @@ import com.xiang.xservice.basic.common.req.BaseRequest;
import com.xiang.xservice.basic.config.MyThreadFactory; import com.xiang.xservice.basic.config.MyThreadFactory;
import com.xiang.xservice.basic.utils.DateUtils; import com.xiang.xservice.basic.utils.DateUtils;
import com.xiang.xservice.basic.utils.RandomCodeUtils; import com.xiang.xservice.basic.utils.RandomCodeUtils;
import com.xiang.xservice.http.helper.HttpRequestHelper;
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;

View File

@@ -1,13 +1,13 @@
package com.xiang.xservice.application.script.fwd.schedule; package com.xiang.xservice.application.script.fwd.schedule;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.xiang.xmc.service.schedule.service.IDynamicTaskSchedulerService;
import com.xiang.xservice.application.script.fwd.entity.param.FwdOrderTaskParam; import com.xiang.xservice.application.script.fwd.entity.param.FwdOrderTaskParam;
import com.xiang.xservice.application.script.fwd.entity.pojo.FAudienceConfig; import com.xiang.xservice.application.script.fwd.entity.pojo.FAudienceConfig;
import com.xiang.xservice.application.script.fwd.entity.pojo.FUserConfig; import com.xiang.xservice.application.script.fwd.entity.pojo.FUserConfig;
import com.xiang.xservice.application.script.fwd.mapper.FwdAudienceConfigMapper; import com.xiang.xservice.application.script.fwd.mapper.FwdAudienceConfigMapper;
import com.xiang.xservice.application.script.fwd.mapper.FwdUserConfigMapper; import com.xiang.xservice.application.script.fwd.mapper.FwdUserConfigMapper;
import com.xiang.xservice.application.script.fwd.service.IPerformService; import com.xiang.xservice.application.script.fwd.service.IPerformService;
import com.xiang.xservice.schedule.service.IDynamicTaskSchedulerService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;

View File

@@ -1,6 +1,6 @@
package com.xiang.xservice.application.script.fwd.service; package com.xiang.xservice.application.script.fwd.service;
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService; import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
import com.xiang.xservice.config.DingTalkRobotScriptConfig; import com.xiang.xservice.config.DingTalkRobotScriptConfig;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@@ -1,6 +1,7 @@
package com.xiang.xservice.application.script.fwd.service.impl; package com.xiang.xservice.application.script.fwd.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xiang.xmc.service.http.helper.HttpRequestHelper;
import com.xiang.xservice.application.script.fwd.constants.PriceRange; import com.xiang.xservice.application.script.fwd.constants.PriceRange;
import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformConfig; import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformConfig;
import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformProjectInfo; import com.xiang.xservice.application.script.fwd.entity.pojo.FPerformProjectInfo;
@@ -16,7 +17,6 @@ import com.xiang.xservice.application.script.fwd.service.DingTalkScriptFWDServic
import com.xiang.xservice.application.script.fwd.service.IPerformService; import com.xiang.xservice.application.script.fwd.service.IPerformService;
import com.xiang.xservice.application.script.fwd.service.IPerformServiceHttp; import com.xiang.xservice.application.script.fwd.service.IPerformServiceHttp;
import com.xiang.xservice.basic.config.MyThreadFactory; import com.xiang.xservice.basic.config.MyThreadFactory;
import com.xiang.xservice.http.helper.HttpRequestHelper;
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;

View File

@@ -8,5 +8,5 @@ public class GladosConstants {
public static final String GLADOS_COOKIE = "SL_G_WPT_TO=en; SL_GWPT_Show_Hide_tmp=1; SL_wptGlobTipTmp=1; koa:sess=eyJ1c2VySWQiOjU1OTg1MywiX2V4cGlyZSI6MTc3MjYwNDkyNjI4OCwiX21heEFnZSI6MjU5MjAwMDAwMDB9; koa:sess.sig=OdaqjpLkIp19lXn0lFuOsHX7vEM"; public static final String GLADOS_COOKIE = "SL_G_WPT_TO=en; SL_GWPT_Show_Hide_tmp=1; SL_wptGlobTipTmp=1; koa:sess=eyJ1c2VySWQiOjU1OTg1MywiX2V4cGlyZSI6MTc3MjYwNDkyNjI4OCwiX21heEFnZSI6MjU5MjAwMDAwMDB9; koa:sess.sig=OdaqjpLkIp19lXn0lFuOsHX7vEM";
public static final String GLADOS_CHECK_IN_BODY = "{\"token\":\"glados.one\"}"; public static final String GLADOS_CHECK_IN_BODY = "{\"token\":\"glados.cloud\"}";
} }

View File

@@ -5,7 +5,7 @@ public class URLConstants {
/** /**
* glados 主域名 * glados 主域名
*/ */
public static final String GLADOS_URL_PREFIX = "https://www.glados.one"; public static final String GLADOS_URL_PREFIX = "https://glados.cloud";
/** /**
* 签到 * 签到

View File

@@ -1,11 +1,9 @@
package com.xiang.xservice.application.script.glados.controller; package com.xiang.xservice.application.script.glados.controller;
import com.xiang.xservice.basic.common.resp.Result;
import com.xiang.xservice.application.script.glados.entity.req.GladosCheckInReq;
import com.xiang.xservice.application.script.glados.service.GLaDOSService; import com.xiang.xservice.application.script.glados.service.GLaDOSService;
import com.xiang.xservice.basic.common.resp.Result;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@@ -21,9 +19,10 @@ public class GLaDOSController {
private final GLaDOSService glaDOSService; private final GLaDOSService glaDOSService;
@PostMapping("/checkIn") @GetMapping("/checkIn")
public Result<String> checkIn(@RequestBody GladosCheckInReq request) { public Result<Void> checkIn() {
return Result.success(glaDOSService.checkIn()); glaDOSService.checkInV2();
return Result.success();
} }
} }

View File

@@ -0,0 +1,20 @@
package com.xiang.xservice.application.script.glados.entity.resp;
import lombok.Data;
/**
* @Author: xiang
* @Date: 2026-01-23 09:21
*/
@Data
public class CheckInResp {
private Long id;
private Long userId;
private Long time;
private String asset;
private String business;
private String change;
private String balance;
private String detail;
}

View File

@@ -22,6 +22,6 @@ public class GladosCheckInJob {
@Scheduled(cron = "0 0 7 1/1 * ?") @Scheduled(cron = "0 0 7 1/1 * ?")
public void checkInJon() { public void checkInJon() {
log.info("[job] Glados Check In Job start, time:{}", LocalDateTime.now()); log.info("[job] Glados Check In Job start, time:{}", LocalDateTime.now());
glaDOSService.checkIn(); glaDOSService.checkInV2();
} }
} }

View File

@@ -1,6 +1,6 @@
package com.xiang.xservice.application.script.glados.service; package com.xiang.xservice.application.script.glados.service;
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService; import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
import com.xiang.xservice.config.DingTalkRobotScriptConfig; import com.xiang.xservice.config.DingTalkRobotScriptConfig;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@@ -10,4 +10,9 @@ public interface GLaDOSService {
* 签到 * 签到
*/ */
String checkIn(); String checkIn();
/**
* 签到
*/
void checkInV2();
} }

View File

@@ -1,10 +1,14 @@
package com.xiang.xservice.application.script.glados.service; package com.xiang.xservice.application.script.glados.service;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xiang.xmc.service.http.helper.BaseHttpHelp;
import com.xiang.xmc.service.http.helper.HttpHelperFactory;
import com.xiang.xservice.application.script.glados.common.GladosConstants; import com.xiang.xservice.application.script.glados.common.GladosConstants;
import com.xiang.xservice.application.script.glados.common.URLConstants; import com.xiang.xservice.application.script.glados.common.URLConstants;
import com.xiang.xservice.application.script.glados.entity.GladosRunLog; import com.xiang.xservice.application.script.glados.entity.GladosRunLog;
import com.xiang.xservice.application.script.glados.entity.resp.CheckInResp;
import com.xiang.xservice.application.script.glados.entity.resp.GLaDOSResponse; import com.xiang.xservice.application.script.glados.entity.resp.GLaDOSResponse;
import com.xiang.xservice.application.script.glados.repository.GladosMapper; import com.xiang.xservice.application.script.glados.repository.GladosMapper;
import com.xiang.xservice.application.script.xb.entity.pojo.User; import com.xiang.xservice.application.script.xb.entity.pojo.User;
@@ -33,6 +37,8 @@ public class GLaDOSServiceImpl implements GLaDOSService{
private final DingTalkScriptGladosService dingTalkService; private final DingTalkScriptGladosService dingTalkService;
private final BaseHttpHelp httpHelp = HttpHelperFactory.createSimpleHttp();
/** /**
* 签到 * 签到
*/ */
@@ -63,6 +69,91 @@ public class GLaDOSServiceImpl implements GLaDOSService{
return sb.toString(); return sb.toString();
} }
@Override
public void checkInV2() {
List<User> users = gladosMapper.listAllUser();
if (CollectionUtils.isEmpty(users)) {
return;
}
for (User user : users) {
try {
for (int i = 0; i < 3; i++) {
if (checkInV2(user)) {
break;
}
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
log.error("线程暂停10s失败");
}
}
} catch (Exception e) {
log.error("签到失败,", e);
}
}
}
public boolean checkInV2(User user) {
Map<String, String> header = Maps.newHashMap();
header.put("Cookie", user.getCookie());
String response = null;
try {
response = httpHelp.doPost(URLConstants.GLADOS_CHECK_IN_URL, header, GladosConstants.GLADOS_CHECK_IN_BODY);
} catch (Exception e) {
log.error("http请求异常:{}", user.getEmail());
return false;
}
if (org.apache.commons.lang3.StringUtils.isBlank(response)) {
return false;
}
GLaDOSResponse<CheckInResp> gLaDOSResponse = JSONObject.parseObject(response, new TypeReference<GLaDOSResponse<CheckInResp>>() {
});
if (Objects.isNull(gLaDOSResponse)) {
return false;
}
if (0 == gLaDOSResponse.getCode()) {
// 成功请求
if (Objects.nonNull(gLaDOSResponse.getPoints()) && 0 != gLaDOSResponse.getPoints()) {
// 签到成功
dingTalkService.sendScriptMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
user.getEmail() + "签到成功,获得积分:" + gLaDOSResponse.getPoints());
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(1).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();
gladosMapper.insertScriptRunLog(build);
return Boolean.TRUE;
}
}
if (gLaDOSResponse.getMessage().contains("Repeats")) {
if (!CollectionUtils.isEmpty(gLaDOSResponse.getList())) {
dingTalkService.sendScriptMsg("用户:" + user.getEmail() + "当前已签到。结果:" + gLaDOSResponse.getList().get(0));
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(1).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();
gladosMapper.insertScriptRunLog(build);
return true;
}
}
if (-2 == gLaDOSResponse.getCode()) {
log.warn("签到失败,用户:{}, cookie过期:{}", user.getEmail(), gLaDOSResponse.getMessage());
String message = "[时间:" + LocalDateTime.now() + "] 用户: " + user.getEmail() + ",签到消息: " + gLaDOSResponse.getMessage() + "手动请求http://general.xiangtech.xyz:30026/system/glados/checkIn";
try {
dingTalkService.sendScriptMsg(message);
return true;
} catch (Exception e) {
log.error("发送钉钉消息失败", e);
}
}
// 请求异常
dingTalkService.sendScriptMsg("用户:" + user.getEmail() + "请求异常,响应结果:" + gLaDOSResponse.getMessage());
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(0).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();
gladosMapper.insertScriptRunLog(build);
return false;
}
private boolean checkIn(User user, StringBuffer sb) { private boolean checkIn(User user, StringBuffer sb) {
Map<String, String> header = Maps.newHashMap(); Map<String, String> header = Maps.newHashMap();
@@ -83,7 +174,8 @@ public class GLaDOSServiceImpl implements GLaDOSService{
log.info("http do post success, response:{}", response); log.info("http do post success, response:{}", response);
// 成功签到记录 // 成功签到记录
if (0 == gLaDOSResponse.getCode() && Objects.nonNull(gLaDOSResponse.getPoints())) { if (0 == gLaDOSResponse.getCode()) {
if (Objects.nonNull(gLaDOSResponse.getPoints())) {
log.info("签到成功, 签到积分:{}, 签到消息:{}", gLaDOSResponse.getPoints(), gLaDOSResponse.getMessage()); log.info("签到成功, 签到积分:{}, 签到消息:{}", gLaDOSResponse.getPoints(), gLaDOSResponse.getMessage());
sb.append(user.getEmail()).append("签到成功,获得积分:").append(gLaDOSResponse.getPoints()).append("\n"); sb.append(user.getEmail()).append("签到成功,获得积分:").append(gLaDOSResponse.getPoints()).append("\n");
try { try {
@@ -95,6 +187,13 @@ public class GLaDOSServiceImpl implements GLaDOSService{
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(1).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build(); GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(1).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();
gladosMapper.insertScriptRunLog(build); gladosMapper.insertScriptRunLog(build);
return Boolean.TRUE; return Boolean.TRUE;
} else {
log.info("签到异常, 签到消息:{}", gLaDOSResponse.getMessage());
sb.append(user.getEmail()).append("签到异常,消息:").append(gLaDOSResponse.getMessage());
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(0).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();
gladosMapper.insertScriptRunLog(build);
return Boolean.FALSE;
}
} }
// 重复签到,表示当日签到成功 // 重复签到,表示当日签到成功

View File

@@ -1,20 +0,0 @@
package com.xiang.xservice.application.script.jntyzx.entity.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;
}

View File

@@ -1,16 +0,0 @@
package com.xiang.xservice.application.script.jntyzx.entity.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;
}

View File

@@ -1,56 +0,0 @@
package com.xiang.xservice.application.script.jntyzx.entity.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;
}

View File

@@ -1,32 +0,0 @@
package com.xiang.xservice.application.script.jntyzx.entity.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;
}

View File

@@ -1,20 +0,0 @@
package com.xiang.xservice.application.script.jntyzx.entity.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;
}

View File

@@ -1,13 +0,0 @@
package com.xiang.xservice.application.script.jntyzx.service;
/**
* @Author: xiang
* @Date: 2025-05-14 14:06
*/
public interface JntyzxService {
/**
* 查询可用场地
*/
void queryAvailable() throws Exception;
}

View File

@@ -1,99 +0,0 @@
package com.xiang.xservice.application.script.jntyzx.service;
import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.Maps;
import com.xiang.xservice.basic.utils.HttpUtils;
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
import com.xiang.xservice.application.script.xb.common.URLConstants;
import com.xiang.xservice.application.script.jntyzx.entity.resp.JntyzxResponse;
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.QueryVenueResponse;
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.SitePositionList;
import com.xiang.xservice.application.script.jntyzx.entity.resp.query.VenueList;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @Author: xiang
* @Date: 2025-05-14 14:07
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class JntyzxServiceImpl implements JntyzxService{
private final DingTalkService dingTalkService;
@Value("${dingtalk.chatId}")
private String chatId;
@Override
public void queryAvailable() throws Exception {
String url = URLConstants.JNTYZX_QUERY_TODAY_VENUE;
Map<String, String> header = Maps.newHashMap();
header.put("X-Access-Token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NDcyMTAwNzQsInVzZXJuYW1lIjoid3hfb3Blbl9pZF9vMjFNWDR5N3doWENHanZVVEdQNkNUejJIYkQ4In0.0h_cAH_e5cCXDQlQN40jZDBgtfrzQWAmgl3YPQf0d-M");
String resp = null;
try {
resp = HttpUtils.doGet(url, header, null);
} catch (Exception e) {
log.error("[doGet] 江南体育中心查询当天场地 请求失败, url:{}", url);
}
if (StringUtils.isEmpty(resp)) {
log.warn("[查询场地] 江南体育中心查询当天场地 请求结果为空, url:{}, resp:{}", url, resp);
}
JntyzxResponse response = JSONObject.parseObject(resp, JntyzxResponse.class);
String message = "";
if (Objects.nonNull(response)) {
if (response.getSuccess()) {
log.info("[查询场地] 江南体育中心查询当天场地 请求地址:{}, 请求结果:{}", url, resp);
JSONObject object = (JSONObject) response.getResult();
if (Objects.nonNull(object)) {
QueryVenueResponse result = object.toJavaObject(QueryVenueResponse.class);
if (Objects.nonNull(result)) {
List<VenueList> venueLists = result.getVenue();
if (!CollectionUtils.isEmpty(venueLists)) {
StringBuilder sb = new StringBuilder();
for (VenueList venue : venueLists) {
List<SitePositionList> positionList = venue.getSitePosition();
positionList = positionList.stream().filter(this::filterTime).collect(Collectors.toList());
for (SitePositionList sitePositionList : positionList) {
sb.append(venue.getPlaceName()).append(":").append(sitePositionList.getSjName()).append(":预定人:").append(sitePositionList.getContacts()).append(",电话:").append(sitePositionList.getContactNumber()).append("\n");
}
}
message = sb.toString();
}
}
}
}
}
if (StringUtils.isNotBlank(message)) {
dingTalkService.sendChatMessage(chatId, message);
}
}
private Boolean filterTime(SitePositionList sitePositionList) {
if (StringUtils.equals("18:00-19:00", sitePositionList.getSjName())) {
return Boolean.TRUE;
}
if (StringUtils.equals("19:00-20:00", sitePositionList.getSjName())) {
return Boolean.TRUE;
}
if (StringUtils.equals("20:00-21:00", sitePositionList.getSjName())) {
return Boolean.TRUE;
}
if (StringUtils.equals("21:00-22:00", sitePositionList.getSjName())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
}

View File

@@ -3,18 +3,18 @@ package com.xiang.xservice.application.script.xb.schedule.xb;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.xiang.xservice.basic.config.MyThreadFactory; import com.xiang.xmc.service.cache.service.IRedisService;
import com.xiang.xservice.basic.utils.DateUtils; import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
import com.xiang.xservice.cache.service.IRedisService;
import com.xiang.xservice.common.entity.DayResult;
import com.xiang.xservice.common.enums.RedisConstant;
import com.xiang.xservice.application.script.xb.entity.pojo.xb.FundMessage; import com.xiang.xservice.application.script.xb.entity.pojo.xb.FundMessage;
import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList; import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList;
import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundInfo; import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundInfo;
import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList; import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList;
import com.xiang.xservice.application.script.xb.repository.XBFundMapper; import com.xiang.xservice.application.script.xb.repository.XBFundMapper;
import com.xiang.xservice.application.script.xb.service.FundService; import com.xiang.xservice.application.script.xb.service.FundService;
import com.xiang.xservice.basic.config.MyThreadFactory;
import com.xiang.xservice.basic.utils.DateUtils;
import com.xiang.xservice.common.entity.DayResult;
import com.xiang.xservice.common.enums.RedisConstant;
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;

View File

@@ -1,6 +1,6 @@
package com.xiang.xservice.application.script.xb.service; package com.xiang.xservice.application.script.xb.service;
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService; import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
import com.xiang.xservice.config.DingTalkRobotXbConfig; import com.xiang.xservice.config.DingTalkRobotXbConfig;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@@ -3,9 +3,9 @@ package com.xiang.xservice.common.schedule;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xiang.xmc.service.cache.service.IRedisService;
import com.xiang.xservice.basic.utils.DateUtils; import com.xiang.xservice.basic.utils.DateUtils;
import com.xiang.xservice.basic.utils.HttpUtils; import com.xiang.xservice.basic.utils.HttpUtils;
import com.xiang.xservice.cache.service.IRedisService;
import com.xiang.xservice.common.entity.DayResult; import com.xiang.xservice.common.entity.DayResult;
import com.xiang.xservice.common.enums.RedisConstant; import com.xiang.xservice.common.enums.RedisConstant;
import com.xiang.xservice.common.enums.UrlConstant; import com.xiang.xservice.common.enums.UrlConstant;

View File

@@ -0,0 +1,12 @@
package com.xiang.xservice.common.service;
import com.xiang.xservice.common.entity.SysConfigDO;
/**
* @Author: xiang
* @Date: 2025-12-16 11:19
*/
public interface ISysConfigService {
SysConfigDO getByName(String name);
}

View File

@@ -0,0 +1,20 @@
package com.xiang.xservice.common.service;
import com.xiang.xservice.common.entity.SysConfigDO;
import com.xiang.xservice.common.mapper.SysConfigMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
* @Author: xiang
* @Date: 2025-12-16 11:20
*/
@Service
@RequiredArgsConstructor
public class SysConfigServiceImpl implements ISysConfigService {
private final SysConfigMapper sysConfigMapper;
@Override
public SysConfigDO getByName(String name) {
return sysConfigMapper.getByName(name);
}
}

View File

@@ -1,7 +1,7 @@
package com.xiang.xservice.common.utils; package com.xiang.xservice.common.utils;
import com.xiang.xservice.cache.service.IRedisService; import com.xiang.xmc.service.cache.service.IRedisService;
import com.xiang.xservice.common.entity.DayResult; import com.xiang.xservice.common.entity.DayResult;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;

View File

@@ -0,0 +1,20 @@
package com.xiang.xservice.config;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.List;
/**
* @Author: xiang
* @Date: 2025-12-15 15:20
*/
@ConfigurationProperties(prefix = "dingtalk.robot.venue")
@Getter
@Setter
public class DingTalkRobotVenueConfig {
private String token;
private String secret;
private List<String> users;
}

View File

@@ -51,3 +51,8 @@ dingtalk:
secret: SECc09d8aad6635f1a4cbadb7c0ab365523c46299f138438cd885e445e0f5f4d730 secret: SECc09d8aad6635f1a4cbadb7c0ab365523c46299f138438cd885e445e0f5f4d730
users: users:
- 450841600726084717 - 450841600726084717
venue:
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
users:
- 450841600726084717

View File

@@ -53,3 +53,8 @@ dingtalk:
secret: SECe10ade3058880b84df5c6f46ab072c11f4ac2a5ef9f134d684705c2a3b004de2 secret: SECe10ade3058880b84df5c6f46ab072c11f4ac2a5ef9f134d684705c2a3b004de2
users: users:
- 450841600726084717 - 450841600726084717
venue:
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
users:
- 450841600726084717

View File

@@ -16,7 +16,7 @@ server:
spring: spring:
profiles: profiles:
active: test active: local
application: application:
name: xservice-script-center name: xservice-script-center
main: main: