Authored by min.ling

update

@@ -184,6 +184,7 @@ public class TopicServiceImpl implements ITopicService { @@ -184,6 +184,7 @@ public class TopicServiceImpl implements ITopicService {
184 if(articleTopMap != null && articleTopMap.get(grassTopic.getId()) != null){ 184 if(articleTopMap != null && articleTopMap.get(grassTopic.getId()) != null){
185 List<Integer> topArticleIds = articleTopMap.get(grassTopic.getId()).stream().map(GrassArticleTopic::getArticleId).collect(Collectors.toList()); 185 List<Integer> topArticleIds = articleTopMap.get(grassTopic.getId()).stream().map(GrassArticleTopic::getArticleId).collect(Collectors.toList());
186 bo.setTopArticles(StringUtils.join(topArticleIds,",")); 186 bo.setTopArticles(StringUtils.join(topArticleIds,","));
  187 + bo.setTopStatus(1);
187 } 188 }
188 result.add(bo); 189 result.add(bo);
189 } 190 }
@@ -220,7 +221,7 @@ public class TopicServiceImpl implements ITopicService { @@ -220,7 +221,7 @@ public class TopicServiceImpl implements ITopicService {
220 articleTopicDao.updateTopByTopicId(req.getId(),updateTime); 221 articleTopicDao.updateTopByTopicId(req.getId(),updateTime);
221 222
222 //将指定文章写入 话题-文章关联表 223 //将指定文章写入 话题-文章关联表
223 - int result = articleTopicDao.updateTopByArticles(articleList,1,updateTime); 224 + int result = articleTopicDao.updateTopByArticles(validArticles,1,updateTime);
224 logger.info("end addArticlesTop,req:{},result:{}",req,result); 225 logger.info("end addArticlesTop,req:{},result:{}",req,result);
225 return new ApiResponse(result); 226 return new ApiResponse(result);
226 } 227 }
@@ -530,7 +530,7 @@ @@ -530,7 +530,7 @@
530 window.self.paramObject.mkData = data; 530 window.self.paramObject.mkData = data;
531 $(labelList).myDialog({ 531 $(labelList).myDialog({
532 title: title, 532 title: title,
533 - width: "50%", 533 + width: "30%",
534 height: "50%", 534 height: "50%",
535 resizable: false, 535 resizable: false,
536 buttons: [{ 536 buttons: [{
@@ -546,10 +546,23 @@ @@ -546,10 +546,23 @@
546 param.id = data.id; 546 param.id = data.id;
547 } 547 }
548 548
549 - //1)表单基本检查 549 + //表单基本检查
550 if (!$("#setTopForm").form("validate")) { 550 if (!$("#setTopForm").form("validate")) {
551 return false; 551 return false;
552 } 552 }
  553 + //校验最多可填五个内容id
  554 + var articleStr = $("#setTopForm #topArticleIds").textbox("getValue");
  555 + var articleArray = articleStr.split(',');
  556 + for(var i = 0; i < articleArray.length; i++){
  557 + if(isNaN(articleArray[i])){
  558 + $.messager.alert("提示", "非数字字符不允许提交!", "");
  559 + return false;
  560 + }
  561 + }
  562 + if(articleArray.length > 5){
  563 + $.messager.alert("提示", "填写不可超过五个内容ID!", "");
  564 + return false;
  565 + }
553 566
554 $.messager.progress({ 567 $.messager.progress({
555 title: "正在执行", 568 title: "正在执行",
@@ -569,7 +582,7 @@ @@ -569,7 +582,7 @@
569 height: 120 582 height: 120
570 }); 583 });
571 } else { 584 } else {
572 - $.messager.alert("失败", "操作失败", "error"); 585 + $.messager.alert("错误", data.message, "error");
573 } 586 }
574 } 587 }
575 }); 588 });
@@ -6,8 +6,8 @@ @@ -6,8 +6,8 @@
6 <tr style="height: 60px"> 6 <tr style="height: 60px">
7 <td> 7 <td>
8 <span style="color:red">*</span><label>内容ID</label> <br> 8 <span style="color:red">*</span><label>内容ID</label> <br>
9 - <input id="topArticleIds" name="topArticleIds" class="easyui-textbox" style="width: 500px;"/>  
10 - <td><span style="color:red">注:至多填写5个,设置的内容必须关联该话题</span></td> 9 + <input id="topArticleIds" name="topArticleIds" class="easyui-textbox" style="width: 500px;" /><br>
  10 + <span style="color:red">注:至多填写5个,设置的内容必须关联该话题</span>
11 </td> 11 </td>
12 </tr> 12 </tr>
13 </table> 13 </table>