修改用户手机,密码,token
This commit is contained in:
parent
22712b91c4
commit
f26af8a2f4
|
|
@ -33,7 +33,7 @@ public class Device {
|
|||
* @param macAddress
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/bindDevice.do", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/bindDevice.do", method = RequestMethod.POST)
|
||||
public Object bindDevice(Integer userId, String macAddress) {
|
||||
try {
|
||||
return deviceHelperI.bindDevice(userId, macAddress);
|
||||
|
|
|
|||
|
|
@ -111,4 +111,17 @@ public class Login {
|
|||
return userHelperI.updateUserImg(file, userId, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户手机和密码
|
||||
*
|
||||
* @param userId
|
||||
* @param password
|
||||
* @param phoneNumber
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/updateUserPassword", method = RequestMethod.POST)
|
||||
public Object updateUserPassword(Integer userId, String password, String phoneNumber, String token) {
|
||||
return userHelperI.updateUserPassword(userId, password, phoneNumber, token);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -446,6 +446,48 @@ public class UserHelper implements UserHelperI {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户手机号码和密码
|
||||
*
|
||||
* @param userId
|
||||
* @param password
|
||||
* @param phoneNumber
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object updateUserPassword(Integer userId, String password, String phoneNumber, String token) {
|
||||
try {
|
||||
if (userId == null || userId == 0) {
|
||||
return IfishUtil.toJson(ResultEnum.error401.getKey(), "");
|
||||
}
|
||||
if (StringUtils.isBlank(password) && StringUtils.isBlank(phoneNumber) && StringUtils.isBlank(token)) {
|
||||
return IfishUtil.toJson(ResultEnum.error401.getKey(), "");
|
||||
}
|
||||
Tbl_User user = getUserById(userId);
|
||||
if (user == null || user.getUserId() <= 0) {
|
||||
return IfishUtil.toJson(ResultEnum.error401.getKey(), "");
|
||||
}
|
||||
if (StringUtils.isNotBlank(password)) {
|
||||
user.setUserPassword(password);
|
||||
}
|
||||
if (StringUtils.isNotBlank(phoneNumber)) {
|
||||
user.setPhoneNumber(phoneNumber);
|
||||
}
|
||||
if (StringUtils.isNotBlank(token)) {
|
||||
user.setToken(token);
|
||||
}
|
||||
int i = tbl_User_Mapper.updateUser(user);
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteRedisByTbl_User(user);
|
||||
Map userMap = getUserMap(user);
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), userMap);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号从缓存或数据库中取得用户对象
|
||||
*
|
||||
|
|
|
|||
|
|
@ -108,4 +108,13 @@ public interface UserHelperI {
|
|||
*/
|
||||
public Object updateUserImg(MultipartFile file, Integer userId, String path);
|
||||
|
||||
/**
|
||||
* 修改用户手机号码和密码
|
||||
*
|
||||
* @param userId
|
||||
* @param password
|
||||
* @param phoneNumber
|
||||
* @return
|
||||
*/
|
||||
public Object updateUserPassword(Integer userId, String password, String phoneNumber, String token);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,10 @@ public class Tbl_User_MapperSql {
|
|||
sb.append("latitude = #{user.latitude}, ");
|
||||
}
|
||||
if (user.getLongitude() != null && user.getLongitude() > 0) {
|
||||
sb.append("longitude = #{iser.longitude}, ");
|
||||
sb.append("longitude = #{user.longitude}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(user.getToken())) {
|
||||
sb.append("token = #{user.token}, ");
|
||||
}
|
||||
sb.append("update_time = NOW() ");
|
||||
sb.append(" WHERE user_id = #{user.userId}");
|
||||
|
|
|
|||
Loading…
Reference in New Issue