Commit 9fafc32f authored by suhuiguang's avatar suhuiguang

1.删除测试代码-全景监控

parents cf7c11d7 f72c369e
......@@ -11,13 +11,13 @@ public enum ResourceTypeDefEnum {
patrol("巡检点","patrol","巡检点","patrol"),
impEquipment("重点设备","impEquipment","重点设备","impEquipment"),
monitorEquipment("探测器","monitorEquipment","探测器","monitorEquipment"),
video("视频设备","video","摄像头","video"),
hydrant("消火栓","hydrant","消防设备","fireEquipment"),
pool("消防水池","pool","消防设备","fireEquipment"),
fireCar("消防车","fireCar","消防设备","fireEquipment"),
fireEquipment("灭火器材","fireEquipment","消防设备","fireEquipment"),
fireChamber("消防小室","fireChamber","消防设备","fireEquipment"),
fireFoamRoom("消防泡沫间","fireFoamRoom","消防设备","fireEquipment"),
video("视频设备","video","摄像头","video");
fireFoamRoom("消防泡沫间","fireFoamRoom","消防设备","fireEquipment");
/**
* 名称,描述
......@@ -73,6 +73,18 @@ public enum ResourceTypeDefEnum {
}
return list;
}
public static Boolean containsTypeCode(String typeCode) {
Boolean flag = false;
for(ResourceTypeDefEnum e : ResourceTypeDefEnum.values()) {
Map<String,String> reso = new HashMap<>();
if(e.getTypeCode().equals(typeCode)) {
flag = true;
break;
}
}
return flag;
}
public String getName() {
return name;
......
package com.yeejoin.amos.fas.core.common.response;
import java.util.ArrayList;
import java.util.List;
public class RegionTreeResponse {
......@@ -12,7 +13,7 @@ public class RegionTreeResponse {
private String ue4Rotation;
private String ue4Extent;
private Boolean isBind;
private List<RegionTreeResponse> children;
private List<RegionTreeResponse> children = new ArrayList<>();
private String type;
public Long getId() {
......
......@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum;
import io.swagger.annotations.Api;
import java.util.List;
......@@ -40,11 +41,11 @@ public class View3dController extends BaseController {
}
@ApiOperation(value = "区域详情查询", notes = "区域详情查询")
@GetMapping(value = "region/detail/{id}")
public CommonResponse getRegionDetail(@PathVariable("id") Long id) {
@GetMapping(value = "region/detail/{riskSourceId}")
public CommonResponse getRegionDetail(@PathVariable("riskSourceId") Long riskSourceId) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
return CommonResponseUtil.success(riskSourceService.findRegionById(id,orgCode));
return CommonResponseUtil.success(riskSourceService.findRegionById(riskSourceId,orgCode));
}
@ApiOperation(value = "区域绑定", notes = "区域绑定")
......@@ -66,10 +67,21 @@ public class View3dController extends BaseController {
@ApiOperation(value = "按照分类查询点树", notes = "按照分类查询点树")
@GetMapping(value = "point/tree/{type}")
public CommonResponse getPointTreeByType(@PathVariable("type") String type) {
public CommonResponse getPointTreeByType(@PathVariable(value="type") String type) {
if(ResourceTypeDefEnum.containsTypeCode(type)) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
return CommonResponseUtil.success(view3dService.getPointTreeByType(type,orgCode));
}
return CommonResponseUtil.failure(type + " 类型不存在");
}
@ApiOperation(value = "按照不同类型查询点详情", notes = "按照不同类型查询点详情")
@GetMapping(value = "point/detail")
public CommonResponse getPointDetail(String type,Long pointId) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
return CommonResponseUtil.success(view3dService.getPointTreeByType(type,orgCode));
return CommonResponseUtil.success(view3dService.getPointDetailByTypeAndId(type,pointId,orgCode));
}
@ApiOperation(value = "今日安全指数查询",notes = "按照日期查询安全指数及分类数据")
......
package com.yeejoin.amos.fas.business.dao.mapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -11,8 +12,22 @@ import org.apache.ibatis.annotations.Param;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
public interface View3dMapper extends BaseMapper{
/**
* 按类型查询树
* @param type
* @param orgCode
* @return
*/
List<RegionTreeResponse> getPointTreeByType(@Param("type")String type,@Param("orgCode")String orgCode);
/**
* 获取点详情
* @param type
* @param pointId
* @param orgCode
* @return
*/
HashMap<String, Object> getPointDetailByTypeAndId(@Param("type")String type, @Param("pointId")Long pointId,@Param("orgCode")String orgCode);
/**
* 统计风险上升异常数量(风险点)-日期+机构
......@@ -35,5 +50,11 @@ public interface View3dMapper extends BaseMapper{
*/
List<RiskPointRpnChangeBo> getAllErrorRiskPoint(Map<String, Object> params);
/**
* 今日安全指数详情
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllErrorPatrolPoint(Map<String, Object> params);
}
......@@ -1754,20 +1754,20 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
//区域列表转树
private static List<RegionTreeResponse> getRiskRegionTree(List<RegionTreeResponse> list) {
List<RegionTreeResponse> treeList = new ArrayList<RegionTreeResponse>();
for (RegionTreeResponse tree : list) {
if (tree.getParentId() != null && tree.getParentId() == 0) {
treeList.add(tree);
}
for (RegionTreeResponse treeNode : list) {
if (treeNode.getParentId().longValue() == tree.getId()) {
if (tree.getChildren() == null) {
tree.setChildren(new ArrayList<>());
}
tree.getChildren().add(treeNode);
}
}
}
HashMap<Long, RegionTreeResponse> hashMap = new HashMap<>();
list.forEach( e -> hashMap.put(e.getId(), e));
List<RegionTreeResponse> treeList = new ArrayList<RegionTreeResponse>();
list.forEach( r -> {
Long parentId = r.getParentId();
if(parentId != null) {
RegionTreeResponse pRegion = hashMap.get(parentId);
if(pRegion != null) {
pRegion.getChildren().add(r);
}else {
treeList.add(r);
}
}
});
return treeList;
}
......
package com.yeejoin.amos.fas.business.service.impl;
import static org.hamcrest.CoreMatchers.either;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
......@@ -180,7 +188,32 @@ public class View3dServiceImpl implements IView3dService {
@Override
public List<RegionTreeResponse> getPointTreeByType(String type,String orgCode) {
return view3dMapper.getPointTreeByType(type,orgCode);
List<RegionTreeResponse> pointTreeByType = view3dMapper.getPointTreeByType(type,orgCode);
return convertPointTree(pointTreeByType);
}
//区域列表转树
private static List<RegionTreeResponse> convertPointTree(List<RegionTreeResponse> list) {
HashMap<Long, RegionTreeResponse> hashMap = new HashMap<>();
list.forEach( e -> hashMap.put(e.getId(), e));
List<RegionTreeResponse> treeList = new ArrayList<RegionTreeResponse>();
list.forEach( r -> {
Long parentId = r.getParentId();
if(parentId != null) {
RegionTreeResponse pRegion = hashMap.get(parentId);
if(pRegion != null) {
pRegion.getChildren().add(r);
}else {
treeList.add(r);
}
}
});
return treeList;
}
@Override
public HashMap<String, Object> getPointDetailByTypeAndId(String type, Long pointId,String orgCode) {
return view3dMapper.getPointDetailByTypeAndId(type,pointId,orgCode);
}
@Override
......@@ -215,8 +248,8 @@ public class View3dServiceImpl implements IView3dService {
List<SafetyIndexDetailVo> resultList = Lists.newArrayList();
String dateStr = DateUtil.getDateFormat(new Date(),DateUtil.DATE_DEFAULT_FORMAT);
Map<String,Object> params = new HashMap<>();
// params.put("orgCode",orgCode);
params.put("orgCode","1*2");
params.put("orgCode",orgCode);
// params.put("orgCode","1*2");
params.put("date",dateStr);
if(StatisticsErrorTypeEum.risk.getCode().equals(type)){
//1.按照日期+机构,查询出所有风险点
......
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.fas.business.vo.TodaySafetyIndexVo;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -35,6 +36,15 @@ public interface IView3dService {
*/
List<RegionTreeResponse> getPointTreeByType(String type,String orgCode);
/**
* 获取点详情
* @param type 树类型
* @param pointId 点id
* @param orgCode 登录机构
* @return
*/
HashMap<String, Object> getPointDetailByTypeAndId(String type, Long pointId,String orgCode);
/**
* 今日安全指数
* @param orgCode 登陆机构
......@@ -49,4 +59,5 @@ public interface IView3dService {
* @return list
*/
List<SafetyIndexDetailVo> getSafetyIndexDetail(String type,String orgCode);
}
......@@ -2,30 +2,172 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.View3dMapper">
<select id="getPointTreeByType" resultType="com.yeejoin.amos.fas.core.common.response.RegionTreeResponse">
select
R.id,R.name,R.code,R.parent_id,R.ue4_location,R.ue4_rotation,R.ue4_extent,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind
from f_risk_source R
where 1=1
<if test="type == 'riskSource'">
</if>
<if test="type == 'patrol'">
</if>
<if test="type == 'impEquipment'">
</if>
<if test="type == 'monitorEquipment'">
</if>
<if test="type == 'fireEquipment'">
<choose>
<when test="type == 'riskSource'">
select
R.id,R.name,R.code,R.parent_id,R.ue4_location,R.ue4_rotation,R.ue4_extent,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
#{type} as type
from f_risk_source R
where 1=1
</when>
<when test="type == 'patrol'">
select
R.id,R.parent_id,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
#{type} as type,
B.name as name,B.point_no,B.ue4_location,B.ue4_rotation
from f_risk_source R
left join p_point B on B.risk_source_id = R.id AND R.is_region='TRUE'
where 1=1
AND B.id is not null
</when>
<when test="type == 'impEquipment'">
select
R.id,R.parent_id,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
#{type} as type,
B.name,B.code,B.ue4_location,B.ue4_rotation
from f_risk_source R
left join f_equipment B on B.risk_source_id = R.id AND R.is_region='TRUE'
where 1=1
AND B.id is not null
</when>
<when test="type == 'monitorEquipment'">
select
R.id,R.parent_id,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
#{type} as type,
B.name,B.code,B.ue4_location,B.ue4_rotation
from f_risk_source R
left join f_fire_equipment B on B.risk_source_id = R.id AND B.equip_classify = 0
where 1=1
AND B.id is not null
</when>
<when test="type == 'video'">
select
R.id,R.parent_id,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
#{type} as type,
B.name,B.code,B.ue4_location,B.ue4_rotation
from f_risk_source R
left join f_fire_equipment B on B.risk_source_id = R.id AND B.equip_classify = 2
where 1=1
AND B.id is not null
</when>
<when test="type == 'fireEquipment'">
select
R.id,R.parent_id,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
CASE
WHEN ISNULL(C.id) = 0 then 'fireCar'
WHEN ISNULL(E.id) = 0 then 'fireEquipment'
WHEN ISNULL(S.id) = 0 AND S.type = 1 then 'fireChamber'
WHEN ISNULL(S.id) = 0 AND S.type = 2 then 'fireFoamRoom'
WHEN ISNULL(W.id) = 0 AND W.type = 1 then 'hydrant'
WHEN ISNULL(W.id) = 0 AND W.type = 2 then 'pool'
END as type,
CASE
WHEN ISNULL(C.name) = 0 then C.name
WHEN ISNULL(E.name) = 0 then E.name
WHEN ISNULL(S.name) = 0 then S.name
WHEN ISNULL(W.name) = 0 then W.name
END as name,
CASE
WHEN ISNULL(C.name) = 0 then C.car_num
WHEN ISNULL(E.name) = 0 then E.code
WHEN ISNULL(S.name) = 0 then S.code
WHEN ISNULL(W.name) = 0 then W.code
END as code,
CASE
WHEN ISNULL(C.name) = 0 then C.ue4_location
WHEN ISNULL(E.name) = 0 then E.ue4_location
WHEN ISNULL(S.name) = 0 then S.ue4_location
WHEN ISNULL(W.name) = 0 then W.ue4_location
END as ue4_location,
CASE
WHEN ISNULL(C.name) = 0 then C.ue4_rotation
WHEN ISNULL(E.name) = 0 then E.ue4_rotation
WHEN ISNULL(S.name) = 0 then S.ue4_rotation
WHEN ISNULL(W.name) = 0 then W.ue4_rotation
END as code
from f_risk_source R
left join f_fire_car C on C.risk_source_id = R.id
left join f_fire_equipment E on E.risk_source_id = R.id AND equip_classify = 3
left join f_fire_station S on S.risk_source_id = R.id
left join f_water_resource W on W.risk_source_id = R.id
where 1=1
AND (C.id is not null OR E.id is not null OR S.id is not null OR w.id is not null)
</when>
</choose>
<if test="orgCode != null">
AND R.org_code like CONCAT(#{orgCode},'%')
</if>
<if test="type == 'video'">
</select>
<select id="getPointDetailByTypeAndId" resultType="java.util.HashMap">
<choose>
<when test="type == 'riskSource'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
from f_risk_source
where 1=1
</when>
<when test="type == 'patrol'">
select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
from p_point
where 1=1
</when>
<when test="type == 'impEquipment'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
from f_equipment
where 1=1
</when>
<when test="type == 'monitorEquipment'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
from f_fire_equipment
where equip_classify = 0
</when>
<when test="type == 'video'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
from f_fire_equipment
where equip_classify = 2
</when>
<when test="type == 'hydrant'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
from f_water_resource
where type = 1
</when>
<when test="type == 'pool'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
from f_water_resource
where type = 2
</when>
<when test="type == 'fireCar'">
select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
from f_fire_car
where 1=1
</when>
<when test="type == 'fireEquipment'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
from f_fire_equipment
where equip_classify = 3
</when>
<when test="type == 'fireChamber'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
from f_fire_station
where type = 2
</when>
<when test="type == 'fireFoamRoom'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
from f_fire_station
where type = 1
</when>
</choose>
<if test="pointId != null">
AND id = #{pointId}
</if>
<if test="orgCode != null">
AND org_code like CONCAT(#{orgCode},'%')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment