Commit 79152802 authored by 付培阳's avatar 付培阳

消防水源接口

parent 932405e6
...@@ -45,7 +45,7 @@ public class WaterResourceDto extends BaseDto { ...@@ -45,7 +45,7 @@ public class WaterResourceDto extends BaseDto {
private Double latitude; private Double latitude;
@ExcelIgnore @ExcelIgnore
@ApiModelProperty(value = "资源类型(消火栓、消防水鹤、天然水源、消防水池)") @ApiModelProperty(value = "资源类型(消火栓:hydrant、消防水鹤:crane、天然水源:natural、消防水池:pool)")
private String resourceType; private String resourceType;
@ExplicitConstraint(type = "XFSYLX", indexNum = 2, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容 @ExplicitConstraint(type = "XFSYLX", indexNum = 2, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
......
package com.yeejoin.amos.boot.module.common.api.mapper; package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData; import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto; import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceZhDto; import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceZhDto;
...@@ -34,4 +35,5 @@ public interface WaterResourceMapper extends BaseMapper<WaterResource> { ...@@ -34,4 +35,5 @@ public interface WaterResourceMapper extends BaseMapper<WaterResource> {
Integer getWaterResourceListCount(@Param("par")RequestData par); Integer getWaterResourceListCount(@Param("par")RequestData par);
List<WaterResourceDto> getWaterResourceTypeList();
} }
...@@ -17,8 +17,11 @@ ...@@ -17,8 +17,11 @@
r.contact_user, r.contact_user,
r.contact_phone, r.contact_phone,
(case r.resource_type when 'crane' then rc.height when 'natural' then rn.height end) height, (case r.resource_type when 'crane' then rc.height when 'natural' then rn.height end) height,
(case r.resource_type when 'crane' then rc.status when 'pool' then rp.status when 'natural' then rn.status end) status, (case r.resource_type
(case r.resource_type when 'crane' then rc.section when 'pool' then rp.section end) section, when 'crane' then rc.status
when 'pool' then rp.status
when 'natural' then rn.status end) status,
(case r.resource_type when 'crane' then rc.section when 'pool' then rp.section end) section,
(case r.resource_type when 'crane' then rc.pipe_network when 'hydarant' then rh.pipe_network end) pipe_network, (case r.resource_type when 'crane' then rc.pipe_network when 'hydarant' then rh.pipe_network end) pipe_network,
(case r.resource_type when 'crane' then rc.pipe_type_name when 'hydarant' then rh.pipe_type_name when 'pool' then rp.pipe_type_name end) pipe_type_name, (case r.resource_type when 'crane' then rc.pipe_type_name when 'hydarant' then rh.pipe_type_name when 'pool' then rp.pipe_type_name end) pipe_type_name,
(case r.resource_type when 'crane' then rc.pipe_diameter when 'hydarant' then rh.pipe_diameter end) pipe_diameter, (case r.resource_type when 'crane' then rc.pipe_diameter when 'hydarant' then rh.pipe_diameter end) pipe_diameter,
...@@ -58,8 +61,6 @@ ...@@ -58,8 +61,6 @@
</select> </select>
<select id="getWaterResourceList" resultType="com.yeejoin.amos.boot.module.common.api.dto.WaterResourceZhDto"> <select id="getWaterResourceList" resultType="com.yeejoin.amos.boot.module.common.api.dto.WaterResourceZhDto">
SELECT SELECT
...@@ -76,48 +77,34 @@ ...@@ -76,48 +77,34 @@
a.maintenance_unit maintenanceUnit, a.maintenance_unit maintenanceUnit,
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) AS distance Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) AS distance
FROM cb_water_resource a FROM cb_water_resource a
where a.is_delete=0 and a.longitude is not null and a.latitude is not null where a.is_delete=0 and a.longitude is not null and a.latitude is not null
<if test='par.resourceType!=null'> <if test='par.resourceType!=null'>
and a.resource_type= #{par.resourceType} and a.resource_type= #{par.resourceType}
</if> </if>
<if test='par.distance!=null'> <if test='par.distance!=null'>
and Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;= #{par.distance} and Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;=
#{par.distance}
</if> </if>
ORDER BY distance limit #{pageNum},#{pageSize} ORDER BY distance limit #{pageNum},#{pageSize}
</select> </select>
<select id="getWaterResourceListCount" resultType="Integer"> <select id="getWaterResourceListCount" resultType="Integer">
SELECT SELECT
COUNT(a.sequence_nbr) num COUNT(a.sequence_nbr) num
FROM cb_water_resource a FROM cb_water_resource a
where a.is_delete=0 and a.longitude is not null and a.latitude is not null where a.is_delete=0 and a.longitude is not null and a.latitude is not null
<if test='par.resourceType!=null'> <if test='par.resourceType!=null'>
and a.resource_type= #{par.resourceType} and a.resource_type= #{par.resourceType}
</if> </if>
<if test='par.distance!=null'> <if test='par.distance!=null'>
and Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;= #{par.distance} and Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;=
#{par.distance}
</if> </if>
</select> </select>
<select id="getWaterResourceTypeList" resultType="com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto">
select distinct belong_fighting_system_id, belong_fighting_system, resource_type, resource_type_name
from cb_water_resource
</select>
</mapper> </mapper>
...@@ -321,4 +321,26 @@ public class WaterResourceController extends BaseController { ...@@ -321,4 +321,26 @@ public class WaterResourceController extends BaseController {
public ResponseModel<List<WaterResourceDto>> selectForList() { public ResponseModel<List<WaterResourceDto>> selectForList() {
return ResponseHelper.buildResponse(waterResourceServiceImpl.queryForWaterResourceList(true)); return ResponseHelper.buildResponse(waterResourceServiceImpl.queryForWaterResourceList(true));
} }
/**
* 列表查询消防水资源
*
* @param name 资源名称
* @param sequenceNbr 资源编号
* @param belongFightingSystemId 所属消防系统id
* @param belongBuildingId 所在建筑id
* @param belongBuilding 所在建筑
* @param resourceType 资源类型(消火栓、消防水鹤、天然水源、消防水池)
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据条件查询列表", notes = "根据条件查询列表")
@GetMapping(value = "/select_list")
public ResponseModel<List<WaterResourceDto>> selectList(String name, Long sequenceNbr,
Long belongFightingSystemId, Long belongBuildingId,
String belongBuilding, String resourceType) {
return ResponseHelper.buildResponse(waterResourceServiceImpl.queryWaterResourceList(false, name, sequenceNbr,
belongFightingSystemId, belongBuildingId,
belongBuilding, resourceType));
}
} }
...@@ -6,6 +6,7 @@ import java.util.Optional; ...@@ -6,6 +6,7 @@ import java.util.Optional;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.module.common.api.dto.*; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.*; import com.yeejoin.amos.boot.module.common.api.entity.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -62,6 +63,20 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -62,6 +63,20 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
return this.queryForList("", false, isDelete); return this.queryForList("", false, isDelete);
} }
/**
* 列表条件查询
*/
public List<WaterResourceDto> queryWaterResourceList(@Condition(Operator.eq) Boolean isDelete,
@Condition(Operator.like) String name,
@Condition(Operator.eq) Long sequenceNbr,
@Condition(Operator.eq) Long belongFightingSystemId,
@Condition(Operator.eq) Long belongBuildingId,
@Condition(Operator.like) String belongBuilding,
@Condition(Operator.eq) String resourceType) {
return this.queryForList("", false, isDelete, name, sequenceNbr, belongFightingSystemId, belongBuildingId,
belongBuilding, resourceType);
}
/** /**
* excel导入 * excel导入
...@@ -147,10 +162,10 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -147,10 +162,10 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
if (null == pageNum || null == pageSize) { if (null == pageNum || null == pageSize) {
pageNum = 1; pageNum = 1;
pageSize = Integer.MAX_VALUE; pageSize = Integer.MAX_VALUE;
}else{ } else {
pageNum=(pageNum - 1) * pageSize; pageNum = (pageNum - 1) * pageSize;
} }
return waterResourceMapper.getWaterResourceList( pageNum, pageSize, requestData); return waterResourceMapper.getWaterResourceList(pageNum, pageSize, requestData);
} }
@Override @Override
...@@ -209,4 +224,8 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -209,4 +224,8 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
} }
return waterResourceDto; return waterResourceDto;
} }
public List<WaterResourceDto> getWaterResourceTypeList() {
return waterResourceMapper.getWaterResourceTypeList();
}
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -44,4 +45,11 @@ public class EquipmentController extends BaseController { ...@@ -44,4 +45,11 @@ public class EquipmentController extends BaseController {
public ResponseModel<List<MenuFrom>> getBuildingList() { public ResponseModel<List<MenuFrom>> getBuildingList() {
return ResponseHelper.buildResponse(equipmentService.getBuildingList()); return ResponseHelper.buildResponse(equipmentService.getBuildingList());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/fireSystem_waterResource/list")
@ApiOperation(value = "获取消防系统消防水源列表")
public ResponseModel<List<MenuFrom>> getFireSystemWaterResourceList() {
return ResponseHelper.buildResponse(equipmentService.getFireSystemWaterResourceList());
}
} }
...@@ -4,14 +4,18 @@ import com.baomidou.mybatisplus.core.toolkit.BeanUtils; ...@@ -4,14 +4,18 @@ import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom; import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser; import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireSystemDto; import com.yeejoin.amos.boot.module.jcs.api.dto.FireSystemDto;
import com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient; import com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Timer; import java.util.Timer;
...@@ -24,6 +28,8 @@ public class EquipmentServiceImpl { ...@@ -24,6 +28,8 @@ public class EquipmentServiceImpl {
@Autowired @Autowired
EquipFeignClient equipFeignClient; EquipFeignClient equipFeignClient;
@Autowired
WaterResourceServiceImpl waterResourceServiceImpl;
public List<MenuFrom> getFireSystemList() { public List<MenuFrom> getFireSystemList() {
ResponseModel<Object> response = equipFeignClient.getFireSystemListAll(); ResponseModel<Object> response = equipFeignClient.getFireSystemListAll();
...@@ -72,4 +78,35 @@ public class EquipmentServiceImpl { ...@@ -72,4 +78,35 @@ public class EquipmentServiceImpl {
} }
return menuFromList; return menuFromList;
} }
public List<MenuFrom> getFireSystemWaterResourceList() {
// 获取消防系统列表
List<MenuFrom> fireSystemDtoList = getFireSystemList();
// 其他系统
MenuFrom fireSystem = new MenuFrom("-1", "其他系统", "0", "0");
fireSystemDtoList.add(fireSystem);
// 获取消防水源类型列表,包含消防系统和消防水源类型,去重
List<WaterResourceDto> waterResourceTypeList = waterResourceServiceImpl.getWaterResourceTypeList();
// 组装消防水资源树
fireSystemDtoList.forEach(item -> {
List<MenuFrom> children = Lists.newArrayList();
waterResourceTypeList.forEach(r -> {
if (r.getBelongFightingSystemId() != null && item.getKey().equals(r.getBelongFightingSystemId().toString())) {
MenuFrom menuFrom = new MenuFrom(r.getResourceType(), r.getResourceTypeName(), item.getKey(), "0");
children.add(menuFrom);
}
});
item.setChildren(children);
});
List<MenuFrom> children = Lists.newArrayList();
waterResourceTypeList.forEach(r -> {
if (r.getBelongFightingSystemId() == null) {
MenuFrom menuFrom = new MenuFrom(r.getResourceType(), r.getResourceTypeName(), "-1", "0");
children.add(menuFrom);
}
});
fireSystem.setChildren(children);
return fireSystemDtoList;
}
} }
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