记得上下班打卡 | 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
bb430898
Commit
bb430898
authored
Jun 13, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
演出 redis整理
parent
ca69604b
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
196 additions
and
249 deletions
+196
-249
KylinRedisConst.java
...com/liquidnet/service/kylin/constant/KylinRedisConst.java
+3
-1
DateUtil.java
...c/main/java/com/liquidnet/commons/lang/util/DateUtil.java
+11
-6
KylinPerformancesController.java
...service/kylin/controller/KylinPerformancesController.java
+6
-28
KylinPerformancesServiceImpl.java
...vice/kylin/service/impl/KylinPerformancesServiceImpl.java
+103
-202
DataUtils.java
...ain/java/com/liquidnet/service/kylin/utils/DataUtils.java
+73
-12
No files found.
liquidnet-bus-api/liquidnet-service-kylin-api/src/main/java/com/liquidnet/service/kylin/constant/KylinRedisConst.java
View file @
bb430898
...
@@ -4,7 +4,9 @@ public class KylinRedisConst {
...
@@ -4,7 +4,9 @@ public class KylinRedisConst {
public
static
final
String
FIELDS
=
"kylin:fields:id"
;
public
static
final
String
FIELDS
=
"kylin:fields:id"
;
public
static
final
String
PERFORMANCES
=
"kylin:performances:id:"
;
public
static
final
String
PERFORMANCES
=
"kylin:performances:id:"
;
public
static
final
String
PERFORMANCES_LIST_CITYNAME
=
"kylin:performances:cityName:"
;
public
static
final
String
PERFORMANCES_LIST_CITYNAME
=
"kylin:performances:cityName:"
;
public
static
final
String
PERFORMANCES_LIST_RECOMMEND
=
"kylin:performances:recommend:"
;
public
static
final
String
PERFORMANCES_LIST_ALL
=
"kylin:performances:cityName*"
;
public
static
final
String
PERFORMANCES_LIST_RECOMMEND
=
"kylin:performances:recommend"
;
public
static
final
String
PERFORMANCES_ROADLIST
=
"kylin:performances:roadShowId:"
;
public
static
final
String
PERFORMANCES_RECOMMEND
=
"kylin:performances:recommend:id:"
;
public
static
final
String
PERFORMANCES_RECOMMEND
=
"kylin:performances:recommend:id:"
;
public
static
final
String
PERFORMANCES_INVENTORY
=
"kylin:performances_inventory:ticket:id:"
;
public
static
final
String
PERFORMANCES_INVENTORY
=
"kylin:performances_inventory:ticket:id:"
;
public
static
final
String
SURPLUS_GENERAL
=
"surplusGeneral"
;
public
static
final
String
SURPLUS_GENERAL
=
"surplusGeneral"
;
...
...
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/DateUtil.java
View file @
bb430898
...
@@ -404,8 +404,8 @@ public abstract class DateUtil {
...
@@ -404,8 +404,8 @@ public abstract class DateUtil {
return
yearInterval
*
12
+
monthInterval
;
return
yearInterval
*
12
+
monthInterval
;
}
}
// 获得当天开始时间和结束时间
// 获得当天开始时间和结束时间
jiangxiulong
public
static
HashMap
oneDayStartEnd
(
String
[]
args
)
{
public
static
HashMap
oneDayStartEnd
()
{
HashMap
datas
=
new
HashMap
();
HashMap
datas
=
new
HashMap
();
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
());
calendar
.
setTime
(
new
Date
());
...
@@ -414,18 +414,23 @@ public abstract class DateUtil {
...
@@ -414,18 +414,23 @@ public abstract class DateUtil {
calendar
.
set
(
Calendar
.
SECOND
,
0
);
calendar
.
set
(
Calendar
.
SECOND
,
0
);
Date
start
=
calendar
.
getTime
();
Date
start
=
calendar
.
getTime
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
startStr
=
sdf
.
format
(
start
);
datas
.
put
(
"start"
,
start
);
datas
.
put
(
"start"
,
start
);
datas
.
put
(
"startStr"
,
startStr
);
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
1
);
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
1
);
calendar
.
add
(
Calendar
.
SECOND
,
-
1
);
calendar
.
add
(
Calendar
.
SECOND
,
-
1
);
Date
end
=
calendar
.
getTime
();
Date
end
=
calendar
.
getTime
();
String
endStr
=
sdf
.
format
(
end
);
datas
.
put
(
"end"
,
end
);
datas
.
put
(
"end"
,
end
);
datas
.
put
(
"endStr"
,
endStr
);
return
datas
;
return
datas
;
}
}
// 获取当月第一天
// 获取当月第一天
jiangxiulong
public
static
String
getMonthFirst
()
{
public
static
String
getMonthFirst
()
{
//规定返回日期格式
//规定返回日期格式
SimpleDateFormat
sf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
...
@@ -440,12 +445,12 @@ public abstract class DateUtil {
...
@@ -440,12 +445,12 @@ public abstract class DateUtil {
return
dayFirst
;
return
dayFirst
;
}
}
// 获取某月第一天
// 获取某月第一天
jiangxiulong
public
static
String
getMonthFirst
(
String
month
)
{
public
static
String
getMonthFirst
(
String
month
)
{
return
month
.
concat
(
"-01"
);
return
month
.
concat
(
"-01"
);
}
}
// 获取当月最后一天
// 获取当月最后一天
jiangxiulong
public
static
String
getMonthLast
()
{
public
static
String
getMonthLast
()
{
//获取Calendar
//获取Calendar
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
...
@@ -458,7 +463,7 @@ public abstract class DateUtil {
...
@@ -458,7 +463,7 @@ public abstract class DateUtil {
return
dayLast
+
" 23:59:59"
;
return
dayLast
+
" 23:59:59"
;
}
}
// 获取某月最后一天
// 获取某月最后一天
jiangxiulong
public
static
String
getMonthLast
(
String
month
)
throws
ParseException
{
public
static
String
getMonthLast
(
String
month
)
throws
ParseException
{
// String 转 Date
// String 转 Date
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
...
...
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/controller/KylinPerformancesController.java
View file @
bb430898
...
@@ -13,7 +13,6 @@ import io.swagger.annotations.ApiOperation;
...
@@ -13,7 +13,6 @@ import io.swagger.annotations.ApiOperation;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.text.ParseException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -38,49 +37,35 @@ public class KylinPerformancesController {
...
@@ -38,49 +37,35 @@ public class KylinPerformancesController {
@GetMapping
(
"localList"
)
@GetMapping
(
"localList"
)
@ApiOperation
(
"本地演出列表"
)
@ApiOperation
(
"本地演出列表"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"
timeStart"
,
value
=
"演出开始时间 2021-01-01"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"
cityName"
,
value
=
"城市名称"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"int"
,
name
=
"days"
,
value
=
"时间范围 几天 今天1 三天3。。。"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"int"
,
name
=
"days"
,
value
=
"时间范围 几天 今天1 三天3。。。"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"title"
,
value
=
"演出名称"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"cityName"
,
value
=
"城市名称"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"int"
,
name
=
"type"
,
value
=
"演出类型 101音乐节 102小型演出(livehouse演出) 103巡演 演出类型只有这几个了"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"int"
,
name
=
"type"
,
value
=
"演出类型 101音乐节 102小型演出(livehouse演出) 103巡演 演出类型只有这几个了"
),
// @ApiImplicitParam(type = "query", dataType = "int", name = "type", value = "演出类型 1音乐节 2演唱会 3小型演出 4展览 6舞台剧"),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"Integer"
,
name
=
"isDiscount"
,
value
=
"是否会员优惠 0 1"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"Integer"
,
name
=
"isDiscount"
,
value
=
"是否会员优惠 0 1"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"Integer"
,
name
=
"isAdvance"
,
value
=
"是否优先 0 1"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"Integer"
,
name
=
"isAdvance"
,
value
=
"是否优先 0 1"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"Integer"
,
name
=
"isExclusive"
,
value
=
"是否会员专属 0 1"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"Integer"
,
name
=
"isExclusive"
,
value
=
"是否会员专属 0 1"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"int"
,
name
=
"page"
,
value
=
"页码"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"int"
,
name
=
"size"
,
value
=
"每页数量"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"orderBy"
,
value
=
"排序字段 时间timeStart"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"orderBy"
,
value
=
"排序字段 时间timeStart"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"sort"
,
value
=
"排序方式[DESC ASC]"
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"sort"
,
value
=
"排序方式[DESC ASC]"
),
})
})
public
ResponseDto
<
HashMap
<
String
,
Object
>>
localList
(
public
ResponseDto
<
HashMap
<
String
,
Object
>>
localList
(
@RequestParam
(
defaultValue
=
""
)
String
timeStart
,
@RequestParam
(
defaultValue
=
"0"
)
int
days
,
@RequestParam
(
defaultValue
=
""
)
String
title
,
@RequestParam
(
defaultValue
=
""
)
String
cityName
,
@RequestParam
(
defaultValue
=
""
)
String
cityName
,
@RequestParam
(
defaultValue
=
"0"
)
int
days
,
@RequestParam
(
defaultValue
=
"0"
)
int
type
,
@RequestParam
(
defaultValue
=
"0"
)
int
type
,
@RequestParam
(
defaultValue
=
""
)
Integer
isDiscount
,
@RequestParam
(
defaultValue
=
""
)
Integer
isDiscount
,
@RequestParam
(
defaultValue
=
""
)
Integer
isAdvance
,
@RequestParam
(
defaultValue
=
""
)
Integer
isAdvance
,
@RequestParam
(
defaultValue
=
""
)
Integer
isExclusive
,
@RequestParam
(
defaultValue
=
""
)
Integer
isExclusive
,
@RequestParam
(
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
defaultValue
=
"10"
)
int
size
,
// 排序
// 排序
@RequestParam
(
defaultValue
=
""
)
String
orderBy
,
@RequestParam
(
defaultValue
=
""
)
String
orderBy
,
@RequestParam
(
defaultValue
=
""
)
String
sort
@RequestParam
(
defaultValue
=
""
)
String
sort
)
{
)
{
HashMap
<
String
,
Object
>
result
=
kylinPerformancesService
.
localList
(
HashMap
<
String
,
Object
>
result
=
kylinPerformancesService
.
localList
(
timeStart
,
days
,
title
,
cityName
,
type
,
days
,
cityName
,
type
,
isDiscount
,
isAdvance
,
isExclusive
,
isDiscount
,
isAdvance
,
isExclusive
,
page
,
size
,
orderBy
,
sort
orderBy
,
sort
);
);
return
ResponseDto
.
success
(
result
);
return
ResponseDto
.
success
(
result
);
}
}
...
@@ -100,15 +85,8 @@ public class KylinPerformancesController {
...
@@ -100,15 +85,8 @@ public class KylinPerformancesController {
@GetMapping
(
"exclusiveList"
)
@GetMapping
(
"exclusiveList"
)
@ApiOperation
(
"会员专属演出列表"
)
@ApiOperation
(
"会员专属演出列表"
)
@ApiImplicitParams
({
public
ResponseDto
<
List
<
KylinPerformanceVo
>>
exclusiveList
()
{
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"int"
,
name
=
"page"
,
value
=
"页码"
),
List
<
KylinPerformanceVo
>
result
=
kylinPerformancesService
.
exclusiveList
();
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"int"
,
name
=
"size"
,
value
=
"每页数量"
)
})
public
ResponseDto
<
List
<
KylinPerformanceVo
>>
exclusiveList
(
@RequestParam
(
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
defaultValue
=
"10"
)
int
size
)
{
List
<
KylinPerformanceVo
>
result
=
kylinPerformancesService
.
exclusiveList
(
page
,
size
);
return
ResponseDto
.
success
(
result
);
return
ResponseDto
.
success
(
result
);
}
}
...
@@ -135,7 +113,7 @@ public class KylinPerformancesController {
...
@@ -135,7 +113,7 @@ public class KylinPerformancesController {
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"yearMonth"
,
value
=
"年月 2021-01"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"yearMonth"
,
value
=
"年月 2021-01"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"cityName"
,
value
=
"城市名称"
,
required
=
true
)
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"cityName"
,
value
=
"城市名称"
,
required
=
true
)
})
})
public
ResponseDto
<
List
>
performanceCalendar
(
@RequestParam
String
yearMonth
,
@RequestParam
String
cityName
)
throws
ParseException
{
public
ResponseDto
<
List
>
performanceCalendar
(
@RequestParam
String
yearMonth
,
@RequestParam
String
cityName
)
{
List
result
=
null
;
List
result
=
null
;
result
=
kylinPerformancesService
.
performanceCalendar
(
yearMonth
,
cityName
);
result
=
kylinPerformancesService
.
performanceCalendar
(
yearMonth
,
cityName
);
return
ResponseDto
.
success
(
result
);
return
ResponseDto
.
success
(
result
);
...
...
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/service/impl/KylinPerformancesServiceImpl.java
View file @
bb430898
This diff is collapsed.
Click to expand it.
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/utils/DataUtils.java
View file @
bb430898
...
@@ -17,12 +17,12 @@ import org.springframework.data.domain.Sort;
...
@@ -17,12 +17,12 @@ import org.springframework.data.domain.Sort;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.regex.Pattern
;
import
java.util.List
;
@Component
@Component
public
class
DataUtils
{
public
class
DataUtils
{
...
@@ -35,6 +35,10 @@ public class DataUtils {
...
@@ -35,6 +35,10 @@ public class DataUtils {
private
RedisUtil
redisUtil
;
private
RedisUtil
redisUtil
;
@Autowired
@Autowired
private
MongoVoUtils
mongoVoUtils
;
private
MongoVoUtils
mongoVoUtils
;
@Autowired
private
DataUtils
dataUtils
;
@Autowired
private
RedisTemplate
redisTemplate
;
/**
/**
* 根据 购票须知 id 获取 购票须知文案
* 根据 购票须知 id 获取 购票须知文案
...
@@ -141,7 +145,12 @@ public class DataUtils {
...
@@ -141,7 +145,12 @@ public class DataUtils {
if
(
redisUtil
.
hasKey
(
KylinRedisConst
.
PERFORMANCES
+
performanceId
))
{
if
(
redisUtil
.
hasKey
(
KylinRedisConst
.
PERFORMANCES
+
performanceId
))
{
}
else
{
}
else
{
KylinPerformanceVo
performanceData
=
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"performancesId"
).
is
(
performanceId
)),
KylinPerformanceVo
.
class
,
KylinPerformanceVo
.
class
.
getSimpleName
());
KylinPerformanceVo
performanceData
=
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"performancesId"
).
is
(
performanceId
)),
KylinPerformanceVo
.
class
,
KylinPerformanceVo
.
class
.
getSimpleName
());
List
<
KylinPerformanceVo
>
roadList
=
new
ArrayList
();
if
(
Integer
.
parseInt
(
performanceData
.
getRoadShowId
())
>
0
)
{
roadList
=
dataUtils
.
getRoadList
(
performanceData
.
getRoadShowId
());
}
redisUtil
.
set
(
KylinRedisConst
.
PERFORMANCES
+
performanceId
,
performanceData
);
redisUtil
.
set
(
KylinRedisConst
.
PERFORMANCES
+
performanceId
,
performanceData
);
performanceData
.
setRoadList
(
roadList
);
// 不一起存到演出详情
}
}
return
(
KylinPerformanceVo
)
redisUtil
.
get
(
KylinRedisConst
.
PERFORMANCES
+
performanceId
);
return
(
KylinPerformanceVo
)
redisUtil
.
get
(
KylinRedisConst
.
PERFORMANCES
+
performanceId
);
}
}
...
@@ -369,14 +378,14 @@ public class DataUtils {
...
@@ -369,14 +378,14 @@ public class DataUtils {
int
count
=
0
;
int
count
=
0
;
for
(
int
i
=
0
;
i
<
allTicketId
.
get
(
useTime
).
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
allTicketId
.
get
(
useTime
).
size
();
i
++)
{
String
item
=
allTicketId
.
get
(
useTime
).
get
(
i
);
String
item
=
allTicketId
.
get
(
useTime
).
get
(
i
);
if
(
allTicketId
.
get
(
useTime
).
size
()==
1
)
{
if
(
allTicketId
.
get
(
useTime
).
size
()
==
1
)
{
redisUtil
.
incr
(
performanceIdKey
,
buyCount
);
redisUtil
.
incr
(
performanceIdKey
,
buyCount
);
break
;
break
;
}
}
if
(
i
==
0
)
{
if
(
i
==
0
)
{
count
=
(
int
)
redisUtil
.
get
(
redisKey
+
":"
+
KylinRedisConst
.
TICKET_ID
+
":"
+
item
);
count
=
(
int
)
redisUtil
.
get
(
redisKey
+
":"
+
KylinRedisConst
.
TICKET_ID
+
":"
+
item
);
}
else
{
}
else
{
if
(
count
!=
(
int
)
redisUtil
.
get
(
redisKey
+
":"
+
KylinRedisConst
.
TICKET_ID
+
":"
+
item
))
{
if
(
count
!=
(
int
)
redisUtil
.
get
(
redisKey
+
":"
+
KylinRedisConst
.
TICKET_ID
+
":"
+
item
))
{
redisUtil
.
incr
(
performanceIdKey
,
buyCount
);
redisUtil
.
incr
(
performanceIdKey
,
buyCount
);
break
;
break
;
}
}
...
@@ -391,14 +400,14 @@ public class DataUtils {
...
@@ -391,14 +400,14 @@ public class DataUtils {
int
count
=
0
;
int
count
=
0
;
for
(
int
i
=
0
;
i
<
allTicketId
.
get
(
useTime
).
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
allTicketId
.
get
(
useTime
).
size
();
i
++)
{
String
item
=
allTicketId
.
get
(
useTime
).
get
(
i
);
String
item
=
allTicketId
.
get
(
useTime
).
get
(
i
);
if
(
allTicketId
.
get
(
useTime
).
size
()==
1
)
{
if
(
allTicketId
.
get
(
useTime
).
size
()
==
1
)
{
redisUtil
.
decr
(
performanceIdKey
,
Math
.
abs
(
buyCount
));
redisUtil
.
decr
(
performanceIdKey
,
Math
.
abs
(
buyCount
));
break
;
break
;
}
}
if
(
i
==
0
)
{
if
(
i
==
0
)
{
count
=
(
int
)
redisUtil
.
get
(
redisKey
+
":"
+
KylinRedisConst
.
TICKET_ID
+
":"
+
item
);
count
=
(
int
)
redisUtil
.
get
(
redisKey
+
":"
+
KylinRedisConst
.
TICKET_ID
+
":"
+
item
);
}
else
{
}
else
{
if
(
count
!=
(
int
)
redisUtil
.
get
(
redisKey
+
":"
+
KylinRedisConst
.
TICKET_ID
+
":"
+
item
))
{
if
(
count
!=
(
int
)
redisUtil
.
get
(
redisKey
+
":"
+
KylinRedisConst
.
TICKET_ID
+
":"
+
item
))
{
redisUtil
.
decr
(
performanceIdKey
,
Math
.
abs
(
buyCount
));
redisUtil
.
decr
(
performanceIdKey
,
Math
.
abs
(
buyCount
));
break
;
break
;
}
}
...
@@ -471,13 +480,19 @@ public class DataUtils {
...
@@ -471,13 +480,19 @@ public class DataUtils {
* @param cityName
* @param cityName
*/
*/
public
List
<
KylinPerformanceVo
>
getPerformancesListOfcityName
(
String
cityName
)
{
public
List
<
KylinPerformanceVo
>
getPerformancesListOfcityName
(
String
cityName
)
{
String
redisKey
=
KylinRedisConst
.
PERFORMANCES
.
concat
(
cityName
);
String
redisKey
=
KylinRedisConst
.
PERFORMANCES
_LIST_CITYNAME
.
concat
(
cityName
);
if
(!
redisUtil
.
hasKey
(
redisKey
))
{
if
(!
redisUtil
.
hasKey
(
redisKey
))
{
// 固定查询条件
// 固定查询条件
Query
query
=
new
Query
();
Query
query
=
new
Query
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
query
.
addCriteria
(
Criteria
.
where
(
"timeEnd"
).
gte
(
nowTimeStr
));
query
.
addCriteria
(
Criteria
.
where
(
"timeEnd"
).
gte
(
nowTimeStr
));
// 其他条件
Pattern
cityNameCompile
=
Pattern
.
compile
(
"^.*"
+
cityName
+
".*$"
,
Pattern
.
CASE_INSENSITIVE
);
query
.
addCriteria
(
Criteria
.
where
(
"cityName"
).
regex
(
cityNameCompile
));
// 排序
Sort
sortName
=
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"timeStart"
);
query
.
with
(
sortName
);
// 不要查询的字段
// 不要查询的字段
query
.
fields
().
exclude
(
"details"
);
query
.
fields
().
exclude
(
"details"
);
query
.
fields
().
exclude
(
"noticeImage"
);
query
.
fields
().
exclude
(
"noticeImage"
);
...
@@ -488,6 +503,15 @@ public class DataUtils {
...
@@ -488,6 +503,15 @@ public class DataUtils {
return
(
List
<
KylinPerformanceVo
>)
redisUtil
.
get
(
redisKey
);
return
(
List
<
KylinPerformanceVo
>)
redisUtil
.
get
(
redisKey
);
}
}
/**
* 删除演出列表redis
*
* @param cityName
*/
public
void
delPerformancesListOfcityName
(
String
cityName
)
{
redisUtil
.
del
(
KylinRedisConst
.
ORDER_ENTITIES
.
concat
(
cityName
));
}
/**
/**
* 获取推荐演出列表redis
* 获取推荐演出列表redis
*/
*/
...
@@ -499,6 +523,9 @@ public class DataUtils {
...
@@ -499,6 +523,9 @@ public class DataUtils {
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
query
.
addCriteria
(
Criteria
.
where
(
"timeEnd"
).
gte
(
nowTimeStr
));
query
.
addCriteria
(
Criteria
.
where
(
"timeEnd"
).
gte
(
nowTimeStr
));
// 排序
Sort
sortName
=
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"timeStart"
);
query
.
with
(
sortName
);
// 不要查询的字段
// 不要查询的字段
query
.
fields
().
exclude
(
"details"
);
query
.
fields
().
exclude
(
"details"
);
query
.
fields
().
exclude
(
"noticeImage"
);
query
.
fields
().
exclude
(
"noticeImage"
);
...
@@ -513,11 +540,45 @@ public class DataUtils {
...
@@ -513,11 +540,45 @@ public class DataUtils {
/**
/**
* 删除演出列表redis
* 删除演出列表redis
*
* @param cityName
*/
*/
public
void
delPerformancesListOfcityName
(
String
cityName
)
{
public
void
delPerformancesListIsRecommend
()
{
redisUtil
.
del
(
KylinRedisConst
.
ORDER_ENTITIES
.
concat
(
cityName
));
redisUtil
.
del
(
KylinRedisConst
.
PERFORMANCES_LIST_RECOMMEND
);
}
/**
* 获取所有城市演出列表redis
*/
public
List
<
KylinPerformanceVo
>
getPerformancesListAll
()
{
List
<
KylinPerformanceVo
>
list
=
new
ArrayList
<>();
Set
<
String
>
keys
=
redisTemplate
.
keys
(
KylinRedisConst
.
PERFORMANCES_LIST_ALL
);
for
(
String
key
:
keys
)
{
List
<
KylinPerformanceVo
>
OneCityList
=
(
List
<
KylinPerformanceVo
>)
redisUtil
.
get
(
key
);
list
.
addAll
(
OneCityList
);
}
return
list
;
}
/**
* 获取巡演列表redis
*/
public
List
<
KylinPerformanceVo
>
getRoadList
(
String
roadShowId
)
{
String
redisKey
=
KylinRedisConst
.
PERFORMANCES_ROADLIST
.
concat
(
roadShowId
);
if
(!
redisUtil
.
hasKey
(
redisKey
))
{
List
<
KylinPerformanceVo
>
roadList
=
mongoTemplate
.
find
(
Query
.
query
(
Criteria
.
where
(
"roadShowId"
).
is
(
roadShowId
)),
KylinPerformanceVo
.
class
,
KylinPerformanceVo
.
class
.
getSimpleName
()
);
redisUtil
.
set
(
redisKey
,
roadList
);
}
return
(
List
<
KylinPerformanceVo
>)
redisUtil
.
get
(
redisKey
);
}
/**
* 删除巡演列表redis
*/
public
void
delRoadList
(
String
roadShowId
)
{
redisUtil
.
del
(
KylinRedisConst
.
PERFORMANCES_ROADLIST
.
concat
(
roadShowId
));
}
}
}
}
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