Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
architecture
/
glsx-archetype
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 74a708c9
authored
Apr 10, 2023
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
整理框架-elasticjob高版本(apache)
1 parent
45f3a9c5
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
141 additions
and
518 deletions
glsx-archetype-parent/rest-admin-job-archetype/pom.xml
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/pom.xml
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/java/cn/com/glsx/vasp/modules/entity/User.java
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/java/cn/com/glsx/vasp/modules/mapper/UserMapper.java
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/java/cn/com/glsx/vasp/modules/model/UserSearch.java
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/java/cn/com/glsx/vasp/modules/repository/IUserRepository.java
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/resources/config/generatorConfig.xml
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/resources/mapper/UserMapper.xml
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/pom.xml
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/Application.java
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/common/constant/Constants.java
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/common/exception/AdminException.java
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/common/exception/AdminExceptionHandler.java
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/modules/job/MySimpleJob.java → glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/modules/job/RestSimpleJob.java
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/modules/service/MySimpleJobService.java → glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/modules/service/RestSimpleJobService.java
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/resources/bootstrap.properties
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/test/java/cn/com/glsx/DemoApplicationTests.java
rest-archetype-framework/rest-admin-cache/pom.xml
rest-archetype-framework/rest-admin-cache/src/main/java/com/glsx/plat/cache/CacheConfig.java
rest-archetype-framework/rest-admin-cache/src/main/java/com/glsx/plat/constant/CacheNameTimeConstant.java
rest-archetype-framework/rest-admin-dubbo/pom.xml
rest-archetype-framework/rest-admin-elasticjob/pom.xml
rest-archetype-framework/rest-admin-elasticjob/src/main/java/com/glsx/plat/job/config/ElasticJobConfig.java
rest-archetype-framework/rest-admin-elasticjob/src/main/java/com/glsx/plat/job/config/ZookepeerConfig.java
glsx-archetype-parent/rest-admin-job-archetype/pom.xml
View file @
74a708c
...
@@ -9,15 +9,14 @@
...
@@ -9,15 +9,14 @@
<relativePath/>
<relativePath/>
</parent>
</parent>
<artifactId>
glsx-
rest-admin-job-archetype
</artifactId>
<artifactId>
rest-admin-job-archetype
</artifactId>
<version>
1
.0-SNAPSHOT
</version>
<version>
2.0
.0-SNAPSHOT
</version>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<description>
Microservice Scaffolding project for Spring Boot
</description>
<description>
Microservice Scaffolding project for Spring Boot
</description>
<modules>
<modules>
<module>
glsx-rest-admin-job
</module>
<module>
rest-admin-job
</module>
<module>
glsx-rest-admin-job-dao
</module>
</modules>
</modules>
<properties>
<properties>
...
@@ -25,46 +24,8 @@
...
@@ -25,46 +24,8 @@
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
<maven.compiler.target>
1.8
</maven.compiler.target>
<spring-cloud.version>
Hoxton.SR9
</spring-cloud.version>
<spring-cloud-alibaba.version>
2.2.6.RELEASE
</spring-cloud-alibaba.version>
<rest-admin-framework.version>
2.0.0-SNAPSHOT
</rest-admin-framework.version>
<!-- <repo.internal.snapshots.url>https://repo1.maven.org/maven2</repo.internal.snapshots.url>-->
<!-- <repo.internal.releases.url>https://repo1.maven.org/maven2</repo.internal.releases.url>-->
<!-- <repo.proxy.url>https://repo1.maven.org/maven2</repo.proxy.url>-->
<!-- <repo.external.url>https://repo1.maven.org/maven2</repo.external.url>-->
</properties>
</properties>
<dependencies>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
${spring-cloud.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<!--spring cloud alibaba-->
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-alibaba-dependencies
</artifactId>
<version>
${spring-cloud-alibaba.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<!--rest-admin-framework-->
<dependency>
<groupId>
com.glsx
</groupId>
<artifactId>
rest-admin-framework-dependencies
</artifactId>
<version>
${rest-admin-framework.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<build>
<resources>
<resources>
<resource>
<resource>
...
@@ -80,48 +41,5 @@
...
@@ -80,48 +41,5 @@
</includes>
</includes>
</resource>
</resource>
</resources>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-archetype-plugin
</artifactId>
<version>
3.1.2
</version>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.6.1
</version>
<configuration>
<encoding>
utf-8
</encoding>
<source>
1.8
</source>
<target>
1.8
</target>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-resources-plugin
</artifactId>
<version>
3.0.2
</version>
<configuration>
<encoding>
UTF-8
</encoding>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-war-plugin
</artifactId>
<version>
3.2.3
</version>
<configuration>
<failOnMissingWebXml>
false
</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<classifier>
exec
</classifier>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</build>
</project>
</project>
\ No newline at end of file
\ No newline at end of file
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/pom.xml
deleted
100644 → 0
View file @
45f3a9c
<?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"
>
<parent>
<artifactId>
glsx-rest-admin-job-archetype
</artifactId>
<groupId>
com.glsx
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
<artifactId>
glsx-rest-admin-job-dao
</artifactId>
<dependencies>
<dependency>
<groupId>
com.glsx
</groupId>
<artifactId>
rest-admin-mybatis
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<!--mybatis 逆向生成插件-->
<plugin>
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-maven-plugin
</artifactId>
<version>
1.3.7
</version>
<dependencies>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
${mysql.version}
</version>
</dependency>
<dependency>
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-core
</artifactId>
<version>
1.3.7
</version>
</dependency>
<dependency>
<groupId>
tk.mybatis
</groupId>
<artifactId>
mapper
</artifactId>
<version>
3.4.1
</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>
Generate MyBatis Artifacts
</id>
<!-- <phase>package</phase>-->
<phase>
deploy
</phase>
<goals>
<goal>
generate
</goal>
</goals>
</execution>
</executions>
<configuration>
<!--允许移动生成的文件 -->
<verbose>
true
</verbose>
<!-- 是否覆盖 -->
<overwrite>
true
</overwrite>
<!-- 自动生成的配置 -->
<configurationFile>
src/main/resources/config/generatorConfig.xml
</configurationFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
\ No newline at end of file
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/java/cn/com/glsx/vasp/modules/entity/User.java
deleted
100644 → 0
View file @
45f3a9c
package
cn
.
com
.
glsx
.
admin
.
modules
.
entity
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.glsx.plat.mybatis.base.BaseEntity
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
@Accessors
(
chain
=
true
)
@Data
@Entity
@Table
(
name
=
"t_user"
)
public
class
User
extends
BaseEntity
{
/**
* 帐号
*/
@Column
(
name
=
"account"
,
length
=
64
)
private
String
account
;
/**
* 密码
*/
@JsonIgnore
@Column
(
name
=
"password"
,
length
=
128
)
private
String
password
;
/**
* 用户名
*/
@Column
(
name
=
"username"
,
length
=
64
)
private
String
username
;
/**
* (真实)姓名
*/
@Column
(
name
=
"realname"
,
length
=
64
)
private
String
realname
;
/**
* 手机号
*/
@Column
(
name
=
"phone"
,
length
=
20
)
private
String
phone
;
/**
* 头像链接
*/
@Column
(
name
=
"avatar"
,
length
=
150
)
private
String
avatar
;
/**
* 加密盐
*/
private
String
salt
;
}
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/java/cn/com/glsx/vasp/modules/mapper/UserMapper.java
deleted
100644 → 0
View file @
45f3a9c
package
cn
.
com
.
glsx
.
admin
.
modules
.
mapper
;
import
cn.com.glsx.admin.modules.entity.User
;
import
cn.com.glsx.admin.modules.model.UserSearch
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
@Mapper
public
interface
UserMapper
extends
CommonBaseMapper
<
User
>
{
List
<
User
>
selectList
(
UserSearch
search
);
User
selectByPhone
(
String
phone
);
void
logicDeleteById
(
Long
id
);
}
\ No newline at end of file
\ No newline at end of file
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/java/cn/com/glsx/vasp/modules/model/UserSearch.java
deleted
100644 → 0
View file @
45f3a9c
package
cn
.
com
.
glsx
.
admin
.
modules
.
model
;
import
cn.hutool.db.Page
;
import
lombok.Data
;
/**
* @author payu
*/
@Data
public
class
UserSearch
extends
Page
{
private
String
term
;
}
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/java/cn/com/glsx/vasp/modules/repository/IUserRepository.java
deleted
100644 → 0
View file @
45f3a9c
//package com.glsx.vasp.modules.repository;
//
//import com.glsx.vasp.modules.entity.User;
//import java.io.Serializable;
//
///**
// * UserRepository JPA
// */
//public interface IUserRepository extends BaseRepository<User, Long>, Serializable {
//
// User findByUsername(String username);
//
//}
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/resources/config/generatorConfig.xml
deleted
100644 → 0
View file @
45f3a9c
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE generatorConfiguration PUBLIC
"-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<!-- 配置生成器 -->
<generatorConfiguration>
<!--classPathEntry:数据库的JDBC驱动,换成你自己的驱动位置 可选 -->
<!-- <classPathEntry location="F://jdbc//mysql-connector-java-8.0.18.jar"/>-->
<!-- 一个数据库一个context -->
<context
id=
"DB2Tables"
targetRuntime=
"Mybatis3"
>
<!-- 自动识别数据库关键字,默认false,如果设置为true,根据SqlReservedWords中定义的关键字列表;一般保留默认值,遇到数据库关键字(Java关键字),使用columnOverride覆盖 -->
<property
name=
"autoDelimitKeywords"
value=
"true"
/>
<!-- 生成的Java文件的编码 -->
<property
name=
"javaFileEncoding"
value=
"utf-8"
/>
<!-- beginningDelimiter和endingDelimiter:指明数据库的用于标记数据库对象名的符号,比如ORACLE就是双引号,MYSQL默认是`反引号; -->
<property
name=
"beginningDelimiter"
value=
"`"
/>
<property
name=
"endingDelimiter"
value=
"`"
/>
<!-- 格式化java代码 -->
<property
name=
"javaFormatter"
value=
"org.mybatis.generator.api.dom.DefaultJavaFormatter"
/>
<!-- 格式化XML代码 -->
<property
name=
"xmlFormatter"
value=
"org.mybatis.generator.api.dom.DefaultXmlFormatter"
/>
<plugin
type=
"org.mybatis.generator.plugins.SerializablePlugin"
/>
<plugin
type=
"org.mybatis.generator.plugins.ToStringPlugin"
/>
<!-- 配置 tk.mybatis 插件 -->
<plugin
type=
"tk.mybatis.mapper.generator.MapperPlugin"
>
<property
name=
"mappers"
value=
"com.glsx.plat.mybatis.mapper.CommonBaseMapper"
/>
</plugin>
<!--配置生成注释信息,最多配置一个 -->
<commentGenerator>
<!-- 阻止生成注释包含时间戳 默认为false -->
<property
name=
"suppressDate"
value=
"true"
/>
<!-- 注释是否添加数据库表的备注信息 默认为false -->
<property
name=
"addRemarkComments"
value=
"true"
/>
</commentGenerator>
<!-- jdbc连接-->
<jdbcConnection
driverClass=
"com.mysql.cj.jdbc.Driver"
connectionURL=
"jdbc:mysql://192.168.3.222:3307/newgps?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true"
userId=
"root"
password=
"Msd^*$@online"
>
<!--防止生成其他库同名表-->
<property
name=
"nullCatalogMeansCurrent"
value=
"true"
/>
</jdbcConnection>
<!-- 类型转换 -->
<javaTypeResolver>
<!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) -->
<property
name=
"forceBigDecimals"
value=
"false"
/>
</javaTypeResolver>
<!-- 生成实体类地址 -->
<javaModelGenerator
targetPackage=
"cn.com.glsx.admin.modules.entity"
targetProject=
"src/main/java"
>
<!-- 是否让schema作为包的后缀 -->
<property
name=
"enableSubPackages"
value=
"true"
/>
<!-- 从数据库返回的值去掉前后空格 -->
<property
name=
"trimStrings"
value=
"true"
/>
</javaModelGenerator>
<!-- 生成mapper.xml文件存放地址 -->
<sqlMapGenerator
targetPackage=
"mapper"
targetProject=
"src/main/resources"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
</sqlMapGenerator>
<!-- 生成接口dao type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象 type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象 type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 -->
<javaClientGenerator
targetPackage=
"cn.com.glsx.admin.modules.mapper"
targetProject=
"src/main/java"
type=
"XMLMAPPER"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
</javaClientGenerator>
<!-- table可以有多个,每个数据库中的表都可以写一个table,tableName表示要匹配的数据库表,也可以在tableName属性中通过使用%通配符来匹配所有数据库表,只有匹配的表才会自动生成文件 enableSelectByPrimaryKey相应的配置表示是否生成相应的接口 -->
<table
tableName=
"smart_devide_status"
domainObjectName=
"DeviceStatus"
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
selectByExampleQueryId=
"false"
/>
</context>
</generatorConfiguration>
\ No newline at end of file
\ No newline at end of file
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job-dao/src/main/resources/mapper/UserMapper.xml
deleted
100644 → 0
View file @
45f3a9c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.com.glsx.vasp.modules.mapper.UserMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.vasp.modules.entity.User"
>
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"phone"
jdbcType=
"VARCHAR"
property=
"phone"
/>
<result
column=
"wx_openid"
jdbcType=
"VARCHAR"
property=
"wxOpenid"
/>
<result
column=
"mini_openid"
jdbcType=
"VARCHAR"
property=
"miniOpenid"
/>
<result
column=
"enable_status"
jdbcType=
"TINYINT"
property=
"enableStatus"
/>
<result
column=
"delete_status"
jdbcType=
"TINYINT"
property=
"deleteStatus"
/>
<result
column=
"created_date"
jdbcType=
"TIMESTAMP"
property=
"createdDate"
/>
<result
column=
"updated_date"
jdbcType=
"TIMESTAMP"
property=
"updatedDate"
/>
</resultMap>
<select
id=
"selectList"
resultMap=
"BaseResultMap"
>
select * from t_user
</select>
<select
id=
"selectByPhone"
parameterType=
"java.lang.String"
resultMap=
"BaseResultMap"
>
select * from t_user where phone = #{phone}
</select>
<update
id=
"logicDeleteById"
parameterType=
"java.lang.Long"
>
update t_user set delete_status = -1 where id = #{id}
</update>
</mapper>
\ No newline at end of file
\ No newline at end of file
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/pom.xml
View file @
74a708c
...
@@ -11,37 +11,38 @@
...
@@ -11,37 +11,38 @@
<packaging>
war
</packaging>
<packaging>
war
</packaging>
<description>
Microservice Scaffolding Project Base on Spring Cloud
</description>
<description>
Microservice Scaffolding Project Base on Spring Cloud
</description>
<artifactId>
glsx-
rest-admin-job
</artifactId>
<artifactId>
rest-admin-job
</artifactId>
<dependencies>
<dependencies>
<!-- 运行环境上下文 -->
<dependency>
<groupId>
com.glsx
</groupId>
<artifactId>
rest-admin-context
</artifactId>
<exclusions>
<exclusion>
<artifactId>
checker-qual
</artifactId>
<groupId>
org.checkerframework
</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- 接入微服务组件联盟 配置、注册、网关、链路、监控等 ,单体应用无需引入(logback-spring.xml与logstash相关内容需要注释掉)-->
<!-- 接入微服务组件联盟 配置、注册、网关、链路、监控等 ,单体应用无需引入(logback-spring.xml与logstash相关内容需要注释掉)-->
<dependency>
<dependency>
<groupId>
com.glsx
</groupId>
<groupId>
com.glsx
</groupId>
<artifactId>
rest-admin-alliance
</artifactId>
<artifactId>
rest-admin-alliance
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.glsx
</groupId>
<groupId>
com.glsx
</groupId>
<artifactId>
rest-admin-elasticjob
</artifactId>
<artifactId>
rest-admin-elasticjob
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.apache.zookeeper
</groupId>
<artifactId>
zookeeper
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<!-- dao示例 -->
<dependency>
<dependency>
<groupId>
com.glsx
</groupId>
<groupId>
org.apache.zookeeper
</groupId>
<artifactId>
rest-admin-job-dao
</artifactId>
<artifactId>
zookeeper
</artifactId>
<version>
2.0.0-SNAPSHOT
</version>
<version>
3.5.8
</version>
<exclusions>
<exclusion>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
</exclusion>
<exclusion>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
\ No newline at end of file
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/Application.java
View file @
74a708c
...
@@ -3,9 +3,9 @@ package cn.com.glsx;
...
@@ -3,9 +3,9 @@ package cn.com.glsx;
import
com.glsx.plat.context.EnableRestAdmin
;
import
com.glsx.plat.context.EnableRestAdmin
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration
;
import
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.context.annotation.EnableMBeanExport
;
import
org.springframework.jmx.support.RegistrationPolicy
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
...
@@ -20,8 +20,7 @@ import static java.util.TimeZone.getTimeZone;
...
@@ -20,8 +20,7 @@ import static java.util.TimeZone.getTimeZone;
@EnableRestAdmin
@EnableRestAdmin
@EnableDiscoveryClient
@EnableDiscoveryClient
@EnableTransactionManagement
@EnableTransactionManagement
@EnableMBeanExport
(
registration
=
RegistrationPolicy
.
IGNORE_EXISTING
)
@SpringBootApplication
(
exclude
=
{
MongoAutoConfiguration
.
class
,
MongoDataAutoConfiguration
.
class
})
@SpringBootApplication
(
scanBasePackages
=
{
"cn.com.glsx"
})
public
class
Application
{
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/common/constant/Constants.java
View file @
74a708c
...
@@ -11,8 +11,6 @@ import com.glsx.plat.core.constant.BasicConstants;
...
@@ -11,8 +11,6 @@ import com.glsx.plat.core.constant.BasicConstants;
*/
*/
public
final
class
Constants
extends
BasicConstants
{
public
final
class
Constants
extends
BasicConstants
{
public
final
static
String
SERVER_NAME
=
"glsx_rest_admin"
;
public
final
static
String
SERVER_NAME
=
"rest-admin-job"
;
}
}
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/common/exception/AdminException.java
deleted
100644 → 0
View file @
45f3a9c
package
cn
.
com
.
glsx
.
scheduler
.
common
.
exception
;
import
com.glsx.plat.exception.SystemMessage
;
import
lombok.Getter
;
import
lombok.Setter
;
/**
* @author payu
*/
@Setter
@Getter
public
class
AdminException
extends
RuntimeException
{
private
int
errorCode
;
public
AdminException
()
{
}
public
AdminException
(
String
message
)
{
super
(
message
);
}
public
AdminException
(
int
errorCode
,
String
message
)
{
super
(
message
);
this
.
errorCode
=
errorCode
;
}
public
AdminException
of
(
SystemMessage
message
)
{
return
new
AdminException
(
message
.
getCode
(),
message
.
getMsg
());
}
public
AdminException
(
Throwable
cause
)
{
super
(
cause
);
}
public
AdminException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
}
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/common/exception/AdminExceptionHandler.java
deleted
100644 → 0
View file @
45f3a9c
package
cn
.
com
.
glsx
.
scheduler
.
common
.
exception
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.exception.ExceptionLevel
;
import
com.glsx.plat.exception.GlobalExceptionHandler
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.binding.BindingException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
/**
* 全局异常处理
*
* @author payu
*/
@Slf4j
@RestControllerAdvice
public
class
AdminExceptionHandler
extends
GlobalExceptionHandler
{
@ExceptionHandler
(
AdminException
.
class
)
public
R
handleAdminException
(
AdminException
e
)
{
return
R
.
error
(
e
.
getMessage
());
}
/**
* 引入Feign服务的话
*
* @param e
* @return
*/
// @ExceptionHandler(FeignException.class)
// public R handleFeignException(FeignException e) {
// return R.error(e.status(), e.getMessage());
// }
/**
* Mybatis BindingException
*
* @param e
* @return
*/
@ExceptionHandler
(
BindingException
.
class
)
public
R
handleBindingException
(
BindingException
e
)
{
return
R
.
error
(
e
.
getMessage
());
}
@Override
protected
void
saveException
(
Exception
e
,
ExceptionLevel
level
)
{
super
.
saveException
(
e
,
level
);
}
}
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/modules/job/
My
SimpleJob.java
→
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/modules/job/
Rest
SimpleJob.java
View file @
74a708c
package
cn
.
com
.
glsx
.
scheduler
.
modules
.
job
;
package
cn
.
com
.
glsx
.
scheduler
.
modules
.
job
;
import
cn.com.glsx.scheduler.modules.service.MySimpleJobService
;
import
cn.com.glsx.scheduler.modules.service.RestSimpleJobService
;
import
com.dangdang.ddframe.job.api.ShardingContext
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob
;
import
com.glsx.plat.common.utils.DateUtils
;
import
com.glsx.plat.common.utils.DateUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.shardingsphere.elasticjob.api.ShardingContext
;
import
org.apache.shardingsphere.elasticjob.simple.job.SimpleJob
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -13,11 +12,10 @@ import java.util.Date;
...
@@ -13,11 +12,10 @@ import java.util.Date;
@Slf4j
@Slf4j
@Component
@Component
@ElasticSimpleJob
(
jobName
=
"MySimpleJob"
,
cron
=
"0/30 * * * * ?"
)
public
class
RestSimpleJob
implements
SimpleJob
{
public
class
MySimpleJob
implements
SimpleJob
{
@Autowired
@Autowired
private
My
SimpleJobService
simpleJobService
;
private
Rest
SimpleJobService
simpleJobService
;
@Override
@Override
public
void
execute
(
ShardingContext
shardingContext
)
{
public
void
execute
(
ShardingContext
shardingContext
)
{
...
...
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/modules/service/
My
SimpleJobService.java
→
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/java/cn/com/glsx/scheduler/modules/service/
Rest
SimpleJobService.java
View file @
74a708c
package
cn
.
com
.
glsx
.
scheduler
.
modules
.
service
;
package
cn
.
com
.
glsx
.
scheduler
.
modules
.
service
;
import
cn.com.glsx.admin.modules.mapper.UserMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
/**
/**
...
@@ -9,10 +7,7 @@ import org.springframework.stereotype.Service;
...
@@ -9,10 +7,7 @@ import org.springframework.stereotype.Service;
* @date 2021年01月26日 下午2:37:40
* @date 2021年01月26日 下午2:37:40
*/
*/
@Service
@Service
public
class
MySimpleJobService
{
public
class
RestSimpleJobService
{
@Autowired
private
UserMapper
userMapper
;
public
void
simpleJob
(
String
name
)
{
public
void
simpleJob
(
String
name
)
{
System
.
out
.
println
(
"呼叫:"
+
name
);
System
.
out
.
println
(
"呼叫:"
+
name
);
...
...
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/main/resources/bootstrap.properties
View file @
74a708c
#项目名称
#项目名称
spring.application.name
=
glsx-
rest-admin-job
spring.application.name
=
rest-admin-job
#日志路径(logback-spring.xml读取,不要加入配置中心)
#日志路径(logback-spring.xml读取,不要加入配置中心)
logging.path
=
/data/java_log/jetty/${spring.application.name}/${spring.application.name}.log
logging.path
=
/data/java_log/jetty/${spring.application.name}/${spring.application.name}.log
#nacos配置中心
#nacos配置中心
spring.cloud.nacos.config.server-
addr
=
192.168.0.63:88
4
8
spring.cloud.nacos.config.server-
addr
=
192.168.0.63:88
6
8
#nacos配置id,完整dataId=${spring.cloud.nacos.config.prefix}-${spring.profiles.active}.${file-extension(由新增配置时选的文件类型决定)}
#nacos配置id,完整dataId=${spring.cloud.nacos.config.prefix}-${spring.profiles.active}.${file-extension(由新增配置时选的文件类型决定)}
#示例:http://192.168.0.63:8848/nacos/v1/cs/configs?dataId=glsx-rest-admin.properties&group=DEV_GROUP
#示例:http://192.168.0.63:8848/nacos/v1/cs/configs?dataId=glsx-rest-admin.properties&group=DEV_GROUP
spring.cloud.nacos.config.group
=
DEV
_GROUP
spring.cloud.nacos.config.group
=
ARCHETYPE
_GROUP
#配置prefix,默认值同${spring.application.name}
#配置prefix,默认值同${spring.application.name}
spring.cloud.nacos.config.prefix
=
${spring.application.name}
spring.cloud.nacos.config.prefix
=
${spring.application.name}
#配置开发环境
#配置开发环境
...
@@ -18,11 +18,11 @@ spring.profiles.active=dev
...
@@ -18,11 +18,11 @@ spring.profiles.active=dev
spring.cloud.nacos.config.file-
extension
=
properties
spring.cloud.nacos.config.file-
extension
=
properties
#微服务sentinel、zipkin、actuator等公共配置
#微服务sentinel、zipkin、actuator等公共配置
spring.cloud.nacos.config.shared-configs[0].data-
id
=
glsx-
rest-microservice-share.properties
spring.cloud.nacos.config.shared-configs[0].data-
id
=
rest-microservice-share.properties
spring.cloud.nacos.config.shared-configs[0]
.group
=
DEV
_GROUP
spring.cloud.nacos.config.shared-configs[0]
.group
=
ARCHETYPE
_GROUP
spring.cloud.nacos.config.shared-configs[0]
.refresh
=
true
spring.cloud.nacos.config.shared-configs[0]
.refresh
=
true
#数据库、redis等公共配置
#数据库、redis等公共配置
spring.cloud.nacos.config.shared-configs[1]
.group
=
DEV
_GROUP
spring.cloud.nacos.config.shared-configs[1]
.group
=
ARCHETYPE
_GROUP
spring.cloud.nacos.config.shared-configs[1].data-
id
=
glsx-rest-admin-share
.properties
spring.cloud.nacos.config.shared-configs[1].data-
id
=
rest-admin-share-dev
.properties
spring.cloud.nacos.config.shared-configs[1]
.refresh
=
true
spring.cloud.nacos.config.shared-configs[1]
.refresh
=
true
\ No newline at end of file
\ No newline at end of file
glsx-archetype-parent/rest-admin-job-archetype/rest-admin-job/src/test/java/cn/com/glsx/DemoApplicationTests.java
View file @
74a708c
package
cn
.
com
.
glsx
;
package
cn
.
com
.
glsx
;
import
cn.com.glsx.scheduler.modules.service.
My
SimpleJobService
;
import
cn.com.glsx.scheduler.modules.service.
Rest
SimpleJobService
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -12,11 +12,11 @@ import org.springframework.test.context.junit4.SpringRunner;
...
@@ -12,11 +12,11 @@ import org.springframework.test.context.junit4.SpringRunner;
public
class
DemoApplicationTests
{
public
class
DemoApplicationTests
{
@Autowired
@Autowired
private
MySimpleJobService
my
SimpleJobService
;
private
RestSimpleJobService
rest
SimpleJobService
;
@Test
@Test
public
void
testJob
()
{
public
void
testJob
()
{
my
SimpleJobService
.
simpleJob
(
"13800138000"
);
rest
SimpleJobService
.
simpleJob
(
"13800138000"
);
}
}
}
}
\ No newline at end of file
\ No newline at end of file
rest-archetype-framework/rest-admin-cache/pom.xml
View file @
74a708c
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
<dependency>
<dependency>
<groupId>
com.github.ben-manes.caffeine
</groupId>
<groupId>
com.github.ben-manes.caffeine
</groupId>
<artifactId>
caffeine
</artifactId>
<artifactId>
caffeine
</artifactId>
<version>
3.1.1
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
rest-archetype-framework/rest-admin-cache/src/main/java/com/glsx/plat/cache/CacheConfig.java
0 → 100644
View file @
74a708c
package
com
.
glsx
.
plat
.
cache
;
import
com.github.benmanes.caffeine.cache.Caffeine
;
import
com.glsx.plat.constant.CacheNameTimeConstant
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.caffeine.CaffeineCache
;
import
org.springframework.cache.support.SimpleCacheManager
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
@Configuration
public
class
CacheConfig
{
@Bean
public
CacheManager
caffeineCacheManager
()
{
SimpleCacheManager
cacheManager
=
new
SimpleCacheManager
();
List
<
CaffeineCache
>
caches
=
new
ArrayList
<>();
caches
.
add
(
new
CaffeineCache
(
CacheNameTimeConstant
.
CACHE_5SECS
,
Caffeine
.
newBuilder
().
expireAfterWrite
(
5
,
TimeUnit
.
SECONDS
).
build
()));
caches
.
add
(
new
CaffeineCache
(
CacheNameTimeConstant
.
CACHE_10SECS
,
Caffeine
.
newBuilder
().
expireAfterWrite
(
10
,
TimeUnit
.
SECONDS
).
build
()));
caches
.
add
(
new
CaffeineCache
(
CacheNameTimeConstant
.
CACHE_30SECS
,
Caffeine
.
newBuilder
().
expireAfterWrite
(
30
,
TimeUnit
.
SECONDS
).
build
()));
cacheManager
.
setCaches
(
caches
);
return
cacheManager
;
}
}
rest-archetype-framework/rest-admin-cache/src/main/java/com/glsx/plat/constant/CacheNameTimeConstant.java
0 → 100644
View file @
74a708c
package
com
.
glsx
.
plat
.
constant
;
public
interface
CacheNameTimeConstant
{
String
CACHE_DEFAULT
=
"CACHE_DEFAULT"
;
String
CACHE_10SECS
=
"CACHE_10SECS"
;
String
CACHE_5SECS
=
"CACHE_5SECS"
;
String
CACHE_30SECS
=
"CACHE_30SECS"
;
String
CACHE_60SECS
=
"CACHE_60SECS"
;
String
CACHE_10MINS
=
"CACHE_10MINS"
;
String
CACHE_5MINS
=
"CACHE_5MINS"
;
String
CACHE_30MINS
=
"CACHE_30MINS"
;
String
CACHE_60MINS
=
"CACHE_60MINS"
;
String
CACHE_12HOURS
=
"CACHE_12HOURS"
;
String
CACHE_24HOURS
=
"CACHE_24HOURS"
;
String
CACHE_3DAYS
=
"CACHE_3DAYS"
;
String
CACHE_7DAYS
=
"CACHE_7DAYS"
;
String
CACHE_30DAYS
=
"CACHE_30DAYS"
;
}
rest-archetype-framework/rest-admin-dubbo/pom.xml
View file @
74a708c
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<properties>
<properties>
<curator.version>
5.2.1
</curator.version>
<curator.version>
5.2.1
</curator.version>
<zookeeper.version>
3.
6
.0
</zookeeper.version>
<zookeeper.version>
3.
7
.0
</zookeeper.version>
</properties>
</properties>
<dependencies>
<dependencies>
...
...
rest-archetype-framework/rest-admin-elasticjob/pom.xml
View file @
74a708c
...
@@ -12,28 +12,28 @@
...
@@ -12,28 +12,28 @@
<artifactId>
rest-admin-elasticjob
</artifactId>
<artifactId>
rest-admin-elasticjob
</artifactId>
<properties>
<properties>
<curator.version>
5.2.0
</curator.version>
<zookeeper.version>
3.6.0
</zookeeper.version>
<zookeeper.version>
3.7.0
</zookeeper.version>
</properties>
</properties>
<dependencies>
<dependencies>
<!-- 运行环境上下文 -->
<dependency>
<dependency>
<groupId>
org.apache.shardingsphere.elasticjob
</groupId>
<groupId>
com.glsx
</groupId>
<artifactId>
elasticjob-lite-spring-boot-starter
</artifactId>
<artifactId>
rest-admin-context
</artifactId>
<version>
3.0.0
</version>
<exclusions>
<exclusion>
<groupId>
org.apache.zookeeper
</groupId>
<artifactId>
zookeeper
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.apache.
zookeeper
</groupId>
<groupId>
org.apache.
shardingsphere.elasticjob
</groupId>
<artifactId>
zookeep
er
</artifactId>
<artifactId>
elasticjob-lite-spring-boot-start
er
</artifactId>
<version>
${zookeeper.version}
</version>
<version>
3.0.3
</version>
</dependency>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.shardingsphere.elasticjob</groupId>-->
<!-- <artifactId>elasticjob-error-handler-email</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.shardingsphere.elasticjob</groupId>-->
<!-- <artifactId>elasticjob-error-handler-wechat</artifactId>-->
<!-- </dependency>-->
<dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-beans
</artifactId>
<artifactId>
spring-beans
</artifactId>
...
...
rest-archetype-framework/rest-admin-elasticjob/src/main/java/com/glsx/plat/job/config/ElasticJobConfig.java
View file @
74a708c
...
@@ -7,10 +7,10 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -7,10 +7,10 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
//
@Configuration
public
class
ElasticJobConfig
{
public
class
ElasticJobConfig
{
@Autowired
//
@Autowired
private
ZookeeperRegistryCenter
regCenter
;
private
ZookeeperRegistryCenter
regCenter
;
@Bean
(
initMethod
=
"init"
)
@Bean
(
initMethod
=
"init"
)
...
...
rest-archetype-framework/rest-admin-elasticjob/src/main/java/com/glsx/plat/job/config/ZookepeerConfig.java
0 → 100644
View file @
74a708c
package
com
.
glsx
.
plat
.
job
.
config
;
import
org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter
;
import
org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration
;
import
org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
//@Configuration
public
class
ZookepeerConfig
{
//zookeeper链接字符串 localhost:2181
private
String
ZOOKEEPER_CONNECTION_STRING
=
"localhost:2181"
;
//定时任务命名空间
private
String
JOB_NAMESPACE
=
"elastic-job-boot-java"
;
//zk的配置及创建注册中心
@Bean
(
initMethod
=
"init"
)
public
CoordinatorRegistryCenter
setUpRegistryCenter
(
@Value
(
"${elaticjob.zookeeper.server-lists}"
)
final
String
serverList
,
@Value
(
"${elaticjob.zookeeper.namespace}"
)
final
String
namespace
)
{
//zk的配置
ZookeeperConfiguration
zookeeperConfiguration
=
new
ZookeeperConfiguration
(
serverList
,
namespace
);
//设置zk超时时间
zookeeperConfiguration
.
setSessionTimeoutMilliseconds
(
1000
);
//创建注册中心
CoordinatorRegistryCenter
zookeeperRegistryCenter
=
new
ZookeeperRegistryCenter
(
zookeeperConfiguration
);
return
zookeeperRegistryCenter
;
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment