|
|
|
@ -20,7 +20,6 @@ import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyDTO; |
|
|
|
|
import digital.laboratory.platform.entrustment.dto.MaterialDTO; |
|
|
|
|
import digital.laboratory.platform.entrustment.entity.CaseEvent; |
|
|
|
|
import digital.laboratory.platform.entrustment.entity.EntrustAlterApply; |
|
|
|
|
import digital.laboratory.platform.entrustment.entity.Entrustment; |
|
|
|
|
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial; |
|
|
|
|
import digital.laboratory.platform.entrustment.enums.AnalysisOptionEnums; |
|
|
|
|
import digital.laboratory.platform.entrustment.enums.EntrustAlterApplyStatus; |
|
|
|
@ -31,6 +30,7 @@ import digital.laboratory.platform.entrustment.service.EntrustAlterApplyService; |
|
|
|
|
import digital.laboratory.platform.entrustment.service.EntrustmentIdentificationMaterialService; |
|
|
|
|
import digital.laboratory.platform.entrustment.service.EntrustmentService; |
|
|
|
|
import digital.laboratory.platform.entrustment.vo.EntrustAlterApplyVO; |
|
|
|
|
import digital.laboratory.platform.entrustment.vo.EntrustmentVO; |
|
|
|
|
import digital.laboratory.platform.sys.entity.DrugLite; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
@ -214,11 +214,11 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public Boolean updateEntrust(ApprovedUpdateEntrustDTO dto) { |
|
|
|
|
StringBuilder updateRecordBuilder = new StringBuilder(); // 更新记录
|
|
|
|
|
Entrustment entrustment = validUpdateInfoAndGetEntrustInfo(dto, updateRecordBuilder); |
|
|
|
|
EntrustmentVO entrustVO = validUpdateInfoAndGetEntrustInfo(dto, updateRecordBuilder); |
|
|
|
|
// 提取委托id
|
|
|
|
|
String entrustId = entrustment.getId(); |
|
|
|
|
CaseEvent oldCaseInfo = caseEventService.getById(entrustment.getCaseId()); |
|
|
|
|
caseEventService.update(Wrappers.<CaseEvent>lambdaUpdate().eq(CaseEvent::getId, entrustment.getCaseId()) |
|
|
|
|
String entrustId = entrustVO.getId(); |
|
|
|
|
CaseEvent oldCaseInfo = caseEventService.getById(entrustVO.getCaseId()); |
|
|
|
|
caseEventService.update(Wrappers.<CaseEvent>lambdaUpdate().eq(CaseEvent::getId, entrustVO.getCaseId()) |
|
|
|
|
.set(CaseEvent::getCaseBrief, dto.getCaseBrief()) |
|
|
|
|
.set(CaseEvent::getCaseName, dto.getCaseName()) |
|
|
|
|
.set(CaseEvent::getHappenTime, dto.getHappenTime()) |
|
|
|
@ -228,42 +228,34 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM |
|
|
|
|
|
|
|
|
|
boolean isTypeName = false; |
|
|
|
|
if (!oldCaseInfo.getCaseBrief().equals(dto.getCaseBrief())) { |
|
|
|
|
opDate = LocalDateTime.now(); |
|
|
|
|
updateRecordBuilder.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:"); |
|
|
|
|
opDate = initUpdateRecordInfo(opDate, updateRecordBuilder); |
|
|
|
|
updateRecordBuilder.append("<br>该委托案件的案件简要由 [").append(oldCaseInfo.getCaseBrief()).append("] 更改为 [").append(dto.getCaseBrief()).append("] 。"); |
|
|
|
|
} |
|
|
|
|
if (!oldCaseInfo.getCaseName().equals(dto.getCaseName())) { |
|
|
|
|
if (opDate == null) { |
|
|
|
|
opDate = LocalDateTime.now(); |
|
|
|
|
updateRecordBuilder.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:"); |
|
|
|
|
} |
|
|
|
|
opDate = initUpdateRecordInfo(opDate, updateRecordBuilder); |
|
|
|
|
updateRecordBuilder.append("<br>该委托案件的案件名称由 [").append(oldCaseInfo.getCaseName()).append("] 更改为 [").append(dto.getCaseName()).append("] 。"); |
|
|
|
|
} |
|
|
|
|
if (dto.getHappenTime() != null && !oldCaseInfo.getHappenTime().equals(dto.getHappenTime().toLocalDate())) { |
|
|
|
|
if (opDate == null) { |
|
|
|
|
opDate = LocalDateTime.now(); |
|
|
|
|
updateRecordBuilder.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:"); |
|
|
|
|
} |
|
|
|
|
opDate = initUpdateRecordInfo(opDate, updateRecordBuilder); |
|
|
|
|
updateRecordBuilder.append("<br>该委托案件的案发时间由 [").append(oldCaseInfo.getHappenTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))).append("] 更改为 [").append(dto.getHappenTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))).append("] 。"); |
|
|
|
|
} |
|
|
|
|
if (dto.getEntrustmentTime() != null && entrustment.getEntrustmentTime().equals(dto.getEntrustmentTime())) { |
|
|
|
|
if (opDate == null) { |
|
|
|
|
opDate = LocalDateTime.now(); |
|
|
|
|
updateRecordBuilder.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:"); |
|
|
|
|
} |
|
|
|
|
updateRecordBuilder.append("<br>该委托案件的委托时间由 [").append(entrustment.getEntrustmentTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("] 更改为 [").append(dto.getEntrustmentTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("] 。"); |
|
|
|
|
if (dto.getEntrustmentTime() != null && entrustVO.getEntrustmentTime().equals(dto.getEntrustmentTime())) { |
|
|
|
|
opDate = initUpdateRecordInfo(opDate, updateRecordBuilder); |
|
|
|
|
updateRecordBuilder.append("<br>该委托案件的委托时间由 [").append(entrustVO.getEntrustmentTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("] 更改为 [").append(dto.getEntrustmentTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("] 。"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
entrustment.setEntrustmentTime(dto.getEntrustmentTime()); // 修改委托时间
|
|
|
|
|
entrustVO.setEntrustmentTime(dto.getEntrustmentTime()); // 修改委托时间
|
|
|
|
|
|
|
|
|
|
if (dto.getEntrustmentType() != null && dto.getEntrustmentType() != entrustment.getEntrustmentType()) { |
|
|
|
|
if (dto.getEntrustmentType() != null && dto.getEntrustmentType() != entrustVO.getEntrustmentType()) { |
|
|
|
|
isTypeName = true; |
|
|
|
|
entrustment.setEntrustmentType(dto.getEntrustmentType()); |
|
|
|
|
if (opDate == null) { |
|
|
|
|
opDate = LocalDateTime.now(); |
|
|
|
|
updateRecordBuilder.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:"); |
|
|
|
|
} |
|
|
|
|
updateRecordBuilder.append("<br>该委托案件的委托类型由 [").append(entrustment.getEntrustmentType() == 0 ? "常规毒品" : "生物样本").append("] 更改为 [").append(dto.getEntrustmentType() == 0 ? "常规毒品" : "生物样本").append("] 。"); |
|
|
|
|
entrustVO.setEntrustmentType(dto.getEntrustmentType()); |
|
|
|
|
opDate = initUpdateRecordInfo(opDate, updateRecordBuilder); |
|
|
|
|
updateRecordBuilder.append("<br>该委托案件的委托类型由 [").append(entrustVO.getEntrustmentType() == 0 ? "常规毒品" : "生物样本").append("] 更改为 [").append(dto.getEntrustmentType() == 0 ? "常规毒品" : "生物样本").append("] 。"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 更新嫌疑人信息
|
|
|
|
|
if (CollUtil.isNotEmpty(dto.getSuspectList())) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// 2.修改检材 信息
|
|
|
|
|
// 这里之所以要取未更新前的信息是为了留痕
|
|
|
|
@ -282,17 +274,33 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM |
|
|
|
|
entrustmentIdentificationMaterialService.updateBatchById(entrustmentIdentificationMaterialList); |
|
|
|
|
// 3. 更新委托鉴定要求和委托时间
|
|
|
|
|
|
|
|
|
|
updateEntrustmentRequirement(entrustment, dto.getEntrustRequirement(), updateRecordBuilder, opDate); |
|
|
|
|
updateEntrustmentRequirement(entrustVO, dto.getEntrustRequirement(), updateRecordBuilder, opDate); |
|
|
|
|
// 如果确认完成,则删除鉴定事项确认书和委托书,并更新申请状态为已完成
|
|
|
|
|
if (dto.getFinished()) { |
|
|
|
|
// 4.删除鉴定事项确认书和委托书
|
|
|
|
|
deleteConfirmEntrustLetter(entrustment.getEntrustmentNo(), entrustId); |
|
|
|
|
deleteConfirmEntrustLetter(entrustVO.getEntrustmentNo(), entrustId); |
|
|
|
|
} |
|
|
|
|
return super.update(Wrappers.<EntrustAlterApply>lambdaUpdate().eq(EntrustAlterApply::getId, dto.getId()) |
|
|
|
|
.set(EntrustAlterApply::getUpdateRecord, updateRecordBuilder.toString()) |
|
|
|
|
.set(dto.getFinished(), EntrustAlterApply::getStatus, EntrustAlterApplyStatus.FINISHED.getStatus())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 初始化更新记录信息的方法 |
|
|
|
|
* 此方法主要用于当操作日期为空时,初始化操作日期为当前时间,并更新记录信息 |
|
|
|
|
* |
|
|
|
|
* @param opDate 操作日期,可能为null |
|
|
|
|
* @param updateRecordBuilder 更新记录的字符串构建器,用于累积更新记录信息 |
|
|
|
|
* @return 返回初始化或更新后的操作日期 |
|
|
|
|
*/ |
|
|
|
|
private LocalDateTime initUpdateRecordInfo(LocalDateTime opDate, StringBuilder updateRecordBuilder) { |
|
|
|
|
if (opDate == null) { |
|
|
|
|
opDate = LocalDateTime.now(); |
|
|
|
|
updateRecordBuilder.append(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).append("<br>案件更新记录:"); |
|
|
|
|
} |
|
|
|
|
return opDate; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 处理更新委托鉴定检材信息 |
|
|
|
|
* |
|
|
|
@ -490,27 +498,27 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM |
|
|
|
|
/** |
|
|
|
|
* 更新鉴定要求 |
|
|
|
|
* |
|
|
|
|
* @param entrustment |
|
|
|
|
* @param entrustVO |
|
|
|
|
* @param entrustRequirement |
|
|
|
|
* @param updateRecordBuilder |
|
|
|
|
* @param opDate |
|
|
|
|
*/ |
|
|
|
|
public void updateEntrustmentRequirement(Entrustment entrustment, String entrustRequirement, StringBuilder updateRecordBuilder, LocalDateTime opDate) { |
|
|
|
|
if (StrUtil.isNotBlank(entrustRequirement) && !entrustment.getEntrustRequirement().equals(entrustRequirement)) { |
|
|
|
|
public void updateEntrustmentRequirement(EntrustmentVO entrustVO, String entrustRequirement, StringBuilder updateRecordBuilder, LocalDateTime opDate) { |
|
|
|
|
if (StrUtil.isNotBlank(entrustRequirement) && !entrustVO.getEntrustRequirement().equals(entrustRequirement)) { |
|
|
|
|
if (opDate == null) { |
|
|
|
|
// 等于null 证明前面的信息并没有修改
|
|
|
|
|
opDate = LocalDateTime.now(); |
|
|
|
|
updateRecordBuilder.append(opDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
|
|
|
|
} |
|
|
|
|
updateRecordBuilder.append("<br>鉴定要求更新记录:").append("<br>原鉴定要求 [").append(entrustment.getEntrustRequirement()).append("] 修改为 [").append(entrustRequirement).append("]。"); |
|
|
|
|
updateRecordBuilder.append("<br>鉴定要求更新记录:").append("<br>原鉴定要求 [").append(entrustVO.getEntrustRequirement()).append("] 修改为 [").append(entrustRequirement).append("]。"); |
|
|
|
|
} else { |
|
|
|
|
List<EntrustmentIdentificationMaterial> renewList = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery() |
|
|
|
|
.eq(EntrustmentIdentificationMaterial::getEntrustmentId, entrustment.getId()) |
|
|
|
|
.eq(EntrustmentIdentificationMaterial::getEntrustmentId, entrustVO.getId()) |
|
|
|
|
.orderByAsc(EntrustmentIdentificationMaterial::getOrderNo)); |
|
|
|
|
entrustRequirement = entrustmentService.buildEntrustReq(renewList); |
|
|
|
|
} |
|
|
|
|
entrustment.setEntrustRequirement(entrustRequirement); |
|
|
|
|
entrustmentService.updateById(entrustment); |
|
|
|
|
entrustVO.setEntrustRequirement(entrustRequirement); |
|
|
|
|
entrustmentService.updateById(entrustVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -546,7 +554,7 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM |
|
|
|
|
* @param updateRecordBuilder 初始化 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private Entrustment validUpdateInfoAndGetEntrustInfo(ApprovedUpdateEntrustDTO dto, StringBuilder updateRecordBuilder) { |
|
|
|
|
private EntrustmentVO validUpdateInfoAndGetEntrustInfo(ApprovedUpdateEntrustDTO dto, StringBuilder updateRecordBuilder) { |
|
|
|
|
// 判断当前申请状态是否审核通过
|
|
|
|
|
EntrustAlterApply entrustAlterApply = super.getById(dto.getId()); |
|
|
|
|
if (entrustAlterApply == null) { |
|
|
|
@ -561,14 +569,14 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM |
|
|
|
|
} |
|
|
|
|
// 状态合法,开始修改委托信息
|
|
|
|
|
// 1. 修改委托案件简要
|
|
|
|
|
Entrustment entrustment = entrustmentService.getById(dto.getEntrustId()); |
|
|
|
|
if (entrustment == null) { |
|
|
|
|
EntrustmentVO entrustVO = entrustmentService.getEntrustmentVOById(dto.getEntrustId()); |
|
|
|
|
if (entrustVO == null) { |
|
|
|
|
throw new ValidateCodeException("修改的委托记录不存在!"); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotBlank(entrustAlterApply.getUpdateRecord())) { |
|
|
|
|
updateRecordBuilder.append(entrustAlterApply.getUpdateRecord()).append("<br>"); |
|
|
|
|
} |
|
|
|
|
return entrustment; |
|
|
|
|
return entrustVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|