Compare commits
8 Commits
2f087553eb
...
perf/fund_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c506a850c3 | ||
|
|
e22bc012c9 | ||
|
|
b598d67281 | ||
|
|
d4c3cf4870 | ||
|
|
bc4b0c9753 | ||
|
|
26474073e5 | ||
|
|
3d50ec5985 | ||
|
|
1ab0e94cfa |
16
pom.xml
16
pom.xml
@@ -112,24 +112,24 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xiang</groupId>
|
||||
<groupId>com.xiang.starter</groupId>
|
||||
<artifactId>xmc-mysql-starter</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xiang</groupId>
|
||||
<groupId>com.xiang.starter</groupId>
|
||||
<artifactId>xmc-cache-starter</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xiang</groupId>
|
||||
<groupId>com.xiang.starter</groupId>
|
||||
<artifactId>xmc-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xiang</groupId>
|
||||
<groupId>com.xiang.starter</groupId>
|
||||
<artifactId>xmc-message-starter</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xiang.starter</groupId>
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.xiang.xservice.application.generator.config;
|
||||
|
||||
import com.alibaba.fastjson2.JSONReader;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import com.alibaba.fastjson2.support.config.FastJsonConfig;
|
||||
import com.alibaba.fastjson2.support.spring6.http.converter.FastJsonHttpMessageConverter;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 2019-2-11 liutf WebMvcConfig 整合 cors 和 SpringMvc MessageConverter
|
||||
*/
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/statics/**").addResourceLocations("classpath:/statics/");
|
||||
}
|
||||
/**
|
||||
* FASTJSON2升级 by https://zhengkai.blog.csdn.net/
|
||||
* https://blog.csdn.net/moshowgame/article/details/138013669
|
||||
*/
|
||||
@Override
|
||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
|
||||
//自定义配置...
|
||||
FastJsonConfig config = new FastJsonConfig();
|
||||
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 添加更多解析特性以提高容错性
|
||||
config.setReaderFeatures(
|
||||
JSONReader.Feature.FieldBased,
|
||||
JSONReader.Feature.SupportArrayToBean,
|
||||
JSONReader.Feature.InitStringFieldAsEmpty
|
||||
);
|
||||
|
||||
config.setWriterFeatures(
|
||||
JSONWriter.Feature.WriteMapNullValue,
|
||||
JSONWriter.Feature.PrettyFormat
|
||||
);
|
||||
|
||||
converter.setFastJsonConfig(config);
|
||||
converter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||
converter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||
converters.add(0, converter);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.xiang.xservice.application.generator.controller;
|
||||
|
||||
import com.xiang.xservice.application.generator.entity.dto.ParamInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ParamInfo;
|
||||
import com.xiang.xservice.application.generator.service.CodeGenService;
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.xiang.xservice.application.generator.controller;
|
||||
|
||||
import com.xiang.xservice.application.generator.entity.dto.TemplateList;
|
||||
import com.xiang.xservice.application.generator.entity.domain.TemplateList;
|
||||
import com.xiang.xservice.application.generator.service.TemplateService;
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -7,8 +7,6 @@ import lombok.AllArgsConstructor;
|
||||
* <p>
|
||||
* 忽略大小写
|
||||
**考虑增加这个类是, 如果在 StringUtils 中加工具方法, 使用起来代码非常冗长且不方便
|
||||
* @author Nisus
|
||||
* @see String
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class NonCaseString implements CharSequence {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.xservice.application.generator.entity.dto;
|
||||
package com.xiang.xservice.application.generator.entity.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
/**
|
||||
* 类信息
|
||||
*
|
||||
* @author zhengkai.blog.csdn.net
|
||||
* @author xiang
|
||||
*/
|
||||
@Data
|
||||
public class ClassInfo {
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.xiang.xservice.application.generator.entity.dto;
|
||||
package com.xiang.xservice.application.generator.entity.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字段信息
|
||||
*
|
||||
* @author zhengkai.blog.csdn.net
|
||||
* @author xiang
|
||||
*/
|
||||
@Data
|
||||
public class FieldInfo {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.xservice.application.generator.entity.dto;
|
||||
package com.xiang.xservice.application.generator.entity.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.Map;
|
||||
/**
|
||||
* 请求参数信息
|
||||
*
|
||||
* @author zhengkai.blog.csdn.net
|
||||
* @author xiang
|
||||
*/
|
||||
@Data
|
||||
public class ParamInfo {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.xservice.application.generator.entity.dto;
|
||||
package com.xiang.xservice.application.generator.entity.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.xservice.application.generator.entity.dto;
|
||||
package com.xiang.xservice.application.generator.entity.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.xiang.xservice.application.generator.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 统一返回结果VO
|
||||
*
|
||||
* @author zhengkai.blog.csdn.net
|
||||
*/
|
||||
@Data
|
||||
public class ResultVo extends HashMap<String, Object> {
|
||||
|
||||
public ResultVo() {
|
||||
put("code", 200);
|
||||
put("msg", "success");
|
||||
}
|
||||
|
||||
public static ResultVo ok() {
|
||||
return new ResultVo();
|
||||
}
|
||||
|
||||
public static ResultVo ok(Object data) {
|
||||
ResultVo resultVo = new ResultVo();
|
||||
resultVo.put("data", data);
|
||||
return resultVo;
|
||||
}
|
||||
|
||||
public static ResultVo error(String msg) {
|
||||
ResultVo resultVo = new ResultVo();
|
||||
resultVo.put("code", 500);
|
||||
resultVo.put("msg", msg);
|
||||
return resultVo;
|
||||
}
|
||||
|
||||
public static ResultVo error(int code, String msg) {
|
||||
ResultVo resultVo = new ResultVo();
|
||||
resultVo.put("code", code);
|
||||
resultVo.put("msg", msg);
|
||||
return resultVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVo put(String key, Object value) {
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xiang.xservice.application.generator.entity.enums;
|
||||
package com.xiang.xservice.application.generator.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.xiang.xservice.application.generator.service;
|
||||
|
||||
|
||||
import com.xiang.xservice.application.generator.entity.dto.ParamInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ParamInfo;
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.xiang.xservice.application.generator.service;
|
||||
|
||||
import com.xiang.xservice.application.generator.entity.dto.TemplateList;
|
||||
import com.xiang.xservice.application.generator.entity.domain.TemplateList;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.xiang.xservice.application.generator.service.impl;
|
||||
|
||||
import com.xiang.xservice.application.generator.entity.dto.ClassInfo;
|
||||
import com.xiang.xservice.application.generator.entity.dto.ParamInfo;
|
||||
import com.xiang.xservice.application.generator.entity.dto.TemplateList;
|
||||
import com.xiang.xservice.application.generator.entity.enums.ParserTypeEnum;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ClassInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ParamInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.TemplateList;
|
||||
import com.xiang.xservice.application.generator.enums.ParserTypeEnum;
|
||||
import com.xiang.xservice.application.generator.service.CodeGenService;
|
||||
import com.xiang.xservice.application.generator.service.TemplateService;
|
||||
import com.xiang.xservice.application.generator.service.parser.JsonParserService;
|
||||
@@ -50,7 +50,6 @@ public class CodeGenServiceImpl implements CodeGenService {
|
||||
// 3. generate the code by freemarker templates with parameters .
|
||||
// Freemarker根据参数和模板生成代码
|
||||
Map<String, String> result = getResultByParams(paramInfo.getOptions());
|
||||
log.info("table:{} - time:{} ", MapUtil.getString(result, "tableName"), System.currentTimeMillis());
|
||||
return Result.success(result);
|
||||
} catch (Exception e) {
|
||||
log.error("代码生成失败", e);
|
||||
@@ -67,10 +66,10 @@ public class CodeGenServiceImpl implements CodeGenService {
|
||||
// 解析模板配置并生成代码
|
||||
List<TemplateList> parentTemplates = templateService.getAllTemplates();
|
||||
for (TemplateList parentTemplateObj : parentTemplates) {
|
||||
List<com.xiang.xservice.application.generator.entity.dto.Template> childTemplates = parentTemplateObj.getTemplates();
|
||||
List<com.xiang.xservice.application.generator.entity.domain.Template> childTemplates = parentTemplateObj.getTemplates();
|
||||
if (childTemplates != null) {
|
||||
for (int x = 0; x < childTemplates.size(); x++) {
|
||||
com.xiang.xservice.application.generator.entity.dto.Template childTemplate = childTemplates.get(x);
|
||||
com.xiang.xservice.application.generator.entity.domain.Template childTemplate = childTemplates.get(x);
|
||||
String templatePath = parentTemplateObj.getGroup() + "/" + childTemplate.getName() + ".ftl";
|
||||
String generatedCode = FreemarkerUtil.processString(templatePath, params);
|
||||
result.put(childTemplate.getName(), generatedCode);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.xiang.xservice.application.generator.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.xiang.xservice.application.generator.entity.dto.TemplateList;
|
||||
import com.xiang.xservice.application.generator.entity.domain.TemplateList;
|
||||
import com.xiang.xservice.application.generator.service.TemplateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.xiang.xservice.application.generator.service.impl.parser;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xiang.xservice.application.generator.entity.dto.ClassInfo;
|
||||
import com.xiang.xservice.application.generator.entity.dto.FieldInfo;
|
||||
import com.xiang.xservice.application.generator.entity.dto.ParamInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ClassInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.FieldInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ParamInfo;
|
||||
import com.xiang.xservice.application.generator.service.parser.JsonParserService;
|
||||
import com.xiang.xservice.basic.exception.BusinessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.xiang.xservice.application.generator.service.impl.parser;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.xiang.xservice.application.generator.entity.dto.ClassInfo;
|
||||
import com.xiang.xservice.application.generator.entity.dto.FieldInfo;
|
||||
import com.xiang.xservice.application.generator.entity.dto.ParamInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ClassInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.FieldInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ParamInfo;
|
||||
import com.xiang.xservice.application.generator.service.parser.SqlParserService;
|
||||
import com.xiang.xservice.application.generator.util.MapUtil;
|
||||
import com.xiang.xservice.application.generator.util.StringUtilsPlus;
|
||||
import com.xiang.xservice.application.generator.util.mysqlJavaTypeUtil;
|
||||
import com.xiang.xservice.application.generator.util.Mysql2JavaTypeUtil;
|
||||
import com.xiang.xservice.basic.exception.BusinessException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.jsqlparser.parser.CCJSqlParserManager;
|
||||
@@ -219,7 +219,7 @@ public class SqlParserServiceImpl implements SqlParserService {
|
||||
}
|
||||
String originTableName = tableName;
|
||||
//ignore prefix
|
||||
if(tableName!=null && StringUtilsPlus.isNotNull(MapUtil.getString(paramInfo.getOptions(),"ignorePrefix"))){
|
||||
if(tableName!=null && StringUtils.isNotBlank(MapUtil.getString(paramInfo.getOptions(),"ignorePrefix"))){
|
||||
tableName = tableName.replaceAll(MapUtil.getString(paramInfo.getOptions(),"ignorePrefix"),"");
|
||||
}
|
||||
// class Name
|
||||
@@ -361,8 +361,8 @@ public class SqlParserServiceImpl implements SqlParserService {
|
||||
}
|
||||
//swagger class
|
||||
String swaggerClass = "string" ;
|
||||
if(mysqlJavaTypeUtil.getMysqlSwaggerTypeMap().containsKey(mysqlType)){
|
||||
swaggerClass = mysqlJavaTypeUtil.getMysqlSwaggerTypeMap().get(mysqlType);
|
||||
if(Mysql2JavaTypeUtil.getMysqlSwaggerTypeMap().containsKey(mysqlType)){
|
||||
swaggerClass = Mysql2JavaTypeUtil.getMysqlSwaggerTypeMap().get(mysqlType);
|
||||
}
|
||||
// field class
|
||||
// int(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||
@@ -371,8 +371,8 @@ public class SqlParserServiceImpl implements SqlParserService {
|
||||
//2018-11-22 lshz0088 处理字段类型的时候,不严谨columnLine.contains(" int") 类似这种的,可在前后适当加一些空格之类的加以区分,否则当我的字段包含这些字符的时候,产生类型判断问题。
|
||||
//2020-05-03 MOSHOW.K.ZHENG 优化对所有类型的处理
|
||||
//2020-10-20 zhengkai 新增包装类型的转换选择
|
||||
if(mysqlJavaTypeUtil.getMysqlJavaTypeMap().containsKey(mysqlType)){
|
||||
fieldClass = mysqlJavaTypeUtil.getMysqlJavaTypeMap().get(mysqlType);
|
||||
if(Mysql2JavaTypeUtil.getMysqlJavaTypeMap().containsKey(mysqlType)){
|
||||
fieldClass = Mysql2JavaTypeUtil.getMysqlJavaTypeMap().get(mysqlType);
|
||||
}
|
||||
// field comment,MySQL的一般位于field行,而pgsql和oralce多位于后面。
|
||||
String fieldComment = null;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.xiang.xservice.application.generator.service.parser;
|
||||
|
||||
|
||||
import com.xiang.xservice.application.generator.entity.dto.ClassInfo;
|
||||
import com.xiang.xservice.application.generator.entity.dto.ParamInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ClassInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ParamInfo;
|
||||
|
||||
/**
|
||||
* JSON解析服务接口
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.xiang.xservice.application.generator.service.parser;
|
||||
|
||||
|
||||
import com.xiang.xservice.application.generator.entity.dto.ClassInfo;
|
||||
import com.xiang.xservice.application.generator.entity.dto.ParamInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ClassInfo;
|
||||
import com.xiang.xservice.application.generator.entity.domain.ParamInfo;
|
||||
|
||||
/**
|
||||
* SQL解析服务接口
|
||||
|
||||
@@ -1,45 +1,19 @@
|
||||
|
||||
package com.xiang.xservice.application.generator.util;
|
||||
|
||||
import joptsimple.internal.Strings;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class MapUtil {
|
||||
public static String getString(Map map, String key) {
|
||||
public static String getString(Map<String, Object> map, String key) {
|
||||
if (map != null && map.containsKey(key)) {
|
||||
try {
|
||||
return map.get(key).toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
return Strings.EMPTY;
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer getInteger(Map map, String key) {
|
||||
if (map != null && map.containsKey(key)) {
|
||||
try {
|
||||
return Integer.valueOf(map.get(key).toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean getBoolean(Map map, String key) {
|
||||
if (map != null && map.containsKey(key)) {
|
||||
try {
|
||||
return Boolean.parseBoolean(map.get(key).toString()) || "true".equals(map.get(key).toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return Strings.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.xiang.xservice.application.generator.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public final class mysqlJavaTypeUtil {
|
||||
public final class Mysql2JavaTypeUtil {
|
||||
public static final HashMap<String, String> mysqlJavaTypeMap = new HashMap<String, String>();
|
||||
public static final HashMap<String, String> mysqlSwaggerTypeMap = new HashMap<String, String>();
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.xiang.xservice.application.generator.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class StringUtilsPlus {
|
||||
|
||||
/**
|
||||
* 首字母大写
|
||||
*
|
||||
* @param str
|
||||
* @param str 字符串
|
||||
*
|
||||
* @return
|
||||
* @return 首字母大写
|
||||
*/
|
||||
public static String upperCaseFirst(String str) {
|
||||
if (str == null || str.trim().isEmpty()) {
|
||||
@@ -19,25 +21,24 @@ public class StringUtilsPlus {
|
||||
/**
|
||||
* 首字母小写
|
||||
*
|
||||
* @param str
|
||||
* @param str 字符串
|
||||
*
|
||||
* @return
|
||||
* @return 首字母小写
|
||||
*/
|
||||
public static String lowerCaseFirst(String str) {
|
||||
//2019-2-10 解决StringUtils.lowerCaseFirst潜在的NPE异常@liutf
|
||||
return (str != null && str.length() > 1) ? str.substring(0, 1).toLowerCase() + str.substring(1) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 下划线,转换为驼峰式
|
||||
*
|
||||
* @param underscoreName
|
||||
* @param underscoreName 下划线字符串
|
||||
*
|
||||
* @return
|
||||
* @return 驼峰式
|
||||
*/
|
||||
public static String underlineToCamelCase(String underscoreName) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
if (underscoreName != null && underscoreName.trim().length() > 0) {
|
||||
if (StringUtils.isNotBlank(underscoreName)) {
|
||||
boolean flag = false;
|
||||
for (int i = 0; i < underscoreName.length(); i++) {
|
||||
char ch = underscoreName.charAt(i);
|
||||
@@ -58,8 +59,6 @@ public class StringUtilsPlus {
|
||||
|
||||
/**
|
||||
* 转 user_name 风格
|
||||
* <p>
|
||||
* 不管原始是什么风格
|
||||
*/
|
||||
public static String toUnderline(String str, boolean upperCase) {
|
||||
if (str == null || str.trim().isEmpty()) {
|
||||
@@ -91,7 +90,8 @@ public class StringUtilsPlus {
|
||||
}
|
||||
|
||||
/**
|
||||
* any str ==> lowerCamel
|
||||
* 任何字符串 转驼峰
|
||||
* @param str 任何字符串
|
||||
*/
|
||||
public static String toLowerCamel(String str) {
|
||||
if (str == null || str.trim().isEmpty()) {
|
||||
@@ -122,9 +122,4 @@ public class StringUtilsPlus {
|
||||
|
||||
return lowerCaseFirst(result.toString());
|
||||
}
|
||||
|
||||
public static boolean isNotNull(String str) {
|
||||
return org.apache.commons.lang3.StringUtils.isNotEmpty(str);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.xiang.xservice.application.script.domain.service;
|
||||
|
||||
import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.config.DingTalkRobotScriptConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-08-07 10:30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DingTalkScriptDomainService {
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
private final DingTalkRobotScriptConfig dingTalkRobotScriptConfig;
|
||||
|
||||
/**
|
||||
* 发送脚本消息
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void sendScriptMsg(String msg) {
|
||||
try {
|
||||
dingTalkService.sendRobotMessage(dingTalkRobotScriptConfig.getSecret(), dingTalkRobotScriptConfig.getToken(),
|
||||
dingTalkRobotScriptConfig.getUsers(), msg);
|
||||
} catch (Exception e) {
|
||||
log.error("信息发送异常, 信息:{}", msg, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.aliyun.alidns20150109.models.DescribeSubDomainRecordsResponseBody;
|
||||
import com.aliyun.alidns20150109.models.UpdateDomainRecordRequest;
|
||||
import com.aliyun.teaopenapi.models.Config;
|
||||
import com.xiang.xservice.application.script.domain.config.AliyunDnsPropertyConfig;
|
||||
import com.xiang.xservice.common.service.dingTalk.ScriptDingTalkFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -36,7 +37,7 @@ public class IDomainServiceImpl implements IDomainService {
|
||||
private final AliyunDnsPropertyConfig aliyunDnsPropertyConfig;
|
||||
private static final String TYPE = "A";
|
||||
|
||||
private final DingTalkScriptDomainService dingTalkService;
|
||||
private final ScriptDingTalkFactory dingTalkService;
|
||||
@Override
|
||||
public void dynamicDomainAnalysis(String publicIp) throws Exception {
|
||||
Client client = createClient();
|
||||
@@ -53,14 +54,14 @@ public class IDomainServiceImpl implements IDomainService {
|
||||
if (records.isEmpty()) {
|
||||
log.info("未找到记录,添加记录..., ip:{}", publicIp);
|
||||
addDnsRecord(client, publicIp, rr);
|
||||
dingTalkService.sendScriptMsg("动态解析公网ip成功,域名:" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
|
||||
dingTalkService.sendMsg("动态解析公网ip成功,域名:" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
|
||||
} else {
|
||||
String recordId = records.get(0).getRecordId();
|
||||
String currentValue = records.get(0).getValue();
|
||||
if (!publicIp.equals(currentValue)) {
|
||||
log.info("IP变更,更新记录...,ip:{}", publicIp);
|
||||
updateDnsRecord(client, recordId, publicIp, rr);
|
||||
dingTalkService.sendScriptMsg("动态解析公网ip成功,域名:" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
|
||||
dingTalkService.sendMsg("动态解析公网ip成功,域名:" + rr + "." + DOMAIN_NAME + ", 新ip:" + publicIp);
|
||||
} else {
|
||||
log.info("ip未变更,无需修改,ip:{}", publicIp);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.xiang.xservice.application.script.fwd.mapper.FwdAudienceConfigMapper;
|
||||
import com.xiang.xservice.application.script.fwd.mapper.FwdPerformConfigMapper;
|
||||
import com.xiang.xservice.application.script.fwd.mapper.FwdPerformProjectInfoMapper;
|
||||
import com.xiang.xservice.application.script.fwd.mapper.FwdUserConfigMapper;
|
||||
import com.xiang.xservice.application.script.fwd.service.DingTalkScriptFWDService;
|
||||
import com.xiang.xservice.application.script.fwd.service.IPerformService;
|
||||
import com.xiang.xservice.application.script.fwd.service.IPerformServiceHttp;
|
||||
import com.xiang.xservice.application.script.fwd.utils.TimeSyncUtils;
|
||||
@@ -31,6 +30,7 @@ import com.xiang.xservice.basic.utils.DateUtils;
|
||||
import com.xiang.xservice.basic.utils.PrimaryKeyUtils;
|
||||
import com.xiang.xservice.common.entity.SysConfigDO;
|
||||
import com.xiang.xservice.common.mapper.SysConfigMapper;
|
||||
import com.xiang.xservice.common.service.dingTalk.ScriptDingTalkFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -66,7 +66,7 @@ public class FwdImportantMsgJob {
|
||||
private final FwdPerformProjectInfoMapper performProjectInfoMapper;
|
||||
private final FwdPerformConfigMapper performConfigMapper;
|
||||
private final DynamicTaskScheduler dynamicTaskScheduler;
|
||||
private final DingTalkScriptFWDService dingTalkScriptFWDService;
|
||||
private final ScriptDingTalkFactory dingTalkScriptFWDService;
|
||||
private final FwdUserConfigMapper fwdUserConfigMapper;
|
||||
private final FwdAudienceConfigMapper fwdAudienceConfigMapper;
|
||||
private final IPerformService iPerformService;
|
||||
@@ -149,7 +149,7 @@ public class FwdImportantMsgJob {
|
||||
}
|
||||
}
|
||||
msg.append("请注意进行数据库配置的更改!");
|
||||
dingTalkScriptFWDService.sendScriptMsg(msg.toString());
|
||||
dingTalkScriptFWDService.sendMsg(msg.toString());
|
||||
log.info("【芬玩岛】演唱会预售定时任务结束!time:{}", System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ public class FwdImportantMsgJob {
|
||||
}
|
||||
}
|
||||
});
|
||||
dingTalkScriptFWDService.sendScriptMsg(msg.toString());
|
||||
dingTalkScriptFWDService.sendMsg(msg.toString());
|
||||
}
|
||||
|
||||
private void savaTask(FPerformProjectInfo data, long taskId, Map<String, Object> params) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.xiang.xservice.application.script.fwd.server;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import com.xiang.xservice.application.script.fwd.service.DingTalkScriptFWDService;
|
||||
import com.xiang.xservice.application.script.fwd.service.IPerformService;
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import com.xiang.xservice.common.service.dingTalk.ScriptDingTalkFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -24,7 +24,7 @@ import java.util.Map;
|
||||
public class FwdUserController {
|
||||
|
||||
private final IPerformService performService;
|
||||
private final DingTalkScriptFWDService dingTalkService;
|
||||
private final ScriptDingTalkFactory dingTalkService;
|
||||
|
||||
@GetMapping("/token")
|
||||
public Result<Void> updateUserTokenFromHttpProxy(@RequestParam Map<String, String> params) {
|
||||
@@ -35,7 +35,7 @@ public class FwdUserController {
|
||||
if (b) {
|
||||
String msg = "用户:" + name + "的token更新成功!";
|
||||
try {
|
||||
dingTalkService.sendScriptMsg(msg);
|
||||
dingTalkService.sendMsg(msg);
|
||||
} catch (Exception e) {
|
||||
log.error("消息发送失败", e);
|
||||
return Result.error("消息发送失败");
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.xiang.xservice.application.script.fwd.service;
|
||||
|
||||
import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.config.DingTalkRobotScriptConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-08-07 10:30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DingTalkScriptFWDService {
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
private final DingTalkRobotScriptConfig dingTalkRobotConfig;
|
||||
|
||||
/**
|
||||
* 发送脚本消息
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void sendScriptMsg(String msg) {
|
||||
try {
|
||||
dingTalkService.sendRobotMessage(dingTalkRobotConfig.getSecret(), dingTalkRobotConfig.getToken(), dingTalkRobotConfig.getUsers(), msg);
|
||||
} catch (Exception e) {
|
||||
log.error("信息发送异常, 信息:{}", msg, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,10 @@ import com.xiang.xservice.application.script.fwd.mapper.FwdPerformConfigMapper;
|
||||
import com.xiang.xservice.application.script.fwd.mapper.FwdPerformProjectInfoMapper;
|
||||
import com.xiang.xservice.application.script.fwd.mapper.FwdPerformSeatInfoMapper;
|
||||
import com.xiang.xservice.application.script.fwd.mapper.FwdUserConfigMapper;
|
||||
import com.xiang.xservice.application.script.fwd.service.DingTalkScriptFWDService;
|
||||
import com.xiang.xservice.application.script.fwd.service.IPerformService;
|
||||
import com.xiang.xservice.application.script.fwd.service.IPerformServiceHttp;
|
||||
import com.xiang.xservice.basic.config.MyThreadFactory;
|
||||
import com.xiang.xservice.common.service.dingTalk.ScriptDingTalkFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -51,7 +51,7 @@ public class PerformServiceImpl implements IPerformService {
|
||||
private final FwdPerformProjectInfoMapper fwdPerformProjectInfoMapper;
|
||||
private final FwdPerformConfigMapper fwdPerformConfigMapper;
|
||||
private final IPerformServiceHttp performServiceHttp;
|
||||
private final DingTalkScriptFWDService dingTalkService;
|
||||
private final ScriptDingTalkFactory dingTalkService;
|
||||
private final FwdUserConfigMapper fwdUserConfigMapper;
|
||||
private final HttpRequestHelper httpRequestHelper;
|
||||
private final ExecutorService es =
|
||||
@@ -121,12 +121,12 @@ public class PerformServiceImpl implements IPerformService {
|
||||
if (Objects.nonNull(projectOrder)) {
|
||||
log.info("下单成功,订单信息:{}", JSONObject.toJSONString(projectOrder));
|
||||
String msg = "【芬玩岛】下单成功✅✅✅,演出名称:" + performByProjectId.getProjectName() + ",请在5分钟内完成付款!订单号:" + projectOrder.getOrderNo();
|
||||
dingTalkService.sendScriptMsg(msg);
|
||||
dingTalkService.sendMsg(msg);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
dingTalkService.sendScriptMsg("【芬玩岛】下单失败❌❌❌,演出名称:" + performByProjectId.getProjectName());
|
||||
dingTalkService.sendMsg("【芬玩岛】下单失败❌❌❌,演出名称:" + performByProjectId.getProjectName());
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.xiang.xservice.application.script.glados.service;
|
||||
|
||||
import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.config.DingTalkRobotScriptConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-08-07 10:30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DingTalkScriptGladosService {
|
||||
|
||||
private final DingTalkService dingTalkService;
|
||||
private final DingTalkRobotScriptConfig dingTalkRobotScriptConfig;
|
||||
|
||||
/**
|
||||
* 发送脚本消息
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void sendScriptMsg(String msg) {
|
||||
try {
|
||||
dingTalkService.sendRobotMessage(dingTalkRobotScriptConfig.getSecret(), dingTalkRobotScriptConfig.getToken(),
|
||||
dingTalkRobotScriptConfig.getUsers(), msg);
|
||||
} catch (Exception e) {
|
||||
log.error("信息发送异常, 信息:{}", msg, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import com.xiang.xservice.application.script.glados.entity.resp.GLaDOSResponse;
|
||||
import com.xiang.xservice.application.script.glados.repository.GladosMapper;
|
||||
import com.xiang.xservice.application.script.xb.entity.pojo.User;
|
||||
import com.xiang.xservice.basic.utils.HttpUtils;
|
||||
import com.xiang.xservice.common.service.dingTalk.ScriptDingTalkFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -35,7 +36,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
|
||||
private final GladosMapper gladosMapper;
|
||||
|
||||
private final DingTalkScriptGladosService dingTalkService;
|
||||
private final ScriptDingTalkFactory dingTalkService;
|
||||
|
||||
private final BaseHttpHelp httpHelp = HttpHelperFactory.createSimpleHttp();
|
||||
|
||||
@@ -119,7 +120,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
// 成功请求
|
||||
if (Objects.nonNull(gLaDOSResponse.getPoints()) && 0 != gLaDOSResponse.getPoints()) {
|
||||
// 签到成功
|
||||
dingTalkService.sendScriptMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
|
||||
dingTalkService.sendMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
|
||||
user.getEmail() + "签到成功,获得积分:" + gLaDOSResponse.getPoints());
|
||||
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(1).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();
|
||||
gladosMapper.insertScriptRunLog(build);
|
||||
@@ -129,7 +130,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
|
||||
if (gLaDOSResponse.getMessage().contains("Repeats")) {
|
||||
if (!CollectionUtils.isEmpty(gLaDOSResponse.getList())) {
|
||||
dingTalkService.sendScriptMsg("用户:" + user.getEmail() + "当前已签到。结果:" + gLaDOSResponse.getList().get(0));
|
||||
dingTalkService.sendMsg("用户:" + user.getEmail() + "当前已签到。结果:" + gLaDOSResponse.getList().get(0));
|
||||
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(1).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();
|
||||
gladosMapper.insertScriptRunLog(build);
|
||||
return true;
|
||||
@@ -140,7 +141,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
log.warn("签到失败,用户:{}, cookie过期:{}", user.getEmail(), gLaDOSResponse.getMessage());
|
||||
String message = "[时间:" + LocalDateTime.now() + "] 用户: " + user.getEmail() + ",签到消息: " + gLaDOSResponse.getMessage() + "手动请求:http://general.xiangtech.xyz:30026/system/glados/checkIn";
|
||||
try {
|
||||
dingTalkService.sendScriptMsg(message);
|
||||
dingTalkService.sendMsg(message);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("发送钉钉消息失败", e);
|
||||
@@ -148,7 +149,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
}
|
||||
|
||||
// 请求异常
|
||||
dingTalkService.sendScriptMsg("用户:" + user.getEmail() + "请求异常,响应结果:" + gLaDOSResponse.getMessage());
|
||||
dingTalkService.sendMsg("用户:" + user.getEmail() + "请求异常,响应结果:" + gLaDOSResponse.getMessage());
|
||||
GladosRunLog build = GladosRunLog.builder().time(LocalDateTime.now()).status(0).code(Integer.valueOf(gLaDOSResponse.getCode().toString())).response(response).user(user.getEmail()).userId(user.getId()).build();
|
||||
gladosMapper.insertScriptRunLog(build);
|
||||
return false;
|
||||
@@ -179,7 +180,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
log.info("签到成功, 签到积分:{}, 签到消息:{}", gLaDOSResponse.getPoints(), gLaDOSResponse.getMessage());
|
||||
sb.append(user.getEmail()).append("签到成功,获得积分:").append(gLaDOSResponse.getPoints()).append("\n");
|
||||
try {
|
||||
dingTalkService.sendScriptMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
|
||||
dingTalkService.sendMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
|
||||
user.getEmail() + "签到成功,获得积分:" + gLaDOSResponse.getPoints());
|
||||
} catch (Exception e) {
|
||||
log.error("发送钉钉消息失败", e);
|
||||
@@ -201,7 +202,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
log.warn("签到失败,重复签到,用户:{}, 签到消息:{}", user.getEmail(), gLaDOSResponse.getMessage());
|
||||
sb.append(user).append("签到失败,重复签到,用户:").append(user).append(",签到消息:").append(gLaDOSResponse.getMessage());
|
||||
try {
|
||||
dingTalkService.sendScriptMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
|
||||
dingTalkService.sendMsg("[时间:" + LocalDateTime.now() + "] 用户: " +
|
||||
user.getEmail() + "当天已经签到成功!获得积分" + gLaDOSResponse.getList().get(0));
|
||||
} catch (Exception e) {
|
||||
log.error("发送钉钉消息失败", e);
|
||||
@@ -216,7 +217,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
log.warn("签到失败,用户:{}, cookie过期:{}", user.getEmail(), gLaDOSResponse.getMessage());
|
||||
String message = "[时间:" + LocalDateTime.now() + "] 用户: " + user.getEmail() + ",签到消息: " + gLaDOSResponse.getMessage();
|
||||
try {
|
||||
dingTalkService.sendScriptMsg(message);
|
||||
dingTalkService.sendMsg(message);
|
||||
} catch (Exception e) {
|
||||
log.error("发送钉钉消息失败", e);
|
||||
}
|
||||
@@ -233,7 +234,7 @@ public class GLaDOSServiceImpl implements GLaDOSService{
|
||||
} else {
|
||||
try {
|
||||
String mes = "[时间:" + LocalDateTime.now() + "] 用户: " + user.getEmail() + ",签到异常,请求结果为空。";
|
||||
dingTalkService.sendScriptMsg(mes);
|
||||
dingTalkService.sendMsg(mes);
|
||||
} catch (Exception e) {
|
||||
log.error("发送钉钉消息失败", e);
|
||||
}
|
||||
|
||||
@@ -1,105 +1,105 @@
|
||||
package com.xiang.xservice.application.script.xb.schedule.xb;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.xiang.xservice.basic.utils.DateUtils;
|
||||
import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundCount;
|
||||
import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.xservice.application.script.xb.service.DingTalkRobotService;
|
||||
import com.xiang.xservice.application.script.xb.service.FundService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-05-21 13:59
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class FundCountJob {
|
||||
|
||||
private final FundService fundService;
|
||||
private final DingTalkRobotService dingTalkService;
|
||||
@Scheduled(cron = "0 0 22 * * ?")
|
||||
public void countFundJob() {
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
return;
|
||||
}
|
||||
log.info("==========================[基金统计] 基金统计定时任务启动!==========================");
|
||||
List<XbFundList> lists = fundService.queryFundList();
|
||||
if (CollectionUtils.isEmpty(lists)) {
|
||||
return;
|
||||
}
|
||||
List<XbFundCount> counts = Lists.newCopyOnWriteArrayList();
|
||||
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
lists.parallelStream().forEach(xbFundList -> {
|
||||
List<FundList> fund = fundService.queryTodayList(date, "2", Boolean.TRUE, Collections.singletonList(xbFundList.getCode()));
|
||||
if (CollectionUtils.isNotEmpty(fund)) {
|
||||
XbFundCount xbFundCount = new XbFundCount();
|
||||
xbFundCount.setLId(xbFundList.getId());
|
||||
xbFundCount.setCode(xbFundList.getCode());
|
||||
xbFundCount.setName(xbFundList.getName());
|
||||
xbFundCount.setChange(fund.get(0).getChange().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP));
|
||||
xbFundCount.setUpdateTime(LocalDateTime.now());
|
||||
counts.add(xbFundCount);
|
||||
}
|
||||
});
|
||||
if (CollectionUtils.isNotEmpty(counts)) {
|
||||
log.info("[基金统计] 基金统计记录,需要插入的数据:{}", JSONObject.toJSONString(counts));
|
||||
fundService.addCounts(counts);
|
||||
}
|
||||
log.info("==========================[基金统计] 基金统计定时任务结束!==========================");
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 40 14 * * ? ")
|
||||
public void countFundInWeek() throws Exception {
|
||||
if (DateUtils.validWeekTime()) return;
|
||||
log.info("==========================[基金统计] 基金本周涨跌幅消息发送定时任务启动!==========================");
|
||||
List<XbFundCount> xbFundCounts = fundService.queryFundCountInWeek();
|
||||
if (CollectionUtils.isEmpty(xbFundCounts)) {
|
||||
return;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Map<String, List<XbFundCount>> map = xbFundCounts.stream().collect(Collectors.groupingBy(XbFundCount::getCode));
|
||||
map.forEach((k, v) -> {
|
||||
List<XbFundCount> fundCounts = map.get(k);
|
||||
if (CollectionUtils.isEmpty(fundCounts)) {
|
||||
return;
|
||||
}
|
||||
List<BigDecimal> decimals = fundCounts.stream().map(XbFundCount::getChange).collect(Collectors.toList());
|
||||
BigDecimal sum = BigDecimal.ZERO;
|
||||
for (BigDecimal decimal : decimals) {
|
||||
sum = sum.add(decimal);
|
||||
}
|
||||
BigDecimal avg = sum.divide(BigDecimal.valueOf(decimals.size()), 2, RoundingMode.HALF_UP);
|
||||
sb.append("【").append(fundCounts.get(0).getName()).append("】本周平均涨跌幅为:").append(avg).append("\n");
|
||||
});
|
||||
if (StringUtils.isNotBlank(sb)) {
|
||||
dingTalkService.sendXbMsg(sb.toString());
|
||||
}
|
||||
log.info("==========================[基金统计] 基金本周涨跌幅消息发送定时任务结束!==========================");
|
||||
}
|
||||
|
||||
}
|
||||
//package com.xiang.xservice.application.script.xb.schedule.xb;
|
||||
//
|
||||
//import com.alibaba.fastjson2.JSONObject;
|
||||
//import com.google.common.collect.Lists;
|
||||
//import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundCount;
|
||||
//import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList;
|
||||
//import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList;
|
||||
//import com.xiang.xservice.application.script.xb.service.FundService;
|
||||
//import com.xiang.xservice.basic.utils.DateUtils;
|
||||
//import com.xiang.xservice.common.service.dingTalk.StockDingTalkFactory;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.apache.commons.collections4.CollectionUtils;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.springframework.scheduling.annotation.Scheduled;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import java.math.BigDecimal;
|
||||
//import java.math.RoundingMode;
|
||||
//import java.time.DayOfWeek;
|
||||
//import java.time.LocalDate;
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.time.format.DateTimeFormatter;
|
||||
//import java.util.Collections;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.Objects;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * @Author: xiang
|
||||
// * @Date: 2025-05-21 13:59
|
||||
// */
|
||||
//@Component
|
||||
//@RequiredArgsConstructor
|
||||
//@Slf4j
|
||||
//@RestController
|
||||
//public class FundCountJob {
|
||||
//
|
||||
// private final FundService fundService;
|
||||
// private final StockDingTalkFactory dingTalkService;
|
||||
// @Scheduled(cron = "0 0 22 * * ?")
|
||||
// public void countFundJob() {
|
||||
// // 周六周日过滤
|
||||
// if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
// Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
// return;
|
||||
// }
|
||||
// log.info("==========================[基金统计] 基金统计定时任务启动!==========================");
|
||||
// List<XbFundList> lists = fundService.queryFundList();
|
||||
// if (CollectionUtils.isEmpty(lists)) {
|
||||
// return;
|
||||
// }
|
||||
// List<XbFundCount> counts = Lists.newCopyOnWriteArrayList();
|
||||
// String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
// lists.parallelStream().forEach(xbFundList -> {
|
||||
// List<FundList> fund = fundService.queryTodayList(date, "2", Boolean.TRUE, Collections.singletonList(xbFundList.getCode()));
|
||||
// if (CollectionUtils.isNotEmpty(fund)) {
|
||||
// XbFundCount xbFundCount = new XbFundCount();
|
||||
// xbFundCount.setLId(xbFundList.getId());
|
||||
// xbFundCount.setCode(xbFundList.getCode());
|
||||
// xbFundCount.setName(xbFundList.getName());
|
||||
// xbFundCount.setChange(fund.get(0).getChange().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP));
|
||||
// xbFundCount.setUpdateTime(LocalDateTime.now());
|
||||
// counts.add(xbFundCount);
|
||||
// }
|
||||
// });
|
||||
// if (CollectionUtils.isNotEmpty(counts)) {
|
||||
// log.info("[基金统计] 基金统计记录,需要插入的数据:{}", JSONObject.toJSONString(counts));
|
||||
// fundService.addCounts(counts);
|
||||
// }
|
||||
// log.info("==========================[基金统计] 基金统计定时任务结束!==========================");
|
||||
// }
|
||||
//
|
||||
// @Scheduled(cron = "0 40 14 * * ? ")
|
||||
// public void countFundInWeek() throws Exception {
|
||||
// if (DateUtils.validWeekTime()) return;
|
||||
// log.info("==========================[基金统计] 基金本周涨跌幅消息发送定时任务启动!==========================");
|
||||
// List<XbFundCount> xbFundCounts = fundService.queryFundCountInWeek();
|
||||
// if (CollectionUtils.isEmpty(xbFundCounts)) {
|
||||
// return;
|
||||
// }
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// Map<String, List<XbFundCount>> map = xbFundCounts.stream().collect(Collectors.groupingBy(XbFundCount::getCode));
|
||||
// map.forEach((k, v) -> {
|
||||
// List<XbFundCount> fundCounts = map.get(k);
|
||||
// if (CollectionUtils.isEmpty(fundCounts)) {
|
||||
// return;
|
||||
// }
|
||||
// List<BigDecimal> decimals = fundCounts.stream().map(XbFundCount::getChange).collect(Collectors.toList());
|
||||
// BigDecimal sum = BigDecimal.ZERO;
|
||||
// for (BigDecimal decimal : decimals) {
|
||||
// sum = sum.add(decimal);
|
||||
// }
|
||||
// BigDecimal avg = sum.divide(BigDecimal.valueOf(decimals.size()), 2, RoundingMode.HALF_UP);
|
||||
// sb.append("【").append(fundCounts.get(0).getName()).append("】本周平均涨跌幅为:").append(avg).append("\n");
|
||||
// });
|
||||
// if (StringUtils.isNotBlank(sb)) {
|
||||
// dingTalkService.sendMsg(sb.toString());
|
||||
// }
|
||||
// log.info("==========================[基金统计] 基金本周涨跌幅消息发送定时任务结束!==========================");
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,180 +1,134 @@
|
||||
package com.xiang.xservice.application.script.xb.schedule.xb;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.xiang.xmc.service.cache.service.IRedisService;
|
||||
import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.application.script.xb.entity.pojo.xb.FundMessage;
|
||||
import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundInfo;
|
||||
import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.xservice.application.script.xb.repository.XBFundMapper;
|
||||
import com.xiang.xservice.application.script.xb.service.FundService;
|
||||
import com.xiang.xservice.basic.config.MyThreadFactory;
|
||||
import com.xiang.xservice.basic.utils.DateUtils;
|
||||
import com.xiang.xservice.common.entity.DayResult;
|
||||
import com.xiang.xservice.common.enums.RedisConstant;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-05-14 17:15
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class FundInfoQueryJob {
|
||||
|
||||
private final FundService fundService;
|
||||
private final DingTalkService dingTalkService;
|
||||
private final XBFundMapper xbFundMapper;
|
||||
private final IRedisService redisService;
|
||||
private final ExecutorService es =
|
||||
new ThreadPoolExecutor(
|
||||
10,
|
||||
20,
|
||||
1000,
|
||||
TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<>(),
|
||||
new MyThreadFactory("xb-query-thread", Boolean.TRUE),
|
||||
new ThreadPoolExecutor.AbortPolicy());
|
||||
@Value("${xiaobei.codeArr}")
|
||||
private String codeArr;
|
||||
@Value("${dingtalk.chatId}")
|
||||
private String chatId;
|
||||
|
||||
/**
|
||||
* 基金涨跌幅5分钟超过2%重点通知
|
||||
*/
|
||||
@Scheduled(cron = "0 0/5 9,10,11,13,14,15 * * ? ")
|
||||
public void queryFundEmergencyJob() throws Exception {
|
||||
// 周六周日过滤
|
||||
if (DateUtils.validWeekTime()) return;
|
||||
LocalDate now = LocalDate.now();
|
||||
com.alibaba.fastjson.JSONObject dayResult = (com.alibaba.fastjson.JSONObject) redisService.hGet(RedisConstant.DAY_INFO_PREFIX_KEY + RedisConstant.getDate4Key(), DateUtils.getDateFromDate(now));
|
||||
com.xiang.xservice.common.utils.DateUtils dateUtils = new com.xiang.xservice.common.utils.DateUtils(redisService);
|
||||
if (dateUtils.validHoliday(JSON.toJavaObject(dayResult, DayResult.class))) return;
|
||||
|
||||
List<com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo> fundInfos = xbFundMapper.queryListIn2Min();
|
||||
if (CollectionUtils.isEmpty(fundInfos)) {
|
||||
return;
|
||||
}
|
||||
Map<String, List<com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo>> map = fundInfos.stream().collect(Collectors.groupingBy(com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo::getCode));
|
||||
StringBuffer sb = new StringBuffer();
|
||||
map.entrySet().parallelStream().forEach(entry -> {
|
||||
List<com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo> infos = entry.getValue();
|
||||
BigDecimal sum = new BigDecimal("0");
|
||||
for (int i = 0; i < infos.size() - 1; i++) {
|
||||
BigDecimal subtract = new BigDecimal(infos.get(i + 1).getChange()).subtract(new BigDecimal(infos.get(i).getChange()));
|
||||
sum = sum.add(subtract);
|
||||
}
|
||||
BigDecimal avg = sum.divide(new BigDecimal(String.valueOf(infos.size())), 2, RoundingMode.HALF_UP);
|
||||
if (avg.abs().compareTo(new BigDecimal("2")) > 0) {
|
||||
sb.append("基金").append(entry.getValue().get(0).getName()).append("5分钟的平均涨跌幅超过2%,涨跌幅达到").append(avg).append("\n");
|
||||
}
|
||||
});
|
||||
if (StringUtils.isNotBlank(sb)) {
|
||||
dingTalkService.sendChatMessage(chatId, sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 基金每分钟涨幅记录
|
||||
*/
|
||||
@Scheduled(cron = "0 0/1 9,10,11,13,14 * * ?")
|
||||
public void queryFundInfoInMinJob() {
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
return;
|
||||
}
|
||||
List<FundMessage> fundMessageList = queryFund(null);
|
||||
if (CollectionUtils.isEmpty(fundMessageList)) {
|
||||
return;
|
||||
}
|
||||
List<CompletableFuture> futures = Lists.newArrayList();
|
||||
List<com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo> fundInfoList = Lists.newCopyOnWriteArrayList();
|
||||
fundMessageList.parallelStream().forEach(fundMessage -> {
|
||||
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
||||
FundInfo fundInfo = fundService.queryFundInfo(fundMessage.getCode());
|
||||
|
||||
com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo info = com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo.builder()
|
||||
.code(fundMessage.getCode())
|
||||
.name(fundInfo.getName())
|
||||
.change(fundMessage.getChange().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString())
|
||||
.updateTime(getTimeFromStr(fundMessage.getDate(), fundMessage.getUpdate()))
|
||||
.build();
|
||||
fundInfoList.add(info);
|
||||
}, es);
|
||||
futures.add(future);
|
||||
});
|
||||
|
||||
CompletableFuture[] futureArr = futures
|
||||
.toArray(futures.toArray(new CompletableFuture[0]));
|
||||
CompletableFuture.allOf(futureArr).join();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(fundInfoList)) {
|
||||
log.info("[基金查询] 每分钟基金涨跌幅查询记录,需要插入的数据:{}", JSONObject.toJSONString(fundInfoList));
|
||||
xbFundMapper.batchSave(fundInfoList);
|
||||
}
|
||||
}
|
||||
|
||||
private List<FundMessage> queryFund(Integer type) {
|
||||
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
List<String> code = Lists.newArrayList();
|
||||
List<XbFundList> lists = xbFundMapper.queryFundList(type);
|
||||
if (CollectionUtils.isEmpty(lists)) {
|
||||
if (Objects.equals(type, 1)) {
|
||||
code = Arrays.stream(codeArr.split(", ")).collect(Collectors.toList());
|
||||
}
|
||||
return Lists.newArrayList();
|
||||
} else {
|
||||
code = lists.stream().map(XbFundList::getCode).collect(Collectors.toList());
|
||||
}
|
||||
List<FundList> fundLists = fundService.queryTodayList(date, "2", Boolean.TRUE, code);
|
||||
if (CollectionUtils.isEmpty(fundLists)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
List<FundMessage> result = Lists.newCopyOnWriteArrayList();
|
||||
fundLists.parallelStream().forEach(fundList -> {
|
||||
FundInfo fundInfo = fundService.queryFundInfo(fundList.getCode());
|
||||
if (Objects.nonNull(fundInfo)) {
|
||||
FundMessage fund = FundMessage.builder().name(fundInfo.getName()).date(fundList.getDate())
|
||||
.code(fundList.getCode()).change(fundList.getChange()).update(fundList.getUpdate()).build();
|
||||
result.add(fund);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
private LocalDateTime getTimeFromStr(String date, String time) {
|
||||
String dateTimeStr = date + " " + time;
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
return LocalDateTime.parse(dateTimeStr, formatter);
|
||||
}
|
||||
|
||||
}
|
||||
//package com.xiang.xservice.application.script.xb.schedule.xb;
|
||||
//
|
||||
//import com.alibaba.fastjson2.JSONObject;
|
||||
//import com.google.common.collect.Lists;
|
||||
//import com.xiang.xservice.application.script.xb.entity.pojo.xb.FundMessage;
|
||||
//import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList;
|
||||
//import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundInfo;
|
||||
//import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList;
|
||||
//import com.xiang.xservice.application.script.xb.repository.XBFundMapper;
|
||||
//import com.xiang.xservice.application.script.xb.service.FundService;
|
||||
//import com.xiang.xservice.basic.config.MyThreadFactory;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.apache.commons.collections4.CollectionUtils;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.scheduling.annotation.Scheduled;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.math.BigDecimal;
|
||||
//import java.math.RoundingMode;
|
||||
//import java.time.DayOfWeek;
|
||||
//import java.time.LocalDate;
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.time.format.DateTimeFormatter;
|
||||
//import java.util.Arrays;
|
||||
//import java.util.List;
|
||||
//import java.util.Objects;
|
||||
//import java.util.concurrent.CompletableFuture;
|
||||
//import java.util.concurrent.ExecutorService;
|
||||
//import java.util.concurrent.LinkedBlockingQueue;
|
||||
//import java.util.concurrent.ThreadPoolExecutor;
|
||||
//import java.util.concurrent.TimeUnit;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * @Author: xiang
|
||||
// * @Date: 2025-05-14 17:15
|
||||
// */
|
||||
//@Component
|
||||
//@RequiredArgsConstructor
|
||||
//@Slf4j
|
||||
//public class FundInfoQueryJob {
|
||||
//
|
||||
// private final FundService fundService;
|
||||
// private final XBFundMapper xbFundMapper;
|
||||
// private final ExecutorService es =
|
||||
// new ThreadPoolExecutor(
|
||||
// 10,
|
||||
// 20,
|
||||
// 1000,
|
||||
// TimeUnit.MILLISECONDS,
|
||||
// new LinkedBlockingQueue<>(),
|
||||
// new MyThreadFactory("xb-query-thread", Boolean.TRUE),
|
||||
// new ThreadPoolExecutor.AbortPolicy());
|
||||
// @Value("${xiaobei.codeArr}")
|
||||
// private String codeArr;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 基金每分钟涨幅记录
|
||||
// */
|
||||
// @Scheduled(cron = "0 0/1 9,10,11,13,14 * * ?")
|
||||
// public void queryFundInfoInMinJob() {
|
||||
// // 周六周日过滤
|
||||
// if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
// Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
// return;
|
||||
// }
|
||||
// List<FundMessage> fundMessageList = queryFund(null);
|
||||
// if (CollectionUtils.isEmpty(fundMessageList)) {
|
||||
// return;
|
||||
// }
|
||||
// List<CompletableFuture> futures = Lists.newArrayList();
|
||||
// List<com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo> fundInfoList = Lists.newCopyOnWriteArrayList();
|
||||
// fundMessageList.parallelStream().forEach(fundMessage -> {
|
||||
// CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
||||
// FundInfo fundInfo = fundService.queryFundInfo(fundMessage.getCode());
|
||||
//
|
||||
// com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo info = com.xiang.xservice.application.script.xb.entity.pojo.xb.FundInfo.builder()
|
||||
// .code(fundMessage.getCode())
|
||||
// .name(fundInfo.getName())
|
||||
// .change(fundMessage.getChange().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString())
|
||||
// .updateTime(getTimeFromStr(fundMessage.getDate(), fundMessage.getUpdate()))
|
||||
// .build();
|
||||
// fundInfoList.add(info);
|
||||
// }, es);
|
||||
// futures.add(future);
|
||||
// });
|
||||
//
|
||||
// CompletableFuture[] futureArr = futures
|
||||
// .toArray(futures.toArray(new CompletableFuture[0]));
|
||||
// CompletableFuture.allOf(futureArr).join();
|
||||
//
|
||||
// if (CollectionUtils.isNotEmpty(fundInfoList)) {
|
||||
// log.info("[基金查询] 每分钟基金涨跌幅查询记录,需要插入的数据:{}", JSONObject.toJSONString(fundInfoList));
|
||||
// xbFundMapper.batchSave(fundInfoList);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private List<FundMessage> queryFund(Integer type) {
|
||||
// String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
// List<String> code = Lists.newArrayList();
|
||||
// List<XbFundList> lists = xbFundMapper.queryFundList(type);
|
||||
// if (CollectionUtils.isEmpty(lists)) {
|
||||
// if (Objects.equals(type, 1)) {
|
||||
// code = Arrays.stream(codeArr.split(", ")).collect(Collectors.toList());
|
||||
// }
|
||||
// return Lists.newArrayList();
|
||||
// } else {
|
||||
// code = lists.stream().map(XbFundList::getCode).collect(Collectors.toList());
|
||||
// }
|
||||
// List<FundList> fundLists = fundService.queryTodayList(date, "2", Boolean.TRUE, code);
|
||||
// if (CollectionUtils.isEmpty(fundLists)) {
|
||||
// return Lists.newArrayList();
|
||||
// }
|
||||
// List<FundMessage> result = Lists.newCopyOnWriteArrayList();
|
||||
// fundLists.parallelStream().forEach(fundList -> {
|
||||
// FundInfo fundInfo = fundService.queryFundInfo(fundList.getCode());
|
||||
// if (Objects.nonNull(fundInfo)) {
|
||||
// FundMessage fund = FundMessage.builder().name(fundInfo.getName()).date(fundList.getDate())
|
||||
// .code(fundList.getCode()).change(fundList.getChange()).update(fundList.getUpdate()).build();
|
||||
// result.add(fund);
|
||||
// }
|
||||
// });
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// private LocalDateTime getTimeFromStr(String date, String time) {
|
||||
// String dateTimeStr = date + " " + time;
|
||||
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
// return LocalDateTime.parse(dateTimeStr, formatter);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,144 +1,144 @@
|
||||
package com.xiang.xservice.application.script.xb.schedule.xb;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList;
|
||||
import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList;
|
||||
import com.xiang.xservice.application.script.xb.service.DingTalkRobotService;
|
||||
import com.xiang.xservice.application.script.xb.service.FundService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-31 18:10
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class FundMsgReportJob {
|
||||
|
||||
private final FundService fundService;
|
||||
private final DingTalkRobotService dingTalkService;
|
||||
private static final Integer TYPE_A = 1;
|
||||
private static final Integer TYPE_M = 3;
|
||||
private static final Integer TYPE_G = 2;
|
||||
|
||||
@Scheduled(cron = "0 1,31 9,10,11,13,14 * * ?")
|
||||
@PostMapping("/asdasda")
|
||||
public void fundReport4A() {
|
||||
log.info("===========A股基金变化通知!===========");
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
log.info("当前时间为:{}", LocalDateTime.now());
|
||||
return;
|
||||
}
|
||||
List<XbFundList> fundLists = fundService.queryFundList(TYPE_A);
|
||||
if (CollectionUtils.isEmpty(fundLists)) {
|
||||
log.info("查询配置的A股信息为空");
|
||||
return;
|
||||
}
|
||||
Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
|
||||
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
|
||||
if (CollectionUtils.isEmpty(funds)) {
|
||||
log.info("http请求查询基金信息为空");
|
||||
return;
|
||||
}
|
||||
log.info("http查询基金信息:{}", JSON.toJSONString(funds));
|
||||
StringBuilder msg = new StringBuilder(date).append("===》A股基金变化通知:\n");
|
||||
buildMsg(funds, fundMap, msg);
|
||||
dingTalkService.sendXbMsg(msg.toString());
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 1,31 9,10,11,13,14,15 * * ?")
|
||||
public void fundReport4G() {
|
||||
log.info("===========港股基金变化通知!===========");
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
log.info("当前时间为:{}", LocalDateTime.now());
|
||||
return;
|
||||
}
|
||||
List<XbFundList> fundLists = fundService.queryFundList(TYPE_G);
|
||||
if (CollectionUtils.isEmpty(fundLists)) {
|
||||
log.info("查询配置的港股信息为空");
|
||||
return;
|
||||
}
|
||||
Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
|
||||
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
|
||||
if (CollectionUtils.isEmpty(funds)) {
|
||||
log.info("http请求查询基金信息为空");
|
||||
return;
|
||||
}
|
||||
log.info("http查询港股基金信息:{}", JSON.toJSONString(funds));
|
||||
StringBuilder msg = new StringBuilder(date).append("===》港股基金变化通知:\n");
|
||||
buildMsg(funds, fundMap, msg);
|
||||
dingTalkService.sendXbMsg(msg.toString());
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 9 * * ?")
|
||||
public void fundReport4M() {
|
||||
log.info("===========美股基金变化通知!===========");
|
||||
// 周六周日过滤
|
||||
if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
log.info("当前时间为:{}", LocalDateTime.now());
|
||||
return;
|
||||
}
|
||||
List<XbFundList> fundLists = fundService.queryFundList(TYPE_M);
|
||||
if (CollectionUtils.isEmpty(fundLists)) {
|
||||
log.info("查询配置的美股信息为空");
|
||||
return;
|
||||
}
|
||||
Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
|
||||
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
|
||||
if (CollectionUtils.isEmpty(funds)) {
|
||||
log.info("http请求查询基金信息为空");
|
||||
return;
|
||||
}
|
||||
log.info("http查询美股基金信息:{}", JSON.toJSONString(funds));
|
||||
StringBuilder msg = new StringBuilder(date).append("===》美股基金变化通知:\n");
|
||||
buildMsg(funds, fundMap, msg);
|
||||
dingTalkService.sendXbMsg(msg.toString());
|
||||
}
|
||||
|
||||
private static void buildMsg(List<FundList> funds, Map<String, XbFundList> fundMap, StringBuilder msg) {
|
||||
funds = funds.stream().sorted(Comparator.comparing(FundList::getChange).reversed())
|
||||
.collect(Collectors.toList());
|
||||
for (FundList fund : funds) {
|
||||
if (fundMap.containsKey(fund.getCode())) {
|
||||
XbFundList fundList = fundMap.get(fund.getCode());
|
||||
msg.append("基金名称:")
|
||||
.append(fundList.getName())
|
||||
.append("涨跌幅:")
|
||||
.append(fund.getChange()
|
||||
.multiply(new BigDecimal("100"))
|
||||
.setScale(2, RoundingMode.HALF_UP))
|
||||
.append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.xiang.xservice.application.script.xb.schedule.xb;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSON;
|
||||
//import com.xiang.xservice.application.script.xb.entity.pojo.xb.XbFundList;
|
||||
//import com.xiang.xservice.application.script.xb.entity.response.xbyj.fund.FundList;
|
||||
//import com.xiang.xservice.application.script.xb.service.FundService;
|
||||
//import com.xiang.xservice.common.service.dingTalk.StockDingTalkFactory;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.apache.commons.collections4.CollectionUtils;
|
||||
//import org.springframework.scheduling.annotation.Scheduled;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import java.math.BigDecimal;
|
||||
//import java.math.RoundingMode;
|
||||
//import java.time.DayOfWeek;
|
||||
//import java.time.LocalDate;
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.time.format.DateTimeFormatter;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Comparator;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.Objects;
|
||||
//import java.util.function.Function;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * @Author: xiang
|
||||
// * @Date: 2025-07-31 18:10
|
||||
// */
|
||||
//@Component
|
||||
//@Slf4j
|
||||
//@RestController
|
||||
//@RequiredArgsConstructor
|
||||
//public class FundMsgReportJob {
|
||||
//
|
||||
// private final FundService fundService;
|
||||
// private final StockDingTalkFactory dingTalkService;
|
||||
// private static final Integer TYPE_A = 1;
|
||||
// private static final Integer TYPE_M = 3;
|
||||
// private static final Integer TYPE_G = 2;
|
||||
//
|
||||
// @Scheduled(cron = "0 1,31 9,10,11,13,14 * * ?")
|
||||
// @PostMapping("/asdasda")
|
||||
// public void fundReport4A() {
|
||||
// log.info("===========A股基金变化通知!===========");
|
||||
// // 周六周日过滤
|
||||
// if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
// Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
// log.info("当前时间为:{}", LocalDateTime.now());
|
||||
// return;
|
||||
// }
|
||||
// List<XbFundList> fundLists = fundService.queryFundList(TYPE_A);
|
||||
// if (CollectionUtils.isEmpty(fundLists)) {
|
||||
// log.info("查询配置的A股信息为空");
|
||||
// return;
|
||||
// }
|
||||
// Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
|
||||
// String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
// List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
|
||||
// if (CollectionUtils.isEmpty(funds)) {
|
||||
// log.info("http请求查询基金信息为空");
|
||||
// return;
|
||||
// }
|
||||
// log.info("http查询基金信息:{}", JSON.toJSONString(funds));
|
||||
// StringBuilder msg = new StringBuilder(date).append("===》A股基金变化通知:\n");
|
||||
// buildMsg(funds, fundMap, msg);
|
||||
// dingTalkService.sendMsg(msg.toString());
|
||||
// }
|
||||
//
|
||||
// @Scheduled(cron = "0 1,31 9,10,11,13,14,15 * * ?")
|
||||
// public void fundReport4G() {
|
||||
// log.info("===========港股基金变化通知!===========");
|
||||
// // 周六周日过滤
|
||||
// if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
// Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
// log.info("当前时间为:{}", LocalDateTime.now());
|
||||
// return;
|
||||
// }
|
||||
// List<XbFundList> fundLists = fundService.queryFundList(TYPE_G);
|
||||
// if (CollectionUtils.isEmpty(fundLists)) {
|
||||
// log.info("查询配置的港股信息为空");
|
||||
// return;
|
||||
// }
|
||||
// Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
|
||||
// String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
// List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
|
||||
// if (CollectionUtils.isEmpty(funds)) {
|
||||
// log.info("http请求查询基金信息为空");
|
||||
// return;
|
||||
// }
|
||||
// log.info("http查询港股基金信息:{}", JSON.toJSONString(funds));
|
||||
// StringBuilder msg = new StringBuilder(date).append("===》港股基金变化通知:\n");
|
||||
// buildMsg(funds, fundMap, msg);
|
||||
// dingTalkService.sendMsg(msg.toString());
|
||||
// }
|
||||
//
|
||||
// @Scheduled(cron = "0 0 9 * * ?")
|
||||
// public void fundReport4M() {
|
||||
// log.info("===========美股基金变化通知!===========");
|
||||
// // 周六周日过滤
|
||||
// if (Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SATURDAY) ||
|
||||
// Objects.equals(LocalDateTime.now().getDayOfWeek(), DayOfWeek.SUNDAY)) {
|
||||
// log.info("当前时间为:{}", LocalDateTime.now());
|
||||
// return;
|
||||
// }
|
||||
// List<XbFundList> fundLists = fundService.queryFundList(TYPE_M);
|
||||
// if (CollectionUtils.isEmpty(fundLists)) {
|
||||
// log.info("查询配置的美股信息为空");
|
||||
// return;
|
||||
// }
|
||||
// Map<String, XbFundList> fundMap = fundLists.stream().collect(Collectors.toMap(XbFundList::getCode, Function.identity(), (a, b) -> a));
|
||||
// String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
// List<FundList> funds = fundService.queryTodayList(date, "2", Boolean.TRUE, new ArrayList<>(fundMap.keySet()));
|
||||
// if (CollectionUtils.isEmpty(funds)) {
|
||||
// log.info("http请求查询基金信息为空");
|
||||
// return;
|
||||
// }
|
||||
// log.info("http查询美股基金信息:{}", JSON.toJSONString(funds));
|
||||
// StringBuilder msg = new StringBuilder(date).append("===》美股基金变化通知:\n");
|
||||
// buildMsg(funds, fundMap, msg);
|
||||
// dingTalkService.sendMsg(msg.toString());
|
||||
// }
|
||||
//
|
||||
// private static void buildMsg(List<FundList> funds, Map<String, XbFundList> fundMap, StringBuilder msg) {
|
||||
// funds = funds.stream().sorted(Comparator.comparing(FundList::getChange).reversed())
|
||||
// .collect(Collectors.toList());
|
||||
// for (FundList fund : funds) {
|
||||
// if (fundMap.containsKey(fund.getCode())) {
|
||||
// XbFundList fundList = fundMap.get(fund.getCode());
|
||||
// msg.append("基金名称:")
|
||||
// .append(fundList.getName())
|
||||
// .append("涨跌幅:")
|
||||
// .append(fund.getChange()
|
||||
// .multiply(new BigDecimal("100"))
|
||||
// .setScale(2, RoundingMode.HALF_UP))
|
||||
// .append("\n");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.xiang.xservice.application.script.xb.service;
|
||||
|
||||
import com.xiang.xmc.service.message.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.config.DingTalkRobotXbConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-08-07 11:02
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DingTalkRobotService {
|
||||
private final DingTalkService dingTalkService;
|
||||
private final DingTalkRobotXbConfig dingTalkRobotConfig;
|
||||
|
||||
/**
|
||||
* 发送脚本消息
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void sendXbMsg(String msg) {
|
||||
try {
|
||||
dingTalkService.sendRobotMessage(dingTalkRobotConfig.getSecret(), dingTalkRobotConfig.getToken(), dingTalkRobotConfig.getUsers(), msg);
|
||||
} catch (Exception e) {
|
||||
log.error("信息发送异常, 信息:{}", msg, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.xiang.xservice.common.enums;
|
||||
|
||||
import com.xiang.xmc.service.message.dingTalk.enums.BaseDingTalkBizType;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-01-04 16:13
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum DingTalkBizTypeEnum implements BaseDingTalkBizType {
|
||||
|
||||
JT("venue", "江南体育中心"),
|
||||
XB("xb", "股票基金变化通知"),
|
||||
SCRIPT("script", "脚本运行通知群")
|
||||
;
|
||||
private final String bizName;
|
||||
private final String desc;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xiang.xservice.common.service.dingTalk;
|
||||
|
||||
import com.xiang.xmc.service.message.dingTalk.config.DingTalkRobotProperties;
|
||||
import com.xiang.xmc.service.message.dingTalk.service.AbstractDingTalkFactory;
|
||||
import com.xiang.xmc.service.message.dingTalk.service.DingTalkSender;
|
||||
import com.xiang.xservice.common.enums.DingTalkBizTypeEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-01-04 16:19
|
||||
*/
|
||||
@Service
|
||||
public class JtDingTalkFactory extends AbstractDingTalkFactory {
|
||||
public JtDingTalkFactory(DingTalkRobotProperties dingTalkRobotProperties, DingTalkSender dingTalkSender) {
|
||||
super(dingTalkRobotProperties, dingTalkSender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(String msg) {
|
||||
getClient(DingTalkBizTypeEnum.JT).sendDingTalkMsg(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.xiang.xservice.common.service.dingTalk;
|
||||
|
||||
import com.xiang.xmc.service.message.dingTalk.config.DingTalkRobotProperties;
|
||||
import com.xiang.xmc.service.message.dingTalk.service.AbstractDingTalkFactory;
|
||||
import com.xiang.xmc.service.message.dingTalk.service.DingTalkSender;
|
||||
import com.xiang.xservice.common.enums.DingTalkBizTypeEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ScriptDingTalkFactory extends AbstractDingTalkFactory {
|
||||
public ScriptDingTalkFactory(DingTalkRobotProperties dingTalkRobotProperties, DingTalkSender dingTalkSender) {
|
||||
super(dingTalkRobotProperties, dingTalkSender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(String msg) {
|
||||
getClient(DingTalkBizTypeEnum.SCRIPT).sendDingTalkMsg(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.xiang.xservice.common.service.dingTalk;
|
||||
|
||||
import com.xiang.xmc.service.message.dingTalk.config.DingTalkRobotProperties;
|
||||
import com.xiang.xmc.service.message.dingTalk.service.AbstractDingTalkFactory;
|
||||
import com.xiang.xmc.service.message.dingTalk.service.DingTalkSender;
|
||||
import com.xiang.xservice.common.enums.DingTalkBizTypeEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class StockDingTalkFactory extends AbstractDingTalkFactory {
|
||||
public StockDingTalkFactory(DingTalkRobotProperties dingTalkRobotProperties, DingTalkSender dingTalkSender) {
|
||||
super(dingTalkRobotProperties, dingTalkSender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(String msg) {
|
||||
getClient(DingTalkBizTypeEnum.XB).sendDingTalkMsg(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xiang.xservice.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/statics/**").addResourceLocations("classpath:/statics/");
|
||||
}
|
||||
}
|
||||
@@ -43,43 +43,7 @@ spring:
|
||||
settings:
|
||||
number_format: 0.##
|
||||
default_encoding: UTF-8
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration
|
||||
server:
|
||||
#tomcat:
|
||||
# remote-ip-header: x-forward-for
|
||||
# uri-encoding: UTF-8
|
||||
# max-threads: 10
|
||||
# background-processor-delay: 30
|
||||
# basedir: ${user.home}/tomcat/
|
||||
undertow:
|
||||
# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
|
||||
# 不要设置过大,如果过大,启动项目会报错:打开文件数过多
|
||||
io-threads: 4
|
||||
# 阻塞任务线程池, 当执行类似servlet请求阻塞IO操作, undertow会从这个线程池中取得线程
|
||||
# 它的值设置取决于系统线程执行任务的阻塞系数,默认值是IO线程数*8
|
||||
worker-threads: 64
|
||||
# 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理
|
||||
# 每块buffer的空间大小,越小的空间被利用越充分,不要设置太大,以免影响其他应用,合适即可
|
||||
buffer-size: 1024
|
||||
# 是否分配的直接内存(NIO直接分配的堆外内存)
|
||||
direct-buffers: true
|
||||
|
||||
OEM:
|
||||
version: 2025 September
|
||||
header: SQL转Java JPA、MYBATIS实现类代码生成平台
|
||||
keywords: sql转实体类,sql转DAO,SQL转service,SQL转JPA实现,SQL转MYBATIS实现
|
||||
title: 大狼狗代码生成器
|
||||
slogan: 👐 Free your hands from boring CRUD—let the code write itself! ⚡
|
||||
description: <p>💻 SpringBootCodeGenerator,又名 `大狼狗代码生成器`🐺🐶,支持 SQL 一键转 JAVA/JPA/Mybatis/MybatisPlus 等多种模板,轻松搞定 CRUD,彻底解放双手 ✋!只需提供 DDL、SELECT SQL 或简单 JSON 👉 即可生成 生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL/CommonMapper 等代码模板。</p><p>🔥🔥🔥 全新 JSqlParser 引擎上线,强力支持 DDL CREATE SQL与 SELECT SQL 解析!欢迎体验 & 反馈 💬!</p><p>👨💻 面向开发者的高效利器,已服务数万工程师,欢迎 Star ⭐、Fork 🍴、提 Issue 💬,一起打造更强大的代码生成平台!</p>
|
||||
author: zhengkai.blog.csdn.net
|
||||
packageName: com.software.system
|
||||
copyright: ✨ Powered by <a href="https://zhengkai.blog.csdn.net" target="_blank">Moshow郑锴</a> — may the holy light guide your code, your coffee, and your commits! ⚡🧙♂️💻
|
||||
returnUtilSuccess: ResponseUtil.success
|
||||
returnUtilFailure: ResponseUtil.error
|
||||
outputStr: http://zhengkai.blog.csdn.net
|
||||
mode: local
|
||||
|
||||
aliyun:
|
||||
dns:
|
||||
@@ -87,23 +51,23 @@ aliyun:
|
||||
- local
|
||||
|
||||
dingtalk:
|
||||
# 钉钉消息用户,用逗号隔开
|
||||
userList: "450841600726084717"
|
||||
# 钉钉消息群ID,需要调用/chat/create api创建群返回
|
||||
chatId: "chatd16d8daeea33b36b73588c676d508096"
|
||||
robot:
|
||||
script:
|
||||
token: 797be7f32062e31dec1d567f8b490a5649a5366083618e236c7a1263df1f4af3
|
||||
secret: SEC9aca642c0c29c9da261462869c464d34623247583d98fc82343a0a4464abbe91
|
||||
users:
|
||||
- 450841600726084717
|
||||
xb:
|
||||
token: ad21ead99f0fdc63aa00d6732b7b0888c17590f7612c68297edfcb71844d1437
|
||||
secret: SECc09d8aad6635f1a4cbadb7c0ab365523c46299f138438cd885e445e0f5f4d730
|
||||
users:
|
||||
- 450841600726084717
|
||||
venue:
|
||||
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
|
||||
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
|
||||
users:
|
||||
- 450841600726084717
|
||||
properties:
|
||||
venue:
|
||||
name: 江南体育中心通知群
|
||||
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
|
||||
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
|
||||
users:
|
||||
- 450841600726084717
|
||||
script:
|
||||
name: 脚本运行通知群
|
||||
token: 797be7f32062e31dec1d567f8b490a5649a5366083618e236c7a1263df1f4af3
|
||||
secret: SEC9aca642c0c29c9da261462869c464d34623247583d98fc82343a0a4464abbe91
|
||||
users:
|
||||
- 450841600726084717
|
||||
xb:
|
||||
name: 股票基金变化通知群
|
||||
token: ad21ead99f0fdc63aa00d6732b7b0888c17590f7612c68297edfcb71844d1437
|
||||
secret: SECc09d8aad6635f1a4cbadb7c0ab365523c46299f138438cd885e445e0f5f4d730
|
||||
users:
|
||||
- 450841600726084717
|
||||
@@ -29,6 +29,20 @@ spring:
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
max-wait: 1000
|
||||
freemarker:
|
||||
request-context-attribute: request
|
||||
suffix: .html
|
||||
content-type: text/html
|
||||
enabled: true
|
||||
cache: false
|
||||
charset: UTF-8
|
||||
allow-request-override: false
|
||||
expose-request-attributes: true
|
||||
expose-session-attributes: true
|
||||
expose-spring-macro-helpers: true
|
||||
settings:
|
||||
number_format: 0.##
|
||||
default_encoding: UTF-8
|
||||
|
||||
aliyun:
|
||||
dns:
|
||||
@@ -38,23 +52,23 @@ aliyun:
|
||||
- nexus
|
||||
|
||||
dingtalk:
|
||||
# 钉钉消息用户,用逗号隔开
|
||||
userList: "450841600726084717"
|
||||
# 钉钉消息群ID,需要调用/chat/create api创建群返回
|
||||
chatId: "chatd16d8daeea33b36b73588c676d508096"
|
||||
robot:
|
||||
script:
|
||||
token: 4709b708d961846e0aee523c5abc3b67e8fa424ee292501d85efd4e504f15a8b
|
||||
secret: SEC768ed578c0fb31a9aec84b1c1db4f195f5aca203985bbb9d549e23e41c8874d1
|
||||
users:
|
||||
- 450841600726084717
|
||||
xb:
|
||||
token: 340a9d39a5b0b6a52ba2262f9c27179cf50e3c8cfe6883ca082649d306038f41
|
||||
secret: SECe10ade3058880b84df5c6f46ab072c11f4ac2a5ef9f134d684705c2a3b004de2
|
||||
users:
|
||||
- 450841600726084717
|
||||
venue:
|
||||
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
|
||||
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
|
||||
users:
|
||||
- 450841600726084717
|
||||
properties:
|
||||
venue:
|
||||
name: 江南体育中心通知群
|
||||
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
|
||||
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
|
||||
users:
|
||||
- 450841600726084717
|
||||
script:
|
||||
name: 脚本运行通知群
|
||||
token: 4709b708d961846e0aee523c5abc3b67e8fa424ee292501d85efd4e504f15a8b
|
||||
secret: SEC768ed578c0fb31a9aec84b1c1db4f195f5aca203985bbb9d549e23e41c8874d1
|
||||
users:
|
||||
- 450841600726084717
|
||||
xb:
|
||||
name: 股票基金变化通知群
|
||||
token: 340a9d39a5b0b6a52ba2262f9c27179cf50e3c8cfe6883ca082649d306038f41
|
||||
secret: SECe10ade3058880b84df5c6f46ab072c11f4ac2a5ef9f134d684705c2a3b004de2
|
||||
users:
|
||||
- 450841600726084717
|
||||
@@ -29,6 +29,20 @@ spring:
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
max-wait: 1000
|
||||
freemarker:
|
||||
request-context-attribute: request
|
||||
suffix: .html
|
||||
content-type: text/html
|
||||
enabled: true
|
||||
cache: false
|
||||
charset: UTF-8
|
||||
allow-request-override: false
|
||||
expose-request-attributes: true
|
||||
expose-session-attributes: true
|
||||
expose-spring-macro-helpers: true
|
||||
settings:
|
||||
number_format: 0.##
|
||||
default_encoding: UTF-8
|
||||
|
||||
aliyun:
|
||||
dns:
|
||||
@@ -36,18 +50,23 @@ aliyun:
|
||||
- test
|
||||
|
||||
dingtalk:
|
||||
# 钉钉消息用户,用逗号隔开
|
||||
userList: "450841600726084717"
|
||||
# 钉钉消息群ID,需要调用/chat/create api创建群返回
|
||||
chatId: "chatd16d8daeea33b36b73588c676d508096"
|
||||
robot:
|
||||
script:
|
||||
token: 797be7f32062e31dec1d567f8b490a5649a5366083618e236c7a1263df1f4af3
|
||||
secret: SEC9aca642c0c29c9da261462869c464d34623247583d98fc82343a0a4464abbe91
|
||||
users:
|
||||
- 450841600726084717
|
||||
xb:
|
||||
token: ad21ead99f0fdc63aa00d6732b7b0888c17590f7612c68297edfcb71844d1437
|
||||
secret: SECc09d8aad6635f1a4cbadb7c0ab365523c46299f138438cd885e445e0f5f4d730
|
||||
users:
|
||||
- 450841600726084717
|
||||
properties:
|
||||
venue:
|
||||
name: 江南体育中心通知群
|
||||
token: 6a218646972c684c75832b0229ea93a234778af537d7469ce96bef290faf530e
|
||||
secret: SEC9018755ba86d3e5c1ed2fbfa1d6953d84bb2a6c8ebe7ed4e318457bfed5e0465
|
||||
users:
|
||||
- 450841600726084717
|
||||
script:
|
||||
name: 脚本运行通知群
|
||||
token: 797be7f32062e31dec1d567f8b490a5649a5366083618e236c7a1263df1f4af3
|
||||
secret: SEC9aca642c0c29c9da261462869c464d34623247583d98fc82343a0a4464abbe91
|
||||
users:
|
||||
- 450841600726084717
|
||||
xb:
|
||||
name: 股票基金变化通知群
|
||||
token: ad21ead99f0fdc63aa00d6732b7b0888c17590f7612c68297edfcb71844d1437
|
||||
secret: SECc09d8aad6635f1a4cbadb7c0ab365523c46299f138438cd885e445e0f5f4d730
|
||||
users:
|
||||
- 450841600726084717
|
||||
@@ -21,6 +21,9 @@ spring:
|
||||
name: xservice-script-center
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration
|
||||
|
||||
http:
|
||||
maxAttempts: 10
|
||||
|
||||
@@ -41,10 +41,10 @@ const vm = new Vue({
|
||||
options: {
|
||||
dataType: "sql",
|
||||
|
||||
authorName: "${(value.author)!!}",
|
||||
packageName: "${(value.packageName)!!}",
|
||||
returnUtilSuccess: "${(value.returnUtilSuccess)!!}",
|
||||
returnUtilFailure: "${(value.returnUtilFailure)!!}",
|
||||
authorName: "Xiang",
|
||||
packageName: "com.xiang",
|
||||
returnUtilSuccess: "Result.success",
|
||||
returnUtilFailure: "Result.error",
|
||||
|
||||
isPackageType: true,
|
||||
isSwagger: false,
|
||||
@@ -62,7 +62,7 @@ const vm = new Vue({
|
||||
templates: [{}],
|
||||
historicalData: [],
|
||||
currentSelect: 'plusentity',
|
||||
outputStr: "${(value.outputStr)!!}",
|
||||
outputStr: "",
|
||||
outputJson: {}
|
||||
},
|
||||
methods: {
|
||||
@@ -136,13 +136,8 @@ const vm = new Vue({
|
||||
axios.post(basePath + "/template/all", {
|
||||
id: 1234
|
||||
}).then(function (res) {
|
||||
console.log('origin res', res);
|
||||
vm.templates = res.data.data
|
||||
console.log('templates', vm.templates);
|
||||
//兼容后端返回数据格式
|
||||
});
|
||||
},
|
||||
updated: function () {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>404</title>
|
||||
</head>
|
||||
<body>
|
||||
404
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user