Commit 899a7451 authored by yzc's avatar yzc

fix: 注释mobile评价

parent 07932c70
package com.ssy.lingxi.member.merchant.model.vo.comment.request;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 订单评价接口参数VO
......@@ -18,286 +13,8 @@ public class MemberTradeCommentWriteVO implements Serializable {
private static final long serialVersionUID = 1577411288889524742L;
/**
* 被评价的会员Id(下级会员Id)
*/
@NotNull(message = "被评价的会员Id(下级会员Id)不能为空")
@Positive(message = "被评价的会员Id(下级会员Id)要大于0")
private Long memberId;
/**
* 被评价的会员的角色Id(下级会员角色Id)
*/
@NotNull(message = "被评价的会员的角色Id(下级会员角色Id)不能为空")
@Positive(message = "被评价的会员的角色Id(下级会员角色Id)要大于0")
private Long roleId;
/**
* 订单id
*/
@NotNull(message = "订单id不能为空")
private Long orderId;
/**
* 商城类型ID
*/
@NotNull(message = "商城类型ID不能为空")
private Long shopId;
/**
* 备注(订单编号)
*/
@NotBlank(message = "备注(订单编号)不能为空")
private String orderNo;
/**
* 订单类型
*/
@NotNull(message = "订单类型不能为空")
private Integer orderType;
/**
* 订单详情id
*/
@NotNull(message = "订单详情id不能为空")
private Long orderDeatailsId;
/**
* 评价星级(1-5)
*/
@NotNull(message = "评价星级不能为空")
@Positive(message = "评价星级要大于0")
private Integer star;
/**
* 评价内容
*/
@NotBlank(message = "评价内容不能为空")
private String comment;
/**
* 商品信息
*/
@NotBlank(message = "商品信息不能为空")
private String product;
/**
* 商品id
*/
@NotNull(message = "商品id不能为空")
private Long productId;
/**
* 商品所属会员id
*/
private Long productMemberId;
/**
* 商品所属会员角色id
*/
private Long productMemberRoleId;
/**
* 商品主图
*/
@NotNull(message = "商品主图不能为空")
private String productImgUrl;
/**
* 交易时间
*/
@NotNull(message = "交易时间不能为空")
private Long dealTime;
/**
* 交易数量
*/
@NotNull(message = "交易数量不能为空")
@Positive(message = "交易数量要大于0")
private Double dealCount;
/**
* 数量单位
*/
@NotBlank(message = "数量单位")
private String unit;
/**
* 单价
*/
@NotNull(message = "单价不能为空")
@Positive(message = "单价要大于0")
@Max(value = 1000000000, message = "单价不能超过10的9次方")
private BigDecimal price;
/**
* 总价
*/
@NotNull(message = "总价不能为空")
@Positive(message = "总价要大于0")
@Max(value = 1000000000, message = "总价不能超过10的9次方")
private BigDecimal totalPrice;
/**
* 评价图片
*/
private List<String> pics;
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public Integer getOrderType() {
return orderType;
}
public void setOrderType(Integer orderType) {
this.orderType = orderType;
}
public Integer getStar() {
return star;
}
public void setStar(Integer star) {
this.star = star;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getProductImgUrl() {
return productImgUrl;
}
public void setProductImgUrl(String productImgUrl) {
this.productImgUrl = productImgUrl;
}
public Long getDealTime() {
return dealTime;
}
public void setDealTime(Long dealTime) {
this.dealTime = dealTime;
}
public Double getDealCount() {
return dealCount;
}
public void setDealCount(Double dealCount) {
this.dealCount = dealCount;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
public List<String> getPics() {
return pics;
}
public void setPics(List<String> pics) {
this.pics = pics;
}
public Long getOrderDeatailsId() {
return orderDeatailsId;
}
public void setOrderDeatailsId(Long orderDeatailsId) {
this.orderDeatailsId = orderDeatailsId;
}
public Long getShopId() {
return shopId;
}
public void setShopId(Long shopId) {
this.shopId = shopId;
}
public Long getProductMemberId() {
return productMemberId;
}
public void setProductMemberId(Long productMemberId) {
this.productMemberId = productMemberId;
}
public Long getProductMemberRoleId() {
return productMemberRoleId;
}
public void setProductMemberRoleId(Long productMemberRoleId) {
this.productMemberRoleId = productMemberRoleId;
}
}
......@@ -53,16 +53,6 @@ public class MobileTradeCommentPageVO implements Serializable {
private Long productId;
/**
* 商品所属会员id
*/
private Long productMemberId;
/**
* 商品所属会员角色id
*/
private Long productMemberRoleId;
/**
* 售后商品
*/
private String product;
......@@ -111,7 +101,7 @@ public class MobileTradeCommentPageVO implements Serializable {
/**
* 交易数量
*/
private Double purchaseCount;
private BigDecimal purchaseCount;
/**
* 计量单位
......@@ -158,6 +148,22 @@ public class MobileTradeCommentPageVO implements Serializable {
this.comment = comment;
}
public Long getShopId() {
return shopId;
}
public void setShopId(Long shopId) {
this.shopId = shopId;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getProduct() {
return product;
}
......@@ -166,6 +172,22 @@ public class MobileTradeCommentPageVO implements Serializable {
this.product = product;
}
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public Integer getOrderType() {
return orderType;
}
public void setOrderType(Integer orderType) {
this.orderType = orderType;
}
public String getOrderNo() {
return orderNo;
}
......@@ -214,11 +236,11 @@ public class MobileTradeCommentPageVO implements Serializable {
this.productImgUrl = productImgUrl;
}
public Double getPurchaseCount() {
public BigDecimal getPurchaseCount() {
return purchaseCount;
}
public void setPurchaseCount(Double purchaseCount) {
public void setPurchaseCount(BigDecimal purchaseCount) {
this.purchaseCount = purchaseCount;
}
......@@ -229,52 +251,4 @@ public class MobileTradeCommentPageVO implements Serializable {
public void setUnit(String unit) {
this.unit = unit;
}
public Long getShopId() {
return shopId;
}
public void setShopId(Long shopId) {
this.shopId = shopId;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public Integer getOrderType() {
return orderType;
}
public void setOrderType(Integer orderType) {
this.orderType = orderType;
}
public Long getProductMemberId() {
return productMemberId;
}
public void setProductMemberId(Long productMemberId) {
this.productMemberId = productMemberId;
}
public Long getProductMemberRoleId() {
return productMemberRoleId;
}
public void setProductMemberRoleId(Long productMemberRoleId) {
this.productMemberRoleId = productMemberRoleId;
}
}
......@@ -39,6 +39,15 @@ public interface IMemberCommentService {
Wrapper<Void> submitMemberTradeComment(UserLoginCacheDTO loginUser, MemberTradeTypeEnum memberTradeTypeEnum, MemberTradeCommentSubmitVO commentSubmitVO);
/**
* 系统定时自动评价
*
* @param memberTradeTypeEnum 评价方角色枚举 1-供应会员,2-采购会员
* @param commentSubmitVO 接口参数
* @return 查询结果
*/
void submitAutoMemberTradeComment(MemberTradeTypeEnum memberTradeTypeEnum, MemberTradeCommentSubmitVO commentSubmitVO);
/**
* 交易能力 - 会员评价管理 - 收到评价分页列表
*
* @param loginUser 登录用户信息
......
......@@ -21,13 +21,18 @@ import com.ssy.lingxi.member.merchant.model.vo.comment.response.*;
import com.ssy.lingxi.member.merchant.model.vo.lifecycle.request.CommonIdVO;
import com.ssy.lingxi.member.merchant.model.vo.maintenance.response.MemberDetailCreditCommentSummaryVO;
import com.ssy.lingxi.member.merchant.model.vo.maintenance.response.MemberDetailCreditTradeHistoryVO;
import com.ssy.lingxi.member.merchant.repository.*;
import com.ssy.lingxi.member.merchant.repository.MemberOrderCommentRepository;
import com.ssy.lingxi.member.merchant.repository.MemberOrderProductCommentRepository;
import com.ssy.lingxi.member.merchant.repository.MemberRelationRepository;
import com.ssy.lingxi.member.merchant.repository.MemberTradeCommentHistoryRepository;
import com.ssy.lingxi.member.merchant.service.base.IBaseMemberCreditAsyncService;
import com.ssy.lingxi.member.merchant.service.base.IBaseMemberLevelAsyncService;
import com.ssy.lingxi.member.merchant.service.feign.IPlatformManageFeignService;
import com.ssy.lingxi.member.merchant.service.feign.IReportFeignService;
import com.ssy.lingxi.member.merchant.service.web.IMemberCommentService;
import com.ssy.lingxi.member.merchant.utils.DateTimeUtil;
import com.ssy.lingxi.report.api.enums.OperateDataSourceEnum;
import com.ssy.lingxi.report.api.enums.PurchaseOrderOperateTypeEnum;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.data.domain.Page;
......@@ -176,14 +181,45 @@ public class MemberCommentServiceImpl implements IMemberCommentService {
}
}
return this.baseSubmitMemberTradeComment(memberTradeTypeEnum, memberOrderCommentDO, commentSubmitVO.getCommentSubmitDetailList(), true);
}
/**
* 系统定时自动评价
*
* @param memberTradeTypeEnum 评价方角色枚举 1-供应会员,2-采购会员
* @param commentSubmitVO 接口参数
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void submitAutoMemberTradeComment(MemberTradeTypeEnum memberTradeTypeEnum, MemberTradeCommentSubmitVO commentSubmitVO) {
// 订单
MemberOrderCommentDO memberOrderCommentDO = memberOrderCommentRepository.findById(commentSubmitVO.getOrderId()).orElse(null);
if (Objects.isNull(memberOrderCommentDO)) {
return;
}
this.baseSubmitMemberTradeComment(memberTradeTypeEnum, memberOrderCommentDO, commentSubmitVO.getCommentSubmitDetailList(), false);
}
/**
*
* @param memberTradeTypeEnum 评价类型
* @param memberOrderCommentDO 待评价订单
* @param commentSubmitDetailList 提交的评价数据
* @param isSensitiveWord 是否要过滤敏感词 0-否 1-是
* @return 返回结果
*/
private Wrapper<Void> baseSubmitMemberTradeComment(MemberTradeTypeEnum memberTradeTypeEnum, MemberOrderCommentDO memberOrderCommentDO, List<MemberTradeCommentSubmitDetailVO> commentSubmitDetailList, boolean isSensitiveWord) {
// 订单商品
List<MemberOrderProductCommentDO> memberOrderProductCommentDOList = memberOrderProductCommentRepository.findAllByOrderId(commentSubmitVO.getOrderId());
List<MemberOrderProductCommentDO> memberOrderProductCommentDOList = memberOrderProductCommentRepository.findAllByOrderId(memberOrderCommentDO.getId());
if (CollectionUtils.isEmpty(memberOrderProductCommentDOList)) {
return Wrapper.fail(ResponseCode.MC_MS_RECORDS_DON_T_EXIST);
}
// 已评价的订单商品记录
List<MemberTradeCommentHistoryDO> memberTradeCommentHistoryDOList = memberTradeCommentHistoryRepository.findAllByOrderIdAndTradeType(commentSubmitVO.getOrderId(), memberTradeTypeEnum.getTypeEnum());
List<MemberTradeCommentHistoryDO> memberTradeCommentHistoryDOList = memberTradeCommentHistoryRepository.findAllByOrderIdAndTradeType(memberOrderCommentDO.getId(), memberTradeTypeEnum.getTypeEnum());
// 没有可评价的订单商品, 直接返回
if (memberOrderProductCommentDOList.size() == memberTradeCommentHistoryDOList.size()) {
return Wrapper.success();
......@@ -194,17 +230,17 @@ public class MemberCommentServiceImpl implements IMemberCommentService {
.filter(orderProduct -> memberTradeCommentHistoryDOList.stream().noneMatch(orderProductComment -> orderProduct.getProductId().equals(orderProductComment.getProductId())))
.collect(Collectors.toMap(e -> e.getId(), e -> e, (e1, e2) -> e2));
// 提交的评价数据
List<MemberTradeCommentSubmitDetailVO> commentSubmitDetailList = commentSubmitVO.getCommentSubmitDetailList();
List<String> submitComment = commentSubmitDetailList.stream().map(MemberTradeCommentSubmitDetailVO::getComment).collect(Collectors.toList());
if (isSensitiveWord) {
// 敏感词过滤
Wrapper<List<String>> filterResult = platformManageFeignService.filterSensitiveWordList(submitComment);
if (filterResult.getCode() != ResponseCode.SUCCESS.getCode()) {
return Wrapper.fail(filterResult.getCode(), filterResult.getMessage());
}
// 敏感词过滤
Wrapper<List<String>> filterResult = platformManageFeignService.filterSensitiveWordList(commentSubmitDetailList.stream().map(MemberTradeCommentSubmitDetailVO::getComment).collect(Collectors.toList()));
if (filterResult.getCode() != ResponseCode.SUCCESS.getCode()) {
return Wrapper.fail(filterResult.getCode(), filterResult.getMessage());
submitComment = filterResult.getData();
}
List<String> filterComments = filterResult.getData();
// 会员数据处理
Long memberId;
Long roleId;
......@@ -256,7 +292,7 @@ public class MemberCommentServiceImpl implements IMemberCommentService {
commentHistoryDO.setSubMemberName(subMemberName);
commentHistoryDO.setStar(submitDetailVO.getStar());
// 评价内容
commentHistoryDO.setComment(CollectionUtils.isEmpty(filterComments) ? submitDetailVO.getComment() : filterComments.get(i));
commentHistoryDO.setComment(CollectionUtils.isEmpty(submitComment) ? submitDetailVO.getComment() : submitComment.get(i));
commentHistoryDO.setProduct(memberOrderProductCommentDO.getName());
commentHistoryDO.setOrderNo(memberOrderCommentDO.getOrderNo());
commentHistoryDO.setStatus(TradeCommentHistoryStatusEnum.SHOW.getCode());
......@@ -299,10 +335,20 @@ public class MemberCommentServiceImpl implements IMemberCommentService {
memberCreditAsyncService.calculateMemberTradeCommentCredit(memberId, roleId, subMemberId, subRoleId, avgStar);
}
// 首页统计
reportFeignService.memberOrderCommentReport(memberTradeTypeEnum.getTypeEnum(), loginUser.getMemberId(), loginUser.getMemberRoleId());
if (MemberTradeTypeEnum.BUYER.equals(memberTradeTypeEnum)) {
// 首页统计
reportFeignService.reduceReport(OperateDataSourceEnum.TRADE_PURCHASE_ORDER.getCode(),
memberOrderCommentDO.getBuyerMemberId(), memberOrderCommentDO.getBuyerRoleId(),
PurchaseOrderOperateTypeEnum.TO_BE_EVALUATE.getCode());
} else {
// 首页统计
reportFeignService.reduceReport(OperateDataSourceEnum.TRADE_SALE_ORDER.getCode(),
memberOrderCommentDO.getVendorMemberId(), memberOrderCommentDO.getVendorRoleId(),
PurchaseOrderOperateTypeEnum.TO_BE_EVALUATE.getCode());
}
return Wrapper.success();
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment