Просмотр исходного кода

全局设计搜索之script脚本搜索

o2sword 5 лет назад
Родитель
Сommit
06acbe60c8
14 измененных файлов с 834 добавлено и 3 удалено
  1. 58 0
      o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ActionManagerList.java
  2. 18 1
      o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAction.java
  3. 70 0
      o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ActionManagerList.java
  4. 18 1
      o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ScriptAction.java
  5. 71 0
      o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ActionManagerList.java
  6. 18 1
      o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ScriptAction.java
  7. 4 0
      o2server/x_query_service_processing/pom.xml
  8. 2 0
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/ActionApplication.java
  9. 10 0
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/DesignJaxrsFilter.java
  10. 312 0
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/ActionSearch.java
  11. 85 0
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/BaseAction.java
  12. 45 0
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/DesignAction.java
  13. 14 0
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/ExceptionFieldEmpty.java
  14. 109 0
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/WrapScript.java

+ 58 - 0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ActionManagerList.java

@@ -0,0 +1,58 @@
+package com.x.cms.assemble.control.jaxrs.script;
+
+import com.x.base.core.container.EntityManagerContainer;
+import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.entity.JpaObject;
+import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.bean.WrapCopier;
+import com.x.base.core.project.bean.WrapCopierFactory;
+import com.x.base.core.project.exception.ExceptionAccessDenied;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.cms.core.entity.AppInfo;
+import com.x.cms.core.entity.element.Script;
+
+import java.util.List;
+
+class ActionManagerList extends BaseAction {
+	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson) throws Exception {
+		if(!effectivePerson.isManager()){
+			throw new ExceptionAccessDenied(effectivePerson);
+		}
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			ActionResult<List<Wo>> result = new ActionResult<>();
+			List<Wo> wos = emc.fetchAll(Script.class,  Wo.copier);
+			wos.stream().forEach(wo -> {
+				try {
+					AppInfo appInfo = emc.find( wo.getAppId(), AppInfo.class );
+					if(appInfo != null){
+						wo.setAppName(appInfo.getAppName());
+					}
+				} catch (Exception e) {
+				}
+			});
+			result.setData(wos);
+			result.setCount((long)wos.size());
+			return result;
+		}
+	}
+
+	public static class Wo extends Script {
+
+		private static final long serialVersionUID = -8095369685452823624L;
+
+		static WrapCopier<Script, Wo> copier = WrapCopierFactory.wo(Script.class, Wo.class,
+				JpaObject.singularAttributeField(Script.class, true, false),null);
+
+		@FieldDescribe("应用名称.")
+		private String appName;
+
+		public String getAppName() {
+			return appName;
+		}
+
+		public void setAppName(String appName) {
+			this.appName = appName;
+		}
+	}
+}

+ 18 - 1
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAction.java

@@ -258,4 +258,21 @@ public class ScriptAction extends StandardJaxrsAction {
 		}
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
-}
+
+	@JaxrsMethodDescribe(value = "列示Script对象(管理员权限).", action = ActionManagerList.class)
+	@GET
+	@Path("list/manager")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void managerList(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
+		ActionResult<List<ActionManagerList.Wo>> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionManagerList().execute(effectivePerson);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+}

+ 70 - 0
o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ActionManagerList.java

@@ -0,0 +1,70 @@
+package com.x.portal.assemble.designer.jaxrs.script;
+
+import com.x.base.core.container.EntityManagerContainer;
+import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.entity.JpaObject;
+import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.bean.WrapCopier;
+import com.x.base.core.project.bean.WrapCopierFactory;
+import com.x.base.core.project.exception.ExceptionAccessDenied;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.portal.core.entity.Portal;
+import com.x.portal.core.entity.Script;
+
+import java.util.List;
+
+class ActionManagerList extends BaseAction {
+	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson) throws Exception {
+		if(!effectivePerson.isManager()){
+			throw new ExceptionAccessDenied(effectivePerson);
+		}
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			ActionResult<List<Wo>> result = new ActionResult<>();
+			List<Wo> wos = emc.fetchAll(Script.class,  Wo.copier);
+			wos.stream().forEach(wo -> {
+				try {
+					Portal portal = emc.find(wo.getPortal(), Portal.class);
+					if(portal != null){
+						wo.setAppId(portal.getId());
+						wo.setAppName(portal.getName());
+					}
+				} catch (Exception e) {
+				}
+			});
+			result.setData(wos);
+			result.setCount((long)wos.size());
+			return result;
+		}
+	}
+
+	public static class Wo extends Script {
+
+		private static final long serialVersionUID = -8095369685452823624L;
+
+		static WrapCopier<Script, Wo> copier = WrapCopierFactory.wo(Script.class, Wo.class,
+				JpaObject.singularAttributeField(Script.class, true, false),null);
+
+		@FieldDescribe("应用Id.")
+		private String appId;
+
+		@FieldDescribe("应用名称.")
+		private String appName;
+
+		public String getAppId() {
+			return appId;
+		}
+
+		public void setAppId(String appId) {
+			this.appId = appId;
+		}
+
+		public String getAppName() {
+			return appName;
+		}
+
+		public void setAppName(String appName) {
+			this.appName = appName;
+		}
+	}
+}

+ 18 - 1
o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ScriptAction.java

@@ -142,4 +142,21 @@ public class ScriptAction extends StandardJaxrsAction {
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
 
-}
+	@JaxrsMethodDescribe(value = "列示Script对象(管理员权限).", action = ActionManagerList.class)
+	@GET
+	@Path("list/manager")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void managerList(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
+		ActionResult<List<ActionManagerList.Wo>> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionManagerList().execute(effectivePerson);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
+}

+ 71 - 0
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ActionManagerList.java

@@ -0,0 +1,71 @@
+package com.x.processplatform.assemble.designer.jaxrs.script;
+
+import com.x.base.core.container.EntityManagerContainer;
+import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.entity.JpaObject;
+import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.bean.WrapCopier;
+import com.x.base.core.project.bean.WrapCopierFactory;
+import com.x.base.core.project.exception.ExceptionAccessDenied;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.tools.ListTools;
+import com.x.processplatform.core.entity.element.Application;
+import com.x.processplatform.core.entity.element.Script;
+
+import java.util.List;
+
+class ActionManagerList extends BaseAction {
+	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson) throws Exception {
+		if(!effectivePerson.isManager()){
+			throw new ExceptionAccessDenied(effectivePerson);
+		}
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			ActionResult<List<Wo>> result = new ActionResult<>();
+			List<Wo> wos = emc.fetchAll(Script.class,  Wo.copier);
+			wos.stream().forEach(wo -> {
+				try {
+					Application app = emc.find(wo.getApplication(), Application.class);
+					if(app != null){
+						wo.setAppId(app.getId());
+						wo.setAppName(app.getName());
+					}
+				} catch (Exception e) {
+				}
+			});
+			result.setData(wos);
+			result.setCount((long)wos.size());
+			return result;
+		}
+	}
+
+	public static class Wo extends Script {
+
+		private static final long serialVersionUID = -8095369685452823624L;
+
+		static WrapCopier<Script, Wo> copier = WrapCopierFactory.wo(Script.class, Wo.class,
+				JpaObject.singularAttributeField(Script.class, true, false),null);
+
+		@FieldDescribe("应用Id.")
+		private String appId;
+
+		@FieldDescribe("应用名称.")
+		private String appName;
+
+		public String getAppId() {
+			return appId;
+		}
+
+		public void setAppId(String appId) {
+			this.appId = appId;
+		}
+
+		public String getAppName() {
+			return appName;
+		}
+
+		public void setAppName(String appName) {
+			this.appName = appName;
+		}
+	}
+}

+ 18 - 1
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ScriptAction.java

@@ -199,4 +199,21 @@ public class ScriptAction extends StandardJaxrsAction {
 		}
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
-}
+
+	@JaxrsMethodDescribe(value = "列示Script对象(管理员权限).", action = ActionManagerList.class)
+	@GET
+	@Path("list/manager")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void managerList(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
+		ActionResult<List<ActionManagerList.Wo>> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionManagerList().execute(effectivePerson);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+}

+ 4 - 0
o2server/x_query_service_processing/pom.xml

@@ -44,6 +44,10 @@
 			<groupId>o2oa</groupId>
 			<artifactId>x_cms_core_express</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>o2oa</groupId>
+			<artifactId>x_portal_core_entity</artifactId>
+		</dependency>
 	</dependencies>
 	<build>
 		<plugins>

+ 2 - 0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/ActionApplication.java

@@ -5,6 +5,7 @@ import java.util.Set;
 import javax.ws.rs.ApplicationPath;
 
 import com.x.base.core.project.jaxrs.AbstractActionApplication;
+import com.x.query.service.processing.jaxrs.design.DesignAction;
 import com.x.query.service.processing.jaxrs.neural.NeuralAction;
 import com.x.query.service.processing.jaxrs.segment.SegmentAction;
 import com.x.query.service.processing.jaxrs.test.TestAction;
@@ -16,6 +17,7 @@ public class ActionApplication extends AbstractActionApplication {
 		classes.add(TestAction.class);
 		classes.add(NeuralAction.class);
 		classes.add(SegmentAction.class);
+		classes.add(DesignAction.class);
 		return classes;
 	}
 

+ 10 - 0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/DesignJaxrsFilter.java

@@ -0,0 +1,10 @@
+package com.x.query.service.processing.jaxrs;
+
+import com.x.base.core.project.jaxrs.CipherManagerUserJaxrsFilter;
+
+import javax.servlet.annotation.WebFilter;
+
+@WebFilter(urlPatterns = "/jaxrs/design/*", asyncSupported = true)
+public class DesignJaxrsFilter extends CipherManagerUserJaxrsFilter {
+
+}

+ 312 - 0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/ActionSearch.java

@@ -0,0 +1,312 @@
+package com.x.query.service.processing.jaxrs.design;
+
+import com.google.gson.JsonElement;
+import com.x.base.core.project.Applications;
+import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.gson.GsonPropertyObject;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.tools.ListTools;
+import com.x.base.core.project.tools.SortTools;
+import com.x.base.core.project.x_cms_assemble_control;
+import com.x.base.core.project.x_portal_assemble_designer;
+import com.x.base.core.project.x_processplatform_assemble_designer;
+import com.x.query.service.processing.ThisApplication;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+
+class ActionSearch extends BaseAction {
+
+	private static Logger logger = LoggerFactory.getLogger(ActionSearch.class);
+
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement)
+			throws Exception {
+		ActionResult<Wo> result = new ActionResult<>();
+		Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
+		Wo wo = new Wo();
+		wo.setType(wi.getType());
+		if(StringUtils.isBlank(wi.getKeyword())){
+			throw new ExceptionFieldEmpty("keyword");
+		}
+		if(StringUtils.isBlank(wi.getType())){
+			throw new ExceptionFieldEmpty("type");
+		}
+		logger.print("{}搜索全局设计:{},关键字:{}", effectivePerson.getDistinguishedName(), wi.getType(), wi.getKeyword());
+		switch (wi.getType()) {
+			case "script":
+				wo.setScriptWrapList(searchScript(wi));
+				break;
+			default:
+				throw new ExceptionFieldEmpty("type");
+		}
+		result.setData(wo);
+		return result;
+	}
+
+	private List<ScriptWo> searchScript(final Wi wi) throws Exception{
+		List<ScriptWo> scriptWoList = new ArrayList<>();
+		CompletableFuture<List<ScriptWo>> cmsCf = CompletableFuture.supplyAsync(() -> {
+			List<ScriptWo> swList = new ArrayList<>();
+			try {
+				List<WrapScript> scriptList = ThisApplication.context().applications().getQuery(x_cms_assemble_control.class,
+						Applications.joinQueryUri("script", "list", "manager"), null).getDataAsList(WrapScript.class);
+				logger.print("CMS的脚本个数:{}",scriptList.size());
+				getScriptSearchRes(wi,"cms",  swList, scriptList);
+			} catch (Exception e) {
+				logger.error(e);
+			}
+			if (swList.size()>2){
+				try {
+					SortTools.desc(swList, "appId");
+				} catch (Exception e) {
+				}
+			}
+			return swList;
+		});
+
+		CompletableFuture<List<ScriptWo>> portalCf = CompletableFuture.supplyAsync(() -> {
+			List<ScriptWo> swList = new ArrayList<>();
+			try {
+				List<WrapScript> scriptList = ThisApplication.context().applications().getQuery(x_portal_assemble_designer.class,
+						Applications.joinQueryUri("script", "list", "manager"), null).getDataAsList(WrapScript.class);
+				logger.print("门户的脚本个数:{}",scriptList.size());
+				getScriptSearchRes(wi,"portal",  swList, scriptList);
+			} catch (Exception e) {
+				logger.error(e);
+			}
+			if (swList.size()>2){
+				try {
+					SortTools.desc(swList, "appId");
+				} catch (Exception e) {
+				}
+			}
+			return swList;
+		});
+
+		CompletableFuture<List<ScriptWo>> processPlatformCf = CompletableFuture.supplyAsync(() -> {
+			List<ScriptWo> swList = new ArrayList<>();
+			try {
+				List<WrapScript> scriptList = ThisApplication.context().applications().getQuery(x_processplatform_assemble_designer.class,
+						Applications.joinQueryUri("script", "list", "manager"), null).getDataAsList(WrapScript.class);
+				logger.print("流程平台的脚本个数:{}",scriptList.size());
+				getScriptSearchRes(wi,"processPlatform", swList, scriptList);
+			} catch (Exception e) {
+				logger.error(e);
+			}
+			if (swList.size()>2){
+				try {
+					SortTools.desc(swList, "appId");
+				} catch (Exception e) {
+				}
+			}
+			return swList;
+		});
+
+		scriptWoList.addAll(processPlatformCf.get());
+		scriptWoList.addAll(portalCf.get());
+		scriptWoList.addAll(cmsCf.get());
+
+		return scriptWoList;
+	}
+
+	private void getScriptSearchRes(final Wi wi, String moduleType, List<ScriptWo> swList, List<WrapScript> scriptList){
+		if (!ListTools.isEmpty(scriptList)){
+			for (WrapScript script:scriptList) {
+				if (keywordMatch(wi.getKeyword(), script.getText(), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
+					List<Integer> list = patternLines(script.getId()+"-"+script.getUpdateTime().getTime(),
+							wi.getKeyword(), script.getText(), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
+					if (!ListTools.isEmpty(list)){
+						ScriptWo scriptWo = new ScriptWo();
+						scriptWo.setModuleType(moduleType);
+						scriptWo.setAppId(script.getAppId());
+						scriptWo.setAppName(script.getAppName());
+						scriptWo.setScriptId(script.getId());
+						scriptWo.setScriptName(script.getName());
+						scriptWo.setPatternLines(list);
+						swList.add(scriptWo);
+					}
+				}
+			}
+		}
+	}
+
+	public static class Wi extends GsonPropertyObject {
+		private static final long serialVersionUID = 4015406081411685640L;
+
+		@FieldDescribe("搜索关键字.")
+		private String keyword;
+		@FieldDescribe("搜索类型:script|form|process")
+		private String type;
+		@FieldDescribe("是否区分大小写.")
+		private Boolean caseSensitive;
+		@FieldDescribe("是否全字匹配.")
+		private Boolean matchWholeWord;
+		@FieldDescribe("是否正则表达式匹配.")
+		private Boolean matchRegExp;
+		@FieldDescribe("限制查询的模块列表.")
+		private List<Module> moduleList;
+
+		public String getKeyword() {
+			return keyword;
+		}
+
+		public void setKeyword(String keyword) {
+			this.keyword = keyword;
+		}
+
+		public String getType() {
+			return type;
+		}
+
+		public void setType(String type) {
+			this.type = type;
+		}
+
+		public Boolean getCaseSensitive() {
+			return caseSensitive;
+		}
+
+		public void setCaseSensitive(Boolean caseSensitive) {
+			this.caseSensitive = caseSensitive;
+		}
+
+		public Boolean getMatchWholeWord() {
+			return matchWholeWord;
+		}
+
+		public void setMatchWholeWord(Boolean matchWholeWord) {
+			this.matchWholeWord = matchWholeWord;
+		}
+
+		public Boolean getMatchRegExp() {
+			return matchRegExp;
+		}
+
+		public void setMatchRegExp(Boolean matchRegExp) {
+			this.matchRegExp = matchRegExp;
+		}
+
+		public List<Module> getModuleList() {
+			return moduleList;
+		}
+
+		public void setModuleList(List<Module> moduleList) {
+			this.moduleList = moduleList;
+		}
+	}
+
+	public static class Module extends GsonPropertyObject {
+		@FieldDescribe("模块的应用关键字.")
+		private String flag;
+		@FieldDescribe("模块类型:processPlatform|cms|portal|query|service")
+		private String moduleType;
+
+		public String getFlag() {
+			return flag;
+		}
+
+		public void setFlag(String flag) {
+			this.flag = flag;
+		}
+
+		public String getModuleType() {
+			return moduleType;
+		}
+
+		public void setModuleType(String moduleType) {
+			this.moduleType = moduleType;
+		}
+	}
+
+	public static class Wo extends GsonPropertyObject {
+		@FieldDescribe("搜索类型:script|form|process")
+		private String type;
+		@FieldDescribe("脚本搜索结果集")
+		private List<ScriptWo> scriptWrapList = new ArrayList<>();
+
+		public String getType() {
+			return type;
+		}
+
+		public void setType(String type) {
+			this.type = type;
+		}
+
+		public List<ScriptWo> getScriptWrapList() {
+			return scriptWrapList;
+		}
+
+		public void setScriptWrapList(List<ScriptWo> scriptWrapList) {
+			this.scriptWrapList = scriptWrapList;
+		}
+	}
+
+	public static class ScriptWo extends GsonPropertyObject {
+		@FieldDescribe("模块类型:processPlatform|cms|portal|query|service")
+		private String moduleType;
+		@FieldDescribe("应用ID")
+		private String appId;
+		@FieldDescribe("应用名称")
+		private String appName;
+		@FieldDescribe("脚本Id")
+		private String scriptId;
+		@FieldDescribe("脚本名称")
+		private String scriptName;
+		@FieldDescribe("匹配行")
+		private List<Integer> patternLines;
+
+		public String getModuleType() {
+			return moduleType;
+		}
+
+		public void setModuleType(String moduleType) {
+			this.moduleType = moduleType;
+		}
+
+		public String getAppId() {
+			return appId;
+		}
+
+		public void setAppId(String appId) {
+			this.appId = appId;
+		}
+
+		public String getAppName() {
+			return appName;
+		}
+
+		public void setAppName(String appName) {
+			this.appName = appName;
+		}
+
+		public String getScriptId() {
+			return scriptId;
+		}
+
+		public void setScriptId(String scriptId) {
+			this.scriptId = scriptId;
+		}
+
+		public String getScriptName() {
+			return scriptName;
+		}
+
+		public void setScriptName(String scriptName) {
+			this.scriptName = scriptName;
+		}
+
+		public List<Integer> getPatternLines() {
+			return patternLines;
+		}
+
+		public void setPatternLines(List<Integer> patternLines) {
+			this.patternLines = patternLines;
+		}
+	}
+
+}

+ 85 - 0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/BaseAction.java

@@ -0,0 +1,85 @@
+package com.x.query.service.processing.jaxrs.design;
+
+import com.x.base.core.project.config.Config;
+import com.x.base.core.project.jaxrs.StandardJaxrsAction;
+import com.x.base.core.project.tools.DefaultCharset;
+import com.x.base.core.project.tools.FileTools;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.File;
+import java.io.RandomAccessFile;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+abstract class BaseAction extends StandardJaxrsAction {
+
+    protected boolean keywordMatch(String keyword, String content, Boolean caseSensitive, Boolean matchWholeWord, Boolean matchRegExp){
+        if(StringUtils.isBlank(keyword) || StringUtils.isBlank(content)){
+            return false;
+        }
+        if(BooleanUtils.isTrue(matchRegExp)){
+            Pattern pattern = Pattern.compile(keyword);
+            Matcher matcher = pattern.matcher(content);
+            return matcher.find();
+        }else if(BooleanUtils.isTrue(matchWholeWord)){
+            if(BooleanUtils.isTrue(caseSensitive)) {
+                Pattern pattern = Pattern.compile("\\b(" + keyword + ")\\b");
+                Matcher matcher = pattern.matcher(content);
+                return matcher.find();
+            }else{
+                Pattern pattern = Pattern.compile("\\b(" + keyword + ")\\b", Pattern.CASE_INSENSITIVE);
+                Matcher matcher = pattern.matcher(content);
+                return matcher.find();
+            }
+        }else{
+            if(BooleanUtils.isTrue(caseSensitive)) {
+                return (content.indexOf(keyword) > -1);
+            }else{
+                return (content.toLowerCase().indexOf(keyword.toLowerCase()) > -1);
+            }
+        }
+    }
+
+    protected List<Integer> patternLines(String id, String keyword, String content, Boolean caseSensitive, Boolean matchWholeWord, Boolean matchRegExp){
+        List<Integer> list = new ArrayList<>();
+        File file = readFile(id, content);
+        if (file!=null){
+            try (RandomAccessFile randomFile = new RandomAccessFile(file, "r")) {
+                int curReadLine = 0;
+                String tmp = "";
+                while ((tmp = randomFile.readLine()) != null) {
+                    curReadLine++;
+                    byte[] bytes = tmp.getBytes("ISO8859-1");
+                    String lineStr = new String(bytes);
+                    if(StringUtils.isNotBlank(lineStr) && lineStr.length()>=keyword.length()){
+                        if(keywordMatch(keyword, lineStr, caseSensitive, matchWholeWord, matchRegExp)){
+                            list.add(curReadLine);
+                        }
+                    }
+                }
+            }catch (Exception e){
+                e.printStackTrace();
+            }
+        }
+        return list;
+    }
+
+    private synchronized File readFile(String id, String content){
+        try {
+            File searchFile = new File(Config.base(), "local/search");
+            FileTools.forceMkdir(searchFile);
+            File file = new File(searchFile.getAbsolutePath(), id+".txt");
+            if (!file.exists()){
+                FileUtils.writeByteArrayToFile(file, content.getBytes(DefaultCharset.name));
+            }
+            return file;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

+ 45 - 0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/DesignAction.java

@@ -0,0 +1,45 @@
+package com.x.query.service.processing.jaxrs.design;
+
+import com.google.gson.JsonElement;
+import com.x.base.core.project.annotation.JaxrsDescribe;
+import com.x.base.core.project.annotation.JaxrsMethodDescribe;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.http.HttpMediaType;
+import com.x.base.core.project.jaxrs.ResponseFactory;
+import com.x.base.core.project.jaxrs.StandardJaxrsAction;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.*;
+import javax.ws.rs.container.AsyncResponse;
+import javax.ws.rs.container.Suspended;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+
+@Path("design")
+@JaxrsDescribe("设计")
+public class DesignAction extends StandardJaxrsAction {
+
+	private static Logger logger = LoggerFactory.getLogger(DesignAction.class);
+
+	@JaxrsMethodDescribe(value = "全局设计搜索.", action = ActionSearch.class)
+	@POST
+	@Path("search")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void search(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+					   JsonElement jsonElement) {
+		ActionResult<ActionSearch.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionSearch().execute(effectivePerson, jsonElement);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
+}

+ 14 - 0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/ExceptionFieldEmpty.java

@@ -0,0 +1,14 @@
+package com.x.query.service.processing.jaxrs.design;
+
+import com.x.base.core.project.exception.PromptException;
+
+public class ExceptionFieldEmpty extends PromptException {
+
+
+	private static final long serialVersionUID = -87643358931771164L;
+
+	public ExceptionFieldEmpty(String field) {
+		super("参数: {} 值无效.", field);
+	}
+
+}

+ 109 - 0
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/WrapScript.java

@@ -0,0 +1,109 @@
+package com.x.query.service.processing.jaxrs.design;
+
+import com.x.base.core.project.gson.GsonPropertyObject;
+
+import java.util.Date;
+
+public class WrapScript extends GsonPropertyObject {
+    private static final long serialVersionUID = 2563902286060447795L;
+
+    private String id;
+    private String name;
+    private String alias;
+    private String text;
+    private String appName;
+    private String appId;
+    private String portalName;
+    private String portal;
+    private String applicationName;
+    private String application;
+    private Date updateTime;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAlias() {
+        return alias;
+    }
+
+    public void setAlias(String alias) {
+        this.alias = alias;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public String getAppName() {
+        return appName;
+    }
+
+    public void setAppName(String appName) {
+        this.appName = appName;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public String getPortalName() {
+        return portalName;
+    }
+
+    public void setPortalName(String portalName) {
+        this.portalName = portalName;
+    }
+
+    public String getPortal() {
+        return portal;
+    }
+
+    public void setPortal(String portal) {
+        this.portal = portal;
+    }
+
+    public String getApplicationName() {
+        return applicationName;
+    }
+
+    public void setApplicationName(String applicationName) {
+        this.applicationName = applicationName;
+    }
+
+    public String getApplication() {
+        return application;
+    }
+
+    public void setApplication(String application) {
+        this.application = application;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}