diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java index 02b28f9..fdce1cb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java @@ -84,10 +84,15 @@ public class MsVideoConferenceController extends BaseController { caseAttach = MsCaseAttach.builder() .caseAppliId(caseId) .annexName(jsonObject.getString("fileName")) - .annexPath(jsonObject.getString("filePath")) .annexType(annexType) .onlyOfficeFileId(jsonObject.getString("fileId")) .build(); + if(jsonObject.get("filePath")!=null){ + String officePath = jsonObject.getString("filePath"); + String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); + caseAttach.setAnnexPath(replace); + + } msCaseAttachMapper.save(caseAttach); } if(caseAttach==null){ diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index d067800..466e02e 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -120,7 +120,7 @@ token: header: Authorization # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz - # 令牌有效期(默认120分钟) + # 令牌有效期(默认30分钟) expireTime: 120 # MyBatis配置 diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 789e72b..e5d63d1 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -283,6 +283,11 @@ org.apache.httpcomponents httpclient + + org.thymeleaf + thymeleaf + 3.0.12.RELEASE + 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 167abfd..b7e869a 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 @@ -1,20 +1,13 @@ package com.ruoyi.common.utils.file; -import cn.hutool.json.JSONObject; -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import com.ruoyi.common.config.EsignDemoConfig; import com.ruoyi.common.constant.EsignHeaderConstant; -import com.ruoyi.common.constant.FileTransformation; 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.EsignHttpHelper; import com.ruoyi.common.utils.bean.EsignFileBean; -import com.ruoyi.common.utils.uuid.IdUtils; -import java.time.LocalDate; import java.util.Map; public class SaaSAPIFileUtils { @@ -88,43 +81,27 @@ public class SaaSAPIFileUtils { public static void main(String[] args) throws EsignDemoException { - String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\23893bfd3f2249ffa5c82850c11c482e.docx"; - - EsignHttpResponse uploadUrl = getUploadUrl(filePath); - String body = uploadUrl.getBody(); - JSONObject jsonObject = new JSONObject(body); - JSONObject dataObj = jsonObject.getJSONObject("data"); - String fileUploadUrl = dataObj.get("fileUploadUrl").toString(); - System.out.println("这是fileUploadUrl:"+fileUploadUrl); - String fileId = dataObj.get("fileId").toString(); - System.out.println("这是fileId:"+fileId); - //String fileUploadUrl = "https://esignoss.esign.cn/1111564182/ccf6db5a-92da-4523-89ba-385a30423596/23893bfd3f2249ffa5c82850c11c482e.docx?Expires=1697021257&OSSAccessKeyId=STS.NTmgvSC8n5Zg1y7EciQftF23N&Signature=CxVZmpwFksWmLYkxPjVz9K4mVyA%3D&callback-var=eyJ4OmZpbGVfa2V5IjoiJDAyODhjOTg3LWNlNzgtNDM1OC04NWYwLTdlNmUyM2NjOTJmNiQzNDk1NzQ3MjE5In0%3D%0A&callback=eyJjYWxsYmFja1VybCI6Imh0dHA6Ly9zbWx0YXBpLnRzaWduLmNuL2FueWRvb3IvZmlsZS1zeXN0ZW0vY2FsbGJhY2svYWxpb3NzIiwiY2FsbGJhY2tCb2R5IjogIntcIm1pbWVUeXBlXCI6JHttaW1lVHlwZX0sXCJzaXplXCI6ICR7c2l6ZX0sXCJidWNrZXRcIjogJHtidWNrZXR9LFwib2JqZWN0XCI6ICR7b2JqZWN0fSxcImV0YWdcIjogJHtldGFnfSxcImZpbGVfa2V5XCI6JHt4OmZpbGVfa2V5fX0iLCJjYWxsYmFja0JvZHlUeXBlIjogImFwcGxpY2F0aW9uL2pzb24ifQ%3D%3D%0A&security-token=CAIS%2BAF1q6Ft5B2yfSjIr5fYLMznrudPgpiMM1%2BGoWM8XelYqfeYrDz2IHtKdXRvBu8Xs%2F4wnmxX7f4YlqB6T55OSAmcNZEofT7katr4MeT7oMWQweEurv%2FMQBqyaXPS2MvVfJ%2BOLrf0ceusbFbpjzJ6xaCAGxypQ12iN%2B%2Fm6%2FNgdc9FHHPPD1x8CcxROxFppeIDKHLVLozNCBPxhXfKB0ca0WgVy0EHsPnvm5DNs0uH1AKjkbRM9r6ceMb0M5NeW75kSMqw0eBMca7M7TVd8RAi9t0t1%2FIVpGiY4YDAWQYLv0rda7DOltFiMkpla7MmXqlft%2BhzcgeQY0pc%2FRqAAaxcPCSY0Du8wgErfR1llD8t2zeFG%2B1mktU4Rsl7AgxsSFxrwILBUk2x7imVsFVA0kkS8rNBMDKGIsIZTCl5M7S2L%2BD8364htwcZgIZYHK2fCN6gCuy%2Bfk9C%2FfQaTc00IWBMw8OubuJ%2Fq2mdMh32yoi7dLuJyhwt1z%2F%2BWf5vIFHdIAA%3D"; - EsignHttpResponse esignHttpResponse = uploadFile(fileUploadUrl, filePath); - System.out.println("这是上传文件流的结果:"+esignHttpResponse.getBody()); - EsignHttpResponse fileStatus = getFileStatus(fileId); - System.out.println("这是获取文件上传状态的结果:"+fileStatus.getBody()); -// getFileStatus("a808f1f39a744357a2f018e4ab34c55d"); -// fileDownloadUrl(""); + fileDownloadUrl("8425b244bf4b417dbb22fd39a1c2d65f"); -// Gson gson = new Gson(); -// EsignHttpResponse fileDownload = fileDownloadUrl(signFlowId); -// 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); -// String fileDownloadUrl = fileObject.get("downloadUrl").toString(); -// String fileName = java.util.UUID.randomUUID().toString().replace("-", "") + ".pdf"; -// String savePath = "/home/ruoyi/uploadPath/upload"; -// 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 saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; -// String fileDownloadUrlnew = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1); -// FileTransformation.downLoadFileByUrl(fileDownloadUrlnew,dir); -// } + + +// String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\23893bfd3f2249ffa5c82850c11c482e.docx"; +// +// EsignHttpResponse uploadUrl = getUploadUrl(filePath); +// String body = uploadUrl.getBody(); +// JSONObject jsonObject = new JSONObject(body); +// JSONObject dataObj = jsonObject.getJSONObject("data"); +// String fileUploadUrl = dataObj.get("fileUploadUrl").toString(); +// System.out.println("这是fileUploadUrl:"+fileUploadUrl); +// String fileId = dataObj.get("fileId").toString(); +// System.out.println("这是fileId:"+fileId); +// //String fileUploadUrl = "https://esignoss.esign.cn/1111564182/ccf6db5a-92da-4523-89ba-385a30423596/23893bfd3f2249ffa5c82850c11c482e.docx?Expires=1697021257&OSSAccessKeyId=STS.NTmgvSC8n5Zg1y7EciQftF23N&Signature=CxVZmpwFksWmLYkxPjVz9K4mVyA%3D&callback-var=eyJ4OmZpbGVfa2V5IjoiJDAyODhjOTg3LWNlNzgtNDM1OC04NWYwLTdlNmUyM2NjOTJmNiQzNDk1NzQ3MjE5In0%3D%0A&callback=eyJjYWxsYmFja1VybCI6Imh0dHA6Ly9zbWx0YXBpLnRzaWduLmNuL2FueWRvb3IvZmlsZS1zeXN0ZW0vY2FsbGJhY2svYWxpb3NzIiwiY2FsbGJhY2tCb2R5IjogIntcIm1pbWVUeXBlXCI6JHttaW1lVHlwZX0sXCJzaXplXCI6ICR7c2l6ZX0sXCJidWNrZXRcIjogJHtidWNrZXR9LFwib2JqZWN0XCI6ICR7b2JqZWN0fSxcImV0YWdcIjogJHtldGFnfSxcImZpbGVfa2V5XCI6JHt4OmZpbGVfa2V5fX0iLCJjYWxsYmFja0JvZHlUeXBlIjogImFwcGxpY2F0aW9uL2pzb24ifQ%3D%3D%0A&security-token=CAIS%2BAF1q6Ft5B2yfSjIr5fYLMznrudPgpiMM1%2BGoWM8XelYqfeYrDz2IHtKdXRvBu8Xs%2F4wnmxX7f4YlqB6T55OSAmcNZEofT7katr4MeT7oMWQweEurv%2FMQBqyaXPS2MvVfJ%2BOLrf0ceusbFbpjzJ6xaCAGxypQ12iN%2B%2Fm6%2FNgdc9FHHPPD1x8CcxROxFppeIDKHLVLozNCBPxhXfKB0ca0WgVy0EHsPnvm5DNs0uH1AKjkbRM9r6ceMb0M5NeW75kSMqw0eBMca7M7TVd8RAi9t0t1%2FIVpGiY4YDAWQYLv0rda7DOltFiMkpla7MmXqlft%2BhzcgeQY0pc%2FRqAAaxcPCSY0Du8wgErfR1llD8t2zeFG%2B1mktU4Rsl7AgxsSFxrwILBUk2x7imVsFVA0kkS8rNBMDKGIsIZTCl5M7S2L%2BD8364htwcZgIZYHK2fCN6gCuy%2Bfk9C%2FfQaTc00IWBMw8OubuJ%2Fq2mdMh32yoi7dLuJyhwt1z%2F%2BWf5vIFHdIAA%3D"; +// EsignHttpResponse esignHttpResponse = uploadFile(fileUploadUrl, filePath); +// System.out.println("这是上传文件流的结果:"+esignHttpResponse.getBody()); +// EsignHttpResponse fileStatus = getFileStatus(fileId); +// System.out.println("这是获取文件上传状态的结果:"+fileStatus.getBody()); + diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java index a1a44fb..296faae 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java @@ -324,6 +324,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { if (identifyName == null) { AjaxResult.error("请检查参数是否完整"); } + // 查询是否存在机构 + SysDept sysDept = sysDeptMapper.selectDeptByName(identifyName); Integer identifyType = deptIdentify.getIdentifyType(); if (identifyType == null) { deptIdentify.setIdentifyType(1); // 设置机构默认为仲裁机构 @@ -331,11 +333,19 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { deptIdentify.setIdentifyStatus(0); //设置认证状态默认为未认证 deptIdentify.setIsUse(0); //设置机构默认为未启用 //将机构名称保存到部门表里 - SysDept sysDept = new SysDept(); - sysDept.setDeptName(identifyName); - sysDept.setParentId(0L); - sysDept.setDeptType(1); - int i1 = sysDeptMapper.insertDept(sysDept); + int i1=0; + if(sysDept == null) { + sysDept = new SysDept(); + sysDept.setParentId(0L); + sysDept.setDeptName(identifyName); + sysDept.setDeptType(1); + i1 = sysDeptMapper.insertDept(sysDept); + } + else { + sysDept.setDeptType(1); + sysDeptMapper.updateDept(sysDept); + } + if (i1 > 0) { /* //将经办人信息存入到用户表里 Long deptId = sysDept.getDeptId(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index c424b0f..bbe159a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -2132,6 +2132,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msCaseApplicationMapper.updateByPrimaryKeySelective(application); // 根据案件id查询案件 MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId()); + if (caseApplication == null) { + throw new ServiceException("未找到案件"); + } caseApplication.setHearDate(application.getHearDate()); ExecutorService executor = ThreadUtil.createThreadPool(); CompletableFuture.runAsync(() -> { @@ -2141,15 +2144,27 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 申请人发送开庭日期短信 sendHearDateSms(caseApplication, affiliates); + // 调解员发送开庭短信 + sendMeditorHearDateSms(caseApplication,vo); - - } + } }, executor); - // 调解员发送短信,根据调解员id查询用户 - CompletableFuture.runAsync(() -> { if (caseApplication.getMediatorId() != null) { + + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + + } + + /** + * 调解员发送开庭短信 + * @param caseApplication + * @param vo + */ + private void sendMeditorHearDateSms(MsCaseApplication caseApplication, BookingVO vo) { + if (caseApplication.getMediatorId() != null && CollectionUtil.isNotEmpty(vo.getHerDates()) && StrUtil.isNotEmpty(caseApplication.getHearDate())) { // 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId()); - String content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为" + application.getHearDate() + ",请知晓,如非本人操作,请忽略本短信。"; + String content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为" + caseApplication.getHearDate() + ",请知晓,如非本人操作,请忽略本短信。"; String templateId = "2077966"; String subject = "开庭日期通知"; MsCaseAffiliate meditorAffliate = new MsCaseAffiliate(); @@ -2163,17 +2178,17 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); // 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信. - content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + application.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" +"authId="+ roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信."; + content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + caseApplication.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" +"authId="+ roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信."; templateId = "2130103"; } // 电话号不为空,发送短信,否则发邮箱 if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { if (roomUuid == null) { SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(), - new String[]{caseApplication.getCaseNum(), application.getHearDate()}); + new String[]{caseApplication.getCaseNum(), caseApplication.getHearDate()}); } else { SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(), - new String[]{caseApplication.getCaseNum(), application.getHearDate(), "authId="+roomUuid}); + new String[]{caseApplication.getCaseNum(), caseApplication.getHearDate(), "authId="+roomUuid}); } @@ -2182,11 +2197,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content); } - } }, executor); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + } } + /** * 发送开庭日期短信 * @param application @@ -2386,6 +2400,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { public AjaxResult saveOnlyOfficeFile(MsCaseAttach caseAttach) { if(StrUtil.isEmpty(caseAttach.getAnnexName())) { caseAttach.setAnnexName("调解书"); + } + if(StrUtil.isNotEmpty(caseAttach.getAnnexPath())) { + String replace = caseAttach.getAnnexPath().replace("/home/ruoyi/uploadPath", "/profile"); + caseAttach.setAnnexPath(replace); } caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); caseAttach.setUseId(getUserInfo().getUserId()); @@ -2483,8 +2501,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { for (MsCaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { String annexPath = caseAttach.getAnnexPath(); - if (annexPath.contains("/profile/upload")) { - annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); + if (annexPath.contains("/profile")) { + annexPath = annexPath.replace("/profile", "/home/ruoyi/uploadPath"); } String path = annexPath; //获取文件上传地址 @@ -2829,8 +2847,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { for (MsCaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { String annexPath = caseAttach.getAnnexPath(); - if (annexPath.contains("/profile/upload")) { - annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); + if (annexPath.contains("/profile")) { + annexPath = annexPath.replace("/profile", "/home/ruoyi/uploadPath"); } String path = annexPath; //获取文件上传地址 @@ -2959,7 +2977,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { SmsUtils.sendSms(application, "2047719",resAffiliateOpt.get().getPhone(), new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); } else { - throw new ServiceException(jsonObject3.getString("message")); + return AjaxResult.error(jsonObject3.getString("message")); } } else { return AjaxResult.error(); @@ -3019,14 +3037,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { List msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) { for (MsCaseAttach msCaseAttach : msCaseAttaches) { - String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath(); - File file = new File(templatePath.replace("/profile", "/uploadPath")); + if (StrUtil.isEmpty(msCaseAttach.getAnnexPath())) { + continue; + } + + String replacePath = msCaseAttach.getAnnexPath().replace("/profile/", "/home/ruoyi/uploadPath/"); + File file = new File(replacePath); MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); // 更新附件表 if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId()); msCaseAttachMapper.updateCaseAttach(msCaseAttach); } + + } } // 修改案件状态为待送达 @@ -3398,12 +3422,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseAttach= MsCaseAttach.builder() .caseAppliId(application.getId()) .annexName(jsonObject.getString("fileName")) - .annexPath(jsonObject.getString("filePath")) .annexType(annexType) .onlyOfficeFileId(jsonObject.getString("fileId")) .build(); + if(jsonObject.get("filePath")!=null){ + String officePath = jsonObject.getString("filePath"); + String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); + caseAttach.setAnnexPath(replace); + + } + } + //保存到附件表里,先删除之前的在保存 msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType); msCaseAttachMapper.save(caseAttach); @@ -3430,16 +3461,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType); if(StrUtil.isEmpty(application.getCaseSource())) { // 北明推送 - String path = "/home/ruoyi" + caseAttach.getAnnexPath(); - File file = new File(path.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_APPLY_BOOK); + if (StrUtil.isNotEmpty(caseAttach.getAnnexPath())) { + String replacePath = caseAttach.getAnnexPath().replace("/profile/", "/home/ruoyi/uploadPath/"); + File file = new File(replacePath); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_APPLY_BOOK); - // 更新附件表 - if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { - caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + // 更新附件表 + if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + } } - } - msCaseAttachMapper.save(caseAttach); + msCaseAttachMapper.save(caseAttach); + } + + } } @@ -3451,7 +3486,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Override @Transactional public JSONArray uploadOnlyOffice(String annexPath,Long caseId) { - annexPath=annexPath.replace("/profile","/home/ruoyi/uploadPath"); + annexPath=annexPath.replace("/profile/","/home/ruoyi/uploadPath/"); File file = new File(annexPath); if (file.exists()) { // 调用onlyoffice diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 41a432a..549f36b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -59,6 +59,7 @@ import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.wisdomarbitrate.utils.SignAward; import com.ruoyi.wisdomarbitrate.utils.SmsUtils; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -76,7 +77,7 @@ import java.util.concurrent.ExecutorService; import java.util.stream.Collectors; import static com.ruoyi.common.core.domain.AjaxResult.success; - +@Slf4j @Service public class MsSignSealServiceImpl implements MsSignSealService { @@ -706,6 +707,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { JSONObject jsonObjectCallback = JSONObject.parseObject(reqbodystr); Gson gson = new Gson(); if (jsonObjectCallback != null) { + log.info("签名回调======"+jsonObjectCallback); int signResult = jsonObjectCallback.getIntValue("signResult"); String action = jsonObjectCallback.getString("action"); String signFlowId = jsonObjectCallback.getString("signFlowId"); @@ -857,11 +859,15 @@ public class MsSignSealServiceImpl implements MsSignSealService { //修改"签署用印记录表"的状态为待用印 if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { sealSignRecordsel.setSignFlowStatus(2); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); }else { // 否则为已完成 sealSignRecordsel.setSignFlowStatus(3); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + // 下载调解书 + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); } - sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + } }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc) && caseApplicationselect.getSealFlag()!=null && caseApplicationselect.getSealFlag()==1 ){ //需要用印 @@ -915,71 +921,72 @@ public class MsSignSealServiceImpl implements MsSignSealService { sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); //下载审核完成的调解书 - EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); - 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); - String fileDownloadUrl = fileObject.get("downloadUrl").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("-", "") + ".pdf"; - String saveName = fileName; - String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; - - // 创建日期目录 - 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 = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); - boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); - if (downLoadFile) { - // 先删除已经存在的调解书 - if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ - List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if(CollectionUtil.isNotEmpty(existAttach)){ - // 对接北明,同步案件状态,删除 - for (MsCaseAttach msCaseAttach : existAttach) { - if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ - continue; - } - beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); - } - } - } - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - MsCaseAttach caseAttach = new MsCaseAttach(); - caseAttach.setCaseAppliId(caseAppliId); - caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); - caseAttachMapper.save(caseAttach); - // 对接北明,调用上传附件接口 - if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { - String templatePath = "/home/ruoyi" + savePath; - File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); - // 更新附件表 - if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ - caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); - msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); - } - - } - } - - } + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); +// EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); +// 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); +// String fileDownloadUrl = fileObject.get("downloadUrl").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("-", "") + ".pdf"; +// String saveName = fileName; +// String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; +// +// // 创建日期目录 +// 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 = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); +// boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); +// if (downLoadFile) { +// // 先删除已经存在的调解书 +// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ +// List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); +// if(CollectionUtil.isNotEmpty(existAttach)){ +// // 对接北明,同步案件状态,删除 +// for (MsCaseAttach msCaseAttach : existAttach) { +// if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ +// continue; +// } +// beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); +// } +// } +// } +// msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); +// MsCaseAttach caseAttach = new MsCaseAttach(); +// caseAttach.setCaseAppliId(caseAppliId); +// caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); +// caseAttach.setAnnexPath(savePath); +// caseAttach.setAnnexName(saveName); +// caseAttachMapper.save(caseAttach); +// // 对接北明,调用上传附件接口 +// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { +// String templatePath = "/home/ruoyi" + savePath; +// File file = new File(templatePath.replace("/profile", "/uploadPath")); +// MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); +// // 更新附件表 +// if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ +// caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); +// msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); +// } +// +// } +// } +// +// } } }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){ //被申请人签名 @@ -1005,71 +1012,72 @@ public class MsSignSealServiceImpl implements MsSignSealService { sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); //下载审核完成的调解书 - EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); - 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); - String fileDownloadUrl = fileObject.get("downloadUrl").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("-", "") + ".pdf"; - String saveName = fileName; - String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; - - // 创建日期目录 - 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 = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); - boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); - if (downLoadFile) { - // 先删除已经存在的调解书 - if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ - List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if(CollectionUtil.isNotEmpty(existAttach)){ - // 对接北明,同步案件状态,删除 - for (MsCaseAttach msCaseAttach : existAttach) { - if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ - continue; - } - beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); - } - } - } - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - MsCaseAttach caseAttach = new MsCaseAttach(); - caseAttach.setCaseAppliId(caseAppliId); - caseAttach.setAnnexType(7); - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); - - // 对接北明,调用上传附件接口 - - if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { - String templatePath = "/home/ruoyi" + savePath; - File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); - // 更新附件表 - if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ - caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); - } - } - caseAttachMapper.save(caseAttach); - } - - } + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); +// EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); +// 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); +// String fileDownloadUrl = fileObject.get("downloadUrl").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("-", "") + ".pdf"; +// String saveName = fileName; +// String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; +// +// // 创建日期目录 +// 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 = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); +// boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); +// if (downLoadFile) { +// // 先删除已经存在的调解书 +// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ +// List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); +// if(CollectionUtil.isNotEmpty(existAttach)){ +// // 对接北明,同步案件状态,删除 +// for (MsCaseAttach msCaseAttach : existAttach) { +// if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ +// continue; +// } +// beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); +// } +// } +// } +// msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); +// MsCaseAttach caseAttach = new MsCaseAttach(); +// caseAttach.setCaseAppliId(caseAppliId); +// caseAttach.setAnnexType(7); +// caseAttach.setAnnexPath(savePath); +// caseAttach.setAnnexName(saveName); +// +// // 对接北明,调用上传附件接口 +// +// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { +// String templatePath = "/home/ruoyi" + savePath; +// File file = new File(templatePath.replace("/profile", "/uploadPath")); +// MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); +// // 更新附件表 +// if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ +// caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); +// } +// } +// caseAttachMapper.save(caseAttach); +// } +// +// } } } } @@ -1082,10 +1090,13 @@ public class MsSignSealServiceImpl implements MsSignSealService { } private void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId) throws EsignDemoException, IOException { + log.info("signFlowId===="+signFlowId); EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); + log.info("下载成功===="+fileDownload); JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); + log.info("下载调解书pdf===="+filesArray); if (filesArray != null && filesArray.size() > 0) { JsonObject fileObject = (JsonObject) filesArray.get(0); String fileDownloadUrl = fileObject.get("downloadUrl").toString(); @@ -1111,6 +1122,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); + log.info("是否下载成功======="+downLoadFile); if (downLoadFile) { // 先删除已经存在的调解书 if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ @@ -1126,11 +1138,13 @@ public class MsSignSealServiceImpl implements MsSignSealService { } } msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); + MsCaseAttach caseAttach = new MsCaseAttach(); caseAttach.setCaseAppliId(caseAppliId); caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); + log.info("调解书保存======="+downLoadFile); caseAttachMapper.save(caseAttach); // 对接北明,调用上传附件接口 if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml index ff0f35a..fad5ed2 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml @@ -113,7 +113,7 @@