记得上下班打卡 | 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
8d1a01ab
Commit
8d1a01ab
authored
Feb 24, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev_goblin' into dev_goblin
parents
8316a705
4aafb739
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
121 additions
and
11 deletions
+121
-11
GoblinCouponController.java
...net/service/goblin/controller/GoblinCouponController.java
+1
-1
GoblinPosController.java
...uidnet/service/goblin/controller/GoblinPosController.java
+99
-0
GoblinStoreMgtCouponController.java
...lin/controller/manage/GoblinStoreMgtCouponController.java
+3
-0
GoblinStoreMgtGoodsServiceImpl.java
...n/service/impl/manage/GoblinStoreMgtGoodsServiceImpl.java
+11
-2
GoblinMongoUtils.java
...a/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
+6
-7
GoblinRedisUtils.java
...a/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
+1
-1
No files found.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/GoblinCouponController.java
View file @
8d1a01ab
...
...
@@ -57,7 +57,7 @@ public class GoblinCouponController {
}
@PostMapping
(
"receive"
)
@ApiOperation
(
"
订单状态
"
)
@ApiOperation
(
"
领取券
"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"storeCouponId"
,
value
=
"平台券id"
),
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/GoblinPosController.java
0 → 100644
View file @
8d1a01ab
package
com
.
liquidnet
.
service
.
goblin
.
controller
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
import
com.liquidnet.common.exception.constant.ErrorCode
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.service.base.ErrorMapping
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinUserCouponVo
;
import
com.liquidnet.service.goblin.service.GoblinCouponService
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
import
com.liquidnet.service.goblin.util.ObjectUtil
;
import
io.swagger.annotations.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.constraints.NotBlank
;
import
java.util.ArrayList
;
import
java.util.List
;
@ApiSupport
(
order
=
145001
)
@Api
(
tags
=
"商城:POS机相关"
)
@Slf4j
@RestController
@RequestMapping
(
"store/pos"
)
public
class
GoblinPosController
{
@Autowired
GoblinRedisUtils
goblinRedisUtils
;
@Autowired
GoblinCouponService
goblinCouponService
;
@PostMapping
(
"coupon/receive"
)
@ApiOperation
(
"领取券"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"storeCouponId"
,
value
=
"平台券id"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"uid"
,
value
=
"UID"
),
})
public
ResponseDto
<
Boolean
>
checkOrderResult
(
@NotBlank
(
message
=
"参数无效:storeCouponId"
)
@RequestParam
(
"storeCouponId"
)
String
storeCouponId
,
@NotBlank
(
message
=
"参数无效:uid"
)
@RequestParam
(
"uid"
)
String
uid
)
{
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
GoblinStoreInfoVo
storeInfoVo
=
goblinRedisUtils
.
getStoreInfoVoByUid
(
currentUid
);
GoblinStoreCouponVo
storeCouponVo
=
goblinRedisUtils
.
getStoreCouponVo
(
storeCouponId
);
if
(
null
==
storeCouponVo
)
{
log
.
warn
(
"商城:POS机相关:领取券:优惠券不存在:[uid={},storeCouponId={}]"
,
uid
,
storeCouponId
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"140050"
));
}
else
if
(
null
==
storeInfoVo
)
{
log
.
warn
(
"商城:POS机相关:领取券:未创建店铺不可领取优惠券:[uid={},storeCouponId={}]"
,
uid
,
storeCouponId
);
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"店铺不存在"
);
}
else
if
(!
storeCouponVo
.
getStoreId
().
equals
(
storeInfoVo
.
getStoreId
()))
{
log
.
warn
(
"商城:POS机相关:领取券:非本店铺优惠券不可领取:[uid={},storeId={},storeCouponId={}]"
,
uid
,
storeInfoVo
.
getStoreId
(),
storeCouponId
);
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"非本店铺优惠券不可领取"
);
}
else
if
(!
storeCouponVo
.
getState
().
equals
(
"1"
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"140051"
));
}
List
<
GoblinUserCouponVo
>
userCouponVos
=
goblinRedisUtils
.
getUserCouponVos
(
uid
);
if
(!
CollectionUtils
.
isEmpty
(
userCouponVos
))
{
int
beforeSize
=
userCouponVos
.
size
();
userCouponVos
.
removeIf
(
vo
->
vo
.
getStoreCouponId
().
equals
(
storeCouponId
));
if
((
beforeSize
-
userCouponVos
.
size
())
>=
storeCouponVo
.
getReceiveLimit
())
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"140052"
));
}
}
if
(
storeCouponVo
.
getStock
().
equals
(
0
)
||
goblinRedisUtils
.
getStoreCouponStock
(
storeCouponId
)
>
0
)
{
Boolean
resultFlg
=
goblinCouponService
.
receiveCoupon
(
uid
,
userCouponVos
,
storeCouponVo
);
return
resultFlg
?
ResponseDto
.
success
()
:
ResponseDto
.
failure
();
}
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"140053"
));
}
@ApiOperationSupport
(
order
=
1
)
@ApiOperation
(
value
=
"SKU明细"
)
@PostMapping
(
"goods/skus"
)
public
ResponseDto
<
List
<
Object
>>
list
(
@NotBlank
(
message
=
"参数无效:skuIds"
)
@RequestBody
String
skuids
)
{
log
.
info
(
"商城:POS机相关:SKU列表[skuIds={}]"
,
skuids
);
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
GoblinStoreInfoVo
storeInfoVo
=
goblinRedisUtils
.
getStoreInfoVoByUid
(
currentUid
);
if
(
null
==
storeInfoVo
)
{
log
.
warn
(
"商城:POS机相关:SKU明细:店铺不存在[uid={},skuIds={}]"
,
currentUid
,
skuids
);
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"店铺不存在"
);
}
String
storeId
=
storeInfoVo
.
getStoreId
();
String
[]
skuIdArr
=
skuids
.
split
(
","
);
ArrayList
<
Object
>
skuVoList
=
CollectionUtil
.
arrayListObject
();
for
(
String
skuId
:
skuIdArr
)
{
GoblinGoodsSkuInfoVo
skuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
skuId
);
if
(
storeId
.
equals
(
skuInfoVo
.
getStoreId
()))
{
skuVoList
.
add
(
skuInfoVo
);
}
}
return
ResponseDto
.
success
(
skuVoList
);
}
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/manage/GoblinStoreMgtCouponController.java
View file @
8d1a01ab
...
...
@@ -138,6 +138,9 @@ public class GoblinStoreMgtCouponController {
if
(
null
==
storeCouponVo
)
{
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"参数有误:优惠券不存在"
);
}
if
(
storeCouponVo
.
getState
().
equals
(
"1"
))
{
// 该优惠券活动中
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"该优惠券活动中不可停用"
);
}
if
(
storeCouponVo
.
getState
().
equals
(
"3"
))
{
// 该优惠券已停用
return
ResponseDto
.
failure
(
ErrorCode
.
HTTP_PARAM_ERROR
.
getCode
(),
"该优惠券已停用"
);
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinStoreMgtGoodsServiceImpl.java
View file @
8d1a01ab
...
...
@@ -699,8 +699,17 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
goodsSkuInfoVo
.
setUpdatedAt
(
now
);
goodsSkuInfoVo
.
setDeletedBy
(
uid
);
goodsSkuInfoVo
.
setDeletedAt
(
now
);
if
(
goblinMongoUtils
.
delGoodsSkuInfoVo
(
goodsSkuInfoVo
))
{
goblinRedisUtils
.
delGoodsSkuInfoVo
(
delSkuId
);
List
<
String
>
skuReList
=
goblinRedisUtils
.
getSkuRe
(
delSkuId
);
skuReList
=
null
==
skuReList
?
CollectionUtil
.
arrayListString
()
:
skuReList
;
skuReList
.
add
(
delSkuId
);
if
(
goblinMongoUtils
.
delGoodsSkuInfoVo
(
goodsSkuInfoVo
,
skuReList
))
{
// goblinRedisUtils.delGoodsSkuInfoVo(delSkuId);
// goblinRedisUtils.delGoodsSkuInfoVoByUnShelves(delSkuId);
skuReList
.
forEach
(
skuRe
->
{
goblinRedisUtils
.
delGoodsSkuInfoVo
(
skuRe
);
goblinRedisUtils
.
delGoodsSkuInfoVoByUnShelves
(
skuRe
);
});
BigDecimal
priceGe
=
BigDecimal
.
ZERO
,
priceLe
=
BigDecimal
.
ZERO
;
for
(
String
skuId
:
mgtGoodsInfoVo
.
getSkuIdList
())
{
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
View file @
8d1a01ab
...
...
@@ -498,9 +498,9 @@ public class GoblinMongoUtils {
return
(
List
<
GoblinGoodsSkuInfoVo
>)
mongoTemplate
.
insert
(
vos
,
GoblinGoodsSkuInfoVo
.
class
.
getSimpleName
());
}
public
boolean
delGoodsSkuInfoVo
(
GoblinGoodsSkuInfoVo
vo
)
{
public
boolean
delGoodsSkuInfoVo
(
GoblinGoodsSkuInfoVo
vo
,
List
<
String
>
skuIdList
)
{
return
mongoTemplate
.
getCollection
(
GoblinGoodsSkuInfoVo
.
class
.
getSimpleName
()).
updateOne
(
Query
.
query
(
Criteria
.
where
(
"skuId"
).
is
(
vo
.
getSkuId
()
).
and
(
"delFlg"
).
is
(
"0"
)).
getQueryObject
(),
Query
.
query
(
Criteria
.
where
(
"skuId"
).
is
(
skuIdList
).
and
(
"delFlg"
).
is
(
"0"
)).
getQueryObject
(),
Update
.
update
(
"updatedBy"
,
vo
.
getUpdatedBy
()).
set
(
"updatedAt"
,
vo
.
getUpdatedAt
())
.
set
(
"deletedBy"
,
vo
.
getDeletedBy
()).
set
(
"deletedAt"
,
vo
.
getDeletedAt
()).
getUpdateObject
()
).
getModifiedCount
()
>
0
;
...
...
@@ -1075,21 +1075,20 @@ public class GoblinMongoUtils {
criteria
.
and
(
"state"
).
is
(
filterParam
.
getState
());
}
if
(
StringUtils
.
isNotBlank
(
filterParam
.
getStartTime
()))
{
LocalDateTime
startTime
=
DateUtil
.
Formatter
.
yyyy
_MM_dd
.
parse
(
filterParam
.
getStartTime
());
LocalDateTime
startTime
=
DateUtil
.
Formatter
.
yyyy
MMddHHmmss
.
parse
(
filterParam
.
getStartTime
());
LocalDateTime
startTimeBegin
=
startTime
.
withHour
(
0
).
withMinute
(
0
).
withSecond
(
0
).
withNano
(
0
);
criteria
.
and
(
"startTime"
).
gte
(
startTimeBegin
);
}
if
(
StringUtils
.
isNotBlank
(
filterParam
.
getEndTime
()))
{
LocalDateTime
endTime
=
DateUtil
.
Formatter
.
yyyy
_MM_dd
.
parse
(
filterParam
.
getEndTime
());
LocalDateTime
endTime
=
DateUtil
.
Formatter
.
yyyy
MMddHHmmss
.
parse
(
filterParam
.
getEndTime
());
LocalDateTime
endTimeEnd
=
endTime
.
withHour
(
23
).
withMinute
(
59
).
withSecond
(
59
).
withNano
(
999
);
criteria
.
and
(
"endTime"
).
gte
(
endTimeEnd
);
}
if
(
StringUtils
.
isNotBlank
(
filterParam
.
getCreatedDt
()))
{
LocalDateTime
createDt
=
DateUtil
.
Formatter
.
yyyy_MM_dd
.
parse
(
filterParam
.
getCreatedDt
());
LocalDateTime
createdAtBegin
=
createDt
.
withHour
(
0
).
withMinute
(
0
).
withSecond
(
0
).
withNano
(
0
);
LocalDateTime
createdAtEnd
=
createDt
.
withHour
(
23
).
withMinute
(
59
).
withSecond
(
59
).
withNano
(
999
);
LocalDateTime
createdAtBegin
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
parse
(
filterParam
.
getCreatedDt
()
+
" 00:00:00"
);
LocalDateTime
createdAtEnd
=
createdAtBegin
.
withHour
(
23
).
withMinute
(
59
).
withSecond
(
59
).
withNano
(
999
);
criteria
.
and
(
"createdAt"
).
gte
(
createdAtBegin
).
lte
(
createdAtEnd
);
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
View file @
8d1a01ab
...
...
@@ -97,7 +97,7 @@ public class GoblinRedisUtils {
String
rk
=
GoblinRedisConst
.
SKU_RELATION
.
concat
(
skuId
);
Object
obj
=
redisUtil
.
get
(
rk
);
if
(
obj
==
null
)
{
return
new
ArrayList
();
return
CollectionUtil
.
arrayListString
();
}
else
{
return
(
List
<
String
>)
obj
;
}
...
...
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