完成主管员工绩效查询模块
This commit is contained in:
@ -21,6 +21,7 @@ import com.greenorange.promotion.model.entity.Course;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.greenorange.promotion.model.vo.course.CourseCardVO;
|
||||
import com.greenorange.promotion.model.vo.course.CourseVO;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderBaseInfoVO;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderCardVO;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
@ -145,43 +146,43 @@ public class CourseOrderController {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员根据id删除课程订单
|
||||
* @param commonRequest 课程订单删除请求体
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@PostMapping("delete")
|
||||
@Operation(summary = "web端管理员根据id删除课程订单", description = "参数:课程订单删除请求体,权限:管理员,方法名:delCourseOrder")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "web端管理员根据id删除课程订单")
|
||||
public BaseResponse<Boolean> delCourseOrder(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
ThrowUtils.throwIf(courseOrder == null || !courseOrder.getOrderStatus().equals(OrderStatusConstant.CLOSED),
|
||||
ErrorCode.OPERATION_ERROR, "该课程订单不存在或订单状态错误");
|
||||
courseOrderService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* web端管理员批量删除课程订单
|
||||
* @param commonBatchRequest 课程订单批量删除请求体
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@PostMapping("delBatch")
|
||||
@Operation(summary = "web端管理员批量删除课程订单", description = "参数:课程订单批量删除请求体,权限:管理员,方法名:delBatchCourseOrder")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "web端管理员批量删除课程订单")
|
||||
public BaseResponse<Boolean> delBatchCourseOrder(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
List<Long> ids = commonBatchRequest.getIds();
|
||||
LambdaQueryWrapper<CourseOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.ne(CourseOrder::getOrderStatus, OrderStatusConstant.CLOSED);
|
||||
long count = courseOrderService.count(queryWrapper);
|
||||
ThrowUtils.throwIf(count > 0, ErrorCode.OPERATION_ERROR, "存在未关闭的课程订单");
|
||||
courseOrderService.removeByIds(ids);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * web端管理员根据id删除课程订单
|
||||
// * @param commonRequest 课程订单删除请求体
|
||||
// * @return 是否删除成功
|
||||
// */
|
||||
// @PostMapping("delete")
|
||||
// @Operation(summary = "web端管理员根据id删除课程订单", description = "参数:课程订单删除请求体,权限:管理员,方法名:delCourseOrder")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "课程订单管理", content = "web端管理员根据id删除课程订单")
|
||||
// public BaseResponse<Boolean> delCourseOrder(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
// Long id = commonRequest.getId();
|
||||
// CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
// ThrowUtils.throwIf(courseOrder == null || !courseOrder.getOrderStatus().equals(OrderStatusConstant.CLOSED),
|
||||
// ErrorCode.OPERATION_ERROR, "该课程订单不存在或订单状态错误");
|
||||
// courseOrderService.removeById(id);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * web端管理员批量删除课程订单
|
||||
// * @param commonBatchRequest 课程订单批量删除请求体
|
||||
// * @return 是否删除成功
|
||||
// */
|
||||
// @PostMapping("delBatch")
|
||||
// @Operation(summary = "web端管理员批量删除课程订单", description = "参数:课程订单批量删除请求体,权限:管理员,方法名:delBatchCourseOrder")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "课程订单管理", content = "web端管理员批量删除课程订单")
|
||||
// public BaseResponse<Boolean> delBatchCourseOrder(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
// List<Long> ids = commonBatchRequest.getIds();
|
||||
// LambdaQueryWrapper<CourseOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.ne(CourseOrder::getOrderStatus, OrderStatusConstant.CLOSED);
|
||||
// long count = courseOrderService.count(queryWrapper);
|
||||
// ThrowUtils.throwIf(count > 0, ErrorCode.OPERATION_ERROR, "存在未关闭的课程订单");
|
||||
// courseOrderService.removeByIds(ids);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
|
||||
/**
|
||||
* web端管理员根据id查询课程订单
|
||||
@ -208,15 +209,15 @@ public class CourseOrderController {
|
||||
@Operation(summary = "Web端管理员分页查询课程订单", description = "参数:课程订单查询请求体,权限:管理员,方法名:listCourseOrderByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "Web端管理员分页查询课程订单")
|
||||
public BaseResponse<Page<CourseOrderVO>> listCourseOrderByPage(@Valid @RequestBody CourseOrderQueryRequest courseOrderQueryRequest) {
|
||||
public BaseResponse<Page<CourseOrderBaseInfoVO>> listCourseOrderByPage(@Valid @RequestBody CourseOrderQueryRequest courseOrderQueryRequest) {
|
||||
long current = courseOrderQueryRequest.getCurrent();
|
||||
long pageSize = courseOrderQueryRequest.getPageSize();
|
||||
QueryWrapper<CourseOrder> queryWrapper = courseOrderService.getQueryWrapper(courseOrderQueryRequest);
|
||||
Page<CourseOrder> page = courseOrderService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
List<CourseOrder> courseOrderList = page.getRecords();
|
||||
List<CourseOrderVO> courseOrderVOList = commonService.convertList(courseOrderList, CourseOrderVO.class);
|
||||
Page<CourseOrderVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(courseOrderVOList);
|
||||
List<CourseOrderBaseInfoVO> courseOrderBaseInfoVOS = commonService.convertList(courseOrderList, CourseOrderBaseInfoVO.class);
|
||||
Page<CourseOrderBaseInfoVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(courseOrderBaseInfoVOS);
|
||||
voPage.setPages(page.getPages());
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
|
@ -2,31 +2,36 @@ package com.greenorange.promotion.controller.userInfo;
|
||||
|
||||
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.ResultUtils;
|
||||
import com.greenorange.promotion.constant.OrderStatusConstant;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
import com.greenorange.promotion.model.dto.userPerformanceSummary.UserPerformanceSummaryAddRequest;
|
||||
import com.greenorange.promotion.model.dto.userPerformanceSummary.UserPerformanceSummaryQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.userPerformanceSummary.UserPerformanceSummaryUpdateRequest;
|
||||
import com.greenorange.promotion.model.dto.userPerformanceSummary.*;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.model.entity.UserPerformanceSummary;
|
||||
import com.greenorange.promotion.model.vo.userPerformanceSummary.UserPerformanceSummaryVO;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderBaseInfoVO;
|
||||
import com.greenorange.promotion.model.vo.userPerformanceSummary.UserPerformanceSummaryDetailVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import com.greenorange.promotion.service.userInfo.UserPerformanceSummaryService;
|
||||
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.apache.commons.lang3.StringUtils;
|
||||
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.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
||||
/**
|
||||
@ -44,102 +49,304 @@ public class UserPerformanceSummaryController {
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
/**
|
||||
* web端管理员添加用户绩效汇总
|
||||
* @param userPerformanceSummaryAddRequest 用户绩效汇总添加请求体
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "web端管理员添加用户绩效汇总", description = "参数:用户绩效汇总添加请求体,权限:管理员,方法名:addUserPerformanceSummary")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "用户绩效汇总管理", content = "web端管理员添加用户绩效汇总")
|
||||
public BaseResponse<Long> addUserPerformanceSummary(@Valid @RequestBody UserPerformanceSummaryAddRequest userPerformanceSummaryAddRequest) {
|
||||
UserPerformanceSummary userPerformanceSummary = commonService.copyProperties(userPerformanceSummaryAddRequest, UserPerformanceSummary.class);
|
||||
userPerformanceSummaryService.save(userPerformanceSummary);
|
||||
return ResultUtils.success(userPerformanceSummary.getId());
|
||||
}
|
||||
@Resource
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@Resource
|
||||
private CourseOrderService courseOrderService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员根据id修改用户绩效汇总信息
|
||||
* @param userPerformanceSummaryUpdateRequest 用户绩效汇总更新请求体
|
||||
* @return 是否更新成功
|
||||
* Web端管理员分页查询主管绩效汇总
|
||||
* @param userPerformanceSummaryQueryRequest 主管绩效汇总查询请求体
|
||||
* @return 用户绩效汇总列表
|
||||
*/
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "web端管理员根据id修改用户绩效汇总信息", description = "参数:用户绩效汇总更新请求体,权限:管理员,方法名:updateUserPerformanceSummary")
|
||||
@PostMapping("supervisor/page")
|
||||
@Operation(summary = "Web端管理员分页查询主管绩效汇总", description = "参数:主管绩效汇总查询请求体,权限:管理员,方法名:listSupervisorPerformanceSummaryByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "用户绩效汇总管理", content = "web端管理员根据id修改用户绩效汇总信息")
|
||||
public BaseResponse<Boolean> updateUserPerformanceSummary(@Valid @RequestBody UserPerformanceSummaryUpdateRequest userPerformanceSummaryUpdateRequest) {
|
||||
UserPerformanceSummary userPerformanceSummary = commonService.copyProperties(userPerformanceSummaryUpdateRequest, UserPerformanceSummary.class);
|
||||
userPerformanceSummaryService.updateById(userPerformanceSummary);
|
||||
return ResultUtils.success(true);
|
||||
public BaseResponse<Page<UserPerformanceSummaryDetailVO>> listSupervisorPerformanceSummaryByPage(@Valid @RequestBody UserPerformanceSummaryRankQueryRequest userPerformanceSummaryQueryRequest) {
|
||||
long current = userPerformanceSummaryQueryRequest.getCurrent();
|
||||
long pageSize = userPerformanceSummaryQueryRequest.getPageSize();
|
||||
String nickName = userPerformanceSummaryQueryRequest.getNickName();
|
||||
String phoneNumber = userPerformanceSummaryQueryRequest.getPhoneNumber();
|
||||
QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(nickName), "nickName", nickName);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(phoneNumber), "phoneNumber", phoneNumber);
|
||||
queryWrapper.eq("userRole", UserConstant.SUPERVISOR_ROLE);
|
||||
List<UserInfo> userInfoList = userInfoService.list(queryWrapper);
|
||||
List<Long> ids = userInfoList.stream().map(UserInfo::getId).toList();
|
||||
if (ids.isEmpty()) ids.add(-10L);
|
||||
|
||||
QueryWrapper<UserPerformanceSummary> userPerformanceSummaryQueryWrapper = userPerformanceSummaryService.getQueryWrapper(userPerformanceSummaryQueryRequest);
|
||||
userPerformanceSummaryQueryWrapper.in("userId", ids);
|
||||
Page<UserPerformanceSummary> page = userPerformanceSummaryService.page(new Page<>(current, pageSize), userPerformanceSummaryQueryWrapper);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = page.getRecords();
|
||||
List<UserPerformanceSummaryDetailVO> userPerformanceSummaryDetailVOS = commonService.convertList(userPerformanceSummaryList, UserPerformanceSummaryDetailVO.class);
|
||||
|
||||
// 封装Map集合(键:用户id, 值:用户信息)
|
||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
||||
for (UserPerformanceSummaryDetailVO userPerformanceSummaryDetailVO : userPerformanceSummaryDetailVOS) {
|
||||
UserInfo userInfo = userInfoMap.get(userPerformanceSummaryDetailVO.getUserId());
|
||||
userPerformanceSummaryDetailVO.setNickName(userInfo.getNickName());
|
||||
userPerformanceSummaryDetailVO.setPhoneNumber(userInfo.getPhoneNumber());
|
||||
}
|
||||
|
||||
Page<UserPerformanceSummaryDetailVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(userPerformanceSummaryDetailVOS);
|
||||
voPage.setPages(page.getPages());
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* web端管理员根据id删除用户绩效汇总
|
||||
* @param commonRequest 用户绩效汇总删除请求体
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@PostMapping("delete")
|
||||
@Operation(summary = "web端管理员根据id删除用户绩效汇总", description = "参数:用户绩效汇总删除请求体,权限:管理员,方法名:delUserPerformanceSummary")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "用户绩效汇总管理", content = "web端管理员根据id删除用户绩效汇总")
|
||||
public BaseResponse<Boolean> delUserPerformanceSummary(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
userPerformanceSummaryService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员批量删除用户绩效汇总
|
||||
* @param commonBatchRequest 用户绩效汇总批量删除请求体
|
||||
* @return 是否删除成功
|
||||
* Web端管理员根据主管id分页查询员工绩效汇总
|
||||
* @param userPerformanceSummaryQueryRequest 员工绩效汇总查询请求体
|
||||
* @return 用户绩效汇总列表
|
||||
*/
|
||||
@PostMapping("delBatch")
|
||||
@Operation(summary = "web端管理员批量删除用户绩效汇总", description = "参数:用户绩效汇总批量删除请求体,权限:管理员,方法名:delBatchUserPerformanceSummary")
|
||||
@PostMapping("staff/page")
|
||||
@Operation(summary = "Web端管理员根据主管id分页查询员工绩效汇总", description = "参数:员工绩效汇总查询请求体,权限:管理员,方法名:listStaffPerformanceSummaryByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "用户绩效汇总管理", content = "web端管理员批量删除用户绩效汇总")
|
||||
public BaseResponse<Boolean> delBatchUserPerformanceSummary(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
List<Long> ids = commonBatchRequest.getIds();
|
||||
userPerformanceSummaryService.removeByIds(ids);
|
||||
return ResultUtils.success(true);
|
||||
public BaseResponse<Page<UserPerformanceSummaryDetailVO>> listStaffPerformanceSummaryByPage(@Valid @RequestBody UserPerformanceSummaryStaffQueryRequest userPerformanceSummaryQueryRequest) {
|
||||
long current = userPerformanceSummaryQueryRequest.getCurrent();
|
||||
long pageSize = userPerformanceSummaryQueryRequest.getPageSize();
|
||||
String nickName = userPerformanceSummaryQueryRequest.getNickName();
|
||||
String phoneNumber = userPerformanceSummaryQueryRequest.getPhoneNumber();
|
||||
Long supervisorUserId = userPerformanceSummaryQueryRequest.getSupervisorUserId();
|
||||
|
||||
QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(nickName), "nickName", nickName);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(phoneNumber), "phoneNumber", phoneNumber);
|
||||
queryWrapper.eq("parentUserId", supervisorUserId);
|
||||
List<UserInfo> userInfoList = userInfoService.list(queryWrapper);
|
||||
List<Long> ids = userInfoList.stream().map(UserInfo::getId).toList();
|
||||
if (ids.isEmpty()) ids.add(-10L);
|
||||
|
||||
QueryWrapper<UserPerformanceSummary> userPerformanceSummaryQueryWrapper = userPerformanceSummaryService.getQueryWrapper(userPerformanceSummaryQueryRequest);
|
||||
userPerformanceSummaryQueryWrapper.in("userId", ids);
|
||||
Page<UserPerformanceSummary> page = userPerformanceSummaryService.page(new Page<>(current, pageSize), userPerformanceSummaryQueryWrapper);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = page.getRecords();
|
||||
List<UserPerformanceSummaryDetailVO> userPerformanceSummaryDetailVOS = commonService.convertList(userPerformanceSummaryList, UserPerformanceSummaryDetailVO.class);
|
||||
|
||||
// 封装Map集合(键:用户id, 值:用户信息)
|
||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
||||
for (UserPerformanceSummaryDetailVO userPerformanceSummaryDetailVO : userPerformanceSummaryDetailVOS) {
|
||||
UserInfo userInfo = userInfoMap.get(userPerformanceSummaryDetailVO.getUserId());
|
||||
userPerformanceSummaryDetailVO.setNickName(userInfo.getNickName());
|
||||
userPerformanceSummaryDetailVO.setPhoneNumber(userInfo.getPhoneNumber());
|
||||
}
|
||||
|
||||
Page<UserPerformanceSummaryDetailVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(userPerformanceSummaryDetailVOS);
|
||||
voPage.setPages(page.getPages());
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员根据id查询用户绩效汇总
|
||||
* @param commonRequest 用户绩效汇总查询请求体
|
||||
* @return 用户绩效汇总信息
|
||||
* Web端管理员根据员工id分页查询客户订单汇总
|
||||
* @param userPerformanceSummaryQueryRequest 员工绩效汇总查询请求体
|
||||
* @return 用户绩效汇总列表
|
||||
*/
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询用户绩效汇总", description = "参数:用户绩效汇总查询请求体,权限:管理员,方法名:queryUserPerformanceSummaryById")
|
||||
@PostMapping("user/page")
|
||||
@Operation(summary = "Web端管理员根据员工id分页查询客户订单汇总", description = "参数:用户绩效汇总查询请求体,权限:管理员,方法名:listUserPerformanceSummaryByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "用户绩效汇总管理", content = "web端管理员根据id查询用户绩效汇总")
|
||||
public BaseResponse<UserPerformanceSummaryVO> queryUserPerformanceSummaryById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
UserPerformanceSummary userPerformanceSummary = userPerformanceSummaryService.getById(id);
|
||||
UserPerformanceSummaryVO userPerformanceSummaryVO = commonService.copyProperties(userPerformanceSummary, UserPerformanceSummaryVO.class);
|
||||
return ResultUtils.success(userPerformanceSummaryVO);
|
||||
public BaseResponse<Page<CourseOrderBaseInfoVO>> listUserPerformanceSummaryByPage(@Valid @RequestBody UserCourseOrderQueryRequest userPerformanceSummaryQueryRequest) {
|
||||
long current = userPerformanceSummaryQueryRequest.getCurrent();
|
||||
long pageSize = userPerformanceSummaryQueryRequest.getPageSize();
|
||||
Long staffUserId = userPerformanceSummaryQueryRequest.getStaffUserId();
|
||||
|
||||
QueryWrapper<CourseOrder> courseOrderQueryWrapper = userPerformanceSummaryService.getCourseOrderQueryWrapper(userPerformanceSummaryQueryRequest);
|
||||
courseOrderQueryWrapper.in("orderStatus", OrderStatusConstant.SUCCESS, OrderStatusConstant.REFUNDED);
|
||||
|
||||
List<Long> ids = userInfoService.findAllSubUser(staffUserId);
|
||||
List<UserInfo> userInfoList = commonService.findByFieldInTargetField(ids, userInfoService, Function.identity(), UserInfo::getId);
|
||||
courseOrderQueryWrapper.in("userId", ids);
|
||||
|
||||
Page<CourseOrder> page = courseOrderService.page(new Page<>(current, pageSize), courseOrderQueryWrapper);
|
||||
List<CourseOrder> courseOrderList = page.getRecords();
|
||||
List<CourseOrderBaseInfoVO> courseOrderBaseInfoVOS = commonService.convertList(courseOrderList, CourseOrderBaseInfoVO.class);
|
||||
|
||||
// 封装Map集合(键:用户id, 值:用户信息)
|
||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
||||
for (CourseOrderBaseInfoVO courseOrderBaseInfoVO : courseOrderBaseInfoVOS) {
|
||||
UserInfo userInfo = userInfoMap.get(courseOrderBaseInfoVO.getUserId());
|
||||
courseOrderBaseInfoVO.setNickName(userInfo.getNickName());
|
||||
courseOrderBaseInfoVO.setPhoneNumber(userInfo.getPhoneNumber());
|
||||
}
|
||||
|
||||
Page<CourseOrderBaseInfoVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(courseOrderBaseInfoVOS);
|
||||
voPage.setPages(page.getPages());
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * Web端管理员分页查询用户绩效汇总
|
||||
// * @param userPerformanceSummaryQueryRequest 用户绩效汇总查询请求体
|
||||
// * Web端管理员分页查询主管绩效排名
|
||||
// * @param userPerformanceSummaryQueryRequest 主管绩效汇总查询请求体
|
||||
// * @return 用户绩效汇总列表
|
||||
// */
|
||||
// @PostMapping("page")
|
||||
// @Operation(summary = "Web端管理员分页查询用户绩效汇总", description = "参数:用户绩效汇总查询请求体,权限:管理员,方法名:listUserPerformanceSummaryByPage")
|
||||
// @PostMapping("user/page")
|
||||
// @Operation(summary = "Web端管理员分页查询主管绩效排名", description = "参数:用户绩效汇总查询请求体,权限:管理员,方法名:listUserPerformanceSummaryByPage")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "用户绩效汇总管理", content = "Web端管理员分页查询用户绩效汇总")
|
||||
// public BaseResponse<Page<UserPerformanceSummaryVO>> listUserPerformanceSummaryByPage(@Valid @RequestBody UserPerformanceSummaryQueryRequest userPerformanceSummaryQueryRequest) {
|
||||
// public BaseResponse<Page<CourseOrderBaseInfoVO>> listUserPerformanceSummaryByPage(@Valid @RequestBody UserCourseOrderQueryRequest userPerformanceSummaryQueryRequest) {
|
||||
// long current = userPerformanceSummaryQueryRequest.getCurrent();
|
||||
// long pageSize = userPerformanceSummaryQueryRequest.getPageSize();
|
||||
// QueryWrapper<UserPerformanceSummary> queryWrapper = userPerformanceSummaryService.getQueryWrapper(userPerformanceSummaryQueryRequest);
|
||||
// Page<UserPerformanceSummary> page = userPerformanceSummaryService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
// List<UserPerformanceSummary> userPerformanceSummaryList = page.getRecords();
|
||||
// List<UserPerformanceSummaryVO> userPerformanceSummaryVOList = commonService.convertList(userPerformanceSummaryList, UserPerformanceSummaryVO.class);
|
||||
// Page<UserPerformanceSummaryVO> voPage = new Page<>(current, pageSize);
|
||||
// voPage.setRecords(userPerformanceSummaryVOList);
|
||||
// Long staffUserId = userPerformanceSummaryQueryRequest.getStaffUserId();
|
||||
//
|
||||
// QueryWrapper<CourseOrder> courseOrderQueryWrapper = userPerformanceSummaryService.getCourseOrderQueryWrapper(userPerformanceSummaryQueryRequest);
|
||||
// courseOrderQueryWrapper.in("orderStatus", OrderStatusConstant.SUCCESS, OrderStatusConstant.REFUNDED);
|
||||
//
|
||||
// List<Long> ids = userInfoService.findAllSubUser(staffUserId);
|
||||
// List<UserInfo> userInfoList = commonService.findByFieldInTargetField(ids, userInfoService, Function.identity(), UserInfo::getId);
|
||||
// courseOrderQueryWrapper.in("userId", ids);
|
||||
//
|
||||
// Page<CourseOrder> page = courseOrderService.page(new Page<>(current, pageSize), courseOrderQueryWrapper);
|
||||
// List<CourseOrder> courseOrderList = page.getRecords();
|
||||
// List<CourseOrderBaseInfoVO> courseOrderBaseInfoVOS = commonService.convertList(courseOrderList, CourseOrderBaseInfoVO.class);
|
||||
//
|
||||
// // 封装Map集合(键:用户id, 值:用户信息)
|
||||
// Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
// for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
||||
// for (CourseOrderBaseInfoVO courseOrderBaseInfoVO : courseOrderBaseInfoVOS) {
|
||||
// UserInfo userInfo = userInfoMap.get(courseOrderBaseInfoVO.getUserId());
|
||||
// courseOrderBaseInfoVO.setNickName(userInfo.getNickName());
|
||||
// courseOrderBaseInfoVO.setPhoneNumber(userInfo.getPhoneNumber());
|
||||
// }
|
||||
//
|
||||
// Page<CourseOrderBaseInfoVO> voPage = new Page<>(current, pageSize);
|
||||
// voPage.setRecords(courseOrderBaseInfoVOS);
|
||||
// voPage.setPages(page.getPages());
|
||||
// voPage.setTotal(page.getTotal());
|
||||
// return ResultUtils.success(voPage);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端查询主管绩效汇总
|
||||
* @param miniUserPerformanceSummaryQueryRequest 主管绩效汇总查询请求体
|
||||
* @return 用户绩效汇总列表
|
||||
*/
|
||||
@PostMapping("query/supervisor")
|
||||
@Operation(summary = "小程序端用户根据主管id查询员工绩效汇总", description = "参数:主管绩效汇总查询请求体,权限:管理员,方法名:miniListPerformanceSummary")
|
||||
@RequiresPermission(mustRole = UserConstant.MANAGER_ROLE)
|
||||
public BaseResponse<List<UserPerformanceSummaryDetailVO>> miniListPerformanceSummary(@Valid @RequestBody MiniUserPerformanceSummaryQueryRequest miniUserPerformanceSummaryQueryRequest) {
|
||||
String nickName = miniUserPerformanceSummaryQueryRequest.getNickName();
|
||||
String phoneNumber = miniUserPerformanceSummaryQueryRequest.getPhoneNumber();
|
||||
|
||||
QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(nickName), "nickName", nickName);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(phoneNumber), "phoneNumber", phoneNumber);
|
||||
queryWrapper.eq("userRole", UserConstant.SUPERVISOR_ROLE);
|
||||
List<UserInfo> userInfoList = userInfoService.list(queryWrapper);
|
||||
List<Long> ids = userInfoList.stream().map(UserInfo::getId).toList();
|
||||
if (ids.isEmpty()) ids.add(-10L);
|
||||
|
||||
QueryWrapper<UserPerformanceSummary> userPerformanceSummaryQueryWrapper = new QueryWrapper<>();
|
||||
userPerformanceSummaryQueryWrapper.in("userId", ids);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = userPerformanceSummaryService.list(userPerformanceSummaryQueryWrapper);
|
||||
List<UserPerformanceSummaryDetailVO> userPerformanceSummaryDetailVOS = commonService.convertList(userPerformanceSummaryList, UserPerformanceSummaryDetailVO.class);
|
||||
|
||||
// 封装Map集合(键:用户id, 值:用户信息)
|
||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
||||
for (UserPerformanceSummaryDetailVO userPerformanceSummaryDetailVO : userPerformanceSummaryDetailVOS) {
|
||||
UserInfo userInfo = userInfoMap.get(userPerformanceSummaryDetailVO.getUserId());
|
||||
userPerformanceSummaryDetailVO.setNickName(userInfo.getNickName());
|
||||
userPerformanceSummaryDetailVO.setPhoneNumber(userInfo.getPhoneNumber());
|
||||
}
|
||||
return ResultUtils.success(userPerformanceSummaryDetailVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端主管查询员工绩效汇总
|
||||
* @param miniUserPerformanceSummaryStaffQueryRequest 员工绩效汇总查询请求体
|
||||
* @return 用户绩效汇总列表
|
||||
*/
|
||||
@PostMapping("query/staff")
|
||||
@Operation(summary = "小程序端主管查询员工绩效汇总", description = "参数:员工绩效汇总查询请求体,权限:管理员,方法名:miniListStaffPerformanceSummary")
|
||||
@RequiresPermission(mustRole = UserConstant.SUPERVISOR_ROLE)
|
||||
public BaseResponse<List<UserPerformanceSummaryDetailVO>> miniListStaffPerformanceSummary(@Valid @RequestBody MiniUserPerformanceSummaryStaffQueryRequest miniUserPerformanceSummaryStaffQueryRequest) {
|
||||
String nickName = miniUserPerformanceSummaryStaffQueryRequest.getNickName();
|
||||
String phoneNumber = miniUserPerformanceSummaryStaffQueryRequest.getPhoneNumber();
|
||||
Long supervisorUserId = miniUserPerformanceSummaryStaffQueryRequest.getSupervisorUserId();
|
||||
|
||||
QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(nickName), "nickName", nickName);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(phoneNumber), "phoneNumber", phoneNumber);
|
||||
queryWrapper.eq("parentUserId", supervisorUserId);
|
||||
List<UserInfo> userInfoList = userInfoService.list(queryWrapper);
|
||||
List<Long> ids = userInfoList.stream().map(UserInfo::getId).toList();
|
||||
if (ids.isEmpty()) ids.add(-10L);
|
||||
|
||||
QueryWrapper<UserPerformanceSummary> userPerformanceSummaryQueryWrapper = new QueryWrapper<>();
|
||||
userPerformanceSummaryQueryWrapper.in("userId", ids);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = userPerformanceSummaryService.list(userPerformanceSummaryQueryWrapper);
|
||||
List<UserPerformanceSummaryDetailVO> userPerformanceSummaryDetailVOS = commonService.convertList(userPerformanceSummaryList, UserPerformanceSummaryDetailVO.class);
|
||||
|
||||
// 封装Map集合(键:用户id, 值:用户信息)
|
||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
||||
for (UserPerformanceSummaryDetailVO userPerformanceSummaryDetailVO : userPerformanceSummaryDetailVOS) {
|
||||
UserInfo userInfo = userInfoMap.get(userPerformanceSummaryDetailVO.getUserId());
|
||||
userPerformanceSummaryDetailVO.setNickName(userInfo.getNickName());
|
||||
userPerformanceSummaryDetailVO.setPhoneNumber(userInfo.getPhoneNumber());
|
||||
}
|
||||
return ResultUtils.success(userPerformanceSummaryDetailVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端员工查询客户下单汇总
|
||||
* @param miniUserCourseOrderQueryRequest 员工绩效汇总查询请求体
|
||||
* @return 用户绩效汇总列表
|
||||
*/
|
||||
@PostMapping("query/user")
|
||||
@Operation(summary = "小程序端员工查询客户下单汇总", description = "参数:员工绩效汇总查询请求体,权限:管理员,方法名:miniListUserPerformanceSummary")
|
||||
@RequiresPermission(mustRole = UserConstant.STAFF_ROLE)
|
||||
public BaseResponse<List<CourseOrderBaseInfoVO>> miniListUserPerformanceSummary(@Valid @RequestBody MiniUserCourseOrderQueryRequest miniUserCourseOrderQueryRequest) {
|
||||
String orderNumber = miniUserCourseOrderQueryRequest.getOrderNumber();
|
||||
Long staffUserId = miniUserCourseOrderQueryRequest.getStaffUserId();
|
||||
QueryWrapper<CourseOrder> courseOrderQueryWrapper = new QueryWrapper<>();
|
||||
courseOrderQueryWrapper.eq(StringUtils.isNotBlank(orderNumber), "orderNumber", orderNumber);
|
||||
courseOrderQueryWrapper.in("orderStatus", OrderStatusConstant.SUCCESS, OrderStatusConstant.REFUNDED);
|
||||
|
||||
List<Long> ids = userInfoService.findAllSubUser(staffUserId);
|
||||
List<UserInfo> userInfoList = commonService.findByFieldInTargetField(ids, userInfoService, Function.identity(), UserInfo::getId);
|
||||
courseOrderQueryWrapper.in("userId", ids);
|
||||
|
||||
List<CourseOrder> courseOrderList = courseOrderService.list(courseOrderQueryWrapper);
|
||||
List<CourseOrderBaseInfoVO> courseOrderBaseInfoVOS = commonService.convertList(courseOrderList, CourseOrderBaseInfoVO.class);
|
||||
|
||||
// 封装Map集合(键:用户id, 值:用户信息)
|
||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
||||
for (CourseOrderBaseInfoVO courseOrderBaseInfoVO : courseOrderBaseInfoVOS) {
|
||||
UserInfo userInfo = userInfoMap.get(courseOrderBaseInfoVO.getUserId());
|
||||
courseOrderBaseInfoVO.setNickName(userInfo.getNickName());
|
||||
courseOrderBaseInfoVO.setPhoneNumber(userInfo.getPhoneNumber());
|
||||
}
|
||||
return ResultUtils.success(courseOrderBaseInfoVOS);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -20,6 +20,12 @@ public interface UserInfoMapper extends BaseMapper<UserInfo> {
|
||||
List<Long> findPathToRoot(Long userId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前用户的所有下级用户(包括间接)
|
||||
*/
|
||||
List<Long> findAllSubUser(Long userId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 客户下单汇总查询请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "客户下单汇总查询请求体", requiredProperties = {"nickName", "phoneNumber"})
|
||||
public class MiniUserCourseOrderQueryRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202502345023453428745832")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
@NotNull(message = "主管用户id不能为null")
|
||||
@Schema(description = "员工id", example = "1")
|
||||
private Long staffUserId;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 主管绩效汇总查询请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "主管绩效汇总查询请求体", requiredProperties = {"nickName", "phoneNumber"})
|
||||
public class MiniUserPerformanceSummaryQueryRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 员工绩效汇总查询请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "员工绩效汇总查询请求体", requiredProperties = {"nickName", "phoneNumber"})
|
||||
public class MiniUserPerformanceSummaryStaffQueryRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 主管用户id
|
||||
*/
|
||||
@NotNull(message = "主管用户id不能为null")
|
||||
@Schema(description = "主管用户id", example = "1")
|
||||
private Long supervisorUserId;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 客户下单汇总查询请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "客户下单汇总查询请求体", requiredProperties = {"nickName", "phoneNumber"})
|
||||
public class UserCourseOrderQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202502345023453428745832")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 起始日期
|
||||
*/
|
||||
@Schema(description = "起始日期", example = "2025-02-29 10:00:00")
|
||||
private String startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
@Schema(description = "结束日期", example = "2025-02-29 10:00:00")
|
||||
private String endDate;
|
||||
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
@NotNull(message = "主管用户id不能为null")
|
||||
@Schema(description = "员工id", example = "1")
|
||||
private Long staffUserId;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -11,85 +11,23 @@ import java.io.Serializable;
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
|
||||
/**
|
||||
* 用户绩效汇总查询请求体,继承自分页请求 PageRequest
|
||||
* 主管绩效汇总查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "用户绩效汇总查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
@Schema(description = "主管绩效汇总查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class UserPerformanceSummaryQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
* 姓名
|
||||
*/
|
||||
@Min(value = 1L, message = "用户ID ID不能小于1")
|
||||
@Schema(description = "用户ID", example = "")
|
||||
private Long id;
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 净成交
|
||||
*/
|
||||
@Schema(description = "净成交", example = "")
|
||||
private BigDecimal netAmount;
|
||||
|
||||
/**
|
||||
* 推广人数
|
||||
*/
|
||||
@Schema(description = "推广人数", example = "")
|
||||
private Integer promoCount;
|
||||
|
||||
/**
|
||||
* 主管数量
|
||||
*/
|
||||
@Schema(description = "主管数量", example = "")
|
||||
private Integer superCount;
|
||||
|
||||
/**
|
||||
* 员工数量
|
||||
*/
|
||||
@Schema(description = "员工数量", example = "")
|
||||
private Integer empCount;
|
||||
|
||||
/**
|
||||
* 下单数量
|
||||
*/
|
||||
@Schema(description = "下单数量", example = "")
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 待释放
|
||||
*/
|
||||
@Schema(description = "待释放", example = "")
|
||||
private BigDecimal toRelease;
|
||||
|
||||
/**
|
||||
* 可结算
|
||||
*/
|
||||
@Schema(description = "可结算", example = "")
|
||||
private BigDecimal toSettle;
|
||||
|
||||
/**
|
||||
* 已结算
|
||||
*/
|
||||
@Schema(description = "已结算", example = "")
|
||||
private BigDecimal settled;
|
||||
|
||||
/**
|
||||
* 已回退
|
||||
*/
|
||||
@Schema(description = "已回退", example = "")
|
||||
private BigDecimal refunded;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Min(value = 1L, message = "用户id ID不能小于1")
|
||||
@Schema(description = "用户id", example = "")
|
||||
private Long userId;
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
|
||||
@Serial
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 主管绩效排名查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "主管绩效排名查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class UserPerformanceSummaryRankQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 起始日期
|
||||
*/
|
||||
@Schema(description = "起始日期", example = "2025-02-29 10:00:00")
|
||||
private String startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
@Schema(description = "结束日期", example = "2025-02-29 10:00:00")
|
||||
private String endDate;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 员工绩效汇总查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "员工绩效汇总查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class UserPerformanceSummaryStaffQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 主管用户id
|
||||
*/
|
||||
@NotNull(message = "主管用户id不能为null")
|
||||
@Schema(description = "主管用户id", example = "1")
|
||||
private Long supervisorUserId;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.greenorange.promotion.model.vo.courseOrder;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CourseOrderBaseInfoVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 课程订单ID
|
||||
*/
|
||||
@Schema(description = "课程订单ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Schema(description = "昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202506241339232334d234234243")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "100.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 订单状态[交易关闭,交易成功,待支付,已退款]
|
||||
*/
|
||||
@Schema(description = "订单状态[交易关闭,交易成功,待支付,已退款]", example = "交易成功")
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id", example = "1")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package com.greenorange.promotion.model.vo.userPerformanceSummary;
|
||||
|
||||
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 UserPerformanceSummaryDetailVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户绩效汇总ID
|
||||
*/
|
||||
@Schema(description = "用户绩效汇总ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "15.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 净成交
|
||||
*/
|
||||
@Schema(description = "净成交", example = "20.00")
|
||||
private BigDecimal netAmount;
|
||||
|
||||
/**
|
||||
* 推广人数
|
||||
*/
|
||||
@Schema(description = "推广人数", example = "300")
|
||||
private Integer promoCount;
|
||||
|
||||
/**
|
||||
* 主管数量
|
||||
*/
|
||||
@Schema(description = "主管数量", example = "5")
|
||||
private Integer superCount;
|
||||
|
||||
/**
|
||||
* 员工数量
|
||||
*/
|
||||
@Schema(description = "员工数量", example = "20")
|
||||
private Integer empCount;
|
||||
|
||||
/**
|
||||
* 下单数量
|
||||
*/
|
||||
@Schema(description = "下单数量", example = "100")
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 待释放
|
||||
*/
|
||||
@Schema(description = "待释放", example = "10.00")
|
||||
private BigDecimal toRelease;
|
||||
|
||||
/**
|
||||
* 可结算
|
||||
*/
|
||||
@Schema(description = "可结算", example = "30.00")
|
||||
private BigDecimal toSettle;
|
||||
|
||||
/**
|
||||
* 已结算
|
||||
*/
|
||||
@Schema(description = "已结算", example = "40.00")
|
||||
private BigDecimal settled;
|
||||
|
||||
/**
|
||||
* 已回退
|
||||
*/
|
||||
@Schema(description = "已回退", example = "20.00")
|
||||
private BigDecimal refunded;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id", example = "1")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -67,12 +67,6 @@ public interface UserInfoService extends IService<UserInfo> {
|
||||
String getVerificationCodeForRegister(String phoneNumber);
|
||||
|
||||
|
||||
/**
|
||||
* 查询从 userId 一路到根节点的所有 id,按 depth 倒序(根先出)
|
||||
*/
|
||||
List<Long> findPathToRoot(Long userId);
|
||||
|
||||
|
||||
/**
|
||||
* 校验用户手机号和验证码
|
||||
*/
|
||||
@ -95,4 +89,16 @@ public interface UserInfoService extends IService<UserInfo> {
|
||||
* 获取小程序用户的查询条件
|
||||
*/
|
||||
LambdaQueryWrapper<UserInfo> getMiniUserInfoQueryWrapper();
|
||||
|
||||
|
||||
/**
|
||||
* 查询从 userId 一路到根节点的所有 id,按 depth 倒序(根先出)
|
||||
*/
|
||||
List<Long> findPathToRoot(Long userId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前用户的所有下级用户(包括间接)
|
||||
*/
|
||||
List<Long> findAllSubUser(Long userId);
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.greenorange.promotion.service.userInfo;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import com.greenorange.promotion.model.dto.userPerformanceSummary.MiniUserCourseOrderQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.userPerformanceSummary.UserCourseOrderQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.greenorange.promotion.model.entity.UserPerformanceSummary;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@ -10,4 +15,14 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface UserPerformanceSummaryService extends IService<UserPerformanceSummary> {
|
||||
|
||||
/**
|
||||
* 获取主管查询条件
|
||||
*/
|
||||
QueryWrapper<UserPerformanceSummary> getQueryWrapper(PageRequest pageRequest);
|
||||
|
||||
|
||||
/**
|
||||
* 获取课程订单的查询条件
|
||||
*/
|
||||
QueryWrapper<CourseOrder> getCourseOrderQueryWrapper(UserCourseOrderQueryRequest userCourseOrderQueryRequest);
|
||||
}
|
||||
|
@ -294,16 +294,6 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询从 userId 一路到根节点的所有 id,按 depth 倒序(根先出)
|
||||
*/
|
||||
@Override
|
||||
public List<Long> findPathToRoot(Long userId) {
|
||||
return userInfoMapper.findPathToRoot(userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序用户获取验证码(用于注册)
|
||||
*/
|
||||
@ -521,6 +511,24 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询从 userId 一路到根节点的所有 id,按 depth 倒序(根先出)
|
||||
*/
|
||||
@Override
|
||||
public List<Long> findPathToRoot(Long userId) {
|
||||
return userInfoMapper.findPathToRoot(userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前用户的所有下级用户(包括间接)
|
||||
*/
|
||||
@Override
|
||||
public List<Long> findAllSubUser(Long userId) {
|
||||
return userInfoMapper.findAllSubUser(userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +1,21 @@
|
||||
package com.greenorange.promotion.service.userInfo.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import com.greenorange.promotion.constant.CommonConstant;
|
||||
import com.greenorange.promotion.model.dto.userPerformanceSummary.MiniUserCourseOrderQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.userPerformanceSummary.UserCourseOrderQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.greenorange.promotion.model.entity.UserPerformanceSummary;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import com.greenorange.promotion.service.userInfo.UserPerformanceSummaryService;
|
||||
import com.greenorange.promotion.mapper.UserPerformanceSummaryMapper;
|
||||
import com.greenorange.promotion.utils.SqlUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@ -15,6 +27,36 @@ import org.springframework.stereotype.Service;
|
||||
public class UserPerformanceSummaryServiceImpl extends ServiceImpl<UserPerformanceSummaryMapper, UserPerformanceSummary>
|
||||
implements UserPerformanceSummaryService{
|
||||
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
@Override
|
||||
public QueryWrapper<UserPerformanceSummary> getQueryWrapper(PageRequest pageRequest) {
|
||||
String sortField = pageRequest.getSortField();
|
||||
String sortOrder = pageRequest.getSortOrder();
|
||||
QueryWrapper<UserPerformanceSummary> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC), sortField);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取课程订单的查询条件
|
||||
*/
|
||||
@Override
|
||||
public QueryWrapper<CourseOrder> getCourseOrderQueryWrapper(UserCourseOrderQueryRequest userCourseOrderQueryRequest) {
|
||||
String orderNumber = userCourseOrderQueryRequest.getOrderNumber();
|
||||
String startTimeStr = userCourseOrderQueryRequest.getStartDate();
|
||||
String endTimeStr = userCourseOrderQueryRequest.getEndDate();
|
||||
DateTime startDate = DateUtil.parse(startTimeStr, "yyyy-MM-dd HH:mm:ss");
|
||||
DateTime endDate = DateUtil.parse(endTimeStr, "yyyy-MM-dd HH:mm:ss");
|
||||
QueryWrapper<CourseOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(orderNumber), "orderNumber", orderNumber);
|
||||
queryWrapper.ge(StringUtils.isNotBlank(startTimeStr), "createTime", startDate);
|
||||
queryWrapper.le(StringUtils.isNotBlank(endTimeStr), "createTime", endDate);
|
||||
return queryWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,4 +46,20 @@
|
||||
FROM user_path
|
||||
ORDER BY depth DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="findAllSubUser" resultType="java.lang.Long">
|
||||
WITH RECURSIVE Subordinates AS (
|
||||
SELECT id
|
||||
FROM user_info
|
||||
WHERE id = #{userId} -- 你查询的起始用户id
|
||||
UNION ALL
|
||||
SELECT u.id
|
||||
FROM user_info u
|
||||
INNER JOIN Subordinates s ON s.id = u.parentUserId
|
||||
)
|
||||
SELECT id FROM Subordinates;
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user