package com.tofly.feesapi.sfgl.controller;

import com.tofly.feesapi.common.core.ResultRespone;
import com.tofly.common.core.util.StringUtil;
import com.tofly.feesapi.common.exception.FeesErrorCode;
import com.tofly.feesapi.common.exception.FeesException;
import com.tofly.feesapi.sfgl.service.YyPjbhService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

@RestController
@RequestMapping("/yypjbh")
@Api(tags = "票据编号表接口")
public class YyPjbhController {

    @Autowired
    private YyPjbhService yyPjbhService;

    @ApiOperation(value = "获取票据号")
    @GetMapping
    @ApiImplicitParams({
            @ApiImplicitParam(name = "sfrybm", value = "收费人员编码", required = true, dataType = "String")
    })
    public ResultRespone getPjh(String sfrybm) {
        if (StringUtil.isEmpty(sfrybm)) {
            throw new FeesException("收费人员编码不能为空！", FeesErrorCode.BUSINESS_ERROR);
        }
        return ResultRespone.success(yyPjbhService.getPjh(sfrybm));
    }

}
