This commit is contained in:
hejinbo
2023-11-30 15:27:37 +08:00
10 changed files with 148 additions and 21 deletions
@@ -132,6 +132,18 @@ public class VideoController extends BaseController {
return videoService.htmlToPDF(reservedConferenceVO);
}
/**
* 根据案件id和类型查询附件
* @param caseAppliId
* @param annexType
* @return
*/
@GetMapping("attachListByCaseId")
public AjaxResult attachListByCaseId( @RequestParam("caseAppliId") Long caseAppliId,@RequestParam("annexType") Integer annexType) {
return videoService.attachListByCaseId(caseAppliId,annexType);
}
}
@@ -142,7 +142,7 @@ public class RuoYiConfig
}
public static String getHtml2PDFPath()
{
return getProfile() + "/upload/html2PDF/";
return getProfile() + "/upload/html2PDF";
}
// https://1304001529.vod-qcloud.com/b78823bbvodcq1304001529/3ce565bf3270835011486046286/f0.mp4
}
@@ -32,13 +32,10 @@ public class PdfUtils {
* @param pdfFilePath 保存的路径
* @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();
PdfWriter writer = null;
try {
// if(!new File(pdfFilePath).exists()){
// new File(pdfFilePath).createNewFile();
// }
writer = PdfWriter.getInstance(document, new FileOutputStream(pdfFilePath));
// 设置底部距离60,解决重叠问题
@@ -19,6 +19,7 @@ public interface CaseAffiliateMapper {
List<CaseAffiliate> selectCaseAffiliate(CaseAffiliate caseAffiliate);
List<CaseAffiliate> selectCaseAffiliateByCaseIds(@Param("ids") List<Long> ids);
CaseAffiliate selectCaseAffiliateByIdentityType(@Param("caseAppliId") Long caseAppliId, @Param("identityType")int identityType);
int updataCaseAffiliate(CaseAffiliate caseAffiliate);
@@ -2,9 +2,11 @@ package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
public interface CaseLogRecordMapper {
@@ -47,4 +47,12 @@ public interface VideoService {
* @return
*/
AjaxResult htmlToPDF(ReservedConferenceVO reservedConferenceVO);
/**
* 根据案件id和类型查询附件
* @param caseAppliId
* @param annexType
* @return
*/
AjaxResult attachListByCaseId(Long caseAppliId, Integer annexType);
}
@@ -257,9 +257,9 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
compareCaseVO.setBeforeCase(beforeCase);
compareCaseVO.setAfterCase(afterCase);
// 对比两个版本修改的字段
String[] columns = {"caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag",
String[] columns = {"caseName","caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag",
"claimPrinciOwed","arbitratClaims","properPreser","requestRule"};
String[] affiliateColumns = {"name", "identityNum","contactTelphone","contactAddress","workTelphone","workAddress",
String[] affiliateColumns = {"name", "identityNum","contactTelphone","contactAddress","workTelphone","workAddress","email",
"nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent","residenAffili","compLegalPerson",
"compLegalperPost","responSex","responBirth"};
StringBuilder changeColumn = new StringBuilder();
@@ -70,6 +70,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
@@ -136,8 +137,19 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
private static final Pattern TELEPHONE_REGX = Pattern.compile("^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$");
// 邮箱正则
private static final Pattern EMAIL_PATTERN = Pattern.compile("^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$");
// 身份证号码正则表达式
private static final String ID_REGEX = "^(\\\\d{15}$|\\\\d{18}$|\\\\d{17}([0-9]|X))$";
// 基本字段校验
private static final String[] baseColumns = {"caseName","caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag",
"claimPrinciOwed","arbitratClaims"};
// 申请人字段校验
private static final String[] applicAffiliateColumns = {"name", "contactTelphone","contactAddress","workTelphone","workAddress",
"residenAffili","compLegalPerson",
"compLegalperPost","email","nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent"};
// 申请人/被申请人代理人字段校验
private static final String[] applicAgentAffiliateColumns = {"nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent"};
// 被申请人字段校验
private static final String[] dectborAffiliateColumns = {"name", "identityNum","contactTelphone","contactAddress","workTelphone","workAddress",
"residenAffili","responSex","responBirth","email","nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent"};
/**
* 数据权限:1.每个人不同的角色,而每个角色可以操作不同的案件状态
@@ -1275,7 +1287,57 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Transactional
public int submitCaseApplication(List<Long> ids) {
int rows = 0;
// 查询案件信息,做必填校验,校验不通过,提示,不能提交
StringBuilder errorMsg = new StringBuilder();
List<CaseApplication> caseApplications = caseApplicationMapper.listCaseApplicationByIds(ids);
if(CollectionUtil.isNotEmpty(caseApplications)) {
Map<Long, CaseApplication> applicationMap = caseApplications.stream().collect(Collectors.toMap(CaseApplication::getId, Function.identity(), (n1, n2) -> n2));
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliateByCaseIds(ids);
// 转换为Map<CaseId,List<CaseAffiliate>>形式
Map<Long, List<CaseAffiliate>> caseAffiliateMap = caseAffiliates.stream().collect(Collectors.groupingBy(CaseAffiliate::getCaseAppliId));
for (Long id : ids) {
// 必填校验
CaseApplication caseApplication = applicationMap.get(id);
// 基本字段校验
if(caseApplication!=null) {
for (String baseColumn : baseColumns) {
if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseApplication, baseColumn))){
errorMsg.append(baseColumn).append("不能为空,");
// todo 暂抛出异常,后边改为提示具体的字段
throw new ServiceException("必填字段未填写,请完善案件信息!");
}
}
// 校验人员
if(CollectionUtil.isNotEmpty(caseAffiliates)){
List<CaseAffiliate> affiliateList = caseAffiliateMap.get(id);
if(CollectionUtil.isNotEmpty(affiliateList)){
for (CaseAffiliate caseAffiliate : affiliateList) {
if(caseAffiliate.getIdentityType()==1){
// 校验申请人
for (String applicAffiliateColumn : applicAffiliateColumns) {
if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseApplication, applicAffiliateColumn))){
errorMsg.append(applicAffiliateColumn).append("不能为空,");
// todo 暂抛出异常,后边改为提示具体的字段
throw new ServiceException("必填字段未填写,请完善案件信息!");
}
}
}else {
// 校验被申请人
// 校验申请人
for (String applicAffiliateColumn : dectborAffiliateColumns) {
if(StrUtil.isEmpty( ObjectFieldUtils.getValue(caseApplication, applicAffiliateColumn))){
errorMsg.append(applicAffiliateColumn).append("不能为空,");
// todo 暂抛出异常,后边改为提示具体的字段
throw new ServiceException("必填字段未填写,请完善案件信息!");
}
}
}
}
}
}
}
CaseApplication application = new CaseApplication();
application.setId(id);
//提交立案申请
@@ -1284,6 +1346,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
// 新增日志
insertCaseLog(application.getId(), CaseApplicationConstants.CASE_CHECK, "");
}
}
return rows;
}
@@ -331,15 +331,14 @@ public class VideoServiceImpl implements VideoService {
}
String htmlContent = "<html><body style=\"font-size:12.0pt; font-family:SimSun;\">" +reservedConferenceVO.getHtmlContent()+"</body></html>";
// html转pdf并上传到服务器
PdfUtils pdfUtils = new PdfUtils();
boolean convertFlag = pdfUtils.htmlStringConvertToPDF(RuoYiConfig.getHtml2PDFPath() + currentFileName, htmlContent);
boolean convertFlag = PdfUtils.htmlStringConvertToPDF(RuoYiConfig.getHtml2PDFPath() +"/"+ currentFileName, htmlContent);
// 绑定案件
if(convertFlag){
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(reservedConferenceVO.getCaseId())
.annexName(fileName)
.annexPath(RuoYiConfig.getHtml2PDFPath())
.annexType(11)
.annexType(7)
.build();
caseAttachMapper.save(caseAttach);
return AjaxResult.success();
@@ -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);
}
/**
* 查询出音视频集合,并下载,在将云点播上面的音视频删除
@@ -45,6 +45,19 @@
</if>
</where>
</select>
<select id="selectCaseAffiliateByCaseIds" resultMap="CaseAffiliateResult">
select c.*,s.user_id
from case_affiliate c
left join sys_user s on c.identity_num=s.id_card
<where>
<if test="ids != null ">
case_appli_id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
<select id="selectCaseAffiliateByIdentityType" resultMap="CaseAffiliateResult">
select c.*
from case_affiliate c
@@ -64,6 +77,7 @@
</select>
<insert id="batchCaseAffiliate">
insert into case_affiliate(case_appli_id, identity_type,application_organ_id,application_organ_name,name,identity_num,contact_telphone,
contact_address,work_address,work_telphone ,name_agent,identity_num_agent,contact_telphone_agent,