Commit 5ee81dcd authored by 刘可心's avatar 刘可心

Merge branch 'SZDAS_V2.0' into 'SZDAS_V2.1'

# Conflicts: # src/main/resources/DBUpdate/DM_UpdateSQL.xml
parents 9c7597fb 67288dca
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>aserver</name> <name>aserver-szdas</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name> <name>org.eclipse.jdt.core.javabuilder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name> <name>org.eclipse.m2e.core.maven2Builder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures> </natures>
</projectDescription> </projectDescription>
\ No newline at end of file
package com.archser.aserver.common.config; package com.archser.aserver.common.config;
import com.alibaba.druid.filter.stat.StatFilter; import com.alibaba.druid.filter.stat.StatFilter;
import com.archser.aserver.common.config.plugins.RedisConfig;
import com.archser.aserver.controller.*; import com.archser.aserver.controller.*;
import com.archser.aserver.interceptor.JwtInterceptor; import com.archser.aserver.interceptor.JwtInterceptor;
import com.archser.aserver.itask.GoodSync; import com.archser.aserver.itask.GoodSync;
import com.archser.aserver.model._MappingKit; import com.archser.aserver.model._MappingKit;
import com.archser.aserver.service.DBService; import com.archser.aserver.service.DBService;
import com.archser.aserver.util.SharedDisk;
import com.archser.aserver.websocket.MessageWebSocket; import com.archser.aserver.websocket.MessageWebSocket;
import com.jfinal.config.*; import com.jfinal.config.*;
import com.jfinal.ext.handler.UrlSkipHandler; import com.jfinal.ext.handler.UrlSkipHandler;
...@@ -19,7 +21,6 @@ import com.jfinal.plugin.activerecord.CaseInsensitiveContainerFactory; ...@@ -19,7 +21,6 @@ import com.jfinal.plugin.activerecord.CaseInsensitiveContainerFactory;
import com.jfinal.plugin.activerecord.dialect.*; import com.jfinal.plugin.activerecord.dialect.*;
import com.jfinal.plugin.cron4j.Cron4jPlugin; import com.jfinal.plugin.cron4j.Cron4jPlugin;
import com.jfinal.plugin.druid.DruidPlugin; import com.jfinal.plugin.druid.DruidPlugin;
import com.jfinal.plugin.redis.RedisPlugin;
import com.jfinal.render.ViewType; import com.jfinal.render.ViewType;
import com.jfinal.server.undertow.UndertowServer; import com.jfinal.server.undertow.UndertowServer;
import com.jfinal.server.undertow.WebBuilder; import com.jfinal.server.undertow.WebBuilder;
...@@ -27,7 +28,7 @@ import com.jfinal.template.Engine; ...@@ -27,7 +28,7 @@ import com.jfinal.template.Engine;
import java.io.File; import java.io.File;
public class MainConfig extends JFinalConfig { public class MainConfig extends JFinalConfig {
/** /**
* 将全局配置提出来 方便其他地方重用 * 将全局配置提出来 方便其他地方重用
...@@ -110,19 +111,21 @@ public class MainConfig extends JFinalConfig { ...@@ -110,19 +111,21 @@ public class MainConfig extends JFinalConfig {
p = PropKit.use("AppConfig.properties").appendIfExists("AppConfig-pro.properties"); p = PropKit.use("AppConfig.properties").appendIfExists("AppConfig-pro.properties");
ClassLoader path = Thread.currentThread().getContextClassLoader(); ClassLoader path = Thread.currentThread().getContextClassLoader();
try { try {
String resources = path.getResource("AppConfig.properties").toURI().getPath().replace("AppConfig.properties",""); String resources = path.getResource("AppConfig.properties").toURI().getPath()
.replace("AppConfig.properties", "");
p.getProperties().put("resources", resources); p.getProperties().put("resources", resources);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
ConfirmMiddlewareType(p); ConfirmMiddlewareType(p);
new SharedDisk(p);
} }
} }
/** /**
* @return void
* @Description: 确认中间件类型获取打包后的resource * @Description: 确认中间件类型获取打包后的resource
* @authorAndDate: ChengYaqing create on 2021/1/14 9:23 * @authorAndDate: ChengYaqing create on 2021/1/14 9:23
* @return void
*/ */
public static void ConfirmMiddlewareType(Prop p) { public static void ConfirmMiddlewareType(Prop p) {
String basePath; String basePath;
...@@ -167,15 +170,12 @@ public class MainConfig extends JFinalConfig { ...@@ -167,15 +170,12 @@ public class MainConfig extends JFinalConfig {
/******** 在此添加数据库 表-Model 映射 *********/ /******** 在此添加数据库 表-Model 映射 *********/
// 如果使用了JFinal Model 生成器 生成了BaseModel 把下面注释解开即可 // 如果使用了JFinal Model 生成器 生成了BaseModel 把下面注释解开即可
_MappingKit.mapping(arp); _MappingKit.mapping(arp);
// 添加到插件列表中 // 添加到插件列表中
me.add(dbPlugin); me.add(dbPlugin);
me.add(arp); me.add(arp);
// 添加Redis 配置 // 配置Redis信息,自动判断单实例和集群并加入JFinal插件列表
RedisPlugin redis = new RedisPlugin("redis", PropKit.get("redis.url"),PropKit.getInt("redis.port"), new RedisConfig(me, p);
PropKit.get("redis.password"));
me.add(redis);
// 添加定时任务 // 添加定时任务
me.add(new Cron4jPlugin(PropKit.append("task.properties"))); me.add(new Cron4jPlugin(PropKit.append("task.properties")));
...@@ -243,7 +243,6 @@ public class MainConfig extends JFinalConfig { ...@@ -243,7 +243,6 @@ public class MainConfig extends JFinalConfig {
/** /**
* 添加websocket * 添加websocket
*
* @param builder * @param builder
*/ */
public static void addWebSocket(WebBuilder builder) { public static void addWebSocket(WebBuilder builder) {
...@@ -254,7 +253,6 @@ public class MainConfig extends JFinalConfig { ...@@ -254,7 +253,6 @@ public class MainConfig extends JFinalConfig {
/** /**
* 添加消息中心的websocket * 添加消息中心的websocket
*
* @param builder * @param builder
*/ */
public static void addMessageWebSocket(WebBuilder builder) { public static void addMessageWebSocket(WebBuilder builder) {
......
package com.archser.aserver.common.config.plugins;
import com.archser.aserver.plugin.redis.RedisSentinelPlugin;
import com.jfinal.config.Plugins;
import com.jfinal.kit.Prop;
import com.jfinal.plugin.redis.RedisPlugin;
import java.util.HashSet;
import java.util.Set;
import redis.clients.jedis.HostAndPort;
/**
* TODO 自定义Redis配置,提取逻辑判断,避免在主类中掺杂大量代码
* @author 李德才
* @version V2.0
* @date 2021/3/4 9:02
*/
public class RedisConfig {
public RedisConfig(Plugins plugins, Prop prop) {
String redisUrl = prop.get("redis.url");
// 哨兵配置
if (redisUrl.contains(",")) {
Set<HostAndPort> sentinels = new HashSet<HostAndPort>();
String[] split = redisUrl.split(",");
int port = 26379;
for (String item : split) {
if (item.contains(":")) {
port = Integer.parseInt(item.split(":")[1]);
}
sentinels.add(new HostAndPort(item.split(":")[0], port));
}
RedisSentinelPlugin redisSentinelPlugin = new RedisSentinelPlugin(
prop.get("redisSentinel.CacheName", "redisSentinel"),
prop.get("redisSentinel.masterName", "mymaster"),
sentinels, prop.get("redis.password", "archser_redis"));
plugins.add(redisSentinelPlugin);
} else {
// 普通Redis单实例配置
RedisPlugin redis = new RedisPlugin("redis", prop.get("redis.url"),
prop.getInt("redis.port", 6379),
prop.get("redis.password"));
plugins.add(redis);
}
}
}
package com.archser.aserver.plugin.redis;
/**
* TODO
* @author 李德才
* @version V2.0
* @date 2021/3/3 14:52
*/
import com.jfinal.plugin.redis.Cache;
import com.jfinal.plugin.redis.IKeyNamingPolicy;
import com.jfinal.plugin.redis.serializer.ISerializer;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisSentinelPool;
public class ICache extends Cache {
private JedisSentinelPool jedisSentinelPool;
/**
* TODO JFinal 自带的 Cache要求传入 JedisPool,无法满足哨兵需求,重写连接属性和获取Jedis对象方法
* @author 李德才
* @date 2021/3/3 16:41
* @return
*/
public ICache(String name, JedisSentinelPool jedisSentinelPool, ISerializer serializer,
IKeyNamingPolicy keyNamingPolicy) {
try {
super.name = name;
super.serializer = serializer;
super.keyNamingPolicy = keyNamingPolicy;
super.threadLocalJedis.set(jedisSentinelPool.getResource());
this.jedisSentinelPool = jedisSentinelPool;
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public Jedis getJedis() {
Jedis jedis = threadLocalJedis.get();
return jedis != null ? jedis : jedisSentinelPool.getResource();
}
}
package com.archser.aserver.plugin.redis;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.IPlugin;
import com.jfinal.plugin.redis.IKeyNamingPolicy;
import com.jfinal.plugin.redis.Redis;
import com.jfinal.plugin.redis.serializer.FstSerializer;
import com.jfinal.plugin.redis.serializer.ISerializer;
import java.util.HashSet;
import java.util.Set;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisSentinelPool;
import redis.clients.jedis.Protocol;
/**
* TODO 自定义JFinal sentinel 集群下的 Redis 插件
* @author 李德才
* @version V2.0
* @date 2021/3/2 17:14
*/
public class RedisSentinelPlugin implements IPlugin {
private String cacheName;
private String masterName = null;
private int connectionTimeout = Protocol.DEFAULT_TIMEOUT;
private String password = null;
private int database = Protocol.DEFAULT_DATABASE;
private Set<String> sentinels = new HashSet<String>();
private ISerializer serializer;
private IKeyNamingPolicy keyNamingPolicy;
private GenericObjectPoolConfig poolConfig;
ICache iCache;
public RedisSentinelPlugin(String cacheName, String masterName, Set<HostAndPort> sentinels,
String password) {
this(cacheName, masterName, sentinels, new GenericObjectPoolConfig(), Protocol.DEFAULT_TIMEOUT,
password);
}
public RedisSentinelPlugin(String cacheName, String masterName, Set<HostAndPort> sentinels,
final GenericObjectPoolConfig poolConfig, int timeout, final String password) {
this(cacheName, masterName, sentinels, poolConfig, timeout, password,
Protocol.DEFAULT_DATABASE);
}
public RedisSentinelPlugin(String cacheName, String masterName, Set<HostAndPort> sentinels,
final GenericObjectPoolConfig poolConfig, int timeout, final String password,
final int database) {
this(cacheName, masterName, sentinels, poolConfig, timeout, timeout, password, database);
}
public RedisSentinelPlugin(String cacheName, String masterName, Set<HostAndPort> sentinels,
final GenericObjectPoolConfig poolConfig,
final int timeout, final int soTimeout, final String password,
final int database) {
this(cacheName, masterName, sentinels, poolConfig, timeout, soTimeout,
password, database, null);
}
public RedisSentinelPlugin(String cacheName, String masterName,
Set<HostAndPort> sentinels, final GenericObjectPoolConfig poolConfig,
final int connectionTimeout, final int soTimeout,
final String password, final int database, final String clientName) {
if (StrKit.isBlank(cacheName)) {
throw new IllegalArgumentException("cacheName can not be blank.");
}
if (StrKit.isBlank(masterName)) {
throw new IllegalArgumentException("masterName can not be blank.");
}
if (null == sentinels || sentinels.isEmpty()) {
throw new IllegalArgumentException("sentinels can not be blank.");
}
if (null == poolConfig) {
throw new IllegalArgumentException("poolConfig can not be null.");
}
for (HostAndPort hp : sentinels) {
this.sentinels.add(hp.toString());
}
this.cacheName = cacheName.trim();
this.masterName = masterName.trim();
this.poolConfig = poolConfig;
this.connectionTimeout = connectionTimeout;
this.password = password;
this.database = database;
}
public boolean start() {
JedisSentinelPool jedisSentinelPool = new JedisSentinelPool(masterName, sentinels, poolConfig,
connectionTimeout, password, database);
if (serializer == null) {
serializer = FstSerializer.me;
}
if (keyNamingPolicy == null) {
keyNamingPolicy = IKeyNamingPolicy.defaultKeyNamingPolicy;
}
iCache = new ICache(cacheName, jedisSentinelPool, serializer, keyNamingPolicy);
Redis.addCache(iCache);
return true;
}
public boolean stop() {
try {
iCache.getJedis().close();
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
}
package com.archser.aserver.util;
import com.jfinal.kit.Prop;
import com.jfinal.kit.PropKit;
import com.jfinal.kit.StrKit;
import java.io.File;
/**
* TODO 根据项目配置文件确定临时文件存放位置
* @author 李德才
* @version V2.0
* @date 2021/3/8 9:40
*/
public class SharedDisk {
protected static String sharedDiskPath = null;
public static String getSharedDiskPath() {
return sharedDiskPath;
}
public static void setSharedDiskPath(String sharedDiskPath) {
SharedDisk.sharedDiskPath = sharedDiskPath;
}
public SharedDisk(Prop p) {
String sharedDisk = PropKit.get("SharedDisk");
// 确定存在临时文件共享磁盘
if (StrKit.notBlank(sharedDisk) && new File(sharedDisk).isDirectory()) {
sharedDiskPath = sharedDisk + File.separator + PropKit.get("serverType");
if (!new File(sharedDiskPath).exists()) {
new File(sharedDiskPath).mkdirs();
}
}
// 不存在临时文件共享磁盘或磁盘地址不可用,
if (StrKit.isBlank(sharedDisk) || !new File(sharedDisk).isDirectory()) {
sharedDiskPath = p.getProperties().get("resourcesPath").toString();
}
}
}
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# \u6570\u636E\u5E93 # \u6570\u636E\u5E93
serverType=aserver
#oracle\u6570\u636E\u5E93 #oracle\u6570\u636E\u5E93
#dbType=ORACLE #dbType=ORACLE
...@@ -38,20 +39,31 @@ jdbc.password=archser_hywdtest ...@@ -38,20 +39,31 @@ jdbc.password=archser_hywdtest
#\u4E2D\u95F4\u4EF6\u7C7B\u578B \u6C49\u8BED\u62FC\u97F3 zhongchaung\u3001dongfangtong\u3001baolande\u3001jindie\u3001dev #\u4E2D\u95F4\u4EF6\u7C7B\u578B \u6C49\u8BED\u62FC\u97F3 zhongchaung\u3001dongfangtong\u3001baolande\u3001jindie\u3001dev
MiddlewareType=dev MiddlewareType=dev
# redis\u914D\u7F6E
redis.url=127.0.0.1 ### don't open redis and redisSentinel At the same time
redis.port=6379 ### \u4E0D\u8981\u540C\u65F6\u6253\u5F00 redis \u5355\u5B9E\u4F8B \u548C redisSentinel \u54E8\u5175\u96C6\u7FA4
redis.password=archser_redis
# redis \u5355\u5B9E\u4F8B
#redis.url=192.168.31.151:26379,192.168.31.154:26379,192.168.31.157:26379
redis.url=39.104.21.218
redis.port=6380
redis.password=archser_redis218_6380
redisSentinel.CacheName=redisSentinel
redisSentinel.masterName=mymaster
#\u5355\u70B9\u767B\u9646\u5730\u5740 #\u5355\u70B9\u767B\u9646\u5730\u5740
basic.url=http://39.104.21.218:11038 basic.url=http://39.104.21.218:11038
## \u662F\u5426\u540C\u6B65Redis\u4E2D\u7684\u6570\u636E ## \u662F\u5426\u540C\u6B65Redis\u4E2D\u7684\u6570\u636E
updateRedis=true updateRedis=true
## \u4E34\u65F6\u6587\u4EF6\u5171\u4EAB\u78C1\u76D8\u8DEF\u5F84
SharedDisk=D:\\workspace\\fserver_folder\\SharedDisk
#ip\u767D\u540D\u5355\uFF0C\u914D\u7F6E\u672C\u673A\u5730\u5740 #ip\u767D\u540D\u5355\uFF0C\u914D\u7F6E\u672C\u673A\u5730\u5740
MyIpAddress=127.0.0.1,0:0:0:0:0:0:0:1 MyIpAddress=127.0.0.1,0:0:0:0:0:0:0:1
#activemq #activemq
#activemq.brokerURL=failover://(tcp://192.168.31.151:61616,tcp://192.168.31.154:61616,tcp://192.168.31.157:61616)
activemq.brokerURL=tcp://39.104.21.218:61616 activemq.brokerURL=tcp://39.104.21.218:61616
authUrl=http://125.77.26.133:7001/auth/token authUrl=http://125.77.26.133:7001/auth/token
...@@ -163,8 +175,10 @@ FserverName=fserver ...@@ -163,8 +175,10 @@ FserverName=fserver
#================sserver================================= #================sserver=================================
#Elasticsearch\u670D\u52A1\u5668\u8BBE\u7F6E #Elasticsearch\u670D\u52A1\u5668\u8BBE\u7F6E
#es.host=192.168.31.151:9200,192.168.31.154:9200,192.168.31.157:9200
es.host=39.104.21.218 es.host=39.104.21.218
es.port=9200 es.port=9200
es.http=http
es.user=es es.user=es
es.password=Admin@123456 es.password=Admin@123456
......
...@@ -2493,7 +2493,7 @@ ...@@ -2493,7 +2493,7 @@
<version edition="105" description="218AS_LIBRARY_FILE表添加宽度"> <version edition="105" description="218AS_LIBRARY_FILE表添加宽度">
<sql creator="yangrifei" createDate="20201204" <sql creator="yangrifei" createDate="20201204"
note="218AS_LIBRARY_FILE表添加宽度"> note="218AS_LIBRARY_FILE表添加宽度">
alter table AS_LIBRARY_FILE add WIDTH varchar(9); alter table AS_LIBRARY_FILE add WIDTH NUMBER(9,0);
</sql> </sql>
</version> </version>
...@@ -2962,7 +2962,40 @@ ...@@ -2962,7 +2962,40 @@
alter table AS_FILE_RECYLE add "ecert_sign" VARCHAR2(50); alter table AS_FILE_RECYLE add "ecert_sign" VARCHAR2(50);
</sql> </sql>
</version> </version>
<!-- <version edition="137" description="帮助中心"> <version edition="137" description="编研管理添加名称简述字段">
<sql creator="zhanglongfa" createDate="20210302" note="编研管理添加名称简述字段">
alter table AS_COMPILATION_CKEDITOR add "NAME" varchar2(100);
alter table AS_COMPILATION_CKEDITOR add "SKETCH" varchar2(500);
</sql>
</version>
<version edition="138" description="编研管理添加序列">
<sql creator="zhanglongfa" createDate="20210302" note="编研管理添加序列">
create sequence SEQ_COMPILATION_CKEDITOR
minvalue 1
maxvalue 999999999
start with 1
increment by 1
nocycle
nocache;
</sql>
</version>
<version edition="139" description="统计服务方案表">
<sql creator="ChengYaqing" createDate="20210315" note="方案表">CREATE TABLE "AS_PROGRAMME" (
ID NUMBER(9,0) NOT NULL,
NAME VARCHAR2(500),
CREATE_USER VARCHAR2(100),
CREATE_TIME VARCHAR2(100),
DESCRIPTION VARCHAR2(500),
FONDS_NUMBER VARCHAR2(100),
PRIMARY KEY("ID")
)</sql>
<sql creator="ChengYaqing" createDate="20210315" note="序列">
CREATE SEQUENCE
"SEQ_AS_PROGRAMME" INCREMENT BY 1 START WITH 1 MAXVALUE
9999999999999999 MINVALUE 1 CACHE 20;
</sql>
</version>
<version edition="140" description="帮助中心">
<sql creator="liukexin" createDate="20210301" note="帮助中心"> <sql creator="liukexin" createDate="20210301" note="帮助中心">
CREATE TABLE "AS_HELPER" CREATE TABLE "AS_HELPER"
( (
...@@ -2975,7 +3008,7 @@ ...@@ -2975,7 +3008,7 @@
create sequence AS_HELPER_SEQ start with 1 increment by 1 maxvalue 99999999999 create sequence AS_HELPER_SEQ start with 1 increment by 1 maxvalue 99999999999
</sql> </sql>
</version> </version>
<version edition="138" description="帮助中心菜单"> <version edition="141" description="帮助中心菜单">
<sql creator="liukexin" createDate="20210301" note="帮助中心"> <sql creator="liukexin" createDate="20210301" note="帮助中心">
insert into insert into
AS_MENU(ID,NAME,TITLE,DESCRIPTION,PATH,SYSTEM_ID,FIRST_LEVEL_NAME,SECOND_LEVEL_NAME,GROUP_ORDER) AS_MENU(ID,NAME,TITLE,DESCRIPTION,PATH,SYSTEM_ID,FIRST_LEVEL_NAME,SECOND_LEVEL_NAME,GROUP_ORDER)
...@@ -2985,7 +3018,7 @@ ...@@ -2985,7 +3018,7 @@
values(SEQ_MENU.nextval,'helpCenter','帮助中心管理','帮助中心管理','#/helpManager',9,'后台管理','系统管理',4); values(SEQ_MENU.nextval,'helpCenter','帮助中心管理','帮助中心管理','#/helpManager',9,'后台管理','系统管理',4);
</sql> </sql>
</version> </version>
<version edition="139" description="设置首页"> <version edition="142" description="设置首页">
<sql creator="liukexin" createDate="20210309" note="设置首页"> <sql creator="liukexin" createDate="20210309" note="设置首页">
CREATE TABLE "AS_USER_HOME" CREATE TABLE "AS_USER_HOME"
( (
...@@ -2995,5 +3028,6 @@ ...@@ -2995,5 +3028,6 @@
"SYSTEM" VARCHAR(100), "SYSTEM" VARCHAR(100),
CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ; CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;
</sql> </sql>
</version> --> </version>
</update> </update>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment