Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tmj
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
凌朝政
tmj
Commits
7bc9f4ac
提交
7bc9f4ac
authored
6月 01, 2022
作者:
rin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:白名单过滤
上级
77ea1839
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
69 行增加
和
459 行删除
+69
-459
QActionDo.java
...main/generated/com/mmc/tmj/entity/database/QActionDo.java
+0
-41
QDeviceDo.java
...main/generated/com/mmc/tmj/entity/database/QDeviceDo.java
+0
-47
QGISMapDo.java
...main/generated/com/mmc/tmj/entity/database/QGISMapDo.java
+0
-47
QPhotographDo.java
.../generated/com/mmc/tmj/entity/database/QPhotographDo.java
+0
-45
QRouteDo.java
src/main/generated/com/mmc/tmj/entity/database/QRouteDo.java
+0
-54
QRoutePointDo.java
.../generated/com/mmc/tmj/entity/database/QRoutePointDo.java
+0
-54
QRunProjectDo.java
.../generated/com/mmc/tmj/entity/database/QRunProjectDo.java
+0
-47
QTaskDto.java
src/main/generated/com/mmc/tmj/entity/database/QTaskDto.java
+0
-61
QTrackDo.java
src/main/generated/com/mmc/tmj/entity/database/QTrackDo.java
+0
-49
TaskController.java
src/main/java/com/mmc/tmj/controller/TaskController.java
+8
-7
LoginFilter.java
src/main/java/com/mmc/tmj/filter/LoginFilter.java
+11
-7
LoginServiceImpl.java
...java/com/mmc/tmj/service/login/impl/LoginServiceImpl.java
+3
-0
UTF8Util.java
src/main/java/com/mmc/tmj/utils/UTF8Util.java
+42
-0
application-dev.yml
src/main/resources/application-dev.yml
+3
-0
application-local.yml
src/main/resources/application-local.yml
+1
-0
application-prod.yml
src/main/resources/application-prod.yml
+1
-0
没有找到文件。
src/main/generated/com/mmc/tmj/entity/database/QActionDo.java
deleted
100644 → 0
浏览文件 @
77ea1839
package
com
.
mmc
.
tmj
.
entity
.
database
;
import
static
com
.
querydsl
.
core
.
types
.
PathMetadataFactory
.*;
import
com.querydsl.core.types.dsl.*
;
import
com.querydsl.core.types.PathMetadata
;
import
javax.annotation.Generated
;
import
com.querydsl.core.types.Path
;
/**
* QActionDo is a Querydsl query type for ActionDo
*/
@Generated
(
"com.querydsl.codegen.EntitySerializer"
)
public
class
QActionDo
extends
EntityPathBase
<
ActionDo
>
{
private
static
final
long
serialVersionUID
=
-
1066345570L
;
public
static
final
QActionDo
actionDo
=
new
QActionDo
(
"actionDo"
);
public
final
NumberPath
<
Integer
>
id
=
createNumber
(
"id"
,
Integer
.
class
);
public
final
NumberPath
<
Integer
>
takeSecond
=
createNumber
(
"takeSecond"
,
Integer
.
class
);
public
final
EnumPath
<
com
.
mmc
.
tmj
.
enums
.
ActionType
>
type
=
createEnum
(
"type"
,
com
.
mmc
.
tmj
.
enums
.
ActionType
.
class
);
public
QActionDo
(
String
variable
)
{
super
(
ActionDo
.
class
,
forVariable
(
variable
));
}
public
QActionDo
(
Path
<?
extends
ActionDo
>
path
)
{
super
(
path
.
getType
(),
path
.
getMetadata
());
}
public
QActionDo
(
PathMetadata
metadata
)
{
super
(
ActionDo
.
class
,
metadata
);
}
}
src/main/generated/com/mmc/tmj/entity/database/QDeviceDo.java
deleted
100644 → 0
浏览文件 @
77ea1839
package
com
.
mmc
.
tmj
.
entity
.
database
;
import
static
com
.
querydsl
.
core
.
types
.
PathMetadataFactory
.*;
import
com.querydsl.core.types.dsl.*
;
import
com.querydsl.core.types.PathMetadata
;
import
javax.annotation.Generated
;
import
com.querydsl.core.types.Path
;
/**
* QDeviceDo is a Querydsl query type for DeviceDo
*/
@Generated
(
"com.querydsl.codegen.EntitySerializer"
)
public
class
QDeviceDo
extends
EntityPathBase
<
DeviceDo
>
{
private
static
final
long
serialVersionUID
=
1699017662L
;
public
static
final
QDeviceDo
deviceDo
=
new
QDeviceDo
(
"deviceDo"
);
public
final
StringPath
deviceHardId
=
createString
(
"deviceHardId"
);
public
final
StringPath
deviceHashId
=
createString
(
"deviceHashId"
);
public
final
StringPath
deviceSerial
=
createString
(
"deviceSerial"
);
public
final
NumberPath
<
Integer
>
id
=
createNumber
(
"id"
,
Integer
.
class
);
public
final
StringPath
name
=
createString
(
"name"
);
public
final
NumberPath
<
Integer
>
status
=
createNumber
(
"status"
,
Integer
.
class
);
public
QDeviceDo
(
String
variable
)
{
super
(
DeviceDo
.
class
,
forVariable
(
variable
));
}
public
QDeviceDo
(
Path
<?
extends
DeviceDo
>
path
)
{
super
(
path
.
getType
(),
path
.
getMetadata
());
}
public
QDeviceDo
(
PathMetadata
metadata
)
{
super
(
DeviceDo
.
class
,
metadata
);
}
}
src/main/generated/com/mmc/tmj/entity/database/QGISMapDo.java
deleted
100644 → 0
浏览文件 @
77ea1839
package
com
.
mmc
.
tmj
.
entity
.
database
;
import
static
com
.
querydsl
.
core
.
types
.
PathMetadataFactory
.*;
import
com.querydsl.core.types.dsl.*
;
import
com.querydsl.core.types.PathMetadata
;
import
javax.annotation.Generated
;
import
com.querydsl.core.types.Path
;
/**
* QGISMapDo is a Querydsl query type for GISMapDo
*/
@Generated
(
"com.querydsl.codegen.EntitySerializer"
)
public
class
QGISMapDo
extends
EntityPathBase
<
GISMapDo
>
{
private
static
final
long
serialVersionUID
=
-
1770713101L
;
public
static
final
QGISMapDo
gISMapDo
=
new
QGISMapDo
(
"gISMapDo"
);
public
final
StringPath
address
=
createString
(
"address"
);
public
final
NumberPath
<
Integer
>
id
=
createNumber
(
"id"
,
Integer
.
class
);
public
final
NumberPath
<
Double
>
latitude
=
createNumber
(
"latitude"
,
Double
.
class
);
public
final
NumberPath
<
Double
>
longitude
=
createNumber
(
"longitude"
,
Double
.
class
);
public
final
StringPath
name
=
createString
(
"name"
);
public
final
StringPath
unit
=
createString
(
"unit"
);
public
QGISMapDo
(
String
variable
)
{
super
(
GISMapDo
.
class
,
forVariable
(
variable
));
}
public
QGISMapDo
(
Path
<?
extends
GISMapDo
>
path
)
{
super
(
path
.
getType
(),
path
.
getMetadata
());
}
public
QGISMapDo
(
PathMetadata
metadata
)
{
super
(
GISMapDo
.
class
,
metadata
);
}
}
src/main/generated/com/mmc/tmj/entity/database/QPhotographDo.java
deleted
100644 → 0
浏览文件 @
77ea1839
package
com
.
mmc
.
tmj
.
entity
.
database
;
import
static
com
.
querydsl
.
core
.
types
.
PathMetadataFactory
.*;
import
com.querydsl.core.types.dsl.*
;
import
com.querydsl.core.types.PathMetadata
;
import
javax.annotation.Generated
;
import
com.querydsl.core.types.Path
;
/**
* QPhotographDo is a Querydsl query type for PhotographDo
*/
@Generated
(
"com.querydsl.codegen.EntitySerializer"
)
public
class
QPhotographDo
extends
EntityPathBase
<
PhotographDo
>
{
private
static
final
long
serialVersionUID
=
-
264103996L
;
public
static
final
QPhotographDo
photographDo
=
new
QPhotographDo
(
"photographDo"
);
public
final
StringPath
createTime
=
createString
(
"createTime"
);
public
final
StringPath
deviceHardId
=
createString
(
"deviceHardId"
);
public
final
NumberPath
<
Integer
>
id
=
createNumber
(
"id"
,
Integer
.
class
);
public
final
StringPath
images
=
createString
(
"images"
);
public
final
NumberPath
<
Integer
>
taskId
=
createNumber
(
"taskId"
,
Integer
.
class
);
public
QPhotographDo
(
String
variable
)
{
super
(
PhotographDo
.
class
,
forVariable
(
variable
));
}
public
QPhotographDo
(
Path
<?
extends
PhotographDo
>
path
)
{
super
(
path
.
getType
(),
path
.
getMetadata
());
}
public
QPhotographDo
(
PathMetadata
metadata
)
{
super
(
PhotographDo
.
class
,
metadata
);
}
}
src/main/generated/com/mmc/tmj/entity/database/QRouteDo.java
deleted
100644 → 0
浏览文件 @
77ea1839
package
com
.
mmc
.
tmj
.
entity
.
database
;
import
static
com
.
querydsl
.
core
.
types
.
PathMetadataFactory
.*;
import
com.querydsl.core.types.dsl.*
;
import
com.querydsl.core.types.PathMetadata
;
import
javax.annotation.Generated
;
import
com.querydsl.core.types.Path
;
import
com.querydsl.core.types.dsl.PathInits
;
/**
* QRouteDo is a Querydsl query type for RouteDo
*/
@Generated
(
"com.querydsl.codegen.EntitySerializer"
)
public
class
QRouteDo
extends
EntityPathBase
<
RouteDo
>
{
private
static
final
long
serialVersionUID
=
-
950630697L
;
public
static
final
QRouteDo
routeDo
=
new
QRouteDo
(
"routeDo"
);
public
final
DateTimePath
<
java
.
time
.
LocalDateTime
>
createWhen
=
createDateTime
(
"createWhen"
,
java
.
time
.
LocalDateTime
.
class
);
public
final
NumberPath
<
Double
>
defaultAltitude
=
createNumber
(
"defaultAltitude"
,
Double
.
class
);
public
final
NumberPath
<
Double
>
defaultPitchAngle
=
createNumber
(
"defaultPitchAngle"
,
Double
.
class
);
public
final
NumberPath
<
Double
>
defaultSpeed
=
createNumber
(
"defaultSpeed"
,
Double
.
class
);
public
final
NumberPath
<
Double
>
defaultYawAngle
=
createNumber
(
"defaultYawAngle"
,
Double
.
class
);
public
final
NumberPath
<
Integer
>
id
=
createNumber
(
"id"
,
Integer
.
class
);
public
final
StringPath
name
=
createString
(
"name"
);
public
final
ListPath
<
RoutePointDo
,
QRoutePointDo
>
points
=
this
.<
RoutePointDo
,
QRoutePointDo
>
createList
(
"points"
,
RoutePointDo
.
class
,
QRoutePointDo
.
class
,
PathInits
.
DIRECT2
);
public
final
StringPath
remark
=
createString
(
"remark"
);
public
QRouteDo
(
String
variable
)
{
super
(
RouteDo
.
class
,
forVariable
(
variable
));
}
public
QRouteDo
(
Path
<?
extends
RouteDo
>
path
)
{
super
(
path
.
getType
(),
path
.
getMetadata
());
}
public
QRouteDo
(
PathMetadata
metadata
)
{
super
(
RouteDo
.
class
,
metadata
);
}
}
src/main/generated/com/mmc/tmj/entity/database/QRoutePointDo.java
deleted
100644 → 0
浏览文件 @
77ea1839
package
com
.
mmc
.
tmj
.
entity
.
database
;
import
static
com
.
querydsl
.
core
.
types
.
PathMetadataFactory
.*;
import
com.querydsl.core.types.dsl.*
;
import
com.querydsl.core.types.PathMetadata
;
import
javax.annotation.Generated
;
import
com.querydsl.core.types.Path
;
import
com.querydsl.core.types.dsl.PathInits
;
/**
* QRoutePointDo is a Querydsl query type for RoutePointDo
*/
@Generated
(
"com.querydsl.codegen.EntitySerializer"
)
public
class
QRoutePointDo
extends
EntityPathBase
<
RoutePointDo
>
{
private
static
final
long
serialVersionUID
=
-
143306897L
;
public
static
final
QRoutePointDo
routePointDo
=
new
QRoutePointDo
(
"routePointDo"
);
public
final
ListPath
<
ActionDo
,
QActionDo
>
actions
=
this
.<
ActionDo
,
QActionDo
>
createList
(
"actions"
,
ActionDo
.
class
,
QActionDo
.
class
,
PathInits
.
DIRECT2
);
public
final
NumberPath
<
Double
>
altitude
=
createNumber
(
"altitude"
,
Double
.
class
);
public
final
NumberPath
<
Integer
>
id
=
createNumber
(
"id"
,
Integer
.
class
);
public
final
NumberPath
<
Double
>
latitude
=
createNumber
(
"latitude"
,
Double
.
class
);
public
final
NumberPath
<
Double
>
longitude
=
createNumber
(
"longitude"
,
Double
.
class
);
public
final
NumberPath
<
Double
>
pitchAngle
=
createNumber
(
"pitchAngle"
,
Double
.
class
);
public
final
NumberPath
<
Double
>
speed
=
createNumber
(
"speed"
,
Double
.
class
);
public
final
StringPath
uuid
=
createString
(
"uuid"
);
public
final
NumberPath
<
Double
>
yawAngle
=
createNumber
(
"yawAngle"
,
Double
.
class
);
public
QRoutePointDo
(
String
variable
)
{
super
(
RoutePointDo
.
class
,
forVariable
(
variable
));
}
public
QRoutePointDo
(
Path
<?
extends
RoutePointDo
>
path
)
{
super
(
path
.
getType
(),
path
.
getMetadata
());
}
public
QRoutePointDo
(
PathMetadata
metadata
)
{
super
(
RoutePointDo
.
class
,
metadata
);
}
}
src/main/generated/com/mmc/tmj/entity/database/QRunProjectDo.java
deleted
100644 → 0
浏览文件 @
77ea1839
package
com
.
mmc
.
tmj
.
entity
.
database
;
import
static
com
.
querydsl
.
core
.
types
.
PathMetadataFactory
.*;
import
com.querydsl.core.types.dsl.*
;
import
com.querydsl.core.types.PathMetadata
;
import
javax.annotation.Generated
;
import
com.querydsl.core.types.Path
;
/**
* QRunProjectDo is a Querydsl query type for RunProjectDo
*/
@Generated
(
"com.querydsl.codegen.EntitySerializer"
)
public
class
QRunProjectDo
extends
EntityPathBase
<
RunProjectDo
>
{
private
static
final
long
serialVersionUID
=
-
1833261322L
;
public
static
final
QRunProjectDo
runProjectDo
=
new
QRunProjectDo
(
"runProjectDo"
);
public
final
NumberPath
<
Integer
>
id
=
createNumber
(
"id"
,
Integer
.
class
);
public
final
NumberPath
<
Double
>
latitude
=
createNumber
(
"latitude"
,
Double
.
class
);
public
final
NumberPath
<
Double
>
longitude
=
createNumber
(
"longitude"
,
Double
.
class
);
public
final
StringPath
projectAddress
=
createString
(
"projectAddress"
);
public
final
StringPath
projectDescript
=
createString
(
"projectDescript"
);
public
final
StringPath
projectName
=
createString
(
"projectName"
);
public
QRunProjectDo
(
String
variable
)
{
super
(
RunProjectDo
.
class
,
forVariable
(
variable
));
}
public
QRunProjectDo
(
Path
<?
extends
RunProjectDo
>
path
)
{
super
(
path
.
getType
(),
path
.
getMetadata
());
}
public
QRunProjectDo
(
PathMetadata
metadata
)
{
super
(
RunProjectDo
.
class
,
metadata
);
}
}
src/main/generated/com/mmc/tmj/entity/database/QTaskDto.java
deleted
100644 → 0
浏览文件 @
77ea1839
package
com
.
mmc
.
tmj
.
entity
.
database
;
import
static
com
.
querydsl
.
core
.
types
.
PathMetadataFactory
.*;
import
com.querydsl.core.types.dsl.*
;
import
com.querydsl.core.types.PathMetadata
;
import
javax.annotation.Generated
;
import
com.querydsl.core.types.Path
;
/**
* QTaskDto is a Querydsl query type for TaskDto
*/
@Generated
(
"com.querydsl.codegen.EntitySerializer"
)
public
class
QTaskDto
extends
EntityPathBase
<
TaskDto
>
{
private
static
final
long
serialVersionUID
=
421423165L
;
public
static
final
QTaskDto
taskDto
=
new
QTaskDto
(
"taskDto"
);
public
final
StringPath
addTime
=
createString
(
"addTime"
);
public
final
StringPath
deviceHardId
=
createString
(
"deviceHardId"
);
public
final
NumberPath
<
Integer
>
deviceId
=
createNumber
(
"deviceId"
,
Integer
.
class
);
public
final
StringPath
deviceName
=
createString
(
"deviceName"
);
public
final
NumberPath
<
Integer
>
deviceStatus
=
createNumber
(
"deviceStatus"
,
Integer
.
class
);
public
final
StringPath
endTime
=
createString
(
"endTime"
);
public
final
NumberPath
<
Integer
>
id
=
createNumber
(
"id"
,
Integer
.
class
);
public
final
StringPath
organizationName
=
createString
(
"organizationName"
);
public
final
StringPath
remark
=
createString
(
"remark"
);
public
final
StringPath
routeName
=
createString
(
"routeName"
);
public
final
StringPath
startTime
=
createString
(
"startTime"
);
public
final
StringPath
taskName
=
createString
(
"taskName"
);
public
final
NumberPath
<
Integer
>
taskStatus
=
createNumber
(
"taskStatus"
,
Integer
.
class
);
public
QTaskDto
(
String
variable
)
{
super
(
TaskDto
.
class
,
forVariable
(
variable
));
}
public
QTaskDto
(
Path
<?
extends
TaskDto
>
path
)
{
super
(
path
.
getType
(),
path
.
getMetadata
());
}
public
QTaskDto
(
PathMetadata
metadata
)
{
super
(
TaskDto
.
class
,
metadata
);
}
}
src/main/generated/com/mmc/tmj/entity/database/QTrackDo.java
deleted
100644 → 0
浏览文件 @
77ea1839
package
com
.
mmc
.
tmj
.
entity
.
database
;
import
static
com
.
querydsl
.
core
.
types
.
PathMetadataFactory
.*;
import
com.querydsl.core.types.dsl.*
;
import
com.querydsl.core.types.PathMetadata
;
import
javax.annotation.Generated
;
import
com.querydsl.core.types.Path
;
/**
* QTrackDo is a Querydsl query type for TrackDo
*/
@Generated
(
"com.querydsl.codegen.EntitySerializer"
)
public
class
QTrackDo
extends
EntityPathBase
<
TrackDo
>
{
private
static
final
long
serialVersionUID
=
891293017L
;
public
static
final
QTrackDo
trackDo
=
new
QTrackDo
(
"trackDo"
);
public
final
StringPath
data
=
createString
(
"data"
);
public
final
StringPath
deviceHardId
=
createString
(
"deviceHardId"
);
public
final
StringPath
deviceType
=
createString
(
"deviceType"
);
public
final
StringPath
flightSortie
=
createString
(
"flightSortie"
);
public
final
NumberPath
<
Integer
>
id
=
createNumber
(
"id"
,
Integer
.
class
);
public
final
StringPath
systemCode
=
createString
(
"systemCode"
);
public
final
NumberPath
<
Integer
>
time
=
createNumber
(
"time"
,
Integer
.
class
);
public
QTrackDo
(
String
variable
)
{
super
(
TrackDo
.
class
,
forVariable
(
variable
));
}
public
QTrackDo
(
Path
<?
extends
TrackDo
>
path
)
{
super
(
path
.
getType
(),
path
.
getMetadata
());
}
public
QTrackDo
(
PathMetadata
metadata
)
{
super
(
TrackDo
.
class
,
metadata
);
}
}
src/main/java/com/mmc/tmj/controller/TaskController.java
浏览文件 @
7bc9f4ac
...
...
@@ -25,8 +25,11 @@ import java.util.stream.Collectors;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.Valid
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.Min
;
import
javax.websocket.server.PathParam
;
import
lombok.extern.slf4j.Slf4j
;
import
org.hibernate.validator.constraints.Length
;
import
org.springframework.http.MediaType
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
...
...
@@ -48,15 +51,12 @@ import org.springframework.web.multipart.MultipartFile;
*/
@Api
(
tags
=
"任务"
)
@Slf4j
@Validated
@RequestMapping
(
"/task"
)
@RestController
public
class
TaskController
{
@Resource
private
TaskService
taskService
;
@Resource
private
LoginService
loginService
;
@Resource
private
DeviceService
deviceService
;
...
...
@@ -81,11 +81,12 @@ public class TaskController {
//分页获取任务列表
@ApiOperation
(
"获取任务列表"
)
@PostMapping
(
"/getTaskList"
)
@Validated
public
BaseResponse
getTaskList
(
@RequestParam
(
defaultValue
=
""
)
String
taskName
,
@RequestParam
(
defaultValue
=
""
)
String
status
,
@RequestParam
(
defaultValue
=
"1"
)
int
num
,
@RequestParam
(
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
defaultValue
=
""
)
@Length
(
max
=
300
,
message
=
"taskName最大300"
)
String
taskName
,
@RequestParam
(
defaultValue
=
""
)
@Length
(
max
=
5
,
message
=
"status最大300"
)
String
status
,
@RequestParam
(
defaultValue
=
"1"
)
@Max
(
value
=
300
,
message
=
"num最大300"
)
@Min
(
value
=
1
,
message
=
"num最小1"
)
int
num
,
@RequestParam
(
defaultValue
=
"10"
)
@Max
(
value
=
30
,
message
=
"size最大30"
)
@Min
(
value
=
1
,
message
=
"size最小1"
)
int
size
,
HttpServletRequest
request
){
//查询对应的任务列表数据
PageRespVo
<
TaskListVo
>
taskList
=
taskService
.
getTaskList
(
taskName
,
status
,
num
,
size
);
...
...
src/main/java/com/mmc/tmj/filter/LoginFilter.java
浏览文件 @
7bc9f4ac
...
...
@@ -3,6 +3,8 @@ package com.mmc.tmj.filter;
import
com.alibaba.fastjson.JSONObject
;
import
com.mmc.tmj.service.login.LoginService
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Optional
;
import
javax.servlet.Filter
;
import
javax.servlet.FilterChain
;
import
javax.servlet.FilterConfig
;
...
...
@@ -12,6 +14,8 @@ import javax.servlet.ServletResponse;
import
javax.servlet.http.HttpServletRequest
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.http.server.ServletServerHttpRequest
;
import
org.springframework.stereotype.Component
;
...
...
@@ -26,6 +30,9 @@ import org.springframework.stereotype.Component;
@Component
@Slf4j
public
class
LoginFilter
implements
Filter
{
@Value
(
"${mmc.tmj.whiteList}"
)
private
List
<
String
>
whiteList
;
@Autowired
private
LoginService
loginService
;
...
...
@@ -43,16 +50,13 @@ public class LoginFilter implements Filter {
public
void
doFilter
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
HttpServletRequest
httpServletRequest
=(
HttpServletRequest
)
request
;
log
.
info
(
"进入filter"
);
log
.
info
(
"request={}"
,
request
);
log
.
info
(
"httpServletRequest={}"
,
httpServletRequest
.
getHeader
(
"token"
));
//chain.doFilter(request,response);
log
.
info
(
"出去filter"
);
log
.
info
(
"httpServletRequest token={}"
,
httpServletRequest
.
getHeader
(
"token"
));
String
requestURI
=
httpServletRequest
.
getRequestURI
();
log
.
info
(
"requestURI={}"
,
requestURI
);
//白名单过滤
if
(
requestURI
.
equals
(
"/tmj/doc.html"
)||
requestURI
.
startsWith
(
"/tmj/taskPointExportToWord"
)
||
requestURI
.
startsWith
(
"/tmj/webjars"
)
||
requestURI
.
startsWith
(
"/tmj/favicon.ico"
)||
requestURI
.
startsWith
(
"/tmj/swagger"
)||
requestURI
.
startsWith
(
"/tmj/v2"
)){
Optional
<
String
>
first
=
whiteList
.
stream
().
filter
(
s
->
requestURI
.
startsWith
(
s
))
.
findFirst
();
if
(
first
.
isPresent
()){
chain
.
doFilter
(
request
,
response
);
}
else
{
if
(
loginService
.
checkLoginInfo
(
httpServletRequest
.
getHeader
(
"token"
))){
...
...
src/main/java/com/mmc/tmj/service/login/impl/LoginServiceImpl.java
浏览文件 @
7bc9f4ac
...
...
@@ -3,6 +3,7 @@ package com.mmc.tmj.service.login.impl;
import
com.mmc.tmj.entity.other.LoginTokenInfo
;
import
com.mmc.tmj.service.login.LoginService
;
import
com.mmc.tmj.utils.JWTUtil
;
import
com.mmc.tmj.utils.UTF8Util
;
import
io.jsonwebtoken.Claims
;
import
javax.annotation.Resource
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -46,6 +47,8 @@ public class LoginServiceImpl implements LoginService {
return
false
;
}
String
userId
=
claims
.
get
(
JWTUtil
.
X_USER_ID
)+
""
;
String
username
=
UTF8Util
.
decode2Utf8
(
claims
.
get
(
"x-user-name"
)+
""
);
//String password = claims.get("x-user-name")+"";
Object
oldToken
=
redisUserTemplate
.
opsForHash
().
get
(
tokenAllowHash
,
userId
);
if
(
null
!=
oldToken
&&
jwtToken
.
equals
(
oldToken
.
toString
())){
return
true
;
...
...
src/main/java/com/mmc/tmj/utils/UTF8Util.java
0 → 100644
浏览文件 @
7bc9f4ac
package
com
.
mmc
.
tmj
.
utils
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.net.URLEncoder
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
/**
* @Author lcz
* @Date 2022/5/30 14:53
* @Version 1.0
* @description
*/
@Slf4j
public
class
UTF8Util
{
public
static
String
decode2Utf8
(
String
originStr
)
{
String
result
=
null
;
if
(
StringUtils
.
isNotEmpty
(
originStr
))
{
try
{
result
=
URLDecoder
.
decode
(
originStr
,
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
log
.
error
(
e
.
getMessage
());
}
}
return
result
;
}
public
static
String
encode2Utf8
(
String
originStr
)
{
String
result
=
null
;
if
(
StringUtils
.
isNotEmpty
(
originStr
))
{
try
{
result
=
URLEncoder
.
encode
(
originStr
,
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
log
.
error
(
e
.
getMessage
());
}
}
return
result
;
}
}
src/main/resources/application-dev.yml
浏览文件 @
7bc9f4ac
...
...
@@ -14,6 +14,7 @@ spring:
mmc
:
tmj
:
whiteList
:
/tmj/doc.html,/tmj/taskPointExportToWord,/tmj/webjars,/tmj/favicon.ico,/tmj/swagger,/tmj/v2
lastModifyDate
:
'
2022-03-10'
# 0.0.1 :主版本号-次版本号(奇数为开发版本、偶数为稳定版本)-修订版本
version
:
'
0.1.1'
...
...
@@ -32,3 +33,5 @@ logging:
org.springframework.web
:
INFO
file
:
name
:
"
logs/${spring.application.name}.log"
#springboot会自动切分日志,如crm.log.1、crm.log.2
src/main/resources/application-local.yml
浏览文件 @
7bc9f4ac
...
...
@@ -33,6 +33,7 @@ spring:
mmc
:
tmj
:
whiteList
:
/tmj/doc.html,/tmj/taskPointExportToWord,/tmj/webjars,/tmj/favicon.ico,/tmj/swagger,/tmj/v2
lastModifyDate
:
'
2021-07-29'
# 0.0.1 :主版本号-次版本号(奇数为开发版本、偶数为稳定版本)-修订版本
version
:
'
0.1.1'
...
...
src/main/resources/application-prod.yml
浏览文件 @
7bc9f4ac
...
...
@@ -14,6 +14,7 @@ spring:
mmc
:
tmj
:
whiteList
:
/tmj/doc.html,/tmj/taskPointExportToWord,/tmj/webjars,/tmj/favicon.ico,/tmj/swagger,/tmj/v2
lastModifyDate
:
'
2022-03-10'
# 0.0.1 :主版本号-次版本号(奇数为开发版本、偶数为稳定版本)-修订版本
version
:
'
0.1.1'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论