html转pdf
This commit is contained in:
+14
-1
@@ -23,12 +23,25 @@ public class ReservedConferenceVO {
|
||||
* 房间号id
|
||||
*/
|
||||
private Long roomId;
|
||||
/**
|
||||
* 会议开始时间
|
||||
*/
|
||||
@NotNull(message = "会议开始时间不能为空")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date scheduleStartTime;
|
||||
|
||||
/**
|
||||
* 会议结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date scheduleEndTime;
|
||||
/**
|
||||
* 案件id
|
||||
*/
|
||||
@NotNull(message = "案件id不能为空")
|
||||
private Long caseId;
|
||||
/**
|
||||
* html内容
|
||||
*/
|
||||
private String htmlContent;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -39,4 +40,11 @@ public interface VideoService {
|
||||
* @return
|
||||
*/
|
||||
AjaxResult secretaryRoleByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据html字符串转pdf并和案件关联
|
||||
* @param reservedConferenceVO
|
||||
* @return
|
||||
*/
|
||||
AjaxResult htmlToPDF(ReservedConferenceVO reservedConferenceVO);
|
||||
}
|
||||
|
||||
+35
-3
@@ -13,9 +13,11 @@ import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.PdfUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
@@ -23,6 +25,7 @@ import com.ruoyi.system.mapper.SysUserRoleMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
|
||||
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
|
||||
@@ -312,6 +315,38 @@ public class VideoServiceImpl implements VideoService {
|
||||
return success(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据html字符串转pdf并和案件关联
|
||||
* @param reservedConferenceVO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult htmlToPDF(ReservedConferenceVO reservedConferenceVO) {
|
||||
String currentFileName = System.currentTimeMillis() + ".pdf";
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = getPathFileName(RuoYiConfig.getHtml2PDFPath(), currentFileName);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
// html转pdf并上传到服务器
|
||||
boolean convertFlag = PdfUtils.htmlStringConvertToPDF(RuoYiConfig.getHtml2PDFPath() + currentFileName, reservedConferenceVO.getHtmlContent());
|
||||
|
||||
// 绑定案件
|
||||
if(convertFlag){
|
||||
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(reservedConferenceVO.getCaseId())
|
||||
.annexName(fileName)
|
||||
.annexPath(RuoYiConfig.getHtml2PDFPath())
|
||||
.annexType(11)
|
||||
.build();
|
||||
caseAttachMapper.save(caseAttach);
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
return AjaxResult.error("pdf转换失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询出音视频集合,并下载,在将云点播上面的音视频删除
|
||||
@@ -388,9 +423,7 @@ public class VideoServiceImpl implements VideoService {
|
||||
staticAndMksDir = Paths.get(absPath).toFile().toString();
|
||||
long downloadFile = HttpUtil.downloadFile(fileUrl, staticAndMksDir);
|
||||
if(downloadFile>0) {
|
||||
log.info("下载成功roomId"+roomId);
|
||||
Long caseId = caseApplicationMapper.selectCaseIdByRoomId(roomId);
|
||||
log.info("下载成功caseId"+caseId);
|
||||
String annexName = getPathFileName(RuoYiConfig.getVideoUploadPath(), fileName);
|
||||
// 存入数据库
|
||||
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(caseId)
|
||||
@@ -399,7 +432,6 @@ public class VideoServiceImpl implements VideoService {
|
||||
.annexType(9)
|
||||
.build();
|
||||
caseAttachMapper.save(caseAttach);
|
||||
log.info("保存附件号成功");
|
||||
return annexName;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user