mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
创建运营商校验输入信息是否重复
This commit is contained in:
@@ -5,6 +5,7 @@ import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.entity.SysDept;
|
||||
import com.jsowell.common.core.domain.entity.SysUser;
|
||||
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.DictUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
@@ -17,6 +18,7 @@ import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.system.service.SysDeptService;
|
||||
import com.jsowell.system.service.SysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -91,6 +93,9 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertPileMerchantInfo(CreateMerchantDTO dto) {
|
||||
// 校验参数
|
||||
verifyParameters(dto);
|
||||
|
||||
// 1. 新增sys_dept
|
||||
SysDept dept = new SysDept();
|
||||
dept.setParentId(100L);
|
||||
@@ -130,6 +135,46 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* verifyParameters
|
||||
*/
|
||||
private void verifyParameters(CreateMerchantDTO dto) {
|
||||
PileMerchantInfo pileMerchantInfo;
|
||||
// 校验组织机构代码是否重复
|
||||
if (StringUtils.isNotBlank(dto.getOrganizationCode())) {
|
||||
pileMerchantInfo = new PileMerchantInfo();
|
||||
pileMerchantInfo.setOrganizationCode(dto.getOrganizationCode());
|
||||
List<PileMerchantInfo> pileMerchantInfos = pileMerchantInfoMapper.selectPileMerchantInfoList(pileMerchantInfo);
|
||||
if (CollectionUtils.isNotEmpty(pileMerchantInfos)) {
|
||||
throw new BusinessException("", "输入的组织机构代码已存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 校验运营商名称是否重复
|
||||
if (StringUtils.isNotBlank(dto.getMerchantName())) {
|
||||
pileMerchantInfo = new PileMerchantInfo();
|
||||
pileMerchantInfo.setMerchantName(dto.getMerchantName());
|
||||
List<PileMerchantInfo> pileMerchantInfos = pileMerchantInfoMapper.selectPileMerchantInfoList(pileMerchantInfo);
|
||||
if (CollectionUtils.isNotEmpty(pileMerchantInfos)) {
|
||||
for (PileMerchantInfo merchantInfo : pileMerchantInfos) {
|
||||
if (StringUtils.equals(merchantInfo.getMerchantName(), dto.getMerchantName())) {
|
||||
throw new BusinessException("", "输入的运营商名称已存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 校验手机号是否重复
|
||||
if (StringUtils.isNotBlank(dto.getManagerPhone())) {
|
||||
pileMerchantInfo = new PileMerchantInfo();
|
||||
pileMerchantInfo.setManagerPhone(dto.getManagerPhone());
|
||||
List<PileMerchantInfo> pileMerchantInfos = pileMerchantInfoMapper.selectPileMerchantInfoList(pileMerchantInfo);
|
||||
if (CollectionUtils.isNotEmpty(pileMerchantInfos)) {
|
||||
throw new BusinessException("", "输入的管理员电话已存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改充电桩运营商信息
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user