From 6520e6fc9298450d36b0276447b190ce44ee6093 Mon Sep 17 00:00:00 2001 From: taozi <9108791@qq.com> Date: Sun, 14 Aug 2022 22:31:27 +0800 Subject: [PATCH] =?UTF-8?q?springboot=E5=8D=87=E7=BA=A7=E5=88=B02.7.2?= =?UTF-8?q?=E3=80=81=E5=94=AE=E5=90=8Ebug=E5=A4=84=E7=90=86=E3=80=81?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E6=8E=92=E5=BA=8F=E4=BF=AE=E5=A4=8D=E3=80=81?= =?UTF-8?q?SecurityConfig=E5=85=BC=E5=AE=B9=E6=96=B0=E7=9A=84=E5=86=99?= =?UTF-8?q?=E6=B3=95=E3=80=81=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5=E6=B2=A1?= =?UTF-8?q?=E9=85=8D=E7=BD=AEgroup=E5=87=BD=E6=95=B0=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- .../modules/security/config/SecurityConfig.java | 14 ++++++++------ .../order/service/mapper/StoreOrderMapper.java | 12 ++++++------ .../service/impl/StoreAfterSalesServiceImpl.java | 4 ++-- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 904f6283..6369e8da 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.springframework.boot spring-boot-starter-parent - 2.6.7 + 2.7.2 @@ -38,7 +38,7 @@ 3.3.0 3.0.0 1.2.83 - 1.2.9 + 1.2.11 5.5.7 4.1.2 2.5.0 diff --git a/yshop-admin/src/main/java/co/yixiang/modules/security/config/SecurityConfig.java b/yshop-admin/src/main/java/co/yixiang/modules/security/config/SecurityConfig.java index 26a711fb..10ad06da 100644 --- a/yshop-admin/src/main/java/co/yixiang/modules/security/config/SecurityConfig.java +++ b/yshop-admin/src/main/java/co/yixiang/modules/security/config/SecurityConfig.java @@ -17,11 +17,11 @@ import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.core.GrantedAuthorityDefaults; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.web.filter.CorsFilter; import org.springframework.web.method.HandlerMethod; @@ -38,7 +38,7 @@ import java.util.Set; @Configuration(proxyBeanMethods = false) @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) -public class SecurityConfig extends WebSecurityConfigurerAdapter { +public class SecurityConfig { private final TokenUtil tokenUtil; private final CorsFilter corsFilter; @@ -66,8 +66,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { return new BCryptPasswordEncoder(); } - @Override - protected void configure(HttpSecurity httpSecurity) throws Exception { + @Bean + SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { // 搜寻匿名标记 url: @AnonymousAccess Map handlerMethodMap = applicationContext.getBean(RequestMappingHandlerMapping.class).getHandlerMethods(); Set anonymousUrls = new HashSet<>(); @@ -78,7 +78,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { anonymousUrls.addAll(infoEntry.getKey().getPatternsCondition().getPatterns()); } } - httpSecurity + return httpSecurity // 禁用 CSRF .csrf().disable() .addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class) @@ -130,7 +130,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers(anonymousUrls.toArray(new String[0])).permitAll() // 所有请求都需要认证 .anyRequest().authenticated() - .and().apply(securityConfigurerAdapter()); + .and().apply(securityConfigurerAdapter()) + .and() + .build(); } private TokenConfigurer securityConfigurerAdapter() { diff --git a/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderMapper.java b/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderMapper.java index 474b32ba..e0fae038 100644 --- a/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderMapper.java +++ b/yshop-mall/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderMapper.java @@ -60,15 +60,15 @@ public interface StoreOrderMapper extends CoreMapper { Double sumTotalPrice(); @Select("SELECT IFNULL(sum(pay_price),0) as num," + - "DATE_FORMAT(create_time, '%m-%d') as time " + + "DATE_FORMAT(ANY_VALUE(create_time), '%m-%d') as time " + " FROM yx_store_order where refund_status=0 and is_del=0 and paid=1 and pay_time >= #{time}" + - " GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') " + - " ORDER BY create_time ASC") + " GROUP BY DATE_FORMAT(ANY_VALUE(create_time),'%Y-%m-%d') " + + " ORDER BY ANY_VALUE(create_time) ASC") List chartList(@Param("time") Date time); @Select("SELECT count(id) as num," + - "DATE_FORMAT(create_time, '%m-%d') as time " + + "DATE_FORMAT(ANY_VALUE(create_time), '%m-%d') as time " + " FROM yx_store_order where refund_status=0 and is_del=0 and paid=1 and pay_time >= #{time}" + - " GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') " + - " ORDER BY create_time ASC") + " GROUP BY DATE_FORMAT(ANY_VALUE(create_time),'%Y-%m-%d') " + + " ORDER BY ANY_VALUE(create_time) ASC") List chartListT(@Param("time") Date time); } diff --git a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java index 3f6ababa..bbd8c665 100644 --- a/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java +++ b/yshop-mall/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java @@ -247,7 +247,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpllambdaQuery().eq(YxStoreOrder::getOrderId, key)); - yxStoreOrder.setStatus(OrderInfoEnum.STATUS_0.getValue()); + // yxStoreOrder.setStatus(OrderInfoEnum.STATUS_0.getValue()); yxStoreOrder.setRefundStatus(OrderInfoEnum.STATUS_0.getValue()); storeOrderMapper.updateById(yxStoreOrder); @@ -323,7 +323,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl