实现提交仲裁结果功能
This commit is contained in:
+1
@@ -36,6 +36,7 @@ public class CaseArbitrateController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/writtenHear")
|
||||
public AjaxResult writtenHear(@Validated @RequestBody ArbitrateRecord arbitrateRecord){
|
||||
arbitrateRecord.setCreateBy(getUsername());
|
||||
return caseArbitrateService.writtenHear(arbitrateRecord);
|
||||
}
|
||||
}
|
||||
|
||||
+122
-22
@@ -2,22 +2,24 @@ package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import com.ruoyi.common.constant.CaseApplicationConstants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.WordUtil;
|
||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.*;
|
||||
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.CaseLogRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.ICaseArbitrateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
||||
@@ -29,6 +31,8 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
||||
private CaseLogRecordMapper caseLogRecordMapper;
|
||||
@Autowired
|
||||
private ArbitrateRecordMapper arbitrateRecordMapper;
|
||||
@Autowired
|
||||
private CaseAttachMapper caseAttachMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -109,15 +113,14 @@ 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 = caseApplication1.getCreateBy();
|
||||
if (createBy!=null){
|
||||
arbitrateRecord.setCreateBy(createBy);
|
||||
}
|
||||
String createBy = arbitrateRecord.getCreateBy();
|
||||
|
||||
//先判断案件是否已经提交过仲裁结果
|
||||
ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
|
||||
if (arbitrateRecord1!=null){
|
||||
@@ -131,13 +134,9 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
||||
caseLogRecord.setCreateBy(createBy);
|
||||
}
|
||||
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
||||
//修改案件状态
|
||||
caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION);
|
||||
caseApplicationMapper.submitCaseApplication(caseApplication);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.GENERATED_ARBITRATION,"");
|
||||
|
||||
return AjaxResult.success("提交成功");
|
||||
}
|
||||
}else {
|
||||
//提交仲裁结果
|
||||
@@ -152,15 +151,116 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
||||
caseLogRecord.setCreateBy(createBy);
|
||||
}
|
||||
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
||||
//修改案件状态
|
||||
caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION);
|
||||
caseApplicationMapper.submitCaseApplication(caseApplication);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.GENERATED_ARBITRATION,"");
|
||||
|
||||
return AjaxResult.success("提交成功");
|
||||
}
|
||||
}
|
||||
return AjaxResult.error("暂无需要提交仲裁结果的案件");
|
||||
|
||||
//生成庭审笔录
|
||||
try {
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
Long id = caseApplication.getId();
|
||||
|
||||
|
||||
//获取案件关联人信息
|
||||
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());
|
||||
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);
|
||||
|
||||
//修改案件状态
|
||||
caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
|
||||
caseApplicationMapper.submitCaseApplication(caseApplication1);
|
||||
|
||||
//将裁决书保存到附件表里
|
||||
CaseAttach caseAttach = CaseAttach.builder()
|
||||
.caseAppliId(id)
|
||||
.annexName(saveName)
|
||||
.annexPath(savePath)
|
||||
.annexType(3)
|
||||
.build();
|
||||
int i = caseAttachMapper.save(caseAttach);
|
||||
if (i > 0) {
|
||||
if (arbitrateRecord1 != null) {
|
||||
Integer annexId = caseAttach.getAnnexId();
|
||||
//将附件id保存到仲裁记录表里面
|
||||
arbitrateRecord1.setAnnexId(annexId);
|
||||
arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("裁决书已生成");
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("裁决书生成异常");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user