修复了一系列bug
This commit is contained in:
@ -16,15 +16,27 @@ public class CorsConfig {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public FilterRegistrationBean<CorsFilter> corsFilter() {
|
public FilterRegistrationBean<CorsFilter> corsFilter() {
|
||||||
|
// 1. 准备一个“规则源”,用于给不同路径配置 CORS 规则
|
||||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
|
// 2. 创建一个“跨域配置”对象,往里填各种允许/不允许的选项
|
||||||
CorsConfiguration config = new CorsConfiguration();
|
CorsConfiguration config = new CorsConfiguration();
|
||||||
// 携带cookie
|
// 【允许携带 Cookie 这类 “凭证”】
|
||||||
config.setAllowCredentials(true);
|
config.setAllowCredentials(true);
|
||||||
// 放行哪些域名(必须用 patterns,否则 * 会和 allowCredentials 冲突)
|
// 【允许的来源域名】
|
||||||
|
// 用通配符 "*",表示不管从哪个域来的,都允许。
|
||||||
|
// 这里用的是 addAllowedOriginPattern,而不是 addAllowedOrigin,
|
||||||
|
// 是为了和 allowCredentials(true) 一起使用时不报错。
|
||||||
config.addAllowedOriginPattern("*");
|
config.addAllowedOriginPattern("*");
|
||||||
|
// 【允许的请求头】
|
||||||
|
// 客户端可以带哪些自定义的 HTTP 头,比如 Content-Type、X-Token…
|
||||||
config.addAllowedHeader("*");
|
config.addAllowedHeader("*");
|
||||||
|
// 【允许的请求方法】
|
||||||
|
// GET、POST、PUT、DELETE、OPTIONS……所有都放行
|
||||||
config.addAllowedMethod("*");
|
config.addAllowedMethod("*");
|
||||||
|
// 把上面这套“跨域规则”注册到所有接口路径(/**)
|
||||||
source.registerCorsConfiguration("/**", config);
|
source.registerCorsConfiguration("/**", config);
|
||||||
|
// 3.用这套规则,创建一个 CorsFilter 过滤器,
|
||||||
|
// 4.并把它交给 Spring 管理,优先级设为最高
|
||||||
FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<>(new CorsFilter(source));
|
FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<>(new CorsFilter(source));
|
||||||
bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
||||||
return bean;
|
return bean;
|
||||||
|
@ -373,6 +373,8 @@ public class UserPerformanceSummaryController {
|
|||||||
public BaseResponse<Page<SupervisorPerformanceSummaryVO>> listStaffUserPerformanceSummaryRankingsByPage(@Valid @RequestBody UserPerformanceSummaryRankQueryRequest userPerformanceSummaryRankQueryRequest) {
|
public BaseResponse<Page<SupervisorPerformanceSummaryVO>> listStaffUserPerformanceSummaryRankingsByPage(@Valid @RequestBody UserPerformanceSummaryRankQueryRequest userPerformanceSummaryRankQueryRequest) {
|
||||||
String startTimeStr = userPerformanceSummaryRankQueryRequest.getStartDate();
|
String startTimeStr = userPerformanceSummaryRankQueryRequest.getStartDate();
|
||||||
String endTimeStr = userPerformanceSummaryRankQueryRequest.getEndDate();
|
String endTimeStr = userPerformanceSummaryRankQueryRequest.getEndDate();
|
||||||
|
String nickName = userPerformanceSummaryRankQueryRequest.getNickName();
|
||||||
|
String phoneNumber = userPerformanceSummaryRankQueryRequest.getPhoneNumber();
|
||||||
DateTime startDate = null;
|
DateTime startDate = null;
|
||||||
DateTime endDate = null;
|
DateTime endDate = null;
|
||||||
boolean isAddDate = true;
|
boolean isAddDate = true;
|
||||||
@ -429,7 +431,11 @@ public class UserPerformanceSummaryController {
|
|||||||
}
|
}
|
||||||
staffNetSalesAmountMap.merge(secondUserId, totalAmount, BigDecimal::add);
|
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);
|
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(userInfoList, userPerformanceSummaryService, UserInfo::getId, UserPerformanceSummary::getUserId);
|
||||||
|
|
||||||
// 封装Map集合(键:主管id, 用户信息)
|
// 封装Map集合(键:主管id, 用户信息)
|
||||||
|
Reference in New Issue
Block a user