From 374841e417f27be4ff907d23c00b4c531c0ee635 Mon Sep 17 00:00:00 2001 From: wangqiong <1322446236@qq.com> Date: Sun, 28 Apr 2024 18:36:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=80=81=E8=BE=BE=E7=AD=BE?= =?UTF-8?q?=E6=94=B6=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/CaseApplication.java | 5 +- .../service/impl/AdjudicationServiceImpl.java | 233 ++++++++---------- .../service/impl/DownFileService.java | 76 ++++++ 3 files changed, 187 insertions(+), 127 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DownFileService.java diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java index 14b2cf6..ba506ac 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java @@ -227,7 +227,10 @@ public class CaseApplication extends BaseEntity { private List caseStatusList; private List annexTypeList; - + /** + * 立案申请书(1)、申请人证据材料(2)、仲裁文书(3)、案件视频(4)、身份证件(5) + * 被申请人证据材料 (6)、庭审笔录(7)、缴费凭证(8)、视频录制(9)、公章图片(10)、语音转录文件(11) + */ private Integer annexType; /** * 案件附件列表 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 b7bf1ed..2dd4e37 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 @@ -10,64 +10,55 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.constant.FileTransformation; -import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.EsignHttpResponse; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.*; +import com.ruoyi.common.utils.EmailOutUtil; +import com.ruoyi.common.utils.ObjectFieldUtils; +import com.ruoyi.common.utils.SmsUtils; +import com.ruoyi.common.utils.WordUtil; import com.ruoyi.common.utils.file.SaaSAPIFileUtils; import com.ruoyi.common.utils.thread.MultipleThreadListParam; -import com.ruoyi.common.utils.thread.MultipleThreadWorkUtil; import com.ruoyi.system.mapper.SysDictDataMapper; import com.ruoyi.wisdomarbitrate.StringIdsReq; -import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO; -import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; -import com.ruoyi.wisdomarbitrate.mapper.*; -import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.wisdomarbitrate.domain.*; import com.ruoyi.wisdomarbitrate.domain.vo.ArchivesDetailVO; +import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO; +import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO; +import com.ruoyi.wisdomarbitrate.mapper.*; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; import com.ruoyi.wisdomarbitrate.service.ICaseLogRecordService; +import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.wisdomarbitrate.utils.SignAward; import lombok.extern.slf4j.Slf4j; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; -import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBookmark; -import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.MailSendException; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; import java.io.*; -import java.math.BigDecimal; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; -import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.util.*; -import java.util.concurrent.CountDownLatch; import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; -import static com.ruoyi.common.utils.PageUtils.startPage; import static com.ruoyi.common.utils.SecurityUtils.getUsername; @Service @@ -110,15 +101,11 @@ public class AdjudicationServiceImpl implements IAdjudicationService { // 仲裁反请求模板内容 - private final String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" + - "《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" + - "仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。"; + private final String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" + "《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" + "仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。"; // 财产保全内容 - String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" + - "第二十八条之规定,将该申请提交至法院。"; + String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" + "第二十八条之规定,将该申请提交至法院。"; // 管辖权异议 - String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《管辖异议申请书》,认为" + - ",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。"; + String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《管辖异议申请书》,认为" + ",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。"; // 线上开庭时+线上仲裁 String onLineDate = "{{onLineDate}}"; String onLine = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于" + onLineDate + "通过仲裁委智慧仲裁平台开庭审理了本案。"; @@ -129,10 +116,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { String writtenDate = "{{writtenDate}}"; String written = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于" + writtenDate + "在仲裁委所在地开庭审理了本案。仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,根据《2022年版仲裁规则》第五十八条的规定对本案进行了书面审理。 "; //开庭+缺席审理 - String absent = "申请人的特别授权委托代理人{{agentName}}" + "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" + - "《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明,\" +\n" + - " \"发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。" + "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + - "第四十条第(二)项、第五十一条的规定,缺席裁决如下:"; + String absent = "申请人的特别授权委托代理人{{agentName}}" + "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" + "《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明,\" +\n" + " \"发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。" + "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + "第四十条第(二)项、第五十一条的规定,缺席裁决如下:"; // 开庭+出席 String attend = "申请人的特别授权委托代理人{{agentName}}和被申请人本人出席了庭审。 "; // 开庭+出席+被申提供证据 @@ -140,14 +124,11 @@ public class AdjudicationServiceImpl implements IAdjudicationService { // 开庭+出席+被申未提供证据 String onLineAttend = "庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;申请人出示了证据材料,被申请人对对方的证据材料进行了质证; 双方当事人均回答了仲裁庭的提问,进行了辩论,并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。 "; // 被申请人出席答辩意见 - String resAttendOpinion = "\n(二)被申请人的答辩意见 \n(三)当事人提供的证据材料及对方的质证意见\n" + - "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:\n{{applicantFile}}\n被申请人对上述材料的质证意见为:{{respondentOpinion}}\n"; + String resAttendOpinion = "\n(二)被申请人的答辩意见 \n(三)当事人提供的证据材料及对方的质证意见\n" + "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:\n{{applicantFile}}\n被申请人对上述材料的质证意见为:{{respondentOpinion}}\n"; // 被申请人出席+被申请人提供了资料 - String resFile = "被申请人向仲裁庭提交了如下证据材料:\n{{resFile}}" + - "申请人对上述材料的质证意见为:{{applicantOpinion}}"; + String resFile = "被申请人向仲裁庭提交了如下证据材料:\n{{resFile}}" + "申请人对上述材料的质证意见为:{{applicantOpinion}}"; // 被申请人缺席 - String resAbsent = "(二)当事人提供的证据材料\n" + - "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:\n{{applicantFile}}"; + String resAbsent = "(二)当事人提供的证据材料\n" + "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:\n{{applicantFile}}"; // 日期格式化年月日 SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); @@ -528,9 +509,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { default: break; } - } else if (dictData.getDictLabel().contains("申请人") || dictData.getDictLabel().contains("统一社会信用代码") - || dictData.getDictLabel().contains("法定代表人") || dictData.getDictLabel().contains("法定代表人职位") - || dictData.getDictLabel().contains("代理人")) { + } else if (dictData.getDictLabel().contains("申请人") || dictData.getDictLabel().contains("统一社会信用代码") || dictData.getDictLabel().contains("法定代表人") || dictData.getDictLabel().contains("法定代表人职位") || dictData.getDictLabel().contains("代理人")) { CaseAffiliate affiliate = affiliateMap.get(1); if (affiliate == null) { continue; @@ -588,12 +567,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { * @param arbitrateRecordSelect 出裁决书生成记录 */ private void saveArbitorFile(Long id, String saveName, String savePath, CaseApplication caseApplicationById, ArbitrateRecord arbitrateRecordSelect) { - CaseAttach caseAttach = CaseAttach.builder() - .caseAppliId(id) - .annexName(saveName) - .annexPath(savePath) - .annexType(3) - .build(); + CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id).annexName(saveName).annexPath(savePath).annexType(3).build(); //保存到附件表里,先判断之前有没有,有的话更新,没有的话新增 List caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach); if (caseAttachList != null && caseAttachList.size() > 0) { @@ -614,7 +588,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { //修改案件状态 caseApplicationById.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION); Integer arbitratMethod = caseApplicationById.getArbitratMethod(); - if(arbitratMethod==1){ + if (arbitratMethod == 1) { caseApplicationById.setLockStatus(1); } caseApplicationMapper.submitCaseApplication(caseApplicationById); @@ -657,12 +631,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService { //电子邮件送达 JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender(); if (appEmail != null) { - emailOutUtil.sendMessageCarryFile(appEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file - , "hjbjava@163.com", javaMailSender); + emailOutUtil.sendMessageCarryFile(appEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file, "hjbjava@163.com", javaMailSender); } if (resEmail != null) { - emailOutUtil.sendMessageCarryFile(resEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file - , "hjbjava@163.com", javaMailSender); + emailOutUtil.sendMessageCarryFile(resEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file, "hjbjava@163.com", javaMailSender); } //修改案件状态 @@ -709,10 +681,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { String trackNum = affiliate.getTrackNum(); if (trackNum != null) { // 构造查询字符串参数 - String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d", - URLEncoder.encode(key, "UTF-8"), - URLEncoder.encode(com, "UTF-8"), - URLEncoder.encode(trackNum, "UTF-8"), null); + String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d", URLEncoder.encode(key, "UTF-8"), URLEncoder.encode(com, "UTF-8"), URLEncoder.encode(trackNum, "UTF-8"), null); // 拼接到API URL中 String fullUrl = apiUrl + "?" + queryParameters; URL url = new URL(fullUrl); @@ -782,6 +751,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { return AjaxResult.success("归档成功,案件状态已改为已归档"); } + @Autowired + DownFileService downFileService; + @Override @Transactional public AjaxResult service(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum) { @@ -800,11 +772,42 @@ public class AdjudicationServiceImpl implements IAdjudicationService { int startIndex = prefix.length(); String path = caseAttach.getAnnexPath() + annexName.substring(startIndex); File file = new File(path); - // todo 部署放开 + //判断文件是否存在 if (!file.exists()) { - return AjaxResult.error("未生成裁决书"); +// return AjaxResult.error("未生成裁决书"); + //若不存在则从e签宝下载PDF文件 + try { + SealSignRecord sealSignRecord = new SealSignRecord(); + sealSignRecord.setCaseAppliId(caseApplication.getId()); + //3为"签署用印记录表"的状态为签署完成 + sealSignRecord.setSignFlowStatus(3); + List sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecord); + if (sealSignRecords != null && sealSignRecords.size() > 0) { + SealSignRecord sealSignRecord1 = sealSignRecords.get(0); + downFileService.downPdfFileFormEsign(sealSignRecord1.getSignFlowid(), caseAttach.getCaseAppliId()); + //下载成功后重新查询 + List caseAttachList1 = caseAttachMapper.queryCaseAttachList(caseApplication1); + for (CaseAttach caseAttach1 : caseAttachList1) { + if (caseAttach1.getAnnexType() == 3) { + annexName = caseAttach.getAnnexName(); + prefix = "/profile/upload/"; + startIndex = prefix.length(); + path = caseAttach.getAnnexPath() + annexName.substring(startIndex); + File file1 = new File(path); + if (!file1.exists()) { + return AjaxResult.error("未生成裁决书"); + } + caseAttachList = caseAttachList1; + break; + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } } - + //找到签署后的PDF文件后调出该循环 + break; } } } @@ -857,33 +860,33 @@ public class AdjudicationServiceImpl implements IAdjudicationService { sendMailRecord1.setCreateBy(getUsername()); if (resEmailFlag) { sendMailRecord1.setSendStatus(1); - }else { + } else { sendMailRecord1.setSendStatus(0); } sendMailRecordMapper.saveSendMailRecord(sendMailRecord1); - if(!appEmailFlag&&!resEmailFlag){ + if (!appEmailFlag && !resEmailFlag) { throw new ServiceException("裁决书发送失败"); } - if(!appEmailFlag){ + if (!appEmailFlag) { throw new ServiceException("申请人裁决书发送失败"); } - if(!resEmailFlag){ + if (!resEmailFlag) { throw new ServiceException("被申请人裁决书发送失败"); } // 发送短信 - if (appEmailFlag||resEmailFlag) { + if (appEmailFlag || resEmailFlag) { if (CollectionUtil.isNotEmpty(caseAffiliates)) { SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); request.setTemplateId("1990362"); for (CaseAffiliate affiliate : caseAffiliates) { - String telphone=null; - if(appEmailFlag&&affiliate.getIdentityType()==1){ - telphone = affiliate.getContactTelphone(); - }else if(resEmailFlag&&affiliate.getIdentityType()==2){ - telphone = affiliate.getContactTelphone(); + String telphone = null; + if (appEmailFlag && affiliate.getIdentityType() == 1) { + telphone = affiliate.getContactTelphone(); + } else if (resEmailFlag && affiliate.getIdentityType() == 2) { + telphone = affiliate.getContactTelphone(); } - if(StrUtil.isEmpty(telphone)){ + if (StrUtil.isEmpty(telphone)) { continue; } @@ -966,9 +969,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { // Boolean aBoolean = emailOutUtil.sendEmil(email, "您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅", appUid +"裁决书", fileList, null); // // Thread.sleep(20); // 收到退信的所有id,即发送失败的uuid - // emailOutUtil.receiverMail(); - // Thread.sleep(3); - // List messageIds = emailOutUtil.receiverMail(); + // emailOutUtil.receiverMail(); + // Thread.sleep(3); + // List messageIds = emailOutUtil.receiverMail(); // if (aBoolean&&(CollectionUtil.isEmpty(messageIds)||!messageIds.contains(appUid))) { // return Boolean.TRUE; // } @@ -1085,9 +1088,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { datas.put("acceptDate", registerDateStr); //反请求 Integer adjudicaCounter = caseApplication1.getAdjudicaCounter(); - String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" + - "《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" + - "仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。"; + String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" + "《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" + "仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。"; if (adjudicaCounter == null) { datas.put("counterclaim", null); } else if (adjudicaCounter == 1) { @@ -1097,8 +1098,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } //财产保全 Integer properPreser = caseApplication1.getProperPreser(); - String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" + - "第二十八条之规定,将该申请提交至法院。"; + String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" + "第二十八条之规定,将该申请提交至法院。"; if (properPreser == null) { datas.put("preservation", null); } else if (properPreser == 1) { @@ -1108,8 +1108,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } //管辖权异议 Integer objectiJuris = caseApplication1.getObjectiJuris(); - String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《管辖异议申请书》,认为" + - ",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。"; + String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《管辖异议申请书》,认为" + ",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。"; if (objectiJuris == null) { datas.put("jurisdictionalObjection", null); } else if (objectiJuris == 1) { @@ -1160,14 +1159,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } else if (isAbsence == 1) { //缺席审理 String absent1 = "申请人的特别授权委托代理人"; - String absent2 = "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" + - "《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。"; - String absent3 = "庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明," + - "发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。"; - String absent4 = "(二/三)当事人提供的证据材料\n" + - "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:"; - String absent5 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + - "第四十条第(二)项、第五十一条的规定,缺席裁决如下:"; + String absent2 = "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" + "《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。"; + String absent3 = "庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明," + "发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。"; + String absent4 = "(二/三)当事人提供的证据材料\n" + "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:"; + String absent5 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + "第四十条第(二)项、第五十一条的规定,缺席裁决如下:"; datas.put("absent1", absent1); datas.put("absent2", absent2); datas.put("absent3", absent3); @@ -1179,13 +1174,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { String attend1 = "申请人的特别授权委托代理人"; String attend2 = "和被申请人本人/的特别授权委托代理人"; String attend3 = "出席了庭审。"; - String attend4 = "庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;" + - "双方当事人均出示了证据材料并对对方的证据材料进行了质证;申请人出示了证据材料," + - "被申请人对对方的证据材料进行了质证;双方当事人均回答了仲裁庭的提问,进行了辩论," + - "并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。"; + String attend4 = "庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;" + "双方当事人均出示了证据材料并对对方的证据材料进行了质证;申请人出示了证据材料," + "被申请人对对方的证据材料进行了质证;双方当事人均回答了仲裁庭的提问,进行了辩论," + "并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。"; String attend5 = "(二)被申请人的答辩意见"; - String attend6 = "(二/三)当事人提供的证据材料及对方的质证意见\n" + - "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:"; + String attend6 = "(二/三)当事人提供的证据材料及对方的质证意见\n" + "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:"; String attend7 = "被申请人对上述材料的质证意见为:"; datas.put("attend1", attend1); datas.put("attend2", attend2); @@ -1199,13 +1190,11 @@ public class AdjudicationServiceImpl implements IAdjudicationService { datas.put("resAgentName", nameAgentList.get(1)); if (arbitratMethod == 1) { //被申出席+开庭 - String attend8 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + - "第五十一条的规定,裁决如下:"; + String attend8 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + "第五十一条的规定,裁决如下:"; datas.put("attend8", attend8); } else { //被申出席+书面 - String attend9 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + - "第五十一条、第五十八条的规定,裁决如下:"; + String attend9 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + "第五十一条、第五十八条的规定,裁决如下:"; datas.put("attend9", attend9); } } @@ -1221,8 +1210,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { if (isImageFile) { String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath(); System.out.println("路径是===========" + annexPath); - PictureRenderData pictureRenderData = WordUtil - .rebuildImageContent(100, 100, null, annexPath); + PictureRenderData pictureRenderData = WordUtil.rebuildImageContent(100, 100, null, annexPath); datas.put("resEvidenceMaterial", pictureRenderData); } } else if (caseAttach.getAnnexType() == 2) { //申请人证据材料 @@ -1231,8 +1219,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { if (isImageFile) { String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath(); System.out.println("路径是===========" + annexPath); - PictureRenderData pictureRenderData = WordUtil - .rebuildImageContent(100, 100, null, annexPath); + PictureRenderData pictureRenderData = WordUtil.rebuildImageContent(100, 100, null, annexPath); //申请人证据材料 datas.put("appEvidenceMaterial", pictureRenderData); } @@ -1270,12 +1257,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { //将裁决书更新到附件表里 - CaseAttach caseAttach = CaseAttach.builder() - .caseAppliId(id) - .annexName(saveName) - .annexPath(savePath) - .annexType(3) - .build(); + CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id).annexName(saveName).annexPath(savePath).annexType(3).build(); int i = caseAttachMapper.updateCaseAttachBycaseid(caseAttach); @@ -1408,9 +1390,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { Gson gson = new Gson(); if (StrUtil.isNotEmpty(identityInfo.getBody())) { JsonObject identityInfoJsonObject = gson.fromJson(identityInfo.getBody(), JsonObject.class); - if(identityInfoJsonObject!=null&&!identityInfoJsonObject.get("data").isJsonNull()) { + if (identityInfoJsonObject != null && !identityInfoJsonObject.get("data").isJsonNull()) { JsonObject identityInfoData = identityInfoJsonObject.getAsJsonObject("data"); - if (identityInfoData != null && !identityInfoData.get("psnId") .isJsonNull()) { + if (identityInfoData != null && !identityInfoData.get("psnId").isJsonNull()) { idsReq.setPsnId(identityInfoData.get("psnId").getAsString()); } } @@ -1423,7 +1405,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { JsonObject signUrlJsonObject = gson.fromJson(batchSignUrl.getBody(), JsonObject.class); if (signUrlJsonObject != null && !signUrlJsonObject.get("data").isJsonNull()) { JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - if (signUrlData != null&& !signUrlData.get("batchSignUrlWithoutLogin").isJsonNull()) { + if (signUrlData != null && !signUrlData.get("batchSignUrlWithoutLogin").isJsonNull()) { // 免登录批量签链接(链接有效期2小时) String url = signUrlData.get("batchSignUrlWithoutLogin").getAsString(); // batchSignUrl 需登录批量签链接(链接有效期2小时),batchSignShortUrl需登录批量签短链接(链接有效期2小时),batchSignShortUrlWithoutLogin免登录批量签短链接(链接有效期2小时) @@ -1459,7 +1441,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } Integer batchNumber = idsReq.getBatchNumber(); Integer caseStatus = CaseApplicationConstants.SIGN_ARBITRATION; - List caseApplications = sealSignRecordMapper.selectsignFlow(batchNumber,caseStatus); + List caseApplications = sealSignRecordMapper.selectsignFlow(batchNumber, caseStatus); if (caseApplications != null && caseApplications.size() > 0) { List signFlowIds = caseApplications.stream().map(CaseApplication::getSignFlowId).collect(Collectors.toList()); idsReq.setIds(signFlowIds); @@ -1478,7 +1460,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } } - }else{ + } else { throw new ServiceException("这个批号没有批量签名的案件"); } @@ -1498,9 +1480,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { Gson gson = new Gson(); if (StrUtil.isNotEmpty(identityInfo.getBody())) { JsonObject identityInfoJsonObject = gson.fromJson(identityInfo.getBody(), JsonObject.class); - if(identityInfoJsonObject!=null&&!identityInfoJsonObject.get("data").isJsonNull()) { + if (identityInfoJsonObject != null && !identityInfoJsonObject.get("data").isJsonNull()) { JsonObject identityInfoData = identityInfoJsonObject.getAsJsonObject("data"); - if (identityInfoData != null && !identityInfoData.get("psnId") .isJsonNull()) { + if (identityInfoData != null && !identityInfoData.get("psnId").isJsonNull()) { idsReq.setPsnId(identityInfoData.get("psnId").getAsString()); } } @@ -1510,7 +1492,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } Integer batchNumber = idsReq.getBatchNumber(); Integer caseStatus = CaseApplicationConstants.ARBITRATED_SEAL; - List caseApplications = sealSignRecordMapper.selectsignFlow(batchNumber,caseStatus); + List caseApplications = sealSignRecordMapper.selectsignFlow(batchNumber, caseStatus); if (caseApplications != null && caseApplications.size() > 0) { List signFlowIds = caseApplications.stream().map(CaseApplication::getSignFlowId).collect(Collectors.toList()); idsReq.setIds(signFlowIds); @@ -1520,7 +1502,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { JsonObject signUrlJsonObject = gson.fromJson(batchSignUrl.getBody(), JsonObject.class); if (signUrlJsonObject != null && !signUrlJsonObject.get("data").isJsonNull()) { JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - if (signUrlData != null&& !signUrlData.get("batchSignUrlWithoutLogin").isJsonNull()) { + if (signUrlData != null && !signUrlData.get("batchSignUrlWithoutLogin").isJsonNull()) { // 免登录批量签链接(链接有效期2小时) String url = signUrlData.get("batchSignUrlWithoutLogin").getAsString(); // batchSignUrl 需登录批量签链接(链接有效期2小时),batchSignShortUrl需登录批量签短链接(链接有效期2小时),batchSignShortUrlWithoutLogin免登录批量签短链接(链接有效期2小时) @@ -1529,7 +1511,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } } - }else{ + } else { throw new ServiceException("这个批号没有批量用印的案件"); } } catch (EsignDemoException e) { @@ -1561,7 +1543,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { return AjaxResult.error(e.getMessage()); } - }else{ + } else { throw new ServiceException("这个批号没有批量归档的案件"); } @@ -1698,33 +1680,33 @@ public class AdjudicationServiceImpl implements IAdjudicationService { sendMailRecord1.setCreateBy(getUsername()); if (resEmailFlag) { sendMailRecord1.setSendStatus(1); - }else { + } else { sendMailRecord1.setSendStatus(0); } sendMailRecordMapper.saveSendMailRecord(sendMailRecord1); - if(!appEmailFlag&&!resEmailFlag){ + if (!appEmailFlag && !resEmailFlag) { throw new ServiceException("裁决书发送失败"); } - if(!appEmailFlag){ + if (!appEmailFlag) { throw new ServiceException("申请人裁决书发送失败"); } - if(!resEmailFlag){ + if (!resEmailFlag) { throw new ServiceException("被申请人裁决书发送失败"); } // 发送短信 - if (appEmailFlag||resEmailFlag) { + if (appEmailFlag || resEmailFlag) { if (CollectionUtil.isNotEmpty(caseAffiliates)) { SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); request.setTemplateId("1990362"); for (CaseAffiliate affiliate : caseAffiliates) { - String telphone=null; - if(appEmailFlag&&affiliate.getIdentityType()==1){ + String telphone = null; + if (appEmailFlag && affiliate.getIdentityType() == 1) { telphone = affiliate.getContactTelphone(); - }else if(resEmailFlag&&affiliate.getIdentityType()==2){ + } else if (resEmailFlag && affiliate.getIdentityType() == 2) { telphone = affiliate.getContactTelphone(); } - if(StrUtil.isEmpty(telphone)){ + if (StrUtil.isEmpty(telphone)) { continue; } @@ -1770,7 +1752,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } - }else{ + } else { throw new ServiceException("这个批号没有批量送达裁决书的案件"); } return AjaxResult.success("仲裁文书送达成功"); @@ -1856,5 +1838,4 @@ public class AdjudicationServiceImpl implements IAdjudicationService { return bookmarkList; } - } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DownFileService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DownFileService.java new file mode 100644 index 0000000..19822cf --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DownFileService.java @@ -0,0 +1,76 @@ +package com.ruoyi.wisdomarbitrate.service.impl; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +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.file.SaaSAPIFileUtils; +import com.ruoyi.wisdomarbitrate.domain.CaseApplication; +import com.ruoyi.wisdomarbitrate.domain.CaseAttach; +import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.IOException; +import java.time.LocalDate; +import java.util.UUID; + +/** + * 下载文件 + */ +@Service +public class DownFileService { + @Autowired + CaseAttachMapper caseAttachMapper; + + /** + * 从E签宝下载签署完成后的PDF文件 + */ + public void downPdfFileFormEsign(String signFlowId, Long caseAppliId) throws EsignDemoException, IOException { + Gson gson = new Gson(); + 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 = "/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 = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); + boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); + if (downLoadFile) { + //立案申请书(1)、申请人证据材料(2)、仲裁文书(3)、案件视频(4)、身份证件(5)、 + // 被申请人证据材料 (6)、庭审笔录(7)、缴费凭证(8)、视频录制(9)、公章图片(10)、语音转录文件(11) + caseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, 3); + CaseAttach caseAttach = new CaseAttach(); + caseAttach.setCaseAppliId(caseAppliId); + caseAttach.setAnnexType(3); + caseAttach.setAnnexPath(savePath); + caseAttach.setAnnexName(saveName); + caseAttachMapper.save(caseAttach); + } + + } + } + +} -- 2.54.0