Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
9b2de18a
Commit
9b2de18a
authored
Feb 24, 2020
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
电子预案:
1.绑定资源设备数据项查询
parent
6ffdde97
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
11 deletions
+112
-11
PlanVisual3dController.java
.../amos/fas/business/controller/PlanVisual3dController.java
+23
-4
PlanVisual3dMapper.java
...join/amos/fas/business/dao/mapper/PlanVisual3dMapper.java
+3
-0
PlanVisual3dServiceImpl.java
...os/fas/business/service/impl/PlanVisual3dServiceImpl.java
+40
-6
IPlanVisual3dService.java
...amos/fas/business/service/intfc/IPlanVisual3dService.java
+2
-0
dbTemplate_3d_plan_visual.xml
...rc/main/resources/db/mapper/dbTemplate_3d_plan_visual.xml
+44
-1
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/PlanVisual3dController.java
View file @
9b2de18a
...
@@ -15,9 +15,12 @@ import org.springframework.web.bind.annotation.PathVariable;
...
@@ -15,9 +15,12 @@ import org.springframework.web.bind.annotation.PathVariable;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RestController
@RequestMapping
(
value
=
"/api/visual"
)
@RequestMapping
(
value
=
"/api/visual"
)
@Api
(
tags
=
"预案可视化API"
)
@Api
(
tags
=
"预案可视化API"
)
public
class
PlanVisual3dController
extends
BaseController
{
public
class
PlanVisual3dController
extends
BaseController
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
PlanVisual3dController
.
class
);
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
PlanVisual3dController
.
class
);
...
@@ -40,10 +43,26 @@ public class PlanVisual3dController extends BaseController {
...
@@ -40,10 +43,26 @@ public class PlanVisual3dController extends BaseController {
/**
/**
* 资源设备信息查询
* 资源设备信息查询
*/
*/
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"资源查询"
,
notes
=
"资源查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"资源查询"
,
notes
=
"资源查询"
)
@Authorization
(
ingore
=
true
)
@Authorization
(
ingore
=
true
)
@GetMapping
(
value
=
"/resource/{type}/list"
)
@GetMapping
(
value
=
"/resource/{type}/list"
)
public
CommonResponse
getResourceList
(
@ApiParam
(
value
=
"资源类型"
,
required
=
true
)
@PathVariable
String
type
){
public
CommonResponse
getResourceList
(
@ApiParam
(
value
=
"资源类型"
,
required
=
true
)
@PathVariable
String
type
)
{
return
planVisual3dService
.
getResourceListByType
(
type
);
return
planVisual3dService
.
getResourceListByType
(
type
);
}
}
/**
* 资源设备数据项查询
*
* @param id
* @return
*/
@Authorization
(
ingore
=
true
)
@GetMapping
(
value
=
"/{type}/detail/{id}"
)
@ApiOperation
(
value
=
"数据项查询"
,
notes
=
"按照分类及id查询数据项"
)
public
CommonResponse
getResourceDetail
(
@ApiParam
(
value
=
"资源类型"
,
required
=
true
)
@PathVariable
String
type
,
@ApiParam
(
value
=
"主键id"
,
required
=
true
)
@PathVariable
Long
id
)
{
List
<
Map
<
String
,
Object
>>
list
=
planVisual3dService
.
getResourceById
(
type
,
id
);
return
CommonResponseUtil
.
success
(
list
);
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/PlanVisual3dMapper.java
View file @
9b2de18a
...
@@ -3,7 +3,10 @@ package com.yeejoin.amos.fas.business.dao.mapper;
...
@@ -3,7 +3,10 @@ package com.yeejoin.amos.fas.business.dao.mapper;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
public
interface
PlanVisual3dMapper
extends
BaseMapper
{
public
interface
PlanVisual3dMapper
extends
BaseMapper
{
List
<
HashMap
<
String
,
String
>>
getResourceListByType
(
@Param
(
"type"
)
String
type
);
List
<
HashMap
<
String
,
String
>>
getResourceListByType
(
@Param
(
"type"
)
String
type
);
Map
<
String
,
Object
>
queryOneByTypeAndId
(
@Param
(
"type"
)
String
type
,
@Param
(
"id"
)
Long
id
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/PlanVisual3dServiceImpl.java
View file @
9b2de18a
...
@@ -16,10 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -16,10 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.util.HashMap
;
import
java.util.*
;
import
java.util.LinkedHashMap
;
import
java.util.stream.Collectors
;
import
java.util.List
;
import
java.util.Map
;
@Service
(
"planVisual3dService"
)
@Service
(
"planVisual3dService"
)
public
class
PlanVisual3dServiceImpl
implements
IPlanVisual3dService
{
public
class
PlanVisual3dServiceImpl
implements
IPlanVisual3dService
{
...
@@ -42,7 +40,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
...
@@ -42,7 +40,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
CommonResponse
response
=
maasVisualServer
.
getTree
();
CommonResponse
response
=
maasVisualServer
.
getTree
();
List
<
TreeSubjectVo
>
treeSubjectVos
=
Lists
.
newArrayList
();
List
<
TreeSubjectVo
>
treeSubjectVos
=
Lists
.
newArrayList
();
if
(
null
!=
response
.
getDataList
())
{
if
(
null
!=
response
.
getDataList
())
{
List
<
Object
>
res
=
(
List
<
Object
>)
response
.
getDataList
();
List
<
Object
>
res
=
(
List
<
Object
>)
response
.
getDataList
();
if
(!
CollectionUtils
.
isEmpty
(
res
))
{
if
(!
CollectionUtils
.
isEmpty
(
res
))
{
treeSubjectVos
=
listToTree
(
res
);
treeSubjectVos
=
listToTree
(
res
);
}
}
...
@@ -134,11 +132,47 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
...
@@ -134,11 +132,47 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
dict
.
setDictCode
(
FasConstant
.
PLAN_SOURCE_TYPE
);
dict
.
setDictCode
(
FasConstant
.
PLAN_SOURCE_TYPE
);
dict
.
setDictValue
(
type
);
dict
.
setDictValue
(
type
);
List
<
Dict
>
dictList
=
dictService
.
getDictList
(
dict
);
List
<
Dict
>
dictList
=
dictService
.
getDictList
(
dict
);
if
(
CollectionUtils
.
isEmpty
(
dictList
))
{
if
(
CollectionUtils
.
isEmpty
(
dictList
))
{
return
CommonResponseUtil
.
failure
(
type
+
"字典类型不存在"
);
return
CommonResponseUtil
.
failure
(
type
+
"字典类型不存在"
);
}
}
//2.返回存在的数据
//2.返回存在的数据
return
CommonResponseUtil
.
success
(
planVisual3dMapper
.
getResourceListByType
(
type
));
return
CommonResponseUtil
.
success
(
planVisual3dMapper
.
getResourceListByType
(
type
));
}
}
@Override
public
List
<
Map
<
String
,
Object
>>
getResourceById
(
String
type
,
Long
id
)
{
//1.查询出要返回数据
Map
<
String
,
Object
>
map
=
planVisual3dMapper
.
queryOneByTypeAndId
(
type
,
id
);
//1.1无数据则返回
if
(
CollectionUtils
.
isEmpty
(
map
))
{
return
new
ArrayList
<>();
}
//2.加工数据
//2.0查询出中英文对照字典映射
Dict
dict
=
new
Dict
();
dict
.
setDictCode
(
type
);
List
<
Dict
>
dictList
=
dictService
.
getDictList
(
dict
);
Map
<
String
,
String
>
dicts
=
dictList
.
stream
().
collect
(
Collectors
.
toMap
(
Dict:
:
getDictValue
,
Dict:
:
getDictName
,
(
key1
,
key2
)
->
key2
));
//2.1换key为中文
Map
<
String
,
Object
>
tempMap
=
new
HashMap
<
String
,
Object
>();
map
.
forEach
((
k
,
v
)
->
{
if
(
dicts
.
containsKey
(
k
))
{
tempMap
.
put
(
dicts
.
get
(
k
),
v
);
}
});
//2.2map转list
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
list
=
tempMap
.
entrySet
().
stream
().
map
(
e
->
{
Map
<
String
,
Object
>
newMap
=
new
HashMap
<
String
,
Object
>();
newMap
.
put
(
"label"
,
e
.
getKey
());
newMap
.
put
(
"value"
,
e
.
getValue
());
return
newMap
;
}).
collect
(
Collectors
.
toList
());
return
list
;
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IPlanVisual3dService.java
View file @
9b2de18a
...
@@ -33,4 +33,6 @@ public interface IPlanVisual3dService {
...
@@ -33,4 +33,6 @@ public interface IPlanVisual3dService {
TextPlan
getTextPlanInfoById
(
Long
id
);
TextPlan
getTextPlanInfoById
(
Long
id
);
CommonResponse
getResourceListByType
(
String
type
);
CommonResponse
getResourceListByType
(
String
type
);
List
<
Map
<
String
,
Object
>>
getResourceById
(
String
type
,
Long
id
);
}
}
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_3d_plan_visual.xml
View file @
9b2de18a
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
(select a.id,a.`name`,a.`code` from f_equipment a) as rs
(select a.id,a.`name`,a.`code` from f_equipment a) as rs
</when>
</when>
<when
test=
"type=='fireStrength'"
>
<when
test=
"type=='fireStrength'"
>
(select a.id,a.`
name`,a.`code` from f_equipment
a) as rs
(select a.id,a.`
username` as name ,a.`code` from f_fire_strength
a) as rs
</when>
</when>
<when
test=
"type=='fireChamber'"
>
<when
test=
"type=='fireChamber'"
>
(select a.id,a.`name`,a.`code` from f_fire_station a where a.type = '1') as rs
(select a.id,a.`name`,a.`code` from f_fire_station a where a.type = '1') as rs
...
@@ -43,4 +43,46 @@
...
@@ -43,4 +43,46 @@
</when>
</when>
</choose>
</choose>
</select>
</select>
<select
id=
"queryOneByTypeAndId"
resultType=
"hashmap"
>
SELECT
*
from
<choose>
<when
test=
"type=='fireCar'"
>
(SELECT * FROM `f_fire_car` a) as rs
</when>
<when
test=
"type=='monitorEquipment'"
>
(select * from f_fire_equipment a where a.equip_classify = 0) as rs
</when>
<when
test=
"type=='fireConsumables'"
>
(select * from f_fire_equipment a where a.equip_classify = 1) as rs
</when>
<when
test=
"type=='video'"
>
(select * from f_fire_equipment a where a.equip_classify = 2) as rs
</when>
<when
test=
"type=='fireEquipment'"
>
(select * from f_fire_equipment a where a.equip_classify = 3) as rs
</when>
<when
test=
"type=='impEquipment'"
>
(select * from f_equipment a) as rs
</when>
<when
test=
"type=='fireStrength'"
>
(select * from f_fire_strength a) as rs
</when>
<when
test=
"type=='fireChamber'"
>
(select * from f_fire_station a where a.type = '1') as rs
</when>
<when
test=
"type=='fireFoamRoom'"
>
(select * from f_fire_station a where a.type = '2') as rs
</when>
<when
test=
"type=='hydrant'"
>
(SELECT * FROM `f_water_resource` a where a.type = '1') as rs
</when>
<when
test=
"type=='pool'"
>
(SELECT * FROM `f_water_resource` a where a.type = '2') as rs
</when>
</choose>
where rs.id = #{id}
</select>
</mapper>
</mapper>
\ No newline at end of file
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