| | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.common.utils.Sm4Utils; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | { |
| | | return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | if (user.getIsDriver() == 0 && !userService.checkDriverUnique(user)){ |
| | | return error("新增用户'" + user.getUserName() + "'失败,驾驶员已绑定其他账户"); |
| | | |
| | | }else{ |
| | | user.setDriverId(null); |
| | | } |
| | | |
| | | user.setCreateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | return toAjax(userService.insertUser(user)); |
| | |
| | | { |
| | | return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | if (user.getIsDriver() == 0 && !userService.checkDriverUnique(user)){ |
| | | return error("新增用户'" + user.getUserName() + "'失败,驾驶员已绑定其他账户"); |
| | | |
| | | } |
| | | |
| | | user.setUpdateBy(getUsername()); |
| | | return toAjax(userService.updateUser(user)); |
| | | } |
| | |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(Sm4Utils.decryptSm4(user.getPassword())) ; |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setUpdateBy(getUsername()); |
| | | return toAjax(userService.resetPwd(user)); |