记得上下班打卡 | 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
daf529a8
Commit
daf529a8
authored
Nov 08, 2022
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+api:条码识别商品详情:pos机使用;
parent
2d813d6c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
129 additions
and
4 deletions
+129
-4
GoblinFrontGoodDetailVo.java
...uidnet/service/goblin/dto/vo/GoblinFrontGoodDetailVo.java
+3
-0
IGoblinStoreZhengzaiService.java
...t/service/goblin/service/IGoblinStoreZhengzaiService.java
+1
-1
GoblinFrontController.java
...dnet/service/goblin/controller/GoblinFrontController.java
+36
-0
GoblinStoreZhengzaiController.java
...vice/goblin/controller/GoblinStoreZhengzaiController.java
+2
-3
GoblinFrontServiceImpl.java
...t/service/goblin/service/impl/GoblinFrontServiceImpl.java
+87
-0
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/dto/vo/GoblinFrontGoodDetailVo.java
View file @
daf529a8
...
@@ -28,6 +28,9 @@ public class GoblinFrontGoodDetailVo implements Serializable {
...
@@ -28,6 +28,9 @@ public class GoblinFrontGoodDetailVo implements Serializable {
@ApiModelProperty
(
value
=
"商品可参与券类型"
)
@ApiModelProperty
(
value
=
"商品可参与券类型"
)
ArrayList
<
String
>
getSpuType
;
ArrayList
<
String
>
getSpuType
;
@ApiModelProperty
(
value
=
"条码识别到的SKUID列表"
,
notes
=
"仅当条码识别时有效"
)
private
List
<
String
>
hitSkuIdList
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
GoblinFrontGoodDetailVo
obj
=
new
GoblinFrontGoodDetailVo
();
private
static
final
GoblinFrontGoodDetailVo
obj
=
new
GoblinFrontGoodDetailVo
();
...
...
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/service/IGoblinStoreZhengzaiService.java
View file @
daf529a8
...
@@ -20,7 +20,7 @@ public interface IGoblinStoreZhengzaiService {
...
@@ -20,7 +20,7 @@ public interface IGoblinStoreZhengzaiService {
/**
/**
* 正在下单 商铺参与活动的商品列表
* 正在下单 商铺参与活动的商品列表
* @param marketId
* @param marketId
* @param keyword 搜索
内容,支持`SPU名称`、`SKU名称`、`SKU编码
`
* @param keyword 搜索
关键字,支持搜索`SPU名称
`
* @return
* @return
*/
*/
ResponseDto
<
List
<
GoblinZhengzaiGoodVo
>>
getSpuList
(
String
marketId
,
String
keyword
);
ResponseDto
<
List
<
GoblinZhengzaiGoodVo
>>
getSpuList
(
String
marketId
,
String
keyword
);
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/GoblinFrontController.java
View file @
daf529a8
package
com
.
liquidnet
.
service
.
goblin
.
controller
;
package
com
.
liquidnet
.
service
.
goblin
.
controller
;
import
com.liquidnet.common.exception.LiquidnetServiceException
;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.entity.GoblinFrontHotWord
;
import
com.liquidnet.service.goblin.entity.GoblinFrontHotWord
;
import
com.liquidnet.service.goblin.service.impl.GoblinFrontServiceImpl
;
import
com.liquidnet.service.goblin.service.impl.GoblinFrontServiceImpl
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -22,10 +28,13 @@ import java.util.List;
...
@@ -22,10 +28,13 @@ import java.util.List;
* @Description:前端接口
* @Description:前端接口
* @date 2021/12/27 下午6:25
* @date 2021/12/27 下午6:25
*/
*/
@Slf4j
@Api
(
tags
=
"前端接口管理"
)
@Api
(
tags
=
"前端接口管理"
)
@RestController
@RestController
@RequestMapping
(
"/front"
)
@RequestMapping
(
"/front"
)
public
class
GoblinFrontController
{
public
class
GoblinFrontController
{
@Autowired
private
GoblinRedisUtils
goblinRedisUtils
;
@Autowired
@Autowired
private
GoblinFrontServiceImpl
goblinFrontService
;
private
GoblinFrontServiceImpl
goblinFrontService
;
...
@@ -75,6 +84,33 @@ public class GoblinFrontController {
...
@@ -75,6 +84,33 @@ public class GoblinFrontController {
return
ResponseDto
.
success
(
vo
);
return
ResponseDto
.
success
(
vo
);
}
}
@GetMapping
(
"getGoodsDetail2"
)
@ApiOperation
(
value
=
"获得商品详情2"
,
notes
=
"条码识别SKU时使用"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"skuCode"
,
value
=
"SKU条码"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"marketId"
,
value
=
"活动id"
),
})
public
ResponseDto
<
GoblinFrontGoodDetailVo
>
getGoodsDetail2
(
@RequestParam
(
name
=
"skuCode"
)
String
skuNo
,
@RequestParam
(
"marketId"
)
String
marketId
)
{
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
GoblinStoreInfoVo
storeInfoVo
=
goblinRedisUtils
.
getStoreInfoVoByUid
(
currentUid
);
if
(
storeInfoVo
==
null
)
{
return
ResponseDto
.
failure
(
"店铺不存在"
);
}
GoblinFrontGoodDetailVo
vo
;
try
{
vo
=
goblinFrontService
.
getGoodsDetail2
(
skuNo
,
storeInfoVo
.
getStoreId
(),
marketId
);
if
(
vo
==
null
)
{
return
ResponseDto
.
failure
(
"商品不存在"
);
}
}
catch
(
LiquidnetServiceException
e
)
{
return
ResponseDto
.
failure
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"Ex.扫条码识别商品:发生异常[skuNo={},marketId={}]"
,
skuNo
,
marketId
,
e
);
return
ResponseDto
.
failure
(
"识别失败"
);
}
return
ResponseDto
.
success
(
vo
);
}
@GetMapping
(
"getMoudleIndex"
)
@GetMapping
(
"getMoudleIndex"
)
@ApiOperation
(
"获取组件排序"
)
@ApiOperation
(
"获取组件排序"
)
public
ResponseDto
getMoudleIndex
()
throws
ParseException
{
public
ResponseDto
getMoudleIndex
()
throws
ParseException
{
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/GoblinStoreZhengzaiController.java
View file @
daf529a8
...
@@ -38,7 +38,7 @@ public class GoblinStoreZhengzaiController {
...
@@ -38,7 +38,7 @@ public class GoblinStoreZhengzaiController {
@ApiOperation
(
"正在下单-参与活动的spu"
)
@ApiOperation
(
"正在下单-参与活动的spu"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"marketId"
,
value
=
"活动id"
,
example
=
"1"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"marketId"
,
value
=
"活动id"
,
example
=
"1"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
false
,
dataType
=
"String"
,
name
=
"kw"
,
value
=
"搜索
内容【1~64位】,支持`SPU名称`、`SKU名称`、`SKU编码
`"
,
example
=
""
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
false
,
dataType
=
"String"
,
name
=
"kw"
,
value
=
"搜索
关键字【1~64位】支持搜索`SPU名称
`"
,
example
=
""
),
})
})
public
ResponseDto
<
List
<
GoblinZhengzaiGoodVo
>>
getStoreList
(
@RequestParam
(
"marketId"
)
@Valid
String
marketId
,
public
ResponseDto
<
List
<
GoblinZhengzaiGoodVo
>>
getStoreList
(
@RequestParam
(
"marketId"
)
@Valid
String
marketId
,
@RequestParam
(
value
=
"kw"
,
required
=
false
)
@Size
(
min
=
1
,
max
=
64
,
message
=
"搜索内容长度超出范围1~64位"
)
String
keyword
)
{
@RequestParam
(
value
=
"kw"
,
required
=
false
)
@Size
(
min
=
1
,
max
=
64
,
message
=
"搜索内容长度超出范围1~64位"
)
String
keyword
)
{
...
@@ -50,8 +50,7 @@ public class GoblinStoreZhengzaiController {
...
@@ -50,8 +50,7 @@ public class GoblinStoreZhengzaiController {
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"marketId"
,
value
=
"活动id"
,
example
=
"1"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"marketId"
,
value
=
"活动id"
,
example
=
"1"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"Integet"
,
name
=
"page"
,
value
=
"页数"
,
example
=
"1"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"Integet"
,
name
=
"page"
,
value
=
"页数"
,
example
=
"1"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
false
,
dataType
=
"String"
,
name
=
"kw"
,
value
=
"搜索内容【1~64位】,支持`SPU名称`、`SKU名称`、`SKU编码`"
,
example
=
""
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
false
,
dataType
=
"String"
,
name
=
"kw"
,
value
=
"搜索关键字【1~64位】支持搜索`SPU名称`"
,
example
=
""
),
})
})
public
ResponseDto
<
GoblinZhengzaiGoodPageVo
>
getStoreList2
(
@RequestParam
(
"marketId"
)
@Valid
String
marketId
,
public
ResponseDto
<
GoblinZhengzaiGoodPageVo
>
getStoreList2
(
@RequestParam
(
"marketId"
)
@Valid
String
marketId
,
@RequestParam
(
"page"
)
@Valid
Integer
page
,
@RequestParam
(
"page"
)
@Valid
Integer
page
,
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinFrontServiceImpl.java
View file @
daf529a8
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.goblin.service.impl;
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.goblin.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.common.exception.LiquidnetServiceException
;
import
com.liquidnet.commons.lang.util.*
;
import
com.liquidnet.commons.lang.util.*
;
import
com.liquidnet.service.base.ErrorMapping
;
import
com.liquidnet.service.base.ErrorMapping
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.ResponseDto
;
...
@@ -32,6 +33,7 @@ import org.springframework.data.mongodb.core.query.Collation;
...
@@ -32,6 +33,7 @@ import org.springframework.data.mongodb.core.query.Collation;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.text.ParseException
;
...
@@ -39,6 +41,7 @@ import java.text.SimpleDateFormat;
...
@@ -39,6 +41,7 @@ import java.text.SimpleDateFormat;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
@Service
@Service
@Slf4j
@Slf4j
...
@@ -345,6 +348,90 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
...
@@ -345,6 +348,90 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
return
goblinFrontGoodDetailVo
;
return
goblinFrontGoodDetailVo
;
}
}
/**
* 根据条码获得商品详情
*/
public
GoblinFrontGoodDetailVo
getGoodsDetail2
(
String
skuNo
,
String
storeId
,
String
marketId
)
{
Criteria
skuCriteria
=
Criteria
.
where
(
"delFlg"
).
is
(
"0"
).
and
(
"storeId"
).
is
(
storeId
).
and
(
"skuNo"
).
is
(
skuNo
);
Query
skuQuery
=
Query
.
query
(
skuCriteria
);
skuQuery
.
fields
().
include
(
"spuId"
).
include
(
"skuId"
);
List
<
GoblinGoodsSkuInfoVo
>
skuQueryResultList
=
mongoTemplate
.
find
(
skuQuery
,
GoblinGoodsSkuInfoVo
.
class
,
GoblinGoodsSkuInfoVo
.
class
.
getSimpleName
());
if
(
CollectionUtils
.
isEmpty
(
skuQueryResultList
))
{
return
null
;
}
List
<
String
>
skuQueryResultSpuIdList
=
skuQueryResultList
.
stream
().
map
(
GoblinGoodsSkuInfoVo:
:
getSpuId
).
collect
(
Collectors
.
toList
());
Criteria
criteria
=
Criteria
.
where
(
"delFlg"
).
is
(
"0"
).
and
(
"storeId"
).
is
(
storeId
).
and
(
"spuId"
).
in
(
skuQueryResultSpuIdList
)
.
and
(
"marketId"
).
is
(
GoblinStatusConst
.
MarketPreStatus
.
MARKET_PRE_ZHENGZAI
.
getValue
().
concat
(
marketId
));
Query
query
=
Query
.
query
(
criteria
);
List
<
GoblinGoodsInfoVo
>
goblinGoodsInfoVos
=
mongoTemplate
.
find
(
query
,
GoblinGoodsInfoVo
.
class
,
GoblinGoodsInfoVo
.
class
.
getSimpleName
());
if
(
CollectionUtils
.
isEmpty
(
goblinGoodsInfoVos
))
{
return
null
;
}
else
if
(
goblinGoodsInfoVos
.
size
()
>
1
)
{
throw
new
LiquidnetServiceException
(
"-1"
,
"条码识别到多个商品,请更正处理"
);
}
String
spuId
=
goblinGoodsInfoVos
.
get
(
0
).
getSpuId
();
Integer
buyCount
=
0
;
GoblinFrontGoodDetailVo
goblinFrontGoodDetailVo
=
GoblinFrontGoodDetailVo
.
getNew
();
GoblinGoodsInfoVo
goblinGoodsInfoVo
=
goblinRedisUtils
.
getGoodsInfoVo
(
spuId
);
GoblinGoodsInfoDetailVo
goblinGoodsInfoDetailVo
=
GoblinGoodsInfoDetailVo
.
getNew
();
//skuIdList
if
(
null
!=
goblinGoodsInfoVo
)
{
BeanUtils
.
copyProperties
(
goblinGoodsInfoVo
,
goblinGoodsInfoDetailVo
);
goblinFrontGoodDetailVo
.
setGoblinGoodsInfoVo
(
goblinGoodsInfoDetailVo
);
// int limit= getStockCount(goblinGoodsInfoVo.getStoreId());
List
<
String
>
skuIdList
=
goblinGoodsInfoVo
.
getSkuIdList
();
ArrayList
<
GoblinGoodsSkuInfoDetailVo
>
list
=
ObjectUtil
.
goblinGoodsSkuInfoDetailVos
();
for
(
String
sku
:
skuIdList
)
{
String
userId
=
CurrentUtil
.
getCurrentUid
();
if
(
StringUtils
.
isNotBlank
(
userId
))
{
buyCount
=
goblinRedisUtils
.
getSkuCountByUid
(
userId
,
sku
);
}
GoblinGoodsSkuInfoVo
goblinGoodsSkuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
sku
);
if
(
null
!=
goblinGoodsSkuInfoVo
&&
goblinGoodsSkuInfoVo
.
getDelFlg
().
equals
(
"0"
)
&&
goblinGoodsSkuInfoVo
.
getShelvesStatus
().
equals
(
"3"
))
{
//获取 sku 库存数量
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
spuId
);
int
stock
=
goblinRedisUtils
.
getSkuStock
(
pre
,
goblinGoodsSkuInfoVo
.
getSkuId
());
log
.
debug
(
"skuId:{},库存数量{}"
,
goblinGoodsSkuInfoVo
.
getSkuId
(),
stock
);
GoblinGoodsSkuInfoDetailVo
goblinGoodsSkuInfoDetailVo
=
GoblinGoodsSkuInfoDetailVo
.
getNew
();
BeanUtils
.
copyProperties
(
goblinGoodsSkuInfoVo
,
goblinGoodsSkuInfoDetailVo
);
if
(
0
!=
goblinGoodsSkuInfoDetailVo
.
getBuyLimit
())
{
if
(
null
==
buyCount
)
{
buyCount
=
0
;
}
goblinGoodsSkuInfoDetailVo
.
setCanBuy
(
goblinGoodsSkuInfoDetailVo
.
getBuyLimit
()
-
buyCount
);
}
else
{
goblinGoodsSkuInfoDetailVo
.
setCanBuy
(-
9999
);
}
if
(
stock
<=
0
)
{
goblinGoodsSkuInfoDetailVo
.
setStockLess
(
true
);
}
else
{
goblinGoodsSkuInfoDetailVo
.
setStockLess
(
false
);
}
goblinGoodsSkuInfoDetailVo
.
setRestStock
(
stock
);
list
.
add
(
goblinGoodsSkuInfoDetailVo
);
}
}
//goblinGoodsInfoVo
GoblinStoreInfoVo
goblinStoreInfoVo
=
this
.
getStore
(
goblinGoodsInfoVo
.
getStoreId
());
if
(
null
!=
goblinStoreInfoVo
)
{
goblinFrontGoodDetailVo
.
setStoreName
(
goblinStoreInfoVo
.
getStoreName
());
}
goblinFrontGoodDetailVo
.
setGoblinGoodsSkuInfoVolist
(
list
);
}
else
{
return
null
;
}
ArrayList
<
String
>
list
=
goblinCouponService
.
getSpuType
(
spuId
,
goblinGoodsInfoDetailVo
.
getStoreId
());
goblinFrontGoodDetailVo
.
setGetSpuType
(
list
);
// 设置条码命中的SKUID列表
List
<
String
>
hitSkuIdList
=
skuQueryResultList
.
stream
().
filter
(
r
->
r
.
getSpuId
().
equals
(
spuId
)).
map
(
GoblinGoodsSkuInfoVo:
:
getSkuId
).
collect
(
Collectors
.
toList
());
goblinFrontGoodDetailVo
.
setHitSkuIdList
(
hitSkuIdList
);
return
goblinFrontGoodDetailVo
;
}
/**
/**
* 获取组件排序
* 获取组件排序
*/
*/
...
...
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