zqy пре 1 месец
родитељ
комит
9e0c1d09dc

+ 24 - 1
metadata/com/kingdee/eas/custom/esign/bizEnum/EsignConfigEnum.enum

@@ -182,6 +182,18 @@
             <userDefined>true</userDefined>
             <value>draft_detail</value>
         </enumValue>
+        <enumValue>
+            <name>sign_flow_rescind</name>
+            <alias>bizEnum[com.kingdee.eas.custom.esign.bizEnum.EsignConfigEnum].enumValues.enumValue[sign_flow_rescind].alias</alias>
+            <userDefined>true</userDefined>
+            <value>sign_flow_rescind</value>
+        </enumValue>
+        <enumValue>
+            <name>urge_filling</name>
+            <alias>bizEnum[com.kingdee.eas.custom.esign.bizEnum.EsignConfigEnum].enumValues.enumValue[urge_filling].alias</alias>
+            <userDefined>true</userDefined>
+            <value>urge_filling</value>
+        </enumValue>
     </enumValues>
     <resource>
         <rs key="bizEnum[com.kingdee.eas.custom.esign.bizEnum.EsignConfigEnum].alias">
@@ -352,6 +364,12 @@
             <lang locale="zh_HK" value="查詢簽署流程列表" />
             <lang locale="zh_TW" value="查詢簽署流程列表" />
         </rs>
+        <rs key="bizEnum[com.kingdee.eas.custom.esign.bizEnum.EsignConfigEnum].enumValues.enumValue[sign_flow_rescind].alias">
+            <lang locale="en_US" value="null" />
+            <lang locale="zh_CN" value="撤销合同拟定" />
+            <lang locale="zh_HK" value="撤銷合同擬定" />
+            <lang locale="zh_TW" value="撤銷合同擬定" />
+        </rs>
         <rs key="bizEnum[com.kingdee.eas.custom.esign.bizEnum.EsignConfigEnum].enumValues.enumValue[sign_templates_detail].alias">
             <lang locale="en_US" value="null" />
             <lang locale="zh_CN" value="查询流程模板详情" />
@@ -370,6 +388,12 @@
             <lang locale="zh_HK" value="催簽流程中簽署人" />
             <lang locale="zh_TW" value="催簽流程中簽署人" />
         </rs>
+        <rs key="bizEnum[com.kingdee.eas.custom.esign.bizEnum.EsignConfigEnum].enumValues.enumValue[urge_filling].alias">
+            <lang locale="en_US" value="null" />
+            <lang locale="zh_CN" value="催填流程中填写人" />
+            <lang locale="zh_HK" value="催填流程中填寫人" />
+            <lang locale="zh_TW" value="催填流程中填寫人" />
+        </rs>
         <rs key="bizEnum[com.kingdee.eas.custom.esign.bizEnum.EsignConfigEnum].extendedProperty.userDefined">
             <lang locale="en_US" value="true" />
             <lang locale="zh_CN" value="true" />
@@ -377,4 +401,3 @@
         </rs>
     </resource>
 </bizEnum>
-

+ 9 - 1
properties/esign/esignConfig.properties

@@ -56,4 +56,12 @@ keyword_positions=/v3/files/{0}/keyword-positions
 get_seal_position_url=/v3/files/get-seal-position-url
 
 #查询签署流程列表
-sign_flow_list=/v3/organizations/sign-flow-list
+sign_flow_list=/v3/organizations/sign-flow-list
+#通过流程模板创建合同拟定和签署流程
+createBySignTemplate=/v3/sign-flow/create-by-sign-template
+#查询流程模板详情
+sign_templates_detail=/v3/sign-templates/detail
+#撤销合同拟定
+sign_flow_rescind=/v3/sign-flow/{0}/rescind
+#催填流程中填写人
+urge_filling=/v3/sign-flow/{0}/urge-filling

+ 6 - 0
src/com/kingdee/eas/custom/esign/bizEnum/EsignConfigEnum.java

@@ -41,6 +41,9 @@ public class EsignConfigEnum extends StringEnum
     public static final String SIGN_FLOW_LIST_VALUE = "sign_flow_list";//alias=查询签署流程列表
     public static final String CREATEBYSIGNTEMPLATE_VALUE = "createBySignTemplate";//alias=通过流程模板创建合同拟定和签署流程
     public static final String SIGN_TEMPLATES_DETAIL_VALUE = "sign_templates_detail";//alias=查询流程模板详情
+    public static final String DRAFT_DETAIL_VALUE = "draft_detail";//alias=查询合同拟定详情
+    public static final String SIGN_FLOW_RESCIND_VALUE = "sign_flow_rescind";//alias=撤销合同拟定
+    public static final String URGE_FILLING_VALUE = "urge_filling";//alias=催填流程中填写人
 
     public static final EsignConfigEnum EsignAppId = new EsignConfigEnum("EsignAppId", ESIGNAPPID_VALUE);
     public static final EsignConfigEnum EsignAppSecret = new EsignConfigEnum("EsignAppSecret", ESIGNAPPSECRET_VALUE);
@@ -70,6 +73,9 @@ public class EsignConfigEnum extends StringEnum
     public static final EsignConfigEnum sign_flow_list = new EsignConfigEnum("sign_flow_list", SIGN_FLOW_LIST_VALUE);
     public static final EsignConfigEnum createBySignTemplate = new EsignConfigEnum("createBySignTemplate", CREATEBYSIGNTEMPLATE_VALUE);
     public static final EsignConfigEnum sign_templates_detail = new EsignConfigEnum("sign_templates_detail", SIGN_TEMPLATES_DETAIL_VALUE);
+    public static final EsignConfigEnum draft_detail = new EsignConfigEnum("draft_detail", DRAFT_DETAIL_VALUE);
+    public static final EsignConfigEnum sign_flow_rescind = new EsignConfigEnum("sign_flow_rescind", SIGN_FLOW_RESCIND_VALUE);
+    public static final EsignConfigEnum urge_filling = new EsignConfigEnum("urge_filling", URGE_FILLING_VALUE);
 
     /**
      * construct function

+ 3 - 0
src/com/kingdee/eas/custom/esign/bizEnum/EsignConfigEnum.properties

@@ -26,3 +26,6 @@ get_seal_position_url=\u83B7\u53D6\u62D6\u7AE0\u5B9A\u4F4D\u9875\u9762
 sign_flow_list=\u67E5\u8BE2\u7B7E\u7F72\u6D41\u7A0B\u5217\u8868
 createBySignTemplate=\u901A\u8FC7\u6D41\u7A0B\u6A21\u677F\u521B\u5EFA\u5408\u540C\u62DF\u5B9A\u548C\u7B7E\u7F72\u6D41\u7A0B
 sign_templates_detail=\u67E5\u8BE2\u6D41\u7A0B\u6A21\u677F\u8BE6\u60C5
+draft_detail=\u67E5\u8BE2\u5408\u540C\u62DF\u5B9A\u8BE6\u60C5
+sign_flow_rescind=\u64A4\u9500\u5408\u540C\u62DF\u5B9A
+urge_filling=\u50AC\u586B\u6D41\u7A0B\u4E2D\u586B\u5199\u4EBA

+ 3 - 0
src/com/kingdee/eas/custom/esign/bizEnum/EsignConfigEnum_l1.properties

@@ -26,3 +26,6 @@ get_seal_position_url=
 sign_flow_list=
 createBySignTemplate=
 sign_templates_detail=
+draft_detail=
+sign_flow_rescind=
+urge_filling=

+ 3 - 0
src/com/kingdee/eas/custom/esign/bizEnum/EsignConfigEnum_l2.properties

@@ -26,3 +26,6 @@ get_seal_position_url=\u83B7\u53D6\u62D6\u7AE0\u5B9A\u4F4D\u9875\u9762
 sign_flow_list=\u67E5\u8BE2\u7B7E\u7F72\u6D41\u7A0B\u5217\u8868
 createBySignTemplate=\u901A\u8FC7\u6D41\u7A0B\u6A21\u677F\u521B\u5EFA\u5408\u540C\u62DF\u5B9A\u548C\u7B7E\u7F72\u6D41\u7A0B
 sign_templates_detail=\u67E5\u8BE2\u6D41\u7A0B\u6A21\u677F\u8BE6\u60C5
+draft_detail=\u67E5\u8BE2\u5408\u540C\u62DF\u5B9A\u8BE6\u60C5
+sign_flow_rescind=\u64A4\u9500\u5408\u540C\u62DF\u5B9A
+urge_filling=\u50AC\u586B\u6D41\u7A0B\u4E2D\u586B\u5199\u4EBA

+ 3 - 0
src/com/kingdee/eas/custom/esign/bizEnum/EsignConfigEnum_l3.properties

@@ -26,3 +26,6 @@ get_seal_position_url=\u7372\u53D6\u62D6\u7AE0\u5B9A\u4F4D\u9801\u9762
 sign_flow_list=\u67E5\u8A62\u7C3D\u7F72\u6D41\u7A0B\u5217\u8868
 createBySignTemplate=\u901A\u904E\u6D41\u7A0B\u7BC4\u672C\u5275\u5EFA\u5408\u540C\u64EC\u5B9A\u548C\u7C3D\u7F72\u6D41\u7A0B
 sign_templates_detail=\u67E5\u8A62\u6D41\u7A0B\u7BC4\u672C\u8A73\u60C5
+draft_detail=\u67E5\u8A62\u5408\u540C\u64EC\u5B9A\u8A73\u60C5
+sign_flow_rescind=\u64A4\u92B7\u5408\u540C\u64EC\u5B9A
+urge_filling=\u50AC\u586B\u6D41\u7A0B\u4E2D\u586B\u5BEB\u4EBA

+ 7 - 2
src/com/kingdee/eas/custom/esign/tsign/hz/comm/EsignHttpHelper.java

@@ -3,6 +3,7 @@ package com.kingdee.eas.custom.esign.tsign.hz.comm;
 import com.kingdee.eas.custom.esign.tsign.hz.enums.EsignHeaderConstant;
 import com.kingdee.eas.custom.esign.tsign.hz.enums.EsignRequestType;
 import com.kingdee.eas.custom.esign.tsign.hz.exception.EsignException;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -97,8 +98,12 @@ public class EsignHttpHelper {
 			paramStr=null;
 			contentMD5="";
 		} else if("PUT".equals(httpMethod)||"POST".equals(httpMethod)){
-			//对body体做md5摘要
-			contentMD5=EsignEncryption.doContentMD5(paramStr);
+			if(StringUtils.isNotBlank(paramStr)) {
+				//对body体做md5摘要
+				contentMD5 = EsignEncryption.doContentMD5(paramStr);
+			}else {
+				contentMD5 = "";
+			}
 		}else{
 			throw new EsignException(String.format("不支持的请求方法%s",httpMethod));
 		}

+ 43 - 4
src/com/kingdee/eas/custom/esign/util/EsignHttpUtil.java

@@ -237,10 +237,11 @@ public class EsignHttpUtil {
         StringBuilder cum = new StringBuilder();
         JSONObject jsonObject = JSON.parseObject(json);
         if(null!=jsonObject) {
-            JSONArray participants = jsonObject.getJSONArray("participants");
-            if (null!=participants){
-                for(int i=0;i<participants.size();i++ ){
-                    JSONObject participant = participants.getJSONObject(i);
+            //JSONArray participants = jsonObject.getJSONArray("participants");
+            JSONArray stubborn_participants = jsonObject.getJSONArray("stubborn_participants");
+            if (null!=stubborn_participants){
+                for(int i=0;i<stubborn_participants.size();i++ ){
+                    JSONObject participant = stubborn_participants.getJSONObject(i);
                     String participantFlag = participant.getString("participantFlag");
                     JSONObject orgParticipant = participant.getJSONObject("orgParticipant");
                     if(null!=orgParticipant) {
@@ -940,4 +941,42 @@ public class EsignHttpUtil {
         //发起接口请求
         return GET(ctx, apiaddr, null, sourceId, configEnum);
     }
+    /**
+     * 撤销合同拟定
+     * 参考文档:https://open.esign.cn/doc/opendoc/file-and-template3/ktmf18mgqx8zr4uk
+     * 接口地址:https://{host}/v3/sign-flow/{signFlowId}/rescind
+     * @param ctx
+     * @param signFlowId
+     * @param sourceId
+     * 请求方法:GET
+     */
+    public static EsignHttpResponse sign_flow_rescind(Context ctx, String signFlowId, String sourceId) throws EsignException, URISyntaxException {
+        EsignConfigEnum configEnum = EsignConfigEnum.sign_flow_rescind;
+        String apiaddr = EsignConfig.getInstance().get(configEnum.getValue());
+        apiaddr = MessageFormat.format(apiaddr, signFlowId);
+        //发起接口请求
+        return POST(ctx, apiaddr, null, sourceId, configEnum);
+    }
+
+    /**
+     * 催填流程中填写人
+     * 参考文档:https://open.esign.cn/doc/opendoc/file-and-template3/smrt7qcdgmvqk8gg
+     * 接口地址:https://{host}/v3/sign-flow/{signFlowId}/urge-filling
+     * @param ctx
+     * @param psnAccount 被催填人账号标识(手机号/邮箱)
+     * @param signFlowId
+     * @param sourceId
+     * 请求方法:GET
+     */
+    public static EsignHttpResponse urge_filling(Context ctx, String signFlowId,String psnAccount, String sourceId) throws EsignException, URISyntaxException {
+        EsignConfigEnum configEnum = EsignConfigEnum.urge_filling;
+        String apiaddr = EsignConfig.getInstance().get(configEnum.getValue());
+        apiaddr = MessageFormat.format(apiaddr, signFlowId);
+        Map<String,Object> josn = Maps.newHashMap();
+        Map<String,Object> urgedOperator = Maps.newHashMap();
+        josn.put("urgedOperator",urgedOperator);
+        urgedOperator.put("psnAccount",psnAccount);
+        //发起接口请求
+        return POST(ctx, apiaddr, JSON.toJSONString(josn), sourceId, configEnum);
+    }
 }

+ 128 - 59
websrc/com/kingdee/eas/custom/esign/handler/ESignGlobalStatusOverviewListHandler.java

@@ -181,17 +181,58 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
             if (StringUtils.isBlank(info.getSignFlowId())) {
                 throw new EsignException("没有签署流程id");
             }
-            EsignHttpResponse httpRes = EsignHttpUtil.revoke_by_file(this.getCtx(), info.getSignFlowId(), revokeReason, info.getEfileId());
+            boolean isSess = false;
+            EsignHttpResponse httpRes = EsignHttpUtil.sign_flow_rescind(this.getCtx(), info.getSignFlowId(), info.getEfileId());
             if (httpRes.getStatus() >= 200 && httpRes.getStatus() < 300) {
                 JSONObject object = JSON.parseObject(httpRes.getBody());
                 if ("0".equals(String.valueOf(object.get("code")))) {
-
                     BatchMessageTipsBody body = new BatchMessageTipsBody();
                     body.setMuitTipsState(Boolean.TRUE);
                     body.setMuitTipsMessage(httpRes.getBody());
                     body.setId(billId);
                     batchMessageTipsHeader.addResult(body);
+                    info.setEsignStatus(EsignStatusEnum.REVOKED);
+                    globalStatusOverview.save(info);
                     success++;
+                    isSess = true;
+                } else {
+                    isSess = false;
+                }
+            } else {
+                isSess = false;
+            }
+            if (!isSess) {
+                httpRes = EsignHttpUtil.revoke_by_file(this.getCtx(), info.getSignFlowId(), revokeReason, info.getEfileId());
+                if (httpRes.getStatus() >= 200 && httpRes.getStatus() < 300) {
+                    JSONObject object = JSON.parseObject(httpRes.getBody());
+                    if ("0".equals(String.valueOf(object.get("code")))) {
+
+                        BatchMessageTipsBody body = new BatchMessageTipsBody();
+                        body.setMuitTipsState(Boolean.TRUE);
+                        body.setMuitTipsMessage(httpRes.getBody());
+                        body.setId(billId);
+                        batchMessageTipsHeader.addResult(body);
+                        info.setEsignStatus(EsignStatusEnum.REVOKED);
+                        globalStatusOverview.save(info);
+                        success++;
+                    } else {
+                        if(httpRes.getBody().indexOf("流程不存在:")>0){
+                            BatchMessageTipsBody body = new BatchMessageTipsBody();
+                            body.setMuitTipsState(Boolean.TRUE);
+                            body.setMuitTipsMessage(httpRes.getBody());
+                            body.setId(billId);
+                            batchMessageTipsHeader.addResult(body);
+                            info.setEsignStatus(EsignStatusEnum.REVOKED);
+                            globalStatusOverview.save(info);
+                            success++;
+                        }else {
+                            BatchMessageTipsBody body = new BatchMessageTipsBody();
+                            body.setMuitTipsState(Boolean.FALSE);
+                            body.setMuitTipsMessage(httpRes.getBody());
+                            body.setId(billId);
+                            batchMessageTipsHeader.addResult(body);
+                        }
+                    }
                 } else {
                     BatchMessageTipsBody body = new BatchMessageTipsBody();
                     body.setMuitTipsState(Boolean.FALSE);
@@ -199,14 +240,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
                     body.setId(billId);
                     batchMessageTipsHeader.addResult(body);
                 }
-            } else {
-                BatchMessageTipsBody body = new BatchMessageTipsBody();
-                body.setMuitTipsState(Boolean.FALSE);
-                body.setMuitTipsMessage(httpRes.getBody());
-                body.setId(billId);
-                batchMessageTipsHeader.addResult(body);
             }
-
         } catch (EsignException e) {
             e.printStackTrace();
             throw new ShrWebBizException(e);
@@ -259,30 +293,8 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
             if (StringUtils.isBlank(info.getSignFlowId())) {
                 throw new EsignException("没有签署流程id");
             }
-            String json = info.getRequestParams();
-            JSONObject params = JSON.parseObject(json);
-            Map<String, Object> jsonMap = Maps.newHashMap();
-            Set<String> noticeSet = Sets.newHashSet();
-            JSONArray jsonArray = params.getJSONArray("signers");
-            if(null!=jsonArray) {
-                for (int i = 0; i < jsonArray.size(); i++) {
-                    JSONObject param = jsonArray.getJSONObject(i);
-                    JSONObject noticeConfig = param.getJSONObject("noticeConfig");
-                    if (null != noticeConfig) {
-                        String noticeTypeStr = noticeConfig.getString("noticeTypes");
-                        if (StringUtils.isNotBlank(noticeTypeStr)) {
-                            String[] noticeTypes = noticeTypeStr.split(",");
-                            for (String nts : noticeTypes) {
-                                noticeSet.add(nts);
-                            }
-                        }
-                    }
-                }
-                jsonMap.put("noticeTypes", StringUtils.join(noticeSet.toArray(), ","));
-            }else {
-                jsonMap.put("noticeTypes", "1,2");
-            }
-            EsignHttpResponse httpRes = EsignHttpUtil.urge_by_file(this.getCtx(), info.getSignFlowId(), JSON.toJSONString(jsonMap), info.getEfileId());
+            boolean isSess=false;
+            EsignHttpResponse httpRes = EsignHttpUtil.urge_filling(this.getCtx(), info.getSignFlowId(), null,info.getEfileId());
             if (httpRes.getStatus() >= 200 && httpRes.getStatus() < 300) {
                 JSONObject object = JSON.parseObject(httpRes.getBody());
                 if ("0".equals(String.valueOf(object.get("code")))) {
@@ -293,6 +305,64 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
                     body.setId(billId);
                     batchMessageTipsHeader.addResult(body);
                     success++;
+                    isSess=true;
+                } else {
+                    if("1451001".equals(String.valueOf(object.get("code")))) {
+                        BatchMessageTipsBody body = new BatchMessageTipsBody();
+                        body.setMuitTipsState(Boolean.FALSE);
+                        body.setMuitTipsMessage(httpRes.getBody());
+                        body.setId(billId);
+                        batchMessageTipsHeader.addResult(body);
+                        //{"code":1451001,"message":"重复催办: 您刚刚催办过,发起半小时后每十分钟仅可催办一次。","data":null}
+                        isSess = true;
+                    }else {
+                        isSess = false;
+                    }
+                }
+            } else {
+                isSess=false;
+            }
+            if(!isSess) {
+                String json = info.getRequestParams();
+                JSONObject params = JSON.parseObject(json);
+                Map<String, Object> jsonMap = Maps.newHashMap();
+                Set<String> noticeSet = Sets.newHashSet();
+                JSONArray jsonArray = params.getJSONArray("signers");
+                if (null != jsonArray) {
+                    for (int i = 0; i < jsonArray.size(); i++) {
+                        JSONObject param = jsonArray.getJSONObject(i);
+                        JSONObject noticeConfig = param.getJSONObject("noticeConfig");
+                        if (null != noticeConfig) {
+                            String noticeTypeStr = noticeConfig.getString("noticeTypes");
+                            if (StringUtils.isNotBlank(noticeTypeStr)) {
+                                String[] noticeTypes = noticeTypeStr.split(",");
+                                for (String nts : noticeTypes) {
+                                    noticeSet.add(nts);
+                                }
+                            }
+                        }
+                    }
+                    jsonMap.put("noticeTypes", StringUtils.join(noticeSet.toArray(), ","));
+                } else {
+                    jsonMap.put("noticeTypes", "1,2");
+                }
+                httpRes = EsignHttpUtil.urge_by_file(this.getCtx(), info.getSignFlowId(), JSON.toJSONString(jsonMap), info.getEfileId());
+                if (httpRes.getStatus() >= 200 && httpRes.getStatus() < 300) {
+                    JSONObject object = JSON.parseObject(httpRes.getBody());
+                    if ("0".equals(String.valueOf(object.get("code")))) {
+                        BatchMessageTipsBody body = new BatchMessageTipsBody();
+                        body.setMuitTipsState(Boolean.TRUE);
+                        body.setMuitTipsMessage(httpRes.getBody());
+                        body.setId(billId);
+                        batchMessageTipsHeader.addResult(body);
+                        success++;
+                    } else {
+                        BatchMessageTipsBody body = new BatchMessageTipsBody();
+                        body.setMuitTipsState(Boolean.FALSE);
+                        body.setMuitTipsMessage(httpRes.getBody());
+                        body.setId(billId);
+                        batchMessageTipsHeader.addResult(body);
+                    }
                 } else {
                     BatchMessageTipsBody body = new BatchMessageTipsBody();
                     body.setMuitTipsState(Boolean.FALSE);
@@ -300,12 +370,6 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
                     body.setId(billId);
                     batchMessageTipsHeader.addResult(body);
                 }
-            } else {
-                BatchMessageTipsBody body = new BatchMessageTipsBody();
-                body.setMuitTipsState(Boolean.FALSE);
-                body.setMuitTipsMessage(httpRes.getBody());
-                body.setId(billId);
-                batchMessageTipsHeader.addResult(body);
             }
         } catch (EsignException e) {
             e.printStackTrace();
@@ -323,6 +387,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
 
     /**
      * 预览附件
+     *
      * @param request
      * @param response
      * @param modelMap
@@ -380,7 +445,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
                 } else {
                     EsignHttpResponse responsesf = EsignHttpUtil.getSign_fields(this.getCtx(), info.getSignFlowId(), info.getEfileId());
                     JSONObject params = JSON.parseObject(responsesf.getBody());
-                    if ( 0 == params.getInteger("code")) {
+                    if (0 == params.getInteger("code")) {
                         JSONObject data = params.getJSONObject("data");
                         JSONArray docs = data.getJSONArray("docs");
                         this.saveDocsPreviewFile(info, docs);
@@ -408,6 +473,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
         this.writeSuccessData(batchMessageTipsHeader);
         return null;
     }
+
     public void saveDocsFile(ESignGlobalStatusOverviewInfo info) throws EsignException, URISyntaxException, IOException, ShrWebBizException, BOSException, EASBizException {
         EsignHttpResponse response1;
         response1 = EsignHttpUtil.getFile_download_url(this.getCtx(), info.getSignFlowId(), 3600, info.getEfileId());
@@ -416,14 +482,14 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
         if (code == 0) {
             JSONObject jsonData = jsonObject.getJSONObject("data");
             JSONArray files = jsonData.getJSONArray("files");
-            if(null!=files) {
+            if (null != files) {
                 for (int i = 0; i < files.size(); i++) {
                     JSONObject fileMap = files.getJSONObject(i);
                     this.saveAttachment(this.getCtx(), info, fileMap, "com.kingdee.eas.custom.esign.app.ESignGlobalStatusOverview.list", "files");
                 }
             }
             JSONArray attachments = jsonData.getJSONArray("attachments");
-            if(null!=attachments) {
+            if (null != attachments) {
                 for (int i = 0; i < attachments.size(); i++) {
                     JSONObject fileMap = attachments.getJSONObject(i);
                     this.saveAttachment(this.getCtx(), info, fileMap, "com.kingdee.eas.custom.esign.app.ESignGlobalStatusOverview.list", "attachments");
@@ -431,6 +497,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
             }
         }
     }
+
     public void saveDocsPreviewFile(ESignGlobalStatusOverviewInfo info, JSONArray docs) throws EsignException, URISyntaxException, IOException, ShrWebBizException, BOSException, EASBizException {
         EsignHttpResponse response1;
         for (int i = 0; i < docs.size(); i++) {
@@ -447,7 +514,8 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
     }
 
     /**
-     *  同步签署状态信息
+     * 同步签署状态信息
+     *
      * @param request
      * @param response
      * @param modelMap
@@ -469,11 +537,11 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
             selectorItemCollection.add(new SelectorItemInfo("person.id"));
             selectorItemCollection.add(new SelectorItemInfo("operator.id"));
             ESignGlobalStatusOverviewInfo info = globalStatusOverview.getESignGlobalStatusOverviewInfo(new ObjectUuidPK(billId));
-            if (null!=info&&StringUtils.isBlank(info.getSignFlowId())) {
+            if (null != info && StringUtils.isBlank(info.getSignFlowId())) {
                 throw new EsignException("没有签署流程id");
             }
 
-            EsignHttpResponse res = EsignHttpUtil.getSign_fields(this.getCtx(),info.getSignFlowId(),info.getEfileId());
+            EsignHttpResponse res = EsignHttpUtil.getSign_fields(this.getCtx(), info.getSignFlowId(), info.getEfileId());
             if (res.getStatus() >= 200 && res.getStatus() < 300) {
                 JSONObject jsonObject = JSON.parseObject(res.getBody());
                 Integer code = (Integer) jsonObject.get("code");
@@ -487,7 +555,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
                     SelectorItemCollection selectorUpdatePartial = new SelectorItemCollection();
                     selectorUpdatePartial.add(new SelectorItemInfo("esignStatus"));
                     selectorUpdatePartial.add(new SelectorItemInfo("description"));
-                    globalStatusOverview.updatePartial(info,selectorUpdatePartial);
+                    globalStatusOverview.updatePartial(info, selectorUpdatePartial);
                 }
             }
             BatchMessageTipsBody body = new BatchMessageTipsBody();
@@ -509,8 +577,10 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
         this.writeSuccessData(batchMessageTipsHeader);
         return null;
     }
+
     /**
-     *  同步签署完成附件
+     * 同步签署完成附件
+     *
      * @param request
      * @param response
      * @param modelMap
@@ -538,7 +608,7 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
 //            if (!info.isFivouchered()) {
 //                throw new EsignException("电子签全域状态总览表 [{0}],签署文件已经同步,请勿重复同步");
 //            }
-            SyncSignedFilesUtil.syncAttachmentsForEmpPage(this.getCtx(),billId);
+            SyncSignedFilesUtil.syncAttachmentsForEmpPage(this.getCtx(), billId);
             BatchMessageTipsBody body = new BatchMessageTipsBody();
             body.setMuitTipsState(Boolean.TRUE);
             body.setMuitTipsMessage("触发同步成功");
@@ -560,7 +630,6 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
     }
 
 
-
     private void delAttachment(Context ctx, ESignGlobalStatusOverviewInfo info) throws BOSException, EASBizException {
         ISHRAttachmentExt SHRAttchExt = SHRAttachmentExtFactory.getLocalInstance(ctx);
         IAttachment attachment = AttachmentFactory.getLocalInstance(ctx);
@@ -594,12 +663,12 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
     private void saveAttachment(Context ctx, ESignGlobalStatusOverviewInfo info, JSONObject fileMap, String uipk, String propertyName) throws IOException, ShrWebBizException, BOSException, EASBizException {
         String fileId = fileMap.getString("fileId");
         String fileName = fileMap.getString("fileName");
-        System.out.println("saveAttachment:fileMap"+fileMap);
-        if(StringUtils.isBlank(fileName)) {
-            fileName = info.getFileName()+".pdf";
+        System.out.println("saveAttachment:fileMap" + fileMap);
+        if (StringUtils.isBlank(fileName)) {
+            fileName = info.getFileName() + ".pdf";
         }
         String downloadUrl = fileMap.getString("downloadUrl");
-        if(StringUtils.isBlank(downloadUrl)) {
+        if (StringUtils.isBlank(downloadUrl)) {
             downloadUrl = fileMap.getString("fileDownloadUrl");
         }
         IAttachment attachment = AttachmentFactory.getLocalInstance(ctx);
@@ -607,14 +676,14 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
         ISHRAttachmentExt SHRAttchExt = SHRAttachmentExtFactory.getLocalInstance(ctx);
         byte[] content = DownloaderUtil.downloadFileToByteArray(downloadUrl);
         fileName = this.checkScriptAttack(fileName);
-        if( fileName.lastIndexOf(46)<=0) {
-            fileName +=".pdf";
+        if (fileName.lastIndexOf(46) <= 0) {
+            fileName += ".pdf";
         }
         String mainname = fileName.substring(0, fileName.lastIndexOf(46));
         String extname = fileName.substring(fileName.lastIndexOf(46) + 1, fileName.length());
         extname = extname.toLowerCase();
-        if ("html".equals(extname)){
-            extname="pdf";
+        if ("html".equals(extname)) {
+            extname = "pdf";
         }
         SHRAttachmentExtInfo attchExt = new SHRAttachmentExtInfo();
         AttachmentInfo ai = new AttachmentInfo();
@@ -632,10 +701,10 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
         }
         ai.setSizeInByte(size);
         ai.setAttachID("" + System.currentTimeMillis());
-        ai.setType(this.getFileType(mainname+"."+extname));
+        ai.setType(this.getFileType(mainname + "." + extname));
         ai.setBeizhu(uipk);
         attchExt.setAttachment(ai);
-        this.setAttExtMulNameAndDesc(ctx, attchExt, mainname+"."+extname, fileId);
+        this.setAttExtMulNameAndDesc(ctx, attchExt, mainname + "." + extname, fileId);
         attchExt.setPropertyName(propertyName);
         attchExt.setType(AttachmentTypeEnum.PROPERTY);
         attchExt.setState(AttachmentState.UNSAVE);

+ 50 - 35
websrc/com/kingdee/eas/custom/esign/osf/Create_by_fileOSFService.java

@@ -3,6 +3,10 @@ package com.kingdee.eas.custom.esign.osf;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.cloudera.impala.jdbc4.internal.fasterxml.jackson.core.JsonProcessingException;
+import com.cloudera.impala.jdbc4.internal.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
@@ -61,30 +65,31 @@ public class Create_by_fileOSFService implements IHRMsfService {
                         JSONObject stdData = stdbody.getJSONObject("data");
                         JSONArray participants = stdData.getJSONArray("participants");
                         JSONArray copiers = stdData.getJSONArray("copiers");
-                        for(int x =0;null!=copiers && x<copiers.size();x++){
+                        for (int x = 0; null != copiers && x < copiers.size(); x++) {
                             JSONObject stdCopier = copiers.getJSONObject(x);
-                            stdCopier.put("participantType",3);
+                            stdCopier.put("participantType", 3);
                             participants.add(stdCopier);
                         }
-                        resul.put("data",participants);
-                    }else {
+                        resul.put("data", participants);
+                    } else {
                         resul.put("code", response.getStatus());
                         resul.put("message", "网络异常");
                         resul.put("data", null);
                     }
-                }else {
+                } else {
                     resul.put("code", response.getStatus());
                     resul.put("message", "网络异常");
                     resul.put("data", null);
                 }
             }
-        }else {
+        } else {
             resul.put("code", response.getStatus());
             resul.put("message", "网络异常");
             resul.put("data", null);
         }
         return resul;
     }
+
     @Override
     public Object process(Context context, Map map) throws EASBizException, BOSException {
 
@@ -106,11 +111,9 @@ public class Create_by_fileOSFService implements IHRMsfService {
                         resul.put("data", null);
                     }
                 }
-            }
-            else if ("getTemplate".equals(mack)) {
-                resul.putAll(this.getSign_templates_detail(context,signTemplateId));
-            }
-            else {
+            } else if ("getTemplate".equals(mack)) {
+                resul.putAll(this.getSign_templates_detail(context, signTemplateId));
+            } else {
                 Map<String, Object> signMap = Maps.newHashMap();
                 String sourceId = jsonObject.getString("sourceId");
                 String signFlowTitle = jsonObject.getString("signFlowTitle");
@@ -209,29 +212,39 @@ public class Create_by_fileOSFService implements IHRMsfService {
                                 Map<String, List<Map<String, Object>>> pMap = this.addParticipants(context, signInfo, eSignTemplateNum, sealId, sourceId);
                                 signMap.put("signTemplateId", eSignTemplateNum);
                                 signMap.put("components", components);
-                                List<Map<String, Object>> participants= Lists.newArrayList();
+                                List<Map<String, Object>> participants = Lists.newArrayList();
 
-                                for(int x =0;x< pMap.get("participants").size();x++){
-                                    Map<String, Object> participant= pMap.get("participants").get(x);
+                                for (int x = 0; x < pMap.get("participants").size(); x++) {
+                                    Map<String, Object> participant = Maps.newHashMap();
+                                    participant.putAll(pMap.get("participants").get(x));
                                     Integer participantSetMode = (Integer) participant.get("participantSetMode");
-                                    Map<String, Object>  psnParticipant = (Map<String, Object>) participant.get("psnParticipant");
-                                    if(null!=psnParticipant){
+                                    Map<String, Object> psnParticipant = (Map<String, Object>) participant.get("psnParticipant");
+                                    if (null != psnParticipant) {
                                         psnParticipant.remove("psnId");
                                     }
 
-                                    Map<String, Object>  orgParticipant = (Map<String, Object>) participant.get("orgParticipant");
-                                    if(null!=orgParticipant){
+                                    Map<String, Object> orgParticipant = (Map<String, Object>) participant.get("orgParticipant");
+                                    if (null != orgParticipant) {
                                         orgParticipant.remove("orgId");
-                                        Map<String, Object>  transactor = (Map<String, Object>) orgParticipant.get("transactor");
+                                        Map<String, Object> transactor = (Map<String, Object>) orgParticipant.get("transactor");
                                         transactor.remove("transactorPsnId");
                                     }
 
-                                    if (null!=participantSetMode&&(participantSetMode.compareTo(1) == 0 ||participantSetMode.compareTo(4)== 0)){
+                                    if (null != participantSetMode && (participantSetMode.compareTo(1) == 0 || participantSetMode.compareTo(4) == 0)) {
                                         participants.add(participant);
                                     }
                                 }
                                 signMap.putAll(pMap);
-                                signMap.put("participants",participants);
+                                signMap.put("participants", participants);
+                                ObjectMapper mapper = new ObjectMapper();
+
+                                // 从 pMap 中取出原始的 participants 列表
+                                List<Map<String, Object>> originalList = (List<Map<String, Object>>) pMap.get("participants");
+                                // 从 JSON 反序列化为新的列表(独立副本)
+                                // 使用 fastjson 深拷贝:序列化时禁用循环引用检测,确保 JSON 完全展开
+                                String jsonString = JSON.toJSONString(originalList, SerializerFeature.DisableCircularReferenceDetect);
+                                List<Map> copiedList = JSON.parseArray(jsonString, Map.class);
+                                signMap.put("stubborn_participants", copiedList);
                                 System.out.println("--------------------------------------------------------------------------------------");
                                 System.out.println("signMap:" + JSON.toJSONString(signMap));
                                 System.out.println("--------------------------------------------------------------------------------------");
@@ -1066,11 +1079,6 @@ public class Create_by_fileOSFService implements IHRMsfService {
     }
 
 
-
-
-
-
-
     /**
      * todo查询流程模板详情 https://open.esign.cn/doc/opendoc/file-and-template3/pfzut7ho9obc7c5r
      * 处理签署方信息
@@ -1086,7 +1094,9 @@ public class Create_by_fileOSFService implements IHRMsfService {
     public Map<String, List<Map<String, Object>>> addParticipants(Context context, JSONObject signInfo, String signTemplateId, String sealOwnerId, String sourceId) throws EsignException, URISyntaxException {
         Map<String, List<Map<String, Object>>> participants_addCopiers = Maps.newHashMap();
         List<Map<String, Object>> participants = Lists.newArrayList();
+
         List<Map<String, Object>> addCopiers = Lists.newArrayList();
+
         String orgName = EsignConfig.getInstance().get("orgName");
         EsignHttpResponse response = EsignHttpUtil.getOrgIdentity_infoByOrgName(context, orgName);
         if (response.getStatus() >= 200 && response.getStatus() < 300) {
@@ -1105,6 +1115,7 @@ public class Create_by_fileOSFService implements IHRMsfService {
                         if (null != parts) {
                             for (int i = 0; i < parts.size(); i++) {
                                 JSONObject p = parts.getJSONObject(i);
+
                                 JSONObject orgParticipant = p.getJSONObject("orgParticipant");
                                 JSONObject psnParticipant = p.getJSONObject("psnParticipant");
 
@@ -1117,12 +1128,13 @@ public class Create_by_fileOSFService implements IHRMsfService {
                                     if (null != orgSignerInfo) {
                                         String signName = orgSignerInfo.getString("signName");
                                         if (participantFlag.equals(signName)) {
-                                             orgParticipant = new JSONObject();
+                                            orgParticipant = new JSONObject();
                                             p.put("orgParticipant", orgParticipant);
-                                            for(int k=0;k<components.size();k++) {
-                                                JSONObject component=components.getJSONObject(k);
+
+                                            for (int k = 0; k < components.size(); k++) {
+                                                JSONObject component = components.getJSONObject(k);
                                                 JSONObject normalSignField = component.getJSONObject("normalSignField");
-                                                if (null!=normalSignField) {
+                                                if (null != normalSignField) {
                                                     JSONArray designatedSealIds = normalSignField.getJSONArray("designatedSealIds");
                                                     //添加印章
                                                     if (StringUtils.isNotBlank(sealOwnerId)) {
@@ -1132,6 +1144,7 @@ public class Create_by_fileOSFService implements IHRMsfService {
                                                             String dorgId = designated.getString("orgId");
                                                             if (sealId.equals(sealOwnerId)) {
                                                                 orgParticipant.put("sealOwnerId", dorgId);
+
                                                             }
                                                         }
                                                     }
@@ -1152,8 +1165,9 @@ public class Create_by_fileOSFService implements IHRMsfService {
                                         if (null != psnSignerInfo) {
                                             String signName = psnSignerInfo.getString("signName");
                                             if (participantFlag.equals(signName)) {
-                                                 psnParticipant = new JSONObject();
+                                                psnParticipant = new JSONObject();
                                                 p.put("psnParticipant", psnParticipant);
+
                                                 //orgParticipant.put("sealOwnerId",sealOwnerId);
                                                 psnParticipant.put("psnAccount", psnSignerInfo.get("psnAccount"));
                                                 psnParticipant.put("psnName", psnSignerInfo.get("psnName"));
@@ -1179,18 +1193,19 @@ public class Create_by_fileOSFService implements IHRMsfService {
                 }
             }
         }
-        for(int i=0;i<participants.size();i++){
-            JSONObject p= (JSONObject) participants.get(i);
+        for (int i = 0; i < participants.size(); i++) {
+            JSONObject p = (JSONObject) participants.get(i);
             p.remove("components");
 
         }
-        for(int i=0;i<addCopiers.size();i++){
+        for (int i = 0; i < addCopiers.size(); i++) {
             JSONObject copier = (JSONObject) addCopiers.get(i);
-            JSONObject p= (JSONObject) copier.get("copierPsnInfo");
+            JSONObject p = (JSONObject) copier.get("copierPsnInfo");
             p.remove("psnId");
         }
         participants_addCopiers.put("participants", participants);
         participants_addCopiers.put("addCopiers", addCopiers);
+
         return participants_addCopiers;
     }