diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/VideoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/VideoController.java index c5958ad..f0220ee 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/VideoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/VideoController.java @@ -132,6 +132,18 @@ public class VideoController extends BaseController { return videoService.htmlToPDF(reservedConferenceVO); } + /** + * 根据案件id和类型查询附件 + * @param caseAppliId + * @param annexType + * @return + */ + @Anonymous + @GetMapping("attachListByCaseId") + public AjaxResult attachListByCaseId( @RequestParam("caseAppliId") Long caseAppliId,@RequestParam("annexType") Integer annexType) { + + return videoService.attachListByCaseId(caseAppliId,annexType); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/PdfUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/PdfUtils.java index 328d5e0..feb1609 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/PdfUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/PdfUtils.java @@ -32,7 +32,7 @@ public class PdfUtils { * @param pdfFilePath 保存的路径 * @param htmlcontent:必须是完整的html格式,比如123 */ - public boolean htmlStringConvertToPDF(String pdfFilePath, String htmlcontent) { + public static boolean htmlStringConvertToPDF(String pdfFilePath, String htmlcontent) { Document document = new Document(); PdfWriter writer = null; try { diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/VideoService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/VideoService.java index 76e76af..c1c8c71 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/VideoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/VideoService.java @@ -47,4 +47,12 @@ public interface VideoService { * @return */ AjaxResult htmlToPDF(ReservedConferenceVO reservedConferenceVO); + + /** + * 根据案件id和类型查询附件 + * @param caseAppliId + * @param annexType + * @return + */ + AjaxResult attachListByCaseId(Long caseAppliId, Integer annexType); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java index 3d8b731..ee7ab61 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java @@ -331,8 +331,7 @@ public class VideoServiceImpl implements VideoService { } String htmlContent = "" +reservedConferenceVO.getHtmlContent()+""; // html转pdf并上传到服务器 - PdfUtils pdfUtils = new PdfUtils(); - boolean convertFlag = pdfUtils.htmlStringConvertToPDF(RuoYiConfig.getHtml2PDFPath() + currentFileName, htmlContent); + boolean convertFlag = PdfUtils.htmlStringConvertToPDF(RuoYiConfig.getHtml2PDFPath() + currentFileName, htmlContent); // 绑定案件 if(convertFlag){ @@ -348,6 +347,37 @@ public class VideoServiceImpl implements VideoService { } } + @Override + public AjaxResult attachListByCaseId(Long caseAppliId, Integer annexType) { + CaseApplication caseApplication = new CaseApplication(); + caseApplication.setId(caseAppliId); + caseApplication.setAnnexType(annexType); + List caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication); + if(CollectionUtil.isEmpty(caseAttachList)){ + return success(caseAttachList); + } + + // 附件转换 + if (caseAttachList != null && caseAttachList.size() > 0) { + for (CaseAttach caseAttach : caseAttachList) { + String annexName = caseAttach.getAnnexName(); + String prefix = "/profile"; + int startIndex = annexName.indexOf(prefix); + startIndex += prefix.length(); + String annexPath = "/uploadPath" + annexName.substring(startIndex); + caseAttach.setAnnexPath(annexPath); + int startIndexnew = annexName.lastIndexOf("/"); + if (startIndexnew != -1) { + String annexNamenew = annexName.substring(startIndexnew + 1); + caseAttach.setAnnexName(annexNamenew); + } + + + } + } + return success(caseAttachList); + } + /** * 查询出音视频集合,并下载,在将云点播上面的音视频删除