Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
Overview
Overview
Details
Activity
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
huluobin
gogirl-miniapp-backend
Commits
0a835a71
Commit
0a835a71
authored
Jul 10, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
9a97a874
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
66 deletions
+68
-66
MarketServiceImpl.java
...irl/application/market/coupon/impl/MarketServiceImpl.java
+68
-66
No files found.
src/main/java/com/gogirl/application/market/coupon/impl/MarketServiceImpl.java
View file @
0a835a71
...
@@ -1080,72 +1080,6 @@ public class MarketServiceImpl implements MarketService {
...
@@ -1080,72 +1080,6 @@ public class MarketServiceImpl implements MarketService {
}
}
});
});
//2、次卡
if
(
ListUtil
.
isNotEmpty
(
timesCardUsedRecordList
))
{
//次卡使用记录
timesCardUsedRecordList
.
forEach
(
timesCardUsedRecord
->
timesCardUsedRecord
.
setStatus
(
TimesCardUsedRecord
.
STATUS_CHOSE
));
timesCardUsedRecordList
.
stream
()
.
sorted
(
Comparator
.
comparing
(
TimesCardUsedRecord:
:
getDiscountAmount
))
.
forEach
(
timesCardUsedRecord
->
{
timesCardOrderServeDetailMapper
.
delete
(
new
LambdaQueryWrapper
<
TimesCardOrderServeDetail
>().
eq
(
TimesCardOrderServeDetail:
:
getOrderId
,
orderId
));
//次卡能用的服务id
List
<
Integer
>
serveIds
=
timesCardCustomerRelevanceMapper
.
queryTimesCardServeIds
(
timesCardUsedRecord
.
getCardTypeId
());
//抵扣的服务为 作用范围内支付金额最高的服务
OrderServe
orderServe
=
this
.
queryMaxPayPrice
(
orderManage
,
serveIds
);
if
(
orderServe
!=
null
)
{
BigDecimal
actualDiscountAmount
=
orderServe
.
getPayPrice
().
min
(
timesCardUsedRecord
.
getDiscountAmount
());
//更新次卡记录 已使用
timesCardUsedRecord
.
setStatus
(
TimesCardUsedRecord
.
STATUS_USED
);
//次卡对应订单服务的美甲师
timesCardUsedRecord
.
setTechnicianName
(
orderServe
.
getTechnicianName
());
//次卡店铺名称
timesCardUsedRecord
.
setDepartmentName
(
orderManage
.
getDepartmentName
());
//次卡店铺id
timesCardUsedRecord
.
setDepartmentId
(
orderManage
.
getDepartmentId
());
//次卡折扣的
timesCardUsedRecord
.
setServeName
(
orderServe
.
getServeName
());
//次卡作用的服务id
timesCardUsedRecord
.
setOrderServeId
(
orderServe
.
getServeId
());
timesCardUsedRecord
.
setOrderId
(
orderId
);
timesCardUsedRecord
.
setActualDiscountAmount
(
actualDiscountAmount
);
timesCardUsedRecordService
.
updateById
(
timesCardUsedRecord
);
//在主服务上折扣的钱
TimesCardOrderServeDetail
timesCardOrderServeDetail
=
new
TimesCardOrderServeDetail
();
timesCardOrderServeDetail
.
setDiscountAmount
(
actualDiscountAmount
);
timesCardOrderServeDetail
.
setOrderServeId
(
orderServe
.
getId
());
timesCardOrderServeDetail
.
setOrderId
(
orderId
);
timesCardOrderServeDetail
.
setTimesCardUserRecordId
(
timesCardUsedRecord
.
getOrderServeId
());
//业绩
timesCardOrderServeDetail
.
setAchievement
(
timesCardUsedRecord
.
getPayAmount
());
timesCardOrderServeDetailMapper
.
insert
(
timesCardOrderServeDetail
);
//订单折扣金额更新
orderServe
.
setBindTimesCard
(
1
);
orderServe
.
addDiscountPrice
(
actualDiscountAmount
);
//业绩
orderServe
.
setAchievement
(
orderServe
.
getAchievement
().
subtract
(
actualDiscountAmount
).
add
(
timesCardUsedRecord
.
getPayAmount
()));
orderManage
.
addDiscountPrice
(
actualDiscountAmount
);
// //更新使用次数
// TimesCardCustomerRelevance timesCardCustomerRelevance = timesCardCustomerRelevanceService.getById(timesCardUsedRecord.getCardRelevanceCustomerId());
// timesCardCustomerRelevance.setUsedTimes(timesCardCustomerRelevance.getUsedTimes() + 1);
// if (timesCardCustomerRelevance.getUsedTimes().equals(timesCardCustomerRelevance.getSumTimes())) {
// //次数用完
// timesCardCustomerRelevance.setStatus(2);
// }
// timesCardCustomerRelevanceService.updateById(timesCardCustomerRelevance);
}
else
{
throw
new
RRException
(
"次卡冲突"
);
}
});
}
//卡券之前删除订单服务和卡券关联
//卡券之前删除订单服务和卡券关联
couponOrderRelevanceService
.
remove
(
new
LambdaQueryWrapper
<
CouponOrderRelevance
>()
couponOrderRelevanceService
.
remove
(
new
LambdaQueryWrapper
<
CouponOrderRelevance
>()
...
@@ -1317,6 +1251,74 @@ public class MarketServiceImpl implements MarketService {
...
@@ -1317,6 +1251,74 @@ public class MarketServiceImpl implements MarketService {
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
freeInnerCouponCustomerRelevanceServiceList
.
forEach
(
couponCustomerRelevanceConsumer
);
freeInnerCouponCustomerRelevanceServiceList
.
forEach
(
couponCustomerRelevanceConsumer
);
//2、次卡
if
(
ListUtil
.
isNotEmpty
(
timesCardUsedRecordList
))
{
//次卡使用记录
timesCardUsedRecordList
.
forEach
(
timesCardUsedRecord
->
timesCardUsedRecord
.
setStatus
(
TimesCardUsedRecord
.
STATUS_CHOSE
));
timesCardUsedRecordList
.
stream
()
.
sorted
(
Comparator
.
comparing
(
TimesCardUsedRecord:
:
getDiscountAmount
))
.
forEach
(
timesCardUsedRecord
->
{
timesCardOrderServeDetailMapper
.
delete
(
new
LambdaQueryWrapper
<
TimesCardOrderServeDetail
>().
eq
(
TimesCardOrderServeDetail:
:
getOrderId
,
orderId
));
//次卡能用的服务id
List
<
Integer
>
serveIds
=
timesCardCustomerRelevanceMapper
.
queryTimesCardServeIds
(
timesCardUsedRecord
.
getCardTypeId
());
//抵扣的服务为 作用范围内支付金额最高的服务
OrderServe
orderServe
=
this
.
queryMaxPayPrice
(
orderManage
,
serveIds
);
if
(
orderServe
!=
null
)
{
BigDecimal
actualDiscountAmount
=
orderServe
.
getPayPrice
().
min
(
timesCardUsedRecord
.
getDiscountAmount
());
//更新次卡记录 已使用
timesCardUsedRecord
.
setStatus
(
TimesCardUsedRecord
.
STATUS_USED
);
//次卡对应订单服务的美甲师
timesCardUsedRecord
.
setTechnicianName
(
orderServe
.
getTechnicianName
());
//次卡店铺名称
timesCardUsedRecord
.
setDepartmentName
(
orderManage
.
getDepartmentName
());
//次卡店铺id
timesCardUsedRecord
.
setDepartmentId
(
orderManage
.
getDepartmentId
());
//次卡折扣的
timesCardUsedRecord
.
setServeName
(
orderServe
.
getServeName
());
//次卡作用的服务id
timesCardUsedRecord
.
setOrderServeId
(
orderServe
.
getServeId
());
timesCardUsedRecord
.
setOrderId
(
orderId
);
timesCardUsedRecord
.
setActualDiscountAmount
(
actualDiscountAmount
);
timesCardUsedRecordService
.
updateById
(
timesCardUsedRecord
);
//在主服务上折扣的钱
TimesCardOrderServeDetail
timesCardOrderServeDetail
=
new
TimesCardOrderServeDetail
();
timesCardOrderServeDetail
.
setDiscountAmount
(
actualDiscountAmount
);
timesCardOrderServeDetail
.
setOrderServeId
(
orderServe
.
getId
());
timesCardOrderServeDetail
.
setOrderId
(
orderId
);
timesCardOrderServeDetail
.
setTimesCardUserRecordId
(
timesCardUsedRecord
.
getOrderServeId
());
//业绩
timesCardOrderServeDetail
.
setAchievement
(
timesCardUsedRecord
.
getPayAmount
());
timesCardOrderServeDetailMapper
.
insert
(
timesCardOrderServeDetail
);
//订单折扣金额更新
orderServe
.
setBindTimesCard
(
1
);
orderServe
.
addDiscountPrice
(
actualDiscountAmount
);
//业绩
orderServe
.
setAchievement
(
orderServe
.
getAchievement
().
subtract
(
actualDiscountAmount
).
add
(
timesCardUsedRecord
.
getPayAmount
()));
orderManage
.
addDiscountPrice
(
actualDiscountAmount
);
// //更新使用次数
// TimesCardCustomerRelevance timesCardCustomerRelevance = timesCardCustomerRelevanceService.getById(timesCardUsedRecord.getCardRelevanceCustomerId());
// timesCardCustomerRelevance.setUsedTimes(timesCardCustomerRelevance.getUsedTimes() + 1);
// if (timesCardCustomerRelevance.getUsedTimes().equals(timesCardCustomerRelevance.getSumTimes())) {
// //次数用完
// timesCardCustomerRelevance.setStatus(2);
// }
// timesCardCustomerRelevanceService.updateById(timesCardCustomerRelevance);
}
else
{
throw
new
RRException
(
"次卡冲突"
);
}
});
}
//6、普通内部券
//6、普通内部券
List
<
CouponCustomerRelevance
>
normalInnerCouponCustomerRelevanceServiceList
=
innerCouponCustomerRelevanceServiceList
List
<
CouponCustomerRelevance
>
normalInnerCouponCustomerRelevanceServiceList
=
innerCouponCustomerRelevanceServiceList
.
stream
()
.
stream
()
...
...
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