feat: rename directory wfc-modules-user to wfc-user
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package org.wfc.user;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.wfc.common.security.annotation.EnableCustomConfig;
|
||||
import org.wfc.common.security.annotation.EnableRyFeignClients;
|
||||
|
||||
/**
|
||||
* 用户平台模块
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication
|
||||
public class WfcUserApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SpringApplication.run(WfcUserApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 用户平台模块启动成功 ლ(´ڡ`ლ)゙ \n" );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wfc.common.core.domain.LoginUser;
|
||||
import org.wfc.common.core.utils.StringUtils;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.form.WANFiRedirectParams;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.omada.api.client.OmadaClientApi;
|
||||
import org.wfc.omada.api.client.model.OperationResponseClientDetail;
|
||||
import org.wfc.omada.api.hotspot.OmadaAuthorizedClientApi;
|
||||
import org.wfc.omada.api.hotspot.model.OperationResponseWithoutResult;
|
||||
import org.wfc.user.api.domain.UUser;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 客户端操作处理
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/client")
|
||||
public class ClientController extends BaseController {
|
||||
@Autowired
|
||||
private OmadaClientApi omadaClientApi;
|
||||
|
||||
@Autowired
|
||||
private OmadaAuthorizedClientApi omadaAuthorizedClientApi;
|
||||
|
||||
/**
|
||||
* 获取客户信息
|
||||
*/
|
||||
// @RequiresLogin()
|
||||
@GetMapping("/auth")
|
||||
public AjaxResult auth() {
|
||||
LoginUser<UUser> loginUser = SecurityUtils.getLoginUser();
|
||||
WANFiRedirectParams wanFiRedirectParams = loginUser.getWanFiRedirectParams();
|
||||
if (wanFiRedirectParams == null) {
|
||||
return error("not wanfi redirect params");
|
||||
}
|
||||
String site = wanFiRedirectParams.getSite();
|
||||
String clientMac = wanFiRedirectParams.getClientMac();
|
||||
if (StringUtils.isBlank(site) || StringUtils.isBlank(clientMac)) {
|
||||
return error("not mac address");
|
||||
}
|
||||
ResponseEntity<OperationResponseWithoutResult> posts = omadaAuthorizedClientApi.authClient(site, clientMac);
|
||||
return success(Objects.requireNonNull(posts.getBody()).getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客户信息
|
||||
*/
|
||||
// @RequiresLogin()
|
||||
@GetMapping("/unauth")
|
||||
public AjaxResult unauth() {
|
||||
LoginUser<UUser> loginUser = SecurityUtils.getLoginUser();
|
||||
WANFiRedirectParams wanFiRedirectParams = loginUser.getWanFiRedirectParams();
|
||||
if (wanFiRedirectParams == null) {
|
||||
return error("not wanfi redirect params");
|
||||
}
|
||||
String site = wanFiRedirectParams.getSite();
|
||||
String clientMac = wanFiRedirectParams.getClientMac();
|
||||
if (StringUtils.isBlank(site) || StringUtils.isBlank(clientMac)) {
|
||||
return error("not mac address");
|
||||
}
|
||||
ResponseEntity<OperationResponseWithoutResult> posts = omadaAuthorizedClientApi.cancelAuthClient(site, clientMac);
|
||||
return success(Objects.requireNonNull(posts.getBody()).getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客户信息
|
||||
*/
|
||||
// @RequiresLogin()
|
||||
@GetMapping("/info")
|
||||
public AjaxResult info() {
|
||||
LoginUser<UUser> loginUser = SecurityUtils.getLoginUser();
|
||||
WANFiRedirectParams wanFiRedirectParams = loginUser.getWanFiRedirectParams();
|
||||
if (wanFiRedirectParams == null) {
|
||||
return error("not wanfi redirect params");
|
||||
}
|
||||
String site = wanFiRedirectParams.getSite();
|
||||
String clientMac = wanFiRedirectParams.getClientMac();
|
||||
if (StringUtils.isBlank(site) || StringUtils.isBlank(clientMac)) {
|
||||
return error("not mac address");
|
||||
}
|
||||
ResponseEntity<OperationResponseClientDetail> posts = omadaClientApi.getClientDetail(site, clientMac);
|
||||
return success(Objects.requireNonNull(posts.getBody()).getResult());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.user.domain.UAccount;
|
||||
import org.wfc.user.service.IUAccountService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-账户表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/account")
|
||||
public class UAccountController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IUAccountService uAccountService;
|
||||
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo page(UAccount uAccount) {
|
||||
startPage();
|
||||
List<UAccount> list = uAccountService.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(UAccount uAccount) {
|
||||
List<UAccount> list = uAccountService.list();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getById(@PathVariable("id") Long id) {
|
||||
return success(uAccountService.getById(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/dashboard")
|
||||
public AjaxResult dashboard() {
|
||||
return success(uAccountService.getByUser());
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody UAccount uAccount) {
|
||||
return toAjax(uAccountService.save(uAccount));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody UAccount uAccount) {
|
||||
return toAjax(uAccountService.updateById(uAccount));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(uAccountService.removeByIds(CollUtil.newArrayList(ids)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wfc.common.core.domain.R;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.user.domain.bo.UCdrClientBo;
|
||||
import org.wfc.user.domain.vo.UCdrClientVo;
|
||||
import org.wfc.user.domain.vo.UCdrHistoryUserVo;
|
||||
import org.wfc.user.domain.vo.UCdrUserVo;
|
||||
import org.wfc.user.service.IUCdrService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户话单表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cdr")
|
||||
@Tag(name = "用户平台-CDR接口")
|
||||
public class UCdrController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IUCdrService cdrService;
|
||||
|
||||
/**
|
||||
* 添加话单信息通过OmadaApi
|
||||
*/
|
||||
@GetMapping("/addCdrInfo")
|
||||
public R<Boolean> addCdrInfoByOmadaApi() {
|
||||
cdrService.addCdrInfoByOmadaApi();
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户查询话单
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Operation(summary = "首页仪表盘")
|
||||
@GetMapping("/getOne")
|
||||
public R<UCdrUserVo> getByUser() {
|
||||
UCdrUserVo result = cdrService.getByUser();
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备查询话单
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/pageClient")
|
||||
public TableDataInfo getByClient(UCdrClientBo clientBo) {
|
||||
startPage();
|
||||
List<UCdrClientVo> result = cdrService.getByClient(clientBo);
|
||||
return getDataTable(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户查询cdr记录
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Operation(summary = "CDR记录")
|
||||
@GetMapping("/pageHistory")
|
||||
public TableDataInfo getHistoryByUser() {
|
||||
startPage();
|
||||
List<UCdrHistoryUserVo> result = cdrService.getHistoryByUser();
|
||||
return getDataTable(result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_话单明细表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/uCdrHistory")
|
||||
public class UCdrHistoryController {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wfc.common.core.domain.R;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.user.api.domain.bo.UClientBo;
|
||||
import org.wfc.user.domain.vo.UClientCurrentVo;
|
||||
import org.wfc.user.domain.vo.UClientHistoryUserVo;
|
||||
import org.wfc.user.service.IUClientService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_AP设备表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/client")
|
||||
@Tag(name = "用户平台-终端设备接口")
|
||||
public class UClientController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IUClientService clientService;
|
||||
|
||||
/**
|
||||
* 根据设备mac保存或更新
|
||||
*/
|
||||
@PostMapping("/recordClientUser")
|
||||
public R<Boolean> recordClientUser(@RequestBody UClientBo clientBo) {
|
||||
boolean result = clientService.recordClientUser(clientBo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户查询当前接入设备
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Operation(summary = "当前设备")
|
||||
@GetMapping("/pageCurrentClient")
|
||||
public TableDataInfo getCurrentClients() {
|
||||
startPage();
|
||||
List<UClientCurrentVo> result = clientService.getCurrentClients();
|
||||
return getDataTable(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户查询历史设备
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Operation(summary = "历史设备")
|
||||
@GetMapping("/pageHistoryClient")
|
||||
public TableDataInfo getHistoryByUser() {
|
||||
startPage();
|
||||
List<UClientHistoryUserVo> result = clientService.getHistoryByUser();
|
||||
return getDataTable(result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wfc.common.core.utils.poi.ExcelUtil;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.domain.UConfig;
|
||||
import org.wfc.user.service.IUConfigService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 信息操作处理
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/config")
|
||||
public class UConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUConfigService configService;
|
||||
|
||||
/**
|
||||
* 获取参数配置列表
|
||||
*/
|
||||
@RequiresPermissions("Utem:config:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UConfig config)
|
||||
{
|
||||
startPage();
|
||||
List<UConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("Utem:config:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UConfig config)
|
||||
{
|
||||
List<UConfig> list = configService.selectConfigList(config);
|
||||
ExcelUtil<UConfig> util = new ExcelUtil<UConfig>(UConfig.class);
|
||||
util.exportExcel(response, list, "参数数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数编号获取详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{configId}")
|
||||
public AjaxResult getInfo(@PathVariable Long configId)
|
||||
{
|
||||
return success(configService.selectConfigById(configId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数键名查询参数值
|
||||
*/
|
||||
@GetMapping(value = "/configKey/{configKey}")
|
||||
public AjaxResult getConfigKey(@PathVariable String configKey)
|
||||
{
|
||||
return success(configService.selectConfigByKey(configKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*/
|
||||
@RequiresPermissions("Utem:config:add")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody UConfig config)
|
||||
{
|
||||
if (!configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*/
|
||||
@RequiresPermissions("Utem:config:edit")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody UConfig config)
|
||||
{
|
||||
if (!configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*/
|
||||
@RequiresPermissions("Utem:config:remove")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||
{
|
||||
configService.deleteConfigByIds(configIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新参数缓存
|
||||
*/
|
||||
@RequiresPermissions("Utem:config:remove")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
configService.resetConfigCache();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wfc.common.core.constant.UserConstants;
|
||||
import org.wfc.common.core.utils.StringUtils;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.api.domain.UDept;
|
||||
import org.wfc.user.service.IUDeptService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dept")
|
||||
public class UDeptController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUDeptService deptService;
|
||||
|
||||
/**
|
||||
* 获取部门列表
|
||||
*/
|
||||
@RequiresPermissions("Utem:dept:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UDept dept)
|
||||
{
|
||||
List<UDept> depts = deptService.selectDeptList(dept);
|
||||
return getDataTable(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门列表(排除节点)
|
||||
*/
|
||||
@RequiresPermissions("Utem:dept:list")
|
||||
@GetMapping("/list/exclude/{deptId}")
|
||||
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
||||
{
|
||||
List<UDept> depts = deptService.selectDeptList(new UDept());
|
||||
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门编号获取详细信息
|
||||
*/
|
||||
@RequiresPermissions("Utem:dept:query")
|
||||
@GetMapping(value = "/{deptId}")
|
||||
public AjaxResult getInfo(@PathVariable Long deptId)
|
||||
{
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
return success(deptService.selectDeptById(deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*/
|
||||
@RequiresPermissions("Utem:dept:add")
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody UDept dept)
|
||||
{
|
||||
if (!deptService.checkDeptNameUnique(dept))
|
||||
{
|
||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
dept.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
*/
|
||||
@RequiresPermissions("Utem:dept:edit")
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody UDept dept)
|
||||
{
|
||||
Long deptId = dept.getDeptId();
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
if (!deptService.checkDeptNameUnique(dept))
|
||||
{
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
else if (dept.getParentId().equals(deptId))
|
||||
{
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
}
|
||||
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
|
||||
{
|
||||
return error("该部门包含未停用的子部门!");
|
||||
}
|
||||
dept.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*/
|
||||
@RequiresPermissions("Utem:dept:remove")
|
||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deptId}")
|
||||
public AjaxResult remove(@PathVariable Long deptId)
|
||||
{
|
||||
if (deptService.hasChildByDeptId(deptId))
|
||||
{
|
||||
return warn("存在下级部门,不允许删除");
|
||||
}
|
||||
if (deptService.checkDeptExistUser(deptId))
|
||||
{
|
||||
return warn("部门存在用户,不允许删除");
|
||||
}
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户设备表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/uDevice")
|
||||
public class UDeviceController {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wfc.common.core.utils.StringUtils;
|
||||
import org.wfc.common.core.utils.poi.ExcelUtil;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.api.domain.UDictData;
|
||||
import org.wfc.user.service.IUDictDataService;
|
||||
import org.wfc.user.service.IUDictTypeService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dict/data")
|
||||
public class UDictDataController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
private IUDictTypeService dictTypeService;
|
||||
|
||||
@RequiresPermissions("Utem:dict:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UDictData dictData)
|
||||
{
|
||||
startPage();
|
||||
List<UDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("Utem:dict:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UDictData dictData)
|
||||
{
|
||||
List<UDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil<UDictData> util = new ExcelUtil<UDictData>(UDictData.class);
|
||||
util.exportExcel(response, list, "字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典数据详细
|
||||
*/
|
||||
@RequiresPermissions("Utem:dict:query")
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||
{
|
||||
return success(dictDataService.selectDictDataById(dictCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据信息
|
||||
*/
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
public AjaxResult dictType(@PathVariable String dictType)
|
||||
{
|
||||
List<UDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||
if (StringUtils.isNull(data))
|
||||
{
|
||||
data = new ArrayList<UDictData>();
|
||||
}
|
||||
return success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@RequiresPermissions("Utem:dict:add")
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody UDictData dict)
|
||||
{
|
||||
dict.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@RequiresPermissions("Utem:dict:edit")
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody UDictData dict)
|
||||
{
|
||||
dict.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@RequiresPermissions("Utem:dict:remove")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||
{
|
||||
dictDataService.deleteDictDataByIds(dictCodes);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wfc.common.core.utils.poi.ExcelUtil;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.api.domain.UDictType;
|
||||
import org.wfc.user.service.IUDictTypeService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dict/type")
|
||||
public class UDictTypeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUDictTypeService dictTypeService;
|
||||
|
||||
@RequiresPermissions("Utem:dict:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UDictType dictType)
|
||||
{
|
||||
startPage();
|
||||
List<UDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("Utem:dict:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UDictType dictType)
|
||||
{
|
||||
List<UDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil<UDictType> util = new ExcelUtil<UDictType>(UDictType.class);
|
||||
util.exportExcel(response, list, "字典类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典类型详细
|
||||
*/
|
||||
@RequiresPermissions("Utem:dict:query")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||
{
|
||||
return success(dictTypeService.selectDictTypeById(dictId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@RequiresPermissions("Utem:dict:add")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody UDictType dict)
|
||||
{
|
||||
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@RequiresPermissions("Utem:dict:edit")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody UDictType dict)
|
||||
{
|
||||
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@RequiresPermissions("Utem:dict:remove")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||
{
|
||||
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
*/
|
||||
@RequiresPermissions("Utem:dict:remove")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
dictTypeService.resetDictCache();
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<UDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||
return success(dictTypes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wfc.common.core.constant.CacheConstants;
|
||||
import org.wfc.common.core.utils.poi.ExcelUtil;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.redis.service.RedisService;
|
||||
import org.wfc.common.security.annotation.InnerAuth;
|
||||
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||
import org.wfc.user.api.domain.ULogininfor;
|
||||
import org.wfc.user.service.IULogininforService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统访问记录
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/logininfor")
|
||||
public class ULogininforController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IULogininforService logininforService;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@RequiresPermissions("Utem:logininfor:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ULogininfor logininfor)
|
||||
{
|
||||
startPage();
|
||||
List<ULogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("Utem:logininfor:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ULogininfor logininfor)
|
||||
{
|
||||
List<ULogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil<ULogininfor> util = new ExcelUtil<ULogininfor>(ULogininfor.class);
|
||||
util.exportExcel(response, list, "登录日志");
|
||||
}
|
||||
|
||||
@RequiresPermissions("Utem:logininfor:remove")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{infoIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] infoIds)
|
||||
{
|
||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||
}
|
||||
|
||||
@RequiresPermissions("Utem:logininfor:remove")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
logininforService.cleanLogininfor();
|
||||
return success();
|
||||
}
|
||||
|
||||
@RequiresPermissions("Utem:logininfor:unlock")
|
||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/unlock/{userName}")
|
||||
public AjaxResult unlock(@PathVariable("userName") String userName)
|
||||
{
|
||||
redisService.deleteObject(CacheConstants.PWD_ERR_CNT_KEY + userName);
|
||||
return success();
|
||||
}
|
||||
|
||||
@InnerAuth
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ULogininfor logininfor)
|
||||
{
|
||||
return toAjax(logininforService.insertLogininfor(logininfor));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wfc.common.core.constant.UserConstants;
|
||||
import org.wfc.common.core.utils.StringUtils;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.domain.UMenu;
|
||||
import org.wfc.user.service.IUMenuService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/menu")
|
||||
public class UMenuController extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(UMenuController.class);
|
||||
|
||||
@Autowired
|
||||
private IUMenuService menuService;
|
||||
|
||||
public enum RoutersType {
|
||||
/**
|
||||
* 菜单
|
||||
*/
|
||||
MENU,
|
||||
/**
|
||||
* 按钮
|
||||
*/
|
||||
MENU_CONSTANT
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
@RequiresPermissions("Utem:menu:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UMenu menu) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<UMenu> menus = menuService.selectMenuList(menu, userId);
|
||||
return getDataTable(menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单编号获取详细信息
|
||||
*/
|
||||
@RequiresPermissions("Utem:menu:query")
|
||||
@GetMapping(value = "/{menuId}")
|
||||
public AjaxResult getInfo(@PathVariable Long menuId) {
|
||||
return success(menuService.selectMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单下拉树列表
|
||||
*/
|
||||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(UMenu menu) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<UMenu> menus = menuService.selectMenuList(menu, userId);
|
||||
return success(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应角色菜单列表树
|
||||
*/
|
||||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<UMenu> menus = menuService.selectMenuList(userId);
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||
return AjaxResult.success(ajax);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
@RequiresPermissions("Utem:menu:add")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody UMenu menu) {
|
||||
if (!menuService.checkMenuNameUnique(menu)) {
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
menu.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@RequiresPermissions("Utem:menu:edit")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody UMenu menu) {
|
||||
if (!menuService.checkMenuNameUnique(menu)) {
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
} else if (menu.getMenuId().equals(menu.getParentId())) {
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||
}
|
||||
menu.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
@RequiresPermissions("Utem:menu:remove")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{menuId}")
|
||||
public AjaxResult remove(@PathVariable("menuId") Long menuId) {
|
||||
if (menuService.hasChildByMenuId(menuId)) {
|
||||
return warn("存在子菜单,不允许删除");
|
||||
}
|
||||
if (menuService.checkMenuExistRole(menuId)) {
|
||||
return warn("菜单已分配,不允许删除");
|
||||
}
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取路由信息
|
||||
*
|
||||
* @return 路由信息
|
||||
*/
|
||||
@GetMapping("getRouters")
|
||||
public AjaxResult getRouters() {
|
||||
// @PathVariable("type") RoutersType type
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<UMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||
return success(menuService.buildMenus(menus));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wfc.common.core.utils.poi.ExcelUtil;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.security.annotation.InnerAuth;
|
||||
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||
import org.wfc.user.api.domain.UOperLog;
|
||||
import org.wfc.user.service.IUOperLogService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/operlog")
|
||||
public class UOperlogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUOperLogService operLogService;
|
||||
|
||||
@RequiresPermissions("Utem:operlog:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UOperLog operLog)
|
||||
{
|
||||
startPage();
|
||||
List<UOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("Utem:operlog:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UOperLog operLog)
|
||||
{
|
||||
List<UOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil<UOperLog> util = new ExcelUtil<UOperLog>(UOperLog.class);
|
||||
util.exportExcel(response, list, "操作日志");
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("Utem:operlog:remove")
|
||||
@DeleteMapping("/{operIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] operIds)
|
||||
{
|
||||
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||
}
|
||||
|
||||
@RequiresPermissions("Utem:operlog:remove")
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
operLogService.cleanOperLog();
|
||||
return success();
|
||||
}
|
||||
|
||||
@InnerAuth
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody UOperLog operLog)
|
||||
{
|
||||
return toAjax(operLogService.insertOperlog(operLog));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.user.domain.UOrder;
|
||||
import org.wfc.user.service.IUOrderService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-订单表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/order")
|
||||
public class UOrderController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IUOrderService uOrderService;
|
||||
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo page(UOrder uOrder) {
|
||||
startPage();
|
||||
List<UOrder> list = uOrderService.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(UOrder uOrder) {
|
||||
List<UOrder> list = uOrderService.list();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getById(@PathVariable("id") Long id) {
|
||||
return success(uOrderService.getById(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody UOrder uOrder) {
|
||||
return toAjax(uOrderService.saveOrder(uOrder));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody UOrder uOrder) {
|
||||
return toAjax(uOrderService.updateById(uOrder));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(uOrderService.removeByIds(CollUtil.newArrayList(ids)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.user.domain.UPackage;
|
||||
import org.wfc.user.domain.URateLimit;
|
||||
import org.wfc.user.service.IUPackageService;
|
||||
import org.wfc.user.service.IURateLimitService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-套餐表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/package")
|
||||
public class UPackageController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
public IUPackageService uPackageService;
|
||||
|
||||
@Autowired
|
||||
private IURateLimitService uRateLimitService;
|
||||
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo page(UPackage uPackage) {
|
||||
startPage();
|
||||
List<UPackage> list = getPackages();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(UPackage uPackage) {
|
||||
List<UPackage> list = getPackages();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
private List<UPackage> getPackages() {
|
||||
List<UPackage> list = uPackageService.list(Wrappers.<UPackage>lambdaQuery()
|
||||
.eq(UPackage::getPackageEnable, true));
|
||||
for (UPackage pack : list) {
|
||||
if (ObjectUtil.isNull(pack.getRateLimitId())) {
|
||||
continue;
|
||||
}
|
||||
URateLimit uRateLimit = uRateLimitService.getById(pack.getRateLimitId());
|
||||
pack.setRateLimits(uRateLimit);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wfc.common.core.utils.poi.ExcelUtil;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.domain.UPost;
|
||||
import org.wfc.user.service.IUPostService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/post")
|
||||
public class UPostController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUPostService postService;
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
*/
|
||||
@RequiresPermissions("Utem:post:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UPost post)
|
||||
{
|
||||
startPage();
|
||||
List<UPost> list = postService.selectPostList(post);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("Utem:post:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UPost post)
|
||||
{
|
||||
List<UPost> list = postService.selectPostList(post);
|
||||
ExcelUtil<UPost> util = new ExcelUtil<UPost>(UPost.class);
|
||||
util.exportExcel(response, list, "岗位数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位编号获取详细信息
|
||||
*/
|
||||
@RequiresPermissions("Utem:post:query")
|
||||
@GetMapping(value = "/{postId}")
|
||||
public AjaxResult getInfo(@PathVariable Long postId)
|
||||
{
|
||||
return success(postService.selectPostById(postId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@RequiresPermissions("Utem:post:add")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody UPost post)
|
||||
{
|
||||
if (!postService.checkPostNameUnique(post))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (!postService.checkPostCodeUnique(post))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@RequiresPermissions("Utem:post:edit")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody UPost post)
|
||||
{
|
||||
if (!postService.checkPostNameUnique(post))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (!postService.checkPostCodeUnique(post))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
@RequiresPermissions("Utem:post:remove")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{postIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] postIds)
|
||||
{
|
||||
return toAjax(postService.deletePostByIds(postIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<UPost> posts = postService.selectPostAll();
|
||||
return success(posts);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.wfc.common.core.domain.LoginUser;
|
||||
import org.wfc.common.core.domain.R;
|
||||
import org.wfc.common.core.utils.StringUtils;
|
||||
import org.wfc.common.core.utils.file.FileTypeUtils;
|
||||
import org.wfc.common.core.utils.file.MimeTypeUtils;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.security.service.TokenService;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.api.RemoteUFileService;
|
||||
import org.wfc.user.api.domain.UFile;
|
||||
import org.wfc.user.api.domain.UUser;
|
||||
import org.wfc.user.service.IUUserService;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/profile")
|
||||
public class UProfileController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUUserService userService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUFileService remoteUFileService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping
|
||||
public AjaxResult profile()
|
||||
{
|
||||
String username = SecurityUtils.getUsername();
|
||||
UUser user = userService.selectUserByUserName(username);
|
||||
AjaxResult ajax = AjaxResult.success(user);
|
||||
ajax.put("roleGroup", userService.selectUserRoleGroup(username));
|
||||
ajax.put("postGroup", userService.selectUserPostGroup(username));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult updateProfile(@RequestBody UUser user)
|
||||
{
|
||||
LoginUser<UUser> loginUser = SecurityUtils.getLoginUser();
|
||||
UUser currentUser = loginUser.getUser();
|
||||
if (user.getNickName() != null) {
|
||||
currentUser.setNickName(user.getNickName());
|
||||
}
|
||||
if (user.getEmail() != null) {
|
||||
currentUser.setEmail(user.getEmail());
|
||||
}
|
||||
if (user.getPhonenumber() != null) {
|
||||
currentUser.setPhonenumber(user.getPhonenumber());
|
||||
}
|
||||
if (user.getSex() != null) {
|
||||
currentUser.setSex(user.getSex());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
|
||||
{
|
||||
return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
|
||||
{
|
||||
return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
if (userService.updateUserProfile(currentUser))
|
||||
{
|
||||
// 更新缓存用户信息
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改个人信息异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
||||
{
|
||||
String username = SecurityUtils.getUsername();
|
||||
UUser user = userService.selectUserByUserName(username);
|
||||
String password = user.getPassword();
|
||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||
{
|
||||
return error("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (SecurityUtils.matchesPassword(newPassword, password))
|
||||
{
|
||||
return error("新密码不能与旧密码相同");
|
||||
}
|
||||
newPassword = SecurityUtils.encryptPassword(newPassword);
|
||||
if (userService.resetUserPwd(username, newPassword) > 0)
|
||||
{
|
||||
// 更新缓存用户密码
|
||||
LoginUser<UUser> loginUser = SecurityUtils.getLoginUser();
|
||||
UUser uuser = loginUser.getUser();
|
||||
uuser.setPassword(newPassword);
|
||||
loginUser.setUser(uuser);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像上传
|
||||
*/
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/avatar")
|
||||
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file)
|
||||
{
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
LoginUser<UUser> loginUser = SecurityUtils.getLoginUser();
|
||||
String extension = FileTypeUtils.getExtension(file);
|
||||
if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION))
|
||||
{
|
||||
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式");
|
||||
}
|
||||
R<UFile> fileResult = remoteUFileService.upload(file);
|
||||
if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData()))
|
||||
{
|
||||
return error("文件服务异常,请联系管理员");
|
||||
}
|
||||
String url = fileResult.getData().getUrl();
|
||||
if (userService.updateUserAvatar(loginUser.getUsername(), url))
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("imgUrl", url);
|
||||
// 更新缓存用户头像
|
||||
UUser uuser = loginUser.getUser();
|
||||
uuser.setAvatar(url);
|
||||
loginUser.setUser(uuser);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
return error("上传图片异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.user.domain.URateLimit;
|
||||
import org.wfc.user.service.IURateLimitService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-带宽限速表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rateLimit")
|
||||
public class URateLimitController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
public IURateLimitService uRateLimitService;
|
||||
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo page(URateLimit uRateLimit) {
|
||||
startPage();
|
||||
List<URateLimit> list = uRateLimitService.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(URateLimit uRateLimit) {
|
||||
List<URateLimit> list = uRateLimitService.list();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wfc.common.core.utils.poi.ExcelUtil;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.api.domain.UDept;
|
||||
import org.wfc.user.api.domain.URole;
|
||||
import org.wfc.user.api.domain.UUser;
|
||||
import org.wfc.user.domain.UUserRole;
|
||||
import org.wfc.user.service.IUDeptService;
|
||||
import org.wfc.user.service.IURoleService;
|
||||
import org.wfc.user.service.IUUserService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/role")
|
||||
public class URoleController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IURoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private IUUserService userService;
|
||||
|
||||
@Autowired
|
||||
private IUDeptService deptService;
|
||||
|
||||
@RequiresPermissions("Utem:role:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(URole role)
|
||||
{
|
||||
startPage();
|
||||
List<URole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("Utem:role:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, URole role)
|
||||
{
|
||||
List<URole> list = roleService.selectRoleList(role);
|
||||
ExcelUtil<URole> util = new ExcelUtil<URole>(URole.class);
|
||||
util.exportExcel(response, list, "角色数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色编号获取详细信息
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:query")
|
||||
@GetMapping(value = "/{roleId}")
|
||||
public AjaxResult getInfo(@PathVariable Long roleId)
|
||||
{
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return success(roleService.selectRoleById(roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:add")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody URole role)
|
||||
{
|
||||
if (!roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (!roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存角色
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody URole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
if (!roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (!roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(roleService.updateRole(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存数据权限
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/dataScope")
|
||||
public AjaxResult dataScope(@RequestBody URole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
return toAjax(roleService.authDataScope(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody URole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
role.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(roleService.updateRoleStatus(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:remove")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{roleIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] roleIds)
|
||||
{
|
||||
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色选择框列表
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:query")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
return success(roleService.selectRoleAll());
|
||||
}
|
||||
/**
|
||||
* 查询已分配用户角色列表
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:list")
|
||||
@GetMapping("/authUser/allocatedList")
|
||||
public TableDataInfo allocatedList(UUser user)
|
||||
{
|
||||
startPage();
|
||||
List<UUser> list = userService.selectAllocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未分配用户角色列表
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:list")
|
||||
@GetMapping("/authUser/unallocatedList")
|
||||
public TableDataInfo unallocatedList(UUser user)
|
||||
{
|
||||
startPage();
|
||||
List<UUser> list = userService.selectUnallocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消授权用户
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancel")
|
||||
public AjaxResult cancelAuthUser(@RequestBody UUserRole userRole)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消授权用户
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancelAll")
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量选择用户授权
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/selectAll")
|
||||
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应角色部门树列表
|
||||
*/
|
||||
@RequiresPermissions("Utem:role:query")
|
||||
@GetMapping(value = "/deptTree/{roleId}")
|
||||
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||
ajax.put("depts", deptService.selectDeptTreeList(new UDept()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,402 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.wfc.common.core.domain.LoginUser;
|
||||
import org.wfc.common.core.domain.R;
|
||||
import org.wfc.common.core.utils.MessageUtils;
|
||||
import org.wfc.common.core.utils.StringUtils;
|
||||
import org.wfc.common.core.utils.poi.ExcelUtil;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.security.annotation.InnerAuth;
|
||||
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||
import org.wfc.common.security.service.TokenService;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.api.domain.UDept;
|
||||
import org.wfc.user.api.domain.URole;
|
||||
import org.wfc.user.api.domain.UUser;
|
||||
import org.wfc.user.domain.query.UserRepeatQuery;
|
||||
import org.wfc.user.service.IUConfigService;
|
||||
import org.wfc.user.service.IUDeptService;
|
||||
import org.wfc.user.service.IUPermissionService;
|
||||
import org.wfc.user.service.IUPostService;
|
||||
import org.wfc.user.service.IURoleService;
|
||||
import org.wfc.user.service.IUUserService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UUserController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUUserService userService;
|
||||
|
||||
@Autowired
|
||||
private IURoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private IUDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private IUPostService postService;
|
||||
|
||||
@Autowired
|
||||
private IUPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private IUConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private MessageSource messageSource;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@GetMapping("/test")
|
||||
public String test()
|
||||
{
|
||||
return MessageUtils.message("user.jcaptcha.error");
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查重复
|
||||
*/
|
||||
@PostMapping("/checkRepeat")
|
||||
public R<Boolean> checkRepeat(@RequestBody UserRepeatQuery query)
|
||||
{
|
||||
UUser user = new UUser();
|
||||
BeanUtils.copyProperties(query, user);
|
||||
return R.ok(!userService.checkUserNameUnique(user) || !userService.checkPhoneUnique(user)
|
||||
|| !userService.checkEmailUnique(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@RequiresPermissions("Utem:user:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UUser user)
|
||||
{
|
||||
startPage();
|
||||
List<UUser> list = userService.selectUserList(user);
|
||||
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)
|
||||
@RequiresPermissions("Utem:user:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UUser user)
|
||||
{
|
||||
List<UUser> list = userService.selectUserList(user);
|
||||
ExcelUtil<UUser> util = new ExcelUtil<UUser>(UUser.class);
|
||||
util.exportExcel(response, list, "用户数据");
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@RequiresPermissions("Utem:user:import")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||
{
|
||||
ExcelUtil<UUser> util = new ExcelUtil<UUser>(UUser.class);
|
||||
List<UUser> userList = util.importExcel(file.getInputStream());
|
||||
String operName = SecurityUtils.getUsername();
|
||||
String message = userService.importUser(userList, updateSupport, operName);
|
||||
return success(message);
|
||||
}
|
||||
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) throws IOException
|
||||
{
|
||||
ExcelUtil<UUser> util = new ExcelUtil<UUser>(UUser.class);
|
||||
util.importTemplateExcel(response, "用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户信息
|
||||
*/
|
||||
@InnerAuth
|
||||
@GetMapping("/info/{username}")
|
||||
public R<LoginUser<UUser>> info(@PathVariable("username") String username)
|
||||
{
|
||||
UUser user = userService.selectUserByUserName(username);
|
||||
if (StringUtils.isNull(user))
|
||||
{
|
||||
return R.fail("用户名或密码错误");
|
||||
}
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
LoginUser<UUser> UUserVo = new LoginUser<UUser>();
|
||||
UUserVo.setUser(user);
|
||||
UUserVo.setRoles(roles);
|
||||
UUserVo.setPermissions(permissions);
|
||||
return R.ok(UUserVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*/
|
||||
@InnerAuth
|
||||
@PostMapping("/register")
|
||||
public R<Boolean> register(@RequestBody UUser uUser)
|
||||
{
|
||||
String username = uUser.getUserName();
|
||||
if (!("true".equals(configService.selectConfigByKey("user.register"))))
|
||||
{
|
||||
return R.fail("当前系统没有开启注册功能!");
|
||||
}
|
||||
if (!userService.checkUserNameUnique(uUser))
|
||||
{
|
||||
return R.fail("user.register.save.error");
|
||||
}
|
||||
|
||||
if (!userService.checkPhoneUnique(uUser))
|
||||
{
|
||||
return R.fail("user.register.phone.save.error " + username);
|
||||
}
|
||||
|
||||
if (!userService.checkEmailUnique(uUser))
|
||||
{
|
||||
return R.fail("user.register.email.save.error");
|
||||
}
|
||||
|
||||
return R.ok(userService.registerUser(uUser));
|
||||
}
|
||||
|
||||
/**
|
||||
*记录用户登录IP地址和登录时间
|
||||
*/
|
||||
@InnerAuth
|
||||
@PutMapping("/recordlogin")
|
||||
public R<Boolean> recordlogin(@RequestBody UUser UUser)
|
||||
{
|
||||
return R.ok(userService.updateUserProfile(UUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
public AjaxResult getInfo()
|
||||
{
|
||||
LoginUser<UUser> loginUser = SecurityUtils.getLoginUser();
|
||||
UUser user = loginUser.getUser();
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
if (!loginUser.getPermissions().equals(permissions))
|
||||
{
|
||||
loginUser.setPermissions(permissions);
|
||||
tokenService.refreshToken(loginUser);
|
||||
}
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put("user", user);
|
||||
data.put("roles", roles);
|
||||
data.put("permissions", permissions);
|
||||
|
||||
return AjaxResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取详细信息
|
||||
*/
|
||||
@RequiresPermissions("Utem:user:query")
|
||||
@GetMapping(value = { "/", "/{userId}" })
|
||||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
||||
{
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
List<URole> roles = roleService.selectRoleAll();
|
||||
data.put("roles", UUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
data.put("posts", postService.selectPostAll());
|
||||
if (StringUtils.isNotNull(userId))
|
||||
{
|
||||
userService.checkUserDataScope(userId);
|
||||
UUser UUser = userService.selectUserById(userId);
|
||||
data.put(AjaxResult.DATA_TAG, UUser);
|
||||
data.put("postIds", postService.selectPostListByUserId(userId));
|
||||
data.put("roleIds", UUser.getRoles().stream().map(URole::getRoleId).collect(Collectors.toList()));
|
||||
}
|
||||
return AjaxResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@RequiresPermissions("Utem:user:add")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody UUser user)
|
||||
{
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
roleService.checkRoleDataScope(user.getRoleIds());
|
||||
if (!userService.checkUserNameUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setCreateBy(SecurityUtils.getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody UUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
// userService.checkUserDataScope(user.getUserId());
|
||||
// deptService.checkDeptDataScope(user.getDeptId());
|
||||
// roleService.checkRoleDataScope(user.getRoleIds());
|
||||
if (!userService.checkUserNameUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
@RequiresPermissions("Utem:user:remove")
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||
{
|
||||
if (ArrayUtils.contains(userIds, SecurityUtils.getUserId()))
|
||||
{
|
||||
return error("当前用户不能删除");
|
||||
}
|
||||
return toAjax(userService.deleteUserByIds(userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@RequiresPermissions("Utem:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/resetPwd")
|
||||
public AjaxResult resetPwd(@RequestBody UUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.resetPwd(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@RequiresPermissions("Utem:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody UUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.updateUserStatus(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取授权角色
|
||||
*/
|
||||
@RequiresPermissions("Utem:user:query")
|
||||
@GetMapping("/authRole/{userId}")
|
||||
public AjaxResult authRole(@PathVariable("userId") Long userId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
UUser user = userService.selectUserById(userId);
|
||||
List<URole> roles = roleService.selectRolesByUserId(userId);
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", UUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*/
|
||||
@RequiresPermissions("Utem:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authRole")
|
||||
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
||||
{
|
||||
userService.checkUserDataScope(userId);
|
||||
roleService.checkRoleDataScope(roleIds);
|
||||
userService.insertUserAuth(userId, roleIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树列表
|
||||
*/
|
||||
@RequiresPermissions("Utem:user:list")
|
||||
@GetMapping("/deptTree")
|
||||
public AjaxResult deptTree(UDept dept)
|
||||
{
|
||||
return success(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wfc.common.core.constant.CacheConstants;
|
||||
import org.wfc.common.core.domain.LoginUser;
|
||||
import org.wfc.common.core.utils.StringUtils;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.log.annotation.Log;
|
||||
import org.wfc.common.log.enums.BusinessType;
|
||||
import org.wfc.common.redis.service.RedisService;
|
||||
import org.wfc.common.security.annotation.RequiresPermissions;
|
||||
import org.wfc.user.domain.UUserOnline;
|
||||
import org.wfc.user.service.IUUserOnlineService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/online")
|
||||
public class UUserOnlineController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUUserOnlineService userOnlineService;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@RequiresPermissions("monitor:online:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(String ipaddr, String userName)
|
||||
{
|
||||
Collection<String> keys = redisService.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||
List<UUserOnline> userOnlineList = new ArrayList<UUserOnline>();
|
||||
for (String key : keys)
|
||||
{
|
||||
LoginUser user = redisService.getCacheObject(key);
|
||||
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(ipaddr))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(userName))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||
}
|
||||
else
|
||||
{
|
||||
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
||||
}
|
||||
}
|
||||
Collections.reverse(userOnlineList);
|
||||
userOnlineList.removeAll(Collections.singleton(null));
|
||||
return getDataTable(userOnlineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强退用户
|
||||
*/
|
||||
@RequiresPermissions("monitor:online:forceLogout")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@DeleteMapping("/{tokenId}")
|
||||
public AjaxResult forceLogout(@PathVariable String tokenId)
|
||||
{
|
||||
redisService.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.wfc.common.mybatis.domain.BaseData;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-账户表
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-23
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("u_account")
|
||||
@Schema(name = "UAccount", description = "用户平台-账户表")
|
||||
public class UAccount extends BaseData {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "余额")
|
||||
private BigDecimal balance;
|
||||
|
||||
@Schema(description = "套餐ID")
|
||||
private Long packageId;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
private Date startTime;
|
||||
|
||||
@Schema(description = "结束时间")
|
||||
private Date endTime;
|
||||
|
||||
@Schema(description = "流量已使用")
|
||||
private Long trafficUsed;
|
||||
|
||||
@Schema(description = "时长已使用")
|
||||
private Long durationUsed;
|
||||
|
||||
@Schema(description = "在线设备数已使用")
|
||||
private Integer clientNumUsed;
|
||||
|
||||
@Schema(description = "套餐名称")
|
||||
private String packageName;
|
||||
|
||||
@Schema(description = "有效期数")
|
||||
private Integer periodNum;
|
||||
|
||||
@Schema(description = "有效期类型")
|
||||
private Integer periodType;
|
||||
|
||||
@Schema(description = "价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "流量")
|
||||
private Long traffic;
|
||||
|
||||
@Schema(description = "时长")
|
||||
private Long duration;
|
||||
|
||||
@Schema(description = "在线设备数")
|
||||
private Integer clientNum;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "带宽是否限制")
|
||||
private Boolean rateLimitEnable;
|
||||
|
||||
@Schema(description = "流量是否限制")
|
||||
private Boolean trafficEnable;
|
||||
|
||||
@Schema(description = "时长是否限制")
|
||||
private Boolean durationEnable;
|
||||
|
||||
@Schema(description = "在线设备数是否限制")
|
||||
private Boolean clientNumEnable;
|
||||
|
||||
@Schema(description = "限速名称")
|
||||
private String rateLimitName;
|
||||
|
||||
@Schema(description = "下行限速")
|
||||
private Long downLimit;
|
||||
|
||||
@Schema(description = "下行限速启用")
|
||||
private Boolean downLimitEnable;
|
||||
|
||||
@Schema(description = "上行限速")
|
||||
private Long upLimit;
|
||||
|
||||
@Schema(description = "上行限速启用")
|
||||
private Boolean upLimitEnable;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.wfc.common.mybatis.domain.BaseData;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户话单表
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@TableName("u_cdr")
|
||||
@Schema(name = "UCdr", description = "用户平台_用户话单表")
|
||||
public class UCdr extends BaseData {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "User ID link to u_user")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "Client ID")
|
||||
private Long clientId;
|
||||
|
||||
@Schema(description = "Device ID")
|
||||
private Long deviceId;
|
||||
|
||||
@Schema(description = "Wireless SSID name ")
|
||||
private String ssid;
|
||||
|
||||
@Schema(description = "tx rate ")
|
||||
private Long rxRate;
|
||||
|
||||
@Schema(description = "tx rate")
|
||||
private Long txRate;
|
||||
|
||||
@Schema(description = "Number of downstream packets. ")
|
||||
private Long downPacket;
|
||||
|
||||
@Schema(description = "Number of upstream packets. ")
|
||||
private Long upPacket;
|
||||
|
||||
@Schema(description = "Downstream traffic (Byte)")
|
||||
private Long trafficDown;
|
||||
|
||||
@Schema(description = "Upstream traffic (Byte)")
|
||||
private Long trafficUp;
|
||||
|
||||
@Schema(description = "Rate limit profile ID. ")
|
||||
private String rateLimitProfileId;
|
||||
|
||||
@Schema(description = "Up time (unit: s).")
|
||||
private Long upTime;
|
||||
|
||||
@Schema(description = "Last found time, timestamp (ms). ")
|
||||
private Long lastSeenTime;
|
||||
|
||||
@Schema(description = "Activity download speed (Bytes/s)")
|
||||
private Long activity;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.wfc.common.mybatis.domain.BaseData;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_话单明细表
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-12
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@TableName("u_cdr_history")
|
||||
@Schema(name = "UCdrHistory", description = "用户平台_话单明细表")
|
||||
public class UCdrHistory extends BaseData {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "CDR ID")
|
||||
private Long cdrId;
|
||||
|
||||
@Schema(description = "Downstream traffic (Byte)")
|
||||
private Long trafficDown;
|
||||
|
||||
@Schema(description = "Upstream traffic (Byte)")
|
||||
private Long trafficUp;
|
||||
|
||||
@Schema(description = "Start time")
|
||||
private Long startTime;
|
||||
|
||||
@Schema(description = "End time")
|
||||
private Long endTime;
|
||||
|
||||
@Schema(description = "Duration(s)")
|
||||
private Long duration;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.wfc.common.mybatis.domain.BaseData;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户设备表
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@TableName("u_client")
|
||||
@Schema(name = "UClient", description = "用户平台_用户设备表")
|
||||
public class UClient extends BaseData {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "User ID link to u_user")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "Site ID")
|
||||
private String siteId;
|
||||
|
||||
@Schema(description = "Client Name")
|
||||
private String clientName;
|
||||
|
||||
@Schema(description = "Client device type")
|
||||
private String clientDeviceType;
|
||||
|
||||
@Schema(description = "Client mac address")
|
||||
private String clientMac;
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.wfc.common.core.annotation.Excel;
|
||||
import org.wfc.common.core.annotation.Excel.ColumnType;
|
||||
import org.wfc.common.core.web.domain.BaseEntity;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 参数配置表 u_config
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public class UConfig extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 参数主键 */
|
||||
@Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
|
||||
private Long configId;
|
||||
|
||||
/** 参数名称 */
|
||||
@Excel(name = "参数名称")
|
||||
private String configName;
|
||||
|
||||
/** 参数键名 */
|
||||
@Excel(name = "参数键名")
|
||||
private String configKey;
|
||||
|
||||
/** 参数键值 */
|
||||
@Excel(name = "参数键值")
|
||||
private String configValue;
|
||||
|
||||
/** 系统内置(Y是 N否) */
|
||||
@Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
|
||||
private String configType;
|
||||
|
||||
public Long getConfigId()
|
||||
{
|
||||
return configId;
|
||||
}
|
||||
|
||||
public void setConfigId(Long configId)
|
||||
{
|
||||
this.configId = configId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "参数名称不能为空")
|
||||
@Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
|
||||
public String getConfigName()
|
||||
{
|
||||
return configName;
|
||||
}
|
||||
|
||||
public void setConfigName(String configName)
|
||||
{
|
||||
this.configName = configName;
|
||||
}
|
||||
|
||||
@NotBlank(message = "参数键名长度不能为空")
|
||||
@Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
|
||||
public String getConfigKey()
|
||||
{
|
||||
return configKey;
|
||||
}
|
||||
|
||||
public void setConfigKey(String configKey)
|
||||
{
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
@NotBlank(message = "参数键值不能为空")
|
||||
@Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
|
||||
public String getConfigValue()
|
||||
{
|
||||
return configValue;
|
||||
}
|
||||
|
||||
public void setConfigValue(String configValue)
|
||||
{
|
||||
this.configValue = configValue;
|
||||
}
|
||||
|
||||
public String getConfigType()
|
||||
{
|
||||
return configType;
|
||||
}
|
||||
|
||||
public void setConfigType(String configType)
|
||||
{
|
||||
this.configType = configType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("configId", getConfigId())
|
||||
.append("configName", getConfigName())
|
||||
.append("configKey", getConfigKey())
|
||||
.append("configValue", getConfigValue())
|
||||
.append("configType", getConfigType())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.wfc.common.mybatis.domain.BaseData;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_AP设备表
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@TableName("u_device")
|
||||
@Schema(name = "UDevice", description = "用户平台_AP设备表")
|
||||
public class UDevice extends BaseData {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "Device Name")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(description = "Device ip")
|
||||
private String deviceIp;
|
||||
|
||||
@Schema(description = "Device mac")
|
||||
private String deviceMac;
|
||||
|
||||
@Schema(description = "Device model")
|
||||
private String deviceModel;
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.wfc.common.core.web.domain.BaseEntity;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单权限表 u_menu
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public class UMenu extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 菜单ID */
|
||||
private Long menuId;
|
||||
|
||||
/** 菜单名称 */
|
||||
private String menuName;
|
||||
|
||||
/** 父菜单名称 */
|
||||
private String parentName;
|
||||
|
||||
/** 父菜单ID */
|
||||
private Long parentId;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer orderNum;
|
||||
|
||||
/** 路由地址 */
|
||||
private String path;
|
||||
|
||||
/** 组件路径 */
|
||||
private String component;
|
||||
|
||||
/** 路由参数 */
|
||||
private String query;
|
||||
|
||||
/** 路由名称,默认和路由地址相同的驼峰格式(注意:因为vue3版本的router会删除名称相同路由,为避免名字的冲突,特殊情况可以自定义) */
|
||||
private String routeName;
|
||||
|
||||
/** 是否为外链(0是 1否) */
|
||||
private String isFrame;
|
||||
|
||||
/** 是否缓存(0缓存 1不缓存) */
|
||||
private String isCache;
|
||||
|
||||
/** 类型(M目录 C菜单 F按钮) */
|
||||
private String menuType;
|
||||
|
||||
/** 显示状态(0显示 1隐藏) */
|
||||
private String visible;
|
||||
|
||||
/** 菜单状态(0正常 1停用) */
|
||||
private String status;
|
||||
|
||||
/** 权限字符串 */
|
||||
private String perms;
|
||||
|
||||
/** 菜单图标 */
|
||||
private String icon;
|
||||
|
||||
/** 菜单key */
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/** 子菜单 */
|
||||
private List<UMenu> children = new ArrayList<UMenu>();
|
||||
|
||||
public Long getMenuId()
|
||||
{
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(Long menuId)
|
||||
{
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
|
||||
public String getMenuName()
|
||||
{
|
||||
return menuName;
|
||||
}
|
||||
|
||||
public void setMenuName(String menuName)
|
||||
{
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
public String getParentName()
|
||||
{
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName)
|
||||
{
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public Long getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
public Integer getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
|
||||
public String getPath()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
|
||||
public String getComponent()
|
||||
{
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent(String component)
|
||||
{
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
public String getQuery()
|
||||
{
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query)
|
||||
{
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public String getRouteName()
|
||||
{
|
||||
return routeName;
|
||||
}
|
||||
|
||||
public void setRouteName(String routeName)
|
||||
{
|
||||
this.routeName = routeName;
|
||||
}
|
||||
|
||||
public String getIsFrame()
|
||||
{
|
||||
return isFrame;
|
||||
}
|
||||
|
||||
public void setIsFrame(String isFrame)
|
||||
{
|
||||
this.isFrame = isFrame;
|
||||
}
|
||||
|
||||
public String getIsCache()
|
||||
{
|
||||
return isCache;
|
||||
}
|
||||
|
||||
public void setIsCache(String isCache)
|
||||
{
|
||||
this.isCache = isCache;
|
||||
}
|
||||
|
||||
@NotBlank(message = "菜单类型不能为空")
|
||||
public String getMenuType()
|
||||
{
|
||||
return menuType;
|
||||
}
|
||||
|
||||
public void setMenuType(String menuType)
|
||||
{
|
||||
this.menuType = menuType;
|
||||
}
|
||||
|
||||
public String getVisible()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(String visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
|
||||
public String getPerms()
|
||||
{
|
||||
return perms;
|
||||
}
|
||||
|
||||
public void setPerms(String perms)
|
||||
{
|
||||
this.perms = perms;
|
||||
}
|
||||
|
||||
public String getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon)
|
||||
{
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public List<UMenu> getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<UMenu> children)
|
||||
{
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("menuId", getMenuId())
|
||||
.append("menuName", getMenuName())
|
||||
.append("parentId", getParentId())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("path", getPath())
|
||||
.append("component", getComponent())
|
||||
.append("query", getQuery())
|
||||
.append("routeName", getRouteName())
|
||||
.append("isFrame", getIsFrame())
|
||||
.append("IsCache", getIsCache())
|
||||
.append("menuType", getMenuType())
|
||||
.append("visible", getVisible())
|
||||
.append("status ", getStatus())
|
||||
.append("perms", getPerms())
|
||||
.append("icon", getIcon())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("name", getName())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import org.wfc.common.mybatis.domain.BaseData;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-订单表
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("u_order")
|
||||
@Schema(name = "UOrder", description = "用户平台-订单表")
|
||||
public class UOrder extends BaseData {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "套餐ID")
|
||||
private Long packageId;
|
||||
|
||||
@Schema(description = "支付ID")
|
||||
private Long paymentId;
|
||||
|
||||
@Schema(description = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "订单类型(0套餐 1充值)")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "订单金额")
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
@Schema(description = "订单状态(0待支付 1已支付 2已取消)")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.wfc.common.mybatis.domain.BaseData;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-套餐表
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("u_package")
|
||||
@Schema(name = "UPackage", description = "用户平台-套餐表")
|
||||
public class UPackage extends BaseData {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "带宽限速ID")
|
||||
private Long rateLimitId;
|
||||
|
||||
@Schema(description = "套餐名称")
|
||||
private String packageName;
|
||||
|
||||
@Schema(description = "有效期数")
|
||||
private Integer periodNum;
|
||||
|
||||
@Schema(description = "有效期类型")
|
||||
private Integer periodType;
|
||||
|
||||
@Schema(description = "价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "流量")
|
||||
private Long traffic;
|
||||
|
||||
@Schema(description = "时长")
|
||||
private Long duration;
|
||||
|
||||
@Schema(description = "在线设备数")
|
||||
private Integer clientNum;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "带宽是否限制")
|
||||
private Boolean rateLimitEnable;
|
||||
|
||||
@Schema(description = "流量是否限制")
|
||||
private Boolean trafficEnable;
|
||||
|
||||
@Schema(description = "时长是否限制")
|
||||
private Boolean durationEnable;
|
||||
|
||||
@Schema(description = "在线设备数是否限制")
|
||||
private Boolean clientNumEnable;
|
||||
|
||||
@Schema(description = "套餐是否启用")
|
||||
private Boolean packageEnable;
|
||||
|
||||
@Schema(description = "带宽限速组")
|
||||
@TableField(exist = false)
|
||||
private URateLimit rateLimits;
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.wfc.common.core.annotation.Excel;
|
||||
import org.wfc.common.core.annotation.Excel.ColumnType;
|
||||
import org.wfc.common.core.web.domain.BaseEntity;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 岗位表 u_post
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public class UPost extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 岗位序号 */
|
||||
@Excel(name = "岗位序号", cellType = ColumnType.NUMERIC)
|
||||
private Long postId;
|
||||
|
||||
/** 岗位编码 */
|
||||
@Excel(name = "岗位编码")
|
||||
private String postCode;
|
||||
|
||||
/** 岗位名称 */
|
||||
@Excel(name = "岗位名称")
|
||||
private String postName;
|
||||
|
||||
/** 岗位排序 */
|
||||
@Excel(name = "岗位排序")
|
||||
private Integer postSort;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 用户是否存在此岗位标识 默认不存在 */
|
||||
private boolean flag = false;
|
||||
|
||||
public Long getPostId()
|
||||
{
|
||||
return postId;
|
||||
}
|
||||
|
||||
public void setPostId(Long postId)
|
||||
{
|
||||
this.postId = postId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "岗位编码不能为空")
|
||||
@Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符")
|
||||
public String getPostCode()
|
||||
{
|
||||
return postCode;
|
||||
}
|
||||
|
||||
public void setPostCode(String postCode)
|
||||
{
|
||||
this.postCode = postCode;
|
||||
}
|
||||
|
||||
@NotBlank(message = "岗位名称不能为空")
|
||||
@Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符")
|
||||
public String getPostName()
|
||||
{
|
||||
return postName;
|
||||
}
|
||||
|
||||
public void setPostName(String postName)
|
||||
{
|
||||
this.postName = postName;
|
||||
}
|
||||
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
public Integer getPostSort()
|
||||
{
|
||||
return postSort;
|
||||
}
|
||||
|
||||
public void setPostSort(Integer postSort)
|
||||
{
|
||||
this.postSort = postSort;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public boolean isFlag()
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(boolean flag)
|
||||
{
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("postId", getPostId())
|
||||
.append("postCode", getPostCode())
|
||||
.append("postName", getPostName())
|
||||
.append("postSort", getPostSort())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import org.wfc.common.mybatis.domain.BaseData;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-带宽限速表
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("u_rate_limit")
|
||||
@Schema(name = "URateLimit", description = "用户平台-带宽限速表")
|
||||
public class URateLimit extends BaseData {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "限速名称")
|
||||
private String rateLimitName;
|
||||
|
||||
@Schema(description = "下行限速")
|
||||
private Long downLimit;
|
||||
|
||||
@Schema(description = "下行限速启用")
|
||||
private Boolean downLimitEnable;
|
||||
|
||||
@Schema(description = "上行限速")
|
||||
private Long upLimit;
|
||||
|
||||
@Schema(description = "上行限速启用")
|
||||
private Boolean upLimitEnable;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 角色和部门关联 u_role_dept
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public class URoleDept
|
||||
{
|
||||
/** 角色ID */
|
||||
private Long roleId;
|
||||
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
|
||||
public Long getRoleId()
|
||||
{
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId)
|
||||
{
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("roleId", getRoleId())
|
||||
.append("deptId", getDeptId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 角色和菜单关联 u_role_menu
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public class URoleMenu
|
||||
{
|
||||
/** 角色ID */
|
||||
private Long roleId;
|
||||
|
||||
/** 菜单ID */
|
||||
private Long menuId;
|
||||
|
||||
public Long getRoleId()
|
||||
{
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId)
|
||||
{
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public Long getMenuId()
|
||||
{
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(Long menuId)
|
||||
{
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("roleId", getRoleId())
|
||||
.append("menuId", getMenuId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
/**
|
||||
* 当前在线会话
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public class UUserOnline
|
||||
{
|
||||
/** 会话编号 */
|
||||
private String tokenId;
|
||||
|
||||
/** 用户名称 */
|
||||
private String userName;
|
||||
|
||||
/** 登录IP地址 */
|
||||
private String ipaddr;
|
||||
|
||||
/** 登录地址 */
|
||||
private String loginLocation;
|
||||
|
||||
/** 浏览器类型 */
|
||||
private String browser;
|
||||
|
||||
/** 操作系统 */
|
||||
private String os;
|
||||
|
||||
/** 登录时间 */
|
||||
private Long loginTime;
|
||||
|
||||
public String getTokenId()
|
||||
{
|
||||
return tokenId;
|
||||
}
|
||||
|
||||
public void setTokenId(String tokenId)
|
||||
{
|
||||
this.tokenId = tokenId;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getIpaddr()
|
||||
{
|
||||
return ipaddr;
|
||||
}
|
||||
|
||||
public void setIpaddr(String ipaddr)
|
||||
{
|
||||
this.ipaddr = ipaddr;
|
||||
}
|
||||
|
||||
public String getLoginLocation()
|
||||
{
|
||||
return loginLocation;
|
||||
}
|
||||
|
||||
public void setLoginLocation(String loginLocation)
|
||||
{
|
||||
this.loginLocation = loginLocation;
|
||||
}
|
||||
|
||||
public String getBrowser()
|
||||
{
|
||||
return browser;
|
||||
}
|
||||
|
||||
public void setBrowser(String browser)
|
||||
{
|
||||
this.browser = browser;
|
||||
}
|
||||
|
||||
public String getOs()
|
||||
{
|
||||
return os;
|
||||
}
|
||||
|
||||
public void setOs(String os)
|
||||
{
|
||||
this.os = os;
|
||||
}
|
||||
|
||||
public Long getLoginTime()
|
||||
{
|
||||
return loginTime;
|
||||
}
|
||||
|
||||
public void setLoginTime(Long loginTime)
|
||||
{
|
||||
this.loginTime = loginTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 用户和岗位关联 u_user_post
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public class UUserPost
|
||||
{
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 岗位ID */
|
||||
private Long postId;
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getPostId()
|
||||
{
|
||||
return postId;
|
||||
}
|
||||
|
||||
public void setPostId(Long postId)
|
||||
{
|
||||
this.postId = postId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("userId", getUserId())
|
||||
.append("postId", getPostId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 用户和角色关联 u_user_role
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public class UUserRole
|
||||
{
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 角色ID */
|
||||
private Long roleId;
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getRoleId()
|
||||
{
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId)
|
||||
{
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("userId", getUserId())
|
||||
.append("roleId", getRoleId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.wfc.user.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 话单设备bo
|
||||
* @author: cyc
|
||||
* @since: 2024-12-13
|
||||
*/
|
||||
@Data
|
||||
public class UCdrClientBo {
|
||||
private String clientName;
|
||||
private String clientMac;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.wfc.user.domain.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @description: 订单状态枚举
|
||||
* @author: cyc
|
||||
* @since: 2024-12-23
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum OrderStatusEnum {
|
||||
|
||||
UNPAID(0, "未支付"),
|
||||
PAID(1, "已支付"),
|
||||
CANCELLED(2, "已取消");
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.wfc.user.domain.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @description: 订单类型枚举
|
||||
* @author: cyc
|
||||
* @since: 2024-12-23
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum OrderTypeEnum {
|
||||
|
||||
PACKAGE(0, "套餐"),
|
||||
RECHARGE(1, "充值");
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.wfc.user.domain.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @description: 有效期类型枚举
|
||||
* @author: cyc
|
||||
* @since: 2024-12-23
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PeriodTypeEnum {
|
||||
|
||||
HOUR(0, "小时"),
|
||||
DAY(1, "天"),
|
||||
MONTH(2, "月"),
|
||||
YEAR(3, "年")
|
||||
;
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
|
||||
public static PeriodTypeEnum getByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (PeriodTypeEnum periodTypeEnum : PeriodTypeEnum.values()) {
|
||||
if (periodTypeEnum.getCode().equals(code)) {
|
||||
return periodTypeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.wfc.user.domain.query;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 用户重复query
|
||||
* @author: caiyuchao
|
||||
* @date: 2024-11-27
|
||||
*/
|
||||
@Data
|
||||
public class UserRepeatQuery {
|
||||
private String userName;
|
||||
private String email;
|
||||
private String phonenumber;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package org.wfc.user.domain.vo;
|
||||
|
||||
import org.wfc.common.core.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 路由显示信息
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public class MetaVo
|
||||
{
|
||||
/**
|
||||
* 设置该路由在侧边栏和面包屑中展示的名字
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 设置该路由的图标,对应路径src/assets/icons/svg
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 设置为true,则不会被 <keep-alive>缓存
|
||||
*/
|
||||
private boolean noCache;
|
||||
|
||||
/**
|
||||
* 内链地址(http(s)://开头)
|
||||
*/
|
||||
private String link;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer order;
|
||||
|
||||
public MetaVo()
|
||||
{
|
||||
}
|
||||
|
||||
public MetaVo(String title, String icon, Integer order)
|
||||
{
|
||||
this.title = title;
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public MetaVo(String title, String icon, boolean noCache, Integer order)
|
||||
{
|
||||
this.title = title;
|
||||
this.icon = icon;
|
||||
this.noCache = noCache;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public MetaVo(String title, String icon, String link, Integer order)
|
||||
{
|
||||
this.title = title;
|
||||
this.icon = icon;
|
||||
this.link = link;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public MetaVo(String title, String icon, boolean noCache, String link, Integer order)
|
||||
{
|
||||
this.title = title;
|
||||
this.icon = icon;
|
||||
this.noCache = noCache;
|
||||
this.order = order;
|
||||
if (StringUtils.ishttp(link))
|
||||
{
|
||||
this.link = link;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNoCache()
|
||||
{
|
||||
return noCache;
|
||||
}
|
||||
|
||||
public void setNoCache(boolean noCache)
|
||||
{
|
||||
this.noCache = noCache;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon)
|
||||
{
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public String getLink()
|
||||
{
|
||||
return link;
|
||||
}
|
||||
|
||||
public void setLink(String link)
|
||||
{
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
public Integer getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(Integer order) {
|
||||
this.order = order;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package org.wfc.user.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.wfc.user.domain.vo.MetaVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 路由配置信息
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
public class RouterVo
|
||||
{
|
||||
/**
|
||||
* 路由名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 路由地址
|
||||
*/
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
|
||||
*/
|
||||
private boolean hideInMenu;
|
||||
|
||||
/**
|
||||
* 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
|
||||
*/
|
||||
private String redirect;
|
||||
|
||||
/**
|
||||
* 组件地址
|
||||
*/
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 路由参数:如 {"id": 1, "name": "ry"}
|
||||
*/
|
||||
private String query;
|
||||
|
||||
/**
|
||||
* 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
|
||||
*/
|
||||
private Boolean alwaysShow;
|
||||
|
||||
/**
|
||||
* 其他元素
|
||||
*/
|
||||
private MetaVo meta;
|
||||
|
||||
/**
|
||||
* 子路由
|
||||
*/
|
||||
private List<RouterVo> children;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPath()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public boolean getHideInMenu()
|
||||
{
|
||||
return hideInMenu;
|
||||
}
|
||||
|
||||
public void setHideInMenu(boolean hideInMenu)
|
||||
{
|
||||
this.hideInMenu = hideInMenu;
|
||||
}
|
||||
|
||||
public String getRedirect()
|
||||
{
|
||||
return redirect;
|
||||
}
|
||||
|
||||
public void setRedirect(String redirect)
|
||||
{
|
||||
this.redirect = redirect;
|
||||
}
|
||||
|
||||
public String getComponent()
|
||||
{
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent(String component)
|
||||
{
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
public String getQuery()
|
||||
{
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query)
|
||||
{
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public Boolean getAlwaysShow()
|
||||
{
|
||||
return alwaysShow;
|
||||
}
|
||||
|
||||
public void setAlwaysShow(Boolean alwaysShow)
|
||||
{
|
||||
this.alwaysShow = alwaysShow;
|
||||
}
|
||||
|
||||
public MetaVo getMeta()
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void setMeta(MetaVo meta)
|
||||
{
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public List<RouterVo> getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<RouterVo> children)
|
||||
{
|
||||
this.children = children;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package org.wfc.user.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.wfc.user.api.domain.UDept;
|
||||
import org.wfc.user.domain.UMenu;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Treeselect树结构实体类
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public class TreeSelect implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 节点ID */
|
||||
private Long id;
|
||||
|
||||
/** 节点名称 */
|
||||
private String label;
|
||||
|
||||
/** 子节点 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<TreeSelect> children;
|
||||
|
||||
public TreeSelect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TreeSelect(UDept dept)
|
||||
{
|
||||
this.id = dept.getDeptId();
|
||||
this.label = dept.getDeptName();
|
||||
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public TreeSelect(UMenu menu)
|
||||
{
|
||||
this.id = menu.getMenuId();
|
||||
this.label = menu.getMenuName();
|
||||
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label)
|
||||
{
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public List<TreeSelect> getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<TreeSelect> children)
|
||||
{
|
||||
this.children = children;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.wfc.user.domain.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @description: 账户仪表盘Vo
|
||||
* @author: cyc
|
||||
* @since: 2024-12-25
|
||||
*/
|
||||
@Data
|
||||
public class UAccountDashboardVo {
|
||||
|
||||
private Long id;
|
||||
|
||||
private BigDecimal balance;
|
||||
|
||||
private Long packageId;
|
||||
|
||||
private Date startTime;
|
||||
|
||||
private Date endTime;
|
||||
|
||||
private Long trafficUsed;
|
||||
|
||||
private Long durationUsed;
|
||||
|
||||
private Integer clientNumUsed;
|
||||
|
||||
private String packageName;
|
||||
|
||||
private Integer periodNum;
|
||||
|
||||
private Integer periodType;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private Long traffic;
|
||||
|
||||
private Long duration;
|
||||
|
||||
private Integer clientNum;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Boolean rateLimitEnable;
|
||||
|
||||
private Boolean trafficEnable;
|
||||
|
||||
private Boolean durationEnable;
|
||||
|
||||
private Boolean clientNumEnable;
|
||||
|
||||
private String rateLimitName;
|
||||
|
||||
private Long downLimit;
|
||||
|
||||
private Boolean downLimitEnable;
|
||||
|
||||
private Long upLimit;
|
||||
|
||||
private Boolean upLimitEnable;
|
||||
|
||||
private Long activity;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.wfc.user.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 话单设备vo
|
||||
* @author: cyc
|
||||
* @since: 2024-12-13
|
||||
*/
|
||||
@Data
|
||||
public class UCdrClientVo {
|
||||
private Long id;
|
||||
private String clientName;
|
||||
private String clientMac;
|
||||
private String clientDeviceType;
|
||||
private Long userId;
|
||||
private Long startTime;
|
||||
private Long endTime;
|
||||
private Long duration;
|
||||
private Long trafficDown;
|
||||
private Long trafficUp;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.wfc.user.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: cdr历史vo
|
||||
* @author: cyc
|
||||
* @since: 2024-12-17
|
||||
*/
|
||||
@Data
|
||||
public class UCdrHistoryUserVo {
|
||||
private Long id;
|
||||
private String clientName;
|
||||
private String clientMac;
|
||||
private String clientDeviceType;
|
||||
private Long startTime;
|
||||
private Long endTime;
|
||||
private Long duration;
|
||||
private Long trafficDown;
|
||||
private Long trafficUp;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.wfc.user.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 话单用户vo
|
||||
* @author: cyc
|
||||
* @since: 2024-12-13
|
||||
*/
|
||||
@Data
|
||||
public class UCdrUserVo {
|
||||
private Long id;
|
||||
private Long startTime;
|
||||
private Long endTime;
|
||||
private Long duration;
|
||||
private Long trafficDown;
|
||||
private Long trafficUp;
|
||||
private Long activity;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.wfc.user.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 当前接入设备Vo
|
||||
* @author: cyc
|
||||
* @since: 2024-12-17
|
||||
*/
|
||||
@Data
|
||||
public class UClientCurrentVo {
|
||||
private Long id;
|
||||
private String clientName;
|
||||
private String clientMac;
|
||||
private String clientDeviceType;
|
||||
private Long upTime;
|
||||
private Long trafficDown;
|
||||
private Long trafficUp;
|
||||
private Long activity;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.wfc.user.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 历史设备vo
|
||||
* @author: cyc
|
||||
* @since: 2024-12-17
|
||||
*/
|
||||
@Data
|
||||
public class UClientHistoryUserVo {
|
||||
private Long id;
|
||||
private String clientName;
|
||||
private String clientMac;
|
||||
private String clientDeviceType;
|
||||
private Long startTime;
|
||||
private Long endTime;
|
||||
private Long duration;
|
||||
private Long trafficDown;
|
||||
private Long trafficUp;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.domain.UAccount;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-账户表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-23
|
||||
*/
|
||||
public interface UAccountMapper extends BaseMapper<UAccount> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.wfc.user.domain.UCdrHistory;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_话单明细表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-12
|
||||
*/
|
||||
public interface UCdrHistoryMapper extends BaseMapper<UCdrHistory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.wfc.user.domain.UCdr;
|
||||
import org.wfc.user.domain.bo.UCdrClientBo;
|
||||
import org.wfc.user.domain.vo.UCdrClientVo;
|
||||
import org.wfc.user.domain.vo.UCdrHistoryUserVo;
|
||||
import org.wfc.user.domain.vo.UCdrUserVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户话单表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
public interface UCdrMapper extends BaseMapper<UCdr> {
|
||||
|
||||
List<UCdrUserVo> getByUser(@Param("userId") Long userId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
|
||||
|
||||
List<UCdrClientVo> getByClient(@Param("client") UCdrClientBo client);
|
||||
|
||||
List<UCdrHistoryUserVo> getHistoryByUser(@Param("userId") Long userId);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.wfc.user.domain.UClient;
|
||||
import org.wfc.user.domain.vo.UClientHistoryUserVo;
|
||||
import org.wfc.user.domain.vo.UClientCurrentVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户设备表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
public interface UClientMapper extends BaseMapper<UClient> {
|
||||
|
||||
List<UClientCurrentVo> getCurrentClients(@Param("userId") Long userId);
|
||||
|
||||
List<UClientHistoryUserVo> getHistoryByUser(@Param("userId") Long userId);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.domain.UConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface UConfigMapper
|
||||
{
|
||||
/**
|
||||
* 查询参数配置信息
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
public UConfig selectConfig(UConfig config);
|
||||
|
||||
/**
|
||||
* 通过ID查询配置
|
||||
*
|
||||
* @param configId 参数ID
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
public UConfig selectConfigById(Long configId);
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 参数配置集合
|
||||
*/
|
||||
public List<UConfig> selectConfigList(UConfig config);
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
*
|
||||
* @param configKey 参数键名
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
public UConfig checkConfigKeyUnique(String configKey);
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertConfig(UConfig config);
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateConfig(UConfig config);
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*
|
||||
* @param configId 参数ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConfigById(Long configId);
|
||||
|
||||
/**
|
||||
* 批量删除参数信息
|
||||
*
|
||||
* @param configIds 需要删除的参数ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConfigByIds(Long[] configIds);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.wfc.user.api.domain.UDept;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门管理 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface UDeptMapper
|
||||
{
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
public List<UDept> selectDeptList(UDept dept);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询部门树信息
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param deptCheckStrictly 部门树选择项是否关联显示
|
||||
* @return 选中部门列表
|
||||
*/
|
||||
public List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
|
||||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 部门信息
|
||||
*/
|
||||
public UDept selectDeptById(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据ID查询所有子部门
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 部门列表
|
||||
*/
|
||||
public List<UDept> selectChildrenDeptById(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据ID查询所有子部门(正常状态)
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 子部门数
|
||||
*/
|
||||
public int selectNormalChildrenDeptById(Long deptId);
|
||||
|
||||
/**
|
||||
* 是否存在子节点
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int hasChildByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 查询部门是否存在用户
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int checkDeptExistUser(Long deptId);
|
||||
|
||||
/**
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
* @param deptName 部门名称
|
||||
* @param parentId 父部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
public UDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
|
||||
|
||||
/**
|
||||
* 新增部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDept(UDept dept);
|
||||
|
||||
/**
|
||||
* 修改部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDept(UDept dept);
|
||||
|
||||
/**
|
||||
* 修改所在部门正常状态
|
||||
*
|
||||
* @param deptIds 部门ID组
|
||||
*/
|
||||
public void updateDeptStatusNormal(Long[] deptIds);
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
* @param depts 子元素
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeptChildren(@Param("depts") List<UDept> depts);
|
||||
|
||||
/**
|
||||
* 删除部门管理信息
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById(Long deptId);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.domain.UDevice;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_AP设备表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
public interface UDeviceMapper extends BaseMapper<UDevice> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.wfc.user.api.domain.UDictData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典表 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface UDictDataMapper
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询字典数据
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
public List<UDictData> selectDictDataList(UDictData dictData);
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
public List<UDictData> selectDictDataByType(String dictType);
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
|
||||
|
||||
/**
|
||||
* 根据字典数据ID查询信息
|
||||
*
|
||||
* @param dictCode 字典数据ID
|
||||
* @return 字典数据
|
||||
*/
|
||||
public UDictData selectDictDataById(Long dictCode);
|
||||
|
||||
/**
|
||||
* 查询字典数据
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据
|
||||
*/
|
||||
public int countDictDataByType(String dictType);
|
||||
|
||||
/**
|
||||
* 通过字典ID删除字典数据信息
|
||||
*
|
||||
* @param dictCode 字典数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictDataById(Long dictCode);
|
||||
|
||||
/**
|
||||
* 批量删除字典数据信息
|
||||
*
|
||||
* @param dictCodes 需要删除的字典数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictDataByIds(Long[] dictCodes);
|
||||
|
||||
/**
|
||||
* 新增字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictData(UDictData dictData);
|
||||
|
||||
/**
|
||||
* 修改字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictData(UDictData dictData);
|
||||
|
||||
/**
|
||||
* 同步修改字典类型
|
||||
*
|
||||
* @param oldDictType 旧字典类型
|
||||
* @param newDictType 新旧字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.api.domain.UDictType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典表 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface UDictTypeMapper
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询字典类型
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
public List<UDictType> selectDictTypeList(UDictType dictType);
|
||||
|
||||
/**
|
||||
* 根据所有字典类型
|
||||
*
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
public List<UDictType> selectDictTypeAll();
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
*
|
||||
* @param dictId 字典类型ID
|
||||
* @return 字典类型
|
||||
*/
|
||||
public UDictType selectDictTypeById(Long dictId);
|
||||
|
||||
/**
|
||||
* 根据字典类型查询信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
public UDictType selectDictTypeByType(String dictType);
|
||||
|
||||
/**
|
||||
* 通过字典ID删除字典信息
|
||||
*
|
||||
* @param dictId 字典ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictTypeById(Long dictId);
|
||||
|
||||
/**
|
||||
* 批量删除字典类型信息
|
||||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDictTypeByIds(Long[] dictIds);
|
||||
|
||||
/**
|
||||
* 新增字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictType(UDictType dictType);
|
||||
|
||||
/**
|
||||
* 修改字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictType(UDictType dictType);
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
public UDictType checkDictTypeUnique(String dictType);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.api.domain.ULogininfor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统访问日志情况信息 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface ULogininforMapper
|
||||
{
|
||||
/**
|
||||
* 新增系统登录日志
|
||||
*
|
||||
* @param logininfor 访问日志对象
|
||||
*/
|
||||
public int insertLogininfor(ULogininfor logininfor);
|
||||
|
||||
/**
|
||||
* 查询系统登录日志集合
|
||||
*
|
||||
* @param logininfor 访问日志对象
|
||||
* @return 登录记录集合
|
||||
*/
|
||||
public List<ULogininfor> selectLogininforList(ULogininfor logininfor);
|
||||
|
||||
/**
|
||||
* 批量删除系统登录日志
|
||||
*
|
||||
* @param infoIds 需要删除的登录日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteLogininforByIds(Long[] infoIds);
|
||||
|
||||
/**
|
||||
* 清空系统登录日志
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int cleanLogininfor();
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.wfc.user.domain.UMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单表 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface UMenuMapper
|
||||
{
|
||||
/**
|
||||
* 查询系统菜单列表
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<UMenu> selectMenuList(UMenu menu);
|
||||
|
||||
/**
|
||||
* 根据用户所有权限
|
||||
*
|
||||
* @return 权限列表
|
||||
*/
|
||||
public List<String> selectMenuPerms();
|
||||
|
||||
/**
|
||||
* 根据用户查询系统菜单列表
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<UMenu> selectMenuListByUserId(UMenu menu);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询权限
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
public List<String> selectMenuPermsByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
public List<String> selectMenuPermsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询菜单
|
||||
*
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<UMenu> selectMenuTreeAll();
|
||||
|
||||
/**
|
||||
* 根据用户ID查询菜单
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<UMenu> selectMenuTreeByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询菜单树信息
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param menuCheckStrictly 菜单树选择项是否关联显示
|
||||
* @return 选中菜单列表
|
||||
*/
|
||||
public List<Long> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
|
||||
|
||||
/**
|
||||
* 根据菜单ID查询信息
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 菜单信息
|
||||
*/
|
||||
public UMenu selectMenuById(Long menuId);
|
||||
|
||||
/**
|
||||
* 是否存在菜单子节点
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int hasChildByMenuId(Long menuId);
|
||||
|
||||
/**
|
||||
* 新增菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMenu(UMenu menu);
|
||||
|
||||
/**
|
||||
* 修改菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMenu(UMenu menu);
|
||||
|
||||
/**
|
||||
* 删除菜单管理信息
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMenuById(Long menuId);
|
||||
|
||||
/**
|
||||
* 校验菜单名称是否唯一
|
||||
*
|
||||
* @param menuName 菜单名称
|
||||
* @param parentId 父菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
public UMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.api.domain.UOperLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface UOperLogMapper
|
||||
{
|
||||
/**
|
||||
* 新增操作日志
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
*/
|
||||
public int insertOperlog(UOperLog operLog);
|
||||
|
||||
/**
|
||||
* 查询系统操作日志集合
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
public List<UOperLog> selectOperLogList(UOperLog operLog);
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
*
|
||||
* @param operIds 需要删除的操作日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOperLogByIds(Long[] operIds);
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
*
|
||||
* @param operId 操作ID
|
||||
* @return 操作日志对象
|
||||
*/
|
||||
public UOperLog selectOperLogById(Long operId);
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
*/
|
||||
public void cleanOperLog();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.domain.UOrder;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-订单表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
public interface UOrderMapper extends BaseMapper<UOrder> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.domain.UPackage;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-套餐表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
public interface UPackageMapper extends BaseMapper<UPackage> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.domain.UPost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface UPostMapper
|
||||
{
|
||||
/**
|
||||
* 查询岗位数据集合
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 岗位数据集合
|
||||
*/
|
||||
public List<UPost> selectPostList(UPost post);
|
||||
|
||||
/**
|
||||
* 查询所有岗位
|
||||
*
|
||||
* @return 岗位列表
|
||||
*/
|
||||
public List<UPost> selectPostAll();
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位信息
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
public UPost selectPostById(Long postId);
|
||||
|
||||
/**
|
||||
* 根据用户ID获取岗位选择框列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 选中岗位ID列表
|
||||
*/
|
||||
public List<Long> selectPostListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 查询用户所属岗位组
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
public List<UPost> selectPostsByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 删除岗位信息
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePostById(Long postId);
|
||||
|
||||
/**
|
||||
* 批量删除岗位信息
|
||||
*
|
||||
* @param postIds 需要删除的岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePostByIds(Long[] postIds);
|
||||
|
||||
/**
|
||||
* 修改岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePost(UPost post);
|
||||
|
||||
/**
|
||||
* 新增岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPost(UPost post);
|
||||
|
||||
/**
|
||||
* 校验岗位名称
|
||||
*
|
||||
* @param postName 岗位名称
|
||||
* @return 结果
|
||||
*/
|
||||
public UPost checkPostNameUnique(String postName);
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
*
|
||||
* @param postCode 岗位编码
|
||||
* @return 结果
|
||||
*/
|
||||
public UPost checkPostCodeUnique(String postCode);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.domain.URateLimit;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-带宽限速表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
public interface URateLimitMapper extends BaseMapper<URateLimit> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.domain.URoleDept;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色与部门关联表 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface URoleDeptMapper
|
||||
{
|
||||
/**
|
||||
* 通过角色ID删除角色和部门关联
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleDeptByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 批量删除角色部门关联信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleDept(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询部门使用数量
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int selectCountRoleDeptByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 批量新增角色部门信息
|
||||
*
|
||||
* @param roleDeptList 角色部门列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchRoleDept(List<URoleDept> roleDeptList);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.api.domain.URole;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色表 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface URoleMapper
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询角色数据
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 角色数据集合信息
|
||||
*/
|
||||
public List<URole> selectRoleList(URole role);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 角色列表
|
||||
*/
|
||||
public List<URole> selectRolePermissionByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
public List<URole> selectRoleAll();
|
||||
|
||||
/**
|
||||
* 根据用户ID获取角色选择框列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 选中角色ID列表
|
||||
*/
|
||||
public List<Long> selectRoleListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
public URole selectRoleById(Long roleId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 角色列表
|
||||
*/
|
||||
public List<URole> selectRolesByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 校验角色名称是否唯一
|
||||
*
|
||||
* @param roleName 角色名称
|
||||
* @return 角色信息
|
||||
*/
|
||||
public URole checkRoleNameUnique(String roleName);
|
||||
|
||||
/**
|
||||
* 校验角色权限是否唯一
|
||||
*
|
||||
* @param roleKey 角色权限
|
||||
* @return 角色信息
|
||||
*/
|
||||
public URole checkRoleKeyUnique(String roleKey);
|
||||
|
||||
/**
|
||||
* 修改角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRole(URole role);
|
||||
|
||||
/**
|
||||
* 新增角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRole(URole role);
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleById(Long roleId);
|
||||
|
||||
/**
|
||||
* 批量删除角色信息
|
||||
*
|
||||
* @param roleIds 需要删除的角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleByIds(Long[] roleIds);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.domain.URoleMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色与菜单关联表 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface URoleMenuMapper
|
||||
{
|
||||
/**
|
||||
* 查询菜单使用数量
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int checkMenuExistRole(Long menuId);
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色和菜单关联
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleMenuByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 批量删除角色菜单关联信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleMenu(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量新增角色菜单信息
|
||||
*
|
||||
* @param roleMenuList 角色菜单列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchRoleMenu(List<URoleMenu> roleMenuList);
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.wfc.user.api.domain.UUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户表 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface UUserMapper
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
* @param UUser 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<UUser> selectUserList(UUser UUser);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<UUser> selectAllocatedList(UUser user);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<UUser> selectUnallocatedList(UUser user);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public UUser selectUserByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public UUser selectUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUser(UUser user);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUser(UUser user);
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
*/
|
||||
public int resetUserPwd(@Param("userName") String userName, @Param("password") String password);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserByIds(Long[] userIds);
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param userName 用户名称
|
||||
* @return 结果
|
||||
*/
|
||||
public UUser checkUserNameUnique(String userName);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
* @param phonenumber 手机号码
|
||||
* @return 结果
|
||||
*/
|
||||
public UUser checkPhoneUnique(String phonenumber);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
*
|
||||
* @param email 用户邮箱
|
||||
* @return 结果
|
||||
*/
|
||||
public UUser checkEmailUnique(String email);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.domain.UUserPost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户与岗位关联表 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface UUserPostMapper
|
||||
{
|
||||
/**
|
||||
* 通过用户ID删除用户和岗位关联
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserPostByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位使用数量
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int countUserPostById(Long postId);
|
||||
|
||||
/**
|
||||
* 批量删除用户和岗位关联
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserPost(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量新增用户岗位信息
|
||||
*
|
||||
* @param userPostList 用户岗位列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUserPost(List<UUserPost> userPostList);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.wfc.user.domain.UUserRole;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户与角色关联表 数据层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface UUserRoleMapper
|
||||
{
|
||||
/**
|
||||
* 通过用户ID删除用户和角色关联
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserRoleByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户和角色关联
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserRole(Long[] ids);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int countUserRoleByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 批量新增用户角色信息
|
||||
*
|
||||
* @param userRoleList 用户角色列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUserRole(List<UUserRole> userRoleList);
|
||||
|
||||
/**
|
||||
* 删除用户和角色关联信息
|
||||
*
|
||||
* @param userRole 用户和角色关联信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserRoleInfo(UUserRole userRole);
|
||||
|
||||
/**
|
||||
* 批量取消授权用户角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要删除的用户数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.api.domain.bo.UClientBo;
|
||||
import org.wfc.user.domain.UAccount;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.wfc.user.domain.vo.UAccountDashboardVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-账户表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-23
|
||||
*/
|
||||
public interface IUAccountService extends IService<UAccount> {
|
||||
|
||||
/**
|
||||
* 统计和取消授权用户
|
||||
*/
|
||||
void statAndCancelAuthUser();
|
||||
|
||||
/**
|
||||
* 授权设备和限速
|
||||
* @param client client
|
||||
*/
|
||||
void authClientAndRateLimit(UClientBo client);
|
||||
|
||||
/**
|
||||
* 首页仪表盘查询
|
||||
* @return
|
||||
*/
|
||||
UAccountDashboardVo getByUser();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.wfc.user.domain.UCdrHistory;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_话单明细表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-12
|
||||
*/
|
||||
public interface IUCdrHistoryService extends IService<UCdrHistory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.wfc.user.domain.UCdr;
|
||||
import org.wfc.user.domain.bo.UCdrClientBo;
|
||||
import org.wfc.user.domain.vo.UCdrClientVo;
|
||||
import org.wfc.user.domain.vo.UCdrHistoryUserVo;
|
||||
import org.wfc.user.domain.vo.UCdrUserVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户话单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
public interface IUCdrService extends IService<UCdr> {
|
||||
|
||||
UCdrUserVo getByUser();
|
||||
|
||||
List<UCdrClientVo> getByClient(UCdrClientBo client);
|
||||
|
||||
List<UCdrHistoryUserVo> getHistoryByUser();
|
||||
|
||||
void addCdrInfoByOmadaApi();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.wfc.user.api.domain.bo.UClientBo;
|
||||
import org.wfc.user.domain.UClient;
|
||||
import org.wfc.user.domain.vo.UClientCurrentVo;
|
||||
import org.wfc.user.domain.vo.UClientHistoryUserVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户设备表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
public interface IUClientService extends IService<UClient> {
|
||||
|
||||
boolean recordClientUser(UClientBo uClientBo);
|
||||
|
||||
List<UClientCurrentVo> getCurrentClients();
|
||||
|
||||
List<UClientHistoryUserVo> getHistoryByUser();
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.domain.UConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 服务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IUConfigService
|
||||
{
|
||||
/**
|
||||
* 查询参数配置信息
|
||||
*
|
||||
* @param configId 参数配置ID
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
public UConfig selectConfigById(Long configId);
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
*
|
||||
* @param configKey 参数键名
|
||||
* @return 参数键值
|
||||
*/
|
||||
public String selectConfigByKey(String configKey);
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 参数配置集合
|
||||
*/
|
||||
public List<UConfig> selectConfigList(UConfig config);
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertConfig(UConfig config);
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateConfig(UConfig config);
|
||||
|
||||
/**
|
||||
* 批量删除参数信息
|
||||
*
|
||||
* @param configIds 需要删除的参数ID
|
||||
*/
|
||||
public void deleteConfigByIds(Long[] configIds);
|
||||
|
||||
/**
|
||||
* 加载参数缓存数据
|
||||
*/
|
||||
public void loadingConfigCache();
|
||||
|
||||
/**
|
||||
* 清空参数缓存数据
|
||||
*/
|
||||
public void clearConfigCache();
|
||||
|
||||
/**
|
||||
* 重置参数缓存数据
|
||||
*/
|
||||
public void resetConfigCache();
|
||||
|
||||
/**
|
||||
* 校验参数键名是否唯一
|
||||
*
|
||||
* @param config 参数信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkConfigKeyUnique(UConfig config);
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.api.domain.UDept;
|
||||
import org.wfc.user.domain.vo.TreeSelect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门管理 服务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IUDeptService
|
||||
{
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
public List<UDept> selectDeptList(UDept dept);
|
||||
|
||||
/**
|
||||
* 查询部门树结构信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门树信息集合
|
||||
*/
|
||||
public List<TreeSelect> selectDeptTreeList(UDept dept);
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
public List<UDept> buildDeptTree(List<UDept> depts);
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
public List<TreeSelect> buildDeptTreeSelect(List<UDept> depts);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询部门树信息
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 选中部门列表
|
||||
*/
|
||||
public List<Long> selectDeptListByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 部门信息
|
||||
*/
|
||||
public UDept selectDeptById(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据ID查询所有子部门(正常状态)
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 子部门数
|
||||
*/
|
||||
public int selectNormalChildrenDeptById(Long deptId);
|
||||
|
||||
/**
|
||||
* 是否存在部门子节点
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean hasChildByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 查询部门是否存在用户
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
public boolean checkDeptExistUser(Long deptId);
|
||||
|
||||
/**
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkDeptNameUnique(UDept dept);
|
||||
|
||||
/**
|
||||
* 校验部门是否有数据权限
|
||||
*
|
||||
* @param deptId 部门id
|
||||
*/
|
||||
public void checkDeptDataScope(Long deptId);
|
||||
|
||||
/**
|
||||
* 新增保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDept(UDept dept);
|
||||
|
||||
/**
|
||||
* 修改保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDept(UDept dept);
|
||||
|
||||
/**
|
||||
* 删除部门管理信息
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById(Long deptId);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.domain.UDevice;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_AP设备表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
public interface IUDeviceService extends IService<UDevice> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.api.domain.UDictData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典 业务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IUDictDataService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询字典数据
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
public List<UDictData> selectDictDataList(UDictData dictData);
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
public String selectDictLabel(String dictType, String dictValue);
|
||||
|
||||
/**
|
||||
* 根据字典数据ID查询信息
|
||||
*
|
||||
* @param dictCode 字典数据ID
|
||||
* @return 字典数据
|
||||
*/
|
||||
public UDictData selectDictDataById(Long dictCode);
|
||||
|
||||
/**
|
||||
* 批量删除字典数据信息
|
||||
*
|
||||
* @param dictCodes 需要删除的字典数据ID
|
||||
*/
|
||||
public void deleteDictDataByIds(Long[] dictCodes);
|
||||
|
||||
/**
|
||||
* 新增保存字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictData(UDictData dictData);
|
||||
|
||||
/**
|
||||
* 修改保存字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictData(UDictData dictData);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.api.domain.UDictData;
|
||||
import org.wfc.user.api.domain.UDictType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典 业务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IUDictTypeService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询字典类型
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
public List<UDictType> selectDictTypeList(UDictType dictType);
|
||||
|
||||
/**
|
||||
* 根据所有字典类型
|
||||
*
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
public List<UDictType> selectDictTypeAll();
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
public List<UDictData> selectDictDataByType(String dictType);
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
*
|
||||
* @param dictId 字典类型ID
|
||||
* @return 字典类型
|
||||
*/
|
||||
public UDictType selectDictTypeById(Long dictId);
|
||||
|
||||
/**
|
||||
* 根据字典类型查询信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
public UDictType selectDictTypeByType(String dictType);
|
||||
|
||||
/**
|
||||
* 批量删除字典信息
|
||||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
*/
|
||||
public void deleteDictTypeByIds(Long[] dictIds);
|
||||
|
||||
/**
|
||||
* 加载字典缓存数据
|
||||
*/
|
||||
public void loadingDictCache();
|
||||
|
||||
/**
|
||||
* 清空字典缓存数据
|
||||
*/
|
||||
public void clearDictCache();
|
||||
|
||||
/**
|
||||
* 重置字典缓存数据
|
||||
*/
|
||||
public void resetDictCache();
|
||||
|
||||
/**
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictType(UDictType dictType);
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictType(UDictType dictType);
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkDictTypeUnique(UDictType dictType);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.api.domain.ULogininfor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统访问日志情况信息 服务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IULogininforService
|
||||
{
|
||||
/**
|
||||
* 新增系统登录日志
|
||||
*
|
||||
* @param logininfor 访问日志对象
|
||||
*/
|
||||
public int insertLogininfor(ULogininfor logininfor);
|
||||
|
||||
/**
|
||||
* 查询系统登录日志集合
|
||||
*
|
||||
* @param logininfor 访问日志对象
|
||||
* @return 登录记录集合
|
||||
*/
|
||||
public List<ULogininfor> selectLogininforList(ULogininfor logininfor);
|
||||
|
||||
/**
|
||||
* 批量删除系统登录日志
|
||||
*
|
||||
* @param infoIds 需要删除的登录日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteLogininforByIds(Long[] infoIds);
|
||||
|
||||
/**
|
||||
* 清空系统登录日志
|
||||
*/
|
||||
public void cleanLogininfor();
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.domain.UMenu;
|
||||
import org.wfc.user.domain.vo.RouterVo;
|
||||
import org.wfc.user.domain.vo.TreeSelect;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 菜单 业务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IUMenuService
|
||||
{
|
||||
/**
|
||||
* 根据用户查询系统菜单列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<UMenu> selectMenuList(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户查询系统菜单列表
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @param userId 用户ID
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<UMenu> selectMenuList(UMenu menu, Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
public Set<String> selectMenuPermsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询权限
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
public Set<String> selectMenuPermsByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询菜单树信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<UMenu> selectMenuTreeByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询菜单树信息
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 选中菜单列表
|
||||
*/
|
||||
public List<Long> selectMenuListByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 构建前端路由所需要的菜单
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
* @return 路由列表
|
||||
*/
|
||||
public List<RouterVo> buildMenus(List<UMenu> menus);
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
public List<UMenu> buildMenuTree(List<UMenu> menus);
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
public List<TreeSelect> buildMenuTreeSelect(List<UMenu> menus);
|
||||
|
||||
/**
|
||||
* 根据菜单ID查询信息
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 菜单信息
|
||||
*/
|
||||
public UMenu selectMenuById(Long menuId);
|
||||
|
||||
/**
|
||||
* 是否存在菜单子节点
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
public boolean hasChildByMenuId(Long menuId);
|
||||
|
||||
/**
|
||||
* 查询菜单是否存在角色
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
public boolean checkMenuExistRole(Long menuId);
|
||||
|
||||
/**
|
||||
* 新增保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMenu(UMenu menu);
|
||||
|
||||
/**
|
||||
* 修改保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMenu(UMenu menu);
|
||||
|
||||
/**
|
||||
* 删除菜单管理信息
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMenuById(Long menuId);
|
||||
|
||||
/**
|
||||
* 校验菜单名称是否唯一
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkMenuNameUnique(UMenu menu);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.api.domain.UOperLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志 服务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IUOperLogService
|
||||
{
|
||||
/**
|
||||
* 新增操作日志
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertOperlog(UOperLog operLog);
|
||||
|
||||
/**
|
||||
* 查询系统操作日志集合
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
public List<UOperLog> selectOperLogList(UOperLog operLog);
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
*
|
||||
* @param operIds 需要删除的操作日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOperLogByIds(Long[] operIds);
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
*
|
||||
* @param operId 操作ID
|
||||
* @return 操作日志对象
|
||||
*/
|
||||
public UOperLog selectOperLogById(Long operId);
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
*/
|
||||
public void cleanOperLog();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.domain.UOrder;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-订单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
public interface IUOrderService extends IService<UOrder> {
|
||||
|
||||
boolean saveOrder(UOrder order);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.domain.UPackage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-套餐表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
public interface IUPackageService extends IService<UPackage> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.api.domain.UUser;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 权限信息 服务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IUPermissionService
|
||||
{
|
||||
/**
|
||||
* 获取角色数据权限
|
||||
*
|
||||
* @param user 用户
|
||||
* @return 角色权限信息
|
||||
*/
|
||||
public Set<String> getRolePermission(UUser user);
|
||||
|
||||
/**
|
||||
* 获取菜单数据权限
|
||||
*
|
||||
* @param user 用户Id
|
||||
* @return 菜单权限信息
|
||||
*/
|
||||
public Set<String> getMenuPermission(UUser user);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.domain.UPost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息 服务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IUPostService
|
||||
{
|
||||
/**
|
||||
* 查询岗位信息集合
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 岗位列表
|
||||
*/
|
||||
public List<UPost> selectPostList(UPost post);
|
||||
|
||||
/**
|
||||
* 查询所有岗位
|
||||
*
|
||||
* @return 岗位列表
|
||||
*/
|
||||
public List<UPost> selectPostAll();
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位信息
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
public UPost selectPostById(Long postId);
|
||||
|
||||
/**
|
||||
* 根据用户ID获取岗位选择框列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 选中岗位ID列表
|
||||
*/
|
||||
public List<Long> selectPostListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 校验岗位名称
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkPostNameUnique(UPost post);
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkPostCodeUnique(UPost post);
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位使用数量
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int countUserPostById(Long postId);
|
||||
|
||||
/**
|
||||
* 删除岗位信息
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePostById(Long postId);
|
||||
|
||||
/**
|
||||
* 批量删除岗位信息
|
||||
*
|
||||
* @param postIds 需要删除的岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePostByIds(Long[] postIds);
|
||||
|
||||
/**
|
||||
* 新增保存岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPost(UPost post);
|
||||
|
||||
/**
|
||||
* 修改保存岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePost(UPost post);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.domain.URateLimit;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-带宽限速表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
public interface IURateLimitService extends IService<URateLimit> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
|
||||
|
||||
import org.wfc.user.api.domain.URole;
|
||||
import org.wfc.user.domain.UUserRole;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色业务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IURoleService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询角色数据
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 角色数据集合信息
|
||||
*/
|
||||
public List<URole> selectRoleList(URole role);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 角色列表
|
||||
*/
|
||||
public List<URole> selectRolesByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色权限
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
public Set<String> selectRolePermissionByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
public List<URole> selectRoleAll();
|
||||
|
||||
/**
|
||||
* 根据用户ID获取角色选择框列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 选中角色ID列表
|
||||
*/
|
||||
public List<Long> selectRoleListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
public URole selectRoleById(Long roleId);
|
||||
|
||||
/**
|
||||
* 校验角色名称是否唯一
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkRoleNameUnique(URole role);
|
||||
|
||||
/**
|
||||
* 校验角色权限是否唯一
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkRoleKeyUnique(URole role);
|
||||
|
||||
/**
|
||||
* 校验角色是否允许操作
|
||||
*
|
||||
* @param role 角色信息
|
||||
*/
|
||||
public void checkRoleAllowed(URole role);
|
||||
|
||||
/**
|
||||
* 校验角色是否有数据权限
|
||||
*
|
||||
* @param roleIds 角色id
|
||||
*/
|
||||
public void checkRoleDataScope(Long... roleIds);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int countUserRoleByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 新增保存角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRole(URole role);
|
||||
|
||||
/**
|
||||
* 修改保存角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRole(URole role);
|
||||
|
||||
/**
|
||||
* 修改角色状态
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRoleStatus(URole role);
|
||||
|
||||
/**
|
||||
* 修改数据权限信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int authDataScope(URole role);
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleById(Long roleId);
|
||||
|
||||
/**
|
||||
* 批量删除角色信息
|
||||
*
|
||||
* @param roleIds 需要删除的角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleByIds(Long[] roleIds);
|
||||
|
||||
/**
|
||||
* 取消授权用户角色
|
||||
*
|
||||
* @param userRole 用户和角色关联信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAuthUser(UUserRole userRole);
|
||||
|
||||
/**
|
||||
* 批量取消授权用户角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要取消授权的用户数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAuthUsers(Long roleId, Long[] userIds);
|
||||
|
||||
/**
|
||||
* 批量选择授权用户角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要删除的用户数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAuthUsers(Long roleId, Long[] userIds);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.common.core.domain.LoginUser;
|
||||
import org.wfc.user.domain.UUserOnline;
|
||||
|
||||
/**
|
||||
* 在线用户 服务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IUUserOnlineService
|
||||
{
|
||||
/**
|
||||
* 通过登录地址查询信息
|
||||
*
|
||||
* @param ipaddr 登录地址
|
||||
* @param user 用户信息
|
||||
* @return 在线用户信息
|
||||
*/
|
||||
public UUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user);
|
||||
|
||||
/**
|
||||
* 通过用户名称查询信息
|
||||
*
|
||||
* @param userName 用户名称
|
||||
* @param user 用户信息
|
||||
* @return 在线用户信息
|
||||
*/
|
||||
public UUserOnline selectOnlineByUserName(String userName, LoginUser user);
|
||||
|
||||
/**
|
||||
* 通过登录地址/用户名称查询信息
|
||||
*
|
||||
* @param ipaddr 登录地址
|
||||
* @param userName 用户名称
|
||||
* @param user 用户信息
|
||||
* @return 在线用户信息
|
||||
*/
|
||||
public UUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user);
|
||||
|
||||
/**
|
||||
* 设置在线用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 在线用户
|
||||
*/
|
||||
public UUserOnline loginUserToUserOnline(LoginUser user);
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.api.domain.UUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户 业务层
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
public interface IUUserService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<UUser> selectUserList(UUser user);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<UUser> selectAllocatedList(UUser user);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<UUser> selectUnallocatedList(UUser user);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public UUser selectUserByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public UUser selectUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户所属角色组
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
public String selectUserRoleGroup(String userName);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户所属岗位组
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
public String selectUserPostGroup(String userName);
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkUserNameUnique(UUser user);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkPhoneUnique(UUser user);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkEmailUnique(UUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
*
|
||||
* @param user 用户信息
|
||||
*/
|
||||
public void checkUserAllowed(UUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否有数据权限
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public void checkUserDataScope(Long userId);
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUser(UUser user);
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean registerUser(UUser user);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUser(UUser user);
|
||||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色组
|
||||
*/
|
||||
public void insertUserAuth(Long userId, Long[] roleIds);
|
||||
|
||||
/**
|
||||
* 修改用户状态
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserStatus(UUser user);
|
||||
|
||||
/**
|
||||
* 修改用户基本信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean updateUserProfile(UUser user);
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean updateUserAvatar(String userName, String avatar);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int resetPwd(UUser user);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
*/
|
||||
public int resetUserPwd(String userName, String password);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserByIds(Long[] userIds);
|
||||
|
||||
/**
|
||||
* 导入用户数据
|
||||
*
|
||||
* @param userList 用户数据列表
|
||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||
* @param operName 操作用户
|
||||
* @return 结果
|
||||
*/
|
||||
public String importUser(List<UUser> userList, Boolean isUpdateSupport, String operName);
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package org.wfc.user.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.wfc.common.core.domain.LoginUser;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.omada.api.client.OmadaClientApi;
|
||||
import org.wfc.omada.api.client.model.ClientRateLimitSetting;
|
||||
import org.wfc.omada.api.client.model.CustomRateLimitEntity;
|
||||
import org.wfc.omada.api.hotspot.OmadaAuthorizedClientApi;
|
||||
import org.wfc.user.api.domain.bo.UClientBo;
|
||||
import org.wfc.user.domain.UAccount;
|
||||
import org.wfc.user.domain.UClient;
|
||||
import org.wfc.user.domain.vo.UAccountDashboardVo;
|
||||
import org.wfc.user.domain.vo.UCdrUserVo;
|
||||
import org.wfc.user.mapper.UAccountMapper;
|
||||
import org.wfc.user.mapper.UCdrMapper;
|
||||
import org.wfc.user.mapper.UClientMapper;
|
||||
import org.wfc.user.service.IUAccountService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-账户表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-23
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> implements IUAccountService {
|
||||
|
||||
@Autowired
|
||||
private UCdrMapper ucdrMapper;
|
||||
|
||||
@Autowired
|
||||
private OmadaAuthorizedClientApi omadaAuthorizedClientApi;
|
||||
|
||||
@Autowired
|
||||
private UClientMapper clientMapper;
|
||||
|
||||
@Autowired
|
||||
private OmadaClientApi omadaClientApi;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void statAndCancelAuthUser() {
|
||||
// 定时任务查询所有未过期或刚过期(失效时间+定时任务间隔时间)的账户套餐,套餐过期/流量用完/时长用完则取消授权
|
||||
Date current = new Date();
|
||||
DateTime endTime = DateUtil.offsetSecond(current, -30);
|
||||
List<UAccount> accounts = this.list(Wrappers.<UAccount>lambdaQuery().gt(UAccount::getEndTime, endTime).isNotNull(UAccount::getUserId));
|
||||
// 更新账户已使用流量,已使用时长
|
||||
for (UAccount account : accounts) {
|
||||
if (ObjectUtil.isNull(account.getUserId())) {
|
||||
continue;
|
||||
}
|
||||
List<UCdrUserVo> statCdr = ucdrMapper.getByUser(account.getUserId(), account.getStartTime().getTime(), account.getEndTime().getTime());
|
||||
statCdr.stream().findFirst().ifPresent(stat -> {
|
||||
account.setTrafficUsed(stat.getTrafficUp() + stat.getTrafficDown());
|
||||
account.setDurationUsed(stat.getDuration());
|
||||
});
|
||||
}
|
||||
this.updateBatchById(accounts);
|
||||
|
||||
// 过期/流量已用完/时长已用完应取消授权
|
||||
List<Long> userIds = accounts.stream().filter(account -> (account.getEndTime().before(endTime) && account.getEndTime().after(current))
|
||||
|| (account.getTrafficEnable() && account.getTrafficUsed() > account.getTraffic())
|
||||
|| (account.getDurationEnable() && account.getDurationUsed() > account.getDuration()))
|
||||
.map(UAccount::getUserId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isNotEmpty(userIds)) {
|
||||
List<UClient> clients = clientMapper.selectList(Wrappers.<UClient>lambdaQuery().isNotNull(UClient::getSiteId)
|
||||
.in(UClient::getUserId, userIds));
|
||||
for (UClient client : clients) {
|
||||
try {
|
||||
omadaAuthorizedClientApi.cancelAuthClient(client.getSiteId(), client.getClientMac());
|
||||
|
||||
// 取消带宽限速
|
||||
ClientRateLimitSetting clientRateLimitSetting = new ClientRateLimitSetting();
|
||||
clientRateLimitSetting.setMode(0);
|
||||
CustomRateLimitEntity customRateLimitEntity = new CustomRateLimitEntity();
|
||||
customRateLimitEntity.setDownEnable(false);
|
||||
customRateLimitEntity.setUpEnable(false);
|
||||
clientRateLimitSetting.setCustomRateLimit(customRateLimitEntity);
|
||||
omadaClientApi.updateClientRateLimitSetting(client.getSiteId(), client.getClientMac(), clientRateLimitSetting);
|
||||
} catch (Exception e) {
|
||||
log.info("unAuth error: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void authClientAndRateLimit(UClientBo client) {
|
||||
UAccount account = this.getOne(Wrappers.<UAccount>lambdaQuery().eq(UAccount::getUserId, client.getUserId()), false);
|
||||
if (ObjectUtil.isNull(account)) {
|
||||
return;
|
||||
}
|
||||
Date current = new Date();
|
||||
if (account.getStartTime().before(current) && account.getEndTime().after(current)
|
||||
&& (!account.getTrafficEnable() || account.getTrafficUsed() <= account.getTraffic())
|
||||
&& (!account.getDurationEnable() || account.getDurationUsed() <= account.getDuration())) {
|
||||
omadaAuthorizedClientApi.authClient(client.getSiteId(), client.getClientMac());
|
||||
|
||||
// 带宽限速
|
||||
if (account.getRateLimitEnable()) {
|
||||
ClientRateLimitSetting clientRateLimitSetting = new ClientRateLimitSetting();
|
||||
clientRateLimitSetting.setMode(0);
|
||||
CustomRateLimitEntity customRateLimitEntity = new CustomRateLimitEntity();
|
||||
customRateLimitEntity.setDownEnable(account.getDownLimitEnable());
|
||||
customRateLimitEntity.setDownLimit(account.getDownLimit() == null ? 0 : account.getDownLimit().intValue());
|
||||
customRateLimitEntity.setDownUnit(1);
|
||||
customRateLimitEntity.setUpEnable(account.getUpLimitEnable());
|
||||
customRateLimitEntity.setUpLimit(account.getUpLimit() == null ? 0 : account.getUpLimit().intValue());
|
||||
customRateLimitEntity.setUpUnit(1);
|
||||
clientRateLimitSetting.setCustomRateLimit(customRateLimitEntity);
|
||||
omadaClientApi.updateClientRateLimitSetting(client.getSiteId(), client.getClientMac(), clientRateLimitSetting);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UAccountDashboardVo getByUser() {
|
||||
LoginUser<Object> loginUser = SecurityUtils.getLoginUser();
|
||||
UAccount account = this.getOne(Wrappers.<UAccount>lambdaQuery().eq(UAccount::getUserId, loginUser.getUserid()), false);
|
||||
UAccountDashboardVo dashboardVo = new UAccountDashboardVo();
|
||||
if (ObjectUtil.isNull(account)) {
|
||||
dashboardVo.setId(loginUser.getUserid());
|
||||
dashboardVo.setBalance(BigDecimal.ZERO);
|
||||
dashboardVo.setTraffic(0L);
|
||||
dashboardVo.setDuration(0L);
|
||||
dashboardVo.setTrafficUsed(0L);
|
||||
dashboardVo.setDurationUsed(0L);
|
||||
dashboardVo.setClientNum(0);
|
||||
dashboardVo.setClientNumUsed(0);
|
||||
dashboardVo.setActivity(0L);
|
||||
} else {
|
||||
BeanUtils.copyProperties(account, dashboardVo);
|
||||
dashboardVo.setId(loginUser.getUserid());
|
||||
dashboardVo.setActivity(0L);
|
||||
}
|
||||
return dashboardVo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.wfc.user.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.wfc.user.domain.UCdrHistory;
|
||||
import org.wfc.user.mapper.UCdrHistoryMapper;
|
||||
import org.wfc.user.service.IUCdrHistoryService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_话单明细表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-12
|
||||
*/
|
||||
@Service
|
||||
public class UCdrHistoryServiceImpl extends ServiceImpl<UCdrHistoryMapper, UCdrHistory> implements IUCdrHistoryService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
package org.wfc.user.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.wfc.common.core.domain.LoginUser;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.omada.api.client.OmadaClientApi;
|
||||
import org.wfc.omada.api.client.OmadaClientInsightApi;
|
||||
import org.wfc.omada.api.client.model.ClientHistoryInfo;
|
||||
import org.wfc.omada.api.client.model.ClientInfo;
|
||||
import org.wfc.omada.api.client.model.OperationResponseClientGridVoClientInfo;
|
||||
import org.wfc.omada.api.client.model.OperationResponseGridVoClientHistoryInfo;
|
||||
import org.wfc.omada.api.device.OmadaDeviceApi;
|
||||
import org.wfc.omada.api.device.model.DeviceInfo;
|
||||
import org.wfc.omada.api.device.model.OperationResponseGridVoDeviceInfo;
|
||||
import org.wfc.omada.api.organization.OmadaSiteApi;
|
||||
import org.wfc.omada.api.organization.model.OperationResponseGridVoSiteSummaryInfo;
|
||||
import org.wfc.omada.api.organization.model.SiteSummaryInfo;
|
||||
import org.wfc.user.domain.UCdr;
|
||||
import org.wfc.user.domain.UCdrHistory;
|
||||
import org.wfc.user.domain.UClient;
|
||||
import org.wfc.user.domain.UDevice;
|
||||
import org.wfc.user.domain.bo.UCdrClientBo;
|
||||
import org.wfc.user.domain.vo.UCdrClientVo;
|
||||
import org.wfc.user.domain.vo.UCdrHistoryUserVo;
|
||||
import org.wfc.user.domain.vo.UCdrUserVo;
|
||||
import org.wfc.user.mapper.UCdrMapper;
|
||||
import org.wfc.user.service.IUAccountService;
|
||||
import org.wfc.user.service.IUCdrHistoryService;
|
||||
import org.wfc.user.service.IUCdrService;
|
||||
import org.wfc.user.service.IUClientService;
|
||||
import org.wfc.user.service.IUDeviceService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户话单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@Service
|
||||
public class UCdrServiceImpl extends ServiceImpl<UCdrMapper, UCdr> implements IUCdrService {
|
||||
|
||||
@Autowired
|
||||
private OmadaSiteApi omadaSiteApi;
|
||||
|
||||
@Autowired
|
||||
private OmadaDeviceApi omadaDeviceApi;
|
||||
|
||||
@Autowired
|
||||
private OmadaClientApi omadaClientApi;
|
||||
|
||||
@Autowired
|
||||
private OmadaClientInsightApi omadaClientInsightApi;
|
||||
|
||||
@Autowired
|
||||
private IUDeviceService deviceService;
|
||||
|
||||
@Autowired
|
||||
private IUClientService clientService;
|
||||
|
||||
@Autowired
|
||||
private IUCdrHistoryService cdrHistoryService;
|
||||
|
||||
@Autowired
|
||||
private IUAccountService accountService;
|
||||
|
||||
@Override
|
||||
public UCdrUserVo getByUser() {
|
||||
LoginUser<Object> loginUser = SecurityUtils.getLoginUser();
|
||||
List<UCdrUserVo> cdrUsers = this.baseMapper.getByUser(loginUser.getUserid(), null, null);
|
||||
return cdrUsers.stream().findFirst().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UCdrClientVo> getByClient(UCdrClientBo client) {
|
||||
return this.baseMapper.getByClient(client);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UCdrHistoryUserVo> getHistoryByUser() {
|
||||
LoginUser<Object> loginUser = SecurityUtils.getLoginUser();
|
||||
return this.baseMapper.getHistoryByUser(loginUser.getUserid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCdrInfoByOmadaApi() {
|
||||
ResponseEntity<OperationResponseGridVoSiteSummaryInfo> siteResp = omadaSiteApi.getSiteList(1, 1000);
|
||||
if (ObjectUtil.isNull(siteResp.getBody())) {
|
||||
return;
|
||||
}
|
||||
List<SiteSummaryInfo> sites = siteResp.getBody().getResult().getData();
|
||||
List<UClient> allClients = clientService.list(Wrappers.<UClient>lambdaQuery().isNotNull(UClient::getUserId));
|
||||
// 添加AP设备
|
||||
addDevices(sites);
|
||||
for (SiteSummaryInfo site : sites) {
|
||||
ResponseEntity<OperationResponseClientGridVoClientInfo> clientResp = omadaClientApi.getGridActiveClients(site.getSiteId(), 1, 1000);
|
||||
if (ObjectUtil.isNull(clientResp.getBody())) {
|
||||
continue;
|
||||
}
|
||||
List<ClientInfo> clients = clientResp.getBody().getResult().getData();
|
||||
for (ClientInfo client : clients) {
|
||||
// 添加用户设备
|
||||
UClient hasClient = addClient(client);
|
||||
// 添加话单
|
||||
addCdr(client, hasClient);
|
||||
}
|
||||
for (UClient client : allClients) {
|
||||
UCdr uCdr = this.getOne(Wrappers.<UCdr>lambdaQuery().eq(UCdr::getUserId, client.getUserId())
|
||||
.eq(UCdr::getClientId, client.getId()), false);
|
||||
if (ObjectUtil.isNotNull(uCdr)) {
|
||||
addCdrHistory(site, client.getClientMac(), uCdr.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
accountService.statAndCancelAuthUser();
|
||||
}
|
||||
|
||||
private void addCdrHistory(SiteSummaryInfo site, String mac, Long cdrId) {
|
||||
// 话单历史
|
||||
ResponseEntity<OperationResponseGridVoClientHistoryInfo> pastConnResp = omadaClientInsightApi.getGridPastConnections(site.getSiteId(), 1, 1000, mac);
|
||||
if (ObjectUtil.isNull(pastConnResp.getBody())) {
|
||||
return;
|
||||
}
|
||||
List<ClientHistoryInfo> pastConns = pastConnResp.getBody().getResult().getData();
|
||||
for (ClientHistoryInfo pastConn : pastConns) {
|
||||
UCdrHistory hasCdrHistory = cdrHistoryService.getOne(Wrappers.<UCdrHistory>lambdaQuery().eq(UCdrHistory::getCdrId, cdrId).eq(UCdrHistory::getStartTime, pastConn.getFirstSeen()), false);
|
||||
if (ObjectUtil.isNotNull(hasCdrHistory)) {
|
||||
continue;
|
||||
}
|
||||
UCdrHistory uCdrHistory = UCdrHistory.builder().cdrId(cdrId).startTime(pastConn.getFirstSeen())
|
||||
.endTime(pastConn.getLastSeen())
|
||||
.trafficUp(pastConn.getUpload())
|
||||
.trafficDown(pastConn.getDownload())
|
||||
.duration(pastConn.getDuration())
|
||||
.build();
|
||||
cdrHistoryService.save(uCdrHistory);
|
||||
}
|
||||
}
|
||||
|
||||
private Long addCdr(ClientInfo client, UClient hasClient) {
|
||||
// 话单
|
||||
UCdr hasUCdr = this.getOne(Wrappers.<UCdr>lambdaQuery()
|
||||
.eq(ObjectUtil.isNotNull(hasClient.getUserId()), UCdr::getUserId, hasClient.getUserId())
|
||||
.eq(UCdr::getClientId, hasClient.getId()), false);
|
||||
Long cdrId = null;
|
||||
if (ObjectUtil.isNotNull(hasUCdr)) {
|
||||
cdrId = hasUCdr.getId();
|
||||
}
|
||||
UDevice hasDevice = deviceService.getOne(Wrappers.<UDevice>lambdaQuery().eq(UDevice::getDeviceMac, client.getApMac()), false);
|
||||
UCdr uCdr = UCdr.builder().clientId(hasClient.getId())
|
||||
.userId(hasClient.getUserId())
|
||||
.deviceId(hasDevice.getId())
|
||||
.ssid(client.getSsid())
|
||||
.rxRate(client.getRxRate())
|
||||
.txRate(client.getTxRate())
|
||||
.lastSeenTime(client.getLastSeen())
|
||||
.upTime(client.getUptime())
|
||||
.upPacket(client.getUpPacket())
|
||||
.downPacket(client.getDownPacket())
|
||||
.trafficDown(client.getTrafficDown())
|
||||
.trafficUp(client.getTrafficUp())
|
||||
.activity(client.getActivity())
|
||||
.build();
|
||||
uCdr.setId(cdrId);
|
||||
this.saveOrUpdate(uCdr);
|
||||
return uCdr.getId();
|
||||
}
|
||||
|
||||
private UClient addClient(ClientInfo client) {
|
||||
// 用户设备
|
||||
UClient hasClient = clientService.getOne(Wrappers.<UClient>lambdaQuery().eq(UClient::getClientMac, client.getMac()), false);
|
||||
Long clientId = null;
|
||||
Long userId = null;
|
||||
if (ObjectUtil.isNotNull(hasClient)) {
|
||||
clientId = hasClient.getId();
|
||||
userId = hasClient.getUserId();
|
||||
}
|
||||
UClient uClient = UClient.builder().clientMac(client.getMac())
|
||||
.userId(userId)
|
||||
.clientName(client.getName())
|
||||
.clientDeviceType(client.getDeviceType())
|
||||
.build();
|
||||
uClient.setId(clientId);
|
||||
clientService.saveOrUpdate(uClient);
|
||||
return uClient;
|
||||
}
|
||||
|
||||
private void addDevices(List<SiteSummaryInfo> sites) {
|
||||
// ap设备
|
||||
for (SiteSummaryInfo site : sites) {
|
||||
ResponseEntity<OperationResponseGridVoDeviceInfo> deviceResp = omadaDeviceApi.getDeviceList(site.getSiteId(), 1, 1000);
|
||||
if (ObjectUtil.isNull(deviceResp.getBody())) {
|
||||
return;
|
||||
}
|
||||
List<DeviceInfo> devices = deviceResp.getBody().getResult().getData();
|
||||
for (DeviceInfo device : devices) {
|
||||
UDevice hasUDevice = deviceService.getOne(Wrappers.<UDevice>lambdaQuery().eq(UDevice::getDeviceMac, device.getMac()), false);
|
||||
if (ObjectUtil.isNotNull(hasUDevice)) {
|
||||
continue;
|
||||
}
|
||||
UDevice uDevice = UDevice.builder().deviceIp(device.getIp())
|
||||
.deviceMac(device.getMac())
|
||||
.deviceName(device.getName())
|
||||
.deviceModel(device.getModel())
|
||||
.build();
|
||||
deviceService.save(uDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.wfc.user.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.wfc.common.core.domain.LoginUser;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.api.domain.bo.UClientBo;
|
||||
import org.wfc.user.domain.UClient;
|
||||
import org.wfc.user.domain.vo.UClientCurrentVo;
|
||||
import org.wfc.user.domain.vo.UClientHistoryUserVo;
|
||||
import org.wfc.user.mapper.UClientMapper;
|
||||
import org.wfc.user.service.IUAccountService;
|
||||
import org.wfc.user.service.IUClientService;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户设备表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author cyc
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@Service
|
||||
public class UClientServiceImpl extends ServiceImpl<UClientMapper, UClient> implements IUClientService {
|
||||
|
||||
@Autowired
|
||||
private IUAccountService accountService;
|
||||
|
||||
@Override
|
||||
public boolean recordClientUser(UClientBo uClientBo) {
|
||||
if (StrUtil.isBlank(uClientBo.getClientMac())) {
|
||||
return false;
|
||||
}
|
||||
UClient hasUClient = this.getOne(Wrappers.<UClient>lambdaQuery()
|
||||
.eq(UClient::getClientMac, uClientBo.getClientMac()), false);
|
||||
UClient uClient = new UClient();
|
||||
BeanUtils.copyProperties(uClientBo, uClient);
|
||||
if (hasUClient != null) {
|
||||
uClient.setId(hasUClient.getId());
|
||||
}
|
||||
boolean flag = this.saveOrUpdate(uClient);
|
||||
// 登录时如果当前用户有可用套餐和余额授权当前设备访问wifi,且根据套餐限制带宽
|
||||
accountService.authClientAndRateLimit(uClientBo);
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UClientCurrentVo> getCurrentClients() {
|
||||
LoginUser<Object> loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return this.baseMapper.getCurrentClients(loginUser.getUserid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UClientHistoryUserVo> getHistoryByUser() {
|
||||
LoginUser<Object> loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return this.baseMapper.getHistoryByUser(loginUser.getUserid());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
package org.wfc.user.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.wfc.common.core.constant.CacheConstants;
|
||||
import org.wfc.common.core.constant.UserConstants;
|
||||
import org.wfc.common.core.exception.ServiceException;
|
||||
import org.wfc.common.core.text.Convert;
|
||||
import org.wfc.common.core.utils.StringUtils;
|
||||
import org.wfc.common.redis.service.RedisService;
|
||||
import org.wfc.user.domain.UConfig;
|
||||
import org.wfc.user.mapper.UConfigMapper;
|
||||
import org.wfc.user.service.IUConfigService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 服务层实现
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@Service
|
||||
public class UConfigServiceImpl implements IUConfigService
|
||||
{
|
||||
@Autowired
|
||||
private UConfigMapper configMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化参数到缓存
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init()
|
||||
{
|
||||
loadingConfigCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参数配置信息
|
||||
*
|
||||
* @param configId 参数配置ID
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
@Override
|
||||
public UConfig selectConfigById(Long configId)
|
||||
{
|
||||
UConfig config = new UConfig();
|
||||
config.setConfigId(configId);
|
||||
return configMapper.selectConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
*
|
||||
* @param configKey 参数key
|
||||
* @return 参数键值
|
||||
*/
|
||||
@Override
|
||||
public String selectConfigByKey(String configKey)
|
||||
{
|
||||
String configValue = Convert.toStr(redisService.getCacheObject(getCacheKey(configKey)));
|
||||
if (StringUtils.isNotEmpty(configValue))
|
||||
{
|
||||
return configValue;
|
||||
}
|
||||
UConfig config = new UConfig();
|
||||
config.setConfigKey(configKey);
|
||||
UConfig retConfig = configMapper.selectConfig(config);
|
||||
if (StringUtils.isNotNull(retConfig))
|
||||
{
|
||||
redisService.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
|
||||
return retConfig.getConfigValue();
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 参数配置集合
|
||||
*/
|
||||
@Override
|
||||
public List<UConfig> selectConfigList(UConfig config)
|
||||
{
|
||||
return configMapper.selectConfigList(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertConfig(UConfig config)
|
||||
{
|
||||
int row = configMapper.insertConfig(config);
|
||||
if (row > 0)
|
||||
{
|
||||
redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateConfig(UConfig config)
|
||||
{
|
||||
UConfig temp = configMapper.selectConfigById(config.getConfigId());
|
||||
if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
|
||||
{
|
||||
redisService.deleteObject(getCacheKey(temp.getConfigKey()));
|
||||
}
|
||||
|
||||
int row = configMapper.updateConfig(config);
|
||||
if (row > 0)
|
||||
{
|
||||
redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除参数信息
|
||||
*
|
||||
* @param configIds 需要删除的参数ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteConfigByIds(Long[] configIds)
|
||||
{
|
||||
for (Long configId : configIds)
|
||||
{
|
||||
UConfig config = selectConfigById(configId);
|
||||
if (StringUtils.equals(UserConstants.YES, config.getConfigType()))
|
||||
{
|
||||
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
|
||||
}
|
||||
configMapper.deleteConfigById(configId);
|
||||
redisService.deleteObject(getCacheKey(config.getConfigKey()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载参数缓存数据
|
||||
*/
|
||||
@Override
|
||||
public void loadingConfigCache()
|
||||
{
|
||||
List<UConfig> configsList = configMapper.selectConfigList(new UConfig());
|
||||
for (UConfig config : configsList)
|
||||
{
|
||||
redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空参数缓存数据
|
||||
*/
|
||||
@Override
|
||||
public void clearConfigCache()
|
||||
{
|
||||
Collection<String> keys = redisService.keys(CacheConstants.SYS_CONFIG_KEY + "*");
|
||||
redisService.deleteObject(keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置参数缓存数据
|
||||
*/
|
||||
@Override
|
||||
public void resetConfigCache()
|
||||
{
|
||||
clearConfigCache();
|
||||
loadingConfigCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数键名是否唯一
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkConfigKeyUnique(UConfig config)
|
||||
{
|
||||
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
||||
UConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
|
||||
if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置cache key
|
||||
*
|
||||
* @param configKey 参数键
|
||||
* @return 缓存键key
|
||||
*/
|
||||
private String getCacheKey(String configKey)
|
||||
{
|
||||
return CacheConstants.SYS_CONFIG_KEY + configKey;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
package org.wfc.user.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.wfc.common.core.constant.UserConstants;
|
||||
import org.wfc.common.core.exception.ServiceException;
|
||||
import org.wfc.common.core.text.Convert;
|
||||
import org.wfc.common.core.utils.SpringUtils;
|
||||
import org.wfc.common.core.utils.StringUtils;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.api.domain.UDept;
|
||||
import org.wfc.user.api.domain.URole;
|
||||
import org.wfc.user.api.domain.UUser;
|
||||
import org.wfc.user.domain.vo.TreeSelect;
|
||||
import org.wfc.user.mapper.UDeptMapper;
|
||||
import org.wfc.user.mapper.URoleMapper;
|
||||
import org.wfc.user.service.IUDeptService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 部门管理 服务实现
|
||||
*
|
||||
* @author wfc
|
||||
*/
|
||||
@Service
|
||||
public class UDeptServiceImpl implements IUDeptService
|
||||
{
|
||||
@Autowired
|
||||
private UDeptMapper deptMapper;
|
||||
|
||||
@Autowired
|
||||
private URoleMapper roleMapper;
|
||||
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<UDept> selectDeptList(UDept dept)
|
||||
{
|
||||
return deptMapper.selectDeptList(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门树结构信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门树信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<TreeSelect> selectDeptTreeList(UDept dept)
|
||||
{
|
||||
List<UDept> depts = deptMapper.selectDeptList(dept);
|
||||
return buildDeptTreeSelect(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<UDept> buildDeptTree(List<UDept> depts)
|
||||
{
|
||||
List<UDept> returnList = new ArrayList<UDept>();
|
||||
List<Long> tempList = depts.stream().map(UDept::getDeptId).collect(Collectors.toList());
|
||||
for (UDept dept : depts)
|
||||
{
|
||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||
if (!tempList.contains(dept.getParentId()))
|
||||
{
|
||||
recursionFn(depts, dept);
|
||||
returnList.add(dept);
|
||||
}
|
||||
}
|
||||
if (returnList.isEmpty())
|
||||
{
|
||||
returnList = depts;
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<TreeSelect> buildDeptTreeSelect(List<UDept> depts)
|
||||
{
|
||||
List<UDept> deptTrees = buildDeptTree(depts);
|
||||
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色ID查询部门树信息
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 选中部门列表
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectDeptListByRoleId(Long roleId)
|
||||
{
|
||||
URole role = roleMapper.selectRoleById(roleId);
|
||||
return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 部门信息
|
||||
*/
|
||||
@Override
|
||||
public UDept selectDeptById(Long deptId)
|
||||
{
|
||||
return deptMapper.selectDeptById(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询所有子部门(正常状态)
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 子部门数
|
||||
*/
|
||||
@Override
|
||||
public int selectNormalChildrenDeptById(Long deptId)
|
||||
{
|
||||
return deptMapper.selectNormalChildrenDeptById(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否存在子节点
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildByDeptId(Long deptId)
|
||||
{
|
||||
int result = deptMapper.hasChildByDeptId(deptId);
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门是否存在用户
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
@Override
|
||||
public boolean checkDeptExistUser(Long deptId)
|
||||
{
|
||||
int result = deptMapper.checkDeptExistUser(deptId);
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkDeptNameUnique(UDept dept)
|
||||
{
|
||||
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
||||
UDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
|
||||
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验部门是否有数据权限
|
||||
*
|
||||
* @param deptId 部门id
|
||||
*/
|
||||
@Override
|
||||
public void checkDeptDataScope(Long deptId)
|
||||
{
|
||||
if (!UUser.isAdmin(SecurityUtils.getUserId()) && StringUtils.isNotNull(deptId))
|
||||
{
|
||||
UDept dept = new UDept();
|
||||
dept.setDeptId(deptId);
|
||||
List<UDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
||||
if (StringUtils.isEmpty(depts))
|
||||
{
|
||||
throw new ServiceException("没有权限访问部门数据!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDept(UDept dept)
|
||||
{
|
||||
UDept info = deptMapper.selectDeptById(dept.getParentId());
|
||||
// 如果父节点不为正常状态,则不允许新增子节点
|
||||
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
|
||||
{
|
||||
throw new ServiceException("部门停用,不允许新增");
|
||||
}
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
return deptMapper.insertDept(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDept(UDept dept)
|
||||
{
|
||||
UDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
|
||||
UDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
|
||||
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
|
||||
{
|
||||
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
|
||||
String oldAncestors = oldDept.getAncestors();
|
||||
dept.setAncestors(newAncestors);
|
||||
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
|
||||
}
|
||||
int result = deptMapper.updateDept(dept);
|
||||
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
|
||||
&& !StringUtils.equals("0", dept.getAncestors()))
|
||||
{
|
||||
// 如果该部门是启用状态,则启用该部门的所有上级部门
|
||||
updateParentDeptStatusNormal(dept);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改该部门的父级部门状态
|
||||
*
|
||||
* @param dept 当前部门
|
||||
*/
|
||||
private void updateParentDeptStatusNormal(UDept dept)
|
||||
{
|
||||
String ancestors = dept.getAncestors();
|
||||
Long[] deptIds = Convert.toLongArray(ancestors);
|
||||
deptMapper.updateDeptStatusNormal(deptIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
* @param deptId 被修改的部门ID
|
||||
* @param newAncestors 新的父ID集合
|
||||
* @param oldAncestors 旧的父ID集合
|
||||
*/
|
||||
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors)
|
||||
{
|
||||
List<UDept> children = deptMapper.selectChildrenDeptById(deptId);
|
||||
for (UDept child : children)
|
||||
{
|
||||
child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
|
||||
}
|
||||
if (children.size() > 0)
|
||||
{
|
||||
deptMapper.updateDeptChildren(children);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门管理信息
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeptById(Long deptId)
|
||||
{
|
||||
return deptMapper.deleteDeptById(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
private void recursionFn(List<UDept> list, UDept t)
|
||||
{
|
||||
// 得到子节点列表
|
||||
List<UDept> childList = getChildList(list, t);
|
||||
t.setChildren(childList);
|
||||
for (UDept tChild : childList)
|
||||
{
|
||||
if (hasChild(list, tChild))
|
||||
{
|
||||
recursionFn(list, tChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到子节点列表
|
||||
*/
|
||||
private List<UDept> getChildList(List<UDept> list, UDept t)
|
||||
{
|
||||
List<UDept> tlist = new ArrayList<UDept>();
|
||||
Iterator<UDept> it = list.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
UDept n = (UDept) it.next();
|
||||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue())
|
||||
{
|
||||
tlist.add(n);
|
||||
}
|
||||
}
|
||||
return tlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有子节点
|
||||
*/
|
||||
private boolean hasChild(List<UDept> list, UDept t)
|
||||
{
|
||||
return getChildList(list, t).size() > 0 ? true : false;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user