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
cee0521f
Commit
cee0521f
authored
Oct 31, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master-background-manager' into master-background-manager
parents
736b6805
dd1685ae
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
144 additions
and
134 deletions
+144
-134
OrderRefundPriceVO.java
...xfc/platform/order/pojo/calculate/OrderRefundPriceVO.java
+18
-0
OrderAccountBiz.java
...ain/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
+0
-1
OrderVehicleCrosstownBiz.java
...com/xxfc/platform/order/biz/OrderVehicleCrosstownBiz.java
+7
-3
OrderCalculateBiz.java
.../com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
+100
-1
BaseOrderController.java
...ava/com/xxfc/platform/order/rest/BaseOrderController.java
+0
-3
OrderRefundController.java
...a/com/xxfc/platform/order/rest/OrderRefundController.java
+19
-126
No files found.
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/calculate/OrderRefundPriceVO.java
0 → 100644
View file @
cee0521f
package
com
.
xxfc
.
platform
.
order
.
pojo
.
calculate
;
import
lombok.Data
;
import
java.math.BigDecimal
;
@Data
public
class
OrderRefundPriceVO
{
BigDecimal
refundAmount
;
BigDecimal
realAmount
;
BigDecimal
cutAmount
;
String
refundDesc
;
public
void
setRefundAmount
(
BigDecimal
refundAmount
)
{
this
.
refundAmount
=
refundAmount
;
this
.
cutAmount
=
realAmount
.
subtract
(
refundAmount
);
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
View file @
cee0521f
...
...
@@ -2,7 +2,6 @@ package com.xxfc.platform.order.biz;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderVehicleCrosstownBiz.java
View file @
cee0521f
...
...
@@ -207,7 +207,6 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
//调用车辆管理的出车还车
//出车
if
(
orderVehicleCrosstownDto
.
getType
()
==
CrosstownTypeEnum
.
DEPARTURE
.
getCode
())
{
//交车
VehicleDepartureVo
vehicleDepartureVo
=
new
VehicleDepartureVo
();
vehicleDepartureVo
.
setVehicleId
(
orderRentVehicleDetail
.
getVehicleId
());
vehicleDepartureVo
.
setDepartureBranchCompanyId
(
orderRentVehicleDetail
.
getStartCompanyId
());
...
...
@@ -223,10 +222,14 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
vehicleDepartureVo
.
setUse
(
"用户租车"
);
vehicleDepartureVo
.
setBookRecordId
(
orderRentVehicleDetail
.
getBookRecordId
());
vehicleDepartureVo
.
setCheckMan
(
userDTO
.
getName
());
if
(
StringUtils
.
isNotBlank
(
orderVehicleCrosstownDto
.
getLicensePhone
()))
{
vehicleDepartureVo
.
setCheckManTel
(
orderVehicleCrosstownDto
.
getLicensePhone
());
}
else
{
vehicleDepartureVo
.
setCheckManTel
(
"13656235623"
);
}
try
{
RestResponse
restResponse
=
vehicleFeign
.
departureBySmall
(
vehicleDepartureVo
);
log
.
info
(
"返回信息: "
+
restResponse
.
toString
());
log
.
error
(
"返回信息: "
+
restResponse
.
toString
());
}
catch
(
Exception
e
)
{
return
ObjectRestResponse
.
createFailedResult
(
1001
,
e
.
getMessage
());
}
...
...
@@ -236,6 +239,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
vehicleArrivalVo
.
setArrivalBranchCompanyId
(
userDTO
.
getCompanyId
());
vehicleArrivalVo
.
setMileage
(
orderVehicleCrosstownDto
.
getMileage
());
vehicleArrivalVo
.
setRecycleMan
(
userDTO
.
getName
());
vehicleArrivalVo
.
setRecycleManTel
(
"13656235623"
);
vehicleArrivalVo
.
setBookRecordId
(
orderRentVehicleDetail
.
getBookRecordId
());
if
(
appUserDTO
!=
null
)
{
vehicleArrivalVo
.
setRecycleManTel
(
appUserDTO
.
getUsername
());
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
View file @
cee0521f
...
...
@@ -2,26 +2,32 @@ package com.xxfc.platform.order.biz.inner;
import
cn.hutool.core.util.StrUtil
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.common.constant.CommonConstants
;
import
com.xxfc.platform.activity.entity.Coupon
;
import
com.xxfc.platform.activity.feign.ActivityFeign
;
import
com.xxfc.platform.app.feign.ConfigFeign
;
import
com.xxfc.platform.order.biz.BaseOrderBiz
;
import
com.xxfc.platform.order.biz.OrderAccountBiz
;
import
com.xxfc.platform.order.biz.OrderItemBiz
;
import
com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.ItemTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.OrderStatusEnum
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.entity.BaseOrder
;
import
com.xxfc.platform.order.entity.OrderItem
;
import
com.xxfc.platform.order.entity.OrderRentVehicleDetail
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDeduction
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
com.xxfc.platform.order.pojo.calculate.InProgressVO
;
import
com.xxfc.platform.order.pojo.calculate.OrderRefundPriceVO
;
import
com.xxfc.platform.order.pojo.order.OrderPageVO
;
import
com.xxfc.platform.universal.constant.DictionaryKey
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.assertj.core.util.Lists
;
import
org.joda.time.DateTime
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -30,7 +36,8 @@ import java.math.RoundingMode;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
APP_ORDER
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_TRUE
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.*;
/**
* 订单退款记录表
...
...
@@ -64,6 +71,9 @@ public class OrderCalculateBiz {
@Autowired
OrderAccountBiz
orderAccountBiz
;
@Autowired
BaseOrderBiz
baseOrderBiz
;
public
InProgressVO
inProgressCalculate
(
BaseOrder
baseOrder
,
OrderItem
orderItem
,
Integer
freeDays
,
Integer
useDays
,
OrderAccountDetail
oad
,
Boolean
isCancel
)
{
BigDecimal
refundAmount
=
BigDecimal
.
ZERO
;
BigDecimal
consumeAmount
=
BigDecimal
.
ZERO
;
...
...
@@ -251,4 +261,93 @@ public class OrderCalculateBiz {
}
return
bookDays
;
}
public
OrderRefundPriceVO
getPriceCalculate
(
String
no
,
OrderPageVO
orderPageVO
)
{
//根据no 查订单
OrderTypeEnum
orderTypeEnum
=
OrderTypeEnum
.
get
(
orderPageVO
.
getType
());
BigDecimal
totalRefundAmount
=
BigDecimal
.
ZERO
;
BigDecimal
totalDeductAmount
=
BigDecimal
.
ZERO
;
StringBuilder
refundDescBuilder
=
new
StringBuilder
(
""
);
String
refundDesc
=
""
;
InProgressVO
inProgressVO
=
new
InProgressVO
();
switch
(
orderTypeEnum
)
{
case
RENT_VEHICLE:
DateTime
nowTime
=
DateTime
.
parse
(
DateTime
.
now
().
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
DateTime
startTime
=
DateTime
.
parse
(
new
DateTime
(
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()).
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
DateTime
endTime
=
DateTime
.
parse
(
new
DateTime
(
orderPageVO
.
getOrderRentVehicleDetail
().
getEndTime
()).
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
Long
timeLag
=
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()
-
System
.
currentTimeMillis
();
OrderItem
vehicleItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
VEHICLE_MODEL
.
getCode
());
setOrderId
(
orderPageVO
.
getId
());
}});
if
(
timeLag
<
0
)
{
OrderAccountDetail
oad
=
new
OrderAccountDetail
();
Integer
freeDays
=
(
null
==
vehicleItem
.
getCutNum
())?
0
:
vehicleItem
.
getCutNum
();
inProgressVO
=
inProgressCalculate
(
orderPageVO
,
vehicleItem
,
freeDays
,
baseOrderBiz
.
getDaysBetweenDateTime
(
startTime
,
nowTime
),
new
OrderAccountDetail
(),
Boolean
.
FALSE
);
//.inProgressCalculate(orderPageVO, baseOrderBiz.getDaysBetweenDateTime(startTime, nowTime));
totalDeductAmount
=
oad
.
realTotalDeduct
();
totalRefundAmount
=
oad
.
getOrderAmount
().
add
(
oad
.
getDepositAmount
());
refundDesc
=
inProgressVO
.
getViolateDesc
();
}
else
{
String
key
=
RENT_REFUND
;
BigDecimal
deductionAmount
=
orderAccountBiz
.
calculateDeduction
(
vehicleItem
.
getBuyAmount
()
,
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()
-
System
.
currentTimeMillis
()
,
DictionaryKey
.
APP_ORDER
+
"_"
+
key
,
refundDescBuilder
);
totalDeductAmount
=
deductionAmount
;
totalRefundAmount
=
orderPageVO
.
getRealAmount
().
subtract
(
deductionAmount
);
refundDesc
=
refundDescBuilder
.
toString
();
}
break
;
case
TOUR:
//判断是省内还是省外
String
key
=
TOUR_IN_REFUND
;
if
(
SYS_TRUE
.
equals
(
orderPageVO
.
getOrderTourDetail
().
getIsOutside
()))
{
key
=
TOUR_REFUND
;
}
OrderItem
adultItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
TOUR_ADULT
.
getCode
());
setOrderId
(
orderPageVO
.
getId
());
}});
OrderItem
childItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
TOUR_CHILD
.
getCode
());
setOrderId
(
orderPageVO
.
getId
());
}});
BigDecimal
adultItemAmount
=
(
null
==
adultItem
)?
BigDecimal
.
ZERO
:
adultItem
.
getRealAmount
();
BigDecimal
childItemAmount
=
(
null
==
childItem
)?
BigDecimal
.
ZERO
:
childItem
.
getRealAmount
();
BigDecimal
deductionAmount
=
orderAccountBiz
.
calculateDeduction
(
adultItemAmount
.
add
(
childItemAmount
)
,
orderPageVO
.
getOrderTourDetail
().
getStartTime
()
-
System
.
currentTimeMillis
()
,
DictionaryKey
.
APP_ORDER
+
"_"
+
key
,
refundDescBuilder
);
totalDeductAmount
=
deductionAmount
;
totalRefundAmount
=
orderPageVO
.
getRealAmount
().
subtract
(
deductionAmount
);
refundDesc
=
refundDescBuilder
.
toString
();
break
;
default
:
break
;
}
OrderRefundPriceVO
orpv
=
new
OrderRefundPriceVO
();
orpv
.
setRealAmount
(
orderPageVO
.
getRealAmount
());
orpv
.
setRefundAmount
(
totalRefundAmount
);
orpv
.
setCutAmount
(
totalDeductAmount
);
return
orpv
;
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/BaseOrderController.java
View file @
cee0521f
...
...
@@ -36,7 +36,6 @@ import com.xxfc.platform.universal.entity.Dictionary;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
com.xxfc.platform.universal.vo.OrderPayVo
;
import
com.xxfc.platform.universal.vo.OrderRefundVo
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -52,7 +51,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.List
;
...
...
@@ -272,7 +270,6 @@ public class BaseOrderController extends CommonBaseController implements UserRes
}});
if
(
null
==
dbBaseOrder
||
!
userId
.
equals
(
dbBaseOrder
.
getUserId
().
toString
()))
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
);
}
dbBaseOrder
.
setCancelReason
(
cancelOrderDto
.
getCancelReason
());
orderCancelBiz
.
cancel
(
dbBaseOrder
,
changeViolateAmount
);
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderRefundController.java
View file @
cee0521f
...
...
@@ -4,7 +4,6 @@ import cn.hutool.core.util.StrUtil;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken
;
import
com.github.wxiaoqi.security.common.constant.CommonConstants
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.util.Query
;
...
...
@@ -14,19 +13,10 @@ import com.xxfc.platform.order.biz.OrderAccountBiz;
import
com.xxfc.platform.order.biz.OrderItemBiz
;
import
com.xxfc.platform.order.biz.OrderRefundBiz
;
import
com.xxfc.platform.order.biz.inner.OrderCalculateBiz
;
import
com.xxfc.platform.order.biz.inner.OrderCancelBiz
;
import
com.xxfc.platform.order.contant.enumerate.ItemTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.OrderStatusEnum
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.entity.OrderItem
;
import
com.xxfc.platform.order.entity.OrderRefund
;
import
com.xxfc.platform.order.entity.OrderRentVehicleDetail
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
com.xxfc.platform.order.pojo.calculate.InProgressVO
;
import
com.xxfc.platform.order.pojo.calculate.OrderRefundPriceVO
;
import
com.xxfc.platform.order.pojo.order.OrderPageVO
;
import
com.xxfc.platform.universal.constant.DictionaryKey
;
import
lombok.Data
;
import
org.joda.time.DateTime
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
...
@@ -35,11 +25,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_FALSE
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_TRUE
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.*;
@Controller
@RequestMapping
(
"orderRefund"
)
...
...
@@ -70,125 +55,33 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
@IgnoreClientToken
public
ObjectRestResponse
<
BigDecimal
>
getPriceCalculate
(
@PathVariable
(
value
=
"no"
)
String
no
)
{
checkAppUser
();
//根据no 查订单
OrderPageVO
orderPageVO
=
baseOrderBiz
.
pageByParm
(
new
Query
(
new
PageParam
(){{
setLimit
(
1
);
setPage
(
1
);
}}){{
put
(
"no"
,
no
);
}}.
getSuper
()).
get
(
0
);
OrderTypeEnum
orderTypeEnum
=
OrderTypeEnum
.
get
(
orderPageVO
.
getType
());
BigDecimal
totalRefundAmount
=
BigDecimal
.
ZERO
;
BigDecimal
totalDeductAmount
=
BigDecimal
.
ZERO
;
StringBuilder
refundDescBuilder
=
new
StringBuilder
(
""
);
String
refundDesc
=
""
;
InProgressVO
inProgressVO
=
new
InProgressVO
();
switch
(
orderTypeEnum
)
{
case
RENT_VEHICLE:
DateTime
nowTime
=
DateTime
.
parse
(
DateTime
.
now
().
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
DateTime
startTime
=
DateTime
.
parse
(
new
DateTime
(
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()).
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
DateTime
endTime
=
DateTime
.
parse
(
new
DateTime
(
orderPageVO
.
getOrderRentVehicleDetail
().
getEndTime
()).
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
Long
timeLag
=
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()
-
System
.
currentTimeMillis
();
OrderItem
vehicleItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
VEHICLE_MODEL
.
getCode
());
setOrderId
(
orderPageVO
.
getId
());
}});
if
(
timeLag
<
0
)
{
OrderAccountDetail
oad
=
new
OrderAccountDetail
();
Integer
freeDays
=
(
null
==
vehicleItem
.
getCutNum
())?
0
:
vehicleItem
.
getCutNum
();
inProgressVO
=
orderCalculateBiz
.
inProgressCalculate
(
orderPageVO
,
vehicleItem
,
freeDays
,
baseOrderBiz
.
getDaysBetweenDateTime
(
startTime
,
nowTime
),
new
OrderAccountDetail
(),
Boolean
.
FALSE
);
//.inProgressCalculate(orderPageVO, baseOrderBiz.getDaysBetweenDateTime(startTime, nowTime));
totalDeductAmount
=
oad
.
realTotalDeduct
();
totalRefundAmount
=
oad
.
getOrderAmount
().
add
(
oad
.
getDepositAmount
());
refundDesc
=
inProgressVO
.
getViolateDesc
();
}
else
{
String
key
=
RENT_REFUND
;
//违约金封顶 租车身份价 * 2天
BigDecimal
topAmount
=
vehicleItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
2
+
""
));
BigDecimal
deductionAmount
=
orderAccountBiz
.
calculateDeduction
(
vehicleItem
.
getBuyAmount
()
,
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()
-
System
.
currentTimeMillis
()
,
DictionaryKey
.
APP_ORDER
+
"_"
+
key
,
refundDescBuilder
);
deductionAmount
=
deductionAmount
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
if
(
topAmount
.
compareTo
(
deductionAmount
)
>
0
)
{
totalDeductAmount
=
totalDeductAmount
.
add
(
deductionAmount
);
topAmount
=
topAmount
.
subtract
(
deductionAmount
);
}
else
{
totalDeductAmount
=
totalDeductAmount
.
add
(
topAmount
);
deductionAmount
=
topAmount
;
topAmount
=
BigDecimal
.
ZERO
;
}
// totalDeductAmount = deductionAmount;
totalRefundAmount
=
orderPageVO
.
getRealAmount
().
subtract
(
deductionAmount
);
refundDesc
=
refundDescBuilder
.
toString
();
}
break
;
case
TOUR:
//判断是省内还是省外
String
key
=
TOUR_IN_REFUND
;
if
(
SYS_TRUE
.
equals
(
orderPageVO
.
getOrderTourDetail
().
getIsOutside
()))
{
key
=
TOUR_REFUND
;
}
OrderItem
adultItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
TOUR_ADULT
.
getCode
());
setOrderId
(
orderPageVO
.
getId
());
}});
OrderItem
childItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
TOUR_CHILD
.
getCode
());
setOrderId
(
orderPageVO
.
getId
());
}});
BigDecimal
adultItemAmount
=
(
null
==
adultItem
)?
BigDecimal
.
ZERO
:
adultItem
.
getRealAmount
();
BigDecimal
childItemAmount
=
(
null
==
childItem
)?
BigDecimal
.
ZERO
:
childItem
.
getRealAmount
();
BigDecimal
deductionAmount
=
orderAccountBiz
.
calculateDeduction
(
adultItemAmount
.
add
(
childItemAmount
)
,
orderPageVO
.
getOrderTourDetail
().
getStartTime
()
-
System
.
currentTimeMillis
()
,
DictionaryKey
.
APP_ORDER
+
"_"
+
key
,
refundDescBuilder
);
totalDeductAmount
=
deductionAmount
;
totalRefundAmount
=
orderPageVO
.
getRealAmount
().
subtract
(
deductionAmount
);
refundDesc
=
refundDescBuilder
.
toString
();
break
;
default
:
break
;
}
OrderRefundPriceVO
orpv
=
new
OrderRefundPriceVO
();
orpv
.
setRealAmount
(
orderPageVO
.
getRealAmount
());
orpv
.
setRefundAmount
(
totalRefundAmount
);
OrderRefundPriceVO
orderRefundPriceVO
=
orderCalculateBiz
.
getPriceCalculate
(
no
,
orderPageVO
);
if
(
orderPageVO
.
getStatus
().
equals
(
OrderStatusEnum
.
ORDER_UNPAY
.
getCode
())
||
orderPageVO
.
getStatus
().
equals
(
OrderStatusEnum
.
ORDER_CRT
.
getCode
())
||
totalDeductAmount
.
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
or
pv
.
setRefundDesc
(
"是否确定取消订单"
);
||
orderRefundPriceVO
.
getRefundAmount
()
.
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
or
derRefundPriceVO
.
setRefundDesc
(
"是否确定取消订单"
);
}
else
{
or
pv
.
setRefundDesc
(
StrUtil
.
format
(
"本次取消操作需要扣除{}元违约金,实际退款金额为{}元,您确定要取消订单吗?"
,
totalDeductAmount
,
totalRefundAmount
));
or
derRefundPriceVO
.
setRefundDesc
(
StrUtil
.
format
(
"本次取消操作需要扣除{}元违约金,实际退款金额为{}元,您确定要取消订单吗?"
,
orderRefundPriceVO
.
getCutAmount
(),
orderRefundPriceVO
.
getRefundAmount
()
));
}
return
ObjectRestResponse
.
succ
(
or
pv
);
return
ObjectRestResponse
.
succ
(
or
derRefundPriceVO
);
}
@
Data
public
class
OrderRefundPriceVO
{
BigDecimal
refundAmount
;
BigDecimal
realAmount
;
BigDecimal
cutAmount
;
String
refundDesc
;
public
void
setRefundAmount
(
BigDecimal
refundAmount
)
{
this
.
refundAmount
=
refundAmount
;
this
.
cutAmount
=
realAmount
.
subtract
(
refundAmount
);
}
@
RequestMapping
(
value
=
"/bg-stage/getViolatePrice/{no}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@IgnoreClientToken
public
ObjectRestResponse
<
BigDecimal
>
getViolatePrice
(
@PathVariable
(
value
=
"no"
)
String
no
)
{
checkAppUser
()
;
OrderPageVO
orderPageVO
=
baseOrderBiz
.
pageByParm
(
new
Query
(
new
PageParam
(){{
setLimit
(
1
);
setPage
(
1
);
}}){{
put
(
"no"
,
no
);
}}.
getSuper
()).
get
(
0
)
;
OrderRefundPriceVO
orderRefundPriceVO
=
orderCalculateBiz
.
getPriceCalculate
(
no
,
orderPageVO
);
return
ObjectRestResponse
.
succ
(
orderRefundPriceVO
);
}
}
\ 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