记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
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
董敬伟
liquidnet-bus-v1
Commits
9b781b6a
Commit
9b781b6a
authored
Feb 18, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
券 接口 提交
parent
924ed1a3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
2 deletions
+82
-2
GoblinCouponService.java
...liquidnet/service/goblin/service/GoblinCouponService.java
+18
-0
GoblinCouponImpl.java
...quidnet/service/goblin/service/impl/GoblinCouponImpl.java
+57
-0
GoblinOrderServiceImpl.java
...t/service/goblin/service/impl/GoblinOrderServiceImpl.java
+7
-2
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/service/GoblinCouponService.java
0 → 100644
View file @
9b781b6a
package
com
.
liquidnet
.
service
.
goblin
.
service
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.entity.GoblinFrontHotWord
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
public
interface
GoblinCouponService
{
//根据spuId获取 该spu可参与的券活动
ArrayList
<
String
>
getSpuType
(
String
spuId
,
String
storeId
);
//获取 类型券列表
ArrayList
<
GoblinStoreCouponVo
>
getSpuByType
(
String
spuId
,
String
storeId
,
String
type
);
//领取券
ArrayList
<
Boolean
>
receiveCoupon
(
String
storeCouponId
,
Integer
number
);
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinCouponImpl.java
0 → 100644
View file @
9b781b6a
package
com
.
liquidnet
.
service
.
goblin
.
service
.
impl
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.service.goblin.constant.GoblinStatusConst
;
import
com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponVo
;
import
com.liquidnet.service.goblin.service.GoblinCouponService
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
import
com.liquidnet.service.goblin.util.ObjectUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
GoblinCouponImpl
implements
GoblinCouponService
{
@Autowired
GoblinRedisUtils
redisUtils
;
@Override
public
ArrayList
<
String
>
getSpuType
(
String
spuId
,
String
storeId
)
{
ArrayList
<
String
>
returnList
=
CollectionUtil
.
arrayListString
();
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
spuId
);
if
(
pre
!=
null
)
{
spuId
=
spuId
.
split
(
pre
)[
0
];
}
List
<
GoblinStoreCouponVo
>
listVo
=
redisUtils
.
getGoodsMarketsForCoupon
(
spuId
,
storeId
);
for
(
GoblinStoreCouponVo
vo
:
listVo
)
{
if
(!
returnList
.
contains
(
vo
.
getType
())
&&
LocalDateTime
.
now
().
isAfter
(
vo
.
getStartTime
())
&&
LocalDateTime
.
now
().
isBefore
(
vo
.
getEndTime
()))
{
returnList
.
add
(
vo
.
getType
());
}
}
return
returnList
;
}
@Override
public
ArrayList
<
GoblinStoreCouponVo
>
getSpuByType
(
String
spuId
,
String
storeId
,
String
type
)
{
ArrayList
<
GoblinStoreCouponVo
>
returnList
=
ObjectUtil
.
getGoblinStoreCouponVoArrayList
();
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
spuId
);
if
(
pre
!=
null
)
{
spuId
=
spuId
.
split
(
pre
)[
0
];
}
List
<
GoblinStoreCouponVo
>
listVo
=
redisUtils
.
getGoodsMarketsForCoupon
(
spuId
,
storeId
);
for
(
GoblinStoreCouponVo
vo
:
listVo
)
{
if
(
vo
.
getType
().
equals
(
type
)
&&
LocalDateTime
.
now
().
isAfter
(
vo
.
getStartTime
())
&&
LocalDateTime
.
now
().
isBefore
(
vo
.
getEndTime
()))
{
vo
.
setStock
(
null
);
returnList
.
add
(
vo
);
}
}
return
returnList
;
}
@Override
public
ArrayList
<
Boolean
>
receiveCoupon
(
String
storeCouponId
,
Integer
number
)
{
return
null
;
}
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinOrderServiceImpl.java
View file @
9b781b6a
...
@@ -183,7 +183,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
...
@@ -183,7 +183,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20018"
));
//乱七八糟异常
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20018"
));
//乱七八糟异常
}
else
if
(
e
.
getMessage
().
equals
(
"无权购买"
))
{
}
else
if
(
e
.
getMessage
().
equals
(
"无权购买"
))
{
return
ResponseDto
.
failure
(
e
.
getMessage
());
return
ResponseDto
.
failure
(
e
.
getMessage
());
}
else
if
(
e
.
getMessage
().
equals
(
"券不可用"
))
{
}
else
if
(
e
.
getMessage
().
equals
(
"券不可用"
))
{
return
ResponseDto
.
failure
(
e
.
getMessage
());
return
ResponseDto
.
failure
(
e
.
getMessage
());
}
else
if
(
e
.
getMessage
().
equals
(
"不可购买"
))
{
}
else
if
(
e
.
getMessage
().
equals
(
"不可购买"
))
{
return
ResponseDto
.
failure
(
e
.
getMessage
());
return
ResponseDto
.
failure
(
e
.
getMessage
());
...
@@ -274,7 +274,12 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
...
@@ -274,7 +274,12 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if
(
platVoucherCode
!=
null
&&
!
platVoucherCode
.
equals
(
""
))
{
if
(
platVoucherCode
!=
null
&&
!
platVoucherCode
.
equals
(
""
))
{
String
spuIds
=
""
;
String
spuIds
=
""
;
for
(
GoblinOrderSkuParam
item
:
storeParam
.
getGoblinOrderSkuParamArrayList
())
{
for
(
GoblinOrderSkuParam
item
:
storeParam
.
getGoblinOrderSkuParamArrayList
())
{
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
());
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
item
.
getSpuId
());
if
(
pre
!=
null
)
{
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
().
split
(
pre
)[
0
]);
}
else
{
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
());
}
}
}
HashMap
<
String
,
Object
>
hashMap
=
orderUtils
.
useCoupon
(
platVoucherCode
,
"购买商品["
+
orderCode
+
"]"
,
storeTotalPrice
,
spuIds
);
HashMap
<
String
,
Object
>
hashMap
=
orderUtils
.
useCoupon
(
platVoucherCode
,
"购买商品["
+
orderCode
+
"]"
,
storeTotalPrice
,
spuIds
);
voucherPrice
=
(
BigDecimal
)
hashMap
.
get
(
"voucher"
);
voucherPrice
=
(
BigDecimal
)
hashMap
.
get
(
"voucher"
);
...
...
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