添加了用户权限,修改了用户查询的代码

This commit is contained in:
2025-06-30 09:43:01 +08:00
parent 869fd1a8b1
commit 656bee3ad1
8 changed files with 26 additions and 126 deletions

View File

@ -68,12 +68,6 @@ public class ProjectCommissionController {
@Resource
private UserInfoService userInfoService;
@Resource
private UserMainInfoService userMainInfoService;
/**
* 小程序用户查看查询项目的抽佣情况

View File

@ -15,6 +15,7 @@ import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailAddRequest
import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailUpdateRequest;
import com.greenorange.promotion.model.dto.subUserProjectCommission.SubUserProjectCommissionAddRequest;
import com.greenorange.promotion.model.entity.*;
import com.greenorange.promotion.model.enums.UserRoleEnum;
import com.greenorange.promotion.model.vo.projectDetail.ProjectDetailVO;
import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.project.ProjectCommissionService;
@ -92,7 +93,9 @@ public class ProjectDetailController {
projectService.updateById(project);
// 获取所有的小程序用户
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE, userInfoService);
LambdaQueryWrapper<UserInfo> miniUserInfoQueryWrapper = userInfoService.getMiniUserInfoQueryWrapper();
List<UserInfo> userInfoList = userInfoService.list(miniUserInfoQueryWrapper);
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(userInfoList, userMainInfoService, UserInfo::getId, UserMainInfo::getUserId);
// 封装Map(键用户id, 值:抽佣比例)
Map<Long, BigDecimal> userCommissionRateMap = new HashMap<>();

View File

@ -60,9 +60,6 @@ public class WithdrawalApplyController {
@Resource
private UserMainInfoService userMainInfoService;
@Resource
private UserInfoService userInfoService;
@Resource
private UserAccountService userAccountService;

View File

@ -80,7 +80,7 @@ public class AdvancementApplyController {
* @return 是否更新成功
*/
@PostMapping("modify/status")
@Operation(summary = "小程序端用户撤销晋升申请记录", description = "参数:晋升申请更新请求体权限管理员方法名revokeAdvancementApply")
@Operation(summary = "小程序端用户撤销晋升申请记录", description = "参数:晋升申请记录id权限管理员方法名revokeAdvancementApply")
@SysLog(title = "晋升申请管理", content = "小程序端用户撤销晋升申请记录")
public BaseResponse<Boolean> revokeAdvancementApply(@Valid @RequestBody CommonRequest commonRequest) {
Long id = commonRequest.getId();
@ -193,6 +193,7 @@ public class AdvancementApplyController {
return ResultUtils.success(advancementApplyVOPlus);
}
/**
* Web端管理员分页查询晋升申请
* @param advancementApplyQueryRequest 晋升申请查询请求体

View File

@ -1,19 +1,12 @@
package com.greenorange.promotion.controller.userInfo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.greenorange.promotion.annotation.RequiresPermission;
import com.greenorange.promotion.annotation.SysLog;
import com.greenorange.promotion.common.BaseResponse;
import com.greenorange.promotion.common.ErrorCode;
import com.greenorange.promotion.common.ResultUtils;
import com.greenorange.promotion.constant.UserConstant;
import com.greenorange.promotion.exception.ThrowUtils;
import com.greenorange.promotion.model.dto.CommonBatchRequest;
import com.greenorange.promotion.model.dto.userAccount.UserAccountAddRequest;
import com.greenorange.promotion.model.dto.userAccount.UserAccountQueryRequest;
import com.greenorange.promotion.model.dto.userAccount.UserAccountUpdateRequest;
import com.greenorange.promotion.model.entity.ProjectSettlement;
import com.greenorange.promotion.model.entity.UserAccount;
import com.greenorange.promotion.model.vo.userAccount.UserAccountVO;
import com.greenorange.promotion.service.common.CommonService;
@ -22,17 +15,13 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.greenorange.promotion.model.dto.CommonRequest;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 用户账户 控制器

View File

@ -113,104 +113,4 @@ public class UserMainInfoController {
return ResultUtils.success(userTeamInfoVO);
}
// /**
// * web端管理员添加用户主要信息
// * @param userMainInfoAddRequest 用户主要信息添加请求体
// * @return 是否添加成功
// */
// @PostMapping("add")
// @Operation(summary = "web端管理员添加用户主要信息", description = "参数用户主要信息添加请求体权限管理员方法名addUserMainInfo")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "用户主要信息管理", content = "web端管理员添加用户主要信息")
// public BaseResponse<Boolean> addUserMainInfo(@Valid @RequestBody UserMainInfoAddRequest userMainInfoAddRequest) {
// UserMainInfo userMainInfo = commonService.copyProperties(userMainInfoAddRequest, UserMainInfo.class);
// userMainInfoService.save(userMainInfo);
// return ResultUtils.success(true);
// }
//
// /**
// * web端管理员根据id修改用户主要信息信息
// * @param userMainInfoUpdateRequest 用户主要信息更新请求体
// * @return 是否更新成功
// */
// @PostMapping("update")
// @Operation(summary = "web端管理员更新用户主要信息", description = "参数用户主要信息更新请求体权限管理员方法名updateUserMainInfo")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "用户主要信息管理", content = "web端管理员根据id修改用户主要信息信息")
// public BaseResponse<Boolean> updateUserMainInfo(@Valid @RequestBody UserMainInfoUpdateRequest userMainInfoUpdateRequest) {
// UserMainInfo userMainInfo = commonService.copyProperties(userMainInfoUpdateRequest, UserMainInfo.class);
// userMainInfoService.updateById(userMainInfo);
// return ResultUtils.success(true);
// }
//
// /**
// * web端管理员根据id删除用户主要信息
// * @param commonRequest 用户主要信息删除请求体
// * @return 是否删除成功
// */
// @PostMapping("delete")
// @Operation(summary = "web端管理员根据id删除用户主要信息", description = "参数用户主要信息删除请求体权限管理员方法名delUserMainInfo")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "用户主要信息管理", content = "web端管理员根据id删除用户主要信息")
// public BaseResponse<Boolean> delUserMainInfo(@Valid @RequestBody CommonRequest commonRequest) {
// Long id = commonRequest.getId();
// userMainInfoService.removeById(id);
// return ResultUtils.success(true);
// }
//
// /**
// * web端管理员批量删除用户主要信息
// * @param commonBatchRequest 用户主要信息批量删除请求体
// * @return 是否删除成功
// */
// @PostMapping("delBatch")
// @Operation(summary = "web端管理员批量删除用户主要信息", description = "参数用户主要信息批量删除请求体权限管理员方法名delBatchUserMainInfo")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "用户主要信息管理", content = "web端管理员批量删除用户主要信息")
// public BaseResponse<Boolean> delBatchUserMainInfo(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
// List<Long> ids = commonBatchRequest.getIds();
// userMainInfoService.removeByIds(ids);
// return ResultUtils.success(true);
// }
//
// /**
// * web端管理员根据id查询用户主要信息
// * @param commonRequest 用户主要信息查询请求体
// * @return 用户主要信息信息
// */
// @PostMapping("queryById")
// @Operation(summary = "web端管理员根据id查询用户主要信息", description = "参数用户主要信息查询请求体权限管理员方法名queryUserMainInfoById")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "用户主要信息管理", content = "web端管理员根据id查询用户主要信息")
// public BaseResponse<UserMainInfoVO> queryUserMainInfoById(@Valid @RequestBody CommonRequest commonRequest) {
// Long id = commonRequest.getId();
// UserMainInfo userMainInfo = userMainInfoService.getById(id);
// ThrowUtils.throwIf(userMainInfo == null, ErrorCode.OPERATION_ERROR, "当前用户主要信息不存在");
// UserMainInfoVO userMainInfoVO = commonService.copyProperties(userMainInfo, UserMainInfoVO.class);
// return ResultUtils.success(userMainInfoVO);
// }
// /**
// * Web端管理员分页查询用户主要信息
// * @param userMainInfoQueryRequest 用户主要信息查询请求体
// * @return 用户主要信息列表
// */
// @PostMapping("page")
// @Operation(summary = "Web端管理员分页查询用户主要信息", description = "参数用户主要信息查询请求体权限管理员方法名listUserMainInfoByPage")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "用户主要信息管理", content = "Web端管理员分页查询用户主要信息")
// public BaseResponse<Page<UserMainInfoVO>> listUserMainInfoByPage(@Valid @RequestBody UserMainInfoQueryRequest userMainInfoQueryRequest) {
// long current = userMainInfoQueryRequest.getCurrent();
// long pageSize = userMainInfoQueryRequest.getPageSize();
// QueryWrapper<UserMainInfo> queryWrapper = userMainInfoService.getQueryWrapper(userMainInfoQueryRequest);
// Page<UserMainInfo> page = userMainInfoService.page(new Page<>(current, pageSize), queryWrapper);
// List<UserMainInfo> userMainInfoList = page.getRecords();
// List<UserMainInfoVO> userMainInfoVOList = commonService.convertList(userMainInfoList, UserMainInfoVO.class);
// Page<UserMainInfoVO> voPage = new Page<>(current, pageSize);
// voPage.setRecords(userMainInfoVOList);
// voPage.setPages(page.getPages());
// voPage.setTotal(page.getTotal());
// return ResultUtils.success(voPage);
// }
}

View File

@ -80,7 +80,7 @@ public interface UserInfoService extends IService<UserInfo> {
/**
* 根据用户权限来获取条件构造器
* 根据用户权限来获取查询条件
*/
LambdaQueryWrapper<UserInfo> getQueryWrapperByUserRole(UserRoleEnum userRoleEnum, LambdaQueryWrapper<UserInfo> lambdaQueryWrapper);
@ -89,4 +89,10 @@ public interface UserInfoService extends IService<UserInfo> {
* 小程序端员工信息注册
*/
void staffUserInfoMiniRegister(AdvancementApplyApproveRequest advancementApplyApproveRequest);
/**
* 获取小程序用户的查询条件
*/
LambdaQueryWrapper<UserInfo> getMiniUserInfoQueryWrapper();
}

View File

@ -10,7 +10,6 @@ import com.greenorange.promotion.common.ErrorCode;
import com.greenorange.promotion.constant.CommonConstant;
import com.greenorange.promotion.constant.SystemConstant;
import com.greenorange.promotion.constant.UserConstant;
import com.greenorange.promotion.exception.BusinessException;
import com.greenorange.promotion.exception.ThrowUtils;
import com.greenorange.promotion.mapper.UserInfoMapper;
import com.greenorange.promotion.model.dto.advancementApply.AdvancementApplyApproveRequest;
@ -326,7 +325,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
/**
* 根据用户权限来获取条件构造器
* 根据用户权限来获取查询条件
*/
@Override
public LambdaQueryWrapper<UserInfo> getQueryWrapperByUserRole(UserRoleEnum userRoleEnum, LambdaQueryWrapper<UserInfo> userInfoLambdaQueryWrapper) {
@ -386,6 +385,17 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
}
/**
* 获取小程序用户的查询条件
*/
@Override
public LambdaQueryWrapper<UserInfo> getMiniUserInfoQueryWrapper() {
LambdaQueryWrapper<UserInfo> userInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
userInfoLambdaQueryWrapper.in(UserInfo::getUserRole, UserRoleEnum.USER, UserRoleEnum.MANAGER, UserRoleEnum.SUPERVISOR, UserRoleEnum.STAFF);
return userInfoLambdaQueryWrapper;
}
/**
* 根据邀请码获得上级用户信息
*/