Преглед изворни кода

Merge branch 'wrdp' into 'develop'

Wrdp

See merge request o2oa/o2oa!3039
o2null пре 4 година
родитељ
комит
98231ecb68

+ 7 - 1
o2server/configSample/mq.json

@@ -23,8 +23,14 @@
   "activeMQ":{
   "activeMQ":{
 	   "url":"tcp://127.0.0.1:61616",
 	   "url":"tcp://127.0.0.1:61616",
 	   "queueName":"queue-test",
 	   "queueName":"queue-test",
+	   "keyStore":"C:/Users/wwx/client.ks",
+	   "trustStore":"C:/Users/wwx/client.ts",
+	   "keyStorePassword":"password",
 	   "###url": "服务地址,端口默认61616.###",
 	   "###url": "服务地址,端口默认61616.###",
-	   "###queueName": "要创建的消息名称###"
+	   "###queueName": "要创建的消息名称###",
+	   "###keyStore": "密钥文件存储路径###",
+	   "###trustStore": "证书文件存储路径###",
+	   "###keyStorePassword": "密钥密码###"
   },
   },
   "###enable": "是否启用.###",
   "###enable": "是否启用.###",
   "###mq": "消息服务类型.###"
   "###mq": "消息服务类型.###"

+ 33 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/MQActive.java

@@ -22,6 +22,15 @@ public class MQActive extends ConfigObject {
 	@FieldDescribe("消息队列名")
 	@FieldDescribe("消息队列名")
 	private String queueName;
 	private String queueName;
 	
 	
+	@FieldDescribe("密钥文件存储路径")
+	private String keyStore;
+	
+	@FieldDescribe("证书文件存储路径")
+	private String trustStore;
+	
+	@FieldDescribe("密钥密码")
+	private String keyStorePassword;
+	
 	public static MQActive defaultInstance() {
 	public static MQActive defaultInstance() {
 		return new MQActive();
 		return new MQActive();
 	}
 	}
@@ -50,6 +59,30 @@ public class MQActive extends ConfigObject {
 	public void setQueueName(String queueName) {
 	public void setQueueName(String queueName) {
 		this.queueName = queueName;
 		this.queueName = queueName;
 	}
 	}
+
+	public String getKeyStore() {
+		return keyStore;
+	}
+
+	public void setKeyStore(String keyStore) {
+		this.keyStore = keyStore;
+	}
+
+	public String getTrustStore() {
+		return trustStore;
+	}
+
+	public void setTrustStore(String trustStore) {
+		this.trustStore = trustStore;
+	}
+
+	public String getKeyStorePassword() {
+		return keyStorePassword;
+	}
+
+	public void setKeyStorePassword(String keyStorePassword) {
+		this.keyStorePassword = keyStorePassword;
+	}
 	
 	
 
 
 	
 	

+ 1 - 1
o2server/x_console/src/main/java/com/x/server/console/NodeAgent.java

@@ -136,7 +136,7 @@ public class NodeAgent extends Thread {
 							fos.close();
 							fos.close();
 							Config.flush();
 							Config.flush();
 							if(syncFilePath.indexOf("web.json") > -1 || syncFilePath.indexOf("collect.json") > -1
 							if(syncFilePath.indexOf("web.json") > -1 || syncFilePath.indexOf("collect.json") > -1
-									|| syncFilePath.indexOf("portal.json") > -1){
+									|| syncFilePath.indexOf("portal.json") > -1 || syncFilePath.indexOf("person.json") > -1){
 								// 更新web服务配置信息
 								// 更新web服务配置信息
 								WebServers.updateWebServerConfigJson();
 								WebServers.updateWebServerConfigJson();
 							}
 							}

+ 85 - 15
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/mq/ActiveMQ.java

@@ -10,6 +10,8 @@ import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.jms.TextMessage;
 
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.ActiveMQSslConnectionFactory;
+
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.x.base.core.project.config.Config;
 import com.x.base.core.project.config.Config;
 import com.x.base.core.project.config.MQActive;
 import com.x.base.core.project.config.MQActive;
@@ -17,6 +19,13 @@ import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.message.core.entity.Message;
 import com.x.message.core.entity.Message;
 
 
+import java.io.FileInputStream;
+import java.security.KeyStore;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+
 public class ActiveMQ implements MQInterface {
 public class ActiveMQ implements MQInterface {
 	
 	
 	private static Logger logger = LoggerFactory.getLogger(ActiveMQ.class);
 	private static Logger logger = LoggerFactory.getLogger(ActiveMQ.class);
@@ -28,16 +37,37 @@ public class ActiveMQ implements MQInterface {
 		try {
 		try {
 			    MQActive configMQ = Config.mq().getActiveMQ();
 			    MQActive configMQ = Config.mq().getActiveMQ();
 			    logger.info("MqActive initialize.....");
 			    logger.info("MqActive initialize.....");
-			    
-			    String url=configMQ.getUrl();
 			    String queueName=configMQ.getQueueName();
 			    String queueName=configMQ.getQueueName();
-	
-				ConnectionFactory factory=new ActiveMQConnectionFactory(url);
-			    this.connection= factory.createConnection();
-				this.connection.start();
-				this.session= this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-				Destination destination=session.createQueue(queueName);
-				this.producer = session.createProducer(destination);
+			    String url=configMQ.getUrl();
+			    url = url.trim();
+			    
+			    String protocol = url.substring(0, 3);
+			   if(protocol.equalsIgnoreCase("tcp")) {
+					ConnectionFactory factory=new ActiveMQConnectionFactory(url);
+				    this.connection= factory.createConnection();
+					this.connection.start();
+					
+					this.session= this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+					Destination destination=session.createQueue(queueName);
+					this.producer = session.createProducer(destination);
+					
+			   }else {
+				    String keyStore = configMQ.getKeyStore();
+				    String keyStorePassword = configMQ.getKeyStorePassword();
+				    String trustStore = configMQ.getTrustStore();
+				    
+			        ActiveMQSslConnectionFactory sslConnectionFactory = new ActiveMQSslConnectionFactory();
+			        sslConnectionFactory.setBrokerURL(url);
+			        sslConnectionFactory.setKeyAndTrustManagers(this.loadKeyManager(keyStore, keyStorePassword), this.loadTrustManager(trustStore),
+			                new java.security.SecureRandom());
+			        this.connection = sslConnectionFactory.createConnection();
+			        this.connection.start();
+			        
+			        this.session =  this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+			        Destination destination = session.createQueue(queueName);
+			        this.producer = session.createProducer(destination);
+			   }
+			   
 		} catch (Exception e) {
 		} catch (Exception e) {
 			e.printStackTrace();
 			e.printStackTrace();
 			logger.error(e);
 			logger.error(e);
@@ -57,12 +87,12 @@ public class ActiveMQ implements MQInterface {
 	 
 	 
 	 public static void main(String[] args) {
 	 public static void main(String[] args) {
 		   ActiveMQ MQClient = getInstance();
 		   ActiveMQ MQClient = getInstance();
-		   //System.out.println(MQClient.getTopic());
 		   Message msg = new Message();
 		   Message msg = new Message();
 		   msg.setBody("body");
 		   msg.setBody("body");
 		   msg.setConsumed(false);
 		   msg.setConsumed(false);
 		   msg.setCreateTime(new Date());
 		   msg.setCreateTime(new Date());
 		   msg.setPerson("person");
 		   msg.setPerson("person");
+		   MQClient.sendMessage(msg);
 	 }
 	 }
 
 
 	@Override
 	@Override
@@ -83,13 +113,53 @@ public class ActiveMQ implements MQInterface {
 	}
 	}
 
 
 	public void destroy() {
 	public void destroy() {
-		 System.out.println("MqActive destroy.....");
-		  try {
+		try {
+			logger.info("MqActive destroy.....");
 			this.connection.close();
 			this.connection.close();
 		} catch (JMSException e) {
 		} catch (JMSException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+			 e.printStackTrace();
 			 logger.error(e);
 			 logger.error(e);
 		}
 		}
-	   }
+	}
+	
+	
+	  /**
+        * 加载证书文件
+     * @param trustStore
+     * @return
+     * @throws java.security.NoSuchAlgorithmException
+     * @throws java.security.KeyStoreException
+     * @throws java.io.IOException
+     * @throws java.security.GeneralSecurityException
+     */
+    public static TrustManager[] loadTrustManager(String trustStore) throws java.security.NoSuchAlgorithmException, java.security.KeyStoreException,
+               java.io.IOException, java.security.GeneralSecurityException {
+          KeyStore ks = KeyStore. getInstance("JKS");
+          ks.load( new FileInputStream(trustStore), null);
+          TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory. getDefaultAlgorithm());
+          tmf.init(ks);
+          return tmf.getTrustManagers();
+    }
+
+    /**
+         * 加载密钥文件
+     * @param keyStore
+     * @param keyStorePassword
+     * @return
+     * @throws java.security.NoSuchAlgorithmException
+     * @throws java.security.KeyStoreException
+     * @throws java.security.GeneralSecurityException
+     * @throws java.security.cert.CertificateException
+     * @throws java.io.IOException
+     * @throws java.security.UnrecoverableKeyException
+     */
+    public static KeyManager[] loadKeyManager(String keyStore, String keyStorePassword) throws java.security.NoSuchAlgorithmException,
+               java.security.KeyStoreException, java.security.GeneralSecurityException, java.security.cert.CertificateException, java.io.IOException,
+               java.security.UnrecoverableKeyException {
+          KeyStore ks = KeyStore. getInstance("JKS");
+          ks.load( new FileInputStream(keyStore), keyStorePassword.toCharArray());
+          KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory. getDefaultAlgorithm());
+          kmf.init(ks, keyStorePassword.toCharArray());
+          return kmf.getKeyManagers();
+    }
 }
 }

+ 27 - 44
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/Business.java

@@ -622,29 +622,13 @@ public class Business {
 			throws Exception {
 			throws Exception {
 		T control = clz.newInstance();
 		T control = clz.newInstance();
 		Activity activity = this.getActivity(work);
 		Activity activity = this.getActivity(work);
-		List<Task> taskList = task().listWithWorkObject(work);
-		Task task = null;
-		for (int i = 0; i < taskList.size(); i++) {
-			Task o = taskList.get(i);
-			if (StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())) {
-				task = o;
-				break;
-			}
-		}
-		List<Read> readList = read().listWithWorkObject(work);
-		Read read = null;
-		for (int i = 0; i < readList.size(); i++) {
-			Read o = readList.get(i);
-			if (StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())) {
-				read = o;
-				break;
-			}
-		}
+		Long taskCount = task().countWithPersonWithJob(effectivePerson.getDistinguishedName(), work.getJob());
+		Long readCount = read().countWithPersonWithJob(effectivePerson.getDistinguishedName(), work.getJob());
 		Application application = application().pick(work.getApplication());
 		Application application = application().pick(work.getApplication());
 		Process process = process().pick(work.getProcess());
 		Process process = process().pick(work.getProcess());
-		Long taskCompletedCount = taskCompleted().countWithPersonWithWork(effectivePerson.getDistinguishedName(), work);
-		Long readCompletedCount = readCompleted().countWithPersonWithWork(effectivePerson.getDistinguishedName(), work);
-		Long reviewCount = review().countWithPersonWithWork(effectivePerson.getDistinguishedName(), work);
+		Long taskCompletedCount = taskCompleted().countWithPersonWithJob(effectivePerson.getDistinguishedName(), work.getJob());
+		Long readCompletedCount = readCompleted().countWithPersonWithJob(effectivePerson.getDistinguishedName(), work.getJob());
+		Long reviewCount = review().countWithPersonWithJob(effectivePerson.getDistinguishedName(), work.getJob());
 		/* 工作是否可以打开(管理员 或 有task,taskCompleted,read,readCompleted,review的人) */
 		/* 工作是否可以打开(管理员 或 有task,taskCompleted,read,readCompleted,review的人) */
 		control.setAllowVisit(false);
 		control.setAllowVisit(false);
 		/* 工作是否可以流转(有task的人) */
 		/* 工作是否可以流转(有task的人) */
@@ -662,7 +646,7 @@ public class Business {
 		/* 工作是否可删除(管理员 或者 此活动在流程设计中允许删除且当前待办人是文件的创建者) */
 		/* 工作是否可删除(管理员 或者 此活动在流程设计中允许删除且当前待办人是文件的创建者) */
 		control.setAllowDelete(false);
 		control.setAllowDelete(false);
 		/* 设置allowVisit */
 		/* 设置allowVisit */
-		if ((null != task) || (null != read) || (taskCompletedCount > 0) || (readCompletedCount > 0)
+		if ((taskCount > 0) || (readCount > 0) || (taskCompletedCount > 0) || (readCompletedCount > 0)
 				|| (reviewCount > 0)) {
 				|| (reviewCount > 0)) {
 			control.setAllowVisit(true);
 			control.setAllowVisit(true);
 		} else if (effectivePerson.isPerson(work.getCreatorPerson())) {
 		} else if (effectivePerson.isPerson(work.getCreatorPerson())) {
@@ -671,22 +655,22 @@ public class Business {
 			control.setAllowVisit(true);
 			control.setAllowVisit(true);
 		}
 		}
 		/* 设置allowProcessing */
 		/* 设置allowProcessing */
-		if (null != task) {
+		if (taskCount > 0) {
 			control.setAllowProcessing(true);
 			control.setAllowProcessing(true);
 		}
 		}
 		/* 设置allowReadProcessing */
 		/* 设置allowReadProcessing */
-		if (null != read) {
+		if (readCount > 0) {
 			control.setAllowReadProcessing(true);
 			control.setAllowReadProcessing(true);
 		}
 		}
 		/* 设置 allowSave */
 		/* 设置 allowSave */
-		if (null != task) {
+		if (taskCount > 0) {
 			control.setAllowSave(true);
 			control.setAllowSave(true);
 		} else if (this.canManageApplicationOrProcess(effectivePerson, application, process)) {
 		} else if (this.canManageApplicationOrProcess(effectivePerson, application, process)) {
 			control.setAllowSave(true);
 			control.setAllowSave(true);
 		}
 		}
 		/* 设置 allowReset */
 		/* 设置 allowReset */
 		if (null != activity && Objects.equals(activity.getActivityType(), ActivityType.manual)
 		if (null != activity && Objects.equals(activity.getActivityType(), ActivityType.manual)
-				&& BooleanUtils.isTrue(((Manual) activity).getAllowReset()) && null != task) {
+				&& BooleanUtils.isTrue(((Manual) activity).getAllowReset()) && taskCount > 0) {
 			control.setAllowReset(true);
 			control.setAllowReset(true);
 		}
 		}
 		/* 设置 allowRetract */
 		/* 设置 allowRetract */
@@ -734,7 +718,7 @@ public class Business {
 			// effectivePerson.getDistinguishedName())) {
 			// effectivePerson.getDistinguishedName())) {
 			// control.setAllowDelete(true);
 			// control.setAllowDelete(true);
 			// }
 			// }
-			if (null != task) {
+			if (taskCount > 0) {
 				control.setAllowDelete(true);
 				control.setAllowDelete(true);
 			}
 			}
 		}
 		}
@@ -1033,21 +1017,21 @@ public class Business {
 		if (effectivePerson.isPerson(work.getCreatorPerson())) {
 		if (effectivePerson.isPerson(work.getCreatorPerson())) {
 			return true;
 			return true;
 		}
 		}
-		if (emc.countEqualAndEqual(TaskCompleted.class, TaskCompleted.person_FIELDNAME,
-				effectivePerson.getDistinguishedName(), TaskCompleted.job_FIELDNAME, work.getJob()) == 0) {
-			if (emc.countEqualAndEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME,
-					effectivePerson.getDistinguishedName(), ReadCompleted.job_FIELDNAME, work.getJob()) == 0) {
-				if (emc.countEqualAndEqual(Task.class, Task.person_FIELDNAME, effectivePerson.getDistinguishedName(),
-						Task.job_FIELDNAME, work.getJob()) == 0) {
-					if (emc.countEqualAndEqual(Read.class, Read.person_FIELDNAME,
-							effectivePerson.getDistinguishedName(), Read.job_FIELDNAME, work.getJob()) == 0) {
-						if (emc.countEqualAndEqual(Review.class, Review.person_FIELDNAME,
-								effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, work.getJob()) == 0) {
-							Application application = application().pick(work.getApplication());
-							Process process = process().pick(work.getProcess());
-							if (!canManageApplicationOrProcess(effectivePerson, application, process)) {
-								return false;
-							}
+		if (emc.countEqualAndEqual(Review.class, Review.person_FIELDNAME,
+				effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, work.getJob()) == 0) {
+			if (emc.countEqualAndEqual(TaskCompleted.class, TaskCompleted.person_FIELDNAME,
+					effectivePerson.getDistinguishedName(), TaskCompleted.job_FIELDNAME, work.getJob()) == 0) {
+				if (emc.countEqualAndEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME,
+						effectivePerson.getDistinguishedName(), ReadCompleted.job_FIELDNAME, work.getJob()) == 0) {
+					if (emc.countEqualAndEqual(Task.class, Task.person_FIELDNAME, effectivePerson.getDistinguishedName(),
+							Task.job_FIELDNAME, work.getJob()) == 0) {
+						if (emc.countEqualAndEqual(Read.class, Read.person_FIELDNAME,
+								effectivePerson.getDistinguishedName(), Read.job_FIELDNAME, work.getJob()) == 0) {
+								Application application = application().pick(work.getApplication());
+								Process process = process().pick(work.getProcess());
+								if (!canManageApplicationOrProcess(effectivePerson, application, process)) {
+									return false;
+								}
 						}
 						}
 					}
 					}
 				}
 				}
@@ -1179,8 +1163,7 @@ public class Business {
 		if (effectivePerson.isManager()) {
 		if (effectivePerson.isManager()) {
 			return true;
 			return true;
 		}
 		}
-		if (emc.countEqualAndEqual(Task.class, Task.person_FIELDNAME, effectivePerson.getDistinguishedName(),
-				Task.work_FIELDNAME, work.getId()) > 0) {
+		if (this.task().countWithPersonWithJob(effectivePerson.getDistinguishedName(), work.getJob()) > 0) {
 			return true;
 			return true;
 		}
 		}
 		if (this.canManageApplicationOrProcess(effectivePerson, work.getApplication(), work.getProcess())) {
 		if (this.canManageApplicationOrProcess(effectivePerson, work.getApplication(), work.getProcess())) {

+ 46 - 34
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/config/ActionSave.java

@@ -1,6 +1,8 @@
 package com.x.program.center.jaxrs.config;
 package com.x.program.center.jaxrs.config;
 
 
+import com.google.gson.Gson;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonElement;
+import com.google.gson.JsonSyntaxException;
 import com.x.base.core.project.annotation.FieldDescribe;
 import com.x.base.core.project.annotation.FieldDescribe;
 import com.x.base.core.project.config.Config;
 import com.x.base.core.project.config.Config;
 import com.x.base.core.project.config.Nodes;
 import com.x.base.core.project.config.Nodes;
@@ -30,12 +32,22 @@ public class ActionSave extends BaseAction {
 		Wo wo = new Wo();
 		Wo wo = new Wo();
 		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 		String fileName = wi.getFileName();
 		String fileName = wi.getFileName();
-		
+
 		if(fileName == null) {
 		if(fileName == null) {
 			throw new ExceptionNameEmpty();
 			throw new ExceptionNameEmpty();
 		}
 		}
-		
+
 		String data = wi.getFileContent();
 		String data = wi.getFileContent();
+		Gson gson = new Gson();
+		JsonElement je = null;
+		try {
+			je = gson.fromJson(data, JsonElement.class);
+		} catch (Exception e) {
+			throw new ExceptionJsonError();
+		}
+		if ((null == je) || !je.isJsonObject()) {
+			throw new ExceptionJsonError();
+		}
 
 
 		if(!Config.nodes().centerServers().first().getValue().getConfigApiEnable()) {
 		if(!Config.nodes().centerServers().first().getValue().getConfigApiEnable()) {
 			throw new ExceptionModifyConfig();
 			throw new ExceptionModifyConfig();
@@ -45,18 +57,18 @@ public class ActionSave extends BaseAction {
 		if(!configFold.exists()){
 		if(!configFold.exists()){
 			configFold.mkdir();
 			configFold.mkdir();
 		}
 		}
-		
+
 		File file = new File(Config.base(),Config.DIR_CONFIG+"/"+fileName);
 		File file = new File(Config.base(),Config.DIR_CONFIG+"/"+fileName);
 		if(!file.exists()) {
 		if(!file.exists()) {
 			file.createNewFile();
 			file.createNewFile();
 		}
 		}
-		
+
 		if(file.exists()) {
 		if(file.exists()) {
 			if(file.isFile()) {
 			if(file.isFile()) {
 			    FileUtils.writeStringToFile(file, data, DefaultCharset.charset);
 			    FileUtils.writeStringToFile(file, data, DefaultCharset.charset);
 			}
 			}
 		}
 		}
-		
+
 		Nodes nodes = Config.nodes();
 		Nodes nodes = Config.nodes();
 		//同步config文件
 		//同步config文件
 		for (String node : nodes.keySet()){
 		for (String node : nodes.keySet()){
@@ -70,27 +82,27 @@ public class ActionSave extends BaseAction {
 		} catch (InterruptedException e) {
 		} catch (InterruptedException e) {
 		}
 		}
 		this.configFlush(effectivePerson);
 		this.configFlush(effectivePerson);
-	
+
 		wo.setTime(df.format(new Date()));
 		wo.setTime(df.format(new Date()));
 		wo.setStatus("success");
 		wo.setStatus("success");
 		result.setData(wo);
 		result.setData(wo);
-		
+
 		return result;
 		return result;
 	}
 	}
-	
 
 
 
 
-	
+
+
 	private boolean executeSyncFile(String syncFilePath , String nodeName ,int nodePort){
 	private boolean executeSyncFile(String syncFilePath , String nodeName ,int nodePort){
 		  boolean syncFileFlag = false;
 		  boolean syncFileFlag = false;
 		  File syncFile;
 		  File syncFile;
 		  InputStream fileInputStream = null;
 		  InputStream fileInputStream = null;
-		 
+
 		try (Socket socket = new Socket(nodeName, nodePort)) {
 		try (Socket socket = new Socket(nodeName, nodePort)) {
-			
+
 			syncFile = new File(Config.base(), syncFilePath);
 			syncFile = new File(Config.base(), syncFilePath);
 			fileInputStream= new FileInputStream(syncFile);
 			fileInputStream= new FileInputStream(syncFile);
-			 
+
 			socket.setKeepAlive(true);
 			socket.setKeepAlive(true);
 			socket.setSoTimeout(5000);
 			socket.setSoTimeout(5000);
 			DataOutputStream dos = null;
 			DataOutputStream dos = null;
@@ -98,17 +110,17 @@ public class ActionSave extends BaseAction {
 			try {
 			try {
 				dos = new DataOutputStream(socket.getOutputStream());
 				dos = new DataOutputStream(socket.getOutputStream());
 			    dis = new DataInputStream(socket.getInputStream());
 			    dis = new DataInputStream(socket.getInputStream());
-			    
+
 				Map<String, Object> commandObject = new HashMap<>();
 				Map<String, Object> commandObject = new HashMap<>();
 				commandObject.put("command", "syncFile:"+ syncFilePath);
 				commandObject.put("command", "syncFile:"+ syncFilePath);
 				commandObject.put("credential", Crypto.rsaEncrypt("o2@", Config.publicKey()));
 				commandObject.put("credential", Crypto.rsaEncrypt("o2@", Config.publicKey()));
 				dos.writeUTF(XGsonBuilder.toJson(commandObject));
 				dos.writeUTF(XGsonBuilder.toJson(commandObject));
 				dos.flush();
 				dos.flush();
-				
+
 				dos.writeUTF(syncFilePath);
 				dos.writeUTF(syncFilePath);
 				dos.flush();
 				dos.flush();
-				
-		
+
+
 				logger.info("同步文件starting.......");
 				logger.info("同步文件starting.......");
 				byte[] bytes = new byte[1024];
 				byte[] bytes = new byte[1024];
 				int length =0;
 				int length =0;
@@ -117,14 +129,14 @@ public class ActionSave extends BaseAction {
 					dos.flush();
 					dos.flush();
 				}
 				}
 				logger.info("同步文件end.......");
 				logger.info("同步文件end.......");
-				
+
 			}finally {
 			}finally {
 				dos.close();
 				dos.close();
 				dis.close();
 				dis.close();
 				socket.close();
 				socket.close();
 				fileInputStream.close();
 				fileInputStream.close();
 			}
 			}
-			
+
 			syncFileFlag = true;
 			syncFileFlag = true;
 		} catch (Exception ex) {
 		} catch (Exception ex) {
 			logger.error(ex);
 			logger.error(ex);
@@ -132,18 +144,18 @@ public class ActionSave extends BaseAction {
 		}
 		}
 		return syncFileFlag;
 		return syncFileFlag;
 	}
 	}
-	
+
 	public static class Wi  extends GsonPropertyObject{
 	public static class Wi  extends GsonPropertyObject{
-		
+
 		@FieldDescribe("服务器地址(*代表多台应用服务器)")
 		@FieldDescribe("服务器地址(*代表多台应用服务器)")
 		private String nodeName;
 		private String nodeName;
-		
+
 		@FieldDescribe("服务端口")
 		@FieldDescribe("服务端口")
 		private String nodePort;
 		private String nodePort;
-		
+
 		@FieldDescribe("文件名")
 		@FieldDescribe("文件名")
 		private String fileName;
 		private String fileName;
-		
+
 		@FieldDescribe("config文件内容")
 		@FieldDescribe("config文件内容")
 		private String fileContent;
 		private String fileContent;
 
 
@@ -171,16 +183,16 @@ public class ActionSave extends BaseAction {
 		public void setFileContent(String fileContent) {
 		public void setFileContent(String fileContent) {
 			this.fileContent = fileContent;
 			this.fileContent = fileContent;
 		}
 		}
-		
-		
-	
+
+
+
 	}
 	}
-	
+
 	public static class Wo extends GsonPropertyObject {
 	public static class Wo extends GsonPropertyObject {
-		
+
 		@FieldDescribe("执行时间")
 		@FieldDescribe("执行时间")
 		private String time;
 		private String time;
-		
+
 		@FieldDescribe("执行结果")
 		@FieldDescribe("执行结果")
 		private String status;
 		private String status;
 
 
@@ -192,15 +204,15 @@ public class ActionSave extends BaseAction {
 
 
 		@FieldDescribe("是否Sample")
 		@FieldDescribe("是否Sample")
 		private boolean isSample;
 		private boolean isSample;
-		
+
 		public String getTime() {
 		public String getTime() {
 			return time;
 			return time;
 		}
 		}
-		
+
 		public void setTime(String time) {
 		public void setTime(String time) {
 			this.time = time;
 			this.time = time;
 		}
 		}
-		
+
 		public String getStatus() {
 		public String getStatus() {
 			return status;
 			return status;
 		}
 		}
@@ -231,7 +243,7 @@ public class ActionSave extends BaseAction {
 		public void setMessage(String message) {
 		public void setMessage(String message) {
 			this.message = message;
 			this.message = message;
 		}
 		}
-		
+
 	}
 	}
-	
+
 }
 }

+ 12 - 0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/config/ExceptionJsonError.java

@@ -0,0 +1,12 @@
+package com.x.program.center.jaxrs.config;
+
+import com.x.base.core.project.exception.PromptException;
+
+class ExceptionJsonError extends PromptException {
+
+	private static final long serialVersionUID = 6084637626229970254L;
+
+	ExceptionJsonError() {
+		super("内容为非法json格式.");
+	}
+}

+ 7 - 3
o2server/x_program_center/src/main/java/com/x/program/center/schedule/TriggerAgent.java

@@ -5,6 +5,8 @@ import java.util.Date;
 import java.util.List;
 import java.util.List;
 import java.util.Optional;
 import java.util.Optional;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManager;
@@ -46,6 +48,8 @@ public class TriggerAgent extends BaseAction {
 
 
 	private static final CopyOnWriteArrayList<String> LOCK = new CopyOnWriteArrayList<>();
 	private static final CopyOnWriteArrayList<String> LOCK = new CopyOnWriteArrayList<>();
 
 
+	private static final ExecutorService executorService = Executors.newWorkStealingPool();
+
 	@Override
 	@Override
 	public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
 	public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
 		try {
 		try {
@@ -89,7 +93,7 @@ public class TriggerAgent extends BaseAction {
 							pair.getName(), pair.getCron(),
 							pair.getName(), pair.getCron(),
 							(pair.getLastStartTime() == null ? "" : DateTools.format(pair.getLastStartTime())));
 							(pair.getLastStartTime() == null ? "" : DateTools.format(pair.getLastStartTime())));
 					ExecuteThread thread = new ExecuteThread(agent);
 					ExecuteThread thread = new ExecuteThread(agent);
-					thread.start();
+					executorService.execute(thread);
 				}
 				}
 
 
 			}
 			}
@@ -170,7 +174,7 @@ public class TriggerAgent extends BaseAction {
 
 
 	}
 	}
 
 
-	public class ExecuteThread extends Thread {
+	public class ExecuteThread implements Runnable {
 
 
 		private Agent agent;
 		private Agent agent;
 
 
@@ -243,4 +247,4 @@ public class TriggerAgent extends BaseAction {
 
 
 	}
 	}
 
 
-}
+}