Commit 10b7b262 by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-platform-auth into developer
parents 82531dcb 8524c904
......@@ -66,6 +66,20 @@ public interface TabSysUserMapper {
int countByPhone(@Param("phone") String phone, @Param("userId") Integer userId,
@Param("enterpriseId") Integer enterpriseId);
/**
* 手机号码查询个数
* @Title: countByPhoneAndLoginType

* @Description:

 * @author guojuxing
* @param phone
* @param userId
* @param enterpriseId

* @param loginType
* @return int


 */
int countByPhoneAndLoginType(@Param("phone") String phone, @Param("userId") Integer userId,
@Param("enterpriseId") Integer enterpriseId, @Param("loginType") Integer loginType);
TabSysUser selectByEnterpriseId(@Param("enterpriseId") Integer enterpriseId);
List<TabSysUser> listAllUserByPhoneNumber(@Param("phoneNumber") String phoneNumber);
......
......@@ -48,6 +48,19 @@ public interface UserService {
*/
boolean isPhoneRepeat(Integer userId, String phone, Integer enterpriseId);
/**
* 手机号码是否重复
* @Title: isPhoneRepeat

* @Description:

 * @author guojuxing
* @param userId
* @param phone 手机号码
* @param enterpriseId 商户ID
* @param loginType
 管理员类别
* @return boolean


 */
boolean isPhoneRepeat(Integer userId, String phone, Integer enterpriseId, Integer loginType);
TabSysUser getUserByEnterpriseId(Integer enterpriseId);
List<TabSysUser> listAllUserByPhoneNumber(String phoneNumber);
......
......@@ -75,6 +75,18 @@ public class UserServiceImpl implements UserService {
}
@Override
public boolean isPhoneRepeat(Integer userId, String phone, Integer enterpriseId, Integer loginType) {
if (loginType == null) {
loginType = LoginUserTypeEnum.GIC_USER.getCode();
}
int count = tabSysUserMapper.countByPhoneAndLoginType(phone, userId, enterpriseId, loginType);
if (count > 0) {
return true;
}
return false;
}
@Override
public TabSysUser getUserByEnterpriseId(Integer enterpriseId) {
return tabSysUserMapper.selectByEnterpriseId(enterpriseId);
}
......
......@@ -232,6 +232,9 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService {
String[] strArr = string.split(SignConstants.UNDERLINE);
List<Integer> list = new ArrayList<>(strArr.length);
for (String str : strArr) {
if (StringUtils.isBlank(str)) {
continue;
}
list.add(Integer.parseInt(str));
}
return list;
......
......@@ -62,7 +62,7 @@ public class UserApiServiceImpl implements UserApiService {
if (!paramResult.isSuccess()) {
return paramResult;
}
if (userService.isPhoneRepeat(null, userDTO.getPhoneNumber(), userDTO.getEnterpriseId())) {
if (userService.isPhoneRepeat(null, userDTO.getPhoneNumber(), userDTO.getEnterpriseId(), null)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "手机号码不能重复");
}
......@@ -127,7 +127,8 @@ public class UserApiServiceImpl implements UserApiService {
if (userDTO.getEnterpriseId() == null) {
ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "商户ID不能为空");
}
if (userService.isPhoneRepeat(null, userDTO.getPhoneNumber(), userDTO.getEnterpriseId())) {
if (userService.isPhoneRepeat(null, userDTO.getPhoneNumber(), userDTO.getEnterpriseId(),
LoginUserTypeEnum.OPERATION_USER.getCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "手机号码不能重复");
}
return ServiceResponse.success(userService.saveOperationUser(userDTO));
......@@ -140,7 +141,7 @@ public class UserApiServiceImpl implements UserApiService {
if (!paramResult.isSuccess()) {
return paramResult;
}
if (userService.isPhoneRepeat(null, userDTO.getPhoneNumber(), userDTO.getEnterpriseId())) {
if (userService.isPhoneRepeat(null, userDTO.getPhoneNumber(), userDTO.getEnterpriseId(), null)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "手机号码不能重复");
}
if (userDTO.getPasswordType() == null) {
......@@ -167,7 +168,7 @@ public class UserApiServiceImpl implements UserApiService {
if (tabUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "用户ID输入有误");
}
if (userService.isPhoneRepeat(userDTO.getUserId(), userDTO.getPhoneNumber(), tabUser.getEnterpriseId())) {
if (userService.isPhoneRepeat(userDTO.getUserId(), userDTO.getPhoneNumber(), tabUser.getEnterpriseId(), null)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "手机号码不能重复");
}
//gic管理员只有一个超管
......@@ -405,7 +406,8 @@ public class UserApiServiceImpl implements UserApiService {
}
@Override
public ServiceResponse<String> editPhoneOrPassword(Integer userId, String nationCode, String phone, String password) {
public ServiceResponse<String> editPhoneOrPassword(Integer userId, String nationCode, String phone,
String password) {
TabSysUser tabUser = userService.getUserById(userId);
if (tabUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "用户ID输入有误,无此数据");
......
......@@ -197,6 +197,17 @@
and phone_number = #{phone}
</select>
<select id="countByPhoneAndLoginType" resultType="int">
select count(1) from tab_sys_user
where status = 1
<if test="userId != null">
and user_id <![CDATA[ <> ]]> #{userId}
</if>
and enterprise_id = #{enterpriseId}
and phone_number = #{phone}
and login_type = #{loginType}
</select>
<select id="selectByEnterpriseId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment