소스 검색

提交修改

zqy 2 달 전
부모
커밋
91d898bef8

+ 14 - 10
websrc/com/kingdee/eas/custom/esign/handler/ESignGlobalStatusOverviewListHandler.java

@@ -264,20 +264,24 @@ public class ESignGlobalStatusOverviewListHandler extends ListHandler {
             Map<String, Object> jsonMap = Maps.newHashMap();
             Set<String> noticeSet = Sets.newHashSet();
             JSONArray jsonArray = params.getJSONArray("signers");
-            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);
+            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");
             }
-            jsonMap.put("noticeTypes", StringUtils.join(noticeSet.toArray(), ","));
             EsignHttpResponse 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());

+ 75 - 4
websrc/com/kingdee/eas/custom/esign/osf/Create_by_fileOSFService.java

@@ -43,11 +43,54 @@ public class Create_by_fileOSFService implements IHRMsfService {
     private static final int MAX_RETRY_COUNT = 20;
     private static final int RETRY_INTERVAL_SECONDS = 3;
 
+    public Map<String, Object> getSign_templates_detail(Context context, String signTemplateId) throws EsignException, URISyntaxException {
+        Map<String, Object> resul = Maps.newHashMap();
+        String orgName = EsignConfig.getInstance().get("orgName");
+        EsignHttpResponse response = EsignHttpUtil.getOrgIdentity_infoByOrgName(context, orgName);
+        if (response.getStatus() >= 200 && response.getStatus() < 300) {
+            JSONObject body = JSON.parseObject(response.getBody());
+            if ("0".equals(String.valueOf(body.get("code")))) {
+                JSONObject orgPsn = body.getJSONObject("data");
+                String orgId = orgPsn.getString("orgId");
+                orgName = orgPsn.getString("orgName");
+                //自动落章只能传orgId
+                EsignHttpResponse std = EsignHttpUtil.getSign_templates_detail(context, signTemplateId, orgId, false, null);
+                if (std.getStatus() >= 200 && std.getStatus() < 300) {
+                    JSONObject stdbody = JSON.parseObject(std.getBody());
+                    if (SUCCESS_CODE.equals(String.valueOf(stdbody.get("code")))) {
+                        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++){
+                            JSONObject stdCopier = copiers.getJSONObject(x);
+                            stdCopier.put("participantType",3);
+                            participants.add(stdCopier);
+                        }
+                        resul.put("data",participants);
+                    }else {
+                        resul.put("code", response.getStatus());
+                        resul.put("message", "网络异常");
+                        resul.put("data", null);
+                    }
+                }else {
+                    resul.put("code", response.getStatus());
+                    resul.put("message", "网络异常");
+                    resul.put("data", null);
+                }
+            }
+        }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 {
 
         String mack = (String) map.get("mack");
         String data = (String) map.get("data");
+        String signTemplateId = (String) map.get("signTemplateId");
         Map<String, Object> resul = Maps.newHashMap();
         try {
             JSONObject jsonObject = JSON.parseObject(data);
@@ -63,7 +106,11 @@ public class Create_by_fileOSFService implements IHRMsfService {
                         resul.put("data", null);
                     }
                 }
-            } 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");
@@ -996,6 +1043,12 @@ public class Create_by_fileOSFService implements IHRMsfService {
         return signers;
     }
 
+
+
+
+
+
+
     /**
      * todo查询流程模板详情 https://open.esign.cn/doc/opendoc/file-and-template3/pfzut7ho9obc7c5r
      * 处理签署方信息
@@ -1021,7 +1074,7 @@ public class Create_by_fileOSFService implements IHRMsfService {
                 String orgId = orgPsn.getString("orgId");
                 orgName = orgPsn.getString("orgName");
                 //自动落章只能传orgId
-                EsignHttpResponse std = EsignHttpUtil.getSign_templates_detail(context, signTemplateId, orgId, false, sourceId);
+                EsignHttpResponse std = EsignHttpUtil.getSign_templates_detail(context, signTemplateId, orgId, true, sourceId);
                 if (std.getStatus() >= 200 && std.getStatus() < 300) {
                     JSONObject bodyStd = JSON.parseObject(std.getBody());
                     if ("0".equals(String.valueOf(bodyStd.get("code")))) {
@@ -1031,9 +1084,9 @@ public class Create_by_fileOSFService implements IHRMsfService {
                             for (int i = 0; i < parts.size(); i++) {
                                 JSONObject p = parts.getJSONObject(i);
                                 JSONObject orgParticipant = p.getJSONObject("orgParticipant");
-
                                 JSONObject psnParticipant = p.getJSONObject("psnParticipant");
 
+                                JSONArray components = p.getJSONArray("components");
                                 String participantFlag = p.getString("participantFlag");
                                 JSONArray signs = signInfo.getJSONArray("signers");
                                 for (int x = 0; x < signs.size(); x++) {
@@ -1044,7 +1097,24 @@ public class Create_by_fileOSFService implements IHRMsfService {
                                         if (participantFlag.equals(signName)) {
                                             orgParticipant = new JSONObject();
                                             p.put("orgParticipant", orgParticipant);
-                                            //orgParticipant.put("sealOwnerId",sealOwnerId);
+                                            for(int k=0;k<components.size();k++) {
+                                                JSONObject component=components.getJSONObject(k);
+                                                JSONObject normalSignField = component.getJSONObject("normalSignField");
+                                                if (null!=normalSignField) {
+                                                    JSONArray designatedSealIds = normalSignField.getJSONArray("designatedSealIds");
+                                                    //添加印章
+                                                    if (StringUtils.isNotBlank(sealOwnerId)) {
+                                                        for (int j = 0; j < designatedSealIds.size(); j++) {
+                                                            JSONObject designated = designatedSealIds.getJSONObject(j);
+                                                            String sealId = designated.getString("sealId");
+                                                            String dorgId = designated.getString("orgId");
+                                                            if (sealId.equals(sealOwnerId)) {
+                                                                orgParticipant.put("sealOwnerId", dorgId);
+                                                            }
+                                                        }
+                                                    }
+                                                }
+                                            }
                                             //orgParticipant.put("orgId",orgId);
                                             orgParticipant.put("orgName", orgSignerInfo.getString("orgName"));
                                             JSONObject transactor = new JSONObject();
@@ -1055,6 +1125,7 @@ public class Create_by_fileOSFService implements IHRMsfService {
                                             //orgParticipant.put("sealOwnerId",sealOwnerId);
                                         }
                                     } else {
+
                                         JSONObject psnSignerInfo = sign.getJSONObject("psnSignerInfo");
                                         if (null != psnSignerInfo) {
                                             String signName = psnSignerInfo.getString("signName");