You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
142 lines
3.9 KiB
Java
142 lines
3.9 KiB
Java
package com.supervision.police.dto;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.io.unit.DataSizeUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.supervision.common.constant.EvidenceConstants;
|
|
import com.supervision.police.domain.EvidenceCategory;
|
|
import lombok.Data;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
|
|
/**
|
|
* 证据处理DTO
|
|
*/
|
|
@Data
|
|
public class EvidenceProcessDTO {
|
|
|
|
/**
|
|
* 证据id
|
|
*/
|
|
private String evidenceId;
|
|
|
|
|
|
/**
|
|
* 证据名称
|
|
*/
|
|
private String evidenceName;
|
|
|
|
/**
|
|
* 附件名称
|
|
*/
|
|
private String attachmentName;
|
|
|
|
/**
|
|
* 模板id
|
|
*/
|
|
private String templateId;
|
|
|
|
|
|
/**
|
|
* 模板类型名称
|
|
*/
|
|
private String templateName;
|
|
|
|
/**
|
|
* 证据类型
|
|
*/
|
|
private String evidenceType;
|
|
|
|
/**
|
|
* 证据类型名称
|
|
*/
|
|
private String evidenceTypeName;
|
|
|
|
|
|
/**
|
|
* 附件大小
|
|
*/
|
|
private String attachmentSize;
|
|
|
|
/**
|
|
* 处理状态
|
|
*/
|
|
private String status;
|
|
|
|
/**
|
|
* 目录id
|
|
*/
|
|
private String directoryId;
|
|
|
|
public EvidenceProcessDTO() {
|
|
}
|
|
|
|
public EvidenceProcessDTO(CaseEvidenceDetailDTO caseEvidence) {
|
|
this.evidenceId = caseEvidence.getId();
|
|
this.evidenceName = caseEvidence.getEvidenceName();
|
|
this.directoryId = caseEvidence.getDirectoryId();
|
|
if (CollUtil.isNotEmpty(caseEvidence.getFileList())){
|
|
this.attachmentName = caseEvidence.getFileList()
|
|
.stream().map(EvidenceFileDTO::getFileName).collect(Collectors.joining(","));
|
|
Integer sum = caseEvidence.getFileList().stream().map(EvidenceFileDTO::getFileSize).reduce(0, Integer::sum);
|
|
this.attachmentSize = DataSizeUtil.format(sum);
|
|
}
|
|
this.evidenceType = caseEvidence.getEvidenceType();
|
|
if (StrUtil.isNotEmpty(caseEvidence.getProcessStatus())){
|
|
this.status = EvidenceConstants.PROCESS_STATUS_MAPPING.get(caseEvidence.getProcessStatus());
|
|
}
|
|
}
|
|
|
|
|
|
public void setTemplateInfo(List<EvidenceDirectoryDTO> directoryList,List<EvidenceCategory> categoryList){
|
|
|
|
if (CollUtil.isEmpty(directoryList)){
|
|
return;
|
|
}
|
|
|
|
EvidenceDirectoryDTO directory = null;
|
|
for (EvidenceDirectoryDTO directoryDTO : directoryList) {
|
|
directory = directoryDTO.findDirectory(this.directoryId);
|
|
if (null != directory){
|
|
break;
|
|
}
|
|
}
|
|
if (null == directory){
|
|
return;
|
|
}
|
|
|
|
Map<String, EvidenceCategory> categoryMap = categoryList.stream().collect(Collectors.toMap(EvidenceCategory::getId, v -> v));
|
|
|
|
EvidenceCategory category = categoryMap.get(directory.getCategoryId());
|
|
if (null != category){
|
|
this.templateId = category.getPromptId();
|
|
this.templateName = category.getCategoryName();
|
|
if (directory.getLevel()== 2){
|
|
this.evidenceTypeName = category.getCategoryName();
|
|
}
|
|
if (directory.getLevel() == 3){
|
|
String parentId = category.getParentId();
|
|
if (StrUtil.isNotEmpty(parentId)){
|
|
EvidenceCategory parentCategory = categoryMap.get(parentId);
|
|
if (null != parentCategory){
|
|
this.evidenceTypeName = StrUtil.join(" / ", parentCategory.getCategoryName(), category.getCategoryName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public void setEvidenceTypeName(List<EvidenceCategory> categoryList){
|
|
if (StrUtil.isNotEmpty(this.evidenceType)){
|
|
Map<String, EvidenceCategory> categoryMap = categoryList.stream().collect(Collectors.toMap(EvidenceCategory::getId, v -> v));
|
|
EvidenceCategory category = categoryMap.get(this.evidenceType);
|
|
if (null != category){
|
|
this.evidenceTypeName = category.getCategoryName();
|
|
}
|
|
}
|
|
}
|
|
}
|