公章管理测试

This commit is contained in:
hejinbo
2023-11-15 09:01:20 +08:00
parent dac20a4a04
commit 4088cf7357
10 changed files with 140 additions and 186 deletions
@@ -61,9 +61,8 @@ public class DeptIdentifyController extends BaseController {
* @return * @return
*/ */
@PostMapping("/sealUpload") @PostMapping("/sealUpload")
public AjaxResult sealUpload(@Validated @RequestBody DeptIdentify deptIdentify public AjaxResult sealUpload(Long id, String sealName , @RequestParam("file") MultipartFile file) {
, @RequestParam("file") MultipartFile file) { return deptIdentifyService.sealUpload(id,sealName, file);
return deptIdentifyService.sealUpload(deptIdentify, file);
} }
/** /**
@@ -1,71 +0,0 @@
package com.ruoyi.web.controller.wisdomarbitrate;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
import com.ruoyi.wisdomarbitrate.mapper.SealSignRecordMapper;
import com.ruoyi.wisdomarbitrate.utils.SignAward;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping
public class MyTest {
@Autowired
private CaseApplicationMapper caseApplicationMapper;
@Autowired
private SealSignRecordMapper sealSignRecordMapper;
@Autowired
private CaseAttachMapper caseAttachMapper;
@Autowired
private DeptIdentifyMapper deptIdentifyMapper;
@GetMapping("/test")
public void myTest() throws EsignDemoException {
Gson gson = new Gson();
DeptIdentify deptIdentify = new DeptIdentify();
deptIdentify.setIdentifyStatus(0);
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
for (int i = 0; i < deptIdentifysnew.size(); i++) {
EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentifysnew.get(i));
JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
if (realnameStatus == 1) {
String orgId = identifyInfoData.get("orgId").getAsString();
System.out.println("这是orgId"+orgId+"=======================");
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();
String sealNames = "";
if (sealArray.size() > 0) {
for (int j = 0; j < sealArray.size(); j++) {
JsonObject sealObject = (JsonObject) sealArray.get(j);
String sealName = sealObject.get("sealName").toString();
String sealNamenew = sealName.substring(1, sealName.length() - 1);
sealNames += sealNamenew + ",";
}
}
String sealName = sealNames.substring(0, sealNames.length() - 1);
deptIdentifynew.setIdentifyStatus(1);
deptIdentifynew.setSealName(sealName);
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
}
}
}
}
}
@@ -6,7 +6,7 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://121.40.189.20:3306/smart_arbitration?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://121.40.189.20:3306/test_smart_arbitration?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: YMzc157# password: YMzc157#
# 从库数据源 # 从库数据源
@@ -18,7 +18,7 @@ ruoyi:
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口,默认为8080 # 服务器的HTTP端口,默认为8080
port: 9001 port: 8001
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
@@ -96,9 +96,7 @@ public class SealUtil {
//生成签名鉴权方式的的header //生成签名鉴权方式的的header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
//发起接口请求 //发起接口请求
EsignHttpResponse response = EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
System.out.println(response);
return response;
} }
/** /**
@@ -114,6 +112,7 @@ public class SealUtil {
return EsignHttpHelper.doUploadHttp(uploadUrl,requestType,esignFileBean.getFileBytes(),esignFileBean.getFileContentMD5(), EsignHeaderConstant.CONTENTTYPE_STREAM.VALUE(),true); return EsignHttpHelper.doUploadHttp(uploadUrl,requestType,esignFileBean.getFileBytes(),esignFileBean.getFileContentMD5(), EsignHeaderConstant.CONTENTTYPE_STREAM.VALUE(),true);
} }
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
queryAuthProcess("OF-2b1e52987408005c");
// createOrgByImage(); // createOrgByImage();
// getOrgEmpower(); // getOrgEmpower();
// queryAuthProcess("OF-2b00885895080028"); // queryAuthProcess("OF-2b00885895080028");
@@ -18,7 +18,7 @@ public interface IDeptIdentifyService {
AjaxResult enableDept(DeptIdentify deptIdentify); AjaxResult enableDept(DeptIdentify deptIdentify);
AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file); AjaxResult sealUpload(Long id, String sealName , MultipartFile file);
AjaxResult receiveNotify(String body); AjaxResult receiveNotify(String body);
@@ -71,14 +71,16 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect); EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect);
JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class); JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
int code = signUrlJsonObject.get("code").getAsInt(); int code = signUrlJsonObject.get("code").getAsInt();
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); if (code == 0){
String url = signUrlData.get("authUrl").getAsString(); JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
//获取本次认证授权流程ID String url = signUrlData.get("authUrl").getAsString();
String authFlowId = signUrlData.get("authFlowId").getAsString(); //获取本次认证授权流程ID
deptIdentify.setAuthFlowId(authFlowId); String authFlowId = signUrlData.get("authFlowId").getAsString();
deptIdentifynew.setIdentifyUrl(url); deptIdentify.setAuthFlowId(authFlowId);
deptIdentify.setIdentifyDate(new Date()); deptIdentifynew.setIdentifyUrl(url);
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify); deptIdentify.setIdentifyDate(new Date());
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
}
} }
return deptIdentifynew; return deptIdentifynew;
} }
@@ -113,7 +115,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
} }
@Override @Override
public AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file) { public AjaxResult sealUpload(Long id, String sealName , MultipartFile file) {
try { try {
if (file.isEmpty()) { if (file.isEmpty()) {
return AjaxResult.error("请选择要上传的文件"); return AjaxResult.error("请选择要上传的文件");
@@ -121,6 +123,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
String filePath = RuoYiConfig.getUploadPath(); String filePath = RuoYiConfig.getUploadPath();
// 上传 // 上传
String fileName = FileUploadUtils.upload(filePath, file); String fileName = FileUploadUtils.upload(filePath, file);
DeptIdentify deptIdentify = new DeptIdentify();
deptIdentify.setId(id);
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentify); List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentify);
if (deptIdentifies != null && deptIdentifies.size() > 0) { if (deptIdentifies != null && deptIdentifies.size() > 0) {
for (DeptIdentify identify : deptIdentifies) { for (DeptIdentify identify : deptIdentifies) {
@@ -133,21 +137,32 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
String prefix = "/profile"; String prefix = "/profile";
int startIndex = fileName.indexOf(prefix); int startIndex = fileName.indexOf(prefix);
startIndex += prefix.length(); startIndex += prefix.length();
String annexPath = "/uploadPath" + fileName.substring(startIndex); //String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
//创建机构图片印章 //创建机构图片印章
String annexPath = "D:\\develop\\2.jpg";
identify.setSealName(sealName);
EsignHttpResponse response = SignAward.createOrgByImage(identify, annexPath); EsignHttpResponse response = SignAward.createOrgByImage(identify, annexPath);
JSONObject jsonObject = JSONObject.parseObject(response.getBody()); JSONObject jsonObject = JSONObject.parseObject(response.getBody());
int code = jsonObject.getIntValue("code"); int code = jsonObject.getIntValue("code");
if (code == 0) { //业务码,0表示成功,非0表示异常。 if (code == 0) { //业务码,0表示成功,非0表示异常。
String sealId = jsonObject.getJSONObject("data").getString("sealId"); String sealId = jsonObject.getJSONObject("data").getString("sealId");
identify.setSealId(sealId);
identify.setIsUse(0); //设置印章使用状态为未启用
//保存到表里 //保存到表里
int i = deptIdentifyMapper.updateDeptIdentify(identify); DeptIdentify deptIdentify1 = new DeptIdentify();
deptIdentify1.setDeptId(identify.getDeptId());
deptIdentify1.setUserId(identify.getUserId());
deptIdentify1.setIdentifyStatus(identify.getIdentifyStatus());
deptIdentify1.setIdentifyDate(identify.getIdentifyDate());
deptIdentify1.setIsUse(identify.getIsUse());
deptIdentify1.setSealName(sealName);
deptIdentify1.setOrgId(identify.getOrgId());
deptIdentify1.setAuthFlowId(identify.getAuthFlowId());
deptIdentify1.setSealId(sealId);
int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify1);
if (i > 0) { if (i > 0) {
return AjaxResult.success("上传成功"); return AjaxResult.success("上传成功");
} }
} }
return AjaxResult.error("公章上传失败,请检查印章名称是否重复");
} }
return AjaxResult.error("企业用户未授予资源管理权限"); return AjaxResult.error("企业用户未授予资源管理权限");
} }
@@ -181,32 +181,36 @@ public class FixSelectFlowDetailUtils {
if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
for (int i = 0; i < deptIdentifysnew.size(); i++) { for (int i = 0; i < deptIdentifysnew.size(); i++) {
EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentifysnew.get(i)); EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentifysnew.get(i));
JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class); JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data"); int code = identifyInfoJsonObject.get("code").getAsInt();
int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt(); if (code == 0) {
if (realnameStatus == 1) { JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
String orgId = identifyInfoData.get("orgId").getAsString(); int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
System.out.println("这是orgId"+orgId+"======================="); if (realnameStatus == 1) {
EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId); String orgId = identifyInfoData.get("orgId").getAsString();
//将orgId保存到数据库里 System.out.println("这是orgId" + orgId + "=======================");
DeptIdentify deptIdentifynew = deptIdentifysnew.get(i); EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
deptIdentifynew.setOrgId(orgId); //将orgId保存到数据库里
JsonObject identifyInfoJsonObject1 = gson.fromJson(identifyInfo1.getBody(), JsonObject.class); DeptIdentify deptIdentifynew = deptIdentifysnew.get(i);
JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data"); deptIdentifynew.setOrgId(orgId);
JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray(); JsonObject identifyInfoJsonObject1 = gson.fromJson(identifyInfo1.getBody(), JsonObject.class);
String sealNames = ""; JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data");
if (sealArray.size() > 0) { JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray();
for (int j = 0; j < sealArray.size(); j++) { String sealNames = "";
JsonObject sealObject = (JsonObject) sealArray.get(j); if (sealArray.size() > 0) {
String sealName = sealObject.get("sealName").toString(); for (int j = 0; j < sealArray.size(); j++) {
String sealNamenew = sealName.substring(1, sealName.length() - 1); JsonObject sealObject = (JsonObject) sealArray.get(j);
sealNames += sealNamenew + ","; String sealName = sealObject.get("sealName").toString();
String sealNamenew = sealName.substring(1, sealName.length() - 1);
sealNames += sealNamenew + ",";
}
} }
String sealName = sealNames.substring(0, sealNames.length() - 1);
deptIdentifynew.setIdentifyStatus(1);
deptIdentifynew.setSealName(sealName);
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
} }
String sealName = sealNames.substring(0, sealNames.length() - 1);
deptIdentifynew.setIdentifyStatus(1);
deptIdentifynew.setSealName(sealName);
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
} }
} }
} }
@@ -217,9 +221,9 @@ public class FixSelectFlowDetailUtils {
* *
* @throws EsignDemoException * @throws EsignDemoException
*/ */
// @Scheduled(cron = "0/30 * * * * ?") // @Scheduled(cron = "0/30 * * * * ?")
@Transactional @Transactional
public void searchForInstitutionalSeal() { public void searchForInstitutionalSeal() {
try { try {
DeptIdentify deptIdentify = new DeptIdentify(); DeptIdentify deptIdentify = new DeptIdentify();
deptIdentify.setIsUse(0); deptIdentify.setIsUse(0);
@@ -228,16 +232,16 @@ public class FixSelectFlowDetailUtils {
for (DeptIdentify identify : deptIdentifies) { for (DeptIdentify identify : deptIdentifies) {
//查询企业内部印章 //查询企业内部印章
Integer annexId = identify.getAnnexId(); Integer annexId = identify.getAnnexId();
if (annexId == null){ if (annexId == null) {
//说明之前没有下载过 //说明之前没有下载过
EsignHttpResponse response = SignAward.orgOwnSealList(identify); EsignHttpResponse response = SignAward.orgOwnSealList(identify);
JSONObject jsonObject = JSONObject.parseObject(response.getBody()); JSONObject jsonObject = JSONObject.parseObject(response.getBody());
JSONObject data = jsonObject.getJSONObject("data"); JSONObject data = jsonObject.getJSONObject("data");
JSONArray seals = data.getJSONArray("seals"); JSONArray seals = data.getJSONArray("seals");
for (int i = 0; i < seals.size(); i++){ for (int i = 0; i < seals.size(); i++) {
JSONObject seal = seals.getJSONObject(i); JSONObject seal = seals.getJSONObject(i);
int statusDescription = seal.getIntValue("statusDescription"); int statusDescription = seal.getIntValue("statusDescription");
if (statusDescription==1){//印章状态 1已启用,2待审核,3审核不通过,4 挂起 if (statusDescription == 1) {//印章状态 1已启用,2待审核,3审核不通过,4 挂起
//已启用证明审核通过,下载到数据库 //已启用证明审核通过,下载到数据库
String sealImageDownloadUrl = seal.getString("sealImageDownloadUrl"); String sealImageDownloadUrl = seal.getString("sealImageDownloadUrl");
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
@@ -265,7 +269,7 @@ public class FixSelectFlowDetailUtils {
caseAttach.setAnnexPath(savePath); caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName); caseAttach.setAnnexName(saveName);
int i1 = caseAttachMapper.save(caseAttach); int i1 = caseAttachMapper.save(caseAttach);
if (i1>0){ if (i1 > 0) {
//将附件id保存到公章管理表里 //将附件id保存到公章管理表里
Integer annexId1 = caseAttach.getAnnexId(); Integer annexId1 = caseAttach.getAnnexId();
identify.setAnnexId(annexId1); identify.setAnnexId(annexId1);
@@ -119,7 +119,10 @@ public class SignAward {
// System.out.println(signFlowDetailJsonObject); // System.out.println(signFlowDetailJsonObject);
DeptIdentify deptIdentify = new DeptIdentify();
deptIdentify.setOrgId("db279dd50d844e6fa64770d9a6edc7dd");
EsignHttpResponse orgByImage = createOrgByImage(deptIdentify, "D:\\develop\\2.jpg");
System.out.println("这是结果===============" + orgByImage);
} }
@@ -435,48 +438,38 @@ public class SignAward {
* @return * @return
*/ */
public static EsignHttpResponse createOrgByImage(DeptIdentify deptIdentify, String filePath) throws EsignDemoException { public static EsignHttpResponse createOrgByImage(DeptIdentify deptIdentify, String filePath) throws EsignDemoException {
//获取认证授权流程ID String apiaddr = "/v3/seals/org-seals/create-by-image";
String authFlowId = deptIdentify.getAuthFlowId(); String orgId = deptIdentify.getOrgId();
//查询认证授权流程详情 //上传印章图片
EsignHttpResponse response = SealUtil.queryAuthProcess(authFlowId); //步骤一:获取印章图片上传地址fileUploadUrl
String body = response.getBody(); EsignHttpResponse response1 = SealUtil.getFileUploadUrl(filePath);
if (body != null) { JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
JSONObject jsonObject = JSONObject.parseObject(body); String fileUploadUrl = jsonObject1.getJSONObject("data").getString("fileUploadUrl");
//查询授权流程状态 //步骤二:将印章图片文件流上传到fileUploadUrl
int authorizedStatus = jsonObject.getJSONObject("data").getIntValue("authorizedStatus"); EsignHttpResponse response2 = SealUtil.fileStreamUpload(fileUploadUrl, filePath);
if (authorizedStatus == 1) {//0 -流程过期失效 1 - 已授权 2 - 授权中 3 - 审批未通过 JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
String apiaddr = "/v3/seals/org-seals/create-by-image"; int errCode = jsonObject2.getIntValue("errCode");
String orgId = deptIdentify.getOrgId(); if (errCode == 0) { //业务码,0表示成功,非0表示异常。
//上传印章图片 //获取步骤一里面的fileKey
//步骤一:获取印章图片上传地址fileUploadUrl String sealImageFileKey = jsonObject1.getJSONObject("data").getString("fileKey");
EsignHttpResponse response1 = SealUtil.getFileUploadUrl(filePath); String sealName = deptIdentify.getSealName();
JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
String fileUploadUrl = jsonObject1.getJSONObject("data").getString("fileUploadUrl"); String jsonParm = "{\n" +
//步骤二:将印章图片文件流上传到fileUploadUrl " \"orgId\": \"" + orgId + "\",\n" +
EsignHttpResponse response2 = SealUtil.fileStreamUpload(fileUploadUrl, filePath); " \"sealImageFileKey\": \"" + sealImageFileKey + "\",\n" +
JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); " \"sealName\": \"" + sealName + "\",\n" +
int errCode = jsonObject2.getIntValue("errCode"); " \"sealWidth\": 50,\n" +
if (errCode == 0){ //业务码,0表示成功,非0表示异常。 " \"sealHeight\": 50,\n" +
//获取步骤一里面的fileKey " \"sealBizType\": \"COMMON\"\n" +
String sealImageFileKey = jsonObject1.getJSONObject("data").getString("fileKey"); "}";
String sealName = deptIdentify.getSealName(); //请求方法
//请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null EsignRequestType requestType = EsignRequestType.POST;
String jsonParm = "{\n" + //生成签名鉴权方式的的header
" \"orgId\": \"" + orgId + "\",\n" + Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
" \"sealImageFileKey\": \"" + sealImageFileKey + "\",\n" + //发起接口请求
" \"sealName\": \" " + sealName + " \",\n" + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
" \"sealWidth\": 50,\n" +
" \"sealHeight\": 50,\n" +
"}";
//请求方法
EsignRequestType requestType = EsignRequestType.POST;
//生成签名鉴权方式的的header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
//发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
}
}
} }
return null; return null;
} }
@@ -485,35 +478,38 @@ public class SignAward {
*/ */
public static EsignHttpResponse orgOwnSealList(DeptIdentify deptIdentify) throws EsignDemoException { public static EsignHttpResponse orgOwnSealList(DeptIdentify deptIdentify) throws EsignDemoException {
String orgId=deptIdentify.getOrgId(); String orgId = deptIdentify.getOrgId();
int pageNum=1; int pageNum = 1;
int pageSize=20; int pageSize = 20;
String apiaddr="/v3/seals/org-own-seal-list?orgId="+orgId+"&pageNum="+pageNum+"&pageSize="+pageSize; String apiaddr = "/v3/seals/org-own-seal-list?orgId=" + orgId + "&pageNum=" + pageNum + "&pageSize=" + pageSize;
//请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
String jsonParm=null; String jsonParm = null;
//请求方法 //请求方法
EsignRequestType requestType= EsignRequestType.GET; EsignRequestType requestType = EsignRequestType.GET;
//生成签名鉴权方式的的header //生成签名鉴权方式的的header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,false); Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
//发起接口请求 //发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,false); return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
} }
/** /**
* 查询指定印章详情(机构) * 查询指定印章详情(机构)
*/ */
public static EsignHttpResponse getOrgSeal(String orgId,String sealId) throws EsignDemoException { public static EsignHttpResponse getOrgSeal(String orgId, String sealId) throws EsignDemoException {
String apiaddr="/v3/seals/org-seal-info?orgId="+orgId+"&sealId="+sealId; String apiaddr = "/v3/seals/org-seal-info?orgId=" + orgId + "&sealId=" + sealId;
//请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
String jsonParm=null; String jsonParm = null;
//请求方法 //请求方法
EsignRequestType requestType= EsignRequestType.GET; EsignRequestType requestType = EsignRequestType.GET;
//生成签名鉴权方式的的header //生成签名鉴权方式的的header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,false); Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
//发起接口请求 //发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,false); return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
} }
} }
@@ -32,7 +32,7 @@
</select> </select>
<select id="selectDeptIdentifyBydeptid" parameterType="DeptIdentify" resultMap="DeptIdentifyResult"> <select id="selectDeptIdentifyBydeptid" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
SELECT d.id ,d.dept_id ,d.user_id ,d.org_id ,d.auth_flow_id SELECT d.*
from dept_identify d from dept_identify d
<where> <where>
<if test="deptId != null"> <if test="deptId != null">
@@ -41,6 +41,9 @@
<if test="userId != null"> <if test="userId != null">
AND d.user_id = #{userId} AND d.user_id = #{userId}
</if> </if>
<if test="id != null">
AND d.id = #{id}
</if>
</where> </where>
</select> </select>
@@ -48,11 +51,23 @@
insert into dept_identify( insert into dept_identify(
<if test="deptId != null">dept_id,</if> <if test="deptId != null">dept_id,</if>
<if test="userId != null">user_id,</if> <if test="userId != null">user_id,</if>
<if test="identifyStatus != null">identify_status</if> <if test="identifyStatus != null">identify_status,</if>
<if test="identifyDate != null">identify_date,</if>
<if test="isUse != null">is_use,</if>
<if test="sealName != null and sealName != ''">seal_name,</if>
<if test="orgId != null and orgId != ''">org_id,</if>
<if test="authFlowId != null and authFlowId != ''">auth_flow_id,</if>
<if test="sealId != null and sealId != ''">seal_id</if>
)values( )values(
<if test="deptId != null">#{deptId},</if> <if test="deptId != null">#{deptId},</if>
<if test="userId != null">#{userId},</if> <if test="userId != null">#{userId},</if>
<if test="identifyStatus != null">#{identifyStatus}</if> <if test="identifyStatus != null">#{identifyStatus},</if>
<if test="identifyDate != null">#{identifyDate},</if>
<if test="isUse != null">#{isUse},</if>
<if test="sealName != null and sealName != ''">#{sealName},</if>
<if test="orgId != null and orgId != ''">#{orgId},</if>
<if test="authFlowId != null and authFlowId != '' ">#{authFlowId},</if>
<if test="sealId != null and sealId != ''">#{sealId}</if>
) )
</insert> </insert>
@@ -104,14 +119,13 @@
<if test="orgId != null and orgId != ''">org_id = #{orgId},</if> <if test="orgId != null and orgId != ''">org_id = #{orgId},</if>
<if test="sealId != null and sealId != ''">seal_id = #{sealId},</if> <if test="sealId != null and sealId != ''">seal_id = #{sealId},</if>
<if test="sealStatus != null ">seal_status = #{sealStatus},</if> <if test="sealStatus != null ">seal_status = #{sealStatus},</if>
<if test="authFlowId != null and authFlowId != '' ">auth_flow_id = #{authFlowId},</if>
</set> </set>
<where> <where>
<if test="id != null"> <if test="id != null">
AND id = #{id} AND id = #{id}
</if> </if>
<if test="sealId != null">
AND seal_id = #{sealId}
</if>
</where> </where>
</update> </update>
@@ -119,6 +133,4 @@
</mapper> </mapper>