修改用户手机,密码,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,19 +50,19 @@ public class UserHelper implements UserHelperI {
|
|||
*/
|
||||
@Autowired
|
||||
private Tbl_User_Mapper tbl_User_Mapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private DeviceHelperI deviceHelperI;
|
||||
|
||||
|
||||
@Autowired
|
||||
private HardWareTypeHelperI hardWareTypeHelperI;
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisKeyHelperI redisKeyHelperI;
|
||||
|
||||
|
||||
@Autowired
|
||||
private SendMobile sendMobile;
|
||||
|
||||
|
||||
@Autowired
|
||||
private FastDFSClientI fastDFSClientI;
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ public class UserHelper implements UserHelperI {
|
|||
dataMap.put("userSex", user.getUserSex());
|
||||
dataMap.put("userImg", user.getUserImg());
|
||||
dataMap.put("nickName", user.getNickName());
|
||||
|
||||
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), dataMap);
|
||||
}
|
||||
|
||||
|
|
@ -353,7 +353,7 @@ public class UserHelper implements UserHelperI {
|
|||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object updateUser(Tbl_User user) {
|
||||
try {
|
||||
|
|
@ -382,7 +382,7 @@ public class UserHelper implements UserHelperI {
|
|||
curUser.setUserSex(userSex);
|
||||
bln = true;
|
||||
}
|
||||
|
||||
|
||||
String registerId = user.getJiguangUserid();
|
||||
if (StringUtils.isNotBlank(registerId)) {
|
||||
curUser.setJiguangUserid(registerId);
|
||||
|
|
@ -431,7 +431,7 @@ public class UserHelper implements UserHelperI {
|
|||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Tbl_User user = getUserById(userId);
|
||||
user.setUserImg(img);
|
||||
int i = tbl_User_Mapper.updateUser(user);
|
||||
|
|
@ -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(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号从缓存或数据库中取得用户对象
|
||||
*
|
||||
|
|
@ -620,7 +662,7 @@ public class UserHelper implements UserHelperI {
|
|||
dataMap.put("device", deviceMap.get("list"));
|
||||
dataMap.put("camera", deviceMap.get("list2"));
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), dataMap);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -720,7 +762,7 @@ public class UserHelper implements UserHelperI {
|
|||
if (tmpUser.getUpdateTime() != null) {
|
||||
userMap.put("updateTime", IfishUtil.format(tmpUser.getUpdateTime()));
|
||||
}
|
||||
|
||||
|
||||
return userMap;
|
||||
}
|
||||
|
||||
|
|
@ -749,9 +791,9 @@ public class UserHelper implements UserHelperI {
|
|||
//封装设备返回信息
|
||||
list.add(getDeviceInfo(device, deviceUser));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Map map = new HashMap();
|
||||
map.put("list", list);
|
||||
map.put("list2", list2);
|
||||
|
|
@ -867,5 +909,5 @@ public class UserHelper implements UserHelperI {
|
|||
return IfishUtil.returnJson(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