|
@@ -3,13 +3,12 @@ package com.szwl.controller;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
+//import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.sun.javafx.logging.PulseLogger;
|
|
|
import com.szwl.annotation.Audit;
|
|
|
import com.szwl.constant.AuditEnum;
|
|
|
import com.szwl.constant.ResponseCodesEnum;
|
|
@@ -25,7 +24,6 @@ import com.szwl.model.param.AddLoginUserParam;
|
|
|
import com.szwl.model.param.UpdateLoginUserParam;
|
|
|
import com.szwl.model.utils.AdminUtils;
|
|
|
import com.szwl.service.*;
|
|
|
-import com.szwl.util.IDGenerator;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -147,7 +145,7 @@ public class TAdminController {
|
|
|
return R.fail(ResponseCodesEnum.A0001, "角色不能为空");
|
|
|
}
|
|
|
//获取当前操作人员
|
|
|
- UserDetailBO loginUser = tokenManager.getLoginUserDetails();
|
|
|
+// UserDetailBO loginUser = tokenManager.getLoginUserDetails();
|
|
|
// 保存用户实体
|
|
|
Date now = new Date();
|
|
|
Long parentId = param.getAdminId();
|
|
@@ -232,9 +230,9 @@ public class TAdminController {
|
|
|
public ResponseModel<?> updateLoginUser(@RequestBody @Valid UpdateLoginUserParam param) {
|
|
|
// public ResponseModel<?> addLoginUser(@RequestBody AddLoginUserParam param) {
|
|
|
//获取当前操作人员
|
|
|
- UserDetailBO loginUser = tokenManager.getLoginUserDetails();
|
|
|
+// UserDetailBO loginUser = tokenManager.getLoginUserDetails();
|
|
|
// 保存用户实体
|
|
|
- Date now = new Date();
|
|
|
+// Date now = new Date();
|
|
|
Long parentId = param.getAdminId();
|
|
|
if (parentId == null) {
|
|
|
return R.fail(ResponseCodesEnum.A0001);
|
|
@@ -307,9 +305,9 @@ public class TAdminController {
|
|
|
@Audit(type = AuditEnum.DELETE, content = "#loginUser.name + '删除账号'")
|
|
|
public ResponseModel<?> deleteLoginUser(@RequestBody @Valid UpdateLoginUserParam param) {
|
|
|
//获取当前操作人员
|
|
|
- UserDetailBO loginUser = tokenManager.getLoginUserDetails();
|
|
|
+// UserDetailBO loginUser = tokenManager.getLoginUserDetails();
|
|
|
// 保存用户实体
|
|
|
- Date now = new Date();
|
|
|
+// Date now = new Date();
|
|
|
Long parentId = param.getAdminId();
|
|
|
if (parentId == null) {
|
|
|
return R.fail(ResponseCodesEnum.A0001);
|
|
@@ -350,7 +348,8 @@ public class TAdminController {
|
|
|
|
|
|
@ApiOperation(value = "获取所有子账号信息")
|
|
|
@GetMapping("/getChildDrenAdminList")
|
|
|
- public ResponseModel<?> getChildDrenAdminList(String adminId, String userName, String name, String isUse) {
|
|
|
+// public ResponseModel<?> getChildDrenAdminList(String adminId, String userName, String name, String isUse) {
|
|
|
+ public ResponseModel<?> getChildDrenAdminList(String adminId, String userName, String name) {
|
|
|
List<AddLoginUserParam> returnList = new ArrayList<>();
|
|
|
LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
|
|
|
query.eq(TAdmin::getParentId, adminId);
|
|
@@ -376,7 +375,7 @@ public class TAdminController {
|
|
|
|
|
|
for (TAdmin admin : list) {
|
|
|
AddLoginUserParam addLoginUserParam = new AddLoginUserParam();
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
+// JSONObject jsonObject = new JSONObject();
|
|
|
addLoginUserParam.setUsername(admin.getUsername());
|
|
|
addLoginUserParam.setName(admin.getName());
|
|
|
addLoginUserParam.setEmail(admin.getEmail());
|
|
@@ -572,7 +571,7 @@ public class TAdminController {
|
|
|
SysUserRole sysUserRole = new SysUserRole();
|
|
|
sysUserRole.setRoleId(newSysRole.getRoleId());
|
|
|
sysUserRole.setUserId(String.valueOf(admin.getId()));
|
|
|
- boolean save = sysUserRoleService.save(sysUserRole);
|
|
|
+// boolean save = sysUserRoleService.save(sysUserRole);
|
|
|
}
|
|
|
tMessageCode.setModifyDate(new Date());
|
|
|
if (admin.getId() != null) {
|
|
@@ -615,12 +614,7 @@ public class TAdminController {
|
|
|
//验证用户名登录
|
|
|
LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
|
|
|
query.eq(TAdmin::getPassword, password);
|
|
|
- query.and(
|
|
|
- wrapper -> {
|
|
|
- wrapper.eq(TAdmin::getUsername, username)
|
|
|
- .or().eq(TAdmin::getPhone, username);
|
|
|
- }
|
|
|
- );
|
|
|
+ query.and(wrapper -> wrapper.eq(TAdmin::getUsername, username).or().eq(TAdmin::getPhone, username));
|
|
|
TAdmin tAdmin = Optional.ofNullable(tAdminService.getOnly(query))
|
|
|
.orElseThrow(() -> new BizException(ResponseCodesEnum.L0002));
|
|
|
|
|
@@ -651,7 +645,7 @@ public class TAdminController {
|
|
|
// 设置登录时间
|
|
|
tAdmin.setLoginDate(new Date());
|
|
|
// 登录IP
|
|
|
- String ipAddress = null;
|
|
|
+ String ipAddress;
|
|
|
// 获取通过代理服务器传递的真实IP地址
|
|
|
String xForwardedForHeader = request.getHeader("X-Forwarded-For");
|
|
|
if (xForwardedForHeader == null) {
|
|
@@ -766,7 +760,7 @@ public class TAdminController {
|
|
|
query.orderByDesc(TAdmin::getCreateDate);
|
|
|
Page<TAdmin> page = new Page<>(current, size, true);
|
|
|
IPage<TAdmin> iPage = tAdminService.page(page, query);
|
|
|
- iPage.getRecords().stream().forEach(e->e.setPassword("")); // 密码置空
|
|
|
+ iPage.getRecords().forEach(e -> e.setPassword("")); // 密码置空
|
|
|
return R.ok(iPage);
|
|
|
}
|
|
|
|
|
@@ -777,7 +771,7 @@ public class TAdminController {
|
|
|
LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
|
|
|
Page<TAdmin> page = new Page<>(current, size, true);
|
|
|
IPage<TAdmin> iPage = tAdminService.page(page, query);
|
|
|
- iPage.getRecords().stream().forEach(e->e.setPassword(""));
|
|
|
+ iPage.getRecords().forEach(e -> e.setPassword(""));
|
|
|
return R.ok(iPage);
|
|
|
}
|
|
|
|
|
@@ -1030,7 +1024,7 @@ public class TAdminController {
|
|
|
SysUserRole sysUserRole = new SysUserRole();
|
|
|
sysUserRole.setRoleId(newSysRole.getRoleId());
|
|
|
sysUserRole.setUserId(String.valueOf(admin.getId()));
|
|
|
- boolean save = sysUserRoleService.save(sysUserRole);
|
|
|
+// boolean save = sysUserRoleService.save(sysUserRole);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1088,7 +1082,7 @@ public class TAdminController {
|
|
|
SysUserRole sysUserRole = new SysUserRole();
|
|
|
sysUserRole.setRoleId(newSysRole.getRoleId());
|
|
|
sysUserRole.setUserId(String.valueOf(adminId));
|
|
|
- boolean save = sysUserRoleService.save(sysUserRole);
|
|
|
+// boolean save = sysUserRoleService.save(sysUserRole);
|
|
|
return R.ok("success");
|
|
|
}
|
|
|
return R.fail(ResponseCodesEnum.A0001, "fail");
|