记得上下班打卡 | 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
0bbe7f7d
Commit
0bbe7f7d
authored
Nov 30, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交 五条人需求 活动状态和banner
parent
17b80e87
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
159 additions
and
2 deletions
+159
-2
SweetConstant.java
...a/com/liquidnet/service/sweet/constant/SweetConstant.java
+3
-0
TempBannerVo.java
...java/com/liquidnet/service/sweet/dto/vo/TempBannerVo.java
+19
-0
TempBannerParam.java
...va/com/liquidnet/service/sweet/param/TempBannerParam.java
+25
-0
SweetCItyVoteStatVo.java
...a/com/liquidnet/service/sweet/vo/SweetCItyVoteStatVo.java
+4
-0
SweetCityVoteController.java
...net/service/sweet/controller/SweetCityVoteController.java
+24
-0
SweetCityVoteServiceImpl.java
.../service/sweet/service/impl/SweetCityVoteServiceImpl.java
+23
-0
RedisDataUtils.java
...ava/com/liquidnet/service/sweet/utils/RedisDataUtils.java
+61
-2
No files found.
liquidnet-bus-api/liquidnet-service-sweet-api/src/main/java/com/liquidnet/service/sweet/constant/SweetConstant.java
View file @
0bbe7f7d
...
...
@@ -46,6 +46,9 @@ public class SweetConstant {
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE
=
"sweet:cityVote"
;
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE_USER
=
":user:"
;
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME
=
":updateTime"
;
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE_START
=
"sweet:cityVote:startTime:"
;
//活动开始时间
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE_END
=
"sweet:cityVote:endTime:"
;
//活动结束时间
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE_BANNER
=
"sweet:cityVote:banner:"
;
//活动banner
// 微信用户相关
public
final
static
String
REDIS_KEY_SWEET_WECHAT_USER_INFO
=
"sweet:wechatUser:zhengzai:unionId:"
;
public
final
static
String
REDIS_KEY_SWEET_WECHAT_USER_INFO_MODERNSKY
=
"sweet:wechatUser:modernsky:unionId:"
;
...
...
liquidnet-bus-api/liquidnet-service-sweet-api/src/main/java/com/liquidnet/service/sweet/dto/vo/TempBannerVo.java
0 → 100644
View file @
0bbe7f7d
package
com
.
liquidnet
.
service
.
sweet
.
dto
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
TempBannerVo
implements
Serializable
,
Cloneable
{
private
static
final
long
serialVersionUID
=
-
6777064807434774542L
;
@ApiModelProperty
(
value
=
"banner图片"
)
private
String
src
;
@ApiModelProperty
(
value
=
"banner链接"
)
private
String
url
;
}
liquidnet-bus-api/liquidnet-service-sweet-api/src/main/java/com/liquidnet/service/sweet/param/TempBannerParam.java
0 → 100644
View file @
0bbe7f7d
package
com
.
liquidnet
.
service
.
sweet
.
param
;
import
com.liquidnet.service.sweet.dto.vo.TempBannerVo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.List
;
@ApiModel
(
value
=
"SweetCityVoteParam"
,
description
=
"用户投票记录入参"
)
@Data
public
class
TempBannerParam
implements
Serializable
{
@ApiModelProperty
(
position
=
13
,
required
=
true
,
value
=
"临时banner数据"
)
@NotBlank
(
message
=
"tempBannerVo不能为空"
)
private
List
<
TempBannerVo
>
tempBannerVo
;
@ApiModelProperty
(
position
=
14
,
required
=
true
,
value
=
"活动类型 1新裤子 2莫宰羊"
,
example
=
"1"
)
@NotNull
(
message
=
"type不能为空"
)
private
Integer
type
;
}
liquidnet-bus-api/liquidnet-service-sweet-api/src/main/java/com/liquidnet/service/sweet/vo/SweetCItyVoteStatVo.java
View file @
0bbe7f7d
...
...
@@ -43,6 +43,9 @@ public class SweetCItyVoteStatVo implements Serializable, Cloneable {
@ApiModelProperty
(
"名次变动状态 1未变化 2上升 3下降"
)
private
Integer
rankingUpOrDown
;
// @ApiModelProperty("状态[0-未开始|1-进行中|2-已结束]")
// private Integer status;
/*@ApiModelProperty("创建时间")
private LocalDateTime createdAt;
...
...
@@ -50,6 +53,7 @@ public class SweetCItyVoteStatVo implements Serializable, Cloneable {
private LocalDateTime updatedAt;*/
private
static
final
SweetCItyVoteStatVo
obj
=
new
SweetCItyVoteStatVo
();
public
static
SweetCItyVoteStatVo
getNew
()
{
try
{
return
(
SweetCItyVoteStatVo
)
obj
.
clone
();
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/controller/SweetCityVoteController.java
View file @
0bbe7f7d
...
...
@@ -2,13 +2,17 @@ package com.liquidnet.service.sweet.controller;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.sweet.dto.vo.TempBannerVo
;
import
com.liquidnet.service.sweet.param.SweetCityVoteParam
;
import
com.liquidnet.service.sweet.param.TempBannerParam
;
import
com.liquidnet.service.sweet.service.ISweetCityVoteService
;
import
com.liquidnet.service.sweet.utils.RedisDataUtils
;
import
com.liquidnet.service.sweet.vo.SweetCItyVoteStatVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.models.auth.In
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -58,4 +62,24 @@ public class SweetCityVoteController {
return
sweetCityVoteService
.
setStatList
(
type
);
}
@Autowired
RedisDataUtils
redisDataUtils
;
@PostMapping
(
"setTime"
)
@ApiOperation
(
"临时-设置时间"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"endTime"
,
value
=
"结束时间[2021-12-01 10:00:00]"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"startTime"
,
value
=
"开始时间[2021-12-01 10:00:00]"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"Integer"
,
name
=
"type"
,
value
=
"活动类型 1新裤子 2莫宰羊"
,
required
=
false
)
})
public
void
setStartEndTime
(
@RequestParam
Integer
type
,
@RequestParam
String
startTime
,
@RequestParam
String
endTime
)
{
redisDataUtils
.
setStartEndTime
(
type
,
startTime
,
endTime
);
}
@PostMapping
(
"setBanner"
)
@ApiOperation
(
"临时-设置banner"
)
public
void
setTempBanner
(
@RequestBody
TempBannerParam
param
)
{
redisDataUtils
.
setTempBanner
(
param
.
getType
(),
param
.
getTempBannerVo
());
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetCityVoteServiceImpl.java
View file @
0bbe7f7d
...
...
@@ -8,6 +8,7 @@ import com.liquidnet.service.base.ResponseDto;
import
com.liquidnet.service.base.SqlMapping
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.sweet.dto.SweetCityVoteStatDto
;
import
com.liquidnet.service.sweet.dto.vo.TempBannerVo
;
import
com.liquidnet.service.sweet.entity.SweetCityVote
;
import
com.liquidnet.service.sweet.mapper.SweetCityVoteMapper
;
import
com.liquidnet.service.sweet.mapper.SweetCityVoteStatMapper
;
...
...
@@ -29,6 +30,8 @@ import java.util.HashMap;
import
java.util.LinkedList
;
import
java.util.List
;
import
static
com
.
liquidnet
.
commons
.
lang
.
util
.
DateUtil
.
DTF_YMD_HMS
;
/**
* <p>
* 答题表 服务实现类
...
...
@@ -70,6 +73,26 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
stringObjectHashMap
.
put
(
"userVote"
,
userVote
);
stringObjectHashMap
.
put
(
"statUpdateTime"
,
redisDataUtils
.
getSweetCityVoteStatUpdateTime
(
type
));
//获取活动状态
HashMap
<
String
,
String
>
map
=
redisDataUtils
.
getStartEndTime
(
type
);
if
(
map
.
get
(
"startTime"
)
==
null
||
map
.
get
(
"endTime"
)
==
null
)
{
stringObjectHashMap
.
put
(
"activeStatus"
,
2
);
}
else
{
LocalDateTime
startTime
=
LocalDateTime
.
parse
(
map
.
get
(
"startTime"
),
DTF_YMD_HMS
);
LocalDateTime
endTime
=
LocalDateTime
.
parse
(
map
.
get
(
"endTime"
),
DTF_YMD_HMS
);
LocalDateTime
now
=
LocalDateTime
.
now
();
if
(
startTime
.
isBefore
(
now
))
{
stringObjectHashMap
.
put
(
"activeStatus"
,
0
);
}
else
if
(
endTime
.
isAfter
(
now
))
{
stringObjectHashMap
.
put
(
"activeStatus"
,
2
);
}
else
{
stringObjectHashMap
.
put
(
"activeStatus"
,
1
);
}
}
//获取banner
List
<
TempBannerVo
>
bannerVoList
=
redisDataUtils
.
getTempBanner
(
type
);
stringObjectHashMap
.
put
(
"bannerList"
,
bannerVoList
);
return
ResponseDto
.
success
(
stringObjectHashMap
);
}
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/utils/RedisDataUtils.java
View file @
0bbe7f7d
...
...
@@ -13,6 +13,7 @@ import com.liquidnet.service.sweet.dto.SweetManualArtistListDto;
import
com.liquidnet.service.sweet.dto.SweetManualArtistStageListDto
;
import
com.liquidnet.service.sweet.dto.vo.IntegralActivityDrawVo
;
import
com.liquidnet.service.sweet.dto.vo.IntegralActivityVo
;
import
com.liquidnet.service.sweet.dto.vo.TempBannerVo
;
import
com.liquidnet.service.sweet.entity.*
;
import
com.liquidnet.service.sweet.mapper.*
;
import
com.liquidnet.service.sweet.param.SweetCityVoteParam
;
...
...
@@ -666,9 +667,9 @@ public class RedisDataUtils {
public
void
setIntegralActivityDrawInList
(
String
uid
,
String
integralActivityId
,
LinkedList
<
IntegralActivityDrawVo
>
integralActivityDrawList
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_IN_USER
.
concat
(
integralActivityId
)
.
concat
(
integralActivityId
)
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_USER_KEY
)
.
concat
(
uid
);
.
concat
(
uid
);
redisUtil
.
set
(
redisKey
,
integralActivityDrawList
);
}
...
...
@@ -768,4 +769,62 @@ public class RedisDataUtils {
.
concat
(
userId
);
redisUtil
.
uLock
(
redisKey
);
}
/***
* 设置活动开始结束时间
* @param type
* @param startTime
* @param endTime
*/
public
void
setStartEndTime
(
Integer
type
,
String
startTime
,
String
endTime
)
{
String
startRedisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_START
.
concat
(
":type:"
+
type
);
String
endRedisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_END
.
concat
(
":type:"
+
type
);
redisUtil
.
set
(
startRedisKey
,
startTime
);
redisUtil
.
set
(
endRedisKey
,
endTime
);
}
/**
* 获取活动开始结束时间 如果报错返回null
*
* @param type
* @return
*/
public
HashMap
<
String
,
String
>
getStartEndTime
(
Integer
type
)
{
try
{
HashMap
<
String
,
String
>
map
=
CollectionUtil
.
mapStringString
();
String
startRedisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_START
.
concat
(
":type:"
+
type
);
String
endRedisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_END
.
concat
(
":type:"
+
type
);
map
.
put
(
"startTime"
,
(
String
)
redisUtil
.
get
(
startRedisKey
));
map
.
put
(
"endTime"
,
(
String
)
redisUtil
.
get
(
endRedisKey
));
return
map
;
}
catch
(
Exception
e
)
{
return
null
;
}
}
/**
* 设置临时banner
* @param type
* @param vo
*/
public
void
setTempBanner
(
Integer
type
,
List
<
TempBannerVo
>
vo
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_BANNER
.
concat
(
":type:"
+
type
);
redisUtil
.
set
(
redisKey
,
vo
);
}
/**
* 获取临时banner
* @param type
* @return
*/
public
List
<
TempBannerVo
>
getTempBanner
(
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_BANNER
.
concat
(
":type:"
+
type
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
obj
==
null
){
return
null
;
}
else
{
return
(
List
<
TempBannerVo
>)
obj
;
}
}
}
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