|
@@ -3,6 +3,7 @@ package com.storlead.trade.controller;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
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.framework.common.result.Result;
|
|
|
import com.storlead.trade.dto.CustomerAnalysisResultDTO;
|
|
import com.storlead.trade.dto.CustomerAnalysisResultDTO;
|
|
|
import com.storlead.trade.dto.CustomerSingleAnalysisRequestDTO;
|
|
import com.storlead.trade.dto.CustomerSingleAnalysisRequestDTO;
|
|
@@ -19,7 +20,11 @@ import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
|
+import java.time.temporal.WeekFields;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Locale;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@@ -141,4 +146,33 @@ public class CustomerAiAnalysisController {
|
|
|
}
|
|
}
|
|
|
return Result.result(statistics);
|
|
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);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|