2024-2-28 设备模块 设备完好率看板接口调整

master
A0010407 11 months ago
parent a4f45a2cbf
commit 7f2628410a

@ -140,6 +140,11 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
//查询所有设备(设备停用的除外) //查询所有设备(设备停用的除外)
// CAST(SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END)*100.00/COUNT(*) as decimal(18,2)) AS intactRate // CAST(SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END)*100.00/COUNT(*) as decimal(18,2)) AS intactRate
EquOperation equipmentIntactRate = deviceInterfaceMapper.getEquipmentIntactRate(equOperation); EquOperation equipmentIntactRate = deviceInterfaceMapper.getEquipmentIntactRate(equOperation);
Double totalEquipment = new Double(equipmentIntactRate.getTotalEquipment());
Double operationEquipment = new Double(equipmentIntactRate.getOperationEquipment());
Double intactRate = operationEquipment*100/totalEquipment;
String douStr = String.format("%.2f", intactRate);
equipmentIntactRate.setIntactRate(douStr);
return success(equipmentIntactRate); return success(equipmentIntactRate);
} }

@ -76,7 +76,7 @@
where dict_label = 'device_refresh_time' where dict_label = 'device_refresh_time'
</select> </select>
<!--设备稳定性 MTBF --> <!--设备稳定性 MTBF 年月-->
<select id="getMTBFList" parameterType="EquOperation" resultType="com.op.device.domain.EquOperation"> <select id="getMTBFList" parameterType="EquOperation" resultType="com.op.device.domain.EquOperation">
select select
row_number() over (order by sum( row_number() over (order by sum(
@ -108,17 +108,7 @@
SELECT SELECT
SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END) AS operationEquipment, SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END) AS operationEquipment,
SUM(CASE WHEN equipment_status = '0' or equipment_status = '2' THEN 1 Else 0 END) AS faultEquipment, SUM(CASE WHEN equipment_status = '0' or equipment_status = '2' THEN 1 Else 0 END) AS faultEquipment,
COUNT(*) AS totalEquipment, COUNT(*) AS totalEquipment
(
SELECT COUNT(id)
FROM equ_operation
WHERE '4%' > failure_rate AND CONVERT(date, create_time) = CONVERT(date, GETDATE())
)*100 /
(
SELECT COUNT(id)
FROM equ_operation
WHERE CONVERT(date, create_time) = CONVERT(date, GETDATE())
) AS intactRate
FROM base_equipment FROM base_equipment
WHERE del_flag = '0' AND status = '1' WHERE del_flag = '0' AND status = '1'
</select> </select>

Loading…
Cancel
Save