Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
custom-server
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhonghong
custom-server
Commits
74ba29c1
Commit
74ba29c1
authored
Jul 23, 2026
by
pfh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
custom仓库rest接口添加
parent
a9dc8dcd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
251 additions
and
6 deletions
+251
-6
custom-server-app/src/main/java/com/jomalls/custom/app/service/warehouse/CustomWarehouseInfoService.java
+15
-0
custom-server-app/src/main/java/com/jomalls/custom/app/service/warehouse/impl/CustomWarehouseInfoServiceImpl.java
+104
-5
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/CustomWarehouseInfoMapper.java
+7
-0
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/warehouse/CustomWarehouseInfoDomainService.java
+7
-0
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/warehouse/impl/CustomWarehouseInfoDomainServiceImpl.java
+19
-1
custom-server-domain/src/main/resources/mapper/CustomWarehouseInfoMapper.xml
+27
-0
custom-server-webapp/src/main/java/com/jomalls/custom/webapp/controller/rest/CustomWarehouseInfoRestController.java
+72
-0
No files found.
custom-server-app/src/main/java/com/jomalls/custom/app/service/warehouse/CustomWarehouseInfoService.java
View file @
74ba29c1
...
@@ -6,9 +6,12 @@ import com.jomalls.custom.app.dto.warehouse.CustomWarehouseInfoSaveDTO;
...
@@ -6,9 +6,12 @@ import com.jomalls.custom.app.dto.warehouse.CustomWarehouseInfoSaveDTO;
import
com.jomalls.custom.app.dto.warehouse.CustomWarehouseInfoUpdateDTO
;
import
com.jomalls.custom.app.dto.warehouse.CustomWarehouseInfoUpdateDTO
;
import
com.jomalls.custom.app.vo.warehouse.CustomWarehouseInfoSnakeVO
;
import
com.jomalls.custom.app.vo.warehouse.CustomWarehouseInfoSnakeVO
;
import
com.jomalls.custom.app.vo.warehouse.CustomWarehouseInfoVO
;
import
com.jomalls.custom.app.vo.warehouse.CustomWarehouseInfoVO
;
import
com.jomalls.custom.dal.entity.CustomWarehouseInfoEntity
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
/**
/**
* 仓库管理 App Service 接口
* 仓库管理 App Service 接口
...
@@ -53,4 +56,16 @@ public interface CustomWarehouseInfoService {
...
@@ -53,4 +56,16 @@ public interface CustomWarehouseInfoService {
* @param ids 仓库 ID,逗号分隔
* @param ids 仓库 ID,逗号分隔
*/
*/
void
remove
(
String
ids
);
void
remove
(
String
ids
);
List
<
CustomWarehouseInfoVO
>
getOnlineWarehouse
(
String
namespace
);
List
<
CustomWarehouseInfoVO
>
allStatusList
();
Set
<
String
>
checkGoodsBelongWarehouse
(
Map
<
String
,
Long
>
param
);
Set
<
String
>
checkGoodsDirectBelongWarehouse
(
Map
<
String
,
Long
>
param
);
CustomWarehouseInfoVO
selectCustomWarehouseInfoById
(
Long
id
);
List
<
CustomWarehouseInfoVO
>
getByIds
(
Collection
<
Long
>
ids
);
}
}
custom-server-app/src/main/java/com/jomalls/custom/app/service/warehouse/impl/CustomWarehouseInfoServiceImpl.java
View file @
74ba29c1
...
@@ -2,6 +2,7 @@ package com.jomalls.custom.app.service.warehouse.impl;
...
@@ -2,6 +2,7 @@ package com.jomalls.custom.app.service.warehouse.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jomalls.custom.app.dto.warehouse.CustomWarehouseInfoSaveDTO
;
import
com.jomalls.custom.app.dto.warehouse.CustomWarehouseInfoSaveDTO
;
import
com.jomalls.custom.app.dto.warehouse.CustomWarehouseInfoUpdateDTO
;
import
com.jomalls.custom.app.dto.warehouse.CustomWarehouseInfoUpdateDTO
;
...
@@ -17,11 +18,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -17,11 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -93,4 +90,106 @@ public class CustomWarehouseInfoServiceImpl implements CustomWarehouseInfoServic
...
@@ -93,4 +90,106 @@ public class CustomWarehouseInfoServiceImpl implements CustomWarehouseInfoServic
customWarehouseInfoDomainService
.
removeByIds
(
idList
);
customWarehouseInfoDomainService
.
removeByIds
(
idList
);
log
.
info
(
"批量删除仓库成功: ids={}"
,
ids
);
log
.
info
(
"批量删除仓库成功: ids={}"
,
ids
);
}
}
@Override
public
List
<
CustomWarehouseInfoVO
>
getOnlineWarehouse
(
String
namespace
){
LambdaQueryWrapper
<
CustomWarehouseInfoEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
CustomWarehouseInfoEntity:
:
getStatus
,
CustomWarehouseEnums
.
ONLINE
.
status
);
if
(!
"demo"
.
equals
(
namespace
)){
queryWrapper
.
eq
(
CustomWarehouseInfoEntity:
:
getFormal
,
true
);
}
List
<
CustomWarehouseInfoEntity
>
list
=
customWarehouseInfoDomainService
.
list
(
queryWrapper
);
List
<
CustomWarehouseInfoVO
>
customWarehouseInfoVOS
=
BeanMapper
.
snakeCase
().
convertList
(
list
,
CustomWarehouseInfoVO
.
class
);
return
customWarehouseInfoVOS
;
}
@Override
public
List
<
CustomWarehouseInfoVO
>
allStatusList
(){
List
<
CustomWarehouseInfoEntity
>
list
=
customWarehouseInfoDomainService
.
list
();
List
<
CustomWarehouseInfoVO
>
customWarehouseInfoVOS
=
BeanMapper
.
snakeCase
().
convertList
(
list
,
CustomWarehouseInfoVO
.
class
);
return
customWarehouseInfoVOS
;
}
@Override
public
Set
<
String
>
checkGoodsBelongWarehouse
(
Map
<
String
,
Long
>
param
)
{
Map
<
String
,
Set
<
Long
>>
productWarehouseMap
=
this
.
getProductBelongWarehouse
(
param
.
keySet
());
Set
<
String
>
res
=
new
HashSet
<>();
for
(
String
key
:
param
.
keySet
())
{
Set
<
Long
>
set
=
productWarehouseMap
.
get
(
key
);
if
(
set
==
null
||
!
set
.
contains
(
param
.
get
(
key
))){
res
.
add
(
key
);
}
}
return
res
;
}
@Override
public
Set
<
String
>
checkGoodsDirectBelongWarehouse
(
Map
<
String
,
Long
>
param
)
{
Map
<
String
,
Set
<
Long
>>
productWarehouseMap
=
this
.
getProductDirectBelongWarehouse
(
param
.
keySet
());
Set
<
String
>
res
=
new
HashSet
<>();
for
(
String
key
:
param
.
keySet
())
{
Set
<
Long
>
set
=
productWarehouseMap
.
get
(
key
);
if
(
set
==
null
||
!
set
.
contains
(
param
.
get
(
key
))){
res
.
add
(
key
);
}
}
return
res
;
}
/**
* 获取产品直接归属仓库<sku,warehouseId>
* @param param
* @return
*/
public
Map
<
String
,
Set
<
Long
>>
getProductBelongWarehouse
(
Collection
<
String
>
param
){
Map
<
String
,
Set
<
Long
>>
res
=
new
HashMap
<>();
List
<
Map
<
String
,
Object
>>
list
=
customWarehouseInfoDomainService
.
getProductBelongWarehouse
(
param
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
for
(
Map
<
String
,
Object
>
item
:
list
){
String
sku
=
(
String
)
item
.
get
(
"sku"
);
Long
warehouseId
=
(
Long
)
item
.
get
(
"warehouseId"
);
Set
<
Long
>
temp
=
res
.
computeIfAbsent
(
sku
,
k
->
new
HashSet
<>());
if
(
warehouseId
!=
null
){
temp
.
add
(
warehouseId
);
}
}
}
return
res
;
}
/**
* 获取产品直接归属仓库<sku,warehouseId>
* @param param
* @return
*/
public
Map
<
String
,
Set
<
Long
>>
getProductDirectBelongWarehouse
(
Collection
<
String
>
param
){
Map
<
String
,
Set
<
Long
>>
res
=
new
HashMap
<>();
List
<
Map
<
String
,
Object
>>
list
=
customWarehouseInfoDomainService
.
getProductDirectBelongWarehouse
(
param
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
for
(
Map
<
String
,
Object
>
item
:
list
){
String
sku
=
(
String
)
item
.
get
(
"sku"
);
Long
warehouseId
=
(
Long
)
item
.
get
(
"warehouseId"
);
Set
<
Long
>
temp
=
res
.
computeIfAbsent
(
sku
,
k
->
new
HashSet
<>());
if
(
warehouseId
!=
null
){
temp
.
add
(
warehouseId
);
}
}
}
return
res
;
}
@Override
public
CustomWarehouseInfoVO
selectCustomWarehouseInfoById
(
Long
id
)
{
CustomWarehouseInfoEntity
byId
=
customWarehouseInfoDomainService
.
getById
(
id
);
CustomWarehouseInfoVO
convert
=
BeanMapper
.
snakeCase
().
convert
(
byId
,
CustomWarehouseInfoVO
.
class
);
return
convert
;
}
@Override
public
List
<
CustomWarehouseInfoVO
>
getByIds
(
Collection
<
Long
>
ids
)
{
LambdaQueryWrapper
<
CustomWarehouseInfoEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
in
(
CustomWarehouseInfoEntity:
:
getId
,
ids
);
List
<
CustomWarehouseInfoEntity
>
list
=
customWarehouseInfoDomainService
.
list
(
queryWrapper
);
List
<
CustomWarehouseInfoVO
>
customWarehouseInfoVOS
=
BeanMapper
.
snakeCase
().
convertList
(
list
,
CustomWarehouseInfoVO
.
class
);
return
customWarehouseInfoVOS
;
}
}
}
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/CustomWarehouseInfoMapper.java
View file @
74ba29c1
...
@@ -4,6 +4,10 @@ import com.jomalls.custom.dal.entity.CustomWarehouseInfoEntity;
...
@@ -4,6 +4,10 @@ import com.jomalls.custom.dal.entity.CustomWarehouseInfoEntity;
import
com.jomalls.custom.mapper.BaseMapper
;
import
com.jomalls.custom.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author Lizh
* @author Lizh
* @version 0.01
* @version 0.01
...
@@ -12,4 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -12,4 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
*/
@Mapper
@Mapper
public
interface
CustomWarehouseInfoMapper
extends
BaseMapper
<
CustomWarehouseInfoEntity
>
{
public
interface
CustomWarehouseInfoMapper
extends
BaseMapper
<
CustomWarehouseInfoEntity
>
{
List
<
Map
<
String
,
Object
>>
getProductDirectBelongWarehouse
(
Collection
<
String
>
param
);
List
<
Map
<
String
,
Object
>>
getProductBelongWarehouse
(
Collection
<
String
>
param
);
}
}
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/warehouse/CustomWarehouseInfoDomainService.java
View file @
74ba29c1
...
@@ -3,6 +3,10 @@ package com.jomalls.custom.domain.service.warehouse;
...
@@ -3,6 +3,10 @@ package com.jomalls.custom.domain.service.warehouse;
import
com.jomalls.custom.dal.entity.CustomWarehouseInfoEntity
;
import
com.jomalls.custom.dal.entity.CustomWarehouseInfoEntity
;
import
com.jomalls.custom.service.IBaseService
;
import
com.jomalls.custom.service.IBaseService
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author Lizh
* @author Lizh
* @version 0.01
* @version 0.01
...
@@ -11,5 +15,8 @@ import com.jomalls.custom.service.IBaseService;
...
@@ -11,5 +15,8 @@ import com.jomalls.custom.service.IBaseService;
*/
*/
public
interface
CustomWarehouseInfoDomainService
extends
IBaseService
<
CustomWarehouseInfoEntity
>
{
public
interface
CustomWarehouseInfoDomainService
extends
IBaseService
<
CustomWarehouseInfoEntity
>
{
List
<
Map
<
String
,
Object
>>
getProductDirectBelongWarehouse
(
Collection
<
String
>
param
);
List
<
Map
<
String
,
Object
>>
getProductBelongWarehouse
(
Collection
<
String
>
param
);
}
}
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/warehouse/impl/CustomWarehouseInfoDomainServiceImpl.java
View file @
74ba29c1
...
@@ -8,6 +8,10 @@ import org.apache.ibatis.session.SqlSessionFactory;
...
@@ -8,6 +8,10 @@ import org.apache.ibatis.session.SqlSessionFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author Lizh
* @author Lizh
...
@@ -22,6 +26,19 @@ public class CustomWarehouseInfoDomainServiceImpl extends BaseServiceImpl<Custom
...
@@ -22,6 +26,19 @@ public class CustomWarehouseInfoDomainServiceImpl extends BaseServiceImpl<Custom
public
CustomWarehouseInfoDomainServiceImpl
(
SqlSessionFactory
sqlSessionFactory
)
{
public
CustomWarehouseInfoDomainServiceImpl
(
SqlSessionFactory
sqlSessionFactory
)
{
super
(
sqlSessionFactory
);
super
(
sqlSessionFactory
);
}
}
// 自定义方法或者基础方法重写
@Override
public
List
<
Map
<
String
,
Object
>>
getProductDirectBelongWarehouse
(
Collection
<
String
>
param
)
{
return
baseMapper
.
getProductDirectBelongWarehouse
(
param
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
getProductBelongWarehouse
(
Collection
<
String
>
param
)
{
return
baseMapper
.
getProductBelongWarehouse
(
param
);
}
}
}
\ No newline at end of file
custom-server-domain/src/main/resources/mapper/CustomWarehouseInfoMapper.xml
View file @
74ba29c1
...
@@ -87,4 +87,31 @@
...
@@ -87,4 +87,31 @@
(#{item.warehouseName}, #{item.warehouseCode}, #{item.overallLogistics}, #{item.superFactory}, #{item.systemLogistics}, #{item.overallLogisticsScope}, #{item.contactName}, #{item.contactPhone}, #{item.contactEmail}, #{item.countryCode}, #{item.countryName}, #{item.province}, #{item.provinceCode}, #{item.provinceAbb}, #{item.city}, #{item.cityCode}, #{item.district}, #{item.street}, #{item.postcode}, #{item.companyName}, #{item.socialCreditCode}, #{item.remarks}, #{item.updateTime}, #{item.createTime}, #{item.status}, #{item.contactNameCn}, #{item.countryNameCn}, #{item.provinceCn}, #{item.cityCn}, #{item.districtCn}, #{item.streetCn}, #{item.formal}, #{item.settlementCurrency}, #{item.companyNameCn})
(#{item.warehouseName}, #{item.warehouseCode}, #{item.overallLogistics}, #{item.superFactory}, #{item.systemLogistics}, #{item.overallLogisticsScope}, #{item.contactName}, #{item.contactPhone}, #{item.contactEmail}, #{item.countryCode}, #{item.countryName}, #{item.province}, #{item.provinceCode}, #{item.provinceAbb}, #{item.city}, #{item.cityCode}, #{item.district}, #{item.street}, #{item.postcode}, #{item.companyName}, #{item.socialCreditCode}, #{item.remarks}, #{item.updateTime}, #{item.createTime}, #{item.status}, #{item.contactNameCn}, #{item.countryNameCn}, #{item.provinceCn}, #{item.cityCn}, #{item.districtCn}, #{item.streetCn}, #{item.formal}, #{item.settlementCurrency}, #{item.companyNameCn})
</foreach>
</foreach>
</insert>
</insert>
<select
id=
"getProductDirectBelongWarehouse"
resultType=
"java.util.Map"
>
select info.sku sku,warehouse.id warehouseId
from custom_product_info info
left join custom_product_warehouse_rel rel on info.id = rel.product_id
left join custom_warehouse_info warehouse on rel.warehouse_id = warehouse.id
<where>
info.sku in
<foreach
collection=
"param"
index=
"index"
separator=
","
close=
")"
open=
"("
item=
"item"
>
#{item}
</foreach>
</where>
</select>
<select
id=
"getProductBelongWarehouse"
resultType=
"java.util.HashMap"
>
select distinct info.sku sku,warehouse.id warehouseId
from custom_product_info info
left join custom_product_factory_price_rel rel on info.id = rel.product_id
left join db_factory factory on rel.factory_id = factory.id
left join custom_warehouse_info warehouse on factory.id = warehouse.super_factory
<where>
info.sku in
<foreach
collection=
"param"
index=
"index"
separator=
","
close=
")"
open=
"("
item=
"item"
>
#{item}
</foreach>
</where>
</select>
</mapper>
</mapper>
custom-server-webapp/src/main/java/com/jomalls/custom/webapp/controller/rest/CustomWarehouseInfoRestController.java
0 → 100644
View file @
74ba29c1
package
com
.
jomalls
.
custom
.
webapp
.
controller
.
rest
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.jomalls.custom.app.service.warehouse.CustomWarehouseInfoService
;
import
com.jomalls.custom.app.utils.IdUtils
;
import
com.jomalls.custom.utils.AjaxResult
;
import
io.swagger.v3.oas.annotations.Operation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
jomalls
.
custom
.
utils
.
AjaxResult
.
success
;
/**
* custom仓库信息提供的rest接口
*/
@RestController
@RequestMapping
(
"api/v2/rest/customWarehouse"
)
public
class
CustomWarehouseInfoRestController
{
@Autowired
private
CustomWarehouseInfoService
customWarehouseInfoService
;
@Operation
(
summary
=
"查询已上线仓库"
)
@GetMapping
(
"/all"
)
public
AjaxResult
all
(
@RequestParam
(
required
=
true
,
value
=
"namespace"
)
String
namespace
)
{
return
AjaxResult
.
success
(
customWarehouseInfoService
.
getOnlineWarehouse
(
namespace
));
}
@Operation
(
summary
=
"查询所有状态的仓库"
)
@GetMapping
(
"/allStatus"
)
public
AjaxResult
allStatus
()
{
return
AjaxResult
.
success
(
customWarehouseInfoService
.
allStatusList
());
}
@Operation
(
summary
=
"校验商品是否属于对应仓库(商品-工厂-仓库)"
)
@PostMapping
(
"/checkGoodsBelongWarehouse"
)
public
AjaxResult
checkGoodsBelongWarehouse
(
@RequestBody
Map
<
String
,
Long
>
param
)
{
return
AjaxResult
.
success
(
customWarehouseInfoService
.
checkGoodsBelongWarehouse
(
param
));
}
@Operation
(
summary
=
"校验商品直接属于仓库(商品-仓库)"
)
@PostMapping
(
"/checkGoodsDirectBelongWarehouse"
)
public
AjaxResult
checkGoodsDirectBelongWarehouse
(
@RequestBody
Map
<
String
,
Long
>
param
)
{
return
AjaxResult
.
success
(
customWarehouseInfoService
.
checkGoodsDirectBelongWarehouse
(
param
));
}
@Operation
(
summary
=
"根据ID获取仓库信息"
)
@GetMapping
(
"/getById"
)
public
AjaxResult
getById
(
@RequestParam
Long
id
)
{
return
AjaxResult
.
success
(
customWarehouseInfoService
.
selectCustomWarehouseInfoById
(
id
));
}
@Operation
(
summary
=
"根据IDS获取仓库信息"
)
@GetMapping
(
"/getByIds"
)
public
AjaxResult
getByIds
(
@RequestParam
(
"ids"
)
String
ids
)
{
if
(
StringUtils
.
isBlank
(
ids
)){
return
AjaxResult
.
error
(
"参数错误"
);
}
List
<
Long
>
idList
=
IdUtils
.
idsConvertToLongList
(
ids
);
if
(
CollectionUtils
.
isEmpty
(
idList
)){
return
AjaxResult
.
error
(
"参数错误"
);
}
return
success
(
customWarehouseInfoService
.
getByIds
(
idList
));
}
}
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