11.8kaifa

This commit is contained in:
hejinbo
2023-11-08 17:47:59 +08:00
parent 8c890c415a
commit 1cdf3abc30
5 changed files with 203 additions and 20 deletions
@@ -33,6 +33,28 @@ public class DeptIdentify extends BaseEntity {
/** 印章名称 */
private String sealName;
/** 机构账号ID */
private String orgId;
/** 认证授权流程ID */
private String authFlowId;
public String getAuthFlowId() {
return authFlowId;
}
public void setAuthFlowId(String authFlowId) {
this.authFlowId = authFlowId;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getSealName() {
return sealName;
}
@@ -56,6 +56,9 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String url = signUrlData.get("authUrl").getAsString();
//获取本次认证授权流程ID
String authFlowId = signUrlData.get("authFlowId").getAsString();
deptIdentify.setAuthFlowId(authFlowId);
deptIdentifynew.setIdentifyUrl(url);
}
@@ -7,6 +7,7 @@ import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.constant.FileTransformation;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.utils.SealUtil;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
@@ -168,7 +169,6 @@ public class FixSelectFlowDetailUtils {
}
@Scheduled(cron = "0/30 * * * * ?")
@Transactional
public void fixExecuteSelectDeptIndentifyUtils() throws EsignDemoException {
@@ -182,9 +182,12 @@ public class FixSelectFlowDetailUtils {
JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
String orgId = identifyInfoData.get("orgId").getAsString();
if(realnameStatus==1){
String orgId = identifyInfoData.get("orgId").getAsString();
EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
//将orgId保存到数据库里
DeptIdentify deptIdentifynew = deptIdentifysnew.get(i);
deptIdentifynew.setOrgId(orgId);
JsonObject identifyInfoJsonObject1 = gson.fromJson(identifyInfo1.getBody(), JsonObject.class);
JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data");
JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray();
@@ -198,16 +201,11 @@ public class FixSelectFlowDetailUtils {
}
}
String sealName = sealNames.substring(0,sealNames.length()-1);
DeptIdentify deptIdentifynew = deptIdentifysnew.get(i);
deptIdentifynew.setIdentifyStatus(1);
deptIdentifynew.setSealName(sealName);
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
}
}
}
}
}
@@ -333,9 +333,9 @@ public class SignAward {
}
/**
* 获取机构认证链接
* 获取机构认证&授权页面链接
*
* @return
* @throws EsignDemoException
*/
public static EsignHttpResponse deptIdentifyUrl(DeptIdentify deptIdentify) throws EsignDemoException {
String apiaddr = "/v3/org-auth-url";
@@ -343,17 +343,27 @@ public class SignAward {
String phonenumber = deptIdentify.getPhonenumber();
String deptName = deptIdentify.getDeptName();
String jsonParm = "{\n" +
" \"orgAuthConfig\": {\n" +
" \"orgName\": \"" + deptName + "\",\n" +
" \"transactorInfo\": {\n" +
" \"psnAccount\": \"" + phonenumber + "\",\n" +
" \"psnInfo\": {\n" +
" \"psnName\": \"" + nickName + "\",\n" +
" \"psnMobile\": \"" + phonenumber + "\"\n" +
" }\n" +
" }\n" +
" \"orgAuthConfig\": {\n" +
" \"orgName\": \"" + deptName + " \",\n" +
" \"transactorInfo\": {\n" +
" \"psnAccount\": \"" + phonenumber + "\",\n" +
" \"psnInfo\": {\n" +
" \"psnName\": \"" + nickName + "\",\n" +
" \"psnMobile\": \"" + phonenumber + "\"\n" +
" }\n" +
" }\n" +
" },\n" +
" \"authorizeConfig\": {\n" +
" \"authorizedScopes\": [\n" +
" \"get_org_identity_info\",\n" +
" \"get_psn_identity_info\",\n" +
" \"org_initiate_sign\",\n" +
" \"psn_initiate_sign\",\n" +
" \"manage_org_resource\",\n" +
" \"manage_psn_resource\",\n" +
" \"use_org_order\"\n" +
" ]\n" +
" }\n" +
"}";
//请求方法
EsignRequestType requestType = EsignRequestType.POST;
@@ -417,7 +427,32 @@ public class SignAward {
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
}
/**
* 创建机构图片印章
*
* @return
*/
public static EsignHttpResponse createOrgByImage(DeptIdentify deptIdentify) throws EsignDemoException {
String apiaddr = "/v3/seals/org-seals/create-by-image";
String orgId = deptIdentify.getOrgId();
String sealImageFileKey = "";
//请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
String jsonParm = "{\n" +
" \"orgId\": \"" + orgId + "\",\n" +
" \"sealImageFileKey\": \"" + sealImageFileKey + "\",\n" +
" \"sealName\": \"企业公章1\",\n" +
" \"sealWidth\": 50,\n" +
" \"sealHeight\": 50,\n" +
"}";
//请求方法
EsignRequestType requestType = EsignRequestType.POST;
//生成签名鉴权方式的的header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
//发起接口请求
EsignHttpResponse response = EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
System.out.println(response);
return response;
}
}