压缩包上传,裁决书生成,案件修改,修改后对比信息
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,13 @@ public class ColumnValue {
|
||||
* 案件id
|
||||
*/
|
||||
private Long caseId;
|
||||
|
||||
/**
|
||||
* 是否为自定义字段,0-否,1-是
|
||||
*/
|
||||
private Integer isDefault;
|
||||
/**
|
||||
* 案件日志表id
|
||||
*/
|
||||
private Long caseAppliLogId;
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@ public class CompareCaseVO {
|
||||
* 变化字段,多个用,拼接
|
||||
*/
|
||||
private String changeColumn;
|
||||
|
||||
/**
|
||||
* 自定义字段变化字段,多个用,拼接
|
||||
*/
|
||||
private String columnValueChangeColumn;
|
||||
|
||||
}
|
||||
|
||||
+3
-9
@@ -118,17 +118,11 @@ public interface CaseApplicationMapper {
|
||||
*/
|
||||
void updateVersionById(@Param("id")Long id, @Param("version")Integer version);
|
||||
|
||||
/**
|
||||
* 查询秘书案件
|
||||
* @param caseApplication
|
||||
* @return
|
||||
*/
|
||||
List<CaseApplication> selectSecretaryCase(CaseApplication caseApplication);
|
||||
|
||||
/**
|
||||
* 查询申请人案件
|
||||
* @param caseApplication
|
||||
* 查询最大批号
|
||||
* @return
|
||||
*/
|
||||
List<CaseApplication> selectApplicationCase(CaseApplication caseApplication);
|
||||
Integer selectBatchNumberLike();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ruoyi.wisdomarbitrate.mapper;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 动态配置字段表
|
||||
*/
|
||||
@Repository
|
||||
public interface ColumnValueLogMapper {
|
||||
|
||||
/**
|
||||
* 批量新增
|
||||
*/
|
||||
void batchSave(@Param("list") List<ColumnValue> list);
|
||||
void batchUpdate(@Param("list") List<ColumnValue> list);
|
||||
|
||||
/**
|
||||
* 根据案件id查询字段及值
|
||||
* @param caseId
|
||||
* @return
|
||||
*/
|
||||
List<ColumnValue> listBycaseAppliLogId(@Param("caseId") Long caseId);
|
||||
|
||||
List<ColumnValue> queryColumnValueList(ColumnValue columnValue);
|
||||
}
|
||||
@@ -27,4 +27,9 @@ public interface ColumnValueMapper {
|
||||
List<ColumnValue> listByCaseId(@Param("caseId") Long caseId);
|
||||
|
||||
List<ColumnValue> queryColumnValueList(ColumnValue columnValue);
|
||||
/**
|
||||
* 批量修改
|
||||
*/
|
||||
void batchUpdate(@Param("list") List<ColumnValue> list);
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.service;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.exception.EsignDemoException;
|
||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount;
|
||||
@@ -18,7 +19,7 @@ public interface ICaseApplicationService {
|
||||
List<CaseApplication> selectCaseApplicationListByRole(CaseApplication caseApplication);
|
||||
|
||||
|
||||
int insertcaseApplication(CaseApplication caseApplication, Map<String,String> fatchMap);
|
||||
int insertcaseApplication(CaseApplication caseApplication, List<ColumnValue> columnValueList);
|
||||
|
||||
int selectCaseApplicationCount(CaseApplication caseApplication);
|
||||
|
||||
|
||||
+367
-220
@@ -7,15 +7,14 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.ruoyi.common.constant.CaseApplicationConstants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.common.utils.*;
|
||||
import com.ruoyi.system.mapper.SysDictDataMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.*;
|
||||
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
||||
import com.ruoyi.common.utils.EmailOutUtil;
|
||||
import com.ruoyi.common.utils.WordUtil;
|
||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ArchivesDetailVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO;
|
||||
@@ -49,6 +48,7 @@ import java.text.NumberFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -84,6 +84,11 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
||||
private TemplateManageMapper templateManageMapper;
|
||||
@Autowired
|
||||
private ColumnValueMapper columnValueMapper;
|
||||
@Autowired
|
||||
private FatchRuleMapper fatchRuleMapper;
|
||||
@Autowired
|
||||
private SysDictDataMapper dictDataMapper;
|
||||
|
||||
// 仲裁反请求模板内容
|
||||
private final String counterclaim= "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" +
|
||||
"《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" +
|
||||
@@ -123,246 +128,105 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
||||
// 被申请人缺席
|
||||
String resAbsent="(二)当事人提供的证据材料\n" +
|
||||
"申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:\n{{applicantFile}}";
|
||||
// 日期格式化年月日
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult createDocument(CaseApplication caseApplicationReq) {
|
||||
String templatePath="";
|
||||
String templateName="";
|
||||
String agentName="";
|
||||
String resName="";
|
||||
String templatePath = "";
|
||||
String templateName = "";
|
||||
String agentName = "";
|
||||
String resName = "";
|
||||
try {
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
Long id = caseApplicationReq.getId();
|
||||
if (id == null) {
|
||||
return AjaxResult.error("案件id不能为空");
|
||||
}
|
||||
|
||||
//获取案件详细信息
|
||||
CaseApplication caseApplicationById = caseApplicationService.selectCaseApplication(caseApplicationReq);
|
||||
|
||||
if(caseApplicationById==null){
|
||||
if (caseApplicationById == null) {
|
||||
return AjaxResult.error("案件不存在");
|
||||
}
|
||||
// 根据模板id查找对应的模板
|
||||
if(caseApplicationById.getTemplateId()!=null) {
|
||||
TemplateManage templateManage = new TemplateManage();
|
||||
templateManage.setId(caseApplicationById.getTemplateId());
|
||||
List<TemplateManage> templateManages = templateManageMapper.selectTemplateList(templateManage);
|
||||
if(CollectionUtil.isEmpty(templateManages)){
|
||||
return AjaxResult.error("请先指定裁决书模板");
|
||||
}
|
||||
templatePath=templateManages.get(0).getTemOrigPath();
|
||||
templateName=templateManages.get(0).getFileName();
|
||||
|
||||
if (caseApplicationById.getTemplateId() == null) {
|
||||
return AjaxResult.error("请先指定裁决书模板");
|
||||
}
|
||||
// 根据模板id查找对应的模板
|
||||
TemplateManage templateManage = new TemplateManage();
|
||||
templateManage.setId(caseApplicationById.getTemplateId());
|
||||
List<TemplateManage> templateManages = templateManageMapper.selectTemplateList(templateManage);
|
||||
if (CollectionUtil.isEmpty(templateManages)) {
|
||||
return AjaxResult.error("请先指定裁决书模板");
|
||||
}
|
||||
templatePath = templateManages.get(0).getTemOrigPath();
|
||||
templateName = templateManages.get(0).getFileName();
|
||||
// 查询案件相关表信息
|
||||
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
||||
caseAffiliate.setCaseAppliId(id);
|
||||
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
|
||||
//获取仲裁记录表里的相关信息
|
||||
ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
|
||||
arbitrateRecord.setCaseAppliId(id);
|
||||
ArbitrateRecord arbitrateRecordSelect = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
|
||||
// 在系统表中查询案件内置字段
|
||||
SysDictData sysDictData = new SysDictData();
|
||||
sysDictData.setDictType("case_built_type");
|
||||
List<SysDictData> dictDataList = dictDataMapper.selectDictDataList(sysDictData);
|
||||
// 根据模板id查询抓取规则,判断从主表取值还是从columnValue值取
|
||||
List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(caseApplicationById.getTemplateId());
|
||||
// 抓取规则,0-内置字段,1-自定义字段
|
||||
Map<Integer, List<FatchRule>> fatchRuleMap = new HashMap<>();
|
||||
// 裁决书需要的字段和内容,占位符需要配置成中文
|
||||
Map<String, String> valueMap = new HashMap<>();
|
||||
// 如果未设置抓取规则,则从主表取数据,设置内置字段值
|
||||
if (CollectionUtil.isNotEmpty(fatchRuleList)) {
|
||||
fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getIsDefault));
|
||||
}
|
||||
// 自定义字段,从columnValue值取
|
||||
if (fatchRuleMap.size()>0&&fatchRuleMap.containsKey(1)) {
|
||||
// 根据案件id查询key-value表
|
||||
List<ColumnValue> columnValueList = columnValueMapper.listByCaseId(caseApplicationReq.getId());
|
||||
if (CollectionUtil.isNotEmpty(columnValueList)) {
|
||||
columnValueList.forEach(columnValue -> valueMap.put(columnValue.getName(), columnValue.getValue()));
|
||||
}
|
||||
}
|
||||
// 组装内置字段,在主表中查出内容
|
||||
buildDefaultColumnValue(dictDataList,caseAffiliates,valueMap,caseApplicationById);
|
||||
|
||||
// todo 获取模板中的所有占位符,该占位符字段必须和抓取字段一致,暂时写死
|
||||
// todo 生成裁决书的内容从key-value表中取,不从案件基本信息表取,会有问题,如果修改的话会有问题,暂不考虑该情况
|
||||
|
||||
// 根据案件id查询key-value表
|
||||
List<ColumnValue> columnValueList = columnValueMapper.listByCaseId(caseApplicationReq.getId());
|
||||
// 获取模板中的占位符key
|
||||
List<String> bookmarkList = getBookmarkByDocx(templatePath);
|
||||
if(CollectionUtil.isEmpty(bookmarkList)){
|
||||
if (CollectionUtil.isEmpty(bookmarkList)) {
|
||||
// 直接保存模板为裁决书
|
||||
saveArbitorFile(id,templateName,templatePath,caseApplicationById,arbitrateRecordSelect);
|
||||
saveArbitorFile(id, templateName, templatePath, caseApplicationById, arbitrateRecordSelect);
|
||||
return AjaxResult.success("生成裁决书成功");
|
||||
}
|
||||
// 如果该表没值,在从主表填充裁决书模板
|
||||
if(CollectionUtil.isNotEmpty(columnValueList)){
|
||||
Map<String, String> columnValueMap = columnValueList.stream().collect(Collectors.toMap(ColumnValue::getColumn, ColumnValue::getValue));
|
||||
agentName=columnValueMap.get("agentName");
|
||||
resName=columnValueMap.get("respondentName");
|
||||
// 懒得if,暂时这样
|
||||
//
|
||||
for (String bookmark : bookmarkList) {
|
||||
if(columnValueMap.containsKey(bookmark)){
|
||||
if(bookmark.equals("resSex")){
|
||||
String responSex = columnValueMap.get(bookmark);
|
||||
if (responSex.equals("0")) {
|
||||
datas.put(bookmark, "男");
|
||||
} else {
|
||||
datas.put(bookmark, "女");
|
||||
}
|
||||
}else if(bookmark.equals("arbitratClaims")){
|
||||
// 请求仲裁庭裁决
|
||||
String arbitratClaims = columnValueMap.get(bookmark);
|
||||
if(StrUtil.isNotEmpty(arbitratClaims)){
|
||||
String replace = arbitratClaims.replace("甲方", "被申请人").replace("乙方", "申请人");
|
||||
datas.put("arbitratClaims", replace);
|
||||
|
||||
}else {
|
||||
datas.put("arbitratClaims", "");
|
||||
}
|
||||
}else if(bookmark.equals("mediationAgreement")){
|
||||
// 查询本案事实如下
|
||||
String mediationAgreement = columnValueMap.get(bookmark);
|
||||
if(StrUtil.isNotEmpty(mediationAgreement)){
|
||||
String replace = mediationAgreement.replace("甲方", "被申请人").replace("乙方", "申请人");
|
||||
datas.put("mediationAgreement", replace);
|
||||
|
||||
}else {
|
||||
datas.put("mediationAgreement", "");
|
||||
}
|
||||
}
|
||||
else {
|
||||
datas.put(bookmark, columnValueMap.get(bookmark));
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
|
||||
}
|
||||
|
||||
// 遍历书签,给书签赋值
|
||||
replaceBookmark(bookmarkList,datas,valueMap);
|
||||
// 根据条件替换书签
|
||||
conditionReplaceBookmark(caseApplicationById,datas,agentName,resName,arbitrateRecordSelect);
|
||||
// 裁决书生成时间
|
||||
LocalDate now = LocalDate.now();
|
||||
String year = Integer.toString(now.getYear());
|
||||
datas.put("year", year);
|
||||
datas.put("裁决书生成时间", year);
|
||||
//生成编码
|
||||
String equipmentNo = getNewEquipmentNo();
|
||||
// 裁决书编号
|
||||
datas.put("num", equipmentNo);
|
||||
datas.put("裁决书编号", equipmentNo);
|
||||
// 仲裁费
|
||||
datas.put("arbitrationFee", caseApplicationById.getFeePayable().toString());
|
||||
datas.put("仲裁费", caseApplicationById.getFeePayable().toString());
|
||||
// 案件创建时间
|
||||
Date createTime = caseApplicationById.getCreateTime();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
|
||||
// 将日期格式化为字符串
|
||||
String createTimeStr = sdf.format(createTime);
|
||||
datas.put("submissionDate", createTimeStr);
|
||||
datas.put("案件创建时间", createTimeStr);
|
||||
// 立案日期
|
||||
Date registerDate = caseApplicationById.getRegisterDate();
|
||||
String registerDateStr = sdf.format(registerDate);
|
||||
datas.put("acceptDate", registerDateStr);
|
||||
|
||||
// 如果有仲裁反请求,该字段设置值
|
||||
Integer adjudicaCounter = caseApplicationById.getAdjudicaCounter();
|
||||
if (adjudicaCounter!=null&&adjudicaCounter == 1) {
|
||||
datas.put("counterclaim", counterclaim);
|
||||
}
|
||||
//财产保全
|
||||
Integer properPreser = caseApplicationById.getProperPreser();
|
||||
if (properPreser!=null&&properPreser == 1) {
|
||||
datas.put("preservation", preservation);
|
||||
}
|
||||
//管辖权异议
|
||||
Integer objectiJuris = caseApplicationById.getObjectiJuris();
|
||||
if (objectiJuris!=null&&objectiJuris == 1) {
|
||||
datas.put("jurisdictionalObjection", jurisdictionalObjection);
|
||||
}
|
||||
|
||||
// 出席庭审人员角色名称
|
||||
String attendName="秘书、";
|
||||
boolean isAbsenceFlag = caseApplicationById.getIsAbsence() != null && caseApplicationById.getIsAbsence().equals(0);
|
||||
boolean appIsAbsenceFlag = caseApplicationById.getAppliIsAbsen() != null && caseApplicationById.getAppliIsAbsen().equals(0);
|
||||
if(isAbsenceFlag||appIsAbsenceFlag){
|
||||
if(isAbsenceFlag) {
|
||||
attendName += "申请代理人" + agentName+"、";
|
||||
}
|
||||
if(appIsAbsenceFlag) {
|
||||
attendName += "被申请人" + resName;
|
||||
}
|
||||
if(attendName.endsWith("、")){
|
||||
attendName=attendName.replace("、","");
|
||||
}
|
||||
datas.put("attendName", attendName);
|
||||
}
|
||||
|
||||
// 仲裁员名称
|
||||
datas.put("arbitratorName", caseApplicationById.getArbitratorName());
|
||||
// 审理方式
|
||||
Integer arbitratMethod = caseApplicationById.getArbitratMethod();
|
||||
Date hearDate = caseApplicationById.getHearDate();
|
||||
if (hearDate != null) {
|
||||
// 审理日期
|
||||
String hearDateStr = sdf.format(hearDate);
|
||||
datas.put("hearDate",hearDateStr);
|
||||
// todo 线上仲裁/线下仲裁方式未选择
|
||||
//线上开庭时
|
||||
if (arbitratMethod == 1) {
|
||||
String replace = onLine.replace(onLineDate, Optional.ofNullable(hearDateStr).orElse(""));
|
||||
datas.put("onLine", replace);
|
||||
|
||||
} else {
|
||||
//书面仲裁时
|
||||
String replace = written.replace(writtenDate, Optional.ofNullable(hearDateStr).orElse(""));
|
||||
datas.put("written", replace);
|
||||
|
||||
}
|
||||
}
|
||||
// 所有附件
|
||||
List<CaseAttach> caseAttachList = caseApplicationById.getCaseAttachList();
|
||||
Map<Integer, List<CaseAttach>> caseAttachMap=new HashMap<>();
|
||||
if(caseAttachList!=null&&caseAttachList.size()>0){
|
||||
caseAttachMap = caseAttachList.stream().collect(Collectors.groupingBy(CaseAttach::getAnnexType));
|
||||
}
|
||||
// 被申请人是否缺席
|
||||
Integer isAbsence = caseApplicationById.getIsAbsence();
|
||||
// 线上开庭
|
||||
if (arbitratMethod == 1) {
|
||||
if (isAbsence != null && isAbsence == 1) {
|
||||
// 被申请人缺席
|
||||
String absentReplace = absent.replace("{{agentName}}", Optional.ofNullable(agentName).orElse(""));
|
||||
datas.put("absent",absentReplace);
|
||||
// 被申请人缺席
|
||||
String resAbsentReplace=resAbsent;
|
||||
if(caseAttachMap!=null && CollectionUtil.isNotEmpty(caseAttachMap.get(2))){
|
||||
List<CaseAttach> caseAttaches = caseAttachMap.get(2);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (CaseAttach caseAttach : caseAttaches) {
|
||||
stringBuilder.append(caseAttach.getAnnexName()).append("\n");
|
||||
}
|
||||
resAbsentReplace = resAttendOpinion.replace("{{applicantFile}}", stringBuilder.toString());
|
||||
}
|
||||
datas.put("resAbsent",resAbsentReplace);
|
||||
} else {
|
||||
// 出席
|
||||
String attendReplace = attend.replace("{{agentName}}", Optional.ofNullable(agentName).orElse(""));
|
||||
datas.put("attend",attendReplace);
|
||||
// 被申请人证据
|
||||
if(caseAttachMap!=null && CollectionUtil.isNotEmpty(caseAttachMap.get(6))){
|
||||
// 开庭+出席+被申提供证据
|
||||
datas.put("onLineAttendFile",onLineAttendFile);
|
||||
// 被申请人出席+被申请人提供了资料
|
||||
String resFileRplace=resFile;
|
||||
if(caseAttachMap!=null && CollectionUtil.isNotEmpty(caseAttachMap.get(6))){
|
||||
List<CaseAttach> caseAttaches = caseAttachMap.get(6);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (CaseAttach caseAttach : caseAttaches) {
|
||||
stringBuilder.append(caseAttach.getAnnexName()).append("\n");
|
||||
}
|
||||
resFileRplace = resFile.replace("{{resFile}}", stringBuilder.toString()).replace("{{applicantOpinion}}", (arbitrateRecordSelect==null||arbitrateRecordSelect.getApplicantOpinion()==null?"":arbitrateRecordSelect.getApplicantOpinion()));
|
||||
}
|
||||
datas.put("resFile",resFileRplace);
|
||||
}else {
|
||||
// 开庭+出席+被申未提供证据
|
||||
datas.put("onLineAttend",onLineAttend);
|
||||
}
|
||||
// 被申请人出席答辩意见
|
||||
String resAttendOpinionReplace=resAttendOpinion;
|
||||
if(caseAttachMap!=null && CollectionUtil.isNotEmpty(caseAttachMap.get(2))){
|
||||
List<CaseAttach> caseAttaches = caseAttachMap.get(2);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (CaseAttach caseAttach : caseAttaches) {
|
||||
stringBuilder.append(caseAttach.getAnnexName()).append("\n");
|
||||
}
|
||||
resAttendOpinionReplace = resAttendOpinion.replace("{{applicantFile}}", stringBuilder.toString()).replace("{{respondentOpinion}}", (arbitrateRecordSelect==null||arbitrateRecordSelect.getRespondentOpinion()==null)?"":arbitrateRecordSelect.getRespondentOpinion());
|
||||
}
|
||||
|
||||
datas.put("resAttendOpinion",resAttendOpinionReplace);
|
||||
}
|
||||
}
|
||||
|
||||
datas.put("立案日期", registerDateStr);
|
||||
|
||||
|
||||
String month = String.format("%02d", now.getMonthValue());
|
||||
String day = String.format("%02d", now.getDayOfMonth());
|
||||
// todo
|
||||
// String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
|
||||
String modalFilePath = templatePath;
|
||||
// todo
|
||||
// String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||
String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||
@@ -370,25 +234,12 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
||||
// todo
|
||||
// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||
String saveName = "D:/home/ruoyi/uploadPath/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);
|
||||
File file = new File(docFilePath);
|
||||
if (file.exists()) {
|
||||
InputStream in = new FileInputStream(file);
|
||||
XWPFDocument xwpfDocument = new XWPFDocument(in);
|
||||
WordUtil.changeText(xwpfDocument);
|
||||
}
|
||||
// 将word中的标签替换掉,生成新的word
|
||||
String docFilePath = wordChangeText(templatePath,datas,saveFolderPath,fileName);
|
||||
|
||||
String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
|
||||
// 保存裁决书附件
|
||||
saveArbitorFile(id,saveName,savePath,caseApplicationById,arbitrateRecordSelect);
|
||||
saveArbitorFile(id, saveName, savePath, caseApplicationById, arbitrateRecordSelect);
|
||||
|
||||
return AjaxResult.success("裁决书已生成");
|
||||
} catch (IOException e) {
|
||||
@@ -396,6 +247,302 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将word中的标签替换掉,生成新的word
|
||||
* @param modalFilePath 裁决书模板路径
|
||||
* @param datas 替换标签的内容
|
||||
* @param saveFolderPath 保存路径
|
||||
* @param fileName 保存文件名
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private String wordChangeText(String modalFilePath, Map<String, Object> datas, String saveFolderPath,String fileName) throws IOException {
|
||||
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);
|
||||
File file = new File(docFilePath);
|
||||
if (file.exists()) {
|
||||
InputStream in = new FileInputStream(file);
|
||||
XWPFDocument xwpfDocument = new XWPFDocument(in);
|
||||
WordUtil.changeText(xwpfDocument);
|
||||
}
|
||||
return docFilePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件判断裁决书中是否需要该内容
|
||||
* @param caseApplicationById 案件信息
|
||||
* @param datas 替换标签值
|
||||
* @param agentName 代理人名称
|
||||
* @param resName 被申请人名称
|
||||
* @param arbitrateRecordSelect 仲裁记录
|
||||
*/
|
||||
private void conditionReplaceBookmark(CaseApplication caseApplicationById, Map<String, Object> datas,String agentName,String resName, ArbitrateRecord arbitrateRecordSelect ) {
|
||||
// 如果有仲裁反请求,该字段设置值
|
||||
Integer adjudicaCounter = caseApplicationById.getAdjudicaCounter();
|
||||
if (adjudicaCounter != null && adjudicaCounter == 1) {
|
||||
datas.put("仲裁反请求", counterclaim);
|
||||
}
|
||||
//财产保全
|
||||
Integer properPreser = caseApplicationById.getProperPreser();
|
||||
if (properPreser != null && properPreser == 1) {
|
||||
datas.put("财产保全", preservation);
|
||||
}
|
||||
//管辖权异议
|
||||
Integer objectiJuris = caseApplicationById.getObjectiJuris();
|
||||
if (objectiJuris != null && objectiJuris == 1) {
|
||||
datas.put("管辖权异议", jurisdictionalObjection);
|
||||
}
|
||||
|
||||
// 出席庭审人员角色名称
|
||||
String attendName = "秘书、";
|
||||
boolean isAbsenceFlag = caseApplicationById.getIsAbsence() != null && caseApplicationById.getIsAbsence().equals(0);
|
||||
boolean appIsAbsenceFlag = caseApplicationById.getAppliIsAbsen() != null && caseApplicationById.getAppliIsAbsen().equals(0);
|
||||
if (isAbsenceFlag || appIsAbsenceFlag) {
|
||||
if (isAbsenceFlag) {
|
||||
attendName += "申请代理人" + agentName + "、";
|
||||
}
|
||||
if (appIsAbsenceFlag) {
|
||||
attendName += "被申请人" + resName;
|
||||
}
|
||||
if (attendName.endsWith("、")) {
|
||||
attendName = attendName.replace("、", "");
|
||||
}
|
||||
datas.put("出席庭审人员", attendName);
|
||||
}
|
||||
|
||||
// 仲裁员名称
|
||||
datas.put("仲裁员姓名", caseApplicationById.getArbitratorName());
|
||||
// 审理方式
|
||||
Integer arbitratMethod = caseApplicationById.getArbitratMethod();
|
||||
Date hearDate = caseApplicationById.getHearDate();
|
||||
String hearDateStr = "";
|
||||
if (hearDate != null) {
|
||||
// 审理日期
|
||||
hearDateStr = sdf.format(hearDate);
|
||||
datas.put("审理日期", hearDateStr);
|
||||
}
|
||||
// todo 线上仲裁/线下仲裁方式未选择
|
||||
//线上开庭时+线上仲裁
|
||||
if (arbitratMethod!=null&&arbitratMethod == 1) {
|
||||
String replace = onLine.replace(onLineDate, Optional.of(hearDateStr).orElse(""));
|
||||
datas.put("线上开庭并线上仲裁", replace);
|
||||
// 所有附件
|
||||
List<CaseAttach> caseAttachList = caseApplicationById.getCaseAttachList();
|
||||
Map<Integer, List<CaseAttach>> caseAttachMap = new HashMap<>();
|
||||
if (caseAttachList != null && caseAttachList.size() > 0) {
|
||||
caseAttachMap = caseAttachList.stream().collect(Collectors.groupingBy(CaseAttach::getAnnexType));
|
||||
}
|
||||
// 被申请人是否缺席
|
||||
Integer isAbsence = caseApplicationById.getIsAbsence();
|
||||
if (isAbsence != null && isAbsence == 1) {
|
||||
// 被申请人缺席,开庭+缺席审理
|
||||
String absentReplace = absent.replace("{{agentName}}", Optional.of(agentName).orElse(""));
|
||||
|
||||
// 被申请人缺席
|
||||
String resAbsentReplace = resAbsent;
|
||||
if (caseAttachMap != null && CollectionUtil.isNotEmpty(caseAttachMap.get(2))) {
|
||||
List<CaseAttach> caseAttaches = caseAttachMap.get(2);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (CaseAttach caseAttach : caseAttaches) {
|
||||
stringBuilder.append(caseAttach.getAnnexName()).append("\n");
|
||||
}
|
||||
resAbsentReplace = resAttendOpinion.replace("{{applicantFile}}", stringBuilder.toString());
|
||||
}
|
||||
datas.put("开庭并缺席", absentReplace + resAbsentReplace);
|
||||
} else {
|
||||
// 被申出席
|
||||
String attendReplace = attend.replace("{{agentName}}", Optional.ofNullable(agentName).orElse(""));
|
||||
datas.put("开庭并出席", attendReplace);
|
||||
// 被申请人证据
|
||||
if (caseAttachMap != null && CollectionUtil.isNotEmpty(caseAttachMap.get(6))) {
|
||||
// 开庭+出席+被申提供证据
|
||||
|
||||
// 开庭+出席+被申提供证据
|
||||
String resFileReplace = resFile;
|
||||
if (CollectionUtil.isNotEmpty(caseAttachMap.get(6))) {
|
||||
List<CaseAttach> caseAttaches = caseAttachMap.get(6);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (CaseAttach caseAttach : caseAttaches) {
|
||||
stringBuilder.append(caseAttach.getAnnexName()).append("\n");
|
||||
}
|
||||
resFileReplace = resFile.replace("{{resFile}}", stringBuilder.toString()).replace("{{applicantOpinion}}", (arbitrateRecordSelect == null || arbitrateRecordSelect.getApplicantOpinion() == null ? "" : arbitrateRecordSelect.getApplicantOpinion()));
|
||||
}
|
||||
datas.put("开庭并出席并被申提供证据", onLineAttendFile + resFileReplace);
|
||||
} else {
|
||||
// 开庭+出席+被申未提供证据
|
||||
datas.put("开庭并出席并被申未提供证据", onLineAttend);
|
||||
}
|
||||
// 被申请人出席答辩意见
|
||||
String resAttendOpinionReplace = resAttendOpinion;
|
||||
if (caseAttachMap != null && CollectionUtil.isNotEmpty(caseAttachMap.get(2))) {
|
||||
List<CaseAttach> caseAttaches = caseAttachMap.get(2);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (CaseAttach caseAttach : caseAttaches) {
|
||||
stringBuilder.append(caseAttach.getAnnexName()).append("\n");
|
||||
}
|
||||
resAttendOpinionReplace = resAttendOpinion.replace("{{applicantFile}}", stringBuilder.toString()).replace("{{respondentOpinion}}", (arbitrateRecordSelect == null || arbitrateRecordSelect.getRespondentOpinion() == null) ? "" : arbitrateRecordSelect.getRespondentOpinion());
|
||||
}
|
||||
|
||||
datas.put("被申请人出席答辩意见", resAttendOpinionReplace);
|
||||
}
|
||||
|
||||
} else {
|
||||
//书面仲裁时
|
||||
String replace = written.replace(writtenDate, Optional.of(hearDateStr).orElse(""));
|
||||
datas.put("书面仲裁", replace);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 给模板中的占位符赋值
|
||||
* @param bookmarkList 书签
|
||||
* @param datas 书签赋值
|
||||
* @param valueMap 案件内容
|
||||
*/
|
||||
private void replaceBookmark(List<String> bookmarkList, Map<String, Object> datas, Map<String, String> valueMap) {
|
||||
for (String bookmark : bookmarkList) {
|
||||
if (valueMap.containsKey(bookmark)) {
|
||||
if (bookmark.equals("仲裁请求")) {
|
||||
// 请求仲裁庭裁决
|
||||
String arbitratClaims = valueMap.get(bookmark);
|
||||
if (StrUtil.isNotEmpty(arbitratClaims)) {
|
||||
String replace = arbitratClaims.replace("甲方", "被申请人").replace("乙方", "申请人");
|
||||
datas.put(bookmark, replace);
|
||||
|
||||
} else {
|
||||
datas.put(bookmark, "");
|
||||
}
|
||||
} else if (bookmark.equals("本案事实")) {
|
||||
// 查询本案事实如下
|
||||
String mediationAgreement = valueMap.get(bookmark);
|
||||
if (StrUtil.isNotEmpty(mediationAgreement)) {
|
||||
String replace = mediationAgreement.replace("甲方", "被申请人").replace("乙方", "申请人");
|
||||
datas.put(bookmark, replace);
|
||||
|
||||
} else {
|
||||
datas.put(bookmark, "");
|
||||
}
|
||||
} else {
|
||||
datas.put(bookmark, valueMap.get(bookmark));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装案件内置字段值,即主表和相关人员表信息
|
||||
* @param dictDataList 内置字段
|
||||
* @param caseAffiliates 关联人员
|
||||
* @param valueMap 组装的值
|
||||
*/
|
||||
private void buildDefaultColumnValue(List<SysDictData> dictDataList, List<CaseAffiliate> caseAffiliates, Map<String, String> valueMap, CaseApplication caseApplication) {
|
||||
if (CollectionUtil.isNotEmpty(dictDataList)) {
|
||||
Map<Integer, CaseAffiliate> affiliateMap = caseAffiliates.stream().collect(Collectors.toMap(CaseAffiliate::getIdentityType, Function.identity(), (n1, n2) -> n2));
|
||||
for (SysDictData dictData : dictDataList) {
|
||||
if (StrUtil.isNotEmpty(dictData.getDictLabel())) {
|
||||
if (dictData.getDictLabel().contains("被申请人")) {
|
||||
CaseAffiliate affiliate = affiliateMap.get(2);
|
||||
if (affiliate == null) {
|
||||
continue;
|
||||
}
|
||||
// 被申请人
|
||||
switch (dictData.getDictLabel()) {
|
||||
case "被申请人姓名":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getName());
|
||||
break;
|
||||
case "被申请人身份证号":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getIdentityNum());
|
||||
break;
|
||||
case "被申请人住所":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getResidenAffili());
|
||||
break;
|
||||
case "被申请人联系电话":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getContactTelphone());
|
||||
break;
|
||||
case "被申请人电子邮件":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getEmail());
|
||||
break;
|
||||
case "被申请人性别":
|
||||
if (dictData.getDictLabel().equals("被申请人性别")) {
|
||||
String responSex = affiliate.getResponSex();
|
||||
if (responSex.equals("0")) {
|
||||
valueMap.put(dictData.getDictLabel(), "男");
|
||||
} else {
|
||||
valueMap.put(dictData.getDictLabel(), "女");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "被申请人出生年月日":
|
||||
Date responBirth = affiliate.getResponBirth();
|
||||
if (responBirth != null) {
|
||||
valueMap.put(dictData.getDictLabel(), sdf.format(responBirth));
|
||||
} else {
|
||||
valueMap.put(dictData.getDictLabel(), "");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (dictData.getDictLabel().contains("申请人") || dictData.getDictLabel().contains("统一社会信用代码")
|
||||
|| dictData.getDictLabel().contains("法定代表人") || dictData.getDictLabel().contains("法定代表人职位")
|
||||
|| dictData.getDictLabel().contains("代理人")) {
|
||||
CaseAffiliate affiliate = affiliateMap.get(1);
|
||||
if (affiliate == null) {
|
||||
continue;
|
||||
}
|
||||
// 申请人
|
||||
switch (dictData.getDictLabel()) {
|
||||
case "申请人姓名":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getName());
|
||||
break;
|
||||
case "统一社会信用代码":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getIdentityNum());
|
||||
break;
|
||||
case "法定代表人":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getCompLegalPerson());
|
||||
break;
|
||||
case "法定代表人职位":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getCompLegalperPost());
|
||||
break;
|
||||
case "申请人住所":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getResidenAffili());
|
||||
break;
|
||||
case "申请人联系地址":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getContactAddress());
|
||||
break;
|
||||
case "委托代理人姓名":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getNameAgent());
|
||||
break;
|
||||
case "委托代理人联系电话":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getContactTelphoneAgent());
|
||||
break;
|
||||
case "委托代理人电子邮件":
|
||||
valueMap.put(dictData.getDictLabel(), affiliate.getAgentEmail());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}else {
|
||||
valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(caseApplication, dictData.getDictValue()));
|
||||
}
|
||||
}else {
|
||||
valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(caseApplication, dictData.getDictValue()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存裁决书附件
|
||||
* @param id 案件id
|
||||
|
||||
+70
-4
@@ -12,6 +12,7 @@ import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
|
||||
import com.ruoyi.wisdomarbitrate.domain.SmsSendRecord;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.CompareCaseVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.UpdateSubmitVO;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.*;
|
||||
@@ -50,6 +51,8 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
||||
private SmsRecordMapper smsRecordMapper;
|
||||
@Autowired
|
||||
private ICaseApplicationService caseApplicationService;
|
||||
@Autowired
|
||||
private ColumnValueLogMapper columnValueLogMapper;
|
||||
// 对比两个版本修改的字段,基本字段对比
|
||||
private static final String[] columns = {"caseName","caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag",
|
||||
"claimPrinciOwed","arbitratClaims","properPreser","requestRule"};
|
||||
@@ -158,6 +161,16 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
||||
caseAttachMapper.updateCaseAttach(caseAttach);
|
||||
}
|
||||
}
|
||||
// 更新自定义字段表
|
||||
// 根据caseLogId查询自定义字段表
|
||||
List<ColumnValue> columnValueList = columnValueLogMapper.listBycaseAppliLogId(caseApplicationLog.getCaseLogId());
|
||||
if(CollectionUtil.isNotEmpty(columnValueList)){
|
||||
for (ColumnValue columnValue : columnValueList) {
|
||||
columnValue.setCaseAppliLogId(vo.getCaseId());
|
||||
|
||||
}
|
||||
columnValueLogMapper.batchUpdate(columnValueList);
|
||||
}
|
||||
} else {
|
||||
// 拒绝,将日志表改版本的状态改为拒绝
|
||||
vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE.getCode());
|
||||
@@ -231,10 +244,12 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setCaseAppliId(vo.getCaseId());
|
||||
caseApplication.setId(vo.getCaseId());
|
||||
CaseApplication beforeCase= caseApplicationService.selectCaseApplication(caseApplication);
|
||||
CaseApplication beforeCase = caseApplicationService.selectCaseApplication(caseApplication);
|
||||
|
||||
// 查询案件关联人员
|
||||
afterCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(afterCase.getCaseLogId()));
|
||||
// 查询自定义字段表
|
||||
afterCase.setColumnValues(columnValueLogMapper.listBycaseAppliLogId(afterCase.getCaseLogId()));
|
||||
// 查询附件
|
||||
CaseAttach caseAttach = new CaseAttach();
|
||||
caseAttach.setCaseAppliLogId(beforeCase.getCaseLogId());
|
||||
@@ -242,7 +257,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
||||
caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach);
|
||||
caseAttach.setCaseAppliLogId(afterCase.getCaseLogId());
|
||||
List<CaseAttach> afterAttachList = caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach);
|
||||
if(CollectionUtil.isNotEmpty(afterAttachList)){
|
||||
if (CollectionUtil.isNotEmpty(afterAttachList)) {
|
||||
for (CaseAttach attach : afterAttachList) {
|
||||
String annexName = attach.getAnnexName();
|
||||
String prefix = "/profile";
|
||||
@@ -284,9 +299,49 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
||||
|
||||
}
|
||||
// 对比案件人员字段
|
||||
compareAffilate(beforeCase,afterCase);
|
||||
compareAffilate(beforeCase, afterCase);
|
||||
// 对比申请人证据资料
|
||||
compareCaseVO.setChangeColumn(compareApplicantFile(beforeCase,afterCase,changeColumn).toString());
|
||||
compareCaseVO.setChangeColumn(compareApplicantFile(beforeCase, afterCase, changeColumn).toString());
|
||||
// 对比自定义字段
|
||||
//
|
||||
List<ColumnValue> beforeColumnValues = beforeCase.getColumnValues();
|
||||
List<ColumnValue> afterColumnValues = afterCase.getColumnValues();
|
||||
StringBuilder columnValueChange = new StringBuilder();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(beforeColumnValues) && CollectionUtil.isNotEmpty(afterColumnValues)) {
|
||||
Map<String, String> beforeColumnValueMap = beforeColumnValues.stream().collect(Collectors.toMap(ColumnValue::getColumn, ColumnValue::getValue, (n1, n2) -> n2));
|
||||
for (ColumnValue afterColumnValue : afterColumnValues) {
|
||||
// 改变前字段不包含改变后字段
|
||||
if (!beforeColumnValueMap.containsKey(afterColumnValue.getColumn())) {
|
||||
columnValueChange.append(afterColumnValue.getColumn()).append(",");
|
||||
} else {
|
||||
// 都有这个字段,比较内容是否相同
|
||||
// 修改后为空,修改前不为空
|
||||
if (StrUtil.isEmpty(afterColumnValue.getValue()) && StrUtil.isNotEmpty(beforeColumnValueMap.get(afterColumnValue.getColumn()))) {
|
||||
columnValueChange.append(afterColumnValue.getColumn()).append(",");
|
||||
} else if (StrUtil.isNotEmpty(afterColumnValue.getValue()) && StrUtil.isEmpty(beforeColumnValueMap.get(afterColumnValue.getColumn()))) {
|
||||
// 修改前为空,修改后不为空
|
||||
columnValueChange.append(afterColumnValue.getColumn()).append(",");
|
||||
} else if (StrUtil.isNotEmpty(afterColumnValue.getValue()) && StrUtil.isNotEmpty(beforeColumnValueMap.get(afterColumnValue.getColumn()))
|
||||
&& !afterColumnValue.getValue().equals(beforeColumnValueMap.get(afterColumnValue.getColumn()))) {
|
||||
// 修改前不为空,修改后不为空,内容不同
|
||||
columnValueChange.append(afterColumnValue.getColumn()).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (CollectionUtil.isEmpty(beforeColumnValues) && CollectionUtil.isNotEmpty(afterColumnValues)) {
|
||||
for (ColumnValue afterColumnValue : afterColumnValues) {
|
||||
columnValueChange.append(afterColumnValue.getColumn()).append(",");
|
||||
}
|
||||
|
||||
} else if (CollectionUtil.isNotEmpty(beforeColumnValues) && CollectionUtil.isEmpty(afterColumnValues)) {
|
||||
for (ColumnValue beforeColumn : beforeColumnValues) {
|
||||
columnValueChange.append(beforeColumn.getColumn()).append(",");
|
||||
}
|
||||
|
||||
}
|
||||
compareCaseVO.setColumnValueChangeColumn(columnValueChange.toString());
|
||||
|
||||
return AjaxResult.success(compareCaseVO);
|
||||
}
|
||||
@@ -442,5 +497,16 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
|
||||
caseAttachMapper.updateCaseAttach(caseAttach);
|
||||
}
|
||||
}
|
||||
// 根据caseLogId查询自定义字段表
|
||||
List<ColumnValue> columnValueList = columnValueLogMapper.listBycaseAppliLogId(caseApplicationLog.getCaseLogId());
|
||||
|
||||
// 更新相关人员主表
|
||||
if(CollectionUtil.isNotEmpty(columnValueList)){
|
||||
for (ColumnValue columnValue : columnValueList) {
|
||||
columnValue.setCaseAppliLogId(vo.getCaseId());
|
||||
|
||||
}
|
||||
columnValueLogMapper.batchUpdate(columnValueList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+292
-198
@@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -31,10 +32,7 @@ import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.thread.ThreadPoolUtil;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.mapper.SysUserRoleMapper;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount;
|
||||
@@ -67,6 +65,7 @@ import java.math.RoundingMode;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
@@ -140,7 +139,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
private FatchRuleMapper fatchRuleMapper;
|
||||
@Autowired
|
||||
private ColumnValueMapper columnValueMapper;
|
||||
|
||||
@Autowired
|
||||
private ColumnValueLogMapper columnValueLogMapper;
|
||||
@Autowired
|
||||
private SysDictDataMapper dictDataMapper;
|
||||
// 手机号正则
|
||||
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}$");
|
||||
// 邮箱正则
|
||||
@@ -938,7 +940,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertcaseApplication(CaseApplication caseApplication,Map<String,String> fatchMap) {
|
||||
public int insertcaseApplication(CaseApplication caseApplication, List<ColumnValue> columnValueList) {
|
||||
|
||||
caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
|
||||
//根据仲裁费用计费规则计算应缴费用
|
||||
@@ -949,6 +951,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
// 获取自动编码
|
||||
String caseNum = generateCaseNum();
|
||||
caseApplication.setCaseNum(caseNum);
|
||||
// 设置批号
|
||||
if(StrUtil.isEmpty(caseApplication.getBatchNumber())){
|
||||
Integer maxBatchNumber = caseApplicationMapper.selectBatchNumberLike();
|
||||
if(maxBatchNumber==null){
|
||||
caseApplication.setBatchNumber("1");
|
||||
}else {
|
||||
caseApplication.setBatchNumber(maxBatchNumber+1+"");
|
||||
}
|
||||
}
|
||||
caseApplication.setCreateBy(getUsername());
|
||||
caseApplication.setVersion(1);
|
||||
// 新增立案信息
|
||||
@@ -1016,29 +1027,42 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "");
|
||||
// 异步新增案件日志
|
||||
ThreadPoolUtil.execute(() -> {
|
||||
// 批量新增columnValue自定义字段
|
||||
if(CollectionUtil.isNotEmpty(columnValueList)) {
|
||||
columnValueList.forEach(columnValue -> columnValue.setCaseId(caseApplication.getId()));
|
||||
columnValueMapper.batchSave(columnValueList);
|
||||
}
|
||||
// 新增案件日志表
|
||||
caseApplication.setCaseAppliId(caseApplication.getId());
|
||||
caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
|
||||
int insertRow = caseApplicationLogMapper.insert(caseApplication);
|
||||
// 插入案件相关人员表日志
|
||||
if (insertRow != 0 && CollectionUtil.isNotEmpty(caseAffiliates)) {
|
||||
caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getId()));
|
||||
// 插入案件日志人员相关表
|
||||
if (CollectionUtil.isNotEmpty(caseAttachList)) {
|
||||
List<CaseAttach> filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList());
|
||||
// 插入日志附件表
|
||||
if (CollectionUtil.isNotEmpty(filterList)) {
|
||||
for (CaseAttach caseAttach : filterList) {
|
||||
// 查询附件表
|
||||
CaseAttach attach = caseAttachMapper.queryAnnexById(caseAttach.getAnnexId());
|
||||
attach.setCaseAppliLogId(caseApplication.getId());
|
||||
caseAttachLogMapper.save(attach);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliates);
|
||||
}
|
||||
// 新增动态配置字段值表
|
||||
insertColumnValue(fatchMap,caseApplication.getCaseAppliId());
|
||||
// 插入附件表日志
|
||||
if (CollectionUtil.isNotEmpty(caseAttachList)) {
|
||||
List<CaseAttach> filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList());
|
||||
// 插入日志附件表
|
||||
if (CollectionUtil.isNotEmpty(filterList)) {
|
||||
for (CaseAttach caseAttach : filterList) {
|
||||
// 查询附件表
|
||||
CaseAttach attach = caseAttachMapper.queryAnnexById(caseAttach.getAnnexId());
|
||||
attach.setCaseAppliLogId(caseApplication.getId());
|
||||
caseAttachLogMapper.save(attach);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 插入columnValueLog自定义字段日志表
|
||||
if (CollectionUtil.isNotEmpty(columnValueList)) {
|
||||
columnValueList.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getId()));
|
||||
columnValueLogMapper.batchSave(columnValueList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -1082,8 +1106,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
caseApplication.setUpdateBy(getUsername());
|
||||
// 立案申请状态直接修改主表信息
|
||||
if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) {
|
||||
|
||||
caseApplicationMapper.updataCaseApplication(caseApplication);
|
||||
// 修改内置字段
|
||||
if(CollectionUtil.isNotEmpty(caseApplication.getColumnValues())) {
|
||||
caseApplicationMapper.updataCaseApplication(caseApplication);
|
||||
}else {
|
||||
// 修改自定义字段
|
||||
columnValueMapper.batchUpdate(caseApplication.getColumnValues());
|
||||
}
|
||||
// 修改记录表状态为同意提交修改的内容
|
||||
caseApplication.setUpdateSubmitStatus(0);
|
||||
} else {
|
||||
@@ -1193,6 +1222,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
}
|
||||
|
||||
}
|
||||
// 插入案件columnValueLog自定义字段表
|
||||
if (CollectionUtil.isNotEmpty(caseApplication.getColumnValues())) {
|
||||
caseApplication.getColumnValues().forEach(columnValue -> columnValue.setCaseAppliLogId(caseApplication.getId()));
|
||||
|
||||
columnValueLogMapper.batchSave(caseApplication.getColumnValues());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -3042,185 +3077,55 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
}
|
||||
}
|
||||
if (fatchMap.size() <= 0) {
|
||||
return error("从压缩包中未抓取到内容,请检查抓取字段配置");
|
||||
return error("从压缩包中未抓取到内容,请检查抓取字段配置");
|
||||
}
|
||||
|
||||
// todo 从压缩包中识别各字段填充到数据库
|
||||
//调用新增案件的接口
|
||||
// 组装案件内置字段主表内容
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setTemplateId(templateId);
|
||||
//默认案件标的 todo 案件标的是什么,默认写死
|
||||
caseApplication.setCaseSubjectAmount(new BigDecimal(10000));
|
||||
// todo 这些以后要去掉,不在案件基本信息表维护,现在往基本信息表设置字段是因为修改以及查询详情的时候页面中字段是固定的,以后也要动态维护字段
|
||||
// 仲裁请求
|
||||
caseApplication.setArbitratClaims(fatchMap.get("arbitrationClaims"));
|
||||
// 事实和理由
|
||||
caseApplication.setFacts(fatchMap.get("factsAndReason"));
|
||||
// 合同编号
|
||||
String contractNumber = fatchMap.get("contractNumber");
|
||||
if (StrUtil.isNotEmpty(contractNumber)) {
|
||||
// 提取字母和数字
|
||||
String regx = "[^a-zA-Z0-9]";
|
||||
String replaceAll = contractNumber.replaceAll(regx, "");
|
||||
|
||||
caseApplication.setContractNumber(replaceAll.toUpperCase());
|
||||
}
|
||||
// todo 从抓取规则表取字段和字典表取基本字段,字典表的字段名塞到基本表,is_default=1自定义字段塞到columnValue
|
||||
// 抓取规则,0-内置字段,1-自定义字段
|
||||
Map<Integer, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getIsDefault));
|
||||
// 自定义字段,组装columnValue表
|
||||
List<ColumnValue> columnValueList = new ArrayList<>();
|
||||
if (fatchRuleMap.size() > 0 && fatchRuleMap.containsKey(1)) {
|
||||
List<FatchRule> columnRules = fatchRuleMap.get(1);
|
||||
columnRules.forEach(columnRule -> {
|
||||
ColumnValue columnValue = new ColumnValue();
|
||||
columnValue.setColumn(columnRule.getColumn());
|
||||
columnValue.setName(columnRule.getColumnName());
|
||||
columnValue.setValue(fatchMap.get(columnRule.getColumnName())); columnValue.setIsDefault(columnRule.getIsDefault());
|
||||
columnValueList.add(columnValue);
|
||||
});
|
||||
}
|
||||
// 在系统表中查询案件内置字段
|
||||
SysDictData sysDictData = new SysDictData();
|
||||
sysDictData.setDictType("case_built_type");
|
||||
List<SysDictData> dictDataList = dictDataMapper.selectDictDataList(sysDictData);
|
||||
// 组装内置字段
|
||||
buildDefaultColumn(caseApplication,dictDataList,fatchMap);
|
||||
// 借款开始日期
|
||||
String lonStartDate = fatchMap.get("lonStartDate:");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat();
|
||||
sdf.applyPattern("yyyy年MM月dd日");
|
||||
if (StrUtil.isNotEmpty(lonStartDate)) {
|
||||
try {
|
||||
caseApplication.setLoanStartDate(sdf.parse(lonStartDate));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
// todo 查询同一批号的模板
|
||||
// 金融消费纠纷基本情况
|
||||
String disputes = fatchMap.get("disputes");
|
||||
caseApplication.setDisputes(disputes);
|
||||
// String disputesTemplate="本案当事人甲{1}(下称“甲方”)于{2}向本案当事人乙{3}(下称“乙方”)申请{3}贷款,贷款金额人民币{4}元,贷款期限{5}期。截至{6},甲方尚欠乙方金额总计人民币{7}元。因甲方诉求与乙方进行协商还款。乙方为妥善解决纠纷,故申请调解中心进行调解。";
|
||||
// List<String> disputeList = getReplaceList(disputesTemplate, disputes);
|
||||
// if(CollectionUtil.isNotEmpty(disputeList)){
|
||||
// if(disputeList.size()>3){
|
||||
// caseApplication.setLoanType(disputeList.get(3));
|
||||
// }
|
||||
// if(disputeList.size()>4) {
|
||||
// String claimPrinciOwed = disputeList.get(4);
|
||||
// // 金额格式化
|
||||
// try {
|
||||
// Double.parseDouble(claimPrinciOwed);
|
||||
//
|
||||
// caseApplication.setClaimPrinciOwed(new BigDecimal(claimPrinciOwed));
|
||||
// } catch (NumberFormatException e) {
|
||||
//
|
||||
// String regEx = "[^0-9]";
|
||||
// Pattern p = Pattern.compile(regEx);
|
||||
// Matcher m = p.matcher(claimPrinciOwed);
|
||||
// String result = m.replaceAll("").trim();
|
||||
// BigDecimal bigDecimal = null;
|
||||
// if (claimPrinciOwed.contains("百")) {
|
||||
// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("100"));
|
||||
// } else if (claimPrinciOwed.contains("千")) {
|
||||
// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("1000"));
|
||||
// } else if (claimPrinciOwed.contains("万")) {
|
||||
// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("10000"));
|
||||
// } else if (claimPrinciOwed.contains("百万")) {
|
||||
// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("1000000"));
|
||||
// } else if (claimPrinciOwed.contains("千万")) {
|
||||
// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("10000000"));
|
||||
// } else if (claimPrinciOwed.contains("亿")) {
|
||||
// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("100000000"));
|
||||
// }
|
||||
// // todo 生产裁决书时金额格式增加千分位
|
||||
// // NumberFormat format = NumberFormat.getInstance();
|
||||
// // String format1 = format.format(bigDecimal);
|
||||
//
|
||||
// caseApplication.setClaimPrinciOwed(bigDecimal);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(disputeList.size()>5){
|
||||
// caseApplication.setLoanTerm(disputeList.get(5));
|
||||
// }
|
||||
// }
|
||||
// 调解协议内容
|
||||
String mediationAgreement = fatchMap.get("mediationAgreement");
|
||||
caseApplication.setMediationAgreement(mediationAgreement);
|
||||
// String mediationAgreementTemplate="1、乙方从维系客户的角度出发,同意为甲方申请停催至{1},停催期间正常计息,且征信影响由甲方自行承担。2、甲方应于{2}停催到期前向乙方申请费息减免业务,并按人民币{3}元一次性结清剩余贷款。3、今后双方无涉,就此结案。";
|
||||
// // 对比模板和pdf识别的内容,取出占位符对应的值
|
||||
// List<String> mediationAgreementList = getReplaceList(mediationAgreementTemplate, mediationAgreement);
|
||||
// if(CollectionUtil.isNotEmpty(mediationAgreementList)){
|
||||
// // 截止日期
|
||||
// String lonEndDate = mediationAgreementList.get(0);
|
||||
// String lonStartDate = fatchMap.get("借款开始日期:");
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
|
||||
// if (StrUtil.isNotEmpty(lonStartDate)) {
|
||||
// try {
|
||||
// caseApplication.setLoanEndDate( sdf.parse(lonEndDate));
|
||||
// caseApplication.setLoanStartDate(sdf.parse(lonStartDate));
|
||||
// } catch (ParseException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// if(mediationAgreementList.size()>2){
|
||||
// // 待还金额
|
||||
// caseApplication.setOutstandingMoney(mediationAgreementList.get(2));
|
||||
// }
|
||||
// }
|
||||
// 合同甲方(贷款人)
|
||||
caseApplication.setPartyA(fatchMap.get("partyA"));
|
||||
List<CaseAffiliate> caseAffiliates = new ArrayList<>();
|
||||
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
||||
caseAffiliate.setIdentityType(1);
|
||||
// 申请人
|
||||
caseAffiliate.setName(fatchMap.get("applicantName"));
|
||||
// 统一社会信用代码
|
||||
caseAffiliate.setIdentityNum(fatchMap.get("creditCode"));
|
||||
// 法定代表人
|
||||
caseAffiliate.setCompLegalPerson(fatchMap.get("legalRepresentative"));
|
||||
// 申请人联系电话
|
||||
caseAffiliate.setContactTelphone(fatchMap.get("applicantPhone"));
|
||||
// 申请人住所
|
||||
caseAffiliate.setResidenAffili(fatchMap.get("applicantHome"));
|
||||
// 申请人联系地址
|
||||
caseAffiliate.setContactAddress(fatchMap.get("applicantAddress"));
|
||||
// // 法定代表人职务
|
||||
caseAffiliate.setCompLegalperPost(fatchMap.get("compLegalperPost"));
|
||||
// 委托代理人
|
||||
caseAffiliate.setNameAgent(fatchMap.get("agentName"));
|
||||
// 委托代理人联系电话
|
||||
caseAffiliate.setContactTelphoneAgent(fatchMap.get("agentPhone"));
|
||||
|
||||
// 代理人电子邮件
|
||||
caseAffiliate.setAgentEmail(StrUtil.isNotEmpty(fatchMap.get("agentEmail")) ? fatchMap.get("agentEmail").replaceAll("\\s", "") : null);
|
||||
|
||||
|
||||
//设置默认代理人的身份证号码,暂时写死 要不然新增方法报错
|
||||
// caseAffiliate.setIdentityNumAgent("610423199603171716");
|
||||
caseAffiliates.add(caseAffiliate);
|
||||
// 被申请人信息
|
||||
CaseAffiliate respondentAffiliate = new CaseAffiliate();
|
||||
respondentAffiliate.setIdentityType(2);
|
||||
// 被申请人名称
|
||||
respondentAffiliate.setName(fatchMap.get("respondentName"));
|
||||
// 被申请人身份证
|
||||
String identityNum = fatchMap.get("respondentCard");
|
||||
// 出生年月日,从身份证抓取
|
||||
if (StrUtil.isNotEmpty(identityNum)) {
|
||||
Map<String, String> identityNumMap = getBirAgeSex(identityNum);
|
||||
String birthday = identityNumMap.get("birthday");
|
||||
if (StrUtil.isNotEmpty(birthday)) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date birthdayDate = null;
|
||||
try {
|
||||
birthdayDate = simpleDateFormat.parse(birthday);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
fatchMap.put("resDateOfBirth", sdf.format(birthdayDate));
|
||||
respondentAffiliate.setResponBirth(birthdayDate);
|
||||
}
|
||||
//从身份证抓取性别
|
||||
fatchMap.put("resSex", identityNumMap.get("sexCode"));
|
||||
respondentAffiliate.setResponSex(identityNumMap.get("sexCode"));
|
||||
// 设置批号
|
||||
if(StrUtil.isEmpty(caseApplication.getBatchNumber())){
|
||||
Integer maxBatchNumber = caseApplicationMapper.selectBatchNumberLike();
|
||||
if(maxBatchNumber==null){
|
||||
caseApplication.setBatchNumber("1");
|
||||
}else {
|
||||
caseApplication.setBatchNumber(maxBatchNumber+1+"");
|
||||
}
|
||||
respondentAffiliate.setIdentityNum(identityNum);
|
||||
// 被申请人电子邮件
|
||||
// if(map.get("乙方确认有效的电子信箱地址为").size()>1) {
|
||||
// if(map.get("乙方确认有效的电子信箱地址为").get(0).contains("/")) {
|
||||
// respondentAffiliate.setEmail(map.get("乙方确认有效的电子信箱地址为").get(1).replaceAll("\\s", ""));
|
||||
// }else {
|
||||
// respondentAffiliate.setEmail(map.get("乙方确认有效的电子信箱地址为").get(0).replaceAll("\\s", ""));
|
||||
// }
|
||||
// }
|
||||
// 被申请人电子邮件
|
||||
respondentAffiliate.setEmail(StrUtil.isNotEmpty(fatchMap.get("respondentEmail")) ? fatchMap.get("respondentEmail").replaceAll("\\s", "") : null);
|
||||
// 被申请人联系电话
|
||||
respondentAffiliate.setContactTelphone(fatchMap.get("respondentPhone"));
|
||||
// 被申请人住所
|
||||
respondentAffiliate.setResidenAffili(fatchMap.get("respondentHome"));
|
||||
|
||||
caseAffiliates.add(respondentAffiliate);
|
||||
caseApplication.setCaseAffiliates(caseAffiliates);
|
||||
}
|
||||
// 新增案件基本信息表
|
||||
this.insertcaseApplication(caseApplication, fatchMap);
|
||||
this.insertcaseApplication(caseApplication, columnValueList);
|
||||
if (null != caseApplication.getId()) {
|
||||
List<CaseAttach> caseAttachs = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : andConvertPDF.entrySet()) {
|
||||
@@ -3254,6 +3159,195 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装内置字段
|
||||
* @param caseApplication 案件信息
|
||||
* @param dictDataList 内置字段
|
||||
* @param fatchMap 抓取字段内容
|
||||
*/
|
||||
private void buildDefaultColumn(CaseApplication caseApplication, List<SysDictData> dictDataList, Map<String, String> fatchMap) {
|
||||
// 组装内置字段
|
||||
if (CollectionUtil.isEmpty(dictDataList)) {
|
||||
return;
|
||||
}
|
||||
List<CaseAffiliate> caseAffiliates = new ArrayList<>();
|
||||
CaseAffiliate debtorAffiliate = new CaseAffiliate();
|
||||
CaseAffiliate affiliate = new CaseAffiliate();
|
||||
for (SysDictData dictData : dictDataList) {
|
||||
if (StrUtil.isNotEmpty(dictData.getDictLabel())) {
|
||||
if(dictData.getDictLabel().contains("被申请人")) {
|
||||
// 组装被申请人内置自段
|
||||
buildDebtorColumn(dictData, fatchMap, debtorAffiliate);
|
||||
}else if( dictData.getDictLabel().contains("申请人")|| dictData.getDictLabel().contains("统一社会信用代码")
|
||||
|| dictData.getDictLabel().contains("法定代表人")|| dictData.getDictLabel().contains("委托代理人")) {
|
||||
// 组装申请人内置自段
|
||||
buildAffilcateColumn(dictData, fatchMap, affiliate);
|
||||
}else if( dictData.getDictLabel().contains("合同编号")) {
|
||||
// 合同编号
|
||||
String contractNumber = fatchMap.get("合同编号");
|
||||
if (StrUtil.isNotEmpty(contractNumber)) {
|
||||
// 提取字母和数字
|
||||
String regx = "[^a-zA-Z0-9]";
|
||||
String replaceAll = contractNumber.replaceAll(regx, "");
|
||||
caseApplication.setContractNumber(replaceAll.toUpperCase());
|
||||
}
|
||||
}else {
|
||||
ObjectFieldUtils.setValue(caseApplication, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel()));
|
||||
}
|
||||
|
||||
} else {
|
||||
ObjectFieldUtils.setValue(caseApplication, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(debtorAffiliate)){
|
||||
caseAffiliates.add(debtorAffiliate);
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(affiliate)){
|
||||
caseAffiliates.add(affiliate);
|
||||
}
|
||||
caseApplication.setCaseAffiliates(caseAffiliates);
|
||||
|
||||
}
|
||||
/**
|
||||
* 组装申请人内置字段
|
||||
* @param dictData 内置字段
|
||||
* @param fatchMap 抓取内容
|
||||
* @param affiliate 案件人员
|
||||
*/
|
||||
private void buildAffilcateColumn(SysDictData dictData, Map<String, String> fatchMap, CaseAffiliate affiliate) {
|
||||
|
||||
affiliate.setIdentityType(1);
|
||||
|
||||
// 申请人
|
||||
switch (dictData.getDictLabel()) {
|
||||
case "申请人姓名":
|
||||
affiliate.setName((fatchMap.get(dictData.getDictLabel())));
|
||||
break;
|
||||
case "统一社会信用代码":
|
||||
affiliate.setIdentityNum((fatchMap.get(dictData.getDictLabel())));
|
||||
break;
|
||||
case "法定代表人":
|
||||
affiliate.setCompLegalPerson(fatchMap.get(dictData.getDictLabel()));
|
||||
break;
|
||||
case "法定代表人职位":
|
||||
affiliate.setCompLegalperPost((fatchMap.get(dictData.getDictLabel())));
|
||||
break;
|
||||
case "申请人住所":
|
||||
affiliate.setResidenAffili((fatchMap.get(dictData.getDictLabel())));
|
||||
break;
|
||||
case "申请人联系地址":
|
||||
affiliate.setContactAddress(fatchMap.get(dictData.getDictLabel()));
|
||||
break;
|
||||
case "委托代理人姓名":
|
||||
affiliate.setNameAgent(fatchMap.get(dictData.getDictLabel()));
|
||||
break;
|
||||
case "委托代理人联系电话":
|
||||
affiliate.setContactTelphoneAgent(fatchMap.get(dictData.getDictLabel()));
|
||||
break;
|
||||
case "委托代理人电子邮件":
|
||||
affiliate.setAgentEmail(StrUtil.isNotEmpty(fatchMap.get(dictData.getDictLabel())) ? fatchMap.get(dictData.getDictLabel()).replace("\n","").replaceAll("\\s", "") : null);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装被申请人内置字段
|
||||
* @param dictData 内置字段
|
||||
* @param fatchMap 抓取内容
|
||||
* @param debtorAffiliate 被申请人
|
||||
*/
|
||||
private void buildDebtorColumn(SysDictData dictData, Map<String, String> fatchMap, CaseAffiliate debtorAffiliate) {
|
||||
|
||||
debtorAffiliate.setIdentityType(2);
|
||||
// 被申请人
|
||||
switch (dictData.getDictLabel()) {
|
||||
case "被申请人姓名":
|
||||
debtorAffiliate.setName(fatchMap.get(dictData.getDictLabel()));
|
||||
break;
|
||||
case "被申请人身份证号":
|
||||
String identityNum = fatchMap.get(dictData.getDictLabel());
|
||||
debtorAffiliate.setIdentityNum(fatchMap.get(dictData.getDictLabel()));
|
||||
// 出生年月日,从身份证抓取
|
||||
if (StrUtil.isNotEmpty(identityNum)) {
|
||||
identityNum=identityNum.replace("\n","");
|
||||
Map<String, String> identityNumMap = getBirAgeSex(identityNum);
|
||||
String birthday = identityNumMap.get("birthday");
|
||||
if (StrUtil.isNotEmpty(birthday)) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date birthdayDate = null;
|
||||
try {
|
||||
birthdayDate = simpleDateFormat.parse(birthday);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
debtorAffiliate.setResponBirth(birthdayDate);
|
||||
}
|
||||
//从身份证抓取性别
|
||||
debtorAffiliate.setResponSex(identityNumMap.get("sexCode"));
|
||||
}
|
||||
|
||||
break;
|
||||
case "被申请人住所":
|
||||
debtorAffiliate.setResidenAffili(fatchMap.get(dictData.getDictLabel()));
|
||||
break;
|
||||
case "被申请人联系电话":
|
||||
debtorAffiliate.setContactTelphone(fatchMap.get(dictData.getDictLabel()));
|
||||
break;
|
||||
case "被申请人电子邮件":
|
||||
debtorAffiliate.setEmail(StrUtil.isNotEmpty(fatchMap.get(dictData.getDictLabel())) ? fatchMap.get(dictData.getDictLabel()).replace("\n","").replaceAll("\\s", "") : null);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 金额格式化,增加千分位
|
||||
* @param money
|
||||
* @return
|
||||
*/
|
||||
private String moneyFormat(String money) {
|
||||
// 金额格式化
|
||||
try {
|
||||
Double.parseDouble(money);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
String regEx = "[^0-9]";
|
||||
Pattern p = Pattern.compile(regEx);
|
||||
Matcher m = p.matcher(money);
|
||||
String result = m.replaceAll("").trim();
|
||||
BigDecimal bigDecimal = null;
|
||||
if (money.contains("百")) {
|
||||
bigDecimal = new BigDecimal(result).multiply(new BigDecimal("100"));
|
||||
} else if (money.contains("千")) {
|
||||
bigDecimal = new BigDecimal(result).multiply(new BigDecimal("1000"));
|
||||
} else if (money.contains("万")) {
|
||||
bigDecimal = new BigDecimal(result).multiply(new BigDecimal("10000"));
|
||||
} else if (money.contains("百万")) {
|
||||
bigDecimal = new BigDecimal(result).multiply(new BigDecimal("1000000"));
|
||||
} else if (money.contains("千万")) {
|
||||
bigDecimal = new BigDecimal(result).multiply(new BigDecimal("10000000"));
|
||||
} else if (money.contains("亿")) {
|
||||
bigDecimal = new BigDecimal(result).multiply(new BigDecimal("100000000"));
|
||||
}
|
||||
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
return format.format(bigDecimal);
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增动态配置字段值表
|
||||
* @param fatchMap
|
||||
@@ -3327,19 +3421,19 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
XWPFDocument xdoc = new XWPFDocument(fis);
|
||||
XWPFWordExtractor extractor = new XWPFWordExtractor(xdoc);
|
||||
buffer = extractor.getText();
|
||||
|
||||
sb.append(buffer!=null?buffer:"");
|
||||
|
||||
|
||||
// OPCPackage opcPackage = POIXMLDocument.openPackage(filePath);
|
||||
// XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
|
||||
// buffer = extractor.getText();
|
||||
if(buffer.length() > 0){
|
||||
//使用换行符分割字符串
|
||||
String [] arry = buffer.split("\r\n");
|
||||
for (String string : arry) {
|
||||
sb.append(string.trim());
|
||||
}
|
||||
}
|
||||
// if(buffer.length() > 0){
|
||||
// //使用换行符分割字符串
|
||||
// String [] arry = buffer.split("\n");
|
||||
// for (String string : arry) {
|
||||
// sb.append(string.trim());
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -3379,7 +3473,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
//文件转成base64
|
||||
String base64 = OCRUtils.pdfConvertBase64(pdfUrl);
|
||||
if (base64 == null) {
|
||||
throw new ServiceException("文件转成base64,转码失败");
|
||||
throw new ServiceException("pdf转base64失败");
|
||||
// return false;
|
||||
}
|
||||
StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.wisdomarbitrate.domain.FatchRule;
|
||||
import com.tencentcloudapi.bsca.v20210811.models.LicenseSummary;
|
||||
import com.tencentcloudapi.common.Credential;
|
||||
@@ -218,27 +219,26 @@ public class OCRUtils {
|
||||
if (StrUtil.isEmpty(fatchRule.getStartContent())) {
|
||||
continue;
|
||||
}
|
||||
// 开始截取字符串 申请人:赵会
|
||||
// String[] startContentSplit = ocrText.split(fatchRule.getStartContent());
|
||||
int startFirstIndex = ocrText.indexOf(fatchRule.getStartContent()) + fatchRule.getStartContent().length();
|
||||
if(startFirstIndex<0){
|
||||
continue;
|
||||
}
|
||||
if (ocrText.length() >= startFirstIndex) {
|
||||
ocrText = ocrText.substring(startFirstIndex);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(fatchRule.getEndContent())) {
|
||||
if(ocrText.indexOf(fatchRule.getEndContent())>=0) {
|
||||
int endFirstIndex = ocrText.indexOf(fatchRule.getEndContent()) + fatchRule.getEndContent().length();
|
||||
if (ocrText.length() >= (endFirstIndex - fatchRule.getEndContent().length())) {
|
||||
fatchMap.put(fatchRule.getColumn(), ocrText.substring(0, endFirstIndex - fatchRule.getEndContent().length()));
|
||||
ocrText = ocrText.substring(endFirstIndex - fatchRule.getEndContent().length());
|
||||
}
|
||||
if (StrUtil.isNotEmpty(fatchRule.getStartContent()) && StrUtil.isNotEmpty(fatchRule.getEndContent())) {
|
||||
String s = StringUtils.substringBetween(ocrText, fatchRule.getStartContent(), fatchRule.getEndContent());
|
||||
if(StrUtil.isNotEmpty(s)){
|
||||
fatchMap.put(fatchRule.getColumnName(), StrUtil.trim(s));
|
||||
}else {
|
||||
fatchMap.put(fatchRule.getColumnName(),"");
|
||||
}
|
||||
|
||||
}else if(StrUtil.isNotEmpty(fatchRule.getStartContent()) && StrUtil.isEmpty(fatchRule.getEndContent())){
|
||||
String s = StringUtils.substringAfter(ocrText,fatchRule.getStartContent());
|
||||
if(StrUtil.isNotEmpty(s)){
|
||||
fatchMap.put(fatchRule.getColumnName(), StrUtil.trim(s));
|
||||
}else {
|
||||
fatchMap.put(fatchRule.getColumnName(),"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user