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
a55d456d
Commit
a55d456d
authored
Jul 23, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature-reward:新建模块,基础代码生成
parent
4dd96931
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
929 additions
and
0 deletions
+929
-0
pom.xml
pom.xml
+2
-0
pom.xml
yudao-module-reward/pom.xml
+23
-0
pom.xml
yudao-module-reward/yudao-module-reward-api/pom.xml
+31
-0
RewardConvert.java
...der/yudao/module/reward/convert/reward/RewardConvert.java
+54
-0
RewardDO.java
...r/yudao/module/reward/dal/dataobject/reward/RewardDO.java
+104
-0
RewardMapper.java
...er/yudao/module/reward/dal/mysql/reward/RewardMapper.java
+67
-0
ErrorCodeConstants.java
...iocoder/yudao/module/reward/enums/ErrorCodeConstants.java
+11
-0
RewardService.java
...der/yudao/module/reward/service/reward/RewardService.java
+65
-0
RewardServiceImpl.java
...yudao/module/reward/service/reward/RewardServiceImpl.java
+87
-0
RewardBackVO.java
...n/iocoder/yudao/module/reward/vo/reward/RewardBackVO.java
+105
-0
RewardBaseVO.java
...n/iocoder/yudao/module/reward/vo/reward/RewardBaseVO.java
+84
-0
RewardCreateReqVO.java
...oder/yudao/module/reward/vo/reward/RewardCreateReqVO.java
+78
-0
RewardQueryVO.java
.../iocoder/yudao/module/reward/vo/reward/RewardQueryVO.java
+69
-0
RewardUpdateReqVO.java
...oder/yudao/module/reward/vo/reward/RewardUpdateReqVO.java
+18
-0
GenRewardCodeTest.java
...ao-module-reward-api/src/test/java/GenRewardCodeTest.java
+2
-0
pom.xml
yudao-module-reward/yudao-module-reward-impl/pom.xml
+34
-0
RewardController.java
...dule/reward/controller/admin/reward/RewardController.java
+95
-0
No files found.
pom.xml
View file @
a55d456d
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
<module>
yudao-module-wealth
</module>
<module>
yudao-module-wealth
</module>
<!-- 发货管理 -->
<!-- 发货管理 -->
<module>
yudao-module-shipment
</module>
<module>
yudao-module-shipment
</module>
<!-- 礼品管理 -->
<module>
yudao-module-reward
</module>
</modules>
</modules>
<name>
${project.artifactId}
</name>
<name>
${project.artifactId}
</name>
...
...
yudao-module-reward/pom.xml
0 → 100644
View file @
a55d456d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao
</artifactId>
<version>
${revision}
</version>
</parent>
<artifactId>
yudao-module-reward
</artifactId>
<packaging>
pom
</packaging>
<name>
${project.artifactId}
</name>
<description>
礼品管理模块
</description>
<modules>
<module>
yudao-module-reward-api
</module>
<module>
yudao-module-reward-impl
</module>
</modules>
</project>
\ No newline at end of file
yudao-module-reward/yudao-module-reward-api/pom.xml
0 → 100644
View file @
a55d456d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-reward
</artifactId>
<version>
${revision}
</version>
</parent>
<artifactId>
yudao-module-reward-api
</artifactId>
<packaging>
jar
</packaging>
<name>
${project.artifactId}
</name>
<description>
reward 模块 API,暴露给其它模块调用
</description>
<properties>
<maven.compiler.source>
11
</maven.compiler.source>
<maven.compiler.target>
11
</maven.compiler.target>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-common
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/convert/reward/RewardConvert.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
convert
.
reward
;
import
java.util.*
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
cn.iocoder.yudao.module.reward.vo.reward.*
;
import
cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO
;
/**
* 礼品 Convert
* @author 系统管理员
*/
@Mapper
public
interface
RewardConvert
{
/*****转换MapStruct*****/
RewardConvert
INSTANCE
=
Mappers
.
getMapper
(
RewardConvert
.
class
);
/***
* 创建VO转实体
* @param bean
* @return
*/
RewardDO
convert
(
RewardCreateReqVO
bean
);
/***
* 修改VO转实体
* @param bean
* @return
*/
RewardDO
convert
(
RewardUpdateReqVO
bean
);
/***
* 实体转返回VO
* @param bean
* @return
*/
RewardBackVO
convert
(
RewardDO
bean
);
/***
* 实体列表转返回VO列表
* @param list
* @return
*/
List
<
RewardBackVO
>
convertList
(
List
<
RewardDO
>
list
);
/***
* 实体分页转返回分页
* @param page
* @return
*/
PageResult
<
RewardBackVO
>
convertPage
(
PageResult
<
RewardDO
>
page
);
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/dal/dataobject/reward/RewardDO.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
dal
.
dataobject
.
reward
;
import
lombok.*
;
import
java.util.*
;
import
com.baomidou.mybatisplus.annotation.*
;
import
cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO
;
/**
* 礼品 DO
*
* @author 系统管理员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName
(
"ecw_reward"
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
public
class
RewardDO
extends
BaseDO
{
/**
* 主键
*/
@TableId
private
Long
id
;
/**
* 礼品ID
*/
private
String
code
;
/**
* 中文名称
*/
private
String
titleZh
;
/**
* 英文名称
*/
private
String
titleEn
;
/**
* 法文名称
*/
private
String
titleFr
;
/**
* 中文礼品图片
*/
private
String
imgZh
;
/**
* 英文礼品图片
*/
private
String
imgEn
;
/**
* 法文礼品图片
*/
private
String
imgFr
;
/**
* 兑换所需积分
*/
private
Integer
pointsRequire
;
/**
* 兑换网点
*/
private
Integer
nodeId
;
/**
* 已兑换次数
*/
private
Integer
exchangeCount
;
/**
* 剩余数量
*/
private
Integer
quantityRemain
;
/**
* 活动开始时间
*/
private
Date
startTime
;
/**
* 活动结束时间
*/
private
Date
endTime
;
/**
* 领取方式(1上门领取,2包邮到家,3邮寄到付)
*/
private
Integer
pickMethod
;
/**
* 允许兑换次数
*/
private
Integer
allowCount
;
/**
* 中文备注
*/
private
String
remarkZh
;
/**
* 英文备注
*/
private
String
remarkEn
;
/**
* 法文备注
*/
private
String
remarkFr
;
/**
* 礼品状态(1已启用,2未启用,3已关闭,4已过期)
*/
private
Integer
status
;
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/dal/mysql/reward/RewardMapper.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
dal
.
mysql
.
reward
;
import
java.util.*
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper
;
import
cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
cn.iocoder.yudao.module.reward.vo.reward.*
;
/**
* 礼品 Mapper
* @author 系统管理员
*/
@Mapper
public
interface
RewardMapper
extends
AbstractMapper
<
RewardDO
>
{
@Override
default
PageResult
<
RewardDO
>
selectPage
(
PageVO
page
,
Object
object
)
{
if
(
object
instanceof
RewardQueryVO
)
{
RewardQueryVO
vo
=
(
RewardQueryVO
)
object
;
return
selectPage
(
page
,
new
LambdaQuery
<
RewardDO
>()
.
eqIfPresent
(
RewardDO:
:
getCode
,
vo
.
getCode
())
.
eqIfPresent
(
RewardDO:
:
getTitleZh
,
vo
.
getTitle
())
.
eqIfPresent
(
RewardDO:
:
getTitleEn
,
vo
.
getTitle
())
.
eqIfPresent
(
RewardDO:
:
getTitleFr
,
vo
.
getTitle
())
.
eqIfPresent
(
RewardDO:
:
getPointsRequire
,
vo
.
getPointsRequire
())
.
eqIfPresent
(
RewardDO:
:
getNodeId
,
vo
.
getNodeId
())
.
eqIfPresent
(
RewardDO:
:
getExchangeCount
,
vo
.
getExchangeCount
())
.
eqIfPresent
(
RewardDO:
:
getQuantityRemain
,
vo
.
getQuantityRemain
())
.
betweenIfPresent
(
RewardDO:
:
getStartTime
,
vo
.
getBeginStartTime
(),
vo
.
getEndStartTime
())
.
betweenIfPresent
(
RewardDO:
:
getEndTime
,
vo
.
getBeginEndTime
(),
vo
.
getEndEndTime
())
.
eqIfPresent
(
RewardDO:
:
getPickMethod
,
vo
.
getPickMethod
())
.
eqIfPresent
(
RewardDO:
:
getAllowCount
,
vo
.
getAllowCount
())
.
eqIfPresent
(
RewardDO:
:
getStatus
,
vo
.
getStatus
())
.
betweenIfPresent
(
RewardDO:
:
getCreateTime
,
vo
.
getBeginCreateTime
(),
vo
.
getEndCreateTime
())
.
orderByDesc
(
RewardDO:
:
getId
));
}
return
null
;
}
@Override
default
List
<
RewardDO
>
selectList
(
Object
object
)
{
if
(
object
instanceof
RewardQueryVO
)
{
RewardQueryVO
vo
=
(
RewardQueryVO
)
object
;
return
selectList
(
new
LambdaQuery
<
RewardDO
>()
.
eqIfPresent
(
RewardDO:
:
getCode
,
vo
.
getCode
())
.
eqIfPresent
(
RewardDO:
:
getTitleZh
,
vo
.
getTitle
())
.
eqIfPresent
(
RewardDO:
:
getTitleEn
,
vo
.
getTitle
())
.
eqIfPresent
(
RewardDO:
:
getTitleFr
,
vo
.
getTitle
())
.
eqIfPresent
(
RewardDO:
:
getPointsRequire
,
vo
.
getPointsRequire
())
.
eqIfPresent
(
RewardDO:
:
getNodeId
,
vo
.
getNodeId
())
.
eqIfPresent
(
RewardDO:
:
getExchangeCount
,
vo
.
getExchangeCount
())
.
eqIfPresent
(
RewardDO:
:
getQuantityRemain
,
vo
.
getQuantityRemain
())
.
betweenIfPresent
(
RewardDO:
:
getStartTime
,
vo
.
getBeginStartTime
(),
vo
.
getEndStartTime
())
.
betweenIfPresent
(
RewardDO:
:
getEndTime
,
vo
.
getBeginEndTime
(),
vo
.
getEndEndTime
())
.
eqIfPresent
(
RewardDO:
:
getPickMethod
,
vo
.
getPickMethod
())
.
eqIfPresent
(
RewardDO:
:
getAllowCount
,
vo
.
getAllowCount
())
.
eqIfPresent
(
RewardDO:
:
getStatus
,
vo
.
getStatus
())
.
betweenIfPresent
(
RewardDO:
:
getCreateTime
,
vo
.
getBeginCreateTime
(),
vo
.
getEndCreateTime
())
.
orderByDesc
(
RewardDO:
:
getId
));
}
return
null
;
}
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/enums/ErrorCodeConstants.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
enums
;
import
cn.iocoder.yudao.framework.common.exception.ErrorCode
;
// TODO 待办:请将下面的错误码复制到 yudao-module-reward-api 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!!
// ========== 礼品 TODO 补充编号 ==========
public
interface
ErrorCodeConstants
{
ErrorCode
_NOT_EXISTS
=
new
ErrorCode
(
1009011000
,
"礼品不存在"
);
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/service/reward/RewardService.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
service
.
reward
;
import
java.util.*
;
import
javax.validation.*
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
import
cn.iocoder.yudao.framework.mybatis.core.service.IService
;
import
cn.iocoder.yudao.module.reward.vo.reward.*
;
import
cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
/**
* 礼品 Service 接口
*
* @author 系统管理员
*/
public
interface
RewardService
extends
IService
<
RewardDO
>
{
/**
* 创建礼品
* @param createReqVO 创建信息
* @return 编号
*/
Long
create
(
@Valid
RewardCreateReqVO
createReqVO
);
/**
* 更新礼品
* @param updateReqVO 更新信息
*/
void
update
(
@Valid
RewardUpdateReqVO
updateReqVO
);
/**
* 删除礼品
* @param id 编号
*/
void
delete
(
Long
id
);
/**
* 获得礼品
* @param id 编号
* @return 礼品
*/
RewardDO
get
(
Long
id
);
/**
* 获得礼品列表
* @param ids 编号
* @return 礼品列表
*/
List
<
RewardDO
>
getList
(
Collection
<
Long
>
ids
);
/**
* 获得礼品分页
* @param page 分页查询
* @param query 查询
* @return 礼品分页
*/
PageResult
<
RewardDO
>
getPage
(
RewardQueryVO
query
,
PageVO
page
);
/**
* 获得礼品列表, 用于 Excel 导出
* @param query 查询
* @return 礼品列表
*/
List
<
RewardDO
>
getList
(
RewardQueryVO
query
);
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/service/reward/RewardServiceImpl.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
service
.
reward
;
import
java.util.*
;
import
javax.annotation.Resource
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
import
cn.iocoder.yudao.framework.mybatis.core.service.AbstractService
;
import
cn.iocoder.yudao.module.reward.vo.reward.*
;
import
cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.module.reward.convert.reward.RewardConvert
;
import
cn.iocoder.yudao.module.reward.dal.mysql.reward.RewardMapper
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
reward
.
enums
.
ErrorCodeConstants
.*;
import
static
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
IdWorker
.
getId
;
/**
* 礼品 Service 实现类
*
* @author 系统管理员
*/
@Service
@Validated
public
class
RewardServiceImpl
extends
AbstractService
<
RewardMapper
,
RewardDO
>
implements
RewardService
{
@Resource
private
RewardMapper
rewardMapper
;
@Override
public
Long
create
(
RewardCreateReqVO
createReqVO
)
{
// 插入
RewardDO
rewardDO
=
RewardConvert
.
INSTANCE
.
convert
(
createReqVO
);
rewardDO
.
setCode
(
"111"
);
int
id
=
rewardMapper
.
insert
(
rewardDO
);
// 返回
return
(
long
)
id
;
}
@Override
public
void
update
(
RewardUpdateReqVO
updateReqVO
)
{
// 校验存在
this
.
validateExists
(
updateReqVO
.
getId
());
// 更新
RewardDO
updateObj
=
RewardConvert
.
INSTANCE
.
convert
(
updateReqVO
);
rewardMapper
.
updateById
(
updateObj
);
}
@Override
public
void
delete
(
Long
id
)
{
// 校验存在
this
.
validateExists
(
id
);
// 删除
rewardMapper
.
deleteById
(
id
);
}
private
void
validateExists
(
Long
id
)
{
if
(
rewardMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
_NOT_EXISTS
);
}
}
@Override
public
RewardDO
get
(
Long
id
)
{
return
rewardMapper
.
selectById
(
id
);
}
@Override
public
List
<
RewardDO
>
getList
(
Collection
<
Long
>
ids
)
{
return
rewardMapper
.
selectBatchIds
(
ids
);
}
@Override
public
PageResult
<
RewardDO
>
getPage
(
RewardQueryVO
query
,
PageVO
page
)
{
return
rewardMapper
.
selectPage
(
page
,
query
);
}
@Override
public
List
<
RewardDO
>
getList
(
RewardQueryVO
query
)
{
return
rewardMapper
.
selectList
(
query
);
}
//生成礼品ID
private
String
generateRewardCode
(){
return
String
.
valueOf
(
getId
());
}
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardBackVO.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
vo
.
reward
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.annotations.*
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
org.springframework.format.annotation.DateTimeFormat
;
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
RewardBackVO
{
@ExcelProperty
(
""
)
@ApiModelProperty
(
value
=
""
,
required
=
true
)
private
Long
id
;
@ExcelProperty
(
"礼品ID"
)
@ApiModelProperty
(
value
=
"礼品ID"
,
required
=
true
)
private
String
code
;
@ExcelProperty
(
"中文名称"
)
@ApiModelProperty
(
value
=
"中文名称"
)
private
String
titleZh
;
@ExcelProperty
(
"英文名称"
)
@ApiModelProperty
(
value
=
"英文名称"
)
private
String
titleEn
;
@ExcelProperty
(
"法文名称"
)
@ApiModelProperty
(
value
=
"法文名称"
)
private
String
titleFr
;
@ExcelProperty
(
"中文礼品图片"
)
@ApiModelProperty
(
value
=
"中文礼品图片"
)
private
String
imgZh
;
@ExcelProperty
(
"英文礼品图片"
)
@ApiModelProperty
(
value
=
"英文礼品图片"
)
private
String
imgEn
;
@ExcelProperty
(
"法文礼品图片"
)
@ApiModelProperty
(
value
=
"法文礼品图片"
)
private
String
imgFr
;
@ExcelProperty
(
"兑换所需积分"
)
@ApiModelProperty
(
value
=
"兑换所需积分"
,
required
=
true
)
private
Integer
pointsRequire
;
@ExcelProperty
(
"兑换网点"
)
@ApiModelProperty
(
value
=
"兑换网点"
,
required
=
true
)
private
Integer
nodeId
;
@ExcelProperty
(
"已兑换次数"
)
@ApiModelProperty
(
value
=
"已兑换次数"
)
private
Integer
exchangeCount
;
@ExcelProperty
(
"剩余数量"
)
@ApiModelProperty
(
value
=
"剩余数量"
,
required
=
true
)
private
Integer
quantityRemain
;
@ExcelProperty
(
"活动开始时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"活动开始时间"
)
private
Date
startTime
;
@ExcelProperty
(
"活动结束时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"活动结束时间"
)
private
Date
endTime
;
@ExcelProperty
(
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
)
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
,
required
=
true
)
private
Integer
pickMethod
;
@ExcelProperty
(
"允许兑换次数"
)
@ApiModelProperty
(
value
=
"允许兑换次数"
,
required
=
true
)
private
Integer
allowCount
;
@ExcelProperty
(
"中文备注"
)
@ApiModelProperty
(
value
=
"中文备注"
)
private
String
remarkZh
;
@ExcelProperty
(
"英文备注"
)
@ApiModelProperty
(
value
=
"英文备注"
)
private
String
remarkEn
;
@ExcelProperty
(
"法文备注"
)
@ApiModelProperty
(
value
=
"法文备注"
)
private
String
remarkFr
;
@ExcelProperty
(
"礼品状态(1已启用,2未启用,3已关闭,4已过期)"
)
@ApiModelProperty
(
value
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)"
,
required
=
true
)
private
Integer
status
;
@ExcelProperty
(
"创建时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
)
private
Date
createTime
;
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardBaseVO.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
vo
.
reward
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.annotations.*
;
import
javax.validation.constraints.*
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
/**
* 礼品 Base VO,提供给添加、修改、详细的子 VO 使用
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
*/
@Data
public
class
RewardBaseVO
{
@ApiModelProperty
(
value
=
"礼品ID"
,
required
=
true
)
@NotNull
(
message
=
"礼品ID不能为空"
)
private
String
code
;
@ApiModelProperty
(
value
=
"中文名称"
)
private
String
titleZh
;
@ApiModelProperty
(
value
=
"英文名称"
)
private
String
titleEn
;
@ApiModelProperty
(
value
=
"法文名称"
)
private
String
titleFr
;
@ApiModelProperty
(
value
=
"中文礼品图片"
)
private
String
imgZh
;
@ApiModelProperty
(
value
=
"英文礼品图片"
)
private
String
imgEn
;
@ApiModelProperty
(
value
=
"法文礼品图片"
)
private
String
imgFr
;
@ApiModelProperty
(
value
=
"兑换所需积分"
,
required
=
true
)
@NotNull
(
message
=
"兑换所需积分不能为空"
)
private
Integer
pointsRequire
;
@ApiModelProperty
(
value
=
"兑换网点"
,
required
=
true
)
@NotNull
(
message
=
"兑换网点不能为空"
)
private
Integer
nodeId
;
@ApiModelProperty
(
value
=
"已兑换次数"
)
private
Integer
exchangeCount
;
@ApiModelProperty
(
value
=
"剩余数量"
,
required
=
true
)
@NotNull
(
message
=
"剩余数量不能为空"
)
private
Integer
quantityRemain
;
@ApiModelProperty
(
value
=
"活动开始时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
Date
startTime
;
@ApiModelProperty
(
value
=
"活动结束时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
Date
endTime
;
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
,
required
=
true
)
@NotNull
(
message
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)不能为空"
)
private
Integer
pickMethod
;
@ApiModelProperty
(
value
=
"允许兑换次数"
,
required
=
true
)
@NotNull
(
message
=
"允许兑换次数不能为空"
)
private
Integer
allowCount
;
@ApiModelProperty
(
value
=
"中文备注"
)
private
String
remarkZh
;
@ApiModelProperty
(
value
=
"英文备注"
)
private
String
remarkEn
;
@ApiModelProperty
(
value
=
"法文备注"
)
private
String
remarkFr
;
@ApiModelProperty
(
value
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)"
,
required
=
true
)
@NotNull
(
message
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)不能为空"
)
private
Integer
status
;
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardCreateReqVO.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
vo
.
reward
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.annotations.*
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
javax.validation.constraints.*
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Data
@ToString
(
callSuper
=
true
)
@ApiModel
(
"管理后台 - 礼品创建 Request VO"
)
public
class
RewardCreateReqVO
{
@ApiModelProperty
(
value
=
"中文名称"
)
private
String
titleZh
;
@ApiModelProperty
(
value
=
"英文名称"
)
private
String
titleEn
;
@ApiModelProperty
(
value
=
"法文名称"
)
private
String
titleFr
;
@ApiModelProperty
(
value
=
"中文礼品图片"
)
private
String
imgZh
;
@ApiModelProperty
(
value
=
"英文礼品图片"
)
private
String
imgEn
;
@ApiModelProperty
(
value
=
"法文礼品图片"
)
private
String
imgFr
;
@ApiModelProperty
(
value
=
"兑换所需积分"
,
required
=
true
)
@NotNull
(
message
=
"兑换所需积分不能为空"
)
private
Integer
pointsRequire
;
@ApiModelProperty
(
value
=
"兑换网点"
,
required
=
true
)
@NotNull
(
message
=
"兑换网点不能为空"
)
private
Integer
nodeId
;
@ApiModelProperty
(
value
=
"剩余数量"
,
required
=
true
)
@NotNull
(
message
=
"剩余数量不能为空"
)
private
Integer
quantityRemain
;
@ApiModelProperty
(
value
=
"活动开始时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
Date
startTime
;
@ApiModelProperty
(
value
=
"活动结束时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
Date
endTime
;
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
,
required
=
true
)
@NotNull
(
message
=
"领取方式不能为空"
)
private
Integer
pickMethod
;
@ApiModelProperty
(
value
=
"允许兑换次数"
,
required
=
true
)
@NotNull
(
message
=
"允许兑换次数不能为空"
)
private
Integer
allowCount
;
@ApiModelProperty
(
value
=
"中文备注"
)
@Size
(
max
=
500
,
message
=
"中文备注长度不能超过500"
)
private
String
remarkZh
;
@ApiModelProperty
(
value
=
"英文备注"
)
@Size
(
max
=
500
,
message
=
"英文备注长度不能超过500"
)
private
String
remarkEn
;
@ApiModelProperty
(
value
=
"法文备注"
)
@Size
(
max
=
500
,
message
=
"法文备注长度不能超过500"
)
private
String
remarkFr
;
@ApiModelProperty
(
value
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)"
,
required
=
true
)
@NotNull
(
message
=
"礼品状态不能为空"
)
private
Integer
status
;
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardQueryVO.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
vo
.
reward
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.annotations.*
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Data
@ApiModel
(
"管理后台 - 礼品查询 VO"
)
public
class
RewardQueryVO
{
@ApiModelProperty
(
value
=
"礼品ID"
)
private
String
code
;
@ApiModelProperty
(
value
=
"名称(不区分语言)"
)
private
String
title
;
@ApiModelProperty
(
value
=
"兑换所需积分"
)
private
Integer
pointsRequire
;
@ApiModelProperty
(
value
=
"兑换网点"
)
private
Integer
nodeId
;
@ApiModelProperty
(
value
=
"已兑换次数"
)
private
Integer
exchangeCount
;
@ApiModelProperty
(
value
=
"剩余数量"
)
private
Integer
quantityRemain
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"开始活动开始时间"
)
private
Date
beginStartTime
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"结束活动开始时间"
)
private
Date
endStartTime
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"开始活动结束时间"
)
private
Date
beginEndTime
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"结束活动结束时间"
)
private
Date
endEndTime
;
@ApiModelProperty
(
value
=
"领取方式(1上门领取,2包邮到家,3邮寄到付)"
)
private
Integer
pickMethod
;
@ApiModelProperty
(
value
=
"允许兑换次数"
)
private
Integer
allowCount
;
@ApiModelProperty
(
value
=
"礼品状态(1已启用,2未启用,3已关闭,4已过期)"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"备注(不区分语言)"
)
private
Integer
remark
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"开始创建时间"
)
private
Date
beginCreateTime
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"结束创建时间"
)
private
Date
endCreateTime
;
}
yudao-module-reward/yudao-module-reward-api/src/main/java/cn/iocoder/yudao/module/reward/vo/reward/RewardUpdateReqVO.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
vo
.
reward
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.annotations.*
;
import
javax.validation.constraints.*
;
@ApiModel
(
"管理后台 - 礼品更新 Request VO"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
public
class
RewardUpdateReqVO
extends
RewardBaseVO
{
@ApiModelProperty
(
value
=
""
,
required
=
true
)
@NotNull
(
message
=
"不能为空"
)
private
Long
id
;
}
yudao-module-reward/yudao-module-reward-api/src/test/java/GenRewardCodeTest.java
0 → 100644
View file @
a55d456d
public
class
GenRewardCodeTest
{
}
yudao-module-reward/yudao-module-reward-impl/pom.xml
0 → 100644
View file @
a55d456d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-reward
</artifactId>
<version>
${revision}
</version>
</parent>
<artifactId>
yudao-module-reward-impl
</artifactId>
<packaging>
jar
</packaging>
<name>
${project.artifactId}
</name>
<description>
reward 模块实现,实现礼品管理相关功能
</description>
<properties>
<maven.compiler.source>
11
</maven.compiler.source>
<maven.compiler.target>
11
</maven.compiler.target>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-reward-api
</artifactId>
<version>
${revision}
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
yudao-module-reward/yudao-module-reward-impl/src/main/java/cn/iocoder/yudao/module/reward/controller/admin/reward/RewardController.java
0 → 100644
View file @
a55d456d
package
cn
.
iocoder
.
yudao
.
module
.
reward
.
controller
.
admin
.
reward
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.annotations.*
;
import
javax.validation.constraints.*
;
import
javax.validation.*
;
import
javax.servlet.http.*
;
import
java.util.*
;
import
java.io.IOException
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
cn.iocoder.yudao.framework.excel.util.ExcelUtils
;
import
cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
operatelog
.
core
.
enums
.
OperateTypeEnum
.*;
import
cn.iocoder.yudao.module.reward.vo.reward.*
;
import
cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO
;
import
cn.iocoder.yudao.module.reward.convert.reward.RewardConvert
;
import
cn.iocoder.yudao.module.reward.service.reward.RewardService
;
@Validated
@RestController
@Api
(
tags
=
"管理后台 - 礼品"
)
@RequestMapping
(
"/reward/"
)
public
class
RewardController
{
@Resource
private
RewardService
rewardService
;
@PostMapping
(
"/create"
)
@ApiOperation
(
"创建礼品"
)
@PreAuthorize
(
"@ss.hasPermission('reward::create')"
)
public
CommonResult
<
Long
>
create
(
@Valid
@RequestBody
RewardCreateReqVO
createReqVO
)
{
return
success
(
rewardService
.
create
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@ApiOperation
(
"更新礼品"
)
@PreAuthorize
(
"@ss.hasPermission('reward::update')"
)
public
CommonResult
<
Boolean
>
update
(
@Valid
@RequestBody
RewardUpdateReqVO
updateReqVO
)
{
rewardService
.
update
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@ApiOperation
(
"删除礼品"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"编号"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Long
.
class
)
@PreAuthorize
(
"@ss.hasPermission('reward::delete')"
)
public
CommonResult
<
Boolean
>
delete
(
@RequestParam
(
"id"
)
Long
id
)
{
rewardService
.
delete
(
id
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@ApiOperation
(
"获得礼品"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"编号"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Long
.
class
)
@PreAuthorize
(
"@ss.hasPermission('reward::query')"
)
public
CommonResult
<
RewardBackVO
>
get
(
@RequestParam
(
"id"
)
Long
id
)
{
RewardDO
rewardDO
=
rewardService
.
get
(
id
);
return
success
(
RewardConvert
.
INSTANCE
.
convert
(
rewardDO
));
}
@GetMapping
(
"/list"
)
@ApiOperation
(
"获得礼品列表"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"编号列表"
,
required
=
true
,
example
=
"1024,2048"
,
dataTypeClass
=
List
.
class
)
@PreAuthorize
(
"@ss.hasPermission('reward::query')"
)
public
CommonResult
<
List
<
RewardBackVO
>>
getList
(
@RequestParam
(
"ids"
)
Collection
<
Long
>
ids
)
{
List
<
RewardDO
>
list
=
rewardService
.
getList
(
ids
);
return
success
(
RewardConvert
.
INSTANCE
.
convertList
(
list
));
}
@GetMapping
(
"/page"
)
@ApiOperation
(
"获得礼品分页"
)
@PreAuthorize
(
"@ss.hasPermission('reward::query')"
)
public
CommonResult
<
PageResult
<
RewardBackVO
>>
getPage
(
@Valid
RewardQueryVO
query
,
PageVO
page
)
{
PageResult
<
RewardDO
>
pageResult
=
rewardService
.
getPage
(
query
,
page
);
return
success
(
RewardConvert
.
INSTANCE
.
convertPage
(
pageResult
));
}
@GetMapping
(
"/export-excel"
)
@ApiOperation
(
"导出礼品 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('reward::export')"
)
@OperateLog
(
type
=
EXPORT
)
public
void
exportExcel
(
@Valid
RewardQueryVO
query
,
HttpServletResponse
response
)
throws
IOException
{
List
<
RewardDO
>
list
=
rewardService
.
getList
(
query
);
// 导出 Excel
List
<
RewardBackVO
>
datas
=
RewardConvert
.
INSTANCE
.
convertList
(
list
);
ExcelUtils
.
write
(
response
,
"礼品.xls"
,
"数据"
,
RewardBackVO
.
class
,
datas
);
}
}
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