zxl
2025-10-16 79b026c753c25f998776d8a6210fc6afab97e647
manager-api/src/main/java/cn/lili/controller/lmk/StatisticsController.java
@@ -6,12 +6,14 @@
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.lmk.domain.vo.PvUvVO;
import cn.lili.modules.lmk.enums.general.StatisticsSearchTypeEnum;
import cn.lili.modules.member.service.FootprintService;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
import cn.lili.modules.statistics.entity.vo.PlatformViewVO;
import cn.lili.modules.statistics.service.PlatformViewService;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -27,52 +29,18 @@
 * @date : 2025-09-16 16:36
 **/
@RestController
@AllArgsConstructor
@RequiredArgsConstructor
@RequestMapping("/manager/lmk/statistics")
public class StatisticsController {
    private final OrderService orderService;
    private final FootprintService footprintService;
    @ApiOperation(value = "获取pv、uv流量数据 表单获取")
    @GetMapping("/pvUv")
    public Result getPVUVData(StatisticsQueryParam queryParam) {
        //TODO 获得 pv/uv数据
        PvUvVO pvUvVO = new PvUvVO();
        List<Long> pvData = new ArrayList<>();
        List<Long> uvData = new ArrayList<>();
        switch (queryParam.getSearchType()) {
            case "TODAY":
                // 今天的数据:添加1
                pvData.add(1L);
                uvData.add(9L);
                break;
            case "YESTERDAY":
                // 明天的数据:添加1
                pvData.add(1L);
                uvData.add(10L);
                break;
            case "LAST_SEVEN":
                // 过去七天的数据:添加1, 2, 3
                for(int i =1;i<=7;i++){
                    pvData.add((long) i);
                    uvData.add((long) i+7);
                }
                break;
            case "LAST_THIRTY":
                // 过去一个月的数据:可以根据需要自定义,这里示例添加1到5
                for(int i =1;i<=30;i++){
                    pvData.add((long) i);
                    uvData.add((long) i+7);
                }
                break;
        }
        pvUvVO.setPvData(pvData);
        pvUvVO.setUvData(uvData);
        return Result.ok().data(pvUvVO);
        return orderService.getPvUv(queryParam);
    }
    @GetMapping("/orderCount")
@@ -81,4 +49,35 @@
    }
    /**
     * 视频/商品 完播率和浏览量统计
     * @param queryParam
     * @return
     */
    @GetMapping("/viewAndCompletionRateCount")
    public Result getViewAndCompletionRateCount(StatisticsQueryParam queryParam) {
        return footprintService.getViewAndCompletionRateCount(queryParam);
    }
    /**
     * 浏览数据和下订单时间段分析
     * @param queryParam
     * @return
     */
    @GetMapping("/orderTimePeriod")
    public Result getOrderTimePeriod(StatisticsQueryParam queryParam) {
        return orderService.getOrderTimePeriod(queryParam);
    }
    /**
     * 商品复购率
     * @param queryParam
     * @return
     */
    @GetMapping("/productRepurchase")
    public Result gerProductRepurchase(StatisticsQueryParam queryParam){
        return orderService.gerProductRepurchase(queryParam);
    }
}