|
|
@@ -2,6 +2,10 @@ package com.kingdee.eas.custom.esign.util;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.google.common.collect.Maps;
|
|
|
+import com.kingdee.bos.BOSException;
|
|
|
+import com.kingdee.bos.Context;
|
|
|
+import com.kingdee.eas.custom.esign.ESignGlobalStatusOverviewFactory;
|
|
|
+import com.kingdee.eas.custom.esign.IESignGlobalStatusOverview;
|
|
|
import com.kingdee.eas.custom.esign.bizEnum.EsignConfigEnum;
|
|
|
import com.kingdee.eas.custom.esign.tsign.hz.comm.EsignHttpHelper;
|
|
|
import com.kingdee.eas.custom.esign.tsign.hz.comm.EsignHttpResponse;
|
|
|
@@ -33,7 +37,7 @@ public class EsignHttpUtil {
|
|
|
* @return
|
|
|
* @throws EsignException
|
|
|
*/
|
|
|
- public static EsignHttpResponse doCommHttp(String url, String jsonParm, EsignRequestType requestType, Boolean debug,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse doCommHttp(Context ctx,String url, String jsonParm, EsignRequestType requestType, Boolean debug,String sourceId) throws EsignException {
|
|
|
//
|
|
|
//生成签名鉴权方式的的header
|
|
|
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(EsignConfig.getInstance().getEsignAppId(),
|
|
|
@@ -52,14 +56,14 @@ public class EsignHttpUtil {
|
|
|
* @return
|
|
|
* @throws EsignException
|
|
|
*/
|
|
|
- public static EsignHttpResponse POST(String url, String jsonParm, Boolean debug,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse POST(Context ctx,String url, String jsonParm, Boolean debug,String sourceId) throws EsignException {
|
|
|
//请求方法
|
|
|
EsignRequestType requestType = EsignRequestType.POST;
|
|
|
- return doCommHttp(url, jsonParm, requestType, debug, sourceId);
|
|
|
+ return doCommHttp(ctx,url, jsonParm, requestType, debug, sourceId);
|
|
|
}
|
|
|
|
|
|
- public static EsignHttpResponse POST(String url, String jsonParm,String sourceId) throws EsignException {
|
|
|
- return POST(url, jsonParm, false, sourceId);
|
|
|
+ public static EsignHttpResponse POST(Context ctx,String url, String jsonParm,String sourceId) throws EsignException {
|
|
|
+ return POST( ctx,url, jsonParm, false, sourceId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -72,27 +76,27 @@ public class EsignHttpUtil {
|
|
|
* @return
|
|
|
* @throws EsignException
|
|
|
*/
|
|
|
- public static EsignHttpResponse GET(String url, String jsonParm, Boolean debug,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse GET(Context ctx,String url, String jsonParm, Boolean debug,String sourceId) throws EsignException {
|
|
|
//请求方法
|
|
|
EsignRequestType requestType = EsignRequestType.GET;
|
|
|
- return doCommHttp(url, jsonParm, requestType, debug, sourceId);
|
|
|
+ return doCommHttp(ctx,url, jsonParm, requestType, debug, sourceId);
|
|
|
}
|
|
|
|
|
|
- public static EsignHttpResponse GET(String url, String jsonParm,String sourceId) throws EsignException {
|
|
|
- return GET(url, jsonParm, false, sourceId);
|
|
|
+ public static EsignHttpResponse GET(Context ctx,String url, String jsonParm,String sourceId) throws EsignException {
|
|
|
+ return GET(ctx,url, jsonParm, false, sourceId);
|
|
|
}
|
|
|
- public static EsignHttpResponse DELETE(String url, String jsonParm,String sourceId) throws EsignException {
|
|
|
- return DELETE(url, jsonParm, false, sourceId);
|
|
|
+ public static EsignHttpResponse DELETE(Context ctx,String url, String jsonParm,String sourceId) throws EsignException {
|
|
|
+ return DELETE( ctx,url, jsonParm, false, sourceId);
|
|
|
}
|
|
|
- public static EsignHttpResponse DELETE(String url, String jsonParm, Boolean debug,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse DELETE(Context ctx,String url, String jsonParm, Boolean debug,String sourceId) throws EsignException {
|
|
|
//请求方法
|
|
|
EsignRequestType requestType = EsignRequestType.DELETE;
|
|
|
- return doCommHttp(url, jsonParm, requestType, debug, sourceId);
|
|
|
+ return doCommHttp(ctx,url, jsonParm, requestType, debug, sourceId);
|
|
|
}
|
|
|
|
|
|
- public static EsignHttpResponse getDocTemplatesDetailById(String id) throws EsignException {
|
|
|
+ public static EsignHttpResponse getDocTemplatesDetailById(Context ctx,String id) throws EsignException {
|
|
|
|
|
|
- return getDocTemplatesDetailById(id, null);
|
|
|
+ return getDocTemplatesDetailById(ctx,id, null);
|
|
|
}
|
|
|
/**
|
|
|
* 查询合同模板中控件详情
|
|
|
@@ -104,11 +108,11 @@ public class EsignHttpUtil {
|
|
|
* @return
|
|
|
* @throws EsignException
|
|
|
*/
|
|
|
- public static EsignHttpResponse getDocTemplatesDetailById(String id,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse getDocTemplatesDetailById(Context ctx,String id,String sourceId) throws EsignException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.DOCTEMPLATESDETAILBYID_VALUE);
|
|
|
apiaddr = MessageFormat.format(apiaddr, id);
|
|
|
String jsonParm = null;
|
|
|
- return GET(apiaddr, jsonParm, sourceId);
|
|
|
+ return GET( ctx,apiaddr, jsonParm, sourceId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -123,9 +127,9 @@ public class EsignHttpUtil {
|
|
|
* @return
|
|
|
* @throws EsignException
|
|
|
*/
|
|
|
- public static EsignHttpResponse createByDocTemplate(String json,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse createByDocTemplate(Context ctx,String json,String sourceId) throws EsignException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.CREATEBYDOCTEMPLATE_VALUE);
|
|
|
- return POST(apiaddr, json, sourceId);
|
|
|
+ return POST( ctx,apiaddr, json, sourceId);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -148,7 +152,7 @@ public class EsignHttpUtil {
|
|
|
* @return
|
|
|
* @throws EsignException
|
|
|
*/
|
|
|
- public static EsignHttpResponse getOrgIdentity_info(String orgId, String orgName,String orgIDCardNum,String orgIDCardType,String sourceId) throws EsignException, URISyntaxException {
|
|
|
+ public static EsignHttpResponse getOrgIdentity_info(Context ctx,String orgId, String orgName,String orgIDCardNum,String orgIDCardType,String sourceId) throws EsignException, URISyntaxException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.ORGANIZATIONS_IDENTITY_INFO_VALUE);
|
|
|
if (StringUtils.isBlank(orgId)&&StringUtils.isBlank(orgName)) {
|
|
|
if (StringUtils.isNotBlank(orgIDCardNum)&&StringUtils.isBlank(orgIDCardType)) {
|
|
|
@@ -170,16 +174,16 @@ public class EsignHttpUtil {
|
|
|
}
|
|
|
URI uri = uriBuilder.build(); // 自动编码
|
|
|
apiaddr = uri.toString();
|
|
|
- return GET(apiaddr, null, sourceId);
|
|
|
+ return GET( ctx,apiaddr, null, sourceId);
|
|
|
}
|
|
|
- public static EsignHttpResponse getOrgIdentity_infoByOrgId(String orgId) throws EsignException, URISyntaxException {
|
|
|
- return getOrgIdentity_info(orgId, null, null, null, null);
|
|
|
+ public static EsignHttpResponse getOrgIdentity_infoByOrgId(Context ctx,String orgId) throws EsignException, URISyntaxException {
|
|
|
+ return getOrgIdentity_info( ctx,orgId, null, null, null, null);
|
|
|
}
|
|
|
- public static EsignHttpResponse getOrgIdentity_infoByOrgName(String orgName) throws EsignException, URISyntaxException {
|
|
|
- return getOrgIdentity_info(null, orgName, null, null, null);
|
|
|
+ public static EsignHttpResponse getOrgIdentity_infoByOrgName(Context ctx,String orgName) throws EsignException, URISyntaxException {
|
|
|
+ return getOrgIdentity_info( ctx,null, orgName, null, null, null);
|
|
|
}
|
|
|
- public static EsignHttpResponse getOrgIdentity_infoByOrgIDCardNum(String orgIDCardNum,String orgIDCardType) throws EsignException, URISyntaxException {
|
|
|
- return getOrgIdentity_info(null, null, orgIDCardNum, orgIDCardType, null);
|
|
|
+ public static EsignHttpResponse getOrgIdentity_infoByOrgIDCardNum(Context ctx,String orgIDCardNum,String orgIDCardType) throws EsignException, URISyntaxException {
|
|
|
+ return getOrgIdentity_info( ctx,null, null, orgIDCardNum, orgIDCardType, null);
|
|
|
}
|
|
|
/**
|
|
|
* 查询个人认证信息
|
|
|
@@ -202,7 +206,7 @@ public class EsignHttpUtil {
|
|
|
* @return
|
|
|
* @throws EsignException
|
|
|
*/
|
|
|
- public static EsignHttpResponse getPersonIdentity_info(String psnId, String psnAccount,String psnIDCardNum,String psnIDCardType,String sourceId) throws EsignException, URISyntaxException {
|
|
|
+ public static EsignHttpResponse getPersonIdentity_info(Context ctx,String psnId, String psnAccount,String psnIDCardNum,String psnIDCardType,String sourceId) throws EsignException, URISyntaxException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.PERSONS_IDENTITY_INFO_VALUE);
|
|
|
if (StringUtils.isBlank(psnId)&&StringUtils.isBlank(psnAccount)) {
|
|
|
if (StringUtils.isNotBlank(psnIDCardNum)&&StringUtils.isBlank(psnIDCardType)) {
|
|
|
@@ -224,16 +228,16 @@ public class EsignHttpUtil {
|
|
|
}
|
|
|
URI uri = uriBuilder.build(); // 自动编码
|
|
|
apiaddr = uri.toString();
|
|
|
- return GET(apiaddr, null, sourceId);
|
|
|
+ return GET( ctx,apiaddr, null, sourceId);
|
|
|
}
|
|
|
- public static EsignHttpResponse getPersonIdentity_infoByPsnId(String psnId) throws EsignException, URISyntaxException {
|
|
|
- return getPersonIdentity_info(psnId, null, null, null, null);
|
|
|
+ public static EsignHttpResponse getPersonIdentity_infoByPsnId(Context ctx,String psnId) throws EsignException, URISyntaxException {
|
|
|
+ return getPersonIdentity_info( ctx,psnId, null, null, null, null);
|
|
|
}
|
|
|
- public static EsignHttpResponse getPersonIdentity_infoByPsnAccount(String psnAccount) throws EsignException, URISyntaxException {
|
|
|
- return getPersonIdentity_info(null, psnAccount, null, null, null);
|
|
|
+ public static EsignHttpResponse getPersonIdentity_infoByPsnAccount(Context ctx,String psnAccount) throws EsignException, URISyntaxException {
|
|
|
+ return getPersonIdentity_info( ctx,null, psnAccount, null, null, null);
|
|
|
}
|
|
|
- public static EsignHttpResponse getPersonIdentity_infoByOrgIDCardNum(String psnIDCardNum,String psnIDCardType) throws EsignException, URISyntaxException {
|
|
|
- return getPersonIdentity_info(null, null, psnIDCardNum, psnIDCardType, null);
|
|
|
+ public static EsignHttpResponse getPersonIdentity_infoByOrgIDCardNum(Context ctx,String psnIDCardNum,String psnIDCardType) throws EsignException, URISyntaxException {
|
|
|
+ return getPersonIdentity_info( ctx,null, null, psnIDCardNum, psnIDCardType, null);
|
|
|
}
|
|
|
/**
|
|
|
* 查询签署流程详情
|
|
|
@@ -245,13 +249,13 @@ public class EsignHttpUtil {
|
|
|
* @param sourceId 来源id
|
|
|
* @return
|
|
|
*/
|
|
|
- public static EsignHttpResponse getSign_fields(String signFlowId,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse getSign_fields(Context ctx,String signFlowId,String sourceId) throws EsignException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.DETAIL_SIGN_FIELDS_VALUE);
|
|
|
apiaddr = MessageFormat.format(apiaddr, signFlowId);
|
|
|
- return GET(apiaddr, null, sourceId);
|
|
|
+ return GET( ctx,apiaddr, null, sourceId);
|
|
|
}
|
|
|
- public static EsignHttpResponse getSign_fields(String signFlowId) throws EsignException {
|
|
|
- return getSign_fields(signFlowId,null);
|
|
|
+ public static EsignHttpResponse getSign_fields(Context ctx,String signFlowId) throws EsignException {
|
|
|
+ return getSign_fields( ctx,signFlowId,null);
|
|
|
}
|
|
|
/**
|
|
|
* 追加签署区
|
|
|
@@ -266,10 +270,10 @@ public class EsignHttpUtil {
|
|
|
* @param sourceId 来源id
|
|
|
* @return
|
|
|
*/
|
|
|
- public static EsignHttpResponse addSign_fields(String signFlowId,String json,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse addSign_fields(Context ctx,String signFlowId,String json,String sourceId) throws EsignException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.ADD_SIGN_FIELDS_VALUE);
|
|
|
apiaddr = MessageFormat.format(apiaddr, signFlowId);
|
|
|
- return POST(apiaddr, json, sourceId);
|
|
|
+ return POST( ctx,apiaddr, json, sourceId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -285,7 +289,7 @@ public class EsignHttpUtil {
|
|
|
* @param sourceId 来源id
|
|
|
* @return
|
|
|
*/
|
|
|
- public static EsignHttpResponse delSign_fields(String signFlowId,String signFieldIds,String sourceId) throws EsignException, URISyntaxException {
|
|
|
+ public static EsignHttpResponse delSign_fields(Context ctx,String signFlowId,String signFieldIds,String sourceId) throws EsignException, URISyntaxException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.DEL_SIGN_FIELDS_VALUE );
|
|
|
apiaddr = MessageFormat.format(apiaddr, signFlowId);
|
|
|
URIBuilder uriBuilder = new URIBuilder(apiaddr);
|
|
|
@@ -294,7 +298,7 @@ public class EsignHttpUtil {
|
|
|
}
|
|
|
URI uri = uriBuilder.build(); // 自动编码
|
|
|
apiaddr = uri.toString();
|
|
|
- return DELETE(apiaddr, null, sourceId);
|
|
|
+ return DELETE( ctx,apiaddr, null, sourceId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -313,10 +317,10 @@ public class EsignHttpUtil {
|
|
|
* @param sourceId 来源id
|
|
|
* @return
|
|
|
*/
|
|
|
- public static EsignHttpResponse addCopiers(String signFlowId,String json,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse addCopiers(Context ctx,String signFlowId,String json,String sourceId) throws EsignException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.ADD_COPIERS_VALUE );
|
|
|
apiaddr = MessageFormat.format(apiaddr, signFlowId);
|
|
|
- return POST(apiaddr, json, sourceId);
|
|
|
+ return POST( ctx,apiaddr, json, sourceId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -331,10 +335,10 @@ public class EsignHttpUtil {
|
|
|
* @param sourceId 来源id
|
|
|
* @return
|
|
|
*/
|
|
|
- public static EsignHttpResponse delCopiers(String signFlowId,String json,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse delCopiers(Context ctx,String signFlowId,String json,String sourceId) throws EsignException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.DEL_COPIERS_VALUE);
|
|
|
apiaddr = MessageFormat.format(apiaddr, signFlowId);
|
|
|
- return POST(apiaddr, json, sourceId);
|
|
|
+ return POST( ctx,apiaddr, json, sourceId);
|
|
|
}
|
|
|
/**
|
|
|
* 基于文件发起签署
|
|
|
@@ -360,13 +364,14 @@ public class EsignHttpUtil {
|
|
|
* @param sourceId 来源id
|
|
|
* @return
|
|
|
*/
|
|
|
- public static EsignHttpResponse create_by_file(String json,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse create_by_file(Context ctx,String json,String sourceId) throws EsignException, BOSException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.CREATE_BY_FILE_VALUE);
|
|
|
/**
|
|
|
* 发起签署前需要新增电子签全域状态总览表
|
|
|
*/
|
|
|
-
|
|
|
- return POST(apiaddr, json, sourceId);
|
|
|
+ IESignGlobalStatusOverview globalStatusOverview = ESignGlobalStatusOverviewFactory.getLocalInstance(ctx);
|
|
|
+
|
|
|
+ return POST( ctx,apiaddr, json, sourceId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -380,10 +385,10 @@ public class EsignHttpUtil {
|
|
|
* @param sourceId 来源id
|
|
|
* @return
|
|
|
*/
|
|
|
- public static EsignHttpResponse start_by_file(String signFlowId,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse start_by_file(Context ctx,String signFlowId,String sourceId) throws EsignException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.START_BY_FILE_VALUE);
|
|
|
apiaddr = MessageFormat.format(apiaddr, signFlowId);
|
|
|
- return POST(apiaddr, null, sourceId);
|
|
|
+ return POST( ctx,apiaddr, null, sourceId);
|
|
|
}
|
|
|
/**
|
|
|
* 撤销签署流程
|
|
|
@@ -397,13 +402,13 @@ public class EsignHttpUtil {
|
|
|
* @param sourceId 来源id
|
|
|
* @return
|
|
|
*/
|
|
|
- public static EsignHttpResponse revoke_by_file(String signFlowId,String revokeReason,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse revoke_by_file(Context ctx,String signFlowId,String revokeReason,String sourceId) throws EsignException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.REVOKE_BY_FILE_VALUE);
|
|
|
apiaddr = MessageFormat.format(apiaddr, signFlowId);
|
|
|
Map<String,String> jsonMap = Maps.newHashMap();
|
|
|
jsonMap.put("revokeReason",(StringUtils.isNotBlank(revokeReason)?revokeReason:""));
|
|
|
String json = JSON.toJSONString(jsonMap);
|
|
|
- return POST(apiaddr, json, sourceId);
|
|
|
+ return POST( ctx,apiaddr, json, sourceId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -419,10 +424,10 @@ public class EsignHttpUtil {
|
|
|
* @param sourceId 来源id
|
|
|
* @return
|
|
|
*/
|
|
|
- public static EsignHttpResponse urge_by_file(String signFlowId,String json,String sourceId) throws EsignException {
|
|
|
+ public static EsignHttpResponse urge_by_file(Context ctx,String signFlowId,String json,String sourceId) throws EsignException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.URGE_BY_FILE_VALUE);
|
|
|
apiaddr = MessageFormat.format(apiaddr, signFlowId);
|
|
|
- return POST(apiaddr, json, sourceId);
|
|
|
+ return POST( ctx,apiaddr, json, sourceId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -440,7 +445,7 @@ public class EsignHttpUtil {
|
|
|
* @param sourceId 来源id
|
|
|
* @return
|
|
|
*/
|
|
|
- public static EsignHttpResponse getFile_download_url(String signFlowId,Integer urlAvailableDate,String sourceId) throws EsignException, URISyntaxException {
|
|
|
+ public static EsignHttpResponse getFile_download_url(Context ctx,String signFlowId,Integer urlAvailableDate,String sourceId) throws EsignException, URISyntaxException {
|
|
|
String apiaddr = EsignConfig.getInstance().get(EsignConfigEnum.FILE_DOWNLOAD_URL_VALUE);
|
|
|
apiaddr = MessageFormat.format(apiaddr, signFlowId);
|
|
|
if (null!=urlAvailableDate&&urlAvailableDate>0&&urlAvailableDate<=3600) {
|
|
|
@@ -449,7 +454,7 @@ public class EsignHttpUtil {
|
|
|
URI uri = uriBuilder.build(); // 自动编码
|
|
|
apiaddr = uri.toString();
|
|
|
}
|
|
|
- return GET(apiaddr, null, sourceId);
|
|
|
+ return GET( ctx,apiaddr, null, sourceId);
|
|
|
}
|
|
|
|
|
|
|