|
@@ -2,6 +2,7 @@ package com.hz.employmentsite.services.impl.baseSettings;
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
+import com.hz.employmentsite.filter.exception.BaseException;
|
|
import com.hz.employmentsite.mapper.PcSiteUserMapper;
|
|
import com.hz.employmentsite.mapper.PcSiteUserMapper;
|
|
import com.hz.employmentsite.mapper.SysRoleMapper;
|
|
import com.hz.employmentsite.mapper.SysRoleMapper;
|
|
import com.hz.employmentsite.mapper.SysUserMapper;
|
|
import com.hz.employmentsite.mapper.SysUserMapper;
|
|
@@ -90,14 +91,23 @@ public class SiteUserImpl implements SiteUserService {
|
|
@Override
|
|
@Override
|
|
public Integer save(SiteUserVo data, String userId) {
|
|
public Integer save(SiteUserVo data, String userId) {
|
|
int result = 0;
|
|
int result = 0;
|
|
|
|
+
|
|
|
|
+ // 手机号查重
|
|
|
|
+ List<String> byMobileSiteId = pcSiteUserMapper.selectByMobile(data.mobile);
|
|
|
|
+
|
|
SiteUserVo record = get(data.siteUserID);
|
|
SiteUserVo record = get(data.siteUserID);
|
|
- PcSiteUser dbData = record ==null ? null : pcSiteUserMapper.selectByPrimaryKey(record.siteUserID);
|
|
|
|
|
|
+ PcSiteUser dbData = record == null ? null : pcSiteUserMapper.selectByPrimaryKey(record.siteUserID);
|
|
Boolean isExist = dbData != null;
|
|
Boolean isExist = dbData != null;
|
|
- SysUser curSysUserData = data.userID != null ? sysUserMapper.selectByPrimaryKey(data.userID):null;
|
|
|
|
|
|
+ SysUser curSysUserData = data.userID != null ? sysUserMapper.selectByPrimaryKey(data.userID) : null;
|
|
Boolean isLinkUser = curSysUserData != null;
|
|
Boolean isLinkUser = curSysUserData != null;
|
|
SysRoleExample roleExp = null;
|
|
SysRoleExample roleExp = null;
|
|
/*注意:这里的data.roleID为用户类型ID*/
|
|
/*注意:这里的data.roleID为用户类型ID*/
|
|
if (!isExist) {
|
|
if (!isExist) {
|
|
|
|
+ // 添加时有重复手机号立即报错
|
|
|
|
+ if (!byMobileSiteId.isEmpty()) {
|
|
|
|
+ throw new BaseException("500", "该手机号已绑定其他驿站人员");
|
|
|
|
+ }
|
|
|
|
+
|
|
//添加
|
|
//添加
|
|
//处理用户表
|
|
//处理用户表
|
|
curSysUserData = new SysUser();
|
|
curSysUserData = new SysUser();
|
|
@@ -125,9 +135,14 @@ public class SiteUserImpl implements SiteUserService {
|
|
dbData.setCreateTime(new Date());
|
|
dbData.setCreateTime(new Date());
|
|
result += pcSiteUserMapper.insert(dbData);
|
|
result += pcSiteUserMapper.insert(dbData);
|
|
} else {
|
|
} else {
|
|
|
|
+ // 修改时,ID列表中没有参数中的ID才报错
|
|
|
|
+ if (!byMobileSiteId.isEmpty() && !byMobileSiteId.contains(data.siteID)) {
|
|
|
|
+ throw new BaseException("500", "该手机号已绑定其他驿站人员");
|
|
|
|
+ }
|
|
|
|
+
|
|
//修改
|
|
//修改
|
|
//处理用户表
|
|
//处理用户表
|
|
- if(isLinkUser){
|
|
|
|
|
|
+ if (isLinkUser) {
|
|
curSysUserData.setName(data.siteUserName);
|
|
curSysUserData.setName(data.siteUserName);
|
|
curSysUserData.setUserTypeID(data.roleID);
|
|
curSysUserData.setUserTypeID(data.roleID);
|
|
curSysUserData.setLoginID(StrToPinYin(data.siteUserName));
|
|
curSysUserData.setLoginID(StrToPinYin(data.siteUserName));
|