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>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version>
<version>2.7.2</version>
</parent>
<properties>
@ -38,7 +38,7 @@
<jedis.version>3.3.0</jedis.version>
<swagger.version>3.0.0</swagger.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>
<poi.version>4.1.2</poi.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.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<RequestMappingInfo, HandlerMethod> handlerMethodMap = applicationContext.getBean(RequestMappingHandlerMapping.class).getHandlerMethods();
Set<String> 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() {

View File

@ -60,15 +60,15 @@ public interface StoreOrderMapper extends CoreMapper<YxStoreOrder> {
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<ChartDataDto> 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<ChartDataDto> chartListT(@Param("time") Date time);
}

View File

@ -247,7 +247,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
storeAfterSales.setSalesState(1);
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());
storeOrderMapper.updateById(yxStoreOrder);
@ -323,7 +323,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus);
} else {
storeAfterSales.setState(AfterSalesStatusEnum.STATUS_1.getValue());
storeAfterSales.setState(AfterSalesStatusEnum.STATUS_3.getValue());
storeAfterSales.setSalesState(2);
//操作记录
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();