Authored by liangyi.chen@yoho.cn

Merge branch 'dev_grass_20190806' into test6.9.10

... ... @@ -166,4 +166,16 @@ public class GrassArticleController {
}
}
@RequestMapping("/updateMarkFlag")
public ApiResponse updateMarkFlag(@RequestBody GrassArticleReq req) {
logger.info("grassArticle updateMarkFlag begin, req is {}");
try {
grassArticleService.updateMarkFlag(req);
return new ApiResponse.ApiResponseBuilder().build();
} catch (PlatformException e) {
return new ApiResponse.ApiResponseBuilder().code(e.getCode()).message(e.getMessage()).build();
}
}
}
... ...
... ... @@ -73,4 +73,11 @@ public class GrassTopicController {
public ApiResponse addArticlesTop(@RequestBody GrassTopicReq req){
return topicService.addArticlesTop(req);
}
@RequestMapping("/changeTopicOrder")
@ResponseBody
public ApiResponse changeTopicOrder(@RequestBody GrassTopicReq req){
topicService.changeTopicOrder(req);
return new ApiResponse.ApiResponseBuilder().build();
}
}
... ...
... ... @@ -34,4 +34,6 @@ public interface IGrassArticleService {
List<Integer> getUidByNickName(String nickName);
void updateMarkFlag(GrassArticleReq req) throws PlatformException;
}
... ...
... ... @@ -27,4 +27,9 @@ public interface ITopicService {
* @return
*/
ApiResponse addArticlesTop(GrassTopicReq req);
/**
* 设置某话题排序值
*/
void changeTopicOrder(GrassTopicReq req);
}
... ...
... ... @@ -1568,6 +1568,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
//短视频url
rspBo.setVideoUrl(videoMap.get(article.getId()) == null ? "" : videoMap.get(article.getId()).getString("videoUrl"));
rspBo.setFileId(videoMap.get(article.getId()) == null ? "" : videoMap.get(article.getId()).getString("fileId"));
//是否打标到达人搭配 0-否 1-是
rspBo.setMarkFlag(article.getMarkFlag());
rspBoList.add(rspBo);
});
return rspBoList;
... ... @@ -1982,4 +1984,15 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
String url = apiUrl + "/?client_type=h5&method=app.grass.videoTask&fileId=" + fileId + "&articleId=" + articleId;
serviceCaller.get("gateway.app.grass.videoTask", url, null, String.class, null);
}
@Override
public void updateMarkFlag(GrassArticleReq req) {
logger.info("enter updateMarkFlag , req={}", req);
Integer id = req.getArticleId();
long time = System.currentTimeMillis();
Integer markFlag = req.getMarkFlag();
if(id != null && markFlag != null){
grassArticleDao.updateMarkFlag(id , markFlag , time);
}
}
}
... ...
... ... @@ -65,7 +65,8 @@ public class TopicServiceImpl implements ITopicService {
int total = grassTopicDAO.countByCondition(status,isOfficial,topicName,groupName,isHot,startTime,endTime,req.getHasArticleTop());
List<TopicRespBo> pageData = new ArrayList<>();
if(total > 0){
List<GrassTopic> list = grassTopicDAO.selectByPageCondition(status,isOfficial,topicName,groupName,isHot,startTime,endTime,req.getStart(),req.getSize(),req.getHasArticleTop());
List<GrassTopic> list = grassTopicDAO.selectByPageCondition(status,isOfficial,topicName,groupName,isHot,
startTime,endTime,req.getStart(),req.getSize(),req.getHasArticleTop(),req.getOrderRule());
pageData = convertTopicRespBo(list);
}
PageResponseVO responseVO = new PageResponseVO();
... ... @@ -122,6 +123,17 @@ public class TopicServiceImpl implements ITopicService {
grassTopicDAO.changeStatus(id,status);
}
@Override
public void changeTopicOrder(GrassTopicReq req) {
logger.info("enter changeTopicOrder , req={}", req);
GrassTopic grassTopic = new GrassTopic();
grassTopic.setId(req.getId());
grassTopic.setTopicOrder(req.getTopicOrder());
grassTopic.setPublishOrder(req.getPublishOrder());
grassTopic.setVisibleOrder(req.getVisibleOrder());
grassTopicDAO.updateByPrimaryKeySelective(grassTopic);
}
/**
* 设置是否是热门
* 最多只能同时存在5个热门话题
... ...
... ... @@ -508,6 +508,11 @@
str += "<a role='showDetail' class='btn-info' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>评论</a>";
}
str += "<a role='markR'";
var classStr = rowData.markFlag == 1 ? "class='btn-danger'" : "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' markFlag='" + rowData.markFlag + "' style='margin-left:10px'>";
var optStr = rowData.markFlag == 1 ? "取消打标</a>" : "打标</a>";
str += optStr;
//str += "<a role='preview' class='btn-info' dataId='" + rowData.previewUrl + "' index='"+ rowIndex + "' style='margin-left:10px'>预览</a>";
return str;
... ... @@ -573,6 +578,29 @@
}
});
$(this).datagrid("getPanel").find("a[role='markR']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var markFlag = $(this).attr("markFlag");
var dataId = $(this).attr("dataId");
index = $(this).attr("index");
var message = "";
if(markFlag == 1){
message = "确认将该文章取消打标到达人搭配吗?";
}
if(markFlag == 0){
message = "确认将该文章打标到达人搭配吗?";
}
$.messager.confirm("确认", message, function (flag) {
if(flag){
switchMark(dataId, markFlag);
}
});
}
});
$(this).datagrid("getPanel").find("a[role='switchT']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
... ... @@ -708,6 +736,17 @@
}, "json");
}
function switchMark(id, markFlag) {
var switchMark = markFlag == 1 ? 0 : 1;
$.post(serverContextPath + "/grassArticle/updateMarkFlag.do?articleId=" + id + "&markFlag=" + switchMark, function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
function switchTop(id, status) {
var switchStatus = status == 1 ? 0 : 1;
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + id + "&isTop=" + switchStatus+ "&operateType=0", function (data) {
... ...
... ... @@ -57,6 +57,9 @@
<input id="endTimeStr" name="endTimeStr" class="easyui-datetimebox" data-options="prompt:'最近修改时间(结束)'"/>
</input>
<input class="easyui-combobox" id="orderRule">
</input>
<a id="searchBtn" class="btn-info">查询</a>
<!--<a id="addActivityBtn" class="btn-success">新增</a>-->
<a id="allBtn" class="btn-info">全部</a>
... ... @@ -131,6 +134,14 @@
required: false,
prompt: "请输入分组名称"
});
$("#orderRule").combobox({
valueField: "value",
textField: "text",
required: false,
prompt: "排序规则",
data: [{text: "全部排序降序", value: "1"}, {text: "全部排序升序", value: "2"}, {text: "发布排序降序", value: "3"}
,{text: "发布排序升序", value: "4"}]
});
... ... @@ -153,7 +164,8 @@
groupName: $("#topicGroupParam").textbox("getValue"),
startTime: startTime,
endTime: endTime,
hasArticleTop:$("#hasArticleTop").combobox("getValue")
hasArticleTop:$("#hasArticleTop").combobox("getValue"),
orderRule: $("#orderRule").combobox("getValue")
});
}
});
... ... @@ -235,6 +247,16 @@
field: "attAmount",
width: 25,
align: "left"
},{
title: "全部排序",
field: "topicOrder",
width: 25,
align: "left"
},{
title: "发布排序",
field: "publishOrder",
width: 25,
align: "left"
}, {
title: "置顶状态",
field: "topStatus",
... ... @@ -284,6 +306,8 @@
}
var topStr = "<a role='setTop' dataId='" + rowData.id + "' style='margin-left:10px;background-color: #31b0d5' index='" + rowIndex + "'>设置置顶</a>";
topStr += "<a role='setOrder' dataId='" + rowData.id + "' style='margin-left:10px;background-color: #31b0d5' index='" + rowIndex + "'>设置排序</a>";
//编辑 上下架 复制链接 设置热门
return str + changeStatus + changeHot + link + topStr;
}
... ... @@ -366,6 +390,17 @@
}
});
// 设置排序
$(this).datagrid("getPanel").find("a[role='setOrder']").linkbutton({
iconCls: "icon-edit",
onClick: function () {
index = $(this).attr("index");
var row = $("#labelListTable").datagrid('getData').rows[index];
setTopicOrderDialog(row);
}
});
}
});
... ... @@ -617,6 +652,74 @@
});
}
// 设置排序
function setTopicOrderDialog(data) {
var labelList = $("<div id='labelList'>").appendTo($(document.body));
var title = "设置排序";
window.self.paramObject.mkData = data;
$(labelList).myDialog({
title: title,
width: "30%",
height: "40%",
resizable: false,
buttons: [{
id: "saveBtn",
text: "保存",
iconCls: "icon-save",
handler: function () {
$("#setOrderForm").form("submit", {
url: serverContextPath + "/grassTopicManage/changeTopicOrder",
onSubmit: function (param) {
console.log(param);
if (data != null) {
param.id = data.id;
}
param.topicOrder = $("#setOrderForm #topicOrder").textbox("getValue");
param.publishOrder = $("#setOrderForm #publishOrder").textbox("getValue");
if($("#setOrderForm #visibleOrder").is(":checked")){
param.visibleOrder = "1";
}else{
param.visibleOrder = "0";
}
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后..."
});
return true;
},
success: function (data) {
$.messager.progress("close");
data = JSON.parse(data);
if (data.code == 200) {
$(labelList).dialog("close");
$("#labelListTable").datagrid("reload");
$.messager.show({
title: "提示",
msg: title + "成功!",
height: 120
});
} else {
$.messager.alert("错误", data.message, "error");
}
}
});
}
}, {
text: "关闭",
iconCls: "icon-cancel",
handler: function () {
$(labelList).dialog("close");
}
}],
modal: true,
href: contextPath + "/html/grass/topicManage/topicSetOrder.html"
});
}
});
</script>
... ...
<!DOCTYPE html>
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
<form name="setOrderForm" id="setOrderForm" method="post">
<div style="margin-top: 20px;margin-left: 30px">
<table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
<tr style="height: 60px">
<td>
<label>全部排序</label> <br>
<input type="text" min=0 max=10 id="topicOrder" name="topicOrder" class="easyui-numberbox" data-options="min:0,precision:0" style="width: 70%;" /><br>
</td>
<td>
<input type="checkbox" id = "visibleOrder"/>全部用户可见
</td>
</tr>
<tr style="height: 60px">
<td>
<label>发布排序</label> <br>
<input type="text" min=0 max=10 id="publishOrder" name="topicOrder" class="easyui-numberbox" data-options="min:0,precision:0" style="width: 70%;" /><br>
<span style="color:red">说明:是否可见由上下架状态控制</span>
</td>
</tr>
</table>
</div>
</form>
</div>
<script>
$(function () {
$("#setOrderForm #topicOrder").textbox({
required: true,
missingMessage: "排序值不能为空",
prompt: "  填写序号,且为正整数"
});
$("#setOrderForm #publishOrder").textbox({
required: true,
missingMessage: "排序值不能为空",
prompt: "  填写序号,且为正整数"
});
var data = paramObject.mkData;
$("#topicOrder").textbox("setValue", data.topicOrder);
$("#publishOrder").textbox("setValue", data.publishOrder);
if(data.visibleOrder == '1'){
$("#visibleOrder").attr("checked",true);
}else{
$("#visibleOrder").attr("checked",false);
}
});
</script>
</html>
... ...