int commit

This commit is contained in:
ycl
2025-12-04 15:10:09 +08:00
commit d27ec3992b
56 changed files with 2006 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

14
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/template/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="23" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/common-springboot-template-spring5-springboot2.iml" filepath="$PROJECT_DIR$/.idea/common-springboot-template-spring5-springboot2.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

0
README.md Normal file
View File

41
template/.gitignore vendored Normal file
View File

@@ -0,0 +1,41 @@
## java
bin/
classes/
## eclipse
.settings/
.classpath
.project
## idea
*.iml
.idea/*
!.idea/codeStyles/
!.idea/dataSources.xml
HELP.md
## vscode
.vscode/
.factorypath
## maven:
target/
test-output/
## system
.DS_Store
logs/
*.log
## vs
.vs
!modules/.gitkeep
.gitattributes
.toco/config.local.yml
_FOSSIL_
_FOSSIL_-journal
.fslckout
.fslckout-journal
*.pem

7
template/.idea/codeStyles/Project.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
</JavaCodeStyleSettings>
</code_scheme>
</component>

View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

1
template/.mvn/jvm.config Normal file
View File

@@ -0,0 +1 @@
-Xmx1536m

BIN
template/.mvn/wrapper/maven-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://maven.aliyun.com/repository/public/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
distributionSha256Sum=0d7125e8c91097b36edb990ea5934e6c68b4440eef4ea96510a0f6815e7eeadb
wrapperUrl=https://maven.aliyun.com/repository/public/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar
wrapperUrlSha256Sum=4e2fbf6554bc8a4702cdfdd3bef464f423393d784ddbb037216320ce55d5e4e1

8
template/.toco/README Normal file
View File

@@ -0,0 +1,8 @@
目录用于存放rules只支持.md文件。
global: 目录用于存放所有agent通用rules
toco: 目录用于存放Toco Agent专用rules用于外层流程整体控制
modeling:目录用于存放Modeling Agent专用rules用于领域建模阶段
plan: 目录用于存放Plan Agent专用rules用于整体规划阶段
design:目录用于存放Design Agent专用rules用于TOCO设计元素设计
coding:目录用于存放Coding Agent专用rules用于编码阶段

View File

@@ -0,0 +1 @@
目录用于存放Design Agent专用rules用于TOCO设计元素设计只支持.md文件

View File

@@ -0,0 +1 @@
目录用于存放所有agent通用rules只支持.md文件

View File

@@ -0,0 +1 @@
目录用于存放Modeling Agent专用rules用于领域建模阶段只支持.md文件

View File

@@ -0,0 +1 @@
目录用于存放Plan Agent专用rules用于整体规划阶段只支持.md文件

View File

@@ -0,0 +1 @@
目录用于存放Toco Agent专用rules用于外层流程整体控制只支持.md文件

1
template/.values.yml Normal file
View File

@@ -0,0 +1 @@
{{ toYaml . }}

17
template/Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM eclipse-temurin:17.0.16_8-jdk-noble AS builder
WORKDIR source
COPY ./ ./
ARG JAR_FILE=entrance/web/target/*.jar
RUN ./mvnw clean package -Dmaven.test.skip=true
RUN cp ${JAR_FILE} app.jar
RUN java -Djarmode=layertools -jar ./app.jar extract
FROM eclipse-temurin:17.0.16_8-jdk-noble
WORKDIR /application
COPY --from=builder source/dependencies/ ./
COPY --from=builder source/snapshot-dependencies/ ./
COPY --from=builder source/spring-boot-loader/ ./
COPY --from=builder source/application/ ./
ENV JAVA_OPTS="-Xms1024m -Xmx1024m"
ENV MAIN_CLASS="org.springframework.boot.loader.JarLauncher"
ENTRYPOINT ["sh", "-c", "exec java ${JAVA_OPTS} -Djava.security.egd=file:dev/./urandom ${MAIN_CLASS}"]

View File

@@ -0,0 +1,5 @@
> 本模块存放公共组件
``` \-- *.utils(工具类; package)
\-- *.enums(公共枚举; package)
\-- *.constants(公共常量; package)
```

12
template/common/pom.xml Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>{{ .groupId }}</groupId>
<artifactId>{{ .artifactId }}</artifactId>
<version>${revision}</version>
</parent>
<groupId>{{ .groupId }}</groupId>
<artifactId>{{ .artifactId }}-common</artifactId>
</project>

View File

@@ -0,0 +1,2 @@
> 本模块存放公共常量
``` \-- *Constant.java

View File

@@ -0,0 +1,2 @@
> 本模块存放公共枚举
``` \-- *Enum.java

View File

@@ -0,0 +1,57 @@
package {{ .package }}.common.redis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import cn.hutool.core.util.StrUtil;
import org.springframework.beans.factory.annotation.Value;
@Configuration
@EnableConfigurationProperties({RedisPoolProperties.class})
@ConditionalOnProperty(name = "redis-config.pool.hostAndPort", havingValue = "true")
public class RedisPoolConfig {
@Autowired
private RedisPoolProperties redisPoolProperties;
@Value("${redis-config.pool.password:}")
private String password;
private JedisPoolConfig initPoolConfig() {
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(redisPoolProperties.getMaxTotal());
poolConfig.setMaxIdle(redisPoolProperties.getMaxIdle());
poolConfig.setMinIdle(redisPoolProperties.getMinIdle());
poolConfig.setNumTestsPerEvictionRun(redisPoolProperties.getNumTestsPerEvictionRun());
poolConfig.setTestOnBorrow(redisPoolProperties.isTestOnBorrow());
poolConfig.setTestOnReturn(redisPoolProperties.isTestOnReturn());
poolConfig.setTestWhileIdle(redisPoolProperties.isTestWhileIdle());
poolConfig.setBlockWhenExhausted(redisPoolProperties.isBlockWhenExhausted());
poolConfig.setJmxEnabled(redisPoolProperties.isJmxEnabled());
poolConfig.setLifo(redisPoolProperties.isLifo());
poolConfig.setNumTestsPerEvictionRun(redisPoolProperties.getNumTestsPerEvictionRun());
poolConfig.setTestOnBorrow(false);
return poolConfig;
}
/**
* create jedis poll
*
*/
@Bean
public JedisPool getRedisPool() {
String host = StrUtil.subBefore(redisPoolProperties.getHostAndPort(), ":", false);
int port = Integer.parseInt(StrUtil.subAfter(redisPoolProperties.getHostAndPort(), ":", false));
if(StrUtil.isNotEmpty(this.password)) {
return new JedisPool(initPoolConfig(),host,port ,1000, password);
}else{
return new JedisPool(initPoolConfig(),host,port);
}
}
}

View File

@@ -0,0 +1,145 @@
package {{ .package }}.common.redis;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
@ConfigurationProperties(prefix = "redis-config.pool")
public class RedisPoolProperties {
private String hostAndPort;
private int maxTotal;
private int maxIdle;
private int minIdle;
private Long maxWaitMillis;
private Long timeBetweenEvictionRunsMillis;
private Long minEvictableIdleTimeMillis;
private Long softMinEvictableIdleTimeMillis;
private boolean testOnBorrow;
private boolean testOnReturn;
private boolean testWhileIdle;
private boolean blockWhenExhausted;
private boolean jmxEnabled;
private boolean lifo;
private int numTestsPerEvictionRun;
public String getHostAndPort() {
return hostAndPort;
}
public void setHostAndPort(String hostAndPort) {
this.hostAndPort = hostAndPort;
}
public int getMaxTotal() {
return maxTotal;
}
public void setMaxTotal(int maxTotal) {
this.maxTotal = maxTotal;
}
public int getMaxIdle() {
return maxIdle;
}
public void setMaxIdle(int maxIdle) {
this.maxIdle = maxIdle;
}
public int getMinIdle() {
return minIdle;
}
public void setMinIdle(int minIdle) {
this.minIdle = minIdle;
}
public Long getMaxWaitMillis() {
return maxWaitMillis;
}
public void setMaxWaitMillis(Long maxWaitMillis) {
this.maxWaitMillis = maxWaitMillis;
}
public Long getTimeBetweenEvictionRunsMillis() {
return timeBetweenEvictionRunsMillis;
}
public void setTimeBetweenEvictionRunsMillis(Long timeBetweenEvictionRunsMillis) {
this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
}
public Long getMinEvictableIdleTimeMillis() {
return minEvictableIdleTimeMillis;
}
public void setMinEvictableIdleTimeMillis(Long minEvictableIdleTimeMillis) {
this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
}
public Long getSoftMinEvictableIdleTimeMillis() {
return softMinEvictableIdleTimeMillis;
}
public void setSoftMinEvictableIdleTimeMillis(Long softMinEvictableIdleTimeMillis) {
this.softMinEvictableIdleTimeMillis = softMinEvictableIdleTimeMillis;
}
public boolean isTestOnBorrow() {
return testOnBorrow;
}
public void setTestOnBorrow(boolean testOnBorrow) {
this.testOnBorrow = testOnBorrow;
}
public boolean isTestOnReturn() {
return testOnReturn;
}
public void setTestOnReturn(boolean testOnReturn) {
this.testOnReturn = testOnReturn;
}
public boolean isTestWhileIdle() {
return testWhileIdle;
}
public void setTestWhileIdle(boolean testWhileIdle) {
this.testWhileIdle = testWhileIdle;
}
public boolean isBlockWhenExhausted() {
return blockWhenExhausted;
}
public void setBlockWhenExhausted(boolean blockWhenExhausted) {
this.blockWhenExhausted = blockWhenExhausted;
}
public boolean isJmxEnabled() {
return jmxEnabled;
}
public void setJmxEnabled(boolean jmxEnabled) {
this.jmxEnabled = jmxEnabled;
}
public boolean isLifo() {
return lifo;
}
public void setLifo(boolean lifo) {
this.lifo = lifo;
}
public int getNumTestsPerEvictionRun() {
return numTestsPerEvictionRun;
}
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) {
this.numTestsPerEvictionRun = numTestsPerEvictionRun;
}
}

View File

@@ -0,0 +1,48 @@
package {{ .package }}.common.response;
import java.text.*;
import java.util.Calendar;
import java.util.Date;
public class MyDateFormat extends DateFormat {
private static final long serialVersionUID = -4580955831439573829L;
private static final String customDateFormat = "yyyy-MM-dd HH:mm:ss";
private DateFormat dateFormat;
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public MyDateFormat(DateFormat dateFormat) {
this.calendar = Calendar.getInstance();
this.dateFormat = dateFormat;
}
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
return this.dateFormat.format(date, toAppendTo, fieldPosition);
}
public Date parse(String source, ParsePosition pos) {
Date date = null;
if (source.length() == "yyyy-MM-dd HH:mm:ss".length()) {
date = this.simpleDateFormat.parse(source, pos);
} else {
date = this.dateFormat.parse(source, pos);
}
return date;
}
public Date parse(String source) throws ParseException {
Date date = null;
if (source.length() == "yyyy-MM-dd HH:mm:ss".length()) {
date = this.simpleDateFormat.parse(source);
} else {
date = this.dateFormat.parse(source);
}
return date;
}
public Object clone() {
Object format = this.dateFormat.clone();
return new MyDateFormat((DateFormat)format);
}
}

View File

@@ -0,0 +1,109 @@
package {{ .package }}.common.response;
import com.vs.common.util.rpc.pub.FailData;
import com.vs.ox.common.exception.ErrorCode;
import com.vs.ox.common.exception.IgnoredException;
import com.vs.ox.common.utils.ObjectMapperFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.Ordered;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Path;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@Slf4j
public class ResponseJsonExceptionResolver extends AbstractHandlerExceptionResolver implements InitializingBean {
private HttpMessageConverter messageConverter;
public ResponseJsonExceptionResolver() {
}
@Override
public void afterPropertiesSet() throws Exception {
if (messageConverter == null) {
messageConverter = new MappingJackson2HttpMessageConverter(ObjectMapperFactory.getDefaultObjectMapper());
}
}
public static String getErrorInfoFromException(Exception e) {
try {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return "\r\n" + sw.toString() + "\r\n";
} catch (Exception e2) {
return "bad getErrorInfoFromException";
}
}
@Override
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
/**
* web请求分页单独处理应对antd框架
*/
FailData failData = new FailData();
failData.setMessage(ex.getMessage());
if (ex instanceof IgnoredException) {
IgnoredException realEx = (IgnoredException) ex;
failData.setCode(realEx.getErrorCode());
failData.setData(realEx.getData());
log.error("execute {} failed with exception", request.getRequestURL(), ex);
} else if (ex instanceof ConstraintViolationException) {
failData.setCode(ErrorCode.WRONG_PARAMETER);
failData.setMessage(getMessage((ConstraintViolationException) ex));
} else if (ex instanceof ErrorCode) {
failData.setCode(((ErrorCode) ex).getErrorCode());
} else {
log.error("execute {} failed with exception", request.getRequestURL(), ex);
}
try {
response.setCharacterEncoding("utf-8");
messageConverter.write(failData, MediaType.APPLICATION_JSON, new ServletServerHttpResponse(response));
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
return new ModelAndView();
}
@Override
public int getOrder() {
return Ordered.LOWEST_PRECEDENCE;
}
public static String getMessage(ConstraintViolationException e) {
List<String> msgList = new ArrayList<>();
for (ConstraintViolation<?> constraintViolation : e.getConstraintViolations()) {
int i = 0;
StringBuilder param = new StringBuilder();
for (Iterator<Path.Node> iterator = constraintViolation.getPropertyPath().iterator(); iterator.hasNext(); i++) {
Path.Node node = iterator.next();
if (i == 0) {
continue;
}
if (!param.toString().isBlank()) {
param.append(".");
}
param.append(node.getName());
}
msgList.add("参数 [ " + param + " ] " + constraintViolation.getMessage());
}
return StringUtils.join(msgList.toArray(), ";");
}
}

View File

@@ -0,0 +1,49 @@
package {{ .package }}.common.response;
import com.vs.common.util.rpc.pub.SuccessData;
import com.vs.ox.common.utils.ObjectMapperFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.method.support.ModelAndViewContainer;
import javax.servlet.http.HttpServletResponse;
import java.util.Collections;
/**
* 处理 Controller 里的返回值,从 Object转为Json
*/
public class ResponseJsonMethodReturnValueHandler implements HandlerMethodReturnValueHandler, InitializingBean {
private HttpMessageConverter messageConverter;
@Override
public void afterPropertiesSet() {
if (messageConverter == null) {
messageConverter = new MappingJackson2HttpMessageConverter(ObjectMapperFactory.getDefaultObjectMapper());
}
}
@Override
public boolean supportsReturnType(MethodParameter returnType) {
return true;
}
@Override
public void handleReturnValue(Object returnValue, MethodParameter returnType, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
mavContainer.setRequestHandled(true);
Object result = returnValue;
/**
* Web分页请求的返回按照antd框架要求的格式不转为SuccessData
*/
result = result == null ? new SuccessData(Collections.emptyMap()) : new SuccessData(returnValue);
ServletServerHttpResponse response = new ServletServerHttpResponse(webRequest.getNativeResponse(HttpServletResponse.class));
messageConverter.write(result, new MediaType(MediaType.APPLICATION_JSON, Collections.singletonMap("charset", "utf-8")), response);
}
}

View File

@@ -0,0 +1,104 @@
package {{ .package }}.common.response;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.method.annotation.MapMethodProcessor;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import org.springframework.web.servlet.mvc.method.annotation.ViewNameMethodReturnValueHandler;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@Configuration
@ComponentScan("com.vs.ox")
public class
WebMvcConfiguration extends WebMvcConfigurerAdapter implements ApplicationContextAware {
RequestMappingHandlerAdapter requestMappingHandlerAdapter;
ApplicationContext applicationContext;
void init() {
List<HandlerMethodReturnValueHandler> returnValueHandlers = this.requestMappingHandlerAdapter.getReturnValueHandlers();
Iterator<HandlerMethodReturnValueHandler> iterator = returnValueHandlers.iterator();
List<HandlerMethodReturnValueHandler> newProcessors = new ArrayList<>();
while (iterator.hasNext()) {
HandlerMethodReturnValueHandler next = iterator.next();
//为了能在controller中直接返回map不被默认的MapMethodProcessor拦截
if (next instanceof MapMethodProcessor ||
//为了能在controller中直接返回String不被默认的ViewNameMethodReturnValueHandler拦截
next instanceof ViewNameMethodReturnValueHandler) {
continue;
} else {
newProcessors.add(next);
}
}
this.requestMappingHandlerAdapter.setReturnValueHandlers(newProcessors);
}
@Override
public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
ResponseJsonExceptionResolver responseJsonExceptionResolver = new ResponseJsonExceptionResolver();
try {
responseJsonExceptionResolver.afterPropertiesSet();
} catch (Exception e) {
e.printStackTrace();
}
exceptionResolvers.add(responseJsonExceptionResolver);
}
@Override
public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) {
ResponseJsonMethodReturnValueHandler responseJsonMethodReturnValueHandler = new ResponseJsonMethodReturnValueHandler();
responseJsonMethodReturnValueHandler.afterPropertiesSet();
returnValueHandlers.add(responseJsonMethodReturnValueHandler);
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
@Autowired
private Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder;
@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
ObjectMapper mapper = jackson2ObjectMapperBuilder.build();
DateFormat dateFormat = mapper.getDateFormat();
mapper.setDateFormat(new MyDateFormat(dateFormat));
MappingJackson2HttpMessageConverter mappingJsonpHttpMessageConverter = new MappingJackson2HttpMessageConverter(mapper);
return mappingJsonpHttpMessageConverter;
}
@Bean
ServletContextListener listener1() {
return new ServletContextListener() {
@Override
public void contextInitialized(ServletContextEvent sce) {
requestMappingHandlerAdapter = applicationContext.getBean(RequestMappingHandlerAdapter.class);
init();
ServletContextListener.super.contextInitialized(sce);
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
ServletContextListener.super.contextDestroyed(sce);
}
};
}
}

View File

@@ -0,0 +1,113 @@
package {{ .package }}.common.utils;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.MissingNode;
import com.vs.ox.common.utils.ObjectMapperFactory;
import java.io.IOException;
import java.util.Optional;
public class JsonUtils {
private static final ObjectMapper objectMapper = ObjectMapperFactory.getDefaultObjectMapper();
static {
objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
}
public static ObjectMapper getObjectMapper() {
return objectMapper;
}
public static String toJson(Object value) {
try {
return objectMapper.writeValueAsString(value);
} catch (JsonProcessingException e) {
throw new IllegalStateException("to Json error", e);
}
}
public static <T> T readObject(String json, TypeReference<T> typeReference) {
return readObject(json, objectMapper.getTypeFactory().constructType(typeReference));
}
public static <T> T readObject(String json, Class<T> clazz) {
return readObject(json, objectMapper.getTypeFactory().constructType(clazz));
}
public static <T> T readObject(byte[] json, Class<T> clazz) {
try {
return objectMapper.readValue(json, clazz);
} catch (IOException e) {
throw new IllegalStateException("read Json error", e);
}
}
public static <T> T readObject(String json, JavaType javaType) {
if (isBlank(json)) {
return null;
}
try {
return objectMapper.readValue(json, javaType);
} catch (IOException e) {
throw new IllegalStateException("read Json error", e);
}
}
public static JsonNode path(String json, String path) {
if (isBlank(json)) {
return MissingNode.getInstance();
}
try {
String atPath = path;
if (!path.startsWith("/")) {
atPath = "/" + path;
}
return objectMapper.readTree(json).at(atPath);
} catch (IOException e) {
throw new IllegalStateException("read Json error", e);
}
}
private static boolean isBlank(String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if ((!Character.isWhitespace(str.charAt(i)))) {
return false;
}
}
return true;
}
public static <T> Optional<T> readPath(String json, String path, TypeReference<T> typeReference) {
return readPath(json, path, objectMapper.getTypeFactory().constructType(typeReference));
}
public static <T> Optional<T> readPath(String json, String path, Class<T> clazz) {
JsonNode jsonNode = path(json, path);
if (jsonNode.isMissingNode()) {
return Optional.empty();
}
try {
return Optional.of(objectMapper.treeToValue(jsonNode, clazz));
} catch (JsonProcessingException e) {
throw new IllegalStateException(e);
}
}
public static <T> Optional<T> readPath(String json, String path, JavaType javaType) {
JsonNode jsonNode = path(json, path);
if (jsonNode.isMissingNode()) {
return Optional.empty();
}
return Optional.of(objectMapper.convertValue(jsonNode, javaType));
}
}

View File

@@ -0,0 +1,3 @@
> 本模块存放公共工具类
``` \-- *Util.java
```

View File

@@ -0,0 +1 @@
> 应用入口

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>{{ .groupId }}</groupId>
<artifactId>{{ .artifactId }}-entrance</artifactId>
<version>${revision}</version>
</parent>
<artifactId>{{ .artifactId }}-entrance-mq</artifactId>
<dependencies>
</dependencies>
</project>

View File

@@ -0,0 +1,4 @@
存放消息消费者
```
\-- *Consumer.java
```

View File

@@ -0,0 +1,4 @@
存放DTOConverter
```
\-- *Converter.java
```

View File

@@ -0,0 +1,4 @@
存放DTO
```
\-- *DTO.java
```

View File

@@ -0,0 +1,4 @@
存放工具类
```
\-- *Util.java
```

23
template/entrance/pom.xml Normal file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>{{ .groupId }}</groupId>
<artifactId>{{ .artifactId }}</artifactId>
<version>${revision}</version>
</parent>
<artifactId>{{ .artifactId }}-entrance</artifactId>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>{{ .groupId }}</groupId>
<artifactId>{{ .artifactId }}-common</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
<modules>
<module>mq</module>
<module>web</module>
</modules>
</project>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>{{ .groupId }}</groupId>
<artifactId>{{ .artifactId }}-entrance</artifactId>
<version>${revision}</version>
</parent>
<artifactId>{{ .artifactId }}-entrance-web</artifactId>
<dependencies>
<dependency>
<groupId>{{ .groupId }}</groupId>
<artifactId>{{ .artifactId }}-entrance-mq</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layers>
<enabled>true</enabled>
</layers>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,27 @@
package {{ .package }}.entrance.web;
import com.vs.sqlmapper.spring.DataSourceConfig;
import com.vs.sqlmapper.spring.scan.VSDaoBeanScan;
import com.vs.agent.TocoAgentInitializer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(scanBasePackages = {"{{.groupId}}", "com.vs"})
@VSDaoBeanScan(basePackages = {"com.vs","{{.groupId}}"})
@Import(DataSourceConfig.class)
@MapperScan("{{.groupId}}.**.persist.mapper.mybatis")
@EnableScheduling
public class AppApplication{
public static void main(String[] args) {
SpringApplication application = new SpringApplication(AppApplication.class);
application.addInitializers(new TocoAgentInitializer());
application.run(args);
}
}

View File

@@ -0,0 +1,71 @@
package {{ .package }}.entrance.web.config;
import org.apache.catalina.connector.Connector;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource;
import java.io.IOException;
@Configuration
public class SSLConfig {
@Bean
public ServletWebServerFactory servletContainer(Environment env) {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
// 禁用自动配置的SSL如果存在
tomcat.setRegisterDefaultServlet(false);
if (hasSslConfig(env)) {
tomcat.addAdditionalTomcatConnectors(createSslConnector(env));
}
return tomcat;
}
private boolean hasSslConfig(Environment env) {
return env.containsProperty("ssl_certificate")
&& env.containsProperty("ssl_certificate-private-key");
}
private Connector createSslConnector(Environment env) {
String certPath = env.getProperty("ssl_certificate");
String keyPath = env.getProperty("ssl_certificate-private-key");
String httpsPort = env.getProperty("server.https.port", "8443");
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("https");
connector.setSecure(true);
connector.setPort(Integer.parseInt(httpsPort));
// 明确设置SSL配置
connector.setProperty("SSLEnabled", "true");
connector.setProperty("sslProtocol", "TLS");
connector.setProperty("clientAuth", "false");
connector.setProperty("sslEnabledProtocols", "TLSv1.2,TLSv1.3");
// 处理证书路径
connector.setProperty("certificateFile", extractFilePath(certPath));
connector.setProperty("certificateKeyFile", extractFilePath(keyPath));
return connector;
}
private String extractFilePath(String classpathResource) {
if (classpathResource == null) return null;
if (classpathResource.startsWith("classpath:")) {
String resource = classpathResource.substring("classpath:".length());
try {
return new ClassPathResource(resource).getFile().getAbsolutePath();
} catch (IOException e) {
throw new RuntimeException("Failed to locate SSL certificate file", e);
}
}
return classpathResource;
}
}

View File

@@ -0,0 +1,17 @@
server.port=8082
mock.enabled=true
#datasource
{{- if eq .dbType "oracle" }}
spring.datasource.url=jdbc:oracle:thin:@//{{ .dbHost }}:{{ .dbPort }}/ORCLCDB
{{- else if eq .dbType "postgresql" }}
spring.datasource.url=jdbc:postgresql://{{ .dbHost }}:{{ .dbPort }}/{{ .dbDatabase }}?useUnicode=true&characterEncoding=utf8&autoReconnect=true&stringtype=unspecified
{{- else if eq .dbType "mysql" }}
spring.datasource.url=jdbc:mysql://${DB_HOST:10.0.2.201:3306}/${DB_DATABASE:hande_test}?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
{{- else if eq .dbType "dm"}}
spring.datasource.url=jdbc:dm://${ .dbHost }/${ .dbPort }/SYSDBA?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
{{- end }}
spring.datasource.username=${DB_USER:hande_test_user}
spring.datasource.password=${DB_PASSWORD:Yu0FvhjUQDGdnmm5}
spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource
spring.datasource.tomcat.max-age=3600000

View File

@@ -0,0 +1,17 @@
server.port=8080
#datasource
{{- if eq .dbType "oracle" }}
spring.datasource.url=jdbc:oracle:thin:@//{{ .dbHost }}:{{ .dbPort }}/ORCLCDB
{{- else if eq .dbType "postgresql" }}
spring.datasource.url=jdbc:postgresql://{{ .dbHost }}:{{ .dbPort }}/{{ .dbDatabase }}?useUnicode=true&characterEncoding=utf8&autoReconnect=true&stringtype=unspecified
{{- else if eq .dbType "mysql" }}
spring.datasource.url=jdbc:mysql://${DB_HOST:10.0.2.201:3306}/${DB_DATABASE:hande_test}?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
{{- else if eq .dbType "dm"}}
spring.datasource.url=jdbc:dm://${ .dbHost }/${ .dbPort }/SYSDBA?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
{{- end }}
spring.datasource.username=${DB_USER:hande_test_user}
spring.datasource.password=${DB_PASSWORD:Yu0FvhjUQDGdnmm5}
spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource

View File

@@ -0,0 +1,15 @@
server.port=8080
#datasource
{{- if eq .dbType "oracle" }}
spring.datasource.url=jdbc:oracle:thin:@//{{ .dbHost }}:{{ .dbPort }}/ORCLCDB
{{- else if eq .dbType "postgresql" }}
spring.datasource.url=jdbc:postgresql://{{ .dbHost }}:{{ .dbPort }}/{{ .dbDatabase }}?useUnicode=true&characterEncoding=utf8&autoReconnect=true&stringtype=unspecified
{{- else if eq .dbType "mysql" }}
spring.datasource.url=jdbc:mysql://${DB_HOST:10.0.2.201:3306}/${DB_DATABASE:hande_test}?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
{{- else if eq .dbType "dm"}}
spring.datasource.url=jdbc:dm://${ .dbHost }/${ .dbPort }/SYSDBA?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
{{- end }}
spring.datasource.username=${DB_USER:hande_test_user}
spring.datasource.password=${DB_PASSWORD:Yu0FvhjUQDGdnmm5}
spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource

View File

@@ -0,0 +1,71 @@
spring.profiles.active=local
envs=local,remote,online,custom
check=true
spring.main.allow-bean-definition-overriding=true
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
spring.jpa.open-in-view=false
spring.main.allow-circular-references=true
spring.login.security.csrf=false
application.name={{ .projectName }}
mybatis.configuration.map-underscore-to-camel-case=true
project_id={{ .projectId }}
project_name={{ .projectName }}
base.package={{.groupId}}
{{- if eq .dbType "mysql" }}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
{{- else if eq .dbType "postgresql" }}
spring.datasource.driver-class-name=org.postgresql.Driver
vs.sqlmapper.dialect=postgresql
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
{{- else if eq .dbType "oracle" }}
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
vs.sqlmapper.dialect=oracle
{{- else if eq .dbType "dm" }}
spring.datasource.driver-class-name=dm.jdbc.driver.DmDriver
hibernate.dialect=org.hibernate.dialect.DmDialect
vs.sqlmapper.dialect=dm
{{- end }}
com.toco.agent.attach=false
#create default table
vs.db.basetable.create=true
server.ssl.enabled=false
server.forward-headers-strategy=framework
#request header
out.request.headers=
#response header
out.response.headers=Content-Type
#custom corss-domain headers, split by ','
cross.domain.headers=
#eg:https://vsstudio.teitui.com
out.host=
#hibernate.show_sql=true
#vs.sqlmapper.showSql=true
mock.enabled=false
## message config , use memory for test, mq.type can be redis/rocketmq/kafka
mq.type=memory
#rocketmq.name-server=${ROCKETMQ_HOST:10.0.2.221:9876;10.0.2.222:9876;10.0.2.223:9876}
#redis
#redis-config.pool.hostAndPort=${REDIS_HOST:redis.byteawake.com:6379}
#redis-config.pool.password=${REDIS_PASSWORD:}
#redis-config.pool.maxTotal=100
#redis-config.pool.maxIdle=10
#redis-config.pool.minIdle=10
#redis-config.pool.maxWaitMillis=10000
#redis-config.pool.softMinEvictableIdleTimeMillis=10000
#redis-config.pool.testOnBorrow=true
#redis-config.pool.testOnReturn=true
#redis-config.pool.testWhileIdle=true
#redis-config.pool.timeBetweenEvictionRunsMillis=30000
#redis-config.pool.minEvictableIdleTimeMillis=1800000
#redis-config.pool.numTestsPerEvictionRun=3
#redis-config.pool.blockWhenExhausted=true
#redis-config.pool.jmxEnabled=true
#redis-config.pool.lifo=true
#kafka.bootstrap-servers=localhost:9092

View File

@@ -0,0 +1,26 @@
[debug.server.host]
// 这块,目前基本是写死这样的配置,不要修改
vs.debug.host = http://vsstudio.teitui.com
[debug.proxy.custom]
// 定义需要增强的classs没有增加的class不记录堆栈
// 一般明显不需要记录的class配置成 class.name=false
// 正则表述式支持,请注意书写
// class.pattern = true 表示要增强记录堆栈的
// 自定义的增加的类
com.vs.entrance.controller.env.register.DebugEnvRegisterTask=false
com.vs.common.util.rpc.pub.PublicInterfaceExecutor = true +[execute]
com.vs.common.util.rpc.pub.PublicInterfaceFilter = true +[doFilter]
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter=true
com.vs.sqlmapper.core.SqlManagerImpl = true +[sqlWatcher]
com.vs.common.util.rpc.RpcMethodExecutor = true
[debug.proxy.service]
// 默认支持serivce下面的所有类放到最后一行
.*?\.service[\.\w_]+ = true -[set*, get*]
.*?\.controller[\.\w_]+ = true -[set*, get*]
.*?\.hibernate[\.\w_]+ = false

View File

@@ -0,0 +1 @@

308
template/mvnw vendored Executable file
View File

@@ -0,0 +1,308 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Apache Maven Wrapper startup batch script, version 3.2.0
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /usr/local/etc/mavenrc ] ; then
. /usr/local/etc/mavenrc
fi
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "$(uname)" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
else
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=$(java-config --jre-home)
fi
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
[ -n "$CLASSPATH" ] &&
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="$(which javac)"
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=$(which readlink)
if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
if $darwin ; then
javaHome="$(dirname "\"$javaExecutable\"")"
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
else
javaExecutable="$(readlink -f "\"$javaExecutable\"")"
fi
javaHome="$(dirname "\"$javaExecutable\"")"
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=$(cd "$wdir/.." || exit 1; pwd)
fi
# end of workaround
done
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
# Remove \r in case we run on Windows within Git Bash
# and check out the repository with auto CRLF management
# enabled. Otherwise, we may read lines that are delimited with
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
# splitting rules.
tr -s '\r\n' ' ' < "$1"
fi
}
log() {
if [ "$MVNW_VERBOSE" = true ]; then
printf '%s\n' "$1"
fi
}
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
log "$MAVEN_PROJECTBASEDIR"
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
if [ -r "$wrapperJarPath" ]; then
log "Found $wrapperJarPath"
else
log "Couldn't find $wrapperJarPath, downloading it ..."
if [ -n "$MVNW_REPOURL" ]; then
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
else
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
fi
while IFS="=" read -r key value; do
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
safeValue=$(echo "$value" | tr -d '\r')
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
esac
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
log "Downloading from: $wrapperUrl"
if $cygwin; then
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
fi
if command -v wget > /dev/null; then
log "Found wget ... using wget"
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
else
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
log "Found curl ... using curl"
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
else
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
fi
else
log "Falling back to using Java to download"
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaSource=$(cygpath --path --windows "$javaSource")
javaClass=$(cygpath --path --windows "$javaClass")
fi
if [ -e "$javaSource" ]; then
if [ ! -e "$javaClass" ]; then
log " - Compiling MavenWrapperDownloader.java ..."
("$JAVA_HOME/bin/javac" "$javaSource")
fi
if [ -e "$javaClass" ]; then
log " - Running MavenWrapperDownloader.java ..."
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
wrapperSha256Sum=""
while IFS="=" read -r key value; do
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
esac
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
if [ -n "$wrapperSha256Sum" ]; then
wrapperSha256Result=false
if command -v sha256sum > /dev/null; then
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
wrapperSha256Result=true
fi
elif command -v shasum > /dev/null; then
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
wrapperSha256Result=true
fi
else
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
exit 1
fi
if [ $wrapperSha256Result = false ]; then
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
exit 1
fi
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
[ -n "$CLASSPATH" ] &&
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
# shellcheck disable=SC2086 # safe args
exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

205
template/mvnw.cmd vendored Executable file
View File

@@ -0,0 +1,205 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Apache Maven Wrapper startup batch script, version 3.2.0
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %WRAPPER_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
SET WRAPPER_SHA_256_SUM=""
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
)
IF NOT %WRAPPER_SHA_256_SUM%=="" (
powershell -Command "&{"^
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
" exit 1;"^
"}"^
"}"
if ERRORLEVEL 1 goto error
)
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%

317
template/pom.xml Normal file
View File

@@ -0,0 +1,317 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.18</version>
<relativePath/>
</parent>
<groupId>{{ .groupId }}</groupId>
<artifactId>{{ .artifactId }}</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>3.0-SNAPSHOT</revision>
{{- if eq .dbType "dm" }}
<dm.driver.version>18</dm.driver.version>
<db.hiernate.dialect.version>8.1.3.140</db.hiernate.dialect.version>
{{- end }}
</properties>
<dependencies>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.4</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20170516</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>4.1.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.3.14</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.3.14</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>2.7.18</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.14</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.1.6.Final</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.4</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.6.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>
<version>4.0.63</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.5.7.Final</version>
</dependency>
<dependency>
<groupId>io.github.think-1024</groupId>
<artifactId>toco-all-spring5-springboot2-community</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>9.0.56</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>9.0.56</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.7</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
<version>2.12.3</version>
</dependency>
{{- if eq .dbType "dm" }}
<dependency>
<groupId>dm</groupId>
<artifactId>DmJdbcDriver</artifactId>
<version>18</version>
</dependency>
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmDialect-for-hibernate5.6</artifactId>
<version>8.1.3.140</version>
</dependency>
{{- else if eq .dbType "mysql" }}
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.27</version>
</dependency>
{{- else if eq .dbType "postgresql" }}
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.6.2</version>
</dependency>
{{- else if eq .dbType "oracle" }}
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
{{- end }}
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>enforce</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[11.0,21.0)</version>
</requireJavaVersion>
<requireMavenVersion>
<version>3.8</version>
</requireMavenVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>entrance</module>
<module>common</module>
</modules>
</project>

3
template/project Normal file
View File

@@ -0,0 +1,3 @@
id={{ .projectId }}
name={{ .projectName | replace "-" "_" }}
version={{ .vsVersion }}

4
template/run.bat Executable file
View File

@@ -0,0 +1,4 @@
@echo off
cd /d %~dp0
.\mvnw.cmd -Dstyle.color=always spring-boot:run %*

5
template/run.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
cd $(dirname $0)
./mvnw -Dstyle.color=always spring-boot:run $@

33
values.yml Normal file
View File

@@ -0,0 +1,33 @@
projectName: test_horsepower1
groupId: com.test_horsepower1
artifactId: '{{ .projectName | replace "-" "_" }}'
applicationName: "{{ .projectName }}-server"
version: 1.0-SNAPSHOT
vsVersion: 1.0.0
projectId: 3fdc654b-feb2-4d4a-be19-e9ca2998b5d6
dbType: mysql
dbHost: 10.0.2.201
dbPort: 3306
package: "{{ .groupId }}.{{ .artifactId }}"
packagePath: '{{ .package | replace "." "/" }}'
dbDatabase: '{{ .projectName | replace "-" "_" }}'
dbUser: '{{ .projectName | replace "-" "_" }}_user'
dbPassword: "{{ randAlphaNum 16 }}"
rocketmq_address: "10.0.2.221:9876;10.0.2.222:9876;10.0.2.223:9876"
rocketmq_topic: '{{ .projectName | replace "-" "_" }}'
rocketmq_consumerGroup: "CID_{{ .artifactId }}"
rocketmq_producerGroup: "PID_{{ .artifactId }}"
elasticsearch_host: "10.0.2.221,10.0.2.222,10.0.2.223"
elasticsearch_port: "9200"
elasticsearch_scheme: "https"
elasticsearch_username: "admin"
elasticsearch_password: "dnZkaNVK"
xxljob_address: "https://xxljob.teitui.com/xxl-job-admin"
xxljob_username: "admin"
xxljob_password: "123456"
xxljob_accessToken: "default_token"
redis_address: "redis.byteawake.com:6379"
redis_password: ""
redis_maxTotal: 100
redis_maxIdle: 10
redis_minIdle: 10