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
5ebe9361
Commit
5ebe9361
authored
Sep 07, 2019
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改部分代码
parent
f417ead2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
11 deletions
+52
-11
OrderCancelBiz.java
...ava/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
+52
-11
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
View file @
5ebe9361
...
@@ -4,6 +4,7 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
...
@@ -4,6 +4,7 @@ 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.feign.ActivityFeign
;
import
com.xxfc.platform.order.biz.*
;
import
com.xxfc.platform.order.biz.*
;
import
com.xxfc.platform.order.contant.enumerate.*
;
import
com.xxfc.platform.order.contant.enumerate.*
;
import
com.xxfc.platform.order.entity.*
;
import
com.xxfc.platform.order.entity.*
;
...
@@ -18,6 +19,7 @@ import org.springframework.stereotype.Service;
...
@@ -18,6 +19,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.*
;
import
java.util.*
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_TRUE
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_TRUE
;
...
@@ -67,6 +69,9 @@ public class OrderCancelBiz {
...
@@ -67,6 +69,9 @@ public class OrderCancelBiz {
@Autowired
@Autowired
ThirdFeign
thirdFeign
;
ThirdFeign
thirdFeign
;
@Autowired
ActivityFeign
activityFeign
;
private
static
Map
<
Integer
,
List
<
Integer
>>
cancelAble
;
private
static
Map
<
Integer
,
List
<
Integer
>>
cancelAble
;
static
{
static
{
cancelAble
=
new
HashMap
<
Integer
,
List
<
Integer
>>();
cancelAble
=
new
HashMap
<
Integer
,
List
<
Integer
>>();
...
@@ -110,28 +115,64 @@ public class OrderCancelBiz {
...
@@ -110,28 +115,64 @@ public class OrderCancelBiz {
setOrderId
(
baseOrder
.
getId
());
setOrderId
(
baseOrder
.
getId
());
}});
}});
OrderItem
orderItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
VEHICLE_MODEL
.
getCode
());
setOrderId
(
baseOrder
.
getId
());
}});
//原退还押金
//原退还押金
Integer
freeDays
=
(
null
==
orderItem
.
getCutNum
())?
0
:
orderItem
.
getCutNum
();
BigDecimal
freeDayAmount
=
BigDecimal
.
ZERO
;
BigDecimal
freeDayAmount
=
BigDecimal
.
ZERO
;
//判断是否使用免费天数,并且进行扣款
if
(
null
!=
orvd
.
getFreeDays
()
&&
orvd
.
getFreeDays
()
>
0
)
{
OrderItem
orderItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
VEHICLE_MODEL
.
getCode
());
setOrderId
(
baseOrder
.
getId
());
}});
freeDayAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
orvd
.
getFreeDays
()+
""
));
}
//如果超过出发时间,不能取消订单
//如果超过出发时间,不能取消订单
//根据时间处理goodsAmount
//根据时间处理goodsAmount
//获取出发时间 到现在 距离时间
//获取出发时间 到现在 距离时间
Long
timeLag
=
orvd
.
getStartTime
()
-
System
.
currentTimeMillis
();
Long
timeLag
=
orvd
.
getStartTime
()
-
System
.
currentTimeMillis
();
//后面允许开始时间过后可以取消订单
if
(
timeLag
<
0
)
{
// if(timeLag < 0) {
// throw new BaseException(ResultCode.FAILED_CODE, new HashSet<String>(){{
// throw new BaseException(ResultCode.FAILED_CODE, new HashSet<String>(){{
// add("已超过出发时间,不能取消订单");
// add("已超过出发时间,不能取消订单");
// }});
// }});
// }
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
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
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
+
""
));
//activityFeign.use(dto.getUserid(), detail.getTickerNo(), detail.getOrder().getNo(), channel, vehicleAmount, ActivityFeign.TYPE_NO_USE);
//for()
}
}
else
{
}
}
else
{
//判断是否使用免费天数,并且进行扣款
if
(
freeDays
>
0
)
{
freeDayAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
orvd
.
getFreeDays
()+
""
));
//违约金封顶 租车身份价 * 2天
BigDecimal
topAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
"2"
));
if
(
freeDayAmount
.
compareTo
(
topAmount
)
>
0
)
{
freeDayAmount
=
freeDayAmount
;
}
}
}
//退款流程
//退款流程
//退订单款
//退订单款
...
...
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