问题修复

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; private String checkOpinion;
/** 裁决书附件id */ /** 裁决书附件id */
private Long annexId; private Integer annexId;
@@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class CaseAttach { public class CaseAttach {
/** /**
* 附件id * 附件id
*/ */
@@ -3,24 +3,23 @@ package com.ruoyi.wisdomarbitrate.service.impl;
import com.deepoove.poi.config.Configure; import com.deepoove.poi.config.Configure;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.WordUtil; import com.ruoyi.common.utils.WordUtil;
import com.ruoyi.wisdomarbitrate.domain.Adjudication; import com.ruoyi.wisdomarbitrate.domain.*;
import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord;
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper; import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper; import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
import org.apache.poi.xwpf.usermodel.*; import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.FileInputStream; import java.io.*;
import java.io.FileOutputStream; import java.nio.file.Files;
import java.io.IOException; import java.nio.file.Path;
import java.io.InputStream; import java.nio.file.StandardCopyOption;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
@Service @Service
@@ -31,6 +30,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
private CaseAffiliateMapper caseAffiliateMapper; private CaseAffiliateMapper caseAffiliateMapper;
@Autowired @Autowired
private ArbitrateRecordMapper arbitrateRecordMapper; private ArbitrateRecordMapper arbitrateRecordMapper;
@Autowired
private CaseAttachMapper caseAttachMapper;
@Override @Override
public AjaxResult createDocument(CaseApplication caseApplication) { public AjaxResult createDocument(CaseApplication caseApplication) {
@@ -57,67 +58,89 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
//获取身份类型 //获取身份类型
int identityType = affiliate.getIdentityType(); int identityType = affiliate.getIdentityType();
if (identityType == 1) { //申请人 if (identityType == 1) { //申请人
datas.put(adjudication.getAppName(), affiliate.getName()); datas.put("appName", affiliate.getName());
datas.put(adjudication.getAppSex(), null); datas.put("appSex", null);
datas.put(adjudication.getAppIDNo(), affiliate.getIdentityNum()); datas.put("appIDNo", affiliate.getIdentityNum());
datas.put(adjudication.getAppAddress(), affiliate.getContactAddress()); datas.put("appAddress", affiliate.getContactAddress());
datas.put(adjudication.getAppAgentName(), affiliate.getNameAgent()); datas.put("appAgentName", affiliate.getNameAgent());
datas.put(adjudication.getAppAgentIDNo(),affiliate.getIdentityNumAgent()); datas.put("appAgentIDNo",affiliate.getIdentityNumAgent());
}else if (identityType == 2){ //被申请人 }else if (identityType == 2){ //被申请人
datas.put(adjudication.getResName(), affiliate.getName()); datas.put("resName", affiliate.getName());
datas.put(adjudication.getResSex(), null); datas.put("resSex", null);
datas.put(adjudication.getResIDNo(), affiliate.getIdentityNum()); datas.put("resIDNo", affiliate.getIdentityNum());
datas.put(adjudication.getResAddress(), affiliate.getContactAddress()); datas.put("resAddress", affiliate.getContactAddress());
datas.put(adjudication.getResAgentName(), affiliate.getNameAgent()); datas.put("resAgentName", affiliate.getNameAgent());
datas.put(adjudication.getResAgentName(),affiliate.getIdentityNumAgent()); datas.put("resAgentIDNo",affiliate.getIdentityNumAgent());
} }
} }
} }
String arbitratorName = caseApplication1.getArbitratorName(); String arbitratorName = caseApplication1.getArbitratorName();
datas.put(adjudication.getCaseName(),caseApplication1.getCaseName()); datas.put("caseName",caseApplication1.getCaseName());
datas.put(adjudication.getArbitratorName(),arbitratorName); datas.put("arbitratorName",arbitratorName);
LocalDate localDate = caseApplication1.getHearDate() LocalDate localDate = caseApplication1.getHearDate()
.toInstant() .toInstant()
.atZone(ZoneId.systemDefault()) .atZone(ZoneId.systemDefault())
.toLocalDate(); .toLocalDate();
datas.put(adjudication.getHearYear(), localDate.getYear()); datas.put("hearYear", localDate.getYear());
datas.put(adjudication.getHearMonths(), localDate.getMonthValue()); datas.put("hearMonths", localDate.getMonthValue());
datas.put(adjudication.getHearDay(), localDate.getDayOfMonth()); datas.put("hearDay", localDate.getDayOfMonth());
datas.put(adjudication.getAppArbitrationClaims(), null); datas.put("appArbitrationClaims", null);
datas.put(adjudication.getAppEvidenceName(), null); datas.put("appEvidenceName", null);
datas.put(adjudication.getAppProveFacts(), null); datas.put("appProveFacts", null);
datas.put(adjudication.getResDefenseContentToApp(), null); datas.put("resDefenseContentToApp", null);
datas.put(adjudication.getResArbitrationClaims(), null); datas.put("resArbitrationClaims", null);
datas.put(adjudication.getResEvidenceName(), null); datas.put("resEvidenceName", null);
datas.put(adjudication.getResProveFacts(), null); datas.put("resProveFacts", null);
datas.put(adjudication.getAppDefenseContentToRes(), null); datas.put("appDefenseContentToRes", null);
datas.put(adjudication.getEvidenDetermi(), arbitrateRecord1.getEvidenDetermi()); datas.put("evidenDetermi", arbitrateRecord1.getEvidenDetermi());
datas.put(adjudication.getFactDetermi(), arbitrateRecord1.getFactDetermi()); datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
datas.put(adjudication.getCaseSketch(), arbitrateRecord1.getCaseSketch()); datas.put("caseSketch", arbitrateRecord1.getCaseSketch());
datas.put(adjudication.getArbitrateThink(), arbitrateRecord1.getArbitrateThink()); datas.put("arbitrateThink", arbitrateRecord1.getArbitrateThink());
datas.put(adjudication.getLegalProvisions(), null); datas.put("legalProvisions", null);
datas.put(adjudication.getRulingFollows(), arbitrateRecord1.getRulingFollows()); datas.put("rulingFollows", arbitrateRecord1.getRulingFollows());
datas.put(adjudication.getUmpire(), null); datas.put("umpire", null);
if (arbitratorName.contains(",")){ if (arbitratorName.contains(",")){
String[] nameArray = arbitratorName.split(","); String[] nameArray = arbitratorName.split(",");
String firstName = nameArray[0]; String firstName = nameArray[0];
String secondName = nameArray[1]; String secondName = nameArray[1];
datas.put(adjudication.getArbitratorName1(), firstName); datas.put("arbitratorName1", firstName);
datas.put(adjudication.getArbitratorName2(), secondName); datas.put("arbitratorName2", secondName);
}else { }else {
String secondName = ""; String secondName = "";
datas.put(adjudication.getArbitratorName1(), arbitratorName); datas.put("arbitratorName1", arbitratorName);
datas.put(adjudication.getArbitratorName2(), secondName); datas.put("arbitratorName2", secondName);
} }
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
datas.put(adjudication.getYear(), now.getYear()); datas.put("year", now.getYear());
datas.put(adjudication.getMonths(), now.getMonthValue()); datas.put("months", now.getMonthValue());
datas.put(adjudication.getDay(), now.getDayOfMonth()); datas.put("day", now.getDayOfMonth());
datas.put(adjudication.getClerk(), null); datas.put("clerk", null);
String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx"; 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 fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
String resultFilePath = "D:/data/" + fileName; String resultFilePath = saveFolderPath+ fileName;
String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath); 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); return AjaxResult.success("裁决书保存路径为" + docFilePath);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
@@ -40,15 +40,10 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
int arbitratMethod = caseApplication1.getArbitratMethod(); int arbitratMethod = caseApplication1.getArbitratMethod();
String caseNum = caseApplication1.getCaseNum(); String caseNum = caseApplication1.getCaseNum();
if (opinion==0){ //拒绝 if (opinion==0){ //拒绝
switch (arbitratMethod) { if (arbitratMethod == 2){
case 1: caseApplication1.setArbitratMethod(1); // 更改仲裁方式
caseApplication1.setArbitratMethod(2); // 更改仲裁方式 }else {
break; caseApplication1.setArbitratMethod(2);
case 2:
caseApplication1.setArbitratMethod(1);
break;
default:
return AjaxResult.error();
} }
} }
//修改案件状态为待开庭 //修改案件状态为待开庭
@@ -13,7 +13,7 @@
<result property="userId" column="use_id" /> <result property="userId" column="use_id" />
<result property="userName" column="use_account" /> <result property="userName" column="use_account" />
</resultMap> </resultMap>
<insert id="save"> <insert id="save" useGeneratedKeys="true" keyProperty="annexId">
INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account) INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account)
VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName}) VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName})
</insert> </insert>