提交修改

This commit is contained in:
quyixiao 2025-08-25 19:42:50 +08:00
parent 5644fd8fe1
commit 2d1d5e3a64
16 changed files with 538 additions and 15 deletions

View File

@ -50,4 +50,7 @@ public interface VvBuyerAddressDao extends BaseMapper<VvBuyerAddressEntity> {
int updateVvBuyerAddressStatusById(@Column(VvBuyerAddressEntity.status_) String status,
@By @Column(VvBuyerAddressEntity.status_) String status1,
@By@Column(VvBuyerAddressEntity.buyer_id) Long buyerId);
}

View File

@ -85,4 +85,7 @@ public interface VvCommentDao extends BaseMapper<VvCommentEntity> {
@LBracket Long buyerId,
@OR @RBracket String status,
@IF @OrderBy(VvCommentEntity.create_timestamp) String createTimestampSort);
int updateVvCommentUserfulByCommidId(@Plus Integer usefulCount,@By Long id);
}

View File

@ -0,0 +1,47 @@
package com.heyu.api.data.dao.vv;
/**
* <p>
* 评论是否有用 服务类
* </p>
*
* @author quyixiao
* @since 2025-08-25
*/
import com.heyu.api.data.entity.vv.VvCommentUserfulEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.mybatis.plugin.annotations.IN;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface VvCommentUserfulDao extends BaseMapper<VvCommentUserfulEntity> {
VvCommentUserfulEntity selectVvCommentUserfulById(@Param("id")Long id);
Long insertVvCommentUserful(VvCommentUserfulEntity vvCommentUserful);
Long insertOrUpdateVvCommentUserful(VvCommentUserfulEntity vvCommentUserful);
int updateVvCommentUserfulById(VvCommentUserfulEntity vvCommentUserful);
int updateCoverVvCommentUserfulById(VvCommentUserfulEntity vvCommentUserful);
int deleteVvCommentUserfulById(@Param("id")Long id);
List<VvCommentUserfulEntity> selectVvCommentUserfulByCommentId(@IN List<Long> commentId, Long buyerId);
VvCommentUserfulEntity selectVvCommentUserfulByCommentIdBuyerId(Long commentId, Long buyerId);
}

View File

@ -46,4 +46,7 @@ public interface VvTradeOrderLineDao extends BaseMapper<VvTradeOrderLineEntity>
List<VvTradeOrderLineEntity> selectVvTradeOrderLineByTradeOrderIds(List<Long> tradeOrderId);
List<VvTradeOrderLineEntity> selectVvTradeOrderLineByTradeOrderIdSkuId(Long tradeOrderId, Long skuId);
}

View File

@ -13,6 +13,18 @@ public class VvCommentDTO extends VvCommentEntity {
private List<VvCommentDetailEntity> vvCommentDetailEntities;
/***
* 用户是否已经点击有用, 1 已经点击 0 未点击
*/
private Integer userful = 0 ;
public static void main(String[] args) {
VvCommentDTO vvCommentDTO = new VvCommentDTO();

View File

@ -0,0 +1,182 @@
package com.heyu.api.data.entity.vv;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.lz.mybatis.plugin.annotations.AS;
import java.math.BigDecimal;
import java.util.Date;import java.util.Date;
/**
*评论是否有用
* @author quyixiao
* @since 2025-08-25
*/
@Data
@TableName("vv_comment_userful")
public class VvCommentUserfulEntity implements java.io.Serializable {
private static final long serialVersionUID = 1L;
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvCommentUserfulEntity:";
public final static String all = CLASS_NAME + "*";
public final static String id_ = CLASS_NAME + "id"; //
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除0 1 删除
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
public final static String comment_id = CLASS_NAME + "comment_id"; // 评论 id
public final static String product_id = CLASS_NAME + "product_id"; // 商品id
public final static String buyer_id = CLASS_NAME + "buyer_id"; // 买家id
public final static String sku_id = CLASS_NAME + "sku_id"; // sku_id
//
@TableId(value = "id", type = IdType.AUTO)
private Long id;
//是否删除0 1 删除
private Integer isDelete;
//创建时间
private Date createTime;
//修改时间
private Date modifyTime;
//评论 id
private Long commentId;
//商品id
private Long productId;
//买家id
private Long buyerId;
//sku_id
private Long skuId;
/**
*
* @return
*/
public Long getId() {
return id;
}
/**
*
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* 是否删除0 1 删除
* @return
*/
public Integer getIsDelete() {
return isDelete;
}
/**
* 是否删除0 1 删除
* @param isDelete
*/
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
/**
* 创建时间
* @return
*/
public Date getCreateTime() {
return createTime;
}
/**
* 创建时间
* @param createTime
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 修改时间
* @return
*/
public Date getModifyTime() {
return modifyTime;
}
/**
* 修改时间
* @param modifyTime
*/
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
/**
* 评论 id
* @return
*/
public Long getCommentId() {
return commentId;
}
/**
* 评论 id
* @param commentId
*/
public void setCommentId(Long commentId) {
this.commentId = commentId;
}
/**
* 商品id
* @return
*/
public Long getProductId() {
return productId;
}
/**
* 商品id
* @param productId
*/
public void setProductId(Long productId) {
this.productId = productId;
}
/**
* 买家id
* @return
*/
public Long getBuyerId() {
return buyerId;
}
/**
* 买家id
* @param buyerId
*/
public void setBuyerId(Long buyerId) {
this.buyerId = buyerId;
}
/**
* sku_id
* @return
*/
public Long getSkuId() {
return skuId;
}
/**
* sku_id
* @param skuId
*/
public void setSkuId(Long skuId) {
this.skuId = skuId;
}
@Override
public String toString() {
return "VvCommentUserfulEntity{" +
",id=" + id +
",isDelete=" + isDelete +
",createTime=" + createTime +
",modifyTime=" + modifyTime +
",commentId=" + commentId +
",productId=" + productId +
",buyerId=" + buyerId +
",skuId=" + skuId +
"}";
}
}

View File

@ -10,7 +10,7 @@ import java.util.Date;import java.util.Date;
/**
*购物车
* @author quyixiao
* @since 2025-08-23
* @since 2025-08-25
*/
@Data
@ -39,6 +39,7 @@ private static final long serialVersionUID = 1L;
public final static String product_main_image_url = CLASS_NAME + "product_main_image_url"; // 商品主图
public final static String sku_id = CLASS_NAME + "sku_id"; // skuid
public final static String sku_image_url = CLASS_NAME + "sku_image_url"; // sku图片
public final static String comment_id = CLASS_NAME + "comment_id"; // 评论 id
//
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ -76,6 +77,8 @@ private static final long serialVersionUID = 1L;
private Long skuId;
//sku图片
private String skuImageUrl;
//评论 id
private Long commentId;
/**
*
* @return
@ -346,6 +349,21 @@ private static final long serialVersionUID = 1L;
this.skuImageUrl = skuImageUrl;
}
/**
* 评论 id
* @return
*/
public Long getCommentId() {
return commentId;
}
/**
* 评论 id
* @param commentId
*/
public void setCommentId(Long commentId) {
this.commentId = commentId;
}
@Override
public String toString() {
return "VvTradeOrderLineEntity{" +
@ -367,6 +385,7 @@ private static final long serialVersionUID = 1L;
",productMainImageUrl=" + productMainImageUrl +
",skuId=" + skuId +
",skuImageUrl=" + skuImageUrl +
",commentId=" + commentId +
"}";
}
}

View File

@ -0,0 +1,68 @@
package com.heyu.api.data.service.impl.vv;
/**
* <p>
* 评论是否有用 服务类
* </p>
*
* @author quyixiao
* @since 2025-08-25
*/
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heyu.api.data.dao.vv.VvCommentUserfulDao;
import com.heyu.api.data.entity.vv.VvCommentUserfulEntity;
import com.heyu.api.data.service.vv.VvCommentUserfulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class VvCommentUserfulServiceImpl extends ServiceImpl<VvCommentUserfulDao, VvCommentUserfulEntity> implements VvCommentUserfulService {
@Autowired
private VvCommentUserfulDao vvCommentUserfulDao;
@Override
public VvCommentUserfulEntity selectVvCommentUserfulById(Long id){
return vvCommentUserfulDao.selectVvCommentUserfulById(id);
}
@Override
public Long insertVvCommentUserful(VvCommentUserfulEntity vvCommentUserful){
return vvCommentUserfulDao.insertVvCommentUserful(vvCommentUserful);
}
@Override
public Long insertOrUpdateVvCommentUserful(VvCommentUserfulEntity vvCommentUserful){
return vvCommentUserfulDao.insertOrUpdateVvCommentUserful(vvCommentUserful);
}
@Override
public int updateVvCommentUserfulById(VvCommentUserfulEntity vvCommentUserful){
return vvCommentUserfulDao.updateVvCommentUserfulById(vvCommentUserful);
}
@Override
public int updateCoverVvCommentUserfulById(VvCommentUserfulEntity vvCommentUserful){
return vvCommentUserfulDao.updateCoverVvCommentUserfulById(vvCommentUserful);
}
@Override
public int deleteVvCommentUserfulById(Long id){
return vvCommentUserfulDao.deleteVvCommentUserfulById(id);
}
}

View File

@ -0,0 +1,34 @@
package com.heyu.api.data.service.vv;
/**
* <p>
* 评论是否有用 服务类
* </p>
*
* @author quyixiao
* @since 2025-08-25
*/
import com.baomidou.mybatisplus.extension.service.IService;
import com.heyu.api.data.entity.vv.VvCommentUserfulEntity;
public interface VvCommentUserfulService extends IService<VvCommentUserfulEntity> {
VvCommentUserfulEntity selectVvCommentUserfulById(Long id);
Long insertVvCommentUserful(VvCommentUserfulEntity vvCommentUserful);
Long insertOrUpdateVvCommentUserful(VvCommentUserfulEntity vvCommentUserful);
int updateVvCommentUserfulById(VvCommentUserfulEntity vvCommentUserful);
int updateCoverVvCommentUserfulById(VvCommentUserfulEntity vvCommentUserful);
int deleteVvCommentUserfulById(Long id);
}

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.heyu.api.data.dao.vv.VvCommentUserfulDao">
</mapper>

View File

@ -94,8 +94,8 @@ public class MysqlMain_insert {
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("vv_comment"));
list.add(new TablesBean("vv_comment_detail"));
list.add(new TablesBean("vv_comment_userful"));
List<TablesBean> list2 = new ArrayList<TablesBean>();

View File

@ -49,7 +49,7 @@ public class MysqlMain_update {
List<TablesBean> list = new ArrayList<TablesBean>();
String a = "vv_comment_detail";
String a = "vv_trade_order_line";
for (String s : a.split(",")) {
list.add(new TablesBean(s));
}

View File

@ -1,4 +1,15 @@
package com.heyu.api.alibaba.request.vv;
import lombok.Data;
@Data
public class AppCommentDelete {
/***
* 评论id
*/
private Long commentId;
}

View File

@ -1,4 +1,30 @@
package com.heyu.api.alibaba.request.vv;
import lombok.Data;
@Data
public class AppCommentUseful {
/***
* 评论id
*/
private Long commentId;
/***
* 买家id
*/
private Long buyerId;
/***
* 是否有用
* 1 有用
*
* -1 无用 取消有用
*
*/
private Integer useful;
}

View File

@ -1,21 +1,19 @@
package com.heyu.api.controller.vv;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.heyu.api.alibaba.request.mm.enums.CommentStatusEnums;
import com.heyu.api.alibaba.request.vv.AppCommentAdd;
import com.heyu.api.alibaba.request.vv.AppCommentDelete;
import com.heyu.api.alibaba.request.vv.AppCommentRequest;
import com.heyu.api.alibaba.request.vv.AppCommentUseful;
import com.heyu.api.data.dao.vv.VvCommentDao;
import com.heyu.api.data.dao.vv.VvCommentDetailDao;
import com.heyu.api.alibaba.request.mm.order.resp.PropertyNameValue;
import com.heyu.api.alibaba.request.vv.*;
import com.heyu.api.data.dao.vv.*;
import com.heyu.api.data.dto.vv.VvCommentDTO;
import com.heyu.api.data.entity.vv.VvCommentDetailEntity;
import com.heyu.api.data.entity.vv.VvCommentEntity;
import com.heyu.api.data.entity.vv.*;
import com.heyu.api.data.utils.R;
import com.heyu.api.utils.ISelect;
import com.heyu.api.utils.PPageUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
@ -35,9 +33,30 @@ public class AppCommentController {
@Autowired
private VvCommentDao vvCommentDao;
@Autowired
private VvCommentDetailDao vvCommentDetailDao;
@Autowired
private VvSkuDao vvSkuDao;
@Autowired
private VvProductDao vvProductDao;
@Autowired
private VvSkuPropertyValueDao vvSkuPropertyValueDao;
@Autowired
private VvBuyerDao vvBuyerDao;
@Autowired
private VvTradeOrderLineDao vvTradeOrderLineDao;
@Autowired
private VvCommentUserfulDao vvCommentUserfulDao;
/***
* 列表
*/
@ -45,7 +64,6 @@ public class AppCommentController {
public R list(@RequestBody AppCommentRequest appCommentRequest) {
PPageUtils pageUtils = null;
// /***
// * 状态 待审批 wait_approval 待审批, approval_pass审批通过 , approval_not_pass 审批未通过如果审批未通过即自己可见但别人不可见
// */
@ -93,17 +111,29 @@ public class AppCommentController {
vvDetailMap.put(vvCommentDetailEntity.getCommentId(), commentDetailEntities);
}
List<Long> commentIds = new ArrayList<>();
for (VvCommentEntity vvCommentEntity : vvCommentEntities) {
VvCommentDTO vvCommentDTO = new VvCommentDTO();
BeanUtils.copyProperties(vvCommentEntity, vvCommentDTO);
commentIds.add(vvCommentDTO.getId());
List<VvCommentDetailEntity> list = vvDetailMap.get(vvCommentEntity.getId());
vvCommentDTO.setVvCommentDetailEntities(list);
vvCommentDTOS.add(vvCommentDTO);
}
if (appCommentRequest.getBuyerId() != null && CollectionUtils.isNotEmpty(commentIds)) {
List<VvCommentUserfulEntity> commentUserfulEntities = vvCommentUserfulDao.selectVvCommentUserfulByCommentId(commentIds, appCommentRequest.getBuyerId());
for (VvCommentDTO vvCommentDTO : vvCommentDTOS) {
for (VvCommentUserfulEntity commentUserfulEntity : commentUserfulEntities) {
if (vvCommentDTO.getId().equals(commentUserfulEntity.getCommentId())) {
vvCommentDTO.setUserful(1);
}
}
}
}
return R.ok().setData(vvCommentDTOS);
}
@ -112,24 +142,100 @@ public class AppCommentController {
*/
@RequestMapping("/add")
public R add(@RequestBody AppCommentAdd appCommentRequest) {
VvCommentEntity vvCommentEntity = new VvCommentEntity();
vvCommentEntity.setProductComment(appCommentRequest.getProductComment());
vvCommentEntity.setTradeOrderId(appCommentRequest.getTradeOrderId());
vvCommentEntity.setSkuId(appCommentRequest.getSkuId());
VvSkuEntity vvSkuEntity = vvSkuDao.selectVvSkuById(appCommentRequest.getSkuId());
VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvSkuEntity.getProductId());
vvCommentEntity.setProductId(vvSkuEntity.getProductId());
vvCommentEntity.setProductTitle(vvProduct.getTitle());
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvSkuEntity.getId());
List<PropertyNameValue> propertyNameValues = new ArrayList<>();
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
PropertyNameValue propertyNameValue = new PropertyNameValue();
propertyNameValue.setPropertyName(vvSkuPropertyValueEntity.getProductPropertyName());
propertyNameValue.setPropertyValue(vvSkuPropertyValueEntity.getProductPropertyValue());
propertyNameValues.add(propertyNameValue);
}
vvCommentEntity.setSkuInfo(JSON.toJSONString(propertyNameValues));
vvCommentEntity.setStatus(CommentStatusEnums.wait_approval.getStatus());
vvCommentEntity.setCreateTimestamp(System.currentTimeMillis());
vvCommentEntity.setServiceComment(appCommentRequest.getServiceComment());
vvCommentEntity.setDescMatch(appCommentRequest.getDescMatch());
vvCommentEntity.setSellerService(appCommentRequest.getSellerService());
vvCommentEntity.setLogisticsService(appCommentRequest.getLogisticsService());
vvCommentEntity.setUsefulCount(0);
VvBuyerEntity vvBuyerEntity = vvBuyerDao.selectVvBuyerById(appCommentRequest.getBuyerId());
vvCommentEntity.setBuyerId(vvBuyerEntity.getId());
vvCommentEntity.setBuyerName(vvBuyerEntity.getBuyerName());
vvCommentEntity.setBuyerPhone(vvBuyerEntity.getBuyerPhone());
vvCommentDao.insert(vvCommentEntity);
if (CollectionUtils.isNotEmpty(appCommentRequest.getCommentDetailList())) {
for (AppCommentDetail appCommentDetail : appCommentRequest.getCommentDetailList()) {
VvCommentDetailEntity vvCommentDetailEntity = new VvCommentDetailEntity();
vvCommentDetailEntity.setCommentId(vvCommentEntity.getId());
vvCommentDetailEntity.setCommentUrl(appCommentDetail.getCommentUrl());
vvCommentDetailEntity.setType(appCommentDetail.getType());
vvCommentDetailEntity.setProductId(vvCommentEntity.getProductId());
vvCommentDetailDao.insertOrUpdateVvCommentDetail(vvCommentDetailEntity);
}
}
List<VvTradeOrderLineEntity> vvTradeOrderLineEntityList = vvTradeOrderLineDao.selectVvTradeOrderLineByTradeOrderIdSkuId(
appCommentRequest.getTradeOrderId(),
appCommentRequest.getSkuId()
);
for (VvTradeOrderLineEntity tradeOrderLineEntity : vvTradeOrderLineEntityList) {
tradeOrderLineEntity.setCommentId(vvCommentEntity.getId());
vvTradeOrderLineDao.updateVvTradeOrderLineById(tradeOrderLineEntity);
}
return R.ok();
}
/***
*
*/
@RequestMapping("/useful")
public R useful(@RequestBody AppCommentUseful appCommentRequest) {
VvCommentUserfulEntity vvCommentUserful = vvCommentUserfulDao.selectVvCommentUserfulByCommentIdBuyerId(appCommentRequest.getCommentId(), appCommentRequest.getBuyerId());
if (appCommentRequest.getUseful() == 1) {
return R.error("已经点过了");
} else if (appCommentRequest.getUseful() == -1) {
if (vvCommentUserful == null) {
return R.error("之前没有点过有用");
}
vvCommentUserfulDao.deleteVvCommentUserfulById(vvCommentUserful.getId());
} else {
return R.ok();
}
VvCommentEntity vvCommentEntity = vvCommentDao.selectVvCommentById(appCommentRequest.getCommentId());
vvCommentDao.updateVvCommentUserfulByCommidId(appCommentRequest.getUseful(), appCommentRequest.getCommentId());
VvCommentUserfulEntity vvCommentUserfulEntity = new VvCommentUserfulEntity();
vvCommentUserfulEntity.setBuyerId(appCommentRequest.getBuyerId());
vvCommentUserfulEntity.setCommentId(appCommentRequest.getCommentId());
vvCommentUserfulEntity.setProductId(vvCommentEntity.getProductId());
vvCommentUserfulEntity.setSkuId(vvCommentEntity.getSkuId());
vvCommentUserfulDao.insertOrUpdateVvCommentUserful(vvCommentUserfulEntity);
return R.ok();
}
/***
* 删除
*/
@RequestMapping("/delete")
public R list(@RequestBody AppCommentDelete appCommentRequest) {
vvCommentDao.deleteVvCommentById(appCommentRequest.getCommentId());
return R.ok();
}

View File

@ -187,6 +187,8 @@ public class AppOrderController {
}
Set<Long> productIds = new HashSet<>();
List<VvSkuPropertyValueEntity> vvSkuPropertyValueList = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuIds(skuIds);
Map<Long, List<VvSkuPropertyValueEntity>> vvSkuPropertyValueMap = new HashMap<>();
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueList) {
@ -198,6 +200,7 @@ public class AppOrderController {
vvSkuPropertyValueMap.put(vvSkuPropertyValueEntity.getSkuId(), vvSkuPropertyValueEntities);
productIds.add(vvSkuPropertyValueEntity.getProductId());
}
Map<Long, VvSkuEntity> skuEntityMap = new HashMap<>();
List<VvSkuEntity> vvSkuEntities = vvSkuDao.selectVvSkuBySkuIds(skuIds);