|
@@ -22,11 +22,14 @@ import com.ozs.framework.web.service.TokenService;
|
|
import com.ozs.service.entity.BaseCameraManagement;
|
|
import com.ozs.service.entity.BaseCameraManagement;
|
|
import com.ozs.service.entity.BaseRailwayManagement;
|
|
import com.ozs.service.entity.BaseRailwayManagement;
|
|
import com.ozs.service.entity.MsgAlarm;
|
|
import com.ozs.service.entity.MsgAlarm;
|
|
|
|
+import com.ozs.service.entity.vo.BaseCameraManagementVo;
|
|
import com.ozs.service.entity.vo.MsgAlarmVo;
|
|
import com.ozs.service.entity.vo.MsgAlarmVo;
|
|
|
|
+import com.ozs.system.service.DataScoreUtil;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
@@ -75,7 +78,10 @@ public class SysUserController extends BaseController {
|
|
private TokenService tokenService;
|
|
private TokenService tokenService;
|
|
@Autowired
|
|
@Autowired
|
|
private ISysRoleService iSysRoleService;
|
|
private ISysRoleService iSysRoleService;
|
|
-
|
|
|
|
|
|
+ @Value("${base.defaultPassword:yn5aq5Mt.106.tky}")
|
|
|
|
+ private String defaultPassword;
|
|
|
|
+ @Autowired
|
|
|
|
+ private DataScoreUtil dataScoreUtil;
|
|
// /**
|
|
// /**
|
|
// * 获取用户列表
|
|
// * 获取用户列表
|
|
// */
|
|
// */
|
|
@@ -98,6 +104,7 @@ public class SysUserController extends BaseController {
|
|
@PostMapping("/list")
|
|
@PostMapping("/list")
|
|
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
|
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
|
public AjaxResult list(@RequestBody SysUserVo sysUserVo) {
|
|
public AjaxResult list(@RequestBody SysUserVo sysUserVo) {
|
|
|
|
+ sysUserVo= (SysUserVo) dataScoreUtil.setDataScore(getUserId(),sysUserVo);
|
|
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<SysUser>();
|
|
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<SysUser>();
|
|
if (!ObjectUtils.isEmpty(sysUserVo.getUserName())) {
|
|
if (!ObjectUtils.isEmpty(sysUserVo.getUserName())) {
|
|
wrapper.like(SysUser::getUserName, sysUserVo.getUserName());
|
|
wrapper.like(SysUser::getUserName, sysUserVo.getUserName());
|
|
@@ -114,11 +121,21 @@ public class SysUserController extends BaseController {
|
|
if (!ObjectUtils.isEmpty(sysUserVo.getStatus())) {
|
|
if (!ObjectUtils.isEmpty(sysUserVo.getStatus())) {
|
|
wrapper.eq(SysUser::getStatus, sysUserVo.getStatus());
|
|
wrapper.eq(SysUser::getStatus, sysUserVo.getStatus());
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ if(!sysUserVo.getDsFlay()){
|
|
|
|
+ if (!ObjectUtils.isEmpty(sysUserVo.getDsUserId())){
|
|
|
|
+ wrapper.eq(SysUser::getCreateBy, sysUserVo.getDsUserId()).or();
|
|
|
|
+ }
|
|
|
|
+ if (!ObjectUtils.isEmpty(sysUserVo.getDsDeptId())){
|
|
|
|
+ wrapper.eq(SysUser::getDeptId,sysUserVo.getDsDeptId()).or();
|
|
|
|
+ }
|
|
|
|
+ if (!ObjectUtils.isEmpty(sysUserVo.getDsDeptIds())){
|
|
|
|
+ wrapper.in(SysUser::getDeptId,sysUserVo.getDsDeptIds());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
IPage<SysUser> page = userService.page(new Page<>(sysUserVo.getPageNum(), sysUserVo.getPageSize()), wrapper);
|
|
IPage<SysUser> page = userService.page(new Page<>(sysUserVo.getPageNum(), sysUserVo.getPageSize()), wrapper);
|
|
if (!ObjectUtils.isEmpty(page) && !ObjectUtils.isEmpty(page.getRecords())) {
|
|
if (!ObjectUtils.isEmpty(page) && !ObjectUtils.isEmpty(page.getRecords())) {
|
|
List<SysUser> dto1 = page.getRecords().stream().map(o -> {
|
|
List<SysUser> dto1 = page.getRecords().stream().map(o -> {
|
|
- List<Long> longs=new ArrayList<>();
|
|
|
|
|
|
+ List<Long> longs = new ArrayList<>();
|
|
SysDept sysDept = deptService.selectDeptById(o.getDeptId());
|
|
SysDept sysDept = deptService.selectDeptById(o.getDeptId());
|
|
if (!ObjectUtils.isEmpty(sysDept)) {
|
|
if (!ObjectUtils.isEmpty(sysDept)) {
|
|
o.setDeptName(sysDept.getDeptName());
|
|
o.setDeptName(sysDept.getDeptName());
|
|
@@ -128,7 +145,7 @@ public class SysUserController extends BaseController {
|
|
for (SysRole role : roles) {
|
|
for (SysRole role : roles) {
|
|
longs.add(role.getRoleId());
|
|
longs.add(role.getRoleId());
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
longs = iSysRoleService.selectRoleListByUserId(o.getId());
|
|
longs = iSysRoleService.selectRoleListByUserId(o.getId());
|
|
}
|
|
}
|
|
Long[] objects = longs.toArray(new Long[]{});
|
|
Long[] objects = longs.toArray(new Long[]{});
|
|
@@ -144,7 +161,7 @@ public class SysUserController extends BaseController {
|
|
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
|
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
|
@PostMapping("/export")
|
|
@PostMapping("/export")
|
|
public void export(HttpServletResponse response, SysUser user) {
|
|
public void export(HttpServletResponse response, SysUser user) {
|
|
- List<Long> longs=new ArrayList<>();
|
|
|
|
|
|
+ List<Long> longs = new ArrayList<>();
|
|
List<SysUser> list = userService.selectUserList(user);
|
|
List<SysUser> list = userService.selectUserList(user);
|
|
for (SysUser sysUser : list) {
|
|
for (SysUser sysUser : list) {
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
@@ -154,7 +171,7 @@ public class SysUserController extends BaseController {
|
|
longs.add(role.getRoleId());
|
|
longs.add(role.getRoleId());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- longs= roleService.selectRoleListByUserId(sysUser.getId());
|
|
|
|
|
|
+ longs = roleService.selectRoleListByUserId(sysUser.getId());
|
|
}
|
|
}
|
|
for (Long aLong : longs) {
|
|
for (Long aLong : longs) {
|
|
SysRole sysRole = roleService.selectRoleById(aLong);
|
|
SysRole sysRole = roleService.selectRoleById(aLong);
|
|
@@ -204,7 +221,7 @@ public class SysUserController extends BaseController {
|
|
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
|
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
|
@GetMapping(value = {"/", "/{id}"})
|
|
@GetMapping(value = {"/", "/{id}"})
|
|
public AjaxResult getInfo(@PathVariable(value = "id", required = false) Long id) {
|
|
public AjaxResult getInfo(@PathVariable(value = "id", required = false) Long id) {
|
|
- userService.checkUserDataScope(id);
|
|
|
|
|
|
+// userService.checkUserDataScope(id);
|
|
AjaxResult ajax = AjaxResult.success();
|
|
AjaxResult ajax = AjaxResult.success();
|
|
List<SysRole> roles = roleService.selectRoleAll();
|
|
List<SysRole> roles = roleService.selectRoleAll();
|
|
ajax.put("roles", SysUser.isAdmin(id) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
|
ajax.put("roles", SysUser.isAdmin(id) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
|
@@ -223,10 +240,6 @@ public class SysUserController extends BaseController {
|
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
public AjaxResult add(@Validated @RequestBody SysUser user) {
|
|
public AjaxResult add(@Validated @RequestBody SysUser user) {
|
|
- boolean matches = user.getPassword().matches(PW_PATTERN);
|
|
|
|
- if (!matches) {
|
|
|
|
- return error("您的密码太简单!需要包含大小英文、数字、特殊字符、并且长度8-20");
|
|
|
|
- }
|
|
|
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user))) {
|
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user))) {
|
|
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
} else if (StringUtils.isNotEmpty(user.getPhoneNum())
|
|
} else if (StringUtils.isNotEmpty(user.getPhoneNum())
|
|
@@ -234,7 +247,6 @@ public class SysUserController extends BaseController {
|
|
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
|
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
|
}
|
|
}
|
|
user.setCreateBy(getUsername());
|
|
user.setCreateBy(getUsername());
|
|
- user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
|
|
|
return toAjax(userService.saveUser(user));
|
|
return toAjax(userService.saveUser(user));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -245,12 +257,8 @@ public class SysUserController extends BaseController {
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
|
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
|
public AjaxResult edit(@Validated @RequestBody SysUser user) {
|
|
public AjaxResult edit(@Validated @RequestBody SysUser user) {
|
|
- boolean matches = user.getPassword().matches(PW_PATTERN);
|
|
|
|
- if (!matches) {
|
|
|
|
- return error("您的密码太简单!需要包含大小英文、数字、特殊字符、并且长度8-20");
|
|
|
|
- }
|
|
|
|
- userService.checkUserAllowed(user);
|
|
|
|
- userService.checkUserDataScope(user.getId());
|
|
|
|
|
|
+// userService.checkUserAllowed(user);
|
|
|
|
+// userService.checkUserDataScope(user.getId());
|
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user))) {
|
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user))) {
|
|
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
} else if (StringUtils.isNotEmpty(user.getPhoneNum())
|
|
} else if (StringUtils.isNotEmpty(user.getPhoneNum())
|
|
@@ -261,7 +269,6 @@ public class SysUserController extends BaseController {
|
|
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
|
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
|
}
|
|
}
|
|
user.setUpdateBy(getUsername());
|
|
user.setUpdateBy(getUsername());
|
|
- user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
|
|
|
return toAjax(userService.updateUsers(user));
|
|
return toAjax(userService.updateUsers(user));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -278,8 +285,8 @@ public class SysUserController extends BaseController {
|
|
return error("您的密码太简单!需要包含大小英文、数字、特殊字符、并且长度8-20");
|
|
return error("您的密码太简单!需要包含大小英文、数字、特殊字符、并且长度8-20");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- userService.checkUserAllowedUpdate(user);
|
|
|
|
- userService.checkUserDataScope(user.getId());
|
|
|
|
|
|
+// userService.checkUserAllowedUpdate(user);
|
|
|
|
+// userService.checkUserDataScope(user.getId());
|
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUniqueUpdate(user))) {
|
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUniqueUpdate(user))) {
|
|
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
} else if (StringUtils.isNotEmpty(user.getPhoneNum())
|
|
} else if (StringUtils.isNotEmpty(user.getPhoneNum())
|
|
@@ -340,13 +347,35 @@ public class SysUserController extends BaseController {
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
@PutMapping("/resetPwd")
|
|
@PutMapping("/resetPwd")
|
|
public AjaxResult resetPwd(@RequestBody SysUser user) {
|
|
public AjaxResult resetPwd(@RequestBody SysUser user) {
|
|
- userService.checkUserAllowed(user);
|
|
|
|
- userService.checkUserDataScope(user.getId());
|
|
|
|
- user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
|
|
|
|
|
+// boolean matches = user.getPassword().matches(PW_PATTERN);
|
|
|
|
+// if (!matches) {
|
|
|
|
+// return error("您的密码太简单!需要包含大小英文、数字、特殊字符、并且长度8-20");
|
|
|
|
+// }
|
|
|
|
+// userService.checkUserAllowed(user);
|
|
|
|
+// userService.checkUserDataScope(user.getId());
|
|
|
|
+ user.setPassword(SecurityUtils.encryptPassword(defaultPassword));
|
|
user.setUpdateBy(getUsername());
|
|
user.setUpdateBy(getUsername());
|
|
return toAjax(userService.resetPwd(user));
|
|
return toAjax(userService.resetPwd(user));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 修改密码
|
|
|
|
+ */
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:user:updatePwd')")
|
|
|
|
+ @Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
|
|
+ @PutMapping("/updatePwd")
|
|
|
|
+ public AjaxResult updatePwd(@RequestBody SysUser user) {
|
|
|
|
+ boolean matches = user.getPassword().matches(PW_PATTERN);
|
|
|
|
+ if (!matches) {
|
|
|
|
+ return error("您的密码太简单!需要包含大小英文、数字、特殊字符、并且长度8-20");
|
|
|
|
+ }
|
|
|
|
+// userService.checkUserAllowed(user);
|
|
|
|
+// userService.checkUserDataScope(user.getId());
|
|
|
|
+ user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
|
|
|
+ user.setUpdateBy(getUsername());
|
|
|
|
+ return toAjax(userService.resetPwd(user));
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 状态修改
|
|
* 状态修改
|
|
*/
|
|
*/
|
|
@@ -354,8 +383,8 @@ public class SysUserController extends BaseController {
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
@PutMapping("/changeStatus")
|
|
@PutMapping("/changeStatus")
|
|
public AjaxResult changeStatus(@RequestBody SysUser user) {
|
|
public AjaxResult changeStatus(@RequestBody SysUser user) {
|
|
- userService.checkUserAllowed(user);
|
|
|
|
- userService.checkUserDataScope(user.getId());
|
|
|
|
|
|
+// userService.checkUserAllowed(user);
|
|
|
|
+// userService.checkUserDataScope(user.getId());
|
|
user.setUpdateBy(getUsername());
|
|
user.setUpdateBy(getUsername());
|
|
return toAjax(userService.updateUserStatus(user));
|
|
return toAjax(userService.updateUserStatus(user));
|
|
}
|
|
}
|
|
@@ -381,7 +410,7 @@ public class SysUserController extends BaseController {
|
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
|
@PutMapping("/authRole")
|
|
@PutMapping("/authRole")
|
|
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {
|
|
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {
|
|
- userService.checkUserDataScope(userId);
|
|
|
|
|
|
+// userService.checkUserDataScope(userId);
|
|
userService.insertUserAuth(userId, roleIds);
|
|
userService.insertUserAuth(userId, roleIds);
|
|
return success();
|
|
return success();
|
|
}
|
|
}
|