11.14批量生成裁决书

This commit is contained in:
hejinbo
2023-11-14 14:42:10 +08:00
parent 0a7bf5b54d
commit dac20a4a04
9 changed files with 144 additions and 171 deletions
@@ -0,0 +1,9 @@
package com.ruoyi.wisdomarbitrate.domain;
import lombok.Data;
import java.util.List;
@Data
public class CaseIds {
private List<Long> ids;
}
@@ -4,13 +4,14 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord;
import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseIds;
import java.util.List;
public interface ICaseArbitrateService {
AjaxResult writtenHear(ArbitrateRecord arbitrateRecord);
AjaxResult writtenHear(CaseIds caseIds);
AjaxResult examineArbitrateMethod(CaseApplication caseApplication, Integer opinion);
}
@@ -147,177 +147,63 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
@Override
@Transactional
public AjaxResult writtenHear(ArbitrateRecord arbitrateRecord) {
//查询案件详情
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(arbitrateRecord.getCaseAppliId());
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
String createBy = arbitrateRecord.getCreateBy();
//先判断案件是否已经提交过仲裁结果
ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
if (arbitrateRecord1 != null) {
int i = arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
if (i > 0) {
//案件日志表里添加数据
CaseLogRecord caseLogRecord = new CaseLogRecord();
caseLogRecord.setCaseAppliId(caseApplication1.getId());
caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
if (createBy != null) {
caseLogRecord.setCreateBy(createBy);
}
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
}
} else {
//提交仲裁结果
int i = arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord);
if (i > 0) {
//案件日志表里添加数据
CaseLogRecord caseLogRecord = new CaseLogRecord();
caseLogRecord.setCaseAppliId(caseApplication1.getId());
caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
if (createBy != null) {
caseLogRecord.setCreateBy(createBy);
}
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
}
}
Boolean aBoolean1 = generateAward(arbitrateRecord);
if (aBoolean1) {
//修改案件状态
caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
if (i > 0) {
return AjaxResult.success("审理成功");
}
}
return AjaxResult.error("裁决书生成有误");
}
//生成庭审笔录
private Boolean generateTrialTranscripts(ArbitrateRecord arbitrateRecord) {
try {
Map<String, Object> datas = new HashMap<>();
Long id = arbitrateRecord.getCaseAppliId();
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(id);
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
//获取案件关联人信息
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 = caseApplication1.getArbitratorName();
datas.put("caseName", caseApplication1.getCaseName());
datas.put("arbitratorName", arbitratorName);
Date hearDate = caseApplication1.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", caseApplication1.getArbitratClaims());
datas.put("evidenDetermi", arbitrateRecord.getEvidenDetermi());
datas.put("factDetermi", arbitrateRecord.getFactDetermi());
datas.put("caseSketch", arbitrateRecord.getCaseSketch());
datas.put("arbitrateThink", arbitrateRecord.getArbitrateThink());
datas.put("rulingFollows", arbitrateRecord.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);
CaseAttach caseAttach = CaseAttach.builder()
.caseAppliId(id)
.annexName(saveName)
.annexPath(savePath)
.annexType(7)
.build();
//保存到附件表里,先判断之前有没有,有的话更新,没有的话新增
CaseAttach caseAttach1 = new CaseAttach();
caseAttach1.setAnnexType(7);
caseAttach1.setCaseAppliId(id);
List<CaseAttach> caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach1);
if (caseAttachList != null && caseAttachList.size() > 0) {
//之前已经生成过了,更新
caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
} else {
//之前没生成过,新增
int i = caseAttachMapper.save(caseAttach);
public AjaxResult writtenHear(CaseIds caseIds) {
if (caseIds!=null){
List<Long> ids = caseIds.getIds();
for (Long caseId : ids) {
//查询案件详情
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(caseId);
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
//先判断案件是否已经提交过仲裁结果
ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
arbitrateRecord.setCaseAppliId(caseId);
ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
if (i > 0) {
if (arbitrateRecord1 != null) {
Integer annexId = caseAttach.getAnnexId();
//将附件id保存到仲裁记录表里面
arbitrateRecord1.setAnnexId(annexId);
arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
if (arbitrateRecord1 != null) {
int i = arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
if (i > 0) {
//案件日志表里添加数据
CaseLogRecord caseLogRecord = new CaseLogRecord();
caseLogRecord.setCaseAppliId(caseApplication1.getId());
caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
caseLogRecord.setCreateBy(getUsername());
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
}
} else {
//提交仲裁结果
int i = arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord);
if (i > 0) {
//案件日志表里添加数据
CaseLogRecord caseLogRecord = new CaseLogRecord();
caseLogRecord.setCaseAppliId(caseApplication1.getId());
caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
caseLogRecord.setCreateBy(getUsername());
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
}
}
Boolean aBoolean1 = generateAward(caseId);
if (aBoolean1) {
//修改案件状态
caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
}else {
return AjaxResult.error("裁决书生成失败");
}
}
return Boolean.TRUE;
} catch (IOException e) {
e.printStackTrace();
return Boolean.FALSE;
return AjaxResult.success("审理成功");
}
return AjaxResult.error("请检查参数");
}
//生成仲裁文书
private Boolean generateAward(ArbitrateRecord arbitrateRecord) {
private Boolean generateAward(Long id) {
try {
Map<String, Object> datas = new HashMap<>();
Long id = arbitrateRecord.getCaseAppliId();
if (id == null) {
return null;
}
@@ -329,6 +215,8 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
String equipmentNo = getNewEquipmentNo();
datas.put("num", equipmentNo);
//获取仲裁记录表里的相关信息
ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
arbitrateRecord.setCaseAppliId(id);
ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
//获取案件关联人信息
CaseAffiliate caseAffiliate = new CaseAffiliate();
@@ -186,6 +186,7 @@ public class FixSelectFlowDetailUtils {
int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
if (realnameStatus == 1) {
String orgId = identifyInfoData.get("orgId").getAsString();
System.out.println("这是orgId"+orgId+"=======================");
EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
//将orgId保存到数据库里
DeptIdentify deptIdentifynew = deptIdentifysnew.get(i);
@@ -355,6 +356,7 @@ public class FixSelectFlowDetailUtils {
}
}
}*/
}