feat:first commit
This commit is contained in:
@@ -20,14 +20,6 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xiang</groupId>
|
||||
<artifactId>facade</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.xiang.xservice;
|
||||
|
||||
public class CheckHealthController {
|
||||
}
|
||||
@@ -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.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.xiang.xservice.domain.controller;
|
||||
|
||||
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import com.xiang.xservice.basic.utils.IpUtils;
|
||||
import com.xiang.xservice.domain.service.IDomainService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 域名动态解析
|
||||
*
|
||||
* @Author: xiang
|
||||
* @Date: 2025-06-10 16:44
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/domain")
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class DynamicDomainController {
|
||||
|
||||
private final IDomainService IDomainService;
|
||||
|
||||
@GetMapping("/getIp")
|
||||
public Result<String> getPublicIp() {
|
||||
String publicIp;
|
||||
try {
|
||||
publicIp = IpUtils.getPublicIp();
|
||||
} catch (IOException e) {
|
||||
log.error("获取公网IP失败, time:{}", LocalDateTime.now(), e);
|
||||
return Result.error("获取公网IP失败");
|
||||
}
|
||||
return Result.success("获取公网IP成功", publicIp);
|
||||
}
|
||||
|
||||
@PostMapping("/ddns")
|
||||
public Result<Void> dynamicDomainAnalysis() {
|
||||
try {
|
||||
String publicIp = IpUtils.getPublicIp();
|
||||
log.info("获取公网IP成功,time:{}, ip:{}", LocalDateTime.now(), publicIp);
|
||||
IDomainService.dynamicDomainAnalysis(publicIp);
|
||||
return Result.success("获取公网IP成功");
|
||||
} catch (Exception e) {
|
||||
log.error("获取公网IP失败, time:{}", LocalDateTime.now(), e);
|
||||
return Result.error("获取公网IP失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.xiang.xservice.domain.entity.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-06-11 15:55
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PublicIpResp {
|
||||
private String code;
|
||||
|
||||
private String message;
|
||||
|
||||
private List<String> data;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.xiang.xservice.domain.schedule;
|
||||
|
||||
import com.xiang.xservice.basic.utils.IpUtils;
|
||||
import com.xiang.xservice.domain.service.IDomainService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-06-10 17:21
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DynamicDomainSchedule {
|
||||
|
||||
private final IDomainService IDomainService;
|
||||
|
||||
@Scheduled(cron = "0 0/5 * * * ? ")
|
||||
public void dynamicDomainSchedule() {
|
||||
String publicIp = "";
|
||||
try {
|
||||
publicIp = IpUtils.getPublicIp();
|
||||
} catch (Exception e) {
|
||||
log.error("获取公网ip失败,", e);
|
||||
}
|
||||
if (StringUtils.isNotBlank(publicIp)) {
|
||||
try {
|
||||
IDomainService.dynamicDomainAnalysis(publicIp);
|
||||
} catch (Exception e) {
|
||||
log.error("动态解析公网ip失败, ip:{}", publicIp, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xiang.xservice.domain.service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-06-10 16:48
|
||||
*/
|
||||
public interface IDomainService {
|
||||
|
||||
/**
|
||||
* 动态域名解析
|
||||
* @param publicIp 动态ip
|
||||
*/
|
||||
void dynamicDomainAnalysis(String publicIp) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.xiang.xservice.domain.service;
|
||||
|
||||
|
||||
import com.aliyun.alidns20150109.Client;
|
||||
import com.aliyun.alidns20150109.models.AddDomainRecordRequest;
|
||||
import com.aliyun.alidns20150109.models.DescribeSubDomainRecordsRequest;
|
||||
import com.aliyun.alidns20150109.models.DescribeSubDomainRecordsResponse;
|
||||
import com.aliyun.alidns20150109.models.DescribeSubDomainRecordsResponseBody;
|
||||
import com.aliyun.alidns20150109.models.UpdateDomainRecordRequest;
|
||||
import com.aliyun.teaopenapi.models.Config;
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.domain.config.AliyunDnsPropertyConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-06-10 16:48
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class IDomainServiceImpl implements IDomainService {
|
||||
|
||||
private static final String ACCESS_KEY_ID = "LTAI5tDMjaVF8Bbqcpp4dmvP";
|
||||
private static final String ACCESS_KEY_SECRET = "nkmnaNjWQy5984C5kjyS0oDmdMKGQd";
|
||||
/**
|
||||
* 根域名
|
||||
*/
|
||||
private static final String DOMAIN_NAME = "xiangtech.xyz";
|
||||
/**
|
||||
* 主机记录,例如 home.example.com
|
||||
*/
|
||||
private final AliyunDnsPropertyConfig aliyunDnsPropertyConfig;
|
||||
private static final String TYPE = "A";
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
@Value("${DingTalk.chatId}")
|
||||
private String chatId;
|
||||
|
||||
@Override
|
||||
public void dynamicDomainAnalysis(String publicIp) throws Exception {
|
||||
Client client = createClient();
|
||||
|
||||
for (String rr : aliyunDnsPropertyConfig.getRR()) {
|
||||
// 查询记录
|
||||
DescribeSubDomainRecordsRequest query = new DescribeSubDomainRecordsRequest()
|
||||
.setSubDomain(rr + "." + DOMAIN_NAME)
|
||||
.setType(TYPE);
|
||||
DescribeSubDomainRecordsResponse response = client.describeSubDomainRecords(query);
|
||||
List<DescribeSubDomainRecordsResponseBody.DescribeSubDomainRecordsResponseBodyDomainRecordsRecord> records =
|
||||
response.getBody().getDomainRecords().getRecord();
|
||||
|
||||
if (records.isEmpty()) {
|
||||
log.info("未找到记录,添加记录..., ip:{}", publicIp);
|
||||
addDnsRecord(client, publicIp, rr);
|
||||
dingTalkService.sendChatMessage(chatId, "动态解析公网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.sendChatMessage(chatId, "动态解析公网ip成功,域名:" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
|
||||
} else {
|
||||
log.info("ip未变更,无需修改,ip:{}", publicIp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Client createClient() throws Exception {
|
||||
Config config = new Config()
|
||||
.setAccessKeyId(ACCESS_KEY_ID)
|
||||
.setAccessKeySecret(ACCESS_KEY_SECRET)
|
||||
.setEndpoint("alidns.cn-hangzhou.aliyuncs.com");
|
||||
return new Client(config);
|
||||
}
|
||||
|
||||
private void updateDnsRecord(Client client, String recordId, String newIp, String rr) throws Exception {
|
||||
UpdateDomainRecordRequest request = new UpdateDomainRecordRequest()
|
||||
.setRecordId(recordId)
|
||||
.setRR(rr)
|
||||
.setType(TYPE)
|
||||
.setValue(newIp);
|
||||
client.updateDomainRecord(request);
|
||||
log.info("更新成功: ,newIP:{}", newIp);
|
||||
}
|
||||
|
||||
private void addDnsRecord(Client client, String ip, String rr) throws Exception {
|
||||
AddDomainRecordRequest request = new AddDomainRecordRequest()
|
||||
.setDomainName(DOMAIN_NAME)
|
||||
.setRR(rr)
|
||||
.setType(TYPE)
|
||||
.setValue(ip);
|
||||
client.addDomainRecord(request);
|
||||
log.info("添加成功: ip:{}", ip);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.common;
|
||||
package com.xiang.xservice.glados.common;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
@@ -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";
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.xiang.controller;
|
||||
package com.xiang.xservice.glados.controller;
|
||||
|
||||
import com.xiang.common.Result;
|
||||
import com.xiang.entity.request.GladosCheckInReq;
|
||||
import com.xiang.service.GLaDOSService;
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import com.xiang.xservice.glados.entity.req.GladosCheckInReq;
|
||||
import com.xiang.xservice.glados.service.GLaDOSService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.pojo;
|
||||
package com.xiang.xservice.glados.entity;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.request;
|
||||
package com.xiang.xservice.glados.entity.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.response;
|
||||
package com.xiang.xservice.glados.entity.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.xiang.repository;
|
||||
package com.xiang.xservice.glados.repository;
|
||||
|
||||
import com.xiang.entity.pojo.GladosRunLog;
|
||||
import com.xiang.entity.pojo.User;
|
||||
import com.xiang.xservice.glados.entity.GladosRunLog;
|
||||
import com.xiang.xservice.xb.entity.pojo.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -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.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.service;
|
||||
package com.xiang.xservice.glados.service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.xiang.service;
|
||||
package com.xiang.xservice.glados.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.xiang.common.GladosConstants;
|
||||
import com.xiang.common.URLConstants;
|
||||
import com.xiang.dingTalk.service.DingTalkService;
|
||||
import com.xiang.entity.pojo.GladosRunLog;
|
||||
import com.xiang.entity.pojo.User;
|
||||
import com.xiang.entity.response.GLaDOSResponse;
|
||||
import com.xiang.repository.GladosMapper;
|
||||
import com.xiang.utils.HttpUtils;
|
||||
import com.xiang.xservice.basic.utils.HttpUtils;
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.glados.common.GladosConstants;
|
||||
import com.xiang.xservice.glados.common.URLConstants;
|
||||
import com.xiang.xservice.glados.entity.GladosRunLog;
|
||||
import com.xiang.xservice.xb.entity.pojo.User;
|
||||
import com.xiang.xservice.glados.entity.resp.GLaDOSResponse;
|
||||
import com.xiang.xservice.glados.repository.GladosMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -31,8 +31,6 @@ import java.util.Objects;
|
||||
@RequiredArgsConstructor
|
||||
public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
|
||||
private final HttpUtils httpUtils;
|
||||
|
||||
private final GladosMapper gladosMapper;
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
@@ -72,7 +70,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
String response = null;
|
||||
|
||||
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) {
|
||||
log.error("http do post error, header:{}, jsonParams:{}", JSONObject.toJSONString(header), GladosConstants.GLADOS_CHECK_IN_BODY, e);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.response.jntyzx;
|
||||
package com.xiang.xservice.jntyzx.entity.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.response.jntyzx.venue.query;
|
||||
package com.xiang.xservice.jntyzx.entity.resp.query;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.response.jntyzx.venue.query;
|
||||
package com.xiang.xservice.jntyzx.entity.resp.query;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.response.jntyzx.venue.query;
|
||||
package com.xiang.xservice.jntyzx.entity.resp.query;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.response.jntyzx.venue.query;
|
||||
package com.xiang.xservice.jntyzx.entity.resp.query;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.service;
|
||||
package com.xiang.xservice.jntyzx.service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.xiang.service;
|
||||
package com.xiang.xservice.jntyzx.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.xiang.common.URLConstants;
|
||||
import com.xiang.dingTalk.service.DingTalkService;
|
||||
import com.xiang.entity.response.jntyzx.JntyzxResponse;
|
||||
import com.xiang.entity.response.jntyzx.venue.query.QueryVenueResponse;
|
||||
import com.xiang.entity.response.jntyzx.venue.query.SitePositionList;
|
||||
import com.xiang.entity.response.jntyzx.venue.query.VenueList;
|
||||
import com.xiang.utils.HttpUtils;
|
||||
import com.xiang.xservice.basic.utils.HttpUtils;
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.xb.common.URLConstants;
|
||||
import com.xiang.xservice.jntyzx.entity.resp.JntyzxResponse;
|
||||
import com.xiang.xservice.jntyzx.entity.resp.query.QueryVenueResponse;
|
||||
import com.xiang.xservice.jntyzx.entity.resp.query.SitePositionList;
|
||||
import com.xiang.xservice.jntyzx.entity.resp.query.VenueList;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -30,7 +30,6 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class JntyzxServiceImpl implements JntyzxService{
|
||||
|
||||
private final HttpUtils httpUtils;
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
|
||||
@@ -44,7 +43,7 @@ public class JntyzxServiceImpl implements JntyzxService{
|
||||
header.put("X-Access-Token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NDcyMTAwNzQsInVzZXJuYW1lIjoid3hfb3Blbl9pZF9vMjFNWDR5N3doWENHanZVVEdQNkNUejJIYkQ4In0.0h_cAH_e5cCXDQlQN40jZDBgtfrzQWAmgl3YPQf0d-M");
|
||||
String resp = null;
|
||||
try {
|
||||
resp = httpUtils.doGet(url, header, null);
|
||||
resp = HttpUtils.doGet(url, header, null);
|
||||
} catch (Exception e) {
|
||||
log.error("[doGet] 江南体育中心查询当天场地 请求失败, url:{}", url);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.common;
|
||||
package com.xiang.xservice.xb.common;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
@@ -6,13 +6,6 @@ package com.xiang.common;
|
||||
*/
|
||||
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";
|
||||
|
||||
|
||||
/**
|
||||
* ====================
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.xiang.controller;
|
||||
package com.xiang.xservice.xb.controller;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.xiang.common.Result;
|
||||
import com.xiang.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.entity.request.xb.fund.QueryFundInfoReq;
|
||||
import com.xiang.entity.request.xb.fund.QueryFundListReq;
|
||||
import com.xiang.entity.request.xb.fund.QueryXbFundListReq;
|
||||
import com.xiang.entity.response.xbyj.fund.FundInfo;
|
||||
import com.xiang.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.service.FundService;
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.xservice.xb.entity.request.xb.fund.QueryFundInfoReq;
|
||||
import com.xiang.xservice.xb.entity.request.xb.fund.QueryFundListReq;
|
||||
import com.xiang.xservice.xb.entity.request.xb.fund.QueryXbFundListReq;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.FundInfo;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.xservice.xb.service.FundService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.pojo;
|
||||
package com.xiang.xservice.xb.entity.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.pojo.xb;
|
||||
package com.xiang.xservice.xb.entity.pojo.xb;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.pojo.xb;
|
||||
package com.xiang.xservice.xb.entity.pojo.xb;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.pojo.xb;
|
||||
package com.xiang.xservice.xb.entity.pojo.xb;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.pojo.xb;
|
||||
package com.xiang.xservice.xb.entity.pojo.xb;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.request.xb.fund;
|
||||
package com.xiang.xservice.xb.entity.request.xb.fund;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.request.xb.fund;
|
||||
package com.xiang.xservice.xb.entity.request.xb.fund;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.request.xb.fund;
|
||||
package com.xiang.xservice.xb.entity.request.xb.fund;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -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 lombok.Data;
|
||||
@@ -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 lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.response.xbyj.fund;
|
||||
package com.xiang.xservice.xb.entity.response.xbyj.fund;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.entity.response.xbyj.fund;
|
||||
package com.xiang.xservice.xb.entity.response.xbyj.fund;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.xiang.repository;
|
||||
package com.xiang.xservice.xb.repository;
|
||||
|
||||
import com.xiang.entity.pojo.xb.FundInfo;
|
||||
import com.xiang.entity.pojo.xb.XbFundCount;
|
||||
import com.xiang.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.FundInfo;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundCount;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -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.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.xiang.schedule.xb;
|
||||
package com.xiang.xservice.xb.schedule.xb;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.xiang.dingTalk.service.DingTalkService;
|
||||
import com.xiang.entity.pojo.xb.XbFundCount;
|
||||
import com.xiang.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.service.FundService;
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundCount;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.xservice.xb.service.FundService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.xiang.schedule.xb;
|
||||
package com.xiang.xservice.xb.schedule.xb;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.xiang.common.factory.xb.QueryThreadFactory;
|
||||
import com.xiang.dingTalk.service.DingTalkService;
|
||||
import com.xiang.entity.pojo.xb.FundMessage;
|
||||
import com.xiang.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.entity.response.xbyj.fund.FundInfo;
|
||||
import com.xiang.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.repository.XBFundMapper;
|
||||
import com.xiang.service.FundService;
|
||||
import com.xiang.xservice.basic.config.MyThreadFactory;
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.FundMessage;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.FundInfo;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.xservice.xb.repository.XBFundMapper;
|
||||
import com.xiang.xservice.xb.service.FundService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -55,7 +55,7 @@ public class FundInfoQueryJob {
|
||||
1000,
|
||||
TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<>(),
|
||||
new QueryThreadFactory("xb-query-thread", Boolean.TRUE),
|
||||
new MyThreadFactory("xb-query-thread", Boolean.TRUE),
|
||||
new ThreadPoolExecutor.AbortPolicy());
|
||||
@Value("${xiaobei.codeArr}")
|
||||
private String codeArr;
|
||||
@@ -172,14 +172,14 @@ public class FundInfoQueryJob {
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
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)) {
|
||||
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();
|
||||
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");
|
||||
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()));
|
||||
@@ -210,12 +210,12 @@ public class FundInfoQueryJob {
|
||||
return;
|
||||
}
|
||||
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 -> {
|
||||
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
||||
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())
|
||||
.name(fundInfo.getName())
|
||||
.change(fundMessage.getChange().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString())
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.xiang.service;
|
||||
package com.xiang.xservice.xb.service;
|
||||
|
||||
import com.xiang.entity.pojo.xb.XbFundCount;
|
||||
import com.xiang.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.entity.response.xbyj.fund.FundInfo;
|
||||
import com.xiang.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundCount;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.FundInfo;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package com.xiang.service;
|
||||
package com.xiang.xservice.xb.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.xiang.common.URLConstants;
|
||||
import com.xiang.entity.pojo.xb.XbFundCount;
|
||||
import com.xiang.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.entity.response.xbyj.fund.FundInfo;
|
||||
import com.xiang.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.entity.response.xbyj.fund.QueryFundInfoResponse;
|
||||
import com.xiang.entity.response.xbyj.fund.QueryFundListResponse;
|
||||
import com.xiang.repository.XBFundMapper;
|
||||
import com.xiang.utils.HttpUtils;
|
||||
import com.xiang.xservice.basic.utils.HttpUtils;
|
||||
import com.xiang.xservice.xb.common.URLConstants;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundCount;
|
||||
import com.xiang.xservice.xb.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.FundInfo;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.QueryFundInfoResponse;
|
||||
import com.xiang.xservice.xb.entity.response.xbyj.fund.QueryFundListResponse;
|
||||
import com.xiang.xservice.xb.repository.XBFundMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -32,7 +32,6 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class FundServiceImpl implements FundService{
|
||||
|
||||
private final HttpUtils httpUtils;
|
||||
|
||||
private final XBFundMapper xbFundMapper;
|
||||
|
||||
@@ -61,7 +60,7 @@ public class FundServiceImpl implements FundService{
|
||||
|
||||
String resp = "";
|
||||
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);
|
||||
if (StringUtils.isNotBlank(resp)) {
|
||||
QueryFundListResponse response = JSONObject.parseObject(resp, QueryFundListResponse.class);
|
||||
@@ -82,7 +81,7 @@ public class FundServiceImpl implements FundService{
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code", code);
|
||||
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)) {
|
||||
log.info("[小蓓养基] 基金详情查询:请求参数:{}, 请求结果:{}", JSONObject.toJSONString(jsonObject), resp);
|
||||
QueryFundInfoResponse response = JSONObject.parseObject(resp, QueryFundInfoResponse.class);
|
||||
12
script/src/main/resources/application-nas.yml
Normal file
12
script/src/main/resources/application-nas.yml
Normal 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
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"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="user" property="user" />
|
||||
<result column="email" property="email" />
|
||||
@@ -18,7 +18,7 @@
|
||||
status
|
||||
</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>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"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="code" property="code" />
|
||||
<result column="name" property="name" />
|
||||
<result column="change" property="change" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
</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="code" property="code" />
|
||||
<result column="name" property="name" />
|
||||
@@ -50,7 +50,7 @@
|
||||
and type = #{type}
|
||||
</if>
|
||||
</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
|
||||
where update_time between NOW() - INTERVAL 7 DAY and NOW()
|
||||
</select>
|
||||
Reference in New Issue
Block a user