根据案件id查附件

This commit is contained in:
18792927508
2023-11-30 15:04:09 +08:00
parent 45d23fbab6
commit de1644db2c
4 changed files with 53 additions and 3 deletions
@@ -132,6 +132,18 @@ public class VideoController extends BaseController {
return videoService.htmlToPDF(reservedConferenceVO); 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);
}
} }
@@ -32,7 +32,7 @@ public class PdfUtils {
* @param pdfFilePath 保存的路径 * @param pdfFilePath 保存的路径
* @param htmlcontent:必须是完整的html格式,比如<html><body>123</body></html> * @param htmlcontent:必须是完整的html格式,比如<html><body>123</body></html>
*/ */
public boolean htmlStringConvertToPDF(String pdfFilePath, String htmlcontent) { public static boolean htmlStringConvertToPDF(String pdfFilePath, String htmlcontent) {
Document document = new Document(); Document document = new Document();
PdfWriter writer = null; PdfWriter writer = null;
try { try {
@@ -47,4 +47,12 @@ public interface VideoService {
* @return * @return
*/ */
AjaxResult htmlToPDF(ReservedConferenceVO reservedConferenceVO); AjaxResult htmlToPDF(ReservedConferenceVO reservedConferenceVO);
/**
* 根据案件id和类型查询附件
* @param caseAppliId
* @param annexType
* @return
*/
AjaxResult attachListByCaseId(Long caseAppliId, Integer annexType);
} }
@@ -331,8 +331,7 @@ public class VideoServiceImpl implements VideoService {
} }
String htmlContent = "<html><body style=\"font-size:12.0pt; font-family:SimSun;\">" +reservedConferenceVO.getHtmlContent()+"</body></html>"; String htmlContent = "<html><body style=\"font-size:12.0pt; font-family:SimSun;\">" +reservedConferenceVO.getHtmlContent()+"</body></html>";
// html转pdf并上传到服务器 // html转pdf并上传到服务器
PdfUtils pdfUtils = new PdfUtils(); boolean convertFlag = PdfUtils.htmlStringConvertToPDF(RuoYiConfig.getHtml2PDFPath() + currentFileName, htmlContent);
boolean convertFlag = pdfUtils.htmlStringConvertToPDF(RuoYiConfig.getHtml2PDFPath() + currentFileName, htmlContent);
// 绑定案件 // 绑定案件
if(convertFlag){ 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<CaseAttach> 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);
}
/** /**
* 查询出音视频集合,并下载,在将云点播上面的音视频删除 * 查询出音视频集合,并下载,在将云点播上面的音视频删除