1. 添加案件是添加案件行为人
parent
33c84c1cab
commit
e20796da87
@ -0,0 +1,17 @@
|
||||
package com.supervision.police.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.supervision.police.domain.CasePerson;
|
||||
|
||||
public interface CasePersonService extends IService<CasePerson> {
|
||||
|
||||
|
||||
/**
|
||||
* 新增案件行为人
|
||||
* @param caseId 案件id
|
||||
* @param caseActorName 案件行为人姓名
|
||||
* @param caseActorIdCard 案件行为人身份证号
|
||||
* @return 插入结果 true 成功 false 失败
|
||||
*/
|
||||
boolean saveCaseActor(String caseId,String caseActorName,String caseActorIdCard);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.supervision.police.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.supervision.police.domain.CasePerson;
|
||||
import com.supervision.police.mapper.CasePersonMapper;
|
||||
import com.supervision.police.service.CasePersonService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CasePersonServiceImpl extends ServiceImpl<CasePersonMapper, CasePerson> implements CasePersonService {
|
||||
@Override
|
||||
public boolean saveCaseActor(String caseId, String caseActorName, String caseActorIdCard) {
|
||||
|
||||
if (StrUtil.isEmpty(caseId) || StrUtil.isEmpty(caseActorName) || StrUtil.isEmpty(caseActorIdCard)){
|
||||
log.info("案件行为人信息不能为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
Long count = super.lambdaQuery().eq(CasePerson::getCaseId, caseId).eq(CasePerson::getIdCard, caseActorIdCard).count();
|
||||
if (count > 0){
|
||||
log.info("案件行为人:{},已经存在于案件:{}之中", caseActorIdCard, caseId);
|
||||
return false;
|
||||
}
|
||||
|
||||
CasePerson casePerson = new CasePerson();
|
||||
casePerson.setCaseId(caseId);
|
||||
casePerson.setName(caseActorName);
|
||||
casePerson.setIdCard(caseActorIdCard);
|
||||
casePerson.setCaseActorFlag(1);
|
||||
// 角色设置为行为人
|
||||
casePerson.setRoleCode("1");
|
||||
return super.save(casePerson);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue