案件修改

This commit is contained in:
18792927508
2023-11-24 14:34:22 +08:00
parent 3c424b60a4
commit 080e77a79d
3 changed files with 58 additions and 40 deletions
@@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.enums.UpdateSubmitStatus;
import com.ruoyi.common.enums.YesOrNoEnum;
import com.ruoyi.common.utils.ObjectFieldUtils;
@@ -23,6 +24,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
@@ -110,6 +112,8 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
if (Objects.equals(vo.getIsAgree(), YesOrNoEnum.YES.getCode())) {
// 如果版本号为1,则直接返回
if(vo.getVersion() <= 1){
vo.setUpdateSubmitStatus(UpdateSubmitStatus.AGREE.getCode());
caseApplicationLogMapper.updateStatus(vo);
return AjaxResult.success();
}
// 同意,查询日志记录表本版本数据,将数据更新到主表,并将日志表改版本的状态改为同意
@@ -238,6 +242,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliLogId(beforeCase.getCaseLogId());
caseAttach.setAnnexType(2);
caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach);
beforeCase.setCaseAttachList(caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach));
caseAttach.setCaseAppliLogId(afterCase.getCaseLogId());
afterCase.setCaseAttachList(caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach));
@@ -251,6 +256,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
"nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent","residenAffili","compLegalPerson",
"compLegalperPost","responSex","responBirth"};
StringBuilder changeColumn = new StringBuilder();
// 对比基本字段
for (String column : columns) {
String beforeValue = ObjectFieldUtils.getValue(beforeCase, column);
String afterValue = ObjectFieldUtils.getValue(afterCase, column);
@@ -269,6 +275,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
}
}
// 对比人员字段
List<CaseAffiliate> beforeCaseCaseAffiliates = beforeCase.getCaseAffiliates();
List<CaseAffiliate> afterCaseCaseAffiliates = afterCase.getCaseAffiliates();
Map<Integer, CaseAffiliate> beforeCaseCaseAffiliateMap = null;
@@ -285,8 +292,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
affiliateChangeColumn.append(column).append(",");
}
}
else if (beforeCaseCaseAffiliates == null && afterCaseCaseAffiliates != null) {
} else if (beforeCaseCaseAffiliates == null && afterCaseCaseAffiliates != null) {
affiliateChangeColumn = new StringBuilder();
for (String column : affiliateColumns) {
@@ -330,6 +336,28 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
}
}
boolean notEmptyFlag = CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isEmpty(beforeCase.getCaseAttachList());
boolean emptyFlag = CollectionUtil.isEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList());
// 对比附件
if(notEmptyFlag || emptyFlag){
changeColumn.append("fileColumn");
}else if(CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList())){
if(beforeCase.getCaseAttachList().size()!=afterCase.getCaseAttachList().size()){
changeColumn.append("fileColumn");
}else {
Map<String, CaseAttach> afterAttachMap = afterCase.getCaseAttachList().stream().collect(Collectors.toMap(CaseAttach::getAnnexPath, Function.identity(), (n1, n2) -> n2));
for (CaseAttach beforeCaseAttach : beforeCase.getCaseAttachList()) {
if(!afterAttachMap.containsKey(beforeCaseAttach.getAnnexPath())) {
changeColumn.append("fileColumn");
break;
}
}
}
}
compareCaseVO.setChangeColumn(changeColumn.toString());
@@ -347,7 +375,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
caseApplicationLog = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion() );
}else {
caseApplicationLog = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion() - 1);
caseApplicationLog = caseApplicationLogMapper.selectBeforeCase(vo.getCaseId(), vo.getVersion() );
}
if (caseApplicationLog == null) {
return;
@@ -1096,24 +1096,28 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
// 异步新增案件日志
ThreadPoolUtil.execute(() -> {
caseApplication.setCaseAppliId(caseApplication.getId());
int insertRow = caseApplicationLogMapper.insert(caseApplication);
if (insertRow != 0 ) {
if( CollectionUtil.isNotEmpty(caseAffiliates)) {
caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getId()));
// 插入案件日志人员相关表
caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliates);
}
if(CollectionUtil.isNotEmpty(caseAttachList)) {
// 插入日志附件表
for (CaseAttach caseAttach : caseAttachList) {
// 查询附件表
CaseAttach attach = caseAttachMapper.queryAnnexById(caseAttach.getAnnexId());
attach.setCaseAppliLogId(caseApplication.getId());
caseAttachLogMapper.save(attach);
try {
caseApplication.setCaseAppliId(caseApplication.getId());
int insertRow = caseApplicationLogMapper.insert(caseApplication);
if (insertRow != 0 ) {
if( CollectionUtil.isNotEmpty(caseAffiliates)) {
caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getId()));
// 插入案件日志人员相关表
caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliates);
}
if(CollectionUtil.isNotEmpty(caseAttachList)) {
// 插入日志附件表
for (CaseAttach caseAttach : caseAttachList) {
// 查询附件表
CaseAttach attach = caseAttachMapper.queryAnnexById(caseAttach.getAnnexId());
attach.setCaseAppliLogId(caseApplication.getId());
caseAttachLogMapper.save(attach);
}
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
});
@@ -2762,25 +2766,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Transactional
public List<ReservedConference> reserveConferenceList(Long caseId) {
List<ReservedConference> reservedConferences = reservedConferenceMapper.selectListByCaseId(caseId);
List<ReservedConference> result = new ArrayList<>();
// 判断当前时间是否大于结束时间,如果大于,则把该房间删掉
if (CollectionUtil.isNotEmpty(reservedConferences)) {
List<Long> ids = new ArrayList<>();
for (ReservedConference reservedConference : reservedConferences) {
Date endTime = reservedConference.getScheduleEndTime();
Date now = new Date();
if (now.after(endTime)) {
ids.add(reservedConference.getId());
} else {
result.add(reservedConference);
}
}
if (CollectionUtil.isNotEmpty(ids)) {
// 根据id批量删除
reservedConferenceMapper.batchDeleteByIds(ids);
}
}
return result;
return reservedConferences;
}
/**