package com.zjrs.ggfw.sggfw.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.mohrss.leaf.core.framework.web.controller.AjaxResponse;
import com.zjrs.ggfw.sggfw.bpo.QueryBusinessBPO;
import com.zjrs.ggfw.sggfw.dto.GgcxDTO;
import com.zjrs.ggfw.sggfw.dto.TywtGrjbxxGgcx01DTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindingResult;
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;


@Api(tags = "省公共服务接口:查询业务信息")
@RestController
@RequestMapping("/api/sggfw/queryBusiness")
public class QueryBusinessController {
    private static final Logger LOG = LoggerFactory.getLogger(QueryBusinessController.class);
    @Resource
    private QueryBusinessBPO queryBusinessBPO;

    @ApiOperation(value = "个人基本信息查询")
    @PostMapping("/tywtGrjbxxGgcx01")
    public AjaxResponse tywtGrjbxxGgcx01(@RequestBody @Valid TywtGrjbxxGgcx01DTO dto, BindingResult bindingResult) {
        AjaxResponse ajaxResponse = new AjaxResponse();
        //校验入参
        if(bindingResult.hasErrors()) {
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg(bindingResult.getFieldError().getDefaultMessage());
            return ajaxResponse;
        }
        try {
            return queryBusinessBPO.tywtGrjbxxGgcx01(dto);
        } catch (Exception e) {
            e.printStackTrace();
            LOG.error(e.getMessage());
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg("系统异常");
        }
        return ajaxResponse;
    }
    @ApiOperation(value = "养老缴费信息查询")
    @PostMapping("/tywtZgsbGgcx01")
    public AjaxResponse tywtZgsbGgcx01(@RequestBody @Valid GgcxDTO dto, BindingResult bindingResult) {
        AjaxResponse ajaxResponse = new AjaxResponse();
        //校验入参
        if(bindingResult.hasErrors()) {
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg(bindingResult.getFieldError().getDefaultMessage());
            return ajaxResponse;
        }
        try {
            return queryBusinessBPO.tywtZgsbGgcx01(dto);
        } catch (Exception e) {
            e.printStackTrace();
            LOG.error(e.getMessage());
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg("系统异常");
        }
        return ajaxResponse;
    }
    @ApiOperation(value = "失业缴费信息查询")
    @PostMapping("/tywtZgsbGgcx02")
    public AjaxResponse tywtZgsbGgcx02(@RequestBody @Valid GgcxDTO dto, BindingResult bindingResult) {
        AjaxResponse ajaxResponse = new AjaxResponse();
        //校验入参
        if(bindingResult.hasErrors()) {
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg(bindingResult.getFieldError().getDefaultMessage());
            return ajaxResponse;
        }
        try {
            return queryBusinessBPO.tywtZgsbGgcx02(dto);
        } catch (Exception e) {
            e.printStackTrace();
            LOG.error(e.getMessage());
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg("系统异常");
        }
        return ajaxResponse;
    }
    @ApiOperation(value = "工伤缴费信息查询")
    @PostMapping("/tywtZgsbGgcx04")
    public AjaxResponse tywtZgsbGgcx04(@RequestBody @Valid GgcxDTO dto, BindingResult bindingResult) {
        AjaxResponse ajaxResponse = new AjaxResponse();
        //校验入参
        if(bindingResult.hasErrors()) {
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg(bindingResult.getFieldError().getDefaultMessage());
            return ajaxResponse;
        }
        try {
            return queryBusinessBPO.tywtZgsbGgcx04(dto);
        } catch (Exception e) {
            e.printStackTrace();
            LOG.error(e.getMessage());
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg("系统异常");
        }
        return ajaxResponse;
    }
    @ApiOperation(value = "职工养老发放信息查询")
    @PostMapping("/tywtZgylDycx01")
    public AjaxResponse tywtZgylDycx01(@RequestBody @Valid GgcxDTO dto, BindingResult bindingResult) {
        AjaxResponse ajaxResponse = new AjaxResponse();
        //校验入参
        if(bindingResult.hasErrors()) {
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg(bindingResult.getFieldError().getDefaultMessage());
            return ajaxResponse;
        }
        try {
            return queryBusinessBPO.tywtZgylDycx01(dto);
        } catch (Exception e) {
            e.printStackTrace();
            LOG.error(e.getMessage());
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg("系统异常");
        }
        return ajaxResponse;
    }
    @ApiOperation(value = "失业待遇发放信息查询")
    @PostMapping("/tywtSyeDycx03")
    public AjaxResponse tywtSyeDycx03(@RequestBody @Valid TywtGrjbxxGgcx01DTO dto, BindingResult bindingResult) {
        AjaxResponse ajaxResponse = new AjaxResponse();
        //校验入参
        if(bindingResult.hasErrors()) {
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg(bindingResult.getFieldError().getDefaultMessage());
            return ajaxResponse;
        }
        try {
            return queryBusinessBPO.tywtSyeDycx03(dto);
        } catch (Exception e) {
            e.printStackTrace();
            LOG.error(e.getMessage());
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg("系统异常");
        }
        return ajaxResponse;
    }
    @ApiOperation(value = "工伤待遇发放信息查询")
    @PostMapping("/tywtGsDycx05")
    public AjaxResponse tywtGsDycx05(@RequestBody @Valid GgcxDTO dto, BindingResult bindingResult) {
        AjaxResponse ajaxResponse = new AjaxResponse();
        //校验入参
        if(bindingResult.hasErrors()) {
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg(bindingResult.getFieldError().getDefaultMessage());
            return ajaxResponse;
        }
        try {
            return queryBusinessBPO.tywtGsDycx05(dto);
        } catch (Exception e) {
            e.printStackTrace();
            LOG.error(e.getMessage());
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg("系统异常");
        }
        return ajaxResponse;
    }
    @ApiOperation(value = "个人基本信息查询")
    @PostMapping("/queryJbxx")
    public AjaxResponse queryJbxx(@RequestBody @Valid TywtGrjbxxGgcx01DTO dto, BindingResult bindingResult) {
        AjaxResponse ajaxResponse = new AjaxResponse();
        //校验入参
        if(bindingResult.hasErrors()) {
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg(bindingResult.getFieldError().getDefaultMessage());
            return ajaxResponse;
        }
        try {
            return queryBusinessBPO.queryJbxx(dto);
        } catch (Exception e) {
            e.printStackTrace();
            LOG.error(e.getMessage());
            ajaxResponse.setAppcode("1");
            ajaxResponse.setErrorMsg("系统异常");
        }
        return ajaxResponse;
    }
}
