|
|
@@ -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"));
|