zxl
2025-10-16 79b026c753c25f998776d8a6210fc6afab97e647
manager-api/src/main/java/cn/lili/controller/lmk/StatisticsController.java
@@ -13,6 +13,7 @@
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;
@@ -28,7 +29,7 @@
 * @date : 2025-09-16 16:36
 **/
@RestController
@AllArgsConstructor
@RequiredArgsConstructor
@RequestMapping("/manager/lmk/statistics")
public class StatisticsController {
    private final OrderService orderService;
@@ -38,44 +39,8 @@
    @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")
@@ -105,4 +70,14 @@
        return orderService.getOrderTimePeriod(queryParam);
    }
    /**
     * 商品复购率
     * @param queryParam
     * @return
     */
    @GetMapping("/productRepurchase")
    public Result gerProductRepurchase(StatisticsQueryParam queryParam){
        return orderService.gerProductRepurchase(queryParam);
    }
}