Browse Source

校验分队下成员手机号唯一

master
sunyuchao 4 years ago
parent
commit
e2eb6343c3
  1. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolTeamServiceImpl.java

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolTeamServiceImpl.java

@ -48,7 +48,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -74,6 +76,14 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl<IcPlacePatrolT
@Override
@Transactional(rollbackFor = Exception.class)
public void add(AddPlacePatrolTeamFormDTO formDTO) {
//检验分队下添加的人员手机号唯一
Map<String, String> map = new HashMap<>();
formDTO.getMemberList().forEach(m -> {
if(map.containsKey(m.getMobile())){
throw new RenException(String.format("新增巡查人员管理失败,分队下人员手机号重复,重复手机号->%s", m.getMobile()));
}
map.put(m.getMobile(),m.getName());
});
//1.分队主表新增数据
IcPlacePatrolTeamEntity entity = ConvertUtils.sourceToTarget(formDTO, IcPlacePatrolTeamEntity.class);
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
@ -101,6 +111,14 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl<IcPlacePatrolT
@Override
@Transactional(rollbackFor = Exception.class)
public void edit(EditPlacePatrolTeamFormDTO formDTO) {
//检验分队下添加的人员手机号唯一
Map<String, String> map = new HashMap<>();
formDTO.getMemberList().forEach(m -> {
if(map.containsKey(m.getMobile())){
throw new RenException(String.format("修改巡查人员管理失败,分队下人员手机号重复,重复手机号->%s", m.getMobile()));
}
map.put(m.getMobile(),m.getName());
});
//1.修改分队主表信息
IcPlacePatrolTeamEntity entity = baseDao.selectById(formDTO.getTeamId());
if (null == entity) {

Loading…
Cancel
Save