package com.hotent.enterpriseDeclare.controller;


import com.hotent.base.annotation.ApiGroup;
import com.hotent.base.constants.ApiGroupConsts;
import com.hotent.base.model.CommonResult;
import com.hotent.project.manager.CostProjectTaskManager;
import com.hotent.project.model.CostNotice;
import com.hotent.project.model.CostProjectTask;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Api(tags = "首页")
@RestController
@RequestMapping("/api/enterprise/home/")
@ApiGroup(group = {ApiGroupConsts.GROUP_COST})
public class HomeController {


    @Autowired
    private CostProjectTaskManager costProjectTaskManager;


    /**
     * 办理统计
     */
    @GetMapping(value = "/doChartList")
    public CommonResult<List<Map<String, Object>>> getDoChartList(
            @RequestParam(required = false) String year,
            @RequestParam(required = false) String region
    ) {
        return CommonResult.<List<Map<String, Object>>>ok().value(costProjectTaskManager.getDoChartList(year,region));
    }


    /**
     * 消息接口
     */
    @GetMapping(value = "/doMsgList")
    public CommonResult<List<CostNotice>> getDoMsgList() {
        return CommonResult.<List<CostNotice>>ok().value(costProjectTaskManager.getDoMsgList());

    }

    /**
     * 代办
     */
    @GetMapping(value = "/doList")
    public CommonResult<List<CostProjectTask>> getDoList(@RequestParam(required = false) String projectId) {
        return CommonResult.<List<CostProjectTask>>ok().value(costProjectTaskManager.getDoList(projectId));
    }


}
