修复了web端绩效查询的bug

This commit is contained in:
2025-07-14 11:49:39 +08:00
parent fd0504f477
commit 74976f5085
4 changed files with 45 additions and 216 deletions

View File

@ -42,6 +42,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -96,26 +97,26 @@ public class UserPerformanceSummaryController {
/**
* Web端管理员分页查询主管绩效汇总
* @param userPerformanceSummaryQueryRequest 主管绩效汇总查询请求体
* @param userPerformanceSummarySupervisorQueryRequest 主管绩效汇总查询请求体
* @return 用户绩效汇总列表
*/
@PostMapping("supervisor/page")
@Operation(summary = "Web端管理员分页查询主管绩效汇总", description = "参数主管绩效汇总查询请求体权限管理员方法名listSupervisorPerformanceSummaryByPage")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
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();
public BaseResponse<Page<UserPerformanceSummaryDetailVO>> listSupervisorPerformanceSummaryByPage(@Valid @RequestBody UserPerformanceSummarySupervisorQueryRequest userPerformanceSummarySupervisorQueryRequest) {
long current = userPerformanceSummarySupervisorQueryRequest.getCurrent();
long pageSize = userPerformanceSummarySupervisorQueryRequest.getPageSize();
String nickName = userPerformanceSummarySupervisorQueryRequest.getNickName();
String phoneNumber = userPerformanceSummarySupervisorQueryRequest.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();
List<Long> ids = userInfoList.stream().map(UserInfo::getId).collect(Collectors.toList());
if (ids.isEmpty()) ids.add(-10L);
QueryWrapper<UserPerformanceSummary> userPerformanceSummaryQueryWrapper = userPerformanceSummaryService.getQueryWrapper(userPerformanceSummaryQueryRequest);
QueryWrapper<UserPerformanceSummary> userPerformanceSummaryQueryWrapper = userPerformanceSummaryService.getQueryWrapper(userPerformanceSummarySupervisorQueryRequest);
userPerformanceSummaryQueryWrapper.in("userId", ids);
Page<UserPerformanceSummary> page = userPerformanceSummaryService.page(new Page<>(current, pageSize), userPerformanceSummaryQueryWrapper);
List<UserPerformanceSummary> userPerformanceSummaryList = page.getRecords();
@ -159,7 +160,7 @@ public class UserPerformanceSummaryController {
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();
List<Long> ids = userInfoList.stream().map(UserInfo::getId).collect(Collectors.toList());
if (ids.isEmpty()) ids.add(-10L);
QueryWrapper<UserPerformanceSummary> userPerformanceSummaryQueryWrapper = userPerformanceSummaryService.getQueryWrapper(userPerformanceSummaryQueryRequest);
@ -527,7 +528,7 @@ public class UserPerformanceSummaryController {
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();
List<Long> ids = userInfoList.stream().map(UserInfo::getId).collect(Collectors.toList());
if (ids.isEmpty()) ids.add(-10L);
QueryWrapper<UserPerformanceSummary> userPerformanceSummaryQueryWrapper = new QueryWrapper<>();
@ -565,7 +566,7 @@ public class UserPerformanceSummaryController {
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();
List<Long> ids = userInfoList.stream().map(UserInfo::getId).collect(Collectors.toList());
if (ids.isEmpty()) ids.add(-10L);
QueryWrapper<UserPerformanceSummary> userPerformanceSummaryQueryWrapper = new QueryWrapper<>();

View File

@ -1,102 +0,0 @@
package com.greenorange.promotion.model.dto.userPerformanceSummary;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serial;
import java.io.Serializable;
/**
* 用户绩效汇总添加请求体
*/
@Data
@Schema(description = "用户绩效汇总添加请求体", requiredProperties = {
"totalAmount",
"netAmount",
"promoCount",
"superCount",
"empCount",
"orderCount",
"toRelease",
"toSettle",
"settled",
"refunded",
"userId",
})
public class UserPerformanceSummaryAddRequest implements Serializable {
/**
* 订单总金额
*/
@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;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,33 @@
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 UserPerformanceSummarySupervisorQueryRequest extends PageRequest implements Serializable {
/**
* 姓名
*/
@Schema(description = "姓名", example = "chenxinzhi")
private String nickName;
/**
* 手机号
*/
@Schema(description = "手机号", example = "15888610253")
private String phoneNumber;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -1,103 +0,0 @@
package com.greenorange.promotion.model.dto.userPerformanceSummary;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serial;
import java.io.Serializable;
/**
* 用户绩效汇总更新请求体
*/
@Data
@Schema(description = "用户绩效汇总更新请求体", requiredProperties = {
"id",
"totalAmount",
"netAmount",
"promoCount",
"superCount",
"empCount",
"orderCount",
"toRelease",
"toSettle",
"settled",
"refunded",
"userId",
})
public class UserPerformanceSummaryUpdateRequest implements Serializable {
/**
* 用户ID
*/
@Min(value = 1L, message = "用户ID ID不能小于1")
@Schema(description = "用户ID", example = "")
private Long id;
/**
* 订单总金额
*/
@Schema(description = "订单总金额", example = "")
private BigDecimal totalAmount;
/**
* 净成交
*/
@Schema(description = "净成交", example = "")
private BigDecimal netAmount;
/**
* 推广人数
*/
@Schema(description = "推广人数", example = "")
private Integer promoCount;
/**
* 员工数量
*/
@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;
@Serial
private static final long serialVersionUID = 1L;
}