Ver código fonte

BUG修复:增加注释,暴露通过流程发布CMS文档的服务

o2lee 5 anos atrás
pai
commit
748cbf4592

+ 22 - 11
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistPublishByWorkFlow.java

@@ -167,18 +167,31 @@ public class ActionPersistPublishByWorkFlow extends BaseAction {
 		}
 
 		if (check) {
-			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-				if ( StringUtils.isNotEmpty( wi.getCreatorIdentity() )) {
-					wi.setCreatorPerson( userManagerService.getPersonNameWithIdentity( wi.getCreatorIdentity() ) );
-					wi.setCreatorUnitName( userManagerService.getUnitNameByIdentity( wi.getCreatorIdentity() ) );
-					wi.setCreatorTopUnitName( userManagerService.getTopUnitNameByIdentity( wi.getCreatorIdentity() ) );
-				} else {
-					if ("xadmin".equalsIgnoreCase( effectivePerson.getDistinguishedName()) ) {
+			try {
+				if (StringUtils.isEmpty( wi.getCreatorIdentity() )) {
+					if( "cipher".equalsIgnoreCase( effectivePerson.getDistinguishedName() )) {
+						wi.setCreatorIdentity("cipher");
+						wi.setCreatorPerson("cipher");
+						wi.setCreatorUnitName("cipher");
+						wi.setCreatorTopUnitName("cipher");
+					}else if ("xadmin".equalsIgnoreCase(effectivePerson.getDistinguishedName())) {
 						wi.setCreatorIdentity("xadmin");
 						wi.setCreatorPerson("xadmin");
 						wi.setCreatorUnitName("xadmin");
 						wi.setCreatorTopUnitName("xadmin");
-					} else {
+					}else {
+						//尝试一下根据当前用户获取用户的第一个身份
+						wi.setCreatorIdentity(userManagerService.getMajorIdentityWithPerson( effectivePerson.getDistinguishedName()) );
+					}
+				}
+
+				if ( !StringUtils.equals(  "cipher", wi.getCreatorIdentity() ) && !StringUtils.equals(  "xadmin", wi.getCreatorIdentity() )) {
+					//说明是指定的发布者,并不使用cipher和xadmin代替
+					if (StringUtils.isNotEmpty( wi.getCreatorIdentity() )) {
+						wi.setCreatorPerson( userManagerService.getPersonNameWithIdentity( wi.getCreatorIdentity() ) );
+						wi.setCreatorUnitName( userManagerService.getUnitNameByIdentity( wi.getCreatorIdentity() ) );
+						wi.setCreatorTopUnitName( userManagerService.getTopUnitNameByIdentity( wi.getCreatorIdentity() ) );
+					}else {
 						Exception exception = new ExceptionPersonHasNoIdentity(wi.getCreatorIdentity());
 						result.error(exception);
 					}
@@ -191,9 +204,6 @@ public class ActionPersistPublishByWorkFlow extends BaseAction {
 
 		if (check) {
 			if ( StringUtils.isEmpty(wi.getTitle())) {
-//				check = false;
-//				Exception exception = new ExceptionDocumentTitleEmpty();
-//				result.error(exception);
 				wi.setTitle( appInfo.getAppName() + " - " + categoryInfo.getCategoryName() + " - 无标题文档" );
 			}
 		}
@@ -212,6 +222,7 @@ public class ActionPersistPublishByWorkFlow extends BaseAction {
 			}
 		}
 
+		//从流程管理中复制所有的附件到CMS
 		if (check) {
 			if ( wi.getWf_attachmentIds() != null && wi.getWf_attachmentIds().length > 0 ) {
 				FileInfo fileInfo = null;

+ 3 - 1
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentCipherAction.java

@@ -11,6 +11,7 @@ import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 
 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;
@@ -21,6 +22,7 @@ import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
 
 @Path("document/cipher")
+@JaxrsDescribe("信息发布信息文档管理(Cipher)")
 public class DocumentCipherAction extends StandardJaxrsAction{
 	
 	private static  Logger logger = LoggerFactory.getLogger( DocumentCipherAction.class );
@@ -30,7 +32,7 @@ public class DocumentCipherAction extends StandardJaxrsAction{
 	@Path("publish/content")
 	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
 	@Consumes(MediaType.APPLICATION_JSON)
-	public void publishContent( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) {		
+	public void publishContentByWorkFlow( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) {
 		EffectivePerson effectivePerson = this.effectivePerson( request );
 		ActionResult<ActionPersistPublishByWorkFlow.Wo> result = new ActionResult<>();
 		Boolean check = true;