Bladeren bron

盖章文件修改

master
CMM 1 jaar geleden
bovenliggende
commit
473081421a
2 gewijzigde bestanden met toevoegingen van 14 en 5 verwijderingen
  1. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java
  2. +11
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java

+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java Bestand weergeven

@@ -6,7 +6,6 @@ import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.irs.config.IrsSealPlatformProperties;
import com.ningdatech.pmapi.todocenter.model.dto.SignReqDTO;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@@ -81,7 +80,8 @@ public class IRSAPIRequest {
// 获取盖好章的PDF文件内容Base64字符串
String signFileB64 = object.getString("signFileB64");
if (Objects.nonNull(signFileB64)){
return signFileB64.getBytes();
Base64.getDecoder().decode(signFileB64);
return Base64.getDecoder().decode(signFileB64);
}else {
return null;
}
@@ -245,7 +245,7 @@ public class IRSAPIRequest {
//刷新此输出流并强制写出所有缓冲的输出字节
bout.flush();
byte[] bytes = baos.toByteArray();
return Base64.encode(bytes);
return String.valueOf(Base64.getEncoder().encode(bytes));
//return encoder.encodeBuffer(bytes);

} catch (IOException e) {


+ 11
- 2
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Bestand weergeven

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.todocenter.manage;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
@@ -495,9 +496,17 @@ public class TodoCenterManage {
signReq.setSignType(signType);
// 调用盖章接口,获取盖章后返回的pdf文件字符数组
byte[] signPdf = IRSAPIRequest.createSignPdf(signReq);

ByteArrayInputStream inputStream = null;
if (Objects.nonNull(signPdf)) {
inputStream = new ByteArrayInputStream(signPdf);
}
// 转换成MultipartFile
MultipartFile multipartFile = new MockMultipartFile("file", originalFileName, "application/pdf", signPdf);
MultipartFile multipartFile;
try {
multipartFile = new MockMultipartFile("file", originalFileName, "application/pdf", inputStream);
} catch (IOException e) {
throw new BizException("生成盖章pdf文件失败!");
}
// 上传OSS
FileResultVO resultVo = fileService.upload(multipartFile, "default");
// 将返回的文件ID更新到项目库中对应的项目下


Laden…
Annuleren
Opslaan