记得上下班打卡 | 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
7f19ae1f
Commit
7f19ae1f
authored
Apr 11, 2022
by
GaoHu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exit
parent
f556c368
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
16 deletions
+18
-16
GoblinGoodsAnticipateServiceImpl.java
...goblin/service/impl/GoblinGoodsAnticipateServiceImpl.java
+15
-15
GoblinMongoUtils.java
...a/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
+3
-1
No files found.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinGoodsAnticipateServiceImpl.java
View file @
7f19ae1f
...
@@ -55,20 +55,20 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
...
@@ -55,20 +55,20 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
PageInfo
<
GoblinGoodsAnticipateVo
>
pageInfo
=
new
PageInfo
<>();
PageInfo
<
GoblinGoodsAnticipateVo
>
pageInfo
=
new
PageInfo
<>();
HashMap
<
String
,
Object
>
map
=
goblinMongoUtils
.
getGoblinGoodsAnticipateVos
(
goodsAnticipateParam
);
HashMap
<
String
,
Object
>
map
=
goblinMongoUtils
.
getGoblinGoodsAnticipateVos
(
goodsAnticipateParam
);
List
<
GoblinGoodsAnticipateVo
>
data
=
(
List
<
GoblinGoodsAnticipateVo
>)
map
.
get
(
"data"
);
List
<
GoblinGoodsAnticipateVo
>
data
=
(
List
<
GoblinGoodsAnticipateVo
>)
map
.
get
(
"data"
);
for
(
GoblinGoodsAnticipateVo
goblinGoodsAnticipateVo
:
data
){
for
(
GoblinGoodsAnticipateVo
goblinGoodsAnticipateVo
:
data
)
{
//预约开始时间
//预约开始时间
LocalDateTime
aboutStartDate
=
goblinGoodsAnticipateVo
.
getAboutStartDate
();
LocalDateTime
aboutStartDate
=
goblinGoodsAnticipateVo
.
getAboutStartDate
();
LocalDateTime
aboutEndDate
=
goblinGoodsAnticipateVo
.
getAboutEndDate
();
LocalDateTime
aboutEndDate
=
goblinGoodsAnticipateVo
.
getAboutEndDate
();
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
();
if
(
aboutStartDate
.
isBefore
(
now
)){
if
(
aboutStartDate
.
isBefore
(
now
))
{
//未开始 0
//未开始 0
goblinGoodsAnticipateVo
.
setState
(
0
);
goblinGoodsAnticipateVo
.
setState
(
0
);
}
}
if
(!
aboutStartDate
.
isBefore
(
now
)&&
aboutEndDate
.
isAfter
(
now
))
{
if
(!
aboutStartDate
.
isBefore
(
now
)
&&
aboutEndDate
.
isAfter
(
now
))
{
//预约中
//预约中
goblinGoodsAnticipateVo
.
setState
(
1
);
goblinGoodsAnticipateVo
.
setState
(
1
);
}
}
if
(
aboutEndDate
.
isBefore
(
now
)){
if
(
aboutEndDate
.
isBefore
(
now
))
{
//已结束
//已结束
goblinGoodsAnticipateVo
.
setState
(
2
);
goblinGoodsAnticipateVo
.
setState
(
2
);
}
}
...
@@ -97,7 +97,7 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
...
@@ -97,7 +97,7 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
//redis消息预约消息表
//redis消息预约消息表
/*
LinkedList<Object[]> sqlAnt = CollectionUtil.linkedListObjectArr();
LinkedList
<
Object
[]>
sqlAnt
=
CollectionUtil
.
linkedListObjectArr
();
sqlAnt
.
add
(
new
Object
[]{
sqlAnt
.
add
(
new
Object
[]{
antId
,
antId
,
goodsAnticipateVo
.
getName
(),
goodsAnticipateVo
.
getName
(),
...
@@ -126,7 +126,7 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
...
@@ -126,7 +126,7 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
goodsAnticipateValueVo
.
getAboutEndDate
(),
goodsAnticipateValueVo
.
getAboutEndDate
(),
});
});
sendRedis
(
"goblin_goods_anticipate_value"
,
sqlValue
);
sendRedis
(
"goblin_goods_anticipate_value"
,
sqlValue
);
});
*/
});
//mongodb新增
//mongodb新增
goblinMongoUtils
.
setGoblinGoodsAnticipateVo
(
goodsAnticipateVo
);
goblinMongoUtils
.
setGoblinGoodsAnticipateVo
(
goodsAnticipateVo
);
...
@@ -181,11 +181,11 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
...
@@ -181,11 +181,11 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
}
}
@Override
@Override
public
ResponseDto
<
Object
>
userAbout
(
String
autId
,
String
skuId
,
String
uid
,
String
phone
,
Integer
state
)
{
public
ResponseDto
<
Object
>
userAbout
(
String
autId
,
String
skuId
,
String
uid
,
String
phone
,
Integer
state
)
{
//查询该用户是否预
//查询该用户是否预
GoblinGoodAnticipateUserVo
userVo
=
goblinRedisUtils
.
getUserAboutAut
(
skuId
,
uid
);
GoblinGoodAnticipateUserVo
userVo
=
goblinRedisUtils
.
getUserAboutAut
(
skuId
,
uid
);
LinkedList
<
Object
[]>
sqlValue
=
CollectionUtil
.
linkedListObjectArr
();
LinkedList
<
Object
[]>
sqlValue
=
CollectionUtil
.
linkedListObjectArr
();
if
(
state
.
equals
(
GoblinGoodAnticipateUserVo
.
STATE_VALID
)
&&
userVo
==
null
)
{
if
(
state
.
equals
(
GoblinGoodAnticipateUserVo
.
STATE_VALID
)
&&
userVo
==
null
)
{
//用户没有预约过
//用户没有预约过
//发送redis消息修改mysql记录用户预约
//发送redis消息修改mysql记录用户预约
sqlValue
.
add
(
new
Object
[]{
sqlValue
.
add
(
new
Object
[]{
...
@@ -194,22 +194,22 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
...
@@ -194,22 +194,22 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
phone
,
phone
,
state
state
});
});
sendRedis
(
"goblin_goods_anticipate_user"
,
sqlValue
);
sendRedis
(
"goblin_goods_anticipate_user"
,
sqlValue
);
GoblinGoodAnticipateUserVo
user
=
new
GoblinGoodAnticipateUserVo
(
uid
,
skuId
,
phone
,
state
);
GoblinGoodAnticipateUserVo
user
=
new
GoblinGoodAnticipateUserVo
(
uid
,
skuId
,
phone
,
state
);
//mongodb记录
//mongodb记录
goblinRedisUtils
.
setUserAboutSku
(
user
);
goblinRedisUtils
.
setUserAboutSku
(
user
);
//预约人数+1或-1
//预约人数+1或-1
}
else
{
}
else
{
//mysql删除用户记录
//mysql删除用户记录
sqlValue
.
add
(
new
Object
[]{
sqlValue
.
add
(
new
Object
[]{
uid
,
uid
,
skuId
skuId
});
});
sendRedis
(
"goblin_goods_anticipate_user_update"
,
sqlValue
);
sendRedis
(
"goblin_goods_anticipate_user_update"
,
sqlValue
);
//删除缓存 redis和mongodb
//删除缓存 redis和mongodb
goblinRedisUtils
.
delUserAboutSku
(
skuId
,
uid
);
goblinRedisUtils
.
delUserAboutSku
(
skuId
,
uid
);
}
}
goblinRedisUtils
.
setAutId
(
autId
,
state
);
goblinRedisUtils
.
setAutId
(
autId
,
state
);
return
null
;
return
null
;
}
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
View file @
7f19ae1f
...
@@ -35,6 +35,7 @@ import org.springframework.util.CollectionUtils;
...
@@ -35,6 +35,7 @@ import org.springframework.util.CollectionUtils;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -101,8 +102,9 @@ public class GoblinMongoUtils {
...
@@ -101,8 +102,9 @@ public class GoblinMongoUtils {
* 根据antId修改 预约人数
* 根据antId修改 预约人数
*/
*/
public
void
updateGoblinGoodsAnticipateVo
(
GoblinGoodsAnticipateUpdateParam
goodsAnticipateUpdateParam
)
{
public
void
updateGoblinGoodsAnticipateVo
(
GoblinGoodsAnticipateUpdateParam
goodsAnticipateUpdateParam
)
{
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
Query
query
=
Query
.
query
(
Criteria
.
where
(
"antId"
).
is
(
goodsAnticipateUpdateParam
.
getAutId
()));
Query
query
=
Query
.
query
(
Criteria
.
where
(
"antId"
).
is
(
goodsAnticipateUpdateParam
.
getAutId
()));
Update
update
=
new
Update
().
set
(
"name"
,
goodsAnticipateUpdateParam
.
getName
()).
set
(
"rule"
,
goodsAnticipateUpdateParam
.
getRule
()).
set
(
"updateDate"
,
LocalDateTime
.
now
(
));
Update
update
=
new
Update
().
set
(
"name"
,
goodsAnticipateUpdateParam
.
getName
()).
set
(
"rule"
,
goodsAnticipateUpdateParam
.
getRule
()).
set
(
"updateDate"
,
df
.
format
(
LocalDateTime
.
now
()
));
mongoTemplate
.
updateFirst
(
query
,
update
,
GoblinGoodsAnticipateVo
.
class
.
getSimpleName
());
mongoTemplate
.
updateFirst
(
query
,
update
,
GoblinGoodsAnticipateVo
.
class
.
getSimpleName
());
}
}
...
...
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