Browse Source

Merge branch 'wrdp' into 'develop'

Wrdp

See merge request o2oa/o2oa!2843
o2null 5 years ago
parent
commit
5f87072e9b

+ 1 - 1
gulpfile.js

@@ -835,7 +835,7 @@ function build_web_api() {
 
 
 function build_doc(){
 function build_doc(){
     return getGitV().then(function(arr){
     return getGitV().then(function(arr){
-        return (shell.task('jsdoc -c o2web/jsdoc.conf.json -q version=('+arr[0]+'-'+arr[1]+')'))();
+        return (shell.task('jsdoc -c o2web/jsdoc.conf.json -q version=\'('+arr[0]+'-'+arr[1]+')\''))();
     });
     });
 }
 }
 exports.build_api = gulp.series(build_doc, build_web_api);
 exports.build_api = gulp.series(build_doc, build_web_api);

+ 9 - 8
o2server/x_console/src/main/java/com/x/server/console/action/DumpData.java

@@ -138,13 +138,14 @@ public class DumpData {
 			List<String> list = new ArrayList<>();
 			List<String> list = new ArrayList<>();
 			if (StringUtils.equals(Config.dumpRestoreData().getMode(), DumpRestoreData.TYPE_FULL)) {
 			if (StringUtils.equals(Config.dumpRestoreData().getMode(), DumpRestoreData.TYPE_FULL)) {
 				list.addAll((List<String>) Config.resource(Config.RESOURCE_CONTAINERENTITYNAMES));
 				list.addAll((List<String>) Config.resource(Config.RESOURCE_CONTAINERENTITYNAMES));
-				return list;
-			}
-			for (String str : (List<String>) Config.resource(Config.RESOURCE_CONTAINERENTITYNAMES)) {
-				Class<?> cls = Thread.currentThread().getContextClassLoader().loadClass(str);
-				ContainerEntity containerEntity = cls.getAnnotation(ContainerEntity.class);
-				if (Objects.equals(containerEntity.reference(), Reference.strong)) {
-					list.add(str);
+				//return list;
+			}else {
+				for (String str : (List<String>) Config.resource(Config.RESOURCE_CONTAINERENTITYNAMES)) {
+					Class<?> cls = Thread.currentThread().getContextClassLoader().loadClass(str);
+					ContainerEntity containerEntity = cls.getAnnotation(ContainerEntity.class);
+					if (Objects.equals(containerEntity.reference(), Reference.strong)) {
+						list.add(str);
+					}
 				}
 				}
 			}
 			}
 			return ListTools.includesExcludesWildcard(list, Config.dumpRestoreData().getIncludes(),
 			return ListTools.includesExcludesWildcard(list, Config.dumpRestoreData().getIncludes(),
@@ -229,4 +230,4 @@ public class DumpData {
 			}
 			}
 		}
 		}
 	}
 	}
-}
+}

+ 13 - 1
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/unit/ActionGet.java

@@ -1,5 +1,6 @@
 package com.x.organization.assemble.control.jaxrs.unit;
 package com.x.organization.assemble.control.jaxrs.unit;
 
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 import java.util.Optional;
 import java.util.Optional;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -252,7 +253,7 @@ class ActionGet extends BaseAction {
 	}
 	}
 
 
 	private void referenceIdentity(Business business, WoUnitDuty woUnitDuty) throws Exception {
 	private void referenceIdentity(Business business, WoUnitDuty woUnitDuty) throws Exception {
-		EntityManager em = business.entityManagerContainer().get(Identity.class);
+		/*EntityManager em = business.entityManagerContainer().get(Identity.class);
 		CriteriaBuilder cb = em.getCriteriaBuilder();
 		CriteriaBuilder cb = em.getCriteriaBuilder();
 		CriteriaQuery<Identity> cq = cb.createQuery(Identity.class);
 		CriteriaQuery<Identity> cq = cb.createQuery(Identity.class);
 		Root<Identity> root = cq.from(Identity.class);
 		Root<Identity> root = cq.from(Identity.class);
@@ -263,6 +264,17 @@ class ActionGet extends BaseAction {
 			this.referencePerson(business, woIdentity);
 			this.referencePerson(business, woIdentity);
 		}
 		}
 		wos = business.identity().sort(wos);
 		wos = business.identity().sort(wos);
+		*/
+		//职务成员需要保证顺序,但没有顺序号只能一个一个查询
+		List<WoIdentity> wos = new ArrayList<>();
+		if(ListTools.isNotEmpty(woUnitDuty.getIdentityList())){
+			for (String id : woUnitDuty.getIdentityList()){
+				Identity identity = business.identity().pick(id);
+				if(identity!=null) {
+					wos.add(WoIdentity.copier.copy(identity));
+				}
+			}
+		}
 		woUnitDuty.setWoIdentityList(wos);
 		woUnitDuty.setWoIdentityList(wos);
 	}
 	}
 
 

+ 15 - 29
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/designer/ActionSearch.java

@@ -170,42 +170,28 @@ class ActionSearch extends BaseAction {
 		}catch (Exception e){
 		}catch (Exception e){
 			logger.error(e);
 			logger.error(e);
 		}
 		}
-		Executor executor = Executors.newFixedThreadPool(batchList.size());
-		List<CompletableFuture<List<Wo>>> cfList = new ArrayList<>();
+		List<Wo> resWos = new ArrayList<>();
 		for (List<String> partProcessIds : batchList) {
 		for (List<String> partProcessIds : batchList) {
-			CompletableFuture<List<Wo>> cf = CompletableFuture.supplyAsync(() -> {
-				List<Wo> resWos = new ArrayList<>();
-				try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-					Business business = new Business(emc);
-					List<Process> processList = emc.list(Process.class, partProcessIds);
-					for (Process process : processList) {
-						try {
-							Wo wo = doProcessSearch(business, process, wi);
-							if (wo!=null){
-								resWos.add(wo);
-							}
-						} catch (Exception e) {
-							logger.error(e);
+			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+				Business business = new Business(emc);
+				List<Process> processList = emc.list(Process.class, partProcessIds);
+				for (Process process : processList) {
+					try {
+						Wo wo = doProcessSearch(business, process, wi);
+						if (wo!=null){
+							resWos.add(wo);
 						}
 						}
+					} catch (Exception e) {
+						logger.error(e);
 					}
 					}
-					processList.clear();
-					processList = null;
-				}catch (Exception e){
-					logger.error(e);
 				}
 				}
-				return resWos;
-			}, executor);
-			cfList.add(cf);
-		}
-		List<Wo> woList = new ArrayList<>();
-		for (CompletableFuture<List<Wo>> cf : cfList){
-			try {
-				woList.addAll(cf.get(30, TimeUnit.SECONDS));
-			} catch (Exception e){
+				processList.clear();
+				processList = null;
+			}catch (Exception e){
 				logger.error(e);
 				logger.error(e);
 			}
 			}
 		}
 		}
-		return woList;
+		return resWos;
 	}
 	}
 
 
 
 

+ 79 - 0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionManageBatchUpdate.java

@@ -0,0 +1,79 @@
+package com.x.processplatform.assemble.surface.jaxrs.attachment;
+
+import com.x.base.core.container.EntityManagerContainer;
+import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.project.config.Config;
+import com.x.base.core.project.config.StorageMapping;
+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.jaxrs.WrapBoolean;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.tools.ExtractTextTools;
+import com.x.base.core.project.tools.ListTools;
+import com.x.processplatform.assemble.surface.Business;
+import com.x.processplatform.assemble.surface.ThisApplication;
+import com.x.processplatform.core.entity.content.Attachment;
+import org.apache.commons.lang3.StringUtils;
+import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
+
+import java.util.List;
+
+class ActionManageBatchUpdate extends BaseAction {
+
+	private static Logger logger = LoggerFactory.getLogger(ActionManageBatchUpdate.class);
+
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, String ids, String fileName, byte[] bytes,
+			FormDataContentDisposition disposition, String extraParam) throws Exception {
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			logger.print("manageBatchUpdate receive id:{}, fileName:{}, effectivePerson:{}.", ids, fileName, effectivePerson.getDistinguishedName());
+			ActionResult<Wo> result = new ActionResult<>();
+			Business business = new Business(emc);
+			if(!business.canManageApplication(effectivePerson, null)){
+				throw new ExceptionAccessDenied(effectivePerson);
+			}
+			/* 天谷印章扩展 */
+			if (StringUtils.isNotEmpty(extraParam)) {
+				WiExtraParam wiExtraParam = gson.fromJson(extraParam, WiExtraParam.class);
+				if (StringUtils.isNotEmpty(wiExtraParam.getFileName())) {
+					fileName = wiExtraParam.getFileName();
+				}
+			}
+
+			if (StringUtils.isEmpty(fileName)) {
+				fileName = this.fileName(disposition);
+			}
+			if(StringUtils.isNotEmpty(ids) && bytes!=null && bytes.length>0){
+				String[] idArray = ids.split(",");
+				for (String id : idArray){
+					Attachment attachment = emc.find(id.trim(), Attachment.class);
+					if(attachment!=null){
+						StorageMapping mapping = ThisApplication.context().storageMappings().get(Attachment.class,
+								attachment.getStorage());
+						emc.beginTransaction(Attachment.class);
+						attachment.updateContent(mapping, bytes, fileName);
+						if (Config.query().getExtractImage() && ExtractTextTools.supportImage(attachment.getName())
+								&& ExtractTextTools.available(bytes)) {
+							attachment.setText(ExtractTextTools.image(bytes));
+							logger.debug("filename:{}, file type:{}, text:{}.", attachment.getName(), attachment.getType(),
+									attachment.getText());
+						}
+						emc.commit();
+
+					}
+				}
+			}
+
+			Wo wo = new Wo();
+			wo.setValue(true);
+			result.setData(wo);
+			return result;
+		}
+	}
+
+	public static class Wo extends WrapBoolean {
+
+	}
+
+}

+ 24 - 1
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/AttachmentAction.java

@@ -1154,4 +1154,27 @@ public class AttachmentAction extends StandardJaxrsAction {
 		}
 		}
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
 	}
-}
+
+	@JaxrsMethodDescribe(value = "管理员批量替换附件.", action = ActionManageBatchUpdate.class)
+	@POST
+	@Path("batch/update/manage")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.MULTIPART_FORM_DATA)
+	public void manageBatchUpdate(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+							 @JaxrsParameterDescribe("附件Id列表,多值逗号隔开") @FormDataParam("ids") String ids,
+							 @JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName,
+							 @JaxrsParameterDescribe("天印扩展字段") @FormDataParam("extraParam") String extraParam,
+							 @FormDataParam(FILE_FIELD) final byte[] bytes,
+							 @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
+		ActionResult<ActionManageBatchUpdate.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionManageBatchUpdate().execute(effectivePerson, ids, fileName, bytes, disposition,
+					extraParam);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+}

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

@@ -34,7 +34,7 @@ class ActionSearch extends BaseAction {
 		if(StringUtils.isBlank(wi.getKeyword())){
 		if(StringUtils.isBlank(wi.getKeyword())){
 			throw new ExceptionFieldEmpty("keyword");
 			throw new ExceptionFieldEmpty("keyword");
 		}
 		}
-		logger.info("{}搜索设计:{}的关键字:{}", effectivePerson.getDistinguishedName(), wi.getModuleList(), wi.getKeyword());
+		logger.debug("{}搜索设计:{}的关键字:{}", effectivePerson.getDistinguishedName(), wi.getModuleList(), wi.getKeyword());
 		if (ListTools.isNotEmpty(wi.getModuleList())) {
 		if (ListTools.isNotEmpty(wi.getModuleList())) {
 			result.setData(search(wi, effectivePerson));
 			result.setData(search(wi, effectivePerson));
 		}else{
 		}else{
@@ -92,67 +92,38 @@ class ActionSearch extends BaseAction {
 				moduleMap.put(ModuleType.service.toString(), list);
 				moduleMap.put(ModuleType.service.toString(), list);
 			}
 			}
 		}
 		}
-		Executor executor = Executors.newFixedThreadPool(5);
-		CompletableFuture<List<WrapDesigner>> processPlatformCf = searchAsync(wi, moduleMap, ModuleType.processPlatform.toString(), x_processplatform_assemble_designer.class, executor);
-		CompletableFuture<List<WrapDesigner>> portalCf = searchAsync(wi, moduleMap, ModuleType.portal.toString(), x_portal_assemble_designer.class, executor);
-		CompletableFuture<List<WrapDesigner>> cmsCf = searchAsync(wi, moduleMap, ModuleType.cms.toString(), x_cms_assemble_control.class, executor);
-		CompletableFuture<List<WrapDesigner>> queryCf = searchAsync(wi, moduleMap, ModuleType.query.toString(), x_query_assemble_designer.class, executor);
-		CompletableFuture<List<WrapDesigner>> serviceCf = searchAsync(wi, moduleMap, ModuleType.service.toString(), x_program_center.class, executor);
 		Wo wo = new Wo();
 		Wo wo = new Wo();
-		try {
-			wo.setProcessPlatformList(processPlatformCf.get(200, TimeUnit.SECONDS));
-		} catch (Exception e) {
-			logger.warn("搜索流程平台设计异常:{}",e.getMessage());
-		}
-		try {
-			wo.setPortalList(portalCf.get(200, TimeUnit.SECONDS));
-		} catch (Exception e) {
-			logger.warn("搜索门户平台设计异常:{}",e.getMessage());
-		}
-		try {
-			wo.setCmsList(cmsCf.get(200, TimeUnit.SECONDS));
-		} catch (Exception e) {
-			logger.warn("搜索内容管理平台设计异常:{}",e.getMessage());
-		}
-		try {
-			wo.setQueryList(queryCf.get(200, TimeUnit.SECONDS));
-		} catch (Exception e) {
-			logger.warn("搜索数据中心平台设计异常:{}",e.getMessage());
-		}
-		try {
-			wo.setServiceList(serviceCf.get(200, TimeUnit.SECONDS));
-		} catch (Exception e) {
-			logger.warn("搜索服务管理平台设计异常:{}",e.getMessage());
-		}
+		wo.setProcessPlatformList(searchApp(wi, moduleMap, ModuleType.processPlatform.toString(), x_processplatform_assemble_designer.class));
+		wo.setPortalList(searchApp(wi, moduleMap, ModuleType.portal.toString(), x_portal_assemble_designer.class));
+		wo.setCmsList(searchApp(wi, moduleMap, ModuleType.cms.toString(), x_cms_assemble_control.class));
+		wo.setQueryList(searchApp(wi, moduleMap, ModuleType.query.toString(), x_query_assemble_designer.class));
+		wo.setServiceList(searchApp(wi, moduleMap, ModuleType.service.toString(), x_program_center.class));
 		return wo;
 		return wo;
 	}
 	}
 
 
-	private CompletableFuture<List<WrapDesigner>> searchAsync(final Wi wi, final Map<String, List<WiDesigner.ModuleApp>> moduleMap, final String moduleType, final Class<?> applicationClass, Executor executor){
-		CompletableFuture<List<WrapDesigner>> cf = CompletableFuture.supplyAsync(() -> {
-			List<WrapDesigner> swList = null;
-			if(moduleMap.containsKey(moduleType)) {
+	private List<WrapDesigner> searchApp(final Wi wi, final Map<String, List<WiDesigner.ModuleApp>> moduleMap, final String moduleType, final Class<?> applicationClass){
+		List<WrapDesigner> swList = null;
+		if(moduleMap.containsKey(moduleType)) {
+			try {
+				WiDesigner wiDesigner = new WiDesigner();
+				BeanUtils.copyProperties(wiDesigner, wi);
+				wiDesigner.setModuleAppList(moduleMap.get(moduleType));
+				List<WrapDesigner> designerList = ThisApplication.context().applications().postQuery(applicationClass,
+						Applications.joinQueryUri("designer", "search"), wiDesigner).getDataAsList(WrapDesigner.class);
+				logger.debug("设计搜索关联{}的匹配设计个数:{}", moduleType, designerList.size());
+				getSearchRes(wi, designerList);
+				swList = designerList;
+			} catch (Exception e) {
+				logger.error(e);
+			}
+			if (swList!=null && swList.size() > 2) {
 				try {
 				try {
-					WiDesigner wiDesigner = new WiDesigner();
-					BeanUtils.copyProperties(wiDesigner, wi);
-					wiDesigner.setModuleAppList(moduleMap.get(moduleType));
-					List<WrapDesigner> designerList = ThisApplication.context().applications().postQuery(applicationClass,
-							Applications.joinQueryUri("designer", "search"), wiDesigner).getDataAsList(WrapDesigner.class);
-					logger.info("设计搜索关联{}的匹配设计个数:{}", moduleType, designerList.size());
-					getSearchRes(wi, designerList);
-					swList = designerList;
+					SortTools.desc(swList, "designerType","appId");
 				} catch (Exception e) {
 				} catch (Exception e) {
-					logger.error(e);
-				}
-				if (swList!=null && swList.size() > 2) {
-					try {
-						SortTools.desc(swList, "designerType","appId");
-					} catch (Exception e) {
-					}
 				}
 				}
 			}
 			}
-			return swList;
-		}, executor);
-		return cf;
+		}
+		return swList;
 	}
 	}
 
 
 	private void getSearchRes(final Wi wi, List<WrapDesigner> designerList){
 	private void getSearchRes(final Wi wi, List<WrapDesigner> designerList){

+ 2 - 2
o2web/source/x_component_Attendance/Explorer.js

@@ -767,7 +767,6 @@ MWF.xApplication.Attendance.Explorer.PopupForm = new Class({
         this.cancelActionNode.addEvent("click", function(e){
         this.cancelActionNode.addEvent("click", function(e){
             this.cancel(e);
             this.cancel(e);
         }.bind(this));
         }.bind(this));
-
         if( this.isNew || this.isEdited){
         if( this.isNew || this.isEdited){
 
 
             this.okActionNode = new Element("div", {
             this.okActionNode = new Element("div", {
@@ -789,7 +788,8 @@ MWF.xApplication.Attendance.Explorer.PopupForm = new Class({
         delete this;
         delete this;
     },
     },
     ok: function(e){
     ok: function(e){
-        var data = this.form.getResult(true,",",true,false,true);
+        debugger
+        var data = this.form.getResult(false,",",true,false,true);
         if( data ){
         if( data ){
             this._ok( data, function( json ){
             this._ok( data, function( json ){
                 if( json.type == "ERROR" ){
                 if( json.type == "ERROR" ){

+ 3 - 2
o2web/source/x_component_Attendance/ScheduleExplorer.js

@@ -85,7 +85,7 @@ MWF.xApplication.Attendance.ScheduleExplorer.Schedule = new Class({
     Extends: MWF.xApplication.Attendance.Explorer.PopupForm,
     Extends: MWF.xApplication.Attendance.Explorer.PopupForm,
     options : {
     options : {
         "width": 600,
         "width": 600,
-        "height": 500,
+        "height": 600,
         "hasTop" : true,
         "hasTop" : true,
         "hasBottom" : true,
         "hasBottom" : true,
         "title" : "",
         "title" : "",
@@ -125,7 +125,7 @@ MWF.xApplication.Attendance.ScheduleExplorer.Schedule = new Class({
 
 
         this.formTableArea.set("html",html);
         this.formTableArea.set("html",html);
         MWF.xDesktop.requireApp("Template", "MForm", function(){
         MWF.xDesktop.requireApp("Template", "MForm", function(){
-
+            debugger
             var ob = Object;
             var ob = Object;
             this.form = new MForm( this.formTableArea, this.data, {
             this.form = new MForm( this.formTableArea, this.data, {
                 onPostLoad: function(){
                 onPostLoad: function(){
@@ -207,6 +207,7 @@ MWF.xApplication.Attendance.ScheduleExplorer.Schedule = new Class({
     },
     },
     _ok: function( data, callback ){
     _ok: function( data, callback ){
         //checkDate
         //checkDate
+        debugger
         var dateList = [];
         var dateList = [];
         var signProxy = data.signProxy;
         var signProxy = data.signProxy;
         if(signProxy!=1){
         if(signProxy!=1){

+ 1 - 1
package.json

@@ -17,7 +17,7 @@
                 "build_web": "npm run build_api_version && gulp build_web",
                 "build_web": "npm run build_api_version && gulp build_web",
                 "build_api_version": "jsdoc -c o2web/jsdoc.conf.json -q version=${VAPI}",
                 "build_api_version": "jsdoc -c o2web/jsdoc.conf.json -q version=${VAPI}",
                 "build_api": "jsdoc -c o2web/jsdoc.conf.json -q version=",
                 "build_api": "jsdoc -c o2web/jsdoc.conf.json -q version=",
-                "build_parallel": "npm run build_server && npm run build_api &&  npm run build_web",
+                "build_parallel": "npm run build_server && npm run build_web",
                 "deploy": "gulp deploy",
                 "deploy": "gulp deploy",
                 "deploy:win": "gulp deploy --e windows",
                 "deploy:win": "gulp deploy --e windows",
                 "deploy:linux": "gulp deploy --e linux",
                 "deploy:linux": "gulp deploy --e linux",