Ver código fonte

二手风控

qrs 1 mês atrás
pai
commit
b11786f8ea

+ 0 - 5
alien-gateway/pom.xml

@@ -196,11 +196,6 @@
             <artifactId>jaxb-api</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>shop.alien</groupId>
-            <artifactId>alien-config</artifactId>
-            <version>1.0.0</version>
-        </dependency>
 
     </dependencies>
 

+ 1 - 1
alien-gateway/src/main/java/shop/alien/gateway/AlienGatewayApplication.java

@@ -13,7 +13,7 @@ import org.springframework.context.annotation.ComponentScan;
  * @version 1.0
  * @date 2025/1/21 16:58
  */
-@ComponentScan({"shop.alien.gateway.*", "shop.alien.config.properties"})
+@ComponentScan({"shop.alien.gateway.*"})
 @MapperScan(basePackages = {"shop.alien.gateway.mapper", "shop.alien.mapper"})
 @EnableFeignClients(basePackages = "shop.alien.gateway.feign")
 @SpringBootApplication

+ 120 - 0
alien-gateway/src/main/java/shop/alien/gateway/config/RiskControlProperties.java

@@ -0,0 +1,120 @@
+package shop.alien.gateway.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+@RefreshScope
+@ConfigurationProperties(prefix = "risk-control")
+public class RiskControlProperties {
+
+    /**
+     * 洗钱嫌疑规则配置
+     */
+    private MoneyLaundering moneyLaundering = new MoneyLaundering();
+
+    /**
+     * 账号异常规则配置
+     */
+    private AccountAbnormal accountAbnormal = new AccountAbnormal();
+
+    /**
+     * 交易欺诈规则配置
+     */
+    private TradeFraud tradeFraud = new TradeFraud();
+
+    /**
+     * 异常发布规则配置
+     */
+    private AbnormalPublish abnormalPublish = new AbnormalPublish();
+
+    @Data
+    public static class MoneyLaundering {
+        /**
+         * 每天交易次数阈值
+         */
+        private int dailyCount = 5;
+
+        /**
+         * 每笔交易金额阈值(元)
+         */
+        private double amountThreshold = 200.0;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "洗钱嫌疑";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "高频高价交易";
+    }
+
+    @Data
+    public static class AccountAbnormal {
+        /**
+         * 24小时内同一设备/mac注册账号数量阈值
+         */
+        private int regCount24h = 3;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "账号异常";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "同一设备24小时内注册超过3个账号";
+    }
+
+    @Data
+    public static class TradeFraud {
+        /**
+         * 24小时内发布成功记录次数阈值
+         */
+        private int publishCount24h = 3;
+
+        /**
+         * 时间窗口(小时)
+         */
+        private int timeWindowHours = 24;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "交易欺诈";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "用户频繁修改商品";
+    }
+
+    @Data
+    public static class AbnormalPublish {
+        /**
+         * 24小时内发布同类商品数量阈值
+         */
+        private int sameCategoryCount24h = 10;
+        
+        /**
+         * 时间窗口(小时)
+         */
+        private int timeWindowHours = 24;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "异常发布";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "短时间大量发布同类商品";
+    }
+}

+ 1 - 1
alien-gateway/src/main/java/shop/alien/gateway/service/LifeUserService.java

@@ -9,12 +9,12 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
-import shop.alien.config.properties.RiskControlProperties;
 import shop.alien.entity.second.LifeUserLog;
 import shop.alien.entity.second.SecondRiskControlRecord;
 import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.vo.LifeUserVo;
 import shop.alien.gateway.config.BaseRedisService;
+import shop.alien.gateway.config.RiskControlProperties;
 import shop.alien.gateway.feign.SecondServiceFeign;
 import shop.alien.gateway.mapper.LifeUserLogGatewayMapper;
 import shop.alien.gateway.mapper.LifeUserGatewayMapper;