已完成小程序端的项目查询

This commit is contained in:
chen-xin-zhi 2025-05-11 18:10:09 +08:00
parent 4d14f5e04e
commit 2e33a08a33
28 changed files with 408 additions and 431 deletions

View File

@ -1,32 +1,14 @@
package com.greenorange.promotion.aop;
import cn.hutool.core.date.DateUtil;
import com.auth0.jwt.JWT;
import com.auth0.jwt.exceptions.JWTDecodeException;
import com.auth0.jwt.interfaces.Claim;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.greenorange.promotion.annotation.RequiresPermission;
import com.greenorange.promotion.common.ErrorCode;
import com.greenorange.promotion.exception.ThrowUtils;
import com.greenorange.promotion.model.entity.UserInfo;
import com.greenorange.promotion.model.enums.UserRoleEnum;
import com.greenorange.promotion.service.user.UserInfoService;
import com.greenorange.promotion.service.userInfo.UserInfoService;
import com.greenorange.promotion.utils.JWTUtils;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.User;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.Date;
import java.util.Objects;
/**

View File

@ -4,21 +4,25 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.CommonRequest;
import com.greenorange.promotion.model.dto.project.ProjectUpdateRequest;
import com.greenorange.promotion.model.dto.projectCommission.ProjectCommissionAddRequest;
import com.greenorange.promotion.model.dto.projectCommission.ProjectCommissionUniteUpdateRequest;
import com.greenorange.promotion.model.dto.projectCommission.ProjectCommissionUpdateRequest;
import com.greenorange.promotion.model.entity.Project;
import com.greenorange.promotion.model.entity.ProjectCommission;
import com.greenorange.promotion.model.entity.ProjectDetail;
import com.greenorange.promotion.model.dto.subUserProjectCommission.SubUserProjectCommissionUpdateRequest;
import com.greenorange.promotion.model.entity.*;
import com.greenorange.promotion.model.vo.projectCommission.ProjectCommissionVO;
import com.greenorange.promotion.model.vo.projectCommission.ProjectDetailCommissionVO;
import com.greenorange.promotion.model.vo.subUserProjectCommission.SubUserProjectCommissionVO;
import com.greenorange.promotion.model.vo.subUserProjectCommission.SubUserProjectDetailCommissionVO;
import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.project.ProjectCommissionService;
import com.greenorange.promotion.service.project.ProjectDetailService;
import com.greenorange.promotion.service.project.ProjectService;
import com.greenorange.promotion.service.project.SubUserProjectCommissionService;
import com.greenorange.promotion.service.userInfo.UserInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
@ -49,6 +53,9 @@ public class ProjectCommissionController {
@Resource
private ProjectCommissionService projectCommissionService;
@Resource
private SubUserProjectCommissionService subUserProjectCommissionService;
@Resource
private CommonService commonService;
@ -58,12 +65,15 @@ public class ProjectCommissionController {
@Resource
private ProjectDetailService projectDetailService;
@Resource
private UserInfoService userInfoService;
/**
* 小程序用户查看查询项目的抽佣情况
* @return 项目抽佣比例列表
* @return 项目抽佣列表
*/
@PostMapping("query/rate")
@PostMapping("query/commission")
@Operation(summary = "小程序用户查看查询项目的抽佣情况", description = "参数权限管理员方法名queryProjectCommission")
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
@SysLog(title = "项目明细抽佣管理", content = "小程序用户查看查询项目的抽佣情况")
@ -76,8 +86,11 @@ public class ProjectCommissionController {
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetField(projectCommissionList, projectDetailService, ProjectCommission::getProjectDetailId, "id");
// 封装Map集合项目明细id项目明细名称
Map<Long, String> projectDetailMap = new HashMap<>();
// 封装Map集合项目明细id项目明细最大抽佣比例
Map<Long, BigDecimal> rateMap = new HashMap<>();
for (ProjectDetail projectDetail : projectDetailList) {
projectDetailMap.put(projectDetail.getId(), projectDetail.getProjectDetailName());
rateMap.put(projectDetail.getId(), projectDetail.getMaxCommissionRate());
}
// 封装项目明细抽佣列表
List<ProjectDetailCommissionVO> projectDetailCommissionVOList = new ArrayList<>();
@ -86,8 +99,10 @@ public class ProjectCommissionController {
BigDecimal myUnitPrice = projectCommission.getMyUnitPrice();
BigDecimal currentCommissionRate = projectCommission.getCurrentCommissionRate();
String projectDetailName = projectDetailMap.get(projectDetailId);
BigDecimal maxCommissionRate = rateMap.get(projectDetailId);
ProjectDetailCommissionVO projectDetailCommissionVO = commonService.copyProperties(projectCommission, ProjectDetailCommissionVO.class);
projectDetailCommissionVO.setProjectDetailName(projectDetailName);
projectDetailCommissionVO.setMaxCommissionRate(maxCommissionRate);
BigDecimal agentUnitPrice = myUnitPrice.multiply(BigDecimal.ONE.subtract(currentCommissionRate));
projectDetailCommissionVO.setAgentUnitPrice(agentUnitPrice);
projectDetailCommissionVOList.add(projectDetailCommissionVO);
@ -100,9 +115,10 @@ public class ProjectCommissionController {
if (pdcList == null) {
pdcList = new ArrayList<>();
}
pdcList.add(projectDetailCommissionVO);
pdcMap.put(projectId, pdcList);
}
// 封装项目抽佣比例列表
// 封装项目抽佣列表
List<Project> projectList = commonService.findByFieldInTargetField(projectCommissionList, projectService, ProjectCommission::getProjectId, "id");
List<ProjectCommissionVO> projectCommissionVOList = new ArrayList<>();
for (Project project : projectList) {
@ -118,119 +134,179 @@ public class ProjectCommissionController {
/**
* 小程序用户修改项目的抽佣比例
* @param projectCommissionUpdateRequest 项目明细抽佣添加请求体
* @param projectCommissionUpdateRequest 项目明细抽佣更新请求体
* @return 是否添加成功
*/
@PostMapping("update/rate")
@Operation(summary = "小程序用户修改项目的抽佣比例", description = "参数:项目明细抽佣添加请求体权限管理员方法名updateProjectCommissionRate")
@Operation(summary = "小程序用户修改项目的抽佣比例", description = "参数:项目明细抽佣更新请求体权限管理员方法名updateProjectCommissionRate")
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
@SysLog(title = "项目明细抽佣管理", content = "小程序用户修改项目的抽佣比例")
public BaseResponse<Boolean> updateProjectCommissionRate(@Valid @RequestBody ProjectCommissionUpdateRequest projectCommissionUpdateRequest) {
ProjectCommission projectCommission = commonService.copyProperties(projectCommissionUpdateRequest, ProjectCommission.class);
projectCommissionService.save(projectCommission);
public BaseResponse<Boolean> updateProjectCommissionRate(@Valid @RequestBody ProjectCommissionUpdateRequest projectCommissionUpdateRequest, HttpServletRequest request) {
Long id = projectCommissionUpdateRequest.getId();
BigDecimal currentCommissionRate = projectCommissionUpdateRequest.getCurrentCommissionRate();
// 校验当前抽佣比例不能大于最大抽佣比例
ProjectCommission projectCommission = projectCommissionService.getById(id);
Long projectDetailId = projectCommission.getProjectDetailId();
ProjectDetail projectDetail = projectDetailService.getById(projectDetailId);
BigDecimal maxCommissionRate = projectDetail.getMaxCommissionRate();
ThrowUtils.throwIf(currentCommissionRate.compareTo(maxCommissionRate) > 0, ErrorCode.OPERATION_ERROR, "当前抽佣比例不能大于最大抽佣比例");
projectCommission.setCurrentCommissionRate(currentCommissionRate);
projectCommissionService.updateById(projectCommission);
// 批量更新下级用户的项目明细抽佣比例
Long userId = (Long) request.getAttribute("userId");
LambdaQueryWrapper<SubUserProjectCommission> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SubUserProjectCommission::getProjectDetailId, projectDetailId);
lambdaQueryWrapper.eq(SubUserProjectCommission::getUserId, userId);
List<SubUserProjectCommission> subUserProjectCommissionList = subUserProjectCommissionService.list(lambdaQueryWrapper);
for (SubUserProjectCommission subUserProjectCommission : subUserProjectCommissionList) {
subUserProjectCommission.setCurrentCommissionRate(currentCommissionRate);
}
subUserProjectCommissionService.updateBatchById(subUserProjectCommissionList);
return ResultUtils.success(true);
}
//
// /**
// * web端管理员添加项目明细抽佣
// * @param projectCommissionAddRequest 项目明细抽佣添加请求体
// * @return 是否添加成功
// */
// @PostMapping("add")
// @Operation(summary = "web端管理员添加项目明细抽佣", description = "参数项目明细抽佣添加请求体权限管理员方法名addProjectCommission")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "项目明细抽佣管理", content = "web端管理员添加项目明细抽佣")
// public BaseResponse<Boolean> addProjectCommission(@Valid @RequestBody ProjectCommissionAddRequest projectCommissionAddRequest) {
// ProjectCommission projectCommission = commonService.copyProperties(projectCommissionAddRequest, ProjectCommission.class);
// projectCommissionService.save(projectCommission);
// return ResultUtils.success(true);
// }
//
// /**
// * web端管理员根据id修改项目明细抽佣信息
// * @param projectCommissionUpdateRequest 项目明细抽佣更新请求体
// * @return 是否更新成功
// */
// @PostMapping("update")
// @Operation(summary = "web端管理员更新项目明细抽佣", description = "参数项目明细抽佣更新请求体权限管理员方法名updateProjectCommission")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "项目明细抽佣管理", content = "web端管理员根据id修改项目明细抽佣信息")
// public BaseResponse<Boolean> updateProjectCommission(@Valid @RequestBody ProjectCommissionUpdateRequest projectCommissionUpdateRequest) {
// ProjectCommission projectCommission = commonService.copyProperties(projectCommissionUpdateRequest, ProjectCommission.class);
// projectCommissionService.updateById(projectCommission);
// return ResultUtils.success(true);
// }
//
// /**
// * web端管理员根据id删除项目明细抽佣
// * @param commonRequest 项目明细抽佣删除请求体
// * @return 是否删除成功
// */
// @PostMapping("delete")
// @Operation(summary = "web端管理员根据id删除项目明细抽佣", description = "参数项目明细抽佣删除请求体权限管理员方法名delProjectCommission")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "项目明细抽佣管理", content = "web端管理员根据id删除项目明细抽佣")
// public BaseResponse<Boolean> delProjectCommission(@Valid @RequestBody CommonRequest commonRequest) {
// Long id = commonRequest.getId();
// projectCommissionService.removeById(id);
// return ResultUtils.success(true);
// }
//
// /**
// * web端管理员批量删除项目明细抽佣
// * @param commonBatchRequest 项目明细抽佣批量删除请求体
// * @return 是否删除成功
// */
// @PostMapping("delBatch")
// @Operation(summary = "web端管理员批量删除项目明细抽佣", description = "参数项目明细抽佣批量删除请求体权限管理员方法名delBatchProjectCommission")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "项目明细抽佣管理", content = "web端管理员批量删除项目明细抽佣")
// public BaseResponse<Boolean> delBatchProjectCommission(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
// List<Long> ids = commonBatchRequest.getIds();
// projectCommissionService.removeByIds(ids);
// return ResultUtils.success(true);
// }
//
// /**
// * web端管理员根据id查询项目明细抽佣
// * @param commonRequest 项目明细抽佣查询请求体
// * @return 项目明细抽佣信息
// */
// @PostMapping("queryById")
// @Operation(summary = "web端管理员根据id查询项目明细抽佣", description = "参数项目明细抽佣查询请求体权限管理员方法名queryProjectCommissionById")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "项目明细抽佣管理", content = "web端管理员根据id查询项目明细抽佣")
// public BaseResponse<ProjectCommissionVO> queryProjectCommissionById(@Valid @RequestBody CommonRequest commonRequest) {
// Long id = commonRequest.getId();
// ProjectCommission projectCommission = projectCommissionService.getById(id);
// ThrowUtils.throwIf(projectCommission == null, ErrorCode.OPERATION_ERROR, "当前项目明细抽佣不存在");
// ProjectCommissionVO projectCommissionVO = commonService.copyProperties(projectCommission, ProjectCommissionVO.class);
// return ResultUtils.success(projectCommissionVO);
// }
//
// /**
// * Web端管理员分页查询项目明细抽佣
// * @param projectCommissionQueryRequest 项目明细抽佣查询请求体
// * @return 项目明细抽佣列表
// */
// @PostMapping("page")
// @Operation(summary = "Web端管理员分页查询项目明细抽佣", description = "参数项目明细抽佣查询请求体权限管理员方法名listProjectCommissionByPage")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "项目明细抽佣管理", content = "Web端管理员分页查询项目明细抽佣")
// public BaseResponse<Page<ProjectCommissionVO>> listProjectCommissionByPage(@Valid @RequestBody ProjectCommissionQueryRequest projectCommissionQueryRequest) {
// long current = projectCommissionQueryRequest.getCurrent();
// long pageSize = projectCommissionQueryRequest.getPageSize();
// QueryWrapper<ProjectCommission> queryWrapper = projectCommissionService.getQueryWrapper(projectCommissionQueryRequest);
// Page<ProjectCommission> page = projectCommissionService.page(new Page<>(current, pageSize), queryWrapper);
// List<ProjectCommission> projectCommissionList = page.getRecords();
// List<ProjectCommissionVO> projectCommissionVOList = commonService.convertList(projectCommissionList, ProjectCommissionVO.class);
// Page<ProjectCommissionVO> voPage = new Page<>(current, pageSize);
// voPage.setRecords(projectCommissionVOList);
// voPage.setPages(page.getPages());
// voPage.setTotal(page.getTotal());
// return ResultUtils.success(voPage);
// }
/**
* 小程序用户查看下级用户的项目明细抽佣情况
* @param commonRequest 项目id
* @return 下级用户的项目明细抽佣列表
*/
@PostMapping("query/sub/commission")
@Operation(summary = "小程序用户查看下级用户的项目明细抽佣情况", description = "参数项目明细抽佣添加请求体权限管理员方法名querySubUserProjectCommission")
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
@SysLog(title = "项目明细抽佣管理", content = "小程序用户查看下级用户的项目明细抽佣情况")
public BaseResponse<List<SubUserProjectCommissionVO>> querySubUserProjectCommission(@Valid @RequestBody CommonRequest commonRequest, HttpServletRequest request) {
Long projectId = commonRequest.getId();
Long userId = (Long) request.getAttribute("userId");
LambdaQueryWrapper<SubUserProjectCommission> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SubUserProjectCommission::getProjectId, projectId);
lambdaQueryWrapper.eq(SubUserProjectCommission::getUserId, userId);
List<SubUserProjectCommission> subUserProjectCommissionList = subUserProjectCommissionService.list(lambdaQueryWrapper);
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetField(subUserProjectCommissionList, projectDetailService, SubUserProjectCommission::getProjectDetailId, "id");
// 封装Map集合项目明细id项目明细名称
Map<Long, String> projectDetailMap = new HashMap<>();
// 封装Map集合项目明细id项目明细最大抽佣比例
Map<Long, BigDecimal> rateMap = new HashMap<>();
for (ProjectDetail projectDetail : projectDetailList) {
projectDetailMap.put(projectDetail.getId(), projectDetail.getProjectDetailName());
rateMap.put(projectDetail.getId(), projectDetail.getMaxCommissionRate());
}
// 封装下级用户项目明细抽佣列表
List<SubUserProjectDetailCommissionVO> subUserProjectDetailCommissionVOList = new ArrayList<>();
for (SubUserProjectCommission subUserProjectCommission : subUserProjectCommissionList) {
Long projectDetailId = subUserProjectCommission.getProjectDetailId();
String projectDetailName = projectDetailMap.get(projectDetailId);
BigDecimal maxCommissionRate = rateMap.get(projectDetailId);
SubUserProjectDetailCommissionVO subUserProjectDetailCommissionVO = commonService.copyProperties(subUserProjectCommission, SubUserProjectDetailCommissionVO.class);
subUserProjectDetailCommissionVO.setProjectDetailName(projectDetailName);
subUserProjectDetailCommissionVO.setMaxCommissionRate(maxCommissionRate);
BigDecimal myUnitPrice = subUserProjectCommission.getMyUnitPrice();
BigDecimal currentCommissionRate = subUserProjectCommission.getCurrentCommissionRate();
BigDecimal agentUnitPrice = myUnitPrice.multiply(BigDecimal.ONE.subtract(currentCommissionRate));
subUserProjectDetailCommissionVO.setAgentUnitPrice(agentUnitPrice);
subUserProjectDetailCommissionVOList.add(subUserProjectDetailCommissionVO);
}
// 封装Map集合下级用户id项目明细抽佣列表
Map<Long, List<SubUserProjectDetailCommissionVO> > subPdcMap = new HashMap<>();
for (SubUserProjectDetailCommissionVO subUserProjectDetailCommissionVO : subUserProjectDetailCommissionVOList) {
Long subUserId = subUserProjectDetailCommissionVO.getSubUserId();
List<SubUserProjectDetailCommissionVO> subUserProjectDetailCommissionVOS = subPdcMap.get(subUserId);
if (subUserProjectDetailCommissionVOS == null) {
subUserProjectDetailCommissionVOS = new ArrayList<>();
}
subUserProjectDetailCommissionVOS.add(subUserProjectDetailCommissionVO);
subPdcMap.put(subUserId, subUserProjectDetailCommissionVOS);
}
// 封装下级用户项目抽佣列表
LambdaQueryWrapper<UserInfo> userInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
userInfoLambdaQueryWrapper.eq(UserInfo::getParentUserId, userId);
List<UserInfo> userInfoList = userInfoService.list(userInfoLambdaQueryWrapper);
List<SubUserProjectCommissionVO> subUserProjectCommissionVOList = new ArrayList<>();
for (UserInfo userInfo : userInfoList) {
Long subUserId = userInfo.getId();
String nickName = userInfo.getNickName();
List<SubUserProjectDetailCommissionVO> subUserProjectDetailCommissionVOS = subPdcMap.get(subUserId);
SubUserProjectCommissionVO subUserProjectCommissionVO = SubUserProjectCommissionVO.builder()
.subUserId(subUserId)
.subUserNickName(nickName)
.subUserProjectDetailCommissionVOList(subUserProjectDetailCommissionVOS)
.build();
subUserProjectCommissionVOList.add(subUserProjectCommissionVO);
}
return ResultUtils.success(subUserProjectCommissionVOList);
}
/**
* 小程序用户修改下级用户的项目明细抽佣比例
* @param subUserProjectCommissionUpdateRequest 下级用户项目明细抽佣更新请求体
* @return 是否添加成功
*/
@PostMapping("update/sub/rate")
@Operation(summary = "小程序用户修改下级用户的项目明细抽佣比例", description = "参数下级用户项目明细抽佣更新请求体权限管理员方法名updateSubUserProjectCommissionRate")
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
@SysLog(title = "项目明细抽佣管理", content = "小程序用户修改下级用户的项目明细抽佣比例")
public BaseResponse<Boolean> updateSubUserProjectCommissionRate(@Valid @RequestBody SubUserProjectCommissionUpdateRequest subUserProjectCommissionUpdateRequest) {
Long id = subUserProjectCommissionUpdateRequest.getId();
BigDecimal currentCommissionRate = subUserProjectCommissionUpdateRequest.getCurrentCommissionRate();
// 校验当前抽佣比例不能大于最大抽佣比例
SubUserProjectCommission subUserProjectCommission = subUserProjectCommissionService.getById(id);
Long projectDetailId = subUserProjectCommission.getProjectDetailId();
ProjectDetail projectDetail = projectDetailService.getById(projectDetailId);
BigDecimal maxCommissionRate = projectDetail.getMaxCommissionRate();
ThrowUtils.throwIf(currentCommissionRate.compareTo(maxCommissionRate) > 0, ErrorCode.OPERATION_ERROR, "当前抽佣比例不能大于最大抽佣比例");
subUserProjectCommission.setCurrentCommissionRate(currentCommissionRate);
subUserProjectCommissionService.updateById(subUserProjectCommission);
return ResultUtils.success(true);
}
/**
* 小程序用户一键设置项目的的抽佣比例
* @param projectCommissionUniteUpdateRequest 统一抽佣比例
* @return 是否添加成功
*/
@PostMapping("update/unite/rate")
@Operation(summary = "小程序用户一键设置项目的的抽佣比例", description = "参数统一抽佣比例权限管理员方法名uniteProjectCommissionRate")
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
@SysLog(title = "项目明细抽佣管理", content = "小程序用户一键设置项目的的抽佣比例")
public BaseResponse<Boolean> uniteProjectCommissionRate(@Valid @RequestBody ProjectCommissionUniteUpdateRequest projectCommissionUniteUpdateRequest, HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
BigDecimal uniteCommissionRate = projectCommissionUniteUpdateRequest.getUniteCommissionRate();
LambdaQueryWrapper<ProjectCommission> projectCommissionLambdaQueryWrapper = new LambdaQueryWrapper<>();
projectCommissionLambdaQueryWrapper.eq(ProjectCommission::getUserId, userId);
List<ProjectCommission> projectCommissionList = projectCommissionService.list(projectCommissionLambdaQueryWrapper);
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetField(projectCommissionList, projectDetailService, ProjectCommission::getProjectDetailId, "id");
// 封装map集合项目明细id, 项目明细最大抽佣比例
Map<Long, BigDecimal> map = new HashMap<>();
for (ProjectDetail projectDetail : projectDetailList) {
map.put(projectDetail.getId(), projectDetail.getMaxCommissionRate());
}
for (ProjectCommission projectCommission : projectCommissionList) {
Long projectDetailId = projectCommission.getProjectDetailId();
BigDecimal maxCommissionRate = map.get(projectDetailId);
BigDecimal setCommissionRate = uniteCommissionRate.compareTo(maxCommissionRate) > 0 ? maxCommissionRate : uniteCommissionRate;
projectCommission.setCurrentCommissionRate(setCommissionRate);
}
projectCommissionService.updateBatchById(projectCommissionList);
// 修改下级用户的项目明细抽佣比例
LambdaQueryWrapper<SubUserProjectCommission> subUserProjectCommissionLambdaQueryWrapper = new LambdaQueryWrapper<>();
subUserProjectCommissionLambdaQueryWrapper.eq(SubUserProjectCommission::getUserId, userId);
List<SubUserProjectCommission> subUserProjectCommissionList = subUserProjectCommissionService.list(subUserProjectCommissionLambdaQueryWrapper);
for (SubUserProjectCommission subUserProjectCommission : subUserProjectCommissionList) {
Long projectDetailId = subUserProjectCommission.getProjectDetailId();
BigDecimal maxCommissionRate = map.get(projectDetailId);
BigDecimal setCommissionRate = uniteCommissionRate.compareTo(maxCommissionRate) > 0 ? maxCommissionRate : uniteCommissionRate;
subUserProjectCommission.setCurrentCommissionRate(setCommissionRate);
}
subUserProjectCommissionService.updateBatchById(subUserProjectCommissionList);
return ResultUtils.success(true);
}
}

View File

@ -1,7 +1,6 @@
package com.greenorange.promotion.controller.project;
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;
@ -9,11 +8,8 @@ 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.projectCommission.ProjectCommissionAddRequest;
import com.greenorange.promotion.model.dto.projectCommission.ProjectCommissionUpdateRequest;
import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailAddRequest;
import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailQueryRequest;
import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailUpdateRequest;
import com.greenorange.promotion.model.dto.subUserProjectCommission.SubUserProjectCommissionAddRequest;
import com.greenorange.promotion.model.entity.*;
@ -22,14 +18,13 @@ import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.project.ProjectCommissionService;
import com.greenorange.promotion.service.project.ProjectDetailService;
import com.greenorange.promotion.service.project.SubUserProjectCommissionService;
import com.greenorange.promotion.service.user.UserInfoService;
import com.greenorange.promotion.service.userInfo.UserInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
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;

View File

@ -1,148 +0,0 @@
package com.greenorange.promotion.controller.project;
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.subUserProjectCommission.SubUserProjectCommissionAddRequest;
import com.greenorange.promotion.model.dto.subUserProjectCommission.SubUserProjectCommissionQueryRequest;
import com.greenorange.promotion.model.dto.subUserProjectCommission.SubUserProjectCommissionUpdateRequest;
import com.greenorange.promotion.model.entity.SubUserProjectCommission;
import com.greenorange.promotion.model.vo.subUserProjectCommission.SubUserProjectCommissionVO;
import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.project.SubUserProjectCommissionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
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;
/**
* 下级用户项目明细抽佣 控制器
*/
@RestController
@RequestMapping("subUserProjectCommission")
@Slf4j
@Tag(name = "下级用户项目明细抽佣管理")
public class SubUserProjectCommissionController {
@Resource
private SubUserProjectCommissionService subUserProjectCommissionService;
@Resource
private CommonService commonService;
/**
* web端管理员添加下级用户项目明细抽佣
* @param subUserProjectCommissionAddRequest 下级用户项目明细抽佣添加请求体
* @return 是否添加成功
*/
@PostMapping("add")
@Operation(summary = "web端管理员添加下级用户项目明细抽佣", description = "参数下级用户项目明细抽佣添加请求体权限管理员方法名addSubUserProjectCommission")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "下级用户项目明细抽佣管理", content = "web端管理员添加下级用户项目明细抽佣")
public BaseResponse<Boolean> addSubUserProjectCommission(@Valid @RequestBody SubUserProjectCommissionAddRequest subUserProjectCommissionAddRequest) {
SubUserProjectCommission subUserProjectCommission = commonService.copyProperties(subUserProjectCommissionAddRequest, SubUserProjectCommission.class);
subUserProjectCommissionService.save(subUserProjectCommission);
return ResultUtils.success(true);
}
/**
* web端管理员根据id修改下级用户项目明细抽佣信息
* @param subUserProjectCommissionUpdateRequest 下级用户项目明细抽佣更新请求体
* @return 是否更新成功
*/
@PostMapping("update")
@Operation(summary = "web端管理员更新下级用户项目明细抽佣", description = "参数下级用户项目明细抽佣更新请求体权限管理员方法名updateSubUserProjectCommission")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "下级用户项目明细抽佣管理", content = "web端管理员根据id修改下级用户项目明细抽佣信息")
public BaseResponse<Boolean> updateSubUserProjectCommission(@Valid @RequestBody SubUserProjectCommissionUpdateRequest subUserProjectCommissionUpdateRequest) {
SubUserProjectCommission subUserProjectCommission = commonService.copyProperties(subUserProjectCommissionUpdateRequest, SubUserProjectCommission.class);
subUserProjectCommissionService.updateById(subUserProjectCommission);
return ResultUtils.success(true);
}
/**
* web端管理员根据id删除下级用户项目明细抽佣
* @param commonRequest 下级用户项目明细抽佣删除请求体
* @return 是否删除成功
*/
@PostMapping("delete")
@Operation(summary = "web端管理员根据id删除下级用户项目明细抽佣", description = "参数下级用户项目明细抽佣删除请求体权限管理员方法名delSubUserProjectCommission")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "下级用户项目明细抽佣管理", content = "web端管理员根据id删除下级用户项目明细抽佣")
public BaseResponse<Boolean> delSubUserProjectCommission(@Valid @RequestBody CommonRequest commonRequest) {
Long id = commonRequest.getId();
subUserProjectCommissionService.removeById(id);
return ResultUtils.success(true);
}
/**
* web端管理员批量删除下级用户项目明细抽佣
* @param commonBatchRequest 下级用户项目明细抽佣批量删除请求体
* @return 是否删除成功
*/
@PostMapping("delBatch")
@Operation(summary = "web端管理员批量删除下级用户项目明细抽佣", description = "参数下级用户项目明细抽佣批量删除请求体权限管理员方法名delBatchSubUserProjectCommission")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "下级用户项目明细抽佣管理", content = "web端管理员批量删除下级用户项目明细抽佣")
public BaseResponse<Boolean> delBatchSubUserProjectCommission(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
List<Long> ids = commonBatchRequest.getIds();
subUserProjectCommissionService.removeByIds(ids);
return ResultUtils.success(true);
}
/**
* web端管理员根据id查询下级用户项目明细抽佣
* @param commonRequest 下级用户项目明细抽佣查询请求体
* @return 下级用户项目明细抽佣信息
*/
@PostMapping("queryById")
@Operation(summary = "web端管理员根据id查询下级用户项目明细抽佣", description = "参数下级用户项目明细抽佣查询请求体权限管理员方法名querySubUserProjectCommissionById")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "下级用户项目明细抽佣管理", content = "web端管理员根据id查询下级用户项目明细抽佣")
public BaseResponse<SubUserProjectCommissionVO> querySubUserProjectCommissionById(@Valid @RequestBody CommonRequest commonRequest) {
Long id = commonRequest.getId();
SubUserProjectCommission subUserProjectCommission = subUserProjectCommissionService.getById(id);
ThrowUtils.throwIf(subUserProjectCommission == null, ErrorCode.OPERATION_ERROR, "当前下级用户项目明细抽佣不存在");
SubUserProjectCommissionVO subUserProjectCommissionVO = commonService.copyProperties(subUserProjectCommission, SubUserProjectCommissionVO.class);
return ResultUtils.success(subUserProjectCommissionVO);
}
// /**
// * Web端管理员分页查询下级用户项目明细抽佣
// * @param subUserProjectCommissionQueryRequest 下级用户项目明细抽佣查询请求体
// * @return 下级用户项目明细抽佣列表
// */
// @PostMapping("page")
// @Operation(summary = "Web端管理员分页查询下级用户项目明细抽佣", description = "参数下级用户项目明细抽佣查询请求体权限管理员方法名listSubUserProjectCommissionByPage")
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "下级用户项目明细抽佣管理", content = "Web端管理员分页查询下级用户项目明细抽佣")
// public BaseResponse<Page<SubUserProjectCommissionVO>> listSubUserProjectCommissionByPage(@Valid @RequestBody SubUserProjectCommissionQueryRequest subUserProjectCommissionQueryRequest) {
// long current = subUserProjectCommissionQueryRequest.getCurrent();
// long pageSize = subUserProjectCommissionQueryRequest.getPageSize();
// QueryWrapper<SubUserProjectCommission> queryWrapper = subUserProjectCommissionService.getQueryWrapper(subUserProjectCommissionQueryRequest);
// Page<SubUserProjectCommission> page = subUserProjectCommissionService.page(new Page<>(current, pageSize), queryWrapper);
// List<SubUserProjectCommission> subUserProjectCommissionList = page.getRecords();
// List<SubUserProjectCommissionVO> subUserProjectCommissionVOList = commonService.convertList(subUserProjectCommissionList, SubUserProjectCommissionVO.class);
// Page<SubUserProjectCommissionVO> voPage = new Page<>(current, pageSize);
// voPage.setRecords(subUserProjectCommissionVOList);
// voPage.setPages(page.getPages());
// voPage.setTotal(page.getTotal());
// return ResultUtils.success(voPage);
// }
}

View File

@ -8,7 +8,6 @@ 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.CommonRequest;
import com.greenorange.promotion.model.dto.projectSettlement.ProjectSettlementAddRequest;
import com.greenorange.promotion.model.dto.projectSettlement.ProjectSettlementUpdateRequest;
@ -18,8 +17,7 @@ import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.project.PromoCodeApplyService;
import com.greenorange.promotion.service.settle.FundsChangeService;
import com.greenorange.promotion.service.settle.ProjectSettlementService;
import com.greenorange.promotion.service.user.UserInfoService;
import com.greenorange.promotion.service.user.UserMainInfoService;
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;

View File

@ -5,33 +5,25 @@ 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.withdrawalApply.WithdrawalApplyAddRequest;
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyQueryRequest;
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyUpdateRequest;
import com.greenorange.promotion.model.entity.FundsChange;
import com.greenorange.promotion.model.entity.UserInfo;
import com.greenorange.promotion.model.entity.WithdrawalApply;
import com.greenorange.promotion.model.vo.fundsChange.FundsChangeVO;
import com.greenorange.promotion.model.vo.withdrawalApply.WithdrawalApplyVO;
import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.settle.FundsChangeService;
import com.greenorange.promotion.service.settle.WithdrawalApplyService;
import com.greenorange.promotion.service.user.UserInfoService;
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 lombok.With;
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;

View File

@ -14,14 +14,14 @@ import com.greenorange.promotion.exception.ThrowUtils;
import com.greenorange.promotion.model.dto.CommonBatchRequest;
import com.greenorange.promotion.model.dto.CommonRequest;
import com.greenorange.promotion.model.dto.CommonStringRequest;
import com.greenorange.promotion.model.dto.user.*;
import com.greenorange.promotion.model.dto.userInfo.*;
import com.greenorange.promotion.model.entity.UserInfo;
import com.greenorange.promotion.model.entity.UserMainInfo;
import com.greenorange.promotion.model.vo.user.UserInfoVO;
import com.greenorange.promotion.model.vo.userInfo.UserInfoVO;
import com.greenorange.promotion.model.vo.userMainInfo.UserMainInfoVO;
import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.user.UserInfoService;
import com.greenorange.promotion.service.user.UserMainInfoService;
import com.greenorange.promotion.service.userInfo.UserInfoService;
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
import com.greenorange.promotion.utils.JWTUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

View File

@ -13,10 +13,11 @@ import com.greenorange.promotion.model.dto.userMainInfo.UserMainInfoUpdateReques
import com.greenorange.promotion.model.entity.UserMainInfo;
import com.greenorange.promotion.model.vo.userMainInfo.UserMainInfoVO;
import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.user.UserMainInfoService;
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -43,6 +44,21 @@ public class UserMainInfoController {
@Resource
private CommonService commonService;
/**
* 小程序用户查询团队信息
* @return 团队信息
*/
@PostMapping("query/team")
@Operation(summary = "小程序用户查询团队信息", description = "参数用户主要信息添加请求体权限管理员方法名queryUserTeamInfo")
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
@SysLog(title = "用户主要信息管理", content = "小程序用户查询团队信息")
public BaseResponse<Boolean> queryUserTeamInfo(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return ResultUtils.success(true);
}
/**
* web端管理员添加用户主要信息
* @param userMainInfoAddRequest 用户主要信息添加请求体

View File

@ -0,0 +1,25 @@
package com.greenorange.promotion.model.dto.projectCommission;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class ProjectCommissionUniteUpdateRequest implements Serializable {
/**
* 统一抽佣比例
*/
@Min(value = 0L, message = "抽佣比例不能小于0")
@Schema(description = "统一抽佣比例", example = "5")
private BigDecimal uniteCommissionRate;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -15,11 +15,7 @@ import java.math.BigDecimal;
@Data
@Schema(description = "项目明细抽佣更新请求体", requiredProperties = {
"id",
"projectDetailId",
"myUnitPrice",
"currentCommissionRate",
"projectId",
"userId",
"currentCommissionRate"
})
public class ProjectCommissionUpdateRequest implements Serializable {
@ -30,39 +26,14 @@ public class ProjectCommissionUpdateRequest implements Serializable {
@Schema(description = "抽佣记录ID", example = "1")
private Long id;
/**
* 项目明细ID
*/
@Min(value = 1L, message = "项目明细ID ID不能小于1")
@Schema(description = "项目明细ID", example = "1")
private Long projectDetailId;
/**
* 我的单价
*/
@Schema(description = "我的单价", example = "0.45")
private BigDecimal myUnitPrice;
/**
* 当前抽佣比例
*/
@Min(value = 0L, message = "抽佣比例不能小于0")
@Schema(description = "当前抽佣比例", example = "5")
private BigDecimal currentCommissionRate;
/**
* 项目ID
*/
@Min(value = 1L, message = "项目ID ID不能小于1")
@Schema(description = "项目ID", example = "1")
private Long projectId;
/**
* 用户ID
*/
@Min(value = 1L, message = "用户ID ID不能小于1")
@Schema(description = "用户ID", example = "1")
private Long userId;
@Serial
private static final long serialVersionUID = 1L;

View File

@ -15,12 +15,7 @@ import java.math.BigDecimal;
@Data
@Schema(description = "下级用户项目明细抽佣更新请求体", requiredProperties = {
"id",
"projectDetailId",
"myUnitPrice",
"currentCommissionRate",
"subUserId",
"projectId",
"userId",
})
public class SubUserProjectCommissionUpdateRequest implements Serializable {
@ -31,46 +26,12 @@ public class SubUserProjectCommissionUpdateRequest implements Serializable {
@Schema(description = "下级用户抽佣记录ID", example = "1")
private Long id;
/**
* 项目明细ID
*/
@Min(value = 1L, message = "项目明细ID ID不能小于1")
@Schema(description = "项目明细ID", example = "1")
private Long projectDetailId;
/**
* 我的单价
*/
@Schema(description = "我的单价", example = "0.24")
private BigDecimal myUnitPrice;
/**
* 当前抽佣比例
*/
@Schema(description = "当前抽佣比例", example = "4")
private BigDecimal currentCommissionRate;
/**
* 下级用户ID
*/
@Min(value = 1L, message = "下级用户ID ID不能小于1")
@Schema(description = "下级用户ID", example = "2")
private Long subUserId;
/**
* 项目ID
*/
@Min(value = 1L, message = "项目ID ID不能小于1")
@Schema(description = "项目ID", example = "1")
private Long projectId;
/**
* 用户ID
*/
@Min(value = 1L, message = "用户ID ID不能小于1")
@Schema(description = "用户ID", example = "1")
private Long userId;
@Serial
private static final long serialVersionUID = 1L;

View File

@ -1,14 +1,11 @@
package com.greenorange.promotion.model.dto.user;
package com.greenorange.promotion.model.dto.userInfo;
import com.greenorange.promotion.annotation.UserEnumValue;
import com.greenorange.promotion.model.enums.UserRoleEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package com.greenorange.promotion.model.dto.user;
package com.greenorange.promotion.model.dto.userInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;

View File

@ -1,4 +1,4 @@
package com.greenorange.promotion.model.dto.user;
package com.greenorange.promotion.model.dto.userInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;

View File

@ -1,4 +1,4 @@
package com.greenorange.promotion.model.dto.user;
package com.greenorange.promotion.model.dto.userInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;

View File

@ -1,9 +1,7 @@
package com.greenorange.promotion.model.dto.user;
package com.greenorange.promotion.model.dto.userInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package com.greenorange.promotion.model.dto.user;
package com.greenorange.promotion.model.dto.userInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;

View File

@ -1,4 +1,4 @@
package com.greenorange.promotion.model.dto.user;
package com.greenorange.promotion.model.dto.userInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;

View File

@ -1,4 +1,4 @@
package com.greenorange.promotion.model.dto.user;
package com.greenorange.promotion.model.dto.userInfo;
import com.greenorange.promotion.annotation.UserEnumValue;
import com.greenorange.promotion.model.enums.UserRoleEnum;

View File

@ -40,6 +40,12 @@ public class ProjectDetailCommissionVO implements Serializable {
@Schema(description = "当前抽佣比例", example = "3")
private BigDecimal currentCommissionRate;
/**
* 最大抽佣比例
*/
@Schema(description = "最大抽佣比例", example = "2")
private BigDecimal maxCommissionRate;
/**
* 项目id
*/

View File

@ -1,60 +1,43 @@
package com.greenorange.promotion.model.vo.subUserProjectCommission;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 下级用户项目明细抽佣 视图对象
*/
@Data
@Schema(description = "下级用户项目明细抽佣 视图对象")
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SubUserProjectCommissionVO implements Serializable {
/**
* 下级用户项目明细抽佣ID
*/
@Schema(description = "下级用户项目明细抽佣ID", example = "1")
private Long id;
/**
* 项目明细ID
*/
@Schema(description = "项目明细ID", example = "${field.example}")
private Long projectDetailId;
/**
* 我的单价
*/
@Schema(description = "我的单价", example = "${field.example}")
private BigDecimal myUnitPrice;
/**
* 当前抽佣比例
*/
@Schema(description = "当前抽佣比例", example = "${field.example}")
private BigDecimal currentCommissionRate;
/**
* 下级用户ID
*/
@Schema(description = "下级用户ID", example = "${field.example}")
@Schema(description = "下级用户ID", example = "5")
private Long subUserId;
/**
* 项目ID
* 下级用户昵称
*/
@Schema(description = "项目ID", example = "${field.example}")
private Long projectId;
@Schema(description = "下级用户昵称", example = "caozhe")
private String subUserNickName;
/**
* 用户ID
* 下级用户的项目明细抽佣列表
*/
@Schema(description = "用户ID", example = "${field.example}")
private Long userId;
@Schema(description = "下级用户项目明细抽佣列表")
private List<SubUserProjectDetailCommissionVO> subUserProjectDetailCommissionVOList;
@Serial

View File

@ -0,0 +1,63 @@
package com.greenorange.promotion.model.vo.subUserProjectCommission;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class SubUserProjectDetailCommissionVO implements Serializable {
/**
* 项目明细抽佣ID
*/
@Schema(description = "项目明细抽佣ID", example = "1")
private Long id;
/**
* 项目明细名称
*/
@Schema(description = "项目明细名称", example = "2.9元购买30元券包")
private String projectDetailName;
/**
* 我的单价
*/
@Schema(description = "我的单价", example = "10.44")
private BigDecimal myUnitPrice;
/**
* 代理单价
*/
@Schema(description = "代理单价", example = "9.44")
private BigDecimal agentUnitPrice;
/**
* 当前抽佣比例
*/
@Schema(description = "当前抽佣比例", example = "3")
private BigDecimal currentCommissionRate;
/**
* 最大抽佣比例
*/
@Schema(description = "最大抽佣比例", example = "2")
private BigDecimal maxCommissionRate;
/**
* 项目id
*/
@Schema(description = "项目id", example = "1")
private Long projectId;
/**
* 下级用户ID
*/
@Schema(description = "下级用户ID", example = "5")
private Long subUserId;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -1,8 +1,6 @@
package com.greenorange.promotion.model.vo.user;
package com.greenorange.promotion.model.vo.userInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serial;

View File

@ -0,0 +1,67 @@
package com.greenorange.promotion.model.vo.userMainInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@Schema(description = "用户团队信息 视图对象")
public class UserTeamInfoVO implements Serializable {
/**
* 用户主要信息ID
*/
@Schema(description = "用户主要信息ID", example = "1")
private Long id;
/**
* 团队人数不包括自己
*/
@Schema(description = "团队人数(不包括自己)", example = "${field.example}")
private Integer teamSize;
/**
* 给上级带来的收益
*/
@Schema(description = "给上级带来的收益", example = "${field.example}")
private BigDecimal parentEarnings;
/**
* 当前余额
*/
@Schema(description = "当前余额", example = "${field.example}")
private BigDecimal currentBalance;
/**
* 提现中的金额
*/
@Schema(description = "提现中的金额", example = "${field.example}")
private BigDecimal withdrawalAmount;
/**
* 已提现的金额
*/
@Schema(description = "已提现的金额", example = "${field.example}")
private BigDecimal withdrawnAmount;
/**
* 累计收入
*/
@Schema(description = "累计收入", example = "${field.example}")
private BigDecimal totalIncome;
/**
* 邀请二维码
*/
@Schema(description = "邀请二维码", example = "${field.example}")
private String inviteQrCode;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -1,10 +1,9 @@
package com.greenorange.promotion.service.user;
package com.greenorange.promotion.service.userInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.greenorange.promotion.model.dto.user.*;
import com.greenorange.promotion.model.dto.userInfo.*;
import com.greenorange.promotion.model.entity.UserInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import jakarta.servlet.http.HttpServletRequest;
/**
* @author 35880

View File

@ -1,4 +1,4 @@
package com.greenorange.promotion.service.user;
package com.greenorange.promotion.service.userInfo;
import com.greenorange.promotion.model.entity.UserMainInfo;
import com.baomidou.mybatisplus.extension.service.IService;

View File

@ -1,10 +1,9 @@
package com.greenorange.promotion.service.user.impl;
package com.greenorange.promotion.service.userInfo.impl;
import cn.hutool.core.util.RandomUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.greenorange.promotion.common.ErrorCode;
import com.greenorange.promotion.constant.CommonConstant;
@ -12,13 +11,13 @@ import com.greenorange.promotion.constant.SystemConstant;
import com.greenorange.promotion.constant.UserConstant;
import com.greenorange.promotion.exception.ThrowUtils;
import com.greenorange.promotion.mapper.UserInfoMapper;
import com.greenorange.promotion.model.dto.user.*;
import com.greenorange.promotion.model.dto.userInfo.*;
import com.greenorange.promotion.model.entity.UserInfo;
import com.greenorange.promotion.model.entity.UserMainInfo;
import com.greenorange.promotion.model.enums.UserRoleEnum;
import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.user.UserInfoService;
import com.greenorange.promotion.service.user.UserMainInfoService;
import com.greenorange.promotion.service.userInfo.UserInfoService;
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
import com.greenorange.promotion.utils.JWTUtils;
import com.greenorange.promotion.utils.RegexUtils;
@ -26,7 +25,6 @@ import com.greenorange.promotion.utils.SendSmsUtil;
import com.greenorange.promotion.utils.SqlUtils;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

View File

@ -1,8 +1,8 @@
package com.greenorange.promotion.service.user.impl;
package com.greenorange.promotion.service.userInfo.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.greenorange.promotion.model.entity.UserMainInfo;
import com.greenorange.promotion.service.user.UserMainInfoService;
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
import com.greenorange.promotion.mapper.UserMainInfoMapper;
import org.springframework.stereotype.Service;