Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
85e2e979
提交
85e2e979
authored
10月 10, 2020
作者:
Whispa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
commit
上级
ec7aa83a
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
32 行增加
和
2 行删除
+32
-2
CartController.java
...a/com/example/afrishop_v3/controllers/CartController.java
+10
-0
OrderController.java
.../com/example/afrishop_v3/controllers/OrderController.java
+12
-1
TbCfOrder.java
src/main/java/com/example/afrishop_v3/models/TbCfOrder.java
+8
-0
TbCfExpressTemplateRepository.java
...afrishop_v3/repository/TbCfExpressTemplateRepository.java
+2
-1
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/CartController.java
浏览文件 @
85e2e979
...
...
@@ -170,6 +170,16 @@ public class CartController extends Controller {
if
(
expressTemplate
!=
null
)
{
tbCfItemDetail
.
setItemCategory
(
expressTemplate
.
getTemplateId
());
tbCfItemDetail
.
setTemplate
(
expressTemplate
);
}
else
{
// For crawling products
Optional
<
TbCfExpressTemplate
>
templateOptional
=
templateRepository
.
findFirstByIsDefault
(
1
);
if
(
templateOptional
.
isPresent
()
){
TbCfExpressTemplate
template
=
templateOptional
.
get
();
tbCfItemDetail
.
setItemCategory
(
template
.
getTemplateId
());
tbCfItemDetail
.
setTemplate
(
template
);
}
}
//}
}
...
...
src/main/java/com/example/afrishop_v3/controllers/OrderController.java
浏览文件 @
85e2e979
...
...
@@ -36,14 +36,16 @@ public class OrderController extends Controller {
private
final
TbCfToicouponRepository
toicouponRepository
;
private
final
TbCfStationItemRepository
itemRepository
;
private
final
TbCfItemCommentRepository
commentRepository
;
private
final
TbCfExpressTemplateRepository
templateRepository
;
private
final
AuthenticationUser
user
;
public
OrderController
(
TbCfOrderRepository
repository
,
TbCfCartRecordRRepository
cartRepository
,
TbCfToicouponRepository
toicouponRepository
,
TbCfStationItemRepository
itemRepository
,
TbCfItemCommentRepository
commentRepository
,
AuthenticationUser
user
)
{
public
OrderController
(
TbCfOrderRepository
repository
,
TbCfCartRecordRRepository
cartRepository
,
TbCfToicouponRepository
toicouponRepository
,
TbCfStationItemRepository
itemRepository
,
TbCfItemCommentRepository
commentRepository
,
TbCfExpressTemplateRepository
templateRepository
,
AuthenticationUser
user
)
{
this
.
repository
=
repository
;
this
.
cartRepository
=
cartRepository
;
this
.
toicouponRepository
=
toicouponRepository
;
this
.
itemRepository
=
itemRepository
;
this
.
commentRepository
=
commentRepository
;
this
.
templateRepository
=
templateRepository
;
this
.
user
=
user
;
}
...
...
@@ -72,6 +74,9 @@ public class OrderController extends Controller {
@RequestParam
(
value
=
"toitableId"
,
required
=
false
)
String
toitableId
)
{
TbCfOrder
order
=
new
TbCfOrder
();
Optional
<
TbCfExpressTemplate
>
templateOptional
=
templateRepository
.
findFirstByIsDefault
(
1
);
templateOptional
.
ifPresent
(
order:
:
setDefaultTemplate
);
if
(
StringUtils
.
isBlank
(
itemId
)
||
itemNum
==
null
||
itemNum
<=
0
||
itemPrice
==
null
||
itemPrice
<=
0
)
return
new
Result
<>(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
(),
"Missing information !"
);
...
...
@@ -114,6 +119,8 @@ public class OrderController extends Controller {
TbCfOrder
order
=
new
TbCfOrder
();
Optional
<
TbCfExpressTemplate
>
templateOptional
=
templateRepository
.
findFirstByIsDefault
(
1
);
templateOptional
.
ifPresent
(
order:
:
setDefaultTemplate
);
order
.
setCouponId
(
toitableId
);
...
...
@@ -184,6 +191,10 @@ public class OrderController extends Controller {
TbCfOrder
order
=
new
TbCfOrder
();
Optional
<
TbCfExpressTemplate
>
templateOptional
=
templateRepository
.
findFirstByIsDefault
(
1
);
templateOptional
.
ifPresent
(
order:
:
setDefaultTemplate
);
order
.
setOrderId
(
IdUtil
.
createIdbyUUID
());
...
...
src/main/java/com/example/afrishop_v3/models/TbCfOrder.java
浏览文件 @
85e2e979
...
...
@@ -149,6 +149,8 @@ public class TbCfOrder {
*/
private
String
remarkInfo
;
private
TbCfExpressTemplate
defaultTemplate
;
public
TbCfOrder
()
{
this
.
orderStatus
=
OrderStatusEnum
.
PENDING_PAY
.
getValue
();
this
.
enableFlag
=
StateConstant
.
VALID
;
...
...
@@ -202,6 +204,11 @@ public class TbCfOrder {
setOrderNo
(
String
.
valueOf
(
IdUtil
.
createLongIdByDate
()));
}
public
void
setDefaultTemplate
(
TbCfExpressTemplate
defaultTemplate
)
{
this
.
defaultTemplate
=
defaultTemplate
;
}
private
void
doSomeCalculations
()
{
itemsPrice
=
itemsPrice
==
null
?
new
BigDecimal
(
0.0
)
:
itemsPrice
;
expressCost
=
expressCost
==
null
?
new
BigDecimal
(
0.0
)
:
expressCost
;
...
...
@@ -212,6 +219,7 @@ public class TbCfOrder {
itemOrderList
.
forEach
(
item
->
{
BigDecimal
itemPrice
=
item
.
getItemPriceTotal
();
TbCfExpressTemplate
template
=
item
.
getTemplate
();
template
=
template
==
null
?
defaultTemplate
:
template
;
itemsPrice
=
itemsPrice
.
add
(
itemPrice
);
tax
=
tax
.
add
(
calculateDutyFee
(
itemPrice
,
template
));
fee
=
fee
.
add
(
calculateHandlingFee
(
itemPrice
,
template
));
...
...
src/main/java/com/example/afrishop_v3/repository/TbCfExpressTemplateRepository.java
浏览文件 @
85e2e979
...
...
@@ -6,12 +6,13 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import
org.springframework.data.repository.query.Param
;
import
java.util.List
;
import
java.util.Optional
;
public
interface
TbCfExpressTemplateRepository
extends
PagingAndSortingRepository
<
TbCfExpressTemplate
,
String
>
{
@Query
(
value
=
"select distinct t2 from TbCfExpTemKeyword t1 left join #{#entityName} t2 on t1.templateId=t2.templateId"
+
" where t1.keyword LIKE concat('%',:keyword,'%') or t1.enkeyword LIKE concat('%',:keyword,'%')"
)
List
<
TbCfExpressTemplate
>
getTemplateByKeyword
(
@Param
(
"keyword"
)
String
keyword
);
TbCfExpressTemplate
findFirstByOrderByTemplateIdAsc
(
);
Optional
<
TbCfExpressTemplate
>
findFirstByIsDefault
(
Integer
isDefault
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论