Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yanxuan-qc-change-system
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
yx-qc-change-flow
yanxuan-qc-change-system
Commits
4fd26689
Commit
4fd26689
authored
Apr 10, 2023
by
穆龙飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify:增加查询接口数据返回
parent
850a2fb8
Pipeline
#47144
passed with stages
in 1 minute 20 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
33 deletions
+90
-33
ISupplierItemService.java
...mail/yanxuan/change/biz/service/ISupplierItemService.java
+3
-1
SupplierItemServiceImpl.java
...xuan/change/biz/service/impl/SupplierItemServiceImpl.java
+41
-14
SupplierItemSkuVO.java
...il/yanxuan/change/integration/todo/SupplierItemSkuVO.java
+17
-0
SupplierItemVO.java
.../mail/yanxuan/change/integration/todo/SupplierItemVO.java
+11
-0
SupplierController.java
...ail/yanxuan/change/web/controller/SupplierController.java
+18
-18
No files found.
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/service/ISupplierItemService.java
View file @
4fd26689
...
...
@@ -13,7 +13,9 @@ public interface ISupplierItemService {
* @param itemName
* @param page
* @param pageSize
* @param skuId
* @return
*/
SupplierItemPageVO
supplierGoodsInfoBySupplier
(
SupplierGoodsInfoReq
supplierGoodsInfoReq
,
String
itemId
,
String
itemName
,
Integer
page
,
Integer
pageSize
);
SupplierItemPageVO
supplierGoodsInfoBySupplier
(
SupplierGoodsInfoReq
supplierGoodsInfoReq
,
String
itemId
,
String
itemName
,
Integer
page
,
Integer
pageSize
,
String
skuId
);
}
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/service/impl/SupplierItemServiceImpl.java
View file @
4fd26689
package
com
.
netease
.
mail
.
yanxuan
.
change
.
biz
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
com.netease.mail.yanxuan.change.integration.item.meta.SkuTo
;
import
com.netease.mail.yanxuan.change.integration.todo.SupplierItemSkuVO
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.netease.mail.yanxuan.change.biz.service.ISupplierItemService
;
import
com.netease.mail.yanxuan.change.common.bean.AjaxResult
;
import
com.netease.mail.yanxuan.change.integration.flow.supplier.FlowRpcSupplierSendService
;
...
...
@@ -12,15 +24,6 @@ import com.netease.mail.yanxuan.change.integration.todo.PageVO;
import
com.netease.mail.yanxuan.change.integration.todo.SupplierItemPageVO
;
import
com.netease.mail.yanxuan.change.integration.todo.SupplierItemVO
;
import
com.netease.yanxuan.flowx.sdk.meta.controller.communal.AjaxResponse
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@Service
public
class
SupplierItemServiceImpl
implements
ISupplierItemService
{
...
...
@@ -32,15 +35,18 @@ public class SupplierItemServiceImpl implements ISupplierItemService {
private
ItemRpcService
itemRpcService
;
@Override
public
SupplierItemPageVO
supplierGoodsInfoBySupplier
(
SupplierGoodsInfoReq
supplierGoodsInfoReq
,
String
itemId
,
String
itemName
,
Integer
page
,
Integer
pageSize
)
{
AjaxResponse
<
List
<
SupplierGoodsInfoRsp
>>
listAjaxResponse
=
flowRpcSupplierSendService
.
supplierGoodsInfoBySupplier
(
supplierGoodsInfoReq
);
public
SupplierItemPageVO
supplierGoodsInfoBySupplier
(
SupplierGoodsInfoReq
supplierGoodsInfoReq
,
String
itemId
,
String
itemName
,
Integer
page
,
Integer
pageSize
,
String
skuId
)
{
AjaxResponse
<
List
<
SupplierGoodsInfoRsp
>>
listAjaxResponse
=
flowRpcSupplierSendService
.
supplierGoodsInfoBySupplier
(
supplierGoodsInfoReq
);
List
<
SupplierGoodsInfoRsp
>
data
=
listAjaxResponse
.
getData
();
List
<
SpuTO
>
spuTOList
=
new
ArrayList
<>();
if
(
data
!=
null
)
{
Set
<
Long
>
fullItemIds
=
data
.
stream
().
map
(
SupplierGoodsInfoRsp:
:
getItemId
).
collect
(
Collectors
.
toSet
());
while
(
fullItemIds
.
size
()
>
200
)
{
List
<
Long
>
itemIds
=
new
ArrayList
<>(
fullItemIds
).
subList
(
0
,
200
);
AjaxResult
<
List
<
SpuTO
>>
listAjaxResult
=
itemRpcService
.
batchQuerySpuInfo
(
BatchQuerySpuInfoParam
.
builder
().
ids
(
itemIds
).
build
());
AjaxResult
<
List
<
SpuTO
>>
listAjaxResult
=
itemRpcService
.
batchQuerySpuInfo
(
BatchQuerySpuInfoParam
.
builder
().
ids
(
itemIds
).
build
());
List
<
SpuTO
>
pageSpuTo
=
listAjaxResult
.
getData
();
if
(!
CollectionUtils
.
isEmpty
(
pageSpuTo
))
{
spuTOList
.
addAll
(
pageSpuTo
);
...
...
@@ -48,18 +54,30 @@ public class SupplierItemServiceImpl implements ISupplierItemService {
fullItemIds
.
removeAll
(
itemIds
);
}
List
<
Long
>
itemIds
=
new
ArrayList
<>(
fullItemIds
);
AjaxResult
<
List
<
SpuTO
>>
listAjaxResult
=
itemRpcService
.
batchQuerySpuInfo
(
BatchQuerySpuInfoParam
.
builder
().
ids
(
itemIds
).
build
());
AjaxResult
<
List
<
SpuTO
>>
listAjaxResult
=
itemRpcService
.
batchQuerySpuInfo
(
BatchQuerySpuInfoParam
.
builder
().
ids
(
itemIds
).
build
());
List
<
SpuTO
>
pageSpuTo
=
listAjaxResult
.
getData
();
if
(!
CollectionUtils
.
isEmpty
(
pageSpuTo
))
{
spuTOList
.
addAll
(
pageSpuTo
);
}
}
if
(
StringUtils
.
isNotBlank
(
itemId
))
{
spuTOList
=
spuTOList
.
stream
().
filter
(
i
->
Long
.
valueOf
(
itemId
).
equals
(
i
.
getId
())).
collect
(
Collectors
.
toList
());
spuTOList
=
spuTOList
.
stream
().
filter
(
i
->
Long
.
valueOf
(
itemId
).
equals
(
i
.
getId
()))
.
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
itemName
))
{
spuTOList
=
spuTOList
.
stream
().
filter
(
i
->
i
.
getName
().
contains
(
itemName
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
skuId
))
{
spuTOList
=
spuTOList
.
stream
().
filter
(
i
->
{
List
<
Long
>
skuIds
=
i
.
getSkuList
().
stream
().
map
(
SkuTo:
:
getId
).
collect
(
Collectors
.
toList
());
if
(
skuIds
.
contains
(
Long
.
valueOf
(
skuId
)))
{
return
Boolean
.
TRUE
;
}
else
{
return
Boolean
.
FALSE
;
}
}).
collect
(
Collectors
.
toList
());
}
PageVO
pageVO
=
buildPageVo
(
spuTOList
.
size
(),
page
,
pageSize
);
Integer
endIndex
=
page
*
pageSize
;
if
(
page
*
pageSize
>
spuTOList
.
size
())
{
...
...
@@ -70,6 +88,15 @@ public class SupplierItemServiceImpl implements ISupplierItemService {
SupplierItemVO
supplierItemVO
=
new
SupplierItemVO
();
supplierItemVO
.
setItemId
(
i
.
getId
());
supplierItemVO
.
setItemName
(
i
.
getName
());
supplierItemVO
.
setSpecList
(
i
.
getSpecList
());
List
<
SupplierItemSkuVO
>
skuVOList
=
i
.
getSkuList
().
stream
().
map
(
s
->
{
SupplierItemSkuVO
supplierItemSkuVO
=
new
SupplierItemSkuVO
();
supplierItemSkuVO
.
setSkuId
(
s
.
getId
());
supplierItemSkuVO
.
setSkuName
(
s
.
getDisplayName
());
supplierItemSkuVO
.
setSkuSpecCombine
(
s
.
getSkuSpecCombine
());
return
supplierItemSkuVO
;
}).
collect
(
Collectors
.
toList
());
supplierItemVO
.
setItemSkuVOList
(
skuVOList
);
return
supplierItemVO
;
}).
collect
(
Collectors
.
toList
());
return
SupplierItemPageVO
.
builder
().
pageVo
(
pageVO
).
supplierItemVOList
(
supplierItemVOList
).
build
();
...
...
yanxuan-qc-change-system-integration/src/main/java/com/netease/mail/yanxuan/change/integration/todo/SupplierItemSkuVO.java
0 → 100644
View file @
4fd26689
package
com
.
netease
.
mail
.
yanxuan
.
change
.
integration
.
todo
;
import
com.netease.mail.yanxuan.change.integration.item.meta.SkuSpecCombineTO
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
SupplierItemSkuVO
{
private
Long
skuId
;
private
String
skuName
;
//SKU规格构成对象
private
List
<
SkuSpecCombineTO
>
skuSpecCombine
;
}
yanxuan-qc-change-system-integration/src/main/java/com/netease/mail/yanxuan/change/integration/todo/SupplierItemVO.java
View file @
4fd26689
package
com
.
netease
.
mail
.
yanxuan
.
change
.
integration
.
todo
;
import
com.netease.mail.yanxuan.change.integration.item.meta.SkuSpecTO
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
@Data
@Builder
@AllArgsConstructor
...
...
@@ -20,4 +23,12 @@ public class SupplierItemVO {
* 商品名称
*/
private
String
itemName
;
/**
* 商品sku
*/
private
List
<
SupplierItemSkuVO
>
itemSkuVOList
;
//SPU关联的规格信息列表
private
List
<
SkuSpecTO
>
specList
;
}
yanxuan-qc-change-system-web/src/main/java/com/netease/mail/yanxuan/change/web/controller/SupplierController.java
View file @
4fd26689
package
com
.
netease
.
mail
.
yanxuan
.
change
.
web
.
controller
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSON
;
import
com.netease.mail.yanxuan.change.biz.config.AppConfig
;
import
com.netease.mail.yanxuan.change.biz.service.ISupplierItemService
;
...
...
@@ -9,19 +17,11 @@ import com.netease.mail.yanxuan.change.integration.flow.supplier.FlowRpcSupplier
import
com.netease.mail.yanxuan.change.integration.flow.supplier.FlowRpcSupplierService
;
import
com.netease.mail.yanxuan.change.integration.flow.supplier.req.SupplierGoodsInfoReq
;
import
com.netease.mail.yanxuan.change.integration.flow.supplier.req.SupplierSearchRemoteReq
;
import
com.netease.mail.yanxuan.change.integration.flow.supplier.rsp.SupplierInfoRsp
;
import
com.netease.mail.yanxuan.change.integration.flow.supplier.rsp.SupplierSimpleRsp
;
import
com.netease.mail.yanxuan.change.integration.todo.SupplierItemPageVO
;
import
com.netease.yanxuan.flowx.sdk.meta.controller.communal.AjaxResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Collections
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @author WangJiaXiang
...
...
@@ -46,9 +46,9 @@ public class SupplierController {
@GetMapping
(
"/query/supplier/infos"
)
public
AjaxResult
<
List
<
SupplierSimpleRsp
>>
querySupplierInfos
(
@RequestParam
(
name
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
name
=
"uid"
,
required
=
false
)
String
uid
,
@RequestParam
(
name
=
"fuzzySearchText"
)
String
fuzzySearchText
)
{
@RequestParam
(
name
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
name
=
"uid"
,
required
=
false
)
String
uid
,
@RequestParam
(
name
=
"fuzzySearchText"
)
String
fuzzySearchText
)
{
SupplierSearchRemoteReq
req
=
new
SupplierSearchRemoteReq
();
req
.
setSearchText
(
fuzzySearchText
);
AjaxResult
<
List
<
SupplierSimpleRsp
>>
supplierInfo
=
supplierSendService
.
queryByConditionForQc
(
req
);
...
...
@@ -56,19 +56,19 @@ public class SupplierController {
return
supplierInfo
;
}
log
.
error
(
"[querySupplierInfos] querySupplierInfos failed, name={},uid={},fuzzySearchText={}, errMsg={}"
,
name
,
uid
,
fuzzySearchText
,
JSON
.
toJSONString
(
supplierInfo
));
uid
,
fuzzySearchText
,
JSON
.
toJSONString
(
supplierInfo
));
return
null
;
}
@GetMapping
(
"/query/supplier/item"
)
public
AjaxResponse
<
SupplierItemPageVO
>
querySupplier
(
@RequestParam
String
supplier
,
@RequestParam
(
required
=
false
)
String
itemId
,
@RequestParam
(
required
=
false
)
String
itemName
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
)
{
@RequestParam
(
required
=
false
)
String
itemId
,
@RequestParam
(
required
=
false
)
String
itemName
,
@RequestParam
(
required
=
false
)
String
skuId
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
)
{
SupplierGoodsInfoReq
supplierGoodsInfoReq
=
new
SupplierGoodsInfoReq
();
supplierGoodsInfoReq
.
setSupplierIds
(
supplier
);
return
AjaxResponse
.
initSuccessResult
(
supplierItemService
.
supplierGoodsInfoBySupplier
(
supplierGoodsInfoReq
,
itemId
,
itemName
,
page
,
pageSize
));
return
AjaxResponse
.
initSuccessResult
(
supplierItemService
.
supplierGoodsInfoBySupplier
(
supplierGoodsInfoReq
,
itemId
,
itemName
,
page
,
pageSize
,
skuId
));
}
}
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