This commit is contained in:
qitz
2024-01-20 17:06:55 +08:00
11 changed files with 282 additions and 37 deletions
@@ -7,9 +7,11 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.BookingVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.BookingVO;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseAttachVO;
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -201,5 +203,43 @@ public class MsCaseApplicationController extends BaseController {
public AjaxResult selectReservation(@RequestParam("id") Long id ) { public AjaxResult selectReservation(@RequestParam("id") Long id ) {
return caseApplicationService.selectReservation(id); return caseApplicationService.selectReservation(id);
} }
/**
* 调解
* @param
* @return
*/
@PostMapping("/mediation")
public AjaxResult mediation(@RequestBody MsCaseApplicationReq req) {
if (req.getCaseFlowId() == null || (req.getId() == null && StrUtil.isEmpty(req.getBatchNumber()))) {
return error("参数校验失败");
}
return caseApplicationService.mediation(req);
}
/**
* 修改庭审笔录
* @param
* @return
*/
@PostMapping("/updateTrialPen")
public AjaxResult updateTrialPen(@RequestBody MsCaseAttach attach) {
if (attach.getCaseAppliId()==null || attach.getAnnexId()==null ) {
return error("参数校验失败");
}
return caseApplicationService.updateTrialPen(attach);
}
/**
* 确认调解书
* @param
* @return
*/
@PostMapping("/confirmMediation")
public AjaxResult confirmMediation(@RequestBody MsCaseAttachVO attach) {
if (attach.getCaseFlowId()==null || attach.getCaseAppliId()==null ) {
return error("参数校验失败");
}
return caseApplicationService.confirmMediation(attach);
}
} }
@@ -15,6 +15,8 @@ public enum AnnexTypeEnum implements EnumsInterface {
MEDIATION_APPLICATION(3, "调解申请书"), MEDIATION_APPLICATION(3, "调解申请书"),
PAYMENT_RECEIPT(4, "缴费单"), PAYMENT_RECEIPT(4, "缴费单"),
MEETING_VIDEO(5, "会议视频"), MEETING_VIDEO(5, "会议视频"),
MEDIATE(6, "庭审笔录"),
MEDIATE_BOOK(7, "调解书"),
; ;
@@ -2,6 +2,7 @@ package com.ruoyi.common.utils;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.exception.ServiceException;
import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFParagraph;
@@ -32,7 +33,7 @@ public class BookMarkUtil {
FileInputStream fileInputStream = new FileInputStream(path); FileInputStream fileInputStream = new FileInputStream(path);
xwpfDocument = new XWPFDocument(fileInputStream); xwpfDocument = new XWPFDocument(fileInputStream);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new ServiceException("未找到模板");
} }
if (xwpfDocument == null) { if (xwpfDocument == null) {
return new ArrayList<>(); return new ArrayList<>();
@@ -70,6 +70,7 @@ public class MsCaseApplication {
/** /**
* 开庭日期 * 开庭日期
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
@Column(name = "hear_date") @Column(name = "hear_date")
private String hearDate; private String hearDate;
@@ -60,5 +60,9 @@ public class MsCaseApplicationReq {
*/ */
private String mediatorName; private String mediatorName;
/**
* 模板类型,1调解书,2调解申请书
*/
private Integer templateType=2;
} }
@@ -0,0 +1,17 @@
package com.ruoyi.wisdomarbitrate.domain.vo.mscase;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import lombok.*;
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class MsCaseAttachVO extends MsCaseAttach {
/**
* 案件状态ID
*/
private Integer caseFlowId;
}
@@ -34,7 +34,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
* @param caseStatusNames * @param caseStatusNames
* @return * @return
*/ */
@Select("<script> select t.* from (select c.id,0 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," + @Select("<script> select t.* from (select c.id,c.mediation_method mediationMethod,0 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
"a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," + "a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
"c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_application c " + "c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_application c " +
"join ms_case_affiliate a on c.id=a.case_appli_id <where> " + "join ms_case_affiliate a on c.id=a.case_appli_id <where> " +
@@ -61,7 +61,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"<if test=\"req.endTime != null and req.endTime != ''\">" + "<if test=\"req.endTime != null and req.endTime != ''\">" +
"and c.create_time &lt;= #{req.endTime}</if>" + "and c.create_time &lt;= #{req.endTime}</if>" +
" </where> " + " </where> " +
"union select c.id id,1 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," + "union select c.id id,c.mediation_method mediationMethod,1 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
"a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," + "a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
"c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_log_record r " + "c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_log_record r " +
"join ms_case_application c on r.case_appli_id=c.id and r.case_status_name!=c.case_status_name " + "join ms_case_application c on r.case_appli_id=c.id and r.case_status_name!=c.case_status_name " +
@@ -4,9 +4,11 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.BookingVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.BookingVO;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseAttachVO;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
@@ -140,4 +142,26 @@ public interface MsCaseApplicationService {
*/ */
AjaxResult selectReservation(Long id); AjaxResult selectReservation(Long id);
/**
* 调解
* @param req
* @return
*/
AjaxResult mediation(MsCaseApplicationReq req);
/**
* 修改庭审笔录
* @param attach
* @return
*/
AjaxResult updateTrialPen(MsCaseAttach attach);
/**
* 确认调解书
* @param attach
* @return
*/
AjaxResult confirmMediation(MsCaseAttachVO attach);
} }
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictData;
@@ -481,37 +482,40 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
* @param req * @param req
* @return * @return
*/ */
@Transactional
@Override @Override
public AjaxResult generateApplication(MsCaseApplicationReq req) { public AjaxResult generateApplication(MsCaseApplicationReq req) {
// 根据模板id查询申请书 // 根据模板id查询申请书
TemplateManage templateManage=templateManageMapper.selectById(req.getTemplateId()); TemplateManage templateManage=templateManageMapper.selectById(req.getTemplateId());
if(templateManage==null||StrUtil.isEmpty(templateManage.getTemOrigPath())){ if(templateManage==null||StrUtil.isEmpty(templateManage.getTemOrigPath())){
return AjaxResult.error("未找到调解申请书模板"); throw new ServiceException("未找到模板");
} }
String templatePath = templateManage.getTemOrigPath(); String templatePath = "/home/ruoyi/" + templateManage.getTemOrigPath();
templatePath=templatePath.replace("/profile","/uploadPath");
try { try {
File file = new File(templatePath); File file = new File(templatePath);
} catch (Exception e) { } catch (Exception e) {
return AjaxResult.error("未找到调解申请书模板"); throw new ServiceException("未找到模板");
} }
// 获取模板中的占位符key // 获取模板中的占位符key
List<String> bookmarkList = getBookmarkByDocx(templatePath); List<String> bookmarkList = getBookmarkByDocx(templatePath);
if (CollectionUtil.isEmpty(bookmarkList)) { if (CollectionUtil.isEmpty(bookmarkList)) {
return AjaxResult.success("请检查模板是否配置正确,未获取到占位符"); throw new ServiceException("请检查模板是否配置正确,未获取到占位符");
} }
// 在系统表中查询案件内置字段 // 在系统表中查询案件内置字段
SysDictData sysDictData = new SysDictData(); SysDictData sysDictData = new SysDictData();
sysDictData.setDictType("case_built_type"); sysDictData.setDictType("case_built_type");
List<SysDictData> dictDataList = dictDataMapper.selectDictDataList(sysDictData); List<SysDictData> dictDataList = dictDataMapper.selectDictDataList(sysDictData);
if(CollectionUtil.isEmpty(dictDataList)){ if(CollectionUtil.isEmpty(dictDataList)){
return AjaxResult.error("未找到系统内置字段"); throw new ServiceException("未找到系统内置字段");
} }
// 如果批号不为空,则为批量操作,根据批号查询未锁定的案件 // 如果批号不为空,则为批量操作,根据批号查询未锁定的案件
if(StrUtil.isNotEmpty(req.getBatchNumber())){ if(StrUtil.isNotEmpty(req.getBatchNumber())){
List<MsCaseApplication> caseApplicationList=listByBatchNumber(req.getBatchNumber(),req.getCaseFlowId()); List<MsCaseApplication> caseApplicationList=listByBatchNumber(req.getBatchNumber(),req.getCaseFlowId());
if(CollectionUtil.isEmpty(caseApplicationList)){ if(CollectionUtil.isEmpty(caseApplicationList)){
return AjaxResult.error("该批次号下未找到案件"); throw new ServiceException("该批次号下未找到案件");
} }
// 案件ids // 案件ids
List<Long> caseIds = caseApplicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList()); List<Long> caseIds = caseApplicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList());
@@ -520,20 +524,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
afflicateExample.createCriteria().andIn("case_appli_id", caseIds); afflicateExample.createCriteria().andIn("case_appli_id", caseIds);
List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(caseIds); List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(caseIds);
if(CollectionUtil.isEmpty(affiliateList)){ if(CollectionUtil.isEmpty(affiliateList)){
return AjaxResult.error("该批次号下未找到案件关联人员"); throw new ServiceException("该批次号下未找到案件关联人员");
} }
Map<Long, MsCaseAffiliate> affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity())); Map<Long, MsCaseAffiliate> affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity()));
// 循环生成调解申请书 // 循环生成调解申请书
for (MsCaseApplication application : caseApplicationList) { for (MsCaseApplication application : caseApplicationList) {
// 案件相关人员 // 案件相关人员
MsCaseAffiliate affiliate = affiliateMap.get(application.getId()); MsCaseAffiliate affiliate = affiliateMap.get(application.getId());
if(affiliate==null){ if(affiliate==null){
continue; continue;
} }
createMediateApplication(application, affiliate, templatePath, bookmarkList,dictDataList); createMediateApplication(application, affiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType());
} }
}else { }else {
@@ -543,13 +546,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 查询案件关联人员 // 查询案件关联人员
MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId()); MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId());
if (application == null || caseAffiliate == null) { if (application == null || caseAffiliate == null) {
return AjaxResult.error("该案件不存在"); throw new ServiceException("该案件不存在");
} }
createMediateApplication(application, caseAffiliate, templatePath, bookmarkList,dictDataList);
createMediateApplication(application, caseAffiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType());
} }
return AjaxResult.success("调解申请书生成成功"); return AjaxResult.success();
} }
/** /**
@@ -738,11 +742,57 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
@Transactional @Transactional
@Override @Override
public AjaxResult updateBooking(BookingVO vo) { public AjaxResult updateBooking(BookingVO vo) {
// 查询被申请人是否预约过(从日志表查),否则不更新流程节点
MsCaseAffiliate msCaseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(vo.getId());
if(msCaseAffiliate==null) {
return AjaxResult.error("该案件不存在");
}
MsCaseApplication application = new MsCaseApplication(); MsCaseApplication application = new MsCaseApplication();
application.setId(vo.getId()); application.setId(vo.getId());
setMediatorAndDate(application,vo); setMediatorAndDate(application,vo);
msCaseApplicationMapper.updateByPrimaryKeySelective(application); int applicantCount = msCaseApplicationMapper.updateByPrimaryKeySelective(application);
nextFlow(vo.getId(),vo.getCaseFlowId(),null); if(applicantCount<1){
return AjaxResult.error("保存失败");
}
// 新增申请人签署日志
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(vo.getCaseFlowId());
if(currentFlow==null){
return AjaxResult.error("当前流程不存在");
}
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"申请人选择调解员");
if(StrUtil.isNotEmpty(msCaseAffiliate.getRespondentIdentityNum())){
// 根据身份证查询用户表
SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
if(user!=null){
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(vo.getCaseFlowId());
if(nextFlow==null){
return AjaxResult.error("未找到下一个流程");
}
// 查询日志中是否有该节点的被申请人操作
Example example = new Example(MsCaseLogRecord.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("case_appli_id", vo.getId());
criteria.andEqualTo("case_node", nextFlow.getNodeId());
criteria.andEqualTo("case_status_name", nextFlow.getCaseStatusName());
criteria.andEqualTo("create_by", user.getUserName());
int count = caseLogRecordMapper.selectCountByExample(example);
if(count>0){
// 被申请人已预约,更新流程节点
// 更改案件流程id和案件状态
application.setCaseFlowId(nextFlow.getId());
application.setCaseStatusName(nextFlow.getCaseStatusName());
application.setLockStatus(null);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
}
// else {
// return AjaxResult.error("被申请人未选择调解员");
// }
}
// else {
// return AjaxResult.error("被申请人未选择调解员");
// }
}
return AjaxResult.success(); return AjaxResult.success();
} }
@@ -853,6 +903,79 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
return AjaxResult.success(result); return AjaxResult.success(result);
} }
/**
* 调解
* @param req
* @return
*/
@Transactional
@Override
public AjaxResult mediation(MsCaseApplicationReq req) {
String templateId=null;
// 批量
if(StrUtil.isNotEmpty(req.getBatchNumber())){
// 查询调解书模板是否存在
Example example = new Example(MsCaseFlow.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("batch_number", req.getBatchNumber());
criteria.andIsNotNull("template_id");
MsCaseApplication caseApplication = msCaseApplicationMapper.selectOneByExample(example);
if(caseApplication==null||caseApplication.getTemplateId()==null){
return AjaxResult.error("未找到模板");
}
templateId= String.valueOf(caseApplication.getTemplateId());
}else {
// 单独生成
// 查询调解书模板是否存在
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
if(application==null||application.getTemplateId()==null){
return AjaxResult.error("未找到模板");
}
templateId= String.valueOf(application.getTemplateId());
}
req.setTemplateId(templateId);
req.setTemplateType(1);
AjaxResult result = generateApplication(req);
if(result!=null && result.isSuccess()){
return result;
}
return AjaxResult.error("生成失败");
}
/**
* 修改庭审笔录
* @param attach
* @return
*/
@Transactional
@Override
public AjaxResult updateTrialPen(MsCaseAttach attach) {
// 删除之前的庭审笔录
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(attach.getCaseAppliId(), AnnexTypeEnum.MEDIATE.getCode());
// 更新庭审笔录
msCaseAttachMapper.updateCaseAttach(attach);
return AjaxResult.success();
}
/**
* 确认调解书
* @param attach
* @return
*/
@Transactional
@Override
public AjaxResult confirmMediation(MsCaseAttachVO attach) {
if(attach.getAnnexId()!=null){
// 删除之前的调解书
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(attach.getCaseAppliId(),AnnexTypeEnum.MEDIATE_BOOK.getCode());
msCaseAttachMapper.updateCaseAttach(attach);
}
// 更新流程节点
nextFlow(attach.getCaseAppliId(),attach.getCaseFlowId(),YesOrNoEnum.YES.getCode());
return AjaxResult.success();
}
/** /**
@@ -956,7 +1079,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
* @param bookmarkList 标签 * @param bookmarkList 标签
* @param dictDataList 内置字段 * @param dictDataList 内置字段
*/ */
private void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList) { private void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList,Integer templateType) {
// 申请书需要的字段和内容,valueMap<占位符,替换的值> // 申请书需要的字段和内容,valueMap<占位符,替换的值>
Map<String, String> valueMap = new HashMap<>(); Map<String, String> valueMap = new HashMap<>();
for (SysDictData dictData : dictDataList) { for (SysDictData dictData : dictDataList) {
@@ -973,8 +1096,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 读取调节申请书,找到占位符,替换值 // 读取调节申请书,找到占位符,替换值
// 遍历书签,给书签赋值 // 遍历书签,给书签赋值
replaceBookmark(bookmarkList, bookmarkValueMap, valueMap); replaceBookmark(bookmarkList, bookmarkValueMap, valueMap);
// 根据条件替换书签
// conditionReplaceBookmark(caseApplicationById, bookmarkValueMap, agentName, resName, arbitrateRecordSelect);
// 申请书生成时间 // 申请书生成时间
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
int year = now.getYear(); int year = now.getYear();
@@ -986,29 +1107,34 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
String month = String.format("%02d", now.getMonthValue()); String month = String.format("%02d", now.getMonthValue());
String day = String.format("%02d", now.getDayOfMonth()); String day = String.format("%02d", now.getDayOfMonth());
// todo // todo
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; String saveFolderPath = RuoYiConfig.getUploadPath()+"/"+ year + "/" + month + "/" + day;
// String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; Integer annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode();
String orgFileName="调解申请书"; String orgFileName = "调解申请书";
if(templateType!=null&&templateType==1) {
orgFileName = "调解书";
annexType=AnnexTypeEnum.MEDIATE_BOOK.getCode();
}
String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx"; String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx";
// todo
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
// String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName;
String resultFilePath = saveFolderPath + "/" + fileName; String resultFilePath = saveFolderPath + "/" + fileName;
// 将word中的标签替换掉,生成新的word // 将word中的标签替换掉,生成新的word
wordChangeText(templatePath, bookmarkValueMap,saveFolderPath,resultFilePath); wordChangeText(templatePath, bookmarkValueMap,saveFolderPath,resultFilePath);
// String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
// 保存裁决书附件
// saveArbitorFile(id, saveName, savePath, caseApplicationById, arbitrateRecordSelect);
MsCaseAttach caseAttach = MsCaseAttach.builder() MsCaseAttach caseAttach = MsCaseAttach.builder()
.caseAppliId(application.getId()) .caseAppliId(application.getId())
.annexName(orgFileName) .annexName(orgFileName)
.annexPath(resultFilePath) .annexPath(resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX))
.annexType(AnnexTypeEnum.MEDIATION_APPLICATION.getCode()) .annexType(annexType)
.build(); .build();
//保存到附件表里,先删除之前的在保存 //保存到附件表里,先删除之前的在保存
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), 3); msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), AnnexTypeEnum.MEDIATION_APPLICATION.getCode());
if (templateType!=null&&templateType==1) {
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
}
msCaseAttachMapper.save(caseAttach); msCaseAttachMapper.save(caseAttach);
// 生成调解书成功,需要更新流程节点
if (templateType!=null&&templateType==1) {
nextFlow(application.getId(), application.getCaseFlowId(), application.getLockStatus());
}
} }
/** /**
@@ -1041,7 +1167,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
WordUtil.changeText(xwpfDocument); WordUtil.changeText(xwpfDocument);
} }
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("请检查文件路径是否有误");
throw new RuntimeException("modalFilePath:"+modalFilePath+"==saveFolderPath:"
+saveFolderPath+"==resultFilePath:"+resultFilePath+"==sourcePath:"+sourcePath+"==destinationPath:"+destinationPath);
} }
} }
/** /**
@@ -31,6 +31,9 @@ import com.tencentcloudapi.trtc.v20190722.TrtcClient;
import com.tencentcloudapi.trtc.v20190722.models.*; import com.tencentcloudapi.trtc.v20190722.models.*;
import com.tencentyun.TLSSigAPIv2; import com.tencentyun.TLSSigAPIv2;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -39,6 +42,8 @@ import tk.mybatis.mapper.entity.Example;
import javax.crypto.Mac; import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Base64; import java.util.Base64;
@@ -175,6 +180,10 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
long roomId = generateRoomId(); long roomId = generateRoomId();
// 绑定案件与房间号 // 绑定案件与房间号
bindCaseId(caseId, String.valueOf(roomId)); bindCaseId(caseId, String.valueOf(roomId));
// 新增预约会议表
ReservedConference conference = new ReservedConference(caseId, SecurityUtils.getUserId(), roomId,
null, null);
reservedConferenceMapper.insert(conference);
return String.valueOf(roomId); return String.valueOf(roomId);
} }
@@ -187,7 +196,7 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
// 查询最大房间号 // 查询最大房间号
Long maxRoomId = caseApplicationMapper.selectMaxRoomId(); Long maxRoomId = caseApplicationMapper.selectMaxRoomId();
if (null == maxRoomId || maxRoomId > 4294967294L/2) { if (null == maxRoomId || maxRoomId > 4294967294L) {
return 4294967294L/2+1; return 4294967294L/2+1;
} else { } else {
return maxRoomId + 1; return maxRoomId + 1;
@@ -376,6 +385,7 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
* @param reservedConferenceVO * @param reservedConferenceVO
* @return * @return
*/ */
@Transactional
@Override @Override
public AjaxResult htmlToPDF(MsReservedConferenceVO reservedConferenceVO) { public AjaxResult htmlToPDF(MsReservedConferenceVO reservedConferenceVO) {
String currentFileName = System.currentTimeMillis() + ".pdf"; String currentFileName = System.currentTimeMillis() + ".pdf";
@@ -391,10 +401,12 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
// 绑定案件 // 绑定案件
if(convertFlag){ if(convertFlag){
// 删除之前的庭审笔录
caseAttachMapper.deleteCaseAttachByCasedIdAndType(reservedConferenceVO.getCaseId(),AnnexTypeEnum.MEDIATE.getCode());
MsCaseAttach caseAttach = MsCaseAttach.builder().caseAppliId(reservedConferenceVO.getCaseId()) MsCaseAttach caseAttach = MsCaseAttach.builder().caseAppliId(reservedConferenceVO.getCaseId())
.annexName(fileName) .annexName(currentFileName)
.annexPath(RuoYiConfig.getHtml2PDFPath()) .annexPath(fileName)
.annexType(7) .annexType(AnnexTypeEnum.MEDIATE.getCode())
.build(); .build();
caseAttachMapper.save(caseAttach); caseAttachMapper.save(caseAttach);
return AjaxResult.success(); return AjaxResult.success();
@@ -403,8 +415,22 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
} }
} }
public static void main(String[] args) throws Exception{
String htmlContent = "<h1>wangwu</h1><p>喂喂喂</p><h1>zhangsan</h1><p>hello</p><h1>zhangsan</h1><p>我能听到你说话</p><h1>wangwu</h1><p>欧克</p><h1>wangwu</h1><p>关于XXX我有几点想说的,balalalalalal</p><h1>zhangsan</h1><p>看到回复的时刻双方都是华德福额外补充你下次u饿哦是那些二的河南省而很为难啊看的法国队哈哈哈哈哈哈哈哈哈</p> "; // HTML字符串
String outputFileName="D://output.docx";
XWPFDocument document = new XWPFDocument();
XWPFParagraph paragraph = document.createParagraph();
XWPFRun run = paragraph.createRun();
run.setText(htmlContent);
FileOutputStream out = new FileOutputStream(new File(outputFileName));
document.write(out);
out.close();
System.out.printf("生成调解笔录成功");
}
/** /**
* 将视频下载到本地 * 将视频下载到本地
* @param fileUrl 视频路径 * @param fileUrl 视频路径
@@ -10,6 +10,7 @@ import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseLogRecordMapper;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Date;
/** /**
* 案件记录日志文件 * 案件记录日志文件
@@ -45,6 +46,7 @@ public class CaseLogUtils
operLog.setCaseAppliId(caseAppliId); operLog.setCaseAppliId(caseAppliId);
operLog.setCaseNode(caseNode); operLog.setCaseNode(caseNode);
operLog.setNotes(notes); operLog.setNotes(notes);
operLog.setCreateTime(new Date());
caseLogRecordMapper.insert(operLog); caseLogRecordMapper.insert(operLog);
} }
} }