记得上下班打卡 | 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
0e2230c0
Commit
0e2230c0
authored
Mar 09, 2026
by
wangyifan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
演出阵容代码优化;修改演出阵容删除缓存
parent
7cbf19f4
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
520 additions
and
223 deletions
+520
-223
KylinRedisConst.java
...com/liquidnet/service/kylin/constant/KylinRedisConst.java
+1
-0
KylinPerformanceArtistLineupVo.java
.../kylin/dto/vo/returns/KylinPerformanceArtistLineupVo.java
+62
-0
IKylinPerformancesService.java
...dnet/service/kylin/service/IKylinPerformancesService.java
+23
-13
IKylinArtistPerformanceService.java
...e/kylin/service/admin/IKylinArtistPerformanceService.java
+56
-0
KylinArtistController.java
.../web/controller/zhengzai/kylin/KylinArtistController.java
+16
-84
KylinArtistPerformanceServiceImpl.java
...kylin/service/impl/KylinArtistPerformanceServiceImpl.java
+127
-0
KylinArtistServiceImpl.java
...n/zhengzai/kylin/service/impl/KylinArtistServiceImpl.java
+44
-27
DataUtils.java
...iquidnet/client/admin/zhengzai/kylin/utils/DataUtils.java
+10
-0
RedisKeyExpireConst.java
.../liquidnet/service/base/constant/RedisKeyExpireConst.java
+3
-0
KylinArtistPerformanceMapper.xml
...net.service.kylin.mapper/KylinArtistPerformanceMapper.xml
+6
-6
KylinPerformancesController.java
...service/kylin/controller/KylinPerformancesController.java
+15
-1
KylinPerformancesServiceImpl.java
...vice/kylin/service/impl/KylinPerformancesServiceImpl.java
+106
-92
DataUtils.java
...ain/java/com/liquidnet/service/kylin/utils/DataUtils.java
+51
-0
No files found.
liquidnet-bus-api/liquidnet-service-kylin-api/src/main/java/com/liquidnet/service/kylin/constant/KylinRedisConst.java
View file @
0e2230c0
...
...
@@ -5,6 +5,7 @@ public class KylinRedisConst {
public
static
final
String
PERFORMANCES
=
"kylin:performances:id:"
;
public
static
final
String
PERFORMANCES_INVOICE_REMINDER
=
"kylin:performances:invoice_reminder:id:"
;
public
static
final
String
PERFORMANCES_NOTICE_REMIND_STATUS
=
"kylin:performances:noticeRemindStatus:id:"
;
public
static
final
String
PERFORMANCES_ARTISTS
=
"kylin:performances:artists:id:"
;
public
static
final
String
PERFORMANCES_TRUE_NAME
=
"kylin:performances_true_name:id:"
;
public
static
final
String
PERFORMANCES_LIST_CITY
=
"kylin:performances:city:"
;
public
static
final
String
PERFORMANCES_LIST_SYSTEM_RECOMMEND
=
"kylin:performances:systemRecommend"
;
...
...
liquidnet-bus-api/liquidnet-service-kylin-api/src/main/java/com/liquidnet/service/kylin/dto/vo/returns/KylinPerformanceArtistLineupVo.java
0 → 100644
View file @
0e2230c0
package
com
.
liquidnet
.
service
.
kylin
.
dto
.
vo
.
returns
;
import
com.liquidnet.service.kylin.dao.KylinArtistPerformanceDao
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
@ApiModel
(
"演出场次艺人阵容Vo"
)
public
class
KylinPerformanceArtistLineupVo
implements
Serializable
{
@ApiModelProperty
(
value
=
"场次ID"
)
private
String
ticketTimesId
;
@ApiModelProperty
(
value
=
"场次标题"
)
private
String
timeTitle
;
@ApiModelProperty
(
value
=
"艺人列表"
)
private
List
<
KylinPerformanceTimeArtist
>
artists
;
@Data
@ApiModel
(
"演出场次艺人"
)
public
static
class
KylinPerformanceTimeArtist
{
@ApiModelProperty
(
value
=
"艺人ID"
)
private
String
artistId
;
@ApiModelProperty
(
value
=
"艺人名称"
)
private
String
artistName
;
@ApiModelProperty
(
value
=
"艺人头像"
)
private
String
avatarUrl
;
@ApiModelProperty
(
value
=
"演出ID"
)
private
String
performanceId
;
@ApiModelProperty
(
value
=
"演出标题"
)
private
String
title
;
@ApiModelProperty
(
value
=
"艺人排序 越大越靠前"
)
private
Integer
sort
;
// 👇 静态转换方法:从 Dao 转为 Vo
public
static
KylinPerformanceTimeArtist
from
(
KylinArtistPerformanceDao
dao
)
{
if
(
dao
==
null
)
{
return
null
;
}
KylinPerformanceTimeArtist
artist
=
new
KylinPerformanceTimeArtist
();
artist
.
setArtistId
(
dao
.
getArtistId
());
artist
.
setArtistName
(
dao
.
getArtistName
());
artist
.
setAvatarUrl
(
dao
.
getAvatarUrl
());
artist
.
setPerformanceId
(
dao
.
getPerformanceId
());
artist
.
setTitle
(
dao
.
getTitle
());
artist
.
setSort
(
dao
.
getSort
());
return
artist
;
}
}
}
liquidnet-bus-api/liquidnet-service-kylin-api/src/main/java/com/liquidnet/service/kylin/service/IKylinPerformancesService.java
View file @
0e2230c0
...
...
@@ -4,6 +4,7 @@ import com.liquidnet.service.base.ResponseDto;
import
com.liquidnet.service.kylin.dto.param.KylinCandyItemParam
;
import
com.liquidnet.service.kylin.dto.param.KylinPerformanceSubscribeParam
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinCandyVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.KylinPerformanceArtistLineupVo
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
...
...
@@ -32,33 +33,42 @@ public interface IKylinPerformancesService {
ResponseDto
<
Integer
>
isSubscribe
(
String
performancesId
);
ResponseDto
<
List
<
KylinCandyVo
>>
kylinCandy
(
List
<
KylinCandyItemParam
>
data
,
String
roadShowId
);
/**
* 演出预约
*
* @param param
* @author zjp
* @param param
* @return: com.liquidnet.service.base.ResponseDto<java.lang.String>
* @date 2024/3/12 14:39
*/
ResponseDto
<
String
>
performanceSubscribe
(
HttpServletRequest
request
,
KylinPerformanceSubscribeParam
param
);
*/
ResponseDto
<
String
>
performanceSubscribe
(
HttpServletRequest
request
,
KylinPerformanceSubscribeParam
param
);
/**
* 是否演出预约
*
@author zjp
* @param performancesId
*
* @param performancesId
* @param ticketTimesId
* @author zjp
* @return: com.liquidnet.service.base.ResponseDto<java.lang.Integer>
* @date 2024/3/6 14:45
*/
ResponseDto
<
Integer
>
performanceIsSubscribe
(
String
performancesId
,
String
ticketTimesId
,
String
ticketsId
);
*/
ResponseDto
<
Integer
>
performanceIsSubscribe
(
String
performancesId
,
String
ticketTimesId
,
String
ticketsId
);
/*
* @description:删除预约演出票种
* @author: zjp
* @date: 2024/5/15 14:10
* @param:
* @return:
* @param:
* @return:
**/
void
deleteIsSubscribe
(
String
performancesId
,
String
ticketTimesId
,
String
ticketsId
);
void
deleteIsSubscribe
(
String
performancesId
,
String
ticketTimesId
,
String
ticketsId
);
/**
* 根据演出ID获取演出阵容
* @param performancesId
* @return
*/
List
<
KylinPerformanceArtistLineupVo
>
performanceArtists
(
String
performancesId
);
}
liquidnet-bus-api/liquidnet-service-kylin-api/src/main/java/com/liquidnet/service/kylin/service/admin/IKylinArtistPerformanceService.java
0 → 100644
View file @
0e2230c0
package
com
.
liquidnet
.
service
.
kylin
.
service
.
admin
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.liquidnet.service.kylin.dao.KylinArtistAssociationStatusDto
;
import
com.liquidnet.service.kylin.dao.KylinArtistPerformanceDao
;
import
com.liquidnet.service.kylin.entity.KylinArtistPerformance
;
import
java.util.List
;
import
java.util.Map
;
public
interface
IKylinArtistPerformanceService
extends
IService
<
KylinArtistPerformance
>
{
/**
* 获取指定场次的艺人阵容
* @param performancesId
* @param timesId
* @return
*/
List
<
KylinArtistPerformanceDao
>
getSessionArtists
(
String
performancesId
,
String
timesId
);
/**
* 更新演出艺人排序
*
* @param performanceId
* @param orderData
* @return
*/
boolean
updateArtistOrder
(
String
performanceId
,
List
<
Map
<
String
,
Object
>>
orderData
);
/**
* 删除演出艺人关联
*
* @param mid
* @param performanceId
* @return
*/
int
deletePerformanceArtist
(
Long
mid
,
String
performanceId
);
/**
* 获取所有艺人
* @param performancesId
* @param timesId
* @param keyword
* @return
*/
List
<
KylinArtistAssociationStatusDto
>
getAllArtists
(
String
performancesId
,
String
timesId
,
String
keyword
);
/**
* 修改艺人关联
* @param performancesId
* @param timesId
* @param artistOrders
* @return
*/
boolean
updateArtistAssociations
(
String
performancesId
,
String
timesId
,
List
<
Map
<
String
,
Object
>>
artistOrders
);
}
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-web/src/main/java/com/liquidnet/client/admin/web/controller/zhengzai/kylin/KylinArtistController.java
View file @
0e2230c0
package
com
.
liquidnet
.
client
.
admin
.
web
.
controller
.
zhengzai
.
kylin
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.github.pagehelper.PageInfo
;
import
com.liquidnet.client.admin.common.annotation.Log
;
import
com.liquidnet.client.admin.common.core.controller.BaseController
;
...
...
@@ -14,10 +13,9 @@ import com.liquidnet.service.kylin.dao.KylinArtistPerformanceDao;
import
com.liquidnet.service.kylin.dto.param.ArtistParam
;
import
com.liquidnet.service.kylin.dto.param.ArtistSearchParam
;
import
com.liquidnet.service.kylin.dto.vo.ArtistVo
;
import
com.liquidnet.service.kylin.entity.KylinArtistPerformance
;
import
com.liquidnet.service.kylin.mapper.KylinArtistPerformanceMapper
;
import
com.liquidnet.service.kylin.service.admin.IKylinArtistService
;
import
com.liquidnet.service.kylin.service.admin.IKylinArtistOperationLogService
;
import
com.liquidnet.service.kylin.service.admin.IKylinArtistPerformanceService
;
import
com.liquidnet.service.kylin.service.admin.IKylinArtistService
;
import
io.swagger.annotations.Api
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -26,10 +24,8 @@ import org.springframework.stereotype.Controller;
import
org.springframework.ui.ModelMap
;
import
org.springframework.web.bind.annotation.*
;
import
com.liquidnet.service.kylin.entity.KylinArtist
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
...
...
@@ -56,7 +52,8 @@ public class KylinArtistController extends BaseController {
private
IKylinArtistOperationLogService
operationLogService
;
@Autowired
private
KylinArtistPerformanceMapper
artistPerformanceMapper
;
private
IKylinArtistPerformanceService
artistPerformanceService
;
@GetMapping
(
"/create"
)
@RequiresPermissions
(
"kylin:artist:create"
)
...
...
@@ -64,6 +61,7 @@ public class KylinArtistController extends BaseController {
mmap
.
put
(
"platformUrl"
,
platformUrl
);
return
prefix
+
"/create"
;
}
@GetMapping
(
"/update/{artistId}"
)
@RequiresPermissions
(
"kylin:artist:update"
)
public
String
update
(
@PathVariable
(
"artistId"
)
String
artistId
,
ModelMap
mmap
)
{
...
...
@@ -206,8 +204,8 @@ public class KylinArtistController extends BaseController {
@PostMapping
(
"/operationLogList"
)
@ResponseBody
public
TableDataInfo
operationLogList
(
String
artistId
,
Integer
pageNum
,
Integer
pageSize
)
{
PageInfo
<
KylinArtistOperationLogDao
>
result
=
operationLogService
.
getOperationLogs
(
artistId
,
pageNum
,
pageSize
);
PageInfo
<
KylinArtistOperationLogDao
>
result
=
operationLogService
.
getOperationLogs
(
artistId
,
pageNum
,
pageSize
);
return
getDataTable
(
result
.
getList
());
}
...
...
@@ -221,12 +219,7 @@ public class KylinArtistController extends BaseController {
if
(
performancesId
==
null
||
timesId
==
null
)
{
return
error
(
"参数不能为空"
);
}
// 查询该场次的艺人
List
<
KylinArtistPerformanceDao
>
artists
=
artistPerformanceMapper
.
selectArtistsByPerformanceAndTimes
(
performancesId
,
timesId
);
List
<
KylinArtistPerformanceDao
>
artists
=
artistPerformanceService
.
getSessionArtists
(
performancesId
,
timesId
);
return
AjaxResult
.
success
(
artists
);
}
catch
(
Exception
e
)
{
return
error
(
"获取艺人阵容失败: "
+
e
.
getMessage
());
...
...
@@ -248,19 +241,7 @@ public class KylinArtistController extends BaseController {
if
(
orderData
==
null
||
orderData
.
isEmpty
())
{
return
error
(
"排序数据不能为空"
);
}
// 更新每个艺人的排序
for
(
Map
<
String
,
Object
>
item
:
orderData
)
{
Long
mid
=
Long
.
valueOf
(
item
.
get
(
"mid"
).
toString
());
Integer
sort
=
Integer
.
valueOf
(
item
.
get
(
"sort"
).
toString
());
KylinArtistPerformance
entity
=
artistPerformanceMapper
.
selectById
(
mid
);
if
(
entity
!=
null
)
{
entity
.
setSort
(
sort
);
artistPerformanceMapper
.
updateById
(
entity
);
}
}
boolean
updateResult
=
artistPerformanceService
.
updateArtistOrder
(
performancesId
,
orderData
);
return
success
(
"排序更新成功"
);
}
catch
(
Exception
e
)
{
return
error
(
"更新排序失败: "
+
e
.
getMessage
());
...
...
@@ -278,8 +259,7 @@ public class KylinArtistController extends BaseController {
if
(
mid
==
null
)
{
return
error
(
"参数错误"
);
}
int
result
=
artistPerformanceMapper
.
deleteById
(
mid
);
int
result
=
artistPerformanceService
.
deletePerformanceArtist
(
mid
,
performancesId
);
if
(
result
>
0
)
{
return
success
(
"删除成功"
);
}
else
{
...
...
@@ -291,41 +271,13 @@ public class KylinArtistController extends BaseController {
}
/**
* 获取所有艺人
以供关联
* 获取所有艺人
*/
@GetMapping
(
"/getAllArtists"
)
@ResponseBody
public
AjaxResult
getAllArtists
(
String
performancesId
,
String
timesId
,
String
keyword
)
{
try
{
// 1. 获取所有艺人
List
<
KylinArtist
>
allArtists
=
kylinArtistService
.
list
(
new
QueryWrapper
<
KylinArtist
>()
.
like
(
keyword
!=
null
&&
!
keyword
.
isEmpty
(),
"artist_name"
,
keyword
)
.
orderByDesc
(
"created_at"
));
// 2. 获取当前场次已关联的艺人,用 Map 保留各自的 sort 值
List
<
KylinArtistPerformanceDao
>
associatedArtists
=
artistPerformanceMapper
.
selectArtistsByPerformanceAndTimes
(
performancesId
,
timesId
);
// key: artistId value: 演出关联表中的 sort(越大越靠前)
Map
<
String
,
Integer
>
associatedSortMap
=
associatedArtists
.
stream
()
.
collect
(
Collectors
.
toMap
(
KylinArtistPerformanceDao:
:
getArtistId
,
KylinArtistPerformanceDao:
:
getSort
,
(
existing
,
replacement
)
->
existing
// 重复 key 保留已有值
));
// 3. 组装返回结果
List
<
KylinArtistAssociationStatusDto
>
resultList
=
allArtists
.
stream
().
map
(
artist
->
{
KylinArtistAssociationStatusDto
dto
=
new
KylinArtistAssociationStatusDto
();
dto
.
setArtistId
(
artist
.
getArtistId
());
dto
.
setArtistName
(
artist
.
getArtistName
());
dto
.
setAvatarUrl
(
artist
.
getAvatarUrl
());
boolean
associated
=
associatedSortMap
.
containsKey
(
artist
.
getArtistId
());
dto
.
setAssociated
(
associated
);
// sort 取演出关联表的值;未关联的艺人 sort 置 0
dto
.
setSort
(
associated
?
associatedSortMap
.
get
(
artist
.
getArtistId
())
:
0
);
return
dto
;
}).
collect
(
Collectors
.
toList
());
List
<
KylinArtistAssociationStatusDto
>
resultList
=
artistPerformanceService
.
getAllArtists
(
performancesId
,
timesId
,
keyword
);
return
AjaxResult
.
success
(
resultList
);
}
catch
(
Exception
e
)
{
return
error
(
"获取艺人列表失败: "
+
e
.
getMessage
());
...
...
@@ -334,6 +286,7 @@ public class KylinArtistController extends BaseController {
/**
* 修改艺人关联
*
* @param payload
* @return
*/
...
...
@@ -344,28 +297,7 @@ public class KylinArtistController extends BaseController {
String
performancesId
=
(
String
)
payload
.
get
(
"performancesId"
);
String
timesId
=
(
String
)
payload
.
get
(
"timesId"
);
List
<
Map
<
String
,
Object
>>
artistOrders
=
(
List
<
Map
<
String
,
Object
>>)
payload
.
get
(
"artistOrders"
);
// 1. 删除当前场次所有已关联的艺人
artistPerformanceMapper
.
delete
(
new
QueryWrapper
<
KylinArtistPerformance
>()
.
eq
(
"performances_id"
,
performancesId
)
.
eq
(
"times_id"
,
timesId
));
// 2. 按前端传入的顺序重新关联,sort 越大越靠前
if
(
artistOrders
!=
null
&&
!
artistOrders
.
isEmpty
())
{
for
(
Map
<
String
,
Object
>
item
:
artistOrders
)
{
String
artistId
=
(
String
)
item
.
get
(
"artistId"
);
Integer
sort
=
item
.
get
(
"sort"
)
!=
null
?
Integer
.
valueOf
(
item
.
get
(
"sort"
).
toString
())
:
0
;
KylinArtistPerformance
newAssociation
=
new
KylinArtistPerformance
();
newAssociation
.
setPerformancesId
(
performancesId
);
newAssociation
.
setTimesId
(
timesId
);
newAssociation
.
setArtistId
(
artistId
);
newAssociation
.
setSort
(
sort
);
artistPerformanceMapper
.
insert
(
newAssociation
);
}
}
boolean
result
=
artistPerformanceService
.
updateArtistAssociations
(
performancesId
,
timesId
,
artistOrders
);
return
success
(
"关联更新成功"
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"error"
,
e
);
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/service/impl/KylinArtistPerformanceServiceImpl.java
0 → 100644
View file @
0e2230c0
package
com
.
liquidnet
.
client
.
admin
.
zhengzai
.
kylin
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.liquidnet.client.admin.zhengzai.kylin.utils.DataUtils
;
import
com.liquidnet.service.kylin.dao.KylinArtistAssociationStatusDto
;
import
com.liquidnet.service.kylin.dao.KylinArtistPerformanceDao
;
import
com.liquidnet.service.kylin.entity.KylinArtist
;
import
com.liquidnet.service.kylin.entity.KylinArtistPerformance
;
import
com.liquidnet.service.kylin.mapper.KylinArtistMapper
;
import
com.liquidnet.service.kylin.mapper.KylinArtistPerformanceMapper
;
import
com.liquidnet.service.kylin.service.admin.IKylinArtistPerformanceService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
public
class
KylinArtistPerformanceServiceImpl
extends
ServiceImpl
<
KylinArtistPerformanceMapper
,
KylinArtistPerformance
>
implements
IKylinArtistPerformanceService
{
@Autowired
private
KylinArtistPerformanceMapper
artistPerformanceMapper
;
@Autowired
private
KylinArtistMapper
artistMapper
;
@Autowired
private
DataUtils
dataUtils
;
@Override
public
List
<
KylinArtistPerformanceDao
>
getSessionArtists
(
String
performancesId
,
String
timesId
)
{
// 查询该场次的艺人
return
artistPerformanceMapper
.
selectArtistsByPerformanceAndTimes
(
performancesId
,
timesId
);
}
@Override
public
boolean
updateArtistOrder
(
String
performanceId
,
List
<
Map
<
String
,
Object
>>
orderData
)
{
// 更新每个艺人的排序
for
(
Map
<
String
,
Object
>
item
:
orderData
)
{
Long
mid
=
Long
.
valueOf
(
item
.
get
(
"mid"
).
toString
());
Integer
sort
=
Integer
.
valueOf
(
item
.
get
(
"sort"
).
toString
());
log
.
info
(
"[updateArtistOrder] mid: {}, sort: {}"
,
mid
,
sort
);
KylinArtistPerformance
entity
=
artistPerformanceMapper
.
selectById
(
mid
);
if
(
entity
!=
null
)
{
entity
.
setSort
(
sort
);
artistPerformanceMapper
.
updateById
(
entity
);
}
}
// 删除缓存演出阵容
dataUtils
.
delPerformanceArtists
(
performanceId
);
return
true
;
}
@Override
public
int
deletePerformanceArtist
(
Long
mid
,
String
performanceId
)
{
// 删除缓存演出阵容
dataUtils
.
delPerformanceArtists
(
performanceId
);
return
artistPerformanceMapper
.
deleteById
(
mid
);
}
@Override
public
List
<
KylinArtistAssociationStatusDto
>
getAllArtists
(
String
performancesId
,
String
timesId
,
String
keyword
)
{
// 1. 获取所有艺人
List
<
KylinArtist
>
allArtists
=
artistMapper
.
selectList
(
new
QueryWrapper
<
KylinArtist
>()
.
like
(
keyword
!=
null
&&
!
keyword
.
isEmpty
(),
"artist_name"
,
keyword
)
.
orderByDesc
(
"created_at"
));
// 2. 获取当前场次已关联的艺人,用 Map 保留各自的 sort 值
List
<
KylinArtistPerformanceDao
>
associatedArtists
=
artistPerformanceMapper
.
selectArtistsByPerformanceAndTimes
(
performancesId
,
timesId
);
// key: artistId value: 演出关联表中的 sort(越大越靠前)
Map
<
String
,
Integer
>
associatedSortMap
=
associatedArtists
.
stream
()
.
collect
(
Collectors
.
toMap
(
KylinArtistPerformanceDao:
:
getArtistId
,
KylinArtistPerformanceDao:
:
getSort
,
(
existing
,
replacement
)
->
existing
// 重复 key 保留已有值
));
// 3. 组装返回结果
List
<
KylinArtistAssociationStatusDto
>
resultList
=
allArtists
.
stream
().
map
(
artist
->
{
KylinArtistAssociationStatusDto
dto
=
new
KylinArtistAssociationStatusDto
();
dto
.
setArtistId
(
artist
.
getArtistId
());
dto
.
setArtistName
(
artist
.
getArtistName
());
dto
.
setAvatarUrl
(
artist
.
getAvatarUrl
());
boolean
associated
=
associatedSortMap
.
containsKey
(
artist
.
getArtistId
());
dto
.
setAssociated
(
associated
);
// sort 取演出关联表的值;未关联的艺人 sort 置 0
dto
.
setSort
(
associated
?
associatedSortMap
.
get
(
artist
.
getArtistId
())
:
0
);
return
dto
;
}).
collect
(
Collectors
.
toList
());
return
resultList
;
}
@Override
public
boolean
updateArtistAssociations
(
String
performancesId
,
String
timesId
,
List
<
Map
<
String
,
Object
>>
artistOrders
)
{
// 1. 删除当前场次所有已关联的艺人
artistPerformanceMapper
.
delete
(
new
QueryWrapper
<
KylinArtistPerformance
>()
.
eq
(
"performances_id"
,
performancesId
)
.
eq
(
"times_id"
,
timesId
));
// 2. 按前端传入的顺序重新关联,sort 越大越靠前
if
(
artistOrders
!=
null
&&
!
artistOrders
.
isEmpty
())
{
for
(
Map
<
String
,
Object
>
item
:
artistOrders
)
{
String
artistId
=
(
String
)
item
.
get
(
"artistId"
);
Integer
sort
=
item
.
get
(
"sort"
)
!=
null
?
Integer
.
parseInt
(
item
.
get
(
"sort"
).
toString
())
:
0
;
KylinArtistPerformance
newAssociation
=
new
KylinArtistPerformance
();
newAssociation
.
setPerformancesId
(
performancesId
);
newAssociation
.
setTimesId
(
timesId
);
newAssociation
.
setArtistId
(
artistId
);
newAssociation
.
setSort
(
sort
);
artistPerformanceMapper
.
insert
(
newAssociation
);
}
}
// 删除缓存演出阵容
dataUtils
.
delPerformanceArtists
(
performancesId
);
return
true
;
}
}
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/service/impl/KylinArtistServiceImpl.java
View file @
0e2230c0
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.liquidnet.client.admin.zhengzai.kylin.utils.DataUtils
;
import
com.liquidnet.commons.lang.util.BeanUtil
;
import
com.liquidnet.commons.lang.util.DateUtil
;
import
com.liquidnet.commons.lang.util.IDGenerator
;
...
...
@@ -17,8 +18,8 @@ import com.liquidnet.service.kylin.entity.KylinArtistAlbum;
import
com.liquidnet.service.kylin.mapper.KylinArtistAlbumMapper
;
import
com.liquidnet.service.kylin.mapper.KylinArtistMapper
;
import
com.liquidnet.service.kylin.mapper.KylinArtistPerformanceMapper
;
import
com.liquidnet.service.kylin.service.admin.IKylinArtistService
;
import
com.liquidnet.service.kylin.service.admin.IKylinArtistOperationLogService
;
import
com.liquidnet.service.kylin.service.admin.IKylinArtistService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -26,7 +27,6 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -56,6 +56,9 @@ public class KylinArtistServiceImpl extends ServiceImpl<KylinArtistMapper, Kylin
@Autowired
private
IKylinArtistOperationLogService
operationLogService
;
@Autowired
private
DataUtils
dataUtils
;
/**
* 创建艺人
*/
...
...
@@ -98,17 +101,17 @@ public class KylinArtistServiceImpl extends ServiceImpl<KylinArtistMapper, Kylin
public
Boolean
update
(
ArtistParam
param
)
{
try
{
String
artistId
=
param
.
getArtistId
();
// 获取原始数据用于对比
KylinArtist
oldArtist
=
artistMapper
.
selectOne
(
new
UpdateWrapper
<
KylinArtist
>().
eq
(
"artist_id"
,
artistId
).
eq
(
"status"
,
1
)
);
if
(
oldArtist
==
null
)
{
log
.
warn
(
"艺人不存在: {}"
,
artistId
);
return
false
;
}
// 校验艺人名称是否已被其他艺人使用
KylinArtist
existArtist
=
artistMapper
.
selectByArtistName
(
param
.
getArtistName
());
if
(
existArtist
!=
null
&&
!
existArtist
.
getArtistId
().
equals
(
artistId
))
{
...
...
@@ -137,6 +140,8 @@ public class KylinArtistServiceImpl extends ServiceImpl<KylinArtistMapper, Kylin
operationLogService
.
recordLog
(
artistId
,
2
,
logContent
);
}
// TODO 根据艺人ID查询所有关联的演出,然后删除缓存中对应的演出阵容
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"修改艺人失败"
,
e
);
...
...
@@ -151,20 +156,30 @@ public class KylinArtistServiceImpl extends ServiceImpl<KylinArtistMapper, Kylin
KylinArtist
data
=
artistMapper
.
selectOne
(
new
UpdateWrapper
<
KylinArtist
>().
eq
(
"artist_id"
,
artistId
).
eq
(
"status"
,
1
)
);
ArtistVo
artistVo
=
new
ArtistVo
();
if
(
data
!=
null
)
{
BeanUtils
.
copyProperties
(
data
,
artistVo
);
// 设置艺人类型名称
if
(
data
.
getArtistType
()
!=
null
)
{
String
typeName
=
""
;
switch
(
data
.
getArtistType
())
{
case
1
:
typeName
=
"音乐人"
;
break
;
case
2
:
typeName
=
"艺术家"
;
break
;
case
3
:
typeName
=
"厂牌"
;
break
;
case
4
:
typeName
=
"品牌方"
;
break
;
default
:
typeName
=
"未知"
;
break
;
case
1
:
typeName
=
"音乐人"
;
break
;
case
2
:
typeName
=
"艺术家"
;
break
;
case
3
:
typeName
=
"厂牌"
;
break
;
case
4
:
typeName
=
"品牌方"
;
break
;
default
:
typeName
=
"未知"
;
break
;
}
artistVo
.
setArtistTypeName
(
typeName
);
}
...
...
@@ -177,7 +192,7 @@ public class KylinArtistServiceImpl extends ServiceImpl<KylinArtistMapper, Kylin
.
collect
(
Collectors
.
toList
());
artistVo
.
setAlbumImages
(
imageUrls
);
}
// 格式化时间显示
if
(
data
.
getCreatedAt
()
!=
null
)
{
artistVo
.
setCreatedAt
(
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
data
.
getCreatedAt
()));
...
...
@@ -220,12 +235,12 @@ public class KylinArtistServiceImpl extends ServiceImpl<KylinArtistMapper, Kylin
PageInfo
<
KylinArtistDao
>
pageInfoTmp
=
null
;
try
{
PageHelper
.
startPage
(
param
.
getPageNum
(),
param
.
getPageSize
());
Map
<
String
,
Object
>
paramMap
=
BeanUtil
.
convertBeanToMap
(
param
);
log
.
info
(
"艺人列表查询参数: {}"
,
paramMap
);
List
<
KylinArtistDao
>
list
=
artistMapper
.
searchArtistList
(
paramMap
);
pageInfoTmp
=
new
PageInfo
<>(
list
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取艺人列表失败"
,
e
);
...
...
@@ -246,7 +261,7 @@ public class KylinArtistServiceImpl extends ServiceImpl<KylinArtistMapper, Kylin
KylinArtist
kylinArtist
=
new
KylinArtist
();
kylinArtist
.
setUpdatedAt
(
updatedAt
);
kylinArtist
.
setStatus
(
0
);
artistMapper
.
update
(
kylinArtist
,
new
UpdateWrapper
<
KylinArtist
>().
in
(
"artist_id"
,
artistIds
)
...
...
@@ -258,14 +273,16 @@ public class KylinArtistServiceImpl extends ServiceImpl<KylinArtistMapper, Kylin
KylinArtist
artist
=
artistMapper
.
selectOne
(
new
UpdateWrapper
<
KylinArtist
>().
eq
(
"artist_id"
,
artistId
)
);
artistAlbumMapper
.
deleteByArtistId
(
artistId
);
// 记录删除日志
String
logContent
=
"删除艺人:"
+
(
artist
!=
null
?
artist
.
getArtistName
()
+
"(ID:"
+
artistId
+
")"
:
artistId
);
operationLogService
.
recordLog
(
artistId
,
3
,
logContent
);
}
// TODO 根据艺人ID查询所有关联的演出
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"删除艺人失败"
,
e
);
...
...
@@ -294,7 +311,7 @@ public class KylinArtistServiceImpl extends ServiceImpl<KylinArtistMapper, Kylin
private
void
saveAlbumImages
(
String
artistId
,
List
<
String
>
imageUrls
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
int
sort
=
imageUrls
.
size
();
for
(
String
imageUrl
:
imageUrls
)
{
KylinArtistAlbum
album
=
new
KylinArtistAlbum
();
album
.
setAlbumId
(
IDGenerator
.
nextSnowId
());
...
...
@@ -304,7 +321,7 @@ public class KylinArtistServiceImpl extends ServiceImpl<KylinArtistMapper, Kylin
album
.
setStatus
(
1
);
album
.
setCreatedAt
(
now
);
album
.
setUpdatedAt
(
now
);
artistAlbumMapper
.
insert
(
album
);
}
}
...
...
@@ -316,12 +333,12 @@ public class KylinArtistServiceImpl extends ServiceImpl<KylinArtistMapper, Kylin
StringBuilder
content
=
new
StringBuilder
();
content
.
append
(
"新增艺人: ["
).
append
(
param
.
getArtistName
()).
append
(
"];"
);
content
.
append
(
"类型: ["
).
append
(
getArtistTypeName
(
param
.
getArtistType
())).
append
(
"];"
);
if
(
param
.
getIntroduction
()
!=
null
&&
!
param
.
getIntroduction
().
isEmpty
())
{
String
intro
=
param
.
getIntroduction
();
content
.
append
(
"介绍: "
).
append
(
intro
.
length
()
>
50
?
intro
.
substring
(
0
,
50
)
+
"..."
:
intro
);
}
//
if (param.getIntroduction() != null && !param.getIntroduction().isEmpty()) {
//
String intro = param.getIntroduction();
//
content.append("介绍: ").append(intro.length() > 50 ? intro.substring(0, 50) + "..." : intro);
//
}
return
content
.
toString
();
}
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/utils/DataUtils.java
View file @
0e2230c0
...
...
@@ -621,4 +621,14 @@ public class DataUtils {
public
static
ArrayList
<
KylinOrderCoupons
>
getKylinOrderCouponsArrayList
()
{
return
(
ArrayList
<
KylinOrderCoupons
>)
kylinOrderCouponsArrayList
.
clone
();
}
/**
* 删除演出阵容 缓存
* @param performancesId
*/
public
void
delPerformanceArtists
(
String
performancesId
)
{
final
String
redisKey
=
KylinRedisConst
.
PERFORMANCES_ARTISTS
+
performancesId
;
redisDataSourceUtil
.
getRedisKylinUtil
().
del
(
redisKey
);
}
}
liquidnet-bus-common/liquidnet-common-service-base/src/main/java/com/liquidnet/service/base/constant/RedisKeyExpireConst.java
View file @
0e2230c0
...
...
@@ -53,4 +53,7 @@ public class RedisKeyExpireConst {
public
static
final
long
GOBLIN_BRACELET_USER_EXPIRE
=
30
*
24
*
60
*
60
;
// GOBLIN_BRACELET_RELATED_ORDER 过期30天
public
static
final
long
GOBLIN_BRACELET_RELATED_ORDER_EXPIRE
=
30
*
24
*
60
*
60
;
// 演出关联阵容缓存过期时间
public
static
final
long
PERFORMANCES_ARTISTS_EXPIRE
=
30
*
24
*
60
*
60
;
}
liquidnet-bus-do/liquidnet-service-kylin-do/src/main/resources/com.liquidnet.service.kylin.mapper/KylinArtistPerformanceMapper.xml
View file @
0e2230c0
...
...
@@ -23,12 +23,12 @@
</select>
<!-- 根据艺人ID获取关联演出数量 -->
<select
id=
"countPerformancesByArtistId"
parameterType=
"java.lang.String"
resultType=
"java.lang.Integer"
>
SELECT COUNT(1)
FROM kylin_artist_performance
WHERE artist_id = #{artistId}
AND status = 1
</select
>
<!-- <select id="countPerformancesByArtistId" parameterType="java.lang.String" resultType="java.lang.Integer">--
>
<!-- SELECT COUNT(1)-->
<!-- FROM kylin_artist_performance-->
<!-- WHERE artist_id = #{artistId}-->
<!-- AND status = 1-->
<!-- </select>--
>
<!-- 根据演出ID和场次ID查询艺人阵容 -->
<select
id=
"selectArtistsByPerformanceAndTimes"
resultType=
"com.liquidnet.service.kylin.dao.KylinArtistPerformanceDao"
>
...
...
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/controller/KylinPerformancesController.java
View file @
0e2230c0
...
...
@@ -7,11 +7,11 @@ import com.liquidnet.service.base.ResponseDto;
import
com.liquidnet.service.kylin.dto.param.KylinCandyParam
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinCandyVo
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.KylinPerformanceArtistLineupVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.PayDetailVo
;
import
com.liquidnet.service.kylin.service.IKylinLackRegistersService
;
import
com.liquidnet.service.kylin.service.IKylinPerformancesService
;
import
com.liquidnet.service.kylin.service.impl.KylinPerformancesServiceImpl
;
import
com.liquidnet.service.kylin.utils.DataUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
@@ -228,6 +228,20 @@ public class KylinPerformancesController {
}
}
@GetMapping
(
"artists/{performancesId}"
)
@ApiOperation
(
"演出艺人阵容及场次详情"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"path"
,
dataType
=
"String"
,
name
=
"performancesId"
,
value
=
"演出id"
,
required
=
true
)
})
public
ResponseDto
<
List
<
KylinPerformanceArtistLineupVo
>>
performanceArtists
(
@PathVariable
(
"performancesId"
)
String
performancesId
)
{
List
<
KylinPerformanceArtistLineupVo
>
result
=
kylinPerformancesService
.
performanceArtists
(
performancesId
);
if
(
result
!=
null
)
{
return
ResponseDto
.
success
(
result
);
}
else
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20700"
));
}
}
@GetMapping
(
"payDetail"
)
@ApiOperation
(
"支付前详情"
)
@ApiImplicitParams
({
...
...
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/service/impl/KylinPerformancesServiceImpl.java
View file @
0e2230c0
...
...
@@ -23,6 +23,7 @@ import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import
com.liquidnet.service.kylin.dto.vo.partner.KylinTicketExpressModuleVo
;
import
com.liquidnet.service.kylin.dto.vo.partner.KylinTicketPartnerVo
;
import
com.liquidnet.service.kylin.dto.vo.partner.KylinTicketTimesPartnerVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.KylinPerformanceArtistLineupVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.PayDetailVo
;
import
com.liquidnet.service.kylin.service.IKylinPerformancesService
;
import
com.liquidnet.service.kylin.utils.DataUtils
;
...
...
@@ -318,7 +319,7 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService {
performancesInfo
.
setIsInvoiceReminder
(
dataUtils
.
getPerformanceInvoiceReminder
(
performancesId
));
performancesInfo
.
setFieldAddress
(
dataUtils
.
getFieldAddressByFieldId
(
performancesInfo
.
getFieldId
()));
performancesInfo
.
setNoticeRemindStatus
(
dataUtils
.
getPerformanceNoticeRemindStatus
(
performancesId
));
List
<
OrderRefundPoundage
>
result
=
dataUtils
.
getRefundPoundage
(
1
,
performancesId
);
List
<
OrderRefundPoundage
>
result
=
dataUtils
.
getRefundPoundage
(
1
,
performancesId
);
performancesInfo
.
setRefundPoundages
(
result
);
return
performancesInfo
;
}
...
...
@@ -379,10 +380,10 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService {
info
.
put
(
"field_name"
,
performancesInfo
.
getFieldName
());
info
.
put
(
"title"
,
performancesInfo
.
getTitle
());
info
.
put
(
"appStatus"
,
performancesInfo
.
getAppStatus
());
info
.
put
(
"imgPoster"
,
performancesInfo
.
getImgPoster
());
info
.
put
(
"fieldName"
,
performancesInfo
.
getFieldName
());
info
.
put
(
"longitude"
,
performancesInfo
.
getLongitude
());
info
.
put
(
"latitude"
,
performancesInfo
.
getLatitude
());
info
.
put
(
"imgPoster"
,
performancesInfo
.
getImgPoster
());
info
.
put
(
"fieldName"
,
performancesInfo
.
getFieldName
());
info
.
put
(
"longitude"
,
performancesInfo
.
getLongitude
());
info
.
put
(
"latitude"
,
performancesInfo
.
getLatitude
());
HashMap
<
String
,
Object
>
result
=
CollectionUtil
.
mapStringObject
();
result
.
put
(
"performancesInfo"
,
info
);
result
.
put
(
"ticketTimesList"
,
ticketTimesList
);
...
...
@@ -555,6 +556,7 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService {
/**
* 设置观演人数量
*
* @param ticketsId
*/
private
Integer
getViewersNumberByTicketsId
(
String
ticketsId
)
{
...
...
@@ -697,7 +699,7 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService {
//老判断 不根据用户会员做判断
//int isMemberStatus = getPerformanceIsMemberStatus(info);
//新判断 根据用户会员做判断
int
isMemberStatus
=
getPerformanceIsMemberStatusByIsMember
(
info
,
CurrentUtil
.
getCurrentUid
());
int
isMemberStatus
=
getPerformanceIsMemberStatusByIsMember
(
info
,
CurrentUtil
.
getCurrentUid
());
if
(
1
==
isMemberStatus
)
{
info
.
setAppStatus
(
6
);
}
...
...
@@ -802,18 +804,19 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService {
}
return
isMemberStatus
;
}
// 会员状态
public
Integer
getPerformanceIsMemberStatusByIsMember
(
KylinPerformanceVo
info
,
String
uid
)
{
public
Integer
getPerformanceIsMemberStatusByIsMember
(
KylinPerformanceVo
info
,
String
uid
)
{
Integer
isMemberStatus
=
0
;
if
(
null
!=
info
)
{
if
(
1
==
info
.
getIsMember
())
{
// 有会员
//普通用户开售时间
String
memberTimeStart
=
info
.
getSellTime
();
if
(
StringUtils
.
isNotEmpty
(
uid
))
{
if
(
StringUtils
.
isNotEmpty
(
uid
))
{
Integer
memberByUser
=
dataUtils
.
isMemberByUser
(
uid
);
if
(
memberByUser
==
1
)
{
if
(
memberByUser
==
1
)
{
//会员开售开售时间
memberTimeStart
=
info
.
getSellMemberTime
();
memberTimeStart
=
info
.
getSellMemberTime
();
}
}
String
nowTime
=
DateUtil
.
getNowTime
();
...
...
@@ -828,6 +831,7 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService {
}
return
isMemberStatus
;
}
/**
* 获取我的已购票演出列表
*
...
...
@@ -915,110 +919,120 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService {
}
@Override
public
ResponseDto
<
String
>
performanceSubscribe
(
HttpServletRequest
request
,
KylinPerformanceSubscribeParam
param
)
{
public
ResponseDto
<
String
>
performanceSubscribe
(
HttpServletRequest
request
,
KylinPerformanceSubscribeParam
param
)
{
try
{
//获取设备类型
String
source
=
request
.
getHeader
(
"source"
);
String
uid
=
CurrentUtil
.
getCurrentUid
();
// 避免重复预约
Integer
performanceSubscribe
=
dataUtils
.
getPerformanceTicketsSubscribe
(
uid
,
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
param
.
getTicketsId
());
Integer
performanceSubscribe
=
dataUtils
.
getPerformanceTicketsSubscribe
(
uid
,
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
param
.
getTicketsId
());
if
(
performanceSubscribe
!=
1
)
{
//先删除其他票种预约信息
List
<
String
>
ticketsIds
=
param
.
getTicketsIds
();
if
(!
CollectionUtils
.
isEmpty
(
ticketsIds
)){
ticketsIds
.
forEach
(
iter
->{
dataUtils
.
deleteIsSubscribe
(
uid
,
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
iter
);
});
}
//删除预约记录
queueUtils
.
sendMsgByRedis
(
MQConst
.
KylinQueue
.
SQL_PERFORMANCE_SUBSCRIBE
.
getKey
(),
SqlMapping
.
get
(
"kylin_performance_subscribe.delete"
,
new
Object
[]{
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
uid
}
));
// 计算过期时间 演出结束时间-当前时间
long
expirationTime
=
DateUtil
.
intervalSeconds
(
DateUtil
.
parse
(
DateUtil
.
format
(
param
.
getTimeEnd
(),
DateUtil
.
Formatter
.
yyyyMMddHHmmss
),
DateUtil
.
DATE_FULL_STR
),
DateUtil
.
now
());
// 计算通知时间 演出开始时间-10分钟
LocalDateTime
timeStart
=
param
.
getTimeStart
();
LocalDateTime
localDateTime
=
timeStart
.
minusMinutes
(
10
);
String
pushTime
=
DateUtil
.
format
(
localDateTime
,
DateUtil
.
Formatter
.
yyyyMMddHHmmss
);
//票种预约
dataUtils
.
setPerformanceTicketsSubscribe
(
uid
,
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
param
.
getTicketsId
(),
expirationTime
);
//本场演出预约
dataUtils
.
setPerformanceSubscribe
(
uid
,
param
.
getPerformancesId
(),
expirationTime
);
//push推送内容
String
title
=
param
.
getPerformancesTitle
()+
DateUtil
.
format
(
timeStart
,
DateUtil
.
Formatter
.
yyyyMMddHHmmss
)+
"即将开票,登登登提前"
+
param
.
getAdvanceMinuteMember
()+
"分钟开抢"
;
// 记录预约信息
queueUtils
.
sendMsgByRedis
(
MQConst
.
KylinQueue
.
SQL_PERFORMANCE_SUBSCRIBE
.
getKey
(),
SqlMapping
.
get
(
"kylin_performance_subscribe.insert"
,
new
Object
[]{
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
param
.
getTicketsId
(),
uid
,
KylinTableStatusConst
.
SubscribeTypeEnum
.
TYPE1
.
getKey
(),
param
.
getDeviceTokens
(),
source
,
pushTime
,
title
,
0
}
));
//redis 用户开票提醒列表
KylinPerformanceSubscribeUpushVo
kylinPerformanceSubscribeUpushVo
=
new
KylinPerformanceSubscribeUpushVo
();
kylinPerformanceSubscribeUpushVo
.
setPushTitle
(
param
.
getPerformancesTitle
());
kylinPerformanceSubscribeUpushVo
.
setPushContent
(
title
);
kylinPerformanceSubscribeUpushVo
.
setImg
(
param
.
getImgPoster
());
kylinPerformanceSubscribeUpushVo
.
setJumpType
(
6
);
kylinPerformanceSubscribeUpushVo
.
setJumpValue
(
param
.
getPerformancesId
());
kylinPerformanceSubscribeUpushVo
.
setPushTime
(
pushTime
);
kylinPerformanceSubscribeUpushVo
.
setTimeStart
(
DateUtil
.
format
(
param
.
getTimeStart
(),
DateUtil
.
Formatter
.
yyyyMMddHHmmss
));
kylinPerformanceSubscribeUpushVo
.
setType
(
KylinTableStatusConst
.
SubscribeTypeEnum
.
TYPE1
.
getKey
());
kylinPerformanceSubscribeUpushVo
.
setPerformancesId
(
param
.
getPerformancesId
());
kylinPerformanceSubscribeUpushVo
.
setTicketTimesId
(
param
.
getTicketTimesId
());
kylinPerformanceSubscribeUpushVo
.
setTicketsId
(
param
.
getTicketsId
());
//开票提醒最多存20条数据
LinkedList
<
KylinPerformanceSubscribeUpushVo
>
performanceSubscribeList
=
dataUtils
.
getPerformanceSubscribeList
(
uid
);
//删除其他票种的消息提醒
for
(
Iterator
<
KylinPerformanceSubscribeUpushVo
>
it
=
performanceSubscribeList
.
iterator
();
it
.
hasNext
();
)
{
KylinPerformanceSubscribeUpushVo
info
=
it
.
next
();
if
(
info
.
getPerformancesId
().
equals
(
param
.
getPerformancesId
())
&&
info
.
getTicketTimesId
().
equals
(
param
.
getTicketTimesId
())){
//移除
it
.
remove
();
//先删除其他票种预约信息
List
<
String
>
ticketsIds
=
param
.
getTicketsIds
();
if
(!
CollectionUtils
.
isEmpty
(
ticketsIds
))
{
ticketsIds
.
forEach
(
iter
->
{
dataUtils
.
deleteIsSubscribe
(
uid
,
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
iter
);
});
}
}
if
(
performanceSubscribeList
.
size
()>=
20
){
KylinPerformanceSubscribeUpushVo
last
=
performanceSubscribeList
.
getLast
();
//删除redis中已读信息
dataUtils
.
deletePerformanceSubscribeRead
(
uid
,
last
.
getPerformancesId
(),
last
.
getTicketTimesId
());
//删除最后一条数据
performanceSubscribeList
.
removeLast
();
//添加到第一条
performanceSubscribeList
.
addFirst
(
kylinPerformanceSubscribeUpushVo
);
}
else
{
//添加到第一条
performanceSubscribeList
.
addFirst
(
kylinPerformanceSubscribeUpushVo
);
}
//开票提醒列表存入redis中
dataUtils
.
setPerformanceSubscribeList
(
uid
,
performanceSubscribeList
);
//删除预约记录
queueUtils
.
sendMsgByRedis
(
MQConst
.
KylinQueue
.
SQL_PERFORMANCE_SUBSCRIBE
.
getKey
(),
SqlMapping
.
get
(
"kylin_performance_subscribe.delete"
,
new
Object
[]{
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
uid
}
));
// 计算过期时间 演出结束时间-当前时间
long
expirationTime
=
DateUtil
.
intervalSeconds
(
DateUtil
.
parse
(
DateUtil
.
format
(
param
.
getTimeEnd
(),
DateUtil
.
Formatter
.
yyyyMMddHHmmss
),
DateUtil
.
DATE_FULL_STR
),
DateUtil
.
now
());
// 计算通知时间 演出开始时间-10分钟
LocalDateTime
timeStart
=
param
.
getTimeStart
();
LocalDateTime
localDateTime
=
timeStart
.
minusMinutes
(
10
);
String
pushTime
=
DateUtil
.
format
(
localDateTime
,
DateUtil
.
Formatter
.
yyyyMMddHHmmss
);
//票种预约
dataUtils
.
setPerformanceTicketsSubscribe
(
uid
,
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
param
.
getTicketsId
(),
expirationTime
);
//本场演出预约
dataUtils
.
setPerformanceSubscribe
(
uid
,
param
.
getPerformancesId
(),
expirationTime
);
//push推送内容
String
title
=
param
.
getPerformancesTitle
()
+
DateUtil
.
format
(
timeStart
,
DateUtil
.
Formatter
.
yyyyMMddHHmmss
)
+
"即将开票,登登登提前"
+
param
.
getAdvanceMinuteMember
()
+
"分钟开抢"
;
// 记录预约信息
queueUtils
.
sendMsgByRedis
(
MQConst
.
KylinQueue
.
SQL_PERFORMANCE_SUBSCRIBE
.
getKey
(),
SqlMapping
.
get
(
"kylin_performance_subscribe.insert"
,
new
Object
[]{
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
param
.
getTicketsId
(),
uid
,
KylinTableStatusConst
.
SubscribeTypeEnum
.
TYPE1
.
getKey
(),
param
.
getDeviceTokens
(),
source
,
pushTime
,
title
,
0
}
));
//redis 用户开票提醒列表
KylinPerformanceSubscribeUpushVo
kylinPerformanceSubscribeUpushVo
=
new
KylinPerformanceSubscribeUpushVo
();
kylinPerformanceSubscribeUpushVo
.
setPushTitle
(
param
.
getPerformancesTitle
());
kylinPerformanceSubscribeUpushVo
.
setPushContent
(
title
);
kylinPerformanceSubscribeUpushVo
.
setImg
(
param
.
getImgPoster
());
kylinPerformanceSubscribeUpushVo
.
setJumpType
(
6
);
kylinPerformanceSubscribeUpushVo
.
setJumpValue
(
param
.
getPerformancesId
());
kylinPerformanceSubscribeUpushVo
.
setPushTime
(
pushTime
);
kylinPerformanceSubscribeUpushVo
.
setTimeStart
(
DateUtil
.
format
(
param
.
getTimeStart
(),
DateUtil
.
Formatter
.
yyyyMMddHHmmss
));
kylinPerformanceSubscribeUpushVo
.
setType
(
KylinTableStatusConst
.
SubscribeTypeEnum
.
TYPE1
.
getKey
());
kylinPerformanceSubscribeUpushVo
.
setPerformancesId
(
param
.
getPerformancesId
());
kylinPerformanceSubscribeUpushVo
.
setTicketTimesId
(
param
.
getTicketTimesId
());
kylinPerformanceSubscribeUpushVo
.
setTicketsId
(
param
.
getTicketsId
());
//开票提醒最多存20条数据
LinkedList
<
KylinPerformanceSubscribeUpushVo
>
performanceSubscribeList
=
dataUtils
.
getPerformanceSubscribeList
(
uid
);
//删除其他票种的消息提醒
for
(
Iterator
<
KylinPerformanceSubscribeUpushVo
>
it
=
performanceSubscribeList
.
iterator
();
it
.
hasNext
();
)
{
KylinPerformanceSubscribeUpushVo
info
=
it
.
next
();
if
(
info
.
getPerformancesId
().
equals
(
param
.
getPerformancesId
())
&&
info
.
getTicketTimesId
().
equals
(
param
.
getTicketTimesId
()))
{
//移除
it
.
remove
();
}
}
if
(
performanceSubscribeList
.
size
()
>=
20
)
{
KylinPerformanceSubscribeUpushVo
last
=
performanceSubscribeList
.
getLast
();
//删除redis中已读信息
dataUtils
.
deletePerformanceSubscribeRead
(
uid
,
last
.
getPerformancesId
(),
last
.
getTicketTimesId
());
//删除最后一条数据
performanceSubscribeList
.
removeLast
();
//添加到第一条
performanceSubscribeList
.
addFirst
(
kylinPerformanceSubscribeUpushVo
);
}
else
{
//添加到第一条
performanceSubscribeList
.
addFirst
(
kylinPerformanceSubscribeUpushVo
);
}
//开票提醒列表存入redis中
dataUtils
.
setPerformanceSubscribeList
(
uid
,
performanceSubscribeList
);
}
return
ResponseDto
.
success
(
"预约成功"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"演出预约 [performancesId:{},ticketTimesId:{},ticketsId:{},uid:{}, e:{}]"
,
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
param
.
getTicketsId
(),
CurrentUtil
.
getCurrentUid
(),
e
);
log
.
error
(
"演出预约 [performancesId:{},ticketTimesId:{},ticketsId:{},uid:{}, e:{}]"
,
param
.
getPerformancesId
(),
param
.
getTicketTimesId
(),
param
.
getTicketsId
(),
CurrentUtil
.
getCurrentUid
(),
e
);
return
ResponseDto
.
success
(
"预约失败"
);
}
}
@Override
public
ResponseDto
<
Integer
>
performanceIsSubscribe
(
String
performancesId
,
String
ticketTimesId
,
String
ticketsId
)
{
public
ResponseDto
<
Integer
>
performanceIsSubscribe
(
String
performancesId
,
String
ticketTimesId
,
String
ticketsId
)
{
String
uid
=
CurrentUtil
.
getCurrentUid
();
Integer
performanceSubscribe
=
dataUtils
.
getPerformanceTicketsSubscribe
(
uid
,
performancesId
,
ticketTimesId
,
ticketsId
);
Integer
performanceSubscribe
=
dataUtils
.
getPerformanceTicketsSubscribe
(
uid
,
performancesId
,
ticketTimesId
,
ticketsId
);
return
ResponseDto
.
success
(
performanceSubscribe
);
}
@Override
public
void
deleteIsSubscribe
(
String
performancesId
,
String
ticketTimesId
,
String
ticketsId
)
{
public
void
deleteIsSubscribe
(
String
performancesId
,
String
ticketTimesId
,
String
ticketsId
)
{
String
uid
=
CurrentUtil
.
getCurrentUid
();
//删除预约提醒
dataUtils
.
deleteIsSubscribe
(
uid
,
performancesId
,
ticketTimesId
,
ticketsId
);
dataUtils
.
deleteIsSubscribe
(
uid
,
performancesId
,
ticketTimesId
,
ticketsId
);
//删除已读
dataUtils
.
deleteIsSubscribeRead
(
uid
,
performancesId
,
ticketTimesId
);
dataUtils
.
deleteIsSubscribeRead
(
uid
,
performancesId
,
ticketTimesId
);
}
@Override
public
List
<
KylinPerformanceArtistLineupVo
>
performanceArtists
(
String
performancesId
)
{
List
<
KylinPerformanceArtistLineupVo
>
artistLineupVos
=
dataUtils
.
getPerformanceArtists
(
performancesId
);
if
(
artistLineupVos
.
isEmpty
())
{
log
.
info
(
"演出阵容为空, performanceId: {}"
,
performancesId
);
return
Collections
.
emptyList
();
}
return
artistLineupVos
;
}
}
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/utils/DataUtils.java
View file @
0e2230c0
...
...
@@ -14,6 +14,7 @@ import com.liquidnet.service.goblin.dto.vo.*;
import
com.liquidnet.service.kylin.constant.KylinRedisConst
;
import
com.liquidnet.service.kylin.constant.KylinTableStatusConst
;
import
com.liquidnet.service.kylin.constant.LuckyBagStatusEnum
;
import
com.liquidnet.service.kylin.dao.KylinArtistPerformanceDao
;
import
com.liquidnet.service.kylin.dao.KylinTicketActive
;
import
com.liquidnet.service.kylin.dto.vo.KylinApiCameraDevicesVo
;
import
com.liquidnet.service.kylin.dto.vo.KylinPerformanceSubscribeUpushVo
;
...
...
@@ -23,12 +24,15 @@ import com.liquidnet.service.kylin.dto.vo.admin.OrderRefundPoundage;
import
com.liquidnet.service.kylin.dto.vo.admin.OrderRefundPoundageAll
;
import
com.liquidnet.service.kylin.dto.vo.express.KylinOrderExpressRouteVo
;
import
com.liquidnet.service.kylin.dto.vo.express.KylinOrderExpressVo
;
import
com.liquidnet.service.kylin.dto.vo.middle.KylinTicketTimesVo
;
import
com.liquidnet.service.kylin.dto.vo.mongo.*
;
import
com.liquidnet.service.kylin.dto.vo.partner.KylinTicketExpressModuleVo
;
import
com.liquidnet.service.kylin.dto.vo.partner.KylinTicketPartnerVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.KylinOrderListVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.KylinOrderRefundsVo
;
import
com.liquidnet.service.kylin.dto.vo.returns.KylinPerformanceArtistLineupVo
;
import
com.liquidnet.service.kylin.entity.*
;
import
com.liquidnet.service.kylin.mapper.KylinArtistPerformanceMapper
;
import
com.liquidnet.service.kylin.mapper.KylinLuckyBagActivityMapper
;
import
com.liquidnet.service.kylin.mapper.KylinLuckyBagMapper
;
import
com.liquidnet.service.kylin.mapper.KylinRewardUserMapper
;
...
...
@@ -67,6 +71,8 @@ public class DataUtils {
private
KylinLuckyBagMapper
kylinLuckyBagMapper
;
@Autowired
private
KylinRewardUserMapper
kylinRewardUserMapper
;
@Autowired
private
KylinArtistPerformanceMapper
artistPerformanceMapper
;
/**
...
...
@@ -1723,4 +1729,49 @@ public class DataUtils {
return
(
int
)
obj
;
}
}
/**
* 根据演出ID获取演出阵容
* @param performancesId
* @return
*/
public
List
<
KylinPerformanceArtistLineupVo
>
getPerformanceArtists
(
String
performancesId
)
{
final
String
redisKey
=
KylinRedisConst
.
PERFORMANCES_ARTISTS
+
performancesId
;
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
null
==
obj
)
{
KylinPerformanceVo
performancesInfo
=
getPerformanceVo
(
performancesId
);
if
(
null
==
performancesInfo
)
{
return
Collections
.
emptyList
();
}
List
<
KylinPerformanceArtistLineupVo
>
resultList
=
new
ArrayList
<>();
List
<
KylinTicketTimesVo
>
ticketTimeList
=
performancesInfo
.
getTicketTimeList
();
if
(!
CollectionUtils
.
isEmpty
(
ticketTimeList
))
{
for
(
KylinTicketTimesVo
timesVo
:
ticketTimeList
)
{
// 获取当前场次关联的艺人,按sort降序
List
<
KylinArtistPerformanceDao
>
artists
=
artistPerformanceMapper
.
selectArtistsByPerformanceAndTimes
(
performancesId
,
timesVo
.
getTicketTimesId
());
KylinPerformanceArtistLineupVo
lineupVo
=
new
KylinPerformanceArtistLineupVo
();
lineupVo
.
setTicketTimesId
(
timesVo
.
getTicketTimesId
());
lineupVo
.
setTimeTitle
(
timesVo
.
getTitle
());
lineupVo
.
setArtists
(
artists
==
null
?
new
ArrayList
<>()
:
artists
.
stream
()
.
map
(
KylinPerformanceArtistLineupVo
.
KylinPerformanceTimeArtist
::
from
)
.
filter
(
Objects:
:
nonNull
)
.
collect
(
Collectors
.
toList
()));
resultList
.
add
(
lineupVo
);
}
}
setPerformanceArtists
(
performancesId
,
resultList
);
return
resultList
;
}
else
{
return
(
List
<
KylinPerformanceArtistLineupVo
>)
obj
;
}
}
public
void
setPerformanceArtists
(
String
performancesId
,
List
<
KylinPerformanceArtistLineupVo
>
artistLineupVos
){
final
String
redisKey
=
KylinRedisConst
.
PERFORMANCES_ARTISTS
+
performancesId
;
redisUtil
.
set
(
redisKey
,
artistLineupVos
,
RedisKeyExpireConst
.
PERFORMANCES_ARTISTS_EXPIRE
);
}
}
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