|
@@ -34,6 +34,8 @@ import org.springframework.mock.web.MockMultipartFile;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
+import sun.misc.BASE64Encoder;
|
|
|
+
|
|
|
import java.io.*;
|
|
|
import java.net.HttpURLConnection;
|
|
|
import java.net.URL;
|
|
@@ -1185,6 +1187,70 @@ public class OwnMessageController extends BaseController {
|
|
|
return f.getAbsolutePath();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询企业当前融信已盖章合同
|
|
|
+ * @param zfiId 融信id
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @GetMapping("/listStamped")
|
|
|
+ public AjaxResult listStamped (@RequestParam(required=false) String zfiId) throws Exception {
|
|
|
+ //获取当前用户
|
|
|
+ LoginUser userInfo = tokenService.getLoginUser();
|
|
|
+ SysUser use = userInfo.getSysUser();
|
|
|
+ //获取公司
|
|
|
+ String companyId = use.getCompanyId();
|
|
|
+ //企业类型
|
|
|
+ String companyType = use.getCompanyType();
|
|
|
+ LambdaQueryWrapper<ZcFinanceFileRel> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ if ("01".equals(companyType)){
|
|
|
+ //核心企业
|
|
|
+ queryWrapper.eq(ZcFinanceFileRel::getZffrCoreId,companyId);
|
|
|
+ }else if ("02".equals(companyType)){
|
|
|
+ //供应商
|
|
|
+ queryWrapper.eq(ZcFinanceFileRel::getZffrSupplierId,companyId);
|
|
|
+ }
|
|
|
+ queryWrapper.eq(ZcFinanceFileRel::getZffrFinanceId, zfiId);
|
|
|
+ List<ZcFinanceFileRel> financeFileList = financeFileRelService.findZcFinanceFileRels(queryWrapper);
|
|
|
+ ZcFinanceInf zcFinanceInf = financeInfService.getById(zfiId);
|
|
|
+ List<PubFileInf> fileInfList = new ArrayList<>();
|
|
|
+ //返回
|
|
|
+ Map<String,Object> p = new HashMap<>();
|
|
|
+ //文件信息
|
|
|
+ List<Map<String,String>> list = new ArrayList<>();
|
|
|
+ p.put("list",list);
|
|
|
+ if (financeFileList.size() > 0){
|
|
|
+ List<String> fileIdList = CommonUtil.getIdFromList(financeFileList,"zffrFileId");
|
|
|
+ LambdaQueryWrapper<PubFileInf> fileInfLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ fileInfLambdaQueryWrapper.in(PubFileInf::getPfiFileId,fileIdList);
|
|
|
+ fileInfLambdaQueryWrapper.eq(PubFileInf::getPfiIsDel,"00");
|
|
|
+ fileInfLambdaQueryWrapper.orderByAsc(PubFileInf::getPfiFileId);
|
|
|
+ fileInfList = fileInfService.findPubFileInfs(fileInfLambdaQueryWrapper);
|
|
|
+ }
|
|
|
+ if(fileInfList.size() > 0 ){
|
|
|
+ //提取所有的文件url
|
|
|
+ List<String> urlList = CommonUtil.getIdFromList(fileInfList,"pfiFileUrl");
|
|
|
+ //提取文件名
|
|
|
+ List<String> fileNameList = CommonUtil.getIdFromList(fileInfList,"pfiFileName");
|
|
|
+ for(int i =0 ; i < urlList.size() ;i++){
|
|
|
+ //文件下载
|
|
|
+ String filePath = downloadFile(urlList.get(i),fileNameList.get(i));
|
|
|
+ File pdfFile = new File(filePath);
|
|
|
+ FileInputStream inputFile = new FileInputStream(pdfFile);
|
|
|
+ byte[] buffer = new byte[(int)pdfFile.length()];
|
|
|
+ inputFile.read(buffer);
|
|
|
+ inputFile.close();
|
|
|
+ String base64 = new BASE64Encoder().encode(buffer);
|
|
|
+ //声明map
|
|
|
+ Map<String,String> pm = new HashMap<>();
|
|
|
+ pm.put("filePath",filePath);
|
|
|
+ pm.put("base64",base64);
|
|
|
+ list.add(pm);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ p.put("list",list);
|
|
|
+ return AjaxResult.success(p);
|
|
|
+ }
|
|
|
public static void main(String[] args){
|
|
|
WordPdfUtil.doc2pdf("D:\\桌面\\bce10e0a-9255-49f6-a6a7-8c771aeb8941.docx","D:\\桌面\\123.pdf");
|
|
|
}
|