From b18075b0c4633ae4d25fa1497e9b98babef6eb06 Mon Sep 17 00:00:00 2001 From: hejinbo Date: Wed, 8 Nov 2023 10:37:48 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A3=81=E5=86=B3?= =?UTF-8?q?=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AdjudicationServiceImpl.java | 6 +-- .../impl/CaseArbitrateServiceImpl.java | 44 ++++++++++++++++--- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java index 62d0f2e..ff37315 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java @@ -296,9 +296,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { String month = String.format("%02d", now.getMonthValue()); String day = String.format("%02d", now.getDayOfMonth()); String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx"; - //String modalFilePath = "D:/develop/新裁决书模板.docx"; + // String modalFilePath = "D:/develop/新裁决书模板.docx"; String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; - //String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day; + // String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day; String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx"; String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; String resultFilePath = saveFolderPath + "/" + fileName; @@ -729,7 +729,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { //财产保全 Integer properPreser = caseApplication1.getProperPreser(); String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" + - "第二十八条之规定,将该申请提交至XXX市XXX区法院。"; + "第二十八条之规定,将该申请提交至法院。"; if (properPreser == null) { datas.put("preservation", null); } else if (properPreser == 1) { diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java index 65bb975..3a9f0d8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.wisdomarbitrate.service.impl; import cn.hutool.core.collection.CollectionUtil; +import com.deepoove.poi.data.PictureRenderData; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; @@ -8,6 +9,7 @@ import com.ruoyi.common.utils.WordUtil; import com.ruoyi.wisdomarbitrate.domain.*; import com.ruoyi.wisdomarbitrate.mapper.*; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; +import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.wisdomarbitrate.service.ICaseArbitrateService; @@ -28,6 +30,7 @@ import java.time.LocalDate; import java.time.ZoneId; import java.util.*; import java.util.function.Function; +import java.util.regex.Pattern; import java.util.stream.Collectors; import static com.ruoyi.common.utils.SecurityUtils.getUsername; @@ -50,6 +53,8 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { private IAdjudicationService adjudicationService; @Autowired private RedisCache redisCache; + @Autowired + private ICaseApplicationService caseApplicationService; @Override @Transactional @@ -346,7 +351,12 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { } else if (identityType == 2) { //被申请人 datas.put("resName", affiliate.getName()); datas.put("resAddress", affiliate.getResidenAffili()); - datas.put("resSex", affiliate.getResponSex()); + String responSex = affiliate.getResponSex(); + if (responSex.equals("0")) { + datas.put("resSex", "男"); + } else { + datas.put("resSex", "女"); + } Date responBirth = affiliate.getResponBirth(); if (responBirth != null) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); @@ -495,10 +505,34 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { } datas.put("claims", caseApplication1.getArbitratClaims()); datas.put("request", caseApplication1.getRequestRule()); - //申请人证据材料 - datas.put("appEvidenceMaterial", null); - //被申请人证据材料 - datas.put("resEvidenceMaterial", null); + CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication); + List caseAttachList1 = caseApplication2.getCaseAttachList(); + if (caseAttachList1 != null && caseAttachList1.size() > 0) { + for (CaseAttach caseAttach : caseAttachList1) { + if (caseAttach.getAnnexType() == 6) { //被申请人证据材料 + String annexName = caseAttach.getAnnexName(); + boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName); + if (isImageFile) { + String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath(); + System.out.println("路径是===========" + annexPath); + PictureRenderData pictureRenderData = WordUtil + .rebuildImageContent(100, 100, null, annexPath); + datas.put("resEvidenceMaterial", pictureRenderData); + } + } else if (caseAttach.getAnnexType() == 2) { //申请人证据材料 + String annexName = caseAttach.getAnnexName(); + boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName); + if (isImageFile) { + String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath(); + System.out.println("路径是===========" + annexPath); + PictureRenderData pictureRenderData = WordUtil + .rebuildImageContent(100, 100, null, annexPath); + //申请人证据材料 + datas.put("appEvidenceMaterial", pictureRenderData); + } + } + } + } datas.put("applicaCrossOpin", caseApplication1.getApplicaCrossOpin()); if (arbitrateRecord1 != null) { datas.put("factDetermi", arbitrateRecord1.getFactDetermi()); -- 2.54.0 From 1cdf3abc301c0e91d77c7c0473c7ecd98c225f8e Mon Sep 17 00:00:00 2001 From: hejinbo Date: Wed, 8 Nov 2023 17:47:59 +0800 Subject: [PATCH 2/4] 11.8kaifa --- .../java/com/ruoyi/common/utils/SealUtil.java | 125 ++++++++++++++++++ .../wisdomarbitrate/domain/DeptIdentify.java | 22 +++ .../service/impl/DeptIdentifyServiceImpl.java | 3 + .../utils/FixSelectFlowDetailUtils.java | 12 +- .../wisdomarbitrate/utils/SignAward.java | 61 +++++++-- 5 files changed, 203 insertions(+), 20 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java new file mode 100644 index 0000000..74860a6 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java @@ -0,0 +1,125 @@ +package com.ruoyi.common.utils; + +import com.ruoyi.common.config.EsignDemoConfig; +import com.ruoyi.common.constant.EsignHeaderConstant; +import com.ruoyi.common.core.domain.entity.EsignHttpResponse; +import com.ruoyi.common.enums.EsignRequestType; +import com.ruoyi.common.exception.EsignDemoException; +import com.ruoyi.common.utils.bean.EsignFileBean; + +import java.util.Map; + +public class SealUtil { + private static String eSignHost = EsignDemoConfig.EsignHost; + private static String eSignAppId = EsignDemoConfig.EsignAppId; + private static String eSignAppSecret = EsignDemoConfig.EsignAppSecret; + + /** + * 获取机构认证&授权页面链接 + * + * @return + */ + public static EsignHttpResponse getOrgEmpower() throws EsignDemoException { + String apiaddr = "/v3/org-auth-url"; + String nickName = "何进波"; + String phonenumber = "15191509780"; + String deptName = "西安云美公司"; + String jsonParm = "{\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; + //生成请求签名鉴权方式的Header + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + //发起接口请求 + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + + } + /** + * 查询认证授权流程详情 + * + * @return + */ + public static EsignHttpResponse queryAuthProcess(String authFlowId ) throws EsignDemoException { + String apiaddr = "/v3/auth-flow/" + authFlowId; + //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null + String jsonParm=null; + //请求方法 + EsignRequestType requestType= EsignRequestType.GET; + //生成签名鉴权方式的的header + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); + //发起接口请求 + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); + } + + + + + /** + * 步骤一:获取印章图片上传地址fileUploadUrl + * + * @return + */ + public static EsignHttpResponse getFileUploadUrl() throws EsignDemoException { + //自定义的文件封装类,传入文件地址可以获取文件的名称大小,文件流等数据 + String filePath = "D:\\develop\\Snipaste_2023-10-27_09-59-23.jpg"; + EsignFileBean esignFileBean = new EsignFileBean(filePath); + String apiaddr="/v3/files/file-key"; + //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null + String jsonParm="{\n" + + " \"contentMd5\": \""+esignFileBean.getFileContentMD5()+"\",\n" + + " \"fileName\":\""+esignFileBean.getFileName()+"\"," + + " \"fileSize\": "+esignFileBean.getFileSize()+",\n" + + " \"contentType\": \""+ EsignHeaderConstant.CONTENTTYPE_STREAM.VALUE()+"\"\n" + + "}"; + //请求方法 + EsignRequestType requestType= EsignRequestType.POST; + //生成签名鉴权方式的的header + Map 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; + } + + /** + * 步骤二:将印章图片文件流上传到fileUploadUrl + * + * @return + */ + public static EsignHttpResponse fileStreamUpload(String uploadUrl,String filePath) throws EsignDemoException { + //根据文件地址获取文件contentMd5 + EsignFileBean esignFileBean = new EsignFileBean(filePath); + //请求方法 + EsignRequestType requestType= EsignRequestType.PUT; + return EsignHttpHelper.doUploadHttp(uploadUrl,requestType,esignFileBean.getFileBytes(),esignFileBean.getFileContentMD5(), EsignHeaderConstant.CONTENTTYPE_STREAM.VALUE(),true); + } + public static void main(String[] args) throws Exception { + // createOrgByImage(); + // getOrgEmpower(); + // queryAuthProcess("OF-2b00885895080028"); + // getFileUploadUrl(); +// String uplodUrl = "https://esignoss.esign.cn/7438987614/8e278262-5960-4004-bff3-297c11e2652e/Snipaste_2023-10-27_09-59-23.jpg?Expires=1699439095&OSSAccessKeyId=STS.NTZ8NBHcTVQXgsxVRH4iyC5AY&Signature=3yu3ZQifphZsnOgN0CI0SJdqFhY%3D&callback-var=eyJ4OmZpbGVfa2V5IjoiJDliM2Y3ZjkyLTdkOWUtNGZkZi04NWU4LWE4ZDU4MzEwZjIzOCQ0MTQwNTE2ODk5In0%3D%0A&callback=eyJjYWxsYmFja1VybCI6Imh0dHA6Ly9zbWx0YXBpLnRzaWduLmNuL2FueWRvb3IvZmlsZS1zeXN0ZW0vY2FsbGJhY2svYWxpb3NzIiwiY2FsbGJhY2tCb2R5IjogIntcIm1pbWVUeXBlXCI6JHttaW1lVHlwZX0sXCJzaXplXCI6ICR7c2l6ZX0sXCJidWNrZXRcIjogJHtidWNrZXR9LFwib2JqZWN0XCI6ICR7b2JqZWN0fSxcImV0YWdcIjogJHtldGFnfSxcImZpbGVfa2V5XCI6JHt4OmZpbGVfa2V5fX0iLCJjYWxsYmFja0JvZHlUeXBlIjogImFwcGxpY2F0aW9uL2pzb24ifQ%3D%3D%0A&security-token=CAIS%2BAF1q6Ft5B2yfSjIr5fvc%2FT2pbx14ZOzZVXJslIdOOZVrPDquzz2IHtKdXRvBu8Xs%2F4wnmxX7f4YlqB6T55OSAmcNZEoWWWTbdH4MeT7oMWQweEurv%2FMQBqyaXPS2MvVfJ%2BOLrf0ceusbFbpjzJ6xaCAGxypQ12iN%2B%2Fm6%2FNgdc9FHHPPD1x8CcxROxFppeIDKHLVLozNCBPxhXfKB0ca0WgVy0EHsPnvm5DNs0uH1AKjkbRM9r6ceMb0M5NeW75kSMqw0eBMca7M7TVd8RAi9t0t1%2FIVpGiY4YDAWQYLv0rda7DOltFiMkpla7MmXqlft%2BhzcgeQY0pc%2FRqAAXGx8FDtPQxW3RSasFgOFBJaxbYjH3WFFrbV25v8a%2BS9OWPAYqOCvmkxbM7N4hOge2iaBAG4SRLMb6ypPJ15YEpoZI8KkdeDvQJryZEWchmc0Lhz0yDRqrN%2BzYhgu4VpBJu1WJg%2FyXrvAZ0gWhBN%2BILrblSR9QHVWVVYZTAKN4ejIAA%3D"; +// fileStreamUpload(uplodUrl,"D:\\develop\\Snipaste_2023-10-27_09-59-23.jpg"); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java index a45a78e..363b96b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java @@ -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; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java index a00f982..3df2489 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java @@ -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); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java index b5dd175..b4a15ff 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java @@ -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); } - } - } - } - } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java index adf53cc..2b5fd23 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java @@ -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 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; + } } -- 2.54.0 From 94d3f1cb1e4212e66cc68870da6019ce539b6b36 Mon Sep 17 00:00:00 2001 From: hejinbo Date: Thu, 9 Nov 2023 17:34:12 +0800 Subject: [PATCH 3/4] =?UTF-8?q?11.9=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeptIdentifyController.java | 12 ++ .../java/com/ruoyi/common/utils/SealUtil.java | 3 +- .../wisdomarbitrate/domain/CaseAttach.java | 4 + .../wisdomarbitrate/domain/DeptIdentify.java | 25 ++- .../service/IDeptIdentifyService.java | 5 + .../service/impl/DeptIdentifyServiceImpl.java | 78 +++++++- .../utils/FixSelectFlowDetailUtils.java | 155 +++++++++++---- .../wisdomarbitrate/utils/SignAward.java | 178 +++++++++++------- .../wisdomarbitrate/CaseAttachMapper.xml | 5 +- .../wisdomarbitrate/DeptIdentifyMapper.xml | 10 +- 10 files changed, 351 insertions(+), 124 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java index 3366e0a..7b6a619 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java @@ -13,6 +13,7 @@ import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -49,6 +50,17 @@ public class DeptIdentifyController extends BaseController { return deptIdentifyService.enableDept(deptIdentify); } + /** + * 上传自定义公章 + * @param deptIdentify + * @param file + * @return + */ + @PostMapping("sealUpload") + public AjaxResult sealUpload(@Validated @RequestBody DeptIdentify deptIdentify + ,@RequestParam("file") MultipartFile file){ + return deptIdentifyService.sealUpload(deptIdentify,file); + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java index 74860a6..95bfef5 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java @@ -80,9 +80,8 @@ public class SealUtil { * * @return */ - public static EsignHttpResponse getFileUploadUrl() throws EsignDemoException { + public static EsignHttpResponse getFileUploadUrl(String filePath) throws EsignDemoException { //自定义的文件封装类,传入文件地址可以获取文件的名称大小,文件流等数据 - String filePath = "D:\\develop\\Snipaste_2023-10-27_09-59-23.jpg"; EsignFileBean esignFileBean = new EsignFileBean(filePath); String apiaddr="/v3/files/file-key"; //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java index 235d502..c7d7541 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java @@ -42,5 +42,9 @@ public class CaseAttach { * 用户账户 */ private String userName; + /** + * 印章状态(0未启用,1已启用) + */ + private Integer sealStatus; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java index 363b96b..f117e71 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java @@ -2,7 +2,6 @@ package com.ruoyi.wisdomarbitrate.domain; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.domain.BaseEntity; - import java.util.Date; public class DeptIdentify extends BaseEntity { @@ -39,6 +38,30 @@ public class DeptIdentify extends BaseEntity { /** 认证授权流程ID */ private String authFlowId; + public String getSealId() { + return sealId; + } + + public void setSealId(String sealId) { + this.sealId = sealId; + } + + /** 印章id */ + private String sealId; + + /** + * 附件id + */ + private Integer annexId; + + public Integer getAnnexId() { + return annexId; + } + + public void setAnnexId(Integer annexId) { + this.annexId = annexId; + } + public String getAuthFlowId() { return authFlowId; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java index e6d3753..fac352f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java @@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.service; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; +import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -15,4 +16,8 @@ public interface IDeptIdentifyService { DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException; AjaxResult enableDept(DeptIdentify deptIdentify); + + AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file); + + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java index 3df2489..710d5a5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java @@ -1,18 +1,26 @@ package com.ruoyi.wisdomarbitrate.service.impl; +import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.google.gson.JsonObject; +import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.domain.AjaxResult; 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.FileUploadUtils; +import com.ruoyi.wisdomarbitrate.domain.CaseAttach; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; +import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper; import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper; import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService; import com.ruoyi.wisdomarbitrate.utils.SignAward; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; import java.util.Date; import java.util.List; @@ -21,19 +29,21 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { @Autowired private DeptIdentifyMapper deptIdentifyMapper; + @Autowired + private CaseAttachMapper caseAttachMapper; @Override @Transactional public List selectDeptIdentify(DeptIdentify deptIdentify) { List deptIdentifys = deptIdentifyMapper.selectDeptIdentify(deptIdentify); - if(deptIdentifys!=null&&deptIdentifys.size()>0){ + if (deptIdentifys != null && deptIdentifys.size() > 0) { for (int i = 0; i < deptIdentifys.size(); i++) { DeptIdentify deptIdentifyselect = deptIdentifys.get(i); List deptIdentifylist = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentifyselect); - if(deptIdentifylist!=null&&deptIdentifylist.size()>0){ + if (deptIdentifylist != null && deptIdentifylist.size() > 0) { continue; - }else { + } else { deptIdentifyselect.setIdentifyStatus(0); deptIdentifyMapper.insertDeptIdentify(deptIdentifyselect); } @@ -49,21 +59,21 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { public DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException { List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify); DeptIdentify deptIdentifynew = new DeptIdentify(); - if(deptIdentifysnew!=null&&deptIdentifysnew.size()>0){ + if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { Gson gson = new Gson(); DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0); EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect); JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class); + int code = signUrlJsonObject.get("code").getAsInt(); JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); String url = signUrlData.get("authUrl").getAsString(); //获取本次认证授权流程ID String authFlowId = signUrlData.get("authFlowId").getAsString(); deptIdentify.setAuthFlowId(authFlowId); deptIdentifynew.setIdentifyUrl(url); + deptIdentify.setIdentifyDate(new Date()); + int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify); } - - deptIdentify.setIdentifyDate(new Date()); - int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify); return deptIdentifynew; } @@ -73,9 +83,9 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify); DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0); Integer identifyStatus = deptIdentifyselect.getIdentifyStatus(); - if(identifyStatus.intValue()==0){ + if (identifyStatus.intValue() == 0) { return AjaxResult.error("这个认证数据未进行认证,不能启用"); - }else if(identifyStatus.intValue()==1){ + } else if (identifyStatus.intValue() == 1) { deptIdentifyselect.setIsUse(1); deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect); @@ -83,7 +93,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { deptIdentifySel.setId(deptIdentify.getId()); deptIdentifySel.setIdentifyStatus(1); List deptIdentifysother = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentifySel); - if(deptIdentifysother!=null&&deptIdentifysother.size()>0){ + if (deptIdentifysother != null && deptIdentifysother.size() > 0) { for (int i = 0; i < deptIdentifysother.size(); i++) { DeptIdentify deptIdentifyother = deptIdentifysother.get(i); deptIdentifyother.setIsUse(0); @@ -96,5 +106,53 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { } + @Override + public AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file) { + try { + if (file.isEmpty()) { + return AjaxResult.error("请选择要上传的文件"); + } + String filePath = RuoYiConfig.getUploadPath(); + // 上传 + String fileName = FileUploadUtils.upload(filePath, file); + List deptIdentifies = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentify); + if (deptIdentifies != null && deptIdentifies.size() > 0) { + for (DeptIdentify identify : deptIdentifies) { + //先判断企业用户是否授予资源管理权限 + String authFlowId = identify.getAuthFlowId(); + EsignHttpResponse response1 = SealUtil.queryAuthProcess(authFlowId); + JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); + int authorizedStatus = jsonObject1.getJSONObject("data").getIntValue("authorizedStatus"); + if (authorizedStatus == 1){//授权流程状态 0流程过期失效 1已授权 2授权中 3审批未通过 + String prefix = "/profile"; + int startIndex = fileName.indexOf(prefix); + startIndex += prefix.length(); + String annexPath = "/uploadPath" + fileName.substring(startIndex); + //创建机构图片印章 + EsignHttpResponse response = SignAward.createOrgByImage(identify, annexPath); + JSONObject jsonObject = JSONObject.parseObject(response.getBody()); + int code = jsonObject.getIntValue("code"); + if (code == 0) { //业务码,0表示成功,非0表示异常。 + String sealId = jsonObject.getJSONObject("data").getString("sealId"); + identify.setSealId(sealId); + identify.setIsUse(0); //设置印章使用状态为未启用 + //保存到表里 + int i = deptIdentifyMapper.updateDeptIdentify(identify); + if (i>0){ + return AjaxResult.success("上传成功"); + } + } + } + return AjaxResult.error("企业用户未授予资源管理权限"); + } + } + } catch (IOException e) { + e.printStackTrace(); + } catch (EsignDemoException e) { + e.printStackTrace(); + } + return AjaxResult.error(); + } + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java index b4a15ff..fdc2e2a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java @@ -1,5 +1,7 @@ package com.ruoyi.wisdomarbitrate.utils; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; @@ -42,7 +44,7 @@ public class FixSelectFlowDetailUtils { @Scheduled(cron = "0/10 * * * * ?") @Transactional - public void fixExecuteSelectFlowDetailUtils(){ + public void fixExecuteSelectFlowDetailUtils() { Gson gson = new Gson(); SealSignRecord sealSignRecordselect = new SealSignRecord(); @@ -50,40 +52,40 @@ public class FixSelectFlowDetailUtils { List sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat(sealSignRecordselect); try { - if(sealSignRecords!=null&&sealSignRecords.size()>0){ + if (sealSignRecords != null && sealSignRecords.size() > 0) { for (int i = 0; i < sealSignRecords.size(); i++) { SealSignRecord sealSignRecord = sealSignRecords.get(i); EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord); - JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class); + JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(), JsonObject.class); JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data"); JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray(); Integer psnsignStatus = null; Integer orgsignStatus = null; for (int j = 0; j < signersArray.size(); j++) { - JsonObject signerObject = (JsonObject)signersArray.get(j); + JsonObject signerObject = (JsonObject) signersArray.get(j); - if(!(signerObject.get("psnSigner").toString()).equals("null")){ + if (!(signerObject.get("psnSigner").toString()).equals("null")) { JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner"); - if(psnSignerData!=null){ + if (psnSignerData != null) { psnsignStatus = signerObject.get("signStatus").getAsInt(); } } - if(!(signerObject.get("orgSigner").toString()).equals("null")){ + if (!(signerObject.get("orgSigner").toString()).equals("null")) { JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner"); - if(orgSignerData!=null){ + if (orgSignerData != null) { orgsignStatus = signerObject.get("signStatus").getAsInt(); } } } - if((psnsignStatus.intValue()==2)&&(orgsignStatus.intValue()==1)){ + if ((psnsignStatus.intValue() == 2) && (orgsignStatus.intValue() == 1)) { //更新立案申请状态为待用印 CaseApplication caseApplication = new CaseApplication(); caseApplication.setId(sealSignRecord.getCaseAppliId()); CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication); - if(caseApplicationselect!=null){ - if((caseApplicationselect.getCaseStatus()!=null)&&(caseApplicationselect.getCaseStatus().intValue()==CaseApplicationConstants.SIGN_ARBITRATION)){ + if (caseApplicationselect != null) { + if ((caseApplicationselect.getCaseStatus() != null) && (caseApplicationselect.getCaseStatus().intValue() == CaseApplicationConstants.SIGN_ARBITRATION)) { caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL); caseApplicationMapper.submitCaseApplication(caseApplication); @@ -94,30 +96,30 @@ public class FixSelectFlowDetailUtils { } } - if((psnsignStatus.intValue()==2)&&(orgsignStatus.intValue()==2)){ + if ((psnsignStatus.intValue() == 2) && (orgsignStatus.intValue() == 2)) { //更新立案申请状态为待送达 CaseApplication caseApplication = new CaseApplication(); caseApplication.setId(sealSignRecord.getCaseAppliId()); CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication); - if(caseApplicationselect!=null){ - if((caseApplicationselect.getCaseStatus()!=null)&&(caseApplicationselect.getCaseStatus().intValue()==CaseApplicationConstants.ARBITRATED_SEAL)){ + if (caseApplicationselect != null) { + if ((caseApplicationselect.getCaseStatus() != null) && (caseApplicationselect.getCaseStatus().intValue() == CaseApplicationConstants.ARBITRATED_SEAL)) { caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY); //下载审核完成的裁决书, String signFlowId = sealSignRecord.getSignFlowid(); EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); - JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(),JsonObject.class); + JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); - if(filesArray!=null&&filesArray.size()>0){ - JsonObject fileObject = (JsonObject)filesArray.get(0); + if (filesArray != null && filesArray.size() > 0) { + JsonObject fileObject = (JsonObject) filesArray.get(0); String fileDownloadUrl = fileObject.get("downloadUrl").toString(); //修改"签署用印记录表"的状态为签署完成 sealSignRecord.setSignFlowStatus(3); - sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1,fileDownloadUrl.length()-1)); + sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1)); sealSignRecordMapper.updataSealSignRecord(sealSignRecord); - String filearbitraUrl = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1); + String filearbitraUrl = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); caseApplication.setFilearbitraUrl(filearbitraUrl); caseApplicationMapper.submitCaseApplication(caseApplication); @@ -136,22 +138,22 @@ public class FixSelectFlowDetailUtils { saveFolder.mkdirs(); } String resultFilePath = saveFolderPath + "/" + fileName; - File resultFilePathFile = new File(resultFilePath); + File resultFilePathFile = new File(resultFilePath); if (!resultFilePathFile.exists()) { resultFilePathFile.createNewFile(); } - String fileDownloadUrlnew = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1); - boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); - if(downLoadFile) { - Long caseAppliId = sealSignRecord.getCaseAppliId(); - CaseAttach caseAttach = new CaseAttach(); - caseAttach.setCaseAppliId(caseAppliId); - caseAttach.setAnnexType(3); - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); - caseAttachMapper.updateCaseAttachBycaseid(caseAttach); - } + String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); + boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); + if (downLoadFile) { + Long caseAppliId = sealSignRecord.getCaseAppliId(); + CaseAttach caseAttach = new CaseAttach(); + caseAttach.setCaseAppliId(caseAppliId); + caseAttach.setAnnexType(3); + caseAttach.setAnnexPath(savePath); + caseAttach.setAnnexName(saveName); + caseAttachMapper.updateCaseAttachBycaseid(caseAttach); + } } } @@ -163,7 +165,7 @@ public class FixSelectFlowDetailUtils { } } catch (EsignDemoException e) { e.printStackTrace(); - }catch (IOException e) { + } catch (IOException e) { e.printStackTrace(); } @@ -176,13 +178,13 @@ public class FixSelectFlowDetailUtils { DeptIdentify deptIdentify = new DeptIdentify(); deptIdentify.setIdentifyStatus(0); List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify); - if(deptIdentifysnew!=null&&deptIdentifysnew.size()>0){ + 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){ + if (realnameStatus == 1) { String orgId = identifyInfoData.get("orgId").getAsString(); EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId); //将orgId保存到数据库里 @@ -192,15 +194,15 @@ public class FixSelectFlowDetailUtils { JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data"); JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray(); String sealNames = ""; - if(sealArray.size()>0){ + if (sealArray.size() > 0) { for (int j = 0; j < sealArray.size(); j++) { - JsonObject sealObject = (JsonObject)sealArray.get(j); + JsonObject sealObject = (JsonObject) sealArray.get(j); String sealName = sealObject.get("sealName").toString(); - String sealNamenew = sealName.substring(1,sealName.length()-1); - sealNames += sealNamenew +","; + String sealNamenew = sealName.substring(1, sealName.length() - 1); + sealNames += sealNamenew + ","; } } - String sealName = sealNames.substring(0,sealNames.length()-1); + String sealName = sealNames.substring(0, sealNames.length() - 1); deptIdentifynew.setIdentifyStatus(1); deptIdentifynew.setSealName(sealName); int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew); @@ -208,4 +210,79 @@ public class FixSelectFlowDetailUtils { } } } + + /** + * 定时查询企业内部印章审核状态 + * + * @throws EsignDemoException + */ + @Scheduled(cron = "0/30 * * * * ?") + @Transactional + public void searchForInstitutionalSeal() { + try { + DeptIdentify deptIdentify = new DeptIdentify(); + deptIdentify.setIsUse(0); + List deptIdentifies = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify); + if (deptIdentifies != null && deptIdentifies.size() > 0) { + for (DeptIdentify identify : deptIdentifies) { + //查询企业内部印章 + Integer annexId = identify.getAnnexId(); + if (annexId == null){ + //说明之前没有下载过 + EsignHttpResponse response = SignAward.orgOwnSealList(identify); + JSONObject jsonObject = JSONObject.parseObject(response.getBody()); + JSONObject data = jsonObject.getJSONObject("data"); + JSONArray seals = data.getJSONArray("seals"); + for (int i = 0; i < seals.size(); i++){ + JSONObject seal = seals.getJSONObject(i); + int statusDescription = seal.getIntValue("statusDescription"); + if (statusDescription==1){//印章状态 1已启用,2待审核,3审核不通过,4 挂起 + //已启用证明审核通过,下载到数据库 + String sealImageDownloadUrl = seal.getString("sealImageDownloadUrl"); + LocalDate now = LocalDate.now(); + String year = Integer.toString(now.getYear()); + String month = String.format("%02d", now.getMonthValue()); + String day = String.format("%02d", now.getDayOfMonth()); + String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; + String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; + String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; + String savePath = "/home/ruoyi/uploadPath/upload/"; + // 创建日期目录 + File saveFolder = new File(saveFolderPath); + if (!saveFolder.exists()) { + saveFolder.mkdirs(); + } + String resultFilePath = saveFolderPath + "/" + fileName; + File resultFilePathFile = new File(resultFilePath); + if (!resultFilePathFile.exists()) { + resultFilePathFile.createNewFile(); + } + boolean downLoadFile = FileTransformation.downLoadFileByUrl(sealImageDownloadUrl, resultFilePath); + if (downLoadFile) { + CaseAttach caseAttach = new CaseAttach(); + caseAttach.setAnnexType(10); //10代表印章图片 + caseAttach.setAnnexPath(savePath); + caseAttach.setAnnexName(saveName); + caseAttach.setSealStatus(1); //1代表印章启用 + int i1 = caseAttachMapper.save(caseAttach); + if (i1>0){ + //将附件id保存到公章管理表里 + Integer annexId1 = caseAttach.getAnnexId(); + identify.setAnnexId(annexId1); + deptIdentifyMapper.updateDeptIdentify(identify); + } + } + } + } + } + } + } + } catch (EsignDemoException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } } + + diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java index 2b5fd23..4a8b483 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java @@ -1,5 +1,6 @@ package com.ruoyi.wisdomarbitrate.utils; +import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; @@ -9,6 +10,7 @@ import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.EsignApplicaConfig; import com.ruoyi.common.utils.EsignHttpHelper; +import com.ruoyi.common.utils.SealUtil; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.SealSignRecord; @@ -18,10 +20,9 @@ import java.util.Map; public class SignAward { - private static String eSignHost= EsignApplicaConfig.EsignHost; - private static String eSignAppId= EsignApplicaConfig.EsignAppId; - private static String eSignAppSecret= EsignApplicaConfig.EsignAppSecret; - + private static String eSignHost = EsignApplicaConfig.EsignHost; + private static String eSignAppId = EsignApplicaConfig.EsignAppId; + private static String eSignAppSecret = EsignApplicaConfig.EsignAppSecret; public static void main(String[] args) throws EsignDemoException { @@ -89,8 +90,6 @@ public class SignAward { // System.out.println("机构印章名称:" +sealNames.substring(0,sealNames.length()-1)); - - //查询签署流程详情 // EsignHttpResponse signFlowDetail = signFlowDetail(sealSignRecord); // JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class); @@ -120,31 +119,30 @@ public class SignAward { // System.out.println(signFlowDetailJsonObject); - - } - /** * 查询签署流程详情 + * * @return */ public static EsignHttpResponse signFlowDetail(SealSignRecord sealSignRecord) throws EsignDemoException { String signFlowId = sealSignRecord.getSignFlowid(); - String apiaddr= "/v3/sign-flow/"+ signFlowId + "/detail"; + String apiaddr = "/v3/sign-flow/" + signFlowId + "/detail"; String jsonParm = null; //请求方法 EsignRequestType requestType = EsignRequestType.GET; //生成签名鉴权方式的的header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); } /** * 发起签署 + * * @return * @throws EsignDemoException */ @@ -174,8 +172,8 @@ public class SignAward { String jsonParm = "{\n" + " \"docs\": [\n" + " {\n" + - " \"fileId\": \"" + fileId + "\",\n" + - " \"fileName\": \"" + fileName + "\"\n" + + " \"fileId\": \"" + fileId + "\",\n" + + " \"fileName\": \"" + fileName + "\"\n" + " }\n" + " ],\n" + " \"signFlowConfig\": {\n" + @@ -203,22 +201,22 @@ public class SignAward { " \"signers\": [\n" + " {\n" + " \"psnSignerInfo\": {\n" + - " \"psnAccount\": \"" + psnAccount + "\",\n" + + " \"psnAccount\": \"" + psnAccount + "\",\n" + " \"psnInfo\": {\n" + - " \"psnName\": \"" + psnName + "\"\n" + + " \"psnName\": \"" + psnName + "\"\n" + " }\n" + " },\n" + " \"signFields\": [\n" + " {\n" + - " \"fileId\": \"" + fileId + "\",\n" + + " \"fileId\": \"" + fileId + "\",\n" + " \"normalSignFieldConfig\": {\n" + " \"autoSign\": false,\n" + " \"freeMode\": false,\n" + " \"movableSignField\": false,\n" + " \"signFieldPosition\": {\n" + - " \"positionPage\": \"" + positionPagepsn + "\",\n" + - " \"positionX\": " + positionXpsn + ",\n" + - " \"positionY\": " + positionYpsn + "\n" + + " \"positionPage\": \"" + positionPagepsn + "\",\n" + + " \"positionX\": " + positionXpsn + ",\n" + + " \"positionY\": " + positionYpsn + "\n" + " },\n" + " \"signFieldStyle\": 1\n" + " },\n" + @@ -230,31 +228,31 @@ public class SignAward { " {\n" + " \"orgSignerInfo\": {\n" + - " \"orgName\": \"" + orgName + "\",\n" + + " \"orgName\": \"" + orgName + "\",\n" + " \"transactorInfo\": {\n" + - " \"psnAccount\": \"" + orgNamePsnAccount + "\",\n" + + " \"psnAccount\": \"" + orgNamePsnAccount + "\",\n" + " \"psnInfo\": {\n" + - " \"psnName\": \"" + orgNamepsnName + "\"\n" + + " \"psnName\": \"" + orgNamepsnName + "\"\n" + " }\n" + " }\n" + " },\n" + " \"signFields\": [\n" + " {\n" + - " \"fileId\": \"" + fileId + "\",\n" + + " \"fileId\": \"" + fileId + "\",\n" + " \"normalSignFieldConfig\": {\n" + " \"autoSign\": false,\n" + " \"freeMode\": false,\n" + " \"availableSealIds\": [\n" + - " \"" + availableSealId + "\"\n" + + " \"" + availableSealId + "\"\n" + " ],\n" + " \"signFieldPosition\": {\n" + - " \"positionPage\": \"" + positionPageorg + "\",\n" + - " \"positionX\": " + positionXorg + ",\n" + - " \"positionY\": " + positionYorg + "\n" + + " \"positionPage\": \"" + positionPageorg + "\",\n" + + " \"positionX\": " + positionXorg + ",\n" + + " \"positionY\": " + positionYorg + "\n" + " },\n" + " \"signFieldStyle\": 1\n" + " },\n" + @@ -277,6 +275,7 @@ public class SignAward { /** * 获取合同文件签名链接 + * * @return * @throws EsignDemoException */ @@ -291,7 +290,7 @@ public class SignAward { " \"clientType\": \"PC\",\n" + " \"operator\": {\n" + - " \"psnAccount\": \"" + psnAccount + "\"\n" + + " \"psnAccount\": \"" + psnAccount + "\"\n" + " }\n" + "}"; //请求方法 @@ -304,6 +303,7 @@ public class SignAward { /** * 获取合同文件用印链接 + * * @return * @throws EsignDemoException */ @@ -317,10 +317,10 @@ public class SignAward { String jsonParm = "{\n" + " \"operator\": {\n" + - " \"psnAccount\": \"" + psnAccount + "\"\n" + + " \"psnAccount\": \"" + psnAccount + "\"\n" + " },\n" + " \"organization\": {\n" + - " \"orgName\": \"" + orgName + "\"\n" + + " \"orgName\": \"" + orgName + "\"\n" + " }\n" + "}"; @@ -346,10 +346,10 @@ public class SignAward { " \"orgAuthConfig\": {\n" + " \"orgName\": \"" + deptName + " \",\n" + " \"transactorInfo\": {\n" + - " \"psnAccount\": \"" + phonenumber + "\",\n" + + " \"psnAccount\": \"" + phonenumber + "\",\n" + " \"psnInfo\": {\n" + - " \"psnName\": \"" + nickName + "\",\n" + - " \"psnMobile\": \"" + phonenumber + "\"\n" + + " \"psnName\": \"" + nickName + "\",\n" + + " \"psnMobile\": \"" + phonenumber + "\"\n" + " }\n" + " }\n" + " },\n" + @@ -377,36 +377,37 @@ public class SignAward { * 查询企业认证状态 */ public static EsignHttpResponse getDeptIdentifyInfo(DeptIdentify deptIdentify) throws EsignDemoException { - String apiaddr="/v3/organizations/identity-info?orgName="+deptIdentify.getDeptName(); + String apiaddr = "/v3/organizations/identity-info?orgName=" + deptIdentify.getDeptName(); - String jsonParm="{}"; + String jsonParm = "{}"; //请求方法 - EsignRequestType requestType= EsignRequestType.GET; + EsignRequestType requestType = EsignRequestType.GET; //生成签名鉴权方式的的header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); } + /** * 查询企业认证印章信息 */ public static EsignHttpResponse deptIdentifySealList(String orgId) throws EsignDemoException { - int pageNum=1; - int pageSize=10; - String apiaddr="/v3/seals/org-own-seal-list?orgId="+orgId+"&pageNum="+pageNum+"&pageSize="+pageSize; - String jsonParm=null; + int pageNum = 1; + int pageSize = 10; + String apiaddr = "/v3/seals/org-own-seal-list?orgId=" + orgId + "&pageNum=" + pageNum + "&pageSize=" + pageSize; + String jsonParm = null; //请求方法 - EsignRequestType requestType= EsignRequestType.GET; + EsignRequestType requestType = EsignRequestType.GET; //生成签名鉴权方式的的header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); } - /** * 获取文件签名印章位置 + * * @return * @throws EsignDemoException */ @@ -432,27 +433,70 @@ public class SignAward { * * @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 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; + public static EsignHttpResponse createOrgByImage(DeptIdentify deptIdentify, String filePath) throws EsignDemoException { + //获取认证授权流程ID + String authFlowId = deptIdentify.getAuthFlowId(); + //查询认证授权流程详情 + EsignHttpResponse response = SealUtil.queryAuthProcess(authFlowId); + String body = response.getBody(); + if (body != null) { + JSONObject jsonObject = JSONObject.parseObject(body); + //查询授权流程状态 + int authorizedStatus = jsonObject.getJSONObject("data").getIntValue("authorizedStatus"); + if (authorizedStatus == 1) {//0 -流程过期失效 1 - 已授权 2 - 授权中 3 - 审批未通过 + String apiaddr = "/v3/seals/org-seals/create-by-image"; + String orgId = deptIdentify.getOrgId(); + //上传印章图片 + //步骤一:获取印章图片上传地址fileUploadUrl + EsignHttpResponse response1 = SealUtil.getFileUploadUrl(filePath); + JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); + String fileUploadUrl = jsonObject1.getJSONObject("data").getString("fileUploadUrl"); + //步骤二:将印章图片文件流上传到fileUploadUrl + EsignHttpResponse response2 = SealUtil.fileStreamUpload(fileUploadUrl, filePath); + JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); + int errCode = jsonObject2.getIntValue("errCode"); + if (errCode == 0){ //业务码,0表示成功,非0表示异常。 + //获取步骤一里面的fileKey + String sealImageFileKey = jsonObject1.getJSONObject("data").getString("fileKey"); + String sealName = deptIdentify.getSealName(); + //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null + String jsonParm = "{\n" + + " \"orgId\": \"" + orgId + "\",\n" + + " \"sealImageFileKey\": \"" + sealImageFileKey + "\",\n" + + " \"sealName\": \" " + sealName + " \",\n" + + " \"sealWidth\": 50,\n" + + " \"sealHeight\": 50,\n" + + "}"; + //请求方法 + EsignRequestType requestType = EsignRequestType.POST; + //生成签名鉴权方式的的header + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + //发起接口请求 + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + } + } + } + return null; } + /** + * 查询企业内部印章 + */ + public static EsignHttpResponse orgOwnSealList(DeptIdentify deptIdentify) throws EsignDemoException { + String orgId=deptIdentify.getOrgId(); + int pageNum=1; + int pageSize=20; + + String apiaddr="/v3/seals/org-own-seal-list?orgId="+orgId+"&pageNum="+pageNum+"&pageSize="+pageSize; + + //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null + String jsonParm=null; + //请求方法 + EsignRequestType requestType= EsignRequestType.GET; + //生成签名鉴权方式的的header + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); + //发起接口请求 + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); + } } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml index 82ce660..47481a3 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml @@ -12,10 +12,11 @@ + - INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account) - VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName}) + INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status) + VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName},#{sealStatus}) delete from case_attach diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml index 7b8ad5c..39cf2ed 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml @@ -14,6 +14,9 @@ + + + @@ -28,7 +31,7 @@ - SELECT d.id ,d.dept_id ,d.user_id, d.identify_status ,d.identify_date ,d.is_use , d.seal_name, sd.dept_name , - u.nick_name ,u.phonenumber + SELECT d.id ,d.dept_id ,d.user_id, d.identify_status ,d.identify_date ,d.is_use , d.seal_name, + d.org_id , d.seal_id ,sd.dept_name , u.nick_name ,u.phonenumber from dept_identify d left join sys_dept sd on d.dept_id = sd.dept_id left join sys_user u on u.user_id = d.user_id @@ -90,6 +93,7 @@ is_use = #{isUse}, identify_status = #{identifyStatus}, seal_name = #{sealName}, + seal_id = #{sealId}, where id = #{id} -- 2.54.0 From 4cf4fa6f5c3e1eb45a565b5eda43ee5c92af6c0c Mon Sep 17 00:00:00 2001 From: hejinbo Date: Fri, 10 Nov 2023 18:08:30 +0800 Subject: [PATCH 4/4] =?UTF-8?q?11.10=20=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeptIdentifyController.java | 47 ++++++- .../common/utils/file/SaaSAPIFileUtils.java | 2 +- .../wisdomarbitrate/domain/CaseAttach.java | 5 +- .../wisdomarbitrate/domain/DeptIdentify.java | 12 ++ .../wisdomarbitrate/domain/vo/SealListVO.java | 27 ++++ .../mapper/CaseAttachMapper.java | 2 + .../mapper/DeptIdentifyMapper.java | 1 + .../service/IDeptIdentifyService.java | 8 ++ .../impl/CaseApplicationServiceImpl.java | 36 ++++- .../service/impl/DeptIdentifyServiceImpl.java | 123 +++++++++++++++++- .../utils/FixSelectFlowDetailUtils.java | 3 +- .../wisdomarbitrate/utils/SignAward.java | 62 +++++---- .../wisdomarbitrate/CaseAttachMapper.xml | 9 ++ .../wisdomarbitrate/DeptIdentifyMapper.xml | 22 +++- 14 files changed, 311 insertions(+), 48 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java index 7b6a619..af52df3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.wisdomarbitrate; +import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -9,6 +10,8 @@ import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.SealSignRecord; +import com.ruoyi.wisdomarbitrate.domain.SmsSendRecord; +import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO; import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; @@ -19,7 +22,7 @@ import java.util.List; @RestController @RequestMapping("/deptIdentify") -public class DeptIdentifyController extends BaseController { +public class DeptIdentifyController extends BaseController { @Autowired private IDeptIdentifyService deptIdentifyService; @@ -52,17 +55,49 @@ public class DeptIdentifyController extends BaseController { /** * 上传自定义公章 + * * @param deptIdentify * @param file * @return */ - @PostMapping("sealUpload") - public AjaxResult sealUpload(@Validated @RequestBody DeptIdentify deptIdentify - ,@RequestParam("file") MultipartFile file){ - return deptIdentifyService.sealUpload(deptIdentify,file); + @PostMapping("/sealUpload") + public AjaxResult sealUpload(@Validated @RequestBody DeptIdentify deptIdentify + , @RequestParam("file") MultipartFile file) { + return deptIdentifyService.sealUpload(deptIdentify, file); } + /** + * 接收E签宝回调通知 + * @param body + * @return + */ + @GetMapping("/notify") + public AjaxResult receiveNotify(String body) { + return deptIdentifyService.receiveNotify(body); + } + /** + * 签章图片列表查询 + * @param deptIdentify + * @return + */ + @GetMapping("/sealList") + public TableDataInfo getSealList(DeptIdentify deptIdentify){ + startPage(); + List list = deptIdentifyService.getSealList(deptIdentify); + return getDataTable(list); + } - + /** + * 印章启用或者禁用 + * @param deptIdentify + * @return + */ + @PostMapping("/updateSealLockStatus") + public AjaxResult updateSealLockStatus(@Validated @RequestBody DeptIdentify deptIdentify){ + if(deptIdentify.getSealId()==null ||deptIdentify.getSealStatus()==null){ + return error("参数校验失败"); + } + return deptIdentifyService.updateSealLockStatus(deptIdentify); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java index 71b52dc..9017df7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java @@ -82,7 +82,7 @@ public class SaaSAPIFileUtils { //生成签名鉴权方式的的header Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,false); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java index c7d7541..05d366e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java @@ -42,9 +42,6 @@ public class CaseAttach { * 用户账户 */ private String userName; - /** - * 印章状态(0未启用,1已启用) - */ - private Integer sealStatus; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java index f117e71..8d4c5b9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java @@ -53,6 +53,10 @@ public class DeptIdentify extends BaseEntity { * 附件id */ private Integer annexId; + /** + * 印章状态 0禁用,1启用 + */ + private Integer sealStatus; public Integer getAnnexId() { return annexId; @@ -168,4 +172,12 @@ public class DeptIdentify extends BaseEntity { public void setIsUse(Integer isUse) { this.isUse = isUse; } + + public Integer getSealStatus() { + return sealStatus; + } + + public void setSealStatus(Integer sealStatus) { + this.sealStatus = sealStatus; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java new file mode 100644 index 0000000..32edfea --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java @@ -0,0 +1,27 @@ +package com.ruoyi.wisdomarbitrate.domain.vo; + +import lombok.Data; + +@Data +public class SealListVO { + /** 印章id */ + private String sealId; + /** 印章名称 */ + private String sealName; + /** + * 印章状态 0禁用,1启用 + */ + private Integer sealStatus; + /** + * 附件id + */ + private Integer annexId; + /** + * 附件路径 + */ + private String annexPath; + /** + * 附件类型,立案申请书(1)、申请人证据材料(2)、仲裁文书(3)、案件视频(4)、身份证件(5)、被申请人证据材料 (6)、庭审笔录(7)、缴费凭证(8)' + */ + private Integer annexType; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java index 5c3fe62..f15d694 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java @@ -23,4 +23,6 @@ public interface CaseAttachMapper { int deleteByFileIds(@Param("ids") List fileIds); List getCaseAttachByCaseIdAndType(CaseAttach caseAttach); + + CaseAttach queryAnnexById(Integer annexId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/DeptIdentifyMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/DeptIdentifyMapper.java index 5261ede..5d93476 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/DeptIdentifyMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/DeptIdentifyMapper.java @@ -19,4 +19,5 @@ public interface DeptIdentifyMapper { int updateDeptIdentify(DeptIdentify deptIdentify); List selectDeptIdentifylistother(DeptIdentify deptIdentify); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java index fac352f..7e99c0d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java @@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.service; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; +import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO; import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -20,4 +21,11 @@ public interface IDeptIdentifyService { AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file); + AjaxResult receiveNotify(String body); + + List getSealList(DeptIdentify deptIdentify); + + AjaxResult updateSealLockStatus(DeptIdentify deptIdentify); + + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 9da0bb7..703f1d0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -106,6 +106,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { private DeptIdentifyMapper deptIdentifyMapper; @Autowired private ReservedConferenceMapper reservedConferenceMapper; + @Autowired + private SysDeptMapper deptMapper; // 手机号正则 private static final Pattern TELEPHONE_REGX = Pattern.compile("^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$"); @@ -1746,7 +1748,25 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } } } - EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord); + DeptIdentify deptIdentify1 = new DeptIdentify(); + deptIdentify1.setSealStatus(1); // 印章状态为启用 + //根据机构名称查询部门id + SysDept sysDept = new SysDept(); + sysDept.setDeptName(sealSignRecord.getOrgnizeName()); + List sysDepts = deptMapper.selectDeptList(sysDept); + if (sysDepts != null && sysDepts.size() > 0) { + Long deptId = sysDepts.get(0).getDeptId(); + deptIdentify1.setDeptId(deptId); + } + List deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify1); + List sealIds = new ArrayList<>(); + if (deptIdentifies != null && deptIdentifies.size() > 0) { + for (DeptIdentify identify : deptIdentifies) { + String sealId = identify.getSealId(); + sealIds.add(sealId); + } + } + EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord,sealIds); JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); if (jsonObject3.getIntValue("code") == 0) { //获取签署流程ID @@ -1881,7 +1901,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { request.setTemplateId("1952136"); for (CaseAffiliate caseAffiliate : caseAffiliates) { request.setPhone(caseAffiliate.getContactTelphone()); - request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo()+caseAffiliate.getUserId()}); + request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo() + caseAffiliate.getUserId()}); // 1952136 普通短信 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请在浏览器打开https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 请知晓,如非本人操作,请忽略本短信。 Boolean aBoolean = SmsUtils.sendSms(request); //保存短信发送记录 @@ -1890,7 +1910,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { smsSendRecord.setCaseNum(caseApplicationselect.getCaseNum()); smsSendRecord.setPhone(request.getPhone()); smsSendRecord.setSendTime(new Date()); - String content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo()+caseAffiliate.getUserId() + ",请在微信内打开https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 请知晓,如非本人操作,请忽略本短信。"; + String content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo() + caseAffiliate.getUserId() + ",请在微信内打开https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 请知晓,如非本人操作,请忽略本短信。"; smsSendRecord.setSendContent(content); String userName; @@ -1909,6 +1929,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } return returnResult; } + @Override public SealSignRecord selectSignUrl(CaseApplication caseApplication) throws EsignDemoException { SealSignRecord sealSignRecord = new SealSignRecord(); @@ -2452,10 +2473,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { /** * 获取userSign,默认过期时间10小时 + * * @param userId * @return */ - public String generateUserSign(String userId){ + public String generateUserSign(String userId) { TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(sdkAppId, secretKey); return tlsSigAPIv2.genUserSig(userId, 60 * 60 * 10); } @@ -2463,6 +2485,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { /** * 预约会议 + * * @param reservedConferenceVO * @return * @throws Exception @@ -2480,7 +2503,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { Integer scheduleEndTime = reservedConferenceVO.getScheduleEndTime(); Random rand = new Random(); int random = rand.nextInt(214748365); - String url="https://roomkit.trtc.tencent-cloud.com/room_api/v1/roomctl/create?usersig=" + userSign + "&identifier=" + administrator + "&sdkappid=" + sdkAppId + "&random=" +random + "&contenttype=json"; + String url = "https://roomkit.trtc.tencent-cloud.com/room_api/v1/roomctl/create?usersig=" + userSign + "&identifier=" + administrator + "&sdkappid=" + sdkAppId + "&random=" + random + "&contenttype=json"; HttpPost post = new HttpPost(url); String result = ""; //添加参数 @@ -2489,7 +2512,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { bodyParams.put("ownerId", reservedConferenceVO.getOwnerId()); bodyParams.put("roomId", reservedConferenceVO.getRoomId()); bodyParams.put("scheduleStartTime", scheduleStartTime); - bodyParams.put("scheduleEndTime",scheduleEndTime); + bodyParams.put("scheduleEndTime", scheduleEndTime); roomParams.put("roomType", 1); bodyParams.put("roomInfo", roomParams); StringEntity postingString = new StringEntity(bodyParams.toString()); @@ -2536,6 +2559,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { /** * 销毁房间回调 + * * @param body * @param request */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java index 710d5a5..47ee8bd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.FileTransformation; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.EsignHttpResponse; import com.ruoyi.common.exception.EsignDemoException; @@ -11,6 +12,7 @@ import com.ruoyi.common.utils.SealUtil; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.wisdomarbitrate.domain.CaseAttach; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; +import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO; import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper; import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper; import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService; @@ -20,9 +22,13 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; +import java.io.File; import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.UUID; @Service public class DeptIdentifyServiceImpl implements IDeptIdentifyService { @@ -123,7 +129,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { EsignHttpResponse response1 = SealUtil.queryAuthProcess(authFlowId); JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); int authorizedStatus = jsonObject1.getJSONObject("data").getIntValue("authorizedStatus"); - if (authorizedStatus == 1){//授权流程状态 0流程过期失效 1已授权 2授权中 3审批未通过 + if (authorizedStatus == 1) {//授权流程状态 0流程过期失效 1已授权 2授权中 3审批未通过 String prefix = "/profile"; int startIndex = fileName.indexOf(prefix); startIndex += prefix.length(); @@ -138,7 +144,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { identify.setIsUse(0); //设置印章使用状态为未启用 //保存到表里 int i = deptIdentifyMapper.updateDeptIdentify(identify); - if (i>0){ + if (i > 0) { return AjaxResult.success("上传成功"); } } @@ -151,8 +157,119 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { } catch (EsignDemoException e) { e.printStackTrace(); } - return AjaxResult.error(); + return AjaxResult.error(); } + @Override + public AjaxResult receiveNotify(String body) { + /* 请求Body数据格式如下: + { + "action":"SEAL_AUDIT", + "auditStatus":1, + "psnId":"c7e00294**41e7", + "rejectReason":"", + "sealBizType":"COMMON", + "sealId":"af80ba0f-xx-xx-xx-a2da292d7f7f", + "sealName":"赵四的图片印章", + "statusDescription":"通过" + }*/ + //解析body数据 + try { + JSONObject jsonObject = JSONObject.parseObject(body); + String action = jsonObject.getString("action"); + if (action.equals("SEAL_AUDIT")) { //SEAL_AUDIT表示图片印章审核结果通知 + String auditStatus = jsonObject.getString("auditStatus"); + if (auditStatus.equals("1")) { //图片印章审核结果 1通过 ,0驳回 + //审核通过,拿到印章id和机构账号ID + String orgId = jsonObject.getString("orgId"); + String sealId = jsonObject.getString("sealId"); + //查询指定印章详情(机构) + EsignHttpResponse response = SignAward.getOrgSeal(orgId, sealId); + JSONObject jsonObject1 = JSONObject.parseObject(response.getBody()); + if (jsonObject1.getIntValue("code") == 0) { //业务码,0表示成功,非0表示异常。 + int sealStatus = jsonObject1.getJSONObject("data").getIntValue("sealStatus"); + if (sealStatus == 1) { //印章状态 1已启用,2待审核,3审核不通过,4 挂起 + String sealImageDownloadUrl = jsonObject1.getString("sealImageDownloadUrl"); + LocalDate now = LocalDate.now(); + String year = Integer.toString(now.getYear()); + String month = String.format("%02d", now.getMonthValue()); + String day = String.format("%02d", now.getDayOfMonth()); + String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; + String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; + String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; + String savePath = "/home/ruoyi/uploadPath/upload/"; + // 创建日期目录 + File saveFolder = new File(saveFolderPath); + if (!saveFolder.exists()) { + saveFolder.mkdirs(); + } + String resultFilePath = saveFolderPath + "/" + fileName; + File resultFilePathFile = new File(resultFilePath); + if (!resultFilePathFile.exists()) { + resultFilePathFile.createNewFile(); + } + boolean downLoadFile = FileTransformation.downLoadFileByUrl(sealImageDownloadUrl, resultFilePath); + if (downLoadFile) { + CaseAttach caseAttach = new CaseAttach(); + caseAttach.setAnnexType(10); //10代表印章图片 + caseAttach.setAnnexPath(savePath); + caseAttach.setAnnexName(saveName); + int i1 = caseAttachMapper.save(caseAttach); + if (i1 > 0) { + //将附件id保存到公章管理表里 + Integer annexId1 = caseAttach.getAnnexId(); + DeptIdentify identify = new DeptIdentify(); + identify.setSealId(sealId); + List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(identify); + if (deptIdentifies != null && deptIdentifies.size() > 0) { + DeptIdentify identify1 = deptIdentifies.get(0); + identify1.setAnnexId(annexId1); + identify1.setSealStatus(1); //启用 + deptIdentifyMapper.updateDeptIdentify(identify1); + } + } + } + } + } + } + } + } catch (EsignDemoException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return new AjaxResult(200, "success"); + } + @Override + public List getSealList(DeptIdentify deptIdentify) { + List deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify); + List sealListVOS = new ArrayList<>(); + if (deptIdentifies != null && deptIdentifies.size() > 0) { + for (DeptIdentify identify : deptIdentifies) { + SealListVO sealListVO = new SealListVO(); + sealListVO.setSealId(identify.getSealId()); + sealListVO.setSealName(identify.getSealName()); + sealListVO.setSealStatus(identify.getSealStatus()); + Integer annexId = identify.getAnnexId(); + //根据附件id查询路径 + CaseAttach caseAttach = caseAttachMapper.queryAnnexById(annexId); + String annexName = caseAttach.getAnnexName(); + String prefix = "/profile"; + int startIndex = annexName.indexOf(prefix); + startIndex += prefix.length(); + String annexPath = "/uploadPath" + annexName.substring(startIndex); + sealListVO.setAnnexPath(annexPath); + sealListVO.setAnnexType(caseAttach.getAnnexType()); + sealListVOS.add(sealListVO); + } + } + return sealListVOS; + } + + @Override + public AjaxResult updateSealLockStatus(DeptIdentify deptIdentify) { + deptIdentifyMapper.updateDeptIdentify(deptIdentify); + return AjaxResult.success(); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java index fdc2e2a..cc01887 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java @@ -216,7 +216,7 @@ public class FixSelectFlowDetailUtils { * * @throws EsignDemoException */ - @Scheduled(cron = "0/30 * * * * ?") + // @Scheduled(cron = "0/30 * * * * ?") @Transactional public void searchForInstitutionalSeal() { try { @@ -263,7 +263,6 @@ public class FixSelectFlowDetailUtils { caseAttach.setAnnexType(10); //10代表印章图片 caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); - caseAttach.setSealStatus(1); //1代表印章启用 int i1 = caseAttachMapper.save(caseAttach); if (i1>0){ //将附件id保存到公章管理表里 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java index 4a8b483..c7b1014 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java @@ -16,6 +16,7 @@ import com.ruoyi.wisdomarbitrate.domain.SealSignRecord; import java.io.File; import java.util.Date; +import java.util.List; import java.util.Map; public class SignAward { @@ -134,9 +135,9 @@ public class SignAward { //请求方法 EsignRequestType requestType = EsignRequestType.GET; //生成签名鉴权方式的的header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); } @@ -146,7 +147,7 @@ public class SignAward { * @return * @throws EsignDemoException */ - public static EsignHttpResponse createByFile(SealSignRecord sealSignRecord) throws EsignDemoException { + public static EsignHttpResponse createByFile(SealSignRecord sealSignRecord, List sealIds) throws EsignDemoException { String apiaddr = "/v3/sign-flow/create-by-file"; String fileId = sealSignRecord.getFileid(); @@ -167,7 +168,6 @@ public class SignAward { double positionXorg = sealSignRecord.getPositionXorg(); double positionYorg = sealSignRecord.getPositionYorg(); - String availableSealId = "209af82b-5f87-4e0a-b0d8-cc4923b6e652"; String jsonParm = "{\n" + " \"docs\": [\n" + @@ -245,7 +245,7 @@ public class SignAward { " \"freeMode\": false,\n" + " \"availableSealIds\": [\n" + - " \"" + availableSealId + "\"\n" + + " \"" + sealIds + "\"\n" + " ],\n" + @@ -268,9 +268,9 @@ public class SignAward { //请求方法 EsignRequestType requestType = EsignRequestType.POST; //生成请求签名鉴权方式的Header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); } /** @@ -296,9 +296,9 @@ public class SignAward { //请求方法 EsignRequestType requestType = EsignRequestType.POST; //生成请求签名鉴权方式的Header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); } /** @@ -327,9 +327,9 @@ public class SignAward { //请求方法 EsignRequestType requestType = EsignRequestType.POST; //生成请求签名鉴权方式的Header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); } /** @@ -368,9 +368,9 @@ public class SignAward { //请求方法 EsignRequestType requestType = EsignRequestType.POST; //生成请求签名鉴权方式的Header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); } /** @@ -383,9 +383,9 @@ public class SignAward { //请求方法 EsignRequestType requestType = EsignRequestType.GET; //生成签名鉴权方式的的header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); } /** @@ -399,9 +399,9 @@ public class SignAward { //请求方法 EsignRequestType requestType = EsignRequestType.GET; //生成签名鉴权方式的的header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); } @@ -423,9 +423,9 @@ public class SignAward { //请求方法 EsignRequestType requestType = EsignRequestType.POST; //生成请求签名鉴权方式的Header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); } /** @@ -470,9 +470,9 @@ public class SignAward { //请求方法 EsignRequestType requestType = EsignRequestType.POST; //生成签名鉴权方式的的header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); } } } @@ -495,8 +495,24 @@ public class SignAward { //请求方法 EsignRequestType requestType= EsignRequestType.GET; //生成签名鉴权方式的的header - Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,false); //发起接口请求 - return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,false); + } + /** + * 查询指定印章详情(机构) + */ + + public static EsignHttpResponse getOrgSeal(String orgId,String sealId) throws EsignDemoException { + String apiaddr="/v3/seals/org-seal-info?orgId="+orgId+"&sealId="+sealId; + + //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null + String jsonParm=null; + //请求方法 + EsignRequestType requestType= EsignRequestType.GET; + //生成签名鉴权方式的的header + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,false); + //发起接口请求 + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,false); } } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml index 47481a3..ad8f264 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml @@ -63,6 +63,15 @@ + update case_attach diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml index 39cf2ed..b6a91d7 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml @@ -17,6 +17,7 @@ + @@ -74,18 +75,25 @@ + update dept_identify @@ -94,8 +102,16 @@ identify_status = #{identifyStatus}, seal_name = #{sealName}, seal_id = #{sealId}, + seal_status = #{sealStatus}, - where id = #{id} + + + AND d.id = #{id} + + + AND seal_id = #{sealId} + + -- 2.54.0