package com.gszc.controller; import com.gszc.build.Result; import com.gszc.build.ResultBuilder; import com.gszc.service.CountService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; @Api(value = "工商注册 API", tags = {"计算api"}) @RestController @RequestMapping("/count") public class CountController { @Autowired CountService countService; /** * 增值税 * * @return */ @PostMapping("/VATCount") @ApiOperation(value = "增值税计算器", notes = "增值税计算器") @ApiImplicitParams({ @ApiImplicitParam(name = "companyType", value = "公司类型(1-有限公司 2-个独、合伙企业)", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "invoiceType", value = "开票类型(1-普通发票 2-专用发票)", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "specialInvoiceType", value = "专票类型(1-服务业 2-商业),不是专票不用填写", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "money", value = "开票金额", dataType = "string", paramType = "query"), }) public Result VATCount(String companyType,String invoiceType,String specialInvoiceType,double money) { BigDecimal bigDecimal = null; try { bigDecimal = countService.VATCount(companyType,invoiceType,specialInvoiceType,money); } catch (Exception e) { return ResultBuilder.error("参数错误",e).build(); } return ResultBuilder.withPayload(bigDecimal).build(); } /** * 个人所得税 * * @return */ @PostMapping("/PITCount") @ApiOperation(value = "个人所得税计算器", notes = "个人所得税计算器") @ApiImplicitParams({ @ApiImplicitParam(name = "type", value = "(1-个税 2-生产经营个税)", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "produceType", value = "生产经营方式(1-核定征收 2-累进税率),不是生产经营不用填写", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "money", value = "开票金额", dataType = "string", paramType = "query"), }) public Result PITCount(String type,String produceType,double money) { BigDecimal bigDecimal = null; try { bigDecimal = countService.PITCount(type,produceType,money); } catch (Exception e) { return ResultBuilder.error("参数错误",e).build(); } return ResultBuilder.withPayload(bigDecimal).build(); } }