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
492c0a95
Commit
492c0a95
authored
Sep 08, 2024
by
zhengyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
目的仓、目的地、目的国联动树形结构数据返回
parent
28cdd065
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
126 additions
and
3 deletions
+126
-3
WarehouseMapper.java
...odule/depository/dal/mysql/warehouse/WarehouseMapper.java
+26
-0
WarehouseService.java
...module/depository/service/warehouse/WarehouseService.java
+4
-0
WarehouseServiceImpl.java
...pository/service/warehouse/impl/WarehouseServiceImpl.java
+41
-1
WarehouseTreeVO.java
...yudao/module/depository/vo/warehouse/WarehouseTreeVO.java
+36
-0
WarehouseController.java
...itory/controller/admin/warehouse/WarehouseController.java
+9
-0
AppWarehouseController.java
...tory/controller/app/warehouse/AppWarehouseController.java
+10
-2
No files found.
yudao-module-depository/yudao-module-depository-core/src/main/java/cn/iocoder/yudao/module/depository/dal/mysql/warehouse/WarehouseMapper.java
View file @
492c0a95
...
@@ -135,6 +135,32 @@ public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
...
@@ -135,6 +135,32 @@ public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
})
})
List
<
WarehouseTreeRegionVO
>
getWarehouseTreeRegionList
(
@Param
(
"tradeType"
)
Integer
tradeType
);
List
<
WarehouseTreeRegionVO
>
getWarehouseTreeRegionList
(
@Param
(
"tradeType"
)
Integer
tradeType
);
@ResultType
(
WarehouseTreeVO
.
class
)
@Select
({
"<script>"
,
"SELECT"
,
"w.id as warehouseId,"
,
"w.title_zh as warehouseTitleZh,"
,
"w.title_en as warehouseTitleEn,"
,
"r1.id as guojia,"
,
"r1.title_zh as guojiaName,"
,
"r1.title_en as guojiaNameEn,"
,
"r2.id as shi, "
,
"r2.title_zh as shiName, "
,
"r2.title_en as shiNameEn "
,
"FROM ecw_warehouse w "
,
"LEFT JOIN ecw_region r1 "
,
"ON w.guojia = r1.id "
,
"LEFT JOIN ecw_region r2 "
,
"ON w.shi = r2.id "
,
"WHERE w.deleted = 0 AND w.`status` =0 "
,
"<if test= 'tradeType != null'>"
,
"AND trade_type =#{tradeType}"
,
"</when>"
,
"</script>"
})
List
<
WarehouseTreeVO
>
getWarehouseTreeList
(
@Param
(
"tradeType"
)
Integer
tradeType
);
@ResultType
(
List
.
class
)
@ResultType
(
List
.
class
)
@Select
({
@Select
({
"<script>"
,
"<script>"
,
...
...
yudao-module-depository/yudao-module-depository-core/src/main/java/cn/iocoder/yudao/module/depository/service/warehouse/WarehouseService.java
View file @
492c0a95
...
@@ -172,4 +172,8 @@ public interface WarehouseService {
...
@@ -172,4 +172,8 @@ public interface WarehouseService {
List
<
WarehouseTreeRegionVO
>
getWarehouseTreeRegionList
(
Integer
tradeType
);
List
<
WarehouseTreeRegionVO
>
getWarehouseTreeRegionList
(
Integer
tradeType
);
List
<
WarehouseTreeRegionVO
>
getRegionList
(
Integer
type
,
String
regionId
,
String
destCountryId
,
String
objectiveId
,
String
destWarehouseId
);
List
<
WarehouseTreeRegionVO
>
getRegionList
(
Integer
type
,
String
regionId
,
String
destCountryId
,
String
objectiveId
,
String
destWarehouseId
);
List
<
WarehouseTreeVO
>
getWarehouseTreeList
(
Integer
tradeType
);
}
}
yudao-module-depository/yudao-module-depository-core/src/main/java/cn/iocoder/yudao/module/depository/service/warehouse/impl/WarehouseServiceImpl.java
View file @
492c0a95
...
@@ -27,6 +27,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
...
@@ -27,6 +27,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.redisson.api.RLock
;
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.Cacheable
;
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
;
...
@@ -60,6 +62,7 @@ public class WarehouseServiceImpl implements WarehouseService {
...
@@ -60,6 +62,7 @@ public class WarehouseServiceImpl implements WarehouseService {
private
DictDataApi
dictDataApi
;
private
DictDataApi
dictDataApi
;
@Override
@Override
@CacheEvict
(
cacheNames
=
"jd:warehouse:tree"
,
key
=
"'all'"
)
public
Long
createWarehouse
(
WarehouseCreateReqVO
createReqVO
)
{
public
Long
createWarehouse
(
WarehouseCreateReqVO
createReqVO
)
{
// 插入
// 插入
WarehouseDO
warehouse
=
WarehouseConvert
.
INSTANCE
.
convert
(
createReqVO
);
WarehouseDO
warehouse
=
WarehouseConvert
.
INSTANCE
.
convert
(
createReqVO
);
...
@@ -70,6 +73,7 @@ public class WarehouseServiceImpl implements WarehouseService {
...
@@ -70,6 +73,7 @@ public class WarehouseServiceImpl implements WarehouseService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@CacheEvict
(
cacheNames
=
"jd:warehouse:tree"
,
key
=
"'all'"
)
public
void
updateWarehouse
(
WarehouseUpdateReqVO
updateReqVO
)
{
public
void
updateWarehouse
(
WarehouseUpdateReqVO
updateReqVO
)
{
Long
id
=
updateReqVO
.
getId
();
Long
id
=
updateReqVO
.
getId
();
// 校验存在
// 校验存在
...
@@ -507,6 +511,42 @@ public class WarehouseServiceImpl implements WarehouseService {
...
@@ -507,6 +511,42 @@ public class WarehouseServiceImpl implements WarehouseService {
return
warehouseLineMapper
.
getStartInfoAndDestInfoByLineId
(
lineId
);
return
warehouseLineMapper
.
getStartInfoAndDestInfoByLineId
(
lineId
);
}
}
@Override
@Cacheable
(
cacheNames
=
"jd:warehouse:tree"
,
key
=
"'all'"
)
public
List
<
WarehouseTreeVO
>
getWarehouseTreeList
(
Integer
tradeType
)
{
List
<
WarehouseTreeVO
>
list
=
warehouseMapper
.
getWarehouseTreeList
(
tradeType
);
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
();
v
.
setChildren
(
warehouseList
);
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
);
}
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
();
v
.
setChildren
(
shiWarehouseList
);
WarehouseTreeVO
warehouseTreeVO
=
shiWarehouseList
.
get
(
0
);
v
.
setGuojiaNameEn
(
warehouseTreeVO
.
getGuojiaNameEn
());
v
.
setGuojiaName
(
warehouseTreeVO
.
getGuojiaName
());
guojiaList
.
add
(
v
);
}
return
guojiaList
;
}
@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
);
...
@@ -529,7 +569,7 @@ public class WarehouseServiceImpl implements WarehouseService {
...
@@ -529,7 +569,7 @@ public class WarehouseServiceImpl implements WarehouseService {
@Override
@Override
public
List
<
WarehouseTreeRegionVO
>
getRegionList
(
Integer
type
,
String
regionId
,
String
destCountryId
,
String
objectiveId
,
String
destWarehouseId
)
{
public
List
<
WarehouseTreeRegionVO
>
getRegionList
(
Integer
type
,
String
regionId
,
String
destCountryId
,
String
objectiveId
,
String
destWarehouseId
)
{
if
(
regionId
.
equals
(
""
))
{
if
(
StringUtils
.
isBlank
(
regionId
))
{
return
new
ArrayList
();
return
new
ArrayList
();
}
}
List
<
WarehouseTreeRegionVO
>
list
=
List
<
WarehouseTreeRegionVO
>
list
=
...
...
yudao-module-depository/yudao-module-depository-core/src/main/java/cn/iocoder/yudao/module/depository/vo/warehouse/WarehouseTreeVO.java
0 → 100644
View file @
492c0a95
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
WarehouseTreeVO
{
@ApiModelProperty
(
"国家区域id"
)
private
Long
guojia
;
@ApiModelProperty
(
"国家中文名称"
)
private
String
guojiaName
;
@ApiModelProperty
(
"国家英文名称"
)
private
String
guojiaNameEn
;
@ApiModelProperty
(
"城市区域id"
)
private
Long
shi
;
@ApiModelProperty
(
"城市中文名称"
)
private
String
shiName
;
@ApiModelProperty
(
"城市英文名称"
)
private
String
shiNameEn
;
@ApiModelProperty
(
"仓库id"
)
private
Long
warehouseId
;
@ApiModelProperty
(
"仓库中文名称"
)
private
String
warehouseTitleZh
;
@ApiModelProperty
(
"仓库英文名称"
)
private
String
warehouseTitleEn
;
@ApiModelProperty
(
value
=
"子元素"
,
example
=
"true"
)
private
List
<
WarehouseTreeVO
>
children
;
}
yudao-module-depository/yudao-module-depository-rest/src/main/java/cn/iocoder/yudao/module/depository/controller/admin/warehouse/WarehouseController.java
View file @
492c0a95
...
@@ -100,6 +100,15 @@ public class WarehouseController {
...
@@ -100,6 +100,15 @@ public class WarehouseController {
return
success
(
list
);
return
success
(
list
);
}
}
@GetMapping
(
"/getWarehouseTreeList"
)
@ApiModelProperty
(
"获取仓库区域树形列表"
)
@ApiImplicitParam
(
name
=
"tradeType"
,
value
=
"进出口类型,1-进口,2-出口"
,
required
=
false
,
example
=
"1"
,
dataTypeClass
=
Integer
.
class
)
public
CommonResult
<
List
<
WarehouseTreeVO
>>
getWarehouseTreeLis
(
Integer
tradeType
){
List
<
WarehouseTreeVO
>
list
=
warehouseService
.
getWarehouseTreeList
(
tradeType
);
return
success
(
list
);
}
@GetMapping
(
"/getRegionList"
)
@GetMapping
(
"/getRegionList"
)
public
CommonResult
<
List
<
WarehouseTreeRegionVO
>>
getRegionList
(
public
CommonResult
<
List
<
WarehouseTreeRegionVO
>>
getRegionList
(
@RequestParam
(
value
=
"type"
,
required
=
false
)
Integer
type
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
Integer
type
,
...
...
yudao-module-depository/yudao-module-depository-rest/src/main/java/cn/iocoder/yudao/module/depository/controller/app/warehouse/AppWarehouseController.java
View file @
492c0a95
...
@@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.WarehouseLine
...
@@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.WarehouseLine
import
cn.iocoder.yudao.module.ecw.service.region.RegionService
;
import
cn.iocoder.yudao.module.ecw.service.region.RegionService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -175,11 +176,18 @@ public class AppWarehouseController {
...
@@ -175,11 +176,18 @@ public class AppWarehouseController {
return
success
(
idList
);
return
success
(
idList
);
}
}
@GetMapping
(
"/getWarehouseTreeList"
)
@ApiModelProperty
(
"获取仓库区域树形列表"
)
@ApiImplicitParam
(
name
=
"tradeType"
,
value
=
"进出口类型,1-进口,2-出口"
,
required
=
false
,
example
=
"1"
,
dataTypeClass
=
Integer
.
class
)
public
CommonResult
<
List
<
WarehouseTreeVO
>>
getWarehouseTreeLis
(
Integer
tradeType
){
List
<
WarehouseTreeVO
>
list
=
warehouseService
.
getWarehouseTreeList
(
tradeType
);
return
success
(
list
);
}
@GetMapping
(
"/getRegionList"
)
@GetMapping
(
"/getRegionList"
)
public
CommonResult
<
List
<
WarehouseTreeRegionVO
>>
getRegionList
(
public
CommonResult
<
List
<
WarehouseTreeRegionVO
>>
getRegionList
(
@RequestParam
(
value
=
"type"
,
required
=
false
)
Integer
type
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
Integer
type
,
String
regionId
,
String
destCountryId
,
String
regionId
,
String
destCountryId
,
String
objectiveId
,
String
destWarehouseId
){
String
objectiveId
,
String
destWarehouseId
){
List
<
WarehouseTreeRegionVO
>
list
=
List
<
WarehouseTreeRegionVO
>
list
=
...
...
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