记得上下班打卡 | 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
f6b7d2ac
Commit
f6b7d2ac
authored
Jun 19, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mongo查询固定条件提出来 演出状态判断提出来
parent
cb79b2a8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
46 deletions
+34
-46
KylinPerformancesServiceImpl.java
...vice/kylin/service/impl/KylinPerformancesServiceImpl.java
+14
-17
DataUtils.java
...ain/java/com/liquidnet/service/kylin/utils/DataUtils.java
+20
-29
No files found.
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/service/impl/KylinPerformancesServiceImpl.java
View file @
f6b7d2ac
...
...
@@ -118,7 +118,16 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM
threeDaysList.add(info);
}*/
HashMap
<
String
,
Object
>
performancesListNotice
=
dataUtils
.
getPerformancesListNotice
();
return
performancesListNotice
;
List
<
KylinPerformanceVo
>
toDayList
=
(
List
<
KylinPerformanceVo
>)
performancesListNotice
.
get
(
"toDayList"
);
List
<
KylinPerformanceVo
>
threeDaysList
=
(
List
<
KylinPerformanceVo
>)
performancesListNotice
.
get
(
"threeDaysList"
);
toDayList
=
checkAppStatus
(
toDayList
);
threeDaysList
=
checkAppStatus
(
threeDaysList
);
HashMap
<
String
,
Object
>
newList
=
new
HashMap
<>();
newList
.
put
(
"toDayList"
,
toDayList
);
newList
.
put
(
"threeDaysList"
,
threeDaysList
);
return
newList
;
}
public
List
<
KylinPerformanceVo
>
recommendList
()
{
...
...
@@ -137,23 +146,11 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM
KylinPerformanceVo
performancesInfo
=
dataUtils
.
getPerformanceVo
(
performancesId
);
// 处理状态 购买 未开始 结束可更改 下架 售馨不可更改
if
(
performancesInfo
.
getAppStatus
()
==
6
||
performancesInfo
.
getAppStatus
()
==
9
||
performancesInfo
.
getAppStatus
()
==
10
)
{
String
stopSellTime
=
performancesInfo
.
getStopSellTime
();
String
sellTime
=
performancesInfo
.
getSellTime
();
String
nowTime
=
DateUtil
.
getNowTime
();
List
<
KylinPerformanceVo
>
KylinPerformanceVoList
=
null
;
KylinPerformanceVoList
.
add
(
performancesInfo
);
KylinPerformanceVoList
=
checkAppStatus
(
KylinPerformanceVoList
);
if
(
1
==
DateUtil
.
compareStrDay
(
sellTime
,
nowTime
))
{
// 未开始
performancesInfo
.
setAppStatus
(
9
);
}
else
{
// 购买
performancesInfo
.
setAppStatus
(
6
);
}
if
(
1
==
DateUtil
.
compareStrDay
(
stopSellTime
,
nowTime
))
{
// 购买
performancesInfo
.
setAppStatus
(
6
);
}
else
{
// 已结束
performancesInfo
.
setAppStatus
(
10
);
}
}
performancesInfo
=
KylinPerformanceVoList
.
get
(
0
);
performancesInfo
.
setMessage
(
KylinPerformanceStatusEnum
.
getName
(
performancesInfo
.
getAppStatus
()));
// 处理距离
...
...
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/utils/DataUtils.java
View file @
f6b7d2ac
...
...
@@ -500,11 +500,7 @@ public class DataUtils {
String
redisKey
=
KylinRedisConst
.
PERFORMANCES_LIST_CITYNAME
.
concat
(
cityName
);
if
(!
redisUtil
.
hasKey
(
redisKey
))
{
// 固定查询条件
Query
query
=
new
Query
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
query
.
addCriteria
(
Criteria
.
where
(
"timeEnd"
).
gte
(
nowTimeStr
));
query
.
addCriteria
(
Criteria
.
where
(
"appStatus"
).
in
(
3
,
6
,
8
,
9
));
Query
query
=
getCommonWhere
();
// 其他条件
Pattern
cityNameCompile
=
Pattern
.
compile
(
"^.*"
+
cityName
+
".*$"
,
Pattern
.
CASE_INSENSITIVE
);
query
.
addCriteria
(
Criteria
.
where
(
"cityName"
).
regex
(
cityNameCompile
));
...
...
@@ -529,11 +525,7 @@ public class DataUtils {
String
redisKey
=
KylinRedisConst
.
PERFORMANCES_LIST_SYSTEM_RECOMMEND
;
if
(!
redisUtil
.
hasKey
(
redisKey
))
{
// 固定条件
Query
query
=
new
Query
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
query
.
addCriteria
(
Criteria
.
where
(
"timeEnd"
).
gte
(
nowTimeStr
));
query
.
addCriteria
(
Criteria
.
where
(
"appStatus"
).
in
(
3
,
6
,
8
,
9
));
Query
query
=
getCommonWhere
();
// 排序
Sort
sortName
=
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"timeStart"
);
Pageable
pageable
=
PageRequest
.
of
(
0
,
8
,
sortName
);
...
...
@@ -557,11 +549,7 @@ public class DataUtils {
String
redisKey
=
KylinRedisConst
.
PERFORMANCES_LIST_NOTICE
;
if
(!
redisUtil
.
hasKey
(
redisKey
))
{
// 固定条件
Query
query
=
new
Query
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
nowTime
.
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
));
query
.
addCriteria
(
Criteria
.
where
(
"timeEnd"
).
gte
(
nowTimeStr
));
query
.
addCriteria
(
Criteria
.
where
(
"appStatus"
).
in
(
3
,
6
,
8
,
9
));
Query
query
=
getCommonWhere
();
// 今天的
HashMap
toDayTime
=
DateUtil
.
oneDayStartEnd
();
...
...
@@ -575,10 +563,7 @@ public class DataUtils {
List
<
KylinPerformanceVo
>
toDayList
=
mongoTemplate
.
find
(
query
,
KylinPerformanceVo
.
class
,
KylinPerformanceVo
.
class
.
getSimpleName
());
// 固定条件
Query
queryT
=
new
Query
();
LocalDateTime
nowTimeT
=
LocalDateTime
.
now
();
String
nowTimeStrT
=
nowTimeT
.
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
));
queryT
.
addCriteria
(
Criteria
.
where
(
"timeEnd"
).
gte
(
nowTimeStrT
));
Query
queryT
=
getCommonWhere
();
// 三天的
Calendar
cal
=
Calendar
.
getInstance
();
...
...
@@ -609,11 +594,7 @@ public class DataUtils {
String
redisKey
=
KylinRedisConst
.
PERFORMANCES_LIST_RECOMMEND
;
if
(!
redisUtil
.
hasKey
(
redisKey
))
{
// 固定条件
Query
query
=
new
Query
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
query
.
addCriteria
(
Criteria
.
where
(
"timeEnd"
).
gte
(
nowTimeStr
));
query
.
addCriteria
(
Criteria
.
where
(
"appStatus"
).
in
(
3
,
6
,
8
,
9
));
Query
query
=
getCommonWhere
();
// 排序
Sort
sortName
=
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"timeStart"
);
query
.
with
(
sortName
);
...
...
@@ -637,11 +618,7 @@ public class DataUtils {
String
redisKey
=
KylinRedisConst
.
PERFORMANCES_LIST_EXCLUSIVE
;
if
(!
redisUtil
.
hasKey
(
redisKey
))
{
// 固定条件
Query
query
=
new
Query
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
query
.
addCriteria
(
Criteria
.
where
(
"timeEnd"
).
gte
(
nowTimeStr
));
query
.
addCriteria
(
Criteria
.
where
(
"appStatus"
).
in
(
3
,
6
,
8
,
9
));
Query
query
=
getCommonWhere
();
// 不要查询的字段
query
.
fields
().
exclude
(
"details"
);
query
.
fields
().
exclude
(
"noticeImage"
);
...
...
@@ -684,4 +661,18 @@ public class DataUtils {
return
(
List
<
KylinPerformanceVo
>)
redisUtil
.
get
(
redisKey
);
}
/**
* 演出搜索固定参数
*/
public
Query
getCommonWhere
()
{
// 固定条件
Query
query
=
new
Query
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
query
.
addCriteria
(
Criteria
.
where
(
"timeEnd"
).
gte
(
nowTimeStr
));
query
.
addCriteria
(
Criteria
.
where
(
"appStatus"
).
in
(
3
,
6
,
8
,
9
));
query
.
addCriteria
(
Criteria
.
where
(
"isShow"
).
is
(
1
));
return
query
;
}
}
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