ca签章每份都签

master
linjj 2 years ago
parent e45855b819
commit caa05b97cc

@ -103,8 +103,9 @@ public class CaSignServiceImpl {
String todayDate = fmt.format(new Date());
//签章后地址
String newpdfPath = newPath + File.separator + todayDate+".pdf";
backupsPdf(pdfPath,newpdfPath);
//进行签章
boolean isSign = caSign(pdfPath, newpdfPath, caReqParam);
boolean isSign = caSign(newpdfPath, caReqParam);
if (isSign) {
idList.add(dto.getId());
dto.setPdfPath(newpdfPath);
@ -126,6 +127,18 @@ public class CaSignServiceImpl {
e.printStackTrace();
}
}
private void backupsPdf(String pdfPath,String newpdfPath){
try (InputStream inputStream = new FileInputStream(pdfPath);
OutputStream outputStream = new FileOutputStream(newpdfPath)) {
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* @Description: updateCaFileStateca
@ -199,20 +212,19 @@ public class CaSignServiceImpl {
*
* z:docus/caTemp/masterId/
*/
private boolean caSign(String fileSrc, String newpdfPath, Archive_Detail_ca_reqParam caReqParam) throws Exception {
System.out.println("fileSrc:" + fileSrc);
private boolean caSign(String newpdfPath, Archive_Detail_ca_reqParam caReqParam) throws Exception {
//定义是否成功
boolean flag = false;
PdfReader pdfReader = null;
try {
pdfReader = new PdfReader(fileSrc);
pdfReader = new PdfReader(newpdfPath);
} catch (Exception e) {
e.printStackTrace();
}
if (pdfReader != null) {
try {
anySignClientTool = new AnySignClientTool(caServerIp, caServerPort);
File file = new File(fileSrc);
File file = new File(newpdfPath);
byte[] pdfBty = ClientUtil.readFileToByteArray(file);
//pdf验章
ChannelMessage messageExist = anySignClientTool.pdfVerify(pdfBty);
@ -252,7 +264,7 @@ public class CaSignServiceImpl {
e.printStackTrace();
}
} else {
log.error("进行签章pdf" + fileSrc + "不存在或损坏");
log.error("进行签章pdf" + newpdfPath + "不存在或损坏");
}
System.out.println("完成");
return flag;

@ -35,7 +35,7 @@
values
<foreach collection="list" item="item" separator=",">
(#{item.id},#{item.pdfPath},#{item.masterID},#{item.upLoadDateTime},#{item.assortID},#{item.source},#{item.subAssort},#{item.title},#{item.flag}
,#{item.Sys},#{item.applyId},#{item.pageNumber},#{item.checkReportId},#{item.crecoverPdfPath},#{item.fileCode},#{item.cType},#{item.fileContext}
,#{item.Sys},#{item.applyId},#{item.pageNumber},#{item.checkReportId},#{item.recoverPdfPath},#{item.fileCode},#{item.cType},#{item.fileContext}
,#{item.pageCount})
</foreach>
</insert>

Loading…
Cancel
Save