Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
250d90e2
Commit
250d90e2
authored
Aug 20, 2021
by
hanghang.wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
满减清空购物车提示语
parent
fffc253f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
26 deletions
+71
-26
shopping-cart-application-service/src/main/java/cn/freemud/enums/ActivityPromptEnum.java
+3
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/FullSubtractionActivityServiceImpl.java
+68
-26
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/enums/ActivityPromptEnum.java
View file @
250d90e2
...
@@ -91,6 +91,9 @@ public class ActivityPromptEnum {
...
@@ -91,6 +91,9 @@ public class ActivityPromptEnum {
ELEVEN
(
11
,
"满足 X 件 减 Y 元 还差 Z元"
),
ELEVEN
(
11
,
"满足 X 件 减 Y 元 还差 Z元"
),
TWELVE
(
12
,
"已减 X 元 再买 Y 件 减 Z 元"
),
TWELVE
(
12
,
"已减 X 元 再买 Y 件 减 Z 元"
),
FIFTEEN
(
15
,
"每满 : 每满 x 件 减 Y 元 ,最高 减 Z元"
),
SIXTEEN
(
16
,
"每满 : 每满 x 件 减 Y 元 ,最高 减 Z元"
),
;
;
private
Integer
code
;
private
Integer
code
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/FullSubtractionActivityServiceImpl.java
View file @
250d90e2
...
@@ -4,6 +4,7 @@ import cn.freemud.entities.dto.*;
...
@@ -4,6 +4,7 @@ import cn.freemud.entities.dto.*;
import
cn.freemud.entities.dto.activity.ActivityQueryDto
;
import
cn.freemud.entities.dto.activity.ActivityQueryDto
;
import
cn.freemud.entities.dto.activity.ActivityQueryResponseDto
;
import
cn.freemud.entities.dto.activity.ActivityQueryResponseDto
;
import
cn.freemud.entities.vo.ActivityList
;
import
cn.freemud.entities.vo.ActivityList
;
import
cn.freemud.enums.ActivityPromptEnum
;
import
cn.freemud.enums.ActivityTypeEnum
;
import
cn.freemud.enums.ActivityTypeEnum
;
import
cn.freemud.enums.GiftTypeEnum
;
import
cn.freemud.enums.GiftTypeEnum
;
import
cn.freemud.service.ActivityService
;
import
cn.freemud.service.ActivityService
;
...
@@ -71,44 +72,85 @@ public class FullSubtractionActivityServiceImpl {
...
@@ -71,44 +72,85 @@ public class FullSubtractionActivityServiceImpl {
// 每满减
// 每满减
if
(
Objects
.
equals
(
ActivityTypeEnum
.
TYPE_11
.
getCode
(),
activityResponseDto
.
getActivityType
()))
{
if
(
Objects
.
equals
(
ActivityTypeEnum
.
TYPE_11
.
getCode
(),
activityResponseDto
.
getActivityType
()))
{
benefitBeanDto
=
benefitBeanDtos
.
get
(
0
);
benefitBeanDto
=
benefitBeanDtos
.
get
(
0
);
messageBuilder
.
append
(
"每满 <span style=\"color:#fa5555\">"
)
//此处的getCouponType == getPreferentialType 优惠类型
.
append
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getThresholdAmount
()
*
1.00
/
100
))
if
(
ActivityPromptEnum
.
PreferentialTypeEnum
.
TO_ORDER_ITEM_QUANTITY
.
getCode
().
equals
(
activityResponseDto
.
getCouponType
()))
{
.
append
(
"</span> 减 <span style=\"color:#fa5555\">"
)
messageBuilder
.
append
(
"每满 <span style=\"color:#fa5555\">"
)
.
append
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
))
.
append
(
benefitBeanDto
.
getBenefitNumber
())
.
append
(
"</span> "
)
.
append
(
"</span>件 减 <span style=\"color:#fa5555\">"
)
.
append
(
"最高减 <span style=\"color:#fa5555\">"
)
.
append
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
))
.
append
(
WebUtil
.
formatAmount
(
activityResponseDto
.
getMaxMoney
()
*
1.00
/
100
))
.
append
(
"</span> "
)
.
append
(
"</span> 元"
);
.
append
(
"元 最高减 <span style=\"color:#fa5555\">"
)
//满足 x 元 减 Y 元 ,最高 减 Z元
.
append
(
WebUtil
.
formatAmount
(
activityResponseDto
.
getMaxMoney
()
*
1.00
/
100
))
cn
.
freemud
.
entities
.
vo
.
ActivityList
notInShopping
=
new
ActivityList
();
.
append
(
"</span> 元"
);
notInShopping
.
setTipType
(
1
);
//满足 x 元 减 Y 元 ,最高 减 Z元
notInShopping
.
setSatisfy
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getThresholdAmount
()
*
1.00
/
100
).
toString
());
ActivityList
notInShopping
=
new
ActivityList
();
notInShopping
.
setDeduct
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
).
toString
());
notInShopping
.
setTipType
(
ActivityPromptEnum
.
TipTypeEnum
.
FIFTEEN
.
getCode
());
notInShopping
.
setMaxDeduct
(
WebUtil
.
formatAmount
(
activityResponseDto
.
getMaxMoney
()
*
1.00
/
100
).
toString
());
notInShopping
.
setSatisfy
(
benefitBeanDto
.
getBenefitNumber
().
toString
());
activityList
.
add
(
notInShopping
);
notInShopping
.
setDeduct
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
).
toString
());
arrayList
.
add
(
notInShopping
);
notInShopping
.
setMaxDeduct
(
WebUtil
.
formatAmount
(
activityResponseDto
.
getMaxMoney
()
*
1.00
/
100
).
toString
());
activityList
.
add
(
notInShopping
);
arrayList
.
add
(
notInShopping
);
}
else
{
messageBuilder
.
append
(
"每满 <span style=\"color:#fa5555\">"
)
.
append
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getThresholdAmount
()
*
1.00
/
100
))
.
append
(
"</span> 减 <span style=\"color:#fa5555\">"
)
.
append
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
))
.
append
(
"</span> "
)
.
append
(
"最高减 <span style=\"color:#fa5555\">"
)
.
append
(
WebUtil
.
formatAmount
(
activityResponseDto
.
getMaxMoney
()
*
1.00
/
100
))
.
append
(
"</span> 元"
);
//满足 x 元 减 Y 元 ,最高 减 Z元
cn
.
freemud
.
entities
.
vo
.
ActivityList
notInShopping
=
new
ActivityList
();
notInShopping
.
setTipType
(
1
);
notInShopping
.
setSatisfy
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getThresholdAmount
()
*
1.00
/
100
).
toString
());
notInShopping
.
setDeduct
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
).
toString
());
notInShopping
.
setMaxDeduct
(
WebUtil
.
formatAmount
(
activityResponseDto
.
getMaxMoney
()
*
1.00
/
100
).
toString
());
activityList
.
add
(
notInShopping
);
arrayList
.
add
(
notInShopping
);
}
}
}
if
(
Objects
.
equals
(
ActivityTypeEnum
.
TYPE_12
.
getCode
(),
activityResponseDto
.
getActivityType
()))
{
if
(
Objects
.
equals
(
ActivityTypeEnum
.
TYPE_12
.
getCode
(),
activityResponseDto
.
getActivityType
()))
{
int
len
=
benefitBeanDtos
.
size
();
int
len
=
benefitBeanDtos
.
size
();
// // 购物车中无商品或者存在与满减互斥的活动
// // 购物车中无商品或者存在与满减互斥的活动
for
(
int
i
=
len
-
1
,
j
=
0
;
i
>=
0
&&
j
<
2
;
i
--,
j
++)
{
for
(
int
i
=
len
-
1
,
j
=
0
;
i
>=
0
&&
j
<
2
;
i
--,
j
++)
{
benefitBeanDto
=
benefitBeanDtos
.
get
(
i
);
benefitBeanDto
=
benefitBeanDtos
.
get
(
i
);
messageBuilder
.
append
(
"满 <span style=\"color:#fa5555\">"
)
if
(
ActivityPromptEnum
.
PreferentialTypeEnum
.
TO_ORDER_ITEM_QUANTITY
.
getCode
().
equals
(
activityResponseDto
.
getCouponType
()))
{
.
append
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getThresholdAmount
()
*
1.00
/
100
))
messageBuilder
.
append
(
"满 <span style=\"color:#fa5555\">"
)
.
append
(
"</span> 减 <span style=\"color:#fa5555\">"
)
.
append
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getBenefitNumber
()
*
1.00
/
100
))
.
append
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
))
.
append
(
"</span>件 减 <span style=\"color:#fa5555\">"
)
.
append
(
"</span> 元"
);
.
append
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
))
.
append
(
"</span> 元"
);
}
else
{
messageBuilder
.
append
(
"满 <span style=\"color:#fa5555\">"
)
.
append
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getThresholdAmount
()
*
1.00
/
100
))
.
append
(
"</span> 减 <span style=\"color:#fa5555\">"
)
.
append
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
))
.
append
(
"</span> 元"
);
}
}
}
// 阶梯满减:满足 X 元 减 Y 元,
// 阶梯满减:满足 X 元 减 Y 元,
for
(
int
j
=
len
-
1
;
j
>=
0
;
j
--)
{
for
(
int
j
=
len
-
1
;
j
>=
0
;
j
--)
{
benefitBeanDto
=
benefitBeanDtos
.
get
(
j
);
benefitBeanDto
=
benefitBeanDtos
.
get
(
j
);
cn
.
freemud
.
entities
.
vo
.
ActivityList
notInShopping
=
new
ActivityList
();
cn
.
freemud
.
entities
.
vo
.
ActivityList
notInShopping
=
new
ActivityList
();
notInShopping
.
setTipType
(
2
);
if
(
ActivityPromptEnum
.
PreferentialTypeEnum
.
TO_ORDER_ITEM_QUANTITY
.
getCode
().
equals
(
activityResponseDto
.
getCouponType
()))
{
notInShopping
.
setSatisfy
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getThresholdAmount
()
*
1.00
/
100
).
toString
());
notInShopping
.
setTipType
(
ActivityPromptEnum
.
TipTypeEnum
.
SIXTEEN
.
getCode
());
notInShopping
.
setDeduct
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
).
toString
());
notInShopping
.
setSatisfy
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getBenefitNumber
()
*
1.00
/
100
).
toString
());
activityList
.
add
(
notInShopping
);
notInShopping
.
setDeduct
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
).
toString
());
arrayList
.
add
(
notInShopping
);
activityList
.
add
(
notInShopping
);
arrayList
.
add
(
notInShopping
);
}
else
{
notInShopping
.
setTipType
(
2
);
notInShopping
.
setSatisfy
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getThresholdAmount
()
*
1.00
/
100
).
toString
());
notInShopping
.
setDeduct
(
WebUtil
.
formatAmount
(
benefitBeanDto
.
getDiscountAmount
()
*
1.00
/
100
).
toString
());
activityList
.
add
(
notInShopping
);
arrayList
.
add
(
notInShopping
);
}
}
}
}
}
if
(
Objects
.
equals
(
ActivityTypeEnum
.
TYPE_230
.
getCode
(),
activityResponseDto
.
getActivityType
()))
{
if
(
Objects
.
equals
(
ActivityTypeEnum
.
TYPE_230
.
getCode
(),
activityResponseDto
.
getActivityType
()))
{
...
...
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