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
22858836
Commit
22858836
authored
Jul 29, 2024
by
zhaobiyan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兑换记录更新接口
parent
6c3ca496
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
197 additions
and
26 deletions
+197
-26
RedeemRewardController.java
...eward/controller/admin/redeem/RedeemRewardController.java
+14
-2
RewardRedeemMapper.java
...ao/module/reward/dal/mysql/redeem/RewardRedeemMapper.java
+2
-0
RewardRedeemService.java
...dao/module/reward/service/redeem/RewardRedeemService.java
+5
-1
RewardRedeemServiceImpl.java
...module/reward/service/redeem/RewardRedeemServiceImpl.java
+57
-0
RewardRedeemUpdateVO.java
...r/yudao/module/reward/vo/reward/RewardRedeemUpdateVO.java
+80
-0
RewardRedeemMapper.xml
...ard-impl/src/main/resources/mapper/RewardRedeemMapper.xml
+39
-23
No files found.
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/controller/admin/redeem/RedeemRewardController.java
View file @
22858836
...
...
@@ -6,9 +6,10 @@ import cn.iocoder.yudao.module.reward.api.reward.RedeemRewardApi;
import
cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardReqVO
;
import
cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardRespDTO
;
import
cn.iocoder.yudao.module.reward.service.redeem.RewardRedeemService
;
import
cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemBaseVO
;
import
cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO
;
import
cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO
;
import
c
om.baomidou.mybatisplus.core.metadata.IPage
;
import
c
n.iocoder.yudao.module.reward.vo.reward.RewardRedeemUpdateVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -19,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
...
...
@@ -42,6 +42,18 @@ public class RedeemRewardController {
return
success
(
rewardRedeemService
.
pageInfo
(
reqVO
));
}
@PostMapping
(
"record/detail"
)
@ApiOperation
(
"兑换记录详情"
)
public
CommonResult
<
RewardRedeemPageRespVO
>
detail
(
@Valid
@RequestBody
RewardRedeemBaseVO
request
)
{
return
success
(
rewardRedeemService
.
detail
(
request
.
getId
()));
}
@PostMapping
(
"record/update"
)
@ApiOperation
(
"兑换记录更新"
)
public
CommonResult
<
Boolean
>
update
(
@Valid
@RequestBody
RewardRedeemUpdateVO
request
)
{
return
success
(
rewardRedeemService
.
updateRecord
(
request
));
}
@PostMapping
(
"/single"
)
@ApiOperation
(
"兑换礼品"
)
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/dal/mysql/redeem/RewardRedeemMapper.java
View file @
22858836
...
...
@@ -19,4 +19,6 @@ public interface RewardRedeemMapper extends AbstractMapper<RewardRedeemDO> {
List
<
RewardRedeemPageRespVO
>
pageInfo
(
@Param
(
"start"
)
int
start
,
@Param
(
"size"
)
int
size
,
@Param
(
"req"
)
RewardRedeemPageReqVO
reqVO
);
int
pageCount
(
@Param
(
"req"
)
RewardRedeemPageReqVO
reqVO
);
RewardRedeemPageRespVO
detail
(
@Param
(
"id"
)
Long
id
);
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/redeem/RewardRedeemService.java
View file @
22858836
...
...
@@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import
cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO
;
import
cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO
;
import
cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO
;
import
c
om.baomidou.mybatisplus.core.metadata.IPage
;
import
c
n.iocoder.yudao.module.reward.vo.reward.RewardRedeemUpdateVO
;
/**
* 礼品兑换 Service 接口
...
...
@@ -15,4 +15,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
public
interface
RewardRedeemService
extends
IService
<
RewardRedeemDO
>
{
PageResult
<
RewardRedeemPageRespVO
>
pageInfo
(
RewardRedeemPageReqVO
reqVO
);
RewardRedeemPageRespVO
detail
(
Long
id
);
Boolean
updateRecord
(
RewardRedeemUpdateVO
request
);
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/redeem/RewardRedeemServiceImpl.java
View file @
22858836
...
...
@@ -2,16 +2,26 @@ package cn.iocoder.yudao.module.reward.service.redeem;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.service.AbstractService
;
import
cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils
;
import
cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO
;
import
cn.iocoder.yudao.module.reward.dal.mysql.redeem.RewardRedeemMapper
;
import
cn.iocoder.yudao.module.reward.enums.ErrorCodeConstants
;
import
cn.iocoder.yudao.module.reward.enums.RewardRedeemStatusEnum
;
import
cn.iocoder.yudao.module.reward.service.reward.RewardService
;
import
cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO
;
import
cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO
;
import
cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemUpdateVO
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
/**
* 礼品兑换 Service
*
...
...
@@ -22,6 +32,8 @@ import java.util.List;
public
class
RewardRedeemServiceImpl
extends
AbstractService
<
RewardRedeemMapper
,
RewardRedeemDO
>
implements
RewardRedeemService
{
@Resource
private
RewardRedeemMapper
rewardRedeemMapper
;
@Resource
private
RewardService
rewardService
;
@Override
public
PageResult
<
RewardRedeemPageRespVO
>
pageInfo
(
RewardRedeemPageReqVO
reqVO
)
{
...
...
@@ -31,4 +43,49 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
int
total
=
rewardRedeemMapper
.
pageCount
(
reqVO
);
return
new
PageResult
<>(
result
,
total
,
reqVO
.
getPageSize
(),
reqVO
.
getPageNo
(),
(
total
+
reqVO
.
getPageSize
()
-
1
)
/
reqVO
.
getPageSize
());
}
@Override
public
RewardRedeemPageRespVO
detail
(
Long
id
)
{
if
(
id
==
null
)
{
return
null
;
}
return
rewardRedeemMapper
.
detail
(
id
);
}
@Override
public
Boolean
updateRecord
(
RewardRedeemUpdateVO
request
)
{
validateParam
(
request
);
LambdaUpdateWrapper
<
RewardRedeemDO
>
wrapper
=
Wrappers
.
lambdaUpdate
();
wrapper
.
eq
(
RewardRedeemDO:
:
getId
,
request
.
getId
());
wrapper
.
set
(
RewardRedeemDO:
:
getRedeemType
,
request
.
getRedeemType
());
wrapper
.
set
(
RewardRedeemDO:
:
getExpenses
,
request
.
getExpenses
());
wrapper
.
set
(
RewardRedeemDO:
:
getCurrency
,
request
.
getCurrency
());
wrapper
.
set
(
RewardRedeemDO:
:
getRecipientName
,
request
.
getRecipientName
());
wrapper
.
set
(
RewardRedeemDO:
:
getRecipientAddress
,
request
.
getRecipientAddress
());
wrapper
.
set
(
RewardRedeemDO:
:
getRecipientPhoneNum
,
request
.
getRecipientPhoneNum
());
wrapper
.
set
(
RewardRedeemDO:
:
getRedeemer
,
request
.
getRedeemer
());
wrapper
.
set
(
RewardRedeemDO:
:
getRedemptionTime
,
request
.
getRedemptionTime
());
wrapper
.
set
(
RewardRedeemDO:
:
getCourierCompany
,
request
.
getCourierCompany
());
wrapper
.
set
(
RewardRedeemDO:
:
getExpressNo
,
request
.
getExpressNo
());
wrapper
.
set
(
RewardRedeemDO:
:
getExpressDate
,
request
.
getExpressDate
());
wrapper
.
set
(
RewardRedeemDO:
:
getExpressSender
,
request
.
getExpressSender
());
wrapper
.
set
(
RewardRedeemDO:
:
getAnnex
,
request
.
getAnnex
());
wrapper
.
set
(
RewardRedeemDO:
:
getRemark
,
request
.
getRemark
());
wrapper
.
set
(
RewardRedeemDO:
:
getUpdater
,
SecurityFrameworkUtils
.
getLoginUserId
());
wrapper
.
set
(
RewardRedeemDO:
:
getUpdateTime
,
new
Date
());
rewardRedeemMapper
.
update
(
null
,
wrapper
);
return
true
;
}
private
void
validateParam
(
RewardRedeemUpdateVO
request
)
{
RewardRedeemDO
rewardRedeemDO
=
getById
(
request
.
getId
());
if
(
rewardRedeemDO
==
null
)
{
//todo 提示修改
throw
exception
(
ErrorCodeConstants
.
REWARD_ENDTIME_ERROR
);
}
if
(
rewardRedeemDO
.
getStatus
()
!=
RewardRedeemStatusEnum
.
REDEEMING
.
getValue
())
{
//todo 提示修改
throw
exception
(
ErrorCodeConstants
.
REWARD_ENDTIME_ERROR
);
}
}
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardRedeemUpdateVO.java
0 → 100644
View file @
22858836
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
vo
.
reward
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Data
public
class
RewardRedeemUpdateVO
{
@NotNull
(
message
=
"id is not null"
)
@ApiModelProperty
(
value
=
"id"
)
private
Long
id
;
@NotNull
(
message
=
"redeemType is not null"
)
@ApiModelProperty
(
value
=
"兑换方式"
)
private
Integer
redeemType
;
@ApiModelProperty
(
value
=
"费用"
)
private
BigDecimal
expenses
;
@ApiModelProperty
(
value
=
"币种"
)
private
Integer
currency
;
@NotNull
(
message
=
"recipientName is not null"
)
/**
* 收件人姓名
*/
@ApiModelProperty
(
value
=
"收件人姓名"
)
private
String
recipientName
;
/**
* 收件人电话
*/
@NotNull
(
message
=
"recipientPhoneNum is not null"
)
@ApiModelProperty
(
value
=
"收件人电话"
)
private
String
recipientPhoneNum
;
/**
* 收件人地址
*/
@NotNull
(
message
=
"recipientAddress is not null"
)
@ApiModelProperty
(
value
=
"收件人地址"
)
private
String
recipientAddress
;
/**
* 兑换人
*/
@ApiModelProperty
(
value
=
"兑换人"
)
private
String
redeemer
;
/**
* 兑换时间
*/
@ApiModelProperty
(
value
=
"兑换时间"
)
private
Date
redemptionTime
;
/**
* 快递公司
*/
@ApiModelProperty
(
value
=
"快递公司"
)
private
String
courierCompany
;
/**
* 快递单号
*/
@ApiModelProperty
(
value
=
"快递单号"
)
private
String
expressNo
;
/**
* 快递日期
*/
@ApiModelProperty
(
value
=
"快递日期"
)
private
String
expressDate
;
/**
* 快递寄出人
*/
@ApiModelProperty
(
value
=
"快递寄出人"
)
private
String
expressSender
;
/**
* 上传附件
*/
@ApiModelProperty
(
value
=
"上传附件"
)
private
String
annex
;
/**
* 备注
*/
@ApiModelProperty
(
value
=
"备注"
)
private
String
remark
;
}
yudao-module-reward/yudao-module-reward-impl/src/main/resources/mapper/RewardRedeemMapper.xml
View file @
22858836
...
...
@@ -11,6 +11,44 @@
<select
id=
"pageInfo"
resultType=
"cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO"
>
select
<include
refid=
"columns"
/>
from ecw_reward_redeem err
left join ecw_reward er on err.reward_id = er.id
left join member_user mu on mu.id = err.member_id
left join ecw_node en on er.node_id = en.id
left join system_user suc on suc.id = er.creator
left join system_user suu on suu.id = er.updater
left join ecw_currency cc on err.currency = cc.id
where 1=1
<include
refid=
"pageCondition"
/>
order by er.create_time desc
limit #{start}, #{size}
</select>
<select
id=
"pageCount"
resultType=
"java.lang.Integer"
>
select count(*)
from ecw_reward_redeem err
left join ecw_reward er on err.reward_id = er.id
left join member_user mu on mu.id = err.member_id
left join ecw_node en on er.node_id = en.id
left join system_user suc on suc.id = er.creator
left join system_user suu on suu.id = er.updater
where 1=1
<include
refid=
"pageCondition"
/>
</select>
<select
id=
"detail"
resultType=
"cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO"
>
select
<include
refid=
"columns"
/>
from ecw_reward_redeem err
left join ecw_reward er on err.reward_id = er.id
left join member_user mu on mu.id = err.member_id
left join ecw_node en on er.node_id = en.id
left join system_user suc on suc.id = er.creator
left join system_user suu on suu.id = er.updater
left join ecw_currency cc on err.currency = cc.id
where err.id = #{id}
</select>
<sql
id=
"columns"
>
err.id ,
err.member_id as memberId,
err.reward_id as rewardId,
...
...
@@ -49,29 +87,7 @@
cc.title_zh as currencyTitleZh,
cc.title_en as currencyTitleEn,
(select username from system_user where id = er.updater) as updaterName
from ecw_reward_redeem err
left join ecw_reward er on err.reward_id = er.id
left join member_user mu on mu.id = err.member_id
left join ecw_node en on er.node_id = en.id
left join system_user suc on suc.id = er.creator
left join system_user suu on suu.id = er.updater
left join ecw_currency cc on err.currency = cc.id
where 1=1
<include
refid=
"pageCondition"
/>
order by er.create_time desc
limit #{start}, #{size}
</select>
<select
id=
"pageCount"
resultType=
"java.lang.Integer"
>
select count(*)
from ecw_reward_redeem err
left join ecw_reward er on err.reward_id = er.id
left join member_user mu on mu.id = err.member_id
left join ecw_node en on er.node_id = en.id
left join system_user suc on suc.id = er.creator
left join system_user suu on suu.id = er.updater
where 1=1
<include
refid=
"pageCondition"
/>
</select>
</sql>
<sql
id=
"pageCondition"
>
<if
test=
"req.rewardTitle != null and req.rewardTitle !=''"
>
...
...
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