完善代码
This commit is contained in:
@@ -9,7 +9,7 @@ public enum EsignConfigConstants {
|
||||
SIGN_SERVICE_PROVIDER("ESIGN",""),
|
||||
UNITNAME("","平台方组织名称"),
|
||||
FORMEDITLOGINNAME("","表单修改登录名"),
|
||||
updateAccountName("表单",""),
|
||||
updateAccountName("表单","平台方单位名"),
|
||||
getTokenUrl("/seeyon/rest/token/","调用获取TOKEN地址"),
|
||||
nodeTokenUrl("/seeyon/rest/flow/notification/","超级节点回调URL"),
|
||||
restName("",""),
|
||||
@@ -21,6 +21,7 @@ public enum EsignConfigConstants {
|
||||
aSignPositionKeyword("甲方盖章/签字","甲方签署位置关键字"),
|
||||
bSignPositionKeyword("乙方盖章/签字","乙方签署位置关键字"),
|
||||
lpSignPositionKeyword("法定代表人","法人签署位置关键字"),
|
||||
signLinkSave("false","是否保存签署链接"),
|
||||
;
|
||||
|
||||
private String defaultValue;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class DefaultEsignCallBackController extends BaseController {
|
||||
|
||||
private static final Log log = Log.get(DefaultEsignCallBackController.class);
|
||||
|
||||
private EsignUploadFileService esignUploadFileService = (EsignUploadFileService) AppContext.getBean("esignByUploadFileService");
|
||||
private EsignUploadFileService esignUploadFileService = (EsignUploadFileService) AppContext.getBean("esignUploadFileService");
|
||||
private EsignCallbackFlowBizService esignCallbackFlowBizService = (EsignCallbackFlowBizService) AppContext.getBean("esignCallbackFlowBizService");
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ public class DefaultEsignCallBackController extends BaseController {
|
||||
log.info("回调处理完成: " + flowId);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("回调处理失败", e);
|
||||
}
|
||||
// response.setStatus(HttpServletResponse.SC_OK);
|
||||
|
||||
@@ -8,29 +8,16 @@ import com.seeyon.apps.esign.po.signfield.NormalSignFieldConfig;
|
||||
import com.seeyon.apps.esign.po.signfield.SignField;
|
||||
import com.seeyon.apps.esign.po.signfield.SignFieldPosition;
|
||||
import com.seeyon.apps.esign.po.signer.Signer;
|
||||
import com.seeyon.apps.esign.service.ContractCreateService;
|
||||
import com.seeyon.apps.esign.service.EsignByTemplateService;
|
||||
import com.seeyon.apps.esign.service.EsignUploadFileService;
|
||||
import com.seeyon.apps.esign.service.FlowFormSignParamBuildFactory;
|
||||
import com.seeyon.apps.esign.service.*;
|
||||
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;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import com.seeyon.utils.form.FormTableExecutor;
|
||||
import com.seeyon.utils.form.FormUpdateField;
|
||||
import com.seeyon.utils.form.FormWhereCondition;
|
||||
import com.seeyon.utils.form.TableContext;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
|
||||
@@ -43,6 +30,8 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
// private EsignUploadFileService uploadFileService = (EsignUploadFileService) AppContext.getBean("esignByUploadFileService");
|
||||
// private EsignByTemplateService templateService = (EsignByTemplateService) AppContext.getBean("esignByTemplateService");
|
||||
// private FlowFormSignParamBuildFactory flowFormSignParamBuildFactory = new FlowFormSignParamBuildFactory();
|
||||
|
||||
private SignLinkService signLinkService = (SignLinkService) AppContext.getBean("signLinkService");
|
||||
private ContractCreateService contractCreateService = (ContractCreateService) AppContext.getBean("contractCreateService");
|
||||
|
||||
@Override
|
||||
@@ -71,11 +60,16 @@ public class EsignMultipleSignerNode extends ACommonSuperNode {
|
||||
if(esignFlowId == null) {
|
||||
return context.back("E签宝签署发起失败");
|
||||
}
|
||||
String isSaveSignLink = configProvider.getBizConfigByKey(EsignConfigConstants.signLinkSave);
|
||||
if("true".equals(isSaveSignLink)){
|
||||
signLinkService.saveGetLinkParam(formDataVo, formDataMasterBean,esignFlowId);
|
||||
}
|
||||
log.info("E签宝签署流程ID: " + esignFlowId + " , OA超级节点ID:" + formDataVo.getToken());
|
||||
log.info("E签宝多方签署合同已发送: " + esignFlowId);
|
||||
return context.wait("等待签署结束");
|
||||
} catch (Exception e) {
|
||||
log.error("E签宝签署失败", e);
|
||||
e.printStackTrace();
|
||||
context.setErrMsg("E签宝签署失败: " + e.getMessage());
|
||||
return context.back("E签宝签署失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -4,22 +4,13 @@ import com.seeyon.apps.common.workflow.node.ACommonSuperNode;
|
||||
import com.seeyon.apps.esign.config.EsignConfigProvider;
|
||||
import com.seeyon.apps.esign.constants.EsignConfigConstants;
|
||||
import com.seeyon.apps.esign.po.param.FlowParamSource;
|
||||
import com.seeyon.apps.esign.po.signer.Signer;
|
||||
import com.seeyon.apps.esign.po.signfield.NormalSignFieldConfig;
|
||||
import com.seeyon.apps.esign.po.signfield.SignField;
|
||||
import com.seeyon.apps.esign.po.signfield.SignFieldPosition;
|
||||
import com.seeyon.apps.esign.service.ContractCreateService;
|
||||
import com.seeyon.apps.esign.service.EsignByTemplateService;
|
||||
import com.seeyon.apps.esign.service.EsignUploadFileService;
|
||||
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;
|
||||
import com.seeyon.cap4.form.service.CAP4FormManager;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -69,6 +60,7 @@ public class EsignOneSignerNode extends ACommonSuperNode {
|
||||
return context.wait("等待签署结束");
|
||||
} catch (Exception e) {
|
||||
log.error("E签宝签署失败", e);
|
||||
e.printStackTrace();
|
||||
context.setErrMsg("E签宝签署失败: " + e.getMessage());
|
||||
return context.back("E签宝签署失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ import com.seeyon.apps.esign.service.SignParamSource;
|
||||
import com.seeyon.apps.ext.workflow.vo.FieldDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
import com.seeyon.cap4.form.bean.FormDataMasterBean;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.organization.bo.V3xOrgMember;
|
||||
import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
import com.seeyon.utils.form.EnumMapUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -105,8 +108,23 @@ public class FlowParamSource implements SignParamSource {
|
||||
"&bizType=FLOW";
|
||||
}
|
||||
|
||||
private String getPsnName(FormDataVo formDataVo) throws NoSuchFieldException {
|
||||
OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager");
|
||||
FieldDataVo psn = formDataVo.getFieldData("甲方签署经办人");
|
||||
String psnName = null;
|
||||
if(psn != null) {
|
||||
try {
|
||||
V3xOrgMember member = orgManager.getMemberById(Long.parseLong((String)psn.getDbValue()));
|
||||
psnName = member.getName();
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
return psnName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SignParty> getSignerParties() {
|
||||
public List<SignParty> getSignerParties() throws Exception {
|
||||
List<SignParty> parties = new ArrayList<>();
|
||||
SignParty aParty = new SignParty();
|
||||
aParty.setPartyId("甲方");
|
||||
@@ -117,7 +135,10 @@ public class FlowParamSource implements SignParamSource {
|
||||
if(!doAutoSign){
|
||||
OrgInfo orgInfo = new OrgInfo();
|
||||
aParty.setOrgInfo(orgInfo);
|
||||
String psnName = getStringField(formDataVo,"甲方签署经办人");
|
||||
String psnName = getPsnName(formDataVo);
|
||||
if(psnName == null) {
|
||||
throw new RuntimeException("甲方签署经办人为空");
|
||||
}
|
||||
String psnMobile = getStringField(formDataVo,"甲方签署经办人联系方式");
|
||||
String orgName = configProvider.getBizConfigByKey(EsignConfigConstants.UNITNAME);
|
||||
PersonInfo personInfo = new PersonInfo();
|
||||
@@ -125,6 +146,15 @@ public class FlowParamSource implements SignParamSource {
|
||||
personInfo.setName(psnName);
|
||||
personInfo.setPhone(psnMobile);
|
||||
orgInfo.setTransactor(personInfo);
|
||||
FieldDataVo isLpSign = formDataVo.getFieldData("是否盖法人章");
|
||||
if(isLpSign != null && "是".equals(isLpSign)) {
|
||||
SignParty lpParty = new SignParty();
|
||||
lpParty.setPartyId("法人章");
|
||||
lpParty.setAutoSign(false);
|
||||
lpParty.setSignOrder(3);
|
||||
lpParty.setSignerType(SignerType.LP);
|
||||
parties.add(lpParty);
|
||||
}
|
||||
}
|
||||
parties.add(aParty);
|
||||
String signWay = getStringField(formDataVo, "签署方式");
|
||||
@@ -158,7 +188,9 @@ public class FlowParamSource implements SignParamSource {
|
||||
bParty.setOrgInfo(bOrgInfo);
|
||||
bParty.setSignerType(SignerType.ORG);
|
||||
}
|
||||
}catch (Exception e){}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
parties.add(bParty);
|
||||
}
|
||||
return parties;
|
||||
|
||||
@@ -61,7 +61,7 @@ public class JsonParamSource implements SignParamSource {
|
||||
|
||||
@Override
|
||||
public Long getSignStatusEnumId() {
|
||||
return oriParams.get("signStatusEnumId") == null ? null : Long.parseLong((String)oriParams.get("signStatusEnumId"));
|
||||
return oriParams.get("signStatusEnumId") == null ? null : (Long) oriParams.get("signStatusEnumId");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,15 +87,22 @@ public class JsonParamSource implements SignParamSource {
|
||||
String tempStr = (String)oriParams.get("signers");
|
||||
List signers = JsonUtils.parseObject(tempStr, List.class);
|
||||
List<SignParty> parties = new ArrayList<>();
|
||||
Float qfPos = 100f;
|
||||
for (Object signer : signers) {
|
||||
Map<String,Object> signerMap = (Map<String,Object>) signer;
|
||||
SignParty signParty = new SignParty();
|
||||
SignerType signerType = SignerType.valueOf((String) signerMap.get("signerType"));
|
||||
signParty.setSignerType(signerType);
|
||||
signParty.setSignOrder((Integer) signerMap.get("signeOrder"));
|
||||
signParty.setSignOrder((Integer) signerMap.get("signOrder"));
|
||||
signParty.setAutoSign(false);
|
||||
signParty.setFreeSign(true);
|
||||
signParty.setQfPos(qfPos);
|
||||
qfPos += 100f;
|
||||
signParty.setPartyId((String)signerMap.get("name"));
|
||||
if(signerMap.get("signPosKeyword") != null) {
|
||||
signParty.setSignKeyword((String)signerMap.get("signPosKeyword"));
|
||||
signParty.setFreeSign(false);
|
||||
}
|
||||
if(signerType == SignerType.PERSON) {
|
||||
PersonInfo personInfo = new PersonInfo();
|
||||
personInfo.setName((String)signerMap.get("name"));
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.seeyon.apps.esign.constants.EsignConfigConstants;
|
||||
import com.seeyon.apps.esign.po.signfield.NormalSignFieldConfig;
|
||||
import com.seeyon.apps.esign.po.signfield.SignField;
|
||||
import com.seeyon.apps.esign.po.signfield.SignFieldPosition;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -19,7 +20,7 @@ public class DefaultSignerBuilder implements SignerBuilder {
|
||||
public Signer build(List<String> fileIds,List<Object> keywordPos, SignParty party) {
|
||||
if (party.getSignerType() == SignerType.PERSON) {
|
||||
return buildPersonSigner(fileIds, keywordPos,party);
|
||||
} else if (party.getSignerType() == SignerType.ORG) {
|
||||
} else if (party.getSignerType() == SignerType.ORG || party.getSignerType() == SignerType.LP) {
|
||||
return buildOrgSigner(fileIds,keywordPos, party);
|
||||
} else {
|
||||
throw new IllegalArgumentException("不支持的签署方类型");
|
||||
@@ -50,7 +51,11 @@ public class DefaultSignerBuilder implements SignerBuilder {
|
||||
private Signer buildOrgSigner(List<String> fileIds, List<Object> keywordPos,SignParty party) {
|
||||
OrgInfo org = party.getOrgInfo();
|
||||
Signer signer = new Signer();
|
||||
signer.setSignerType(1);
|
||||
if(SignerType.ORG.equals(party.getSignerType())) {
|
||||
signer.setSignerType(1);
|
||||
}else {
|
||||
signer.setSignerType(2);
|
||||
}
|
||||
signer.setSignConfig(mapOf("signOrder", party.getSignOrder()));
|
||||
if (!party.getAutoSign() && org != null) {
|
||||
signer.setNoticeConfig(mapOf("noticeTypes", "1"));
|
||||
@@ -76,6 +81,9 @@ public class DefaultSignerBuilder implements SignerBuilder {
|
||||
}
|
||||
|
||||
private List<SignFieldPosition> extractPosition(List<Object> positions, String keyword) {
|
||||
if(StringUtils.isBlank(keyword)) {
|
||||
return null;
|
||||
}
|
||||
List<SignFieldPosition> posList = new ArrayList<>();
|
||||
for (Object obj : positions) {
|
||||
Map<String, Object> position = (Map<String, Object>) obj;
|
||||
@@ -88,7 +96,7 @@ public class DefaultSignerBuilder implements SignerBuilder {
|
||||
Map<String,Object> tempMap = (Map<String, Object>) coord;
|
||||
SignFieldPosition sfp = new SignFieldPosition();
|
||||
sfp.setPositionPage(posMap.get("pageNum") + "");
|
||||
sfp.setPositionX(toFloat(tempMap.get("positionX")) + 150f);
|
||||
sfp.setPositionX(toFloat(tempMap.get("positionX")) + 160f);
|
||||
sfp.setPositionY(toFloat(tempMap.get("positionY")));
|
||||
posList.add(sfp);
|
||||
}
|
||||
@@ -122,7 +130,7 @@ public class DefaultSignerBuilder implements SignerBuilder {
|
||||
if(lpSignFieldPositions != null && lpSignFieldPositions.size() > 0) {
|
||||
signFieldPositions.addAll(lpSignFieldPositions);
|
||||
}
|
||||
if(signFieldPositions.size() > 0) {
|
||||
if(signFieldPositions.size() > 0 && !SignerType.PERSON.equals(party.getSignerType())) {
|
||||
signFieldPositions.add(qiFengposition);
|
||||
}
|
||||
for (SignFieldPosition position : signFieldPositions) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.seeyon.apps.esign.constants.EsignConfigConstants;
|
||||
import com.seeyon.apps.esign.po.signfield.NormalSignFieldConfig;
|
||||
import com.seeyon.apps.esign.po.signfield.SignField;
|
||||
import com.seeyon.apps.esign.po.signfield.SignFieldPosition;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -18,9 +19,9 @@ public class JsonSignerBuilder implements SignerBuilder{
|
||||
@Override
|
||||
public Signer build(List<String> fileIds, List<Object> keywordPos, SignParty party) {
|
||||
if (party.getSignerType() == SignerType.PERSON) {
|
||||
return buildPersonSigner(fileIds,party);
|
||||
return buildPersonSigner(fileIds,keywordPos,party);
|
||||
} else if (party.getSignerType() == SignerType.ORG) {
|
||||
return buildOrgSigner(fileIds, party);
|
||||
return buildOrgSigner(fileIds,keywordPos,party);
|
||||
} else {
|
||||
throw new IllegalArgumentException("不支持的签署方类型");
|
||||
}
|
||||
@@ -30,23 +31,66 @@ public class JsonSignerBuilder implements SignerBuilder{
|
||||
return val instanceof Number ? ((Number) val).floatValue() : Float.parseFloat(val.toString());
|
||||
}
|
||||
|
||||
private List<SignField> buildSignFields(List<String> fileIds, SignParty party) {
|
||||
private List<SignField> buildSignFields(List<String> fileIds,List<Object> keywordPos, SignParty party) {
|
||||
List<SignField> signFields = new ArrayList<>();
|
||||
for (String fileId : fileIds) {
|
||||
NormalSignFieldConfig normalSignFieldConfig = new NormalSignFieldConfig();
|
||||
normalSignFieldConfig.setAssignedSealId(party.getSealId());
|
||||
normalSignFieldConfig.setFreeMode(true);
|
||||
normalSignFieldConfig.setAutoSign(false);
|
||||
normalSignFieldConfig.setAdaptableSignFieldSize(true);
|
||||
SignField field = new SignField();
|
||||
field.setSignFieldType(0);
|
||||
field.setNormalSignFieldConfig(normalSignFieldConfig);
|
||||
field.setFileId(fileId);
|
||||
signFields.add(field);
|
||||
List<SignFieldPosition> signFieldPositions = null;
|
||||
if(!Boolean.TRUE.equals(party.getFreeSign())){
|
||||
String signKeyword = party.getSignKeyword();
|
||||
signFieldPositions = extractPosition(keywordPos, signKeyword);
|
||||
for (SignFieldPosition position : signFieldPositions) {
|
||||
NormalSignFieldConfig fieldConfig = new NormalSignFieldConfig();
|
||||
fieldConfig.setSignFieldPosition(position);
|
||||
fieldConfig.setAutoSign(party.getAutoSign());
|
||||
fieldConfig.setSignFieldStyle("ALL".equals(position.getAcrossPageMode()) ? 2 : 1);
|
||||
SignField field = new SignField();
|
||||
field.setSignFieldType(0);
|
||||
field.setNormalSignFieldConfig(fieldConfig);
|
||||
field.setFileId(fileId);
|
||||
signFields.add(field);
|
||||
}
|
||||
if(signFieldPositions.size() > 0 && !SignerType.PERSON.equals(party.getSignerType())) {
|
||||
SignField field = new SignField();
|
||||
field.setSignFieldType(0);
|
||||
buildQfSignNormalConfig(party);
|
||||
field.setNormalSignFieldConfig(buildFreeModeSignNormalConfig(party));
|
||||
field.setFileId(fileId);
|
||||
signFields.add(field);
|
||||
}
|
||||
}else {
|
||||
|
||||
SignField field = new SignField();
|
||||
field.setSignFieldType(0);
|
||||
field.setNormalSignFieldConfig(buildFreeModeSignNormalConfig(party));
|
||||
field.setFileId(fileId);
|
||||
signFields.add(field);
|
||||
}
|
||||
}
|
||||
return signFields;
|
||||
}
|
||||
|
||||
private NormalSignFieldConfig buildFreeModeSignNormalConfig(SignParty party) {
|
||||
NormalSignFieldConfig normalSignFieldConfig = new NormalSignFieldConfig();
|
||||
normalSignFieldConfig.setAssignedSealId(party.getSealId());
|
||||
normalSignFieldConfig.setFreeMode(true);
|
||||
normalSignFieldConfig.setAutoSign(false);
|
||||
normalSignFieldConfig.setAdaptableSignFieldSize(true);
|
||||
return normalSignFieldConfig;
|
||||
}
|
||||
|
||||
private NormalSignFieldConfig buildQfSignNormalConfig(SignParty party) {
|
||||
NormalSignFieldConfig normalSignFieldConfig = new NormalSignFieldConfig();
|
||||
normalSignFieldConfig.setAssignedSealId(party.getSealId());
|
||||
normalSignFieldConfig.setFreeMode(false);
|
||||
normalSignFieldConfig.setAutoSign(false);
|
||||
SignFieldPosition qfengposition = new SignFieldPosition();
|
||||
qfengposition.setAcrossPageMode("ALL");
|
||||
qfengposition.setPositionY(party.getQfPos());
|
||||
normalSignFieldConfig.setSignFieldPosition(qfengposition);
|
||||
normalSignFieldConfig.setAdaptableSignFieldSize(true);
|
||||
return normalSignFieldConfig;
|
||||
}
|
||||
|
||||
private Map<String, Object> mapOf(Object... keyValues) {
|
||||
if (keyValues.length % 2 != 0) throw new IllegalArgumentException("key-value 必须成对出现");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@@ -56,7 +100,34 @@ public class JsonSignerBuilder implements SignerBuilder{
|
||||
return map;
|
||||
}
|
||||
|
||||
private Signer buildPersonSigner(List<String> fileIds, SignParty party) {
|
||||
private List<SignFieldPosition> extractPosition(List<Object> positions, String keyword) {
|
||||
if(StringUtils.isBlank(keyword)) {
|
||||
return null;
|
||||
}
|
||||
List<SignFieldPosition> posList = new ArrayList<>();
|
||||
for (Object obj : positions) {
|
||||
Map<String, Object> position = (Map<String, Object>) obj;
|
||||
if (Boolean.TRUE.equals(position.get("searchResult")) && keyword.equals(position.get("keyword"))) {
|
||||
Object[] posArray = (Object[]) position.get("positions");
|
||||
for (Object o : posArray) {
|
||||
Map<String, Object> posMap = (Map<String, Object>)o;
|
||||
Object[] coords = (Object[]) posMap.get("coordinates");
|
||||
for (Object coord : coords) {
|
||||
Map<String,Object> tempMap = (Map<String, Object>) coord;
|
||||
SignFieldPosition sfp = new SignFieldPosition();
|
||||
sfp.setPositionPage(posMap.get("pageNum") + "");
|
||||
sfp.setPositionX(toFloat(tempMap.get("positionX")) + 160f);
|
||||
sfp.setPositionY(toFloat(tempMap.get("positionY")));
|
||||
posList.add(sfp);
|
||||
}
|
||||
}
|
||||
return posList;
|
||||
}
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
private Signer buildPersonSigner(List<String> fileIds,List<Object> keywordPos, SignParty party) {
|
||||
PersonInfo psn = party.getPersonInfo();
|
||||
if (psn == null) throw new IllegalStateException("个人签署方缺少 PersonInfo");
|
||||
Signer signer = new Signer();
|
||||
@@ -73,11 +144,11 @@ public class JsonSignerBuilder implements SignerBuilder{
|
||||
)
|
||||
));
|
||||
}
|
||||
signer.setSignFields(buildSignFields(fileIds, party));
|
||||
signer.setSignFields(buildSignFields(fileIds,keywordPos,party));
|
||||
return signer;
|
||||
}
|
||||
|
||||
private Signer buildOrgSigner(List<String> fileIds,SignParty party) {
|
||||
private Signer buildOrgSigner(List<String> fileIds,List<Object> keywordPos,SignParty party) {
|
||||
OrgInfo org = party.getOrgInfo();
|
||||
Signer signer = new Signer();
|
||||
signer.setSignerType(1);
|
||||
@@ -101,7 +172,7 @@ public class JsonSignerBuilder implements SignerBuilder{
|
||||
)
|
||||
));
|
||||
}
|
||||
signer.setSignFields(buildSignFields(fileIds,party));
|
||||
signer.setSignFields(buildSignFields(fileIds,keywordPos,party));
|
||||
return signer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public class SignParty {
|
||||
|
||||
/** 签署关键字(可为空) */
|
||||
private String signKeyword;
|
||||
private Float qfPos;
|
||||
|
||||
private Boolean freeSign = false;
|
||||
|
||||
@@ -125,4 +126,12 @@ public class SignParty {
|
||||
public void setSignKeyword(String signKeyword) {
|
||||
this.signKeyword = signKeyword;
|
||||
}
|
||||
|
||||
public Float getQfPos() {
|
||||
return qfPos;
|
||||
}
|
||||
|
||||
public void setQfPos(Float qfPos) {
|
||||
this.qfPos = qfPos;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
package com.seeyon.apps.esign.po.signer;
|
||||
|
||||
public enum SignerType {
|
||||
PERSON, ORG
|
||||
PERSON, ORG,LP
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class EsignUploadFileService {
|
||||
for (String path : paths) {
|
||||
file = new File(path);
|
||||
String contentMD5 = EsignUploadFileService.getFileContentMD5(path);
|
||||
GetUploadUrlResp uploadResp = getUploadFileUrl(file.getName(), contentMD5, file.length(),false);
|
||||
GetUploadUrlResp uploadResp = getUploadFileUrl(file.getName(), contentMD5, file.length(),true);
|
||||
uploadFile(uploadResp.getFileUploadUrl(), contentMD5, file.getName(), path);
|
||||
fileIds.add(uploadResp.getFileId());
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@ import com.seeyon.apps.esign.config.EsignConfigProvider;
|
||||
import com.seeyon.apps.esign.constants.EsignConfigConstants;
|
||||
import com.seeyon.apps.esign.po.param.FlowParamSource;
|
||||
import com.seeyon.apps.esign.po.signer.DefaultSignerBuilder;
|
||||
import com.seeyon.apps.esign.po.signer.SignParty;
|
||||
import com.seeyon.apps.esign.po.signer.Signer;
|
||||
import com.seeyon.apps.ext.workflow.vo.FieldDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -35,10 +37,21 @@ public class FlowFormSignParamBuildFactory implements SignParamBuildFactory {
|
||||
Map<String, Object> signFlowConfig = buildSignFlowConfig(source.getContractTitle(),source.getCallbackUrl());
|
||||
DefaultSignerBuilder signerBuilder = new DefaultSignerBuilder();
|
||||
List<String> keywords = new ArrayList<>();
|
||||
keywords.add(configProvider.getBizConfigByKey(EsignConfigConstants.aSignPositionKeyword));
|
||||
keywords.add(configProvider.getBizConfigByKey(EsignConfigConstants.bSignPositionKeyword));
|
||||
keywords.add(configProvider.getBizConfigByKey(EsignConfigConstants.lpSignPositionKeyword));
|
||||
List<Signer> signers = signerBuilder.buildAll(fileIds,getKeywordPos(fileIds,keywords),source.getSignerParties());
|
||||
String aSignPosKeyword = configProvider.getBizConfigByKey(EsignConfigConstants.aSignPositionKeyword);
|
||||
String bSignPosKeyword = configProvider.getBizConfigByKey(EsignConfigConstants.bSignPositionKeyword);
|
||||
String lpSignPosKeyword = configProvider.getBizConfigByKey(EsignConfigConstants.lpSignPositionKeyword);
|
||||
if(StringUtils.isNotBlank(aSignPosKeyword)){
|
||||
keywords.add(aSignPosKeyword);
|
||||
}
|
||||
if(StringUtils.isNotBlank(bSignPosKeyword)){
|
||||
keywords.add(bSignPosKeyword);
|
||||
}
|
||||
if(StringUtils.isNotBlank(lpSignPosKeyword)) {
|
||||
keywords.add(lpSignPosKeyword);
|
||||
}
|
||||
List<Object> keywordPos = getKeywordPos(fileIds, keywords);
|
||||
List<SignParty> signerParties = source.getSignerParties();
|
||||
List<Signer> signers = signerBuilder.buildAll(fileIds,keywordPos,signerParties);
|
||||
signParams.put("signFlowConfig", signFlowConfig);
|
||||
signParams.put("signers", signers);
|
||||
return signParams;
|
||||
|
||||
@@ -5,10 +5,13 @@ import com.seeyon.apps.esign.config.EsignConfigProvider;
|
||||
import com.seeyon.apps.esign.constants.EsignConfigConstants;
|
||||
import com.seeyon.apps.esign.po.param.JsonParamSource;
|
||||
import com.seeyon.apps.esign.po.signer.DefaultSignerBuilder;
|
||||
import com.seeyon.apps.esign.po.signer.JsonSignerBuilder;
|
||||
import com.seeyon.apps.esign.po.signer.SignParty;
|
||||
import com.seeyon.apps.esign.po.signer.Signer;
|
||||
import com.seeyon.apps.ext.workflow.vo.FieldDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -32,13 +35,30 @@ public class NormalFormSignParamBuildFactory implements SignParamBuildFactory {
|
||||
signParams.put("docs", docs);
|
||||
}
|
||||
Map<String, Object> signFlowConfig = buildSignFlowConfig(source.getContractTitle(),source.getCallbackUrl());
|
||||
DefaultSignerBuilder signerBuilder = new DefaultSignerBuilder();
|
||||
List<Signer> signers = signerBuilder.buildAll(fileIds,null,source.getSignerParties());
|
||||
JsonSignerBuilder signerBuilder = new JsonSignerBuilder();
|
||||
List<SignParty> signerParties = source.getSignerParties();
|
||||
List<String> keywords = new ArrayList<>();
|
||||
signerParties.forEach(party -> {
|
||||
if(StringUtils.isNotBlank(party.getSignKeyword())) {
|
||||
keywords.add(party.getSignKeyword());
|
||||
}
|
||||
});
|
||||
List<Object> keywordPos = getKeywordPos(fileIds, keywords);
|
||||
List<Signer> signers = signerBuilder.buildAll(fileIds,keywordPos,signerParties);
|
||||
signParams.put("signFlowConfig", signFlowConfig);
|
||||
signParams.put("signers", signers);
|
||||
return signParams;
|
||||
}
|
||||
|
||||
private List<Object> getKeywordPos(List<String> fileIds,List<String> keywords){
|
||||
List<Object> pos = new ArrayList<>();
|
||||
for (String fileId : fileIds){
|
||||
List<Object> signPosition = uploadFileService.getSignPosition(fileId, keywords);
|
||||
pos.addAll(signPosition);
|
||||
}
|
||||
return pos.size() > 0 ? pos : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean support(SignParamSource source) {
|
||||
return source instanceof JsonParamSource;
|
||||
|
||||
@@ -41,7 +41,7 @@ public interface SignParamSource {
|
||||
/**
|
||||
* 所有签署方(顺序、类型、自动签等都在这里)
|
||||
*/
|
||||
List<SignParty> getSignerParties();
|
||||
List<SignParty> getSignerParties() throws Exception;
|
||||
|
||||
/** 通知类型 */
|
||||
default String noticeTypes() {
|
||||
|
||||
@@ -26,6 +26,7 @@ public class EsignFlowQueryResource extends BaseResource {
|
||||
try {
|
||||
return success(esignFlowQueryService.queryFlow(req.getParameter("eFlowId")));
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return fail("失败");
|
||||
|
||||
@@ -29,6 +29,7 @@ public class EsignTemplateResource extends BaseResource {
|
||||
Map<String, Object> map = esignFileTemplateService.queryTemplates(pageNum);
|
||||
return success(map);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return fail("失败");
|
||||
@@ -43,6 +44,7 @@ public class EsignTemplateResource extends BaseResource {
|
||||
String compareDetailUrl = esignFileTemplateService.getCompareDetailUrl(templateRefId, contractRefId);
|
||||
return success(compareDetailUrl);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return fail("失败");
|
||||
|
||||
Reference in New Issue
Block a user