Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
ef7d400a
Commit
ef7d400a
authored
Jul 01, 2021
by
taabe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
装备服务-消防建筑树接口
parent
8febe2ad
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
18 deletions
+83
-18
MenuFrom.java
...java/com/yeejoin/amos/boot/biz/common/utils/MenuFrom.java
+12
-1
EquipFeignClient.java
...join/amos/boot/module/jcs/api/feign/EquipFeignClient.java
+8
-0
EquipmentController.java
...s/boot/module/jcs/biz/controller/EquipmentController.java
+9
-1
FireChemicalController.java
...oot/module/jcs/biz/controller/FireChemicalController.java
+11
-6
EquipmentServiceImpl.java
...oot/module/jcs/biz/service/impl/EquipmentServiceImpl.java
+43
-10
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/MenuFrom.java
View file @
ef7d400a
...
...
@@ -62,8 +62,19 @@ public class MenuFrom {
this
.
title
=
title
;
this
.
label
=
label
;
this
.
name
=
name
;
this
.
parentId
=
parentId
;
this
.
parentId
=
parentId
;
}
public
MenuFrom
(
String
key
,
String
name
,
String
parentId
)
{
super
();
this
.
id
=
key
;
this
.
value
=
key
;
this
.
key
=
key
;
this
.
title
=
name
;
this
.
label
=
name
;
this
.
name
=
name
;
this
.
parentId
=
parentId
;
}
public
MenuFrom
()
{
super
();
}
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/feign/EquipFeignClient.java
View file @
ef7d400a
...
...
@@ -74,4 +74,12 @@ public interface EquipFeignClient {
*/
@RequestMapping
(
value
=
"/fire-fighting-system/list"
,
method
=
RequestMethod
.
GET
)
ResponseModel
<
Object
>
getFireSystemListAll
();
/**
* 获取消防系统列表
*
* @return
*/
@RequestMapping
(
value
=
"/building/tree"
,
method
=
RequestMethod
.
GET
)
ResponseModel
<
Object
>
getBuildingTree
();
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/EquipmentController.java
View file @
ef7d400a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
controller
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.MenuFrom
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.FireSystemDto
;
import
com.yeejoin.amos.boot.module.jcs.biz.service.impl.EquipmentServiceImpl
;
import
io.swagger.annotations.Api
;
...
...
@@ -32,7 +33,14 @@ public class EquipmentController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/fireSystem/list"
)
@ApiOperation
(
value
=
"获取消防系统列表"
)
public
ResponseModel
<
List
<
FireSystemDto
>>
getFireSystemList
()
{
public
ResponseModel
<
List
<
MenuFrom
>>
getFireSystemList
()
{
return
ResponseHelper
.
buildResponse
(
equipmentService
.
getFireSystemList
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/building/tree"
)
@ApiOperation
(
value
=
"获取消防建筑树"
)
public
ResponseModel
<
List
<
MenuFrom
>>
getBuildingList
()
{
return
ResponseHelper
.
buildResponse
(
equipmentService
.
getBuildingList
());
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/FireChemicalController.java
View file @
ef7d400a
...
...
@@ -4,18 +4,23 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.FireChemicalDto
;
import
com.yeejoin.amos.boot.module.jcs.biz.service.impl.FireChemicalServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Arrays
;
import
java.util.List
;
...
...
@@ -64,9 +69,9 @@ public class FireChemicalController extends BaseController {
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}
"
)
@DeleteMapping
(
value
=
"/batch
"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除危化品"
,
notes
=
"根据sequenceNbr删除危化品"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
String
sequenceNbr
)
{
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
@RequestParam
(
value
=
"ids"
)
String
sequenceNbr
)
{
@SuppressWarnings
(
"rawtypes"
)
List
lt
=
Arrays
.
asList
(
sequenceNbr
.
split
(
","
));
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/EquipmentServiceImpl.java
View file @
ef7d400a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.toolkit.BeanUtils
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.biz.common.utils.MenuFrom
;
import
com.yeejoin.amos.boot.biz.common.utils.TreeParser
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.FireSystemDto
;
import
com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StopWatch
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.List
;
...
...
@@ -21,20 +25,49 @@ public class EquipmentServiceImpl {
@Autowired
EquipFeignClient
equipFeignClient
;
public
List
<
FireSystemDto
>
getFireSystemList
()
{
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
public
List
<
MenuFrom
>
getFireSystemList
()
{
ResponseModel
<
Object
>
response
=
equipFeignClient
.
getFireSystemListAll
();
stopWatch
.
stop
();
System
.
out
.
printf
(
"耗时%f秒/n"
,
stopWatch
.
getTotalTimeSeconds
());
List
<
Map
<
String
,
Object
>>
fireSystemMapList
=
(
List
<
Map
<
String
,
Object
>>)
response
.
getResult
();
List
<
FireSystemDto
>
fireSystemDtoList
=
Lists
.
newArrayList
();
List
<
MenuFrom
>
fireSystemDtoList
=
Lists
.
newArrayList
();
fireSystemMapList
.
forEach
(
system
->
{
FireSystemDto
fireSystemDto
=
new
FireSystemDto
();
fireSystemDto
.
setId
((
String
)
system
.
get
(
"id"
));
fireSystemDto
.
setName
((
String
)
system
.
get
(
"name"
));
fireSystemDtoList
.
add
(
fireSystemDto
);
MenuFrom
menuFrom
=
new
MenuFrom
((
String
)
system
.
get
(
"id"
),
(
String
)
system
.
get
(
"name"
),
"0"
);
fireSystemDtoList
.
add
(
menuFrom
);
});
return
fireSystemDtoList
;
}
public
List
<
MenuFrom
>
getBuildingList
()
{
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
ResponseModel
<
Object
>
response
=
equipFeignClient
.
getBuildingTree
();
stopWatch
.
stop
();
System
.
out
.
printf
(
"耗时%f秒/n"
,
stopWatch
.
getTotalTimeSeconds
());
List
<
Map
<
String
,
Object
>>
buildingMapList
=
(
List
<
Map
<
String
,
Object
>>)
response
.
getResult
();
List
<
MenuFrom
>
buildingTreeList
=
Lists
.
newArrayList
();
buildingMapList
.
forEach
(
building
->
{
MenuFrom
menuFrom
=
new
MenuFrom
((
String
)
building
.
get
(
"id"
),
"全部建筑"
,
(
String
)
building
.
get
(
"parentId"
));
List
<
Map
<
String
,
Object
>>
children
=
(
List
<
Map
<
String
,
Object
>>)
building
.
get
(
"children"
);
menuFrom
.
setChildren
(
parseTree
(
menuFrom
,
children
));
menuFrom
.
setIsLeaf
(
false
);
buildingTreeList
.
add
(
menuFrom
);
});
return
buildingTreeList
.
get
(
0
).
getChildren
();
}
private
List
<
MenuFrom
>
parseTree
(
MenuFrom
parent
,
List
<
Map
<
String
,
Object
>>
children
)
{
List
<
MenuFrom
>
menuFromList
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
children
))
{
children
.
forEach
(
child
->
{
MenuFrom
menuFrom
=
new
MenuFrom
((
String
)
child
.
get
(
"id"
),
(
String
)
child
.
get
(
"name"
),
(
String
)
child
.
get
(
"parentId"
));
if
(!
ValidationUtil
.
isEmpty
(
child
.
get
(
"children"
)))
{
parseTree
(
menuFrom
,
(
List
<
Map
<
String
,
Object
>>)
child
.
get
(
"children"
));
}
else
{
parent
.
setIsLeaf
(
false
);
}
menuFromList
.
add
(
menuFrom
);
parent
.
setChildren
(
menuFromList
);
});
}
return
menuFromList
;
}
}
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