Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
65ea4a83
提交
65ea4a83
authored
1月 07, 2021
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化
上级
c14cc3db
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
19 行增加
和
14 行删除
+19
-14
BonusController.java
.../com/example/afrishop_v3/controllers/BonusController.java
+9
-3
FlutterWaveController.java
...xample/afrishop_v3/controllers/FlutterWaveController.java
+2
-2
Bonus.java
src/main/java/com/example/afrishop_v3/models/Bonus.java
+8
-9
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/BonusController.java
浏览文件 @
65ea4a83
...
@@ -89,7 +89,9 @@ public class BonusController extends Controller {
...
@@ -89,7 +89,9 @@ public class BonusController extends Controller {
nativeQuery
.
setParameter
(
"year"
,
year
);
nativeQuery
.
setParameter
(
"year"
,
year
);
List
<
Bonus
>
bonuses
=
repository
.
findAllByUser_IdAndCreateDateMonthAndCreateDateYear
(
byId
.
get
(),
month
,
year
,
PageRequest
.
of
(
pageNo
,
pageSize
)).
toList
();
List
<
Bonus
>
bonuses
=
repository
.
findAllByUser_IdAndCreateDateMonthAndCreateDateYear
(
byId
.
get
(),
month
,
year
,
PageRequest
.
of
(
pageNo
,
pageSize
)).
toList
();
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
hashMap
.
put
(
"total"
,
BigDecimal
.
valueOf
((
double
)
nativeQuery
.
getSingleResult
()).
setScale
(
3
,
RoundingMode
.
HALF_UP
));
Double
singleResult
=
(
Double
)
nativeQuery
.
getSingleResult
();
BigDecimal
totalBonus
=
BigDecimal
.
valueOf
(
singleResult
);
hashMap
.
put
(
"total"
,
totalBonus
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
BigDecimal
.
ZERO
:
totalBonus
.
setScale
(
3
,
BigDecimal
.
ROUND_DOWN
));
hashMap
.
put
(
"list"
,
bonuses
);
hashMap
.
put
(
"list"
,
bonuses
);
return
hashMap
;
return
hashMap
;
}
}
...
@@ -123,7 +125,9 @@ public class BonusController extends Controller {
...
@@ -123,7 +125,9 @@ public class BonusController extends Controller {
nativeQuery
.
setParameter
(
"year"
,
year
);
nativeQuery
.
setParameter
(
"year"
,
year
);
List
<
Bonus
>
bonuses
=
repository
.
findAllByUser_IdAndCreateDateMonthAndCreateDateYear
(
byId
.
get
(),
month
,
year
,
PageRequest
.
of
(
pageNo
,
pageSize
)).
toList
();
List
<
Bonus
>
bonuses
=
repository
.
findAllByUser_IdAndCreateDateMonthAndCreateDateYear
(
byId
.
get
(),
month
,
year
,
PageRequest
.
of
(
pageNo
,
pageSize
)).
toList
();
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
hashMap
.
put
(
"total"
,
BigDecimal
.
valueOf
((
double
)
nativeQuery
.
getSingleResult
()).
setScale
(
3
,
RoundingMode
.
HALF_UP
));
Double
singleResult
=
(
Double
)
nativeQuery
.
getSingleResult
();
BigDecimal
totalBonus
=
BigDecimal
.
valueOf
(
singleResult
);
hashMap
.
put
(
"total"
,
totalBonus
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
BigDecimal
.
ZERO
:
totalBonus
.
setScale
(
3
,
BigDecimal
.
ROUND_DOWN
));
hashMap
.
put
(
"list"
,
bonuses
);
hashMap
.
put
(
"list"
,
bonuses
);
return
hashMap
;
return
hashMap
;
}
}
...
@@ -151,7 +155,9 @@ public class BonusController extends Controller {
...
@@ -151,7 +155,9 @@ public class BonusController extends Controller {
nativeQuery
.
setParameter
(
"year"
,
year
);
nativeQuery
.
setParameter
(
"year"
,
year
);
List
<
Bonus
>
bonuses
=
repository
.
findAllByUser_IdAndCreateDate
(
byId
.
get
(),
dayOfYear
,
year
,
PageRequest
.
of
(
pageNo
,
pageSize
)).
toList
();
List
<
Bonus
>
bonuses
=
repository
.
findAllByUser_IdAndCreateDate
(
byId
.
get
(),
dayOfYear
,
year
,
PageRequest
.
of
(
pageNo
,
pageSize
)).
toList
();
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
hashMap
.
put
(
"total"
,
BigDecimal
.
valueOf
((
double
)
nativeQuery
.
getSingleResult
()).
setScale
(
3
,
RoundingMode
.
HALF_UP
));
Double
singleResult
=
(
Double
)
nativeQuery
.
getSingleResult
();
BigDecimal
totalBonus
=
BigDecimal
.
valueOf
(
singleResult
);
hashMap
.
put
(
"total"
,
totalBonus
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
BigDecimal
.
ZERO
:
totalBonus
.
setScale
(
3
,
BigDecimal
.
ROUND_DOWN
));
hashMap
.
put
(
"list"
,
bonuses
);
hashMap
.
put
(
"list"
,
bonuses
);
return
hashMap
;
return
hashMap
;
}
}
...
...
src/main/java/com/example/afrishop_v3/controllers/FlutterWaveController.java
浏览文件 @
65ea4a83
...
@@ -81,7 +81,7 @@ public class FlutterWaveController extends Controller {
...
@@ -81,7 +81,7 @@ public class FlutterWaveController extends Controller {
public
ResponseEntity
<
String
>
payForOrderByCard
(
@RequestParam
(
"orderId"
)
String
orderId
,
@RequestBody
FlutterWaveCard
flutterWaveCard
)
{
public
ResponseEntity
<
String
>
payForOrderByCard
(
@RequestParam
(
"orderId"
)
String
orderId
,
@RequestBody
FlutterWaveCard
flutterWaveCard
)
{
RaveConstant
.
PUBLIC_KEY
=
PUBLIC_KEY
;
RaveConstant
.
PUBLIC_KEY
=
PUBLIC_KEY
;
RaveConstant
.
SECRET_KEY
=
SECRET_KEY
;
RaveConstant
.
SECRET_KEY
=
SECRET_KEY
;
RaveConstant
.
ENVIRONMENT
=
Environment
.
LIVE
;
//or live
RaveConstant
.
ENVIRONMENT
=
Environment
.
STAGING
;
//or live
// Result result = new Result();
// Result result = new Result();
Optional
<
TbCfOrder
>
byId
=
repository
.
findById
(
orderId
);
Optional
<
TbCfOrder
>
byId
=
repository
.
findById
(
orderId
);
...
@@ -135,7 +135,7 @@ public class FlutterWaveController extends Controller {
...
@@ -135,7 +135,7 @@ public class FlutterWaveController extends Controller {
public
ResponseEntity
<
String
>
payForOrderByPhone
(
@RequestParam
(
"orderId"
)
String
orderId
,
@RequestBody
FlutterWaveCard
flutterWaveCard
)
{
public
ResponseEntity
<
String
>
payForOrderByPhone
(
@RequestParam
(
"orderId"
)
String
orderId
,
@RequestBody
FlutterWaveCard
flutterWaveCard
)
{
RaveConstant
.
PUBLIC_KEY
=
PUBLIC_KEY
;
RaveConstant
.
PUBLIC_KEY
=
PUBLIC_KEY
;
RaveConstant
.
SECRET_KEY
=
SECRET_KEY
;
RaveConstant
.
SECRET_KEY
=
SECRET_KEY
;
RaveConstant
.
ENVIRONMENT
=
Environment
.
LIVE
;
//or live
RaveConstant
.
ENVIRONMENT
=
Environment
.
STAGING
;
//or live
// Result result = new Result();
// Result result = new Result();
Optional
<
TbCfOrder
>
byId
=
repository
.
findById
(
orderId
);
Optional
<
TbCfOrder
>
byId
=
repository
.
findById
(
orderId
);
...
...
src/main/java/com/example/afrishop_v3/models/Bonus.java
浏览文件 @
65ea4a83
...
@@ -45,7 +45,7 @@ public class Bonus extends Model {
...
@@ -45,7 +45,7 @@ public class Bonus extends Model {
private
boolean
status
=
false
;
private
boolean
status
=
false
;
@Column
(
columnDefinition
=
"is_withdraw"
,
name
=
"is_withdraw"
)
@Column
(
columnDefinition
=
"is_withdraw"
,
name
=
"is_withdraw"
)
public
boolean
withdraw
=
false
;
public
boolean
withdraw
=
false
;
@Transient
@Transient
...
@@ -89,28 +89,27 @@ public class Bonus extends Model {
...
@@ -89,28 +89,27 @@ public class Bonus extends Model {
}
}
public
BigDecimal
getAmount
()
{
public
BigDecimal
getAmount
()
{
return
amount
==
null
?
BigDecimal
.
ZERO
:
amount
.
setScale
(
3
,
RoundingMode
.
HALF_UP
);
return
(
amount
==
null
||
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
?
BigDecimal
.
ZERO
:
amount
.
setScale
(
3
,
BigDecimal
.
ROUND_DOWN
);
}
}
public
void
setAmount
(
BigDecimal
amount
)
{
public
void
setAmount
(
BigDecimal
amount
)
{
this
.
amount
=
amount
;
this
.
amount
=
amount
;
}
}
private
void
withDrawChange
(){
private
void
withDrawChange
()
{
this
.
withdraw
=
true
;
this
.
withdraw
=
true
;
}
}
public
void
reverseAmount
(){
public
void
reverseAmount
()
{
this
.
withDrawChange
();
this
.
withDrawChange
();
amount
=
getAmount
().
multiply
(
BigDecimal
.
valueOf
(-
1
));
amount
=
getAmount
().
multiply
(
BigDecimal
.
valueOf
(-
1
));
}
}
public
String
getUserId
(){
public
String
getUserId
()
{
return
userInfo
==
null
?
null
:
userInfo
.
getUserId
();
return
userInfo
==
null
?
null
:
userInfo
.
getUserId
();
}
}
public
void
setPercentage
(
double
percentage
)
{
public
void
setPercentage
(
double
percentage
)
{
this
.
percentage
=
percentage
;
this
.
percentage
=
percentage
;
}
}
...
@@ -124,8 +123,8 @@ public class Bonus extends Model {
...
@@ -124,8 +123,8 @@ public class Bonus extends Model {
this
.
userInfo
=
userInfo
;
this
.
userInfo
=
userInfo
;
}
}
public
Optional
<
String
>
userId
(){
public
Optional
<
String
>
userId
()
{
return
userInfo
==
null
?
Optional
.
empty
()
:
Optional
.
ofNullable
(
userInfo
.
getUserId
());
return
userInfo
==
null
?
Optional
.
empty
()
:
Optional
.
ofNullable
(
userInfo
.
getUserId
());
}
}
public
void
setItem
(
Item
item
)
{
public
void
setItem
(
Item
item
)
{
...
@@ -136,7 +135,7 @@ public class Bonus extends Model {
...
@@ -136,7 +135,7 @@ public class Bonus extends Model {
this
.
stationItem
=
stationItem
;
this
.
stationItem
=
stationItem
;
}
}
public
Date
getDate
(){
public
Date
getDate
()
{
return
createDate
;
return
createDate
;
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论