记得上下班打卡 | 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
299ccf38
Commit
299ccf38
authored
Oct 15, 2025
by
wangyifan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
返回手册发布状态字段并重新排序
parent
e8989233
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
1 deletion
+90
-1
SweetManualAppletDto.java
...com/liquidnet/service/sweet/dto/SweetManualAppletDto.java
+6
-0
SweetManualMapper.xml
.../com.liquidnet.service.sweet.mapper/SweetManualMapper.xml
+2
-1
SweetAppletController.java
...idnet/service/sweet/controller/SweetAppletController.java
+2
-0
MarkNearestUtils.java
...a/com/liquidnet/service/sweet/utils/MarkNearestUtils.java
+80
-0
No files found.
liquidnet-bus-do/liquidnet-service-sweet-do/src/main/java/com/liquidnet/service/sweet/dto/SweetManualAppletDto.java
View file @
299ccf38
...
...
@@ -38,6 +38,12 @@ public class SweetManualAppletDto implements Serializable ,Cloneable{
@ApiModelProperty
(
"纬度"
)
private
String
latitude
;
@ApiModelProperty
(
"是否发布手册 0:不发布 1:发布"
)
private
Integer
isReleaseManual
;
@ApiModelProperty
(
"是否距离今日最近 0:否 1:是"
)
private
Integer
isNear
;
private
static
final
SweetManualAppletDto
obj
=
new
SweetManualAppletDto
();
public
static
SweetManualAppletDto
getNew
()
{
...
...
liquidnet-bus-do/liquidnet-service-sweet-do/src/main/resources/com.liquidnet.service.sweet.mapper/SweetManualMapper.xml
View file @
299ccf38
...
...
@@ -132,7 +132,8 @@
p.time_end,
t1.time_sell,
t1.pay_countdown_minute,
t1.is_member
t1.is_member,
sm.is_release_manual
FROM kylin_performances AS p
LEFT JOIN kylin_performance_status AS ps ON p.performances_id = ps.performance_id
LEFT JOIN kylin_performance_relations AS pr ON p.performances_id = pr.performance_id
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/controller/SweetAppletController.java
View file @
299ccf38
...
...
@@ -9,6 +9,7 @@ import com.liquidnet.service.sweet.dto.SweetPerformArtistTimeListDto;
import
com.liquidnet.service.sweet.entity.SweetManualNotify
;
import
com.liquidnet.service.sweet.entity.SweetManualShop
;
import
com.liquidnet.service.sweet.entity.SweetRichtext
;
import
com.liquidnet.service.sweet.utils.MarkNearestUtils
;
import
com.liquidnet.service.sweet.utils.ObjectUtil
;
import
com.liquidnet.service.sweet.utils.RedisArDataUtils
;
import
com.liquidnet.service.sweet.utils.RedisDataUtils
;
...
...
@@ -52,6 +53,7 @@ public class SweetAppletController {
vo
.
add
(
item
);
}
}
MarkNearestUtils
.
markNearestPerformance
(
vo
);
return
ResponseDto
.
success
(
vo
);
}
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/utils/MarkNearestUtils.java
0 → 100644
View file @
299ccf38
package
com
.
liquidnet
.
service
.
sweet
.
utils
;
import
com.liquidnet.service.sweet.dto.SweetManualAppletDto
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.TimeZone
;
public
class
MarkNearestUtils
{
private
static
final
SimpleDateFormat
DATE_FORMAT
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
static
{
// 如果 timeStart 是北京时间,设置时区
DATE_FORMAT
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"GMT+8"
));
}
/**
* 1. 设置列表中距离当前时间最近的演出 isNear = 1,其余为 0
* 2. 按timeStart 降序排列
*
* @param list 演出手册 DTO 列表
*/
public
static
void
markNearestPerformance
(
List
<
SweetManualAppletDto
>
list
)
{
if
(
list
==
null
||
list
.
isEmpty
())
{
return
;
}
Date
now
=
new
Date
();
SweetManualAppletDto
nearest
=
null
;
Date
nearestTime
=
null
;
for
(
SweetManualAppletDto
dto
:
list
)
{
if
(
dto
.
getTimeStart
()
==
null
||
dto
.
getTimeStart
().
trim
().
isEmpty
())
{
dto
.
setIsNear
(
0
);
continue
;
}
try
{
Date
startTime
=
DATE_FORMAT
.
parse
(
dto
.
getTimeStart
());
// 可选:如果只考虑未来或正在进行的演出,可取消下面的注释
if
(
startTime
.
before
(
now
))
continue
;
if
(
nearestTime
==
null
||
startTime
.
before
(
nearestTime
))
{
nearestTime
=
startTime
;
nearest
=
dto
;
}
}
catch
(
ParseException
e
)
{
// 解析失败,设为 0
dto
.
setIsNear
(
0
);
}
}
// 先将所有 isNear 设为 0
for
(
SweetManualAppletDto
dto
:
list
)
{
dto
.
setIsNear
(
0
);
}
// 将最近的那个设为 1
if
(
nearest
!=
null
)
{
nearest
.
setIsNear
(
1
);
}
// 第二步:按 timeStart 降序排序(最新的在前)
list
.
sort
((
a
,
b
)
->
{
if
(
a
.
getTimeStart
()
==
null
&&
b
.
getTimeStart
()
==
null
)
return
0
;
if
(
a
.
getTimeStart
()
==
null
)
return
1
;
if
(
b
.
getTimeStart
()
==
null
)
return
-
1
;
try
{
Date
dateA
=
DATE_FORMAT
.
parse
(
a
.
getTimeStart
());
Date
dateB
=
DATE_FORMAT
.
parse
(
b
.
getTimeStart
());
return
dateB
.
compareTo
(
dateA
);
// 降序:b.compareTo(a)
}
catch
(
ParseException
e
)
{
// 解析失败,保持原顺序(或可抛出异常)
return
0
;
}
});
}
}
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