package com.zjrs.zwnw.fxfk.controller;

import feign.Util;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.mohrss.leaf.core.framework.web.controller.AjaxResponse;
import com.zjrs.zwnw.fxfk.bpo.YcywjkBPO;
import com.zjrs.zwnw.fxfk.dto.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.util.Map;

@Api("异常业务监控")
@RestController
@RequestMapping("/api/fxfk/ycywjk")
public class YcywjkController {
    private static final Logger LOG = LoggerFactory.getLogger(YcywjkController.class);

    @Resource
    private YcywjkBPO ycywjkBPO;

    /**
     * 异常业务监控总接口
     *
     * @return
     */
    @ApiOperation(value = "异常业务监控总接口", notes = "异常业务监控总接口")
    @PostMapping("/getAll")
    public AjaxResponse getAll(@RequestBody YcywTjInputDTO dto) {
        LOG.info("异常业务监控总接口开始");
        AjaxResponse ajaxResponse = new AjaxResponse();
        if(Util.isBlank(dto.getSsdq())){
            dto.setSsdq("440800");
        }
        try {
            Map<String,Object> resultMap = ycywjkBPO.getAll(dto);
            ajaxResponse.setData("data", resultMap);
        } catch (Exception e) {
            LOG.error(e.getMessage());
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg("系统异常");
        }
        LOG.info("异常业务监控总接口结束");
        return ajaxResponse;
    }

}
