Merge remote-tracking branch 'origin/wzj-main' into wzj-main
This commit is contained in:
commit
5c0907bfb9
@ -3,7 +3,7 @@
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="ruoyi/ruoyi-server:5.3.1" />
|
||||
<option name="buildOnly" value="true" />
|
||||
<option name="containerName" value="" />
|
||||
<option name="sourceFilePath" value="ruoyi-admin/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
|
@ -22,7 +22,7 @@
|
||||
<module>ruoyi-im</module>
|
||||
<module>ruoyi-auth</module>
|
||||
<module>ruoyi-transaction</module>
|
||||
<!-- <module>ruoyi-statistics</module>-->
|
||||
<module>ruoyi-statistics</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
|
@ -26,6 +26,10 @@
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-member</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-order</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-content</artifactId>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.wzj.soopin.statistics.aop;
|
||||
|
||||
import cn.lili.modules.statistics.aop.enums.PageViewEnum;
|
||||
|
||||
import com.wzj.soopin.statistics.aop.enums.PageViewEnum;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@ -10,6 +11,7 @@ import java.lang.annotation.*;
|
||||
* @author Bulbasaur
|
||||
* @since 2021/7/9 1:47 上午
|
||||
*/
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
|
@ -1,15 +1,9 @@
|
||||
package com.wzj.soopin.statistics.aop.aspect;
|
||||
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.common.context.ThreadContextHolder;
|
||||
import cn.lili.common.utils.IpUtils;
|
||||
import cn.lili.common.utils.SpelUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.vos.GoodsSkuVO;
|
||||
import cn.lili.modules.statistics.aop.PageViewPoint;
|
||||
import cn.lili.modules.statistics.aop.enums.PageViewEnum;
|
||||
import cn.lili.modules.statistics.util.StatisticsSuffix;
|
||||
|
||||
import com.wzj.soopin.statistics.aop.PageViewPoint;
|
||||
import com.wzj.soopin.statistics.aop.enums.PageViewEnum;
|
||||
import jakarta.persistence.Cache;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
@ -28,8 +22,8 @@ import java.util.Map;
|
||||
* @author Chopper
|
||||
* @since 2021-01-14 18:01
|
||||
*/
|
||||
@Aspect
|
||||
@Configuration
|
||||
//@Aspect
|
||||
//@Configuration
|
||||
@Slf4j
|
||||
public class PageViewInterceptor {
|
||||
|
||||
@ -38,54 +32,54 @@ public class PageViewInterceptor {
|
||||
|
||||
|
||||
|
||||
@AfterReturning(returning = "rvt", pointcut = "@annotation(cn.lili.modules.statistics.aop.PageViewPoint)")
|
||||
// @AfterReturning(returning = "rvt", pointcut = "@annotation(cn.lili.modules.statistics.aop.PageViewPoint)")
|
||||
public void interceptor(JoinPoint point, Object rvt) {
|
||||
MethodSignature signature = (MethodSignature) point.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
PageViewPoint pageViewPoint = method.getAnnotation(PageViewPoint.class);
|
||||
PageViewEnum pageViewEnum = pageViewPoint.type();
|
||||
//store id 为-1 代表平台访问
|
||||
String storeId;
|
||||
//商品访问
|
||||
String goodsId = null;
|
||||
|
||||
switch (pageViewEnum) {
|
||||
case SKU:
|
||||
ResultMessage<Map<String, Object>> skuRvt = (ResultMessage<Map<String, Object>>) rvt;
|
||||
if (skuRvt != null && skuRvt.getResult() != null && skuRvt.getResult().containsKey("data")) {
|
||||
GoodsSkuVO goodsSkuDetail = (GoodsSkuVO) skuRvt.getResult().get("data");
|
||||
storeId = goodsSkuDetail.getStoreId();
|
||||
goodsId = goodsSkuDetail.getGoodsId();
|
||||
break;
|
||||
}
|
||||
case STORE:
|
||||
Map<String, String> map = null;
|
||||
try {
|
||||
map = spelFormat(point);
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
storeId = map.get("id");
|
||||
break;
|
||||
default:
|
||||
storeId = "-1";
|
||||
}
|
||||
String ip = IpUtils.getIpAddress(ThreadContextHolder.getHttpRequest());
|
||||
try {
|
||||
//PV 统计48小时过期 留下一定时间予以统计累计数据库
|
||||
cache.incr(CachePrefix.PV.getPrefix() + StatisticsSuffix.suffix(), 60 * 60 * 48);
|
||||
|
||||
//平台UV统计
|
||||
cache.cumulative(CachePrefix.UV.getPrefix() + StatisticsSuffix.suffix(), ip);
|
||||
|
||||
//PV 统计48小时过期 留下一定时间予以统计累计数据库
|
||||
cache.incr(CachePrefix.STORE_PV.getPrefix() + StatisticsSuffix.suffix(storeId), 60 * 60 * 48);
|
||||
|
||||
//店铺UV 统计,则需要对id去重复,所以如下处理
|
||||
cache.cumulative(CachePrefix.STORE_UV.getPrefix() + StatisticsSuffix.suffix(storeId), ip);
|
||||
} catch (Exception e) {
|
||||
log.error("页面出错", e);
|
||||
}
|
||||
// PageViewEnum pageViewEnum = pageViewPoint.type();
|
||||
// //store id 为-1 代表平台访问
|
||||
// String storeId;
|
||||
// //商品访问
|
||||
// String goodsId = null;
|
||||
//
|
||||
// switch (pageViewEnum) {
|
||||
// case SKU:
|
||||
// ResultMessage<Map<String, Object>> skuRvt = (ResultMessage<Map<String, Object>>) rvt;
|
||||
// if (skuRvt != null && skuRvt.getResult() != null && skuRvt.getResult().containsKey("data")) {
|
||||
// GoodsSkuVO goodsSkuDetail = (GoodsSkuVO) skuRvt.getResult().get("data");
|
||||
// storeId = goodsSkuDetail.getStoreId();
|
||||
// goodsId = goodsSkuDetail.getGoodsId();
|
||||
// break;
|
||||
// }
|
||||
// case STORE:
|
||||
// Map<String, String> map = null;
|
||||
// try {
|
||||
// map = spelFormat(point);
|
||||
// } catch (Exception e) {
|
||||
// return;
|
||||
// }
|
||||
// storeId = map.get("id");
|
||||
// break;
|
||||
// default:
|
||||
// storeId = "-1";
|
||||
// }
|
||||
// String ip = IpUtils.getIpAddress(ThreadContextHolder.getHttpRequest());
|
||||
// try {
|
||||
// //PV 统计48小时过期 留下一定时间予以统计累计数据库
|
||||
// cache.incr(CachePrefix.PV.getPrefix() + StatisticsSuffix.suffix(), 60 * 60 * 48);
|
||||
//
|
||||
// //平台UV统计
|
||||
// cache.cumulative(CachePrefix.UV.getPrefix() + StatisticsSuffix.suffix(), ip);
|
||||
//
|
||||
// //PV 统计48小时过期 留下一定时间予以统计累计数据库
|
||||
// cache.incr(CachePrefix.STORE_PV.getPrefix() + StatisticsSuffix.suffix(storeId), 60 * 60 * 48);
|
||||
//
|
||||
// //店铺UV 统计,则需要对id去重复,所以如下处理
|
||||
// cache.cumulative(CachePrefix.STORE_UV.getPrefix() + StatisticsSuffix.suffix(storeId), ip);
|
||||
// } catch (Exception e) {
|
||||
// log.error("页面出错", e);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -101,8 +95,8 @@ public class PageViewInterceptor {
|
||||
Map<String, String> result = new HashMap<>(2);
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
PageViewPoint pageViewPoint = signature.getMethod().getAnnotation(PageViewPoint.class);
|
||||
String id = SpelUtil.compileParams(joinPoint, pageViewPoint.id());
|
||||
result.put("id", id);
|
||||
// String id = SpelUtil.compileParams(joinPoint, pageViewPoint.id());
|
||||
// result.put("id", id);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user