package com.yem.wm.syn.eas.api.controller;

import com.alibaba.fastjson.JSONArray;
import com.yem.wm.syn.eas.api.dto.BillTypeAddNewDTO;
import com.yem.wm.syn.eas.api.service.IBillTypeService;
import com.yem.wm.syn.eas.api.service.impl.BillTypeServiceImpl;
import kd.bos.openapi.common.custom.annotation.ApiController;
import kd.bos.openapi.common.custom.annotation.ApiParam;
import kd.bos.openapi.common.custom.annotation.ApiPostMapping;
import kd.bos.openapi.common.result.CustomApiResult;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;

import javax.validation.Valid;
import java.io.IOException;

/**
 * @author 涛
 * @date 2023/10/26
 * 价格库接口
 */
@ApiController(value = "bos", desc = "")
public class BillTypeController {
    @ApiPostMapping("/addNew/billType")
    public CustomApiResult<Object> addNew(@NotNull @ApiParam("add") @Valid BillTypeAddNewDTO billTypeAddNewDTO) throws IOException {
        try {
            IBillTypeService service = new BillTypeServiceImpl();
            service.addNew(billTypeAddNewDTO);
        }catch (Exception e){
            CustomApiResult<Object> fail = CustomApiResult.fail("501", e.getMessage());
            return fail;
        }
        CustomApiResult<Object> ces = CustomApiResult.success("成功");
        return ces;
    }
}
