Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
5cc0f983
Commit
5cc0f983
authored
Sep 08, 2024
by
zhengyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取仓库区域并行国家、城市、仓库列表
parent
392d0842
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
2 deletions
+87
-2
WarehouseService.java
...module/depository/service/warehouse/WarehouseService.java
+1
-0
WarehouseServiceImpl.java
...pository/service/warehouse/impl/WarehouseServiceImpl.java
+48
-2
WarehouseListVO.java
...yudao/module/depository/vo/warehouse/WarehouseListVO.java
+23
-0
WarehouseController.java
...itory/controller/admin/warehouse/WarehouseController.java
+8
-0
AppWarehouseController.java
...tory/controller/app/warehouse/AppWarehouseController.java
+7
-0
No files found.
yudao-module-depository/yudao-module-depository-core/src/main/java/cn/iocoder/yudao/module/depository/service/warehouse/WarehouseService.java
View file @
5cc0f983
...
@@ -176,4 +176,5 @@ public interface WarehouseService {
...
@@ -176,4 +176,5 @@ public interface WarehouseService {
List
<
WarehouseTreeVO
>
getWarehouseTreeList
(
Integer
tradeType
);
List
<
WarehouseTreeVO
>
getWarehouseTreeList
(
Integer
tradeType
);
WarehouseListVO
getGuojiaAndShiAndWarehouseList
(
Integer
tradeType
);
}
}
yudao-module-depository/yudao-module-depository-core/src/main/java/cn/iocoder/yudao/module/depository/service/warehouse/impl/WarehouseServiceImpl.java
View file @
5cc0f983
...
@@ -29,6 +29,7 @@ import org.redisson.api.RLock;
...
@@ -29,6 +29,7 @@ import org.redisson.api.RLock;
import
org.redisson.api.RedissonClient
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Caching
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -62,7 +63,10 @@ public class WarehouseServiceImpl implements WarehouseService {
...
@@ -62,7 +63,10 @@ public class WarehouseServiceImpl implements WarehouseService {
private
DictDataApi
dictDataApi
;
private
DictDataApi
dictDataApi
;
@Override
@Override
@CacheEvict
(
cacheNames
=
"jd:warehouse:tree"
,
key
=
"#createReqVO.tradeType"
)
@Caching
(
evict
=
{
@CacheEvict
(
cacheNames
=
"jd:warehouse:tree"
,
key
=
"#createReqVO.tradeType"
),
@CacheEvict
(
cacheNames
=
"jd:warehouse:list"
,
key
=
"#createReqVO.tradeType"
)
})
public
Long
createWarehouse
(
WarehouseCreateReqVO
createReqVO
)
{
public
Long
createWarehouse
(
WarehouseCreateReqVO
createReqVO
)
{
// 插入
// 插入
WarehouseDO
warehouse
=
WarehouseConvert
.
INSTANCE
.
convert
(
createReqVO
);
WarehouseDO
warehouse
=
WarehouseConvert
.
INSTANCE
.
convert
(
createReqVO
);
...
@@ -73,7 +77,11 @@ public class WarehouseServiceImpl implements WarehouseService {
...
@@ -73,7 +77,11 @@ public class WarehouseServiceImpl implements WarehouseService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@CacheEvict
(
cacheNames
=
"jd:warehouse:tree"
,
key
=
"#updateReqVO.tradeType"
)
@Caching
(
evict
=
{
@CacheEvict
(
cacheNames
=
"jd:warehouse:tree"
,
key
=
"#updateReqVO.tradeType"
),
@CacheEvict
(
cacheNames
=
"jd:warehouse:list"
,
key
=
"#updateReqVO.tradeType"
)
})
public
void
updateWarehouse
(
WarehouseUpdateReqVO
updateReqVO
)
{
public
void
updateWarehouse
(
WarehouseUpdateReqVO
updateReqVO
)
{
Long
id
=
updateReqVO
.
getId
();
Long
id
=
updateReqVO
.
getId
();
// 校验存在
// 校验存在
...
@@ -547,6 +555,44 @@ public class WarehouseServiceImpl implements WarehouseService {
...
@@ -547,6 +555,44 @@ public class WarehouseServiceImpl implements WarehouseService {
return
guojiaList
;
return
guojiaList
;
}
}
@Override
@Cacheable
(
cacheNames
=
"jd:warehouse:list"
,
key
=
"#tradeType"
)
public
WarehouseListVO
getGuojiaAndShiAndWarehouseList
(
Integer
tradeType
)
{
WarehouseListVO
vo
=
new
WarehouseListVO
();
List
<
WarehouseTreeVO
>
list
=
warehouseMapper
.
getWarehouseTreeList
(
tradeType
);
vo
.
setWarehouseList
(
list
);
Map
<
Long
,
List
<
WarehouseTreeVO
>>
shiMap
=
list
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
WarehouseTreeVO:
:
getShi
));
List
<
WarehouseTreeVO
>
shiVOList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Long
,
List
<
WarehouseTreeVO
>>
m
:
shiMap
.
entrySet
())
{
WarehouseTreeVO
v
=
new
WarehouseTreeVO
();
v
.
setShi
(
m
.
getKey
());
List
<
WarehouseTreeVO
>
warehouseList
=
m
.
getValue
();
WarehouseTreeVO
warehouseTreeVO
=
warehouseList
.
get
(
0
);
v
.
setShiName
(
warehouseTreeVO
.
getShiName
());
v
.
setShiNameEn
(
warehouseTreeVO
.
getShiNameEn
());
v
.
setGuojiaNameEn
(
warehouseTreeVO
.
getGuojiaNameEn
());
v
.
setGuojiaName
(
warehouseTreeVO
.
getGuojiaName
());
v
.
setGuojia
(
warehouseTreeVO
.
getGuojia
());
shiVOList
.
add
(
v
);
}
vo
.
setShiList
(
shiVOList
);
Map
<
Long
,
List
<
WarehouseTreeVO
>>
guojiaMap
=
shiVOList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
WarehouseTreeVO:
:
getGuojia
));
List
<
WarehouseTreeVO
>
guojiaList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Long
,
List
<
WarehouseTreeVO
>>
entry
:
guojiaMap
.
entrySet
())
{
WarehouseTreeVO
v
=
new
WarehouseTreeVO
();
v
.
setGuojia
(
entry
.
getKey
());
List
<
WarehouseTreeVO
>
shiWarehouseList
=
entry
.
getValue
();
WarehouseTreeVO
warehouseTreeVO
=
shiWarehouseList
.
get
(
0
);
v
.
setGuojiaNameEn
(
warehouseTreeVO
.
getGuojiaNameEn
());
v
.
setGuojiaName
(
warehouseTreeVO
.
getGuojiaName
());
guojiaList
.
add
(
v
);
}
vo
.
setGuojiaList
(
guojiaList
);
return
vo
;
}
@Override
@Override
public
List
<
WarehouseTreeRegionVO
>
getWarehouseTreeRegionList
(
Integer
tradeType
)
{
public
List
<
WarehouseTreeRegionVO
>
getWarehouseTreeRegionList
(
Integer
tradeType
)
{
List
<
WarehouseTreeRegionVO
>
list
=
warehouseMapper
.
getWarehouseTreeRegionList
(
tradeType
);
List
<
WarehouseTreeRegionVO
>
list
=
warehouseMapper
.
getWarehouseTreeRegionList
(
tradeType
);
...
...
yudao-module-depository/yudao-module-depository-core/src/main/java/cn/iocoder/yudao/module/depository/vo/warehouse/WarehouseListVO.java
0 → 100644
View file @
5cc0f983
package
cn
.
iocoder
.
yudao
.
module
.
depository
.
vo
.
warehouse
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
@ApiModel
(
"仓库区域列表值"
)
public
class
WarehouseListVO
{
@ApiModelProperty
(
"国家区域列表"
)
private
List
<
WarehouseTreeVO
>
guojiaList
;
@ApiModelProperty
(
"城市区域列表"
)
private
List
<
WarehouseTreeVO
>
shiList
;
@ApiModelProperty
(
"仓库列表"
)
private
List
<
WarehouseTreeVO
>
warehouseList
;
}
yudao-module-depository/yudao-module-depository-rest/src/main/java/cn/iocoder/yudao/module/depository/controller/admin/warehouse/WarehouseController.java
View file @
5cc0f983
...
@@ -108,6 +108,14 @@ public class WarehouseController {
...
@@ -108,6 +108,14 @@ public class WarehouseController {
return
success
(
list
);
return
success
(
list
);
}
}
@GetMapping
(
"/getGuojiaAndShiAndWarehouseList"
)
@ApiOperation
(
"获取仓库区域并行国家、城市、仓库列表"
)
@ApiImplicitParam
(
name
=
"tradeType"
,
value
=
"进出口类型,1-进口,2-出口"
,
required
=
false
,
example
=
"1"
,
dataTypeClass
=
Integer
.
class
)
public
CommonResult
<
WarehouseListVO
>
getGuojiaAndShiAndWarehouseList
(
Integer
tradeType
){
WarehouseListVO
warehouseListVO
=
warehouseService
.
getGuojiaAndShiAndWarehouseList
(
tradeType
);
return
success
(
warehouseListVO
);
}
@GetMapping
(
"/getRegionList"
)
@GetMapping
(
"/getRegionList"
)
public
CommonResult
<
List
<
WarehouseTreeRegionVO
>>
getRegionList
(
public
CommonResult
<
List
<
WarehouseTreeRegionVO
>>
getRegionList
(
...
...
yudao-module-depository/yudao-module-depository-rest/src/main/java/cn/iocoder/yudao/module/depository/controller/app/warehouse/AppWarehouseController.java
View file @
5cc0f983
...
@@ -184,6 +184,13 @@ public class AppWarehouseController {
...
@@ -184,6 +184,13 @@ public class AppWarehouseController {
return
success
(
list
);
return
success
(
list
);
}
}
@GetMapping
(
"/getGuojiaAndShiAndWarehouseList"
)
@ApiOperation
(
"获取仓库区域并行国家、城市、仓库列表"
)
@ApiImplicitParam
(
name
=
"tradeType"
,
value
=
"进出口类型,1-进口,2-出口"
,
required
=
false
,
example
=
"1"
,
dataTypeClass
=
Integer
.
class
)
public
CommonResult
<
WarehouseListVO
>
getGuojiaAndShiAndWarehouseList
(
Integer
tradeType
){
WarehouseListVO
warehouseListVO
=
warehouseService
.
getGuojiaAndShiAndWarehouseList
(
tradeType
);
return
success
(
warehouseListVO
);
}
@GetMapping
(
"/getRegionList"
)
@GetMapping
(
"/getRegionList"
)
...
...
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