增加了嫌疑人的录入
This commit is contained in:
@@ -18,14 +18,8 @@ import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
|
||||
import digital.laboratory.platform.common.oss.service.OssFile;
|
||||
import digital.laboratory.platform.entrustment.convert.CaseEventConvert;
|
||||
import digital.laboratory.platform.entrustment.dto.UpdateCaseAndEntrustTypeDTO;
|
||||
import digital.laboratory.platform.entrustment.entity.CaseEvent;
|
||||
import digital.laboratory.platform.entrustment.entity.CaseEvidence;
|
||||
import digital.laboratory.platform.entrustment.entity.Entrustment;
|
||||
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
|
||||
import digital.laboratory.platform.entrustment.service.CaseEventService;
|
||||
import digital.laboratory.platform.entrustment.service.CaseEvidenceService;
|
||||
import digital.laboratory.platform.entrustment.service.EntrustmentIdentificationMaterialService;
|
||||
import digital.laboratory.platform.entrustment.service.EntrustmentService;
|
||||
import digital.laboratory.platform.entrustment.entity.*;
|
||||
import digital.laboratory.platform.entrustment.service.*;
|
||||
import digital.laboratory.platform.entrustment.vo.CaseEventVO;
|
||||
import digital.laboratory.platform.othersys.vo.EntrustDataVo;
|
||||
import digital.laboratory.platform.sys.entity.SysOrg;
|
||||
@@ -74,6 +68,8 @@ public class CaseEventController {
|
||||
|
||||
private final OssFile ossFile;
|
||||
|
||||
private final SuspectService suspectService;
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询案件事件
|
||||
@@ -95,6 +91,8 @@ public class CaseEventController {
|
||||
}
|
||||
|
||||
Entrustment one = entrustmentService.getOne(Wrappers.<Entrustment>lambdaQuery().eq(Entrustment::getCaseId, id));
|
||||
String entrustId = one.getId();
|
||||
cevo.setSuspects(suspectService.list(Wrappers.<Suspect>lambdaQuery().eq(Suspect::getEntrustId, entrustId)));
|
||||
cevo.setEntrustmentType(one.getEntrustmentType());
|
||||
cevo.setOldIdentificationResult(one.getOldIdentificationResult());
|
||||
return R.ok(cevo);
|
||||
@@ -244,6 +242,19 @@ public class CaseEventController {
|
||||
.set(Entrustment::getEntrustmentType, dto.getEntrustmentType())
|
||||
.set(StrUtil.isNotBlank(dto.getOldIdentificationResult()), Entrustment::getOldIdentificationResult, dto.getOldIdentificationResult())
|
||||
);
|
||||
}
|
||||
// 把嫌疑人数组重新保存以便,以每次前端传来的数据为准
|
||||
if (ObjectUtil.isNotNull(dto.getSuspects())) {
|
||||
for (Suspect suspect : dto.getSuspects()) {
|
||||
if (StringUtils.isBlank(suspect.getIdNumber())||suspect.getIdNumber().length()!=18){
|
||||
throw new RuntimeException("请输入正确的身份证号码");
|
||||
}
|
||||
}
|
||||
List<Suspect> list = suspectService.list(Wrappers.<Suspect>lambdaQuery().eq(Suspect::getEntrustId, dto.getEntrustId()));
|
||||
suspectService.addSuspectList(dto.getSuspects(), dto.getEntrustId());
|
||||
suspectService.removeBatchByIds(list);
|
||||
|
||||
|
||||
}
|
||||
return R.ok(caseEvent, "保存案件信息成功");
|
||||
} else {
|
||||
|
||||
@@ -2,9 +2,11 @@ package digital.laboratory.platform.entrustment.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import digital.laboratory.platform.entrustment.entity.Entrustment;
|
||||
import digital.laboratory.platform.entrustment.entity.Suspect;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class EntrustmentDTO extends Entrustment {
|
||||
@@ -15,4 +17,6 @@ public class EntrustmentDTO extends Entrustment {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private LocalDate happenTime;
|
||||
|
||||
private List<Suspect> suspects;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@ package digital.laboratory.platform.entrustment.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import digital.laboratory.platform.entrustment.entity.Suspect;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "UpdateCaseAndEntrustTypeDTO", description = "更新案件信息和委托类型的DTO请求类")
|
||||
@@ -101,4 +103,7 @@ public class UpdateCaseAndEntrustTypeDTO {
|
||||
"常规毒品:首次鉴定、初筛(不要报告、只要结果)、补充鉴定、重新鉴定;" +
|
||||
"生物样本:首次鉴定、初筛(不要报告、只要结果)、涉缅人员、自愿戒治人员、补充鉴定、重新鉴定")
|
||||
private String oldIdentificationResult;
|
||||
|
||||
@ApiModelProperty(value="案件嫌疑人")
|
||||
private List<Suspect> suspects;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package digital.laboratory.platform.entrustment.entity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@TableName(value = "b_suspect", autoResultMap = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "委托嫌疑人")
|
||||
public class Suspect extends BaseEntity {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String idNumber;
|
||||
|
||||
private String phoneNumber;
|
||||
|
||||
private String sex;
|
||||
|
||||
private int age;
|
||||
|
||||
private String entrustId;
|
||||
|
||||
private int orderNo;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package digital.laboratory.platform.entrustment.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import digital.laboratory.platform.entrustment.entity.Suspect;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 委托嫌疑人数据访问接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface SuspectMapper extends BaseMapper<Suspect> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package digital.laboratory.platform.entrustment.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import digital.laboratory.platform.entrustment.entity.Suspect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 委托嫌疑人业务逻辑接口
|
||||
*/
|
||||
public interface SuspectService extends IService<Suspect> {
|
||||
List<Suspect> addSuspectList(List<Suspect> suspectList, String entrustId);
|
||||
}
|
||||
@@ -11,15 +11,9 @@ import digital.laboratory.platform.common.core.constant.OSSDirectoryConstants;
|
||||
import digital.laboratory.platform.common.core.util.R;
|
||||
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
|
||||
import digital.laboratory.platform.common.oss.service.OssFile;
|
||||
import digital.laboratory.platform.entrustment.entity.CaseEvent;
|
||||
import digital.laboratory.platform.entrustment.entity.CaseEvidence;
|
||||
import digital.laboratory.platform.entrustment.entity.Entrustment;
|
||||
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
|
||||
import digital.laboratory.platform.entrustment.entity.*;
|
||||
import digital.laboratory.platform.entrustment.mapper.CaseEventMapper;
|
||||
import digital.laboratory.platform.entrustment.service.CaseEventService;
|
||||
import digital.laboratory.platform.entrustment.service.CaseEvidenceService;
|
||||
import digital.laboratory.platform.entrustment.service.EntrustmentIdentificationMaterialService;
|
||||
import digital.laboratory.platform.entrustment.service.EntrustmentService;
|
||||
import digital.laboratory.platform.entrustment.service.*;
|
||||
import digital.laboratory.platform.entrustment.vo.CaseEventVO;
|
||||
import digital.laboratory.platform.othersys.vo.EntrustDataVo;
|
||||
import digital.laboratory.platform.sys.entity.SysOrg;
|
||||
@@ -61,6 +55,8 @@ public class CaseEventServiceImpl extends ServiceImpl<CaseEventMapper, CaseEvent
|
||||
@Resource
|
||||
private EntrustmentIdentificationMaterialService entrustmentIdentificationMaterialService;
|
||||
|
||||
@Resource
|
||||
private SuspectService suspectService;
|
||||
/**
|
||||
* 校验案件信息是否合法
|
||||
*
|
||||
@@ -358,8 +354,14 @@ public class CaseEventServiceImpl extends ServiceImpl<CaseEventMapper, CaseEvent
|
||||
ossFile.fileDelete(OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + e.getId() + "/" + attName);
|
||||
}
|
||||
|
||||
// 删除该委托绑定的嫌疑人
|
||||
suspectService.remove(Wrappers.<Suspect>lambdaQuery().eq(Suspect::getEntrustId, e.getId()));
|
||||
|
||||
// 删除委托本身
|
||||
entrustmentService.removeById(e.getId());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 删除全部物证
|
||||
|
||||
@@ -163,6 +163,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
@Resource
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Resource
|
||||
private SuspectService suspectService;
|
||||
|
||||
|
||||
// /**
|
||||
// * 审核人员由委托创建者选择。如果 true, 前台在委托提交审核前, 弹出界面让委托人选择审核者; 如果 false, 由系统自动选择审核者。
|
||||
@@ -359,6 +362,12 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
evo.setHappenTime(LocalDateTimeUtil.format(caseEventService.getById(evo.getCaseId()).getHappenTime(), "yyyy年MM月dd日"));
|
||||
evo.setStatusDescription(EntrustStatusConstants.getStatusDescription(evo.getStatus()));
|
||||
evo.setPreviousStatusDescription(EntrustStatusConstants.getStatusDescription(evo.getPreviousStatus()));
|
||||
evo.setSuspects(
|
||||
suspectService.list(Wrappers.<Suspect>lambdaQuery()
|
||||
.eq(Suspect::getEntrustId, evo.getId())
|
||||
.orderByAsc(Suspect::getOrderNo)
|
||||
)
|
||||
);
|
||||
return evo;
|
||||
}
|
||||
|
||||
@@ -3048,6 +3057,13 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
entrustment.setClientOrgName(entrustmentDTO.getClientOrgName());
|
||||
entrustment.setId(IdWorker.get32UUID().toUpperCase());
|
||||
entrustment.setCaseId(caseEvent.getId());
|
||||
|
||||
// 创建嫌疑人信息
|
||||
List<Suspect> suspects = entrustmentDTO.getSuspects();
|
||||
if (suspects!=null&&suspects.size()>0){
|
||||
suspectService.addSuspectList(suspects,entrustment.getId());
|
||||
}
|
||||
|
||||
this.save(entrustment);
|
||||
return entrustment;
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package digital.laboratory.platform.entrustment.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
import digital.laboratory.platform.entrustment.entity.Suspect;
|
||||
import digital.laboratory.platform.entrustment.mapper.SuspectMapper;
|
||||
import digital.laboratory.platform.entrustment.service.SuspectService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 委托嫌疑人业务逻辑实现类
|
||||
*/
|
||||
@Service
|
||||
public class SuspectServiceImpl extends ServiceImpl<SuspectMapper, Suspect> implements SuspectService {
|
||||
|
||||
/**
|
||||
* 批量添加嫌疑人信息并关联到指定委托
|
||||
*
|
||||
* @param suspectList 嫌疑人信息列表
|
||||
* @param entrustId 委托ID,用于关联嫌疑人与委托关系
|
||||
* @return 添加成功返回原嫌疑人列表,失败返回null
|
||||
*/
|
||||
@Override
|
||||
public List<Suspect> addSuspectList(List<Suspect> suspectList, String entrustId) {
|
||||
// 遍历嫌疑人列表进行预处理
|
||||
int orderNo = 1;
|
||||
for (Suspect suspect : suspectList) {
|
||||
// 生成全局唯一ID并设置(转为大写保证一致性)
|
||||
suspect.setId(IdWorker.get32UUID().toUpperCase());
|
||||
|
||||
// 从身份证号码中提取并填充性别和年龄信息
|
||||
String idNumber = suspect.getIdNumber();
|
||||
if (!StringUtils.isNotBlank(idNumber) || idNumber.length() != 18){
|
||||
throw new RuntimeException("身份证号码格式错误");
|
||||
}
|
||||
this.fillIdentityInfo(suspect);
|
||||
|
||||
// 关联委托ID,建立嫌疑人与委托的关系
|
||||
suspect.setEntrustId(entrustId);
|
||||
suspect.setOrderNo(orderNo);
|
||||
orderNo++;
|
||||
}
|
||||
|
||||
// 批量保存嫌疑人信息到数据库
|
||||
boolean ret = this.saveBatch(suspectList);
|
||||
|
||||
// 根据保存结果返回处理后的列表或null
|
||||
return ret ? suspectList : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从身份证号码中提取并填充性别和年龄信息
|
||||
*/
|
||||
private void fillIdentityInfo(Suspect suspect) {
|
||||
String idNumber = suspect.getIdNumber();
|
||||
|
||||
// 去除空格并转换为大写
|
||||
idNumber = idNumber.trim().toUpperCase();
|
||||
|
||||
// 校验身份证长度
|
||||
if (idNumber.length() == 18) {
|
||||
try {
|
||||
// 提取性别
|
||||
int genderCode = Integer.parseInt(idNumber.substring(16, 17));
|
||||
suspect.setSex(genderCode % 2 == 0 ? "女" : "男");
|
||||
|
||||
// 提取出生日期并计算年龄
|
||||
String birthDateStr = idNumber.substring(6, 14);
|
||||
LocalDate birthDate = LocalDate.parse(birthDateStr, DateTimeFormatter.BASIC_ISO_DATE);
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
long age = ChronoUnit.YEARS.between(birthDate, currentDate);
|
||||
suspect.setAge((int)age);
|
||||
|
||||
} catch (Exception e) {
|
||||
// 身份证格式异常,记录日志但不中断业务
|
||||
Log.info("身份证号码格式异常: {}", idNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package digital.laboratory.platform.entrustment.vo;
|
||||
|
||||
import digital.laboratory.platform.entrustment.entity.CaseEvent;
|
||||
import digital.laboratory.platform.entrustment.entity.CaseEvidence;
|
||||
import digital.laboratory.platform.entrustment.entity.Suspect;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -35,4 +36,6 @@ public class CaseEventVO extends CaseEvent {
|
||||
"常规毒品:首次鉴定、初筛(不要报告、只要结果)、补充鉴定、重新鉴定;" +
|
||||
"生物样本:首次鉴定、初筛(不要报告、只要结果)、涉缅人员、自愿戒治人员、补充鉴定、重新鉴定")
|
||||
private String oldIdentificationResult;
|
||||
|
||||
private List<Suspect> suspects;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package digital.laboratory.platform.entrustment.vo;
|
||||
import digital.laboratory.platform.common.aop.annotation.DlpFeign;
|
||||
import digital.laboratory.platform.entrustment.entity.Entrustment;
|
||||
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
|
||||
import digital.laboratory.platform.entrustment.entity.Suspect;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -90,4 +91,7 @@ public class EntrustmentVO extends Entrustment {
|
||||
|
||||
@ApiModelProperty("检材列表")
|
||||
private List<EntrustmentIdentificationMaterial> materialList;
|
||||
|
||||
@ApiModelProperty("嫌疑人列表")
|
||||
private List<Suspect>suspects;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user