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
076838c7
Commit
076838c7
authored
Sep 10, 2019
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加部分代码
parent
44aa7328
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
20 deletions
+44
-20
OrderAccountDeduction.java
...fc/platform/order/pojo/account/OrderAccountDeduction.java
+5
-1
OrderAccountBiz.java
...ain/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
+17
-8
OrderCalculateBiz.java
.../com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
+17
-6
OrderCancelBiz.java
...ava/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
+5
-5
No files found.
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/account/OrderAccountDeduction.java
View file @
076838c7
...
...
@@ -6,6 +6,10 @@ import java.math.BigDecimal;
@Data
public
class
OrderAccountDeduction
{
public
static
final
int
ORIGIN_ORDER
=
1
;
public
static
final
int
ORIGIN_DEPOSIT
=
2
;
/**
* 名称
*/
...
...
@@ -17,7 +21,7 @@ public class OrderAccountDeduction {
Integer
type
;
/**
* 来源
* 来源
1--订单款 2--押金
*/
Integer
origin
;
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
View file @
076838c7
...
...
@@ -10,7 +10,6 @@ import com.xxfc.platform.order.contant.enumerate.RefundStatusEnum;
import
com.xxfc.platform.order.contant.enumerate.RefundTypeEnum
;
import
com.xxfc.platform.order.entity.BaseOrder
;
import
com.xxfc.platform.order.entity.OrderItem
;
import
com.xxfc.platform.order.entity.OrderRefund
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDeduction
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
com.xxfc.platform.universal.entity.Dictionary
;
...
...
@@ -25,7 +24,6 @@ import com.xxfc.platform.order.entity.OrderAccount;
import
com.xxfc.platform.order.mapper.OrderAccountMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
javax.xml.ws.Action
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.Map
;
...
...
@@ -58,7 +56,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
* @param timeLag 与开始时间的时间差
* @param dicParentKey
*/
public
BigDecimal
rentRefundProcess
Tota
l
(
BaseOrder
baseOrder
,
OrderItem
mainItem
,
Long
timeLag
,
String
dicParentKey
,
BigDecimal
depositAmount
,
BigDecimal
originalDeductAmount
)
{
public
BigDecimal
rentRefundProcess
Cance
l
(
BaseOrder
baseOrder
,
OrderItem
mainItem
,
Long
timeLag
,
String
dicParentKey
,
BigDecimal
depositAmount
,
BigDecimal
originalDeductAmount
)
{
//计算退款金额
//商品价格 - 优惠券减免的价格
BigDecimal
originalRefundAmount
=
BigDecimal
.
ZERO
.
add
(
mainItem
.
getRealAmount
());
...
...
@@ -158,11 +156,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
set
(
"ga"
,
goodsAmount
);
}})).
toString
());
refundDescBuilder
=
refundDescBuilder
.
insert
(
0
,
names
[
1
]+
","
);
OrderAccountDeduction
orderAccountDeduction
=
new
OrderAccountDeduction
();
orderAccountDeduction
.
setType
(
DeductionTypeEnum
.
VIOLATE
.
getCode
());
orderAccountDeduction
.
setName
(
names
[
1
]);
orderAccountDeduction
.
setAmount
(
goodsAmount
.
subtract
(
refundGoodsAmount
));
orderAccountDetail
.
getDeductions
().
add
(
orderAccountDeduction
);
orderAccountDetail
.
getDeductions
().
add
(
initDeduction
(
goodsAmount
.
subtract
(
refundGoodsAmount
),
names
[
1
],
DeductionTypeEnum
.
VIOLATE
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
));
break
;
}
}
...
...
@@ -170,6 +164,21 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
return
refundGoodsAmount
;
}
/**
* 初始化deduction
* @param subtract
* @param name
* @return
*/
public
OrderAccountDeduction
initDeduction
(
BigDecimal
subtract
,
String
name
,
DeductionTypeEnum
dte
,
Integer
origin
)
{
OrderAccountDeduction
orderAccountDeduction
=
new
OrderAccountDeduction
();
orderAccountDeduction
.
setType
(
dte
.
getCode
());
orderAccountDeduction
.
setName
(
name
);
orderAccountDeduction
.
setAmount
(
subtract
);
orderAccountDeduction
.
setOrigin
(
origin
);
return
orderAccountDeduction
;
}
/**
* 记录订单退款记录
* @param orderId
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
View file @
076838c7
...
...
@@ -9,13 +9,13 @@ 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.feign.ConfigFeign
;
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.contant.enumerate.ItemTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.RefundStatusEnum
;
import
com.xxfc.platform.order.contant.enumerate.RefundTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.*
;
import
com.xxfc.platform.order.entity.*
;
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.universal.constant.DictionaryKey
;
import
com.xxfc.platform.universal.dto.SmsTemplateDTO
;
...
...
@@ -71,9 +71,13 @@ public class OrderCalculateBiz {
@Autowired
OrderItemBiz
orderItemBiz
;
public
InProgressVO
inProgressCalculate
(
BaseOrder
baseOrder
,
OrderItem
orderItem
,
Integer
freeDays
,
Integer
useDays
)
{
@Autowired
OrderAccountBiz
orderAccountBiz
;
public
InProgressVO
inProgressCalculate
(
BaseOrder
baseOrder
,
OrderItem
orderItem
,
Integer
freeDays
,
Integer
useDays
,
OrderAccountDetail
oad
)
{
BigDecimal
refundAmount
=
BigDecimal
.
ZERO
;
InProgressVO
inProgressVO
=
new
InProgressVO
();
//计算:剩余免费天数
Integer
backFreeDays
=
freeDays
-
useDays
;
//待返还的免费天数
...
...
@@ -107,9 +111,14 @@ public class OrderCalculateBiz {
consumeAmount
=
consumeAmount
.
subtract
(
couponAmount
);
}
if
(
consumeAmount
.
compareTo
(
orderItem
.
getRealAmount
())
>
0
)
{
//消费金额 大于真实的金额 增加额外费用
inProgressVO
.
setExtraAmount
(
consumeAmount
.
subtract
(
orderItem
.
getRealAmount
()));
// consumeAmount = orderItem
OrderAccountDeduction
extraDeduction
=
orderAccountBiz
.
initDeduction
(
inProgressVO
.
getExtraAmount
(),
"消费额外费用"
,
DeductionTypeEnum
.
EXTRA
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
);
oad
.
getDeductions
().
add
(
extraDeduction
);
}
else
{
//否则,设置返回钱
refundAmount
=
refundAmount
.
add
(
orderItem
.
getRealAmount
().
subtract
(
consumeAmount
));
...
...
@@ -132,6 +141,8 @@ public class OrderCalculateBiz {
residueDays
=
2
;
}
inProgressVO
.
setViolateAmount
(
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
((
residueDays
+
""
))));
OrderAccountDeduction
violateDeduction
=
orderAccountBiz
.
initDeduction
(
inProgressVO
.
getViolateAmount
(),
"违约金"
,
DeductionTypeEnum
.
VIOLATE
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
);
oad
.
getDeductions
().
add
(
violateDeduction
);
}
return
inProgressVO
;
...
...
@@ -143,6 +154,6 @@ public class OrderCalculateBiz {
setOrderId
(
baseOrder
.
getId
());
}});
Integer
freeDays
=
(
null
==
orderItem
.
getCutNum
())?
0
:
orderItem
.
getCutNum
();
return
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
);
return
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
,
null
);
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
View file @
076838c7
...
...
@@ -4,7 +4,6 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
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.order.biz.*
;
import
com.xxfc.platform.order.contant.enumerate.*
;
...
...
@@ -16,7 +15,6 @@ import com.xxfc.platform.universal.feign.ThirdFeign;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.assertj.core.util.Lists
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -141,9 +139,11 @@ public class OrderCancelBiz {
//计算:使用天数 当前时间 - 开始时间的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
();
InProgressVO
inProgressVO
=
orderCalculateBiz
.
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
);
InProgressVO
inProgressVO
=
orderCalculateBiz
.
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
,
null
);
//结合
//退款子流程: 订单基础,退款描述,退款金额
orderAccountBiz
.
refundSubProcess
(
baseOrder
,
""
,
baseOrder
.
getRealAmount
(),
inProgressVO
.
getRefundAmount
(),
RefundTypeEnum
.
ORDER_FUND
.
getCode
(),
RefundStatusEnum
.
ALL
.
getCode
(),
null
);
}
else
{
//没到出车时间
...
...
@@ -158,7 +158,7 @@ public class OrderCancelBiz {
}
}
orderAccountBiz
.
rentRefundProcess
Tota
l
(
hasUpdateOrder
,
orderItem
,
timeLag
,
APP_ORDER
+
"_"
+
RENT_REFUND
,
orvd
.
getDeposit
(),
freeDayAmount
);
orderAccountBiz
.
rentRefundProcess
Cance
l
(
hasUpdateOrder
,
orderItem
,
timeLag
,
APP_ORDER
+
"_"
+
RENT_REFUND
,
orvd
.
getDeposit
(),
freeDayAmount
);
}
//退款流程
...
...
@@ -168,7 +168,7 @@ public class OrderCancelBiz {
// //退押金
// orderRefundBiz.rentRefundDepositProcess(hasUpdateOrder, orvd.getDeposit(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, freeDayAmount);
//
// orderAccountBiz.rentRefundProcess
Tota
l(hasUpdateOrder, orderItem, timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), freeDayAmount);freeDayAmount
// orderAccountBiz.rentRefundProcess
Cance
l(hasUpdateOrder, orderItem, timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), freeDayAmount);freeDayAmount
//已付款的取消订单发送消息
try
{
...
...
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