Commit 01746378 by zhangjing

fixed 服务商修改用户名和密码

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@23794 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 380f33c3
......@@ -2,6 +2,7 @@ package com.glsx.usercenter.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.glsx.common.annotation.AuthCheck;
import com.glsx.common.annotation.Log;
import com.glsx.common.constants.Constants;
import com.glsx.common.constants.ResultObject;
......@@ -45,6 +46,7 @@ public class ProviderController extends BaseController {
* @param bindingResult
* @return
*/
@AuthCheck
@RequestMapping(value = "/save", method = {RequestMethod.POST})
@Log(menuName = "服务商管理-新增/编辑", operateType = Constants.SYS_LOG_OPERATE_TYPE_SAVE)
public ResultObject save(@Validated(value = {Default.class}) SysManager sysManager, BindingResult bindingResult) {
......
......@@ -6,6 +6,7 @@ import com.glsx.common.constants.ResultObject;
import com.glsx.common.feign.client.CommonClient;
import com.glsx.common.feign.client.OrderClient;
import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.StringUtils;
import com.glsx.usercenter.constants.ResultCodeEnum;
import com.glsx.usercenter.exception.BusinessException;
import com.glsx.usercenter.mapper.*;
......@@ -24,7 +25,6 @@ import com.glsx.usercenter.service.SysUserService;
import com.glsx.usercenter.utils.QRCodeUtil;
import com.glsx.usercenter.utils.ShiroUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.crazycake.shiro.RedisSessionDAO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -95,14 +95,35 @@ public class SysProviderServiceImpl implements ISysProviderService {
return new ResultObject(ResultCodeEnum.FAIL.getCode(),
"该用户账号已存在, 如果是编辑服务商请传ID到后台");
}
sysManager.setPassword(sysUserService.encryptPassword(sysManager.getPassword()));
String password = sysManager.getPassword();
if (StringUtils.isEmpty(password)) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(),
"密码必填");
}
sysManager.setPassword(sysUserService.encryptPassword(password));
sysManager.setCreateTime(DateUtil.getCurrentTime());
sysManager.setCreateBy(ShiroUtil.getUserId());
} else {
//修改
SysUser user = new SysUser();
user.setId(sysManager.getId());
SysUser oldUser = sysUserService.getUserById(user);
//修改用户名
String newUsername = sysManager.getUsername();
if (StringUtils.isNotEmpty(newUsername)) {
if (!oldUser.getUsername().equalsIgnoreCase(newUsername)) {
List<SysUser> users = sysUserService.findByUserName(newUsername);
if (CollectionUtils.isNotEmpty(users)) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(),
"用户名【" + newUsername + "】已存在, 请使用其它用户名");
}
}
}
//修改密码
String password = sysManager.getPassword();
if (!com.glsx.common.utils.StringUtils.isEmpty(password)) {
if (StringUtils.isNotEmpty(password)) {
sysManager.setPassword(sysUserService.encryptPassword(sysManager.getPassword()));
} else {
sysManager.setPassword(oldUser.getPassword());
}
//强制(已注销或停用的用户)下线
if (!"sys_user_status_normal".equals(sysManager.getUserStatus())) {
......
......@@ -535,7 +535,7 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="password != null">
<if test="password != null and password.trim() != ''">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="sex != null">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!