Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ufo
/
yohoufo-fore
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Lixiaodi
6 years ago
Commit
a4b592d7de38d36362aa06f1fc1e8bd790456586
1 parent
ad62619b
修改记账分总账分账
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
15 deletions
order/src/main/java/com/yohoufo/order/service/MerchantOrderPaymentService.java
order/src/main/java/com/yohoufo/order/service/MerchantOrderPaymentService.java
View file @
a4b592d
...
...
@@ -157,6 +157,9 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
swd
.
setType
(
SellerWalletDetail
.
Type
.
RE_CHARGE
.
getValue
());
swd
.
setCreateTime
(
TimeUtils
.
getTimeStampSecond
());
swd
.
setUpdateTime
(
0
);
swd
.
setAvailAmount
(
orderInfo
.
getAmount
());
swd
.
setLockAmount
(
BigDecimal
.
ZERO
);
swd
.
setIsSet
(
1
);
JSONObject
att
=
new
JSONObject
();
att
.
put
(
"payment"
,
orderInfo
.
getPayment
());
swd
.
setAttachValue
(
att
.
toJSONString
());
...
...
@@ -389,7 +392,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
// 支付保证金:明细记录+orders_pay记录
public
void
useEarnestAddWalletDetail
(
SellerWallet
sw
,
List
<
OrderInfo
>
orderList
)
{
for
(
OrderInfo
oi
:
orderList
)
{
SellerWalletDetail
swd
=
addWalletDetail
(
sw
,
oi
.
getOrderCode
(),
oi
.
getAmount
(),
1
,
SellerWalletDetail
.
Type
.
PUBLISH
);
SellerWalletDetail
swd
=
addWalletDetail
(
sw
,
oi
.
getOrderCode
(),
oi
.
getAmount
(),
SellerWalletDetail
.
Type
.
PUBLISH
);
addOrdersPay
(
swd
);
}
}
...
...
@@ -403,7 +406,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
}
else
{
t
=
SellerWalletDetail
.
Type
.
SUBTRACT_PRICE
;
}
SellerWalletDetail
swd
=
addWalletDetail
(
sw
,
oi
.
getOrderCode
(),
oi
.
getAmount
(),
1
,
t
);
SellerWalletDetail
swd
=
addWalletDetail
(
sw
,
oi
.
getOrderCode
(),
oi
.
getAmount
(),
t
);
changePriceUpdateOrdersPay
(
swd
);
}
}
...
...
@@ -411,7 +414,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
// 下架商品(卖家+系统):明细记录+退款表记录
public
void
unshelveAddWalletDetail
(
SellerWallet
sw
,
List
<
OrderInfo
>
orderList
,
SellerWalletDetail
.
Type
type
)
{
for
(
OrderInfo
oi
:
orderList
)
{
SellerWalletDetail
swd
=
addWalletDetail
(
sw
,
oi
.
getOrderCode
(),
oi
.
getAmount
(),
1
,
type
);
SellerWalletDetail
swd
=
addWalletDetail
(
sw
,
oi
.
getOrderCode
(),
oi
.
getAmount
(),
type
);
addRefundRecord
(
swd
,
oi
.
getAmount
());
}
}
...
...
@@ -465,6 +468,9 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
swd
.
setIsBatch
(
0
);
swd
.
setCreateTime
(
TimeUtils
.
getTimeStampSecond
());
swd
.
setUpdateTime
(
0
);
swd
.
setAvailAmount
(
BigDecimal
.
ZERO
);
swd
.
setLockAmount
(
BigDecimal
.
ZERO
);
swd
.
setIsSet
(
1
);
logger
.
info
(
"商家退出,退还保证金,钱包归零处理,增加扣减明细,bean={}"
,
swd
);
sellerWalletDetailMapper
.
insert
(
swd
);
...
...
@@ -472,7 +478,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
}
// 增加:明细
private
SellerWalletDetail
addWalletDetail
(
SellerWallet
sw
,
long
orderCode
,
BigDecimal
amount
,
Integer
isBatch
,
SellerWalletDetail
.
Type
type
)
{
private
SellerWalletDetail
addWalletDetail
(
SellerWallet
sw
,
long
orderCode
,
BigDecimal
amount
,
SellerWalletDetail
.
Type
type
)
{
Integer
uid
=
sw
.
getUid
();
SellerWalletDetail
swd
=
new
SellerWalletDetail
();
swd
.
setOrderCode
(
orderCode
);
...
...
@@ -480,7 +486,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
swd
.
setUid
(
uid
);
swd
.
setWalletId
(
sw
.
getId
());
swd
.
setAmount
(
amount
);
swd
.
setIsBatch
(
isBatch
);
swd
.
setIsBatch
(
1
);
swd
.
setCreateTime
(
TimeUtils
.
getTimeStampSecond
());
swd
.
setUpdateTime
(
0
);
logger
.
info
(
"增加保证金明细({}),bean={}"
,
type
.
getName
(),
swd
);
...
...
@@ -511,34 +517,39 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
return
null
;
}
sw
.
setAmount
(
null
);
sw
.
setLockAmount
(
null
);
BigDecimal
beforeAvailAmount
=
sw
.
getAmount
();
BigDecimal
beforeLockAmount
=
sw
.
getLockAmount
();
BigDecimal
availAmount
=
null
;
BigDecimal
lockAmount
=
null
;
// 减去保证金
if
(
type
==
SellerWalletDetail
.
Type
.
PUBLISH
||
type
==
SellerWalletDetail
.
Type
.
ADD_PRICE
||
type
==
SellerWalletDetail
.
Type
.
SUBTRACT_PRICE
)
{
sw
.
setAmount
(
money
.
multiply
(
new
BigDecimal
(
"-1"
)));
sw
.
setLockAmount
(
money
);
availAmount
=
money
.
multiply
(
new
BigDecimal
(
"-1"
));
lockAmount
=
money
;
}
else
if
(
type
==
SellerWalletDetail
.
Type
.
SELLER_OFF
||
type
==
SellerWalletDetail
.
Type
.
SYSTEM_OFF
||
type
==
SellerWalletDetail
.
Type
.
APPRAISE_OK
||
type
==
SellerWalletDetail
.
Type
.
BUYER_CANCEL_DELIVERY
||
type
==
SellerWalletDetail
.
Type
.
BUYER_CANCEL_NO_DELIVERY
)
{
// 增加保证金
sw
.
setAmount
(
money
);
sw
.
setLockAmount
(
money
.
multiply
(
new
BigDecimal
(
"-1"
)));
availAmount
=
money
;
lockAmount
=
money
.
multiply
(
new
BigDecimal
(
"-1"
));
}
else
if
(
type
==
SellerWalletDetail
.
Type
.
SELLER_CANCEL
||
type
==
SellerWalletDetail
.
Type
.
SELLER_OVER_TIME
||
type
==
SellerWalletDetail
.
Type
.
APPRAISE_FAIL
)
{
// 处罚保证金
sw
.
setLockAmount
(
money
.
multiply
(
new
BigDecimal
(
"-1"
)
));
lockAmount
=
money
.
multiply
(
new
BigDecimal
(
"-1"
));
}
sw
.
setAmount
(
availAmount
);
sw
.
setLockAmount
(
lockAmount
);
sw
.
setUpdateTime
(
TimeUtils
.
getTimeStampSecond
());
logger
.
info
(
"{}修改钱包表余额,bean={}"
,
sw
);
if
(
sellerWalletMapper
.
addMoney
(
sw
)
==
0
)
{
logger
.
error
(
message
+
"失败,(并发)更新表返回0,uid={}"
,
uid
);
CommonAlarmEventPublisher
.
publish
(
message
+
"失败"
,
"ufo.order.changePrice"
,
"(并发)更新表返回0,uid="
+
uid
+
", 金额为:"
+
money
);
logger
.
error
(
message
+
"失败,(并发)更新表返回0,bean={}"
,
sw
);
CommonAlarmEventPublisher
.
publish
(
message
+
"失败"
,
"ufo.order.changePrice"
,
"(并发)更新表返回0,uid="
+
uid
+
", bean为:"
+
sw
);
return
null
;
}
logger
.
info
(
"{}修改钱包表余额成功,bean={}"
,
sw
);
...
...
@@ -550,9 +561,14 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
swd
.
setWalletId
(
sw
.
getId
());
swd
.
setAmount
(
money
);
swd
.
setIsBatch
(
0
);
swd
.
setAttachValue
(
attach
);
swd
.
setCreateTime
(
TimeUtils
.
getTimeStampSecond
());
swd
.
setUpdateTime
(
0
);
//////////////////////////
swd
.
setAttachValue
(
attach
);
swd
.
setAvailAmount
(
availAmount
==
null
?
beforeAvailAmount
:
beforeAvailAmount
.
add
(
availAmount
));
swd
.
setLockAmount
(
lockAmount
==
null
?
beforeLockAmount
:
beforeLockAmount
.
add
(
lockAmount
));
swd
.
setIsSet
(
0
);
/////////////////////////
logger
.
info
(
"增加钱包明细汇总记录,bean={}"
,
swd
);
sellerWalletDetailMapper
.
insert
(
swd
);
logger
.
info
(
"增加钱包明细汇总记录成功,bean={}"
,
swd
);
...
...
Please
register
or
login
to post a comment