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

Merge branch 'cherry-pick-9445aca4' into 'wrdp'

Merge branch 'fix/已归档的工作不能修改排序号和site' into 'project/chinamobile-重庆移动'

See merge request o2oa/o2oa!2986
胡起 5 лет назад
Родитель
Сommit
049754e308

+ 3 - 12
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionChangeOrderNumber.java

@@ -1,6 +1,5 @@
 package com.x.processplatform.assemble.surface.jaxrs.attachment;
 
-import org.apache.commons.lang3.BooleanUtils;
 
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
@@ -15,9 +14,6 @@ import com.x.base.core.project.logger.LoggerFactory;
 import com.x.processplatform.assemble.surface.Business;
 import com.x.processplatform.assemble.surface.WorkControl;
 import com.x.processplatform.core.entity.content.Attachment;
-import com.x.processplatform.core.entity.content.Work;
-import com.x.processplatform.core.entity.element.Application;
-import com.x.processplatform.core.entity.element.Process;
 
 import java.util.List;
 
@@ -30,18 +26,13 @@ class ActionChangeOrderNumber extends BaseAction {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			Work work = emc.find(workId, Work.class);
-			/* 判断work是否存在 */
-			if (null == work) {
-				throw new ExceptionEntityNotExist(workId, Work.class);
-			}
 			Attachment attachment = emc.find(id, Attachment.class);
 			if (null == attachment) {
 				throw new ExceptionEntityNotExist(id, Attachment.class);
 			}
-			WoControl control = business.getControl(effectivePerson, work, WoControl.class);
-			if (BooleanUtils.isNotTrue(control.getAllowSave())) {
-				throw new ExceptionAccessDenied(effectivePerson, work);
+			if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workId,
+					new ExceptionEntityNotExist(workId))) {
+				throw new ExceptionAccessDenied(effectivePerson);
 			}
 			List<String> identities = business.organization().identity().listWithPerson(effectivePerson);
 			List<String> units = business.organization().unit().listWithPerson(effectivePerson);

+ 4 - 9
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionChangeSite.java

@@ -21,21 +21,16 @@ class ActionChangeSite extends BaseAction {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			/* 后面要重新保存 */
-			Work work = emc.find(workId, Work.class);
-			/** 判断work是否存在 */
-			if (null == work) {
-				throw new ExceptionEntityNotExist(workId, Work.class);
-			}
 			Attachment attachment = emc.find(id, Attachment.class);
 			if (null == attachment) {
 				throw new ExceptionEntityNotExist(id, Attachment.class);
 			}
 
-			WoControl control = business.getControl(effectivePerson, work, WoControl.class);
-			if (BooleanUtils.isNotTrue(control.getAllowSave())) {
-				throw new ExceptionAccessDenied(effectivePerson, work);
+			if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workId,
+					new ExceptionEntityNotExist(workId))) {
+				throw new ExceptionAccessDenied(effectivePerson);
 			}
+
 			List<String> identities = business.organization().identity().listWithPerson(effectivePerson);
 			List<String> units = business.organization().unit().listWithPerson(effectivePerson);
 			boolean canEdit = this.edit(attachment, effectivePerson, identities, units, business);