Explorar el Código

修复文章变动页按钮和无待办撤回异常

文章变动页将提交与保存拆分:在用文章和已保存的待提交变动都显示提交/保存,停用仍只在在用状态显示。

启动文章变动流程前先确认存在可撤回的当前待办审核,避免无可撤回任务时公共 BPM 撤回服务抛 IndexOutOfBoundsException,导致发起失败。

Validation:\n- git diff --check -- WebRoot/web/subassembly/app/pc/10021/10105/1002110105_run.jsp WebRoot/web/subassembly/app/pc/10021/10105/1002110105_edit.jsp src/space/apps/moudules/website/services/flow/ArticleFlowService.java\n- ./local-run/bin/compile-hxcs-deploy-classes.sh
非繁 hace 3 meses
padre
commit
a58a995d48

+ 13 - 10
WebRoot/web/subassembly/app/pc/10021/10105/1002110105_edit.jsp

@@ -103,12 +103,13 @@
 
 					</el-row>
 				</el-form>
-			</div>
-			<div class="space-form-btn">
-				<el-button type="primary" v-if="disable" icon="el-icon-circle-check" @click="space.forms.NSSubmit();">保存</el-button>
-				<el-button type="danger" v-if="disable" icon="el-icon-warning-outline" onclick='@service{ name:`article_status_submit`, params:`{articleid: "${articleid}", dcode: "71"}`,  page:`toTips`, type:`event`, refresh:`true` }@'>停用</el-button>
-				<el-button type="success" v-if="enable" icon="el-icon-warning-outline" onclick='@service{ name:`article_status_submit`, params:`{articleid: "${articleid}", dcode: "61"}`, page:`toTips`, type:`event`, refresh:`true` }@'>启用</el-button>
-				<el-button icon="el-icon-circle-close" onclick="space.allFunction.closeDialog();">关闭</el-button>
+			</div>
+			<div class="space-form-btn">
+				<el-button type="success" v-if="submitChange" icon="el-icon-circle-check" @click="space.forms.NSSubmit();">提交</el-button>
+				<el-button type="primary" v-if="saveChange" icon="el-icon-circle-check" @click="space.forms.submit();">保存</el-button>
+				<el-button type="danger" v-if="disable" icon="el-icon-warning-outline" onclick='@service{ name:`article_status_submit`, params:`{articleid: "${articleid}", dcode: "71"}`,  page:`toTips`, type:`event`, refresh:`true` }@'>停用</el-button>
+				<el-button type="success" v-if="enable" icon="el-icon-warning-outline" onclick='@service{ name:`article_status_submit`, params:`{articleid: "${articleid}", dcode: "61"}`, page:`toTips`, type:`event`, refresh:`true` }@'>启用</el-button>
+				<el-button icon="el-icon-circle-close" onclick="space.allFunction.closeDialog();">关闭</el-button>
 			</div>
 		</div>
 	</body>
@@ -226,10 +227,12 @@
 					editorHeight:'',
 					sticktopDesc: '文章的置顶到期时间,到期后系统会自动将该篇文章取消置顶',
 					releaseDesc: '文章审核通过后,系统将在设定的时间自动发布此文章',
-					navigationIssueOptions: undefined,
-					navigationCopyOptions: undefined,
-					disable: space.utils.dcode.isDisable("${article.dcode}"),
-					enable: space.utils.dcode.isEnable("${article.dcode}"),
+					navigationIssueOptions: undefined,
+					navigationCopyOptions: undefined,
+					disable: space.utils.dcode.isDisable("${article.dcode}"),
+					enable: space.utils.dcode.isEnable("${article.dcode}"),
+					submitChange: space.utils.dcode.isDisable("${article.dcode}") || (space.utils.dcode.isRoughDraft("${article.dcode}") && "${article.ascode}" === "10010"),
+					saveChange: space.utils.dcode.isDisable("${article.dcode}") || (space.utils.dcode.isRoughDraft("${article.dcode}") && "${article.ascode}" === "10010"),
 					photoSizeMsg: '', // 缩略图尺寸信息
 					photoSize:{
 						width: '',

+ 13 - 10
WebRoot/web/subassembly/app/pc/10021/10105/1002110105_run.jsp

@@ -128,12 +128,13 @@
 
 					</el-row>
 				</el-form>
-			</div>
-			<div class="space-form-btn">
-				<el-button type="primary" v-if="disable" icon="el-icon-circle-check" @click="space.forms.NSSubmit();">保存</el-button>
-				<el-button type="danger" v-if="disable" icon="el-icon-warning-outline" onclick='<app:token name='website.article_status_submit' page='toTips' type='event' params='{articleid: "${articleid}", dcode: "71"}' refresh='true' />'>停用</el-button>
-				<el-button type="success" v-if="enable" icon="el-icon-warning-outline" onclick='<app:token name='website.article_status_submit' page='toTips' type='event' params='{articleid: "${articleid}", dcode: "61"}' refresh='true' />'>启用</el-button>
-				<el-button icon="el-icon-circle-close" onclick="space.allFunction.closeDialog();">关闭</el-button>
+			</div>
+			<div class="space-form-btn">
+				<el-button type="success" v-if="submitChange" icon="el-icon-circle-check" @click="space.forms.NSSubmit();">提交</el-button>
+				<el-button type="primary" v-if="saveChange" icon="el-icon-circle-check" @click="space.forms.submit();">保存</el-button>
+				<el-button type="danger" v-if="disable" icon="el-icon-warning-outline" onclick='<app:token name='website.article_status_submit' page='toTips' type='event' params='{articleid: "${articleid}", dcode: "71"}' refresh='true' />'>停用</el-button>
+				<el-button type="success" v-if="enable" icon="el-icon-warning-outline" onclick='<app:token name='website.article_status_submit' page='toTips' type='event' params='{articleid: "${articleid}", dcode: "61"}' refresh='true' />'>启用</el-button>
+				<el-button icon="el-icon-circle-close" onclick="space.allFunction.closeDialog();">关闭</el-button>
 			</div>
 		</div>
 	</body>
@@ -252,10 +253,12 @@
 					editorHeight:'',
 					sticktopDesc: '文章的置顶到期时间,到期后系统会自动将该篇文章取消置顶',
 					releaseDesc: '文章审核通过后,系统将在设定的时间自动发布此文章',
-					navigationIssueOptions: undefined,
-					navigationCopyOptions: undefined,
-					disable: space.utils.dcode.isDisable("${article.dcode}"),
-					enable: space.utils.dcode.isEnable("${article.dcode}"),
+					navigationIssueOptions: undefined,
+					navigationCopyOptions: undefined,
+					disable: space.utils.dcode.isDisable("${article.dcode}"),
+					enable: space.utils.dcode.isEnable("${article.dcode}"),
+					submitChange: space.utils.dcode.isDisable("${article.dcode}") || (space.utils.dcode.isRoughDraft("${article.dcode}") && "${article.ascode}" === "10010"),
+					saveChange: space.utils.dcode.isDisable("${article.dcode}") || (space.utils.dcode.isRoughDraft("${article.dcode}") && "${article.ascode}" === "10010"),
 					photoSizeMsg: '', // 缩略图尺寸信息
 					photoSize:{
 						width: '',

+ 28 - 2
src/space/apps/moudules/website/services/flow/ArticleFlowService.java

@@ -233,9 +233,11 @@ public class ArticleFlowService extends BaseTransaction {
 				throw new Exception("当前登录用户未关联部门,无法发起流程");
 			}
 			
-			// 撤回当前数据未结束的流程
+			// 撤回当前数据未结束的流程。没有当前待办审核时,公共撤回服务会取空列表第 0 条,需先跳过。
 			Map<String, String> paramMap = new HashMap<String, String>();
-			BpmProcessUtil.withdrawTaskByPageBean(gdba, article, getWebApp(), getAppUser(), paramMap);
+			if (hasWithdrawableArticleProcess(gdba, article)) {
+				BpmProcessUtil.withdrawTaskByPageBean(gdba, article, getWebApp(), getAppUser(), paramMap);
+			}
 			
 			withdrawArticleCopy(gdba, article);// 收回
 			
@@ -271,6 +273,30 @@ public class ArticleFlowService extends BaseTransaction {
 		
 		return DEFAULT_FORWARD;
 	}
+
+	private boolean hasWithdrawableArticleProcess(GeneralDBAccess gdba, Article article) throws Exception {
+		if (article == null || article.getArticleid() == null) {
+			return false;
+		}
+
+		String sql = " select count(*) as c "
+				+ " from apply ap "
+				+ " where ap.dcode <> 72 "
+				+ " and ap.table_name = 'article' "
+				+ " and ap.table_key = 'articleid' "
+				+ " and ap.table_key_value = :articleid "
+				+ " and ap.end_time is null "
+				+ " and exists ( "
+				+ "   select 1 from audit au "
+				+ "   where au.applyid = ap.applyid "
+				+ "   and au.dcode <> 72 "
+				+ "   and au.acode in (51, 61) "
+				+ " ) ";
+		SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
+		sqlCmd.setString("articleid", article.getArticleid());
+		Map<String, Object> resultMap = gdba.selectAsMap(sqlCmd);
+		return resultMap != null && Integer.parseInt(resultMap.get("c").toString()) > 0;
+	}
 	
 	/**
 	 * 撤回未审核的文章抄送