2
0

feat: add list user in sys

This commit is contained in:
caiyuchao
2024-12-13 15:02:58 +08:00
parent d1e99f28ed
commit 967a65f571
6 changed files with 66 additions and 8 deletions

View File

@@ -1,11 +1,18 @@
package org.wfc.user.api; package org.wfc.user.api;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.wfc.common.core.constant.SecurityConstants; import org.wfc.common.core.constant.SecurityConstants;
import org.wfc.common.core.constant.ServiceNameConstants; import org.wfc.common.core.constant.ServiceNameConstants;
import org.wfc.common.core.domain.LoginUser; import org.wfc.common.core.domain.LoginUser;
import org.wfc.common.core.domain.R; import org.wfc.common.core.domain.R;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.user.api.domain.UUser; import org.wfc.user.api.domain.UUser;
import org.wfc.user.api.factory.RemoteUUserFallbackFactory; import org.wfc.user.api.factory.RemoteUUserFallbackFactory;
@@ -57,6 +64,14 @@ public interface RemoteUUserService
@PutMapping("/user/recordlogin") @PutMapping("/user/recordlogin")
public R<Boolean> recordUserLogin(@RequestBody UUser user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<Boolean> recordUserLogin(@RequestBody UUser user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 查询用户列表
* @param user 用户信息
* @return 结果
*/
@PostMapping("/user/page")
public TableDataInfo page(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize, @RequestBody UUser user);
/** /**
* 添加话单信息通过OmadaApi * 添加话单信息通过OmadaApi
*/ */

View File

@@ -4,11 +4,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.wfc.common.core.constant.HttpStatus;
import org.wfc.common.core.domain.LoginUser; import org.wfc.common.core.domain.LoginUser;
import org.wfc.common.core.domain.R; import org.wfc.common.core.domain.R;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.user.api.RemoteUUserService; import org.wfc.user.api.RemoteUUserService;
import org.wfc.user.api.domain.UUser; import org.wfc.user.api.domain.UUser;
import java.util.Collections;
/** /**
* 用户服务降级处理 * 用户服务降级处理
* *
@@ -49,6 +53,14 @@ public class RemoteUUserFallbackFactory implements FallbackFactory<RemoteUUserSe
return R.fail("记录用户登录信息失败:" + throwable.getMessage()); return R.fail("记录用户登录信息失败:" + throwable.getMessage());
} }
@Override
public TableDataInfo page(Integer pageNum, Integer pageSize, UUser user) {
TableDataInfo rspData = new TableDataInfo(Collections.emptyList(), 0L);
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
return rspData;
}
@Override @Override
public R<Boolean> addCdrInfoByOmadaApi() { public R<Boolean> addCdrInfoByOmadaApi() {
return R.fail("添加话单信息失败:" + throwable.getMessage()); return R.fail("添加话单信息失败:" + throwable.getMessage());

View File

@@ -1,19 +1,20 @@
package org.wfc.common.core.web.controller; package org.wfc.common.core.web.controller;
import java.beans.PropertyEditorSupport; import com.github.pagehelper.PageInfo;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageInfo;
import org.wfc.common.core.constant.HttpStatus; import org.wfc.common.core.constant.HttpStatus;
import org.wfc.common.core.utils.DateUtils; import org.wfc.common.core.utils.DateUtils;
import org.wfc.common.core.utils.PageUtils; import org.wfc.common.core.utils.PageUtils;
import org.wfc.common.core.web.domain.AjaxResult; import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo; import org.wfc.common.core.web.page.TableDataInfo;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
/** /**
* web层通用数据处理 * web层通用数据处理
* *

View File

@@ -8,6 +8,9 @@ public class PageDataVo {
/** 列表数据 */ /** 列表数据 */
private List<?> rows; private List<?> rows;
public PageDataVo() {
}
public PageDataVo(List<?> list, Long total) { public PageDataVo(List<?> list, Long total) {
this.rows = list; this.rows = list;
this.total = total; this.total = total;

View File

@@ -113,6 +113,14 @@ public class UUserController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
@PostMapping("/page")
public TableDataInfo page(@RequestBody UUser user)
{
startPage();
List<UUser> list = userService.selectUserList(user);
return getDataTable(list);
}
@Log(title = "用户管理", businessType = BusinessType.EXPORT) @Log(title = "用户管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("Utem:user:export") @RequiresPermissions("Utem:user:export")
@PostMapping("/export") @PostMapping("/export")
@@ -290,9 +298,9 @@ public class UUserController extends BaseController
public AjaxResult edit(@Validated @RequestBody UUser user) public AjaxResult edit(@Validated @RequestBody UUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); // userService.checkUserDataScope(user.getUserId());
deptService.checkDeptDataScope(user.getDeptId()); // deptService.checkDeptDataScope(user.getDeptId());
roleService.checkRoleDataScope(user.getRoleIds()); // roleService.checkRoleDataScope(user.getRoleIds());
if (!userService.checkUserNameUnique(user)) if (!userService.checkUserNameUnique(user))
{ {
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");

View File

@@ -1,5 +1,6 @@
package org.wfc.system.controller; package org.wfc.system.controller;
import com.github.pagehelper.Page;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.wfc.common.core.domain.R; import org.wfc.common.core.domain.R;
import org.wfc.common.core.utils.MessageUtils; import org.wfc.common.core.utils.MessageUtils;
import org.wfc.common.core.utils.PageUtils;
import org.wfc.common.core.utils.StringUtils; import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.poi.ExcelUtil; import org.wfc.common.core.utils.poi.ExcelUtil;
import org.wfc.common.core.web.controller.BaseController; import org.wfc.common.core.web.controller.BaseController;
@@ -38,6 +40,8 @@ import org.wfc.system.service.ISysPermissionService;
import org.wfc.system.service.ISysPostService; import org.wfc.system.service.ISysPostService;
import org.wfc.system.service.ISysRoleService; import org.wfc.system.service.ISysRoleService;
import org.wfc.system.service.ISysUserService; import org.wfc.system.service.ISysUserService;
import org.wfc.user.api.RemoteUUserService;
import org.wfc.user.api.domain.UUser;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@@ -80,6 +84,9 @@ public class SysUserController extends BaseController
@Autowired @Autowired
private MessageSource messageSource; private MessageSource messageSource;
@Autowired
private RemoteUUserService remoteUUserService;
/** /**
* 测试国际化 * 测试国际化
*/ */
@@ -113,6 +120,18 @@ public class SysUserController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 获取用户平台-用户列表
*/
@GetMapping("/listUser")
public TableDataInfo listUser(UUser user)
{
startPage();
Page<Object> localPage = PageUtils.getLocalPage();
TableDataInfo result = remoteUUserService.page(localPage.getPageNum(), localPage.getPageSize(), user);
return result;
}
@Log(title = "用户管理", businessType = BusinessType.EXPORT) @Log(title = "用户管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:user:export") @RequiresPermissions("system:user:export")
@PostMapping("/export") @PostMapping("/export")