Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
0ccd65ec
Commit
0ccd65ec
authored
Aug 15, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台获取礼品列表增加会员id筛选
parent
2d693130
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
12 deletions
+32
-12
RewardServiceImpl.java
...yudao/module/reward/service/reward/RewardServiceImpl.java
+29
-12
RewardQueryVO.java
.../iocoder/yudao/module/reward/vo/reward/RewardQueryVO.java
+3
-0
No files found.
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/reward/RewardServiceImpl.java
View file @
0ccd65ec
...
...
@@ -212,6 +212,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
lambdaQuery
.
eqIfPresent
(
RewardDO:
:
getNodeId
,
query
.
getNodeId
())
.
eq
(
StringUtils
.
isNotBlank
(
query
.
getPickMethod
()),
RewardDO:
:
getPickMethod
,
query
.
getPickMethod
())
.
eqIfPresent
(
RewardDO:
:
getStatus
,
query
.
getStatus
());
//判断memberId,筛选会员所在城市网点礼品
if
(
query
.
getMemberId
()
!=
null
&&
query
.
getNodeId
()
==
null
)
{
List
<
Long
>
nodes
=
getMemberCityNodes
(
query
.
getMemberId
());
lambdaQuery
.
in
(
CollectionUtil
.
isNotEmpty
(
nodes
),
RewardDO:
:
getNodeId
,
nodes
);
}
//备注,模糊匹配三种语言
if
(
StringUtils
.
isNotBlank
(
query
.
getRemark
()))
{
lambdaQuery
.
and
(
wrapper
->
...
...
@@ -326,16 +331,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
if
(
reqVO
.
getNodeId
()
!=
null
)
{
rewardDOLambdaQuery
.
eq
(
RewardDO:
:
getNodeId
,
reqVO
.
getNodeId
());
}
else
{
UserRespDTO
user
=
memberUserApi
.
getUser
(
reqVO
.
getMemberId
());
List
<
NodeRespDTO
>
nodes
=
null
;
// 如果用户没有填写国家或城市默认展示中国的礼品
if
(
user
.
getCity
()
==
null
||
user
.
getCountry
()
==
null
)
{
nodes
=
nodeApi
.
getNodesByCity
(
null
,
130L
);
}
else
{
nodes
=
nodeApi
.
getNodesByCity
(
user
.
getCity
().
longValue
(),
null
);
}
List
<
Long
>
nodes
=
getMemberCityNodes
(
reqVO
.
getMemberId
());
if
(
CollectionUtil
.
isNotEmpty
(
nodes
))
{
rewardDOLambdaQuery
.
in
(
RewardDO:
:
getNodeId
,
nodes
.
stream
().
map
(
NodeRespDTO:
:
getId
).
collect
(
Collectors
.
toList
())
);
rewardDOLambdaQuery
.
in
(
RewardDO:
:
getNodeId
,
nodes
);
}
}
List
<
RewardDO
>
rewardDOS
=
rewardMapper
.
selectList
(
rewardDOLambdaQuery
);
...
...
@@ -344,7 +342,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
collect
.
forEach
(
this
::
setPickMethod
);
return
collect
;
}
return
Collections
.
EMPTY_LIST
;
return
Collections
.
emptyList
()
;
}
@Override
...
...
@@ -354,14 +352,14 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
BeanUtils
.
copyProperties
(
rewardDO
,
appRewardBackVO
);
setPickMethod
(
appRewardBackVO
);
NodeRespDTO
nodesById
=
nodeApi
.
getNodesById
(
Long
.
valueOf
(
rewardDO
.
getNodeId
()));
if
(
nodesById
!=
null
){
if
(
nodesById
!=
null
)
{
appRewardBackVO
.
setNodeZh
(
nodesById
.
getTitleZh
());
appRewardBackVO
.
setNodeEn
(
nodesById
.
getTitleEn
());
}
return
appRewardBackVO
;
}
private
void
setPickMethod
(
AppRewardBackVO
appRewardBackVO
){
private
void
setPickMethod
(
AppRewardBackVO
appRewardBackVO
)
{
for
(
String
pickMethod
:
appRewardBackVO
.
getPickMethod
().
split
(
","
))
{
AppRewardBackVO
.
PickMethod
pickMethodDict
=
new
AppRewardBackVO
.
PickMethod
();
pickMethodDict
.
setValue
(
pickMethod
);
...
...
@@ -381,6 +379,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
/**
* 校验礼品是否过期并修改礼品状态
*/
@Override
public
Boolean
validateExpire
(
RewardDO
rewardDO
)
{
if
(
rewardDO
.
getEndTime
()
!=
null
)
{
if
(
rewardDO
.
getStatus
()
==
RewardStatusEnum
.
ENABLED
.
getValue
()
&&
rewardDO
.
getEndTime
().
toInstant
().
isBefore
(
Instant
.
now
()))
{
...
...
@@ -394,4 +393,22 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
}
return
false
;
}
/**
* 获取会员所在城市网点id
*/
private
List
<
Long
>
getMemberCityNodes
(
Long
memberId
)
{
UserRespDTO
user
=
memberUserApi
.
getUser
(
memberId
);
List
<
NodeRespDTO
>
nodes
;
// 如果用户没有填写国家或城市默认展示中国的礼品
if
(
user
.
getCity
()
==
null
||
user
.
getCountry
()
==
null
)
{
nodes
=
nodeApi
.
getNodesByCity
(
null
,
130L
);
}
else
{
nodes
=
nodeApi
.
getNodesByCity
(
user
.
getCity
().
longValue
(),
null
);
}
if
(
CollectionUtil
.
isNotEmpty
(
nodes
))
{
return
nodes
.
stream
().
map
(
NodeRespDTO:
:
getId
).
collect
(
Collectors
.
toList
());
}
return
Collections
.
emptyList
();
}
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardQueryVO.java
View file @
0ccd65ec
...
...
@@ -51,4 +51,7 @@ public class RewardQueryVO {
@ApiModelProperty
(
value
=
"结束创建时间"
)
private
Date
endCreateTime
;
@ApiModelProperty
(
value
=
"会员id"
)
private
Long
memberId
;
}
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