Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
4122a092
提交
4122a092
authored
12月 17, 2020
作者:
Whispa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
# Conflicts: # src/main/java/com/example/afrishop_v3/models/TbCfCartRecordR.java
上级
a4207003
94bfa5f5
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
197 行增加
和
119 行删除
+197
-119
ActivityController.java
...m/example/afrishop_v3/controllers/ActivityController.java
+104
-59
BonusController.java
.../com/example/afrishop_v3/controllers/BonusController.java
+1
-1
DpoPayController.java
...com/example/afrishop_v3/controllers/DpoPayController.java
+4
-5
FlutterWaveController.java
...xample/afrishop_v3/controllers/FlutterWaveController.java
+15
-15
LogisticsController.java
.../example/afrishop_v3/controllers/LogisticsController.java
+10
-1
PaypalContoller.java
.../com/example/afrishop_v3/controllers/PaypalContoller.java
+9
-8
ProblemController.java
...om/example/afrishop_v3/controllers/ProblemController.java
+1
-1
TbCfHomePageEntityController.java
...afrishop_v3/controllers/TbCfHomePageEntityController.java
+2
-2
TbCfOrder.java
src/main/java/com/example/afrishop_v3/models/TbCfOrder.java
+41
-21
TbCfProblem.java
...main/java/com/example/afrishop_v3/models/TbCfProblem.java
+2
-0
NetworkRepository.java
...com/example/afrishop_v3/repository/NetworkRepository.java
+1
-1
TbCfClassificationRepository.java
.../afrishop_v3/repository/TbCfClassificationRepository.java
+2
-1
TbCfPosterRepository.java
.../example/afrishop_v3/repository/TbCfPosterRepository.java
+2
-1
TbCfProblemRepository.java
...example/afrishop_v3/repository/TbCfProblemRepository.java
+1
-1
WebSecurityConfig.java
...a/com/example/afrishop_v3/security/WebSecurityConfig.java
+1
-1
application.properties
src/main/resources/application.properties
+1
-1
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/ActivityController.java
浏览文件 @
4122a092
...
...
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import
java.math.BigDecimal
;
import
java.text.DateFormat
;
import
java.text.NumberFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -136,65 +137,6 @@ public class ActivityController {
return
t
;
}
@GetMapping
(
"/caculateCartDiscount"
)
public
Result
caculateCartDiscount
(
@RequestBody
String
[]
cartIds
)
{
// Activity activity = null;
// List<Activity> activityList = new ArrayList<>();
BigDecimal
itemPrice
=
BigDecimal
.
ZERO
;
BigDecimal
lessAmount
=
BigDecimal
.
ZERO
;
String
discount
=
null
;
int
itemCount
=
0
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
for
(
String
cartId
:
cartIds
)
{
Optional
<
TbCfCartRecordR
>
byId
=
cartRecordRRepository
.
findById
(
cartId
);
if
(
byId
.
isPresent
())
{
TbCfCartRecordR
cart
=
byId
.
get
();
itemPrice
=
itemPrice
.
add
(
cart
.
getItemPrice
());
itemCount
+=
cart
.
getItemNum
();
// String itemId = cart.getItemId();
// activity = checkActivity(itemId);
// activityList.add(activity);
}
}
if
(
activityRepository
.
existsByUseType
(
1
))
{
List
<
Activity
>
fullList
=
activityRepository
.
findAllByUseType
(
1
);
Activity
activity
=
fullList
.
get
(
0
);
String
type
=
activity
.
getType
().
toString
();
List
<
Condition
>
conList
=
JSONObject
.
parseArray
(
activity
.
getCondition
(),
Condition
.
class
);
Collections
.
sort
(
conList
,
Comparator
.
comparing
(
Condition:
:
getKey
));
// BigDecimal finalItemPrice = itemPrice;
if
(
"1"
.
equals
(
type
)
||
"2"
.
equals
(
type
))
{
for
(
Condition
con
:
conList
)
{
double
key
=
con
.
getKey
();
BigDecimal
threshold
=
new
BigDecimal
(
key
);
double
value
=
con
.
getValue
();
discount
=
String
.
valueOf
(
value
);
if
(
itemPrice
.
compareTo
(
threshold
)
<
0
)
{
lessAmount
=
threshold
.
subtract
(
itemPrice
);
map
.
put
(
"discount"
,
discount
);
map
.
put
(
"lessAmount"
,
lessAmount
);
}
break
;
}
}
else
if
(
"3"
.
equals
(
type
))
{
for
(
Condition
con
:
conList
)
{
int
key
=
(
int
)
con
.
getKey
();
double
value
=
con
.
getValue
();
discount
=
String
.
valueOf
(
value
);
if
(
itemCount
<
key
)
{
map
.
put
(
"discount"
,
discount
);
map
.
put
(
"lessAmount"
,
key
-
itemCount
);
}
break
;
}
}
}
return
new
Result
(
map
);
}
public
Activity
checkActivity
(
String
itemId
)
{
Result
result
=
new
Result
();
...
...
@@ -242,4 +184,107 @@ public class ActivityController {
return
activity
;
}
@PostMapping
(
"/caculateCartDiscount"
)
public
Result
caculateCartDiscount
(
@RequestBody
String
[]
cartIds
)
{
BigDecimal
itemPrice
=
BigDecimal
.
ZERO
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
NumberFormat
nf
=
NumberFormat
.
getInstance
();
List
<
Activity
>
fullList
=
activityRepository
.
findAllByUseType
(
1
);
if
(
fullList
.
size
()
==
0
||
fullList
==
null
)
return
new
Result
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
(),
"There is no online activity"
);
Activity
activity
=
fullList
.
get
(
0
);
String
type
=
activity
.
getType
().
toString
();
List
<
Condition
>
conList
=
JSONObject
.
parseArray
(
activity
.
getCondition
(),
Condition
.
class
);
Collections
.
sort
(
conList
,
Comparator
.
comparing
(
Condition:
:
getKey
));
StringBuffer
msg
=
new
StringBuffer
();
map
.
put
(
"activity"
,
activity
);
boolean
exist
=
false
;
int
itemCount
=
0
;
for
(
String
cartId
:
cartIds
)
{
Optional
<
TbCfCartRecordR
>
byId
=
cartRecordRRepository
.
findById
(
cartId
);
if
(
byId
.
isPresent
())
{
exist
=
true
;
TbCfCartRecordR
cart
=
byId
.
get
();
itemCount
+=
cart
.
getItemNum
();
itemPrice
=
itemPrice
.
add
(
cart
.
getItemPrice
()
.
multiply
(
new
BigDecimal
(
cart
.
getItemNum
())));
}
}
if
(!
exist
)
{
map
.
put
(
"message"
,
activity
.
getContent
().
trim
());
return
new
Result
(
map
);
}
BigDecimal
lessAmount
;
String
discount
;
for
(
Condition
con
:
conList
)
{
double
value
=
con
.
getValue
();
double
key
=
con
.
getKey
();
discount
=
nf
.
format
(
value
);
if
(
"1"
.
equals
(
type
))
{
discount
=
"$"
+
discount
;
}
else
{
discount
=
discount
+
"%"
;
}
if
(
"1"
.
equals
(
type
)
||
"2"
.
equals
(
type
))
{
BigDecimal
threshold
=
new
BigDecimal
(
key
);
if
(
itemPrice
.
compareTo
(
threshold
)
>=
0
)
{
msg
.
delete
(
0
,
msg
.
length
());
msg
.
append
(
"Congrats, you've got "
+
discount
+
" off ! "
);
}
else
{
lessAmount
=
threshold
.
subtract
(
itemPrice
);
String
less
=
nf
.
format
(
lessAmount
);
msg
.
append
(
"Spend "
+
less
+
" more to Enjoy "
+
discount
+
" off !"
);
break
;
}
}
else
if
(
"3"
.
equals
(
type
))
{
/**
*
* 2件9折
* 3件8折
* 5件7折
*
* 如果用户购买1件商品,提示:Buy 1 more item to Enjoy 10% off !
* 如果用户购买2件商品,提示:Congrats, you've got 30% off ! Buy 1 more item to Enjoy 20% off !
* .
* .
* .
* 如果用户购大于或者等于5件商品,提示:Congrats, you've got 30% off !
*
*/
int
num
=
(
int
)
con
.
getKey
();
if
(
itemCount
>=
num
)
{
msg
.
delete
(
0
,
msg
.
length
());
msg
.
append
(
"Congrats, you've got "
+
discount
+
" off ! "
);
}
else
{
msg
.
append
(
"Buy "
+
(
num
-
itemCount
)
+
" more item to Enjoy "
+
discount
+
" off !"
);
break
;
}
}
}
map
.
put
(
"message"
,
msg
);
return
new
Result
(
map
);
}
}
src/main/java/com/example/afrishop_v3/controllers/BonusController.java
浏览文件 @
4122a092
...
...
@@ -262,7 +262,7 @@ public class BonusController extends Controller {
private
TbCfUserInfo
runBonusInc
(
TbCfUserInfo
user
,
BigDecimal
amount
,
int
percent
,
boolean
direct
,
String
orderId
)
{
if
(
user
==
null
)
return
null
;
Optional
<
Network
>
userCode
=
networkRepository
.
findByNetworkInfoCode
(
user
.
getCode
());
Optional
<
Network
>
userCode
=
networkRepository
.
find
First
ByNetworkInfoCode
(
user
.
getCode
());
if
(
userCode
.
isPresent
()
||
direct
)
{
TbCfUserInfo
userInfo
=
direct
?
user
:
userCode
.
get
().
getUserInfo
();
Bonus
bonus
=
new
Bonus
();
...
...
src/main/java/com/example/afrishop_v3/controllers/DpoPayController.java
浏览文件 @
4122a092
...
...
@@ -421,11 +421,10 @@ public class DpoPayController extends Controller {
sendNotification
(
user
.
getFcm
(),
"Bonus alert !!"
,
user
.
display
()
+
", You received bonus of $"
+
formatter
.
format
(
v
)
+
" in your account"
);
}
}
}
TbCfUserInfo
bonusInc
=
runBonusInc
(
user
,
amount
,
5
,
false
,
orderId
);
runBonusInc
(
sharer
.
orElseGet
(()
->
postOptional
.
isPresent
()
?
postOptional
.
get
().
getRealUser
()
:
bonusInc
),
amount
,
5
,
postOptional
.
isPresent
()
||
sharer
.
isPresent
(),
orderId
);
//runBonusInc(bonusInc, amount, 0);
}
}
}
...
...
@@ -435,7 +434,7 @@ public class DpoPayController extends Controller {
private
TbCfUserInfo
runBonusInc
(
TbCfUserInfo
user
,
BigDecimal
amount
,
int
percent
,
boolean
direct
,
String
orderId
)
{
if
(
user
==
null
)
return
null
;
Optional
<
Network
>
userCode
=
networkRepository
.
findByNetworkInfoCode
(
user
.
getCode
());
Optional
<
Network
>
userCode
=
networkRepository
.
find
First
ByNetworkInfoCode
(
user
.
getCode
());
if
(
userCode
.
isPresent
()
||
direct
)
{
TbCfUserInfo
userInfo
=
direct
?
user
:
userCode
.
get
().
getUserInfo
();
Bonus
bonus
=
new
Bonus
();
...
...
src/main/java/com/example/afrishop_v3/controllers/FlutterWaveController.java
浏览文件 @
4122a092
...
...
@@ -97,7 +97,7 @@ public class FlutterWaveController extends Controller {
if
(
OrderStatusEnum
.
PAID
.
getValue
().
equals
(
orderEntity
.
getPayStatus
()))
{
json
.
put
(
"message"
,
"Order paid!"
);
json
.
put
(
"code"
,
ResultCodeEnum
.
ORDER_PAY_ERROR
.
getCode
());
}
else
{
}
else
{
try
{
String
orderPrice
=
orderEntity
.
getRealityPay
().
toString
();
CardCharge
ch
=
new
CardCharge
();
...
...
@@ -106,7 +106,7 @@ public class FlutterWaveController extends Controller {
.
setCurrency
(
"USD"
)
.
setCountry
(
"NG"
)
.
setAmount
(
orderPrice
)
.
setRedirect_url
(
REDIRECT_URL
+
"/"
+
orderId
)
.
setRedirect_url
(
REDIRECT_URL
+
"/"
+
orderId
)
.
setExpiryyear
(
flutterWaveCard
.
getYear
())
.
setExpirymonth
(
flutterWaveCard
.
getMonth
())
.
setEmail
(
flutterWaveCard
.
getEmail
())
...
...
@@ -151,7 +151,7 @@ public class FlutterWaveController extends Controller {
if
(
OrderStatusEnum
.
PAID
.
getValue
().
equals
(
orderEntity
.
getPayStatus
()))
{
json
.
put
(
"message"
,
"Order paid!"
);
json
.
put
(
"code"
,
ResultCodeEnum
.
ORDER_PAY_ERROR
.
getCode
());
}
else
{
}
else
{
try
{
CardCharge
ch
=
new
CardCharge
();
ch
.
setCardno
(
flutterWaveCard
.
getCard
())
...
...
@@ -159,7 +159,7 @@ public class FlutterWaveController extends Controller {
.
setCurrency
(
"ZMW"
)
.
setCountry
(
"NG"
)
.
setAmount
(
orderEntity
.
getRealityPay
().
toString
())
.
setRedirect_url
(
REDIRECT_URL
+
"/"
+
orderId
)
.
setRedirect_url
(
REDIRECT_URL
+
"/"
+
orderId
)
.
setExpiryyear
(
flutterWaveCard
.
getYear
())
.
setExpirymonth
(
flutterWaveCard
.
getMonth
())
.
setPhonenumber
(
flutterWaveCard
.
getPhone
())
...
...
@@ -220,7 +220,7 @@ public class FlutterWaveController extends Controller {
String
authurl
=
results
.
getString
(
"authurl"
);
if
(
"success"
.
equalsIgnoreCase
(
statusFlag
)
&&
"successful"
.
equalsIgnoreCase
(
status
))
{
TbCfUserInfo
user
=
this
.
user
.
user
();
if
(
user
.
hasFcm
()
)
{
if
(
user
.
hasFcm
())
{
sendNotification
(
user
.
getFcm
(),
"Order alert !!"
,
"Order of $"
+
tbCfOrderVo
.
getRealityPay
()
+
" has been successfully paid !!"
);
}
logger
.
info
(
"订单号"
+
orderId
+
"[flutterwave支付]校验成功时间:"
+
new
Date
());
...
...
@@ -245,8 +245,8 @@ public class FlutterWaveController extends Controller {
bonus
.
setOrderId
(
orderId
);
bonus
.
setAmount
(
tbCfOrder
.
getItemsPrice
());
System
.
out
.
println
(
"佣金-----》》》订单号:"
+
orderId
+
"=user="
+
tbCfOrder
.
getUserId
()+
"=price="
+
tbCfOrder
.
getItemsPrice
());
saveNetworkMarketing
(
bonus
,
tbCfOrder
.
getUserId
());
System
.
out
.
println
(
"佣金-----》》》订单号:"
+
orderId
+
"=user="
+
tbCfOrder
.
getUserId
()
+
"=price="
+
tbCfOrder
.
getItemsPrice
());
saveNetworkMarketing
(
bonus
,
tbCfOrder
.
getUserId
());
}
// TbCfFinanceVo tbCfFinanceVo = new TbCfFinanceVo();
// BeanUtils.copyProperties(finance, tbCfFinanceVo);
...
...
@@ -417,11 +417,11 @@ public class FlutterWaveController extends Controller {
sendNotification
(
user
.
getFcm
(),
"Bonus alert !!"
,
user
.
display
()
+
", You received bonus of $"
+
formatter
.
format
(
v
)
+
" in your account"
);
}
}
}
TbCfUserInfo
bonusInc
=
runBonusInc
(
user
,
amount
,
5
,
false
,
orderId
);
runBonusInc
(
sharer
.
orElseGet
(()
->
postOptional
.
isPresent
()
?
postOptional
.
get
().
getRealUser
()
:
bonusInc
),
amount
,
5
,
postOptional
.
isPresent
()
||
sharer
.
isPresent
(),
orderId
);
//runBonusInc(bonusInc, amount, 0);
}
}
}
...
...
@@ -431,7 +431,7 @@ public class FlutterWaveController extends Controller {
private
TbCfUserInfo
runBonusInc
(
TbCfUserInfo
user
,
BigDecimal
amount
,
int
percent
,
boolean
direct
,
String
orderId
)
{
if
(
user
==
null
)
return
null
;
Optional
<
Network
>
userCode
=
networkRepository
.
findByNetworkInfoCode
(
user
.
getCode
());
Optional
<
Network
>
userCode
=
networkRepository
.
find
First
ByNetworkInfoCode
(
user
.
getCode
());
if
(
userCode
.
isPresent
()
||
direct
)
{
TbCfUserInfo
userInfo
=
direct
?
user
:
userCode
.
get
().
getUserInfo
();
Bonus
bonus
=
new
Bonus
();
...
...
@@ -441,7 +441,7 @@ public class FlutterWaveController extends Controller {
bonus
.
setAmount
(
v
);
bonus
.
setPercentage
(
percent
);
bonus
.
setOrderId
(
orderId
);
if
(
userInfo
!=
null
&&
userInfo
.
invited
()&&
!
"000000"
.
equals
(
userInfo
.
getCode
()))
{
if
(
userInfo
!=
null
&&
userInfo
.
invited
()
&&
!
"000000"
.
equals
(
userInfo
.
getCode
()))
{
bonusRepository
.
save
(
bonus
);
// bonus = repository.save(bonus);
if
(
userInfo
.
hasFcm
())
{
...
...
src/main/java/com/example/afrishop_v3/controllers/LogisticsController.java
浏览文件 @
4122a092
...
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.example.afrishop_v3.base.Result
;
import
com.example.afrishop_v3.enums.ResultCodeEnum
;
import
com.example.afrishop_v3.models.TbCfPlatformOrder
;
import
com.example.afrishop_v3.repository.TbCfExpressTemplateRepository
;
import
com.example.afrishop_v3.repository.TbCfPlatformOrderRepository
;
import
com.example.afrishop_v3.util.HttpClientUtil
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -37,9 +38,11 @@ public class LogisticsController {
private
String
TOKEN
;
private
final
TbCfPlatformOrderRepository
repository
;
private
final
TbCfExpressTemplateRepository
expressTemplateRepository
;
public
LogisticsController
(
TbCfPlatformOrderRepository
repository
)
{
public
LogisticsController
(
TbCfPlatformOrderRepository
repository
,
TbCfExpressTemplateRepository
expressTemplateRepository
)
{
this
.
repository
=
repository
;
this
.
expressTemplateRepository
=
expressTemplateRepository
;
}
@GetMapping
(
"/getOrderLogistics/{orderDetailId}"
)
...
...
@@ -93,4 +96,10 @@ public class LogisticsController {
}
return
result
;
}
@GetMapping
(
"/freeShippingThreshold"
)
public
Result
freeShippingThreshold
(){
return
new
Result
(
expressTemplateRepository
.
findFirstByIsDefault
(
1
));
}
}
src/main/java/com/example/afrishop_v3/controllers/PaypalContoller.java
浏览文件 @
4122a092
...
...
@@ -225,8 +225,8 @@ public class PaypalContoller extends Controller {
bonus
.
setOrderId
(
orderId
);
bonus
.
setAmount
(
order1
.
getItemsPrice
());
System
.
out
.
println
(
"佣金-----》》》订单号:"
+
orderId
+
"=user="
+
order1
.
getUserId
()+
"=price="
+
order1
.
getItemsPrice
());
saveNetworkMarketing
(
bonus
,
order1
.
getUserId
());
System
.
out
.
println
(
"佣金-----》》》订单号:"
+
orderId
+
"=user="
+
order1
.
getUserId
()
+
"=price="
+
order1
.
getItemsPrice
());
saveNetworkMarketing
(
bonus
,
order1
.
getUserId
());
}
}
...
...
@@ -345,20 +345,21 @@ public class PaypalContoller extends Controller {
sendNotification
(
user
.
getFcm
(),
"Bonus alert !!"
,
user
.
display
()
+
", You received bonus of $"
+
formatter
.
format
(
v
)
+
" in your account"
);
}
}
}
TbCfUserInfo
bonusInc
=
runBonusInc
(
user
,
amount
,
5
,
false
,
orderId
);
runBonusInc
(
sharer
.
orElseGet
(()
->
postOptional
.
isPresent
()
?
postOptional
.
get
().
getRealUser
()
:
bonusInc
),
amount
,
5
,
postOptional
.
isPresent
()
||
sharer
.
isPresent
(),
orderId
);
//runBonusInc(bonusInc, amount, 0);
}
}
}
}
private
TbCfUserInfo
runBonusInc
(
TbCfUserInfo
user
,
BigDecimal
amount
,
int
percent
,
boolean
direct
,
String
orderId
)
{
if
(
user
==
null
)
return
null
;
Optional
<
Network
>
userCode
=
networkRepository
.
findByNetworkInfoCode
(
user
.
getCode
());
Optional
<
Network
>
userCode
=
networkRepository
.
find
First
ByNetworkInfoCode
(
user
.
getCode
());
if
(
userCode
.
isPresent
()
||
direct
)
{
TbCfUserInfo
userInfo
=
direct
?
user
:
userCode
.
get
().
getUserInfo
();
Bonus
bonus
=
new
Bonus
();
...
...
@@ -368,7 +369,7 @@ public class PaypalContoller extends Controller {
bonus
.
setAmount
(
v
);
bonus
.
setPercentage
(
percent
);
bonus
.
setOrderId
(
orderId
);
if
(
userInfo
!=
null
&&
userInfo
.
invited
()&&
!
"000000"
.
equals
(
userInfo
.
getCode
()))
{
if
(
userInfo
!=
null
&&
userInfo
.
invited
()
&&
!
"000000"
.
equals
(
userInfo
.
getCode
()))
{
bonusRepository
.
save
(
bonus
);
// bonus = repository.save(bonus);
if
(
userInfo
.
hasFcm
())
{
...
...
src/main/java/com/example/afrishop_v3/controllers/ProblemController.java
浏览文件 @
4122a092
...
...
@@ -30,7 +30,7 @@ public class ProblemController {
@GetMapping
(
"/{type}"
)
public
Result
getShippingClause
(
@PathVariable
Integer
type
)
throws
Exception
{
TbCfProblem
clause
=
repository
.
findFirstByType
(
type
);
TbCfProblem
clause
=
repository
.
findFirstByType
OrderByCreateTimeDesc
(
type
);
String
shippingClause
=
URLDecoder
.
decode
(
clause
.
getAnswer
(),
"utf-8"
);
TbCfProblem
problem
=
new
TbCfProblem
();
problem
.
setQuestion
(
clause
.
getQuestion
());
...
...
src/main/java/com/example/afrishop_v3/controllers/TbCfHomePageEntityController.java
浏览文件 @
4122a092
...
...
@@ -113,7 +113,7 @@ public class TbCfHomePageEntityController extends Controller {
//分类导航栏
if
(
"1"
.
equals
(
type
))
{
/*moduleMap.put("class_title", getTitleImage(1));*/
List
<
TbCfClassification
>
classificationList
=
classificationRepository
.
findAll
();
List
<
TbCfClassification
>
classificationList
=
classificationRepository
.
findAll
(
Sort
.
by
(
Sort
.
Order
.
asc
(
"sort"
))
);
moduleMap
.
put
(
"classificationList"
,
classificationList
);
}
//爬虫品牌
...
...
@@ -125,7 +125,7 @@ public class TbCfHomePageEntityController extends Controller {
//海报图
if
(
"3"
.
equals
(
type
))
{
moduleMap
.
put
(
"poster_title"
,
getTitleImage
(
3
));
List
<
TbCfPosters
>
postersList
=
posterRepository
.
findAll
();
List
<
TbCfPosters
>
postersList
=
posterRepository
.
findAll
(
Sort
.
by
(
Sort
.
Order
.
asc
(
"sort"
))
);
moduleMap
.
put
(
"postersList"
,
postersList
);
}
list
.
add
(
moduleMap
);
...
...
src/main/java/com/example/afrishop_v3/models/TbCfOrder.java
浏览文件 @
4122a092
...
...
@@ -166,7 +166,7 @@ public class TbCfOrder {
*/
private
String
remarkInfo
;
@Transient
private
BigDecimal
reduceAmount
;
@Transient
...
...
@@ -208,6 +208,14 @@ public class TbCfOrder {
this
.
orderTime
=
new
Date
();
}
public
BigDecimal
getReduceAmount
()
{
return
this
.
reduceAmount
==
null
?
BigDecimal
.
ZERO
:
reduceAmount
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
public
void
setReduceAmount
(
BigDecimal
reduceAmount
)
{
this
.
reduceAmount
=
reduceAmount
;
}
public
void
setCommentCount
(
Integer
commentCount
)
{
this
.
commentCount
=
commentCount
;
...
...
@@ -362,22 +370,34 @@ public class TbCfOrder {
*/
boolean
fullAct
=
activityRepository
.
existsByUseType
(
1
);
if
(
this
.
open
&&
fullAct
)
{
Activity
activity
=
activityRepository
.
findAllByUseType
(
1
).
get
(
0
);
Activity
act
=
null
;
List
<
Activity
>
alist
=
activityRepository
.
findAllByUseType
(
1
);
if
(
alist
!=
null
&&
alist
.
size
()
>
0
)
{
act
=
alist
.
get
(
0
);
}
Optional
<
Activity
>
optional
=
Optional
.
ofNullable
(
act
);
if
(
optional
.
isPresent
())
{
Activity
activity
=
optional
.
get
();
String
type
=
String
.
valueOf
(
activity
.
getType
());
if
(
"1"
.
equals
(
type
))
{
reduceAmount
=
caculateActFee
(
false
,
false
,
activity
,
itemsPrice
,
null
);
System
.
out
.
println
(
"减免金额:
"
+
reduceAmount
);
System
.
out
.
println
(
"减免金额:$
"
+
reduceAmount
);
}
else
if
(
"2"
.
equals
(
type
))
{
rate
=
caculateActFee
(
false
,
true
,
activity
,
itemsPrice
,
null
);
System
.
out
.
println
(
"折扣比例:"
+
rate
);
itemsPrice
=
rate
.
multiply
(
itemsPrice
);
System
.
out
.
println
(
"折扣比例:"
+
rate
.
multiply
(
new
BigDecimal
(
100
))+
"折"
);
// itemsPrice = rate.multiply(itemsPrice);
reduceAmount
=
itemsPrice
.
multiply
(
rate
);
}
else
if
(
"3"
.
equals
(
type
))
{
rate
=
caculateActFee
(
true
,
true
,
activity
,
itemsPrice
,
itemSum
);
System
.
out
.
println
(
"购买件数:"
+
itemSum
);
System
.
out
.
println
(
"折扣比例:"
+
rate
);
itemsPrice
=
rate
.
multiply
(
itemsPrice
);
System
.
out
.
println
(
"折扣比例:"
+
rate
.
multiply
(
new
BigDecimal
(
100
))+
"折"
);
// itemsPrice = rate.multiply(itemsPrice);
reduceAmount
=
itemsPrice
.
multiply
(
rate
);
}
reduceAmount
=
reduceAmount
.
setScale
(
BigDecimal
.
ROUND_HALF_UP
,
2
);
}
}
/*else {
//按活动类型计算优惠价格
Integer sum = 0;
...
...
@@ -444,7 +464,7 @@ public class TbCfOrder {
}
}
if
(
discount
)
{
result
=
new
BigDecimal
(
1
).
subtract
(
result
.
divide
(
new
BigDecimal
(
100
)
));
result
=
result
.
divide
(
new
BigDecimal
(
100
));
}
return
result
;
...
...
@@ -727,7 +747,7 @@ public class TbCfOrder {
* 获取:商品总价
*/
public
BigDecimal
getItemsPrice
()
{
return
itemsPrice
==
null
?
BigDecimal
.
ZERO
:
itemsPrice
.
setScale
(
2
,
RoundingMode
.
CEILING
);
return
itemsPrice
==
null
?
BigDecimal
.
ZERO
:
itemsPrice
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
}
/**
...
...
@@ -741,7 +761,7 @@ public class TbCfOrder {
* 获取:总价
*/
public
BigDecimal
getTotalPrice
()
{
return
totalPrice
==
null
?
BigDecimal
.
ZERO
:
totalPrice
.
setScale
(
2
,
RoundingMode
.
CEILING
);
return
totalPrice
==
null
?
BigDecimal
.
ZERO
:
totalPrice
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
}
/**
...
...
@@ -755,7 +775,7 @@ public class TbCfOrder {
* 获取:实际付款
*/
public
BigDecimal
getRealityPay
()
{
return
realityPay
==
null
?
BigDecimal
.
ZERO
:
realityPay
.
setScale
(
2
,
RoundingMode
.
CEILING
);
return
realityPay
==
null
?
BigDecimal
.
ZERO
:
realityPay
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
}
/**
...
...
@@ -802,7 +822,7 @@ public class TbCfOrder {
* 获取:快递费
*/
public
BigDecimal
getExpressCost
()
{
return
expressCost
==
null
?
BigDecimal
.
ZERO
:
expressCost
.
setScale
(
2
,
RoundingMode
.
CEILING
);
return
expressCost
==
null
?
BigDecimal
.
ZERO
:
expressCost
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
}
/**
...
...
src/main/java/com/example/afrishop_v3/models/TbCfProblem.java
浏览文件 @
4122a092
...
...
@@ -2,6 +2,7 @@ package com.example.afrishop_v3.models;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.hibernate.annotations.Where
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
...
...
@@ -10,6 +11,7 @@ import java.util.Date;
@Entity
@Getter
@Setter
@Where
(
clause
=
"enable_flag=1"
)
public
class
TbCfProblem
{
/**
* 问题id
...
...
src/main/java/com/example/afrishop_v3/repository/NetworkRepository.java
浏览文件 @
4122a092
...
...
@@ -12,7 +12,7 @@ public interface NetworkRepository extends PagingAndSortingRepository<Network,St
boolean
existsByUserInfo_CodeAndNetworkInfo_UserId
(
String
userInfo_code
,
String
networkInfo_userId
);
Network
findByUserInfo_UserIdAndNetworkInfo_UserId
(
String
user
,
String
network
);
Network
findByUserInfo_CodeAndNetworkInfo_UserId
(
String
userInfo_code
,
String
networkInfo_userId
);
Optional
<
Network
>
findByNetworkInfoCode
(
String
user_code
);
Optional
<
Network
>
find
First
ByNetworkInfoCode
(
String
user_code
);
Network
findTopByOrderByIdDesc
();
...
...
src/main/java/com/example/afrishop_v3/repository/TbCfClassificationRepository.java
浏览文件 @
4122a092
package
com
.
example
.
afrishop_v3
.
repository
;
import
com.example.afrishop_v3.models.TbCfClassification
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.repository.PagingAndSortingRepository
;
import
java.util.List
;
public
interface
TbCfClassificationRepository
extends
PagingAndSortingRepository
<
TbCfClassification
,
String
>
{
List
<
TbCfClassification
>
findAll
();
List
<
TbCfClassification
>
findAll
(
Sort
sort
);
}
src/main/java/com/example/afrishop_v3/repository/TbCfPosterRepository.java
浏览文件 @
4122a092
package
com
.
example
.
afrishop_v3
.
repository
;
import
com.example.afrishop_v3.models.TbCfPosters
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.repository.PagingAndSortingRepository
;
import
java.util.List
;
public
interface
TbCfPosterRepository
extends
PagingAndSortingRepository
<
TbCfPosters
,
String
>
{
List
<
TbCfPosters
>
findAll
();
List
<
TbCfPosters
>
findAll
(
Sort
sort
);
}
src/main/java/com/example/afrishop_v3/repository/TbCfProblemRepository.java
浏览文件 @
4122a092
...
...
@@ -5,5 +5,5 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public
interface
TbCfProblemRepository
extends
PagingAndSortingRepository
<
TbCfProblem
,
String
>
{
TbCfProblem
findFirstByType
(
Integer
type
);
TbCfProblem
findFirstByType
OrderByCreateTimeDesc
(
Integer
type
);
}
src/main/java/com/example/afrishop_v3/security/WebSecurityConfig.java
浏览文件 @
4122a092
...
...
@@ -69,7 +69,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.
sessionManagement
().
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
).
and
()
.
authorizeRequests
().
antMatchers
(
"/api/auth/**"
,
"/search/image/**"
,
"/itemStation/**"
,
"/startPage/**"
,
"/goodsType/**"
,
"/home/**"
,
"/spider/**"
,
"/store/**"
,
"/shopify/**"
,
"/community/**"
,
"/version/**"
,
"/flutterwave/notify/**"
,
"/dpo/notify/**"
,
"/advertisement/**"
,
"/website/**"
,
"/paypal/**"
,
"/discover/bonus/**"
,
"/problem/**"
,
"/cube/**"
).
permitAll
()
"/flutterwave/notify/**"
,
"/dpo/notify/**"
,
"/advertisement/**"
,
"/website/**"
,
"/paypal/**"
,
"/discover/bonus/**"
,
"/problem/**"
,
"/cube/**"
,
"/activity/**"
).
permitAll
()
.
antMatchers
(
"/api/test/**"
).
permitAll
()
.
anyRequest
().
authenticated
();
...
...
src/main/resources/application.properties
浏览文件 @
4122a092
server.servlet.context-path
=
/zion
spring.jpa.hibernate.ddl-auto
=
update
server.port
=
8083
spring.profiles.active
=
dev
spring.profiles.active
=
prod
#spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/afrishop_test?useUnicode=true&connectionCollation=utf8mb4_general_ci&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
#spring.datasource.username=root
#spring.datasource.password=Diaoyunnuli.8
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论