Authored by chaogeng

Merge branch 'dev_grass_20190108' of http://git.yoho.cn/platform/platform-cms in…

…to dev_grass_20190108
... ... @@ -3,13 +3,14 @@ package com.yohobuy.platform.grass.restapi;
import com.yohobuy.platform.grass.service.IGrassGoodsCommentService;
import com.yohobuy.platform.model.common.ApiResponse;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.grass.request.GoodsCommentModifyStatusReq;
import com.yohobuy.platform.model.grass.request.GoodsCommentQueryReq;
import com.yohobuy.platform.model.grass.response.GoodsCommentQueryRsp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
... ... @@ -33,9 +34,9 @@ public class GrassGoodsCommentController {
@RequestMapping("/modifyStatus")
@ResponseBody
public ApiResponse modifyStatus(@RequestParam("id") Integer id,@RequestParam("status") Integer status){
logger.info("enter modifyStatus.id is {},status is {}",id,status);
grassGoodsCommentService.modifyStatus(id,status);
public ApiResponse modifyStatus(@RequestBody GoodsCommentModifyStatusReq req){
logger.info("enter modifyStatus.param is {}",req);
grassGoodsCommentService.modifyStatus(req);
return new ApiResponse.ApiResponseBuilder().message("审核完成").build();
}
}
... ...
package com.yohobuy.platform.grass.service;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.grass.request.GoodsCommentModifyStatusReq;
import com.yohobuy.platform.model.grass.request.GoodsCommentQueryReq;
import com.yohobuy.platform.model.grass.response.GoodsCommentQueryRsp;
... ... @@ -10,5 +11,5 @@ import com.yohobuy.platform.model.grass.response.GoodsCommentQueryRsp;
public interface IGrassGoodsCommentService {
PageResponseVO<GoodsCommentQueryRsp> queryComment(GoodsCommentQueryReq req);
void modifyStatus(Integer id,Integer status);
void modifyStatus(GoodsCommentModifyStatusReq req);
}
... ...
... ... @@ -6,6 +6,7 @@ import com.yohobuy.platform.dal.grass.IGrassGoodsCommentDao;
import com.yohobuy.platform.grass.service.IGrassGoodsCommentService;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.grass.GoodsChildCommentTotalBo;
import com.yohobuy.platform.model.grass.request.GoodsCommentModifyStatusReq;
import com.yohobuy.platform.model.grass.request.GoodsCommentQueryReq;
import com.yohobuy.platform.model.grass.response.GoodsCommentQueryRsp;
import org.apache.commons.collections.CollectionUtils;
... ... @@ -54,8 +55,8 @@ public class GrassGoodsCommentServiceImpl implements IGrassGoodsCommentService {
}
@Override
public void modifyStatus(Integer id,Integer status) {
public void modifyStatus(GoodsCommentModifyStatusReq req) {
Integer reviewerId = new UserHelper().getUserId();
grassGoodsCommentDao.updateStatus(id,status,reviewerId, DateUtil.currentTimeSeconds());
grassGoodsCommentDao.updateStatus(req.getIds(),req.getStatus(),reviewerId, DateUtil.currentTimeSeconds());
}
}
... ...
... ... @@ -46,7 +46,10 @@
<a id="allBtn" class="btn-info">全部</a>
</div>
<div style="margin-left: 20px;margin-top: 10px">
<a id="btnBatchAllow" class="btn-long" style="background-color: #5CB85C;">批量通过</a>
<a id="btnBatchBan" class="btn-long" style="background-color: #ffa951;">批量拒绝</a>
</div>
</div>
<div region="center" id="labelGroupList" style="margin-left: 20px">
... ... @@ -87,7 +90,24 @@
$("#labelGroupListTable").datagrid("load", {});
}
});
$("#btnBatchAllow").click(function(){
batchUpdateStatus(1);
});
$("#btnBatchBan").click(function(){
batchUpdateStatus(2);
});
function batchUpdateStatus(status){
var rows = $('#labelGroupListTable').datagrid('getSelections');
if(!rows||rows.length == 0){
$.messager.alert("提示", "请先选择数据!", "warn");
return;
}
var ids = [];
rows.forEach(function(value,i){
ids.push(value.id);
})
updateStatus(ids,status)
}
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
... ... @@ -128,6 +148,11 @@
},
columns: [[
{
field: "ck",
checkbox:true,
align: "left"
},
{
title: "评论ID",
field: "id",
width: 15,
... ... @@ -223,7 +248,7 @@
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: true,
singleSelect: false,
onLoadSuccess: function (data) {
if(index != ""){
$(this).datagrid("scrollTo",index);
... ... @@ -235,7 +260,7 @@
onClick : function() {
index = $(this).attr("index");
var row = $("#labelGroupListTable").datagrid('getData').rows[index];
updateStatus(row.id,1);
updateStatus([row.id],1);
}
});
$(this).datagrid("getPanel").find("a[role='banStatus']").linkbutton({
... ... @@ -243,37 +268,40 @@
onClick : function() {
index = $(this).attr("index");
var row = $("#labelGroupListTable").datagrid('getData').rows[index];
updateStatus(row.id,2);
updateStatus([row.id],2);
}
});
function updateStatus(id,status){
$.ajax(
{
type : 'post',
url : serverContextPath + "/grassGoodsComment/modifyStatus",
dataType : 'json',
data : {
id:id,
status:status
},
success : function(result){
if(result.code==200){
$("#labelGroupListTable").datagrid("reload");
$.messager.show({
title: "提示",
msg: "审核成功!",
height: 120
});
}else{
$.messager.alert("审核失败", result.message, "error");
}
}
}
);
}
}
});
function updateStatus(ids,status){
var param={
ids:ids,
status:status
};
$.ajax(
{
type : 'post',
url : serverContextPath + "/grassGoodsComment/modifyStatus",
dataType : 'json',
data : JSON.stringify(param),
contentType : 'application/json',
dataType : 'json',
success : function(result){
if(result.code==200){
$("#labelGroupListTable").datagrid("reload");
$.messager.show({
title: "提示",
msg: "审核成功!",
height: 120
});
}else{
$.messager.alert("审核失败", result.message, "error");
}
}
}
);
}
});
</script>
... ...
... ... @@ -305,7 +305,7 @@
iconCls : "icon-save",
handler:function(){
var rows = $('#productListTable').datagrid('getSelections');
if(!rows){
if(!rows||rows.length == 0){
$.messager.alert("提示", "请先选择数据!", "warn");
return;
}
... ...