package com.jeeplus.sys.feign;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.jeeplus.common.constant.AppNameConstants;
import com.jeeplus.sys.domain.WorkAttachmentInfo;
import com.jeeplus.sys.factory.WorkAttachmentApiFallbackFactory;
import com.jeeplus.sys.service.dto.UserDTO;
import com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.io.InputStream;
import java.util.List;
import java.util.Map;


@FeignClient(contextId = "workAttachmentApi", name = AppNameConstants.APP_PUBLIC_MODULES, fallbackFactory = WorkAttachmentApiFallbackFactory.class)
public interface IWorkAttachmentApi {


    /**
     * 查询电子章文件信息
     * @param id
     * @return
     */
    @PostMapping("/oss/file/selectWorkAttachmentByAttachmentId")
    List<WorkAttachmentInfo> selectWorkAttachmentByAttachmentId(@RequestParam(value = "id")String id);

    /**
     * 财务模块保存附件使用
     * @param map
     */
    @RequestMapping(value = "/oss/file/financeFileSave", method = RequestMethod.POST)
    void insertWorkAttachment (@RequestBody Map<String ,String > map);

    /**
     * 财务模块使用，根据id删除附件
     * @param id
     */
    @GetMapping("/oss/file/deleteById")
    void deleteById(@RequestParam(value = "id")String id);

    /**
     * 财务模块使用，根据attachmentId删除附件
     * @param attachmentId
     */
    @GetMapping("/oss/file/deleteByAttachmentId")
    void deleteByAttachmentId(@RequestParam(value = "attachmentId")String attachmentId);

    @RequestMapping(value = "/oss/file/deleteByAttachmentIdNotInIds", method = RequestMethod.POST)
    void deleteByAttachmentIdNotInIds(@RequestParam(value = "attachmentId")String attachmentId,
                                      @RequestParam(value = "delIds")List<String> delIds);

    /**
     * 保存/修改附件
     * @param map
     */
    @RequestMapping(value = "/oss/file/saveOrUpdateFileListFlag", method = RequestMethod.POST)
    void saveOrUpdateFileListFlag(@RequestBody Map<String ,String > map);

    /**
     * 保存附件信息
     * @param map
     */
    @RequestMapping(value = "/oss/file/saveOrUpdateFileList", method = RequestMethod.POST)
    void saveOrUpdateFileList(@RequestBody Map<String ,String > map);

    /**
     * 根据attachmentId查询附件信息
     * @param attachmentId
     * @return
     */
    @PostMapping("/oss/file/selectListByAttachmentId")
    List<WorkAttachmentInfo> selectListByAttachmentId(@RequestParam(value = "attachmentId")String attachmentId);

    /**
     * 财务模块使用，根据attachmentId删除附件
     * @param ids
     */
    @RequestMapping(value = "/oss/file/deleteByIds", method = RequestMethod.POST)
    void deleteByIds(@RequestBody String ids);

    /**
     * 保存附件信息
     * @param map
     */
    @RequestMapping(value = "/oss/file/saveFile", method = RequestMethod.POST)
    String saveFile(@RequestBody Map<String ,String > map);

    /**
     * 附件下载到本地指定文件夹
     * @param key
     * @param fileName
     * @param downFileStr
     */
    @RequestMapping(value = "/oss/file/downByStreamSaveLocal", method = RequestMethod.POST)
    void downByStreamSaveLocal(@RequestParam(value = "key")String key,
                               @RequestParam(value = "fileName")String fileName,
                               @RequestParam(value = "downFileStr")String downFileStr);

    /**
     * 附件转流
     * @param key
     * @param fileName
     */
    @RequestMapping(value = "/oss/file/downBytesByStream", method = RequestMethod.POST)
    byte[] downBytesByStream(@RequestParam(value = "key")String key,
                               @RequestParam(value = "fileName")String fileName);


    /**
     * 获取编号模板编号
     * @param companyId
     * @param bizCode
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/oss/file/genSerialNum", method = RequestMethod.POST)
    String genSerialNum(@RequestParam(value = "companyId")String companyId,
                               @RequestParam(value = "bizCode")String bizCode,
                               @RequestParam(value = "currentToken")String currentToken
                        ) throws Exception;

    /**
     * 获取编号模板报告编号
     * @param companyId
     * @param bizCode
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/oss/file/genSerialNumNoSort", method = RequestMethod.POST)
    String genSerialNumNoSort(@RequestParam(value = "companyId")String companyId,
                              @RequestParam(value = "bizCode")String bizCode,
                              @RequestParam(value = "currentToken")String currentToken
                        ) throws Exception;

    /**
     * 获取编号模板报告编号
     * @param companyId
     * @param bizCode
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/oss/file/genSerialReviewNum", method = RequestMethod.POST)
    String genSerialReviewNum(@RequestParam(value = "companyId")String companyId,
                              @RequestParam(value = "bizCode")String bizCode,
                              @RequestParam(value = "currentToken")String currentToken
    ) throws Exception;

    /**
     * 根据关联id和url查询数据信息
     * @param workattachment
     * @return
     */
    @RequestMapping(value = "/oss/file/getByAttachmentIdAndUrlAndAttachmentFlag", method = RequestMethod.POST)
    List<WorkAttachmentInfo> getByAttachmentIdAndUrlAndAttachmentFlag(@RequestBody WorkAttachmentInfo workattachment);

    /**
     * 附件下载到本地指定文件夹(签章系统)
     * @param key
     * @param fileName
     * @param downFileStr
     */
    @RequestMapping(value = "/oss/file/downQzByStreamSaveLocal", method = RequestMethod.POST)
    void downQzByStreamSaveLocal(@RequestParam(value = "key")String key,
                                 @RequestParam(value = "fileName")String fileName,
                                 @RequestParam(value = "downFileStr")String downFileStr);

    @PostMapping("/oss/file/datePath")
    String datePath();

    /**
     * 上传到OSS服务器  如果同名文件会覆盖服务器上的
     * @param inStream
     * @param fileDir
     * @param fileName
     * @return
     */
    @RequestMapping(value = "/oss/file/uploadFile2OSS", method = RequestMethod.POST)
    String uploadFile2OSS(@RequestParam(value = "inStream")InputStream inStream,
                          @RequestParam(value = "fileDir")String fileDir,
                          @RequestParam(value = "fileName")String fileName);

    /**
     * 上传到OSS服务器  如果同名文件会覆盖服务器上的(签章文件上传)
     * @param filePath
     * @param fileDir
     * @param fileName
     * @return
     */
    @RequestMapping(value = "/oss/file/uploadFileSignatureOSS", method = RequestMethod.POST)
    String uploadFileSignatureOSS(@RequestParam(value = "filePath")String filePath,
                          @RequestParam(value = "fileDir")String fileDir,
                          @RequestParam(value = "fileName")String fileName);

    /**
     * 保存附件信息
     * @param map
     */
    @RequestMapping(value = "/oss/file/saveMsg2", method = RequestMethod.POST)
    void saveMsg2(@RequestBody Map<String ,String > map);

    /**
     * 处理数电发票数据中的购买方名称信息
     * @param attachmentIdList
     * @param type
     * @return
     */
    @RequestMapping(value = "/oss/file/disposeElectronicEngineeringInvoice", method = RequestMethod.GET)
    Map<String ,String > disposeElectronicEngineeringInvoice(@RequestParam(value = "attachmentIdList")List<String> attachmentIdList,@RequestParam(value = "type")String type);

    /**
     * 获取数电发票数据中的发票号信息
     * @param attachmentIdList
     * @param type
     * @return
     */
    @RequestMapping(value = "/oss/file/disposeElectronicEngineeringInvoiceNumber", method = RequestMethod.GET)
    Map<String ,String > disposeElectronicEngineeringInvoiceNumber(@RequestParam(value = "attachmentIdList")List<String> attachmentIdList,@RequestParam(value = "type")String type);

}


