| | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.dto.DirectInvoicingDTO; |
| | | import com.doumee.dao.business.dto.EntrustInvoicingDTO; |
| | | import com.doumee.dao.business.model.Taxes; |
| | | import com.doumee.dao.business.vo.TaxesInvoicingVO; |
| | | import com.doumee.service.business.TaxesService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | |
| | | /** |
| | | * @author 江蹄蹄 |
| | | * @date 2024/01/15 15:07 |
| | | * @date 2024/01/16 10:03 |
| | | */ |
| | | @Api(tags = "发票信息表") |
| | | @RestController |
| | |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("business:taxes:query") |
| | | public ApiResponse<PageData<Taxes>> findPage (@RequestBody PageWrap<Taxes> pageWrap) { |
| | | return ApiResponse.success(taxesService.findPage(pageWrap)); |
| | | return ApiResponse.success(taxesService.findPageForCompany(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("列表查询") |
| | | @PostMapping("/list") |
| | | @RequiresPermissions("business:taxes:query") |
| | | public ApiResponse<List<Taxes>> findList (@RequestBody Taxes taxes) { |
| | | return ApiResponse.success(taxesService.findListForCompany(taxes)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | |
| | | ExcelExporter.build(Taxes.class).export(taxesService.findPage(pageWrap).getRecords(), "发票信息表", response); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @RequiresPermissions("business:taxes:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | public ApiResponse<Taxes> findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(taxesService.findById(id)); |
| | | } |
| | | |
| | | // @ApiOperation("获取企业信息") |
| | | // @GetMapping("/getCompanyDetail") |
| | | // @RequiresPermissions("business:taxes:query") |
| | | // public ApiResponse<Taxes> getCompanyDetail() { |
| | | // LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | // if(!loginUserInfo.getType().equals(Constants.ONE)){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业类用户无法进行该操作"); |
| | | // } |
| | | // return ApiResponse.success(taxesService.findById(loginUserInfo.getCompanyId())); |
| | | // } |
| | | |
| | | @ApiOperation("提交委托投报开票") |
| | | @PostMapping("/entrustInvoicing") |
| | | public ApiResponse entrustInvoicing(@RequestBody EntrustInvoicingDTO entrustInvoicingDTOs) { |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(!loginUserInfo.getType().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业类用户无法进行该操作"); |
| | | } |
| | | taxesService.entrustInvoicing(entrustInvoicingDTOs); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("提交直托投报开票") |
| | | @PostMapping("/directInvoicing") |
| | | public ApiResponse directInvoicing(@RequestBody DirectInvoicingDTO directInvoicingDTO) { |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(!loginUserInfo.getType().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业类用户无法进行该操作"); |
| | | } |
| | | taxesService.directInvoicing(directInvoicingDTO); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取直保数据信息",notes = "") |
| | | @GetMapping("/getDirectTaxes") |
| | | @RequiresPermissions("business:taxes:query") |
| | | public ApiResponse<List<TaxesInvoicingVO>> getDirectTaxes(@RequestParam Integer id) { |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(!loginUserInfo.getType().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业类用户无法进行该操作"); |
| | | } |
| | | return ApiResponse.success(taxesService.getDirectTaxes(id)); |
| | | } |
| | | |
| | | } |