From 74305b57289568cc155f6692f6322d91ba9c0e09 Mon Sep 17 00:00:00 2001 From: hejinbo Date: Thu, 23 Nov 2023 20:15:55 +0800 Subject: [PATCH] xiufu --- .../service/impl/DeptIdentifyServiceImpl.java | 55 +++++----- .../utils/FixSelectFlowDetailUtils.java | 101 ++++++++++++++++++ .../wisdomarbitrate/utils/SignAward.java | 6 +- .../wisdomarbitrate/CaseApplicationMapper.xml | 2 +- .../wisdomarbitrate/DeptIdentifyMapper.xml | 2 + 5 files changed, 138 insertions(+), 28 deletions(-) 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 58b285d..8b29ee2 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 @@ -102,25 +102,28 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { } List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0); - Integer isUse = deptIdentifyselect.getIsUse(); - if (isUse == 0) { //机构为未启用状态 - Integer identifyStatus = deptIdentifyselect.getIdentifyStatus(); - if (identifyStatus == 0) { - return AjaxResult.error("这个认证数据未进行认证,不能启用"); - } else { - deptIdentifyselect.setIsUse(1); - int i = deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect); - if (i > 0) { - return AjaxResult.success("启用成功"); - } - } - } else { //机构为已启用状态 - deptIdentifyselect.setIsUse(0); - int i = deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect); - if (i > 0) { - return AjaxResult.success(); - } + Integer identifyStatus = deptIdentifyselect.getIdentifyStatus(); + if (identifyStatus != 1) { + return AjaxResult.error("这个认证数据未进行认证,不能启用"); } + deptIdentifyselect.setIsUse(1); + int i = deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect); + if (i > 0) { + //把其他认证数据置为未使用 + DeptIdentify deptIdentify2 = new DeptIdentify(); + deptIdentify2.setIsUse(1); + List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify2); + for (DeptIdentify deptIdentify3 : deptIdentifies) { + if (deptIdentify3.equals(deptIdentifyselect)) { + continue; + } + deptIdentify3.setIsUse(0); + deptIdentifyMapper.updateDeptIdentify(deptIdentify3); + } + return AjaxResult.success("启用成功"); + } + + return AjaxResult.error(); } @@ -412,7 +415,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { templateManage.setTemOrigPath(annexPath); String format = getFileExtension(fileName); templateManage.setTemFormat(format); - String subFileName = fileName.substring(fileName.lastIndexOf("/")+1); + String subFileName = fileName.substring(fileName.lastIndexOf("/") + 1); templateManage.setFileName(subFileName); templateManage.setCreateBy(getUsername()); int i = templateManageMapper.insertTemplateManage(templateManage); @@ -441,7 +444,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { startIndex += prefix.length(); String annexPath = "uploadPath" + fileName.substring(startIndex); templateManage.setTemOrigPath(annexPath); - String subFileName = fileName.substring(fileName.lastIndexOf("/")+1); + String subFileName = fileName.substring(fileName.lastIndexOf("/") + 1); templateManage.setFileName(subFileName); String format = getFileExtension(fileName); templateManage.setTemFormat(format); @@ -491,14 +494,14 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { } @Override - public List selectPostUserByDeptId(DeptIdentify deptIdentify) { + public List selectPostUserByDeptId(DeptIdentify deptIdentify) { List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify); - if (deptIdentifies!= null && deptIdentifies.size() > 0) { + if (deptIdentifies != null && deptIdentifies.size() > 0) { deptIdentify = deptIdentifies.get(0); - if (deptIdentify.getDeptId()!= null) { + if (deptIdentify.getDeptId() != null) { //默认查询经办人的 Long roleId = 106L; - List sysUserList = sysUserMapper.selectRoleUserByDeptId(deptIdentify.getDeptId(),roleId); + List sysUserList = sysUserMapper.selectRoleUserByDeptId(deptIdentify.getDeptId(), roleId); return sysUserList; } @@ -508,12 +511,12 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { @Override public AjaxResult bindHandler(DeptIdentify deptIdentify) { - if (deptIdentify.getId()== null||deptIdentify.getUserId()==null) { + if (deptIdentify.getId() == null || deptIdentify.getUserId() == null) { return AjaxResult.error("请检查参数是否完整"); } //根据userid查询用户信息 SysUser sysUser = sysUserMapper.selectUserById(deptIdentify.getUserId()); - if (sysUser!= null) { + if (sysUser != null) { deptIdentify.setOperName(sysUser.getNickName()); deptIdentify.setOperPhone(sysUser.getPhonenumber()); deptIdentify.setOperUserName(sysUser.getUserName()); 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 01bdc19..b532b5e 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 @@ -272,6 +272,107 @@ public class FixSelectFlowDetailUtils { } } + /** + * 定时查询企业认证状态 + * + * @throws Exception + */ + @Scheduled(cron = "*/30 * * * * *") + @Transactional + public void fixExecuteSelectDeptIndentify() throws Exception { + Gson gson = new Gson(); + DeptIdentify deptIdentify = new DeptIdentify(); + deptIdentify.setIdentifyStatus(2); + List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); + if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { + for (int i = 0; i < deptIdentifysnew.size(); i++) { + DeptIdentify deptIdentify1 = deptIdentifysnew.get(i); + String authFlowId = deptIdentify1.getAuthFlowId(); + if (authFlowId != null) { + EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentify1); + JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class); + int code = identifyInfoJsonObject.get("code").getAsInt(); + if (code == 0) { + JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data"); + int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt(); + if (realnameStatus == 1) { + String orgId = identifyInfoData.get("orgId").getAsString(); + //查询企业内部印章 + EsignHttpResponse response = SignAward.deptIdentifySealList(orgId); + JsonObject jsonObject = gson.fromJson(response.getBody(), JsonObject.class); + int code1 = jsonObject.get("code").getAsInt(); + if (code1 == 0) { + JsonObject data = jsonObject.getAsJsonObject("data"); + JsonArray seals = data.get("seals").getAsJsonArray(); + if (seals.size() > 0) { + for (int j = 0; j < seals.size(); j++) { + //保存印章信息到数据库 + JsonObject asJsonObject = seals.get(j).getAsJsonObject(); + SealManage sealManage = new SealManage(); + String sealName = asJsonObject.get("sealName").toString(); + String sealId = asJsonObject.get("sealId").toString(); + String url = asJsonObject.get("sealImageDownloadUrl").toString(); + 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("-", "") + ".jpg"; + 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(); + } + String fileDownloadUrlnew = url.substring(1, url.length() - 1); + boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, 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) { + //将印章信息保存到公章管理表里 + String sealName1 = sealName.substring(1, sealName.length() - 1); + String sealId1 = sealId.substring(1, sealId.length() - 1); + Integer annexId1 = caseAttach.getAnnexId(); + sealManage.setAnnexId(annexId1); + sealManage.setSealId(sealId1); + sealManage.setSealName(sealName1); + sealManage.setIdentifyId(deptIdentify1.getId()); + sealManage.setSealStatus(1); + sealManage.setIsUse(1); + sealManageMapper.insertSealManage(sealManage); + } + } + } + } + + } + //将orgId保存到数据库里 + deptIdentify1.setOrgId(orgId); + deptIdentify1.setIdentifyStatus(1); + deptIdentify1.setIsUse(0); //默认机构为未启用 + int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify1); + } + }else { + deptIdentify1.setIdentifyStatus(2); + deptIdentifyMapper.updateDeptIdentify(deptIdentify1); + } + } + + } + } + } + + /** * 定时查询印章审核状态 */ 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 7305769..9df0cdf 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 @@ -32,6 +32,7 @@ public class SignAward { SealSignRecord sealSignRecord = new SealSignRecord(); + /* 发起签署*/ // EsignHttpResponse createByFile = createByFile(sealSignRecord); // JsonObject createByFileJsonObject = gson.fromJson(createByFile.getBody(), JsonObject.class); @@ -119,7 +120,10 @@ public class SignAward { // } // System.out.println(signFlowDetailJsonObject); - + DeptIdentify deptIdentify = new DeptIdentify(); + deptIdentify.setAuthFlowId("OF-2b4e8f043408003c"); + EsignHttpResponse deptIdentifyInfo = getDeptIdentifyInfo(deptIdentify); + System.out.println(deptIdentifyInfo); } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index b1e7188..02b883e 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -1465,7 +1465,7 @@ where id = #{id} - update case_application set pay_type=#{payDTO.payType} where id in + update case_application set pay_type=#{payType} where id in #{caseId} diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml index 1b735ad..3d5e2c0 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml @@ -114,7 +114,9 @@ legal_per_name = #{legalPerName}, legal_per_phone = #{legalPerPhone}, identify_email = #{identifyEmail}, + user_id = #{userId}, auth_flow_id = #{authFlowId} + -- 2.54.0