YPZ 3 týždňov pred
rodič
commit
49cc5c9d35

+ 34 - 0
java/storlead-sasa/storlead-trade/src/main/java/com/storlead/trade/controller/CustomerAiAnalysisController.java

@@ -3,6 +3,7 @@ package com.storlead.trade.controller;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.storlead.framework.common.constant.CommonConstant;
 import com.storlead.framework.common.result.Result;
 import com.storlead.trade.dto.CustomerAnalysisResultDTO;
 import com.storlead.trade.dto.CustomerSingleAnalysisRequestDTO;
@@ -19,7 +20,11 @@ import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.time.temporal.WeekFields;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 @RestController
@@ -141,4 +146,33 @@ public class CustomerAiAnalysisController {
         }
         return Result.result(statistics);
     }
+
+    @GetMapping("/customer-group/stats")
+    @ApiOperation("目标客户群统计数据")
+    public Result<Object> customerGroupStats() {
+        Map<String, Object> result = new HashMap<>();
+        
+        // 全部潜客 - 查询总数(排除已删除)
+        LambdaQueryWrapper<CustomerAnalysisResultEntity> totalWrapper = new LambdaQueryWrapper<>();
+        totalWrapper.eq(CustomerAnalysisResultEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
+        long totalCustomers = customerAnalysisResultEntityService.count(totalWrapper);
+        result.put("totalCustomers", totalCustomers);
+        
+        // 本周新增 - 查询本周创建的数据(排除已删除)
+        LocalDateTime now = LocalDateTime.now();
+        LocalDateTime weekStart = now.with(WeekFields.of(Locale.getDefault()).dayOfWeek(), 1).toLocalDate().atStartOfDay();
+        LambdaQueryWrapper<CustomerAnalysisResultEntity> weekWrapper = new LambdaQueryWrapper<>();
+        weekWrapper.eq(CustomerAnalysisResultEntity::getIsDelete, CommonConstant.DEL_FLAG_0)
+                   .ge(CustomerAnalysisResultEntity::getCreateTime, weekStart);
+        long weeklyNew = customerAnalysisResultEntityService.count(weekWrapper);
+        result.put("weeklyNew", weeklyNew);
+        
+        // 高评分客户 - 默认值
+        result.put("highScoreCustomers", 124);
+        
+        // 沉默客户 - 默认值
+        result.put("silentCustomers", 89);
+        
+        return Result.result(result);
+    }
 }

+ 14 - 0
java/storlead-sasa/storlead-trade/src/main/java/com/storlead/trade/controller/MarketingController.java

@@ -6,6 +6,7 @@ import com.storlead.framework.common.result.Result;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
@@ -66,4 +67,17 @@ public class MarketingController {
         return Result.ok();
     }
 
+    @GetMapping("/dashboard/stats")
+    @ApiOperation("营销: 仪表盘统计数据")
+    public Result<Object> dashboardStats() {
+        return Result.result(new java.util.HashMap<String, Object>() {{
+            put("monthlySent", "2.8K");
+            put("avgOpenRate", "45%");
+            put("clickRate", "12%");
+            put("replyRate", "8%");
+            put("protectedCustomers", 156);
+            put("pendingReview", 23);
+        }});
+    }
+
 }