Commit 6c49815c authored by 李秀明's avatar 李秀明

fix: BUG#23962 站端设备平台v5>消防自动化>消防资源>消防设施>消防装备,左下角装备定义的数量的查询接口查询出的数据,和设备卡片的数据不一致

parent 121d2911
......@@ -537,10 +537,10 @@ public class FireFightingSystemController extends AbstractBaseController {
}
}
if (flag == 0) {
String classificationCode = equipTypeAmountPage.getEquipmentClassificationCode().replaceAll("0+$", "");
String classificationCode = equipTypeAmountPage.getEquipmentClassificationCode().replaceAll("0+$", "").trim();
return fireFightingSystemService.getColaCategoryAmountEquList(inhierarchy, classificationCode, equipTypeAmountPage);
} else {
String classificationCode = equipTypeAmountPage.getEquipmentClassificationCode().replaceAll("0+$", "");
String classificationCode = equipTypeAmountPage.getEquipmentClassificationCode().replaceAll("0+$", "").trim();
return fireFightingSystemService.getColaCategoryAmountEquList(inhierarchy, classificationCode.length() % 2 == 0 ? classificationCode : classificationCode + "0", equipTypeAmountPage);
}
// return fireFightingSystemService.getColaCategoryAmountEquList(inhierarchy, equipTypeAmountPage.getEquipmentClassificationCode(), equipTypeAmountPage);
......
......@@ -12,7 +12,7 @@ public interface ISourceStatistics {
* @param categoryCode 资源分类code
* @return int 数量
*/
int equipCategoryStatistics(String bizOrgCode, SourceTypeEnum sourceType, String categoryCode);
int equipCategoryStatistics(String bizOrgCode, SourceTypeEnum sourceType, String categoryCode, boolean isRoot);
/**
* 初始化所有有分类数据(装备、车辆),bizOrgCode + "_" + sourceType.getCode() + "_" + categoryCode
......
......@@ -1350,7 +1350,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List<EquipmentCategory> list = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> {
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, sourceTypeEnum, action.getCode());
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, sourceTypeEnum, action.getCode(), Objects.isNull(action.getParentId()));
action.setCount(Double.parseDouble(num + ""));
if (action.getParentId() == null) {
list.add(action);
......
......@@ -23,12 +23,14 @@ public class SourcesStatisticsImpl implements ISourceStatistics {
@Override
public int equipCategoryStatistics(String bizOrgCode, SourceTypeEnum sourceType, String categoryCode) {
public int equipCategoryStatistics(String bizOrgCode, SourceTypeEnum sourceType, String categoryCode, boolean isRoot) {
// 计算处通用code,用来上下级匹配如12001010000->1200101
String treeCode = subStringZero(categoryCode);
treeCode = treeCode.length() % 2 == 0 ? treeCode : treeCode + "0";
if (!isRoot && treeCode.length() % 2 != 0) {
treeCode = treeCode + "0";
}
Set<String> keys = redisUtil.getKeys(buildPattenKey(bizOrgCode, sourceType.getCode(), treeCode));
if (keys.size() > 0) {
if (!keys.isEmpty()) {
//求和
return this.sumNumber(keys);
} else {
......
......@@ -222,7 +222,7 @@
where id =#{id}
</update>
<!-- 全部建筑下不应该存在装备-->
<!-- 全部建筑下不应该存在装备-->
<select id="getPointDataNum" resultType="com.yeejoin.equipmanage.common.entity.vo.PointTreeVo">
SELECT b.* from (
select
......@@ -274,7 +274,7 @@
'equipment' as `key`,
equ.img as imgPath,
spe.qr_code as equipCode,
-- spe.code as equipCode,
-- spe.code as equipCode,
spe.code AS code,
stru.source_id as parentId,
cat.id as equipId,
......@@ -848,7 +848,7 @@
LEFT JOIN wl_manufacturer_info wlai on wled.manufacturer_id=wlai.id
LEFT JOIN wl_equipment_category wec ON wle.category_id = wec.id
WHERE 1=1
<if test="codeHead!=null and codeHead!='' and codeHead!=' '">
<if test="codeHead!=null and codeHead!=''">
and LEFT (wle.CODE, #{hierarchy}) = #{codeHead}
</if>
......@@ -952,7 +952,7 @@
LEFT JOIN wl_manufacturer_info wlai ON wlc.manufacturer_id = wlai.id
LEFT JOIN wl_equipment_category wec ON wle.category_id = wec.id
WHERE 1=1
<if test="codeHead!=null and codeHead!='' and codeHead!=' '">
<if test="codeHead!=null and codeHead!=''">
and LEFT (wec.CODE, #{hierarchy}) = #{codeHead}
</if>
<if test="equipTypeAmountPage.industryCode!=null">
......@@ -1905,7 +1905,7 @@
LEFT JOIN wl_manufacturer_info wlai ON wlc.manufacturer_id = wlai.id
LEFT JOIN wl_equipment_category wec ON wle.category_id = wec.id
WHERE 1=1
<if test="codeHead!=null and codeHead!='' and codeHead!=' '">
<if test="codeHead!=null and codeHead!=''">
and LEFT (wec.CODE, #{hierarchy}) = #{codeHead}
</if>
<if test="equipTypeAmountPage.industryCode!=null">
......@@ -1996,7 +1996,7 @@
LEFT JOIN wl_manufacturer_info wlai on wled.manufacturer_id=wlai.id
LEFT JOIN wl_equipment_category wec ON wle.category_id = wec.id
WHERE 1=1
<if test="codeHead!=null and codeHead!='' and codeHead!=' '">
<if test="codeHead!=null and codeHead!=''">
and LEFT (wle.CODE, #{hierarchy}) = #{codeHead}
<!-- and wec.`code` like concat(#{codeHead}, '%')-->
</if>
......@@ -2114,7 +2114,7 @@
LEFT JOIN wl_manufacturer_info wlai on wled.manufacturer_id=wlai.id
LEFT JOIN wl_equipment_category wec ON wle.category_id = wec.id
WHERE 1=1
<if test="codeHead!=null and codeHead!='' and codeHead!=' '">
<if test="codeHead!=null and codeHead!=''">
and LEFT (wle.CODE, #{hierarchy}) = #{codeHead}
</if>
......@@ -2689,50 +2689,50 @@
<select id="equipAlarmTOP" resultType="java.util.Map">
<!-- SELECT-->
<!-- ifnull( `a`.`fightSysName`, NULL ) AS `fightSysName`,-->
<!-- ifnull( `a`.`fightSysCode`, NULL ) AS `fightSysCode`,-->
<!-- ifnull( `a`.`fightSysId`, NULL ) AS `fightSysId`,-->
<!-- ifnull( `a`.`report_date`, NULL ) AS `reportDate`,-->
<!-- `a`.`equipName` AS `equipName`,-->
<!-- sum( `a`.`total` ) AS `total`-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- `rd`.`index_type` AS `indxKey`,-->
<!-- `rd`.`index_name` AS `index_name`,-->
<!-- `rd`.`equipment_specific_name` AS `equipName`,-->
<!-- count( DISTINCT `rd`.`equipment_specific_id` ) AS `total`,-->
<!-- `rd`.`report_date` AS `report_date`,-->
<!-- `fs`.`name` AS `fightSysName`,-->
<!-- `fs`.`code` AS `fightSysCode`,-->
<!-- `fs`.`id` AS `fightSysId`,-->
<!-- `rd`.`equipment_specific_id` AS `equipId`-->
<!-- FROM-->
<!-- (-->
<!-- `wl_equipment_alarm_report_day` `rd`-->
<!-- LEFT JOIN `f_fire_fighting_system` `fs` ON ((-->
<!-- 0 != find_in_set( `fs`.`id`, `rd`.`system_ids` ))))-->
<!-- WHERE-->
<!-- (((-->
<!-- curdate() - INTERVAL 30 DAY-->
<!-- ) &lt;= cast( `rd`.`report_date` AS date ))-->
<!-- AND ( `fs`.`code` = #{systemCode} )-->
<!-- AND ( `fs`.`biz_org_code` like concat(#{bizOrgCode}, '%') )-->
<!-- AND ((-->
<!-- `rd`.`index_type` LIKE '%Fault'-->
<!-- )-->
<!-- OR ( `rd`.`index_type` LIKE '%FireAlarm' )-->
<!-- OR ( `rd`.`index_type` LIKE '%Shield' ))-->
<!-- AND ( `rd`.`value` = 'true' ))-->
<!-- GROUP BY-->
<!-- `rd`.`equipment_specific_id`,-->
<!-- `rd`.`report_date`-->
<!-- ) `a`-->
<!-- GROUP BY-->
<!-- `a`.`equipId`-->
<!-- ORDER BY-->
<!-- `total` DESC-->
<!-- LIMIT 5-->
<!-- ifnull( `a`.`fightSysName`, NULL ) AS `fightSysName`,-->
<!-- ifnull( `a`.`fightSysCode`, NULL ) AS `fightSysCode`,-->
<!-- ifnull( `a`.`fightSysId`, NULL ) AS `fightSysId`,-->
<!-- ifnull( `a`.`report_date`, NULL ) AS `reportDate`,-->
<!-- `a`.`equipName` AS `equipName`,-->
<!-- sum( `a`.`total` ) AS `total`-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- `rd`.`index_type` AS `indxKey`,-->
<!-- `rd`.`index_name` AS `index_name`,-->
<!-- `rd`.`equipment_specific_name` AS `equipName`,-->
<!-- count( DISTINCT `rd`.`equipment_specific_id` ) AS `total`,-->
<!-- `rd`.`report_date` AS `report_date`,-->
<!-- `fs`.`name` AS `fightSysName`,-->
<!-- `fs`.`code` AS `fightSysCode`,-->
<!-- `fs`.`id` AS `fightSysId`,-->
<!-- `rd`.`equipment_specific_id` AS `equipId`-->
<!-- FROM-->
<!-- (-->
<!-- `wl_equipment_alarm_report_day` `rd`-->
<!-- LEFT JOIN `f_fire_fighting_system` `fs` ON ((-->
<!-- 0 != find_in_set( `fs`.`id`, `rd`.`system_ids` ))))-->
<!-- WHERE-->
<!-- (((-->
<!-- curdate() - INTERVAL 30 DAY-->
<!-- ) &lt;= cast( `rd`.`report_date` AS date ))-->
<!-- AND ( `fs`.`code` = #{systemCode} )-->
<!-- AND ( `fs`.`biz_org_code` like concat(#{bizOrgCode}, '%') )-->
<!-- AND ((-->
<!-- `rd`.`index_type` LIKE '%Fault'-->
<!-- )-->
<!-- OR ( `rd`.`index_type` LIKE '%FireAlarm' )-->
<!-- OR ( `rd`.`index_type` LIKE '%Shield' ))-->
<!-- AND ( `rd`.`value` = 'true' ))-->
<!-- GROUP BY-->
<!-- `rd`.`equipment_specific_id`,-->
<!-- `rd`.`report_date`-->
<!-- ) `a`-->
<!-- GROUP BY-->
<!-- `a`.`equipId`-->
<!-- ORDER BY-->
<!-- `total` DESC-->
<!-- LIMIT 5-->
SELECT
d.*
......@@ -2787,37 +2787,37 @@
</select>
<select id="equipmentState" resultType="java.util.Map">
<!-- SELECT-->
<!-- b.equipName,-->
<!-- (CASE WHEN-->
<!-- b.totalNum > 0 THEN-->
<!-- '异常' ELSE '正常' END) `status`,-->
<!-- b.totalNum AS totalNum,-->
<!-- b.`code` AS equipDetailCode-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- a.equipName,-->
<!-- count( wesl.id ) AS totalNum,-->
<!-- a.`code`-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- wes.`name` AS equipName,-->
<!-- wed.equipment_id AS equipmentId,-->
<!-- wed.`code` AS code-->
<!-- FROM-->
<!-- wl_equipment_specific wes-->
<!-- LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id-->
<!-- WHERE-->
<!-- FIND_IN_SET( #{id}, wes.system_id ) > 0-->
<!-- GROUP BY-->
<!-- wed.equipment_id-->
<!-- ) a-->
<!-- LEFT JOIN wl_equipment_specific_alarm_log wesl ON wesl.equipment_id = a.equipmentId-->
<!-- GROUP BY-->
<!-- a.equipmentId-->
<!-- ) b-->
<!-- SELECT-->
<!-- b.equipName,-->
<!-- (CASE WHEN-->
<!-- b.totalNum > 0 THEN-->
<!-- '异常' ELSE '正常' END) `status`,-->
<!-- b.totalNum AS totalNum,-->
<!-- b.`code` AS equipDetailCode-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- a.equipName,-->
<!-- count( wesl.id ) AS totalNum,-->
<!-- a.`code`-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- wes.`name` AS equipName,-->
<!-- wed.equipment_id AS equipmentId,-->
<!-- wed.`code` AS code-->
<!-- FROM-->
<!-- wl_equipment_specific wes-->
<!-- LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id-->
<!-- WHERE-->
<!-- FIND_IN_SET( #{id}, wes.system_id ) > 0-->
<!-- GROUP BY-->
<!-- wed.equipment_id-->
<!-- ) a-->
<!-- LEFT JOIN wl_equipment_specific_alarm_log wesl ON wesl.equipment_id = a.equipmentId-->
<!-- GROUP BY-->
<!-- a.equipmentId-->
<!-- ) b-->
SELECT
b.equipName,
......@@ -3157,52 +3157,52 @@
</select>
<!-- <select id="getWaterPoolVolumeInfo" resultType="java.util.Map">-->
<!-- SELECT-->
<!-- IFNULL( sum( a.margin ), 0 ) AS margin,-->
<!-- IFNULL( sum( volume ), 0 ) AS volume-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- `ou`.`code` AS `code`,-->
<!-- ifnull((-->
<!-- abs((-->
<!-- ifnull(-->
<!-- max((-->
<!-- CASE-->
<!-- WHEN ( `ei`.`name_key` = 'FHS_WirelessliquidDetector_WaterLevel' ) THEN-->
<!-- `ei`.`perf_value`-->
<!-- END-->
<!-- )),-->
<!-- ifnull( `rp`.`min_water_level`, 0 )) /-->
<!-- IF-->
<!-- ((-->
<!-- ifnull( `rp`.`max_water_level`, 0 ) = 0-->
<!-- ),-->
<!-- 1,-->
<!-- ifnull( `rp`.`max_water_level`, 0 )))) * ifnull( `rp`.`volume`, 0 )),-->
<!-- 0-->
<!-- ) AS `margin`,-->
<!-- ifnull( `rp`.`volume`, 0 ) AS `volume`-->
<!-- FROM-->
<!-- `cb_water_resource` `r`-->
<!-- LEFT JOIN `cb_org_usr` `ou` ON `ou`.`biz_org_code` = `r`.`biz_org_code`-->
<!-- LEFT JOIN `cb_water_resource_pool` `rp` ON `rp`.`resource_id` = `r`.`sequence_nbr`-->
<!-- LEFT JOIN `wl_equipment_specific` `es` ON `es`.`id` = `rp`.`level_device_id`-->
<!-- LEFT JOIN `wl_equipment_detail` `ed` ON `ed`.`id` = `es`.`equipment_detail_id`-->
<!-- LEFT JOIN `wl_equipment_index` `ei` ON `ei`.`equipment_id` = `ed`.`equipment_id`-->
<!-- WHERE-->
<!-- `r`.`resource_type` IN ( 'pool', 'industryPool' )-->
<!-- AND `r`.`is_delete` = 1-->
<!-- AND `ou`.`code` IS NOT NULL-->
<!-- <if test="companyCode != null and companyCode != ''">-->
<!-- AND ou.`code` = #{companyCode}-->
<!-- </if>-->
<!-- GROUP BY-->
<!-- `r`.`sequence_nbr`-->
<!-- ) a-->
<!-- </select>-->
<!-- <select id="getWaterPoolVolumeInfo" resultType="java.util.Map">-->
<!-- SELECT-->
<!-- IFNULL( sum( a.margin ), 0 ) AS margin,-->
<!-- IFNULL( sum( volume ), 0 ) AS volume-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- `ou`.`code` AS `code`,-->
<!-- ifnull((-->
<!-- abs((-->
<!-- ifnull(-->
<!-- max((-->
<!-- CASE-->
<!-- WHEN ( `ei`.`name_key` = 'FHS_WirelessliquidDetector_WaterLevel' ) THEN-->
<!-- `ei`.`perf_value`-->
<!-- END-->
<!-- )),-->
<!-- ifnull( `rp`.`min_water_level`, 0 )) /-->
<!-- IF-->
<!-- ((-->
<!-- ifnull( `rp`.`max_water_level`, 0 ) = 0-->
<!-- ),-->
<!-- 1,-->
<!-- ifnull( `rp`.`max_water_level`, 0 )))) * ifnull( `rp`.`volume`, 0 )),-->
<!-- 0-->
<!-- ) AS `margin`,-->
<!-- ifnull( `rp`.`volume`, 0 ) AS `volume`-->
<!-- FROM-->
<!-- `cb_water_resource` `r`-->
<!-- LEFT JOIN `cb_org_usr` `ou` ON `ou`.`biz_org_code` = `r`.`biz_org_code`-->
<!-- LEFT JOIN `cb_water_resource_pool` `rp` ON `rp`.`resource_id` = `r`.`sequence_nbr`-->
<!-- LEFT JOIN `wl_equipment_specific` `es` ON `es`.`id` = `rp`.`level_device_id`-->
<!-- LEFT JOIN `wl_equipment_detail` `ed` ON `ed`.`id` = `es`.`equipment_detail_id`-->
<!-- LEFT JOIN `wl_equipment_index` `ei` ON `ei`.`equipment_id` = `ed`.`equipment_id`-->
<!-- WHERE-->
<!-- `r`.`resource_type` IN ( 'pool', 'industryPool' )-->
<!-- AND `r`.`is_delete` = 1-->
<!-- AND `ou`.`code` IS NOT NULL-->
<!-- <if test="companyCode != null and companyCode != ''">-->
<!-- AND ou.`code` = #{companyCode}-->
<!-- </if>-->
<!-- GROUP BY-->
<!-- `r`.`sequence_nbr`-->
<!-- ) a-->
<!-- </select>-->
<select id="getCarNum" resultType="java.lang.Integer">
SELECT
......@@ -4790,7 +4790,7 @@
r.`name`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
-- IFNULL(max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),'--') AS nowLevel,
-- IFNULL(max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),'--') AS nowLevel,
IFNULL((select
avg(IFNULL(ei.`value`, 0))
from
......@@ -5018,7 +5018,7 @@
LEFT JOIN wl_form_instance_equip fi ON fi.instance_id = es.id
WHERE
ed.`code` LIKE '92011000%'
<!-- AND es.iot_code IS NOT NULL-->
<!-- AND es.iot_code IS NOT NULL-->
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND es.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
......@@ -5228,7 +5228,7 @@
AND ( (sd.`status` != 7) or (sd.`status` is null) or (sd.`status` = ''))
AND e.expiry_date IS NOT NULL
AND es.biz_org_code like concat(#{bizOrgCode}, '%')
<!-- AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0-->
<!-- AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0-->
AND #{expiryDayNum} >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
) a
GROUP BY
......@@ -5257,7 +5257,7 @@
AND ( (sd.`status` != 7) or (sd.`status` is null) or (sd.`status` = ''))
AND e.expiry_date IS NOT NULL
AND es.biz_org_code like concat(#{bizOrgCode}, '%')
<!-- AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0-->
<!-- AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0-->
AND #{expiryDayNum} >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
ORDER BY DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) ASC
</select>
......@@ -5324,7 +5324,7 @@
AND ( (sd.`status` != 7) or (sd.`status` is null) or (sd.`status` = ''))
AND e.expiry_date IS NOT NULL
AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
<!-- AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0-->
<!-- AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0-->
AND 60 >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
) AS countNum
</select>
......
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