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
b7d23338
Commit
b7d23338
authored
Jul 30, 2024
by
zhaobiyan
Browse files
Options
Browse Files
Download
Plain Diff
会员积分查询新增编码筛选
parents
58b8a937
7f1f5617
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
418 additions
and
51 deletions
+418
-51
RewardRedeemRecordExportEvent.java
...ollo/core/event/export/RewardRedeemRecordExportEvent.java
+46
-0
pom.xml
yudao-module-member/yudao-module-member-impl/pom.xml
+1
-1
ScoreRuleController.java
...ember/controller/admin/scoreRule/ScoreRuleController.java
+3
-3
ScoreRuleConvert.java
...dao/module/member/convert/scoreRule/ScoreRuleConvert.java
+3
-2
ScoreRuleService.java
...dao/module/member/service/scoreRule/ScoreRuleService.java
+1
-1
ScoreRuleServiceImpl.java
...module/member/service/scoreRule/ScoreRuleServiceImpl.java
+16
-16
ScoreRuleBackDetailVO.java
...dao/module/member/vo/scoreRule/ScoreRuleBackDetailVO.java
+28
-0
ScoreRuleBackVO.java
...der/yudao/module/member/vo/scoreRule/ScoreRuleBackVO.java
+20
-20
ScoreRuleBaseVO.java
...der/yudao/module/member/vo/scoreRule/ScoreRuleBaseVO.java
+1
-1
MemberUserScoreMapper.xml
.../src/main/resources/mapper/user/MemberUserScoreMapper.xml
+1
-1
pom.xml
yudao-module-reward/yudao-module-reward-impl/pom.xml
+17
-1
RedeemRewardController.java
...eward/controller/admin/redeem/RedeemRewardController.java
+6
-0
RewardRedeemMapper.java
...ao/module/reward/dal/mysql/redeem/RewardRedeemMapper.java
+2
-0
RewardRedeemRecordExportListener.java
...ule/reward/listener/RewardRedeemRecordExportListener.java
+118
-0
RewardRedeemService.java
...dao/module/reward/service/redeem/RewardRedeemService.java
+6
-0
RewardRedeemServiceImpl.java
...module/reward/service/redeem/RewardRedeemServiceImpl.java
+31
-0
RewardRedeemBaseVO.java
...der/yudao/module/reward/vo/reward/RewardRedeemBaseVO.java
+3
-3
RewardRedeemPageRespVO.java
...yudao/module/reward/vo/reward/RewardRedeemPageRespVO.java
+5
-2
RewardRedeemRecordExportVO.java
...o/module/reward/vo/reward/RewardRedeemRecordExportVO.java
+69
-0
RewardRedeemMapper.xml
...ard-impl/src/main/resources/mapper/RewardRedeemMapper.xml
+19
-0
DownloadTypeEnum.java
.../yudao/module/system/enums/download/DownloadTypeEnum.java
+5
-0
DownloadLogServiceImpl.java
...le/system/service/downloadLog/DownloadLogServiceImpl.java
+17
-0
No files found.
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/core/event/export/RewardRedeemRecordExportEvent.java
0 → 100644
View file @
b7d23338
package
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
event
.
export
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
RewardRedeemRecordExportEvent
{
/**
* 操作用户
*/
private
Long
userId
=
0L
;
/**
* 端口
*/
private
Integer
userType
=
2
;
/**
* 请求参数
*/
private
String
requestParams
;
/**
* 国际化语言值,默认0中文, 具体取值I18nMessage.getLang()
*/
private
Integer
lang
=
0
;
/**
* 文件名称
*/
private
String
fileName
;
/**
* 文件路径
*/
private
String
path
;
/**
* 下载地址
*/
private
String
url
;
/**
* 执行结果
*/
private
String
result
;
@ApiModelProperty
(
value
=
"文件ID"
)
private
Long
fileId
;
}
yudao-module-member/yudao-module-member-impl/pom.xml
View file @
b7d23338
...
...
@@ -41,7 +41,7 @@
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-system-impl
</artifactId>
<version>
1.6.1-snapshot
</version>
<version>
${revision}
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/admin/scoreRule/ScoreRuleController.java
View file @
b7d23338
...
...
@@ -65,9 +65,9 @@ public class ScoreRuleController {
@ApiOperation
(
"获得积分规则详情"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"编号"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Long
.
class
)
@PreAuthorize
(
"@ss.hasPermission('member:score-rule:query')"
)
public
CommonResult
<
ScoreRuleBackVO
>
getScoreRule
(
@NotNull
@RequestBody
Long
id
)
{
ScoreRuleBack
VO
scoreRuleBack
VO
=
scoreRuleService
.
getScoreRule
(
id
);
return
success
(
scoreRuleBackVO
);
public
CommonResult
<
ScoreRuleBack
Detail
VO
>
getScoreRule
(
@NotNull
@RequestBody
Long
id
)
{
ScoreRuleBack
DetailVO
scoreRuleBackDetail
VO
=
scoreRuleService
.
getScoreRule
(
id
);
return
success
(
scoreRuleBack
Detail
VO
);
}
@PostMapping
(
"/list"
)
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/convert/scoreRule/ScoreRuleConvert.java
View file @
b7d23338
package
cn
.
iocoder
.
yudao
.
module
.
member
.
convert
.
scoreRule
;
import
java.util.*
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleBackVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleCreateReqVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleUpdateReqVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO
;
import
java.util.List
;
/**
* 积分规则 DO Convert
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreRule/ScoreRuleService.java
View file @
b7d23338
...
...
@@ -41,7 +41,7 @@ public interface ScoreRuleService extends IService<ScoreRuleDO> {
* @param id 编号
* @return 积分规则
*/
ScoreRuleBackVO
getScoreRule
(
Long
id
);
ScoreRuleBack
Detail
VO
getScoreRule
(
Long
id
);
/**
* 获得积分规则列表
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/scoreRule/ScoreRuleServiceImpl.java
View file @
b7d23338
...
...
@@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
...
...
@@ -99,14 +100,15 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
}
@Override
public
ScoreRuleBackVO
getScoreRule
(
Long
id
)
{
public
ScoreRuleBack
Detail
VO
getScoreRule
(
Long
id
)
{
ScoreRuleDO
scoreRuleDO
=
scoreRuleMapper
.
selectById
(
id
);
if
(
scoreRuleDO
==
null
)
{
throw
exception
(
SCORE_RULE_NOT_EXISTS
);
}
ScoreRuleBackVO
scoreRuleBackVO
=
ScoreRuleConvert
.
INSTANCE
.
convert
(
scoreRuleDO
);
setExtraVO
(
scoreRuleBackVO
);
return
scoreRuleBackVO
;
ScoreRuleBackDetailVO
scoreRuleBackDetailVO
=
new
ScoreRuleBackDetailVO
();
BeanUtils
.
copyProperties
(
scoreRuleDO
,
scoreRuleBackDetailVO
);
setExtraVO
(
scoreRuleBackDetailVO
);
return
scoreRuleBackDetailVO
;
}
...
...
@@ -114,7 +116,6 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
public
List
<
ScoreRuleBackVO
>
getScoreRuleList
(
Collection
<
Long
>
ids
)
{
List
<
ScoreRuleDO
>
scoreRuleDOS
=
scoreRuleMapper
.
selectBatchIds
(
ids
);
List
<
ScoreRuleBackVO
>
scoreRuleBackVOS
=
ScoreRuleConvert
.
INSTANCE
.
convertList
(
scoreRuleDOS
);
scoreRuleBackVOS
.
forEach
(
this
::
setExtraVO
);
return
scoreRuleBackVOS
;
}
...
...
@@ -122,24 +123,23 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
public
PageResult
<
ScoreRuleBackVO
>
getScoreRulePage
(
ScoreRuleQueryVO
query
,
PageVO
page
)
{
PageResult
<
ScoreRuleDO
>
pageResult
=
scoreRuleMapper
.
selectPage
(
page
,
query
);
PageResult
<
ScoreRuleBackVO
>
scoreRuleBackVOPageResult
=
ScoreRuleConvert
.
INSTANCE
.
convertPage
(
pageResult
);
scoreRuleBackVOPageResult
.
getList
().
forEach
(
this
::
setExtraVO
);
return
scoreRuleBackVOPageResult
;
}
/**
* 设置返回VO额外信息
*
* @param scoreRuleBackVO VO
* @param scoreRuleBack
Detail
VO VO
*/
private
void
setExtraVO
(
ScoreRuleBack
VO
scoreRuleBack
VO
)
{
if
(
scoreRuleBackVO
.
getType
()
==
ScoreRuleTypeEnum
.
ORDER_V
.
getValue
())
{
scoreRuleBack
VO
.
setExtraOrderV
(
JSONUtil
.
toBean
(
scoreRuleBack
VO
.
getExtra
(),
ScoreRuleOrderVExtraVO
.
class
));
}
else
if
(
scoreRuleBackVO
.
getType
()
==
ScoreRuleTypeEnum
.
REGISTER
.
getValue
())
{
scoreRuleBack
VO
.
setExtraRegister
(
JSONUtil
.
toBean
(
scoreRuleBack
VO
.
getExtra
(),
ScoreRuleRegisterExtraVO
.
class
));
}
else
if
(
scoreRuleBackVO
.
getType
()
==
ScoreRuleTypeEnum
.
RECOMMEND
.
getValue
())
{
scoreRuleBack
VO
.
setExtraRecommend
(
JSONUtil
.
toBean
(
scoreRuleBack
VO
.
getExtra
(),
ScoreRulerRecommendExtraVO
.
class
));
}
else
if
(
scoreRuleBackVO
.
getType
()
==
ScoreRuleTypeEnum
.
SHARE
.
getValue
())
{
scoreRuleBack
VO
.
setExtraShare
(
JSONUtil
.
toBean
(
scoreRuleBack
VO
.
getExtra
(),
ScoreRuleShareExtraVO
.
class
));
private
void
setExtraVO
(
ScoreRuleBack
DetailVO
scoreRuleBackDetail
VO
)
{
if
(
scoreRuleBack
Detail
VO
.
getType
()
==
ScoreRuleTypeEnum
.
ORDER_V
.
getValue
())
{
scoreRuleBack
DetailVO
.
setExtraOrderV
(
JSONUtil
.
toBean
(
scoreRuleBackDetail
VO
.
getExtra
(),
ScoreRuleOrderVExtraVO
.
class
));
}
else
if
(
scoreRuleBack
Detail
VO
.
getType
()
==
ScoreRuleTypeEnum
.
REGISTER
.
getValue
())
{
scoreRuleBack
DetailVO
.
setExtraRegister
(
JSONUtil
.
toBean
(
scoreRuleBackDetail
VO
.
getExtra
(),
ScoreRuleRegisterExtraVO
.
class
));
}
else
if
(
scoreRuleBack
Detail
VO
.
getType
()
==
ScoreRuleTypeEnum
.
RECOMMEND
.
getValue
())
{
scoreRuleBack
DetailVO
.
setExtraRecommend
(
JSONUtil
.
toBean
(
scoreRuleBackDetail
VO
.
getExtra
(),
ScoreRulerRecommendExtraVO
.
class
));
}
else
if
(
scoreRuleBack
Detail
VO
.
getType
()
==
ScoreRuleTypeEnum
.
SHARE
.
getValue
())
{
scoreRuleBack
DetailVO
.
setExtraShare
(
JSONUtil
.
toBean
(
scoreRuleBackDetail
VO
.
getExtra
(),
ScoreRuleShareExtraVO
.
class
));
}
else
{
throw
exception
(
SCORE_RULE_NOT_EXISTS
);
}
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/vo/scoreRule/ScoreRuleBackDetailVO.java
0 → 100644
View file @
b7d23338
package
cn
.
iocoder
.
yudao
.
module
.
member
.
vo
.
scoreRule
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
@Data
@ToString
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
"管理后台 - 积分规则详细信息 Response VO"
)
public
class
ScoreRuleBackDetailVO
extends
ScoreRuleBackVO
{
@ApiModelProperty
(
value
=
"扩展字段原始"
)
private
String
extra
;
@ApiModelProperty
(
value
=
"订单V值扩展字段"
)
private
ScoreRuleOrderVExtraVO
extraOrderV
;
@ApiModelProperty
(
value
=
"注册扩展字段"
)
private
ScoreRuleRegisterExtraVO
extraRegister
;
@ApiModelProperty
(
value
=
"推荐扩展字段"
)
private
ScoreRulerRecommendExtraVO
extraRecommend
;
@ApiModelProperty
(
value
=
"分享扩展字段"
)
private
ScoreRuleShareExtraVO
extraShare
;
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/vo/scoreRule/ScoreRuleBackVO.java
View file @
b7d23338
package
cn
.
iocoder
.
yudao
.
module
.
member
.
vo
.
scoreRule
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.annotations.*
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
/**
...
...
@@ -17,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
* @author 系统管理员
*/
@Data
@ApiModel
(
"管理后台 - 积分规则 Response VO"
)
@ApiModel
(
"管理后台 - 积分规则
基本信息
Response VO"
)
public
class
ScoreRuleBackVO
{
@ExcelProperty
(
"主键"
)
...
...
@@ -72,7 +70,7 @@ public class ScoreRuleBackVO {
@ExcelProperty
(
"积分有效期"
)
@ApiModelProperty
(
value
=
"积分有效期"
,
required
=
true
)
private
Integer
s
oc
rePeriod
;
private
Integer
s
co
rePeriod
;
@ExcelProperty
(
"排序值"
)
@ApiModelProperty
(
value
=
"排序值"
,
required
=
true
)
...
...
@@ -95,15 +93,17 @@ public class ScoreRuleBackVO {
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"扩展字段原始"
)
private
String
extra
;
@ApiModelProperty
(
value
=
"订单V值扩展字段"
)
private
ScoreRuleOrderVExtraVO
extraOrderV
;
@ApiModelProperty
(
value
=
"注册扩展字段"
)
private
ScoreRuleRegisterExtraVO
extraRegister
;
@ApiModelProperty
(
value
=
"推荐扩展字段"
)
private
ScoreRulerRecommendExtraVO
extraRecommend
;
@ApiModelProperty
(
value
=
"分享扩展字段"
)
private
ScoreRuleShareExtraVO
extraShare
;
@ExcelProperty
(
"更新时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"更新时间"
,
required
=
true
)
private
Date
updateTime
;
@ExcelProperty
(
"创建人"
)
@ApiModelProperty
(
value
=
"创建人"
,
required
=
true
)
private
String
creator
;
@ExcelProperty
(
"更新人"
)
@ApiModelProperty
(
value
=
"更新人"
,
required
=
true
)
private
String
updater
;
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/vo/scoreRule/ScoreRuleBaseVO.java
View file @
b7d23338
...
...
@@ -70,7 +70,7 @@ public class ScoreRuleBaseVO {
@NotNull
(
message
=
"排序值不能为空"
)
private
Integer
orderNum
;
@ApiModelProperty
(
value
=
"是否推送(0是,1否)"
,
required
=
true
)
@ApiModelProperty
(
value
=
"是否推送(0是,1否)
默认是
"
,
required
=
true
)
@NotNull
(
message
=
"是否推送不能为空"
)
private
Integer
pushActivity
=
0
;
...
...
yudao-module-member/yudao-module-member-impl/src/main/resources/mapper/user/MemberUserScoreMapper.xml
View file @
b7d23338
...
...
@@ -42,7 +42,7 @@
<sql
id=
"scoreCondition"
>
<if
test=
"query.key != null and query.key != ''"
>
and (mu.nickname like '%${query.key}%' or mu.mobile like '%${query.key}%')
and (mu.nickname like '%${query.key}%' or mu.mobile like '%${query.key}%'
or mu.code like '%${query.key}%'
)
</if>
<if
test=
"query.country != null"
>
and mu.country = #{query.country}
...
...
yudao-module-reward/yudao-module-reward-impl/pom.xml
View file @
b7d23338
...
...
@@ -39,12 +39,28 @@
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-system-api
</artifactId>
<version>
1.6.1-snapshot
</version>
<version>
${revision}
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-ecw-api
</artifactId>
<version>
${revision}
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-spring-boot-starter-config
</artifactId>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-system-impl
</artifactId>
<version>
1.6.1-snapshot
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-infra-impl
</artifactId>
<version>
1.6.1-snapshot
</version>
<scope>
compile
</scope>
</dependency>
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/controller/admin/redeem/RedeemRewardController.java
View file @
b7d23338
...
...
@@ -72,6 +72,12 @@ public class RedeemRewardController {
return
success
(
rewardRedeemService
.
verifyBack
(
redeemIds
));
}
@PostMapping
(
"record/export"
)
@ApiOperation
(
"导出"
)
public
CommonResult
<
Boolean
>
export
(
@Valid
@RequestBody
RewardRedeemPageReqVO
reqVO
)
{
return
success
(
rewardRedeemService
.
export
(
reqVO
));
}
@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 @
b7d23338
...
...
@@ -21,4 +21,6 @@ public interface RewardRedeemMapper extends AbstractMapper<RewardRedeemDO> {
int
pageCount
(
@Param
(
"req"
)
RewardRedeemPageReqVO
reqVO
);
RewardRedeemPageRespVO
detail
(
@Param
(
"id"
)
Long
id
);
List
<
RewardRedeemPageRespVO
>
exportList
(
@Param
(
"req"
)
RewardRedeemPageReqVO
request
);
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/listener/RewardRedeemRecordExportListener.java
0 → 100644
View file @
b7d23338
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
listener
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.RewardRedeemRecordExportEvent
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.excel.util.ExcelUtils
;
import
cn.iocoder.yudao.module.infra.api.file.FileApi
;
import
cn.iocoder.yudao.module.infra.api.file.dto.FileRespDto
;
import
cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO
;
import
cn.iocoder.yudao.module.reward.service.redeem.RewardRedeemService
;
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.RewardRedeemRecordExportVO
;
import
cn.iocoder.yudao.module.system.framework.ue.UeProperties
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
excel
.
constant
.
ExportConstant
.
DATA_FORMAT
;
@Component
@AllArgsConstructor
@Slf4j
public
class
RewardRedeemRecordExportListener
{
private
RewardRedeemService
rewardRedeemService
;
private
UeProperties
ueProperties
;
private
FileApi
fileService
;
@EventListener
(
RewardRedeemRecordExportEvent
.
class
)
public
void
listen
(
RewardRedeemRecordExportEvent
event
)
{
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
String
nowTime
=
formatter
.
format
(
LocalDateTime
.
now
());
String
dir
=
ueProperties
.
getTempDir
().
concat
(
"/rewardRedeemRecord/excel/"
);
File
fileDir
=
new
File
(
dir
);
if
(!
fileDir
.
exists
()){
// 不存在则创建一个目录
fileDir
.
mkdirs
();
}
String
fileName
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"shipment_preload.xlsx"
);
RewardRedeemPageReqVO
request
=
JSONObject
.
parseObject
(
event
.
getRequestParams
(),
RewardRedeemPageReqVO
.
class
);
Integer
totalCount
=
rewardRedeemService
.
exportCount
(
request
);
int
size
=
500
;
int
totalPage
=
totalCount
%
size
==
0
?
totalCount
/
size:
totalCount
/
size
+
1
;
List
<
RewardRedeemRecordExportVO
>
result
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<=
totalPage
;
i
++)
{
request
.
setPageNo
(
i
);
request
.
setPageSize
(
size
);
PageResult
<
RewardRedeemPageRespVO
>
rewardRedeemPageRespVOPageResult
=
rewardRedeemService
.
pageInfo
(
request
);
result
.
addAll
(
convert2ExcelVo
(
rewardRedeemPageRespVOPageResult
.
getList
()));
}
try
{
String
path
=
ExcelUtils
.
write
(
dir
,
fileName
,
"数据"
,
RewardRedeemRecordExportVO
.
class
,
result
);
// 获取到临时文件
File
file
=
new
File
(
path
);
// 创建FileInputStream对象
FileInputStream
fileInputStream
=
new
FileInputStream
(
file
);
// 读取文件内容
byte
[]
fileBytes
=
new
byte
[(
int
)
file
.
length
()];
fileInputStream
.
read
(
fileBytes
);
// 关闭文件流
fileInputStream
.
close
();
// 将文件上传到资源服务器
FileRespDto
fileRespDto
=
fileService
.
createFile
(
dir
,
fileName
,
fileBytes
);
event
.
setPath
(
fileRespDto
.
getPath
());
event
.
setFileName
(
fileRespDto
.
getFileName
());
event
.
setUrl
(
fileRespDto
.
getUrl
());
event
.
setFileId
(
fileRespDto
.
getId
());
}
catch
(
Exception
e
)
{
log
.
info
(
"reward redeem record export listener exception"
,
e
);
event
.
setResult
(
e
.
getMessage
());
}
}
private
Collection
<
RewardRedeemRecordExportVO
>
convert2ExcelVo
(
List
<
RewardRedeemPageRespVO
>
list
)
{
return
list
.
stream
().
map
(
item
->
{
RewardRedeemRecordExportVO
exportVO
=
new
RewardRedeemRecordExportVO
();
exportVO
.
setId
(
String
.
valueOf
(
item
.
getId
()));
exportVO
.
setStatus
(
item
.
getStatus
());
exportVO
.
setRewardCode
(
item
.
getRewardCode
());
exportVO
.
setRewardTitle
(
item
.
getRewardTitleZh
());
exportVO
.
setMemberName
(
item
.
getMemberName
());
exportVO
.
setRewardCount
(
item
.
getRewardCount
());
exportVO
.
setRedeemType
(
item
.
getRedeemType
());
exportVO
.
setEntrance
(
item
.
getEntrance
());
exportVO
.
setExpenses
(
item
.
getExpenses
());
exportVO
.
setCurrencyTitle
(
item
.
getCurrencyTitleZh
());
exportVO
.
setRecipientName
(
item
.
getRecipientName
());
exportVO
.
setRecipientPhoneNum
(
item
.
getRecipientPhoneNum
());
exportVO
.
setRecipientAddress
(
item
.
getRecipientAddress
());
exportVO
.
setRedeemer
(
item
.
getRedeemer
());
exportVO
.
setRedemptionTime
(
item
.
getCreateTime
());
exportVO
.
setCourierCompanyName
(
item
.
getCourierCompanyName
());
exportVO
.
setExpressNo
(
item
.
getExpressNo
());
exportVO
.
setExpressDate
(
item
.
getExpressDate
());
exportVO
.
setExpressSender
(
item
.
getExpressSender
());
exportVO
.
setRemark
(
item
.
getRemark
());
exportVO
.
setVerifyUser
(
item
.
getVerifyUser
());
exportVO
.
setVerifyTime
(
item
.
getVerifyTime
());
exportVO
.
setCreatorName
(
item
.
getCreatorName
());
exportVO
.
setCreateTime
(
item
.
getCreateTime
());
exportVO
.
setUpdaterName
(
item
.
getUpdaterName
());
exportVO
.
setUpdateTime
(
item
.
getUpdateTime
());
return
exportVO
;
}).
collect
(
Collectors
.
toList
());
}
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/redeem/RewardRedeemService.java
View file @
b7d23338
...
...
@@ -25,4 +25,10 @@ public interface RewardRedeemService extends IService<RewardRedeemDO> {
Boolean
batchVerify
(
RewardRedeemBatchVerifyReqVO
request
);
Boolean
verifyBack
(
List
<
Long
>
redeemIds
);
Boolean
export
(
RewardRedeemPageReqVO
reqVO
);
List
<
RewardRedeemPageRespVO
>
exportList
(
RewardRedeemPageReqVO
request
);
Integer
exportCount
(
RewardRedeemPageReqVO
request
);
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/service/redeem/RewardRedeemServiceImpl.java
View file @
b7d23338
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
service
.
redeem
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.i18n.core.I18nMessage
;
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
;
...
...
@@ -11,6 +12,9 @@ import cn.iocoder.yudao.module.reward.enums.RewardPickMethedEnum;
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.*
;
import
cn.iocoder.yudao.module.system.api.file.FileMakeApi
;
import
cn.iocoder.yudao.module.system.api.file.dto.FileMakeReqDTO
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
...
...
@@ -19,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -26,6 +31,7 @@ import java.util.function.Function;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
system
.
enums
.
download
.
DownloadTypeEnum
.
REWARD_REDEEM_RECORD
;
/**
* 礼品兑换 Service
...
...
@@ -39,6 +45,8 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
private
RewardRedeemMapper
rewardRedeemMapper
;
@Resource
private
RewardService
rewardService
;
@Resource
private
FileMakeApi
fileMakeApi
;
@Override
public
PageResult
<
RewardRedeemPageRespVO
>
pageInfo
(
RewardRedeemPageReqVO
reqVO
)
{
...
...
@@ -152,6 +160,29 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
return
true
;
}
@Override
public
Boolean
export
(
RewardRedeemPageReqVO
reqVO
)
{
FileMakeReqDTO
fileMakeReqDTO
=
new
FileMakeReqDTO
();
fileMakeReqDTO
.
setType
(
REWARD_REDEEM_RECORD
.
getType
());
fileMakeReqDTO
.
setName
(
"礼品兑换记录导出excel"
);
fileMakeReqDTO
.
setFileSuffix
(
"xlsx"
);
fileMakeReqDTO
.
setTemporaryFile
(
true
);
fileMakeReqDTO
.
setUserType
(
2
);
fileMakeReqDTO
.
setLang
(
I18nMessage
.
getLang
());
fileMakeReqDTO
.
setRequestParams
(
JSONObject
.
toJSONString
(
reqVO
));
fileMakeApi
.
sendFileMake
(
fileMakeReqDTO
);
return
true
;
}
@Override
public
List
<
RewardRedeemPageRespVO
>
exportList
(
RewardRedeemPageReqVO
request
)
{
return
rewardRedeemMapper
.
exportList
(
request
);
}
@Override
public
Integer
exportCount
(
RewardRedeemPageReqVO
request
)
{
return
rewardRedeemMapper
.
pageCount
(
request
);
}
private
List
<
Long
>
checkBatchVerifyParam
(
RewardRedeemBatchVerifyReqVO
request
)
{
LambdaUpdateWrapper
<
RewardRedeemDO
>
wrapper
=
Wrappers
.
lambdaUpdate
();
wrapper
.
in
(
RewardRedeemDO:
:
getId
,
request
.
getIds
());
...
...
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardRedeemBaseVO.java
View file @
b7d23338
...
...
@@ -88,7 +88,7 @@ public class RewardRedeemBaseVO {
* 快递日期
*/
@ApiModelProperty
(
value
=
"快递日期"
)
private
String
expressDate
;
private
Date
expressDate
;
/**
* 快递寄出人
*/
...
...
@@ -111,7 +111,7 @@ public class RewardRedeemBaseVO {
@ApiModelProperty
(
value
=
"更新人id"
)
private
String
updater
;
@ApiModelProperty
(
value
=
"更新时间"
)
private
String
updateTime
;
private
Date
updateTime
;
@ApiModelProperty
(
value
=
"是否删除"
)
private
Boolean
deleted
;
/**
...
...
@@ -123,5 +123,5 @@ public class RewardRedeemBaseVO {
* 核销时间
*/
@ApiModelProperty
(
value
=
"核销时间"
)
private
String
verifyTime
;
private
Date
verifyTime
;
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardRedeemPageRespVO.java
View file @
b7d23338
...
...
@@ -23,12 +23,15 @@ public class RewardRedeemPageRespVO extends RewardRedeemBaseVO {
private
String
nodeTitleEn
;
@ApiModelProperty
(
value
=
"兑换积分"
)
private
Integer
totalCount
;
@ApiModelProperty
(
value
=
"创建人
时间
"
)
@ApiModelProperty
(
value
=
"创建人"
)
private
String
creatorName
;
@ApiModelProperty
(
value
=
"更新人
时间
"
)
@ApiModelProperty
(
value
=
"更新人"
)
private
String
updaterName
;
@ApiModelProperty
(
value
=
"币种名称中文"
)
private
String
currencyTitleZh
;
@ApiModelProperty
(
value
=
"币种名称英文"
)
private
String
currencyTitleEn
;
@ApiModelProperty
(
value
=
"快递公司名称"
)
private
String
courierCompanyName
;
}
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardRedeemRecordExportVO.java
0 → 100644
View file @
b7d23338
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
vo
.
reward
;
import
cn.iocoder.yudao.framework.excel.annotations.DictFormat
;
import
cn.iocoder.yudao.framework.excel.convert.DictConvert
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.converters.bigdecimal.BigDecimalStringConverter
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Data
public
class
RewardRedeemRecordExportVO
{
@ExcelProperty
(
"兑换记录ID"
)
private
String
id
;
@ExcelProperty
(
value
=
"兑换状态"
,
converter
=
DictConvert
.
class
)
@DictFormat
(
"reward_redeem_status"
)
private
Integer
status
;
@ExcelProperty
(
"礼品ID"
)
private
String
rewardCode
;
@ExcelProperty
(
"礼品名称"
)
private
String
rewardTitle
;
@ExcelProperty
(
"会员名称"
)
private
String
memberName
;
@ExcelProperty
(
"兑换数量"
)
private
Integer
rewardCount
;
@ExcelProperty
(
value
=
"兑换方式"
,
converter
=
DictConvert
.
class
)
@DictFormat
(
"way_of_receiving"
)
private
Integer
redeemType
;
@ExcelProperty
(
value
=
"兑换入口"
,
converter
=
DictConvert
.
class
)
@DictFormat
(
"platform_type"
)
private
Integer
entrance
;
@ExcelProperty
(
value
=
"费用"
,
converter
=
BigDecimalStringConverter
.
class
)
private
BigDecimal
expenses
;
@ExcelProperty
(
"币种名称"
)
private
String
currencyTitle
;
@ExcelProperty
(
value
=
"收件人姓名"
)
private
String
recipientName
;
@ExcelProperty
(
value
=
"收件人电话"
)
private
String
recipientPhoneNum
;
@ExcelProperty
(
value
=
"收件人地址"
)
private
String
recipientAddress
;
@ExcelProperty
(
value
=
"兑换人"
)
private
String
redeemer
;
@ExcelProperty
(
value
=
"兑换时间"
)
private
Date
redemptionTime
;
@ExcelProperty
(
value
=
"快递公司名称"
)
private
String
courierCompanyName
;
@ExcelProperty
(
value
=
"快递单号"
)
private
String
expressNo
;
@ExcelProperty
(
value
=
"快递日期"
)
private
Date
expressDate
;
@ExcelProperty
(
value
=
"快递寄出人"
)
private
String
expressSender
;
@ExcelProperty
(
value
=
"备注"
)
private
String
remark
;
@ExcelProperty
(
value
=
"核销人"
)
private
String
verifyUser
;
@ExcelProperty
(
value
=
"核销时间"
)
private
Date
verifyTime
;
@ExcelProperty
(
value
=
"创建人"
)
private
String
creatorName
;
@ExcelProperty
(
value
=
"创建时间"
)
private
Date
createTime
;
@ExcelProperty
(
value
=
"更新人"
)
private
String
updaterName
;
@ExcelProperty
(
value
=
"更新时间"
)
private
Date
updateTime
;
}
yudao-module-reward/yudao-module-reward-impl/src/main/resources/mapper/RewardRedeemMapper.xml
View file @
b7d23338
...
...
@@ -19,6 +19,7 @@
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
left join ecw_express ee on err.courier_company = ee.id
where 1=1
<include
refid=
"pageCondition"
/>
order by er.create_time desc
...
...
@@ -32,6 +33,7 @@
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_express ee on err.courier_company = ee.id
where 1=1
<include
refid=
"pageCondition"
/>
</select>
...
...
@@ -45,8 +47,24 @@
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
left join ecw_express ee on err.courier_company = ee.id
where err.id = #{id}
</select>
<select
id=
"exportList"
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
left join ecw_express ee on err.courier_company = ee.id
where 1=1
<include
refid=
"pageCondition"
/>
order by er.create_time desc
</select>
<sql
id=
"columns"
>
err.id ,
...
...
@@ -64,6 +82,7 @@
err.redeemer,
err.redemption_time as redemptionTime,
err.courier_company as courierCompany,
ee.company_name as courierCompanyName,
err.express_no as expressNo,
err.express_date as expressDate,
err.express_sender as expressSender,
...
...
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/download/DownloadTypeEnum.java
View file @
b7d23338
...
...
@@ -174,6 +174,11 @@ public enum DownloadTypeEnum implements IntArrayValuable {
*/
REPORT_SALES_ANALYSIS
(
32
),
/**
* 礼品兑换记录
*/
REWARD_REDEEM_RECORD
(
33
),
// ....自己补充
;
...
...
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/downloadLog/DownloadLogServiceImpl.java
View file @
b7d23338
...
...
@@ -362,6 +362,9 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
//销售分析报表
REPORT_SALES_ANALYSIS_Event
(
downloadLog
);
break
;
case
REWARD_REDEEM_RECORD:
rewardRedeemRecordExportPushEvent
(
downloadLog
);
break
;
default
:
downloadLog
.
setResult
(
"unknown type"
);
break
;
...
...
@@ -388,6 +391,20 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
}
}
private
void
rewardRedeemRecordExportPushEvent
(
DownloadLogDO
downloadLog
)
{
RewardRedeemRecordExportEvent
event
=
new
RewardRedeemRecordExportEvent
();
event
.
setUserId
(
downloadLog
.
getUserId
());
event
.
setUserType
(
downloadLog
.
getUserType
());
event
.
setLang
(
downloadLog
.
getLang
());
event
.
setRequestParams
(
downloadLog
.
getRequestParams
());
applicationContext
.
publishEvent
(
event
);
downloadLog
.
setFileName
(
event
.
getFileName
());
downloadLog
.
setPath
(
event
.
getPath
());
downloadLog
.
setDownloadUrl
(
event
.
getUrl
());
downloadLog
.
setResult
(
event
.
getResult
());
downloadLog
.
setFileId
(
event
.
getFileId
());
}
private
void
achievementDetailExcelExportPushEvent
(
DownloadLogDO
downloadLog
)
{
AchievementDetailExcelExportPushEvent
event
=
new
AchievementDetailExcelExportPushEvent
();
event
.
setUserId
(
downloadLog
.
getUserId
());
...
...
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