|  | @@ -21,6 +21,7 @@ import com.xunmei.system.domain.SysUserRole;
 | 
	
		
			
				|  |  |  import com.xunmei.system.service.*;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.ArrayUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  import org.springframework.validation.annotation.Validated;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  import org.springframework.web.multipart.MultipartFile;
 | 
	
	
		
			
				|  | @@ -159,6 +160,7 @@ public class SysUserController extends BaseController {
 | 
	
		
			
				|  |  |      @RequiresPermissions("system:user:add")
 | 
	
		
			
				|  |  |      @Log(title = "用户管理", businessType = BusinessType.INSERT)
 | 
	
		
			
				|  |  |      @PostMapping
 | 
	
		
			
				|  |  | +    @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      public AjaxResult add(@Validated @RequestBody SysUser user) {
 | 
	
		
			
				|  |  |          if (!userService.checkUserNameUnique(user)) {
 | 
	
		
			
				|  |  |              return error("新增用户'" + user.getUsername() + "'失败,登录账号已存在");
 | 
	
	
		
			
				|  | @@ -169,21 +171,26 @@ public class SysUserController extends BaseController {
 | 
	
		
			
				|  |  |  //        {
 | 
	
		
			
				|  |  |  //            return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
 | 
	
		
			
				|  |  |  //        }
 | 
	
		
			
				|  |  | -        if (user.getRoleIds()!=null&&user.getRoleIds().length > 0) {
 | 
	
		
			
				|  |  | -            for (Long roleId :
 | 
	
		
			
				|  |  | -                    user.getRoleIds()) {
 | 
	
		
			
				|  |  | -                sysUserRoleService.insertSysUserRole(new SysUserRole(user.getId(), roleId));
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  |          user.setCreateBy(SecurityUtils.getUsername());
 | 
	
		
			
				|  |  |          user.setCreateTime(new Date());
 | 
	
		
			
				|  |  |          //isp的加密方式
 | 
	
		
			
				|  |  |          final String salt = SaltHelper.salt();
 | 
	
		
			
				|  |  |          user.setSalt(salt);
 | 
	
		
			
				|  |  |          user.setPassword(SaltHelper.exec(user.getPassword(), salt));
 | 
	
		
			
				|  |  | +        userService.insertUser(user);
 | 
	
		
			
				|  |  | +//        if (user.getId()!=null&&user.getRoleIds()!=null&&user.getRoleIds().length > 0) {
 | 
	
		
			
				|  |  | +//            for (Long roleId :
 | 
	
		
			
				|  |  | +//                    user.getRoleIds()) {
 | 
	
		
			
				|  |  | +//                SysUserRole sysUserRole = new SysUserRole();
 | 
	
		
			
				|  |  | +//                sysUserRole.setUserId(user.getId());
 | 
	
		
			
				|  |  | +//                sysUserRole.setRoleId(roleId);
 | 
	
		
			
				|  |  | +//                sysUserRoleService.insertSysUserRole(sysUserRole);
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  //        user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
 | 
	
		
			
				|  |  | -        return toAjax(userService.insertUser(user));
 | 
	
		
			
				|  |  | +        return AjaxResult.success();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 |