Merge remote-tracking branch 'origin/wzj-main' into wzj-main

This commit is contained in:
huk 2025-09-18 11:16:43 +08:00
commit 5c0907bfb9
5 changed files with 61 additions and 61 deletions

View File

@ -3,7 +3,7 @@
<deployment type="dockerfile"> <deployment type="dockerfile">
<settings> <settings>
<option name="imageTag" value="ruoyi/ruoyi-server:5.3.1" /> <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" /> <option name="sourceFilePath" value="ruoyi-admin/Dockerfile" />
</settings> </settings>
</deployment> </deployment>

View File

@ -22,7 +22,7 @@
<module>ruoyi-im</module> <module>ruoyi-im</module>
<module>ruoyi-auth</module> <module>ruoyi-auth</module>
<module>ruoyi-transaction</module> <module>ruoyi-transaction</module>
<!-- <module>ruoyi-statistics</module>--> <module>ruoyi-statistics</module>
</modules> </modules>
<artifactId>ruoyi-modules</artifactId> <artifactId>ruoyi-modules</artifactId>

View File

@ -26,6 +26,10 @@
<groupId>org.dromara</groupId> <groupId>org.dromara</groupId>
<artifactId>ruoyi-member</artifactId> <artifactId>ruoyi-member</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-order</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.dromara</groupId> <groupId>org.dromara</groupId>
<artifactId>ruoyi-content</artifactId> <artifactId>ruoyi-content</artifactId>

View File

@ -1,6 +1,7 @@
package com.wzj.soopin.statistics.aop; 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.*; import java.lang.annotation.*;
@ -10,6 +11,7 @@ import java.lang.annotation.*;
* @author Bulbasaur * @author Bulbasaur
* @since 2021/7/9 1:47 上午 * @since 2021/7/9 1:47 上午
*/ */
@Target({ElementType.PARAMETER, ElementType.METHOD}) @Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented

View File

@ -1,15 +1,9 @@
package com.wzj.soopin.statistics.aop.aspect; package com.wzj.soopin.statistics.aop.aspect;
import cn.lili.cache.Cache;
import cn.lili.cache.CachePrefix; import com.wzj.soopin.statistics.aop.PageViewPoint;
import cn.lili.common.context.ThreadContextHolder; import com.wzj.soopin.statistics.aop.enums.PageViewEnum;
import cn.lili.common.utils.IpUtils; import jakarta.persistence.Cache;
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 lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterReturning;
@ -28,8 +22,8 @@ import java.util.Map;
* @author Chopper * @author Chopper
* @since 2021-01-14 18:01 * @since 2021-01-14 18:01
*/ */
@Aspect //@Aspect
@Configuration //@Configuration
@Slf4j @Slf4j
public class PageViewInterceptor { 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) { public void interceptor(JoinPoint point, Object rvt) {
MethodSignature signature = (MethodSignature) point.getSignature(); MethodSignature signature = (MethodSignature) point.getSignature();
Method method = signature.getMethod(); Method method = signature.getMethod();
PageViewPoint pageViewPoint = method.getAnnotation(PageViewPoint.class); PageViewPoint pageViewPoint = method.getAnnotation(PageViewPoint.class);
PageViewEnum pageViewEnum = pageViewPoint.type(); // PageViewEnum pageViewEnum = pageViewPoint.type();
//store id -1 代表平台访问 // //store id -1 代表平台访问
String storeId; // String storeId;
//商品访问 // //商品访问
String goodsId = null; // String goodsId = null;
//
switch (pageViewEnum) { // switch (pageViewEnum) {
case SKU: // case SKU:
ResultMessage<Map<String, Object>> skuRvt = (ResultMessage<Map<String, Object>>) rvt; // ResultMessage<Map<String, Object>> skuRvt = (ResultMessage<Map<String, Object>>) rvt;
if (skuRvt != null && skuRvt.getResult() != null && skuRvt.getResult().containsKey("data")) { // if (skuRvt != null && skuRvt.getResult() != null && skuRvt.getResult().containsKey("data")) {
GoodsSkuVO goodsSkuDetail = (GoodsSkuVO) skuRvt.getResult().get("data"); // GoodsSkuVO goodsSkuDetail = (GoodsSkuVO) skuRvt.getResult().get("data");
storeId = goodsSkuDetail.getStoreId(); // storeId = goodsSkuDetail.getStoreId();
goodsId = goodsSkuDetail.getGoodsId(); // goodsId = goodsSkuDetail.getGoodsId();
break; // break;
} // }
case STORE: // case STORE:
Map<String, String> map = null; // Map<String, String> map = null;
try { // try {
map = spelFormat(point); // map = spelFormat(point);
} catch (Exception e) { // } catch (Exception e) {
return; // return;
} // }
storeId = map.get("id"); // storeId = map.get("id");
break; // break;
default: // default:
storeId = "-1"; // storeId = "-1";
} // }
String ip = IpUtils.getIpAddress(ThreadContextHolder.getHttpRequest()); // String ip = IpUtils.getIpAddress(ThreadContextHolder.getHttpRequest());
try { // try {
//PV 统计48小时过期 留下一定时间予以统计累计数据库 // //PV 统计48小时过期 留下一定时间予以统计累计数据库
cache.incr(CachePrefix.PV.getPrefix() + StatisticsSuffix.suffix(), 60 * 60 * 48); // cache.incr(CachePrefix.PV.getPrefix() + StatisticsSuffix.suffix(), 60 * 60 * 48);
//
//平台UV统计 // //平台UV统计
cache.cumulative(CachePrefix.UV.getPrefix() + StatisticsSuffix.suffix(), ip); // cache.cumulative(CachePrefix.UV.getPrefix() + StatisticsSuffix.suffix(), ip);
//
//PV 统计48小时过期 留下一定时间予以统计累计数据库 // //PV 统计48小时过期 留下一定时间予以统计累计数据库
cache.incr(CachePrefix.STORE_PV.getPrefix() + StatisticsSuffix.suffix(storeId), 60 * 60 * 48); // cache.incr(CachePrefix.STORE_PV.getPrefix() + StatisticsSuffix.suffix(storeId), 60 * 60 * 48);
//
//店铺UV 统计则需要对id去重复所以如下处理 // //店铺UV 统计则需要对id去重复所以如下处理
cache.cumulative(CachePrefix.STORE_UV.getPrefix() + StatisticsSuffix.suffix(storeId), ip); // cache.cumulative(CachePrefix.STORE_UV.getPrefix() + StatisticsSuffix.suffix(storeId), ip);
} catch (Exception e) { // } catch (Exception e) {
log.error("页面出错", e); // log.error("页面出错", e);
} // }
} }
@ -101,8 +95,8 @@ public class PageViewInterceptor {
Map<String, String> result = new HashMap<>(2); Map<String, String> result = new HashMap<>(2);
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); MethodSignature signature = (MethodSignature) joinPoint.getSignature();
PageViewPoint pageViewPoint = signature.getMethod().getAnnotation(PageViewPoint.class); PageViewPoint pageViewPoint = signature.getMethod().getAnnotation(PageViewPoint.class);
String id = SpelUtil.compileParams(joinPoint, pageViewPoint.id()); // String id = SpelUtil.compileParams(joinPoint, pageViewPoint.id());
result.put("id", id); // result.put("id", id);
return result; return result;
} }
} }