Commit ffff1bd3 authored by 李秀明's avatar 李秀明

fix: BUG#23594,30706 消防物资,应急物资卡片上显示的数量,应包含装备的数据和备品库的数据,新增泡沫液的分类

parent d226c250
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog; import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.WlSpareEquipment;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO; import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
import com.yeejoin.equipmanage.common.entity.vo.EquipTypeImgAmountVO; import com.yeejoin.equipmanage.common.entity.vo.EquipTypeImgAmountVO;
import com.yeejoin.equipmanage.common.enums.*; import com.yeejoin.equipmanage.common.enums.*;
...@@ -12,6 +14,7 @@ import com.yeejoin.equipmanage.common.utils.UnitTransformUtil; ...@@ -12,6 +14,7 @@ import com.yeejoin.equipmanage.common.utils.UnitTransformUtil;
import com.yeejoin.equipmanage.common.vo.IotDataVO; import com.yeejoin.equipmanage.common.vo.IotDataVO;
import com.yeejoin.equipmanage.common.vo.PressurePumpCountVo; import com.yeejoin.equipmanage.common.vo.PressurePumpCountVo;
import com.yeejoin.equipmanage.mapper.EmergencyMapper; import com.yeejoin.equipmanage.mapper.EmergencyMapper;
import com.yeejoin.equipmanage.mapper.WlSpareEquipmentMapper;
import com.yeejoin.equipmanage.service.IEmergencyService; import com.yeejoin.equipmanage.service.IEmergencyService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmLogService; import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmLogService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce; import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
...@@ -27,6 +30,7 @@ import org.springframework.util.CollectionUtils; ...@@ -27,6 +30,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.*;
...@@ -53,6 +57,10 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -53,6 +57,10 @@ public class EmergencyServiceImpl implements IEmergencyService {
@Autowired @Autowired
private SupervisionVideoServiceImpl supervisionVideoService; private SupervisionVideoServiceImpl supervisionVideoService;
@Autowired
private WlSpareEquipmentMapper wlSpareEquipmentMapper;
@Autowired @Autowired
private IPressurePumpService pressurePumpService; private IPressurePumpService pressurePumpService;
...@@ -142,7 +150,39 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -142,7 +150,39 @@ public class EmergencyServiceImpl implements IEmergencyService {
@Override @Override
public Map<String, Object> emergencyMaterials() { public Map<String, Object> emergencyMaterials() {
return emergencyMapper.selectEmergencyMaterials(); double liquidFoam = getCAFSFoamTanksRemainingVolume();
Map<String, Object> resultMap = emergencyMapper.selectEmergencyMaterials();
resultMap.put("liquidFoam", liquidFoam);
return resultMap;
}
private double getCAFSFoamTanksRemainingVolume() {
// 1. 查询CAFS泡沫罐余量总和
Page<Map<String, Object>> page = new Page<>(1, 9999);
Page<Map<String, Object>> queriedPage = emergencyMapper.selectFoamTank(page);
List<Map<String, Object>> records = queriedPage.getRecords();
BigDecimal sum = new BigDecimal(0);
for (Map<String, Object> record : records) {
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(record.get("nowLevel")),
String.valueOf(record.get("unit")), String.valueOf(record.get("minLevel")), String.valueOf(record.get("maxLevel")));
if (!String.valueOf(transResult.get("abs")).equals("--") && !ObjectUtils.isEmpty(record.get("volume"))) {
BigDecimal value = new BigDecimal(String.valueOf(record.get("volume"))).multiply(new BigDecimal(String.valueOf(transResult.get("abs")))).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
sum = sum.add(value);
}
}
// 2. 查询备品备件泡沫液余量总和
List<WlSpareEquipment> wlSpareEquipments = wlSpareEquipmentMapper.selectList(
Wrappers.<WlSpareEquipment>lambdaQuery()
.select(WlSpareEquipment::getStockNum)
.likeRight(WlSpareEquipment::getEquipCategoryCode, "420104")
);
for (WlSpareEquipment equipment : wlSpareEquipments) {
BigDecimal stockNum = BigDecimal.valueOf(equipment.getStockNum()).setScale(2, RoundingMode.HALF_UP);
sum = sum.add(stockNum);
}
return sum.doubleValue();
} }
@Override @Override
......
...@@ -212,12 +212,60 @@ ...@@ -212,12 +212,60 @@
<select id="selectEmergencyMaterials" resultType="java.util.Map"> <select id="selectEmergencyMaterials" resultType="java.util.Map">
SELECT SELECT
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '3104', '%' ) ) AS fireExtinguisher, (
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '3105', '%' ) ) AS fireHydrant, (SELECT COUNT(1) FROM wl_equipment_specific wel WHERE wel.equipment_code LIKE CONCAT('3104', '%') AND wel.single = 1) +
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '3910', '%' ) ) AS fireShovel, (SELECT ROUND(IFNULL(SUM(wse.stock_num), 0), 2) FROM wl_spare_equipment wse WHERE wse.equip_category_code LIKE CONCAT('3104', '%')) +
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '3904', '%' ) ) AS fireAxe, (
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '3911', '%' ) ) AS fireBucket, SELECT ROUND(IFNULL(SUM(wsd.amount), 0), 2) FROM wl_stock_detail wsd WHERE wsd.equipment_specific_id IN (
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '1106', '%' ) ) AS respirator SELECT id FROM wl_equipment_specific t WHERE t.equipment_code LIKE CONCAT('3104', '%') AND t.single = 0
)
)
) AS fireExtinguisher,
(
(SELECT COUNT(1) FROM wl_equipment_specific wel WHERE wel.equipment_code LIKE CONCAT('3105', '%') AND wel.single = 1) +
(SELECT ROUND(IFNULL(SUM(wse.stock_num), 0), 2) FROM wl_spare_equipment wse WHERE wse.equip_category_code LIKE CONCAT('3105', '%')) +
(
SELECT ROUND(IFNULL(SUM(wsd.amount), 0), 2) FROM wl_stock_detail wsd WHERE wsd.equipment_specific_id IN (
SELECT id FROM wl_equipment_specific t WHERE t.equipment_code LIKE CONCAT('3105', '%') AND t.single = 0
)
)
) AS fireHydrant,
(
(SELECT COUNT(1) FROM wl_equipment_specific wel WHERE wel.equipment_code LIKE CONCAT('3910', '%') AND wel.single = 1) +
(SELECT ROUND(IFNULL(SUM(wse.stock_num), 0), 2) FROM wl_spare_equipment wse WHERE wse.equip_category_code LIKE CONCAT('3910', '%')) +
(
SELECT ROUND(IFNULL(SUM(wsd.amount), 0), 2) FROM wl_stock_detail wsd WHERE wsd.equipment_specific_id IN (
SELECT id FROM wl_equipment_specific t WHERE t.equipment_code LIKE CONCAT('3910', '%') AND t.single = 0
)
)
) AS fireShovel,
(
(SELECT COUNT(1) FROM wl_equipment_specific wel WHERE wel.equipment_code LIKE CONCAT('3904', '%') AND wel.single = 1) +
(SELECT ROUND(IFNULL(SUM(wse.stock_num), 0), 2) FROM wl_spare_equipment wse WHERE wse.equip_category_code LIKE CONCAT('3904', '%')) +
(
SELECT ROUND(IFNULL(SUM(wsd.amount), 0), 2) FROM wl_stock_detail wsd WHERE wsd.equipment_specific_id IN (
SELECT id FROM wl_equipment_specific t WHERE t.equipment_code LIKE CONCAT('3904', '%') AND t.single = 0
)
)
) AS fireAxe,
(
(SELECT COUNT(1) FROM wl_equipment_specific wel WHERE wel.equipment_code LIKE CONCAT('3911', '%') AND wel.single = 1) +
(SELECT ROUND(IFNULL(SUM(wse.stock_num), 0), 2) FROM wl_spare_equipment wse WHERE wse.equip_category_code LIKE CONCAT('3911', '%')) +
(
SELECT ROUND(IFNULL(SUM(wsd.amount), 0), 2) FROM wl_stock_detail wsd WHERE wsd.equipment_specific_id IN (
SELECT id FROM wl_equipment_specific t WHERE t.equipment_code LIKE CONCAT('3911', '%') AND t.single = 0
)
)
) AS fireBucket,
(
(SELECT COUNT(1) FROM wl_equipment_specific wel WHERE wel.equipment_code LIKE CONCAT('1106', '%') AND wel.single = 1) +
(SELECT ROUND(IFNULL(SUM(wse.stock_num), 0), 2) FROM wl_spare_equipment wse WHERE wse.equip_category_code LIKE CONCAT('1106', '%')) +
(
SELECT ROUND(IFNULL(SUM(wsd.amount), 0), 2) FROM wl_stock_detail wsd WHERE wsd.equipment_specific_id IN (
SELECT id FROM wl_equipment_specific t WHERE t.equipment_code LIKE CONCAT('1106', '%') AND t.single = 0
)
)
) AS respirator
</select> </select>
<select id="selectEmergencyMaterialsDetails" resultType="java.util.Map"> <select id="selectEmergencyMaterialsDetails" resultType="java.util.Map">
SELECT 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