Authored by liangyi.chen@yoho.cn

Merge branch 'dev_grass_20190806' into test6.9.10

@@ -166,4 +166,16 @@ public class GrassArticleController { @@ -166,4 +166,16 @@ public class GrassArticleController {
166 } 166 }
167 } 167 }
168 168
  169 + @RequestMapping("/updateMarkFlag")
  170 + public ApiResponse updateMarkFlag(@RequestBody GrassArticleReq req) {
  171 + logger.info("grassArticle updateMarkFlag begin, req is {}");
  172 + try {
  173 + grassArticleService.updateMarkFlag(req);
  174 + return new ApiResponse.ApiResponseBuilder().build();
  175 + } catch (PlatformException e) {
  176 + return new ApiResponse.ApiResponseBuilder().code(e.getCode()).message(e.getMessage()).build();
  177 + }
  178 +
  179 + }
  180 +
169 } 181 }
@@ -73,4 +73,11 @@ public class GrassTopicController { @@ -73,4 +73,11 @@ public class GrassTopicController {
73 public ApiResponse addArticlesTop(@RequestBody GrassTopicReq req){ 73 public ApiResponse addArticlesTop(@RequestBody GrassTopicReq req){
74 return topicService.addArticlesTop(req); 74 return topicService.addArticlesTop(req);
75 } 75 }
  76 +
  77 + @RequestMapping("/changeTopicOrder")
  78 + @ResponseBody
  79 + public ApiResponse changeTopicOrder(@RequestBody GrassTopicReq req){
  80 + topicService.changeTopicOrder(req);
  81 + return new ApiResponse.ApiResponseBuilder().build();
  82 + }
76 } 83 }
@@ -34,4 +34,6 @@ public interface IGrassArticleService { @@ -34,4 +34,6 @@ public interface IGrassArticleService {
34 34
35 35
36 List<Integer> getUidByNickName(String nickName); 36 List<Integer> getUidByNickName(String nickName);
  37 +
  38 + void updateMarkFlag(GrassArticleReq req) throws PlatformException;
37 } 39 }
@@ -27,4 +27,9 @@ public interface ITopicService { @@ -27,4 +27,9 @@ public interface ITopicService {
27 * @return 27 * @return
28 */ 28 */
29 ApiResponse addArticlesTop(GrassTopicReq req); 29 ApiResponse addArticlesTop(GrassTopicReq req);
  30 +
  31 + /**
  32 + * 设置某话题排序值
  33 + */
  34 + void changeTopicOrder(GrassTopicReq req);
30 } 35 }
@@ -1568,6 +1568,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService { @@ -1568,6 +1568,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
1568 //短视频url 1568 //短视频url
1569 rspBo.setVideoUrl(videoMap.get(article.getId()) == null ? "" : videoMap.get(article.getId()).getString("videoUrl")); 1569 rspBo.setVideoUrl(videoMap.get(article.getId()) == null ? "" : videoMap.get(article.getId()).getString("videoUrl"));
1570 rspBo.setFileId(videoMap.get(article.getId()) == null ? "" : videoMap.get(article.getId()).getString("fileId")); 1570 rspBo.setFileId(videoMap.get(article.getId()) == null ? "" : videoMap.get(article.getId()).getString("fileId"));
  1571 + //是否打标到达人搭配 0-否 1-是
  1572 + rspBo.setMarkFlag(article.getMarkFlag());
1571 rspBoList.add(rspBo); 1573 rspBoList.add(rspBo);
1572 }); 1574 });
1573 return rspBoList; 1575 return rspBoList;
@@ -1982,4 +1984,15 @@ public class GrassArticleServiceImpl implements IGrassArticleService { @@ -1982,4 +1984,15 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
1982 String url = apiUrl + "/?client_type=h5&method=app.grass.videoTask&fileId=" + fileId + "&articleId=" + articleId; 1984 String url = apiUrl + "/?client_type=h5&method=app.grass.videoTask&fileId=" + fileId + "&articleId=" + articleId;
1983 serviceCaller.get("gateway.app.grass.videoTask", url, null, String.class, null); 1985 serviceCaller.get("gateway.app.grass.videoTask", url, null, String.class, null);
1984 } 1986 }
  1987 +
  1988 + @Override
  1989 + public void updateMarkFlag(GrassArticleReq req) {
  1990 + logger.info("enter updateMarkFlag , req={}", req);
  1991 + Integer id = req.getArticleId();
  1992 + long time = System.currentTimeMillis();
  1993 + Integer markFlag = req.getMarkFlag();
  1994 + if(id != null && markFlag != null){
  1995 + grassArticleDao.updateMarkFlag(id , markFlag , time);
  1996 + }
  1997 + }
1985 } 1998 }
@@ -65,7 +65,8 @@ public class TopicServiceImpl implements ITopicService { @@ -65,7 +65,8 @@ public class TopicServiceImpl implements ITopicService {
65 int total = grassTopicDAO.countByCondition(status,isOfficial,topicName,groupName,isHot,startTime,endTime,req.getHasArticleTop()); 65 int total = grassTopicDAO.countByCondition(status,isOfficial,topicName,groupName,isHot,startTime,endTime,req.getHasArticleTop());
66 List<TopicRespBo> pageData = new ArrayList<>(); 66 List<TopicRespBo> pageData = new ArrayList<>();
67 if(total > 0){ 67 if(total > 0){
68 - List<GrassTopic> list = grassTopicDAO.selectByPageCondition(status,isOfficial,topicName,groupName,isHot,startTime,endTime,req.getStart(),req.getSize(),req.getHasArticleTop()); 68 + List<GrassTopic> list = grassTopicDAO.selectByPageCondition(status,isOfficial,topicName,groupName,isHot,
  69 + startTime,endTime,req.getStart(),req.getSize(),req.getHasArticleTop(),req.getOrderRule());
69 pageData = convertTopicRespBo(list); 70 pageData = convertTopicRespBo(list);
70 } 71 }
71 PageResponseVO responseVO = new PageResponseVO(); 72 PageResponseVO responseVO = new PageResponseVO();
@@ -122,6 +123,17 @@ public class TopicServiceImpl implements ITopicService { @@ -122,6 +123,17 @@ public class TopicServiceImpl implements ITopicService {
122 grassTopicDAO.changeStatus(id,status); 123 grassTopicDAO.changeStatus(id,status);
123 } 124 }
124 125
  126 + @Override
  127 + public void changeTopicOrder(GrassTopicReq req) {
  128 + logger.info("enter changeTopicOrder , req={}", req);
  129 + GrassTopic grassTopic = new GrassTopic();
  130 + grassTopic.setId(req.getId());
  131 + grassTopic.setTopicOrder(req.getTopicOrder());
  132 + grassTopic.setPublishOrder(req.getPublishOrder());
  133 + grassTopic.setVisibleOrder(req.getVisibleOrder());
  134 + grassTopicDAO.updateByPrimaryKeySelective(grassTopic);
  135 + }
  136 +
125 /** 137 /**
126 * 设置是否是热门 138 * 设置是否是热门
127 * 最多只能同时存在5个热门话题 139 * 最多只能同时存在5个热门话题
@@ -508,6 +508,11 @@ @@ -508,6 +508,11 @@
508 str += "<a role='showDetail' class='btn-info' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>评论</a>"; 508 str += "<a role='showDetail' class='btn-info' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>评论</a>";
509 } 509 }
510 510
  511 + str += "<a role='markR'";
  512 + var classStr = rowData.markFlag == 1 ? "class='btn-danger'" : "class='btn-success'";
  513 + str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' markFlag='" + rowData.markFlag + "' style='margin-left:10px'>";
  514 + var optStr = rowData.markFlag == 1 ? "取消打标</a>" : "打标</a>";
  515 + str += optStr;
511 //str += "<a role='preview' class='btn-info' dataId='" + rowData.previewUrl + "' index='"+ rowIndex + "' style='margin-left:10px'>预览</a>"; 516 //str += "<a role='preview' class='btn-info' dataId='" + rowData.previewUrl + "' index='"+ rowIndex + "' style='margin-left:10px'>预览</a>";
512 517
513 return str; 518 return str;
@@ -573,6 +578,29 @@ @@ -573,6 +578,29 @@
573 } 578 }
574 }); 579 });
575 580
  581 + $(this).datagrid("getPanel").find("a[role='markR']").linkbutton({
  582 + iconCls : "icon-edit",
  583 + onClick: function () {
  584 + var markFlag = $(this).attr("markFlag");
  585 + var dataId = $(this).attr("dataId");
  586 + index = $(this).attr("index");
  587 + var message = "";
  588 + if(markFlag == 1){
  589 + message = "确认将该文章取消打标到达人搭配吗?";
  590 + }
  591 + if(markFlag == 0){
  592 + message = "确认将该文章打标到达人搭配吗?";
  593 + }
  594 + $.messager.confirm("确认", message, function (flag) {
  595 + if(flag){
  596 + switchMark(dataId, markFlag);
  597 +
  598 + }
  599 + });
  600 +
  601 + }
  602 + });
  603 +
576 $(this).datagrid("getPanel").find("a[role='switchT']").linkbutton({ 604 $(this).datagrid("getPanel").find("a[role='switchT']").linkbutton({
577 iconCls : "icon-edit", 605 iconCls : "icon-edit",
578 onClick: function () { 606 onClick: function () {
@@ -708,6 +736,17 @@ @@ -708,6 +736,17 @@
708 }, "json"); 736 }, "json");
709 } 737 }
710 738
  739 + function switchMark(id, markFlag) {
  740 + var switchMark = markFlag == 1 ? 0 : 1;
  741 + $.post(serverContextPath + "/grassArticle/updateMarkFlag.do?articleId=" + id + "&markFlag=" + switchMark, function (data) {
  742 + if(data.code != 200){
  743 + alert(data.message);
  744 + }else{
  745 + $("#activityListTable").datagrid("reload");
  746 + }
  747 + }, "json");
  748 + }
  749 +
711 function switchTop(id, status) { 750 function switchTop(id, status) {
712 var switchStatus = status == 1 ? 0 : 1; 751 var switchStatus = status == 1 ? 0 : 1;
713 $.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + id + "&isTop=" + switchStatus+ "&operateType=0", function (data) { 752 $.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + id + "&isTop=" + switchStatus+ "&operateType=0", function (data) {
@@ -57,6 +57,9 @@ @@ -57,6 +57,9 @@
57 <input id="endTimeStr" name="endTimeStr" class="easyui-datetimebox" data-options="prompt:'最近修改时间(结束)'"/> 57 <input id="endTimeStr" name="endTimeStr" class="easyui-datetimebox" data-options="prompt:'最近修改时间(结束)'"/>
58 </input> 58 </input>
59 59
  60 + <input class="easyui-combobox" id="orderRule">
  61 + </input>
  62 +
60 <a id="searchBtn" class="btn-info">查询</a> 63 <a id="searchBtn" class="btn-info">查询</a>
61 <!--<a id="addActivityBtn" class="btn-success">新增</a>--> 64 <!--<a id="addActivityBtn" class="btn-success">新增</a>-->
62 <a id="allBtn" class="btn-info">全部</a> 65 <a id="allBtn" class="btn-info">全部</a>
@@ -131,6 +134,14 @@ @@ -131,6 +134,14 @@
131 required: false, 134 required: false,
132 prompt: "请输入分组名称" 135 prompt: "请输入分组名称"
133 }); 136 });
  137 + $("#orderRule").combobox({
  138 + valueField: "value",
  139 + textField: "text",
  140 + required: false,
  141 + prompt: "排序规则",
  142 + data: [{text: "全部排序降序", value: "1"}, {text: "全部排序升序", value: "2"}, {text: "发布排序降序", value: "3"}
  143 + ,{text: "发布排序升序", value: "4"}]
  144 + });
134 145
135 146
136 147
@@ -153,7 +164,8 @@ @@ -153,7 +164,8 @@
153 groupName: $("#topicGroupParam").textbox("getValue"), 164 groupName: $("#topicGroupParam").textbox("getValue"),
154 startTime: startTime, 165 startTime: startTime,
155 endTime: endTime, 166 endTime: endTime,
156 - hasArticleTop:$("#hasArticleTop").combobox("getValue") 167 + hasArticleTop:$("#hasArticleTop").combobox("getValue"),
  168 + orderRule: $("#orderRule").combobox("getValue")
157 }); 169 });
158 } 170 }
159 }); 171 });
@@ -235,6 +247,16 @@ @@ -235,6 +247,16 @@
235 field: "attAmount", 247 field: "attAmount",
236 width: 25, 248 width: 25,
237 align: "left" 249 align: "left"
  250 + },{
  251 + title: "全部排序",
  252 + field: "topicOrder",
  253 + width: 25,
  254 + align: "left"
  255 + },{
  256 + title: "发布排序",
  257 + field: "publishOrder",
  258 + width: 25,
  259 + align: "left"
238 }, { 260 }, {
239 title: "置顶状态", 261 title: "置顶状态",
240 field: "topStatus", 262 field: "topStatus",
@@ -284,6 +306,8 @@ @@ -284,6 +306,8 @@
284 } 306 }
285 var topStr = "<a role='setTop' dataId='" + rowData.id + "' style='margin-left:10px;background-color: #31b0d5' index='" + rowIndex + "'>设置置顶</a>"; 307 var topStr = "<a role='setTop' dataId='" + rowData.id + "' style='margin-left:10px;background-color: #31b0d5' index='" + rowIndex + "'>设置置顶</a>";
286 308
  309 + topStr += "<a role='setOrder' dataId='" + rowData.id + "' style='margin-left:10px;background-color: #31b0d5' index='" + rowIndex + "'>设置排序</a>";
  310 +
287 //编辑 上下架 复制链接 设置热门 311 //编辑 上下架 复制链接 设置热门
288 return str + changeStatus + changeHot + link + topStr; 312 return str + changeStatus + changeHot + link + topStr;
289 } 313 }
@@ -366,6 +390,17 @@ @@ -366,6 +390,17 @@
366 } 390 }
367 }); 391 });
368 392
  393 + // 设置排序
  394 + $(this).datagrid("getPanel").find("a[role='setOrder']").linkbutton({
  395 + iconCls: "icon-edit",
  396 + onClick: function () {
  397 +
  398 + index = $(this).attr("index");
  399 + var row = $("#labelListTable").datagrid('getData').rows[index];
  400 + setTopicOrderDialog(row);
  401 + }
  402 + });
  403 +
369 } 404 }
370 }); 405 });
371 406
@@ -617,6 +652,74 @@ @@ -617,6 +652,74 @@
617 }); 652 });
618 } 653 }
619 654
  655 + // 设置排序
  656 + function setTopicOrderDialog(data) {
  657 +
  658 + var labelList = $("<div id='labelList'>").appendTo($(document.body));
  659 + var title = "设置排序";
  660 + window.self.paramObject.mkData = data;
  661 + $(labelList).myDialog({
  662 + title: title,
  663 + width: "30%",
  664 + height: "40%",
  665 + resizable: false,
  666 + buttons: [{
  667 + id: "saveBtn",
  668 + text: "保存",
  669 + iconCls: "icon-save",
  670 + handler: function () {
  671 +
  672 + $("#setOrderForm").form("submit", {
  673 + url: serverContextPath + "/grassTopicManage/changeTopicOrder",
  674 + onSubmit: function (param) {
  675 + console.log(param);
  676 + if (data != null) {
  677 + param.id = data.id;
  678 + }
  679 + param.topicOrder = $("#setOrderForm #topicOrder").textbox("getValue");
  680 + param.publishOrder = $("#setOrderForm #publishOrder").textbox("getValue");
  681 + if($("#setOrderForm #visibleOrder").is(":checked")){
  682 + param.visibleOrder = "1";
  683 + }else{
  684 + param.visibleOrder = "0";
  685 + }
  686 +
  687 +
  688 + $.messager.progress({
  689 + title: "正在执行",
  690 + msg: "正在执行,请稍后..."
  691 + });
  692 + return true;
  693 + },
  694 + success: function (data) {
  695 + $.messager.progress("close");
  696 + data = JSON.parse(data);
  697 + if (data.code == 200) {
  698 + $(labelList).dialog("close");
  699 + $("#labelListTable").datagrid("reload");
  700 + $.messager.show({
  701 + title: "提示",
  702 + msg: title + "成功!",
  703 + height: 120
  704 + });
  705 + } else {
  706 + $.messager.alert("错误", data.message, "error");
  707 + }
  708 + }
  709 + });
  710 + }
  711 + }, {
  712 + text: "关闭",
  713 + iconCls: "icon-cancel",
  714 + handler: function () {
  715 + $(labelList).dialog("close");
  716 + }
  717 + }],
  718 + modal: true,
  719 + href: contextPath + "/html/grass/topicManage/topicSetOrder.html"
  720 + });
  721 + }
  722 +
620 }); 723 });
621 724
622 </script> 725 </script>
  1 +<!DOCTYPE html>
  2 +<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
  3 + <form name="setOrderForm" id="setOrderForm" method="post">
  4 + <div style="margin-top: 20px;margin-left: 30px">
  5 + <table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
  6 + <tr style="height: 60px">
  7 + <td>
  8 + <label>全部排序</label> <br>
  9 + <input type="text" min=0 max=10 id="topicOrder" name="topicOrder" class="easyui-numberbox" data-options="min:0,precision:0" style="width: 70%;" /><br>
  10 + </td>
  11 + <td>
  12 + <input type="checkbox" id = "visibleOrder"/>全部用户可见
  13 + </td>
  14 +
  15 +
  16 + </tr>
  17 + <tr style="height: 60px">
  18 + <td>
  19 + <label>发布排序</label> <br>
  20 + <input type="text" min=0 max=10 id="publishOrder" name="topicOrder" class="easyui-numberbox" data-options="min:0,precision:0" style="width: 70%;" /><br>
  21 + <span style="color:red">说明:是否可见由上下架状态控制</span>
  22 + </td>
  23 + </tr>
  24 + </table>
  25 + </div>
  26 + </form>
  27 +
  28 +</div>
  29 +
  30 +
  31 +<script>
  32 +
  33 + $(function () {
  34 + $("#setOrderForm #topicOrder").textbox({
  35 + required: true,
  36 + missingMessage: "排序值不能为空",
  37 + prompt: "  填写序号,且为正整数"
  38 + });
  39 +
  40 + $("#setOrderForm #publishOrder").textbox({
  41 + required: true,
  42 + missingMessage: "排序值不能为空",
  43 + prompt: "  填写序号,且为正整数"
  44 + });
  45 +
  46 + var data = paramObject.mkData;
  47 + $("#topicOrder").textbox("setValue", data.topicOrder);
  48 + $("#publishOrder").textbox("setValue", data.publishOrder);
  49 + if(data.visibleOrder == '1'){
  50 + $("#visibleOrder").attr("checked",true);
  51 + }else{
  52 + $("#visibleOrder").attr("checked",false);
  53 + }
  54 +
  55 + });
  56 +
  57 +
  58 +</script>
  59 +
  60 +</html>
  61 +