This commit is contained in:
tangzh 2025-03-11 15:25:23 +08:00
parent c314ee2423
commit b4e573a66a
34 changed files with 648 additions and 140 deletions

View File

@ -0,0 +1,41 @@
package com.zbkj.common.model.product;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("eb_review_tag")
public class ReviewTag implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Integer id;
/**
* 标签名
*/
private String name;
/**
* 状态, 1正常0失效
*/
private Integer status;
/**
* 排序
*/
private Integer sort;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}

View File

@ -0,0 +1,41 @@
package com.zbkj.common.model.product;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("eb_review_tag_category")
public class ReviewTagCategory implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Integer id;
/**
* 标签id
*/
private Integer reviewTagId;
/**
* 产品分类
*/
private Integer cid;
/**
* 状态, 1正常0失效
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}

View File

@ -0,0 +1,42 @@
package com.zbkj.common.model.product;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
@Data
@TableName("eb_store_product_problem")
public class StoreProductProblem implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
@TableId
private Integer id;
/**
* 商品id
*/
private Integer productId;
/**
* 问题
*/
private String problem;
/**
* 答案
*/
private String answer;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}

View File

@ -0,0 +1,36 @@
package com.zbkj.common.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="GetReplyListRequest对象", description="GetReplyListRequest对象")
public class GetReplyListRequest implements Serializable {
private static final long serialVersionUID = 3481659942630712958L;
@ApiModelProperty(value = "产品id", required = true)
@NotNull(message = "产品id不能为空")
private Integer productId;
@ApiModelProperty(value = "评价等级|0=全部,1=好评,2=中评,3=差评")
private Integer type;
@ApiModelProperty(value = "评论标签名称")
private String tag;
@ApiModelProperty(value = "查最新传1")
private String latest;
@ApiModelProperty(value = "有图片传1")
private String havePics;
}

View File

@ -61,4 +61,8 @@ public class StoreProductReplyAddRequest implements Serializable {
@ApiModelProperty(value = "商品规格属性值,多规格时用英文逗号拼接")
private String sku;
@ApiModelProperty(value = "商品评论标签,多个,号隔开")
private String reviewTags;
}

View File

@ -2,13 +2,13 @@ package com.zbkj.common.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 评价商品页响应对象
@ -40,4 +40,7 @@ public class OrderProductReplyResponse implements Serializable {
@ApiModelProperty(value = "规格sku")
private String sku;
@ApiModelProperty(value = "评论标签")
private List<String> reviewTags;
}

View File

@ -0,0 +1,56 @@
package com.zbkj.common.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="OrderReplyListResponse对象", description="OrderReplyListResponse对象")
public class OrderReplyListResponse implements Serializable {
private static final long serialVersionUID = 1387727608277207652L;
@ApiModelProperty(value = "订单id")
private Integer id;
@ApiModelProperty(value = "订单编号")
private String orderId;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "商品名称")
private String productName;
@ApiModelProperty(value = "商品id")
private Integer productId;
@ApiModelProperty(value = "商品attrid")
private String uni;
@ApiModelProperty(value = "商品图片")
private String image;
@ApiModelProperty(value = "评论图片")
private String pics;
@ApiModelProperty(value = "评论内容")
private String comment;
@ApiModelProperty(value = "商品分")
private Integer productScore;
@ApiModelProperty(value = "服务分")
private Integer serviceScore;
@ApiModelProperty(value = "分等级1好评2中评3差评")
private Integer scoreGrade;
}

View File

@ -26,6 +26,13 @@ public class ProductDetailReplyResponse implements Serializable {
@ApiModelProperty(value = "好评率")
private String replyChance;
@ApiModelProperty(value = "最后一条评论信息")
@ApiModelProperty(value = "一条评论信息")
private ProductReplyResponse productReply;
@ApiModelProperty(value = "问题数量")
private Integer problemNum;
@ApiModelProperty(value = "一条常见问题")
private ProductProblemResponse productProblem;
}

View File

@ -0,0 +1,25 @@
package com.zbkj.common.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="ProductProblemResponse对象", description="ProductProblemResponse对象")
public class ProductProblemResponse {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "问题")
private String problem;
@ApiModelProperty(value = "答案")
private String answer;
}

View File

@ -25,31 +25,40 @@ public class StoreProductReplayCountResponse implements Serializable {
public StoreProductReplayCountResponse() {}
public StoreProductReplayCountResponse(Long sumCount, Long goodCount, Long inCount, Long poorCount, String replyChance, Integer replyStar, List<ReplyReviewTagsVo> reviewTags) {
this.sumCount = sumCount;
this.goodCount = goodCount;
this.inCount = inCount;
this.poorCount = poorCount;
this.replyChance = replyChance;
this.replyStar = replyStar;
// this.goodCount = goodCount;
// this.inCount = inCount;
// this.poorCount = poorCount;
// this.replyChance = replyChance;
// this.replyStar = replyStar;
this.reviewTags = reviewTags;
}
public StoreProductReplayCountResponse(Long sumCount, Long picsCount, List<ReplyReviewTagsVo> reviewTags) {
this.sumCount = sumCount;
this.picsCount = picsCount;
this.reviewTags = reviewTags;
}
@ApiModelProperty(value = "评论总数")
private Long sumCount;
@ApiModelProperty(value = "好评总数")
private Long goodCount;
// @ApiModelProperty(value = "好评总数")
// private Long goodCount;
//
// @ApiModelProperty(value = "中评总数")
// private Long inCount;
//
// @ApiModelProperty(value = "差评总数")
// private Long poorCount;
//
// @ApiModelProperty(value = "好评率")
// private String replyChance;
//
// @ApiModelProperty(value = "评分星数")
// private Integer replyStar;
@ApiModelProperty(value = "中评总数")
private Long inCount;
@ApiModelProperty(value = "差评总数")
private Long poorCount;
@ApiModelProperty(value = "好评率")
private String replyChance;
@ApiModelProperty(value = "评分星数")
private Integer replyStar;
@ApiModelProperty(value = "有图片评论数")
private Long picsCount;
@ApiModelProperty(value = "评论标签")
private List<ReplyReviewTagsVo> reviewTags;

View File

@ -2,6 +2,7 @@ package com.zbkj.front.controller;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.GetReplyListRequest;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.ProductListRequest;
import com.zbkj.common.request.ProductRequest;
@ -84,16 +85,9 @@ public class ProductController {
* 商品评论列表
*/
@ApiOperation(value = "商品评论列表")
@RequestMapping(value = "/reply/list/{id}", method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "评价等级|0=全部,1=好评,2=中评,3=差评", allowableValues = "range[0,1,2,3]"),
@ApiImplicitParam(name = "tag", value = "评价标签")
})
public CommonResult<CommonPage<ProductReplyResponse>> getReplyList(@PathVariable Integer id,
@RequestParam(value = "type") Integer type,
@RequestParam(value = "tag") String tag,
@Validated PageParamRequest pageParamRequest) {
return CommonResult.success(CommonPage.restPage(productService.getReplyList(id, type, tag, pageParamRequest)));
@RequestMapping(value = "/reply/list", method = RequestMethod.GET)
public CommonResult<CommonPage<ProductReplyResponse>> getReplyList(@Validated GetReplyListRequest request, @Validated PageParamRequest pageParamRequest) {
return CommonResult.success(CommonPage.restPage(productService.getReplyList(request, pageParamRequest)));
}
/**

View File

@ -102,7 +102,7 @@ public class StoreOrderController {
@ApiOperation(value = "订单列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiImplicitParams ({
@ApiImplicitParam(name = "type", value = "评价等级|null=全部,0=未支付,1=待发货/备货中,2=待收货,3=待评价,4=已完成,-3=售后/退款", required = false),
@ApiImplicitParam(name = "type", value = "评价等级|null=全部,0=未支付,1=待发货/备货中,2=待收货,3=待评价,4=已完成,-3=售后/退款"),
})
public CommonResult<CommonPage<OrderDetailResponse>> orderList(@RequestParam(name = "type") Integer type, @ModelAttribute PageParamRequest pageRequest) {
return CommonResult.success(orderService.list(type, pageRequest));
@ -144,20 +144,6 @@ public class StoreOrderController {
}
}
/**
* 订单评价
* @param request StoreProductReplyAddRequest 评论参数
*/
@ApiOperation(value = "评价订单")
@RequestMapping(value = "/comment", method = RequestMethod.POST)
public CommonResult<Boolean> comment(@RequestBody @Validated StoreProductReplyAddRequest request) {
if(orderService.reply(request)) {
return CommonResult.success();
}else{
return CommonResult.failed();
}
}
/**
* 订单收货
* @param id Integer 订单id
@ -220,6 +206,46 @@ public class StoreOrderController {
return CommonResult.success(orderService.getRefundReason());
}
/**
* 订单评价
* @param request StoreProductReplyAddRequest 评论参数
*/
@ApiOperation(value = "评价订单")
@RequestMapping(value = "/comment", method = RequestMethod.POST)
public CommonResult<Boolean> comment(@RequestBody @Validated StoreProductReplyAddRequest request) {
if(orderService.reply(request)) {
return CommonResult.success();
}else{
return CommonResult.failed();
}
}
/**
* 评论中心-列表
* @param type 类型
* @param pageRequest 分页
* @return 订单列表
*/
@ApiOperation(value = "评论中心-列表")
@RequestMapping(value = "/orderReply/list", method = RequestMethod.GET)
@ApiImplicitParams ({
@ApiImplicitParam(name = "type", value = "类型|0=待评论,1已评论", defaultValue = "0"),
})
public CommonResult<CommonPage<OrderReplyListResponse>> orderReplyList(@RequestParam(name = "type") Integer type, @ModelAttribute PageParamRequest pageRequest) {
return CommonResult.success(orderService.orderReplyList(type, pageRequest));
}
/**
* 待评价商品信息查询
* @param request
* @return
*/
@ApiOperation(value = "待评价商品信息查询")
@RequestMapping(value = "/product", method = RequestMethod.POST)
public CommonResult<OrderProductReplyResponse> getOrderProductForReply(@Validated @RequestBody GetProductReply request) {
return CommonResult.success(orderService.getReplyProduct(request));
}
/**
* 根据订单号查询物流信息
* @param orderId 订单号
@ -231,12 +257,6 @@ public class StoreOrderController {
return CommonResult.success(orderService.expressOrder(orderId));
}
@ApiOperation(value = "待评价商品信息查询")
@RequestMapping(value = "/product", method = RequestMethod.POST)
public CommonResult<OrderProductReplyResponse> getOrderProductForReply(@Validated @RequestBody GetProductReply request) {
return CommonResult.success(orderService.getReplyProduct(request));
}
/**
* 获取支付配置
*/

View File

@ -2,6 +2,7 @@ package com.zbkj.front.service;
import com.zbkj.common.model.product.StoreProduct;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.GetReplyListRequest;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.ProductListRequest;
import com.zbkj.common.request.ProductRequest;
@ -48,13 +49,11 @@ public interface ProductService {
/**
* 商品评论列表
* @param proId 商品编号
* @param type 评价等级|0=全部,1=好评,2=中评,3=差评
* @param tag 评价标签名称
* @param request 查询条件
* @param pageParamRequest 分页参数
* @return PageInfo<ProductReplyResponse>
*/
PageInfo<ProductReplyResponse> getReplyList(Integer proId, Integer type, String tag, PageParamRequest pageParamRequest);
PageInfo<ProductReplyResponse> getReplyList(GetReplyListRequest request, PageParamRequest pageParamRequest);
/**
* 商品评论数量

View File

@ -20,6 +20,7 @@ import com.zbkj.common.model.record.UserVisitRecord;
import com.zbkj.common.model.system.SystemUserLevel;
import com.zbkj.common.model.user.User;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.GetReplyListRequest;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.ProductListRequest;
import com.zbkj.common.request.ProductRequest;
@ -242,14 +243,13 @@ public class ProductServiceImpl implements ProductService {
/**
* 商品评论列表
* @param proId 商品编号
* @param type 评价等级|0=全部,1=好评,2=中评,3=差评
* @param request 查询条件
* @param pageParamRequest 分页参数
* @return PageInfo<ProductReplyResponse>
*/
@Override
public PageInfo<ProductReplyResponse> getReplyList(Integer proId, Integer type, String tag, PageParamRequest pageParamRequest) {
return storeProductReplyService.getH5List(proId, type, tag, pageParamRequest);
public PageInfo<ProductReplyResponse> getReplyList(GetReplyListRequest request, PageParamRequest pageParamRequest) {
return storeProductReplyService.getH5List(request, pageParamRequest);
}
/**
@ -260,13 +260,14 @@ public class ProductServiceImpl implements ProductService {
public StoreProductReplayCountResponse getReplyCount(Integer id) {
MyRecord myRecord = storeProductReplyService.getH5Count(id);
Long sumCount = myRecord.getLong("sumCount");
Long goodCount = myRecord.getLong("goodCount");
Long inCount = myRecord.getLong("mediumCount");
Long poorCount = myRecord.getLong("poorCount");
String replyChance = myRecord.getStr("replyChance");
Integer replyStar = myRecord.getInt("replyStar");
Long picsCount = myRecord.getLong("picsCount");
// Long goodCount = myRecord.getLong("goodCount");
// Long inCount = myRecord.getLong("mediumCount");
// Long poorCount = myRecord.getLong("poorCount");
// String replyChance = myRecord.getStr("replyChance");
// Integer replyStar = myRecord.getInt("replyStar");
List<ReplyReviewTagsVo> tags = myRecord.get("tags");
return new StoreProductReplayCountResponse(sumCount, goodCount, inCount, poorCount, replyChance, replyStar, tags);
return new StoreProductReplayCountResponse(sumCount, picsCount, tags);
}
/**

View File

@ -0,0 +1,8 @@
package com.zbkj.service.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbkj.common.model.product.ReviewTagCategory;
public interface ReviewTagCategoryDao extends BaseMapper<ReviewTagCategory> {
}

View File

@ -0,0 +1,12 @@
package com.zbkj.service.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbkj.common.model.product.ReviewTag;
import java.util.List;
public interface ReviewTagDao extends BaseMapper<ReviewTag> {
List<String> getReviewTagsByProductId(Integer productId);
}

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbkj.common.request.StoreDateRangeSqlPram;
import com.zbkj.common.request.StoreOrderStaticsticsRequest;
import com.zbkj.common.response.OrderBrokerageData;
import com.zbkj.common.response.OrderReplyListResponse;
import com.zbkj.common.response.StoreOrderStatisticsChartItemResponse;
import com.zbkj.common.response.StoreStaffDetail;
import org.apache.ibatis.annotations.Param;
@ -60,4 +61,12 @@ public interface StoreOrderDao extends BaseMapper<StoreOrder> {
* @param spreadId 推广人uid
*/
OrderBrokerageData getBrokerageData(@Param("uid") Integer uid, @Param("spreadId") Integer spreadId);
/**
* 评论列表
* @param uid 用户uid
* @param type 0=待评论,1已评论
* @return
*/
List<OrderReplyListResponse> selectOrderReplyList(@Param("uid") Integer uid, @Param("type") Integer type);
}

View File

@ -0,0 +1,8 @@
package com.zbkj.service.dao;
import com.zbkj.common.model.product.StoreProductProblem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface StoreProductProblemDao extends BaseMapper<StoreProductProblem> {
}

View File

@ -1,12 +1,9 @@
package com.zbkj.service.service;
import com.zbkj.common.model.user.User;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.*;
import com.zbkj.common.response.*;
import com.zbkj.common.vo.MyRecord;
import com.zbkj.common.vo.OrderInfoDetailVo;
import org.springframework.scheduling.annotation.Async;
import java.util.List;
@ -24,6 +21,14 @@ public interface OrderService {
*/
CommonPage<OrderDetailResponse> list(Integer type, PageParamRequest pageRequest);
/**
* 评论列表
* @param type
* @param pageRequest
* @return
*/
CommonPage<OrderReplyListResponse> orderReplyList(Integer type, PageParamRequest pageRequest);
/**
* 订单详情
* @param orderId 订单id

View File

@ -0,0 +1,9 @@
package com.zbkj.service.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zbkj.common.model.product.ReviewTagCategory;
public interface ReviewTagCategoryService extends IService<ReviewTagCategory> {
}

View File

@ -0,0 +1,14 @@
package com.zbkj.service.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zbkj.common.model.product.ReviewTag;
import java.util.List;
public interface ReviewTagService extends IService<ReviewTag> {
List<String> getReviewTagsByProductId(Integer productId);
}

View File

@ -370,4 +370,12 @@ public interface StoreOrderService extends IService<StoreOrder> {
* @param spreadId 推广人uid
*/
OrderBrokerageData getBrokerageData(Integer uid, Integer spreadId);
/**
* 评论列表
* @param userId
* @param type
* @return
*/
List<OrderReplyListResponse> selectOrderReplyList(Integer userId, Integer type);
}

View File

@ -0,0 +1,9 @@
package com.zbkj.service.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zbkj.common.model.product.StoreProductProblem;
public interface StoreProductProblemService extends IService<StoreProductProblem> {
}

View File

@ -1,14 +1,11 @@
package com.zbkj.service.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zbkj.common.request.StoreProductReplyAddRequest;
import com.zbkj.common.request.StoreProductReplyCommentRequest;
import com.zbkj.common.request.StoreProductReplySearchRequest;
import com.zbkj.common.request.*;
import com.zbkj.common.response.ProductDetailReplyResponse;
import com.zbkj.common.response.ProductReplyResponse;
import com.zbkj.common.response.StoreProductReplyResponse;
import com.zbkj.common.vo.MyRecord;
import com.zbkj.common.request.PageParamRequest;
import com.github.pagehelper.PageInfo;
import com.zbkj.common.model.product.StoreProductReply;
@ -64,12 +61,11 @@ public interface StoreProductReplyService extends IService<StoreProductReply> {
/**
* 移动端商品评论列表
* @param proId 商品编号
* @param type 评价等级|0=全部,1=好评,2=中评,3=差评
* @param request 查询条件
* @param pageParamRequest 分页参数
* @return PageInfo<ProductReplyResponse>
*/
PageInfo<ProductReplyResponse> getH5List(Integer proId, Integer type, String tag, PageParamRequest pageParamRequest);
PageInfo<ProductReplyResponse> getH5List(GetReplyListRequest request, PageParamRequest pageParamRequest);
/**
* 删除评论

View File

@ -1,7 +1,5 @@
package com.zbkj.service.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.zbkj.common.constants.Constants;
import com.zbkj.common.model.home.Home;

View File

@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.zbkj.common.constants.*;
import com.zbkj.common.exception.CrmebException;
import com.zbkj.common.model.bargain.StoreBargain;
@ -111,6 +112,7 @@ public class OrderServiceImpl implements OrderService {
@Autowired
private StoreSeckillService storeSeckillService;
private StoreCombinationService storeCombinationService;
@Autowired
@ -169,6 +171,9 @@ public class OrderServiceImpl implements OrderService {
@Autowired
private SmsTemplateService smsTemplateService;
@Autowired
private ReviewTagService reviewTagService;
/**
* 发送后台管理员下单提醒通知短信
* @param orderNo 订单编号
@ -431,6 +436,29 @@ public class OrderServiceImpl implements OrderService {
return detailPage;
}
@Override
public CommonPage<OrderReplyListResponse> orderReplyList(Integer type, PageParamRequest page) {
Integer userId = userService.getUserIdException();
PageHelper.startPage(page.getPage(), page.getLimit());
List<OrderReplyListResponse> list = storeOrderService.selectOrderReplyList(userId, type);
for (OrderReplyListResponse res : list) {
if (type == 1) {
Integer productScore = res.getProductScore();
Integer serviceScore = res.getServiceScore();
int scoreGrade = 0;
if (productScore + serviceScore >= 8) {
scoreGrade = 1;
} else if ((productScore + serviceScore) < 8 && (productScore + serviceScore) > 4) {
scoreGrade = 2;
} else {
scoreGrade = 3;
}
res.setScoreGrade(scoreGrade);
}
}
return CommonPage.restPage(list);
}
/**
* 获取订单活动类型
* @param storeOrder 订单都西昂
@ -760,6 +788,8 @@ public class OrderServiceImpl implements OrderService {
response.setImage(scr.getImage());
response.setSku(scr.getSku());
response.setStoreName(scr.getProductName());
List<String> reviewTags = reviewTagService.getReviewTagsByProductId(scr.getProductId());
response.setReviewTags(reviewTags);
return response;
}

View File

@ -0,0 +1,12 @@
package com.zbkj.service.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.common.model.product.ReviewTagCategory;
import com.zbkj.service.dao.ReviewTagCategoryDao;
import com.zbkj.service.service.ReviewTagCategoryService;
import org.springframework.stereotype.Service;
@Service
public class ReviewTagCategoryServiceImpl extends ServiceImpl<ReviewTagCategoryDao, ReviewTagCategory> implements ReviewTagCategoryService {
}

View File

@ -0,0 +1,21 @@
package com.zbkj.service.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.common.model.product.ReviewTag;
import com.zbkj.service.dao.ReviewTagDao;
import com.zbkj.service.service.ReviewTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ReviewTagServiceImpl extends ServiceImpl<ReviewTagDao, ReviewTag> implements ReviewTagService {
@Autowired ReviewTagDao dao;
@Override
public List<String> getReviewTagsByProductId(Integer productId) {
return dao.getReviewTagsByProductId(productId);
}
}

View File

@ -1415,6 +1415,11 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
return dao.getBrokerageData(uid, spreadId);
}
@Override
public List<OrderReplyListResponse> selectOrderReplyList(Integer userId, Integer type) {
return dao.selectOrderReplyList(userId, type);
}
///////////////////////////////////////////////////////////////////////////////////////////////////// 以下为自定义方法
/**

View File

@ -0,0 +1,12 @@
package com.zbkj.service.service.impl;
import com.zbkj.common.model.product.StoreProductProblem;
import com.zbkj.service.dao.StoreProductProblemDao;
import com.zbkj.service.service.StoreProductProblemService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class StoreProductProblemServiceImpl extends ServiceImpl<StoreProductProblemDao, StoreProductProblem> implements StoreProductProblemService {
}

View File

@ -14,14 +14,13 @@ import com.zbkj.common.constants.Constants;
import com.zbkj.common.exception.CrmebException;
import com.zbkj.common.model.order.StoreOrder;
import com.zbkj.common.model.product.StoreProduct;
import com.zbkj.common.model.product.StoreProductProblem;
import com.zbkj.common.model.product.StoreProductReply;
import com.zbkj.common.model.user.User;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.StoreProductReplyAddRequest;
import com.zbkj.common.request.StoreProductReplyCommentRequest;
import com.zbkj.common.request.StoreProductReplySearchRequest;
import com.zbkj.common.request.*;
import com.zbkj.common.response.ProductDetailReplyResponse;
import com.zbkj.common.response.ProductProblemResponse;
import com.zbkj.common.response.ProductReplyResponse;
import com.zbkj.common.response.StoreProductReplyResponse;
import com.zbkj.common.utils.CrmebUtil;
@ -33,6 +32,7 @@ import com.zbkj.common.vo.StoreOrderInfoOldVo;
import com.zbkj.common.vo.dateLimitUtilVo;
import com.zbkj.service.dao.StoreProductReplyDao;
import com.zbkj.service.service.*;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
@ -78,6 +78,8 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
@Autowired
private TransactionTemplate transactionTemplate;
@Autowired
private StoreProductProblemService storeProductProblemService;
/**
* 列表
@ -227,31 +229,33 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
public MyRecord getH5Count(Integer productId) {
// 评论总数
Integer sumCount = getCountByScore(productId, "all");
// 好评总数
Integer goodCount = getCountByScore(productId, "good");
// 中评总数
Integer mediumCount = getCountByScore(productId, "medium");
// 差评总数
Integer poorCount = getCountByScore(productId, "poor");
// 好评率
String replyChance = "0";
if (sumCount > 0 && goodCount > 0) {
replyChance = String.format("%.2f", ((goodCount.doubleValue() / sumCount.doubleValue())));
}
// 评分星数(商品评星 + 服务评星)/2
Integer replyStar = 0;
if (sumCount > 0) {
replyStar = getSumStar(productId);
}
List<ReplyReviewTagsVo> tags = dao.getReviewTags(productId);
// 评论图片数
Integer picsCount = getCountByScore(productId, null, "havePics");
// // 好评总数
// Integer goodCount = getCountByScore(productId, "good");
// // 中评总数
// Integer mediumCount = getCountByScore(productId, "medium");
// // 差评总数
// Integer poorCount = getCountByScore(productId, "poor");
// // 好评率
// String replyChance = "0";
// if (sumCount > 0 && goodCount > 0) {
// replyChance = String.format("%.2f", ((goodCount.doubleValue() / sumCount.doubleValue())));
// }
// // 评分星数(商品评星 + 服务评星)/2
// Integer replyStar = 0;
// if (sumCount > 0) {
// replyStar = getSumStar(productId);
// }
MyRecord record = new MyRecord();
record.set("sumCount", sumCount);
record.set("goodCount", goodCount);
record.set("mediumCount", mediumCount);
record.set("poorCount", poorCount);
record.set("replyChance", replyChance);
record.set("replyStar", replyStar);
record.set("tags", tags);
record.set("picsCount", picsCount);
// record.set("goodCount", goodCount);
// record.set("mediumCount", mediumCount);
// record.set("poorCount", poorCount);
// record.set("replyChance", replyChance);
// record.set("replyStar", replyStar);
record.set("tags", dao.getReviewTags(productId));
return record;
}
@ -310,25 +314,39 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
response.setSumCount(sumCount);
response.setReplyChance(replyChance);
response.setProductReply(productReplyResponse);
// 查询一条问题
LambdaQueryWrapper<StoreProductProblem> lqwSpp = new LambdaQueryWrapper<>();
lqwSpp.eq(StoreProductProblem::getProductId, proId);
int problemNum = storeProductProblemService.count(lqwSpp);
lqw.last(" limit 1");
StoreProductProblem one = storeProductProblemService.getOne(lqwSpp);
ProductProblemResponse sppRes = new ProductProblemResponse();
BeanUtils.copyProperties(one, sppRes);
response.setProblemNum(problemNum);
response.setProductProblem(sppRes);
return response;
}
/**
* 移动端商品评论列表
* @param proId 商品编号
* @param type 评价等级|0=全部,1=好评,2=中评,3=差评
* @param tag 评价标签名称
* @param request 查询条件
* @param pageParamRequest 分页参数
* @return PageInfo<ProductReplyResponse>
*/
@Override
public PageInfo<ProductReplyResponse> getH5List(Integer proId, Integer type, String tag, PageParamRequest pageParamRequest) {
public PageInfo<ProductReplyResponse> getH5List(GetReplyListRequest request, PageParamRequest pageParamRequest) {
Page<StoreProductReply> startPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
Integer productId = request.getProductId();
Integer type = request.getType();
String tag = request.getTag();
String latest = request.getLatest();
String havePics = request.getHavePics();
// StoreProductReply 类的多条件查询
LambdaQueryWrapper<StoreProductReply> lqw = new LambdaQueryWrapper<>();
lqw.eq(StoreProductReply::getIsDel, false);
lqw.eq(StoreProductReply::getProductId, proId);
lqw.eq(StoreProductReply::getProductId, productId);
if (null != type) {
//评价等级|0=全部,1=好评,2=中评,3=差评
switch (type) {
case 1:
@ -342,12 +360,18 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
break;
default:
break;
}
}
if (StringUtils.isNotBlank(tag)) {
lqw.like(StoreProductReply::getReviewTags, tag);
}
lqw.orderByDesc(StoreProductReply::getId);
if (StringUtils.isNotBlank(havePics)) {
lqw.isNotNull(StoreProductReply::getPics);
}
if (StringUtils.isNotBlank(latest)) {
lqw.orderByDesc(StoreProductReply::getCreateTime);
}
// lqw.orderByDesc(StoreProductReply::getId);
List<StoreProductReply> replyList = dao.selectList(lqw);
List<ProductReplyResponse> responseList = new ArrayList<>();
for (StoreProductReply productReply : replyList) {
@ -404,28 +428,36 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
return update(lup);
}
// 获取统计数据好评中评差评
private Integer getCountByScore(Integer productId, String type) {
// 获取统计数据好评中评差评/ 有评论图片的数量
private Integer getCountByScore(Integer productId, String type, String havePics) {
LambdaQueryWrapper<StoreProductReply> lqw = new LambdaQueryWrapper<>();
lqw.eq(StoreProductReply::getProductId, productId);
lqw.eq(StoreProductReply::getIsDel, false);
if (null != type) {
switch (type) {
case "all":
break;
case "good":
lqw.apply( " (product_score + service_score) >= 8");
lqw.apply(" (product_score + service_score) >= 8");
break;
case "medium":
lqw.apply( " (product_score + service_score) < 8 and (product_score + service_score) > 4");
lqw.apply(" (product_score + service_score) < 8 and (product_score + service_score) > 4");
break;
case "poor":
lqw.apply( " (product_score + service_score) <= 4");
lqw.apply(" (product_score + service_score) <= 4");
break;
}
}
if (StringUtils.isNotEmpty(havePics)) {
lqw.isNotNull(StoreProductReply::getPics);
}
return dao.selectCount(lqw);
}
private Integer getCountByScore(Integer productId, String type) {
return getCountByScore(productId, type, null);
}
/**
* 如果所有的都已评价那么订单完成
* @author Mr.Zhang

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zbkj.service.dao.ReviewTagCategoryDao">
</mapper>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zbkj.service.dao.ReviewTagDao">
<select id="getReviewTagsByProductId" resultType="java.lang.String">
select t.`name` from eb_review_tag t
inner join eb_review_tag_category tc on t.id = tc.review_tag_id
inner join (
select
substring_index(SUBSTRING_INDEX(r.cate_id, ',', b.help_topic_id + 1), ',', -1) cid
from eb_store_product r
JOIN help_topic b ON b.help_topic_id <![CDATA[<]]> (length(r.cate_id) - length(replace(r.cate_id,',','')) + 1)
where r.id = #{id}
) t on tc.cid = t.cid
where t.status = 1 and tc.status = 1
</select>
</mapper>

View File

@ -2,6 +2,23 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zbkj.service.dao.StoreOrderDao">
<select id="selectOrderReplyList" resultType="com.zbkj.common.response.OrderReplyListResponse">
SELECT
o.id, o.order_id orderId, o.create_time createTime,
oi.product_id productId,
oi.product_name productName,
oi.unique uni, oi.image,
r.pics, r.comment,
r.product_score productScore,
r.service_score serviceScore
FROM eb_store_order o
INNER JOIN eb_store_order_info oi ON o.id = oi.order_id
LEFT JOIN eb_store_product_reply r ON o.id = r.oid AND oi.product_id = r.product_id
where o.`status` in (2, 3) and o.uid = #{uid}
<if test="type == 0"> and r.id is null </if>
<if test="type == 1"> and r.id is not null </if>
</select>
<select id="getTotalPrice" resultType="java.math.BigDecimal">
select sum(pay_price) from eb_store_order where ${where} and refund_status = 0
</select>