记得上下班打卡 | 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
d570e0fb
Commit
d570e0fb
authored
Oct 18, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
投票活动增加type
parent
bbc0faea
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
82 additions
and
43 deletions
+82
-43
FeignSweetTaskActivityClient.java
...ervice/feign/sweet/task/FeignSweetTaskActivityClient.java
+2
-1
SweetCityVoteTaskHandler.java
...rvice/executor/main/handler/SweetCityVoteTaskHandler.java
+4
-1
db_sweetsugar_structure.sql
.../liquidnet-service-sweet/docu/db_sweetsugar_structure.sql
+2
-0
SweetConstant.java
...a/com/liquidnet/service/sweet/constant/SweetConstant.java
+2
-1
SweetCityVoteController.java
...net/service/sweet/controller/SweetCityVoteController.java
+7
-5
SweetCityVoteStatDto.java
...com/liquidnet/service/sweet/dto/SweetCityVoteStatDto.java
+3
-0
SweetCityVote.java
...ava/com/liquidnet/service/sweet/entity/SweetCityVote.java
+5
-0
SweetCityVoteStat.java
...com/liquidnet/service/sweet/entity/SweetCityVoteStat.java
+5
-0
SweetCityVoteStatMapper.java
...quidnet/service/sweet/mapper/SweetCityVoteStatMapper.java
+1
-1
SweetCityVoteParam.java
...com/liquidnet/service/sweet/param/SweetCityVoteParam.java
+5
-0
ISweetCityVoteService.java
...iquidnet/service/sweet/service/ISweetCityVoteService.java
+2
-2
SweetCityVoteServiceImpl.java
.../service/sweet/service/impl/SweetCityVoteServiceImpl.java
+15
-14
RedisDataUtils.java
...ava/com/liquidnet/service/sweet/utils/RedisDataUtils.java
+17
-15
SweetCItyVoteStatVo.java
...a/com/liquidnet/service/sweet/vo/SweetCItyVoteStatVo.java
+3
-0
SweetCityVoteStatMapper.xml
...iquidnet/service/sweet/mapper/SweetCityVoteStatMapper.xml
+6
-0
sqlmap.properties
...uidnet-service-sweet/src/main/resources/sqlmap.properties
+3
-3
No files found.
liquidnet-bus-feign/liquidnet-api-feign-sweet/src/main/java/com/liquidnet/service/feign/sweet/task/FeignSweetTaskActivityClient.java
View file @
d570e0fb
...
@@ -5,6 +5,7 @@ import feign.hystrix.FallbackFactory;
...
@@ -5,6 +5,7 @@ import feign.hystrix.FallbackFactory;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
@Component
@Component
@FeignClient
(
name
=
"liquidnet-service-sweet"
,
@FeignClient
(
name
=
"liquidnet-service-sweet"
,
...
@@ -14,6 +15,6 @@ import org.springframework.web.bind.annotation.GetMapping;
...
@@ -14,6 +15,6 @@ import org.springframework.web.bind.annotation.GetMapping;
public
interface
FeignSweetTaskActivityClient
{
public
interface
FeignSweetTaskActivityClient
{
@GetMapping
(
"sweet/sweetCityVote/setStatList"
)
@GetMapping
(
"sweet/sweetCityVote/setStatList"
)
ResponseDto
<
Boolean
>
setStatList
();
ResponseDto
<
Boolean
>
setStatList
(
@RequestParam
(
"type"
)
Integer
type
);
}
}
liquidnet-bus-service/liquidnet-service-executor-all/liquidnet-service-executor-main/src/main/java/com/liquidnet/service/executor/main/handler/SweetCityVoteTaskHandler.java
View file @
d570e0fb
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.executor.main.handler;
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.executor.main.handler;
import
com.liquidnet.service.feign.sweet.task.FeignSweetTaskActivityClient
;
import
com.liquidnet.service.feign.sweet.task.FeignSweetTaskActivityClient
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.context.XxlJobHelper
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -21,7 +22,9 @@ public class SweetCityVoteTaskHandler {
...
@@ -21,7 +22,9 @@ public class SweetCityVoteTaskHandler {
@XxlJob
(
value
=
"sev-sweet:cityVoteStat"
)
@XxlJob
(
value
=
"sev-sweet:cityVoteStat"
)
public
ReturnT
<
String
>
cityVoteStatHandler
()
{
public
ReturnT
<
String
>
cityVoteStatHandler
()
{
try
{
try
{
Boolean
data
=
feignSweetTaskActivityClient
.
setStatList
().
getData
();
String
jobParam
=
XxlJobHelper
.
getJobParam
();
//执行参数
log
.
info
(
"jobParam = "
+
Integer
.
parseInt
(
jobParam
));
Boolean
data
=
feignSweetTaskActivityClient
.
setStatList
(
Integer
.
parseInt
(
jobParam
)).
getData
();
log
.
info
(
"cityVoteStatHandler:结果:{}"
,
data
);
log
.
info
(
"cityVoteStatHandler:结果:{}"
,
data
);
ReturnT
<
String
>
success
=
ReturnT
.
SUCCESS
;
ReturnT
<
String
>
success
=
ReturnT
.
SUCCESS
;
success
.
setMsg
(
String
.
valueOf
(
data
));
success
.
setMsg
(
String
.
valueOf
(
data
));
...
...
liquidnet-bus-service/liquidnet-service-sweet/docu/db_sweetsugar_structure.sql
View file @
d570e0fb
...
@@ -490,6 +490,7 @@ CREATE TABLE `sweet_city_vote`
...
@@ -490,6 +490,7 @@ CREATE TABLE `sweet_city_vote`
`phone`
varchar
(
11
)
NOT
NULL
DEFAULT
''
COMMENT
'手机号'
,
`phone`
varchar
(
11
)
NOT
NULL
DEFAULT
''
COMMENT
'手机号'
,
`openId`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'openId'
,
`openId`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'openId'
,
`unionId`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'unionId'
,
`unionId`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'unionId'
,
`type`
tinyint
NOT
NULL
DEFAULT
1
COMMENT
'活动类型 1新裤子 2莫宰羊'
,
`city_code`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'城市代码'
,
`city_code`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'城市代码'
,
`city_name`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'城市名称'
,
`city_name`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'城市名称'
,
`day_time`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'投票天'
,
`day_time`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'投票天'
,
...
@@ -511,6 +512,7 @@ CREATE TABLE `sweet_city_vote_stat`
...
@@ -511,6 +512,7 @@ CREATE TABLE `sweet_city_vote_stat`
`city_name`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'城市名称'
,
`city_name`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'城市名称'
,
`vote_num`
int
NOT
NULL
DEFAULT
0
COMMENT
'真实投票数量'
,
`vote_num`
int
NOT
NULL
DEFAULT
0
COMMENT
'真实投票数量'
,
`manual_vote_num`
int
NOT
NULL
DEFAULT
0
COMMENT
'手动增加投票数量'
,
`manual_vote_num`
int
NOT
NULL
DEFAULT
0
COMMENT
'手动增加投票数量'
,
`type`
tinyint
NOT
NULL
DEFAULT
1
COMMENT
'活动类型 1新裤子 2莫宰羊'
,
`created_at`
datetime
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`created_at`
datetime
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`updated_at`
datetime
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'更新时间'
,
`updated_at`
datetime
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`mid`
),
PRIMARY
KEY
(
`mid`
),
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/constant/SweetConstant.java
View file @
d570e0fb
...
@@ -26,7 +26,8 @@ public class SweetConstant {
...
@@ -26,7 +26,8 @@ public class SweetConstant {
public
final
static
String
REDIS_KEY_SWEET_ANSWER_PHONE
=
"sweet:answer:phone:"
;
public
final
static
String
REDIS_KEY_SWEET_ANSWER_PHONE
=
"sweet:answer:phone:"
;
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST
=
"sweet:cityVote:StatList"
;
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST
=
"sweet:cityVote:StatList"
;
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE
=
"sweet:cityVote:cityCode:"
;
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE
=
"sweet:cityVote:cityCode:"
;
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE_USER
=
"sweet:cityVote:user:"
;
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
=
"sweet:cityVote:updateTime"
;
public
final
static
String
REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME
=
"sweet:cityVote:updateTime"
;
public
final
static
String
REDIS_KEY_SWEET_WECHAT_USER_INFO_MODERNSKY
=
"sweet:wechatUser:modernsky:unionId:"
;
public
final
static
String
REDIS_KEY_SWEET_WECHAT_USER_INFO_MODERNSKY
=
"sweet:wechatUser:modernsky:unionId:"
;
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/controller/SweetCityVoteController.java
View file @
d570e0fb
...
@@ -35,13 +35,15 @@ public class SweetCityVoteController {
...
@@ -35,13 +35,15 @@ public class SweetCityVoteController {
@ApiOperation
(
"城市投票排名"
)
@ApiOperation
(
"城市投票排名"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"phone"
,
value
=
"手机号"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"phone"
,
value
=
"手机号"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"unionId"
,
value
=
"unionId"
,
required
=
true
)
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"unionId"
,
value
=
"unionId"
,
required
=
true
),
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"Integer"
,
name
=
"type"
,
value
=
"活动类型 1新裤子 2莫宰羊"
,
required
=
true
)
})
})
public
ResponseDto
<
List
<
SweetCItyVoteStatVo
>>
getList
(
public
ResponseDto
<
List
<
SweetCItyVoteStatVo
>>
getList
(
@RequestParam
String
phone
,
@RequestParam
String
phone
,
@RequestParam
String
unionId
@RequestParam
String
unionId
,
@RequestParam
Integer
type
)
{
)
{
return
sweetCityVoteService
.
getList
(
phone
,
unionId
);
return
sweetCityVoteService
.
getList
(
phone
,
unionId
,
type
);
}
}
@PostMapping
(
"createVote"
)
@PostMapping
(
"createVote"
)
...
@@ -52,8 +54,8 @@ public class SweetCityVoteController {
...
@@ -52,8 +54,8 @@ public class SweetCityVoteController {
@GetMapping
(
"setStatList"
)
@GetMapping
(
"setStatList"
)
@ApiOperation
(
"统计投票排名"
)
@ApiOperation
(
"统计投票排名"
)
public
ResponseDto
setStatList
()
{
public
ResponseDto
setStatList
(
@RequestParam
Integer
type
)
{
return
sweetCityVoteService
.
setStatList
();
return
sweetCityVoteService
.
setStatList
(
type
);
}
}
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/dto/SweetCityVoteStatDto.java
View file @
d570e0fb
...
@@ -27,6 +27,9 @@ public class SweetCityVoteStatDto implements Serializable ,Cloneable{
...
@@ -27,6 +27,9 @@ public class SweetCityVoteStatDto implements Serializable ,Cloneable{
@ApiModelProperty
(
"总投票数"
)
@ApiModelProperty
(
"总投票数"
)
private
Integer
totalNum
;
private
Integer
totalNum
;
@ApiModelProperty
(
"type"
)
private
Integer
type
;
private
static
final
SweetCityVoteStatDto
obj
=
new
SweetCityVoteStatDto
();
private
static
final
SweetCityVoteStatDto
obj
=
new
SweetCityVoteStatDto
();
public
static
SweetCityVoteStatDto
getNew
()
{
public
static
SweetCityVoteStatDto
getNew
()
{
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/entity/SweetCityVote.java
View file @
d570e0fb
...
@@ -47,6 +47,11 @@ public class SweetCityVote implements Serializable {
...
@@ -47,6 +47,11 @@ public class SweetCityVote implements Serializable {
@TableField
(
"unionId"
)
@TableField
(
"unionId"
)
private
String
unionId
;
private
String
unionId
;
/**
* 活动类型 1新裤子 2莫宰羊
*/
private
Integer
type
;
/**
/**
* 城市代码
* 城市代码
*/
*/
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/entity/SweetCityVoteStat.java
View file @
d570e0fb
...
@@ -49,6 +49,11 @@ public class SweetCityVoteStat implements Serializable {
...
@@ -49,6 +49,11 @@ public class SweetCityVoteStat implements Serializable {
*/
*/
private
Integer
manualVoteNum
;
private
Integer
manualVoteNum
;
/**
* type
*/
private
Integer
type
;
/**
/**
* 创建时间
* 创建时间
*/
*/
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/mapper/SweetCityVoteStatMapper.java
View file @
d570e0fb
...
@@ -16,5 +16,5 @@ import java.util.List;
...
@@ -16,5 +16,5 @@ import java.util.List;
*/
*/
public
interface
SweetCityVoteStatMapper
extends
BaseMapper
<
SweetCityVoteStat
>
{
public
interface
SweetCityVoteStatMapper
extends
BaseMapper
<
SweetCityVoteStat
>
{
List
<
SweetCityVoteStatDto
>
getStatList
();
List
<
SweetCityVoteStatDto
>
getStatList
(
Integer
type
);
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/param/SweetCityVoteParam.java
View file @
d570e0fb
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.io.Serializable
;
@ApiModel
(
value
=
"SweetCityVoteParam"
,
description
=
"用户投票记录入参"
)
@ApiModel
(
value
=
"SweetCityVoteParam"
,
description
=
"用户投票记录入参"
)
...
@@ -29,4 +30,8 @@ public class SweetCityVoteParam implements Serializable {
...
@@ -29,4 +30,8 @@ public class SweetCityVoteParam implements Serializable {
@NotBlank
(
message
=
"cityName不能为空"
)
@NotBlank
(
message
=
"cityName不能为空"
)
private
String
cityName
;
private
String
cityName
;
@ApiModelProperty
(
position
=
14
,
required
=
true
,
value
=
"活动类型 1新裤子 2莫宰羊"
,
example
=
"1"
)
@NotNull
(
message
=
"type不能为空"
)
private
Integer
type
;
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/ISweetCityVoteService.java
View file @
d570e0fb
...
@@ -20,7 +20,7 @@ public interface ISweetCityVoteService extends IService<SweetCityVote> {
...
@@ -20,7 +20,7 @@ public interface ISweetCityVoteService extends IService<SweetCityVote> {
ResponseDto
createVote
(
SweetCityVoteParam
param
);
ResponseDto
createVote
(
SweetCityVoteParam
param
);
ResponseDto
setStatList
();
ResponseDto
setStatList
(
Integer
type
);
ResponseDto
<
List
<
SweetCItyVoteStatVo
>>
getList
(
String
phone
,
String
unionId
);
ResponseDto
<
List
<
SweetCItyVoteStatVo
>>
getList
(
String
phone
,
String
unionId
,
Integer
type
);
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetCityVoteServiceImpl.java
View file @
d570e0fb
...
@@ -46,9 +46,9 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
...
@@ -46,9 +46,9 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
private
SweetCityVoteStatMapper
sweetCityVoteStatMapper
;
private
SweetCityVoteStatMapper
sweetCityVoteStatMapper
;
@Override
@Override
public
ResponseDto
getList
(
String
phone
,
String
unionId
)
{
public
ResponseDto
getList
(
String
phone
,
String
unionId
,
Integer
type
)
{
List
<
SweetCItyVoteStatVo
>
sweetCityVoteStatList
=
redisDataUtils
.
getSweetCityVoteStatList
();
List
<
SweetCItyVoteStatVo
>
sweetCityVoteStatList
=
redisDataUtils
.
getSweetCityVoteStatList
(
type
);
SweetCityVoteParam
userVote
=
redisDataUtils
.
getUserVote
(
phone
,
unionId
);
SweetCityVoteParam
userVote
=
redisDataUtils
.
getUserVote
(
phone
,
unionId
,
type
);
if
(!
CollectionUtils
.
isEmpty
(
sweetCityVoteStatList
))
{
if
(!
CollectionUtils
.
isEmpty
(
sweetCityVoteStatList
))
{
for
(
SweetCItyVoteStatVo
info
:
sweetCityVoteStatList
)
{
for
(
SweetCItyVoteStatVo
info
:
sweetCityVoteStatList
)
{
if
(
null
==
userVote
)
{
if
(
null
==
userVote
)
{
...
@@ -64,14 +64,14 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
...
@@ -64,14 +64,14 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
HashMap
<
String
,
Object
>
stringObjectHashMap
=
CollectionUtil
.
mapStringObject
();
HashMap
<
String
,
Object
>
stringObjectHashMap
=
CollectionUtil
.
mapStringObject
();
stringObjectHashMap
.
put
(
"list"
,
sweetCityVoteStatList
);
stringObjectHashMap
.
put
(
"list"
,
sweetCityVoteStatList
);
stringObjectHashMap
.
put
(
"userVote"
,
userVote
);
stringObjectHashMap
.
put
(
"userVote"
,
userVote
);
stringObjectHashMap
.
put
(
"statUpdateTime"
,
redisDataUtils
.
getSweetCityVoteStatUpdateTime
());
stringObjectHashMap
.
put
(
"statUpdateTime"
,
redisDataUtils
.
getSweetCityVoteStatUpdateTime
(
type
));
return
ResponseDto
.
success
(
stringObjectHashMap
);
return
ResponseDto
.
success
(
stringObjectHashMap
);
}
}
@Override
@Override
public
ResponseDto
createVote
(
SweetCityVoteParam
param
)
{
public
ResponseDto
createVote
(
SweetCityVoteParam
param
)
{
SweetCityVoteParam
userVote
=
redisDataUtils
.
getUserVote
(
param
.
getPhone
(),
param
.
getUnionId
());
SweetCityVoteParam
userVote
=
redisDataUtils
.
getUserVote
(
param
.
getPhone
(),
param
.
getUnionId
()
,
param
.
getType
()
);
if
(
null
!=
userVote
)
{
if
(
null
!=
userVote
)
{
return
ResponseDto
.
failure
(
"已经投过票啦~"
);
return
ResponseDto
.
failure
(
"已经投过票啦~"
);
}
}
...
@@ -83,6 +83,7 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
...
@@ -83,6 +83,7 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
aNew
.
setUnionId
(
param
.
getUnionId
());
aNew
.
setUnionId
(
param
.
getUnionId
());
aNew
.
setCityCode
(
param
.
getCityCode
());
aNew
.
setCityCode
(
param
.
getCityCode
());
aNew
.
setCityName
(
param
.
getCityName
());
aNew
.
setCityName
(
param
.
getCityName
());
aNew
.
setType
(
param
.
getType
());
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
...
@@ -90,38 +91,38 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
...
@@ -90,38 +91,38 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
LinkedList
<
Object
[]>
sqlsDataB
=
CollectionUtil
.
linkedListObjectArr
();
LinkedList
<
Object
[]>
sqlsDataB
=
CollectionUtil
.
linkedListObjectArr
();
sqls
.
add
(
SqlMapping
.
get
(
"sweet_city_vote.insert"
));
sqls
.
add
(
SqlMapping
.
get
(
"sweet_city_vote.insert"
));
sqlsDataA
.
add
(
new
Object
[]{
sqlsDataA
.
add
(
new
Object
[]{
aNew
.
getVoteId
(),
aNew
.
getPhone
(),
sweetWechatOpenId
,
aNew
.
getUnionId
(),
aNew
.
getCityCode
(),
aNew
.
getCityName
(),
DateUtil
.
format
(
LocalDateTime
.
now
(),
DateUtil
.
Formatter
.
yyyyMMdd
)
aNew
.
getVoteId
(),
aNew
.
getPhone
(),
sweetWechatOpenId
,
aNew
.
getUnionId
(),
aNew
.
get
Type
(),
aNew
.
get
CityCode
(),
aNew
.
getCityName
(),
DateUtil
.
format
(
LocalDateTime
.
now
(),
DateUtil
.
Formatter
.
yyyyMMdd
)
});
});
Integer
cityVoteNum
=
redisDataUtils
.
getSweetCityVote
(
aNew
.
getCityCode
());
Integer
cityVoteNum
=
redisDataUtils
.
getSweetCityVote
(
aNew
.
getCityCode
()
,
aNew
.
getType
()
);
if
(
cityVoteNum
>
0
)
{
// 已有 incr
if
(
cityVoteNum
>
0
)
{
// 已有 incr
sqls
.
add
(
SqlMapping
.
get
(
"sweet_city_vote_stat.update"
));
sqls
.
add
(
SqlMapping
.
get
(
"sweet_city_vote_stat.update"
));
sqlsDataB
.
add
(
new
Object
[]{
sqlsDataB
.
add
(
new
Object
[]{
LocalDateTime
.
now
(),
aNew
.
getCityCode
()
LocalDateTime
.
now
(),
aNew
.
getCityCode
()
,
aNew
.
getType
()
});
});
}
else
{
// insert
}
else
{
// insert
sqls
.
add
(
SqlMapping
.
get
(
"sweet_city_vote_stat.insert"
));
sqls
.
add
(
SqlMapping
.
get
(
"sweet_city_vote_stat.insert"
));
sqlsDataB
.
add
(
new
Object
[]{
sqlsDataB
.
add
(
new
Object
[]{
IDGenerator
.
nextSnowId
(),
aNew
.
getCityCode
(),
aNew
.
getCityName
(),
1
IDGenerator
.
nextSnowId
(),
aNew
.
getCityCode
(),
aNew
.
getCityName
(),
1
,
aNew
.
getType
()
});
});
}
}
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
SWEET_CITY_VOTE_DRAW
.
getKey
(),
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
SWEET_CITY_VOTE_DRAW
.
getKey
(),
SqlMapping
.
gets
(
sqls
,
sqlsDataA
,
sqlsDataB
));
SqlMapping
.
gets
(
sqls
,
sqlsDataA
,
sqlsDataB
));
redisDataUtils
.
incrSweetCityVote
(
aNew
.
getCityCode
());
redisDataUtils
.
incrSweetCityVote
(
aNew
.
getCityCode
()
,
aNew
.
getType
()
);
redisDataUtils
.
setUserVote
(
param
.
getPhone
(),
param
.
getUnionId
(),
param
);
redisDataUtils
.
setUserVote
(
param
.
getPhone
(),
param
.
getUnionId
(),
param
);
return
ResponseDto
.
success
();
return
ResponseDto
.
success
();
}
}
public
ResponseDto
setStatList
()
{
public
ResponseDto
setStatList
(
Integer
type
)
{
List
<
SweetCityVoteStatDto
>
list
=
sweetCityVoteStatMapper
.
getStatList
();
List
<
SweetCityVoteStatDto
>
list
=
sweetCityVoteStatMapper
.
getStatList
(
type
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
ArrayList
<
SweetCItyVoteStatVo
>
newList
=
ObjectUtil
.
getSweetCItyVoteStatVoList
();
ArrayList
<
SweetCItyVoteStatVo
>
newList
=
ObjectUtil
.
getSweetCItyVoteStatVoList
();
list
.
forEach
(
r
->
newList
.
add
(
SweetCItyVoteStatVo
.
getNew
().
copy
(
r
)));
list
.
forEach
(
r
->
newList
.
add
(
SweetCItyVoteStatVo
.
getNew
().
copy
(
r
)));
redisDataUtils
.
setSweetCityVoteStatList
(
newList
);
redisDataUtils
.
setSweetCityVoteStatList
(
newList
,
type
);
}
}
redisDataUtils
.
setSweetCityVoteStatUpdateTime
();
redisDataUtils
.
setSweetCityVoteStatUpdateTime
(
type
);
return
ResponseDto
.
success
();
return
ResponseDto
.
success
();
}
}
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/utils/RedisDataUtils.java
View file @
d570e0fb
...
@@ -492,12 +492,12 @@ public class RedisDataUtils {
...
@@ -492,12 +492,12 @@ public class RedisDataUtils {
}
}
// 投票
// 投票
public
void
setSweetCityVoteStatList
(
List
<
SweetCItyVoteStatVo
>
sweetCItyVoteStatVo
)
{
public
void
setSweetCityVoteStatList
(
List
<
SweetCItyVoteStatVo
>
sweetCItyVoteStatVo
,
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST
;
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST
.
concat
(
String
.
valueOf
(
type
))
;
redisUtil
.
set
(
redisKey
,
sweetCItyVoteStatVo
);
redisUtil
.
set
(
redisKey
,
sweetCItyVoteStatVo
);
}
}
public
List
<
SweetCItyVoteStatVo
>
getSweetCityVoteStatList
()
{
public
List
<
SweetCItyVoteStatVo
>
getSweetCityVoteStatList
(
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST
;
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST
.
concat
(
String
.
valueOf
(
type
))
;
Object
obj
=
redisUtil
.
get
(
redisKey
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
List
<
SweetCItyVoteStatVo
>
sweetCityVoteStatList
=
ObjectUtil
.
getSweetCItyVoteStatVoList
();
List
<
SweetCItyVoteStatVo
>
sweetCityVoteStatList
=
ObjectUtil
.
getSweetCItyVoteStatVoList
();
if
(
null
!=
obj
)
{
if
(
null
!=
obj
)
{
...
@@ -505,12 +505,12 @@ public class RedisDataUtils {
...
@@ -505,12 +505,12 @@ public class RedisDataUtils {
}
}
return
sweetCityVoteStatList
;
return
sweetCityVoteStatList
;
}
}
public
void
incrSweetCityVote
(
String
cityCode
)
{
public
void
incrSweetCityVote
(
String
cityCode
,
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE
.
concat
(
cityCode
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE
.
concat
(
String
.
valueOf
(
type
)).
concat
(
cityCode
);
redisUtil
.
incr
(
redisKey
,
1
);
redisUtil
.
incr
(
redisKey
,
1
);
}
}
public
Integer
getSweetCityVote
(
String
cityCode
)
{
public
Integer
getSweetCityVote
(
String
cityCode
,
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE
.
concat
(
cityCode
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE
.
concat
(
String
.
valueOf
(
type
)).
concat
(
cityCode
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
null
==
obj
)
{
if
(
null
==
obj
)
{
return
0
;
return
0
;
...
@@ -519,11 +519,13 @@ public class RedisDataUtils {
...
@@ -519,11 +519,13 @@ public class RedisDataUtils {
}
}
}
}
public
void
setUserVote
(
String
phone
,
String
openId
,
SweetCityVoteParam
param
)
{
public
void
setUserVote
(
String
phone
,
String
openId
,
SweetCityVoteParam
param
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_USER
.
concat
(
phone
).
concat
(
"-"
).
concat
(
openId
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
param
.
getType
()))
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_USER
).
concat
(
phone
).
concat
(
"-"
).
concat
(
openId
);
redisUtil
.
set
(
redisKey
,
param
);
redisUtil
.
set
(
redisKey
,
param
);
}
}
public
SweetCityVoteParam
getUserVote
(
String
phone
,
String
openId
)
{
public
SweetCityVoteParam
getUserVote
(
String
phone
,
String
openId
,
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_USER
.
concat
(
phone
).
concat
(
"-"
).
concat
(
openId
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE
.
concat
(
String
.
valueOf
(
type
))
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_USER
).
concat
(
phone
).
concat
(
"-"
).
concat
(
openId
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
null
==
obj
)
{
if
(
null
==
obj
)
{
return
null
;
return
null
;
...
@@ -531,12 +533,12 @@ public class RedisDataUtils {
...
@@ -531,12 +533,12 @@ public class RedisDataUtils {
return
(
SweetCityVoteParam
)
obj
;
return
(
SweetCityVoteParam
)
obj
;
}
}
}
}
public
void
setSweetCityVoteStatUpdateTime
()
{
public
void
setSweetCityVoteStatUpdateTime
(
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME
;
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME
.
concat
(
String
.
valueOf
(
type
))
;
redisUtil
.
set
(
redisKey
,
DateUtil
.
getNowTime
());
redisUtil
.
set
(
redisKey
,
DateUtil
.
getNowTime
());
}
}
public
String
getSweetCityVoteStatUpdateTime
()
{
public
String
getSweetCityVoteStatUpdateTime
(
Integer
type
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME
;
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME
.
concat
(
String
.
valueOf
(
type
))
;
Object
obj
=
redisUtil
.
get
(
redisKey
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
null
==
obj
)
{
if
(
null
==
obj
)
{
return
""
;
return
""
;
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/vo/SweetCItyVoteStatVo.java
View file @
d570e0fb
...
@@ -37,6 +37,9 @@ public class SweetCItyVoteStatVo implements Serializable, Cloneable {
...
@@ -37,6 +37,9 @@ public class SweetCItyVoteStatVo implements Serializable, Cloneable {
@ApiModelProperty
(
"当前用户是否投了当前城市 1没投 2投了"
)
@ApiModelProperty
(
"当前用户是否投了当前城市 1没投 2投了"
)
private
Integer
isVote
;
private
Integer
isVote
;
@ApiModelProperty
(
"type"
)
private
Integer
type
;
/*@ApiModelProperty("创建时间")
/*@ApiModelProperty("创建时间")
private LocalDateTime createdAt;
private LocalDateTime createdAt;
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/resources/com/liquidnet/service/sweet/mapper/SweetCityVoteStatMapper.xml
View file @
d570e0fb
...
@@ -8,12 +8,18 @@
...
@@ -8,12 +8,18 @@
<result
column=
"vote_num"
property=
"voteNum"
/>
<result
column=
"vote_num"
property=
"voteNum"
/>
<result
column=
"manual_vote_num"
property=
"manualVoteNum"
/>
<result
column=
"manual_vote_num"
property=
"manualVoteNum"
/>
<result
column=
"total_num"
property=
"totalNum"
/>
<result
column=
"total_num"
property=
"totalNum"
/>
<result
column=
"type"
property=
"type"
/>
</resultMap>
</resultMap>
<select
id=
"getStatList"
resultMap=
"getListResult"
>
<select
id=
"getStatList"
resultMap=
"getListResult"
>
select
select
*, (vote_num + manual_vote_num) as total_num
*, (vote_num + manual_vote_num) as total_num
from sweet_city_vote_stat
from sweet_city_vote_stat
<where>
<if
test=
"type != ''"
>
AND type=${type}
</if>
</where>
ORDER BY total_num DESC
ORDER BY total_num DESC
</select>
</select>
</mapper>
</mapper>
liquidnet-bus-service/liquidnet-service-sweet/src/main/resources/sqlmap.properties
View file @
d570e0fb
...
@@ -50,8 +50,8 @@ sweet_remind.insert=INSERT INTO sweet_remind (remind_id,openId,unionId,performan
...
@@ -50,8 +50,8 @@ sweet_remind.insert=INSERT INTO sweet_remind (remind_id,openId,unionId,performan
# --------------------------小程序登录记录用户解密后信息--------------------------
# --------------------------小程序登录记录用户解密后信息--------------------------
sweet_applet_user.insert
=
INSERT INTO sweet_applet_user (user_id,openId,unionId,getPhoneNumber,getPurePhoneNumber,getCountryCode,type) VALUES (?,?,?,?,?,?,?)
sweet_applet_user.insert
=
INSERT INTO sweet_applet_user (user_id,openId,unionId,getPhoneNumber,getPurePhoneNumber,getCountryCode,type) VALUES (?,?,?,?,?,?,?)
# --------------------------用户投票记录--------------------------
# --------------------------用户投票记录--------------------------
sweet_city_vote.insert
=
INSERT INTO sweet_city_vote (vote_id,phone,openId,unionId,
city_code,city_name,day_time) VALUES (
?,?,?,?,?,?,?)
sweet_city_vote.insert
=
INSERT INTO sweet_city_vote (vote_id,phone,openId,unionId,
type,city_code,city_name,day_time) VALUES (?,
?,?,?,?,?,?,?)
sweet_city_vote_stat.insert
=
INSERT INTO sweet_city_vote_stat (stat_id,city_code,city_name,vote_num
) VALUES (
?,?,?,?)
sweet_city_vote_stat.insert
=
INSERT INTO sweet_city_vote_stat (stat_id,city_code,city_name,vote_num
,type) VALUES (?,
?,?,?,?)
sweet_city_vote_stat.update
=
UPDATE sweet_city_vote_stat SET vote_num = IFNULL(vote_num, 0) + 1, updated_at = ? WHERE city_code = ?
sweet_city_vote_stat.update
=
UPDATE sweet_city_vote_stat SET vote_num = IFNULL(vote_num, 0) + 1, updated_at = ? WHERE city_code = ?
AND type = ?
# --------------------------防疫答题--------------------------
# --------------------------防疫答题--------------------------
sweet_antigenic_question.insert
=
INSERT INTO sweet_antigenic_question (question_id,type,openId,unionId,nickname,address,phone,urgent_phone,keyword1,keyword11,keyword2,keyword3,keyword4,keyword5,keyword6,keyword7) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
sweet_antigenic_question.insert
=
INSERT INTO sweet_antigenic_question (question_id,type,openId,unionId,nickname,address,phone,urgent_phone,keyword1,keyword11,keyword2,keyword3,keyword4,keyword5,keyword6,keyword7) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
\ No newline at end of file
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