实现生成庭审笔录

This commit is contained in:
qitz
2023-10-15 10:16:48 +08:00
parent c21e092c89
commit 6b56829d92
10 changed files with 276 additions and 10 deletions
@@ -101,6 +101,16 @@ public class CaseApplication extends BaseEntity {
/** 案件描述 */
private String caseDescribe;
/** 裁决书URL */
private String filearbitraUrl;
public String getFilearbitraUrl() {
return filearbitraUrl;
}
public void setFilearbitraUrl(String filearbitraUrl) {
this.filearbitraUrl = filearbitraUrl;
}
/** 是否同意组庭 */
private Integer isAgreePendTral;
@@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
import java.util.List;
@@ -14,4 +15,7 @@ public interface CaseAttachMapper {
int updateCaseAttach(CaseAttach caseAttach);
int updateCaseAttachBycaseid(CaseAttach caseAttach);
}
@@ -1,6 +1,8 @@
package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
@@ -46,4 +48,6 @@ public interface ICaseApplicationService {
SealSignRecord selectSignUrl(CaseApplication caseApplication) throws EsignDemoException;
SealSignRecord selectSealUrl(CaseApplication caseApplication) throws EsignDemoException;
AjaxResult creatTrialRecord(ArbitrateRecord arbitrateRecord);
}
@@ -56,6 +56,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
private ICaseLogRecordService caseLogRecordService;
@Override
@Transactional
public AjaxResult createDocument(CaseApplication caseApplication) {
try {
Map<String, Object> datas = new HashMap<>();
@@ -125,10 +126,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("year", year);
datas.put("months", month);
datas.put("day", day);
String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
//String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
//String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
// String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
// String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
String resultFilePath = saveFolderPath + "/" + fileName;
@@ -20,6 +20,7 @@ import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.WordUtil;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
@@ -44,8 +45,14 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -75,6 +82,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
private SysUserMapper sysUserMapper;
@Autowired
private SealSignRecordMapper sealSignRecordMapper;
@Autowired
private CaseLogRecordMapper caseLogRecordMapper;
// 手机号正则
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}$");
@@ -968,6 +977,171 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
return sealSignRecordReslt;
}
@Override
@Transactional
public AjaxResult creatTrialRecord(ArbitrateRecord arbitrateRecordselect) {
//生成仲裁结果
CaseApplication caseApplicationselect = new CaseApplication();
caseApplicationselect.setId(arbitrateRecordselect.getCaseAppliId());
CaseApplication caseApplication = caseApplicationMapper.selectCaseApplication(caseApplicationselect);
String createBy = caseApplication.getCreateBy();
if (createBy!=null){
arbitrateRecordselect.setCreateBy(createBy);
}
//先判断案件是否已经提交过仲裁结果
ArbitrateRecord arbitrateRecordsele = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecordselect);
if (arbitrateRecordsele!=null){
int i = arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecordselect);
if (i>0){
//案件日志表里添加数据
CaseLogRecord caseLogRecord = new CaseLogRecord();
caseLogRecord.setCaseAppliId(caseApplication.getId());
caseLogRecord.setCaseNode(caseApplication.getCaseStatus());
if (createBy!=null){
caseLogRecord.setCreateBy(createBy);
}
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.GENERATED_ARBITRATION,"");
}
}else {
//提交仲裁结果
int i = arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecordselect);
if (i>0){
//案件日志表里添加数据
CaseLogRecord caseLogRecord = new CaseLogRecord();
caseLogRecord.setCaseAppliId(caseApplication.getId());
caseLogRecord.setCaseNode(caseApplication.getCaseStatus());
if (createBy!=null){
caseLogRecord.setCreateBy(createBy);
}
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.GENERATED_ARBITRATION,"");
}
}
//生成庭审笔录
try {
Map<String, Object> datas = new HashMap<>();
Long id = caseApplication.getId();
if (id == null) {
return null;
}
//获取仲裁记录表里的相关信息
ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
arbitrateRecord.setCaseAppliId(id);
ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
//获取案件关联人信息
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(id);
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if (caseAffiliates != null && caseAffiliates.size() > 0) {
for (CaseAffiliate affiliate : caseAffiliates) {
//获取身份类型
int identityType = affiliate.getIdentityType();
if (identityType == 1) { //申请人
datas.put("appName", affiliate.getName());
datas.put("appIDNo", affiliate.getIdentityNum());
datas.put("appAddress", affiliate.getContactAddress());
datas.put("appAgentName", affiliate.getNameAgent());
datas.put("appAgentIDNo", affiliate.getIdentityNumAgent());
} else if (identityType == 2) { //被申请人
datas.put("resName", affiliate.getName());
datas.put("resIDNo", affiliate.getIdentityNum());
datas.put("resAddress", affiliate.getContactAddress());
datas.put("resAgentName", affiliate.getNameAgent());
datas.put("resAgentIDNo", affiliate.getIdentityNumAgent());
}
}
}
String arbitratorName = caseApplication.getArbitratorName();
datas.put("caseName", caseApplication.getCaseName());
datas.put("arbitratorName", arbitratorName);
Date hearDate = caseApplication.getHearDate();
if (hearDate != null) {
LocalDate localDate = hearDate.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate();
datas.put("hearYear", localDate.getYear());
datas.put("hearMonths", localDate.getMonthValue());
datas.put("hearDay", localDate.getDayOfMonth());
} else {
datas.put("hearYear", null);
datas.put("hearMonths", null);
datas.put("hearDay", null);
}
datas.put("appArbitrationClaims", caseApplication.getArbitratClaims());
if (arbitrateRecord1 != null) {
datas.put("evidenDetermi", arbitrateRecord1.getEvidenDetermi());
datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
datas.put("caseSketch", arbitrateRecord1.getCaseSketch());
datas.put("arbitrateThink", arbitrateRecord1.getArbitrateThink());
datas.put("rulingFollows", arbitrateRecord1.getRulingFollows());
}
datas.put("legalProvisions", "仲裁法");
LocalDate now = LocalDate.now();
String year = Integer.toString(now.getYear());
String month = String.format("%02d", now.getMonthValue());
String day = String.format("%02d", now.getDayOfMonth());
datas.put("year", year);
datas.put("months", month);
datas.put("day", day);
String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
// String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
// String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
String resultFilePath = saveFolderPath + "/" + fileName;
// 创建日期目录
File saveFolder = new File(saveFolderPath);
if (!saveFolder.exists()) {
saveFolder.mkdirs();
}
Path sourcePath = new File(modalFilePath).toPath();
Path destinationPath = new File(resultFilePath).toPath();
Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
// String savePath = saveFolderPath;
// saveName = fileName;
//将庭审笔录保存到附件表里
CaseAttach caseAttach = CaseAttach.builder()
.caseAppliId(id)
.annexName(saveName)
.annexPath(savePath)
.annexType(7)
.build();
int i = caseAttachMapper.save(caseAttach);
if (i > 0) {
if (arbitrateRecord1 != null) {
Integer annexId = caseAttach.getAnnexId();
//将附件id保存到仲裁记录表里面
arbitrateRecord1.setAnnexId(annexId);
arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
}
}
//获取案件详细信息
CaseApplication caseApplicationSelct = caseApplicationMapper.selectCaseApplication(caseApplication);
return AjaxResult.success(caseApplicationSelct);
} catch (IOException e) {
e.printStackTrace();
return AjaxResult.error("生成庭审笔录异常");
}
}
@Override
@Transactional
public int pendTralSure(CaseApplication caseApplication) {
@@ -4,18 +4,23 @@ import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.constant.FileTransformation;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
import com.ruoyi.wisdomarbitrate.mapper.SealSignRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.List;
import java.util.UUID;
@Component
public class FixSelectFlowDetailUtils {
@@ -24,8 +29,10 @@ public class FixSelectFlowDetailUtils {
private CaseApplicationMapper caseApplicationMapper;
@Autowired
private SealSignRecordMapper sealSignRecordMapper;
@Autowired
private CaseAttachMapper caseAttachMapper;
@Scheduled(cron = "0/3 * * * * ?")
// @Scheduled(cron = "0/3 * * * * ?")
public void fixExecuteSelectFlowDetailUtils() throws EsignDemoException {
Gson gson = new Gson();
@@ -83,8 +90,6 @@ public class FixSelectFlowDetailUtils {
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
if(caseApplicationselect.getCaseStatus().intValue()==CaseApplicationConstants.ARBITRATED_SEAL){
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
caseApplicationMapper.submitCaseApplication(caseApplication);
//下载审核完成的裁决书,
String signFlowId = sealSignRecord.getSignFlowid();
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
@@ -96,8 +101,11 @@ public class FixSelectFlowDetailUtils {
String fileDownloadUrl = fileObject.get("downloadUrl").toString();
//修改"签署用印记录表"的状态为签署完成
sealSignRecord.setSignFlowStatus(3);
sealSignRecord.setFileDownloadUrl(fileDownloadUrl);
sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1,fileDownloadUrl.length()-1));
sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
String filearbitraUrl = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1);
caseApplication.setFilearbitraUrl(filearbitraUrl);
caseApplicationMapper.submitCaseApplication(caseApplication);
}
}