记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
0bdb0d25
Commit
0bdb0d25
authored
Jun 07, 2021
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+验票API参数校验
parent
55a4afa3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
9 deletions
+38
-9
LnsRegex.java
...in/java/com/liquidnet/commons/lang/constant/LnsRegex.java
+7
-0
KylinStationController.java
...dnet/service/kylin/controller/KylinStationController.java
+31
-9
No files found.
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/constant/LnsRegex.java
0 → 100644
View file @
0bdb0d25
package
com
.
liquidnet
.
commons
.
lang
.
constant
;
public
class
LnsRegex
{
public
static
class
Valid
{
public
static
final
String
DATETIME_FULL
=
"^(((((0[48]|[2468][048]|[3579][26])00))|(([0-9]{2})(0[48]|[2468][048]|[13579][26])))[-|.|/| ]0?2[-|.|/| ]29|(((?!0{1,4})[0-9]{1,4})[-|.|/| ](((0[13-9]|1[0-2]|[13-9])[-|.|/| ](29|30))|((0[13578]|(10|12)|[13578])[-|.|/| ]31)|((0(?:[1-9])|1(?:[0-2])|[1-9])[-|.|/| ](0(?:[1-9])|1[0-9]|2[0-8]|[1-9])))))( ((0?[0-9])|(1[0-9]|2[0-3])):(([1-5][0-9])|(0?[0-9])):(([1-5][0-9])|(0?[0-9])))?$"
;
}
}
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/controller/KylinStationController.java
View file @
0bdb0d25
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.kylin.controller;
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.kylin.controller;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.commons.lang.constant.LnsRegex
;
import
com.liquidnet.commons.lang.core.JwtValidator
;
import
com.liquidnet.commons.lang.core.JwtValidator
;
import
com.liquidnet.commons.lang.util.*
;
import
com.liquidnet.commons.lang.util.*
;
import
com.liquidnet.service.base.ErrorMapping
;
import
com.liquidnet.service.base.ErrorMapping
;
...
@@ -27,8 +28,12 @@ import org.springframework.data.mongodb.core.query.Query;
...
@@ -27,8 +28,12 @@ import org.springframework.data.mongodb.core.query.Query;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.Pattern
;
import
javax.validation.constraints.Size
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
...
@@ -38,11 +43,11 @@ import java.util.*;
...
@@ -38,11 +43,11 @@ import java.util.*;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.function.Predicate
;
import
java.util.function.Predicate
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Api
(
tags
=
"验票"
)
@Api
(
tags
=
"验票"
)
@Slf4j
@Slf4j
@Validated
@RestController
@RestController
@RequestMapping
(
"station"
)
@RequestMapping
(
"station"
)
public
class
KylinStationController
{
public
class
KylinStationController
{
...
@@ -65,7 +70,10 @@ public class KylinStationController {
...
@@ -65,7 +70,10 @@ public class KylinStationController {
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"String"
,
name
=
"passwd"
,
value
=
"密码"
,
example
=
"123456"
),
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"String"
,
name
=
"passwd"
,
value
=
"密码"
,
example
=
"123456"
),
})
})
@PostMapping
(
"login"
)
@PostMapping
(
"login"
)
public
ResponseDto
<
KylinStationLoginVo
>
login
(
@RequestParam
String
mobile
,
@RequestParam
String
passwd
)
{
public
ResponseDto
<
KylinStationLoginVo
>
login
(
@Pattern
(
regexp
=
"\\d{11}"
,
message
=
"手机号格式有误"
)
@RequestParam
String
mobile
,
@NotBlank
(
message
=
"密码不能为空"
)
@RequestParam
String
passwd
)
{
log
.
info
(
"mobile:{},passwd:{}"
,
mobile
,
passwd
);
log
.
info
(
"mobile:{},passwd:{}"
,
mobile
,
passwd
);
return
this
.
loginVerification
(
mobile
,
passwd
,
true
);
return
this
.
loginVerification
(
mobile
,
passwd
,
true
);
...
@@ -77,7 +85,10 @@ public class KylinStationController {
...
@@ -77,7 +85,10 @@ public class KylinStationController {
@ApiImplicitParam
(
type
=
"body"
,
required
=
true
,
dataType
=
"String"
,
name
=
"code"
,
value
=
"验证码"
,
example
=
"111111"
),
@ApiImplicitParam
(
type
=
"body"
,
required
=
true
,
dataType
=
"String"
,
name
=
"code"
,
value
=
"验证码"
,
example
=
"111111"
),
})
})
@PostMapping
(
"login/sms"
)
@PostMapping
(
"login/sms"
)
public
ResponseDto
<
KylinStationLoginVo
>
loginBySms
(
@RequestParam
String
mobile
,
@RequestParam
String
code
)
{
public
ResponseDto
<
KylinStationLoginVo
>
loginBySms
(
@Pattern
(
regexp
=
"\\d{11}"
,
message
=
"手机号格式有误"
)
@RequestParam
String
mobile
,
@Pattern
(
regexp
=
"\\d{6}"
,
message
=
"验证码格式有误"
)
@RequestParam
String
code
)
{
log
.
info
(
"mobile:{},code:{}"
,
mobile
,
code
);
log
.
info
(
"mobile:{},code:{}"
,
mobile
,
code
);
return
this
.
loginVerification
(
mobile
,
code
,
false
);
return
this
.
loginVerification
(
mobile
,
code
,
false
);
...
@@ -108,9 +119,13 @@ public class KylinStationController {
...
@@ -108,9 +119,13 @@ public class KylinStationController {
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"Integer"
,
name
=
"pageSize"
,
value
=
"页记录数"
,
example
=
"5"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"Integer"
,
name
=
"pageSize"
,
value
=
"页记录数"
,
example
=
"5"
),
})
})
@GetMapping
(
"performances"
)
@GetMapping
(
"performances"
)
public
ResponseDto
<
PageInfo
<
KylinStationPerformanceVo
>>
performances
(
@RequestParam
String
mod
,
public
ResponseDto
<
PageInfo
<
KylinStationPerformanceVo
>>
performances
(
@Pattern
(
regexp
=
"\\d{11}"
,
message
=
"手机号格式有误"
)
@RequestParam
String
mod
,
@Size
(
max
=
30
,
message
=
"匹配字符过长"
)
@RequestParam
(
required
=
false
)
String
match
,
@RequestParam
(
required
=
false
)
String
match
,
@Size
(
min
=
1
,
max
=
100
,
message
=
"页码无效"
)
@RequestParam
(
defaultValue
=
"1"
,
required
=
false
)
int
pageNo
,
@RequestParam
(
defaultValue
=
"1"
,
required
=
false
)
int
pageNo
,
@Size
(
min
=
5
,
max
=
10
,
message
=
"页记录数无效"
)
@RequestParam
(
defaultValue
=
"5"
,
required
=
false
)
int
pageSize
)
{
@RequestParam
(
defaultValue
=
"5"
,
required
=
false
)
int
pageSize
)
{
List
<
KylinStationPerformanceVo
>
voList
=
new
ArrayList
<>();
List
<
KylinStationPerformanceVo
>
voList
=
new
ArrayList
<>();
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
...
@@ -144,7 +159,8 @@ public class KylinStationController {
...
@@ -144,7 +159,8 @@ public class KylinStationController {
return
ResponseDto
.
success
(
new
PageInfo
<>());
return
ResponseDto
.
success
(
new
PageInfo
<>());
}
}
if
(
StringUtils
.
isNotBlank
(
match
))
{
if
(
StringUtils
.
isNotBlank
(
match
))
{
Pattern
pattern
=
Pattern
.
compile
(
"^.*"
+
match
+
".*$"
,
Pattern
.
CASE_INSENSITIVE
);
java
.
util
.
regex
.
Pattern
pattern
=
java
.
util
.
regex
.
Pattern
.
compile
(
"^.*"
+
match
+
".*$"
,
java
.
util
.
regex
.
Pattern
.
CASE_INSENSITIVE
);
criteria
.
orOperator
(
criteria
.
orOperator
(
Criteria
.
where
(
"title"
).
regex
(
pattern
),
Criteria
.
where
(
"title"
).
regex
(
pattern
),
Criteria
.
where
(
"cityName"
).
regex
(
pattern
),
Criteria
.
where
(
"cityName"
).
regex
(
pattern
),
...
@@ -244,7 +260,8 @@ public class KylinStationController {
...
@@ -244,7 +260,8 @@ public class KylinStationController {
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"performanceId"
,
value
=
"演出ID[64]"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"performanceId"
,
value
=
"演出ID[64]"
),
})
})
@GetMapping
(
"download"
)
@GetMapping
(
"download"
)
public
ResponseDto
<
KylinStationCheckRefreshVo
>
downloadTicketData
(
@RequestParam
String
performanceId
)
{
public
ResponseDto
<
KylinStationCheckRefreshVo
>
downloadTicketData
(
@NotBlank
(
message
=
"演出ID不能为空"
)
@RequestParam
String
performanceId
)
{
log
.
info
(
"performanceId:{}"
,
performanceId
);
log
.
info
(
"performanceId:{}"
,
performanceId
);
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
...
@@ -315,9 +332,11 @@ public class KylinStationController {
...
@@ -315,9 +332,11 @@ public class KylinStationController {
@ApiOperation
(
value
=
"上载验票数据"
)
@ApiOperation
(
value
=
"上载验票数据"
)
@PostMapping
(
"upload"
)
@PostMapping
(
"upload"
)
public
ResponseDto
<
Object
>
uploadTicketData
(
@RequestBody
List
<
KylinStationCheckOrderParam
>
checkOrderParamList
)
{
public
ResponseDto
<
Object
>
uploadTicketData
(
@RequestBody
List
<
KylinStationCheckOrderParam
>
checkOrderParamList
)
{
log
.
info
(
"checkDataParams:{}"
,
JsonUtils
.
toJson
(
checkOrderParamList
));
log
.
debug
(
"checkDataParams:{}"
,
JsonUtils
.
toJson
(
checkOrderParamList
));
kylinOrderTicketEntitiesService
.
updateByStation
(
checkOrderParamList
);
if
(!
CollectionUtils
.
isEmpty
(
checkOrderParamList
))
{
kylinOrderTicketEntitiesService
.
updateByStation
(
checkOrderParamList
);
}
return
ResponseDto
.
success
();
return
ResponseDto
.
success
();
}
}
...
@@ -328,7 +347,10 @@ public class KylinStationController {
...
@@ -328,7 +347,10 @@ public class KylinStationController {
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"latestUpdateAt"
,
value
=
"最近更新时间[yyyy-MM-dd HH:mm:ss]"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"latestUpdateAt"
,
value
=
"最近更新时间[yyyy-MM-dd HH:mm:ss]"
),
})
})
@PostMapping
(
"refresh"
)
@PostMapping
(
"refresh"
)
public
ResponseDto
<
KylinStationCheckRefreshVo
>
refreshTicketData
(
@RequestParam
String
performanceId
,
@RequestParam
String
latestUpdateAt
)
{
public
ResponseDto
<
KylinStationCheckRefreshVo
>
refreshTicketData
(
@NotBlank
(
message
=
"演出ID不能为空"
)
@RequestParam
String
performanceId
,
@Pattern
(
regexp
=
LnsRegex
.
Valid
.
DATETIME_FULL
,
message
=
"时间格式有误"
)
@RequestParam
String
latestUpdateAt
)
{
log
.
info
(
"refresh performanceId:{},latestUpdateAt:{}"
,
performanceId
,
latestUpdateAt
);
log
.
info
(
"refresh performanceId:{},latestUpdateAt:{}"
,
performanceId
,
latestUpdateAt
);
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment