修复了一系列bug

This commit is contained in:
2025-07-20 08:57:30 +08:00
parent c386ba4bd8
commit 104a2b573e
2 changed files with 21 additions and 3 deletions

View File

@ -16,15 +16,27 @@ public class CorsConfig {
@Bean
public FilterRegistrationBean<CorsFilter> corsFilter() {
// 1. 准备一个“规则源”,用于给不同路径配置 CORS 规则
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
// 2. 创建一个“跨域配置”对象,往里填各种允许/不允许的选项
CorsConfiguration config = new CorsConfiguration();
// 携带cookie
// 【允许携带 Cookie 这类 “凭证”】
config.setAllowCredentials(true);
// 放行哪些域名(必须用 patterns否则 * 会和 allowCredentials 冲突)
// 【允许的来源域名】
// 用通配符 "*",表示不管从哪个域来的,都允许。
// 这里用的是 addAllowedOriginPattern而不是 addAllowedOrigin
// 是为了和 allowCredentials(true) 一起使用时不报错。
config.addAllowedOriginPattern("*");
// 【允许的请求头】
// 客户端可以带哪些自定义的 HTTP 头,比如 Content-Type、X-Token…
config.addAllowedHeader("*");
// 【允许的请求方法】
// GET、POST、PUT、DELETE、OPTIONS……所有都放行
config.addAllowedMethod("*");
// 把上面这套“跨域规则”注册到所有接口路径(/**
source.registerCorsConfiguration("/**", config);
// 3.用这套规则,创建一个 CorsFilter 过滤器,
// 4.并把它交给 Spring 管理,优先级设为最高
FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<>(new CorsFilter(source));
bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
return bean;

View File

@ -373,6 +373,8 @@ public class UserPerformanceSummaryController {
public BaseResponse<Page<SupervisorPerformanceSummaryVO>> listStaffUserPerformanceSummaryRankingsByPage(@Valid @RequestBody UserPerformanceSummaryRankQueryRequest userPerformanceSummaryRankQueryRequest) {
String startTimeStr = userPerformanceSummaryRankQueryRequest.getStartDate();
String endTimeStr = userPerformanceSummaryRankQueryRequest.getEndDate();
String nickName = userPerformanceSummaryRankQueryRequest.getNickName();
String phoneNumber = userPerformanceSummaryRankQueryRequest.getPhoneNumber();
DateTime startDate = null;
DateTime endDate = null;
boolean isAddDate = true;
@ -429,7 +431,11 @@ public class UserPerformanceSummaryController {
}
staffNetSalesAmountMap.merge(secondUserId, totalAmount, BigDecimal::add);
}
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.STAFF_ROLE, userInfoService);
LambdaQueryWrapper<UserInfo> userInfoQueryWrapper = new LambdaQueryWrapper<>();
userInfoQueryWrapper.eq(StringUtils.isNotBlank(nickName), UserInfo::getNickName, nickName)
.eq(StringUtils.isNotBlank(phoneNumber), UserInfo::getPhoneNumber, phoneNumber)
.eq(UserInfo::getUserRole, UserConstant.STAFF_ROLE);
List<UserInfo> userInfoList = userInfoService.list(userInfoQueryWrapper);
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(userInfoList, userPerformanceSummaryService, UserInfo::getId, UserPerformanceSummary::getUserId);
// 封装Map集合主管id, 用户信息)