Browse Source

为CMS栏目信息保存适应Cihper操作

liyihz2008 7 years ago
parent
commit
53ec39eec9

+ 1 - 0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdict/BaseAction.java

@@ -111,6 +111,7 @@ abstract class BaseAction extends StandardJaxrsAction {
 		}
 	}
 
+	@SuppressWarnings("deprecation")
 	void delete(Business business, AppDict appDict, String... paths) throws Exception {
 		EntityManagerContainer emc = business.entityManagerContainer();
 		List<AppDictItem> exists = business.getAppDictItemFactory()

+ 31 - 20
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/ActionSave.java

@@ -15,6 +15,7 @@ import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WoId;
 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.cms.assemble.control.service.LogService;
 import com.x.cms.core.entity.AppInfo;
 import com.x.cms.core.entity.CategoryInfo;
@@ -25,6 +26,11 @@ import com.x.cms.core.entity.element.View;
 import com.x.cms.core.entity.element.ViewCategory;
 import com.x.cms.core.entity.element.ViewFieldConfig;
 
+/**
+ * 保存CMS栏目信息设置
+ * @author O2LEE
+ *
+ */
 public class ActionSave extends BaseAction {
 
 	private static  Logger logger = LoggerFactory.getLogger(ActionSave.class);
@@ -50,7 +56,15 @@ public class ActionSave extends BaseAction {
 		}
 		
 		if (check) {
-			if ( !"xadmin".equalsIgnoreCase( effectivePerson.getDistinguishedName()) ) {
+			if( "cipher".equalsIgnoreCase( effectivePerson.getDistinguishedName() )) {
+				identityName = "cipher";
+				unitName = "cipher";
+				topUnitName = "cipher";
+			}else if( "xadmin".equalsIgnoreCase( effectivePerson.getDistinguishedName() )) {
+				identityName = "xadmin";
+				unitName = "xadmin";
+				topUnitName = "xadmin";
+			}else {
 				try {
 					identityName = userManagerService.getPersonIdentity( effectivePerson.getDistinguishedName(), identityName );
 				} catch (Exception e) {
@@ -59,56 +73,51 @@ public class ActionSave extends BaseAction {
 					result.error(exception);
 					logger.error(e, effectivePerson, request, null);
 				}
-			}else {
-				identityName = "xadmin";
-				unitName = "xadmin";
-				topUnitName = "xadmin";
 			}
 		}
 
-		if (check && !"xadmin".equals(identityName)) {
+		if (check && !"xadmin".equals(identityName)&& !"cipher".equals(identityName)) {
 			try {
 				unitName = userManagerService.getUnitNameByIdentity( identityName );
 			} catch (Exception e) {
 				check = false;
-				Exception exception = new ExceptionAppInfoProcess(e,
-						"系统在根据用户身份信息查询所属组织名称时发生异常。Identity:" + identityName);
+				Exception exception = new ExceptionAppInfoProcess(e, "系统在根据用户身份信息查询所属组织名称时发生异常。Identity:" + identityName);
 				result.error(exception);
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		if (check && !"xadmin".equals(identityName)) {
+		if (check && !"xadmin".equals(identityName)&& !"cipher".equals(identityName)) {
 			try {
 				topUnitName = userManagerService.getTopUnitNameByIdentity( identityName );
 			} catch (Exception e) {
 				check = false;
-				Exception exception = new ExceptionAppInfoProcess(e,
-						"系统在根据用户身份信息查询所属顶层组织名称时发生异常。Identity:" + identityName);
+				Exception exception = new ExceptionAppInfoProcess(e, "系统在根据用户身份信息查询所属顶层组织名称时发生异常。Identity:" + identityName);
 				result.error(exception);
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
 
 		if (check) {
-			if ( wi.getAppName() == null || wi.getAppName().isEmpty()) {
+			if ( StringUtils.isEmpty( wi.getAppName() ) ) {
 				check = false;
 				Exception exception = new ExceptionAppInfoNameEmpty();
 				result.error(exception);
 			}
 		}
+		
 		if (check) {
-			if( StringUtils.isEmpty( wi.getDocumentType() ) ) {
-				wi.setDocumentType( "信息" );
+			if( "数据".equals( wi.getDocumentType() )) {
+				wi.setDocumentType( "数据" );
 			}else {
-				if( !"信息".equals(wi.getDocumentType()) && !"数据".equals( wi.getDocumentType() )) {
-					wi.setDocumentType( "信息" );
-				}
+				wi.setDocumentType( "信息" );
 			}
 		}
+		
 		if (check) {
 			try {
+				//判断栏目信息是否已经存在,栏目信息不允许重名
 				ids = appInfoServiceAdv.listByAppName( wi.getAppName());
-				if (ids != null && !ids.isEmpty()) {
+				if ( ListTools.isNotEmpty( ids ) ) {
 					for (String tmp : ids) {
 						if (tmp != null && !tmp.trim().equals( wi.getId())) {
 							check = false;
@@ -119,8 +128,7 @@ public class ActionSave extends BaseAction {
 				}
 			} catch (Exception e) {
 				check = false;
-				Exception exception = new ExceptionAppInfoProcess(e,
-						"系统根据应用栏目名称查询应用栏目信息对象时发生异常。AppName:" + wi.getAppName());
+				Exception exception = new ExceptionAppInfoProcess(e, "系统根据应用栏目名称查询应用栏目信息对象时发生异常。AppName:" + wi.getAppName());
 				result.error(exception);
 				logger.error(e, effectivePerson, request, null);
 			}
@@ -132,6 +140,7 @@ public class ActionSave extends BaseAction {
 			wi.setCreatorTopUnitName( topUnitName );
 			
 			try {
+				//保存CMS栏目信息
 				appInfo = appInfoServiceAdv.save( wi, effectivePerson );
 
 				// 更新缓存
@@ -159,7 +168,9 @@ public class ActionSave extends BaseAction {
 	}
 
 	public static class Wi extends AppInfo {
+		
 		private static final long serialVersionUID = -6314932919066148113L;
+		
 		private String identity = null;
 
 		public String getIdentity() {

+ 1 - 0
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/data/BaseAction.java

@@ -122,6 +122,7 @@ public class BaseAction extends StandardJaxrsAction {
 		}
 	}
 
+	@SuppressWarnings("deprecation")
 	void deleteData(Business business, Document document, String... paths) throws Exception {
 		List<Item> exists = business.itemFactory().listWithDocmentWithPath(document.getId(), paths);
 		if (exists.isEmpty()) {

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

@@ -28,7 +28,6 @@ import com.x.cms.core.entity.CategoryInfo;
 import com.x.cms.core.entity.Document;
 import com.x.cms.core.entity.FileInfo;
 import com.x.cms.core.entity.element.Form;
-import com.x.cms.core.entity.tools.LogUtil;
 
 /**
  * 直接发布文档内容