Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
c7afa481
提交
c7afa481
authored
12月 16, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update activity
上级
8b2ad21e
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
8 行增加
和
11 行删除
+8
-11
ActivityController.java
...m/example/afrishop_v3/controllers/ActivityController.java
+8
-11
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/ActivityController.java
浏览文件 @
c7afa481
...
@@ -138,7 +138,6 @@ public class ActivityController {
...
@@ -138,7 +138,6 @@ public class ActivityController {
}
}
public
Activity
checkActivity
(
String
itemId
)
{
public
Activity
checkActivity
(
String
itemId
)
{
Result
result
=
new
Result
();
Result
result
=
new
Result
();
Activity
activity
=
null
;
Activity
activity
=
null
;
...
@@ -207,12 +206,12 @@ public class ActivityController {
...
@@ -207,12 +206,12 @@ public class ActivityController {
StringBuffer
msg
=
new
StringBuffer
();
StringBuffer
msg
=
new
StringBuffer
();
map
.
put
(
"activity"
,
activity
);
map
.
put
(
"activity"
,
activity
);
boolean
exist
=
false
;
boolean
exist
=
false
;
int
itemCount
=
0
;
int
itemCount
=
0
;
for
(
String
cartId
:
cartIds
)
{
for
(
String
cartId
:
cartIds
)
{
Optional
<
TbCfCartRecordR
>
byId
=
cartRecordRRepository
.
findById
(
cartId
);
Optional
<
TbCfCartRecordR
>
byId
=
cartRecordRRepository
.
findById
(
cartId
);
if
(
byId
.
isPresent
())
{
if
(
byId
.
isPresent
())
{
exist
=
true
;
exist
=
true
;
TbCfCartRecordR
cart
=
byId
.
get
();
TbCfCartRecordR
cart
=
byId
.
get
();
itemCount
+=
cart
.
getItemNum
();
itemCount
+=
cart
.
getItemNum
();
itemPrice
=
itemPrice
.
add
(
cart
.
getItemPrice
()
itemPrice
=
itemPrice
.
add
(
cart
.
getItemPrice
()
...
@@ -220,8 +219,8 @@ public class ActivityController {
...
@@ -220,8 +219,8 @@ public class ActivityController {
}
}
}
}
if
(!
exist
){
if
(!
exist
)
{
map
.
put
(
"message"
,
activity
.
getContent
());
map
.
put
(
"message"
,
activity
.
getContent
().
trim
());
return
new
Result
(
map
);
return
new
Result
(
map
);
}
}
...
@@ -243,10 +242,9 @@ public class ActivityController {
...
@@ -243,10 +242,9 @@ public class ActivityController {
BigDecimal
threshold
=
new
BigDecimal
(
key
);
BigDecimal
threshold
=
new
BigDecimal
(
key
);
if
(
itemPrice
.
compareTo
(
threshold
)
>=
0
)
{
if
(
itemPrice
.
compareTo
(
threshold
)
>=
0
)
{
msg
.
delete
(
0
,
msg
.
length
());
msg
.
delete
(
0
,
msg
.
length
());
msg
.
append
(
"Congrats, you've got "
+
discount
+
" off! "
);
msg
.
append
(
"Congrats, you've got "
+
discount
+
" off! "
);
}
}
else
{
else
{
lessAmount
=
threshold
.
subtract
(
itemPrice
);
lessAmount
=
threshold
.
subtract
(
itemPrice
);
String
less
=
nf
.
format
(
lessAmount
);
String
less
=
nf
.
format
(
lessAmount
);
msg
.
append
(
"Spend "
+
less
+
" more to Enjoy "
+
discount
+
" off !"
);
msg
.
append
(
"Spend "
+
less
+
" more to Enjoy "
+
discount
+
" off !"
);
...
@@ -271,10 +269,9 @@ public class ActivityController {
...
@@ -271,10 +269,9 @@ public class ActivityController {
int
num
=
(
int
)
con
.
getKey
();
int
num
=
(
int
)
con
.
getKey
();
if
(
itemCount
>=
num
)
{
if
(
itemCount
>=
num
)
{
msg
.
delete
(
0
,
msg
.
length
());
msg
.
delete
(
0
,
msg
.
length
());
msg
.
append
(
"Congrats, you've got "
+
discount
+
" off ! "
);
msg
.
append
(
"Congrats, you've got "
+
discount
+
" off ! "
);
}
}
else
{
else
{
msg
.
append
(
"Buy "
+
(
num
-
itemCount
)
+
" more item to Enjoy "
+
discount
+
" off !"
);
msg
.
append
(
"Buy "
+
(
num
-
itemCount
)
+
" more item to Enjoy "
+
discount
+
" off !"
);
break
;
break
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论