springboot升级到2.7.2、售后bug处理、字典排序修复、SecurityConfig兼容新的写法、修复首页没配置group函数报错问题

This commit is contained in:
taozi
2022-08-14 22:31:27 +08:00
parent 6c4d00abdd
commit 6520e6fc92
4 changed files with 18 additions and 16 deletions

View File

@ -28,7 +28,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version> <version>2.7.2</version>
</parent> </parent>
<properties> <properties>
@ -38,7 +38,7 @@
<jedis.version>3.3.0</jedis.version> <jedis.version>3.3.0</jedis.version>
<swagger.version>3.0.0</swagger.version> <swagger.version>3.0.0</swagger.version>
<fastjson.version>1.2.83</fastjson.version> <fastjson.version>1.2.83</fastjson.version>
<druid.version>1.2.9</druid.version> <druid.version>1.2.11</druid.version>
<hutool.version>5.5.7</hutool.version> <hutool.version>5.5.7</hutool.version>
<poi.version>4.1.2</poi.version> <poi.version>4.1.2</poi.version>
<commons-pool2.version>2.5.0</commons-pool2.version> <commons-pool2.version>2.5.0</commons-pool2.version>

View File

@ -17,11 +17,11 @@ import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; 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.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 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.core.GrantedAuthorityDefaults;
import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.filter.CorsFilter; import org.springframework.web.filter.CorsFilter;
import org.springframework.web.method.HandlerMethod; import org.springframework.web.method.HandlerMethod;
@ -38,7 +38,7 @@ import java.util.Set;
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@EnableWebSecurity @EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter { public class SecurityConfig {
private final TokenUtil tokenUtil; private final TokenUtil tokenUtil;
private final CorsFilter corsFilter; private final CorsFilter corsFilter;
@ -66,8 +66,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return new BCryptPasswordEncoder(); return new BCryptPasswordEncoder();
} }
@Override @Bean
protected void configure(HttpSecurity httpSecurity) throws Exception { SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
// 搜寻匿名标记 url @AnonymousAccess // 搜寻匿名标记 url @AnonymousAccess
Map<RequestMappingInfo, HandlerMethod> handlerMethodMap = applicationContext.getBean(RequestMappingHandlerMapping.class).getHandlerMethods(); Map<RequestMappingInfo, HandlerMethod> handlerMethodMap = applicationContext.getBean(RequestMappingHandlerMapping.class).getHandlerMethods();
Set<String> anonymousUrls = new HashSet<>(); Set<String> anonymousUrls = new HashSet<>();
@ -78,7 +78,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
anonymousUrls.addAll(infoEntry.getKey().getPatternsCondition().getPatterns()); anonymousUrls.addAll(infoEntry.getKey().getPatternsCondition().getPatterns());
} }
} }
httpSecurity return httpSecurity
// 禁用 CSRF // 禁用 CSRF
.csrf().disable() .csrf().disable()
.addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class) .addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class)
@ -130,7 +130,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(anonymousUrls.toArray(new String[0])).permitAll() .antMatchers(anonymousUrls.toArray(new String[0])).permitAll()
// 所有请求都需要认证 // 所有请求都需要认证
.anyRequest().authenticated() .anyRequest().authenticated()
.and().apply(securityConfigurerAdapter()); .and().apply(securityConfigurerAdapter())
.and()
.build();
} }
private TokenConfigurer securityConfigurerAdapter() { private TokenConfigurer securityConfigurerAdapter() {

View File

@ -60,15 +60,15 @@ public interface StoreOrderMapper extends CoreMapper<YxStoreOrder> {
Double sumTotalPrice(); Double sumTotalPrice();
@Select("SELECT IFNULL(sum(pay_price),0) as num," + @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}" + " 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') " + " GROUP BY DATE_FORMAT(ANY_VALUE(create_time),'%Y-%m-%d') " +
" ORDER BY create_time ASC") " ORDER BY ANY_VALUE(create_time) ASC")
List<ChartDataDto> chartList(@Param("time") Date time); List<ChartDataDto> chartList(@Param("time") Date time);
@Select("SELECT count(id) as num," + @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}" + " 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') " + " GROUP BY DATE_FORMAT(ANY_VALUE(create_time),'%Y-%m-%d') " +
" ORDER BY create_time ASC") " ORDER BY ANY_VALUE(create_time) ASC")
List<ChartDataDto> chartListT(@Param("time") Date time); List<ChartDataDto> chartListT(@Param("time") Date time);
} }

View File

@ -247,7 +247,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
storeAfterSales.setSalesState(1); storeAfterSales.setSalesState(1);
YxStoreOrder yxStoreOrder = storeOrderMapper.selectOne(Wrappers.<YxStoreOrder>lambdaQuery().eq(YxStoreOrder::getOrderId, key)); YxStoreOrder yxStoreOrder = storeOrderMapper.selectOne(Wrappers.<YxStoreOrder>lambdaQuery().eq(YxStoreOrder::getOrderId, key));
yxStoreOrder.setStatus(OrderInfoEnum.STATUS_0.getValue()); // yxStoreOrder.setStatus(OrderInfoEnum.STATUS_0.getValue());
yxStoreOrder.setRefundStatus(OrderInfoEnum.STATUS_0.getValue()); yxStoreOrder.setRefundStatus(OrderInfoEnum.STATUS_0.getValue());
storeOrderMapper.updateById(yxStoreOrder); storeOrderMapper.updateById(yxStoreOrder);
@ -323,7 +323,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); storeAfterSalesStatusMapper.insert(storeAfterSalesStatus);
} else { } else {
storeAfterSales.setState(AfterSalesStatusEnum.STATUS_1.getValue()); storeAfterSales.setState(AfterSalesStatusEnum.STATUS_3.getValue());
storeAfterSales.setSalesState(2); storeAfterSales.setSalesState(2);
//操作记录 //操作记录
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();