更新
This commit is contained in:
@@ -1,21 +1,53 @@
|
||||
**可以使用传统方式运行,可以使用docker
|
||||
容器的方式运行。程序的启动顺序是配置中心,
|
||||
注册中心,其他服务。无论是使何种方式运行,
|
||||
保证除配置中心外,其他所有服务都能从配置中
|
||||
加载到对应的配置文件,其他所有的服务都能注
|
||||
册到注册中心。所以运行的时候一定要将除配置
|
||||
中心外所有服务的注册空间的配置空间都指定正
|
||||
确,本项目中本地运行时则是都指定到本机的
|
||||
ip地址**
|
||||
###本项目开发的相关约定
|
||||
|
||||
###配置中心 端口号 9999 监控 19999
|
||||
www.config.server.com
|
||||
###注册中心 端口号 10002 监控 20002
|
||||
www.eureka.server.com
|
||||
###注册中心2 端口号 10003 监控 20003
|
||||
www.eureka.server2.com
|
||||
###用户权限管理中心 端口号 10004 监控 20004
|
||||
www.upms.com
|
||||
###后台管理界面
|
||||
manage-system
|
||||
<h1>欢迎查看micro-fast项目说明</h1>
|
||||
<hr>
|
||||
<ol>
|
||||
<li><h2>项目简介</h2>
|
||||
<p>本项目使用mybatis,spring系列框架作为基础,致力于打造一套中小企业分布式系统解决方案.借助于springCould微服务
|
||||
框架,对原框架进行整合扩展使用云架构进行开发.</p>
|
||||
</li>
|
||||
<li><h2>模块介绍</h2>
|
||||
<ol>
|
||||
<li><h3>SSM公共模块 common</h3>
|
||||
<p>common模块对SSM框架进行了整合,借助springboot实现了模块的热插拔,具有可复用性和可扩展性
|
||||
</p>
|
||||
</li>
|
||||
<li><h3>配置中心 config-server</h3>
|
||||
<p>配置中心默认启动端口号9999,健康检查端口号19999.访问地址www.config.server.com
|
||||
</p>
|
||||
</li>
|
||||
<li><h3>注册中心 eureka-sever</h3>
|
||||
<p>注册中心默认启动端口号10002,健康检查端口号20002.访问地址www.eureka.server.com.为保证服务的稳定可靠,
|
||||
可以创建多个注册中心,实现服务注册的备份冗余,实现高可用性
|
||||
</p>
|
||||
</li>
|
||||
<li><h3>注册中心2 eureka-sever2</h3>
|
||||
<p>注册中心2默认启动端口号10003,健康检查端口号20003.访问地址www.eureka.server2.com.
|
||||
</p>
|
||||
</li>
|
||||
<li><h3>用户权限管理中心 upms</h3>
|
||||
<p>用户权限管理中心默认启动端口号10004,健康检查端口号20004.访问地址www.upms.com
|
||||
</p>
|
||||
</li>
|
||||
<li><h3>后台管理界面 manage-system</h3>
|
||||
<p>使用react.js搭建后台管理界面
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li><h2>项目相关约束</h2>
|
||||
<p>遵循类似于springboot约定大与配置的原则.本项目开发约束如下:
|
||||
<h3>关于使用docker方式运行项目</h3>
|
||||
<p>可以使用传统方式运行,可以使用docker
|
||||
容器的方式运行。程序的启动顺序是配置中心,
|
||||
注册中心,其他服务。无论是使何种方式运行,
|
||||
保证除配置中心外,其他所有服务都能从配置中
|
||||
加载到对应的配置文件,其他所有的服务都能注
|
||||
册到注册中心。所以运行的时候一定要将除配置
|
||||
中心外所有服务的注册空间的配置空间都指定正
|
||||
确,本项目中本地运行时则是都指定到本机的
|
||||
ip地址</p>
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
+1
-8
@@ -87,21 +87,18 @@
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-el</artifactId>
|
||||
</dependency>
|
||||
<!-- 工具类 -->
|
||||
<!--提供了丰富的工具类和数据结构-->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>20.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--工具类-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.5</version>
|
||||
</dependency>
|
||||
|
||||
<!--集合工具类-->
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
@@ -114,22 +111,19 @@
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- id加密解密 -->
|
||||
<dependency>
|
||||
<groupId>org.hashids</groupId>
|
||||
<artifactId>hashids</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ftp client -->
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- file upload springmvc文件上传-->
|
||||
<!-- file upload协助 springmvc文件上传-->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
@@ -163,7 +157,6 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.druid.support.http.WebStatFilter;
|
||||
import com.alibaba.druid.support.spring.stat.DruidStatInterceptor;
|
||||
import com.micro.fast.common.config.param.DruidParamConfig;
|
||||
import com.micro.fast.common.config.param.JdbcConnectionParamConfig;
|
||||
import com.micro.fast.common.util.AESUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -133,7 +134,7 @@ public class DataSourceConfig {
|
||||
DruidDataSource druidDataSource = new DruidDataSource();
|
||||
//数据库连接的相关配置
|
||||
druidDataSource.setUsername(jdbcConnectionParamConfig.getUsername());
|
||||
druidDataSource.setPassword(jdbcConnectionParamConfig.getPassword());
|
||||
druidDataSource.setPassword(AESUtil.AESDecode(jdbcConnectionParamConfig.getPassword()));
|
||||
druidDataSource.setUrl(jdbcConnectionParamConfig.getUrl());
|
||||
druidDataSource.setDriverClassName(jdbcConnectionParamConfig.getDriverClass());
|
||||
//连接池的具体配置
|
||||
|
||||
@@ -8,6 +8,15 @@ import org.springframework.validation.annotation.Validated;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* mybatis配置参数
|
||||
* create by lishouyu 2017/09/09
|
||||
* email 18332763730@163.com
|
||||
*
|
||||
* last edit lishouyu 2017/09/09
|
||||
* email 18332763730@163.com
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@AutoConfigureBefore(com.micro.fast.common.config.SqlSessionFactoryConfig.class)
|
||||
@ConfigurationProperties(prefix = "mybatis")
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.micro.fast.common.response;
|
||||
|
||||
/**
|
||||
* 数据字典
|
||||
* create by lishouyu 2017/09/09
|
||||
* email 18332763730@163.com
|
||||
*
|
||||
* last edit lishouyu 2017/09/09
|
||||
* email 18332763730@163.com
|
||||
*
|
||||
*/
|
||||
public class Const {
|
||||
//服务器响应数据字典
|
||||
public enum ServerResponseCode{
|
||||
SUCCESS(0,"SUCCESS"),//获取数据成功
|
||||
ERROR(1,"ERROR");//获取数据失败
|
||||
private Integer code;
|
||||
private String msg;
|
||||
ServerResponseCode(Integer code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.micro.fast.common.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
/**
|
||||
* mybatis参数配置
|
||||
* create by lishouyu 2017/09/09
|
||||
* email 18332763730@163.com
|
||||
*
|
||||
* last edit lishouyu 2017/09/09
|
||||
* email 18332763730@163.com
|
||||
*
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)//序列化中不包含为空的字段
|
||||
public class ServerResponse<T> {
|
||||
private Integer code;//获取数据返回的提示数据字典码
|
||||
private String msg; //获取数据成功或者失败的时候提示的消息
|
||||
T data;
|
||||
|
||||
/**
|
||||
* 所有的构造方法均为私有,不允许外部直接调用构造方法
|
||||
*/
|
||||
public ServerResponse() {
|
||||
|
||||
}
|
||||
|
||||
private ServerResponse(Integer code) {
|
||||
this(code, null, null);
|
||||
}
|
||||
|
||||
private ServerResponse(Integer code, String msg) {
|
||||
this(code, msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 为了避免T 为string的时候调用的是 上面的构造方法,需要对构造方法进行包装。构造方法设置为私有,不允许外部调用
|
||||
*
|
||||
* @param code
|
||||
* @param data
|
||||
*/
|
||||
private ServerResponse(Integer code, T data) {
|
||||
this(code, null, data);
|
||||
}
|
||||
|
||||
private ServerResponse(Integer code, String msg, T data) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回代码是小于等于0的时候表示请求数据失败,或者进行验证时失败
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JsonIgnore //使其不再json序列化结果之中
|
||||
public boolean isSuccess() {
|
||||
return Const.ServerResponseCode.SUCCESS.getCode() == this.code;
|
||||
}
|
||||
|
||||
//请求成功
|
||||
public static <T> ServerResponse<T> success() {
|
||||
|
||||
return new ServerResponse<T>(Const.ServerResponseCode.SUCCESS.getCode());
|
||||
}
|
||||
|
||||
public static <T> ServerResponse<T> successMsg(String msg) {
|
||||
|
||||
return new ServerResponse<T>(
|
||||
Const.ServerResponseCode.SUCCESS.getCode(),
|
||||
msg);
|
||||
}
|
||||
|
||||
public static <T> ServerResponse<T> successData(T data) {
|
||||
|
||||
return new ServerResponse<T>(Const.ServerResponseCode.SUCCESS.getCode(),
|
||||
data);
|
||||
}
|
||||
|
||||
public static <T> ServerResponse<T> successMsgData(String msg, T data) {
|
||||
|
||||
return new ServerResponse<T>(Const.ServerResponseCode.SUCCESS.getCode(),
|
||||
msg, data);
|
||||
}
|
||||
|
||||
//请求失败
|
||||
public static <T> ServerResponse<T> error() {
|
||||
return new ServerResponse<T>(Const.ServerResponseCode.ERROR.getCode());
|
||||
}
|
||||
|
||||
public static <T> ServerResponse<T> errorMsg(String msg) {
|
||||
return new ServerResponse<T>(Const.ServerResponseCode.ERROR.getCode(), msg);
|
||||
}
|
||||
|
||||
public static <T> ServerResponse<T> errorCodeMsg(Integer code, String msg) {
|
||||
return new ServerResponse<T>(code, msg);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public class AESUtilTest {
|
||||
System.out.println("key | AESEncode | AESDecode");
|
||||
for (String key : keys) {
|
||||
System.out.print(key+" | ");
|
||||
String aesEncode = AESUtil.AESEncode("li");
|
||||
String aesEncode = AESUtil.AESEncode("studyj2e");
|
||||
System.out.print(aesEncode+" | ");
|
||||
String aesDecode = AESUtil.AESDecode(aesEncode);
|
||||
System.out.println(aesDecode);
|
||||
|
||||
Reference in New Issue
Block a user