|
@@ -1,6 +1,6 @@
|
|
|
package com.cyksj.web.controller.manage.cms;
|
|
package com.cyksj.web.controller.manage.cms;
|
|
|
|
|
|
|
|
-import cn.dev33.satoken.stp.StpUtil;
|
|
|
|
|
|
|
+import com.cyksj.web.util.StpAbroadUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
@@ -97,7 +97,7 @@ public class CmsAdminUserController {
|
|
|
@Log(module = "用户管理/新增用户", businessType = BusinessType.POST, isSaveRequestData = true)
|
|
@Log(module = "用户管理/新增用户", businessType = BusinessType.POST, isSaveRequestData = true)
|
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
|
public Result<String> saveAdmin(@RequestBody @Validated CmsUserReq cmsUserReq) throws Exception {
|
|
public Result<String> saveAdmin(@RequestBody @Validated CmsUserReq cmsUserReq) throws Exception {
|
|
|
- Long adminId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
|
+ Long adminId = StpAbroadUtil.getLoginIdAsLong();
|
|
|
CmsUser exist = cmsUserMapper.selectById(adminId);
|
|
CmsUser exist = cmsUserMapper.selectById(adminId);
|
|
|
if (exist == null) {
|
|
if (exist == null) {
|
|
|
throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
|
|
throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
|
|
@@ -135,7 +135,7 @@ public class CmsAdminUserController {
|
|
|
@DeleteMapping("/delete/{id}")
|
|
@DeleteMapping("/delete/{id}")
|
|
|
@Log(module = "用户管理/删除用户", businessType = BusinessType.DELETE)
|
|
@Log(module = "用户管理/删除用户", businessType = BusinessType.DELETE)
|
|
|
public Result<String> deleteAdminById(@PathVariable Long id) throws Exception {
|
|
public Result<String> deleteAdminById(@PathVariable Long id) throws Exception {
|
|
|
- Long adminId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
|
+ Long adminId = StpAbroadUtil.getLoginIdAsLong();
|
|
|
CmsUser exist = cmsUserMapper.selectById(adminId);
|
|
CmsUser exist = cmsUserMapper.selectById(adminId);
|
|
|
if (exist == null) {
|
|
if (exist == null) {
|
|
|
throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
|
|
throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
|
|
@@ -163,7 +163,7 @@ public class CmsAdminUserController {
|
|
|
cmsUserManager.delUserRoleRelation(id);
|
|
cmsUserManager.delUserRoleRelation(id);
|
|
|
cmsUserMapper.deleteById(id);
|
|
cmsUserMapper.deleteById(id);
|
|
|
//删除用户,将上线的用户踢下
|
|
//删除用户,将上线的用户踢下
|
|
|
- StpUtil.logoutByLoginId(id);
|
|
|
|
|
|
|
+ StpAbroadUtil.logoutByLoginId(id);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult("删除成功");
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult("删除成功");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -173,7 +173,7 @@ public class CmsAdminUserController {
|
|
|
@PutMapping("/put")
|
|
@PutMapping("/put")
|
|
|
@Log(module = "用户管理/编辑用户", businessType = BusinessType.PUT, isSaveRequestData = true)
|
|
@Log(module = "用户管理/编辑用户", businessType = BusinessType.PUT, isSaveRequestData = true)
|
|
|
public Result<String> editAdmin(@RequestBody CmsUserReq cmsUserReq) throws Exception {
|
|
public Result<String> editAdmin(@RequestBody CmsUserReq cmsUserReq) throws Exception {
|
|
|
- Long adminId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
|
+ Long adminId = StpAbroadUtil.getLoginIdAsLong();
|
|
|
CmsUser exist = cmsUserMapper.selectById(adminId);
|
|
CmsUser exist = cmsUserMapper.selectById(adminId);
|
|
|
if (exist == null) {
|
|
if (exist == null) {
|
|
|
throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
|
|
throw BusinessRuntimeException.getInstance("账号不存在,请重新登录");
|
|
@@ -209,7 +209,7 @@ public class CmsAdminUserController {
|
|
|
user.setModifiedBy(exist.getNickname());
|
|
user.setModifiedBy(exist.getNickname());
|
|
|
cmsUserMapper.updateById(user);
|
|
cmsUserMapper.updateById(user);
|
|
|
if (flag) {
|
|
if (flag) {
|
|
|
- StpUtil.logoutByLoginId(cmsUserReq.getId());
|
|
|
|
|
|
|
+ StpAbroadUtil.logoutByLoginId(cmsUserReq.getId());
|
|
|
}
|
|
}
|
|
|
//是不是客服
|
|
//是不是客服
|
|
|
CmsUserVO isCustomer = beanSearcher.searchFirst(CmsUserVO.class, MapUtils.builder()
|
|
CmsUserVO isCustomer = beanSearcher.searchFirst(CmsUserVO.class, MapUtils.builder()
|
|
@@ -236,7 +236,7 @@ public class CmsAdminUserController {
|
|
|
cmsUserMapper.updateById(cmsUser);
|
|
cmsUserMapper.updateById(cmsUser);
|
|
|
if (!cmsUser.getStatus()) {
|
|
if (!cmsUser.getStatus()) {
|
|
|
//状态为禁用时,将上线的用户下线
|
|
//状态为禁用时,将上线的用户下线
|
|
|
- StpUtil.logoutByLoginId(cmsUser.getId());
|
|
|
|
|
|
|
+ StpAbroadUtil.logoutByLoginId(cmsUser.getId());
|
|
|
}
|
|
}
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult("用户状态变更成功");
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult("用户状态变更成功");
|
|
|
}
|
|
}
|
|
@@ -280,9 +280,9 @@ public class CmsAdminUserController {
|
|
|
}
|
|
}
|
|
|
// 生成token
|
|
// 生成token
|
|
|
|
|
|
|
|
- StpUtil.login(admin.getId());
|
|
|
|
|
|
|
+ StpAbroadUtil.login(admin.getId());
|
|
|
|
|
|
|
|
- String token = StpUtil.getTokenValue();
|
|
|
|
|
|
|
+ String token = StpAbroadUtil.getTokenValue();
|
|
|
|
|
|
|
|
admin.setPassword("");
|
|
admin.setPassword("");
|
|
|
|
|
|
|
@@ -303,7 +303,7 @@ public class CmsAdminUserController {
|
|
|
|
|
|
|
|
@GetMapping("/get/list")
|
|
@GetMapping("/get/list")
|
|
|
public Result<SearchResult<CmsUserVO>> list(String roleNames) {
|
|
public Result<SearchResult<CmsUserVO>> list(String roleNames) {
|
|
|
- long userId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
|
+ long userId = StpAbroadUtil.getLoginIdAsLong();
|
|
|
MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
if (StrUtil.isNotEmpty(roleNames) && roleNames.contains("客服")) {
|
|
if (StrUtil.isNotEmpty(roleNames) && roleNames.contains("客服")) {
|
|
|
CmsUser user = cmsUserManager.getUser(userId);
|
|
CmsUser user = cmsUserManager.getUser(userId);
|
|
@@ -324,8 +324,8 @@ public class CmsAdminUserController {
|
|
|
if (cmsUser == null) {
|
|
if (cmsUser == null) {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
- StpUtil.login(cmsUser.getId());
|
|
|
|
|
- String token = StpUtil.getTokenValue();
|
|
|
|
|
|
|
+ StpAbroadUtil.login(cmsUser.getId());
|
|
|
|
|
+ String token = StpAbroadUtil.getTokenValue();
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(token);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(token);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|