记得上下班打卡 | 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
9def8731
Commit
9def8731
authored
Mar 01, 2022
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~API:添加优惠券:当前时间时直接开始活动处理;
~API:添加优惠券:+时间校验;
parent
7795e953
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
GoblinStoreMgtCouponController.java
...lin/controller/manage/GoblinStoreMgtCouponController.java
+14
-1
GoblinStoreMgtCouponServiceImpl.java
.../service/impl/manage/GoblinStoreMgtCouponServiceImpl.java
+22
-0
No files found.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/manage/GoblinStoreMgtCouponController.java
View file @
9def8731
...
...
@@ -41,6 +41,7 @@ import javax.validation.constraints.NotNull;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.time.LocalDateTime
;
import
java.util.Iterator
;
import
java.util.List
;
...
...
@@ -207,6 +208,10 @@ public class GoblinStoreMgtCouponController {
storeCouponBasicVo
.
setDeduction
(
mgtCouponAddParam
.
getValMinus
());
break
;
}
LocalDateTime
startTime
=
storeCouponBasicVo
.
getStartTime
(),
endTime
=
storeCouponBasicVo
.
getEndTime
();
if
(
startTime
.
isEqual
(
endTime
)
||
startTime
.
isAfter
(
endTime
)
||
endTime
.
isBefore
(
LocalDateTime
.
now
()))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"活动开始、结束时间无效"
);
}
List
<
String
>
spuIdList
=
storeCouponBasicVo
.
getSpuIdList
();
if
(
storeCouponBasicVo
.
getUseScope
().
equals
(
"1"
)
&&
!
CollectionUtils
.
isEmpty
(
spuIdList
))
{
...
...
@@ -265,9 +270,17 @@ public class GoblinStoreMgtCouponController {
log
.
debug
(
"商铺活动:优惠券编辑:[mgtCouponEditParam={}]"
,
JsonUtils
.
toJson
(
mgtCouponEditParam
));
}
GoblinStoreCouponBasicVo
storeCouponBasicVo
=
mgtCouponEditParam
.
initStoreCouponBasicInfo
();
LocalDateTime
startTime
=
storeCouponBasicVo
.
getStartTime
(),
endTime
=
storeCouponBasicVo
.
getEndTime
();
if
(
startTime
.
isEqual
(
endTime
)
||
startTime
.
isAfter
(
endTime
)
||
endTime
.
isBefore
(
LocalDateTime
.
now
()))
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"活动开始、结束时间无效"
);
}
LocalDateTime
befStartTime
=
storeCouponVo
.
getStartTime
();
if
(
befStartTime
.
minusMinutes
(
10
).
isAfter
(
storeCouponBasicVo
.
getStartTime
()))
{
storeCouponBasicVo
.
setStartTime
(
startTime
);
}
storeCouponBasicVo
.
setType
(
storeCouponVo
.
getType
());
storeCouponBasicVo
.
setState
(
storeCouponVo
.
getState
());
storeCouponBasicVo
.
setStartTime
(
storeCouponVo
.
getStartTime
());
storeCouponBasicVo
.
setStock
(
storeCouponVo
.
getStock
());
// 这里库存不允许编辑修改,只可在列表页编辑'增减库存'
switch
(
storeCouponBasicVo
.
getType
())
{
case
"1"
:
// 代金
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinStoreMgtCouponServiceImpl.java
View file @
9def8731
...
...
@@ -136,6 +136,9 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
String
storeCouponId
=
IDGenerator
.
nextMilliId
();
LocalDateTime
now
=
LocalDateTime
.
now
();
boolean
activityStartFlg
=
storeCouponBasicVo
.
getStartTime
().
isBefore
(
now
);
storeCouponBasicVo
.
setState
(
activityStartFlg
?
"1"
:
"0"
);
storeCouponBasicVo
.
setStoreCouponId
(
storeCouponId
);
storeCouponBasicVo
.
setStoreCouponNo
(
storeCouponId
);
storeCouponBasicVo
.
setDelFlg
(
"0"
);
...
...
@@ -148,6 +151,14 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
goblinRedisUtils
.
setStoreCouponStock
(
storeCouponId
,
stock
);
}
if
(
activityStartFlg
)
{
// 活动已开始,处理店铺活动数据
GoblinStoreMarketDto
storeMarketDto
=
GoblinStoreMarketDto
.
getNew
();
storeMarketDto
.
setId
(
storeCouponId
);
storeMarketDto
.
setType
(
1
);
goblinRedisUtils
.
addStoreMarketDto
(
storeCouponBasicVo
.
getStoreId
(),
storeMarketDto
);
}
LinkedList
<
String
>
toMqSqls
=
CollectionUtil
.
linkedListString
();
toMqSqls
.
add
(
SqlMapping
.
get
(
"goblin_store_coupon.insert"
));
LinkedList
<
Object
[]>
initStoreCouponObjs
=
CollectionUtil
.
linkedListObjectArr
();
...
...
@@ -210,10 +221,21 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
String
storeCouponId
=
storeCouponBasicVo
.
getStoreCouponId
();
LocalDateTime
now
=
LocalDateTime
.
now
();
boolean
activityStopFlg
=
storeCouponBasicVo
.
getEndTime
().
isBefore
(
now
);
storeCouponBasicVo
.
setState
(
activityStopFlg
?
"2"
:
storeCouponBasicVo
.
getState
());
storeCouponBasicVo
.
setUpdatedAt
(
now
);
storeCouponBasicVo
.
setUpdatedBy
(
uid
);
if
(
goblinMongoUtils
.
updateMgtStoreCouponBasicVo
(
storeCouponBasicVo
))
{
if
(
activityStopFlg
)
{
// 活动已结束,处理店铺活动数据
GoblinStoreMarketDto
storeMarketDto
=
GoblinStoreMarketDto
.
getNew
();
storeMarketDto
.
setId
(
storeCouponId
);
storeMarketDto
.
setType
(
1
);
goblinRedisUtils
.
delStoreMarketDto
(
storeCouponBasicVo
.
getStoreId
(),
storeMarketDto
);
}
goblinRedisUtils
.
del
(
GoblinRedisConst
.
STORE_COUPON
.
concat
(
storeCouponId
));
// 删除REDIS缓存
goblinRedisUtils
.
del
(
GoblinRedisConst
.
STORE_COUPON_RULE
.
concat
(
storeCouponId
));
// 删除REDIS缓存
...
...
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