案件修改 #238

Merged
wangqiong123 merged 1 commits from wq into dev 2023-11-24 06:34:46 +00:00
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;
}
/**
@@ -48,6 +48,7 @@
<result property="lockStatus" column="lock_status" />
<result property="version" column="version" />
<result property="updateSubmitStatus" column="update_submit_status" />
<result property="properPreser" column="proper_preser" />
</resultMap>
<insert id="insert" parameterType="com.ruoyi.wisdomarbitrate.domain.CaseApplication" useGeneratedKeys="true" keyProperty="id">
insert into case_application_log(
@@ -69,6 +70,7 @@
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="version != null ">version,</if>
<if test="updateSubmitStatus != null ">update_submit_status,</if>
<if test="properPreser != null ">proper_preser,</if>
create_time
)values(
<if test="caseAppliId != null">#{caseAppliId},</if>
@@ -89,6 +91,7 @@
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="version != null ">#{version},</if>
<if test="updateSubmitStatus != null ">#{updateSubmitStatus},</if>
<if test="properPreser != null ">#{properPreser},</if>
sysdate()
)
</insert>
@@ -130,7 +133,7 @@
<select id="selectByCaseIdAndVersion" resultMap="CaseApplicationResult">
SELECT case_appli_id id,id caseLogId,case_appli_id caseAppliId ,case_name,case_num,case_subject_amount,arbitrat_claims,request_rule,loan_start_date,
loan_end_date,claim_princi_owed,claim_interest_owed,claim_liquid_damag,fee_payable,contract_number,
create_by,version,update_submit_status,create_time
create_by,version,update_submit_status,create_time,proper_preser
FROM case_application_log
WHERE case_appli_id = #{caseAppliId} and version=#{version}
</select>
@@ -138,7 +141,7 @@
<select id="selectLatestCase" resultMap="CaseApplicationResult">
SELECT id caseLogId,case_appli_id caseAppliId ,case_name,case_num,case_subject_amount,arbitrat_claims,request_rule,loan_start_date,
loan_end_date,claim_princi_owed,claim_interest_owed,claim_liquid_damag,fee_payable,contract_number,
create_by,version,update_submit_status,create_time
create_by,version,update_submit_status,create_time,proper_preser
FROM case_application_log
WHERE case_appli_id = #{caseAppliId} ORDER BY version DESC limit 1
</select>
@@ -156,7 +159,7 @@
<select id="selectBeforeCase" resultMap="CaseApplicationResult">
SELECT case_appli_id id,id caseLogId,case_appli_id caseAppliId ,case_name,case_num,case_subject_amount,arbitrat_claims,request_rule,loan_start_date,
loan_end_date,claim_princi_owed,claim_interest_owed,claim_liquid_damag,fee_payable,contract_number,
create_by,version,update_submit_status,create_time
create_by,version,update_submit_status,create_time,proper_preser
FROM case_application_log
WHERE case_appli_id = #{caseId} and version &lt; #{version} and update_submit_status not in ( 4, 5 ) order by version desc limit 1
</select>