Commit a9bb5914 by giaogiao

优化行程列表:查询已完成 需要额外查询已取消状态

parent 234a8e60
...@@ -56,7 +56,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties ...@@ -56,7 +56,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.filter.DelegatingFilterProxy; import org.springframework.web.filter.DelegatingFilterProxy;
import javax.servlet.DispatcherType; import javax.servlet.DispatcherType;
...@@ -204,14 +203,13 @@ public class ShiroConfig { ...@@ -204,14 +203,13 @@ public class ShiroConfig {
ShiroLoginService shiroLoginService, ShiroLoginService shiroLoginService,
SysLoginRedisService sysLoginRedisService, SysLoginRedisService sysLoginRedisService,
ShiroProperties shiroProperties, ShiroProperties shiroProperties,
JwtProperties jwtProperties, JwtProperties jwtProperties) {
RedisTemplate redisTemplate) {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
// 设置安全管理器 // 设置安全管理器
shiroFilterFactoryBean.setSecurityManager(securityManager); shiroFilterFactoryBean.setSecurityManager(securityManager);
// 设置过滤器 // 设置过滤器
Map<String, Filter> filterMap = getFilterMap(shiroLoginService, sysLoginRedisService, jwtProperties, redisTemplate); Map<String, Filter> filterMap = getFilterMap(shiroLoginService, jwtProperties);
shiroFilterFactoryBean.setFilters(filterMap); shiroFilterFactoryBean.setFilters(filterMap);
// 设置过滤器顺序 // 设置过滤器顺序
Map<String, String> filterChainMap = getFilterChainDefinitionMap(shiroProperties); Map<String, String> filterChainMap = getFilterChainDefinitionMap(shiroProperties);
...@@ -226,11 +224,9 @@ public class ShiroConfig { ...@@ -226,11 +224,9 @@ public class ShiroConfig {
* @return * @return
*/ */
private Map<String, Filter> getFilterMap(ShiroLoginService shiroLoginService, private Map<String, Filter> getFilterMap(ShiroLoginService shiroLoginService,
SysLoginRedisService loginRedisService, JwtProperties jwtProperties) {
JwtProperties jwtProperties,
RedisTemplate redisTemplate) {
Map<String, Filter> filterMap = new LinkedHashMap<>(); Map<String, Filter> filterMap = new LinkedHashMap<>();
filterMap.put(JWT_FILTER_NAME, new JwtFilter(shiroLoginService, loginRedisService, jwtProperties, redisTemplate)); filterMap.put(JWT_FILTER_NAME, new JwtFilter(shiroLoginService, jwtProperties));
return filterMap; return filterMap;
} }
......
...@@ -39,6 +39,9 @@ public interface StrokeMapper extends BaseMapper<Stroke> { ...@@ -39,6 +39,9 @@ public interface StrokeMapper extends BaseMapper<Stroke> {
* @return * @return
*/ */
IPage<StrokeQueryVo> getStrokePageList(@Param("page") Page page, @Param("param") StrokePageParam strokePageParam, @Param("userId") Long userId); IPage<StrokeQueryVo> getStrokePageList(@Param("page") Page page, @Param("param") StrokePageParam strokePageParam, @Param("userId") Long userId);
IPage<StrokeQueryVo> getStrokePageListWithFinsh(@Param("page") Page page, @Param("param") StrokePageParam strokePageParam, @Param("userId") Long userId);
/** /**
* 商家端 获取行程分页对象 * 商家端 获取行程分页对象
......
...@@ -92,6 +92,13 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp ...@@ -92,6 +92,13 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal(); JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
// 查询已完成 需要额外查询已取消状态
if (strokePageParam.getStatus().equals(StrokeStatusEnum.COMPLETED.getCode())){
IPage<StrokeQueryVo> iPage = strokeMapper.getStrokePageListWithFinsh(page, strokePageParam, jwtToken.getUserId());
return new Paging<StrokeQueryVo>(iPage);
}
IPage<StrokeQueryVo> iPage = strokeMapper.getStrokePageList(page, strokePageParam, jwtToken.getUserId()); IPage<StrokeQueryVo> iPage = strokeMapper.getStrokePageList(page, strokePageParam, jwtToken.getUserId());
return new Paging<StrokeQueryVo>(iPage); return new Paging<StrokeQueryVo>(iPage);
......
...@@ -54,6 +54,22 @@ ...@@ -54,6 +54,22 @@
</where> </where>
</select> </select>
<!-- 已完成订单-->
<select id="getStrokePageListWithFinsh" parameterType="com.jumeirah.common.param.StrokePageParam"
resultType="com.jumeirah.common.vo.StrokeQueryVo">
select
<include refid="Page_Column_List"/>
from stroke s
INNER JOIN merchant_user mu ON mu.id = s.mc_id
<where>
and s.user_id = #{userId}
and s.deleted = 0
and s.`status` = #{param.status}
or s.`status` = 99
</where>
</select>
<select id="getMcStrokePageList" parameterType="com.jumeirah.common.param.McStrokePageParam" <select id="getMcStrokePageList" parameterType="com.jumeirah.common.param.McStrokePageParam"
resultType="com.jumeirah.common.vo.McStrokeQueryVo"> resultType="com.jumeirah.common.vo.McStrokeQueryVo">
SELECT SELECT
......
...@@ -19,7 +19,6 @@ package io.geekidea.springbootplus.framework.shiro.jwt; ...@@ -19,7 +19,6 @@ package io.geekidea.springbootplus.framework.shiro.jwt;
import io.geekidea.springbootplus.config.properties.JwtProperties; import io.geekidea.springbootplus.config.properties.JwtProperties;
import io.geekidea.springbootplus.framework.common.api.ApiCode; import io.geekidea.springbootplus.framework.common.api.ApiCode;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.shiro.cache.SysLoginRedisService;
import io.geekidea.springbootplus.framework.shiro.service.ShiroLoginService; import io.geekidea.springbootplus.framework.shiro.service.ShiroLoginService;
import io.geekidea.springbootplus.framework.shiro.util.JwtTokenUtil; import io.geekidea.springbootplus.framework.shiro.util.JwtTokenUtil;
import io.geekidea.springbootplus.framework.shiro.util.JwtUtil; import io.geekidea.springbootplus.framework.shiro.util.JwtUtil;
...@@ -32,7 +31,6 @@ import org.apache.shiro.authc.AuthenticationToken; ...@@ -32,7 +31,6 @@ import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.AuthenticatingFilter; import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
import org.apache.shiro.web.util.WebUtils; import org.apache.shiro.web.util.WebUtils;
import org.springframework.data.redis.core.RedisTemplate;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
...@@ -50,13 +48,11 @@ import javax.servlet.http.HttpServletResponse; ...@@ -50,13 +48,11 @@ import javax.servlet.http.HttpServletResponse;
public class JwtFilter extends AuthenticatingFilter { public class JwtFilter extends AuthenticatingFilter {
private final ShiroLoginService shiroLoginService; private final ShiroLoginService shiroLoginService;
private final SysLoginRedisService sysLoginRedisService;
private final JwtProperties jwtProperties; private final JwtProperties jwtProperties;
public JwtFilter(ShiroLoginService shiroLoginService, SysLoginRedisService loginRedisService, JwtProperties jwtProperties, RedisTemplate redisTemplate) { public JwtFilter(ShiroLoginService shiroLoginService, JwtProperties jwtProperties) {
this.shiroLoginService = shiroLoginService; this.shiroLoginService = shiroLoginService;
this.sysLoginRedisService = loginRedisService;
this.jwtProperties = jwtProperties; this.jwtProperties = jwtProperties;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment