提交修改

This commit is contained in:
quyixiao 2025-08-30 10:55:16 +08:00
parent 01498494b8
commit 3401ee4a45
19 changed files with 648 additions and 377 deletions

View File

@ -45,7 +45,7 @@
<dependency>
<groupId>com.lz.mybatis.plugin</groupId>
<artifactId>lz_mybatis_plugin</artifactId>
<version>20.0-SNAPSHOT</version>
<version>21.0-SNAPSHOT</version>
</dependency>

View File

@ -82,8 +82,10 @@ public interface VvCommentDao extends BaseMapper<VvCommentEntity> {
@OrderBy(VvCommentEntity.id_)
List<VvCommentEntity> selectLogin(IPage page,
@IF Long productId,
@LBracket Long buyerId,
@OR @RBracket String status,
@IF @OrderBy(VvCommentEntity.create_timestamp) String createTimestampSort);

View File

@ -10,7 +10,7 @@ package com.heyu.api.data.dao.vv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heyu.api.data.entity.vv.VvPackageEntity;
import com.lz.mybatis.plugin.annotations.IFNullReturnEmptyList;
import com.lz.mybatis.plugin.annotations.IFNullReturnEmpty;
import com.lz.mybatis.plugin.annotations.IN;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -39,5 +39,5 @@ public interface VvPackageDao extends BaseMapper<VvPackageEntity> {
int deleteVvPackageById(@Param("id")Long id);
List<VvPackageEntity> selectVvPackageByTrackNumbers(@IFNullReturnEmptyList @IN List<String> trackNumber);
List<VvPackageEntity> selectVvPackageByTrackNumbers(@IFNullReturnEmpty @IN List<String> trackNumber);
}

View File

@ -67,7 +67,7 @@ public interface VvTradeOrderDao extends BaseMapper<VvTradeOrderEntity> {
void updateByBuerIdAndIds(String status,@By Long buyerId,@By List<Long> ids);
List<VvTradeOrderEntity> selectVvTradeOrderByTradeOrderIds(@IN List<Long> id);
List<VvTradeOrderEntity> selectVvTradeOrderByTradeOrderIds(@IFNullReturnEmpty @IN List<Long> id);
}

View File

@ -130,7 +130,7 @@ public interface VvTradeOrderLineDao extends BaseMapper<VvTradeOrderLineEntity>
@IF @GE @Column(VvTradeOrderLineEntity.create_timestamp) Long minCreateTimestamp,
@IF @LE @Column(VvTradeOrderLineEntity.create_timestamp) Long maxCreateTimestamp,
@IF @LIKE String productName,
@IF Long buyerId,
@IFNullReturnEmpty Long buyerId,
@IF String reverseStatus,
@IF @OrderBy(VvTradeOrderLineEntity.create_timestamp) String createTimestampSort);

View File

@ -0,0 +1,19 @@
package com.heyu.api.data.dto;
import lombok.Data;
@Data
public class BuyerDTO {
/***
* 买家id
*/
private Long buyerId ;
/***
* 买家名称
*/
private String buyerName ;
}

View File

@ -1,15 +1,16 @@
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.util.Date;
import java.math.BigDecimal;
import java.util.Date;import java.util.Date;
/**
*评论表
* @author quyixiao
* @since 2025-08-25
* @since 2025-08-30
*/
@Data
@ -20,322 +21,70 @@ private static final long serialVersionUID = 1L;
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvCommentEntity:";
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 product_comment = CLASS_NAME + "product_comment"; // 商品评论的内容
public final static String trade_order_id = CLASS_NAME + "trade_order_id"; // 订单id
public final static String sku_id = CLASS_NAME + "sku_id"; // sku_id
public final static String product_id = CLASS_NAME + "product_id"; // 商品id
public final static String product_title = CLASS_NAME + "product_title"; // 商品标题
public final static String sku_info = CLASS_NAME + "sku_info"; // sku信息
public final static String status_ = CLASS_NAME + "status"; // 待审批 wait_approval 待审批, approval_pass审批通过 , approval_not_pass 审批未通过如果审批未通过即自己可见但别人不可见
public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 创建时间
public final static String service_comment = CLASS_NAME + "service_comment"; // 服务评论内容
public final static String desc_match = CLASS_NAME + "desc_match"; // 描述相符
public final static String seller_service = CLASS_NAME + "seller_service"; // 卖家服务
public final static String logistics_service = CLASS_NAME + "logistics_service"; // 物流服务
public final static String useful_count = CLASS_NAME + "useful_count"; // 有用数
public final static String buyer_id = CLASS_NAME + "buyer_id"; // 买家id
public final static String buyer_name = CLASS_NAME + "buyer_name"; // 买家名称
public final static String buyer_phone = CLASS_NAME + "buyer_phone"; // 买家手机号
//
@TableId(value = "id", type = IdType.AUTO)
private Long id;
//是否删除0 1 删除
private Integer isDelete;
//创建时间
private Date createTime;
//修改时间
private Date modifyTime;
//商品评论的内容
private String productComment;
//订单id
private Long tradeOrderId;
//sku_id
private Long skuId;
//商品id
private Long productId;
//商品标题
private String productTitle;
//sku信息
private String skuInfo;
//待审批 wait_approval 待审批, approval_pass审批通过 , approval_not_pass 审批未通过如果审批未通过即自己可见但别人不可见
private String status;
//创建时间
private Long createTimestamp;
//服务评论内容
private String serviceComment;
//描述相符
private Integer descMatch;
//卖家服务
private Integer sellerService;
//物流服务
private Integer logisticsService;
//有用数
private Integer usefulCount;
public final static String buyer_id = CLASS_NAME + "buyer_id"; // 买家id
public final static String buyer_name = CLASS_NAME + "buyer_name"; // 买家名称
public final static String buyer_phone = CLASS_NAME + "buyer_phone"; // 买家手机号
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 创建时间
public final static String desc_match = CLASS_NAME + "desc_match"; // 描述相符
public final static String id_ = CLASS_NAME + "id"; //
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除0 1 删除
public final static String logistics_service = CLASS_NAME + "logistics_service"; // 物流服务
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
public final static String product_comment = CLASS_NAME + "product_comment"; // 商品评论的内容
public final static String product_id = CLASS_NAME + "product_id"; // 商品id
public final static String product_title = CLASS_NAME + "product_title"; // 商品标题
public final static String seller_service = CLASS_NAME + "seller_service"; // 卖家服务
public final static String service_comment = CLASS_NAME + "service_comment"; // 服务评论内容
public final static String sku_id = CLASS_NAME + "sku_id"; // sku_id
public final static String sku_info = CLASS_NAME + "sku_info"; // sku信息
public final static String status_ = CLASS_NAME + "status"; // 待审批 wait_approval 待审批, approval_pass审批通过 , approval_not_pass 审批未通过如果审批未通过即自己可见但别人不可见
public final static String trade_order_id = CLASS_NAME + "trade_order_id"; // 订单id
public final static String trade_order_line_id = CLASS_NAME + "trade_order_line_id"; // 子单维度的评论
public final static String useful_count = CLASS_NAME + "useful_count"; // 有用数
//买家id
@TableId(value = "buyer_id", type = IdType.AUTO)
private Long buyerId;
//买家名称
private String buyerName;
//买家手机号
private String buyerPhone;
/**
*
* @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;
}
/**
* 商品评论的内容
* @return
*/
public String getProductComment() {
return productComment;
}
/**
* 商品评论的内容
* @param productComment
*/
public void setProductComment(String productComment) {
this.productComment = productComment;
}
/**
* 订单id
* @return
*/
public Long getTradeOrderId() {
return tradeOrderId;
}
/**
* 订单id
* @param tradeOrderId
*/
public void setTradeOrderId(Long tradeOrderId) {
this.tradeOrderId = tradeOrderId;
}
/**
* sku_id
* @return
*/
public Long getSkuId() {
return skuId;
}
/**
* sku_id
* @param skuId
*/
public void setSkuId(Long skuId) {
this.skuId = skuId;
}
/**
* 商品id
* @return
*/
public Long getProductId() {
return productId;
}
/**
* 商品id
* @param productId
*/
public void setProductId(Long productId) {
this.productId = productId;
}
/**
* 商品标题
* @return
*/
public String getProductTitle() {
return productTitle;
}
/**
* 商品标题
* @param productTitle
*/
public void setProductTitle(String productTitle) {
this.productTitle = productTitle;
}
/**
* sku信息
* @return
*/
public String getSkuInfo() {
return skuInfo;
}
/**
* sku信息
* @param skuInfo
*/
public void setSkuInfo(String skuInfo) {
this.skuInfo = skuInfo;
}
/**
* 待审批 wait_approval 待审批, approval_pass审批通过 , approval_not_pass 审批未通过如果审批未通过即自己可见但别人不可见
* @return
*/
public String getStatus() {
return status;
}
/**
* 待审批 wait_approval 待审批, approval_pass审批通过 , approval_not_pass 审批未通过如果审批未通过即自己可见但别人不可见
* @param status
*/
public void setStatus(String status) {
this.status = status;
}
/**
* 创建时间
* @return
*/
public Long getCreateTimestamp() {
return createTimestamp;
}
/**
* 创建时间
* @param createTimestamp
*/
public void setCreateTimestamp(Long createTimestamp) {
this.createTimestamp = createTimestamp;
}
/**
* 服务评论内容
* @return
*/
public String getServiceComment() {
return serviceComment;
}
/**
* 服务评论内容
* @param serviceComment
*/
public void setServiceComment(String serviceComment) {
this.serviceComment = serviceComment;
}
/**
* 描述相符
* @return
*/
public Integer getDescMatch() {
return descMatch;
}
/**
* 描述相符
* @param descMatch
*/
public void setDescMatch(Integer descMatch) {
this.descMatch = descMatch;
}
/**
* 卖家服务
* @return
*/
public Integer getSellerService() {
return sellerService;
}
/**
* 卖家服务
* @param sellerService
*/
public void setSellerService(Integer sellerService) {
this.sellerService = sellerService;
}
/**
* 物流服务
* @return
*/
public Integer getLogisticsService() {
return logisticsService;
}
/**
* 物流服务
* @param logisticsService
*/
public void setLogisticsService(Integer logisticsService) {
this.logisticsService = logisticsService;
}
/**
* 有用数
* @return
*/
public Integer getUsefulCount() {
return usefulCount;
}
/**
* 有用数
* @param usefulCount
*/
public void setUsefulCount(Integer usefulCount) {
this.usefulCount = usefulCount;
}
//创建时间
private Date createTime;
//创建时间
private Long createTimestamp;
//描述相符
private Integer descMatch;
//
private Long id;
//是否删除0 1 删除
private Integer isDelete;
//物流服务
private Integer logisticsService;
//修改时间
private Date modifyTime;
//商品评论的内容
private String productComment;
//商品id
private Long productId;
//商品标题
private String productTitle;
//卖家服务
private Integer sellerService;
//服务评论内容
private String serviceComment;
//sku_id
private Long skuId;
//sku信息
private String skuInfo;
//待审批 wait_approval 待审批, approval_pass审批通过 , approval_not_pass 审批未通过如果审批未通过即自己可见但别人不可见
private String status;
//订单id
private Long tradeOrderId;
//子单维度的评论
private Long tradeOrderLineId;
//有用数
private Integer usefulCount;
/**
* 买家id
* @return
@ -381,29 +130,300 @@ private static final long serialVersionUID = 1L;
this.buyerPhone = buyerPhone;
}
/**
* 创建时间
* @return
*/
public Date getCreateTime() {
return createTime;
}
/**
* 创建时间
* @param createTime
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 创建时间
* @return
*/
public Long getCreateTimestamp() {
return createTimestamp;
}
/**
* 创建时间
* @param createTimestamp
*/
public void setCreateTimestamp(Long createTimestamp) {
this.createTimestamp = createTimestamp;
}
/**
* 描述相符
* @return
*/
public Integer getDescMatch() {
return descMatch;
}
/**
* 描述相符
* @param descMatch
*/
public void setDescMatch(Integer descMatch) {
this.descMatch = descMatch;
}
/**
*
* @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 Integer getLogisticsService() {
return logisticsService;
}
/**
* 物流服务
* @param logisticsService
*/
public void setLogisticsService(Integer logisticsService) {
this.logisticsService = logisticsService;
}
/**
* 修改时间
* @return
*/
public Date getModifyTime() {
return modifyTime;
}
/**
* 修改时间
* @param modifyTime
*/
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
/**
* 商品评论的内容
* @return
*/
public String getProductComment() {
return productComment;
}
/**
* 商品评论的内容
* @param productComment
*/
public void setProductComment(String productComment) {
this.productComment = productComment;
}
/**
* 商品id
* @return
*/
public Long getProductId() {
return productId;
}
/**
* 商品id
* @param productId
*/
public void setProductId(Long productId) {
this.productId = productId;
}
/**
* 商品标题
* @return
*/
public String getProductTitle() {
return productTitle;
}
/**
* 商品标题
* @param productTitle
*/
public void setProductTitle(String productTitle) {
this.productTitle = productTitle;
}
/**
* 卖家服务
* @return
*/
public Integer getSellerService() {
return sellerService;
}
/**
* 卖家服务
* @param sellerService
*/
public void setSellerService(Integer sellerService) {
this.sellerService = sellerService;
}
/**
* 服务评论内容
* @return
*/
public String getServiceComment() {
return serviceComment;
}
/**
* 服务评论内容
* @param serviceComment
*/
public void setServiceComment(String serviceComment) {
this.serviceComment = serviceComment;
}
/**
* sku_id
* @return
*/
public Long getSkuId() {
return skuId;
}
/**
* sku_id
* @param skuId
*/
public void setSkuId(Long skuId) {
this.skuId = skuId;
}
/**
* sku信息
* @return
*/
public String getSkuInfo() {
return skuInfo;
}
/**
* sku信息
* @param skuInfo
*/
public void setSkuInfo(String skuInfo) {
this.skuInfo = skuInfo;
}
/**
* 待审批 wait_approval 待审批, approval_pass审批通过 , approval_not_pass 审批未通过如果审批未通过即自己可见但别人不可见
* @return
*/
public String getStatus() {
return status;
}
/**
* 待审批 wait_approval 待审批, approval_pass审批通过 , approval_not_pass 审批未通过如果审批未通过即自己可见但别人不可见
* @param status
*/
public void setStatus(String status) {
this.status = status;
}
/**
* 订单id
* @return
*/
public Long getTradeOrderId() {
return tradeOrderId;
}
/**
* 订单id
* @param tradeOrderId
*/
public void setTradeOrderId(Long tradeOrderId) {
this.tradeOrderId = tradeOrderId;
}
/**
* 子单维度的评论
* @return
*/
public Long getTradeOrderLineId() {
return tradeOrderLineId;
}
/**
* 子单维度的评论
* @param tradeOrderLineId
*/
public void setTradeOrderLineId(Long tradeOrderLineId) {
this.tradeOrderLineId = tradeOrderLineId;
}
/**
* 有用数
* @return
*/
public Integer getUsefulCount() {
return usefulCount;
}
/**
* 有用数
* @param usefulCount
*/
public void setUsefulCount(Integer usefulCount) {
this.usefulCount = usefulCount;
}
@Override
public String toString() {
return "VvCommentEntity{" +
",id=" + id +
",isDelete=" + isDelete +
",createTime=" + createTime +
",modifyTime=" + modifyTime +
",productComment=" + productComment +
",tradeOrderId=" + tradeOrderId +
",skuId=" + skuId +
",productId=" + productId +
",productTitle=" + productTitle +
",skuInfo=" + skuInfo +
",status=" + status +
",createTimestamp=" + createTimestamp +
",serviceComment=" + serviceComment +
",descMatch=" + descMatch +
",sellerService=" + sellerService +
",logisticsService=" + logisticsService +
",usefulCount=" + usefulCount +
",buyerId=" + buyerId +
",buyerName=" + buyerName +
",buyerPhone=" + buyerPhone +
",createTime=" + createTime +
",createTimestamp=" + createTimestamp +
",descMatch=" + descMatch +
",id=" + id +
",isDelete=" + isDelete +
",logisticsService=" + logisticsService +
",modifyTime=" + modifyTime +
",productComment=" + productComment +
",productId=" + productId +
",productTitle=" + productTitle +
",sellerService=" + sellerService +
",serviceComment=" + serviceComment +
",skuId=" + skuId +
",skuInfo=" + skuInfo +
",status=" + status +
",tradeOrderId=" + tradeOrderId +
",tradeOrderLineId=" + tradeOrderLineId +
",usefulCount=" + usefulCount +
"}";
}
}

View File

@ -5,7 +5,7 @@ package com.heyu.api.data.service.impl.vv;
* </p>
*
* @author quyixiao
* @since 2025-08-25
* @since 2025-08-30
*/
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

View File

@ -5,7 +5,7 @@ package com.heyu.api.data.service.vv;
* </p>
*
* @author quyixiao
* @since 2025-08-25
* @since 2025-08-30
*/
import com.baomidou.mybatisplus.extension.service.IService;
import com.heyu.api.data.entity.vv.VvCommentEntity;

View File

@ -54,6 +54,12 @@ public class RedisUtils {
* 默认过期时长单位
*/
public final static long DEFAULT_EXPIRE = 60 * 60 * 24;
/**
* 不设置过期时长
*/

View File

@ -95,7 +95,7 @@ public class MysqlMain_insert {
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("vv_file_resource"));
list.add(new TablesBean("vv_comment"));

View File

@ -1,6 +1,6 @@
package com.test.xxx.mysql;
import com.heyu.api.data.dao.vv.VvAdminDao;
import com.heyu.api.data.dao.vv.VvTradeOrderLineDao;
import com.lz.mybatis.plugin.utils.TestParseUtils;
import com.lz.mybatis.plugin.utils.t.Tuple2;
import org.junit.Test;
@ -11,7 +11,7 @@ SqlParseUtilsTest {
@Test
public void test1() {
Tuple2<Boolean, String> tuple = TestParseUtils.testSql(VvAdminDao::selectVvAdminByUserName).getData();
Tuple2<Boolean, String> tuple = TestParseUtils.testSql(VvTradeOrderLineDao::selectByAppCondition).getData();
System.out.println(tuple.getSecond());

View File

@ -10,20 +10,11 @@ import java.util.List;
@Data
public class AppCommentAdd {
/***
* sku id
*/
private Long skuId;
//买家id
private Long buyerId;
/***
* 订单id
*/
private Long tradeOrderId;
//商品评论的内容
private String productComment;
@ -44,12 +35,17 @@ public class AppCommentAdd {
*/
private List<AppCommentDetail> commentDetailList;
/***
* 子单维度
*/
private Long tradeOrderLineId;
public static void main(String[] args) {
AppCommentAdd appCommentAdd = new AppCommentAdd();
appCommentAdd.setSkuId(91L);
appCommentAdd.setBuyerId(2L);
appCommentAdd.setTradeOrderId(3L);
appCommentAdd.setProductComment("东西很好");
appCommentAdd.setServiceComment("服务态度好");
appCommentAdd.setDescMatch(5);

View File

@ -24,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
@ -72,16 +73,24 @@ public class LogAop {
String args = "";
String className = "";
String uri = "";
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
String traceId = attributes.getRequest().getHeader("traceId");
if(StringUtils.isBlank(traceId)){
traceId = OrderUtil.getUserPoolOrder("on");
}
LogAspect.threadLocalNo.set(traceId);
LogAspect.threadLocalTime.set(System.currentTimeMillis());
HttpServletRequest request = attributes.getRequest();
uri = attributes.getRequest().getRequestURI();
if(uri.startsWith("/mm/") || uri.startsWith("/app/")){
return point.proceed();
}
try {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
String traceId = attributes.getRequest().getHeader("traceId");
if(StringUtils.isBlank(traceId)){
traceId = OrderUtil.getUserPoolOrder("on");
}
LogAspect.threadLocalNo.set(traceId);
LogAspect.threadLocalTime.set(System.currentTimeMillis());
HttpServletRequest request = attributes.getRequest();
uri = attributes.getRequest().getRequestURI();
args = recordRequestLog(point.getArgs(), uri);
Signature sig = point.getSignature();
@ -100,10 +109,7 @@ public class LogAop {
.append("class:").append(className).append("#").append(methodName).append(BLANK_SPACE)
.append("uri:").append(uri);
if(uri.startsWith("/mm/") || uri.startsWith("/app/")){
return point.proceed();
}
// 默认对有的接口进行拦截
Boolean intercept = faceAuthMap.get(className);
@ -178,6 +184,10 @@ public class LogAop {
for (Object arg1 : argArrs) {
if (arg1 instanceof MultipartFile) {
continue;
}else if (arg1 instanceof HttpServletRequest) {
continue;
}else if (arg1 instanceof HttpServletResponse) {
continue;
} else if (arg1 instanceof MultipartFile[]) {
continue;
} else {

View File

@ -0,0 +1,202 @@
package com.heyu.api.aop;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.heyu.api.common.LogAspect;
import com.heyu.api.data.dto.BuyerDTO;
import com.heyu.api.data.service.bussiness.RedisSettingService;
import com.heyu.api.data.utils.OrderUtil;
import com.heyu.api.data.utils.RedisUtils;
import com.heyu.api.data.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* 日志aop
* Created by wutao on 2018/10/12.
*/
@Aspect
@Component
@Order(1)
@Slf4j
public class ZhenZhenLogAop {
private String BLANK_SPACE = " ";
@Autowired
private RedisUtils redisUtils;
@Autowired
private RedisSettingService redisSettingService;
@Pointcut(value = "(" + " @within(org.springframework.web.bind.annotation.RestController) || " + " @within(org.springframework.stereotype.Controller)" + ")")
public void pointcut() {
}
@Around("pointcut()")
public Object doAround(ProceedingJoinPoint point) throws Throwable {
Object result = null;
StringBuilder sb = new StringBuilder();
String methodName = "";
String ip = "";
String args = "";
String className = "";
String uri = "";
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
String traceId = attributes.getRequest().getHeader("traceId");
if (StringUtils.isBlank(traceId)) {
traceId = OrderUtil.getUserPoolOrder("on");
}
LogAspect.threadLocalNo.set(traceId);
LogAspect.threadLocalTime.set(System.currentTimeMillis());
HttpServletRequest request = attributes.getRequest();
uri = attributes.getRequest().getRequestURI();
// 如果不是小程序的url 则直接过滤掉
if (!uri.startsWith("/mm/") && !uri.startsWith("/app/")) {
return point.proceed();
}
try {
args = recordRequestLog(point.getArgs(), uri);
Signature sig = point.getSignature();
Method method = ((MethodSignature) sig).getMethod();
if (sig instanceof MethodSignature) {
methodName = ((MethodSignature) sig).getMethod().getName();
}
Class clazz = point.getTarget().getClass();
className = clazz.getName();
String token = attributes.getRequest().getHeader("token");
if (uri.startsWith("/app/")) {
Object [] argArrs= point.getArgs();
if (argArrs != null && argArrs.length > 0) {
/***
*
*/
Long buyerId = null;
if(StringUtils.isNotBlank(token)){
Object tokenValue = redisUtils.get(token);
if(tokenValue !=null){
String tokenStr = tokenValue.toString();
BuyerDTO buyerDTO = JSONObject.parseObject(tokenStr, BuyerDTO.class);
buyerId = buyerDTO.getBuyerId();
}
}
for (Object argArr : argArrs) {
argArr.getClass().getDeclaredMethods();
List<Method> methods = new ArrayList<>();
getClassDeclaredMethods(argArr.getClass(),methods);
for (Method m : methods) {
if (m.getName().startsWith("set")) {
String mName = m.getName().substring(3);
if("buyerId".equalsIgnoreCase(mName)) {
m.setAccessible(true);
m.invoke(argArr, new Object[]{buyerId});
}
}
}
}
}
} else if (uri.startsWith("/mm/")) {
// 登录不拦截
if (!"/mm/admin/login".equals(uri)) {
Object tokenValue = redisUtils.get(token);
if (tokenValue == null) {
// return R.error("请登录");
}
}
}
result = point.proceed();
} catch (Exception e) {
log.error("LogAop set error " + sb.toString(), e);
} finally {
printLog(result, args, ip, className, methodName, uri);
LogAspect.threadLocalNo.remove();
LogAspect.threadLocalTime.remove();
}
return result;
}
public static void getClassDeclaredMethods( Class entityType, List<Method> methods){
if(entityType == Object.class){
return ;
}
Method method [] = entityType.getDeclaredMethods();
for (Method method1 : method) {
methods.add(method1);
}
}
public void printLog(Object result, String args, String ip, String className, String methodName,
String preUri) {
StringBuilder sb = new StringBuilder();
sb.append("ZhenZhenLogAop args:").append(args).append(BLANK_SPACE)
.append("ip:").append(ip).append(BLANK_SPACE)
.append("class:").append(className).append("#").append(methodName).append(BLANK_SPACE)
.append("uri:").append(preUri).append(BLANK_SPACE)
.append("result:").append(JSON.toJSONString(result));
log.info(sb.toString());
}
private String recordRequestLog(Object[] argArrs, String uri) {
String mediaType = "";
String args = null;
try {
List<Object> list = new ArrayList<>();
if (argArrs != null && argArrs.length > 0) {
for (Object arg1 : argArrs) {
if (arg1 instanceof MultipartFile) {
continue;
} else if (arg1 instanceof HttpServletRequest) {
continue;
} else if (arg1 instanceof HttpServletResponse) {
continue;
} else if (arg1 instanceof MultipartFile[]) {
continue;
} else {
list.add(arg1);
}
}
}
Object jsonData = list.size() == 1 ? list.get(0) : list;
args = JSON.toJSONString(jsonData);
return args;
} catch (Exception e) {
log.error("url " + uri + " , uri " + uri + " ,mediaType " + mediaType + ", 打印请求日志错误" + args, e);
}
return "";
}
}

View File

@ -2,6 +2,7 @@ package com.heyu.api.controller.mm;
import com.heyu.api.alibaba.request.mm.VVAdminRequest;
import com.heyu.api.data.constants.RedisConstans;
import com.heyu.api.data.dao.vv.VvAdminDao;
import com.heyu.api.data.dao.vv.VvLoginLogDao;
import com.heyu.api.data.dto.vv.VVAdminDTO;
@ -9,6 +10,7 @@ import com.heyu.api.data.entity.vv.VvAdminEntity;
import com.heyu.api.data.entity.vv.VvLoginLogEntity;
import com.heyu.api.data.utils.MD5Utils;
import com.heyu.api.data.utils.R;
import com.heyu.api.data.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
@ -20,7 +22,6 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/mm/admin")
public class AdminLoginController {
@Autowired
private VvAdminDao vvAdminDao;
@ -28,6 +29,13 @@ public class AdminLoginController {
@Autowired
private VvLoginLogDao vvLoginLogDao;
@Autowired
private RedisUtils redisUtils;
/***
* 列表
* http://localhost:8888/mm/admin/login
@ -41,7 +49,6 @@ public class AdminLoginController {
VVAdminDTO vvAdminDTO = new VVAdminDTO();
VvAdminEntity vvAdminEntity = vvAdminDao.selectVvAdminByUserName(vvAdminRequest.getUsername());
// admin123 != '1' or 1 = 1
if (vvAdminEntity.getPassword().equals(vvAdminRequest.getPassword())) {
vvAdminDTO.setUsername(vvAdminRequest.getUsername());
@ -53,13 +60,14 @@ public class AdminLoginController {
vvLoginLogDao.deleteVvLoginLogRealByUserName(vvAdminRequest.getUsername());
vvLoginLogEntity.setUsername(vvAdminRequest.getUsername());
redisUtils.set(token,vvAdminRequest.getUsername(), RedisConstans.SECOND_OF_ONE_7_DAY);
vvLoginLogEntity.setToken(token);
vvLoginLogDao.insertOrUpdateVvLoginLog(vvLoginLogEntity);
return R.ok().setData(vvAdminDTO);
}
return R.ok("密码错误");
}
}

View File

@ -26,8 +26,6 @@ public class UploadOssController {
private OssFileUploadService ossFileUploadService;
/**
*post man 配置
* https://blog.csdn.net/maowendi/article/details/80537304

View File

@ -57,6 +57,8 @@ public class AppCommentController {
private VvCommentUserfulDao vvCommentUserfulDao;
/***
* 列表
*/
@ -68,7 +70,6 @@ public class AppCommentController {
// * 状态 待审批 wait_approval 待审批, approval_pass审批通过 , approval_not_pass 审批未通过如果审批未通过即自己可见但别人不可见
// */
// private String status;
if (appCommentRequest.getBuyerId() != null) {
pageUtils = PPageUtils.startPage(appCommentRequest.getPageNum(), appCommentRequest.getPageSize())
.doSelect(new ISelect() {
@ -83,6 +84,7 @@ public class AppCommentController {
}
});
} else {
pageUtils = PPageUtils.startPage(appCommentRequest.getPageNum(), appCommentRequest.getPageSize())
.doSelect(new ISelect() {
@Override
@ -95,8 +97,12 @@ public class AppCommentController {
}
});
}
List<VvCommentEntity> vvCommentEntities = pageUtils.getRows();
List<VvCommentEntity> vvCommentEntities = pageUtils.getRows();
List<VvCommentDTO> vvCommentDTOS = new ArrayList<>();
List<VvCommentDetailEntity> vvCommentDetailEntities = vvCommentDetailDao.selectVvCommentDetailByProductId(appCommentRequest.getProductId());
@ -143,11 +149,13 @@ 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());
VvTradeOrderLineEntity vvTradeOrderLineEntity = vvTradeOrderLineDao.selectVvTradeOrderLineById(appCommentRequest.getTradeOrderLineId());
vvCommentEntity.setTradeOrderId(vvTradeOrderLineEntity.getTradeOrderId());
vvCommentEntity.setSkuId(vvTradeOrderLineEntity.getSkuId());
VvSkuEntity vvSkuEntity = vvSkuDao.selectVvSkuById(vvTradeOrderLineEntity.getSkuId());
VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvSkuEntity.getProductId());
vvCommentEntity.setProductId(vvSkuEntity.getProductId());
@ -191,8 +199,8 @@ public class AppCommentController {
}
}
List<VvTradeOrderLineEntity> vvTradeOrderLineEntityList = vvTradeOrderLineDao.selectVvTradeOrderLineByTradeOrderIdSkuId(
appCommentRequest.getTradeOrderId(),
appCommentRequest.getSkuId()
vvTradeOrderLineEntity.getTradeOrderId(),
vvTradeOrderLineEntity.getSkuId()
);
for (VvTradeOrderLineEntity tradeOrderLineEntity : vvTradeOrderLineEntityList) {
tradeOrderLineEntity.setCommentId(vvCommentEntity.getId());

View File

@ -61,6 +61,8 @@ public class AppOrderController {
private VvBuyerAddressDao vvBuyerAddressDao;
/***
* https://api.1024api.com/api-interface/app/order/list
*
* 列表
*/
@RequestMapping("/list")