提交 c8aafb35 编写于 作者: O o2sword

记录内容管理文档发布http请求的body体内容3

上级 f1f49329
...@@ -10,7 +10,9 @@ import java.util.UUID; ...@@ -10,7 +10,9 @@ import java.util.UUID;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.config.Token; import com.x.base.core.project.config.Token;
import com.x.base.core.project.exception.ExceptionAccessDenied;
import com.x.base.core.project.tools.DateTools; import com.x.base.core.project.tools.DateTools;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.enums.DocumentStatus; import com.x.cms.core.entity.enums.DocumentStatus;
import com.x.cms.core.entity.query.DocumentNotify; import com.x.cms.core.entity.query.DocumentNotify;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
...@@ -52,90 +54,51 @@ public class ActionPersistPublishContent extends BaseAction { ...@@ -52,90 +54,51 @@ public class ActionPersistPublishContent extends BaseAction {
protected ActionResult<Wo> execute( HttpServletRequest request, JsonElement jsonElement, EffectivePerson effectivePerson) throws Exception { protected ActionResult<Wo> execute( HttpServletRequest request, JsonElement jsonElement, EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>(); ActionResult<Wo> result = new ActionResult<>();
List<FileInfo> cloudPictures = null;
AppInfo appInfo = null;
CategoryInfo categoryInfo = null;
Document document = null; Document document = null;
Form form = null; Wi wi = this.convertToWrapIn( jsonElement, Wi.class );
Wi wi = null;
Boolean check = true; Boolean check = true;
try { if ( StringUtils.isEmpty( wi.getCategoryId() ) ) {
wi = this.convertToWrapIn( jsonElement, Wi.class ); throw new ExceptionDocumentCategoryIdEmpty();
} catch (Exception e ) {
check = false;
Exception exception = new ExceptionDocumentInfoProcess( e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString() );
result.error( exception );
logger.error( e, effectivePerson, request, null);
} }
if (check) { CategoryInfo categoryInfo;
if ( StringUtils.isEmpty(wi.getCategoryId())) { AppInfo appInfo = null;
check = false;
Exception exception = new ExceptionDocumentCategoryIdEmpty(); Document oldDocument = documentQueryService.get(wi.getId());
result.error(exception); if(oldDocument != null){
categoryInfo = categoryInfoServiceAdv.get( oldDocument.getCategoryId() );
appInfo = appInfoServiceAdv.get(oldDocument.getAppId());
}else{
categoryInfo = categoryInfoServiceAdv.get( wi.getCategoryId() );
if(categoryInfo != null) {
appInfo = appInfoServiceAdv.get(categoryInfo.getAppId());
} }
} }
if (check) { if(categoryInfo == null){
try { throw new ExceptionCategoryInfoNotExists(wi.getCategoryId());
categoryInfo = categoryInfoServiceAdv.get( wi.getCategoryId() ); }
if (categoryInfo == null) { if (appInfo == null) {
check = false; throw new ExceptionAppInfoNotExists(categoryInfo.getAppId());
Exception exception = new ExceptionCategoryInfoNotExists(wi.getCategoryId());
result.error(exception);
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionDocumentInfoProcess(e,"系统在根据ID查询分类信息时发生异常!ID:" + wi.getCategoryId());
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
} }
if (check) { Business business = new Business(null);
try { if(!business.isDocumentEditor(effectivePerson, appInfo, categoryInfo, oldDocument)){
appInfo = appInfoServiceAdv.get( categoryInfo.getAppId() ); throw new ExceptionAccessDenied(effectivePerson);
if (appInfo == null) {
check = false;
Exception exception = new ExceptionAppInfoNotExists(categoryInfo.getAppId());
result.error(exception);
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionDocumentInfoProcess(e, "系统在根据ID查询应用栏目信息时发生异常!ID:" + categoryInfo.getAppId());
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
} }
// 查询分类设置的编辑表单 // 查询分类设置的编辑表单
if (check) { if ( StringUtils.isEmpty(categoryInfo.getFormId() )) {
if ( StringUtils.isEmpty(categoryInfo.getFormId())) { throw new ExceptionCategoryFormIdEmpty();
check = false;
Exception exception = new ExceptionCategoryFormIdEmpty();
result.error(exception);
}
} }
if (check) { Form form = formServiceAdv.get(categoryInfo.getFormId());
try { if (form == null) {
form = formServiceAdv.get(categoryInfo.getFormId()); throw new ExceptionFormForEditNotExists(categoryInfo.getFormId());
if (form == null) { } else {
check = false; wi.setForm(form.getId());
Exception exception = new ExceptionFormForEditNotExists(categoryInfo.getFormId()); wi.setFormName(form.getName());
result.error(exception);
} else {
wi.setForm(form.getId());
wi.setFormName(form.getName());
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionDocumentInfoProcess(e,
"系统在根据ID查询编辑表单时发生异常!ID:" + categoryInfo.getFormId());
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
} }
if (check) { if (check) {
...@@ -345,7 +308,9 @@ public class ActionPersistPublishContent extends BaseAction { ...@@ -345,7 +308,9 @@ public class ActionPersistPublishContent extends BaseAction {
if ( check && !wi.getSkipPermission() ) { if ( check && !wi.getSkipPermission() ) {
//将读者以及作者信息持久化到数据库中 //将读者以及作者信息持久化到数据库中
try { try {
documentPersistService.refreshDocumentPermission( document.getId(), wi.getReaderList(), wi.getAuthorList() ); if(oldDocument==null || (wi.getReaderList() != null && wi.getAuthorList() != null)) {
documentPersistService.refreshDocumentPermission(document.getId(), wi.getReaderList(), wi.getAuthorList());
}
} catch (Exception e) { } catch (Exception e) {
Exception exception = new ExceptionDocumentInfoProcess(e, "系统在核对文档访问管理权限信息时发生异常!"); Exception exception = new ExceptionDocumentInfoProcess(e, "系统在核对文档访问管理权限信息时发生异常!");
result.error(exception); result.error(exception);
......
...@@ -262,7 +262,9 @@ public class ActionPersistSaveDocument extends BaseAction { ...@@ -262,7 +262,9 @@ public class ActionPersistSaveDocument extends BaseAction {
if (check) { if (check) {
try {//将读者以及作者信息持久化到数据库中 try {//将读者以及作者信息持久化到数据库中
documentPersistService.refreshDocumentPermission( document.getId(), wi.getReaderList(), wi.getAuthorList() ); if(oldDocument==null || (wi.getReaderList() != null && wi.getAuthorList() != null)){
documentPersistService.refreshDocumentPermission( document.getId(), wi.getReaderList(), wi.getAuthorList() );
}
} catch (Exception e) { } catch (Exception e) {
check = false; check = false;
Exception exception = new ExceptionDocumentInfoProcess(e, "系统在核对文档访问管理权限信息时发生异常!"); Exception exception = new ExceptionDocumentInfoProcess(e, "系统在核对文档访问管理权限信息时发生异常!");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册