package org.dromara.payment.taxRecords.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.payment.task.domain.vo.MerTaskEnrollVo;
import org.dromara.payment.taxRecords.domain.bo.SwMonitorBo;
import org.dromara.payment.taxRecords.domain.vo.SwMonitorVo;
import org.dromara.payment.taxRecords.service.ISwMonitorService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;


/**
 * @author sunzexing
 * @version 1.0
 * @title SwMonitorController
 * @description 税务监控
 * @create 2024-06-24 10:22
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/swMonitor")
public class SwMonitorController extends BaseController {



    @Resource
    public ISwMonitorService swMonitorService;


    /**
     * 查询完税务监控
     */
//    @SaCheckPermission("swMonitor:swMonitor:list")
    @GetMapping("/list")
    @Log(title = "查询税务监控", businessType = BusinessType.SELECT)
    public TableDataInfo<SwMonitorVo> list(SwMonitorBo bo, PageQuery pageQuery) {
        return this.swMonitorService.queryPageList(bo, pageQuery);
    }




    @Log(title = "查询税务附件", businessType = BusinessType.SELECT)
    @GetMapping("/getUrl")
    public R<String> getFileUrl(Long tailId,String tailNo,String subNo, Integer type,Long workId,Integer busType,Long sydId,Long merId)throws Exception {
        return R.ok( null,this.swMonitorService.getFileUrl(tailId,tailNo,subNo,type,workId,busType,sydId,merId));
    }


    /**
     * 导出发票
     */
   // @SaCheckPermission("taxRecords:taxRecordsDetail:export")
    @Log(title = "下载发票", businessType = BusinessType.EXPORT)
    @PostMapping("/exportInv")
    public void export(String bo, HttpServletResponse response)throws Exception {
        this.swMonitorService.exportInv(bo,response);
    }

    @Log(title = "根据项目自编码查询完工信息", businessType = BusinessType.SELECT)
    @GetMapping("/getTaskEnroll")
    public R<MerTaskEnrollVo>  selTaskEnroll(String proSubNo)throws Exception{
        return R.ok(this.swMonitorService.getTaskEnrollVo(proSubNo));
    }

}
