heyuan 1 päivä sitten
vanhempi
commit
fdd2c222ba

+ 30 - 28
properties/esign/esignConfig.properties

@@ -1,57 +1,59 @@
 shrAddr=http://172.16.105.191:8080/shr
 notifyUrl=http://hrtest.tenda.cn:8080/callback/callBackToOSF
-#搴旂敤ID
+#应用ID
 EsignAppId=7439075213
-#搴旂敤瀵嗛挜
+#应用密钥
 EsignAppSecret=8e4e6afcdd0eb159ef8e14af23e8d623
-#e绛惧疂鎺ュ彛璋冪敤鍩熷悕
-#e绛惧疂鎺ュ彛璋冪敤鍩熷悕锛堟ā鎷熺幆澧冿級
+#e签宝接口调用域名
+#e签宝接口调用域名(模拟环境)
 #https://smlopenapi.esign.cn
-#e绛惧疂鎺ュ彛璋冪敤鍩熷悕锛堟�寮忕幆澧冿級
+#e签宝接口调用域名(正式环境)
 #https://openapi.esign.cn
 EsignHost=https://smlopenapi.esign.cn
-#鏌ヨ�鍚堝悓妯℃澘涓�帶浠惰�鎯�
+#查询合同模板中控件详情
 docTemplatesDetailById=/v3/doc-templates/{0}
-#濉�啓妯℃澘鐢熸垚鏂囦欢
+#填写模板生成文件
 createByDocTemplate=/v3/files/create-by-doc-template
-#鏌ヨ�鏈烘瀯璁よ瘉淇℃伅
+#查询机构认证信息
 organizations.identity-info=/v3/organizations/identity-info
-#鏌ヨ�涓�汉璁よ瘉淇℃伅
+#查询个人认证信息
 persons.identity-info=/v3/persons/identity-info
-#娣诲姞绛剧讲鍖轰俊鎭�
+#添加签署区信息
 add.sign_fields=/v3/sign-flow/{0}/signers/sign-fields
-#鏌ヨ�绛剧讲娴佺▼璇︽儏
+#查询签署流程详情
 detail.sign_fields=/v3/sign-flow/{0}/detail
-#鍒犻櫎绛剧讲鍖�
+#删除签署区
 del.sign_fields=/v3/sign-flow/{0}/signers/sign-fields
-#娣诲姞鎶勯€佹柟
+#添加抄送方
 add.copiers=/v3/sign-flow/{0}/copiers
-#鍒犻櫎鎶勯€佹柟
+#删除抄送方
 del.copiers=/v3/sign-flow/{signFlowId}/copiers/delete
-#鍩轰簬鏂囦欢鍙戣捣绛剧讲
+#基于文件发起签署
 create_by_file=/v3/sign-flow/create-by-file
-#寮€鍚��缃叉祦绋�
+#开启签署流程
 start_by_file=/v3/sign-flow/{0}/start
-#寮€鍚��缃叉祦绋�
+#开启签署流程
 revoke_by_file=/v3/sign-flow/{0}/revoke
-#鍌��娴佺▼涓��缃蹭汉
+#催签流程中签署人
 urge_by_file=/v3/sign-flow/{0}/urge
-#涓嬭浇宸茬�缃叉枃浠跺強闄勫睘鏉愭枡
+#下载已签署文件及附属材料
 file_download_url=/v3/sign-flow/{0}/file-download-url
-#涓嬭浇宸茬�缃叉枃浠跺強闄勫睘鏉愭枡
+#下载已签署文件及附属材料
 preview_file_download_url=/v3/sign-flow/{0}/preview-file-download-url
-#鏌ヨ�浼佷笟鍐呴儴鍗扮珷
+#查询企业内部印章
 org_own_seal_list=/v3/seals/org-own-seal-list?orgId={0}&pageNum={1}&pageSize={2}
-#鏌ヨ�琚��閮ㄤ紒涓氭巿鏉冨嵃绔�
+#查询被外部企业授权印章
 org_authorized_seal_list=/v3/seals/org-authorized-seal-list?orgId={0}&pageNum={1}&pageSize={2}
-#鏌ヨ�琚��閮ㄤ紒涓氭巿鏉冨嵃绔�
-orgId=b7cef1b902dd42568baaf5865ac09536
-#鏌ヨ�鏂囦欢涓婁紶鐘舵€�
+#查询被外部企业授权印章
+#orgId=b7cef1b902dd42568baaf5865ac09536
+orgName=深圳市吉祥腾达科技有限公司
+#查询文件上传状态
 getFilesState=/v3/files/{0}
-#妫€绱㈡枃浠跺叧閿�瓧鍧愭爣
+#检索文件关键字坐标
 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

+ 39 - 4
src/com/kingdee/eas/custom/esign/app/SealControllerBean.java

@@ -38,7 +38,8 @@ public class SealControllerBean extends AbstractSealControllerBean {
     private String queryAuthorizedSealListUrl = null;
     //机构账号ID
     private String orgId = null;
-    private int pageSize = 20;
+    private String orgName = null;
+    private static int pageSize = 20;
 
 
     public SealControllerBean() {
@@ -48,9 +49,11 @@ public class SealControllerBean extends AbstractSealControllerBean {
         //查询被外部企业授权印章
         queryAuthorizedSealListUrl = esignConfig.get(AUTHORIZEDSEALLIST.getValue());
         //机构账号ID
-        orgId = esignConfig.get("orgId");
+        //orgId = esignConfig.get("orgId");
+        orgName = esignConfig.get("orgName");
     }
 
+
     /**
      * 同步印章
      *
@@ -68,13 +71,41 @@ public class SealControllerBean extends AbstractSealControllerBean {
         if (StringUtils.isBlank(queryAuthorizedSealListUrl)) {
             errorList.add("查询被外部企业授权印章");
         }
-        if (StringUtils.isBlank(orgId)) {
-            errorList.add("机构账号ID");
+//        if (StringUtils.isBlank(orgId)) {
+//            errorList.add("机构账号ID");
+//        }
+        if (StringUtils.isBlank(orgName)) {
+            errorList.add("机构名称");
         }
         if (!errorList.isEmpty()) {
             throw new BOSException(String.join("、", errorList) + "配置为空,请检查配置文件esignConfig.properties");
         }
+        logger.error("_syncSeals orgName: " + orgName);
         try {
+            if (StringUtils.isBlank(orgId)) {
+                EsignHttpResponse orgIdentityInfoByOrgName = null;
+                try {
+                    //获取机构账号ID
+                    orgIdentityInfoByOrgName = EsignHttpUtil.getOrgIdentity_infoByOrgName(ctx, orgName);
+                } catch (Exception e) {
+                    throw new BOSException("获取机构账号ID报错: " + e.getMessage(), e);
+                }
+                int status = orgIdentityInfoByOrgName.getStatus();
+                if (status != 200) {
+                    throw new BOSException("获取机构账号ID报错: " + orgIdentityInfoByOrgName.getBody());
+                }
+                String body = orgIdentityInfoByOrgName.getBody();
+                JSONObject jsonObject = JSONObject.parseObject(body);
+                if (0 != jsonObject.getInteger("code")) {
+                    throw new BOSException("获取机构账号ID报错: " + jsonObject.getString("message"));
+                }
+                JSONObject data = jsonObject.getJSONObject("data");
+                orgId = data.getString("orgId");
+            }
+            logger.error("_syncSeals orgId: " + orgId);
+            if (StringUtils.isBlank(orgId)) {
+                throw new BOSException("获取机构账号ID报错: 结构id为空");
+            }
             //获取e签宝印章数据
             SealCollection sealCollection = getSealCollection(ctx);
             CoreBaseCollection colls = new CoreBaseCollection();
@@ -148,6 +179,10 @@ public class SealControllerBean extends AbstractSealControllerBean {
                     sealInfo.setAuthorizer(false);
                 }
                 colls.add(sealInfo);
+                // 设置机构id
+                sealInfo.setAuthorizerOrgId(orgId);
+                // 设置机构名称
+                sealInfo.setAuthorizerOrgName(orgName);
                 // 设置通用属性
                 sealInfo.setSealName(seal.getString("sealName"));
                 sealInfo.setName(seal.getString("sealName"));

+ 18 - 7
src/com/kingdee/eas/custom/esign/util/EsignConfig.java

@@ -4,6 +4,7 @@ import com.kingdee.eas.custom.esign.bizEnum.EsignConfigEnum;
 
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
@@ -14,17 +15,21 @@ public class EsignConfig {
     private Properties propt = new Properties();//共用参数
 
     private static EsignConfig instance = new EsignConfig();
+
     public static EsignConfig getInstance() {
         return instance;
     }
+
     // 应用ID
     public String getEsignAppId() {
         return this.propt.getProperty(EsignConfigEnum.ESIGNAPPID_VALUE);
     }
+
     // 应用密钥
     public String getEsignAppSecret() {
         return this.propt.getProperty(EsignConfigEnum.ESIGNAPPSECRET_VALUE);
     }
+
     // e签宝接口调用域名(模拟环境)
     //"https://smlopenapi.esign.cn";
     // e签宝接口调用域名(正式环境)
@@ -32,25 +37,31 @@ public class EsignConfig {
     public String getEsignHost() {
         return this.propt.getProperty(EsignConfigEnum.ESIGNHOST_VALUE);
     }
+
     public String get(String key) {
         return this.propt.getProperty(key);
     }
+
     private EsignConfig() {
         this.initConfig("/server/properties/esign/esignConfig.properties");
     }
+
     public void initConfig(String filePath) {
         try {
-            this.propt.load(new FileInputStream(System.getProperty("EAS_HOME") + filePath));
-        }catch (IOException e){
+            InputStreamReader reader = new InputStreamReader(
+                    new FileInputStream(System.getProperty("EAS_HOME") + filePath),
+                    "GBK");
+            this.propt.load(reader);
+        } catch (IOException e) {
             e.printStackTrace();
-
         }
     }
-    public Map<String,String> getConfig() {
-        Map<String,String> map = new HashMap<>();
+
+    public Map<String, String> getConfig() {
+        Map<String, String> map = new HashMap<>();
         Set<Map.Entry<Object, Object>> set = this.propt.entrySet();
-        for(Map.Entry<Object, Object> entry : set){
-            map.put((String)entry.getKey(),(String)entry.getValue());
+        for (Map.Entry<Object, Object> entry : set) {
+            map.put((String) entry.getKey(), (String) entry.getValue());
         }
         return map;
     }