Merge pull request 'feat:first commit' (#1) from perf_reconstruction into master

Reviewed-on: XiangZ/xservice-script#1
This commit is contained in:
XiangZ
2025-07-17 14:43:54 +00:00
68 changed files with 218 additions and 1061 deletions

View File

@@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xiang</groupId>
<artifactId>xservice-scirpt</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>domain</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.xiang</groupId>
<artifactId>facade</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alidns20150109</artifactId>
<version>3.4.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.0.RELEASE</version>
<configuration>
<classifier>exec</classifier>
<!-- 指定该Main Class为全局的唯一入口 -->
<mainClass>com.xiang.DomainApplication</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,17 +0,0 @@
package com.xiang;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* @Author: xiang
* @Date: 2025-06-10 16:43
*/
@SpringBootApplication
@EnableScheduling
public class DomainApplication {
public static void main(String[] args) {
SpringApplication.run(DomainApplication.class, args);
}
}

View File

@@ -1,51 +0,0 @@
package com.xiang.common;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collections;
import java.util.List;
/**
* @Author: xiang
* @Date: 2025-05-09 14:09
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
private String code;
private String message;
private List<T> data;
public static Result<Void> success(String message) {
return new Result<Void>("200", message, null);
}
public static <T> Result<T> success(String message, List<T> data) {
return new Result<T>("200", message, data);
}
public static <T> Result<T> success(String message, T data) {
return new Result<T>("200", message, Collections.singletonList(data));
}
public static <T> Result<T> error(String message) {
return new Result<T>("500", message, null);
}
public static <T> Result<T> error(String message, T data) {
return new Result<T>("500", message, Collections.singletonList(data));
}
public static <T> Result<T> error(String message, List<T> data) {
return new Result<T>("500", message, data);
}
public static Result<Void> error(String code, String message) {
return new Result<Void>(code, message, null);
}
}

View File

@@ -1,121 +0,0 @@
package com.xiang.utils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.io.Closeable;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
/**
* @Author: xiang
* @Date: 2025-05-08 14:39
*/
@Slf4j
public class HttpUtils {
private final static int socketTimeOut = 60 * 1000;
private final static int connectTimeout = 60 * 1000;
private final static int connectionRequestTimeout = 15 * 1000;
private final static int defaultMaxPerRoute = 500;
private final static int maxTotal = 2000;
public static String doPost(String url, Map<String, String> header, String jsonParams) {
RequestConfig requestConfig = RequestConfig.custom()
// 设置连接超时时间
.setConnectTimeout(connectTimeout)
// 设置Socket超时时间
.setSocketTimeout(socketTimeOut)
.setConnectionRequestTimeout(connectionRequestTimeout)
.build();
//创建httpClient对象
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
CloseableHttpResponse response = null;
String result = "";
try {
// 创建http请求
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", "application/json");
// 创建请求内容
StringEntity entity = new StringEntity(jsonParams, "utf-8");
entity.setContentType("application/json");
httpPost.setEntity(entity);
// 设置请求头
if (null != header && !header.isEmpty()) {
Set<Map.Entry<String, String>> entries = header.entrySet();
for (Map.Entry<String, String> e : entries) {
httpPost.setHeader(e.getKey(), e.getValue());
}
}
response = httpClient.execute(httpPost);
result = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
log.error("doPost异常", e);
} finally {
//关闭资源
closeResource(response, httpClient);
}
return result;
}
public static String doGet(String url, Map<String, String> header, Map<String, String> param) {
RequestConfig requestConfig = RequestConfig.custom()
// 设置连接超时时间
.setConnectTimeout(connectTimeout)
// 设置Socket超时时间
.setSocketTimeout(socketTimeOut)
.setConnectionRequestTimeout(connectionRequestTimeout)
.build();
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
CloseableHttpResponse response;
String result = "";
try {
String request = "";
if (MapUtils.isNotEmpty(param)) {
StringBuilder req = new StringBuilder("?");
for (Map.Entry<String, String> entry : param.entrySet()) {
req.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
}
request = req.substring(0, req.length() - 1);
}
HttpGet httpGet = new HttpGet(url + request);
httpGet.addHeader("Content-Type", "application/json");
if (MapUtils.isNotEmpty(header)) {
for (Map.Entry<String, String> entry : header.entrySet()) {
httpGet.setHeader(entry.getKey(), entry.getValue());
}
}
log.info("doGet请求请求地址{}", url + request);
response = httpClient.execute(httpGet);
result = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
log.error("doGet异常", e);
}
return result;
}
/**
* @Description 关闭资源
*/
private static void closeResource(Closeable... resources) {
try {
for (Closeable resource : resources) {
if (resource != null) {
resource.close();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -1,22 +0,0 @@
package com.xiang.utils;
import com.google.common.collect.Maps;
import java.io.IOException;
import java.util.Map;
/**
* @Author: xiang
* @Date: 2025-06-10 16:50
*/
public class IpUtils {
private final static String PUBLIC_IP_URL = "https://api-ipv4.ip.sb/ip";
public static String getPublicIp() throws IOException {
Map<String, String> header = Maps.newHashMap();
header.put("User-Agent", "Mozilla/5.0");
return HttpUtils.doGet(PUBLIC_IP_URL, header, null).trim();
}
}

View File

@@ -1,10 +0,0 @@
spring:
datasource:
url: jdbc:mysql:///xservice-script?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
aliyun:
dns:
RR: test21

View File

@@ -1,10 +0,0 @@
spring:
datasource:
url: jdbc:mysql://172.28.159.213:3306/xservice-script?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
aliyun:
dns:
RR: client

View File

@@ -1,10 +0,0 @@
spring:
datasource:
url: jdbc:mysql://172.28.159.213:3306/xservice-script?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
aliyun:
dns:
RR: general

View File

@@ -1,18 +0,0 @@
mybatis:
mapper-locations:
- classpath*:mapper/*.xml
configuration:
map-underscore-to-camel-case: true
DingTalk:
# 钉钉消息用户,用逗号隔开
userList: "450841600726084717"
# 钉钉消息群ID需要调用/chat/create api创建群返回
chatId: "chatd16d8daeea33b36b73588c676d508096"
server:
port: 8080
spring:
profiles:
active: local

View File

@@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!-- 应用名称:和统一配置中的项目代码保持一致(小写) -->
<property name="APP_NAME" value="xservice-script"/>
<contextName>${APP_NAME}</contextName>
<!--日志文件保留天数 -->
<property name="LOG_MAX_HISTORY" value="30"/>
<!--应用日志文件保存路径 -->
<!--在没有定义${LOG_HOME}系统变量的时候,可以设置此本地变量。提交测试、上线时,要将其注释掉,使用系统变量。 -->
<property name="LOG_HOME" value="logs/${APP_NAME}"/>
<!--<property name="LOG_HOME" msg="/home/logs/${APP_NAME}" />-->
<!--控制台输出appender-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<!--设置输出格式-->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%boldGreen(%contextName): %boldCyan(%d{yyyy-MM-dd HH:mm:ss:SSS}) %highlight([%c]) %boldMagenta([%t]) %boldCyan([%L]) %highlight([traceId:%X{traceId:-},spanId:%X{spanId:-},localIp:%X{localIp:-}]) %boldGreen([%p]) - %msg%n
</pattern>
<!--设置编码-->
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 按照每天生成日志文件:主项目日志 -->
<appender name="APP_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${LOG_HOME}/debug-%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%c类名%t表示线程名%L行 %p日志级别 %msg日志消息%n是换行符 -->
<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>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 按照每天生成日志文件:主项目日志 -->
<appender name="APP_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${LOG_HOME}/info-%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%c类名%t表示线程名%L行 %p日志级别 %msg日志消息%n是换行符 -->
<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>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</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">
<!--日志文件输出的文件名 -->
<FileNamePattern>${LOG_HOME}/error-%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%c类名%t表示线程名%L行 %p日志级别 %msg日志消息%n是换行符 -->
<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>
<!-- 此日志文件只记录error级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>error</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!--日志输出到文件-->
<root level="info">
<appender-ref ref="APP_DEBUG"/>
<appender-ref ref="APP_INFO"/>
<appender-ref ref="APP_ERROR"/>
<appender-ref ref="console"/>
</root>
<!-- mybatis 日志级别 -->
<logger name="com.xiang" level="debug"/>
</configuration>

View File

@@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xiang</groupId>
<artifactId>xservice-scirpt</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>facade</artifactId>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- &lt;!&ndash; 新版钉钉SDK &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.aliyun</groupId>-->
<!-- <artifactId>dingtalk</artifactId>-->
<!-- <version>2.2.16</version>-->
<!-- </dependency>-->
<!-- 旧版的钉钉SDK-->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 生成可执行的jar的名字xxx-exec.jar -->
<!-- 不固定写成abcd都可以 -->
<classifier>exec</classifier>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,30 +0,0 @@
package com.xiang.dingTalk.common.enums;
import lombok.Getter;
/**
* @Author: xiang
* @Date: 2025-05-09 15:54
*/
@Getter
public enum DingTalkUrlEnum {
/**
* 钉钉接口枚举
*/
DING_TALK_GET_ENTERPRISE_INTER_TOKEN("https://oapi.dingtalk.com/gettoken", "获取企业内部应用Token"),
DING_TALK_ASYNC_SEND_MESSAGE("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2", "异步发送工作通知"),
DING_TALK_CHAR_MESSAGE("https://oapi.dingtalk.com/chat/send", "发送消息到企业群旧版SDK"),
;
final String url;
final String desc;
DingTalkUrlEnum(String url, String desc) {
this.url = url;
this.desc = desc;
}
}

View File

@@ -1,19 +0,0 @@
package com.xiang.dingTalk.common.enums;
import lombok.Getter;
/**
* @Author: xiang
* @Date: 2025-05-09 16:00
*/
@Getter
public enum HttpMethod {
GET("get"),
;
final String method;
HttpMethod(String method) {
this.method = method;
}
}

View File

@@ -1,118 +0,0 @@
package com.xiang.dingTalk.service;
import com.alibaba.fastjson2.JSONObject;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiChatSendRequest;
import com.dingtalk.api.request.OapiGettokenRequest;
import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request;
import com.dingtalk.api.response.OapiChatSendResponse;
import com.dingtalk.api.response.OapiGettokenResponse;
import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response;
import com.xiang.dingTalk.common.enums.DingTalkUrlEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Author: xiang
* @Date: 2025-05-09 15:06
*/
@Slf4j
@Service
public class DingTalkService {
/**
* 应用凭证id
* https://open-dev.dingtalk.com/fe/ai?hash=%23%2Fapp%2F3fa4c9a7-27f2-4d6f-bbe7-41d2a17b5c11%2Fbaseinfo#/app/3fa4c9a7-27f2-4d6f-bbe7-41d2a17b5c11/baseinfo
*/
private static final String APP_ID = "3fa4c9a7-27f2-4d6f-bbe7-41d2a17b5c11";
/**
* 原企业内部应用AgentID
*/
private static final String AGENT_ID = "3829551658";
/**
* 组织ID
*
*/
private static final String CORP_ID = "dingf2c4425cd179a26ef2c783f7214b6d69";
private static final String CLIENT_ID = "dingcc9fikz1c0e5wb9v";
private static final String CLIENT_SECRET = "wyapsH6y8P1K_wuTPKGKwG0mquj1uth9Dxn6HcRpta3sh8Syukl0C8nOmR1PeBzs";
private static final String GRANT_TYPE = "client_credentials";
private static final String USER_ID = "450841600726084717";
private static final String MSG_TYPE = "text";
// userID 450841600726084717
// chatID chatd16d8daeea33b36b73588c676d508096
/**
* 发送消息到企业群
* @return
*/
public String sendChatMessage(String chatId, String message) throws Exception{
String token = getToken();
DefaultDingTalkClient client = new DefaultDingTalkClient(DingTalkUrlEnum.DING_TALK_CHAR_MESSAGE.getUrl());
OapiChatSendRequest req = new OapiChatSendRequest();
req.setChatid(chatId);
OapiChatSendRequest.Msg msg = new OapiChatSendRequest.Msg();
OapiChatSendRequest.Text text = new OapiChatSendRequest.Text();
text.setContent(message);
msg.setText(text);
msg.setMsgtype("text");
req.setMsg(msg);
OapiChatSendResponse rsp = client.execute(req, token);
log.info("[DingTalk] send chat message, req:{}, token:{}, response:{}", JSONObject.toJSONString(req), token, JSONObject.toJSONString(rsp));
return rsp.getMessageId();
}
/**
* 异步发送工作同志--文本类型
* @param userId
* @param message
* @return
* @throws Exception
*/
public String asyncSendMessage(String userId, String message) throws Exception {
String token = getToken();
DingTalkClient client = new DefaultDingTalkClient(DingTalkUrlEnum.DING_TALK_ASYNC_SEND_MESSAGE.getUrl());
OapiMessageCorpconversationAsyncsendV2Request req = new OapiMessageCorpconversationAsyncsendV2Request();
req.setAgentId(Long.parseLong(AGENT_ID));
req.setUseridList(userId);
req.setToAllUser(false);
OapiMessageCorpconversationAsyncsendV2Request.Msg obj1 = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
obj1.setMsgtype(MSG_TYPE);
OapiMessageCorpconversationAsyncsendV2Request.Text obj2 = new OapiMessageCorpconversationAsyncsendV2Request.Text();
obj2.setContent(message);
obj1.setText(obj2);
req.setMsg(obj1);
log.info("send Ding Talk message, userId:{}, message:{}", userId, message);
OapiMessageCorpconversationAsyncsendV2Response rsp = client.execute(req, token);
log.info("send Ding Talk message response, taskId:{}", JSONObject.toJSONString(rsp));
return rsp.getTaskId().toString();
}
/**
* 获取企业内部应用token
*
* @return
* @throws Exception
*/
public String getToken() throws Exception {
DingTalkClient client = new DefaultDingTalkClient(DingTalkUrlEnum.DING_TALK_GET_ENTERPRISE_INTER_TOKEN.getUrl());
OapiGettokenRequest req = new OapiGettokenRequest();
req.setAppkey(CLIENT_ID);
req.setAppsecret(CLIENT_SECRET);
req.setHttpMethod("GET");
OapiGettokenResponse rsp = client.execute(req);
return rsp.getAccessToken();
}
}

19
pom.xml
View File

@@ -4,12 +4,17 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xiang</groupId>
<artifactId>xservice-basic</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.xiang</groupId> <groupId>com.xiang</groupId>
<artifactId>xservice-scirpt</artifactId> <artifactId>xservice-scirpt</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>facade</module>
<module>script</module> <module>script</module>
</modules> </modules>
@@ -23,6 +28,16 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.xiang</groupId>
<artifactId>xservice-common</artifactId>
<version>1.0-snapshot</version>
</dependency>
<dependency>
<groupId>com.xiang</groupId>
<artifactId>xservice-third-part</artifactId>
<version>1.0-snapshot</version>
</dependency>
<!--<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId> <artifactId>spring-boot-starter</artifactId>
<version>${spring.boot.version}</version> <version>${spring.boot.version}</version>
@@ -76,7 +91,7 @@
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.15.0</version> <version>3.15.0</version>
</dependency> </dependency>-->
</dependencies> </dependencies>
<build> <build>

View File

@@ -20,14 +20,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<dependencies>
<dependency>
<groupId>com.xiang</groupId>
<artifactId>facade</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@@ -1,51 +0,0 @@
package com.xiang.common;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collections;
import java.util.List;
/**
* @Author: xiang
* @Date: 2025-05-09 14:09
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
private String code;
private String message;
private List<T> data;
public static Result<Void> success(String message) {
return new Result<Void>("200", message, null);
}
public static <T> Result<T> success(String message, List<T> data) {
return new Result<T>("200", message, data);
}
public static <T> Result<T> success(String message, T data) {
return new Result<T>("200", message, Collections.singletonList(data));
}
public static <T> Result<T> error(String message) {
return new Result<T>("500", message, null);
}
public static <T> Result<T> error(String message, T data) {
return new Result<T>("500", message, Collections.singletonList(data));
}
public static <T> Result<T> error(String message, List<T> data) {
return new Result<T>("500", message, data);
}
public static Result<Void> error(String code, String message) {
return new Result<Void>(code, message, null);
}
}

View File

@@ -1,28 +0,0 @@
package com.xiang.common.factory.xb;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @Author: xiang
* @Date: 2025-05-15 08:54
*/
public class QueryThreadFactory implements ThreadFactory {
private final String threadName;
private final boolean daemon;
private final AtomicInteger threadNum = new AtomicInteger();
public QueryThreadFactory(String threadName, boolean daemon) {
this.threadName = threadName;
this.daemon = daemon;
}
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r, this.threadName + "[#" + threadNum.incrementAndGet() + "]");
thread.setDaemon(this.daemon);
return thread;
}
}

View File

@@ -1,27 +0,0 @@
package com.xiang.controller;
import com.xiang.common.Result;
import com.xiang.service.JntyzxService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: xiang
* @Date: 2025-05-14 15:13
*/
@RestController
@RequestMapping("/system/jntyzx")
@RequiredArgsConstructor
public class JntyzxController {
private final JntyzxService jntyzxService;
@PostMapping("/queryVenue")
public Result<Void> queryVenue() throws Exception {
jntyzxService.queryAvailable();
return Result.success("success");
}
}

View File

@@ -1,143 +0,0 @@
package com.xiang.utils;
import com.alibaba.fastjson2.JSONObject;
import com.xiang.common.URLConstants;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Component;
import java.io.Closeable;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
/**
* @Author: xiang
* @Date: 2025-05-08 14:39
*/
@Slf4j
@Component
public class HttpUtils {
private int socketTimeOut = 60 * 1000;
private int connectTimeout = 60 * 1000;
private int connectionRequestTimeout = 15 * 1000;
private int defaultMaxPerRoute = 500;
private int maxTotal = 2000;
public String doPost(String url, Map<String, String> header, String jsonParams) {
RequestConfig requestConfig = RequestConfig.custom()
// 设置连接超时时间
.setConnectTimeout(connectTimeout)
// 设置Socket超时时间
.setSocketTimeout(socketTimeOut)
.setConnectionRequestTimeout(connectionRequestTimeout)
.build();
//创建httpClient对象
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
CloseableHttpResponse response = null;
String result = "";
try {
// 创建http请求
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", "application/json");
// 创建请求内容
StringEntity entity = new StringEntity(jsonParams, "utf-8");
entity.setContentType("application/json");
httpPost.setEntity(entity);
// 设置请求头
if (null != header && !header.isEmpty()) {
Set<Map.Entry<String, String>> entries = header.entrySet();
for (Map.Entry<String, String> e : entries) {
httpPost.setHeader(e.getKey(), e.getValue());
}
}
response = httpClient.execute(httpPost);
result = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
log.error("doPost异常", e);
} finally {
//关闭资源
closeResource(response, httpClient);
}
return result;
}
public String doGet(String url, Map<String, String> header, Map<String, String> param) {
RequestConfig requestConfig = RequestConfig.custom()
// 设置连接超时时间
.setConnectTimeout(connectTimeout)
// 设置Socket超时时间
.setSocketTimeout(socketTimeOut)
.setConnectionRequestTimeout(connectionRequestTimeout)
.build();
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
CloseableHttpResponse response;
String result = "";
try {
String request = "";
if (MapUtils.isNotEmpty(param)) {
StringBuilder req = new StringBuilder("?");
for (Map.Entry<String, String> entry : param.entrySet()) {
req.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
}
request = req.substring(0, req.length() - 1);
}
HttpGet httpGet = new HttpGet(url + request);
httpGet.addHeader("Content-Type", "application/json");
if (MapUtils.isNotEmpty(header)) {
for (Map.Entry<String, String> entry : header.entrySet()) {
httpGet.setHeader(entry.getKey(), entry.getValue());
}
}
log.info("doGet请求请求地址{}", url + request);
response = httpClient.execute(httpGet);
result = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
log.error("doGet异常", e);
}
return result;
}
/**
* @Description 关闭资源
*/
private void closeResource(Closeable... resources) {
try {
for (Closeable resource : resources) {
if (resource != null) {
resource.close();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
// HttpUtils httpUtils = new HttpUtils();
// Map<String, String> map = new HashMap<>();
// map.put("Cookie", "SL_G_WPT_TO=en; SL_GWPT_Show_Hide_tmp=1; SL_wptGlobTipTmp=1; koa:sess=eyJ1c2VySWQiOjU1OTg1MywiX2V4cGlyZSI6MTc3MjYwNDkyNjI4OCwiX21heEFnZSI6MjU5MjAwMDAwMDB9; koa:sess.sig=OdaqjpLkIp19lXn0lFuOsHX7vEM");
// String response = httpUtils.doPost("https://www.glados.one/api/user/checkin", map, "{\"token\":\"glados.one\"}");
// System.out.println(response);
HttpUtils httpUtils = new HttpUtils();
// Map<String, String> header = Maps.newHashMap();
// header.put("X-Access-Token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NDcyMTAwNzQsInVzZXJuYW1lIjoid3hfb3Blbl9pZF9vMjFNWDR5N3doWENHanZVVEdQNkNUejJIYkQ4In0.0h_cAH_e5cCXDQlQN40jZDBgtfrzQWAmgl3YPQf0d-M");
// System.out.println(httpUtils.doGet("https://jntyzx.cn:8443/GYM-JN/multi/Subscribe/getSubscribeByToday?gid=03&isWeekend=1", header, null));
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", "012414");
jsonObject.put("unionId", "o896o5y8bJZYMh2gdKhDdmUKc0Wk");
String resp = httpUtils.doPost(URLConstants.XB_QUERY_FUND_INFO, null, JSONObject.toJSONString(jsonObject));
System.out.println(resp);
}
}

View File

@@ -0,0 +1,4 @@
package com.xiang.xservice;
public class CheckHealthController {
}

View File

@@ -1,6 +1,6 @@
package com.xiang.controller; package com.xiang.xservice;
import com.xiang.common.Result; import com.xiang.xservice.basic.common.resp.Result;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;

View File

@@ -0,0 +1,15 @@
package com.xiang.xservice.domain.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@ConfigurationProperties(prefix = "aliyun.dns")
@Data
public class AliyunDnsPropertyConfig {
private List<String> RR;
}

View File

@@ -1,8 +1,9 @@
package com.xiang.controller; package com.xiang.xservice.domain.controller;
import com.xiang.common.Result;
import com.xiang.service.DomainService; import com.xiang.xservice.basic.common.resp.Result;
import com.xiang.utils.IpUtils; import com.xiang.xservice.basic.utils.IpUtils;
import com.xiang.xservice.domain.service.IDomainService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@@ -25,7 +26,7 @@ import java.time.LocalDateTime;
@RequiredArgsConstructor @RequiredArgsConstructor
public class DynamicDomainController { public class DynamicDomainController {
private final DomainService domainService; private final IDomainService IDomainService;
@GetMapping("/getIp") @GetMapping("/getIp")
public Result<String> getPublicIp() { public Result<String> getPublicIp() {
@@ -44,7 +45,7 @@ public class DynamicDomainController {
try { try {
String publicIp = IpUtils.getPublicIp(); String publicIp = IpUtils.getPublicIp();
log.info("获取公网IP成功time:{}, ip:{}", LocalDateTime.now(), publicIp); log.info("获取公网IP成功time:{}, ip:{}", LocalDateTime.now(), publicIp);
domainService.dynamicDomainAnalysis(publicIp); IDomainService.dynamicDomainAnalysis(publicIp);
return Result.success("获取公网IP成功"); return Result.success("获取公网IP成功");
} catch (Exception e) { } catch (Exception e) {
log.error("获取公网IP失败 time:{}", LocalDateTime.now(), e); log.error("获取公网IP失败 time:{}", LocalDateTime.now(), e);

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.resp; package com.xiang.xservice.domain.entity.resp;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View File

@@ -1,7 +1,7 @@
package com.xiang.schedule; package com.xiang.xservice.domain.schedule;
import com.xiang.service.DomainServiceImpl; import com.xiang.xservice.basic.utils.IpUtils;
import com.xiang.utils.IpUtils; import com.xiang.xservice.domain.service.IDomainService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -17,7 +17,7 @@ import org.springframework.stereotype.Component;
@Slf4j @Slf4j
public class DynamicDomainSchedule { public class DynamicDomainSchedule {
private final DomainServiceImpl domainService; private final IDomainService IDomainService;
@Scheduled(cron = "0 0/5 * * * ? ") @Scheduled(cron = "0 0/5 * * * ? ")
public void dynamicDomainSchedule() { public void dynamicDomainSchedule() {
@@ -29,7 +29,7 @@ public class DynamicDomainSchedule {
} }
if (StringUtils.isNotBlank(publicIp)) { if (StringUtils.isNotBlank(publicIp)) {
try { try {
domainService.dynamicDomainAnalysis(publicIp); IDomainService.dynamicDomainAnalysis(publicIp);
} catch (Exception e) { } catch (Exception e) {
log.error("动态解析公网ip失败, ip:{}", publicIp, e); log.error("动态解析公网ip失败, ip:{}", publicIp, e);
} }

View File

@@ -1,10 +1,10 @@
package com.xiang.service; package com.xiang.xservice.domain.service;
/** /**
* @Author: xiang * @Author: xiang
* @Date: 2025-06-10 16:48 * @Date: 2025-06-10 16:48
*/ */
public interface DomainService { public interface IDomainService {
/** /**
* 动态域名解析 * 动态域名解析

View File

@@ -1,4 +1,4 @@
package com.xiang.service; package com.xiang.xservice.domain.service;
import com.aliyun.alidns20150109.Client; import com.aliyun.alidns20150109.Client;
@@ -8,7 +8,8 @@ import com.aliyun.alidns20150109.models.DescribeSubDomainRecordsResponse;
import com.aliyun.alidns20150109.models.DescribeSubDomainRecordsResponseBody; import com.aliyun.alidns20150109.models.DescribeSubDomainRecordsResponseBody;
import com.aliyun.alidns20150109.models.UpdateDomainRecordRequest; import com.aliyun.alidns20150109.models.UpdateDomainRecordRequest;
import com.aliyun.teaopenapi.models.Config; import com.aliyun.teaopenapi.models.Config;
import com.xiang.dingTalk.service.DingTalkService; import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
import com.xiang.xservice.domain.config.AliyunDnsPropertyConfig;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -23,7 +24,7 @@ import java.util.List;
@Service @Service
@Slf4j @Slf4j
@RequiredArgsConstructor @RequiredArgsConstructor
public class DomainServiceImpl implements DomainService { public class IDomainServiceImpl implements IDomainService {
private static final String ACCESS_KEY_ID = "LTAI5tDMjaVF8Bbqcpp4dmvP"; private static final String ACCESS_KEY_ID = "LTAI5tDMjaVF8Bbqcpp4dmvP";
private static final String ACCESS_KEY_SECRET = "nkmnaNjWQy5984C5kjyS0oDmdMKGQd"; private static final String ACCESS_KEY_SECRET = "nkmnaNjWQy5984C5kjyS0oDmdMKGQd";
@@ -34,8 +35,7 @@ public class DomainServiceImpl implements DomainService {
/** /**
* 主机记录例如 home.example.com * 主机记录例如 home.example.com
*/ */
@Value("${aliyun.dns.RR}") private final AliyunDnsPropertyConfig aliyunDnsPropertyConfig;
private String rr;
private static final String TYPE = "A"; private static final String TYPE = "A";
private final DingTalkService dingTalkService; private final DingTalkService dingTalkService;
@@ -46,6 +46,7 @@ public class DomainServiceImpl implements DomainService {
public void dynamicDomainAnalysis(String publicIp) throws Exception { public void dynamicDomainAnalysis(String publicIp) throws Exception {
Client client = createClient(); Client client = createClient();
for (String rr : aliyunDnsPropertyConfig.getRR()) {
// 查询记录 // 查询记录
DescribeSubDomainRecordsRequest query = new DescribeSubDomainRecordsRequest() DescribeSubDomainRecordsRequest query = new DescribeSubDomainRecordsRequest()
.setSubDomain(rr + "." + DOMAIN_NAME) .setSubDomain(rr + "." + DOMAIN_NAME)
@@ -56,20 +57,21 @@ public class DomainServiceImpl implements DomainService {
if (records.isEmpty()) { if (records.isEmpty()) {
log.info("未找到记录,添加记录..., ip:{}", publicIp); log.info("未找到记录,添加记录..., ip:{}", publicIp);
addDnsRecord(client, publicIp); addDnsRecord(client, publicIp, rr);
dingTalkService.sendChatMessage(chatId, "动态解析公网ip成功域名" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp); dingTalkService.sendChatMessage(chatId, "动态解析公网ip成功域名" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
} else { } else {
String recordId = records.get(0).getRecordId(); String recordId = records.get(0).getRecordId();
String currentValue = records.get(0).getValue(); String currentValue = records.get(0).getValue();
if (!publicIp.equals(currentValue)) { if (!publicIp.equals(currentValue)) {
log.info("IP变更更新记录...,ip:{}", publicIp); log.info("IP变更更新记录...,ip:{}", publicIp);
updateDnsRecord(client, recordId, publicIp); updateDnsRecord(client, recordId, publicIp, rr);
dingTalkService.sendChatMessage(chatId, "动态解析公网ip成功域名" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp); dingTalkService.sendChatMessage(chatId, "动态解析公网ip成功域名" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
} else { } else {
log.info("ip未变更无需修改ip:{}", publicIp); log.info("ip未变更无需修改ip:{}", publicIp);
} }
} }
} }
}
private Client createClient() throws Exception { private Client createClient() throws Exception {
Config config = new Config() Config config = new Config()
@@ -79,7 +81,7 @@ public class DomainServiceImpl implements DomainService {
return new Client(config); return new Client(config);
} }
private void updateDnsRecord(Client client, String recordId, String newIp) throws Exception { private void updateDnsRecord(Client client, String recordId, String newIp, String rr) throws Exception {
UpdateDomainRecordRequest request = new UpdateDomainRecordRequest() UpdateDomainRecordRequest request = new UpdateDomainRecordRequest()
.setRecordId(recordId) .setRecordId(recordId)
.setRR(rr) .setRR(rr)
@@ -89,7 +91,7 @@ public class DomainServiceImpl implements DomainService {
log.info("更新成功: newIP:{}", newIp); log.info("更新成功: newIP:{}", newIp);
} }
private void addDnsRecord(Client client, String ip) throws Exception { private void addDnsRecord(Client client, String ip, String rr) throws Exception {
AddDomainRecordRequest request = new AddDomainRecordRequest() AddDomainRecordRequest request = new AddDomainRecordRequest()
.setDomainName(DOMAIN_NAME) .setDomainName(DOMAIN_NAME)
.setRR(rr) .setRR(rr)

View File

@@ -1,4 +1,4 @@
package com.xiang.common; package com.xiang.xservice.glados.common;
/** /**
* @Author: xiang * @Author: xiang

View File

@@ -0,0 +1,14 @@
package com.xiang.xservice.glados.common;
public class URLConstants {
/**
* glados 主域名
*/
public static final String GLADOS_URL_PREFIX = "https://www.glados.one";
/**
* 签到
*/
public static final String GLADOS_CHECK_IN_URL = GLADOS_URL_PREFIX + "/api/user/checkin";
}

View File

@@ -1,8 +1,8 @@
package com.xiang.controller; package com.xiang.xservice.glados.controller;
import com.xiang.common.Result; import com.xiang.xservice.basic.common.resp.Result;
import com.xiang.entity.request.GladosCheckInReq; import com.xiang.xservice.glados.entity.req.GladosCheckInReq;
import com.xiang.service.GLaDOSService; import com.xiang.xservice.glados.service.GLaDOSService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.pojo; package com.xiang.xservice.glados.entity;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.request; package com.xiang.xservice.glados.entity.req;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.response; package com.xiang.xservice.glados.entity.resp;
import lombok.Data; import lombok.Data;

View File

@@ -1,7 +1,7 @@
package com.xiang.repository; package com.xiang.xservice.glados.repository;
import com.xiang.entity.pojo.GladosRunLog; import com.xiang.xservice.glados.entity.GladosRunLog;
import com.xiang.entity.pojo.User; import com.xiang.xservice.xb.entity.pojo.User;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

View File

@@ -1,6 +1,6 @@
package com.xiang.schedule; package com.xiang.xservice.glados.schedule;
import com.xiang.service.GLaDOSService; import com.xiang.xservice.glados.service.GLaDOSService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;

View File

@@ -1,4 +1,4 @@
package com.xiang.service; package com.xiang.xservice.glados.service;
/** /**
* @Author: xiang * @Author: xiang

View File

@@ -1,15 +1,15 @@
package com.xiang.service; package com.xiang.xservice.glados.service;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xiang.common.GladosConstants; import com.xiang.xservice.basic.utils.HttpUtils;
import com.xiang.common.URLConstants; import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
import com.xiang.dingTalk.service.DingTalkService; import com.xiang.xservice.glados.common.GladosConstants;
import com.xiang.entity.pojo.GladosRunLog; import com.xiang.xservice.glados.common.URLConstants;
import com.xiang.entity.pojo.User; import com.xiang.xservice.glados.entity.GladosRunLog;
import com.xiang.entity.response.GLaDOSResponse; import com.xiang.xservice.xb.entity.pojo.User;
import com.xiang.repository.GladosMapper; import com.xiang.xservice.glados.entity.resp.GLaDOSResponse;
import com.xiang.utils.HttpUtils; import com.xiang.xservice.glados.repository.GladosMapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -31,8 +31,6 @@ import java.util.Objects;
@RequiredArgsConstructor @RequiredArgsConstructor
public class GLaDOSServiceImpl implements GLaDOSService{ public class GLaDOSServiceImpl implements GLaDOSService{
private final HttpUtils httpUtils;
private final GladosMapper gladosMapper; private final GladosMapper gladosMapper;
private final DingTalkService dingTalkService; private final DingTalkService dingTalkService;
@@ -72,7 +70,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
String response = null; String response = null;
try { try {
response = httpUtils.doPost(URLConstants.GLADOS_CHECK_IN_URL, header, GladosConstants.GLADOS_CHECK_IN_BODY); response = HttpUtils.doPost(URLConstants.GLADOS_CHECK_IN_URL, header, GladosConstants.GLADOS_CHECK_IN_BODY);
} catch (Exception e) { } catch (Exception e) {
log.error("http do post error, header:{}, jsonParams:{}", JSONObject.toJSONString(header), GladosConstants.GLADOS_CHECK_IN_BODY, e); log.error("http do post error, header:{}, jsonParams:{}", JSONObject.toJSONString(header), GladosConstants.GLADOS_CHECK_IN_BODY, e);
} }

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.response.jntyzx; package com.xiang.xservice.jntyzx.entity.resp;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.response.jntyzx.venue.query; package com.xiang.xservice.jntyzx.entity.resp.query;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.response.jntyzx.venue.query; package com.xiang.xservice.jntyzx.entity.resp.query;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.response.jntyzx.venue.query; package com.xiang.xservice.jntyzx.entity.resp.query;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.response.jntyzx.venue.query; package com.xiang.xservice.jntyzx.entity.resp.query;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.service; package com.xiang.xservice.jntyzx.service;
/** /**
* @Author: xiang * @Author: xiang

View File

@@ -1,14 +1,14 @@
package com.xiang.service; package com.xiang.xservice.jntyzx.service;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xiang.common.URLConstants; import com.xiang.xservice.basic.utils.HttpUtils;
import com.xiang.dingTalk.service.DingTalkService; import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
import com.xiang.entity.response.jntyzx.JntyzxResponse; import com.xiang.xservice.xb.common.URLConstants;
import com.xiang.entity.response.jntyzx.venue.query.QueryVenueResponse; import com.xiang.xservice.jntyzx.entity.resp.JntyzxResponse;
import com.xiang.entity.response.jntyzx.venue.query.SitePositionList; import com.xiang.xservice.jntyzx.entity.resp.query.QueryVenueResponse;
import com.xiang.entity.response.jntyzx.venue.query.VenueList; import com.xiang.xservice.jntyzx.entity.resp.query.SitePositionList;
import com.xiang.utils.HttpUtils; import com.xiang.xservice.jntyzx.entity.resp.query.VenueList;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -30,7 +30,6 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class JntyzxServiceImpl implements JntyzxService{ public class JntyzxServiceImpl implements JntyzxService{
private final HttpUtils httpUtils;
private final DingTalkService dingTalkService; private final DingTalkService dingTalkService;
@@ -44,7 +43,7 @@ public class JntyzxServiceImpl implements JntyzxService{
header.put("X-Access-Token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NDcyMTAwNzQsInVzZXJuYW1lIjoid3hfb3Blbl9pZF9vMjFNWDR5N3doWENHanZVVEdQNkNUejJIYkQ4In0.0h_cAH_e5cCXDQlQN40jZDBgtfrzQWAmgl3YPQf0d-M"); header.put("X-Access-Token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NDcyMTAwNzQsInVzZXJuYW1lIjoid3hfb3Blbl9pZF9vMjFNWDR5N3doWENHanZVVEdQNkNUejJIYkQ4In0.0h_cAH_e5cCXDQlQN40jZDBgtfrzQWAmgl3YPQf0d-M");
String resp = null; String resp = null;
try { try {
resp = httpUtils.doGet(url, header, null); resp = HttpUtils.doGet(url, header, null);
} catch (Exception e) { } catch (Exception e) {
log.error("[doGet] 江南体育中心查询当天场地 请求失败, url:{}", url); log.error("[doGet] 江南体育中心查询当天场地 请求失败, url:{}", url);
} }

View File

@@ -1,4 +1,4 @@
package com.xiang.common; package com.xiang.xservice.xb.common;
/** /**
* @Author: xiang * @Author: xiang
@@ -6,13 +6,6 @@ package com.xiang.common;
*/ */
public class URLConstants { public class URLConstants {
public static final String GLADOS_URL_PREFIX = "https://www.glados.one";
/**
* 签到
*/
public static final String GLADOS_CHECK_IN_URL = GLADOS_URL_PREFIX + "/api/user/checkin";
/** /**
* ==================== * ====================

View File

@@ -1,14 +1,14 @@
package com.xiang.controller; package com.xiang.xservice.xb.controller;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.xiang.common.Result; import com.xiang.xservice.basic.common.resp.Result;
import com.xiang.entity.pojo.xb.XbFundList; import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
import com.xiang.entity.request.xb.fund.QueryFundInfoReq; import com.xiang.xservice.xb.entity.request.xb.fund.QueryFundInfoReq;
import com.xiang.entity.request.xb.fund.QueryFundListReq; import com.xiang.xservice.xb.entity.request.xb.fund.QueryFundListReq;
import com.xiang.entity.request.xb.fund.QueryXbFundListReq; import com.xiang.xservice.xb.entity.request.xb.fund.QueryXbFundListReq;
import com.xiang.entity.response.xbyj.fund.FundInfo; import com.xiang.xservice.xb.entity.response.xbyj.fund.FundInfo;
import com.xiang.entity.response.xbyj.fund.FundList; import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
import com.xiang.service.FundService; import com.xiang.xservice.xb.service.FundService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.pojo; package com.xiang.xservice.xb.entity.pojo;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.pojo.xb; package com.xiang.xservice.xb.entity.pojo.xb;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.pojo.xb; package com.xiang.xservice.xb.entity.pojo.xb;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.pojo.xb; package com.xiang.xservice.xb.entity.pojo.xb;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.pojo.xb; package com.xiang.xservice.xb.entity.pojo.xb;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.request.xb.fund; package com.xiang.xservice.xb.entity.request.xb.fund;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.request.xb.fund; package com.xiang.xservice.xb.entity.request.xb.fund;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.request.xb.fund; package com.xiang.xservice.xb.entity.request.xb.fund;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.response.xbyj.fund; package com.xiang.xservice.xb.entity.response.xbyj.fund;
import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.response.xbyj.fund; package com.xiang.xservice.xb.entity.response.xbyj.fund;
import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.response.xbyj.fund; package com.xiang.xservice.xb.entity.response.xbyj.fund;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.xiang.entity.response.xbyj.fund; package com.xiang.xservice.xb.entity.response.xbyj.fund;
import lombok.Data; import lombok.Data;

View File

@@ -1,8 +1,8 @@
package com.xiang.repository; package com.xiang.xservice.xb.repository;
import com.xiang.entity.pojo.xb.FundInfo; import com.xiang.xservice.xb.entity.pojo.xb.FundInfo;
import com.xiang.entity.pojo.xb.XbFundCount; import com.xiang.xservice.xb.entity.pojo.xb.XbFundCount;
import com.xiang.entity.pojo.xb.XbFundList; import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

View File

@@ -1,6 +1,6 @@
package com.xiang.schedule.jntyzx; package com.xiang.xservice.xb.schedule.jntyzx;
import com.xiang.service.JntyzxService; import com.xiang.xservice.jntyzx.service.JntyzxService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

View File

@@ -1,12 +1,12 @@
package com.xiang.schedule.xb; package com.xiang.xservice.xb.schedule.xb;
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.dingTalk.service.DingTalkService; import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
import com.xiang.entity.pojo.xb.XbFundCount; import com.xiang.xservice.xb.entity.pojo.xb.XbFundCount;
import com.xiang.entity.pojo.xb.XbFundList; import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
import com.xiang.entity.response.xbyj.fund.FundList; import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
import com.xiang.service.FundService; import com.xiang.xservice.xb.service.FundService;
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,15 +1,15 @@
package com.xiang.schedule.xb; package com.xiang.xservice.xb.schedule.xb;
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.common.factory.xb.QueryThreadFactory; import com.xiang.xservice.basic.config.MyThreadFactory;
import com.xiang.dingTalk.service.DingTalkService; import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
import com.xiang.entity.pojo.xb.FundMessage; import com.xiang.xservice.xb.entity.pojo.xb.FundMessage;
import com.xiang.entity.pojo.xb.XbFundList; import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
import com.xiang.entity.response.xbyj.fund.FundInfo; import com.xiang.xservice.xb.entity.response.xbyj.fund.FundInfo;
import com.xiang.entity.response.xbyj.fund.FundList; import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
import com.xiang.repository.XBFundMapper; import com.xiang.xservice.xb.repository.XBFundMapper;
import com.xiang.service.FundService; import com.xiang.xservice.xb.service.FundService;
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;
@@ -55,7 +55,7 @@ public class FundInfoQueryJob {
1000, 1000,
TimeUnit.MILLISECONDS, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(), new LinkedBlockingQueue<>(),
new QueryThreadFactory("xb-query-thread", Boolean.TRUE), new MyThreadFactory("xb-query-thread", Boolean.TRUE),
new ThreadPoolExecutor.AbortPolicy()); new ThreadPoolExecutor.AbortPolicy());
@Value("${xiaobei.codeArr}") @Value("${xiaobei.codeArr}")
private String codeArr; private String codeArr;
@@ -172,14 +172,14 @@ public class FundInfoQueryJob {
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) { Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
return; return;
} }
List<com.xiang.entity.pojo.xb.FundInfo> fundInfos = xbFundMapper.queryListIn2Min(); List<com.xiang.xservice.xb.entity.pojo.xb.FundInfo> fundInfos = xbFundMapper.queryListIn2Min();
if (CollectionUtils.isEmpty(fundInfos)) { if (CollectionUtils.isEmpty(fundInfos)) {
return; return;
} }
Map<String, List<com.xiang.entity.pojo.xb.FundInfo>> map = fundInfos.stream().collect(Collectors.groupingBy(com.xiang.entity.pojo.xb.FundInfo::getCode)); Map<String, List<com.xiang.xservice.xb.entity.pojo.xb.FundInfo>> map = fundInfos.stream().collect(Collectors.groupingBy(com.xiang.xservice.xb.entity.pojo.xb.FundInfo::getCode));
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
map.entrySet().parallelStream().forEach(entry -> { map.entrySet().parallelStream().forEach(entry -> {
List<com.xiang.entity.pojo.xb.FundInfo> infos = entry.getValue(); List<com.xiang.xservice.xb.entity.pojo.xb.FundInfo> infos = entry.getValue();
BigDecimal sum = new BigDecimal("0"); BigDecimal sum = new BigDecimal("0");
for (int i = 0; i < infos.size() - 1; i++) { 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())); BigDecimal subtract = new BigDecimal(infos.get(i + 1).getChange()).subtract(new BigDecimal(infos.get(i).getChange()));
@@ -210,12 +210,12 @@ public class FundInfoQueryJob {
return; return;
} }
List<CompletableFuture> futures = Lists.newArrayList(); List<CompletableFuture> futures = Lists.newArrayList();
List<com.xiang.entity.pojo.xb.FundInfo> fundInfoList = Lists.newCopyOnWriteArrayList(); List<com.xiang.xservice.xb.entity.pojo.xb.FundInfo> fundInfoList = Lists.newCopyOnWriteArrayList();
fundMessageList.parallelStream().forEach(fundMessage -> { fundMessageList.parallelStream().forEach(fundMessage -> {
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> { CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
FundInfo fundInfo = fundService.queryFundInfo(fundMessage.getCode()); FundInfo fundInfo = fundService.queryFundInfo(fundMessage.getCode());
com.xiang.entity.pojo.xb.FundInfo info = com.xiang.entity.pojo.xb.FundInfo.builder() com.xiang.xservice.xb.entity.pojo.xb.FundInfo info = com.xiang.xservice.xb.entity.pojo.xb.FundInfo.builder()
.code(fundMessage.getCode()) .code(fundMessage.getCode())
.name(fundInfo.getName()) .name(fundInfo.getName())
.change(fundMessage.getChange().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString()) .change(fundMessage.getChange().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString())

View File

@@ -1,9 +1,9 @@
package com.xiang.service; package com.xiang.xservice.xb.service;
import com.xiang.entity.pojo.xb.XbFundCount; import com.xiang.xservice.xb.entity.pojo.xb.XbFundCount;
import com.xiang.entity.pojo.xb.XbFundList; import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
import com.xiang.entity.response.xbyj.fund.FundInfo; import com.xiang.xservice.xb.entity.response.xbyj.fund.FundInfo;
import com.xiang.entity.response.xbyj.fund.FundList; import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
import java.util.List; import java.util.List;

View File

@@ -1,16 +1,16 @@
package com.xiang.service; package com.xiang.xservice.xb.service;
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.common.URLConstants; import com.xiang.xservice.basic.utils.HttpUtils;
import com.xiang.entity.pojo.xb.XbFundCount; import com.xiang.xservice.xb.common.URLConstants;
import com.xiang.entity.pojo.xb.XbFundList; import com.xiang.xservice.xb.entity.pojo.xb.XbFundCount;
import com.xiang.entity.response.xbyj.fund.FundInfo; import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
import com.xiang.entity.response.xbyj.fund.FundList; import com.xiang.xservice.xb.entity.response.xbyj.fund.FundInfo;
import com.xiang.entity.response.xbyj.fund.QueryFundInfoResponse; import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
import com.xiang.entity.response.xbyj.fund.QueryFundListResponse; import com.xiang.xservice.xb.entity.response.xbyj.fund.QueryFundInfoResponse;
import com.xiang.repository.XBFundMapper; import com.xiang.xservice.xb.entity.response.xbyj.fund.QueryFundListResponse;
import com.xiang.utils.HttpUtils; import com.xiang.xservice.xb.repository.XBFundMapper;
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;
@@ -32,7 +32,6 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class FundServiceImpl implements FundService{ public class FundServiceImpl implements FundService{
private final HttpUtils httpUtils;
private final XBFundMapper xbFundMapper; private final XBFundMapper xbFundMapper;
@@ -61,7 +60,7 @@ public class FundServiceImpl implements FundService{
String resp = ""; String resp = "";
try { try {
resp = httpUtils.doPost(URLConstants.XB_QUERY_LIST, null, JSONObject.toJSONString(json)); resp = HttpUtils.doPost(URLConstants.XB_QUERY_LIST, null, JSONObject.toJSONString(json));
log.info("[基金列表查询] 查询成功, 请求地址:{}, 请求参数:{}, 请求结果:{}", URLConstants.XB_QUERY_LIST, JSONObject.toJSONString(json), resp); log.info("[基金列表查询] 查询成功, 请求地址:{}, 请求参数:{}, 请求结果:{}", URLConstants.XB_QUERY_LIST, JSONObject.toJSONString(json), resp);
if (StringUtils.isNotBlank(resp)) { if (StringUtils.isNotBlank(resp)) {
QueryFundListResponse response = JSONObject.parseObject(resp, QueryFundListResponse.class); QueryFundListResponse response = JSONObject.parseObject(resp, QueryFundListResponse.class);
@@ -82,7 +81,7 @@ public class FundServiceImpl implements FundService{
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("code", code); jsonObject.put("code", code);
jsonObject.put("unionId", unionId); jsonObject.put("unionId", unionId);
String resp = httpUtils.doPost(URLConstants.XB_QUERY_FUND_INFO, null, JSONObject.toJSONString(jsonObject)); String resp = HttpUtils.doPost(URLConstants.XB_QUERY_FUND_INFO, null, JSONObject.toJSONString(jsonObject));
if (StringUtils.isNotBlank(resp)) { if (StringUtils.isNotBlank(resp)) {
log.info("[小蓓养基] 基金详情查询:请求参数:{}, 请求结果:{}", JSONObject.toJSONString(jsonObject), resp); log.info("[小蓓养基] 基金详情查询:请求参数:{}, 请求结果:{}", JSONObject.toJSONString(jsonObject), resp);
QueryFundInfoResponse response = JSONObject.parseObject(resp, QueryFundInfoResponse.class); QueryFundInfoResponse response = JSONObject.parseObject(resp, QueryFundInfoResponse.class);

View File

@@ -0,0 +1,12 @@
spring:
datasource:
url: jdbc:mysql://192.168.2.10:3306/xservice-script?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
username: root
password: Admin@123
driver-class-name: com.mysql.cj.jdbc.Driver
aliyun:
dns:
RR:
- client
- file

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xiang.repository.GladosMapper"> <mapper namespace="com.xiang.xservice.glados.repository.GladosMapper">
<resultMap id="BaseResultMap" type="com.xiang.entity.pojo.User" > <resultMap id="BaseResultMap" type="com.xiang.xservice.xb.entity.pojo.User" >
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="user" property="user" /> <result column="user" property="user" />
<result column="email" property="email" /> <result column="email" property="email" />
@@ -18,7 +18,7 @@
status status
</sql> </sql>
<insert id="insertScriptRunLog" keyProperty="id" useGeneratedKeys="true" parameterType="com.xiang.entity.pojo.GladosRunLog"> <insert id="insertScriptRunLog" keyProperty="id" useGeneratedKeys="true" parameterType="com.xiang.xservice.glados.entity.GladosRunLog">
insert into scirpt_glados_run(time, status, response, user, user_id, code) values (#{time}, #{status}, #{response}, #{user}, #{userId}, #{code}) insert into scirpt_glados_run(time, status, response, user, user_id, code) values (#{time}, #{status}, #{response}, #{user}, #{userId}, #{code})
</insert> </insert>

View File

@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xiang.repository.XBFundMapper"> <mapper namespace="com.xiang.xservice.xb.repository.XBFundMapper">
<resultMap id="BaseResultMap" type="com.xiang.entity.pojo.xb.FundInfo" > <resultMap id="BaseResultMap" type="com.xiang.xservice.xb.entity.pojo.xb.FundInfo" >
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="code" property="code" /> <result column="code" property="code" />
<result column="name" property="name" /> <result column="name" property="name" />
<result column="change" property="change" /> <result column="change" property="change" />
<result column="update_time" property="updateTime" /> <result column="update_time" property="updateTime" />
</resultMap> </resultMap>
<resultMap id="XbFundListMap" type="com.xiang.entity.pojo.xb.XbFundList"> <resultMap id="XbFundListMap" type="com.xiang.xservice.xb.entity.pojo.xb.XbFundList">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="code" property="code" /> <result column="code" property="code" />
<result column="name" property="name" /> <result column="name" property="name" />
@@ -50,7 +50,7 @@
and type = #{type} and type = #{type}
</if> </if>
</select> </select>
<select id="queryFundInWeek" resultType="com.xiang.entity.pojo.xb.XbFundCount"> <select id="queryFundInWeek" resultType="com.xiang.xservice.xb.entity.pojo.xb.XbFundCount">
select * from xb_fund_count select * from xb_fund_count
where update_time between NOW() - INTERVAL 7 DAY and NOW() where update_time between NOW() - INTERVAL 7 DAY and NOW()
</select> </select>