Commit a9bb5914 by giaogiao

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

parent 234a8e60
......@@ -56,7 +56,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.filter.DelegatingFilterProxy;
import javax.servlet.DispatcherType;
......@@ -204,14 +203,13 @@ public class ShiroConfig {
ShiroLoginService shiroLoginService,
SysLoginRedisService sysLoginRedisService,
ShiroProperties shiroProperties,
JwtProperties jwtProperties,
RedisTemplate redisTemplate) {
JwtProperties jwtProperties) {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
// 设置安全管理器
shiroFilterFactoryBean.setSecurityManager(securityManager);
// 设置过滤器
Map<String, Filter> filterMap = getFilterMap(shiroLoginService, sysLoginRedisService, jwtProperties, redisTemplate);
Map<String, Filter> filterMap = getFilterMap(shiroLoginService, jwtProperties);
shiroFilterFactoryBean.setFilters(filterMap);
// 设置过滤器顺序
Map<String, String> filterChainMap = getFilterChainDefinitionMap(shiroProperties);
......@@ -226,11 +224,9 @@ public class ShiroConfig {
* @return
*/
private Map<String, Filter> getFilterMap(ShiroLoginService shiroLoginService,
SysLoginRedisService loginRedisService,
JwtProperties jwtProperties,
RedisTemplate redisTemplate) {
JwtProperties jwtProperties) {
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;
}
......
......@@ -39,6 +39,9 @@ public interface StrokeMapper extends BaseMapper<Stroke> {
* @return
*/
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
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());
return new Paging<StrokeQueryVo>(iPage);
......
......@@ -54,36 +54,52 @@
</where>
</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"
resultType="com.jumeirah.common.vo.McStrokeQueryVo">
SELECT
s.*,
CONCAT( au.surname, au.`name` ) AS applicant,
au.phone AS phone_number
s.*,
CONCAT( au.surname, au.`name` ) AS applicant,
au.phone AS phone_number
FROM
stroke s
LEFT JOIN app_user au ON au.id = s.user_id
<where>
<if test="mcStrokePageParam.type !=null">
AND s.type = #{mcStrokePageParam.type}
</if>
<if test="mcStrokePageParam.id !=null">
AND s.id = #{mcStrokePageParam.id}
</if>
<if test="mcStrokePageParam.startTime !=null and mcStrokePageParam.startTime != ''">
AND s.create_time &gt;= #{mcStrokePageParam.startTime}
</if>
<if test="mcStrokePageParam.endTime !=null and mcStrokePageParam.endTime != ''">
AND s.create_time &lt;= #{mcStrokePageParam.endTime}
</if>
<if test="mcStrokePageParam.applicant !=null and mcStrokePageParam.applicant != ''">
AND CONCAT( au.surname, au.`name` ) LIKE CONCAT('%',#{mcStrokePageParam.applicant},'%')
</if>
</where>
stroke s
LEFT JOIN app_user au ON au.id = s.user_id
<where>
<if test="mcStrokePageParam.type !=null">
AND s.type = #{mcStrokePageParam.type}
</if>
<if test="mcStrokePageParam.id !=null">
AND s.id = #{mcStrokePageParam.id}
</if>
<if test="mcStrokePageParam.startTime !=null and mcStrokePageParam.startTime != ''">
AND s.create_time &gt;= #{mcStrokePageParam.startTime}
</if>
<if test="mcStrokePageParam.endTime !=null and mcStrokePageParam.endTime != ''">
AND s.create_time &lt;= #{mcStrokePageParam.endTime}
</if>
<if test="mcStrokePageParam.applicant !=null and mcStrokePageParam.applicant != ''">
AND CONCAT( au.surname, au.`name` ) LIKE CONCAT('%',#{mcStrokePageParam.applicant},'%')
</if>
</where>
WHERE
s.type = 2
AND s.id = 1
AND (s.create_time BETWEEN '2020-10-07 15:32:30' AND '2020-10-12 15:32:30')
s.type = 2
AND s.id = 1
AND (s.create_time BETWEEN '2020-10-07 15:32:30' AND '2020-10-12 15:32:30')
AND CONCAT( au.surname, au.`name` ) LIKE '%姓名'
</select>
......
......@@ -19,7 +19,6 @@ package io.geekidea.springbootplus.framework.shiro.jwt;
import io.geekidea.springbootplus.config.properties.JwtProperties;
import io.geekidea.springbootplus.framework.common.api.ApiCode;
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.util.JwtTokenUtil;
import io.geekidea.springbootplus.framework.shiro.util.JwtUtil;
......@@ -32,7 +31,6 @@ import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
import org.apache.shiro.web.util.WebUtils;
import org.springframework.data.redis.core.RedisTemplate;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
......@@ -50,13 +48,11 @@ import javax.servlet.http.HttpServletResponse;
public class JwtFilter extends AuthenticatingFilter {
private final ShiroLoginService shiroLoginService;
private final SysLoginRedisService sysLoginRedisService;
private final JwtProperties jwtProperties;
public JwtFilter(ShiroLoginService shiroLoginService, SysLoginRedisService loginRedisService, JwtProperties jwtProperties, RedisTemplate redisTemplate) {
public JwtFilter(ShiroLoginService shiroLoginService, JwtProperties jwtProperties) {
this.shiroLoginService = shiroLoginService;
this.sysLoginRedisService = loginRedisService;
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