|
|
@@ -314,6 +314,20 @@ public class ArticleService extends BaseTransaction {
|
|
|
return SortOrderUtil.parseSortNumber(getParameter("sortNumber"));
|
|
|
}
|
|
|
|
|
|
+ private Article getArticleById(GeneralDBAccess gdba, Long articleid) throws Exception {
|
|
|
+ String sql = " select articleid, dcode, websiteid, unitid, ascode, navigationid, title, ajtcode, `desc`,"
|
|
|
+ + " source, thumbnail, sticktop, sticktop_end_time, sticktop_schedulesid, `release`, release_time,"
|
|
|
+ + " release_task_schedulesid, content, edit_content, url, read_count, create_time, last_change_time,"
|
|
|
+ + " create_pid, last_change_pid from article where articleid = :articleid ";
|
|
|
+ SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
|
|
|
+ sqlCmd.setString("articleid", articleid);
|
|
|
+ List<Article> list = gdba.selectAsList(sqlCmd, Article.class);
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
+ throw new Exception("文章不存在");
|
|
|
+ }
|
|
|
+ return list.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 设置文章申请服务
|
|
|
*
|
|
|
@@ -347,11 +361,10 @@ public class ArticleService extends BaseTransaction {
|
|
|
GeneralDBAccess gdba = getGdbaInstance();
|
|
|
AppUser appUser = getAppUser();
|
|
|
|
|
|
- Article a2 = new Article();
|
|
|
- a2.setArticleid(getParameterToLong("articleid"));
|
|
|
- gdba.selectById(a2);
|
|
|
+ Article a2 = getArticleById(gdba, getParameterToLong("articleid"));
|
|
|
|
|
|
- if (!Long.valueOf(dataStatusCode.INSERT.getCode()).equals(a2.getDcode())) {
|
|
|
+ if (!Long.valueOf(dataStatusCode.INSERT.getCode()).equals(a2.getDcode())
|
|
|
+ && !Long.valueOf(dataStatusCode.STAY_SUBMIT.getCode()).equals(a2.getDcode())) {
|
|
|
// setResponsePackage(getResponseErrorMsgPackage());
|
|
|
|
|
|
StringBuilder msgBuilder = new StringBuilder();
|
|
|
@@ -369,9 +382,7 @@ public class ArticleService extends BaseTransaction {
|
|
|
String content = getParameterNotXSS("body");
|
|
|
String navIdList = getParameter("navIdList");
|
|
|
|
|
|
- Article article = new Article();
|
|
|
- article.setArticleid(a2.getArticleid());
|
|
|
- gdba.selectById(article);
|
|
|
+ Article article = getArticleById(gdba, a2.getArticleid());
|
|
|
PojoUtil.formatRequest(getRequest(), article);
|
|
|
|
|
|
WebsiteNavigation wn = getArticleTargetNavigation(gdba, article.getNavigationid(), "发布栏目");
|
|
|
@@ -623,9 +634,7 @@ public class ArticleService extends BaseTransaction {
|
|
|
String content = getParameterNotXSS("body");
|
|
|
String navIdList = getParameter("navIdList");
|
|
|
|
|
|
- Article article = new Article();
|
|
|
- article.setArticleid(getParameterToLong("articleid"));
|
|
|
- gdba.selectById(article);
|
|
|
+ Article article = getArticleById(gdba, getParameterToLong("articleid"));
|
|
|
PojoUtil.formatRequest(getRequest(), article);
|
|
|
|
|
|
WebsiteNavigation wn = getArticleTargetNavigation(gdba, article.getNavigationid(), "发布栏目");
|
|
|
@@ -641,9 +650,7 @@ public class ArticleService extends BaseTransaction {
|
|
|
|
|
|
article.setSticktop("yes".equals(top) ? 1L : 0L);
|
|
|
|
|
|
- Article a2 = new Article();
|
|
|
- a2.setArticleid(article.getArticleid());
|
|
|
- gdba.selectById(a2);
|
|
|
+ Article a2 = getArticleById(gdba, article.getArticleid());
|
|
|
ChangeLogUtil.addChangeLog(gdba, appUser, "Article", a2.getArticleid(),
|
|
|
buildArticleChangeLogContent(a2, nowTimestamp));
|
|
|
|