Commit cb821db6 authored by suhuiguang's avatar suhuiguang

1.增加区域下点查询接口,前端删除区域时根据长度进行校验

parent f571ae6a
......@@ -12,8 +12,6 @@ import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.Authorization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
......@@ -144,8 +142,7 @@ public class View3dController extends BaseController {
public CommonResponse getStatisticsDuty(){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
CommonResponse statisticsDuty = view3dService.getStatisticsDuty(getAppKey(),getProduct(),orgCode);
return statisticsDuty;
return view3dService.getStatisticsDuty(getAppKey(),getProduct(),orgCode);
}
@ApiOperation(value = "异常区域信息查询",notes = "异常区域信息查询")
......@@ -157,7 +154,7 @@ public class View3dController extends BaseController {
return CommonResponseUtil.success(exceptionRegionVoList);
}
@ApiOperation(value = "异常区域信息查询",notes = "异常区域信息查询")
@ApiOperation(value = "设备状态信息查询",notes = "设备状态信息查询")
@GetMapping(value = "equipStatus/list")
public CommonResponse getEquipStatusList(){
ReginParams reginParams =getSelectedOrgInfo();
......@@ -233,4 +230,10 @@ public class View3dController extends BaseController {
public CommonResponse pointLevel(@ApiParam(value = "点类型") @RequestParam String type){
return CommonResponseUtil.success(view3dService.pointLevelList(type));
}
@ApiOperation(value = "重新区域下包含点",notes = "重新区域下包含点")
@GetMapping(value = "point/list/{regionId}")
public CommonResponse listPointsByRegion(@PathVariable Long regionId, @RequestParam(required = false, defaultValue = "all") String type){
return CommonResponseUtil.success(view3dService.listPointsByRegionId(regionId,type));
}
}
......@@ -149,4 +149,11 @@ public interface View3dMapper extends BaseMapper{
Long retrieveAllCount(String type, String inputText,String orgCode,String dataLevel,String protectObjName);
List<HashMap<String, Object>> retrieveAll(String type, String inputText, long start, int length,String orgCode,String dataLevel,String protectObjName);
/**
* 查询区域下点
* @param ids 区域ids
* @return list
*/
List<Map<String, Object>> getAllPointInRegions(@Param("ids") List<Long> ids);
}
......@@ -600,5 +600,42 @@ public class View3dServiceImpl implements IView3dService {
throw new YeeException("不支持的类型 -->"+ type);
}
}
@Override
public List<Map<String, Object>> listPointsByRegionId(Long regionId, String type) {
List<Map<String, Object>> pointList = new ArrayList<>();
if(FasConstant.ALL_POINT.equalsIgnoreCase(type)){//分支1:查询区域及子区域下所有点
List<Long> regionIds = new ArrayList<>();
List<RiskSource> riskSourceList = iRiskSourceDao.findByParentId(regionId);
this.getAllRiskRegion(regionIds,riskSourceList);
regionIds.add(regionId);
pointList = this.getPointsByRegionIds(regionIds);
} else {//分支2:查询指定区域下所有点
pointList = this.getPointsByRegionIds(Collections.singletonList(regionId));
}
return pointList;
}
private List<Map<String,Object>> getPointsByRegionIds(List<Long> ids){
return view3dMapper.getAllPointInRegions(ids);
}
/**
* 获得子节点:区域
* @param ids 返回
* @param riskSourceList 风险点区域列表
*/
private void getAllRiskRegion(List<Long> ids, List<RiskSource> riskSourceList) {
//TODO 递归
for (RiskSource riskSource : riskSourceList) {
if (riskSource.getIsRegion().equalsIgnoreCase("TRUE")) {
ids.add(riskSource.getId());
List<RiskSource> list = iRiskSourceDao.findByParentId(riskSource.getId());
if (list != null) {
this.getAllRiskRegion(ids, list);
}
}
}
}
}
......@@ -165,4 +165,11 @@ public interface IView3dService {
*/
List<Map<String,String>> pointLevelList(String type);
/**
* 查询区域下的各类点
* @param regionId 区域id
* @param type 类型
* @return list
*/
List<Map<String, Object>> listPointsByRegionId(Long regionId, String type);
}
......@@ -1385,4 +1385,52 @@ from (select concat('riskSource',r.id) as id,r.name,r.code,r.ue4_location as ue4
</if>
LIMIT ${start},${length}
</select>
<select id="getAllPointInRegions" resultType="java.util.Map">
select
CONCAT(type,'-',id) as `key`,
id as pointId,
name,
type,
risk_source_id as regionId
from
(select id,name,'riskSource' as type, parent_id as risk_source_id
from f_risk_source where is_region = 'FALSE'
UNION all
select id,name,'patrol' as type,risk_source_id
from p_point WHERE is_delete = FALSE
UNION all
select id,name ,'impEquipment' as type,risk_source_id
from f_equipment e
UNION all
select id,name,'monitorEquipment' as type,risk_source_id
from f_fire_equipment where equip_classify = 0
UNION all
select id,name,'video' as type,risk_source_id
from f_fire_equipment where equip_classify = 2
UNION all
select id,name ,'hydrant' as type,risk_source_id
from f_water_resource where type = 1
UNION all
select id,name,'pool' as type,risk_source_id
from f_water_resource where type = 2
UNION all
select id,name,'fireCar' as type,risk_source_id
from f_fire_car
UNION all
select id,name,'fireEquipment' as type,risk_source_id
from f_fire_equipment where equip_classify = 3
UNION all
select id,name,'fireChamber' as type,risk_source_id
from f_fire_station where type = 2
UNION all
select id,name,'fireFoamRoom' as type,risk_source_id
from f_fire_station where type = 1
) as sp
where
risk_source_id in
<foreach collection="ids" open="(" separator="," close=")" item="id">
#{id}
</foreach>
order by regionId
</select>
</mapper>
\ No newline at end of file
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