提交 4e346d71 authored 作者: 吴德鹏's avatar 吴德鹏

评论管理

上级 77c9e820
......@@ -66,9 +66,11 @@ public class TbCfItemCommentController {
@RequiresPermissions("tbcfitemcomment:save")
@ResponseBody
public R save(@RequestBody TbCfItemCommentEntity tbCfItemComment) {
tbCfItemCommentService.save(tbCfItemComment);
return R.ok();
int res = tbCfItemCommentService.save(tbCfItemComment);
if (res > 0) {
return R.ok();
}
return R.error("操作失败");
}
/**
......@@ -78,9 +80,12 @@ public class TbCfItemCommentController {
@RequiresPermissions("tbcfitemcomment:update")
@ResponseBody
public R update(@RequestBody TbCfItemCommentEntity tbCfItemComment) {
tbCfItemCommentService.update(tbCfItemComment);
int res = tbCfItemCommentService.update(tbCfItemComment);
return R.ok();
if (res > 0) {
return R.ok();
}
return R.error("操作失败");
}
/**
......
......@@ -57,10 +57,10 @@ public class TbCfItemCommentEntity implements Serializable {
* 商品评论
*/
private String itemReview;
/**
* 点赞人数
*/
private Long likeNum;
// /**
// * 点赞人数
// */
// private Long likeNum;
/**
* 删除标志 0:正常 1:已删除
*/
......@@ -78,6 +78,24 @@ public class TbCfItemCommentEntity implements Serializable {
private String orderNo;
private String itemName;
private boolean real;
private String itemImg;
public String getItemImg() {
return itemImg;
}
public void setItemImg(String itemImg) {
this.itemImg = itemImg;
}
public boolean isReal() {
return real;
}
public void setReal(boolean real) {
this.real = real;
}
public String getUserName() {
return userName;
......@@ -250,19 +268,19 @@ public class TbCfItemCommentEntity implements Serializable {
public String getItemReview() {
return itemReview;
}
/**
* 设置:点赞人数
*/
public void setLikeNum(Long likeNum) {
this.likeNum = likeNum;
}
/**
* 获取:点赞人数
*/
public Long getLikeNum() {
return likeNum;
}
// /**
// * 设置:点赞人数
// */
// public void setLikeNum(Long likeNum) {
// this.likeNum = likeNum;
// }
//
// /**
// * 获取:点赞人数
// */
// public Long getLikeNum() {
// return likeNum;
// }
/**
* 设置:删除标志 0:正常 1:已删除
*/
......
package com.platform.service.impl;
import com.platform.dao.TbCfItemCommentDao;
import com.platform.dao.TbCfUserInfoDao;
import com.platform.entity.TbCfItemCommentEntity;
import com.platform.service.TbCfItemCommentService;
import com.platform.utils.IdUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -21,6 +24,9 @@ public class TbCfItemCommentServiceImpl implements TbCfItemCommentService {
@Autowired
private TbCfItemCommentDao tbCfItemCommentDao;
@Autowired
private TbCfUserInfoDao tbCfUserInfoDao;
@Override
public TbCfItemCommentEntity queryObject(String id) {
return tbCfItemCommentDao.queryObject(id);
......@@ -38,12 +44,28 @@ public class TbCfItemCommentServiceImpl implements TbCfItemCommentService {
@Override
public int save(TbCfItemCommentEntity tbCfItemComment) {
// String account = tbCfItemComment.getUserId();
// String userId = tbCfUserInfoDao.queryById(account);
// if (StringUtils.isBlank(userId)) {
// return 0;
// }
// tbCfItemComment.setUserId(userId);
tbCfItemComment.setId(IdUtil.createIdbyUUID());
tbCfItemComment.setReal(true);
tbCfItemComment.setCreateTime(new Date());
tbCfItemComment.setUpdateTime(new Date());
tbCfItemComment.setDelFlag(0);
return tbCfItemCommentDao.save(tbCfItemComment);
}
@Override
public int update(TbCfItemCommentEntity tbCfItemComment) {
// String account = tbCfItemComment.getUserId();
// String userId = tbCfUserInfoDao.queryById(account);
// if (StringUtils.isBlank(userId)) {
// return 0;
// }
tbCfItemComment.setUpdateTime(new Date());
return tbCfItemCommentDao.update(tbCfItemComment);
}
......
......@@ -15,13 +15,15 @@
<result property="logisticsScore" column="logistics_score"/>
<result property="priceScore" column="price_score"/>
<result property="itemReview" column="item_review"/>
<result property="likeNum" column="like_num"/>
<!-- <result property="likeNum" column="like_num"/>-->
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="username" column="nick"></result>
<result property="orderNo" column="order_no"></result>
<result property="itemName" column="item_name"></result>
<result property="real" column="real"/>
<result property="itemImg" column="item_img"/>
<!-- <result property="username" column="nick"></result>-->
<!-- <result property="orderNo" column="order_no"></result>-->
<!-- <result property="itemName" column="item_name"></result>-->
</resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfItemCommentEntity">
......@@ -37,7 +39,7 @@
`logistics_score`,
`price_score`,
`item_review`,
`like_num`,
`real`,
`del_flag`,
`create_time`,
`update_time`
......@@ -58,13 +60,14 @@
c.logistics_score,
c.price_score,
c.item_review,
c.like_num,
c.real,
c.del_flag,
c.create_time,
c.update_time,
u.nick userName,
o.order_no orderNo,
i.item_name itemName
o.order_no,
i.item_name,
i.item_img
FROM
tb_cf_item_comment c
LEFT JOIN tb_cf_user_info u ON c.user_id = u.user_id
......@@ -75,12 +78,24 @@
<if test="name != null and name.trim() != ''">
AND u.nick LIKE concat('%',#{name},'%')
</if>
<if test="real != null and real.trim()!=''">
AND c.real=#{real}
</if>
<if test="startTime != null and startTime.trim() != '' and endTime!=null and endTime!=''">
AND c.create_time between #{startTime} and #{endTime}
</if>
<if test="orderNo != null and orderNo.trim() != ''">
AND o.order_no =#{orderNo}
</if>
<if test="itemName != null and itemName.trim() != ''">
AND i.item_name LIKE concat('%',#{itemName},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by item_id desc,create_time desc
order by create_time desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
......@@ -89,11 +104,29 @@
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_item_comment c left join tb_cf_user_info u on c.user_id=u.user_id
SELECT
count(1)
FROM
tb_cf_item_comment c
LEFT JOIN tb_cf_user_info u ON c.user_id = u.user_id
left join tb_cf_order o on c.order_id=o.order_id
left join tb_cf_station_item i on c.item_id=i.item_id
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND u.nick LIKE concat('%',#{name},'%')
</if>
<if test="real != null and real.trim()!=''">
AND c.real=#{real}
</if>
<if test="startTime != null and startTime.trim() != '' and endTime!=null and endTime!=''">
AND c.create_time between #{startTime} and #{endTime}
</if>
<if test="orderNo != null and orderNo.trim() != ''">
AND o.order_no =#{orderNo}
</if>
<if test="itemName != null and itemName.trim() != ''">
AND i.item_name LIKE concat('%',#{itemName},'%')
</if>
</select>
<insert id="save" parameterType="com.platform.entity.TbCfItemCommentEntity">
......@@ -109,7 +142,7 @@
`logistics_score`,
`price_score`,
`item_review`,
`like_num`,
`real`,
`del_flag`,
`create_time`,
`update_time`)
......@@ -125,7 +158,7 @@
#{logisticsScore},
#{priceScore},
#{itemReview},
#{likeNum},
#{real},
#{delFlag},
#{createTime},
#{updateTime})
......@@ -144,7 +177,7 @@
<if test="logisticsScore != null">`logistics_score` = #{logisticsScore},</if>
<if test="priceScore != null">`price_score` = #{priceScore},</if>
<if test="itemReview != null">`item_review` = #{itemReview},</if>
<if test="likeNum != null">`like_num` = #{likeNum},</if>
<!-- <if test="real != null">`like_num` = #{real},</if>-->
<if test="delFlag != null">`del_flag` = #{delFlag},</if>
<if test="createTime != null">`create_time` = #{createTime},</if>
<if test="updateTime != null">`update_time` = #{updateTime}</if>
......@@ -163,4 +196,4 @@
</foreach>
</delete>
</mapper>
\ No newline at end of file
</mapper>
......@@ -10,6 +10,10 @@
padding: 13px;
vertical-align: middle;
}
.ivu-card-body>form>div{
margin: 0 auto;
width: 500px;
}
</style>
</head>
<body>
......@@ -42,41 +46,56 @@
<Card v-show="!showList">
<p slot="title">{{title}}</p>
<i-form ref="formValidate" :model="tbCfItemComment" :rules="ruleValidate" :label-width="80">
<Form-item label="评论人" prop="userId">
<i-input v-model="tbCfItemComment.userId" placeholder="评论人"/>
<Form-item label="选择用户" prop="userId" style="width: 500px">
<i-input v-model="tbCfItemComment.userId" placeholder="选择用户"/>
</Form-item>
<!-- <Form-item label="订单ID" prop="orderId">-->
<!-- <i-input v-model="tbCfItemComment.orderId" placeholder="订单ID"/>-->
<!-- </Form-item>-->
<Form-item label="评论时间" prop="createTime" style="width: 500px">
<Date-picker v-model="tbCfItemComment.createTime" type="datetime" placeholder="评论时间"
></Date-picker>
</Form-item>
<Form-item label="订单ID" prop="orderId">
<i-input v-model="tbCfItemComment.orderId" placeholder="订单ID"/>
<Form-item label="类型" prop="type" style="width: 500px">
<i-select v-model="tbCfItemComment.type" placeholder="请选择"/>
<i-option v-for="v in commentList" :value="v.value">{{v.label}}</i-option>
</i-select>
</Form-item>
<Form-item label="商品ID" prop="itemId">
<i-input v-model="tbCfItemComment.itemId" placeholder="商品ID"/>
<Form-item label="图片/视频" prop="urls">
<!-- <i-input v-model="xPicture.pictureUrl" placeholder="图片地址"/> -->
<upload
multiple
action="../api/osstest/uploadtest"
:before-upload="handleBeforeUpload"
:on-success="vhandleSuccess" :show-upload-list="false" accept="image/jpeg, image/png">
<i-button icon="ios-cloud-upload-outline">请选择图片</i-button>
</upload>
<div id="imgWrapper" style="display: flex;position: relative;">
<div v-for="item in uploadList" style="margin-left: 5px;" :data-img-path="item">
<img :src="item" width="100" height="100" id="itemImg">
<i class="ivu-icon ivu-icon-ios-trash-outline"
style="cursor:pointer;display: flex;font-size: 24px;position: relative;left:11px"
@click="delImg1(item)"></i>
</div>
</div>
</Form-item>
<Form-item label="商品评分" prop="itemScore">
<Form-item label="选择商品" prop="itemId" style="width: 500px">
<i-input v-model="tbCfItemComment.itemId" placeholder="选择商品"/>
</Form-item>
<Form-item label="商品评分" prop="itemScore" style="width: 500px">
<i-input v-model="tbCfItemComment.itemScore" placeholder="商品评分"/>
</Form-item>
<Form-item label="服务评分" prop="serviceScore">
<Form-item label="服务评分" prop="serviceScore" style="width: 500px">
<i-input v-model="tbCfItemComment.serviceScore" placeholder="服务评分"/>
</Form-item>
<Form-item label="物流评分" prop="logisticsScore">
<Form-item label="物流评分" prop="logisticsScore" style="width: 500px">
<i-input v-model="tbCfItemComment.logisticsScore" placeholder="物流评分"/>
</Form-item>
<Form-item label="价格评分" prop="priceScore">
<Form-item label="价格评分" prop="priceScore" style="width: 500px">
<i-input v-model="tbCfItemComment.priceScore" placeholder="价格评分"/>
</Form-item>
<Form-item label="商品评论" prop="itemReview">
<i-input v-model="tbCfItemComment.itemReview" placeholder="商品评论"/>
</Form-item>
<Form-item label="点赞人数" prop="likeNum">
<i-input v-model="tbCfItemComment.likeNum" placeholder="点赞人数"/>
</Form-item>
<Form-item label="删除标志 0:正常 1:已删除" prop="delFlag">
<i-input v-model="tbCfItemComment.delFlag" placeholder="删除标志 0:正常 1:已删除"/>
</Form-item>
<Form-item label="创建时间" prop="createTime">
<i-input v-model="tbCfItemComment.createTime" placeholder="创建时间"/>
</Form-item>
<Form-item label="回复时间" prop="replyTime">
<i-input v-model="tbCfItemComment.replyTime" placeholder="回复时间"/>
<Form-item label="商品评论" prop="itemReview" >
<textarea v-model="tbCfItemComment.itemReview" style="width: 400px;height: 300px;"></textarea>
</Form-item>
<Form-item>
<i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
......@@ -90,4 +109,4 @@
<script src="${rc.contextPath}/js/sys/tbcfitemcomment.js?_${date.systemTime}"></script>
</body>
</html>
\ No newline at end of file
</html>
......@@ -9,6 +9,9 @@
position: relative !important;
top: 0 !important;
}
.ui-jqgrid .ui-jqgrid-bdiv{
overflow: revert !important;
}
</style>
<body>
<div id="rrapp" v-cloak style="height: calc(100% - 15px);">
......
......@@ -11,14 +11,23 @@ $(function () {
{label: '物流评分', name: 'logisticsScore', index: 'logistics_score', width: 80},
{label: '价格评分', name: 'priceScore', index: 'price_score', width: 80},
{label: '商品评论', name: 'itemReview', index: 'item_review', width: 80},
{label: '点赞人数', name: 'likeNum', index: 'like_num', width: 80},
// {label: '点赞人数', name: 'likeNum', index: 'like_num', width: 80},
{label: '状态', name: 'delFlag', index: 'del_flag', width: 80, formatter: statusFormat},
{label: '创建时间', name: 'createTime', index: 'create_time', width: 80}
{label: '创建时间', name: 'createTime', index: 'create_time', width: 80},
{
label: '评论类型', name: 'real', index: 'real', width: 80, formatter: function (value, options, row) {
if (value) {
return '<span class="label label-primary">真实评论</span>'
}
return '<span class="label label-warning">虚拟评论</span>'
}
}
],
shrinkToFit: true,
datatype : "json",
rowNum:15,
rowList:[15,30,45],
datatype: "json",
rowNum: 10,
rowList: [10, 30, 45],
mtype: "POST",
rownumbers: true,
rownumWidth: 40,
......@@ -33,6 +42,20 @@ $(function () {
let vm = new Vue({
el: '#rrapp',
data: {
uploadList: [],
commentList: [
{
label: '纯文本',
value: 0
}, {
label: '带图片',
value: 1
}, {
label: '带视频',
value: 2
}
],
showList: true,
title: null,
tbCfItemComment: {},
......@@ -42,19 +65,101 @@ let vm = new Vue({
]
},
q: {
name: ''
name: '',
real: '',
startTime: '',
endTime: '',
orderNo: '',
itemName: ''
}
},
methods: {
vhandleSuccess(response, file, fileList) {
// "http://diaosaas-prod.oss-cn-shenzhen.aliyuncs.com/education/155728894307110106.jpg"
console.log('shangchuan', response)
vm.uploadList.push(response);
$("#itemImg").show();
},
handleSuccess(response, file, fileList) {
// "http://diaosaas-prod.oss-cn-shenzhen.aliyuncs.com/education/155728894307110106.jpg"
vm.uploadList1.push(response);
$("#skuImg").show();
},
handleBeforeUpload(file) {
// 上传图片大小不超过5M
if (file.size > 5 * 1024 * 1024) {
alert('请上传不超过5M的图片');
return false;
}
const check = this.uploadList.length < 6;
if (!check) {
this.$Notice.warning({
title: '最多只能上传6张图片'
});
return false;
}
// 限制上传文件的宽高
// return this.checkImageWH(file,750,320);
},
// 限制上传图片的宽高
checkImageWH: function (file, width, height) {
let self = this;
return new Promise(function (resolve, reject) {
let filereader = new FileReader();
filereader.onload = e => {
let src = e.target.result;
const image = new Image();
image.onload = function () {
if (width && image.width != width) {
self.$Notice.error({
title: '请上传宽为' + width + "的图片",
});
reject();
} else if (height && image.height != height) {
self.$Notice.error({
title: '请上传高为' + height + "的图片",
});
reject();
} else {
resolve();
}
};
image.onerror = reject;
image.src = src;
};
filereader.readAsDataURL(file);
});
},
// 删除上传图片
delImg1: function (url) {
if (vm.title != "详情") {
vm.uploadList.remove(url);
console.log(url);
Ajax.request({
url: "../api/upload/delFile?url=" + url,
async: false,
type: "POST",
contentType: "application/json",
successCallback: function (resultData) {
// console.log(resultData);
iview.Message.success(resultData.success);
}
});
}
},
query: function () {
vm.reload();
},
add: function () {
vm.uploadList = [];
vm.showList = false;
vm.title = "新增";
vm.tbCfItemComment = {};
},
update: function (event) {
vm.uploadList = [];
let id = getSelectedRow("#jqGrid");
if (id == null) {
return;
......@@ -66,6 +171,8 @@ let vm = new Vue({
},
saveOrUpdate: function (event) {
let url = vm.tbCfItemComment.id == null ? "../tbcfitemcomment/save" : "../tbcfitemcomment/update";
console.log("this.uploadList", this.uploadList)
vm.tbCfItemComment.urls = this.uploadList.map(res => res).join(';');
Ajax.request({
url: url,
params: JSON.stringify(vm.tbCfItemComment),
......@@ -104,6 +211,7 @@ let vm = new Vue({
async: true,
successCallback: function (r) {
vm.tbCfItemComment = r.tbCfItemComment;
vm.uploadList = vm.tbCfItemComment.urls.split(";");
}
});
},
......@@ -111,14 +219,26 @@ let vm = new Vue({
vm.showList = true;
let page = $("#jqGrid").jqGrid('getGridParam', 'page');
$("#jqGrid").jqGrid('setGridParam', {
postData: {'name': vm.q.name},
postData: {
'name': vm.q.name,
'real': vm.q.real,
'startTime': vm.q.startTime,
'endTime': vm.q.endTime,
'orderNo': vm.q.orderNo,
'itemName': vm.q.itemName
},
page: page
}).trigger("reloadGrid");
vm.handleReset('formValidate');
},
reloadSearch: function () {
vm.q = {
name: ''
name: '',
real: '',
startTime: '',
endTime: '',
orderNo: '',
itemName: ''
};
vm.reload();
},
......@@ -130,5 +250,7 @@ let vm = new Vue({
handleReset: function (name) {
handleResetForm(this, name);
}
}, created() {
vm.tbCfItemComment.type = vm.commentList[0].value;
}
});
\ No newline at end of file
});
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论