6 Commits

Author SHA1 Message Date
Xiang
03f98fbe1e fix:返回值 2026-02-11 15:41:59 +08:00
Xiang
67e67a911e Merge remote-tracking branch 'origin/master'
# Conflicts:
#	script/src/main/java/com/xiang/xservice/application/script/xb/schedule/xb/FundCountJob.java
#	script/src/main/java/com/xiang/xservice/application/script/xb/schedule/xb/FundInfoQueryJob.java
#	script/src/main/java/com/xiang/xservice/application/script/xb/schedule/xb/FundMsgReportJob.java
2026-02-11 09:00:57 +08:00
Xiang
d62d788e81 fix:清理代码 2026-02-11 09:00:12 +08:00
xiang
c506a850c3 feat:基金定时任务 2026-02-07 20:12:45 +08:00
xiang
e22bc012c9 fix:顶顶消息修复 2026-01-30 23:22:48 +08:00
xiang
b598d67281 fix:pom版本修改 2026-01-30 22:54:39 +08:00
29 changed files with 227 additions and 772 deletions

18
pom.xml
View File

@@ -112,29 +112,29 @@
</dependency>
<dependency>
<groupId>com.xiang</groupId>
<groupId>com.xiang.starter</groupId>
<artifactId>xmc-mysql-starter</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.xiang</groupId>
<groupId>com.xiang.starter</groupId>
<artifactId>xmc-cache-starter</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.xiang</groupId>
<groupId>com.xiang.starter</groupId>
<artifactId>xmc-common</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.xiang</groupId>
<groupId>com.xiang.starter</groupId>
<artifactId>xmc-message-starter</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.xiang.starter</groupId>
<artifactId>xmc-http-starter</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.xiang.starter</groupId>

View File

@@ -31,13 +31,13 @@ public class IndexController {
@GetMapping("/index")
public Result<String> index() {
String msg = "已激活环境:" + env + "web端口启用" + port + "使用datasource:" + url;
return Result.success(msg);
return Result.data(msg);
}
@GetMapping("/redisTest")
private Result<String> redisTest() {
redisTemplate.opsForValue().set("2222", "231");
return Result.success("redis获取到key为test的值为" + redisTemplate.opsForValue().get("2222"));
return Result.data("redis获取到key为test的值为" + redisTemplate.opsForValue().get("2222"));
}
}

View File

@@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 模板管理控制器
*
@@ -21,8 +23,8 @@ public class TemplateController {
private final TemplateService templateService;
@PostMapping("/all")
public Result<TemplateList> getAllTemplates() throws Exception {
return Result.success(templateService.getAllTemplates());
public Result<List<TemplateList>> getAllTemplates() throws Exception {
return Result.data(templateService.getAllTemplates());
}
}

View File

@@ -50,7 +50,7 @@ public class CodeGenServiceImpl implements CodeGenService {
// 3. generate the code by freemarker templates with parameters .
// Freemarker根据参数和模板生成代码
Map<String, String> result = getResultByParams(paramInfo.getOptions());
return Result.success(result);
return Result.data(result);
} catch (Exception e) {
log.error("代码生成失败", e);
return Result.error("代码生成失败: " + e.getMessage());

View File

@@ -37,7 +37,7 @@ public class DynamicDomainController {
log.error("获取公网IP失败 time:{}", LocalDateTime.now(), e);
return Result.error("获取公网IP失败");
}
return Result.success("获取公网IP成功", publicIp);
return Result.data(publicIp);
}
@PostMapping("/ddns")
@@ -46,7 +46,7 @@ public class DynamicDomainController {
String publicIp = IpUtils.getPublicIp();
log.info("获取公网IP成功time:{}, ip:{}", LocalDateTime.now(), publicIp);
IDomainService.dynamicDomainAnalysis(publicIp);
return Result.success("获取公网IP成功");
return Result.data("获取公网IP成功");
} catch (Exception e) {
log.error("获取公网IP失败 time:{}", LocalDateTime.now(), e);
return Result.error("获取公网IP失败");

View File

@@ -1,33 +0,0 @@
package com.xiang.xservice.application.script.domain.service;
import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
import com.xiang.xservice.config.DingTalkRobotScriptConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Author: xiang
* @Date: 2025-08-07 10:30
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class DingTalkScriptDomainService {
private final DingTalkService dingTalkService;
private final DingTalkRobotScriptConfig dingTalkRobotScriptConfig;
/**
* 发送脚本消息
* @param msg 消息
*/
public void sendScriptMsg(String msg) {
try {
dingTalkService.sendRobotMessage(dingTalkRobotScriptConfig.getSecret(), dingTalkRobotScriptConfig.getToken(),
dingTalkRobotScriptConfig.getUsers(), msg);
} catch (Exception e) {
log.error("信息发送异常, 信息:{}", msg, e);
}
}
}

View File

@@ -9,6 +9,7 @@ import com.aliyun.alidns20150109.models.DescribeSubDomainRecordsResponseBody;
import com.aliyun.alidns20150109.models.UpdateDomainRecordRequest;
import com.aliyun.teaopenapi.models.Config;
import com.xiang.xservice.application.script.domain.config.AliyunDnsPropertyConfig;
import com.xiang.xservice.common.service.dingTalk.ScriptDingTalkFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -36,7 +37,7 @@ public class IDomainServiceImpl implements IDomainService {
private final AliyunDnsPropertyConfig aliyunDnsPropertyConfig;
private static final String TYPE = "A";
private final DingTalkScriptDomainService dingTalkService;
private final ScriptDingTalkFactory dingTalkService;
@Override
public void dynamicDomainAnalysis(String publicIp) throws Exception {
Client client = createClient();
@@ -53,14 +54,14 @@ public class IDomainServiceImpl implements IDomainService {
if (records.isEmpty()) {
log.info("未找到记录,添加记录..., ip:{}", publicIp);
addDnsRecord(client, publicIp, rr);
dingTalkService.sendScriptMsg("动态解析公网ip成功域名" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
dingTalkService.sendMsg("动态解析公网ip成功域名" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
} else {
String recordId = records.get(0).getRecordId();
String currentValue = records.get(0).getValue();
if (!publicIp.equals(currentValue)) {
log.info("IP变更更新记录...,ip:{}", publicIp);
updateDnsRecord(client, recordId, publicIp, rr);
dingTalkService.sendScriptMsg("动态解析公网ip成功域名" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
dingTalkService.sendMsg("动态解析公网ip成功域名" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
} else {
log.info("ip未变更无需修改ip:{}", publicIp);
}

View File

@@ -23,7 +23,6 @@ import com.xiang.xservice.application.script.fwd.mapper.FwdAudienceConfigMapper;
import com.xiang.xservice.application.script.fwd.mapper.FwdPerformConfigMapper;
import com.xiang.xservice.application.script.fwd.mapper.FwdPerformProjectInfoMapper;
import com.xiang.xservice.application.script.fwd.mapper.FwdUserConfigMapper;
import com.xiang.xservice.application.script.fwd.service.DingTalkScriptFWDService;
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.utils.TimeSyncUtils;
@@ -31,6 +30,7 @@ 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.mapper.SysConfigMapper;
import com.xiang.xservice.common.service.dingTalk.ScriptDingTalkFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@@ -66,7 +66,7 @@ public class FwdImportantMsgJob {
private final FwdPerformProjectInfoMapper performProjectInfoMapper;
private final FwdPerformConfigMapper performConfigMapper;
private final DynamicTaskScheduler dynamicTaskScheduler;
private final DingTalkScriptFWDService dingTalkScriptFWDService;
private final ScriptDingTalkFactory dingTalkScriptFWDService;
private final FwdUserConfigMapper fwdUserConfigMapper;
private final FwdAudienceConfigMapper fwdAudienceConfigMapper;
private final IPerformService iPerformService;
@@ -149,7 +149,7 @@ public class FwdImportantMsgJob {
}
}
msg.append("请注意进行数据库配置的更改!");
dingTalkScriptFWDService.sendScriptMsg(msg.toString());
dingTalkScriptFWDService.sendMsg(msg.toString());
log.info("【芬玩岛】演唱会预售定时任务结束time:{}", System.currentTimeMillis());
}
@@ -249,7 +249,7 @@ public class FwdImportantMsgJob {
}
}
});
dingTalkScriptFWDService.sendScriptMsg(msg.toString());
dingTalkScriptFWDService.sendMsg(msg.toString());
}
private void savaTask(FPerformProjectInfo data, long taskId, Map<String, Object> params) {

View File

@@ -102,6 +102,6 @@ public class FwdDataController {
}
}
}
return Result.success("success");
return Result.data("success");
}
}

View File

@@ -36,37 +36,37 @@ public class FwdOuterController {
@GetMapping("/getShowProjects")
public Result<ProjectsResp> getShowProjects() {
ProjectsResp showProjectsFromHttp = performServiceHttp.getShowProjectsFromHttp(new BaseRequest());
return Result.success("查询成功!", showProjectsFromHttp);
return Result.data(showProjectsFromHttp);
}
@GetMapping("/getProjectInfo/{id}")
public Result<Perform> getProjectInfo(@PathVariable("id") Long id) {
String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken();
Perform performsByProjectIdFromHttp = performServiceHttp.getPerformsByProjectIdFromHttp(id, token);
return Result.success("查询成功!", performsByProjectIdFromHttp);
return Result.data(performsByProjectIdFromHttp);
}
@GetMapping("/getPerformsByProjectIdFromHttp/{id}")
public Result<Perform> getPerformsByProjectIdFromHttp(@PathVariable("id") Long id) {
String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken();
Perform performsByProjectIdFromHttp = performServiceHttp.getPerformsByProjectIdFromHttp(id, token);
return Result.success("查询成功!", performsByProjectIdFromHttp);
return Result.data(performsByProjectIdFromHttp);
}
@PostMapping("/createOrder")
public Result<String> createOrder(Long projectId) throws Exception {
String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken();
if (performService.createProjectOrder(projectId, FREQUENT_IDS, token)) {
return Result.success("下单成功!");
return Result.data("下单成功!");
}
return Result.error("下单失败!");
}
@GetMapping("/getSeatPlanStatus")
public Result<SeatPlanStatus> getSeatPlanStatu (@RequestParam List<Long> ids) {
public Result<List<SeatPlanStatus>> getSeatPlanStatu (@RequestParam List<Long> ids) {
String token = fwdUserConfigMapper.getAvailableUser().get(0).getToken();
List<SeatPlanStatus> seatPlanStatusFromHttp = performServiceHttp.getSeatPlanStatusFromHttp(ids, token);
return Result.success("查询成功!", seatPlanStatusFromHttp);
return Result.data(seatPlanStatusFromHttp);
}
}

View File

@@ -1,9 +1,9 @@
package com.xiang.xservice.application.script.fwd.server;
import com.alibaba.fastjson.JSON;
import com.xiang.xservice.basic.common.resp.Result;
import com.xiang.xservice.application.script.fwd.service.DingTalkScriptFWDService;
import com.xiang.xservice.application.script.fwd.service.IPerformService;
import com.xiang.xservice.basic.common.resp.Result;
import com.xiang.xservice.common.service.dingTalk.ScriptDingTalkFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
@@ -24,7 +24,7 @@ import java.util.Map;
public class FwdUserController {
private final IPerformService performService;
private final DingTalkScriptFWDService dingTalkService;
private final ScriptDingTalkFactory dingTalkService;
@GetMapping("/token")
public Result<Void> updateUserTokenFromHttpProxy(@RequestParam Map<String, String> params) {
@@ -35,7 +35,7 @@ public class FwdUserController {
if (b) {
String msg = "用户:" + name + "的token更新成功";
try {
dingTalkService.sendScriptMsg(msg);
dingTalkService.sendMsg(msg);
} catch (Exception e) {
log.error("消息发送失败", e);
return Result.error("消息发送失败");

View File

@@ -1,32 +0,0 @@
package com.xiang.xservice.application.script.fwd.service;
import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
import com.xiang.xservice.config.DingTalkRobotScriptConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Author: xiang
* @Date: 2025-08-07 10:30
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class DingTalkScriptFWDService {
private final DingTalkService dingTalkService;
private final DingTalkRobotScriptConfig dingTalkRobotConfig;
/**
* 发送脚本消息
* @param msg 消息
*/
public void sendScriptMsg(String msg) {
try {
dingTalkService.sendRobotMessage(dingTalkRobotConfig.getSecret(), dingTalkRobotConfig.getToken(), dingTalkRobotConfig.getUsers(), msg);
} catch (Exception e) {
log.error("信息发送异常, 信息:{}", msg, e);
}
}
}

View File

@@ -13,10 +13,10 @@ import com.xiang.xservice.application.script.fwd.mapper.FwdPerformConfigMapper;
import com.xiang.xservice.application.script.fwd.mapper.FwdPerformProjectInfoMapper;
import com.xiang.xservice.application.script.fwd.mapper.FwdPerformSeatInfoMapper;
import com.xiang.xservice.application.script.fwd.mapper.FwdUserConfigMapper;
import com.xiang.xservice.application.script.fwd.service.DingTalkScriptFWDService;
import com.xiang.xservice.application.script.fwd.service.IPerformService;
import com.xiang.xservice.application.script.fwd.service.IPerformServiceHttp;
import com.xiang.xservice.basic.config.MyThreadFactory;
import com.xiang.xservice.common.service.dingTalk.ScriptDingTalkFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@@ -51,7 +51,7 @@ public class PerformServiceImpl implements IPerformService {
private final FwdPerformProjectInfoMapper fwdPerformProjectInfoMapper;
private final FwdPerformConfigMapper fwdPerformConfigMapper;
private final IPerformServiceHttp performServiceHttp;
private final DingTalkScriptFWDService dingTalkService;
private final ScriptDingTalkFactory dingTalkService;
private final FwdUserConfigMapper fwdUserConfigMapper;
private final HttpRequestHelper httpRequestHelper;
private final ExecutorService es =
@@ -121,12 +121,12 @@ public class PerformServiceImpl implements IPerformService {
if (Objects.nonNull(projectOrder)) {
log.info("下单成功,订单信息:{}", JSONObject.toJSONString(projectOrder));
String msg = "【芬玩岛】下单成功✅✅✅,演出名称:" + performByProjectId.getProjectName() + "请在5分钟内完成付款订单号" + projectOrder.getOrderNo();
dingTalkService.sendScriptMsg(msg);
dingTalkService.sendMsg(msg);
return Boolean.TRUE;
}
}
}
dingTalkService.sendScriptMsg("【芬玩岛】下单失败❌❌❌,演出名称:" + performByProjectId.getProjectName());
dingTalkService.sendMsg("【芬玩岛】下单失败❌❌❌,演出名称:" + performByProjectId.getProjectName());
return Boolean.FALSE;
}

View File

@@ -1,33 +0,0 @@
package com.xiang.xservice.application.script.glados.service;
import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
import com.xiang.xservice.config.DingTalkRobotScriptConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Author: xiang
* @Date: 2025-08-07 10:30
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class DingTalkScriptGladosService {
private final DingTalkService dingTalkService;
private final DingTalkRobotScriptConfig dingTalkRobotScriptConfig;
/**
* 发送脚本消息
* @param msg 消息
*/
public void sendScriptMsg(String msg) {
try {
dingTalkService.sendRobotMessage(dingTalkRobotScriptConfig.getSecret(), dingTalkRobotScriptConfig.getToken(),
dingTalkRobotScriptConfig.getUsers(), msg);
} catch (Exception e) {
log.error("信息发送异常, 信息:{}", msg, e);
}
}
}

View File

@@ -13,6 +13,7 @@ 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.xb.entity.pojo.User;
import com.xiang.xservice.basic.utils.HttpUtils;
import com.xiang.xservice.common.service.dingTalk.ScriptDingTalkFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -35,7 +36,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
private final GladosMapper gladosMapper;
private final DingTalkScriptGladosService dingTalkService;
private final ScriptDingTalkFactory dingTalkService;
private final BaseHttpHelp httpHelp = HttpHelperFactory.createSimpleHttp();
@@ -119,7 +120,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
// 成功请求
if (Objects.nonNull(gLaDOSResponse.getPoints()) && 0 != gLaDOSResponse.getPoints()) {
// 签到成功
dingTalkService.sendScriptMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
dingTalkService.sendMsg("[时间:" + 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);
@@ -129,7 +130,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
if (gLaDOSResponse.getMessage().contains("Repeats")) {
if (!CollectionUtils.isEmpty(gLaDOSResponse.getList())) {
dingTalkService.sendScriptMsg("用户:" + user.getEmail() + "当前已签到。结果:" + gLaDOSResponse.getList().get(0));
dingTalkService.sendMsg("用户:" + 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;
@@ -140,7 +141,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
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);
dingTalkService.sendMsg(message);
return true;
} catch (Exception e) {
log.error("发送钉钉消息失败", e);
@@ -148,7 +149,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
}
// 请求异常
dingTalkService.sendScriptMsg("用户:" + user.getEmail() + "请求异常,响应结果:" + gLaDOSResponse.getMessage());
dingTalkService.sendMsg("用户:" + 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;
@@ -179,7 +180,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
log.info("签到成功, 签到积分:{}, 签到消息:{}", gLaDOSResponse.getPoints(), gLaDOSResponse.getMessage());
sb.append(user.getEmail()).append("签到成功,获得积分:").append(gLaDOSResponse.getPoints()).append("\n");
try {
dingTalkService.sendScriptMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
dingTalkService.sendMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
user.getEmail() + "签到成功,获得积分:" + gLaDOSResponse.getPoints());
} catch (Exception e) {
log.error("发送钉钉消息失败", e);
@@ -201,7 +202,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
log.warn("签到失败,重复签到,用户:{}, 签到消息:{}", user.getEmail(), gLaDOSResponse.getMessage());
sb.append(user).append("签到失败,重复签到,用户:").append(user).append(",签到消息:").append(gLaDOSResponse.getMessage());
try {
dingTalkService.sendScriptMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
dingTalkService.sendMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
user.getEmail() + "当天已经签到成功!获得积分" + gLaDOSResponse.getList().get(0));
} catch (Exception e) {
log.error("发送钉钉消息失败", e);
@@ -216,7 +217,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
log.warn("签到失败,用户:{}, cookie过期:{}", user.getEmail(), gLaDOSResponse.getMessage());
String message = "[时间:" + LocalDateTime.now() + "] 用户: " + user.getEmail() + ",签到消息: " + gLaDOSResponse.getMessage();
try {
dingTalkService.sendScriptMsg(message);
dingTalkService.sendMsg(message);
} catch (Exception e) {
log.error("发送钉钉消息失败", e);
}
@@ -233,7 +234,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
} else {
try {
String mes = "[时间:" + LocalDateTime.now() + "] 用户: " + user.getEmail() + ",签到异常,请求结果为空。";
dingTalkService.sendScriptMsg(mes);
dingTalkService.sendMsg(mes);
} catch (Exception e) {
log.error("发送钉钉消息失败", e);
}

View File

@@ -1,7 +1,5 @@
package com.xiang.xservice.application.script.xb.controller;
import com.google.common.collect.Lists;
import com.xiang.xservice.basic.common.resp.Result;
import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList;
import com.xiang.xservice.application.script.xb.entity.request.xb.fund.QueryFundInfoReq;
import com.xiang.xservice.application.script.xb.entity.request.xb.fund.QueryFundListReq;
@@ -9,6 +7,7 @@ import com.xiang.xservice.application.script.xb.entity.request.xb.fund.QueryXbFu
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.service.FundService;
import com.xiang.xservice.basic.common.resp.Result;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
@@ -31,28 +30,28 @@ public class XBController {
private final FundService fundService;
@PostMapping("/queryFundList")
public Result<XbFundList> queryFundList(@RequestBody QueryXbFundListReq req) {
public Result<List<XbFundList>> queryFundList(@RequestBody QueryXbFundListReq req) {
List<XbFundList> result = fundService.queryFundList(req.getType());
if (CollectionUtils.isEmpty(result)) {
return Result.error("基金列表信息为空!");
}
return Result.success("success", result);
return Result.data(result);
}
@PostMapping("/queryList")
public Result<FundList> queryList(@RequestBody QueryFundListReq req) {
public Result<List<FundList>> queryList(@RequestBody QueryFundListReq req) {
List<FundList> result = fundService.queryTodayList(req.getDate(), req.getDataResources(), req.getDataSourceSwitch(), req.getCodeArr());
if (CollectionUtils.isEmpty(result)) {
return Result.error("基金列表信息为空!");
}
return Result.success("success", result);
return Result.data(result);
}
@PostMapping("/queryFundInfo")
public Result<FundInfo> queryFundInfo(@RequestBody QueryFundInfoReq req) {
FundInfo fundInfo = fundService.queryFundInfo(req.getCode());
if (Objects.nonNull(fundInfo)) {
return Result.success("success", Lists.newArrayList(fundInfo));
return Result.data(fundInfo);
}
return Result.error("查询基金信息为空!");
}

View File

@@ -1,105 +0,0 @@
package com.xiang.xservice.application.script.xb.schedule.xb;
import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.Lists;
import com.xiang.xservice.basic.utils.DateUtils;
import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundCount;
import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList;
import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList;
import com.xiang.xservice.application.script.xb.service.DingTalkRobotService;
import com.xiang.xservice.application.script.xb.service.FundService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @Author: xiang
* @Date: 2025-05-21 13:59
*/
@Component
@RequiredArgsConstructor
@Slf4j
@RestController
public class FundCountJob {
private final FundService fundService;
private final DingTalkRobotService dingTalkService;
@Scheduled(cron = "0 0 22 * * ?")
public void countFundJob() {
// 周六周日过滤
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
return;
}
log.info("==========================[基金统计] 基金统计定时任务启动!==========================");
List<XbFundList> lists = fundService.queryFundList();
if (CollectionUtils.isEmpty(lists)) {
return;
}
List<XbFundCount> counts = Lists.newCopyOnWriteArrayList();
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
lists.parallelStream().forEach(xbFundList -> {
List<FundList> fund = fundService.queryTodayList(date, "2", Boolean.TRUE, Collections.singletonList(xbFundList.getCode()));
if (CollectionUtils.isNotEmpty(fund)) {
XbFundCount xbFundCount = new XbFundCount();
xbFundCount.setLId(xbFundList.getId());
xbFundCount.setCode(xbFundList.getCode());
xbFundCount.setName(xbFundList.getName());
xbFundCount.setChange(fund.get(0).getChange().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP));
xbFundCount.setUpdateTime(LocalDateTime.now());
counts.add(xbFundCount);
}
});
if (CollectionUtils.isNotEmpty(counts)) {
log.info("[基金统计] 基金统计记录,需要插入的数据:{}", JSONObject.toJSONString(counts));
fundService.addCounts(counts);
}
log.info("==========================[基金统计] 基金统计定时任务结束!==========================");
}
@Scheduled(cron = "0 40 14 * * ? ")
public void countFundInWeek() throws Exception {
if (DateUtils.validWeekTime()) return;
log.info("==========================[基金统计] 基金本周涨跌幅消息发送定时任务启动!==========================");
List<XbFundCount> xbFundCounts = fundService.queryFundCountInWeek();
if (CollectionUtils.isEmpty(xbFundCounts)) {
return;
}
StringBuilder sb = new StringBuilder();
Map<String, List<XbFundCount>> map = xbFundCounts.stream().collect(Collectors.groupingBy(XbFundCount::getCode));
map.forEach((k, v) -> {
List<XbFundCount> fundCounts = map.get(k);
if (CollectionUtils.isEmpty(fundCounts)) {
return;
}
List<BigDecimal> decimals = fundCounts.stream().map(XbFundCount::getChange).collect(Collectors.toList());
BigDecimal sum = BigDecimal.ZERO;
for (BigDecimal decimal : decimals) {
sum = sum.add(decimal);
}
BigDecimal avg = sum.divide(BigDecimal.valueOf(decimals.size()), 2, RoundingMode.HALF_UP);
sb.append("").append(fundCounts.get(0).getName()).append("】本周平均涨跌幅为:").append(avg).append("\n");
});
if (StringUtils.isNotBlank(sb)) {
dingTalkService.sendXbMsg(sb.toString());
}
log.info("==========================[基金统计] 基金本周涨跌幅消息发送定时任务结束!==========================");
}
}

View File

@@ -1,180 +0,0 @@
package com.xiang.xservice.application.script.xb.schedule.xb;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.Lists;
import com.xiang.xmc.service.cache.service.IRedisService;
import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
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.response.xbyj.fund.FundInfo;
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.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.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @Author: xiang
* @Date: 2025-05-14 17:15
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class FundInfoQueryJob {
private final FundService fundService;
private final DingTalkService dingTalkService;
private final XBFundMapper xbFundMapper;
private final IRedisService redisService;
private final ExecutorService es =
new ThreadPoolExecutor(
10,
20,
1000,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(),
new MyThreadFactory("xb-query-thread", Boolean.TRUE),
new ThreadPoolExecutor.AbortPolicy());
@Value("${xiaobei.codeArr}")
private String codeArr;
@Value("${dingtalk.chatId}")
private String chatId;
/**
* 基金涨跌幅5分钟超过2%重点通知
*/
@Scheduled(cron = "0 0/5 9,10,11,13,14,15 * * ? ")
public void queryFundEmergencyJob() throws Exception {
// 周六周日过滤
if (DateUtils.validWeekTime()) return;
LocalDate now = LocalDate.now();
com.alibaba.fastjson.JSONObject dayResult = (com.alibaba.fastjson.JSONObject) redisService.hGet(RedisConstant.DAY_INFO_PREFIX_KEY + RedisConstant.getDate4Key(), DateUtils.getDateFromDate(now));
com.xiang.xservice.common.utils.DateUtils dateUtils = new com.xiang.xservice.common.utils.DateUtils(redisService);
if (dateUtils.validHoliday(JSON.toJavaObject(dayResult, DayResult.class))) return;
List<com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo> fundInfos = xbFundMapper.queryListIn2Min();
if (CollectionUtils.isEmpty(fundInfos)) {
return;
}
Map<String, List<com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo>> map = fundInfos.stream().collect(Collectors.groupingBy(com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo::getCode));
StringBuffer sb = new StringBuffer();
map.entrySet().parallelStream().forEach(entry -> {
List<com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo> infos = entry.getValue();
BigDecimal sum = new BigDecimal("0");
for (int i = 0; i < infos.size() - 1; i++) {
BigDecimal subtract = new BigDecimal(infos.get(i + 1).getChange()).subtract(new BigDecimal(infos.get(i).getChange()));
sum = sum.add(subtract);
}
BigDecimal avg = sum.divide(new BigDecimal(String.valueOf(infos.size())), 2, RoundingMode.HALF_UP);
if (avg.abs().compareTo(new BigDecimal("2")) > 0) {
sb.append("基金").append(entry.getValue().get(0).getName()).append("5分钟的平均涨跌幅超过2%,涨跌幅达到").append(avg).append("\n");
}
});
if (StringUtils.isNotBlank(sb)) {
dingTalkService.sendChatMessage(chatId, sb.toString());
}
}
/**
* 基金每分钟涨幅记录
*/
@Scheduled(cron = "0 0/1 9,10,11,13,14 * * ?")
public void queryFundInfoInMinJob() {
// 周六周日过滤
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
return;
}
List<FundMessage> fundMessageList = queryFund(null);
if (CollectionUtils.isEmpty(fundMessageList)) {
return;
}
List<CompletableFuture> futures = Lists.newArrayList();
List<com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo> fundInfoList = Lists.newCopyOnWriteArrayList();
fundMessageList.parallelStream().forEach(fundMessage -> {
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
FundInfo fundInfo = fundService.queryFundInfo(fundMessage.getCode());
com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo info = com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo.builder()
.code(fundMessage.getCode())
.name(fundInfo.getName())
.change(fundMessage.getChange().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString())
.updateTime(getTimeFromStr(fundMessage.getDate(), fundMessage.getUpdate()))
.build();
fundInfoList.add(info);
}, es);
futures.add(future);
});
CompletableFuture[] futureArr = futures
.toArray(futures.toArray(new CompletableFuture[0]));
CompletableFuture.allOf(futureArr).join();
if (CollectionUtils.isNotEmpty(fundInfoList)) {
log.info("[基金查询] 每分钟基金涨跌幅查询记录,需要插入的数据:{}", JSONObject.toJSONString(fundInfoList));
xbFundMapper.batchSave(fundInfoList);
}
}
private List<FundMessage> queryFund(Integer type) {
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<String> code = Lists.newArrayList();
List<XbFundList> lists = xbFundMapper.queryFundList(type);
if (CollectionUtils.isEmpty(lists)) {
if (Objects.equals(type, 1)) {
code = Arrays.stream(codeArr.split(", ")).collect(Collectors.toList());
}
return Lists.newArrayList();
} else {
code = lists.stream().map(XbFundList::getCode).collect(Collectors.toList());
}
List<FundList> fundLists = fundService.queryTodayList(date, "2", Boolean.TRUE, code);
if (CollectionUtils.isEmpty(fundLists)) {
return Lists.newArrayList();
}
List<FundMessage> result = Lists.newCopyOnWriteArrayList();
fundLists.parallelStream().forEach(fundList -> {
FundInfo fundInfo = fundService.queryFundInfo(fundList.getCode());
if (Objects.nonNull(fundInfo)) {
FundMessage fund = FundMessage.builder().name(fundInfo.getName()).date(fundList.getDate())
.code(fundList.getCode()).change(fundList.getChange()).update(fundList.getUpdate()).build();
result.add(fund);
}
});
return result;
}
private LocalDateTime getTimeFromStr(String date, String time) {
String dateTimeStr = date + " " + time;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
return LocalDateTime.parse(dateTimeStr, formatter);
}
}

View File

@@ -1,144 +0,0 @@
package com.xiang.xservice.application.script.xb.schedule.xb;
import com.alibaba.fastjson.JSON;
import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList;
import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList;
import com.xiang.xservice.application.script.xb.service.DingTalkRobotService;
import com.xiang.xservice.application.script.xb.service.FundService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Author: xiang
* @Date: 2025-07-31 18:10
*/
@Component
@Slf4j
@RestController
@RequiredArgsConstructor
public class FundMsgReportJob {
private final FundService fundService;
private final DingTalkRobotService dingTalkService;
private static final Integer TYPE_A = 1;
private static final Integer TYPE_M = 3;
private static final Integer TYPE_G = 2;
@Scheduled(cron = "0 1,31 9,10,11,13,14 * * ?")
@PostMapping("/asdasda")
public void fundReport4A() {
log.info("===========A股基金变化通知===========");
// 周六周日过滤
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
log.info("当前时间为:{}", LocalDateTime.now());
return;
}
List<XbFundList> fundLists = fundService.queryFundList(TYPE_A);
if (CollectionUtils.isEmpty(fundLists)) {
log.info("查询配置的A股信息为空");
return;
}
Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
if (CollectionUtils.isEmpty(funds)) {
log.info("http请求查询基金信息为空");
return;
}
log.info("http查询基金信息:{}", JSON.toJSONString(funds));
StringBuilder msg = new StringBuilder(date).append("===》A股基金变化通知:\n");
buildMsg(funds, fundMap, msg);
dingTalkService.sendXbMsg(msg.toString());
}
@Scheduled(cron = "0 1,31 9,10,11,13,14,15 * * ?")
public void fundReport4G() {
log.info("===========港股基金变化通知!===========");
// 周六周日过滤
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
log.info("当前时间为:{}", LocalDateTime.now());
return;
}
List<XbFundList> fundLists = fundService.queryFundList(TYPE_G);
if (CollectionUtils.isEmpty(fundLists)) {
log.info("查询配置的港股信息为空");
return;
}
Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
if (CollectionUtils.isEmpty(funds)) {
log.info("http请求查询基金信息为空");
return;
}
log.info("http查询港股基金信息:{}", JSON.toJSONString(funds));
StringBuilder msg = new StringBuilder(date).append("===》港股基金变化通知:\n");
buildMsg(funds, fundMap, msg);
dingTalkService.sendXbMsg(msg.toString());
}
@Scheduled(cron = "0 0 9 * * ?")
public void fundReport4M() {
log.info("===========美股基金变化通知!===========");
// 周六周日过滤
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
log.info("当前时间为:{}", LocalDateTime.now());
return;
}
List<XbFundList> fundLists = fundService.queryFundList(TYPE_M);
if (CollectionUtils.isEmpty(fundLists)) {
log.info("查询配置的美股信息为空");
return;
}
Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
if (CollectionUtils.isEmpty(funds)) {
log.info("http请求查询基金信息为空");
return;
}
log.info("http查询美股基金信息:{}", JSON.toJSONString(funds));
StringBuilder msg = new StringBuilder(date).append("===》美股基金变化通知:\n");
buildMsg(funds, fundMap, msg);
dingTalkService.sendXbMsg(msg.toString());
}
private static void buildMsg(List<FundList> funds, Map<String, XbFundList> fundMap, StringBuilder msg) {
funds = funds.stream().sorted(Comparator.comparing(FundList::getChange).reversed())
.collect(Collectors.toList());
for (FundList fund : funds) {
if (fundMap.containsKey(fund.getCode())) {
XbFundList fundList = fundMap.get(fund.getCode());
msg.append("基金名称:")
.append(fundList.getName())
.append("涨跌幅:")
.append(fund.getChange()
.multiply(new BigDecimal("100"))
.setScale(2, RoundingMode.HALF_UP))
.append("\n");
}
}
}
}

View File

@@ -1,31 +0,0 @@
package com.xiang.xservice.application.script.xb.service;
import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
import com.xiang.xservice.config.DingTalkRobotXbConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Author: xiang
* @Date: 2025-08-07 11:02
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class DingTalkRobotService {
private final DingTalkService dingTalkService;
private final DingTalkRobotXbConfig dingTalkRobotConfig;
/**
* 发送脚本消息
* @param msg 消息
*/
public void sendXbMsg(String msg) {
try {
dingTalkService.sendRobotMessage(dingTalkRobotConfig.getSecret(), dingTalkRobotConfig.getToken(), dingTalkRobotConfig.getUsers(), msg);
} catch (Exception e) {
log.error("信息发送异常, 信息:{}", msg, e);
}
}
}

View File

@@ -0,0 +1,21 @@
package com.xiang.xservice.common.enums;
import com.xiang.xmc.service.message.dingTalk.enums.BaseDingTalkBizType;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* @Author: xiang
* @Date: 2026-01-04 16:13
*/
@Getter
@RequiredArgsConstructor
public enum DingTalkBizTypeEnum implements BaseDingTalkBizType {
JT("venue", "江南体育中心"),
XB("xb", "股票基金变化通知"),
SCRIPT("script", "脚本运行通知群")
;
private final String bizName;
private final String desc;
}

View File

@@ -1,72 +0,0 @@
package com.xiang.xservice.common.schedule;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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.HttpUtils;
import com.xiang.xservice.common.entity.DayResult;
import com.xiang.xservice.common.enums.RedisConstant;
import com.xiang.xservice.common.enums.UrlConstant;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.time.YearMonth;
import java.util.HashMap;
import java.util.Objects;
/**
* @Author: xiang
* @Date: 2025-10-04 10:09
*/
@Component
@RequiredArgsConstructor
@RestController
public class HolidayQueryJob {
private final IRedisService redisService;
private static final String API_KEY = "d20db0ca13e151ca7323d849d8efc6db";
@Scheduled(cron = "0 0 0 1 1/1 ?")
@PostMapping("/queryHolidayInfoJob")
public void queryHolidayInfoJob() {
YearMonth now = YearMonth.now(); // 当前年月
LocalDate start = now.atDay(1);
LocalDate end = now.atEndOfMonth();
for (LocalDate d = start; !d.isAfter(end); d = d.plusDays(1)) {
try {
String date = DateUtils.getDateFromDate(d);
HashMap<String, String> paramMap = Maps.newHashMap();
paramMap.put("key", API_KEY);
paramMap.put("date", date);
paramMap.put("detail", "");
HashMap<String, String> headers = Maps.newHashMap();
headers.put("Content-Type", "application/x-www-form-urlencoded");
String resp = HttpUtils.doGet(UrlConstant.HOLIDAY_QUERY_URL, headers, paramMap);
if (StringUtils.isNotBlank(resp)) {
JSONObject jsonObject = JSON.parseObject(resp);
String reason = (String) jsonObject.get("reason");
if (!StringUtils.equals(reason, "success")) {
continue;
}
JSONObject result = jsonObject.getJSONObject("result");
DayResult dayResult = JSON.toJavaObject(result, DayResult.class);
if (Objects.isNull(dayResult)) {
continue;
}
redisService.hSet(RedisConstant.DAY_INFO_PREFIX_KEY + RedisConstant.getDate4Key(), date, result);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

View File

@@ -0,0 +1,23 @@
package com.xiang.xservice.common.service.dingTalk;
import com.xiang.xmc.service.message.dingTalk.config.DingTalkRobotProperties;
import com.xiang.xmc.service.message.dingTalk.service.AbstractDingTalkFactory;
import com.xiang.xmc.service.message.dingTalk.service.DingTalkSender;
import com.xiang.xservice.common.enums.DingTalkBizTypeEnum;
import org.springframework.stereotype.Service;
/**
* @Author: xiang
* @Date: 2026-01-04 16:19
*/
@Service
public class JtDingTalkFactory extends AbstractDingTalkFactory {
public JtDingTalkFactory(DingTalkRobotProperties dingTalkRobotProperties, DingTalkSender dingTalkSender) {
super(dingTalkRobotProperties, dingTalkSender);
}
@Override
public void sendMsg(String msg) {
getClient(DingTalkBizTypeEnum.JT).sendDingTalkMsg(msg);
}
}

View File

@@ -0,0 +1,19 @@
package com.xiang.xservice.common.service.dingTalk;
import com.xiang.xmc.service.message.dingTalk.config.DingTalkRobotProperties;
import com.xiang.xmc.service.message.dingTalk.service.AbstractDingTalkFactory;
import com.xiang.xmc.service.message.dingTalk.service.DingTalkSender;
import com.xiang.xservice.common.enums.DingTalkBizTypeEnum;
import org.springframework.stereotype.Service;
@Service
public class ScriptDingTalkFactory extends AbstractDingTalkFactory {
public ScriptDingTalkFactory(DingTalkRobotProperties dingTalkRobotProperties, DingTalkSender dingTalkSender) {
super(dingTalkRobotProperties, dingTalkSender);
}
@Override
public void sendMsg(String msg) {
getClient(DingTalkBizTypeEnum.SCRIPT).sendDingTalkMsg(msg);
}
}

View File

@@ -0,0 +1,19 @@
package com.xiang.xservice.common.service.dingTalk;
import com.xiang.xmc.service.message.dingTalk.config.DingTalkRobotProperties;
import com.xiang.xmc.service.message.dingTalk.service.AbstractDingTalkFactory;
import com.xiang.xmc.service.message.dingTalk.service.DingTalkSender;
import com.xiang.xservice.common.enums.DingTalkBizTypeEnum;
import org.springframework.stereotype.Service;
@Service
public class StockDingTalkFactory extends AbstractDingTalkFactory {
public StockDingTalkFactory(DingTalkRobotProperties dingTalkRobotProperties, DingTalkSender dingTalkSender) {
super(dingTalkRobotProperties, dingTalkSender);
}
@Override
public void sendMsg(String msg) {
getClient(DingTalkBizTypeEnum.XB).sendDingTalkMsg(msg);
}
}

View File

@@ -43,43 +43,7 @@ spring:
settings:
number_format: 0.##
default_encoding: UTF-8
autoconfigure:
exclude:
- com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration
server:
#tomcat:
# remote-ip-header: x-forward-for
# uri-encoding: UTF-8
# max-threads: 10
# background-processor-delay: 30
# basedir: ${user.home}/tomcat/
undertow:
# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
# 不要设置过大,如果过大,启动项目会报错:打开文件数过多
io-threads: 4
# 阻塞任务线程池, 当执行类似servlet请求阻塞IO操作, undertow会从这个线程池中取得线程
# 它的值设置取决于系统线程执行任务的阻塞系数默认值是IO线程数*8
worker-threads: 64
# 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理
# 每块buffer的空间大小,越小的空间被利用越充分,不要设置太大,以免影响其他应用,合适即可
buffer-size: 1024
# 是否分配的直接内存(NIO直接分配的堆外内存)
direct-buffers: true
OEM:
version: 2025 September
header: SQL转Java JPA、MYBATIS实现类代码生成平台
keywords: sql转实体类,sql转DAO,SQL转service,SQL转JPA实现,SQL转MYBATIS实现
title: 大狼狗代码生成器
slogan: 👐 Free your hands from boring CRUD—let the code write itself! ⚡
description: <p>💻 SpringBootCodeGenerator又名 `大狼狗代码生成器`🐺🐶,支持 SQL 一键转 JAVA/JPA/Mybatis/MybatisPlus 等多种模板,轻松搞定 CRUD彻底解放双手 ✋!只需提供 DDL、SELECT SQL 或简单 JSON 👉 即可生成 生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL/CommonMapper 等代码模板。</p><p>🔥🔥🔥 全新 JSqlParser 引擎上线,强力支持 DDL CREATE SQL与 SELECT SQL 解析!欢迎体验 & 反馈 💬!</p><p>👨‍💻 面向开发者的高效利器,已服务数万工程师,欢迎 Star ⭐、Fork 🍴、提 Issue 💬,一起打造更强大的代码生成平台!</p>
author: zhengkai.blog.csdn.net
packageName: com.software.system
copyright: ✨ Powered by <a href="https://zhengkai.blog.csdn.net" target="_blank">Moshow郑锴</a> — may the holy light guide your code, your coffee, and your commits! ⚡🧙‍♂️💻
returnUtilSuccess: ResponseUtil.success
returnUtilFailure: ResponseUtil.error
outputStr: http://zhengkai.blog.csdn.net
mode: local
aliyun:
dns:
@@ -87,23 +51,23 @@ aliyun:
- local
dingtalk:
# 钉钉消息用户,用逗号隔开
userList: "450841600726084717"
# 钉钉消息群ID需要调用/chat/create api创建群返回
chatId: "chatd16d8daeea33b36b73588c676d508096"
robot:
properties:
venue:
name: 江南体育中心通知群
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
users:
- 450841600726084717
script:
name: 脚本运行通知群
token: 797be7f32062e31dec1d567f8b490a5649a5366083618e236c7a1263df1f4af3
secret: SEC9aca642c0c29c9da261462869c464d34623247583d98fc82343a0a4464abbe91
users:
- 450841600726084717
xb:
name: 股票基金变化通知群
token: ad21ead99f0fdc63aa00d6732b7b0888c17590f7612c68297edfcb71844d1437
secret: SECc09d8aad6635f1a4cbadb7c0ab365523c46299f138438cd885e445e0f5f4d730
users:
- 450841600726084717
venue:
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
users:
- 450841600726084717

View File

@@ -29,6 +29,20 @@ spring:
max-idle: 8
min-idle: 0
max-wait: 1000
freemarker:
request-context-attribute: request
suffix: .html
content-type: text/html
enabled: true
cache: false
charset: UTF-8
allow-request-override: false
expose-request-attributes: true
expose-session-attributes: true
expose-spring-macro-helpers: true
settings:
number_format: 0.##
default_encoding: UTF-8
aliyun:
dns:
@@ -38,23 +52,23 @@ aliyun:
- nexus
dingtalk:
# 钉钉消息用户,用逗号隔开
userList: "450841600726084717"
# 钉钉消息群ID需要调用/chat/create api创建群返回
chatId: "chatd16d8daeea33b36b73588c676d508096"
robot:
properties:
venue:
name: 江南体育中心通知群
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
users:
- 450841600726084717
script:
name: 脚本运行通知群
token: 4709b708d961846e0aee523c5abc3b67e8fa424ee292501d85efd4e504f15a8b
secret: SEC768ed578c0fb31a9aec84b1c1db4f195f5aca203985bbb9d549e23e41c8874d1
users:
- 450841600726084717
xb:
name: 股票基金变化通知群
token: 340a9d39a5b0b6a52ba2262f9c27179cf50e3c8cfe6883ca082649d306038f41
secret: SECe10ade3058880b84df5c6f46ab072c11f4ac2a5ef9f134d684705c2a3b004de2
users:
- 450841600726084717
venue:
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
users:
- 450841600726084717

View File

@@ -29,6 +29,20 @@ spring:
max-idle: 8
min-idle: 0
max-wait: 1000
freemarker:
request-context-attribute: request
suffix: .html
content-type: text/html
enabled: true
cache: false
charset: UTF-8
allow-request-override: false
expose-request-attributes: true
expose-session-attributes: true
expose-spring-macro-helpers: true
settings:
number_format: 0.##
default_encoding: UTF-8
aliyun:
dns:
@@ -36,17 +50,22 @@ aliyun:
- test
dingtalk:
# 钉钉消息用户,用逗号隔开
userList: "450841600726084717"
# 钉钉消息群ID需要调用/chat/create api创建群返回
chatId: "chatd16d8daeea33b36b73588c676d508096"
robot:
properties:
venue:
name: 江南体育中心通知群
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
users:
- 450841600726084717
script:
name: 脚本运行通知群
token: 797be7f32062e31dec1d567f8b490a5649a5366083618e236c7a1263df1f4af3
secret: SEC9aca642c0c29c9da261462869c464d34623247583d98fc82343a0a4464abbe91
users:
- 450841600726084717
xb:
name: 股票基金变化通知群
token: ad21ead99f0fdc63aa00d6732b7b0888c17590f7612c68297edfcb71844d1437
secret: SECc09d8aad6635f1a4cbadb7c0ab365523c46299f138438cd885e445e0f5f4d730
users:

View File

@@ -21,6 +21,9 @@ spring:
name: xservice-script-center
main:
allow-bean-definition-overriding: true
autoconfigure:
exclude:
- com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration
http:
maxAttempts: 10