Commit ec9ddd7b authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_ccs' of http://172.16.10.76/moa/amos-boot-biz into develop_ccs

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/BuildingServiceImpl.java
parents 3340cd50 b53b84de
package com.yeejoin.amos.boot.module.common.api.dto;
import java.util.Date;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.CommonExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 微型消防站
*
......@@ -38,6 +39,9 @@ public class FireStationDto extends BaseDto {
@ExcelProperty(value = "所在建筑", index = 1)
@ApiModelProperty(value = "所在建筑物名称")
private String whereBuilding;
@ExcelIgnore
private String parentBuildingId;
@ExcelProperty(value = "地址", index = 2)
@ApiModelProperty(value = "地址")
......
......@@ -37,6 +37,9 @@ public class KeySiteDto extends BaseDto implements Serializable{
@ApiModelProperty(value = "所属建筑id")
private Long buildingId;
@ApiModelProperty("当前所在建筑物id的所有父节点id")
private String parentBuildingId;
@ApiModelProperty(value = "所属建筑名称")
private String buildingName;
......
......@@ -37,6 +37,9 @@ public class FireStation extends BaseEntity {
@ApiModelProperty(value = "所在建筑物名称")
private String whereBuilding;
@ApiModelProperty("当前所在建筑物id的所有父节点id")
private String parentBuildingId;
@ApiModelProperty(value = "装备简要情况")
private String equipmentBrief;
......
......@@ -33,7 +33,7 @@ public class KeySite extends BaseEntity {
*/
@TableField("belong_id")
private Long belongId;
/**
* 所属单位/部门名称
......@@ -46,6 +46,12 @@ public class KeySite extends BaseEntity {
@TableField("building_id")
private Long buildingId;
/**
* 所属父节点的建筑id集合
*/
@TableField("parent_building_id")
private String parentBuildingId;
@TableField("building_name")
private String buildingName;
......
......@@ -4,8 +4,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import com.yeejoin.amos.boot.module.common.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.common.api.dto.PerfQuotaIotDTO;
......@@ -367,4 +368,10 @@ public interface EquipFeignClient {
//获取消防装备权限
@RequestMapping(value = "/equipment-detail/permissions/export", method = RequestMethod.GET)
ResponseModel<ReginParams> getPermissions() ;
@RequestMapping(value = "/building/getBuildingList", method = RequestMethod.GET)
ResponseModel<List<Map<String, Object>>> getBuildingTreeList();
@RequestMapping(value = "/building/companyBuildingTree", method = RequestMethod.GET)
public ResponseModel<Object> getCompanyBuildingTree();
}
......@@ -29,9 +29,10 @@ public interface FireStationMapper extends BaseMapper<FireStation> {
+ "<if test='par.bizCompanyCode!=null'> and a.biz_company_code like CONCAT('',#{par.bizCompanyCode},'%') </if>"
+ "<if test='par.address!=null'> and a.address like CONCAT('',#{par.address},'%') </if>"
+ "<if test='par.bizOrgCode != null'> and a.biz_org_code like CONCAT(#{par.bizOrgCode},'%') </if>"
+"<if test='nodeIds != null' > AND where_building_id in <foreach collection='nodeIds' item='buildingId' open='(' close=')' separator=','> #{buildingId} </foreach></if>"
+" order by a.rec_date desc limit #{pageNum},#{pageSize}"
+ "</script>")
List<FireStationDto>getFireStation(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize,@Param("par")FireStationDto par);
List<FireStationDto>getFireStation(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize,@Param("par")FireStationDto par,List<String> nodeIds);
@Select("<script>"
+ "select COUNT(cb_fire_station.sequence_nbr) num from cb_fire_station where cb_fire_station.is_delete=0 "
+ "<if test='par.name!=null'> and cb_fire_station.name like CONCAT('%',#{par.name},'%') </if>"
......@@ -39,8 +40,9 @@ public interface FireStationMapper extends BaseMapper<FireStation> {
+ "<if test='par.bizCompanyCode!=null'> and cb_fire_station.biz_company_code like CONCAT('',#{par.bizCompanyCode},'%') </if>"
+ "<if test='par.address!=null'> and cb_fire_station.address like CONCAT('',#{par.address},'%') </if>"
+ "<if test='par.bizOrgCode != null'> and biz_org_code like CONCAT(#{par.bizOrgCode},'%') </if>"
+"<if test='nodeIds != null' > AND where_building_id in <foreach collection='nodeIds' item='buildingId' open='(' close=')' separator=','> #{buildingId} </foreach></if>"
+ "</script>")
Map<String, Long> getFireStationCount(@Param("par")FireStationDto par);
Map<String, Long> getFireStationCount(@Param("par")FireStationDto par,List<String> nodeIds);
......@@ -58,4 +60,6 @@ public interface FireStationMapper extends BaseMapper<FireStation> {
Integer getStationListCount(@Param("par")RequestData par);
FireStationDto getFireStationDetails(Long id);
List<Map<String, Object>> getfireStatioCount(String bizOrgCode);
}
package com.yeejoin.amos.boot.module.common.api.mapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -7,9 +10,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDateDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
import java.util.List;
import java.util.Map;
/**
* 重点部位 Mapper 接口
*
......@@ -21,7 +21,7 @@ public interface KeySiteMapper extends BaseMapper<KeySite> {
* 分页查询
*/
public IPage<KeySiteDto> getPageList(Page<KeySiteDto> page, String name, Long buildingId, String fireEnduranceRate,
public IPage<KeySiteDto> getPageList(Page<KeySiteDto> page, String name, List<Long> buildingIds, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, String bizOrgCode);
/**
* 获取所有的重点部位数据
......@@ -40,4 +40,11 @@ public KeySiteDto getSequenceNbr(Long sequenceNbr);
public List<KeySiteDateDto> getKeySiteDate(Long id);
public List<String> getAddress();
/**
* 查询该单位下对应建筑的重点部位数量
* @param belong_id
* @return
*/
public List<Map<String, Object>> getKeySiteCount(String bizOrgCode);
}
package com.yeejoin.amos.boot.module.common.api.service;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDateDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto;
......@@ -8,8 +11,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import java.util.List;
/**
* 重点部位接口类
*
......@@ -75,4 +76,10 @@ public List<KeySiteDateDto> getKeySiteDate(Long id);
public List<KeySite> getKeySiteDateByNameLike(Long companyId);
public List<Map<String, Object>> keySiteCountAndBuildingTree(String bizOrgCode);
public Map<String, String> getNodeAllParentIds(List<String> ids) ;
public List<Long> getNodeAllnodeIds(Long id) ;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.FireStationMapper">
<mapper
namespace="com.yeejoin.amos.boot.module.common.api.mapper.FireStationMapper">
<select id="getStationList" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireStationzhDto">
<select id="getStationList"
resultType="com.yeejoin.amos.boot.module.common.api.dto.FireStationzhDto">
SELECT
a.sequence_nbr sequenceNbr,
a.person_charge_name personChargeName,
a.longitude,
a.name,
a.latitude,
a.person_charge_telephone personChargeTelephone,
(SELECT count(i.instance_id)
from
cb_dynamic_form_instance i
where
i.field_value = a.sequence_nbr ) As userNum,
(SELECT COUNT(*)FROM jc_firestation_jacket WHERE firefighters_id = a.sequence_nbr and is_delete =0) AS eqNum,
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) AS distance
FROM cb_fire_station a
where a.is_delete=0 and a.longitude is not null and a.latitude is not null
<if test='par.distance!=null'>
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;= #{par.distance}
</if>
ORDER BY distance limit #{pageNum},#{pageSize}
</select>
SELECT
a.sequence_nbr sequenceNbr,
a.person_charge_name personChargeName,
a.longitude,
a.name,
a.latitude,
a.person_charge_telephone personChargeTelephone,
(SELECT count(i.instance_id)
from
cb_dynamic_form_instance i
where
i.field_value = a.sequence_nbr ) As userNum,
(SELECT COUNT(*)FROM jc_firestation_jacket WHERE firefighters_id =
a.sequence_nbr and is_delete =0) AS eqNum,
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1)
AS distance
FROM cb_fire_station a
where a.is_delete=0 and a.longitude is not null and a.latitude is not null
<if test='par.distance!=null'>
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1)
&lt;= #{par.distance}
</if>
ORDER BY distance limit #{pageNum},#{pageSize}
</select>
<select id="getStationListCount" resultType="Integer">
SELECT
COUNT(a.sequence_nbr) num
FROM cb_fire_station a
where a.is_delete=0 and a.longitude is not null and a.latitude is not null
<if test='par.distance!=null'>
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;= #{par.distance}
</if>
</select>
<select id="getStationListCount" resultType="Integer">
SELECT
COUNT(a.sequence_nbr) num
FROM cb_fire_station a
where a.is_delete=0 and a.longitude is not null and a.latitude is not null
<if test='par.distance!=null'>
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1)
&lt;= #{par.distance}
</if>
</select>
<select id="getFireStationDetails" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireStationDto">
SELECT
a.*,
(SELECT
count(i.instance_id)
from
cb_dynamic_form_instance i
where
i.field_value = #{id}) As userNum
FROM cb_fire_station a
where
a.sequence_nbr = #{id}
</select>
<select id="getFireStationDetails"
resultType="com.yeejoin.amos.boot.module.common.api.dto.FireStationDto">
SELECT
a.*,
(SELECT
count(i.instance_id)
from
cb_dynamic_form_instance i
where
i.field_value = #{id}) As userNum
FROM cb_fire_station a
where
a.sequence_nbr = #{id}
</select>
<select id="getfireStatioCount" resultType="map">
SELECT
parent_building_id,
count(1) as count
FROM
cb_fire_station
WHERE is_delete= false
<if test="bizOrgCode != null and bizOrgCode != ''">
AND biz_org_code = #{bizOrgCode}
</if>
GROUP BY
where_building_id
</select>
</mapper>
......@@ -3,22 +3,27 @@
<mapper
namespace="com.yeejoin.amos.boot.module.common.api.mapper.KeySiteMapper">
<select id="getPageList" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
<select id="getPageList"
resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT
c.`name` as name,
c.belong_id as belongId,
c.biz_org_name as belongName,
c.biz_org_name as
belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.building_name as
buildingName,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_area as
buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.key_prevention_reason AS
keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
......@@ -27,9 +32,11 @@
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_user_name AS
recUserName,
c.rec_date AS recDate,
c.fire_endurance_rate_name as fireEnduranceRateName,
c.fire_endurance_rate_name as
fireEnduranceRateName,
c.use_nature_name as useNatureName
FROM
cb_key_site c
......@@ -37,8 +44,11 @@
<if test="name != null and name != ''">
AND c.`name` like concat('%',#{name}, '%')
</if>
<if test="buildingId != null and buildingId != -1">
AND c.`building_id`= #{buildingId}
<if test="buildingIds != null">
AND c.`building_id` in
<foreach collection="buildingIds" item="buildingId" open="(" close=")" separator=",">
#{buildingId}
</foreach>
</if>
<if test="fireEnduranceRate != null and fireEnduranceRate != ''">
AND c.`fire_endurance_rate`= #{fireEnduranceRate}
......@@ -54,69 +64,72 @@
</if>
order by c.rec_date desc
</select>
<select id="getSequenceNbr" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT c.`name` as name,
c.belong_id as belongId,
cou.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName,
c.biz_org_name as bizOrgName,
c.biz_org_code as bizOrgCode
<select id="getSequenceNbr"
resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT c.`name` as name,
c.belong_id as belongId,
cou.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName,
c.biz_org_name as bizOrgName,
c.biz_org_code as bizOrgCode
FROM cb_key_site c
left join cb_org_usr cou on c.belong_id = cou.sequence_nbr
where c.sequence_nbr = #{sequenceNbr}
and c.is_delete = FALSE;
left join cb_org_usr cou on c.belong_id = cou.sequence_nbr
where
c.sequence_nbr = #{sequenceNbr}
and c.is_delete = FALSE;
</select>
<select id="getKeySiteList" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT c.`name` as name,
c.belong_id as belongId,
c.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName
<select id="getKeySiteList"
resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT c.`name` as name,
c.belong_id as belongId,
c.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName
FROM cb_key_site c
where c.is_delete = FALSE
<if test="name != null and name != ''">
......@@ -139,18 +152,22 @@
</if>
</select>
<select id="getKeySiteDate" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDateDto">
<select id="getKeySiteDate"
resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDateDto">
SELECT
c.sequence_nbr AS `key`,
c.sequence_nbr AS `value`,
c.`name` as label,
c.address_desc as fireLocation,
c.longitude as floorLongitude,
c.latitude AS floorLatitude,
cou.biz_org_name as belongName,
c.belong_id as belongId
FROM cb_key_site c LEFT JOIN cb_org_usr cou on cou.sequence_nbr = c.belong_id
where c.is_delete=FALSE
c.sequence_nbr AS `key`,
c.sequence_nbr AS `value`,
c.`name` as
label,
c.address_desc as fireLocation,
c.longitude as floorLongitude,
c.latitude AS floorLatitude,
cou.biz_org_name as belongName,
c.belong_id as belongId
FROM cb_key_site c LEFT JOIN
cb_org_usr cou on cou.sequence_nbr = c.belong_id
where
c.is_delete=FALSE
<if test="id != null and id != -1">
AND c.`belong_id`= #{id}
</if>
......@@ -158,14 +175,29 @@
<select id="getAddress" resultType="string">
SELECT
cb_key_site.address_desc
cb_key_site.address_desc
FROM
cb_key_site
WHERE
cb_key_site.is_delete = FALSE AND
cb_key_site.address_desc IS NOT NULL AND
cb_key_site.address_desc != ''
GROUP BY
cb_key_site.address_desc
</select>
<select id="getKeySiteCount" resultType="map">
SELECT
parent_building_id,
count(1) as count
FROM
cb_key_site
cb_key_site
WHERE
cb_key_site.is_delete = FALSE AND
cb_key_site.address_desc IS NOT NULL AND
cb_key_site.address_desc != ''
is_delete=false
<if test="bizOrgCode != null and bizOrgCode != ''">
and biz_org_code = #{bizOrgCode}
</if>
GROUP BY
cb_key_site.address_desc
building_id
</select>
</mapper>
......@@ -32,6 +32,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
......@@ -190,4 +191,12 @@ public class FireStationController extends BaseController {
PermissionInterceptorContext.setDataAuthRule(authKey);
return ResponseHelper.buildResponse(iOrgUsrService.companyTreeByUserAndType(reginParams, OrgPersonEnum.公司.getKey()));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/fireStationCountAndBuildingTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登录人角色获取当前单位下的所在建筑的微型消防站统计值", notes = "根据登录人角色获取当前单位下的所在建筑的微型消防站统计值")
public ResponseModel<List<Map<String, Object>>> fireStationCountAndBuildingTree(
@RequestParam(required = false) String bizOrgCode) {
return ResponseHelper.buildResponse(fireStationServiceImpl.fireStationCountAndBuildingTree(bizOrgCode));
}
}
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean;
......@@ -12,6 +16,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
......@@ -24,6 +29,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.FireStationzhDto;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.entity.FireStation;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.FireStationMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFireStationService;
......@@ -43,8 +49,14 @@ public class FireStationServiceImpl extends BaseService<FireStationDto, FireStat
FireStationMapper fireStationMapper;
@Autowired
OrgUsrMapper orgUsrMapper;
@Autowired
OrgUsrServiceImpl orgUsrService;
@Autowired
EquipFeignClient equipFeignClient;
/**
* 分页查询
*/
......@@ -69,8 +81,12 @@ public class FireStationServiceImpl extends BaseService<FireStationDto, FireStat
@Override
public Page<FireStationDto> getFirefighters(int pageNum, int pageSize, FireStationDto par) {
List<FireStationDto> list = fireStationMapper.getFireStation((pageNum - 1) * pageSize, pageSize, par);
Map<String, Long> num = fireStationMapper.getFireStationCount(par);
List<String> ids=null;
if(!"-1".equals(par.getWhereBuildingId())) {
ids= getNodeAllnodeIds(par.getWhereBuildingId());
}
List<FireStationDto> list = fireStationMapper.getFireStation((pageNum - 1) * pageSize, pageSize, par,ids);
Map<String, Long> num = fireStationMapper.getFireStationCount(par,ids);
Page<FireStationDto> pageBean = new Page<>(pageNum, pageSize, num.get("num"));
return pageBean.setRecords(list);
}
......@@ -200,4 +216,107 @@ public class FireStationServiceImpl extends BaseService<FireStationDto, FireStat
root.setChildren(menuList);
return Lists.newArrayList(root);
}
@SuppressWarnings("unchecked")
public List<Map<String, Object>> fireStationCountAndBuildingTree(String bizOrgCode) {
Map<String, Integer> FireStationCountMap = parseFireStationCount(bizOrgCode);
ResponseModel<Object> response = equipFeignClient.getBuildingTree();
List<Map<String, Object>> buildingMapList = (List<Map<String, Object>>) response.getResult();
if(buildingMapList==null || buildingMapList.size()<1) {
return null;
}
return parseTree((List<Map<String, Object>>)buildingMapList.get(0).get("children"),FireStationCountMap);
}
@SuppressWarnings("unchecked")
private List<Map<String, Object>> parseTree(List<Map<String, Object>> children,
Map<String, Integer> keySiteCountMap) {
if (!ValidationUtil.isEmpty(children)) {
for (Map<String, Object> child : children) {
if (child.get("id") != null) {
if (keySiteCountMap.containsKey(child.get("id").toString())) {
child.put("count",keySiteCountMap.get(child.get("id").toString()));
}else {
child.put("count",0);
}
}else {
child.put("count",0);
}
if (!ValidationUtil.isEmpty(child.get("children"))) {
parseTree((List<Map<String, Object>>) child.get("children"), keySiteCountMap);
}
}
}
return children;
}
private Map<String, Integer> parseFireStationCount(String bizOrgCode) {
Map<String, Integer> map = new HashMap<String, Integer>();
List<Map<String, Object>> list = fireStationMapper.getfireStatioCount(bizOrgCode);
for (Map<String, Object> map2 : list) {
Object parentBuilingIdString = map2.get("parent_building_id");
if (ObjectUtils.isEmpty(parentBuilingIdString)) {
continue;
}
String[] parentBuilingIdArray = parentBuilingIdString.toString().split(",");
for (int i = 0; i < parentBuilingIdArray.length; i++) {
if (map.containsKey(parentBuilingIdArray[i])) {
int num = map.get(parentBuilingIdArray[i]).intValue();
num = num + Integer.parseInt(map2.get("count").toString());
map.put(parentBuilingIdArray[i], num);
} else {
map.put(parentBuilingIdArray[i], Integer.parseInt(map2.get("count").toString()));
}
}
}
return map;
}
public Map<String, String> getNodeAllParentIds(List<String> ids) {
Map<String, String> map =new HashMap<String, String>();
ResponseModel<List<Map<String, Object>>> response= equipFeignClient.getBuildingTreeList();
List<Map<String, Object>> responseList =response.getResult();
if(response.getStatus()!=200 && response.getResult().size()<1) {
return null;
}
ids.stream().forEach(i->{
String tegartString = getNodeAllParentIds( responseList,i,i);
map.put(i, tegartString);
});
return map;
}
private String getNodeAllParentIds(List<Map<String, Object>> list , String id,String tegartString){
for (Map<String, Object> map : list) {
if(map.get("id").toString().equals(id) && map.get("parentId")!=null ) {
tegartString=tegartString+","+map.get("parentId").toString();
return getNodeAllParentIds(list,map.get("parentId").toString(),tegartString);
}
}
return tegartString;
}
public List<String> getNodeAllnodeIds(String id) {
List<String> resultList = new ArrayList<String>();
resultList.add(id);
ResponseModel<List<Map<String, Object>>> response= equipFeignClient.getBuildingTreeList();
List<Map<String, Object>> responseList =response.getResult();
if(response.getResult()==null && response.getResult().size()<1) {
return null;
}
return getNodeAllnodeIds(resultList, responseList,id.toString());
}
private List<String> getNodeAllnodeIds(List<String> resultList,List<Map<String, Object>> list,String id){
for (Map<String, Object> map : list) {
if(map.get("parentId").toString().equals(id) && map.get("parentId")!=null ) {
resultList.add(map.get("id").toString());
return getNodeAllnodeIds(resultList,list,map.get("id").toString());
}
}
return resultList;
}
}
......@@ -105,7 +105,12 @@ public class BuildingController extends AbstractBaseController {
public List<BuildingTreeVo> getBuildingTree() {
return buildService.getBuildingTree();
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防建筑树列表信息")
@GetMapping(value = "/getBuildingList")
public List<Map<String, Object>> getBuildingTreeList() {
return buildService.getBuildingDetaiList();
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防建筑层级树")
@GetMapping(value = "/tierTree")
......
......@@ -36,8 +36,8 @@ public interface JcsFeign {
@RequestHeader("appKey") String appKey,
@RequestHeader("product") String product,
@RequestHeader("token") String token,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "pageNum") int pageNum,
@RequestParam(value = "pageSize") int pageSize,
@RequestParam(value = "name") String name,
@RequestParam(value = "belongBuildingId") List<Long> belongBuildingId,
@RequestParam(value = "belongFightingSystemId") Long belongFightingSystemId,
......
......@@ -302,6 +302,7 @@ public interface IBuilldService extends IService<Building> {
List<BuildingTreeVo> getBuildingVideoTreeNew();
List<Map<String, Object>> getBuildingDetaiList();
/**
* 查询指定楼层下装备、摄像头
* @param floorId 楼层id
......
......@@ -52,6 +52,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ZeHua Li
* @date 2020/11/12 15:48
......@@ -389,6 +390,11 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}).collect(Collectors.toList());
}
@Override
public List<Map<String, Object>> getBuildingDetaiList() {
return iFormInstanceService.getSpecialChildrenList(null);
}
private List<BuildingTreeVo> getBuildingTreeVos(Boolean isContainRootNode) {
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode());
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null);
......@@ -435,7 +441,8 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}
}
private List<BuildingTreeVo> buildBuildingData(FormGroup formGroup, List<Map<String, Object>> allList, Boolean isContainRootNode) {
private List<BuildingTreeVo> buildBuildingData(FormGroup
formGroup, List<Map<String, Object>> allList, Boolean isContainRootNode) {
List<BuildingTreeVo> allListVo = Bean.listMap2ListBean(allList, BuildingTreeVo.class);
if (isContainRootNode) {
BuildingTreeVo treeNode = new BuildingTreeVo();
......@@ -1158,14 +1165,15 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
.filter(a -> companyBuildingList.stream().noneMatch(c -> c.getId().toString().equals(a.getParentId())))
.peek(b -> {
b.setChildren(getCompanyBuildingChildrenWithCount(b.getId().toString(), companyBuildingList));
b.setTotal(b.getChildren().stream().filter(c->c.getTotal() != null).mapToLong(BuildingTreeVo::getTotal).sum());
b.setTotal(b.getChildren().stream().filter(c -> c.getTotal() != null).mapToLong(BuildingTreeVo::getTotal).sum());
}).collect(Collectors.toList());
}
private List<BuildingTreeVo> getCompanyBuildingChildrenWithCount(String parentId, List<BuildingTreeVo> companyBuildingList) {
private List<BuildingTreeVo> getCompanyBuildingChildrenWithCount(String
parentId, List<BuildingTreeVo> companyBuildingList) {
return companyBuildingList.stream().filter(a -> parentId.equals(a.getParentId())).peek(a -> {
a.setChildren(getCompanyBuildingChildrenWithCount(a.getId().toString(), companyBuildingList));
a.setTotal(a.getChildren().stream().filter(c->c.getTotal() != null).mapToLong(BuildingTreeVo::getTotal).sum());
a.setTotal(a.getChildren().stream().filter(c -> c.getTotal() != null).mapToLong(BuildingTreeVo::getTotal).sum());
}).collect(Collectors.toList());
}
......
......@@ -191,11 +191,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
});
String userId = remoteSecurityService.getAgencyUser().getUserId();
vo.setRecUserId(userId);
// 冗余名称,数据同步使用
this.setChargePersonName(vo);
String s = String.valueOf(System.currentTimeMillis());
vo.setId(s);
vo.setRecUserId(userId);
vo.setSort(s);
DynamicFormGroup dynamicFormGroup = iEqDynamicFormGroupService.getById(vo.getFormGroupId());
vo.setSystemType(dynamicFormGroup.getRelationId() != null ? dynamicFormGroup.getRelationId().toString() : "");
......@@ -273,8 +273,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
private void setChargePersonName(FireFightingSystemVo vo) {
if (StringUtil.isNotEmpty(vo.getChargePerson())) {
FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.queryByUserId(vo.getChargePerson());
if (StringUtil.isNotEmpty(vo.getRecUserId())) {
FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.queryByUserId(vo.getRecUserId());
AgencyUserModel userModel = result == null ? new AgencyUserModel() : result.getResult();
vo.setChargePersonName(userModel.getRealName());
}
......
......@@ -83,6 +83,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.FirefightersContacts;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersEducation;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersPost;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersWorkexperience;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.entity.RescueEquipment;
......@@ -786,7 +787,9 @@ public class ExcelServiceImpl {
}
private void excelImportFireStation(MultipartFile multipartFile) throws Exception {
List<FireStationDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireStationDto.class, 1);
Map<String, String> maps = getAllBuildingIdForParentBuilingIds(excelDtoList);
List<FireStation> excelEntityList = new ArrayList<>();
excelDtoList.forEach(item -> {
FireStation fireStation = new FireStation();
......@@ -796,6 +799,9 @@ public class ExcelServiceImpl {
String[] whereBuilding = fireStation.getWhereBuilding().split("@");
fireStation.setWhereBuilding(whereBuilding[0]);
fireStation.setWhereBuildingId(whereBuilding[1]);
if(maps.containsKey(whereBuilding[1])){
fireStation.setParentBuildingId(maps.get(whereBuilding[1]));
}
}
if (fireStation.getBizCompany() != null) {
String[] bizCompany = fireStation.getBizCompany().split("@");
......@@ -817,7 +823,17 @@ public class ExcelServiceImpl {
});
fireStationService.saveBatch(excelEntityList);
}
public Map<String, String> getAllBuildingIdForParentBuilingIds(List<FireStationDto> excelDtoList) {
List<String> list = new ArrayList<String>();
for (FireStationDto fireStation : excelDtoList) {
if (org.apache.commons.lang3.StringUtils.isNotBlank(fireStation.getWhereBuilding())) {
String[] whereBuilding = fireStation.getWhereBuilding().split("@");
fireStation.setWhereBuildingId(whereBuilding[1]);
list.add(whereBuilding[1]);
}
}
return keySiteService.getNodeAllParentIds(list);
}
private void excelImportFireTeam(MultipartFile multipartFile) throws Exception {
List<FireTeamDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireTeamDto.class, 1);
List<FireTeam> excelEntityList = new ArrayList<>();
......
......@@ -663,13 +663,13 @@
<if test="equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''">
AND wles.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%')
</if>
)s1
)s1 WHERE 1=1
<if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''">
where s1.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
AND s1.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
</if>
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
where s1.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
AND s1.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if>
......@@ -745,7 +745,7 @@
</if>
)s2
<if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''">
where s2.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
AND s2.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
</if>
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
where s2.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
......@@ -1844,13 +1844,13 @@ FROM
<if test="equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''">
AND wles.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%')
</if>
)s1
)s1 WHERE 1=1
<if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''">
where s1.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
AND s1.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
</if>
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
where s1.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
AND s1.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if>
order by createDate DESC
</select>
......@@ -1960,13 +1960,13 @@ FROM
<if test="equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''">
AND wles.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%')
</if>
)s1
)s1 WHERE 1=1
<if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''">
where s1.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
and s1.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
</if>
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
where s1.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
and s1.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if>
......
......@@ -2723,7 +2723,29 @@
</sql>
</changeSet>
<changeSet id="chenhao-2022-02-08-1" author="chenhao">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_key_site" columnName="parent_building_id"/>
</not>
</preConditions>
<comment>cb_key_site add column parent_building_id 所属建筑节点的所有父节点id集合</comment>
<sql>
ALTER TABLE cb_key_site ADD parent_building_id varchar(500) NULL COMMENT '所属建筑节点的所有父节点id集合';
</sql>
</changeSet>
<changeSet id="chenhao-2022-02-09-1" author="chenhao">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_fire_station" columnName="parent_building_id"/>
</not>
</preConditions>
<comment>cb_fire_station add column parent_building_id 所属建筑节点的所有父节点id集合</comment>
<sql>
ALTER TABLE cb_fire_station ADD parent_building_id varchar(1000) NULL COMMENT '所属建筑节点的所有父节点id集合';
</sql>
</changeSet>
<changeSet author="tw" id="20220207-1" runAlways="true">
<comment>`getParentList`</comment>
<sql endDelimiter="#">
......
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