记得上下班打卡 | 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
7cd058ff
Commit
7cd058ff
authored
Aug 19, 2021
by
Administrator
🎨
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pre' into 'master'
Pre See merge request
!18
parents
be8c398b
f512ac53
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
38 deletions
+60
-38
SweetConstant.java
...a/com/liquidnet/service/sweet/constant/SweetConstant.java
+1
-0
SweetAppletController.java
...idnet/service/sweet/controller/SweetAppletController.java
+1
-0
SweetWechatSyncDataController.java
...rvice/sweet/controller/SweetWechatSyncDataController.java
+6
-5
SweetWechatMpService.java
...dnet/service/sweet/service/impl/SweetWechatMpService.java
+40
-33
RedisDataUtils.java
...ava/com/liquidnet/service/sweet/utils/RedisDataUtils.java
+12
-0
No files found.
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/constant/SweetConstant.java
View file @
7cd058ff
...
@@ -15,6 +15,7 @@ public class SweetConstant {
...
@@ -15,6 +15,7 @@ public class SweetConstant {
public
final
static
String
REDIS_KEY_SWEET_SHOP
=
"sweet:artists:shop:manual:"
;
public
final
static
String
REDIS_KEY_SWEET_SHOP
=
"sweet:artists:shop:manual:"
;
public
final
static
String
REDIS_KEY_SWEET_LUCK_DRAW
=
"sweet:luckDraw:mobile:"
;
public
final
static
String
REDIS_KEY_SWEET_LUCK_DRAW
=
"sweet:luckDraw:mobile:"
;
public
final
static
String
REDIS_KEY_SWEET_LUCK_DRAW_RESULT
=
"sweet:luckDraw:num:"
;
public
final
static
String
REDIS_KEY_SWEET_LUCK_DRAW_SURPLUS
=
"sweet:luckDraw:num:"
;
//中奖库存
public
final
static
String
REDIS_KEY_SWEET_LUCK_DRAW_SURPLUS
=
"sweet:luckDraw:num:"
;
//中奖库存
public
final
static
String
REDIS_KEY_SWEET_LUCK_DRAW_ALL
=
"sweet:luckDraw:num:"
;
//中奖总量
public
final
static
String
REDIS_KEY_SWEET_LUCK_DRAW_ALL
=
"sweet:luckDraw:num:"
;
//中奖总量
public
final
static
String
REDIS_KEY_SWEET_LUCK_DRAW_PRESENT_MOBILE
=
"sweet:luckDraw:present:mobile:"
;
//中奖库存
public
final
static
String
REDIS_KEY_SWEET_LUCK_DRAW_PRESENT_MOBILE
=
"sweet:luckDraw:present:mobile:"
;
//中奖库存
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/controller/SweetAppletController.java
View file @
7cd058ff
...
@@ -336,6 +336,7 @@ public class SweetAppletController {
...
@@ -336,6 +336,7 @@ public class SweetAppletController {
HashMap
<
String
,
Integer
>
hashMap
=
CollectionUtil
.
mapStringInteger
();
HashMap
<
String
,
Integer
>
hashMap
=
CollectionUtil
.
mapStringInteger
();
hashMap
.
put
(
"count"
,
redisDataUtils
.
getLuckDrawStatus
(
mobile
,
luckDrawNum
));
hashMap
.
put
(
"count"
,
redisDataUtils
.
getLuckDrawStatus
(
mobile
,
luckDrawNum
));
hashMap
.
put
(
"prize"
,
redisDataUtils
.
getLuckDrawResult
(
mobile
,
luckDrawNum
));
return
ResponseDto
.
success
(
hashMap
);
return
ResponseDto
.
success
(
hashMap
);
}
}
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/controller/SweetWechatSyncDataController.java
View file @
7cd058ff
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.Api;
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
...
@@ -19,6 +20,7 @@ import java.io.*;
...
@@ -19,6 +20,7 @@ import java.io.*;
@Api
(
tags
=
"同步微信用户数据"
)
@Api
(
tags
=
"同步微信用户数据"
)
@RestController
@RestController
@RequestMapping
(
"/wechatSync"
)
@RequestMapping
(
"/wechatSync"
)
@Slf4j
public
class
SweetWechatSyncDataController
{
public
class
SweetWechatSyncDataController
{
@Autowired
@Autowired
...
@@ -35,8 +37,7 @@ public class SweetWechatSyncDataController {
...
@@ -35,8 +37,7 @@ public class SweetWechatSyncDataController {
BufferedReader
bufferedReader
=
new
BufferedReader
(
read
);
BufferedReader
bufferedReader
=
new
BufferedReader
(
read
);
String
mobile
=
null
;
String
mobile
=
null
;
while
((
mobile
=
bufferedReader
.
readLine
())
!=
null
)
{
while
((
mobile
=
bufferedReader
.
readLine
())
!=
null
)
{
System
.
out
.
println
(
mobile
);
log
.
info
(
"regMobilen:mobile:[{}]"
,
mobile
);
try
{
try
{
MultiValueMap
<
String
,
String
>
params
=
new
LinkedMultiValueMap
();
MultiValueMap
<
String
,
String
>
params
=
new
LinkedMultiValueMap
();
params
.
add
(
"mobile"
,
mobile
);
params
.
add
(
"mobile"
,
mobile
);
...
@@ -46,7 +47,7 @@ public class SweetWechatSyncDataController {
...
@@ -46,7 +47,7 @@ public class SweetWechatSyncDataController {
String
url
=
""
;
String
url
=
""
;
HttpUtil
.
post
(
url
,
params
);
HttpUtil
.
post
(
url
,
params
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
log
.
info
(
"regMobileException:mobile:[{}]"
,
mobile
);
}
}
}
}
...
@@ -62,7 +63,7 @@ public class SweetWechatSyncDataController {
...
@@ -62,7 +63,7 @@ public class SweetWechatSyncDataController {
try
{
try
{
sweetWechatMpService
.
userInfo
();
sweetWechatMpService
.
userInfo
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
log
.
error
(
"getUsers"
,
e
);
}
}
}
}
...
@@ -75,7 +76,7 @@ public class SweetWechatSyncDataController {
...
@@ -75,7 +76,7 @@ public class SweetWechatSyncDataController {
try
{
try
{
sweetWechatMpService
.
getUser
(
openId
);
sweetWechatMpService
.
getUser
(
openId
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
log
.
error
(
"getUser"
,
e
);
}
}
}
}
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetWechatMpService.java
View file @
7cd058ff
...
@@ -47,9 +47,12 @@ public class SweetWechatMpService {
...
@@ -47,9 +47,12 @@ public class SweetWechatMpService {
log
.
info
(
"nextOpenid:[{}] "
,
nextOpenid
);
log
.
info
(
"nextOpenid:[{}] "
,
nextOpenid
);
for
(
String
openId
:
openids
)
{
for
(
String
openId
:
openids
)
{
try
{
WxMpUser
wxMpUser
=
wxMpService
.
getUserService
().
userInfo
(
openId
);
WxMpUser
wxMpUser
=
wxMpService
.
getUserService
().
userInfo
(
openId
);
log
.
info
(
"openId:[{}],wxMpUsers:[{}]"
,
openId
,
wxMpUser
);
if
(!
wxMpUser
.
getSubscribe
())
{
log
.
info
(
"getSubscribeFalse:openId:[{}]"
,
openId
);
continue
;
}
SweetWechatUser
userInfo
=
redisDataUtils
.
getSweetWechatUser
(
wxMpUser
.
getUnionId
());
SweetWechatUser
userInfo
=
redisDataUtils
.
getSweetWechatUser
(
wxMpUser
.
getUnionId
());
if
(
null
==
userInfo
)
{
if
(
null
==
userInfo
)
{
SweetWechatUser
sweetWechatUser
=
SweetWechatUser
.
getNew
();
SweetWechatUser
sweetWechatUser
=
SweetWechatUser
.
getNew
();
...
@@ -80,9 +83,13 @@ public class SweetWechatMpService {
...
@@ -80,9 +83,13 @@ public class SweetWechatMpService {
// 入缓存
// 入缓存
redisDataUtils
.
setSweetWechatUser
(
sweetWechatUser
);
redisDataUtils
.
setSweetWechatUser
(
sweetWechatUser
);
}
}
}
catch
(
Exception
e
)
{
log
.
info
(
"forException:openId:[{}]"
,
openId
);
}
}
}
log
.
info
(
"nextOpenidSuccess:[{}] "
,
nextOpenid
);
}
while
(!
nextOpenid
.
isEmpty
());
}
while
(!
nextOpenid
.
isEmpty
());
log
.
info
(
"同步微信用户完成"
);
}
}
public
void
getUser
(
String
openId
)
throws
WxErrorException
{
public
void
getUser
(
String
openId
)
throws
WxErrorException
{
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/utils/RedisDataUtils.java
View file @
7cd058ff
...
@@ -404,6 +404,17 @@ public class RedisDataUtils {
...
@@ -404,6 +404,17 @@ public class RedisDataUtils {
}
}
}
}
//获取抽奖状态
public
int
getLuckDrawResult
(
String
mobile
,
String
luckDrawNum
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_LUCK_DRAW_RESULT
.
concat
(
luckDrawNum
).
concat
(
":mobile:"
+
mobile
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
obj
==
null
){
return
0
;
}
else
{
return
(
int
)
redisUtil
.
get
(
redisKey
);
}
}
//修改抽奖状态
//修改抽奖状态
public
SweetPrizeVo
changeLuckDrawStatus
(
String
mobile
,
String
unionId
,
String
luckDrawNum
)
{
public
SweetPrizeVo
changeLuckDrawStatus
(
String
mobile
,
String
unionId
,
String
luckDrawNum
)
{
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
...
@@ -444,6 +455,7 @@ public class RedisDataUtils {
...
@@ -444,6 +455,7 @@ public class RedisDataUtils {
if
(
surplus
<
prizeALl
)
{
if
(
surplus
<
prizeALl
)
{
prize
=
(
int
)
redisUtil
.
incr
(
redisSurplus
,
1
);
prize
=
(
int
)
redisUtil
.
incr
(
redisSurplus
,
1
);
redisUtil
.
set
(
redisKey
,
2
);
redisUtil
.
set
(
redisKey
,
2
);
redisUtil
.
set
(
SweetConstant
.
REDIS_KEY_SWEET_LUCK_DRAW_RESULT
.
concat
(
luckDrawNum
).
concat
(
":mobile:"
+
mobile
),
prize
);
}
}
}
}
}
}
...
...
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