xiaoyong931011
2022-06-23 7804b65c502ac9b2bb93f6f64dff53e2a1322f79
20220528
11 files added
16 files modified
637 ■■■■■ changed files
src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java 27 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/ApiMallGoodsController.java 11 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/ApiMallOrderController.java 9 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/ViewMallOrderController.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/conversion/MallGoodsCommentConversion.java 15 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/AdminMallGoodsCommentDto.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/ApiAddCommentDto.java 29 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/ApiAddCommentDtos.java 19 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/ApiMallGoodsCommentDto.java 20 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/MallGoodsComment.java 47 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/MallOrderInfo.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/mapper/MallGoodsCommentMapper.java 15 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/mapper/MallGoodsMapper.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/IAdminMallOrderService.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/IApiMallGoodsService.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/IApiMallOrderInfoService.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallOrderService.java 31 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallGoodsServiceImpl.java 20 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java 42 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/AdminMallGoodsCommentVo.java 49 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/MallGoodsCommentVo.java 35 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/MallGoodsDetailsVo.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/OrderDetailVo.java 3 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/MallGoodsCommentMapper.xml 25 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/MallGoodsMapper.xml 19 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/MallOrderInfoMapper.xml 1 ●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/order/commentList.html 168 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java
@@ -360,4 +360,31 @@
        return new FebsResponse().success();
    }
    /**
     * 评论列表
     */
    @GetMapping("commentList")
    public FebsResponse getCommentList(AdminMallGoodsCommentDto adminMallGoodsCommentDto, QueryRequest request) {
        Map<String, Object> data = getDataTable(adminMallOrderService.getCommentListInPage(adminMallGoodsCommentDto, request));
        return new FebsResponse().success().data(data);
    }
    /**
     * 评论列表-显示评论
     */
    @GetMapping("showStateSwitchOn/{id}")
    @ControllerEndpoint(operation = "评论列表-显示评论", exceptionMessage = "设置失败")
    public FebsResponse showStateSwitchOn(@NotNull(message = "{required}") @PathVariable Long id) {
        return adminMallOrderService.showStateSwitchOn(id);
    }
    /**
     * 评论列表-不显示评论
     */
    @GetMapping("showStateSwitchOff/{id}")
    @ControllerEndpoint(operation = "评论列表-显示评论", exceptionMessage = "设置失败")
    public FebsResponse showStateSwitchOff(@NotNull(message = "{required}") @PathVariable Long id) {
        return adminMallOrderService.showStateSwitchOff(id);
    }
}
src/main/java/cc/mrbird/febs/mall/controller/ApiMallGoodsController.java
@@ -1,8 +1,10 @@
package cc.mrbird.febs.mall.controller;
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.mall.dto.ApiMallGoodsCommentDto;
import cc.mrbird.febs.mall.dto.MallGoodsQueryDto;
import cc.mrbird.febs.mall.service.IApiMallGoodsService;
import cc.mrbird.febs.mall.vo.MallGoodsCommentVo;
import cc.mrbird.febs.mall.vo.MallGoodsDetailsVo;
import cc.mrbird.febs.mall.vo.MallGoodsListVo;
import io.swagger.annotations.Api;
@@ -45,4 +47,13 @@
        return new FebsResponse().success().data(mallGoodsService.findMallGoodsDetailsById(id));
    }
    @ApiOperation(value = "获取商品评价", notes = "获取商品评价")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = MallGoodsCommentVo.class)
    })
    @PostMapping(value = "/commentByGoodsId")
    public FebsResponse commentByGoodsId(@RequestBody ApiMallGoodsCommentDto queryDto) {
        return new FebsResponse().success().data(mallGoodsService.findMallGoodsCommentByGoodsId(queryDto));
    }
}
src/main/java/cc/mrbird/febs/mall/controller/ApiMallOrderController.java
@@ -15,7 +15,6 @@
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@@ -103,4 +102,12 @@
        mallOrderInfoService.refundExpress(refundExpressDto);
        return new FebsResponse().success().message("提交成功");
    }
    @ApiOperation(value = "评价", notes = "评价")
    @PostMapping(value = "/goodsComment")
    public FebsResponse goodsComment(@RequestBody ApiAddCommentDtos addCommentDtos) {
        mallOrderInfoService.goodsComment(addCommentDtos);
        return new FebsResponse().success().message("评价成功");
    }
}
src/main/java/cc/mrbird/febs/mall/controller/ViewMallOrderController.java
@@ -39,6 +39,16 @@
    }
    /**
     * 评论列表
     * @return
     */
    @GetMapping("commentList")
    @RequiresPermissions("commentList:view")
    public String commentList() {
        return FebsUtil.view("modules/order/commentList");
    }
    /**
     * 订单-发货
     * @param id
     * @param model
src/main/java/cc/mrbird/febs/mall/conversion/MallGoodsCommentConversion.java
New file
@@ -0,0 +1,15 @@
package cc.mrbird.febs.mall.conversion;
import cc.mrbird.febs.mall.dto.ApiAddCommentDto;
import cc.mrbird.febs.mall.entity.MallGoodsComment;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public abstract class MallGoodsCommentConversion {
    public static final MallGoodsCommentConversion INSTANCE = Mappers.getMapper(MallGoodsCommentConversion.class);
    public abstract MallGoodsComment dtoToEntity(ApiAddCommentDto dto);
}
src/main/java/cc/mrbird/febs/mall/dto/AdminMallGoodsCommentDto.java
New file
@@ -0,0 +1,14 @@
package cc.mrbird.febs.mall.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel(value = "AdminMallGoodsCommentDto", description = "参数接收类")
public class AdminMallGoodsCommentDto {
    private String goodsName;
    private String name;
}
src/main/java/cc/mrbird/febs/mall/dto/ApiAddCommentDto.java
New file
@@ -0,0 +1,29 @@
package cc.mrbird.febs.mall.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "ApiMallActListDto", description = "参数接收类")
public class ApiAddCommentDto {
    @ApiModelProperty(value = "规格ID")
    private Long skuId;
    @ApiModelProperty(value = "商品ID")
    private Long goodsId;
    @ApiModelProperty(value = "评分  4.0")
    private Double star;
    @ApiModelProperty(value = "评论")
    private String comment;
    @ApiModelProperty(value = "图片")
    private String images;
    @ApiModelProperty(value = "是否匿名评价 1:匿名 2:不匿名")
    private Integer anonymousState;
}
src/main/java/cc/mrbird/febs/mall/dto/ApiAddCommentDtos.java
New file
@@ -0,0 +1,19 @@
package cc.mrbird.febs.mall.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "ApiAddCommentDtos", description = "参数接收类")
public class ApiAddCommentDtos {
    @ApiModelProperty(value = "订单ID")
    private Long orderId;
    @ApiModelProperty(value = "订单ID")
    private List<ApiAddCommentDto> apiAddCommentDtos;
}
src/main/java/cc/mrbird/febs/mall/dto/ApiMallGoodsCommentDto.java
New file
@@ -0,0 +1,20 @@
package cc.mrbird.febs.mall.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "ApiMallGoodsCommentDto", description = "商品评论接收类")
public class ApiMallGoodsCommentDto {
    @ApiModelProperty(value = "页码", example = "1")
    private Integer pageNow;
    @ApiModelProperty(value = "每页数量", example = "10")
    private Integer pageSize;
    @ApiModelProperty(value = "商品ID", example = "1")
    private Long goodsId;
}
src/main/java/cc/mrbird/febs/mall/entity/MallGoodsComment.java
New file
@@ -0,0 +1,47 @@
package cc.mrbird.febs.mall.entity;
import cc.mrbird.febs.common.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("mall_goods_comment")
public class MallGoodsComment extends BaseEntity {
    /**
     * 显示
     */
    public static final Integer SHOW_STATE_ENABLE = 1;
    /**
     * 隐藏
     */
    public static final Integer SHOW_STATE_DISABLED = 2;
    //会员ID
    private Long memberId;
    //商品ID
    private Long goodsId;
    //样式ID
    private Long styleId;
    //规格ID
    private Long skuId;
    //订单ID
    private Long orderId;
    //评分
    private Double star;
    //评论
    private String comment;
    //图片
    private String images;
    //展示状态 1:显示 2:隐藏
    private Integer showState;
    //匿名状态 1:匿名 2:不匿名
    private Integer anonymousState;
    //商品名称
    private String goodsName;
    //样式名称
    private String styleName;
    //规格名称
    private String skuName;
}
src/main/java/cc/mrbird/febs/mall/entity/MallOrderInfo.java
@@ -80,4 +80,14 @@
    private Integer orderType;
    private BigDecimal carriage;
    /**
     * ALTER TABLE `mall_order_info`
     * ADD COLUMN `comment_state`  int(11) NULL COMMENT '评价状态 1:待评价 2:已评价' AFTER `carriage`;
     */
    private Integer commentState;
    /**
     * 评价状态 1:待评价 2:已评价
     */
    public static final Integer COMMENT_STATE_NO = 1;
    public static final Integer COMMENT_STATE_YES = 2;
}
src/main/java/cc/mrbird/febs/mall/mapper/MallGoodsCommentMapper.java
New file
@@ -0,0 +1,15 @@
package cc.mrbird.febs.mall.mapper;
import cc.mrbird.febs.mall.dto.AdminMallGoodsCommentDto;
import cc.mrbird.febs.mall.entity.MallGoodsComment;
import cc.mrbird.febs.mall.vo.AdminMallGoodsCommentVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
public interface MallGoodsCommentMapper extends BaseMapper<MallGoodsComment> {
    IPage<AdminMallGoodsCommentVo> getCommentListInPage(Page<AdminMallGoodsCommentVo> page, @Param("record")AdminMallGoodsCommentDto adminMallGoodsCommentDto);
}
src/main/java/cc/mrbird/febs/mall/mapper/MallGoodsMapper.java
@@ -2,6 +2,7 @@
import cc.mrbird.febs.mall.dto.MallGoodsQueryDto;
import cc.mrbird.febs.mall.entity.MallGoods;
import cc.mrbird.febs.mall.entity.MallGoodsComment;
import cc.mrbird.febs.mall.vo.*;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -40,4 +41,6 @@
    List<AdminMallGoodsTreeVo> getAllGoodsTree();
    List<MallGoods> selectOrderGoodsList(@Param("memberId") Long memberId, @Param("date") Date date);
    IPage<MallGoodsCommentVo> selectMallGoodsCommentListQueryInPage(Page<MallGoodsCommentVo> page,  @Param("record")MallGoodsComment mallGoodsComment);
}
src/main/java/cc/mrbird/febs/mall/service/IAdminMallOrderService.java
@@ -60,4 +60,10 @@
    FebsResponse cancelOrder(Long id);
    AdminMallMemberPaymentVo getMallMemberRefundPayInfoByFlowId(long id);
    IPage<AdminMallGoodsCommentVo> getCommentListInPage(AdminMallGoodsCommentDto adminMallGoodsCommentDto, QueryRequest request);
    FebsResponse showStateSwitchOn(Long id);
    FebsResponse showStateSwitchOff(Long id);
}
src/main/java/cc/mrbird/febs/mall/service/IApiMallGoodsService.java
@@ -1,7 +1,9 @@
package cc.mrbird.febs.mall.service;
import cc.mrbird.febs.mall.dto.ApiMallGoodsCommentDto;
import cc.mrbird.febs.mall.dto.MallGoodsQueryDto;
import cc.mrbird.febs.mall.entity.MallGoods;
import cc.mrbird.febs.mall.vo.MallGoodsCommentVo;
import cc.mrbird.febs.mall.vo.MallGoodsDetailsVo;
import cc.mrbird.febs.mall.vo.MallGoodsListVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -13,4 +15,6 @@
    IPage<MallGoodsListVo> findMallGoodsListInPage(MallGoodsQueryDto queryDto);
    MallGoodsDetailsVo findMallGoodsDetailsById(@Param("id") Long id);
    IPage<MallGoodsCommentVo> findMallGoodsCommentByGoodsId(ApiMallGoodsCommentDto queryDto);
}
src/main/java/cc/mrbird/febs/mall/service/IApiMallOrderInfoService.java
@@ -30,4 +30,6 @@
    void refundExpress(RefundExpressDto refundExpressDto);
    void autoCancelOrder(Long id);
    void goodsComment(ApiAddCommentDtos addCommentDtos);
}
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallOrderService.java
@@ -43,6 +43,8 @@
    private final MallOrderRefundAddressMapper mallOrderRefundAddressMapper;
    private final MallGoodsCommentMapper mallGoodsCommentMapper;
    private final MallMoneyFlowMapper mallMoneyFlowMapper;
    private final IApiMallMemberWalletService iApiMallMemberWalletService;
@@ -363,6 +365,35 @@
    }
    @Override
    public IPage<AdminMallGoodsCommentVo> getCommentListInPage(AdminMallGoodsCommentDto adminMallGoodsCommentDto, QueryRequest request) {
        Page<AdminMallGoodsCommentVo> page = new Page<>(request.getPageNum(), request.getPageSize());
        IPage<AdminMallGoodsCommentVo> adminMallGoodsCommentVos = mallGoodsCommentMapper.getCommentListInPage(page, adminMallGoodsCommentDto);
        return adminMallGoodsCommentVos;
    }
    @Override
    public FebsResponse showStateSwitchOn(Long id) {
        MallGoodsComment mallGoodsComment = mallGoodsCommentMapper.selectById(id);
        if (ObjectUtil.isEmpty(mallGoodsComment)) {
            return new FebsResponse().fail().message("评论不存在,请刷新当前页面");
        }
        mallGoodsComment.setShowState(MallGoodsComment.SHOW_STATE_ENABLE);
        mallGoodsCommentMapper.updateById(mallGoodsComment);
        return new FebsResponse().success();
    }
    @Override
    public FebsResponse showStateSwitchOff(Long id) {
        MallGoodsComment mallGoodsComment = mallGoodsCommentMapper.selectById(id);
        if (ObjectUtil.isEmpty(mallGoodsComment)) {
            return new FebsResponse().fail().message("评论不存在,请刷新当前页面");
        }
        mallGoodsComment.setShowState(MallGoodsComment.SHOW_STATE_DISABLED);
        mallGoodsCommentMapper.updateById(mallGoodsComment);
        return new FebsResponse().success();
    }
    @Override
    public void deliverGoodsByOrderNo(DeliverGoodsDto deliverGoodsDto) {
        MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectByOrderNo(deliverGoodsDto.getOrderNo());
        if (mallOrderInfo == null) {
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallGoodsServiceImpl.java
@@ -3,14 +3,19 @@
import cc.mrbird.febs.common.exception.FebsException;
import cc.mrbird.febs.mall.conversion.MallGoodsConversion;
import cc.mrbird.febs.mall.conversion.MallMemberConversion;
import cc.mrbird.febs.mall.dto.ApiMallGoodsCommentDto;
import cc.mrbird.febs.mall.dto.MallGoodsQueryDto;
import cc.mrbird.febs.mall.entity.MallGoods;
import cc.mrbird.febs.mall.entity.MallGoodsComment;
import cc.mrbird.febs.mall.mapper.MallGoodsCommentMapper;
import cc.mrbird.febs.mall.mapper.MallGoodsImagesMapper;
import cc.mrbird.febs.mall.mapper.MallGoodsMapper;
import cc.mrbird.febs.mall.service.IApiMallGoodsService;
import cc.mrbird.febs.mall.vo.MallGoodsCommentVo;
import cc.mrbird.febs.mall.vo.MallGoodsDetailsVo;
import cc.mrbird.febs.mall.vo.MallGoodsListVo;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -32,6 +37,8 @@
public class ApiMallGoodsServiceImpl extends ServiceImpl<MallGoodsMapper, MallGoods> implements IApiMallGoodsService {
    private final MallGoodsImagesMapper goodsImagesMapper;
    private final MallGoodsCommentMapper mallGoodsCommentMapper;
    @Override
    public IPage<MallGoodsListVo> findMallGoodsListInPage(MallGoodsQueryDto queryDto) {
@@ -54,6 +61,19 @@
            mallGoodsDetailsVo.setVolume(stockAndVolume.get("volume").intValue());
        }
        mallGoodsDetailsVo.setImages(images);
        QueryWrapper<MallGoodsComment> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("goods_id",id);
        Integer commentCount = mallGoodsCommentMapper.selectCount(objectQueryWrapper);
        mallGoodsDetailsVo.setCommentCount(commentCount);
        return mallGoodsDetailsVo;
    }
    @Override
    public IPage<MallGoodsCommentVo> findMallGoodsCommentByGoodsId(ApiMallGoodsCommentDto queryDto) {
        Page<MallGoodsCommentVo> page = new Page<>(queryDto.getPageNow(), queryDto.getPageSize());
        MallGoodsComment mallGoodsComment = new MallGoodsComment();
        mallGoodsComment.setGoodsId(queryDto.getGoodsId());
        return this.baseMapper.selectMallGoodsCommentListQueryInPage(page,mallGoodsComment);
    }
}
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
@@ -6,6 +6,7 @@
import cc.mrbird.febs.common.utils.LoginUserUtil;
import cc.mrbird.febs.common.utils.MallUtils;
import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.mall.conversion.MallGoodsCommentConversion;
import cc.mrbird.febs.mall.conversion.MallOrderInfoConversion;
import cc.mrbird.febs.mall.conversion.MallOrderRefundConversion;
import cc.mrbird.febs.mall.dto.*;
@@ -31,7 +32,6 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@@ -48,6 +48,7 @@
    private final MallAddressInfoMapper mallAddressInfoMapper;
    private final MallOrderItemMapper mallOrderItemMapper;
    private final MallMemberMapper memberMapper;
    private final MallGoodsCommentMapper mallGoodsCommentMapper;
    private final IApiMallMemberWalletService memberWalletService;
    private final MallExpressInfoMapper expressInfoMapper;
    private final MallOrderRefundMapper mallOrderRefundMapper;
@@ -491,4 +492,43 @@
            this.baseMapper.updateById(orderInfo);
        }
    }
    @Override
    public void goodsComment(ApiAddCommentDtos addCommentDtos) {
        Long orderId = addCommentDtos.getOrderId();
        MallMember member = LoginUserUtil.getLoginUser();
        MallOrderInfo orderInfo = this.baseMapper.selectOrderDetailsById(orderId);
        if (orderInfo == null || AppContants.DEL_FLAG_Y == orderInfo.getDelFlag()) {
            throw new FebsException("订单不存在");
        }
        if (OrderStatusEnum.FINISH.getValue() != orderInfo.getStatus()) {
            throw new FebsException("该状态不能评价");
        }
        if (MallOrderInfo.COMMENT_STATE_YES == orderInfo.getCommentState()) {
            throw new FebsException("该状态不能评价");
        }
        orderInfo.setCommentState(MallOrderInfo.COMMENT_STATE_YES);
        this.baseMapper.updateById(orderInfo);
        List<ApiAddCommentDto> apiAddCommentDtos = addCommentDtos.getApiAddCommentDtos();
        if(CollUtil.isNotEmpty(apiAddCommentDtos)){
            for(ApiAddCommentDto apiAddCommentDto : apiAddCommentDtos){
                Long skuId = apiAddCommentDto.getSkuId();
                MallGoodsSku mallGoodsSku = mallGoodsSkuMapper.selectById(skuId);
                Long goodsId = apiAddCommentDto.getGoodsId();
                MallGoods mallGoods = mallGoodsMapper.selectById(goodsId);
                MallGoodsComment mallGoodsComment = MallGoodsCommentConversion.INSTANCE.dtoToEntity(apiAddCommentDto);
                mallGoodsComment.setMemberId(member.getId());
                mallGoodsComment.setOrderId(orderId);
                mallGoodsComment.setGoodsName(mallGoods.getGoodsName());
                mallGoodsComment.setSkuName(mallGoodsSku.getSkuName());
                mallGoodsComment.setStyleId(mallGoodsSku.getStyleId());
                mallGoodsComment.setStyleName(mallGoodsSku.getStyleName());
                mallGoodsComment.setShowState(MallGoodsComment.SHOW_STATE_ENABLE);
                mallGoodsCommentMapper.insert(mallGoodsComment);
            }
        }
    }
}
src/main/java/cc/mrbird/febs/mall/vo/AdminMallGoodsCommentVo.java
New file
@@ -0,0 +1,49 @@
package cc.mrbird.febs.mall.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel(value = "AdminMallGoodsCommentVo", description = "信息返回类")
public class AdminMallGoodsCommentVo {
    private Long id;
    @ApiModelProperty(value = "订单编号")
    private String orderNo;
    @ApiModelProperty(value = "姓名")
    private String memberName;
    @ApiModelProperty(value = "商品名称")
    private String goodsName;
    @ApiModelProperty(value = "样式名称")
    private String styleName;
    @ApiModelProperty(value = "规格名称")
    private String skuName;
    @ApiModelProperty(value = "评价时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;
    @ApiModelProperty(value = "评分  4.0")
    private Double star;
    @ApiModelProperty(value = "评论")
    private String comment;
    @ApiModelProperty(value = "图片")
    private String images;
    @ApiModelProperty(value = "是否匿名评价 1:匿名 2:不匿名")
    private Integer anonymousState;
    @ApiModelProperty(value = "展示状态 1:显示 2:隐藏")
    private Integer showState;
}
src/main/java/cc/mrbird/febs/mall/vo/MallGoodsCommentVo.java
New file
@@ -0,0 +1,35 @@
package cc.mrbird.febs.mall.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel(value = "MallGoodsCommentVo", description = "商品评价列表")
public class MallGoodsCommentVo {
    @ApiModelProperty(value = "头像")
    private String avatar;
    @ApiModelProperty(value = "名称")
    private String name;
    @ApiModelProperty(value = "评价时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;
    @ApiModelProperty(value = "评分  4.0")
    private Double star;
    @ApiModelProperty(value = "评论")
    private String comment;
    @ApiModelProperty(value = "图片")
    private String images;
    @ApiModelProperty(value = "是否匿名评价 1:匿名 2:不匿名")
    private Integer anonymousState;
}
src/main/java/cc/mrbird/febs/mall/vo/MallGoodsDetailsVo.java
@@ -68,4 +68,7 @@
    @ApiModelProperty(value = "样式")
    private List<GoodsDetailsStyleVo> styles;
    @ApiModelProperty(value = "评论数量")
    private Integer commentCount;
}
src/main/java/cc/mrbird/febs/mall/vo/OrderDetailVo.java
@@ -81,5 +81,8 @@
                return 3;
        }
    }
    @ApiModelProperty(value = "评价状态 1:待评价 2:已评价")
    private Integer commentState;
}
src/main/resources/mapper/modules/MallGoodsCommentMapper.xml
New file
@@ -0,0 +1,25 @@
<?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="cc.mrbird.febs.mall.mapper.MallGoodsCommentMapper">
    <select id="getCommentListInPage" resultType="cc.mrbird.febs.mall.vo.AdminMallGoodsCommentVo">
        select a.*,
        b.name memberName,
        c.order_no orderNo
        from mall_goods_comment a
        left join mall_member b on a.member_id = b.id
        left join mall_order_info c on a.order_id = c.id
        <where>
            <if test="record != null">
                <if test="record.goodsName != null and record.goodsName != ''">
                    and a.goods_name like CONCAT('%', CONCAT(#{record.goodsName}, '%'))
                </if>
                <if test="record.name != null and record.name != ''">
                    and b.name like CONCAT('%', CONCAT(#{record.name}, '%'))
                </if>
            </if>
        </where>
        order by a.created_time desc
    </select>
</mapper>
src/main/resources/mapper/modules/MallGoodsMapper.xml
@@ -214,4 +214,23 @@
            and date_format(c.pay_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
        </if>
    </select>
    <select id="selectMallGoodsCommentListQueryInPage" resultType="cc.mrbird.febs.mall.vo.MallGoodsCommentVo">
        select
        a.*,
        b.name name,
        b.avatar avatar
        from mall_goods_comment a
        left join mall_member b on b.id = a.member_id
        <where>
            <if test="record != null">
                <if test="record.goodsId != null and record.goodsId != ''">
                    and a.goods_id=#{record.goodsId}
                </if>
            </if>
        </where>
        group by a.id
        order by a.created_time desc
    </select>
</mapper>
src/main/resources/mapper/modules/MallOrderInfoMapper.xml
@@ -96,6 +96,7 @@
        <result column="longitude" property="longitude" />
        <result column="latitude" property="latitude" />
        <result column="order_type" property="orderType" />
        <result column="comment_state" property="commentState" />
        <result column="carriage" property="carriage" />
        <result column="remark" property="remark" />
        <result column="del_flag" property="delFlag" />
src/main/resources/templates/febs/views/modules/order/commentList.html
New file
@@ -0,0 +1,168 @@
<div class="layui-fluid layui-anim febs-anim" id="febs-comment" lay-title="评论列表">
    <div class="layui-row febs-container">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body febs-table-full">
                    <form class="layui-form layui-table-form" lay-filter="user-table-form">
                        <div class="layui-form-item">
                            <div class="layui-col-md10">
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input type="text" placeholder="用户名" name="name" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input type="text" placeholder="商品名" name="goodsName" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query">
                                    <i class="layui-icon">&#xe848;</i>
                                </div>
                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset">
                                    <i class="layui-icon">&#xe79b;</i>
                                </div>
                            </div>
                        </div>
                    </form>
                    <table lay-filter="commetTable" lay-data="{id: 'commetTable'}"></table>
                    <style type="text/css">
                        .layui-table-cell{
                            text-align:center;
                            height: auto;
                            white-space: nowrap; /*文本不会换行,在同一行显示*/
                            overflow: hidden; /*超出隐藏*/
                            text-overflow: ellipsis; /*省略号显示*/
                        }
                        .layui-table img{
                            max-width:100px
                        }
                    </style>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 表格操作栏 start -->
<script type="text/html" id="showStateSwitch">
    {{# if(d.showState === 1) { }}
    <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="showStateSwitch">
    {{# } else { }}
    <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="showStateSwitch">
    {{# } }}
</script>
<script id="showScreenhost" type="text/html">
    {{# var srr=d.images.split(",");
    for(var j in srr) { srr[j] }}
    <div style="margin:0 10px; display:inline-block !important; display:inline;  max-width:100px; max-height:100px;">
        <img style=" max-width:100px; max-height:100px;" src="{{srr[j]}}" alt=""/>
    </div>
    {{# } }}
</script>
<!-- 表格操作栏 end -->
<script data-th-inline="none" type="text/javascript">
    // 引入组件并初始化
    layui.use([ 'jquery', 'form', 'table', 'febs'], function () {
        var $ = layui.jquery,
            febs = layui.febs,
            form = layui.form,
            table = layui.table,
            $view = $('#febs-comment'),
            $query = $view.find('#query'),
            $reset = $view.find('#reset'),
            $searchForm = $view.find('form'),
            sortObject = {field: 'phone', type: null},
            tableIns;
        form.render();
        // 表格初始化
        initTable();
        // 初始化表格操作栏各个按钮功能
        table.on('tool(commetTable)', function (obj) {
            var data = obj.data,
                layEvent = obj.event;
        });
        // 查询按钮
        $query.on('click', function () {
            var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
            tableIns.reload({where: params, page: {curr: 1}});
        });
        // 刷新按钮
        $reset.on('click', function () {
            $searchForm[0].reset();
            sortObject.type = 'null';
            tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject});
        });
        function initTable() {
            tableIns = febs.table.init({
                elem: $view.find('table'),
                id: 'commetTable',
                url: ctx + 'admin/order/commentList',
                defaultToolbar: [],
                toolbar: '#tableToolBar',
                cols: [[
                        {field: 'memberName', title: '昵称', minWidth: 100,align:'left'},
                        {field: 'orderNo', title: '订单编号', minWidth: 80,align:'left'},
                        {field: 'goodsName', title: '商品名称', minWidth: 80,align:'left'},
                        {field: 'styleName', title: '样式', minWidth: 80,align:'left'},
                        {field: 'skuName', title: '规格', minWidth: 80,align:'left'},
                        {field: 'showState', title: '是否展示', templet: '#showStateSwitch', minWidth: 80,align:'center'},
                        {field: 'images', title: '图片', align: 'center', templet: '#showScreenhost', width: 400},
                        {field: 'star', title: '评分', minWidth: 50,align:'left'},
                        {field: 'comment', title: '评论', minWidth: 120,align:'left'},
                        {field: 'createdTime', title: '评价时间', minWidth: 180,align:'left'},
                        {field: 'anonymousState', title: '是否匿名',
                            templet: function (d) {
                                if (d.anonymousState === 1) {
                                    return '<span style="color:red;">匿名</span>'
                                } else if (d.anonymousState === 2) {
                                    return '<span">不匿名</span>'
                                }else{
                                    return ''
                                }
                            }, minWidth: 80,align:'center'},
                ]]
            });
        }
        // 获取查询参数
        function getQueryParams() {
            return {
                name: $searchForm.find('input[name="name"]').val().trim(),
                goodsName: $searchForm.find('input[name="goodsName"]').val().trim(),
            };
        }
        function showStateSwitchOn(id) {
            febs.get(ctx + 'admin/order/showStateSwitchOn/' + id, null, function () {
                febs.alert.success('设置成功');
                $query.click();
            });
        }
        function showStateSwitchOff(id) {
            febs.get(ctx + 'admin/order/showStateSwitchOff/' + id, null, function () {
                febs.alert.success('设置成功');
                $query.click();
            });
        }
        form.on('switch(showStateSwitch)', function (data) {
            if (data.elem.checked) {
                showStateSwitchOn(data.value);
            } else {
                showStateSwitchOff(data.value);
            }
        })
    })
</script>