记得上下班打卡 | 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
5c05aca6
Commit
5c05aca6
authored
Jan 04, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交 app 正在下单 活动、店铺列表
parent
2ca63d68
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
9 deletions
+71
-9
GoblinRedisConst.java
...m/liquidnet/service/goblin/constant/GoblinRedisConst.java
+2
-0
GoblinZhengzaiMarketServiceImpl.java
.../goblin/service/impl/GoblinZhengzaiMarketServiceImpl.java
+10
-6
GoblinMongoUtils.java
.../client/admin/zhengzai/goblin/utils/GoblinMongoUtils.java
+10
-3
GoblinRedisUtils.java
.../client/admin/zhengzai/goblin/utils/GoblinRedisUtils.java
+49
-0
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/constant/GoblinRedisConst.java
View file @
5c05aca6
...
...
@@ -43,6 +43,8 @@ public class GoblinRedisConst {
public
static
final
String
REDIS_GOBLIN_STORE_SELF_RELATION
=
PREFIX
.
concat
(
"zhengzai:storeId:"
);
//活动-当前商铺能参与的官方活动id列表
public
static
final
String
REDIS_GOBLIN_STORE_MARKET
=
PREFIX
.
concat
(
"store:market:"
);
//商铺活动
public
static
final
String
REDIS_GOBLIN_ZHENGZAI_LIST
=
PREFIX
.
concat
(
"zhengzai:list"
);
//全部正在下单内容
public
static
final
String
REDIS_GOBLIN_STORE_MARKET_ISCONFIG
=
PREFIX
.
concat
(
"store:is_config:"
);
//商铺活动-该活动配置了款式的商品
/* ----------------------------------------------------------------- */
/**
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/goblin/service/impl/GoblinZhengzaiMarketServiceImpl.java
View file @
5c05aca6
...
...
@@ -84,6 +84,7 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
goblinMongoUtils
.
delSelfMarket
(
marketId
);
//redis
goblinRedisUtils
.
delSelfMarket
(
marketId
);
goblinRedisUtils
.
delZhengzaiList
(
marketId
);
}
else
{
selfMarketing
.
setStatus
(
status
);
selfMarketing
.
setUpdatedAt
(
LocalDateTime
.
now
());
...
...
@@ -92,9 +93,10 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
//mongo
GoblinSelfMarketingVo
vo
=
GoblinSelfMarketingVo
.
getNew
();
BeanUtils
.
copyProperties
(
selfMarketing
,
vo
);
goblinMongoUtils
.
updateSelfMarket
(
marketId
,
vo
);
GoblinSelfMarketingVo
changeVo
=
goblinMongoUtils
.
updateSelfMarket
(
marketId
,
vo
);
//redis
goblinRedisUtils
.
setSelfMarket
(
marketId
,
vo
);
goblinRedisUtils
.
setSelfMarket
(
marketId
,
changeVo
);
goblinRedisUtils
.
changeZhengzaiList
(
changeVo
);
}
return
ResponseDto
.
success
();
}
...
...
@@ -120,6 +122,7 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
goblinMongoUtils
.
insertSelfMarket
(
vo
);
//redis
goblinRedisUtils
.
setSelfMarket
(
SelfMarketId
,
vo
);
goblinRedisUtils
.
addZhengzaiList
(
vo
);
return
ResponseDto
.
success
();
}
...
...
@@ -139,9 +142,10 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
vo
.
setName
(
purchaseName
);
vo
.
setStartTime
(
st
);
vo
.
setEndTime
(
et
);
goblinMongoUtils
.
updateSelfMarket
(
marketId
,
vo
);
GoblinSelfMarketingVo
changeVo
=
goblinMongoUtils
.
updateSelfMarket
(
marketId
,
vo
);
//redis
goblinRedisUtils
.
setSelfMarket
(
marketId
,
vo
);
goblinRedisUtils
.
changeZhengzaiList
(
changeVo
);
return
ResponseDto
.
success
();
}
...
...
@@ -186,7 +190,7 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
goblinMongoUtils
.
insertZhengzaiRelation
(
vo
);
//redis
goblinRedisUtils
.
setZhengzaiRelation
(
marketId
,
vo
);
goblinRedisUtils
.
addStoreSelfRelation
(
marketId
,
storeId
);
goblinRedisUtils
.
addStoreSelfRelation
(
marketId
,
storeId
);
return
ResponseDto
.
success
();
}
...
...
@@ -205,7 +209,7 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
goblinMongoUtils
.
updateZhengzaiRelation
(
marketId
,
storeId
,
vo
);
//redis
goblinRedisUtils
.
setZhengzaiRelation
(
marketId
,
vo
);
goblinRedisUtils
.
addStoreSelfRelation
(
marketId
,
storeId
);
goblinRedisUtils
.
addStoreSelfRelation
(
marketId
,
storeId
);
}
else
if
(
delTag
==
1
)
{
GoblinMarketingZhengzaiRelation
entity
=
GoblinMarketingZhengzaiRelation
.
getNew
();
entity
.
setDelTag
(
1
);
...
...
@@ -216,7 +220,7 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
goblinMongoUtils
.
delZhengzaiRelation
(
marketId
,
storeId
);
//redis
goblinRedisUtils
.
delZhengzaiRelation
(
marketId
,
storeId
);
goblinRedisUtils
.
delStoreSelfRelation
(
marketId
,
storeId
);
goblinRedisUtils
.
delStoreSelfRelation
(
marketId
,
storeId
);
}
return
ResponseDto
.
success
();
}
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/goblin/utils/GoblinMongoUtils.java
View file @
5c05aca6
package
com
.
liquidnet
.
client
.
admin
.
zhengzai
.
goblin
.
utils
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.goblin.dto.vo.GoblinMarketingZhengzaiRelationVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo
;
import
com.liquidnet.service.goblin.entity.GoblinMarketingZhengzaiRelation
;
import
com.liquidnet.service.goblin.entity.GoblinSelfMarketing
;
import
com.liquidnet.service.kylin.dto.vo.partner.KylinTicketTimesPartnerVo
;
import
com.mongodb.BasicDBObject
;
import
com.mongodb.client.model.FindOneAndUpdateOptions
;
import
com.mongodb.client.model.ReturnDocument
;
import
com.mongodb.client.result.DeleteResult
;
import
com.mongodb.client.result.UpdateResult
;
import
org.bson.Document
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.convert.MongoConverter
;
...
...
@@ -26,11 +31,13 @@ public class GoblinMongoUtils {
return
mongoTemplate
.
insert
(
data
,
GoblinSelfMarketingVo
.
class
.
getSimpleName
());
}
public
UpdateResult
updateSelfMarket
(
String
selfMarketId
,
GoblinSelfMarketingVo
data
)
{
public
GoblinSelfMarketingVo
updateSelfMarket
(
String
selfMarketId
,
GoblinSelfMarketingVo
data
)
{
BasicDBObject
object
=
GoblinObjectUtils
.
cloneBasicDBObject
().
append
(
"$set"
,
mongoConverter
.
convertToMongoType
(
data
));
return
mongoTemplate
.
getCollection
(
GoblinSelfMarketing
.
class
.
getSimpleName
()).
updateOn
e
(
Document
doc
=
mongoTemplate
.
getCollection
(
GoblinSelfMarketing
.
class
.
getSimpleName
()).
findOneAndUpdat
e
(
Query
.
query
(
Criteria
.
where
(
"selfMarketId"
).
is
(
selfMarketId
)).
getQueryObject
(),
object
);
object
,
new
FindOneAndUpdateOptions
().
returnDocument
(
ReturnDocument
.
AFTER
));
return
JsonUtils
.
fromJson
(
doc
.
toJson
(),
GoblinSelfMarketingVo
.
class
);
}
public
DeleteResult
delSelfMarket
(
String
selfMarketId
)
{
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/goblin/utils/GoblinRedisUtils.java
View file @
5c05aca6
...
...
@@ -55,6 +55,7 @@ public class GoblinRedisUtils {
/**
* 获取 当前商铺能参与的官方活动id列表
*
* @param storeId
* @return
*/
...
...
@@ -68,6 +69,7 @@ public class GoblinRedisUtils {
}
}
//添加 当前商铺能参与的活动id列表
public
void
addStoreSelfRelation
(
String
selfMarketId
,
String
storeId
)
{
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_STORE_SELF_RELATION
.
concat
(
storeId
);
List
<
String
>
list
=
getZhengzaiRelation
(
storeId
);
...
...
@@ -75,6 +77,7 @@ public class GoblinRedisUtils {
redisDataSourceUtil
.
getRedisGoblinUtil
().
set
(
redisKey
,
list
);
}
//删除 当前商铺能参与的活动id列表
public
void
delStoreSelfRelation
(
String
selfMarketId
,
String
storeId
)
{
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_STORE_SELF_RELATION
.
concat
(
storeId
);
List
<
String
>
list
=
getZhengzaiRelation
(
storeId
);
...
...
@@ -82,4 +85,50 @@ public class GoblinRedisUtils {
redisDataSourceUtil
.
getRedisGoblinUtil
().
set
(
redisKey
,
list
);
}
//获取 正在下单 活动列表
public
List
<
GoblinSelfMarketingVo
>
getZhengzaiList
()
{
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_ZHENGZAI_LIST
;
Object
obj
=
redisDataSourceUtil
.
getRedisGoblinUtil
().
get
(
redisKey
);
if
(
obj
==
null
)
{
return
new
ArrayList
();
}
else
{
return
(
List
<
GoblinSelfMarketingVo
>)
obj
;
}
}
//添加 正在下单 活动列表
public
void
addZhengzaiList
(
GoblinSelfMarketingVo
vo
)
{
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_ZHENGZAI_LIST
;
List
<
GoblinSelfMarketingVo
>
list
=
getZhengzaiList
();
list
.
add
(
vo
);
redisDataSourceUtil
.
getRedisGoblinUtil
().
set
(
redisKey
,
list
);
}
//删除 正在下单 活动列表
public
void
delZhengzaiList
(
String
selfMarketId
)
{
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_ZHENGZAI_LIST
;
List
<
GoblinSelfMarketingVo
>
list
=
getZhengzaiList
();
for
(
GoblinSelfMarketingVo
item
:
list
)
{
if
(
item
.
getSelfMarketId
().
equals
(
selfMarketId
))
{
list
.
remove
(
item
);
break
;
}
}
redisDataSourceUtil
.
getRedisGoblinUtil
().
set
(
redisKey
,
list
);
}
//修改 正在下单 活动列表
public
void
changeZhengzaiList
(
GoblinSelfMarketingVo
vo
)
{
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_ZHENGZAI_LIST
;
List
<
GoblinSelfMarketingVo
>
list
=
getZhengzaiList
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
GoblinSelfMarketingVo
item
=
list
.
get
(
i
);
if
(
item
.
getSelfMarketId
().
equals
(
vo
.
getSelfMarketId
()))
{
list
.
set
(
i
,
item
);
break
;
}
}
redisDataSourceUtil
.
getRedisGoblinUtil
().
set
(
redisKey
,
list
);
}
}
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