Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
caosy
/
fun-common
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cb2dd087
authored
Apr 27, 2022
by
zhangchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优惠券添加分类
parent
22d14fd6
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
297 additions
and
1 deletions
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/TourVoucherRuleConditionBaseBean.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/TourVoucherRuleConditionBean.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/TrainVoucherRuleConditionBaseBean.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/TrainVoucherRuleConditionBean.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VipVoucherRuleConditionBaseBean.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VipVoucherRuleConditionBean.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherTypeEnum.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/TourVoucherRuleConditionBaseBean.java
0 → 100644
View file @
cb2dd087
package
com
.
ctrip
.
fun
.
common
.
vo
.
basic
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
/**
* 会员专享套票
* @author DELL
*
*/
public
class
TourVoucherRuleConditionBaseBean
extends
AbstractRuleConditionBaseBean
{
private
static
final
long
serialVersionUID
=
4101212688944997275L
;
/**
* 资源ID
*/
private
int
resourceId
;
/**
* 产品ID
*/
private
int
productId
;
public
int
getResourceId
()
{
return
resourceId
;
}
public
void
setResourceId
(
int
resourceId
)
{
this
.
resourceId
=
resourceId
;
}
public
int
getProductId
()
{
return
productId
;
}
public
void
setProductId
(
int
productId
)
{
this
.
productId
=
productId
;
}
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/TourVoucherRuleConditionBean.java
0 → 100644
View file @
cb2dd087
package
com
.
ctrip
.
fun
.
common
.
vo
.
basic
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
/**
* 会员专享套票
* @author DELL
*
*/
public
class
TourVoucherRuleConditionBean
extends
AbstractRuleConditionBean
<
CourseRuleConditionBaseBean
>{
@Override
public
boolean
isEnableUse
(
CourseRuleConditionBaseBean
t
)
{
// TODO Auto-generated method stub
return
false
;
}
/*@Override
public boolean isEnableUse(CourseRuleConditionBaseBean t) {
if (this.getType() == 1) {
return true;
} else if (getType() == 2) {
// 转换数据(产品ID、资源ID)
List<Integer> productIdList = new ArrayList<Integer>();
List<Integer> resourceIdList = new ArrayList<Integer>();
if (StringUtils.hasText(this.getValue())) {
String[] productIdArray = this.getValue().split(",");
for (String s : productIdArray) {
if (StringUtils.hasText(s)) {
productIdList.add(Integer.valueOf(s));
}
}
}
if (StringUtils.hasText(this.getResourceIds())) {
String[] resourceIdArray = this.getResourceIds().split(",");
for (String s : resourceIdArray) {
if (StringUtils.hasText(s)) {
resourceIdList.add(Integer.valueOf(s));
}
}
}
boolean isEnableProduct = true, isEnableResource = true, isEnableProductStartDate = true, isEnableProductEndDate = true;
if (!CollectionUtils.isEmpty(productIdList) && !productIdList.contains(t.getProductId())) {
isEnableProduct = false;
}
if (!CollectionUtils.isEmpty(resourceIdList) && !resourceIdList.contains(t.getResourceId())) {
isEnableResource = false;
}
if (getProductStartDate() != null && t.getPlayDate() != null && getProductStartDate().after(t.getPlayDate())) {
isEnableProductStartDate = false;
}
if (getProductEndDate() != null && t.getPlayDate() != null && getProductEndDate().before(t.getPlayDate())) {
isEnableProductEndDate = false;
}
if (isEnableProduct && isEnableResource && isEnableProductStartDate && isEnableProductEndDate) {
return true;
}
}
return false;
}*/
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/TrainVoucherRuleConditionBaseBean.java
0 → 100644
View file @
cb2dd087
package
com
.
ctrip
.
fun
.
common
.
vo
.
basic
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
/**
* 培训产品套票
* @author DELL
*
*/
public
class
TrainVoucherRuleConditionBaseBean
extends
AbstractRuleConditionBaseBean
{
private
static
final
long
serialVersionUID
=
4101212688944997275L
;
/**
* 资源ID
*/
private
int
resourceId
;
/**
* 产品ID
*/
private
int
productId
;
public
int
getResourceId
()
{
return
resourceId
;
}
public
void
setResourceId
(
int
resourceId
)
{
this
.
resourceId
=
resourceId
;
}
public
int
getProductId
()
{
return
productId
;
}
public
void
setProductId
(
int
productId
)
{
this
.
productId
=
productId
;
}
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/TrainVoucherRuleConditionBean.java
0 → 100644
View file @
cb2dd087
package
com
.
ctrip
.
fun
.
common
.
vo
.
basic
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
/**
* 会员专享套票
* @author DELL
*
*/
public
class
TrainVoucherRuleConditionBean
extends
AbstractRuleConditionBean
<
TrainVoucherRuleConditionBaseBean
>{
@Override
public
boolean
isEnableUse
(
TrainVoucherRuleConditionBaseBean
t
)
{
// TODO Auto-generated method stub
return
false
;
}
/* @Override
public boolean isEnableUse(CourseRuleConditionBaseBean t) {
if (this.getType() == 1) {
return true;
} else if (getType() == 2) {
// 转换数据(产品ID、资源ID)
List<Integer> productIdList = new ArrayList<Integer>();
List<Integer> resourceIdList = new ArrayList<Integer>();
if (StringUtils.hasText(this.getValue())) {
String[] productIdArray = this.getValue().split(",");
for (String s : productIdArray) {
if (StringUtils.hasText(s)) {
productIdList.add(Integer.valueOf(s));
}
}
}
if (StringUtils.hasText(this.getResourceIds())) {
String[] resourceIdArray = this.getResourceIds().split(",");
for (String s : resourceIdArray) {
if (StringUtils.hasText(s)) {
resourceIdList.add(Integer.valueOf(s));
}
}
}
boolean isEnableProduct = true, isEnableResource = true, isEnableProductStartDate = true, isEnableProductEndDate = true;
if (!CollectionUtils.isEmpty(productIdList) && !productIdList.contains(t.getProductId())) {
isEnableProduct = false;
}
if (!CollectionUtils.isEmpty(resourceIdList) && !resourceIdList.contains(t.getResourceId())) {
isEnableResource = false;
}
if (getProductStartDate() != null && t.getPlayDate() != null && getProductStartDate().after(t.getPlayDate())) {
isEnableProductStartDate = false;
}
if (getProductEndDate() != null && t.getPlayDate() != null && getProductEndDate().before(t.getPlayDate())) {
isEnableProductEndDate = false;
}
if (isEnableProduct && isEnableResource && isEnableProductStartDate && isEnableProductEndDate) {
return true;
}
}
return false;
}*/
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VipVoucherRuleConditionBaseBean.java
0 → 100644
View file @
cb2dd087
package
com
.
ctrip
.
fun
.
common
.
vo
.
basic
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
/**
* 培训产品套票
* @author DELL
*
*/
public
class
VipVoucherRuleConditionBaseBean
extends
AbstractRuleConditionBaseBean
{
private
static
final
long
serialVersionUID
=
4101212688944997275L
;
/**
* 资源ID
*/
private
int
resourceId
;
/**
* 产品ID
*/
private
int
productId
;
public
int
getResourceId
()
{
return
resourceId
;
}
public
void
setResourceId
(
int
resourceId
)
{
this
.
resourceId
=
resourceId
;
}
public
int
getProductId
()
{
return
productId
;
}
public
void
setProductId
(
int
productId
)
{
this
.
productId
=
productId
;
}
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VipVoucherRuleConditionBean.java
0 → 100644
View file @
cb2dd087
package
com
.
ctrip
.
fun
.
common
.
vo
.
basic
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
/**
* 会员专享套票
* @author DELL
*
*/
public
class
VipVoucherRuleConditionBean
extends
AbstractRuleConditionBean
<
VipVoucherRuleConditionBaseBean
>{
/**
* 暂时不验证
*/
@Override
public
boolean
isEnableUse
(
VipVoucherRuleConditionBaseBean
t
)
{
// TODO Auto-generated method stub
return
false
;
}
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherTypeEnum.java
View file @
cb2dd087
...
...
@@ -17,7 +17,13 @@ public enum VoucherTypeEnum {
MALL
(
3
,
"商城"
,
new
MallProductRuleConditionBean
()),
EVENT_ACTIVITY
(
4
,
"赛事活动"
,
new
EventActivityRuleConditionBean
());
EVENT_ACTIVITY
(
4
,
"赛事活动"
,
new
EventActivityRuleConditionBean
()),
TOUR_VOUCHER
(
5
,
"套票券"
,
new
TourVoucherRuleConditionBean
()),
TRAIN_VOUCHER
(
6
,
"培训券"
,
new
TrainVoucherRuleConditionBean
()),
VIP_VOUCHER
(
7
,
"会员券"
,
new
VipVoucherRuleConditionBean
());
private
int
value
;
private
String
msg
;
...
...
@@ -69,6 +75,12 @@ public enum VoucherTypeEnum {
return
new
MallProductRuleConditionBean
();
case
4
:
return
new
EventActivityRuleConditionBean
();
case
5
:
return
new
TourVoucherRuleConditionBean
();
case
6
:
return
new
TrainVoucherRuleConditionBean
();
case
7
:
return
new
VipVoucherRuleConditionBean
();
default
:
return
null
;
}
...
...
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