问题修复

This commit is contained in:
hejinbo
2023-09-23 10:51:08 +08:00
parent 5a0d1dbe0b
commit b4549fa2cc
5 changed files with 80 additions and 62 deletions
@@ -26,7 +26,7 @@ public class ArbitrateRecord extends BaseEntity {
/** 审核裁决书意见 */
private String checkOpinion;
/** 裁决书附件id */
private Long annexId;
private Integer annexId;
@@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CaseAttach {
public class CaseAttach {
/**
* 附件id
*/
@@ -3,24 +3,23 @@ package com.ruoyi.wisdomarbitrate.service.impl;
import com.deepoove.poi.config.Configure;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.WordUtil;
import com.ruoyi.wisdomarbitrate.domain.Adjudication;
import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord;
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.*;
import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
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.time.format.DateTimeFormatter;
import java.util.*;
@Service
@@ -31,6 +30,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
private CaseAffiliateMapper caseAffiliateMapper;
@Autowired
private ArbitrateRecordMapper arbitrateRecordMapper;
@Autowired
private CaseAttachMapper caseAttachMapper;
@Override
public AjaxResult createDocument(CaseApplication caseApplication) {
@@ -57,67 +58,89 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
//获取身份类型
int identityType = affiliate.getIdentityType();
if (identityType == 1) { //申请人
datas.put(adjudication.getAppName(), affiliate.getName());
datas.put(adjudication.getAppSex(), null);
datas.put(adjudication.getAppIDNo(), affiliate.getIdentityNum());
datas.put(adjudication.getAppAddress(), affiliate.getContactAddress());
datas.put(adjudication.getAppAgentName(), affiliate.getNameAgent());
datas.put(adjudication.getAppAgentIDNo(),affiliate.getIdentityNumAgent());
datas.put("appName", affiliate.getName());
datas.put("appSex", null);
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(adjudication.getResName(), affiliate.getName());
datas.put(adjudication.getResSex(), null);
datas.put(adjudication.getResIDNo(), affiliate.getIdentityNum());
datas.put(adjudication.getResAddress(), affiliate.getContactAddress());
datas.put(adjudication.getResAgentName(), affiliate.getNameAgent());
datas.put(adjudication.getResAgentName(),affiliate.getIdentityNumAgent());
datas.put("resName", affiliate.getName());
datas.put("resSex", null);
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(adjudication.getCaseName(),caseApplication1.getCaseName());
datas.put(adjudication.getArbitratorName(),arbitratorName);
datas.put("caseName",caseApplication1.getCaseName());
datas.put("arbitratorName",arbitratorName);
LocalDate localDate = caseApplication1.getHearDate()
.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate();
datas.put(adjudication.getHearYear(), localDate.getYear());
datas.put(adjudication.getHearMonths(), localDate.getMonthValue());
datas.put(adjudication.getHearDay(), localDate.getDayOfMonth());
datas.put(adjudication.getAppArbitrationClaims(), null);
datas.put(adjudication.getAppEvidenceName(), null);
datas.put(adjudication.getAppProveFacts(), null);
datas.put(adjudication.getResDefenseContentToApp(), null);
datas.put(adjudication.getResArbitrationClaims(), null);
datas.put(adjudication.getResEvidenceName(), null);
datas.put(adjudication.getResProveFacts(), null);
datas.put(adjudication.getAppDefenseContentToRes(), null);
datas.put(adjudication.getEvidenDetermi(), arbitrateRecord1.getEvidenDetermi());
datas.put(adjudication.getFactDetermi(), arbitrateRecord1.getFactDetermi());
datas.put(adjudication.getCaseSketch(), arbitrateRecord1.getCaseSketch());
datas.put(adjudication.getArbitrateThink(), arbitrateRecord1.getArbitrateThink());
datas.put(adjudication.getLegalProvisions(), null);
datas.put(adjudication.getRulingFollows(), arbitrateRecord1.getRulingFollows());
datas.put(adjudication.getUmpire(), null);
datas.put("hearYear", localDate.getYear());
datas.put("hearMonths", localDate.getMonthValue());
datas.put("hearDay", localDate.getDayOfMonth());
datas.put("appArbitrationClaims", null);
datas.put("appEvidenceName", null);
datas.put("appProveFacts", null);
datas.put("resDefenseContentToApp", null);
datas.put("resArbitrationClaims", null);
datas.put("resEvidenceName", null);
datas.put("resProveFacts", null);
datas.put("appDefenseContentToRes", null);
datas.put("evidenDetermi", arbitrateRecord1.getEvidenDetermi());
datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
datas.put("caseSketch", arbitrateRecord1.getCaseSketch());
datas.put("arbitrateThink", arbitrateRecord1.getArbitrateThink());
datas.put("legalProvisions", null);
datas.put("rulingFollows", arbitrateRecord1.getRulingFollows());
datas.put("umpire", null);
if (arbitratorName.contains(",")){
String[] nameArray = arbitratorName.split(",");
String firstName = nameArray[0];
String secondName = nameArray[1];
datas.put(adjudication.getArbitratorName1(), firstName);
datas.put(adjudication.getArbitratorName2(), secondName);
datas.put("arbitratorName1", firstName);
datas.put("arbitratorName2", secondName);
}else {
String secondName = "";
datas.put(adjudication.getArbitratorName1(), arbitratorName);
datas.put(adjudication.getArbitratorName2(), secondName);
datas.put("arbitratorName1", arbitratorName);
datas.put("arbitratorName2", secondName);
}
LocalDate now = LocalDate.now();
datas.put(adjudication.getYear(), now.getYear());
datas.put(adjudication.getMonths(), now.getMonthValue());
datas.put(adjudication.getDay(), now.getDayOfMonth());
datas.put(adjudication.getClerk(), null);
String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
datas.put("year", now.getYear());
datas.put("months", now.getMonthValue());
datas.put("day", now.getDayOfMonth());
datas.put("clerk", null);
String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
String currentDateStr = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String saveFolderPath = "/data/arbitrate-document/formal/" + currentDateStr;
// 创建日期目录
File saveFolder = new File(saveFolderPath);
if (!saveFolder.exists()) {
saveFolder.mkdirs();
}
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
String resultFilePath = "D:/data/" + fileName;
String resultFilePath = saveFolderPath+ fileName;
String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
//将裁决书保存到附件表里
CaseAttach caseAttach = CaseAttach.builder()
.caseAppliId(id)
.annexName(fileName)
.annexPath(docFilePath)
.annexType(3)
.build();
int i = caseAttachMapper.save(caseAttach);
if (i>0){
Integer annexId = caseAttach.getAnnexId();
//将附件id保存到仲裁记录表里面
arbitrateRecord1.setAnnexId(annexId);
arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
}
return AjaxResult.success("裁决书保存路径为" + docFilePath);
} catch (IOException e) {
e.printStackTrace();
@@ -40,15 +40,10 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
int arbitratMethod = caseApplication1.getArbitratMethod();
String caseNum = caseApplication1.getCaseNum();
if (opinion==0){ //拒绝
switch (arbitratMethod) {
case 1:
caseApplication1.setArbitratMethod(2); // 更改仲裁方式
break;
case 2:
caseApplication1.setArbitratMethod(1);
break;
default:
return AjaxResult.error();
if (arbitratMethod == 2){
caseApplication1.setArbitratMethod(1); // 更改仲裁方式
}else {
caseApplication1.setArbitratMethod(2);
}
}
//修改案件状态为待开庭