package com.gci.boot.modules.vehicles.controller;

import cn.hutool.core.collection.CollectionUtil;
import com.gci.boot.common.log.annotation.AddSysLog;
import com.gci.boot.common.vo.Result;

import com.gci.boot.modules.vehicles.service.BacklogService;
import com.gci.boot.modules.vehicles.vo.BacklogStatisVO;
import com.gci.boot.modules.vehicles.vo.RepairInfoListVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Api(tags="待办")
@Slf4j
@RestController
@RequestMapping("/vehicles/backlog")
public class BacklogController {
    @Autowired
    private BacklogService backlogService;

    @PostMapping(value = "/test")
    public Result<?> test() {
        Map<String, List<Integer>> object = backlogService.getUserBacklogButton();
        return Result.ok(object);
    }

    //1出险 2违章 3事故 4维修 5_保养台账 6年检 7_保养计划
    @AddSysLog("PC待办-获取对应tab分页")
    @GetMapping(value = "/getBacklogPage")
    public Result<?> getBacklogPage(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                @RequestParam(name = "type", defaultValue = "1") String type,
                                HttpServletRequest req) {
        return backlogService.getBacklogPageList(pageNo,pageSize,type,req);
    }

    @AddSysLog("PC待办-数量查询")
    @GetMapping(value = "/getBacklogStatis")
    public Result<?> getBacklogCount(HttpServletRequest req) {
        List<BacklogStatisVO> result = backlogService.getBacklogStatis(req);
        return Result.ok(result);
    }
}
