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
0e312220
Commit
0e312220
authored
Aug 23, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'refs/heads/feature_member_score' into dev
parents
81f17f72
134fb1dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
10 deletions
+65
-10
AppRewardController.java
...ule/reward/controller/app/reward/AppRewardController.java
+4
-3
AppRewardListBackVO.java
.../reward/controller/app/reward/vo/AppRewardListBackVO.java
+28
-0
RewardService.java
...der/yudao/module/reward/service/reward/RewardService.java
+2
-1
RewardServiceImpl.java
...yudao/module/reward/service/reward/RewardServiceImpl.java
+31
-6
No files found.
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/controller/app/reward/AppRewardController.java
View file @
0e312220
...
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.reward.controller.app.reward;
...
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.reward.controller.app.reward;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.module.ecw.api.node.NodeApi
;
import
cn.iocoder.yudao.module.ecw.api.node.NodeApi
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardBackVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardBackVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardListBackVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardListReqVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardListReqVO
;
import
cn.iocoder.yudao.module.reward.service.reward.RewardService
;
import
cn.iocoder.yudao.module.reward.service.reward.RewardService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -36,8 +37,8 @@ public class AppRewardController {
...
@@ -36,8 +37,8 @@ public class AppRewardController {
@PostMapping
(
"/list"
)
@PostMapping
(
"/list"
)
@ApiOperation
(
"会员获得礼品列表"
)
@ApiOperation
(
"会员获得礼品列表"
)
public
CommonResult
<
List
<
AppRewardBackVO
>
>
getListByMemberInfo
(
@RequestBody
AppRewardListReqVO
reqVO
)
{
public
CommonResult
<
AppRewardListBackVO
>
getListByMemberInfo
(
@RequestBody
AppRewardListReqVO
reqVO
)
{
List
<
AppRewardBackVO
>
list
=
rewardService
.
getListByMemberInfo
(
reqVO
);
AppRewardListBackVO
listVO
=
rewardService
.
getListByMemberInfo
(
reqVO
);
return
success
(
list
);
return
success
(
list
VO
);
}
}
}
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/controller/app/reward/vo/AppRewardListBackVO.java
0 → 100644
View file @
0e312220
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
controller
.
app
.
reward
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
/**
* 礼品列表 Response VO
*
* @author 系统管理员
*/
@Data
@ApiModel
(
"客户端 - 礼品列表 Response VO"
)
public
class
AppRewardListBackVO
{
@ApiModelProperty
(
value
=
"国家id,为了区分根据什么条件查得礼品"
)
private
Long
country
;
@ApiModelProperty
(
value
=
"城市id,为了区分根据什么条件查得礼品"
)
private
Long
city
;
@ApiModelProperty
(
value
=
"礼品列表"
)
private
List
<
AppRewardBackVO
>
list
;
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/reward/RewardService.java
View file @
0e312220
...
@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
...
@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import
cn.iocoder.yudao.framework.mybatis.core.service.IService
;
import
cn.iocoder.yudao.framework.mybatis.core.service.IService
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardBackVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardBackVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardListBackVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardListReqVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardListReqVO
;
import
cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO
;
import
cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO
;
import
cn.iocoder.yudao.module.reward.vo.reward.*
;
import
cn.iocoder.yudao.module.reward.vo.reward.*
;
...
@@ -84,7 +85,7 @@ public interface RewardService extends IService<RewardDO> {
...
@@ -84,7 +85,7 @@ public interface RewardService extends IService<RewardDO> {
* @param reqVO
* @param reqVO
* @return
* @return
*/
*/
List
<
AppRewardBackVO
>
getListByMemberInfo
(
AppRewardListReqVO
reqVO
);
AppRewardListBackVO
getListByMemberInfo
(
AppRewardListReqVO
reqVO
);
AppRewardBackVO
getRewardDetailForUser
(
Long
id
);
AppRewardBackVO
getRewardDetailForUser
(
Long
id
);
}
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/reward/RewardServiceImpl.java
View file @
0e312220
...
@@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.ecw.api.node.dto.NodeRespDTO;
...
@@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.ecw.api.node.dto.NodeRespDTO;
import
cn.iocoder.yudao.module.member.api.user.MemberUserApi
;
import
cn.iocoder.yudao.module.member.api.user.MemberUserApi
;
import
cn.iocoder.yudao.module.member.api.user.dto.UserRespDTO
;
import
cn.iocoder.yudao.module.member.api.user.dto.UserRespDTO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardBackVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardBackVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardListBackVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardListReqVO
;
import
cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardListReqVO
;
import
cn.iocoder.yudao.module.reward.convert.reward.RewardConvert
;
import
cn.iocoder.yudao.module.reward.convert.reward.RewardConvert
;
import
cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO
;
import
cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO
;
...
@@ -269,6 +270,8 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
...
@@ -269,6 +270,8 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
reward
.
setCode
(
generateRewardCode
());
reward
.
setCode
(
generateRewardCode
());
//设置为未启用
//设置为未启用
reward
.
setStatus
(
RewardStatusEnum
.
DISABLED
.
getValue
());
reward
.
setStatus
(
RewardStatusEnum
.
DISABLED
.
getValue
());
//已兑换次数清零
reward
.
setExchangeCount
(
0
);
reward
.
setId
(
null
);
reward
.
setId
(
null
);
reward
.
setCreateTime
(
null
);
reward
.
setCreateTime
(
null
);
...
@@ -333,7 +336,8 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
...
@@ -333,7 +336,8 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
}
}
@Override
@Override
public
List
<
AppRewardBackVO
>
getListByMemberInfo
(
AppRewardListReqVO
reqVO
)
{
public
AppRewardListBackVO
getListByMemberInfo
(
AppRewardListReqVO
reqVO
)
{
AppRewardListBackVO
appRewardListBackVO
=
new
AppRewardListBackVO
();
LambdaQuery
<
RewardDO
>
rewardDOLambdaQuery
=
new
LambdaQuery
<>();
LambdaQuery
<
RewardDO
>
rewardDOLambdaQuery
=
new
LambdaQuery
<>();
rewardDOLambdaQuery
.
eq
(
RewardDO:
:
getStatus
,
RewardStatusEnum
.
ENABLED
.
getValue
())
rewardDOLambdaQuery
.
eq
(
RewardDO:
:
getStatus
,
RewardStatusEnum
.
ENABLED
.
getValue
())
.
gt
(
RewardDO:
:
getQuantityRemain
,
0
)
.
gt
(
RewardDO:
:
getQuantityRemain
,
0
)
...
@@ -343,18 +347,36 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
...
@@ -343,18 +347,36 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
if
(
reqVO
.
getNodeId
()
!=
null
)
{
if
(
reqVO
.
getNodeId
()
!=
null
)
{
rewardDOLambdaQuery
.
eq
(
RewardDO:
:
getNodeId
,
reqVO
.
getNodeId
());
rewardDOLambdaQuery
.
eq
(
RewardDO:
:
getNodeId
,
reqVO
.
getNodeId
());
}
else
{
}
else
{
List
<
Long
>
nodes
=
getMemberCityNodes
(
reqVO
.
getMemberId
());
UserRespDTO
user
=
memberUserApi
.
getUser
(
reqVO
.
getMemberId
());
if
(
CollectionUtil
.
isNotEmpty
(
nodes
))
{
List
<
NodeRespDTO
>
nodes
;
rewardDOLambdaQuery
.
in
(
RewardDO:
:
getNodeId
,
nodes
);
// 根据用户城市获取
nodes
=
nodeApi
.
getNodesByCity
(
user
.
getCity
().
longValue
(),
null
);
appRewardListBackVO
.
setCity
(
user
.
getCity
().
longValue
());
appRewardListBackVO
.
setCountry
(
user
.
getCountry
().
longValue
());
if
(
CollectionUtil
.
isEmpty
(
nodes
))
{
// 根据用户国家获取
nodes
=
nodeApi
.
getNodesByCity
(
null
,
user
.
getCountry
().
longValue
());
appRewardListBackVO
.
setCity
(
null
);
}
// 国家和城市都获取不到
if
(
CollectionUtil
.
isEmpty
(
nodes
))
{
nodes
=
nodeApi
.
getNodesByCity
(
null
,
130L
);
appRewardListBackVO
.
setCountry
(
130L
);
}
List
<
Long
>
nodeIds
=
nodes
.
stream
().
map
(
NodeRespDTO:
:
getId
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
nodeIds
))
{
rewardDOLambdaQuery
.
in
(
RewardDO:
:
getNodeId
,
nodeIds
);
}
}
}
}
List
<
RewardDO
>
rewardDOS
=
rewardMapper
.
selectList
(
rewardDOLambdaQuery
);
List
<
RewardDO
>
rewardDOS
=
rewardMapper
.
selectList
(
rewardDOLambdaQuery
);
if
(
rewardDOS
!=
null
&&
!
rewardDOS
.
isEmpty
())
{
if
(
rewardDOS
!=
null
&&
!
rewardDOS
.
isEmpty
())
{
List
<
AppRewardBackVO
>
collect
=
rewardDOS
.
stream
().
map
(
RewardConvert
.
INSTANCE
::
convertAppVO
).
collect
(
Collectors
.
toList
());
List
<
AppRewardBackVO
>
collect
=
rewardDOS
.
stream
().
map
(
RewardConvert
.
INSTANCE
::
convertAppVO
).
collect
(
Collectors
.
toList
());
collect
.
forEach
(
this
::
setPickMethod
);
collect
.
forEach
(
this
::
setPickMethod
);
return
collect
;
appRewardListBackVO
.
setList
(
collect
);
return
appRewardListBackVO
;
}
}
return
Collections
.
emptyList
();
appRewardListBackVO
.
setList
(
Collections
.
emptyList
());
return
appRewardListBackVO
;
}
}
@Override
@Override
...
@@ -420,11 +442,14 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
...
@@ -420,11 +442,14 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
if
(
user
.
getCity
()
==
null
||
user
.
getCountry
()
==
null
)
{
if
(
user
.
getCity
()
==
null
||
user
.
getCountry
()
==
null
)
{
nodes
=
nodeApi
.
getNodesByCity
(
null
,
130L
);
nodes
=
nodeApi
.
getNodesByCity
(
null
,
130L
);
}
else
{
}
else
{
// 根据用户城市获取
nodes
=
nodeApi
.
getNodesByCity
(
user
.
getCity
().
longValue
(),
null
);
nodes
=
nodeApi
.
getNodesByCity
(
user
.
getCity
().
longValue
(),
null
);
if
(
CollectionUtil
.
isEmpty
(
nodes
))
{
if
(
CollectionUtil
.
isEmpty
(
nodes
))
{
// 根据用户国家获取
nodes
=
nodeApi
.
getNodesByCity
(
null
,
user
.
getCountry
().
longValue
());
nodes
=
nodeApi
.
getNodesByCity
(
null
,
user
.
getCountry
().
longValue
());
}
}
}
}
// 国家和城市都获取不到
if
(
CollectionUtil
.
isEmpty
(
nodes
))
{
if
(
CollectionUtil
.
isEmpty
(
nodes
))
{
nodes
=
nodeApi
.
getNodesByCity
(
null
,
130L
);
nodes
=
nodeApi
.
getNodesByCity
(
null
,
130L
);
}
}
...
...
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