package cn.estsh.i3plus.ext.mes.apiservice.controller.base.ep;

import cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.ep.EpBaseBusiReportService;
import cn.estsh.i3plus.ext.mes.pojo.model.ep.EpPartDivulgeCheckRecordModel;
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ResultBean;
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.RestController;

/**
 * @PROJECT_NAME: i3plus-mes-panasonic-dev
 * @DESCRIPTION:
 * @USER: xinwang.yi
 * @DATE: 2021-12-20 14:33
 */
@RestController
@Api(tags = "基础报表")
@RequestMapping(CommonConstWords.BASE_URL_MES + "/ep-ext/report")
public class EpBaseBusiReportController {

    @Autowired
    private EpBaseBusiReportService baseBusiReportService;

    @GetMapping("/part-divulge-check-record/query")
    public ResultBean queryPartDivulgeCheckRecord(EpPartDivulgeCheckRecordModel partDivulgeCheckRecordModel , Pager pager){
        try {
            //请求参数非空
            if (null == partDivulgeCheckRecordModel || null == pager) {
                return ResultBean.fail("请求参数不完整");
            }
            return ResultBean.success("查询成功").setListPager(baseBusiReportService.queryPartDivulgeCheckRecord(partDivulgeCheckRecordModel,pager))
                    .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
        } catch (ImppBusiException imppException) {
            return ResultBean.fail(imppException);
        } catch (Exception e) {
            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
        }
    }

}
