Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
2e1b9aaf
Commit
2e1b9aaf
authored
Sep 07, 2019
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加部分代码
parent
b5ecf3c7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
37 deletions
+59
-37
OrderCalculateBiz.java
.../com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
+55
-0
OrderCancelBiz.java
...ava/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
+4
-37
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
View file @
2e1b9aaf
...
@@ -5,13 +5,18 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
...
@@ -5,13 +5,18 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.activity.entity.Coupon
;
import
com.xxfc.platform.activity.feign.ActivityFeign
;
import
com.xxfc.platform.app.entity.Cofig
;
import
com.xxfc.platform.app.entity.Cofig
;
import
com.xxfc.platform.app.feign.ConfigFeign
;
import
com.xxfc.platform.app.feign.ConfigFeign
;
import
com.xxfc.platform.order.biz.OrderItemBiz
;
import
com.xxfc.platform.order.biz.OrderRefundBiz
;
import
com.xxfc.platform.order.biz.OrderRefundBiz
;
import
com.xxfc.platform.order.contant.enumerate.ItemTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.RefundStatusEnum
;
import
com.xxfc.platform.order.contant.enumerate.RefundStatusEnum
;
import
com.xxfc.platform.order.contant.enumerate.RefundTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.RefundTypeEnum
;
import
com.xxfc.platform.order.entity.*
;
import
com.xxfc.platform.order.entity.*
;
import
com.xxfc.platform.order.pojo.calculate.InProgressVO
;
import
com.xxfc.platform.universal.constant.DictionaryKey
;
import
com.xxfc.platform.universal.constant.DictionaryKey
;
import
com.xxfc.platform.universal.dto.SmsTemplateDTO
;
import
com.xxfc.platform.universal.dto.SmsTemplateDTO
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.entity.Dictionary
;
...
@@ -20,6 +25,7 @@ import com.xxfc.platform.vehicle.entity.BranchCompany;
...
@@ -20,6 +25,7 @@ import com.xxfc.platform.vehicle.entity.BranchCompany;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
com.xxfc.platform.vehicle.pojo.CompanyDetail
;
import
com.xxfc.platform.vehicle.pojo.CompanyDetail
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.assertj.core.util.Lists
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -56,8 +62,57 @@ public class OrderCalculateBiz {
...
@@ -56,8 +62,57 @@ public class OrderCalculateBiz {
@Autowired
@Autowired
ConfigFeign
configFeign
;
ConfigFeign
configFeign
;
@Autowired
ActivityFeign
activityFeign
;
@Autowired
@Autowired
OrderRefundBiz
orderRefundBiz
;
OrderRefundBiz
orderRefundBiz
;
@Autowired
OrderItemBiz
orderItemBiz
;
public
InProgressVO
inProgressCalculate
(
BaseOrder
baseOrder
,
OrderItem
orderItem
,
Integer
freeDays
,
Integer
useDays
)
{
//计算:剩余免费天数
Integer
backFreeDays
=
freeDays
-
useDays
;
//过了出发时间取消订单 ,优先使用免费天数
if
(
backFreeDays
<=
0
)
{
//大于总天数 只返回押金
if
(
useDays
>=
orderItem
.
getTotalNum
())
{
//退押金
//orderRefundBiz.rentRefundDepositProcess(hasUpdateOrder, orvd.getDeposit(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, freeDayAmount);
}
else
{
//需要扣除订单费用
//判断是否达到优惠券条件 不符合则返还优惠券
Integer
consumeDays
=
0
-
backFreeDays
;
//计算使用天数的费用
BigDecimal
consumeAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
consumeDays
+
""
));
List
<
String
>
backCouponNos
=
Lists
.
newArrayList
();
List
<
BigDecimal
>
couponAmounts
=
Lists
.
newArrayList
();
for
(
String
tickerNo
:
baseOrder
.
getCouponTickerNos
().
split
(
","
))
{
BigDecimal
couponAmount
=
activityFeign
.
use
(
baseOrder
.
getUserId
(),
Lists
.
newArrayList
(
tickerNo
),
baseOrder
.
getNo
(),
Coupon
.
CHANNEL_RENT
,
consumeAmount
,
ActivityFeign
.
TYPE_CHECK
);
if
(
couponAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
//能够使用优惠券,则不返还
couponAmounts
.
add
(
couponAmount
);
}
else
{
backCouponNos
.
add
(
tickerNo
);
}
}
}
}
else
{
//返回剩余免费天数,返回优惠券,订单款
}
return
new
InProgressVO
();
}
public
InProgressVO
inProgressCalculate
(
BaseOrder
baseOrder
,
Integer
useDays
)
{
OrderItem
orderItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
VEHICLE_MODEL
.
getCode
());
setOrderId
(
baseOrder
.
getId
());
}});
Integer
freeDays
=
(
null
==
orderItem
.
getCutNum
())?
0
:
orderItem
.
getCutNum
();
return
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
);
}
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
View file @
2e1b9aaf
...
@@ -59,6 +59,9 @@ public class OrderCancelBiz {
...
@@ -59,6 +59,9 @@ public class OrderCancelBiz {
@Autowired
@Autowired
OrderMsgBiz
orderMsgBiz
;
OrderMsgBiz
orderMsgBiz
;
@Autowired
OrderCalculateBiz
orderCalculateBiz
;
@Autowired
@Autowired
UserFeign
userFeign
;
UserFeign
userFeign
;
...
@@ -135,7 +138,7 @@ public class OrderCancelBiz {
...
@@ -135,7 +138,7 @@ public class OrderCancelBiz {
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long
useTimeLag
=
System
.
currentTimeMillis
()
-
orvd
.
getStartTime
();
Long
useTimeLag
=
System
.
currentTimeMillis
()
-
orvd
.
getStartTime
();
Integer
useDays
=
new
BigDecimal
(
useTimeLag
+
""
).
divide
(
new
BigDecimal
((
24
*
60
*
60
*
1000
)+
""
)).
setScale
(
0
,
BigDecimal
.
ROUND_UP
).
intValue
();
Integer
useDays
=
new
BigDecimal
(
useTimeLag
+
""
).
divide
(
new
BigDecimal
((
24
*
60
*
60
*
1000
)+
""
)).
setScale
(
0
,
BigDecimal
.
ROUND_UP
).
intValue
();
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
);
orderCalculateBiz
.
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
);
}
else
{
}
else
{
//没到出车时间
//没到出车时间
...
@@ -226,40 +229,4 @@ public class OrderCancelBiz {
...
@@ -226,40 +229,4 @@ public class OrderCancelBiz {
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
}
}
}
private
InProgressVO
inProgressCalculate
(
BaseOrder
baseOrder
,
OrderItem
orderItem
,
Integer
freeDays
,
Integer
useDays
)
{
//计算:剩余免费天数
Integer
backFreeDays
=
freeDays
-
useDays
;
//过了出发时间取消订单 ,优先使用免费天数
if
(
backFreeDays
<=
0
)
{
//大于总天数 只返回押金
if
(
useDays
>=
orderItem
.
getTotalNum
())
{
//退押金
//orderRefundBiz.rentRefundDepositProcess(hasUpdateOrder, orvd.getDeposit(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, freeDayAmount);
}
else
{
//需要扣除订单费用
//判断是否达到优惠券条件 不符合则返还优惠券
Integer
consumeDays
=
0
-
backFreeDays
;
//计算使用天数的费用
BigDecimal
consumeAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
consumeDays
+
""
));
List
<
String
>
backCouponNos
=
Lists
.
newArrayList
();
List
<
BigDecimal
>
couponAmounts
=
Lists
.
newArrayList
();
for
(
String
tickerNo
:
baseOrder
.
getCouponTickerNos
().
split
(
","
))
{
BigDecimal
couponAmount
=
activityFeign
.
use
(
baseOrder
.
getUserId
(),
Lists
.
newArrayList
(
tickerNo
),
baseOrder
.
getNo
(),
Coupon
.
CHANNEL_RENT
,
consumeAmount
,
ActivityFeign
.
TYPE_CHECK
);
if
(
couponAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
//能够使用优惠券,则不返还
couponAmounts
.
add
(
couponAmount
);
}
else
{
backCouponNos
.
add
(
tickerNo
);
}
}
}
}
else
{
//返回剩余免费天数,返回优惠券,订单款
}
return
new
InProgressVO
();
}
}
}
\ No newline at end of file
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