Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
f6c847d1
提交
f6c847d1
authored
4月 04, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
后端 + 前端:优惠劵模板添加(未完成)
上级
8e9ca19e
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
31 个修改的文件
包含
1739 行增加
和
98 行删除
+1739
-98
router.config.js
admin-web/config/router.config.js
+5
-0
menu.js
admin-web/src/locales/zh-CN/menu.js
+2
-2
couponCardTemplateList.js
admin-web/src/models/promotion/couponCardTemplateList.js
+179
-0
CouponCardTemplateList.js
admin-web/src/pages/Promotion/CouponCardTemplateList.js
+0
-0
CouponCardTemplateList.less
admin-web/src/pages/Promotion/CouponCardTemplateList.less
+48
-0
ProductRecommendList.js
admin-web/src/pages/Promotion/ProductRecommendList.js
+2
-3
promotion.js
admin-web/src/services/promotion.js
+9
-2
AdminsCouponTemplateController.java
...ion/controller/admins/AdminsCouponTemplateController.java
+85
-0
CouponTemplateConvert.java
.../promotion/application/convert/CouponTemplateConvert.java
+27
-0
AdminsCouponTemplateVO.java
...omotion/application/vo/admins/AdminsCouponTemplateVO.java
+273
-0
CouponService.java
...ain/java/cn/iocoder/mall/promotion/api/CouponService.java
+5
-8
CouponCardTemplatePageBO.java
...coder/mall/promotion/api/bo/CouponCardTemplatePageBO.java
+0
-5
CouponCodeTemplateBO.java
...n/iocoder/mall/promotion/api/bo/CouponCodeTemplateBO.java
+0
-4
CouponCodeTemplatePageBO.java
...coder/mall/promotion/api/bo/CouponCodeTemplatePageBO.java
+0
-4
CouponTemplateBO.java
...va/cn/iocoder/mall/promotion/api/bo/CouponTemplateBO.java
+344
-0
CouponTemplatePageBO.java
...n/iocoder/mall/promotion/api/bo/CouponTemplatePageBO.java
+2
-1
ProductRecommendBO.java
.../cn/iocoder/mall/promotion/api/bo/ProductRecommendBO.java
+4
-3
CouponTemplateDateTypeEnum.java
...ll/promotion/api/constant/CouponTemplateDateTypeEnum.java
+43
-0
CouponTemplatePreferentialTypeEnum.java
...tion/api/constant/CouponTemplatePreferentialTypeEnum.java
+43
-0
CouponTemplateRangeTypeEnum.java
...l/promotion/api/constant/CouponTemplateRangeTypeEnum.java
+46
-0
CouponTemplateStatusEnum.java
...mall/promotion/api/constant/CouponTemplateStatusEnum.java
+36
-0
CouponTemplateTypeEnum.java
...r/mall/promotion/api/constant/CouponTemplateTypeEnum.java
+35
-0
ProductRecommendTypeEnum.java
...mall/promotion/api/constant/ProductRecommendTypeEnum.java
+3
-4
CouponCardTemplateAddDTO.java
...oder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java
+181
-18
CouponCodeTemplatePageDTO.java
...der/mall/promotion/api/dto/CouponCodeTemplatePageDTO.java
+0
-21
CouponTemplatePageDTO.java
...iocoder/mall/promotion/api/dto/CouponTemplatePageDTO.java
+1
-1
CouponTemplateConvert.java
...der/mall/promotion/biz/convert/CouponTemplateConvert.java
+31
-0
CouponTemplateDO.java
...coder/mall/promotion/biz/dataobject/CouponTemplateDO.java
+182
-2
ProductRecommendDO.java
...der/mall/promotion/biz/dataobject/ProductRecommendDO.java
+3
-3
CouponServiceImpl.java
...iocoder/mall/promotion/biz/service/CouponServiceImpl.java
+134
-1
CouponTemplateMapper.xml
...e-impl/src/main/resources/mapper/CouponTemplateMapper.xml
+16
-16
没有找到文件。
admin-web/config/router.config.js
浏览文件 @
f6c847d1
...
...
@@ -120,6 +120,11 @@ export default [
// name: 'product-category-list',
// component: './Product/ProductCategoryList',
// },
{
path
:
'/promotion/coupon-card-template-list'
,
name
:
'coupon-card-template-list'
,
component
:
'./Promotion/CouponCardTemplateList'
,
}
],
},
{
...
...
admin-web/src/locales/zh-CN/menu.js
浏览文件 @
f6c847d1
...
...
@@ -56,4 +56,5 @@ export default {
// 营销相关
'menu.promotion.promotion-banner-list'
:
'Banner 管理'
,
'menu.promotion.product-recommend-list'
:
'商品推荐'
,
};
\ No newline at end of file
'menu.promotion.coupon-card-template-list'
:
'优惠劵管理'
,
};
admin-web/src/models/promotion/couponCardTemplateList.js
0 → 100644
浏览文件 @
f6c847d1
import
{
message
}
from
'antd'
;
import
{
addProductRecommend
,
deleteProductRecommend
,
queryProductRecommend
,
updateProductRecommend
,
updateProductRecommendStatus
,
addCouponCardTemplate
,
}
from
'../../services/promotion'
;
import
PaginationHelper
from
'../../../helpers/PaginationHelper'
;
const
SEARCH_PARAMS_DEFAULT
=
{
type
:
1
,
};
export
default
{
namespace
:
'couponCardTemplateList'
,
state
:
{
// 分页列表相关
list
:
[],
listLoading
:
false
,
pagination
:
PaginationHelper
.
defaultPaginationConfig
,
searchParams
:
SEARCH_PARAMS_DEFAULT
,
// 添加 or 修改表单相关
modalVisible
:
false
,
modalType
:
undefined
,
// 'add' or 'update' 表单
formVals
:
{},
// 当前表单值
modalLoading
:
false
,
},
effects
:
{
// 查询列表
*
query
({
payload
},
{
call
,
put
})
{
// 显示加载中
yield
put
({
type
:
'changeListLoading'
,
payload
:
true
,
});
// 请求
const
response
=
yield
call
(
queryProductRecommend
,
payload
);
// 响应
yield
put
({
type
:
'setAll'
,
payload
:
{
list
:
response
.
data
.
list
,
pagination
:
PaginationHelper
.
formatPagination
(
response
.
data
,
payload
),
searchParams
:
{
type
:
payload
.
type
}
},
});
// 隐藏加载中
yield
put
({
type
:
'changeListLoading'
,
payload
:
false
,
});
},
*
add
({
payload
},
{
call
,
put
})
{
const
{
callback
,
body
}
=
payload
;
// 显示加载中
yield
put
({
type
:
'changeModalLoading'
,
payload
:
true
,
});
// 请求
const
response
=
yield
call
(
addCouponCardTemplate
,
body
);
// 响应
if
(
response
.
code
===
0
)
{
if
(
callback
)
{
callback
(
response
);
}
// 刷新列表
yield
put
({
type
:
'query'
,
payload
:
{
...
PaginationHelper
.
defaultPayload
},
});
}
// 隐藏加载中
yield
put
({
type
:
'changeModalLoading'
,
payload
:
false
,
});
},
*
update
({
payload
},
{
call
,
put
})
{
const
{
callback
,
body
}
=
payload
;
// 显示加载中
yield
put
({
type
:
'changeModalLoading'
,
payload
:
true
,
});
// 请求
const
response
=
yield
call
(
updateProductRecommend
,
body
);
// 响应
if
(
response
.
code
===
0
)
{
if
(
callback
)
{
callback
(
response
);
}
// 刷新列表
yield
put
({
type
:
'query'
,
payload
:
{
...
PaginationHelper
.
defaultPayload
},
});
}
// 隐藏加载中
yield
put
({
type
:
'changeModalLoading'
,
payload
:
false
,
});
},
*
updateStatus
({
payload
},
{
call
,
put
})
{
// 请求
const
response
=
yield
call
(
updateProductRecommendStatus
,
payload
);
// 响应
if
(
response
.
code
===
0
)
{
message
.
info
(
'更新状态成功!'
);
// 刷新列表
yield
put
({
type
:
'query'
,
payload
:
{
...
PaginationHelper
.
defaultPayload
},
});
}
},
*
delete
({
payload
},
{
call
,
put
})
{
// 请求
const
response
=
yield
call
(
deleteProductRecommend
,
payload
);
// 响应
if
(
response
.
code
===
0
)
{
message
.
info
(
'删除成功!'
);
// 刷新列表
yield
put
({
type
:
'query'
,
payload
:
{
...
PaginationHelper
.
defaultPayload
},
});
}
},
},
reducers
:
{
// 修改加载中的状态
changeModalLoading
(
state
,
{
payload
})
{
return
{
...
state
,
modalLoading
:
payload
,
};
},
changeListLoading
(
state
,
{
payload
})
{
return
{
...
state
,
listLoading
:
payload
,
};
},
// 设置所有属性
setAll
(
state
,
{
payload
})
{
return
{
...
state
,
...
payload
,
};
}
},
};
admin-web/src/pages/Promotion/CouponCardTemplateList.js
0 → 100644
浏览文件 @
f6c847d1
差异被折叠。
点击展开。
admin-web/src/pages/Promotion/CouponCardTemplateList.less
0 → 100644
浏览文件 @
f6c847d1
@import '~antd/lib/style/themes/default.less';
@import '~@/utils/utils.less';
.tableList {
.tableListOperator {
margin-bottom: 16px;
button {
margin-right: 8px;
}
}
}
.tableDelete {
color: red;
}
.tableListForm {
:global {
.ant-form-item {
display: flex;
margin-right: 0;
margin-bottom: 24px;
> .ant-form-item-label {
width: auto;
padding-right: 8px;
line-height: 32px;
}
.ant-form-item-control {
line-height: 32px;
}
}
.ant-form-item-control-wrapper {
flex: 1;
}
}
.submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
}
@media screen and (max-width: @screen-lg) {
.tableListForm :global(.ant-form-item) {
margin-right: 24px;
}
}
\ No newline at end of file
admin-web/src/pages/Promotion/ProductRecommendList.js
浏览文件 @
f6c847d1
...
...
@@ -257,7 +257,7 @@ const AddOrUpdateForm = Form.create()(props => {
});
};
const
title
=
modalType
===
'add'
?
'新建
Banner'
:
'更新 Banner
'
;
const
title
=
modalType
===
'add'
?
'新建
商品推荐'
:
'更新商品推荐
'
;
return
(
<
Modal
destroyOnClose
...
...
@@ -395,4 +395,4 @@ class BannerList extends PureComponent {
}
}
export
default
BannerList
;
\ No newline at end of file
export
default
BannerList
;
admin-web/src/services/promotion.js
浏览文件 @
f6c847d1
...
...
@@ -63,4 +63,12 @@ export async function deleteProductRecommend(params) {
return
request
(
`/promotion-api/admins/product_recommend/delete?
${
stringify
(
params
)}
`
,
{
method
:
'POST'
,
});
}
\ No newline at end of file
}
// coupon
export
async
function
addCouponCardTemplate
(
params
)
{
return
request
(
`/promotion-api/admins/coupon/template/add_card?
${
stringify
(
params
)}
`
,
{
method
:
'POST'
,
});
}
promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponTemplateController.java
0 → 100644
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
controller
.
admins
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.promotion.api.CouponService
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplateBO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO
;
import
cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Date
;
@RestController
@RequestMapping
(
"admins/product_recommend"
)
@Api
(
"优惠劵(码)模块"
)
public
class
AdminsCouponTemplateController
{
@Reference
(
validation
=
"true"
)
private
CouponService
couponService
;
// ========== 优惠劵(码)模板 ==========
@PostMapping
(
"/template/add_card"
)
@ApiOperation
(
value
=
"创建优惠劵模板"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"title"
,
value
=
"标题"
,
required
=
true
,
example
=
"优惠劵牛逼"
),
@ApiImplicitParam
(
name
=
"description"
,
value
=
"使用说明"
,
example
=
"我只是描述"
),
@ApiImplicitParam
(
name
=
"quota"
,
value
=
"每人限领个数"
,
example
=
"null - 则表示不限制"
),
@ApiImplicitParam
(
name
=
"stock"
,
value
=
"剩余可用库存"
,
example
=
"null - 则表示无限库存"
),
@ApiImplicitParam
(
name
=
"priceAvailable"
,
value
=
"是否设置满多少金额可用,单位:分"
,
example
=
"0-不限制;大于0-多少金额可用"
),
@ApiImplicitParam
(
name
=
"rangeType"
,
value
=
"可用范围的类型"
,
required
=
true
,
example
=
"参见 CouponTemplateRangeTypeEnum 枚举"
),
@ApiImplicitParam
(
name
=
"rangeValues"
,
value
=
"指定商品 / 分类列表,使用逗号分隔商品编号"
),
@ApiImplicitParam
(
name
=
"dateType"
,
value
=
"生效日期类型"
,
example
=
"参见 CouponTemplateDateTypeEnum 枚举"
),
@ApiImplicitParam
(
name
=
"validStartTime"
,
value
=
"固定日期-生效开始时间"
,
example
=
"当 dateType 为固定日期时,非空"
),
@ApiImplicitParam
(
name
=
"validEndTime"
,
value
=
"固定日期-生效结束时间"
,
example
=
"当 dateType 为固定日期时,非空"
),
@ApiImplicitParam
(
name
=
"fixedBeginTerm"
,
value
=
"领取日期-开始天数"
,
example
=
"当 dateType 为领取日期时,非空"
),
@ApiImplicitParam
(
name
=
"fixedEndTerm"
,
value
=
"领取日期-结束天数"
,
example
=
"当 dateType 为领取日期时,非空"
),
@ApiImplicitParam
(
name
=
"preferentialType"
,
value
=
"优惠类型"
,
example
=
"参见 CouponTemplatePreferentialTypeEnum 枚举"
),
@ApiImplicitParam
(
name
=
"priceOff"
,
value
=
"优惠金额,单位:分"
,
example
=
"当 preferentialType 为现金券时,非空"
),
@ApiImplicitParam
(
name
=
"percentOff"
,
value
=
"折扣百分比"
,
example
=
"当 preferentialType 为折扣卷时,非空"
),
@ApiImplicitParam
(
name
=
"discountPriceLimit"
,
value
=
"折扣上限"
,
example
=
"当 preferentialType 为折扣卷时,非空"
),
})
public
CommonResult
<
AdminsCouponTemplateVO
>
add
(
@RequestParam
(
value
=
"title"
)
String
title
,
@RequestParam
(
value
=
"description"
,
required
=
false
)
String
description
,
@RequestParam
(
value
=
"quota"
,
required
=
false
)
Integer
quota
,
@RequestParam
(
value
=
"stock"
,
required
=
false
)
Integer
stock
,
@RequestParam
(
value
=
"priceAvailable"
)
Integer
priceAvailable
,
@RequestParam
(
value
=
"rangeType"
)
Integer
rangeType
,
@RequestParam
(
value
=
"rangeType"
,
required
=
false
)
String
rangeValues
,
@RequestParam
(
value
=
"dateType"
)
Integer
dateType
,
@RequestParam
(
value
=
"validStartTime"
,
required
=
false
)
Date
validStartTime
,
@RequestParam
(
value
=
"validEndTime"
,
required
=
false
)
Date
validEndTime
,
@RequestParam
(
value
=
"fixedBeginTerm"
,
required
=
false
)
Integer
fixedBeginTerm
,
@RequestParam
(
value
=
"fixedEndTerm"
,
required
=
false
)
Integer
fixedEndTerm
,
@RequestParam
(
value
=
"preferentialType"
)
Integer
preferentialType
,
@RequestParam
(
value
=
"priceOff"
,
required
=
false
)
Integer
priceOff
,
@RequestParam
(
value
=
"percentOff"
,
required
=
false
)
Integer
percentOff
,
@RequestParam
(
value
=
"discountPriceLimit"
,
required
=
false
)
Integer
discountPriceLimit
)
{
// 创建 CouponCardTemplateAddDTO 对象
CouponCardTemplateAddDTO
couponCardTemplateAddDTO
=
new
CouponCardTemplateAddDTO
()
.
setTitle
(
title
).
setDescription
(
description
)
.
setQuota
(
quota
).
setStock
(
stock
)
.
setPriceAvailable
(
priceAvailable
).
setRangeType
(
rangeType
).
setRangeValues
(
rangeValues
)
.
setDateType
(
dateType
).
setValidStartTime
(
validStartTime
).
setValidEndTime
(
validEndTime
)
.
setFixedBeginTerm
(
fixedBeginTerm
).
setFixedEndTerm
(
fixedEndTerm
)
.
setPreferentialType
(
preferentialType
).
setPriceOff
(
priceOff
).
setPercentOff
(
percentOff
).
setDiscountPriceLimit
(
discountPriceLimit
);
// 提交请求
CommonResult
<
CouponTemplateBO
>
result
=
couponService
.
addCouponCardTemplate
(
couponCardTemplateAddDTO
);
// 返回结果
return
CouponTemplateConvert
.
INSTANCE
.
convert2
(
result
);
}
// ========== 优惠劵 ==========
// ========== 优惠码 ==========
}
promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/convert/CouponTemplateConvert.java
0 → 100644
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
convert
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplateBO
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
@Mapper
public
interface
CouponTemplateConvert
{
CouponTemplateConvert
INSTANCE
=
Mappers
.
getMapper
(
CouponTemplateConvert
.
class
);
@Mappings
({})
AdminsCouponTemplateVO
convert
(
CouponTemplateBO
bannerBO
);
@Mappings
({})
CommonResult
<
AdminsCouponTemplateVO
>
convert2
(
CommonResult
<
CouponTemplateBO
>
result
);
// @Mappings({})
// CommonResult<AdminsCouponTemplatePageVO> convert(CommonResult<CouponTemplatePageBO> result);
//
// @Mappings({})
// List<UsersCouponTemplateVO> convertList(List<CouponTemplateBO> banners);
}
promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsCouponTemplateVO.java
0 → 100644
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
vo
.
admins
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.Date
;
@ApiModel
(
"CouponTemplate VO"
)
public
class
AdminsCouponTemplateVO
{
// ========== 基本信息 BEGIN ==========
@ApiModelProperty
(
value
=
"模板编号,自增唯一"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"标题"
,
required
=
true
,
example
=
"优惠劵牛逼"
)
private
String
title
;
@ApiModelProperty
(
value
=
"使用说明"
,
required
=
true
,
example
=
"我只是描述"
)
private
String
description
;
@ApiModelProperty
(
value
=
"优惠劵类型"
,
required
=
true
,
example
=
"参见 CouponTemplateTypeEnum 枚举"
)
private
Integer
type
;
/**
* 码类型
*
* 1-一卡一码(UNIQUE)
* 2-通用码(GENERAL)
*
* 【优惠码独有】 @see CouponCodeDO
*/
// TODO
private
Integer
codeType
;
@ApiModelProperty
(
value
=
"优惠码状态"
,
required
=
true
,
example
=
"参见 CouponTemplateStatusEnum 枚举"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"每人限领个数"
,
example
=
"null - 则表示不限制"
)
private
Integer
quota
;
@ApiModelProperty
(
value
=
"发放总量"
)
private
Integer
total
;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
@ApiModelProperty
(
value
=
"是否设置满多少金额可用,单位:分"
,
required
=
true
,
example
=
"0-不限制;大于0-多少金额可用"
)
private
Integer
priceAvailable
;
@ApiModelProperty
(
value
=
"可用范围的类型"
,
required
=
true
,
example
=
"参见 CouponTemplateRangeTypeEnum 枚举"
)
private
Integer
rangeType
;
@ApiModelProperty
(
value
=
"指定商品 / 分类列表,使用逗号分隔商品编号"
,
example
=
"参见 CouponTemplateRangeTypeEnum 枚举"
)
private
String
rangeValues
;
@ApiModelProperty
(
value
=
"生效日期类型"
,
example
=
"参见 CouponTemplateDateTypeEnum 枚举"
)
private
Integer
dateType
;
@ApiModelProperty
(
value
=
"固定日期-生效开始时间"
)
private
Date
validStartTime
;
@ApiModelProperty
(
value
=
"固定日期-生效结束时间"
)
private
Date
validEndTime
;
@ApiModelProperty
(
value
=
"领取日期-开始天数"
,
example
=
"例如,0-当天;1-次天"
)
private
Integer
fixedBeginTerm
;
@ApiModelProperty
(
value
=
"领取日期-结束天数"
)
private
Integer
fixedEndTerm
;
// ========== 使用规则 END ==========
// ========== 使用效果 BEGIN ==========
@ApiModelProperty
(
value
=
"优惠类型"
,
example
=
"参见 CouponTemplatePreferentialTypeEnum 枚举"
)
private
Integer
preferentialType
;
@ApiModelProperty
(
value
=
"折扣百分比"
)
private
Integer
percentOff
;
@ApiModelProperty
(
value
=
"优惠金额,单位:分"
)
private
Integer
priceOff
;
@ApiModelProperty
(
value
=
"折扣上限"
)
private
Integer
discountPriceLimit
;
// ========== 使用效果 END ==========
// ========== 统计信息 BEGIN ==========
@ApiModelProperty
(
value
=
"折扣上限"
,
required
=
true
)
private
Integer
statFetchNum
;
// ========== 统计信息 END ==========
@ApiModelProperty
(
value
=
"折扣上限"
,
required
=
true
)
private
Date
createTime
;
public
Integer
getId
()
{
return
id
;
}
public
AdminsCouponTemplateVO
setId
(
Integer
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getTitle
()
{
return
title
;
}
public
AdminsCouponTemplateVO
setTitle
(
String
title
)
{
this
.
title
=
title
;
return
this
;
}
public
String
getDescription
()
{
return
description
;
}
public
AdminsCouponTemplateVO
setDescription
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
public
Integer
getType
()
{
return
type
;
}
public
AdminsCouponTemplateVO
setType
(
Integer
type
)
{
this
.
type
=
type
;
return
this
;
}
public
Integer
getCodeType
()
{
return
codeType
;
}
public
AdminsCouponTemplateVO
setCodeType
(
Integer
codeType
)
{
this
.
codeType
=
codeType
;
return
this
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
AdminsCouponTemplateVO
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
return
this
;
}
public
Integer
getQuota
()
{
return
quota
;
}
public
AdminsCouponTemplateVO
setQuota
(
Integer
quota
)
{
this
.
quota
=
quota
;
return
this
;
}
public
Integer
getStock
()
{
return
stock
;
}
public
AdminsCouponTemplateVO
setStock
(
Integer
stock
)
{
this
.
stock
=
stock
;
return
this
;
}
public
Integer
getPriceAvailable
()
{
return
priceAvailable
;
}
public
AdminsCouponTemplateVO
setPriceAvailable
(
Integer
priceAvailable
)
{
this
.
priceAvailable
=
priceAvailable
;
return
this
;
}
public
Integer
getRangeType
()
{
return
rangeType
;
}
public
AdminsCouponTemplateVO
setRangeType
(
Integer
rangeType
)
{
this
.
rangeType
=
rangeType
;
return
this
;
}
public
String
getRangeValues
()
{
return
rangeValues
;
}
public
AdminsCouponTemplateVO
setRangeValues
(
String
rangeValues
)
{
this
.
rangeValues
=
rangeValues
;
return
this
;
}
public
Integer
getDateType
()
{
return
dateType
;
}
public
AdminsCouponTemplateVO
setDateType
(
Integer
dateType
)
{
this
.
dateType
=
dateType
;
return
this
;
}
public
Date
getValidStartTime
()
{
return
validStartTime
;
}
public
AdminsCouponTemplateVO
setValidStartTime
(
Date
validStartTime
)
{
this
.
validStartTime
=
validStartTime
;
return
this
;
}
public
Date
getValidEndTime
()
{
return
validEndTime
;
}
public
AdminsCouponTemplateVO
setValidEndTime
(
Date
validEndTime
)
{
this
.
validEndTime
=
validEndTime
;
return
this
;
}
public
Integer
getFixedBeginTerm
()
{
return
fixedBeginTerm
;
}
public
AdminsCouponTemplateVO
setFixedBeginTerm
(
Integer
fixedBeginTerm
)
{
this
.
fixedBeginTerm
=
fixedBeginTerm
;
return
this
;
}
public
Integer
getFixedEndTerm
()
{
return
fixedEndTerm
;
}
public
AdminsCouponTemplateVO
setFixedEndTerm
(
Integer
fixedEndTerm
)
{
this
.
fixedEndTerm
=
fixedEndTerm
;
return
this
;
}
public
Integer
getPreferentialType
()
{
return
preferentialType
;
}
public
AdminsCouponTemplateVO
setPreferentialType
(
Integer
preferentialType
)
{
this
.
preferentialType
=
preferentialType
;
return
this
;
}
public
Integer
getPercentOff
()
{
return
percentOff
;
}
public
AdminsCouponTemplateVO
setPercentOff
(
Integer
percentOff
)
{
this
.
percentOff
=
percentOff
;
return
this
;
}
public
Integer
getPriceOff
()
{
return
priceOff
;
}
public
AdminsCouponTemplateVO
setPriceOff
(
Integer
priceOff
)
{
this
.
priceOff
=
priceOff
;
return
this
;
}
public
Integer
getDiscountPriceLimit
()
{
return
discountPriceLimit
;
}
public
AdminsCouponTemplateVO
setDiscountPriceLimit
(
Integer
discountPriceLimit
)
{
this
.
discountPriceLimit
=
discountPriceLimit
;
return
this
;
}
public
Integer
getStatFetchNum
()
{
return
statFetchNum
;
}
public
AdminsCouponTemplateVO
setStatFetchNum
(
Integer
statFetchNum
)
{
this
.
statFetchNum
=
statFetchNum
;
return
this
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
AdminsCouponTemplateVO
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
return
this
;
}
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java
浏览文件 @
f6c847d1
...
...
@@ -2,18 +2,15 @@ package cn.iocoder.mall.promotion.api;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.promotion.api.bo.CouponCardBO
;
import
cn.iocoder.mall.promotion.api.bo.CouponCardTemplatePageBO
;
import
cn.iocoder.mall.promotion.api.bo.CouponCodeTemplateBO
;
import
cn.iocoder.mall.promotion.api.bo.CouponCodeTemplatePageBO
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplateBO
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO
;
import
cn.iocoder.mall.promotion.api.dto.*
;
public
interface
CouponService
{
// ========== 优惠劵(码)模板 ==========
CommonResult
<
CouponCodeTemplatePageBO
>
getCouponCodeTemplatePage
(
CouponCodeTemplatePageDTO
couponCodeTemplatePageDTO
);
CommonResult
<
CouponCardTemplatePageBO
>
getCouponCardTemplatePage
(
CouponCardTemplatePageDTO
couponCardTemplatePageDTO
);
CommonResult
<
CouponTemplatePageBO
>
getCouponTemplatePage
(
CouponTemplatePageDTO
couponTemplatePageDTO
);
/**
* 创建优惠码模板
...
...
@@ -21,7 +18,7 @@ public interface CouponService {
* @param couponCodeTemplateAddDTO 优惠码模板添加 DTO
* @return 优惠码模板
*/
CommonResult
<
Coupon
Code
TemplateBO
>
addCouponCodeTemplate
(
CouponCodeTemplateAddDTO
couponCodeTemplateAddDTO
);
CommonResult
<
CouponTemplateBO
>
addCouponCodeTemplate
(
CouponCodeTemplateAddDTO
couponCodeTemplateAddDTO
);
/**
* 创建优惠劵模板
...
...
@@ -29,7 +26,7 @@ public interface CouponService {
* @param couponCardTemplateAddDTO 优惠码模板添加 DTO
* @return 优惠劵模板
*/
CommonResult
<
Coupon
Code
TemplateBO
>
addCouponCardTemplate
(
CouponCardTemplateAddDTO
couponCardTemplateAddDTO
);
CommonResult
<
CouponTemplateBO
>
addCouponCardTemplate
(
CouponCardTemplateAddDTO
couponCardTemplateAddDTO
);
/**
* 更新优惠码模板
...
...
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplatePageBO.java
deleted
100644 → 0
浏览文件 @
8e9ca19e
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
bo
;
public
class
CouponCardTemplatePageBO
{
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplateBO.java
deleted
100644 → 0
浏览文件 @
8e9ca19e
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
bo
;
public
class
CouponCodeTemplateBO
{
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplatePageBO.java
deleted
100644 → 0
浏览文件 @
8e9ca19e
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
bo
;
public
class
CouponCodeTemplatePageBO
{
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponTemplateBO.java
0 → 100644
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
bo
;
import
java.util.Date
;
public
class
CouponTemplateBO
{
// ========== 基本信息 BEGIN ==========
/**
* 模板编号,自增唯一。
*/
private
Integer
id
;
/**
* 标题
*/
private
String
title
;
/**
* 使用说明
*/
private
String
description
;
/**
* 类型
*
* 1-优惠劵
* 2-优惠码
*/
private
Integer
type
;
/**
* 码类型
*
* 1-一卡一码(UNIQUE)
* 2-通用码(GENERAL)
*
* 【优惠码独有】 @see CouponCodeDO
*/
private
Integer
codeType
;
/**
* 优惠码状态
*
* 1-开启中
* 2-禁用中
* 3-已过期
*
* 当优惠劵(码)开启中,可以手动操作,设置禁用中。
*/
private
Integer
status
;
/**
* 每人限领个数
*
* null - 则表示不限制
*/
private
Integer
quota
;
/**
* 发放总量
*/
private
Integer
total
;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
/**
* 是否设置满多少金额可用,单位:分
*
* 0-不限制
* 大于0-多少金额可用
*/
private
Integer
priceAvailable
;
/**
* 可用范围的类型
*
* 10-全部(ALL):所有可用
* 20-部分(PART):部分商品可用,或指定商品可用
* 21-部分(PART):部分商品不可用,或指定商品可用
* 30-部分(PART):部分分类可用,或指定商品可用
* 31-部分(PART):部分分类不可用,或指定商品可用
*/
private
Integer
rangeType
;
/**
* 指定商品 / 分类列表,使用逗号分隔商品编号
*/
private
String
rangeValues
;
/**
* 生效日期类型
*
* 1-固定日期
* 2-领取日期:领到券 {@link #fixedBeginTerm} 日开始 N 天内有效
*/
private
Integer
dateType
;
/**
* 固定日期-生效开始时间
*/
private
Date
validStartTime
;
/**
* 固定日期-生效结束时间
*/
private
Date
validEndTime
;
/**
* 领取日期-开始天数
*
* 例如,0-当天;1-次天
*/
private
Integer
fixedBeginTerm
;
/**
* 领取日期-结束天数
*/
private
Integer
fixedEndTerm
;
// ========== 使用规则 END ==========
// ========== 使用效果 BEGIN ==========
/**
* 优惠类型
*
* 1-代金卷
* 2-折扣卷
*/
private
Integer
preferentialType
;
/**
* 折扣百分比。
*
* 例如,80% 为 80。
* 当 100% 为 100 ,则代表免费。
*/
private
Integer
percentOff
;
/**
* 优惠金额,单位:分
*/
private
Integer
priceOff
;
/**
* 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。
*
* 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。
*/
private
Integer
discountPriceLimit
;
// ========== 使用效果 END ==========
// ========== 统计信息 BEGIN ==========
/**
* 领取优惠券的次数
*/
private
Integer
statFetchNum
;
// ========== 统计信息 END ==========
/**
* 创建时间
*/
private
Date
createTime
;
public
Integer
getId
()
{
return
id
;
}
public
CouponTemplateBO
setId
(
Integer
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getTitle
()
{
return
title
;
}
public
CouponTemplateBO
setTitle
(
String
title
)
{
this
.
title
=
title
;
return
this
;
}
public
String
getDescription
()
{
return
description
;
}
public
CouponTemplateBO
setDescription
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
public
Integer
getType
()
{
return
type
;
}
public
CouponTemplateBO
setType
(
Integer
type
)
{
this
.
type
=
type
;
return
this
;
}
public
Integer
getCodeType
()
{
return
codeType
;
}
public
CouponTemplateBO
setCodeType
(
Integer
codeType
)
{
this
.
codeType
=
codeType
;
return
this
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
CouponTemplateBO
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
return
this
;
}
public
Integer
getQuota
()
{
return
quota
;
}
public
CouponTemplateBO
setQuota
(
Integer
quota
)
{
this
.
quota
=
quota
;
return
this
;
}
public
Integer
getTotal
()
{
return
total
;
}
public
CouponTemplateBO
setTotal
(
Integer
total
)
{
this
.
total
=
total
;
return
this
;
}
public
Integer
getPriceAvailable
()
{
return
priceAvailable
;
}
public
CouponTemplateBO
setPriceAvailable
(
Integer
priceAvailable
)
{
this
.
priceAvailable
=
priceAvailable
;
return
this
;
}
public
Integer
getRangeType
()
{
return
rangeType
;
}
public
CouponTemplateBO
setRangeType
(
Integer
rangeType
)
{
this
.
rangeType
=
rangeType
;
return
this
;
}
public
String
getRangeValues
()
{
return
rangeValues
;
}
public
CouponTemplateBO
setRangeValues
(
String
rangeValues
)
{
this
.
rangeValues
=
rangeValues
;
return
this
;
}
public
Integer
getDateType
()
{
return
dateType
;
}
public
CouponTemplateBO
setDateType
(
Integer
dateType
)
{
this
.
dateType
=
dateType
;
return
this
;
}
public
Date
getValidStartTime
()
{
return
validStartTime
;
}
public
CouponTemplateBO
setValidStartTime
(
Date
validStartTime
)
{
this
.
validStartTime
=
validStartTime
;
return
this
;
}
public
Date
getValidEndTime
()
{
return
validEndTime
;
}
public
CouponTemplateBO
setValidEndTime
(
Date
validEndTime
)
{
this
.
validEndTime
=
validEndTime
;
return
this
;
}
public
Integer
getPreferentialType
()
{
return
preferentialType
;
}
public
CouponTemplateBO
setPreferentialType
(
Integer
preferentialType
)
{
this
.
preferentialType
=
preferentialType
;
return
this
;
}
public
Integer
getPercentOff
()
{
return
percentOff
;
}
public
CouponTemplateBO
setPercentOff
(
Integer
percentOff
)
{
this
.
percentOff
=
percentOff
;
return
this
;
}
public
Integer
getPriceOff
()
{
return
priceOff
;
}
public
CouponTemplateBO
setPriceOff
(
Integer
priceOff
)
{
this
.
priceOff
=
priceOff
;
return
this
;
}
public
Integer
getDiscountPriceLimit
()
{
return
discountPriceLimit
;
}
public
CouponTemplateBO
setDiscountPriceLimit
(
Integer
discountPriceLimit
)
{
this
.
discountPriceLimit
=
discountPriceLimit
;
return
this
;
}
public
Integer
getStatFetchNum
()
{
return
statFetchNum
;
}
public
CouponTemplateBO
setStatFetchNum
(
Integer
statFetchNum
)
{
this
.
statFetchNum
=
statFetchNum
;
return
this
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
CouponTemplateBO
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
return
this
;
}
public
Integer
getFixedBeginTerm
()
{
return
fixedBeginTerm
;
}
public
CouponTemplateBO
setFixedBeginTerm
(
Integer
fixedBeginTerm
)
{
this
.
fixedBeginTerm
=
fixedBeginTerm
;
return
this
;
}
public
Integer
getFixedEndTerm
()
{
return
fixedEndTerm
;
}
public
CouponTemplateBO
setFixedEndTerm
(
Integer
fixedEndTerm
)
{
this
.
fixedEndTerm
=
fixedEndTerm
;
return
this
;
}
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/Coupon
CardTemplat
eBO.java
→
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/Coupon
TemplatePag
eBO.java
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
bo
;
public
class
CouponCardTemplateBO
{
public
class
CouponTemplatePageBO
{
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/ProductRecommendBO.java
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
bo
;
import
cn.iocoder.mall.promotion.api.constant.ProductRecommendTypeEnum
;
import
java.util.Date
;
/**
...
...
@@ -14,7 +16,7 @@ public class ProductRecommendBO {
/**
* 类型
*
* {@link
cn.iocoder.mall.promotion.api.constant.ProductRecommendType
}
* {@link
ProductRecommendTypeEnum
}
*/
private
Integer
type
;
/**
...
...
@@ -103,4 +105,4 @@ public class ProductRecommendBO {
return
this
;
}
}
\ No newline at end of file
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateDateTypeEnum.java
0 → 100644
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
constant
;
import
cn.iocoder.common.framework.core.IntArrayValuable
;
import
java.util.Arrays
;
public
enum
CouponTemplateDateTypeEnum
implements
IntArrayValuable
{
FIXED_DATE
(
1
,
"固定日期"
),
FIXED_TERM
(
2
,
"领取日期"
),
;
public
static
final
int
[]
ARRAYS
=
Arrays
.
stream
(
values
()).
mapToInt
(
CouponTemplateDateTypeEnum:
:
getValue
).
toArray
();
/**
* 值
*/
private
final
Integer
value
;
/**
* 名字
*/
private
final
String
name
;
CouponTemplateDateTypeEnum
(
Integer
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
@Override
public
int
[]
array
()
{
return
ARRAYS
;
}
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplatePreferentialTypeEnum.java
0 → 100644
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
constant
;
import
cn.iocoder.common.framework.core.IntArrayValuable
;
import
java.util.Arrays
;
public
enum
CouponTemplatePreferentialTypeEnum
implements
IntArrayValuable
{
PRICE
(
1
,
"代金卷"
),
DISCOUNT
(
2
,
"折扣卷"
),
;
public
static
final
int
[]
ARRAYS
=
Arrays
.
stream
(
values
()).
mapToInt
(
CouponTemplatePreferentialTypeEnum:
:
getValue
).
toArray
();
/**
* 值
*/
private
final
Integer
value
;
/**
* 名字
*/
private
final
String
name
;
CouponTemplatePreferentialTypeEnum
(
Integer
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
@Override
public
int
[]
array
()
{
return
ARRAYS
;
}
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateRangeTypeEnum.java
0 → 100644
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
constant
;
import
cn.iocoder.common.framework.core.IntArrayValuable
;
import
java.util.Arrays
;
public
enum
CouponTemplateRangeTypeEnum
implements
IntArrayValuable
{
ALL
(
10
,
"所有可用"
),
PRODUCT_INCLUDE_PRT
(
20
,
"部分商品可用,或指定商品可用"
),
PRODUCT_EXCLUDE_PRT
(
21
,
"部分商品不可用,或指定商品可用"
),
CATEGORY_INCLUDE_PRT
(
30
,
"部分分类可用,或指定分类可用"
),
CATEGORY_EXCLUDE_PRT
(
31
,
"部分分类不可用,或指定分类可用"
),
;
public
static
final
int
[]
ARRAYS
=
Arrays
.
stream
(
values
()).
mapToInt
(
CouponTemplateRangeTypeEnum:
:
getValue
).
toArray
();
/**
* 值
*/
private
final
Integer
value
;
/**
* 名字
*/
private
final
String
name
;
CouponTemplateRangeTypeEnum
(
Integer
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
@Override
public
int
[]
array
()
{
return
ARRAYS
;
}
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateStatusEnum.java
0 → 100644
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
constant
;
import
java.util.Arrays
;
public
enum
CouponTemplateStatusEnum
{
ENABLE
(
1
,
"开启中"
),
DISABLE
(
2
,
"禁用中"
),
EXPIRE
(
3
,
"已过期"
),
;
public
static
final
int
[]
ARRAYS
=
Arrays
.
stream
(
values
()).
mapToInt
(
CouponTemplateStatusEnum:
:
getValue
).
toArray
();
/**
* 值
*/
private
final
Integer
value
;
/**
* 名字
*/
private
final
String
name
;
CouponTemplateStatusEnum
(
Integer
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateTypeEnum.java
0 → 100644
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
constant
;
import
java.util.Arrays
;
public
enum
CouponTemplateTypeEnum
{
CARD
(
1
,
"优惠劵"
),
CODE
(
2
,
"折扣卷"
),
;
public
static
final
int
[]
ARRAYS
=
Arrays
.
stream
(
values
()).
mapToInt
(
CouponTemplateTypeEnum:
:
getValue
).
toArray
();
/**
* 值
*/
private
final
Integer
value
;
/**
* 名字
*/
private
final
String
name
;
CouponTemplateTypeEnum
(
Integer
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/ProductRecommendType.java
→
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/ProductRecommendType
Enum
.java
浏览文件 @
f6c847d1
...
...
@@ -3,7 +3,7 @@ package cn.iocoder.mall.promotion.api.constant;
/**
* 商品推荐类型
*/
public
enum
ProductRecommendType
{
public
enum
ProductRecommendType
Enum
{
HOT
(
1
,
"热卖推荐"
),
NEW
(
2
,
"新品推荐"
),
...
...
@@ -19,7 +19,7 @@ public enum ProductRecommendType {
*/
private
final
String
name
;
ProductRecommendType
(
Integer
value
,
String
name
)
{
ProductRecommendType
Enum
(
Integer
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
...
...
@@ -40,4 +40,4 @@ public enum ProductRecommendType {
||
NEW
.
value
.
equals
(
status
);
}
}
\ No newline at end of file
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
dto
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplateDateTypeEnum
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplatePreferentialTypeEnum
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplateRangeTypeEnum
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
...
...
@@ -28,13 +34,14 @@ public class CouponCardTemplateAddDTO {
*
* null - 则表示不限制
*/
@Min
(
value
=
1
,
message
=
"每人限领个数最小为 {value}"
)
private
Integer
quota
;
/**
* 剩余可用库存
*
* null - 则表示无限库存
* 发放总量
*/
private
Integer
stock
;
@NotNull
(
message
=
"发放总量不能为空"
)
@Min
(
value
=
1
,
message
=
"每人限领个数最小为 {value}"
)
private
Integer
total
;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
...
...
@@ -45,6 +52,7 @@ public class CouponCardTemplateAddDTO {
* 大于0-多少金额可用
*/
@NotNull
(
message
=
"使用金额门槛不能为空"
)
@Min
(
value
=
0L
,
message
=
"使用金额门槛最低为 {value}"
)
private
Integer
priceAvailable
;
/**
* 可用范围的类型
...
...
@@ -52,10 +60,11 @@ public class CouponCardTemplateAddDTO {
* 10-全部(ALL):所有可用
* 20-部分(PART):部分商品可用,或指定商品可用
* 21-部分(PART):部分商品不可用,或指定商品可用
* 30-部分(PART):部分分类可用,或指定
商品
可用
* 31-部分(PART):部分分类不可用,或指定
商品
可用
* 30-部分(PART):部分分类可用,或指定
分类
可用
* 31-部分(PART):部分分类不可用,或指定
分类
可用
*/
@NotNull
(
message
=
"可用范围的类型不能为空"
)
@InEnum
(
value
=
CouponTemplateRangeTypeEnum
.
class
,
message
=
"可用范围的类型必须在 {value}"
)
private
Integer
rangeType
;
/**
* 指定商品 / 分类列表,使用逗号分隔商品编号
...
...
@@ -65,9 +74,10 @@ public class CouponCardTemplateAddDTO {
* 生效日期类型
*
* 1-固定日期
* 2-领取日期:领到券 {@link #fixedTerm} 日开始 N 天内有效
* 2-领取日期:领到券 {@link #fixed
End
Term} 日开始 N 天内有效
*/
@NotNull
(
message
=
"生效日期类型不能为空"
)
@InEnum
(
value
=
CouponTemplateDateTypeEnum
.
class
,
message
=
"生效日期类型必须在 {value}"
)
private
Integer
dateType
;
/**
* 固定日期-生效开始时间
...
...
@@ -77,16 +87,18 @@ public class CouponCardTemplateAddDTO {
* 固定日期-生效结束时间
*/
private
Date
validEndTime
;
// /**
// * 领取日期-开始天数
// *
// * 例如,0-当天;1-次天
// */
// private Integer fixedBeginTerm;
/**
* 领取日期-开始天数
*
* 例如,0-当天;1-次天
*/
@Min
(
value
=
0L
,
message
=
"领取日期开始时间最小为 {value}"
)
private
Integer
fixedBeginTerm
;
/**
* 领取日期-结束天数
*/
private
Integer
fixedTerm
;
@Min
(
value
=
1L
,
message
=
"领取日期结束时间最小为 {value}"
)
private
Integer
fixedEndTerm
;
// ========== 使用规则 END ==========
// ========== 使用效果 BEGIN ==========
...
...
@@ -96,24 +108,175 @@ public class CouponCardTemplateAddDTO {
* 1-代金卷
* 2-折扣卷
*/
@NotNull
(
message
=
"优惠类型不能为空"
)
@InEnum
(
value
=
CouponTemplatePreferentialTypeEnum
.
class
,
message
=
"优惠类型必须在 {value}"
)
private
Integer
preferentialType
;
/**
* 优惠金额,单位:分
*/
@Min
(
value
=
1
,
message
=
"优惠金额最小值为 {value}"
)
private
Integer
priceOff
;
/**
* 折扣百分比。
*
* 例如,80% 为 80。
* 当 100% 为 100 ,则代表免费。
*/
@Max
(
value
=
100
,
message
=
"折扣比最大值为 {value}"
)
private
Integer
percentOff
;
/**
* 优惠金额,单位:分
*/
private
Integer
priceOff
;
/**
* 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。
*
* 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。
*/
@Min
(
value
=
1
,
message
=
"折扣上限最小值为 {value}"
)
private
Integer
discountPriceLimit
;
// ========== 使用效果 END ==========
public
String
getTitle
()
{
return
title
;
}
public
CouponCardTemplateAddDTO
setTitle
(
String
title
)
{
this
.
title
=
title
;
return
this
;
}
public
String
getDescription
()
{
return
description
;
}
public
CouponCardTemplateAddDTO
setDescription
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
public
Integer
getQuota
()
{
return
quota
;
}
public
CouponCardTemplateAddDTO
setQuota
(
Integer
quota
)
{
this
.
quota
=
quota
;
return
this
;
}
public
Integer
getPriceAvailable
()
{
return
priceAvailable
;
}
public
CouponCardTemplateAddDTO
setPriceAvailable
(
Integer
priceAvailable
)
{
this
.
priceAvailable
=
priceAvailable
;
return
this
;
}
public
Integer
getRangeType
()
{
return
rangeType
;
}
public
CouponCardTemplateAddDTO
setRangeType
(
Integer
rangeType
)
{
this
.
rangeType
=
rangeType
;
return
this
;
}
public
String
getRangeValues
()
{
return
rangeValues
;
}
public
CouponCardTemplateAddDTO
setRangeValues
(
String
rangeValues
)
{
this
.
rangeValues
=
rangeValues
;
return
this
;
}
public
Integer
getDateType
()
{
return
dateType
;
}
public
CouponCardTemplateAddDTO
setDateType
(
Integer
dateType
)
{
this
.
dateType
=
dateType
;
return
this
;
}
public
Date
getValidStartTime
()
{
return
validStartTime
;
}
public
CouponCardTemplateAddDTO
setValidStartTime
(
Date
validStartTime
)
{
this
.
validStartTime
=
validStartTime
;
return
this
;
}
public
Date
getValidEndTime
()
{
return
validEndTime
;
}
public
CouponCardTemplateAddDTO
setValidEndTime
(
Date
validEndTime
)
{
this
.
validEndTime
=
validEndTime
;
return
this
;
}
public
Integer
getFixedBeginTerm
()
{
return
fixedBeginTerm
;
}
public
CouponCardTemplateAddDTO
setFixedBeginTerm
(
Integer
fixedBeginTerm
)
{
this
.
fixedBeginTerm
=
fixedBeginTerm
;
return
this
;
}
public
Integer
getFixedEndTerm
()
{
return
fixedEndTerm
;
}
public
CouponCardTemplateAddDTO
setFixedEndTerm
(
Integer
fixedEndTerm
)
{
this
.
fixedEndTerm
=
fixedEndTerm
;
return
this
;
}
public
Integer
getPreferentialType
()
{
return
preferentialType
;
}
public
CouponCardTemplateAddDTO
setPreferentialType
(
Integer
preferentialType
)
{
this
.
preferentialType
=
preferentialType
;
return
this
;
}
public
Integer
getPercentOff
()
{
return
percentOff
;
}
public
CouponCardTemplateAddDTO
setPercentOff
(
Integer
percentOff
)
{
this
.
percentOff
=
percentOff
;
return
this
;
}
public
Integer
getPriceOff
()
{
return
priceOff
;
}
public
CouponCardTemplateAddDTO
setPriceOff
(
Integer
priceOff
)
{
this
.
priceOff
=
priceOff
;
return
this
;
}
public
Integer
getDiscountPriceLimit
()
{
return
discountPriceLimit
;
}
public
CouponCardTemplateAddDTO
setDiscountPriceLimit
(
Integer
discountPriceLimit
)
{
this
.
discountPriceLimit
=
discountPriceLimit
;
return
this
;
}
public
Integer
getTotal
()
{
return
total
;
}
public
CouponCardTemplateAddDTO
setTotal
(
Integer
total
)
{
this
.
total
=
total
;
return
this
;
}
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplatePageDTO.java
deleted
100644 → 0
浏览文件 @
8e9ca19e
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
dto
;
/**
* 优惠码模板分页 DTO
*/
public
class
CouponCodeTemplatePageDTO
{
/**
* 标题
*/
private
String
title
;
/**
* 状态
*/
private
Integer
status
;
/**
* 优惠类型
*/
private
Integer
preferentialType
;
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/Coupon
Card
TemplatePageDTO.java
→
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponTemplatePageDTO.java
浏览文件 @
f6c847d1
...
...
@@ -3,7 +3,7 @@ package cn.iocoder.mall.promotion.api.dto;
/**
* 优惠劵模板分页 DTO
*/
public
class
Coupon
Card
TemplatePageDTO
{
public
class
CouponTemplatePageDTO
{
/**
* 标题
...
...
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/convert/CouponTemplateConvert.java
0 → 100644
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
convert
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplateBO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateAddDTO
;
import
cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
@Mapper
public
interface
CouponTemplateConvert
{
CouponTemplateConvert
INSTANCE
=
Mappers
.
getMapper
(
CouponTemplateConvert
.
class
);
// @Mappings({})
// CouponTemplateBO convertToBO(CouponTemplateDO banner);
//
// @Mappings({})
// List<CouponTemplateBO> convertToBO(List<CouponTemplateDO> bannerList);
@Mappings
({})
CouponTemplateDO
convert
(
CouponCodeTemplateAddDTO
template
);
@Mappings
({})
CouponTemplateDO
convert
(
CouponCardTemplateAddDTO
template
);
@Mappings
({})
CouponTemplateBO
convert
(
CouponTemplateDO
template
);
}
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java
浏览文件 @
f6c847d1
...
...
@@ -195,7 +195,7 @@ public class CouponTemplateDO extends BaseDO {
private
Integer
discountPriceLimit
;
// ========== 使用效果 END ==========
//
// ========== 统计信息 BEGIN ==========
// ========== 统计信息 BEGIN ==========
// /**
// * 领取优惠券的人数
// */
...
...
@@ -208,6 +208,186 @@ public class CouponTemplateDO extends BaseDO {
// * 使用优惠券的次数
// */
// private Integer statUseNum;
//
// ========== 统计信息 END ==========
// ========== 统计信息 END ==========
public
Integer
getId
()
{
return
id
;
}
public
CouponTemplateDO
setId
(
Integer
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getTitle
()
{
return
title
;
}
public
CouponTemplateDO
setTitle
(
String
title
)
{
this
.
title
=
title
;
return
this
;
}
public
String
getDescription
()
{
return
description
;
}
public
CouponTemplateDO
setDescription
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
public
Integer
getType
()
{
return
type
;
}
public
CouponTemplateDO
setType
(
Integer
type
)
{
this
.
type
=
type
;
return
this
;
}
public
Integer
getCodeType
()
{
return
codeType
;
}
public
CouponTemplateDO
setCodeType
(
Integer
codeType
)
{
this
.
codeType
=
codeType
;
return
this
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
CouponTemplateDO
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
return
this
;
}
public
Integer
getQuota
()
{
return
quota
;
}
public
CouponTemplateDO
setQuota
(
Integer
quota
)
{
this
.
quota
=
quota
;
return
this
;
}
public
Integer
getStock
()
{
return
stock
;
}
public
CouponTemplateDO
setStock
(
Integer
stock
)
{
this
.
stock
=
stock
;
return
this
;
}
public
Integer
getPriceAvailable
()
{
return
priceAvailable
;
}
public
CouponTemplateDO
setPriceAvailable
(
Integer
priceAvailable
)
{
this
.
priceAvailable
=
priceAvailable
;
return
this
;
}
public
Integer
getRangeType
()
{
return
rangeType
;
}
public
CouponTemplateDO
setRangeType
(
Integer
rangeType
)
{
this
.
rangeType
=
rangeType
;
return
this
;
}
public
String
getRangeValues
()
{
return
rangeValues
;
}
public
CouponTemplateDO
setRangeValues
(
String
rangeValues
)
{
this
.
rangeValues
=
rangeValues
;
return
this
;
}
public
Integer
getDateType
()
{
return
dateType
;
}
public
CouponTemplateDO
setDateType
(
Integer
dateType
)
{
this
.
dateType
=
dateType
;
return
this
;
}
public
Date
getValidStartTime
()
{
return
validStartTime
;
}
public
CouponTemplateDO
setValidStartTime
(
Date
validStartTime
)
{
this
.
validStartTime
=
validStartTime
;
return
this
;
}
public
Date
getValidEndTime
()
{
return
validEndTime
;
}
public
CouponTemplateDO
setValidEndTime
(
Date
validEndTime
)
{
this
.
validEndTime
=
validEndTime
;
return
this
;
}
public
Integer
getFixedTerm
()
{
return
fixedTerm
;
}
public
CouponTemplateDO
setFixedTerm
(
Integer
fixedTerm
)
{
this
.
fixedTerm
=
fixedTerm
;
return
this
;
}
public
Integer
getPreferentialType
()
{
return
preferentialType
;
}
public
CouponTemplateDO
setPreferentialType
(
Integer
preferentialType
)
{
this
.
preferentialType
=
preferentialType
;
return
this
;
}
public
Integer
getPercentOff
()
{
return
percentOff
;
}
public
CouponTemplateDO
setPercentOff
(
Integer
percentOff
)
{
this
.
percentOff
=
percentOff
;
return
this
;
}
public
Integer
getPriceOff
()
{
return
priceOff
;
}
public
CouponTemplateDO
setPriceOff
(
Integer
priceOff
)
{
this
.
priceOff
=
priceOff
;
return
this
;
}
public
Integer
getDiscountPriceLimit
()
{
return
discountPriceLimit
;
}
public
CouponTemplateDO
setDiscountPriceLimit
(
Integer
discountPriceLimit
)
{
this
.
discountPriceLimit
=
discountPriceLimit
;
return
this
;
}
public
Integer
getStatFetchNum
()
{
return
statFetchNum
;
}
public
CouponTemplateDO
setStatFetchNum
(
Integer
statFetchNum
)
{
this
.
statFetchNum
=
statFetchNum
;
return
this
;
}
}
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
dataobject
;
import
cn.iocoder.common.framework.dataobject.DeletableDO
;
import
cn.iocoder.mall.promotion.api.constant.ProductRecommendTypeEnum
;
/**
* 商品推荐 DO
...
...
@@ -14,7 +15,7 @@ public class ProductRecommendDO extends DeletableDO {
/**
* 类型
*
* {@link
cn.iocoder.mall.promotion.api.constant.ProductRecommendType
}
* {@link
ProductRecommendTypeEnum
}
*/
private
Integer
type
;
/**
...
...
@@ -91,4 +92,4 @@ public class ProductRecommendDO extends DeletableDO {
return
this
;
}
}
\ No newline at end of file
}
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java
浏览文件 @
f6c847d1
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
service
;
public
class
CouponServiceImpl
{
import
cn.iocoder.common.framework.constant.SysErrorCodeEnum
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.promotion.api.CouponService
;
import
cn.iocoder.mall.promotion.api.bo.CouponCardBO
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplateBO
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplateDateTypeEnum
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplatePreferentialTypeEnum
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplateStatusEnum
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplateTypeEnum
;
import
cn.iocoder.mall.promotion.api.dto.*
;
import
cn.iocoder.mall.promotion.biz.convert.CouponTemplateConvert
;
import
cn.iocoder.mall.promotion.biz.dao.CouponTemplateMapper
;
import
cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
@Service
// 实际上不用添加。添加的原因是,必须 Spring 报错提示
@com
.
alibaba
.
dubbo
.
config
.
annotation
.
Service
(
validation
=
"true"
)
public
class
CouponServiceImpl
implements
CouponService
{
@Autowired
private
CouponTemplateMapper
couponTemplateMapper
;
@Override
public
CommonResult
<
CouponTemplatePageBO
>
getCouponTemplatePage
(
CouponTemplatePageDTO
couponTemplatePageDTO
)
{
return
null
;
}
@Override
public
CommonResult
<
CouponTemplateBO
>
addCouponCodeTemplate
(
CouponCodeTemplateAddDTO
couponCodeTemplateAddDTO
)
{
return
null
;
}
@Override
public
CommonResult
<
CouponTemplateBO
>
addCouponCardTemplate
(
CouponCardTemplateAddDTO
couponCardTemplateAddDTO
)
{
// 校验生效日期相关
CommonResult
<
Boolean
>
checkCouponCodeTemplateDateTypeResult
=
this
.
checkCouponTemplateDateType
(
couponCardTemplateAddDTO
.
getDateType
(),
couponCardTemplateAddDTO
.
getValidStartTime
(),
couponCardTemplateAddDTO
.
getValidEndTime
(),
couponCardTemplateAddDTO
.
getFixedBeginTerm
(),
couponCardTemplateAddDTO
.
getFixedEndTerm
());
if
(
checkCouponCodeTemplateDateTypeResult
.
isError
())
{
return
CommonResult
.
error
(
checkCouponCodeTemplateDateTypeResult
);
}
// 校验优惠类型
CommonResult
<
Boolean
>
checkCouponTemplateDateTypeResult
=
this
.
checkCouponTemplatePreferentialType
(
couponCardTemplateAddDTO
.
getPreferentialType
(),
couponCardTemplateAddDTO
.
getPercentOff
(),
couponCardTemplateAddDTO
.
getPriceOff
());
if
(
checkCouponCodeTemplateDateTypeResult
.
isError
())
{
return
CommonResult
.
error
(
checkCouponTemplateDateTypeResult
);
}
// 保存优惠劵模板到数据库
CouponTemplateDO
template
=
CouponTemplateConvert
.
INSTANCE
.
convert
(
couponCardTemplateAddDTO
)
.
setType
(
CouponTemplateTypeEnum
.
CARD
.
getValue
())
.
setStatus
(
CouponTemplateStatusEnum
.
ENABLE
.
getValue
())
.
setStatFetchNum
(
0
);
couponTemplateMapper
.
insert
(
template
);
// 返回成功
return
CommonResult
.
success
(
CouponTemplateConvert
.
INSTANCE
.
convert
(
template
));
}
@Override
public
CommonResult
<
Boolean
>
updateCouponCodeTemplate
(
CouponCodeTemplateUpdateDTO
couponCodeTemplateUpdateDTO
)
{
return
null
;
}
@Override
public
CommonResult
<
Boolean
>
updateCouponCardTemplate
(
CouponCardTemplateUpdateDTO
couponCardTemplateUpdateDTO
)
{
return
null
;
}
@Override
public
CommonResult
<
Boolean
>
updateCouponTemplateStatus
(
Integer
adminId
,
Integer
couponTemplateId
,
Integer
status
)
{
return
null
;
}
@Override
public
CommonResult
<
CouponCardBO
>
addCouponCard
(
Integer
userId
,
Integer
couponTemplateId
)
{
return
null
;
}
@Override
public
CommonResult
<
Boolean
>
useCouponCard
(
Integer
userId
,
Integer
couponCardId
,
Integer
usedOrderId
,
Integer
usedPrice
)
{
return
null
;
}
@Override
public
CommonResult
<
Boolean
>
cancelUseCouponCard
(
Integer
userId
,
Integer
couponCardId
)
{
return
null
;
}
@Override
public
CommonResult
<
CouponCardBO
>
useCouponCode
(
Integer
userId
,
String
code
)
{
return
null
;
}
private
CommonResult
<
Boolean
>
checkCouponTemplateDateType
(
Integer
dateType
,
Date
validStartTime
,
Date
validEndTime
,
Integer
fixedBeginTerm
,
Integer
fixedEndTerm
)
{
if
(
CouponTemplateDateTypeEnum
.
FIXED_DATE
.
getValue
().
equals
(
dateType
))
{
// 固定日期
if
(
validStartTime
==
null
)
{
return
CommonResult
.
error
(
SysErrorCodeEnum
.
VALIDATION_REQUEST_PARAM_ERROR
.
getCode
(),
"生效开始时间不能为空"
);
}
if
(
validEndTime
==
null
)
{
return
CommonResult
.
error
(
SysErrorCodeEnum
.
VALIDATION_REQUEST_PARAM_ERROR
.
getCode
(),
"生效结束时间不能为空"
);
}
}
else
if
(
CouponTemplateDateTypeEnum
.
FIXED_TERM
.
getValue
().
equals
(
dateType
))
{
// 领取日期
if
(
fixedBeginTerm
==
null
)
{
return
CommonResult
.
error
(
SysErrorCodeEnum
.
VALIDATION_REQUEST_PARAM_ERROR
.
getCode
(),
"领取日期开始时间不能为空"
);
}
if
(
fixedEndTerm
==
null
)
{
return
CommonResult
.
error
(
SysErrorCodeEnum
.
VALIDATION_REQUEST_PARAM_ERROR
.
getCode
(),
"领取日期结束时间不能为空"
);
}
}
else
{
throw
new
IllegalArgumentException
(
"未知的生效日期类型:"
+
dateType
);
}
return
CommonResult
.
success
(
true
);
}
private
CommonResult
<
Boolean
>
checkCouponTemplatePreferentialType
(
Integer
preferentialType
,
Integer
percentOff
,
Integer
priceOff
)
{
if
(
CouponTemplatePreferentialTypeEnum
.
PRICE
.
getValue
().
equals
(
preferentialType
))
{
if
(
priceOff
==
null
)
{
return
CommonResult
.
error
(
SysErrorCodeEnum
.
VALIDATION_REQUEST_PARAM_ERROR
.
getCode
(),
"优惠金额不能为空"
);
}
}
else
if
(
CouponTemplatePreferentialTypeEnum
.
DISCOUNT
.
getValue
().
equals
(
preferentialType
))
{
if
(
percentOff
==
null
)
{
return
CommonResult
.
error
(
SysErrorCodeEnum
.
VALIDATION_REQUEST_PARAM_ERROR
.
getCode
(),
"折扣百分比不能为空"
);
}
}
else
{
throw
new
IllegalArgumentException
(
"未知的优惠类型:"
+
preferentialType
);
}
return
CommonResult
.
success
(
true
);
}
}
promotion/promotion-service-impl/src/main/resources/mapper/CouponTemplateMapper.xml
浏览文件 @
f6c847d1
...
...
@@ -72,15 +72,15 @@
<insert
id=
"insert"
parameterType=
"CouponTemplateDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
INSERT INTO coupon_template (
title, description, type, code_type,
status, quota,
stock
, price_available, range_type,
status, quota,
total
, price_available, range_type,
range_values, date_type, valid_start_time, valid_end_time, fixed_term,
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
create_time
) VALUES (
#{title}, #{description
, #{type, #{code_t
ype},
#{status}, #{quota
, #{stock
}, #{priceAvailable}, #{rangeType},
#{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime, #{fixedTerm},
#{preferentialType, #{percentOff}, #{priceOff}, #{discountPriceLimit}, #{statFetchNum},
#{title}, #{description
}, #{type}, #{codeT
ype},
#{status}, #{quota
}, #{total
}, #{priceAvailable}, #{rangeType},
#{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime
}
, #{fixedTerm},
#{preferentialType
}
, #{percentOff}, #{priceOff}, #{discountPriceLimit}, #{statFetchNum},
#{createTime}
)
</insert>
...
...
@@ -104,37 +104,37 @@
stock = #{stock},
</if>
<if
test=
"priceAvailable != null"
>
price_available = #{priceAvailable}
price_available = #{priceAvailable}
,
</if>
<if
test=
"rangeType != null"
>
range_type = #{rangeType}
range_type = #{rangeType}
,
</if>
<if
test=
"rangeValues != null"
>
range_values = #{rangeValues}
range_values = #{rangeValues}
,
</if>
<if
test=
"dateType != null"
>
date_type = #{dateType}
date_type = #{dateType}
,
</if>
<if
test=
"validStartTime != null"
>
valid_start_time = #{validStartTime}
valid_start_time = #{validStartTime}
,
</if>
<if
test=
"validEndTime != null"
>
valid_end_time = #{validEndTime}
valid_end_time = #{validEndTime}
,
</if>
<if
test=
"fixedTerm != null"
>
fixed_term = #{fixedTerm}
fixed_term = #{fixedTerm}
,
</if>
<if
test=
"preferentialType != null"
>
preferential_type = #{preferentialType}
preferential_type = #{preferentialType}
,
</if>
<if
test=
"percentOff != null"
>
percent_off = #{percentOff}
percent_off = #{percentOff}
,
</if>
<if
test=
"priceOff != null"
>
price_off = #{priceOff}
price_off = #{priceOff}
,
</if>
<if
test=
"discountPriceLimit != null"
>
discount_price_limit = #{discountPriceLimit}
discount_price_limit = #{discountPriceLimit}
,
</if>
</set>
WHERE id = #{id}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论