单签改为手动签署
This commit is contained in:
@@ -12,6 +12,7 @@ import com.seeyon.apps.esign.po.SignFieldPosition;
|
||||
import com.seeyon.apps.esign.po.Signer;
|
||||
import com.seeyon.apps.esign.service.EsignByTemplateService;
|
||||
import com.seeyon.apps.esign.service.EsignByUploadFileService;
|
||||
import com.seeyon.apps.ext.workflow.vo.FieldDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.SuperNodeContext;
|
||||
import com.seeyon.cap4.form.bean.FormDataMasterBean;
|
||||
@@ -106,7 +107,7 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
|
||||
aPositions.add(aQiFengposition);
|
||||
bPositions.add(bQiFengposition);
|
||||
String sealId = formDataVo.getFieldData("甲方印章ID").getStringValue();
|
||||
String sealId = getStringField(formDataVo,"甲方印章ID");
|
||||
Signer bSigner = !"组织".equals(bSignerType) ? createPsnSigner(fileId,formDataVo.getFieldData("乙方姓名").getStringValue(),bPositions,1,formDataVo.getFieldData("乙方电话").getStringValue(),false) : createOrgSigner(
|
||||
fileId,
|
||||
getStringField(formDataVo, B_UNIT_NAME_FIELD),
|
||||
@@ -297,8 +298,14 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
throw new RuntimeException("未找到关键字位置: " + keyword);
|
||||
}
|
||||
|
||||
private String getStringField(FormDataVo vo, String field) throws NoSuchFieldException {
|
||||
return vo.getFieldData(field) != null ? vo.getFieldData(field).getStringValue() : null;
|
||||
private String getStringField(FormDataVo vo, String field) {
|
||||
try {
|
||||
FieldDataVo fieldData = vo.getFieldData(field);
|
||||
return fieldData.getStringValue();
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Float toFloat(Object val) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.seeyon.apps.esign.node;
|
||||
|
||||
import com.seeyon.apps.common.workflow.node.ACommonSuperNode;
|
||||
import com.seeyon.apps.esign.config.EsignConfigProvider;
|
||||
import com.seeyon.apps.esign.constants.EsignApiUrl;
|
||||
import com.seeyon.apps.esign.constants.EsignConfigConstants;
|
||||
import com.seeyon.apps.esign.form.FormDataOperator;
|
||||
import com.seeyon.apps.esign.form.FormUpdateField;
|
||||
@@ -9,6 +10,7 @@ import com.seeyon.apps.esign.form.FormWhereCondition;
|
||||
import com.seeyon.apps.esign.po.*;
|
||||
import com.seeyon.apps.esign.service.EsignByTemplateService;
|
||||
import com.seeyon.apps.esign.service.EsignByUploadFileService;
|
||||
import com.seeyon.apps.ext.workflow.vo.FieldDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.SuperNodeContext;
|
||||
import com.seeyon.cap4.form.bean.FormDataMasterBean;
|
||||
@@ -86,16 +88,17 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
}
|
||||
|
||||
private List<Signer> buildOnlyASigner(FormDataVo formDataVo, String fileId) throws Exception {
|
||||
List<Object> positions = uploadFileService.getSignPosition(fileId);
|
||||
List<SignFieldPosition> aPositions = extractPosition(positions, "甲方盖章/签字");
|
||||
List<SignFieldPosition> aPositions = new ArrayList<>();
|
||||
|
||||
SignFieldPosition aQiFengposition = new SignFieldPosition();
|
||||
aQiFengposition.setAcrossPageMode("ALL");
|
||||
aQiFengposition.setPositionY(520f);
|
||||
String sealId = formDataVo.getFieldData("甲方印章ID").getStringValue();
|
||||
String sealId = getStringField(formDataVo,"甲方印章ID");
|
||||
String psnName = getStringField(formDataVo,"甲方签署经办人");
|
||||
String psnMobile = getStringField(formDataVo,"甲方签署经办人联系方式");
|
||||
aPositions.add(aQiFengposition);
|
||||
Signer aSigner = createOrgSigner(
|
||||
fileId,null, aPositions, 1, null, null, null, null, null, null,true
|
||||
fileId,"湖北国通领驭建设集团有限公司", aPositions, 1, null, null, null, psnMobile, psnName, null,false
|
||||
,sealId);
|
||||
List<Signer> signers = new ArrayList<>();
|
||||
signers.add(aSigner);
|
||||
@@ -201,17 +204,11 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
if(Boolean.FALSE.equals(autoSign)){
|
||||
signer.setNoticeConfig(mapOf("noticeTypes", "1"));
|
||||
|
||||
Map<String, Object> orgInfo = mapOf("orgName", orgName, "orgInfo", mapOf(
|
||||
"legalRepName", legalName,
|
||||
"legalRepIDCardNum", legalId,
|
||||
"orgIDCardNum", orgCode,
|
||||
"orgIDCardType", "CRED_ORG_USCC"
|
||||
),
|
||||
Map<String, Object> orgInfo = mapOf("orgName", orgName,
|
||||
"transactorInfo", mapOf(
|
||||
"psnAccount", transPhone,
|
||||
"psnInfo", mapOf(
|
||||
"psnName", psnName,
|
||||
"psnIDCardNum", psnId
|
||||
"psnName", psnName
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -233,9 +230,7 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
qiFengfield.setFileId(fileId);
|
||||
signFields.add(qiFengfield);
|
||||
}else {
|
||||
fieldConfig.setSignFieldPosition(po);
|
||||
fieldConfig.setAutoSign(autoSign);
|
||||
fieldConfig.setSignFieldStyle(1);
|
||||
fieldConfig.setFreeMode(true);
|
||||
SignField field = new SignField();
|
||||
field.setSignFieldType(0);
|
||||
field.setNormalSignFieldConfig(fieldConfig);
|
||||
@@ -272,8 +267,14 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
throw new RuntimeException("未找到关键字位置: " + keyword);
|
||||
}
|
||||
|
||||
private String getStringField(FormDataVo vo, String field) throws NoSuchFieldException {
|
||||
return vo.getFieldData(field) != null ? vo.getFieldData(field).getStringValue() : null;
|
||||
private String getStringField(FormDataVo vo, String field) {
|
||||
try {
|
||||
FieldDataVo fieldData = vo.getFieldData(field);
|
||||
return fieldData.getStringValue();
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Float toFloat(Object val) {
|
||||
|
||||
@@ -5,6 +5,7 @@ public class NormalSignFieldConfig {
|
||||
private Integer signFieldStyle;
|
||||
private SignFieldPosition signFieldPosition;
|
||||
private String assignedSealId; //指定签章id
|
||||
private Boolean freeMode = false;
|
||||
|
||||
public Boolean getAutoSign() {
|
||||
return autoSign;
|
||||
@@ -37,4 +38,12 @@ public class NormalSignFieldConfig {
|
||||
public void setAssignedSealId(String assignedSealId) {
|
||||
this.assignedSealId = assignedSealId;
|
||||
}
|
||||
|
||||
public Boolean getFreeMode() {
|
||||
return freeMode;
|
||||
}
|
||||
|
||||
public void setFreeMode(Boolean freeMode) {
|
||||
this.freeMode = freeMode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.seeyon.apps.esign.po;
|
||||
|
||||
public class OrgBaseInfo {
|
||||
private String orgIDCardNum;
|
||||
private String legalRepName;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public class SealService {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!"已启用".equals(vo.getSealBizTypeDescription())) {
|
||||
if (!"已启用".equals(vo.getStatusDescription())) {
|
||||
try {
|
||||
formDataOperator.deleteByCondition(formNo, conditions);
|
||||
} catch (Exception e) {
|
||||
|
||||
86
esign/src/test/java/TestUploadFile.java
Normal file
86
esign/src/test/java/TestUploadFile.java
Normal file
@@ -0,0 +1,86 @@
|
||||
import com.seeyon.aicloud.common.JsonUtils;
|
||||
import com.seeyon.apps.esign.po.*;
|
||||
import com.seeyon.apps.esign.service.EsignByUploadFileService;
|
||||
import com.seeyon.apps.esign.utils.EsignHttpHelper;
|
||||
import com.seeyon.apps.esign.utils.EsignRequestType;
|
||||
import com.seeyon.apps.esign.utils.FileUtil;
|
||||
import com.seeyon.apps.esign.utils.HttpClient;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
public class TestUploadFile {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
uploadFile();
|
||||
}
|
||||
|
||||
public static void uploadFile() throws Exception {
|
||||
File file = null;
|
||||
FileUtil fileUtil = new FileUtil();
|
||||
String filePath = "E:\\RuicyWu\\Documents\\xwechat_files\\wxid_mbbio0boprzm22_a34d\\msg\\file\\2025-08\\湖北晟恒建设工程有限公司 合同-国通领驭1.pdf";
|
||||
try {
|
||||
file = new File(filePath);
|
||||
String contentMD5 = EsignByUploadFileService.getFileContentMD5(filePath);
|
||||
GetUploadUrlResp uploadResp = getUploadFileUrl(file.getName(), contentMD5, file.length(),true);
|
||||
uploadFile(uploadResp.getFileUploadUrl(), contentMD5, file.getName(), filePath);
|
||||
System.out.println(uploadResp.getFileId());
|
||||
}finally {
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] getBytes(String filePath) throws Exception {
|
||||
File file = new File(filePath);
|
||||
FileInputStream fis = null;
|
||||
byte[] buffer = null;
|
||||
try {
|
||||
fis = new FileInputStream(file);
|
||||
buffer = new byte[(int) file.length()];
|
||||
fis.read(buffer);
|
||||
} catch (Exception e) {
|
||||
Exception ex = new Exception("获取文件字节流失败", e);
|
||||
ex.initCause(e);
|
||||
throw ex;
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
Exception ex = new Exception("关闭文件字节流失败", e);
|
||||
ex.initCause(e);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public static String uploadFile(String uploadUrl,String contentMD5,String fileName,String filePath) throws Exception {
|
||||
EsignHttpResponse esignHttpResponse = EsignHttpHelper.doUploadHttp(uploadUrl, EsignRequestType.PUT, getBytes(filePath), contentMD5, "application/octet-stream", false);
|
||||
return esignHttpResponse.getBody();
|
||||
}
|
||||
|
||||
public static GetUploadUrlResp getUploadFileUrl(String fileName,String fileMd5,Long fileSize,boolean convert2Pdf) throws Exception {
|
||||
String url = "http://smlopenapi.esign.cn/v3/files/file-upload-url";
|
||||
GetUploadUrlResp resp = new GetUploadUrlResp();
|
||||
EsignApiHeader esignApiHeader = EsignApiHeader.build().appId("7438886882");
|
||||
esignApiHeader.token("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJnSWQiOiJkN2NjYTRlOWJlNzc0ZWJlYWNhM2IwZGRhOTZiNTE4NCIsImFwcElkIjoiNzQzODg4Njg4MiIsIm9JZCI6IjhiYTcxOGYxZGQ2OTRkZjc4ZDVlZjMyNGQ4M2JhNzNiIiwidGltZXN0YW1wIjoxNzU1NDg3MTQ3NjUxfQ.ytTPETDldpLXPdfv_k0Nzi2YVyTxpf3X6m9YveeatPI");
|
||||
EsignFileUploadParams params = new EsignFileUploadParams();
|
||||
params.setFileName(fileName);
|
||||
params.setContentMd5(fileMd5);
|
||||
params.setFileSize(fileSize);
|
||||
params.setConvertToPDF(convert2Pdf);
|
||||
params.setContentType("application/octet-stream");
|
||||
String respStr = HttpClient.httpPostRaw(url, JsonUtils.toJSONString(params), esignApiHeader.convert2Headers(), null);
|
||||
EsignBaseResp esignBaseResp = JsonUtils.parseObject(respStr, EsignBaseResp.class);
|
||||
Object data = esignBaseResp.getData();
|
||||
if (data != null) {
|
||||
Map<String, Object> map = (Map<String, Object>) data;
|
||||
resp.setFileUploadUrl((String) map.get("fileUploadUrl"));
|
||||
resp.setFileId((String) map.get("fileId"));
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user