package com.usky.fire.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.fire.service.BscLawTrendService;
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;

/**
 * <p>
 * 消防执法动态大屏统计 前端控制器
 * </p>
 *
 * @author JCB
 * @since 2022-10-13
 */
@RestController
@RequestMapping("/bscLawTrend")
public class BscLawTrendController {

    @Autowired
    private BscLawTrendService bscLawTrendService;

    /**
     * 消防执法动态-数据查询
     *
     * @param moduleType 模块类型(monthLaw:当月执法情况 adstraLicense:行政许可情况 reportComplaint:消防隐患举报投诉 complaintHandle:投诉处理情况)
     * @param startDate      开始时间 格式：yyyy-MM-dd HH:mm:ss
     * @param endDate        结束时间 格式：yyyy-MM-dd HH:mm:ss
     * @return
     */
    @GetMapping("lawTrendList")
    public ApiResult<Object> lawTrendList(@RequestParam(value = "moduleType") String moduleType,
                                          @RequestParam(value = "startDate", required = false) String startDate,
                                          @RequestParam(value = "endDate", required = false) String endDate) {
        return ApiResult.success(bscLawTrendService.lawTrendList(moduleType, startDate, endDate));
    }

    /**
     * 消防执法动态-单位撒点详情数据
     *
     * @param companyId 单位ID
     * @return
     */
    @GetMapping("companyData")
    public ApiResult<List<Map<String, Object>>> companyData(@RequestParam(value = "companyId") String companyId,
                                                            @RequestParam(value = "companyName") String companyName) {
        return ApiResult.success(bscLawTrendService.companyData(companyId, companyName));
    }

    @GetMapping("monthLaw")
    public ApiResult<Void> monthLaw() {
        bscLawTrendService.lawEnforcement();
        return ApiResult.success();
    }

}

