设备看板 两个接口

highway
A0010407 12 months ago
parent 7c7830a750
commit 134c9d271d

@ -1,6 +1,7 @@
package com.op.device.controller;
import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquOperationRecord;
import com.op.device.service.IDeviceInterfaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -49,4 +50,25 @@ public class DeviceInterfaceController {
return deviceInterfaceService.getRepairQuantity();
}
/**
* -MTBF top10
* /
* @param equOperationRecord
* @return
*/
@GetMapping("/equipmentStability")
public AjaxResult getEquipmentStabilityList(EquOperationRecord equOperationRecord) {
return deviceInterfaceService.getEquipmentStabilityList(equOperationRecord);
}
/**
*
* /
* @param equOperationRecord
* @return
*/
@GetMapping("/equipmentIntactRate")
public AjaxResult getEquipmentIntactRate(EquOperationRecord equOperationRecord) {
return deviceInterfaceService.getEquipmentIntactRate(equOperationRecord);
}
}

@ -64,6 +64,26 @@ public class EquOperationRecord extends BaseEntity {
/** 删除标识 */
private String delFlag;
//MTBF接口字段
//序号
private String serialNumber;
//开机时间
private String onTime;
//故障次数
private String shutDownNumber;
//mtbf
private String mtbf;
//IntactRate 完好设备占比字段
//运行设备
private String operationEquipment;
//故障设备
private String faultEquipment;
//总设备
private String totalEquipment;
//百分比
private String intactRate;
public void setId(String id) {
this.id = id;
}
@ -149,6 +169,70 @@ public class EquOperationRecord extends BaseEntity {
return delFlag;
}
//虚拟字段 序号
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public String getSerialNumber() {
return serialNumber;
}
//开机时间
public void setOnTime(String onTime) {
this.onTime = onTime;
}
public String getOnTime() {
return onTime;
}
//故障次数
public void setShutDownNumber(String shutDownNumber) {
this.shutDownNumber = shutDownNumber;
}
public String getShutDownNumber() {
return shutDownNumber;
}
//mtbf
public void setMtbf(String mtbf) {
this.mtbf = mtbf;
}
public String getMtbf() {
return mtbf;
}
//运行设备
public void setOperationEquipment(String operationEquipment) {
this.operationEquipment = operationEquipment;
}
public String getOperationEquipment() {
return operationEquipment;
}
//故障设备
public void setFaultEquipment(String faultEquipment) {
this.faultEquipment = faultEquipment;
}
public String getFaultEquipment() {
return faultEquipment;
}
//总设备
public void setTotalEquipment(String totalEquipment) {
this.totalEquipment = totalEquipment;
}
public String getTotalEquipment() {
return totalEquipment;
}
//完好率
public void setIntactRate(String intactRate) {
this.intactRate = intactRate;
}
public String getIntactRate() {
return intactRate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -62,5 +62,4 @@ public interface EquEquipmentMapper {
//查询设备类型
List<EquEquipment> getEquipmentTypeList(EquEquipment equEquipment);
}

@ -65,4 +65,10 @@ public interface EquOperationRecordMapper {
* @return
*/
List<EquOperationRecord> selectEquOperationRecordByEquipmentCode(String equipmentCode);
//设备稳定性 MTBF设备平均故障间隔
List<EquOperationRecord> getMTBFList(EquOperationRecord equOperationRecord);
//设备完好率
EquOperationRecord getEquipmentIntactRate(EquOperationRecord equOperationRecord);
}

@ -1,6 +1,7 @@
package com.op.device.service;
import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquOperationRecord;
/**
*
@ -24,4 +25,18 @@ public interface IDeviceInterfaceService {
* @return
*/
AjaxResult getRepairQuantity();
/**
* MTBF /
* @return
*/
AjaxResult getEquipmentStabilityList(EquOperationRecord equOperationRecord);
/**
*
* /
* @param equOperationRecord
* @return
*/
AjaxResult getEquipmentIntactRate(EquOperationRecord equOperationRecord);
}

@ -5,6 +5,7 @@ import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquOperationRecord;
import com.op.device.domain.EquRepairWorkOrder;
import com.op.device.domain.MesReportWork;
import com.op.device.mapper.EquEquipmentMapper;
import com.op.device.domain.vo.IEquipmentVO;
import com.op.device.domain.vo.IRepairWorkOrderVO;
import com.op.device.mapper.DeviceInterfaceMapper;
@ -36,6 +37,12 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
@Autowired
private EquOperationRecordMapper equOperationRecordMapper;
@Autowired
private EquEquipmentMapper equEquipmentMapper;
@Autowired
private EquOperationRecordMapper equOperationRecordMapper;
/**
*
*
@ -180,4 +187,29 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
return success(top10);
}
/**
* -MTBF top10
* /
*/
@Override
@DS("#header.poolName")
public AjaxResult getEquipmentStabilityList(EquOperationRecord equOperationRecord) {
//查询所有设备(设备停用的除外)
List<EquOperationRecord> equipmentList = equOperationRecordMapper.getMTBFList(equOperationRecord);
return success(equipmentList);
}
/**
*
* /
*/
@Override
@DS("#header.poolName")
public AjaxResult getEquipmentIntactRate(EquOperationRecord equOperationRecord) {
//查询所有设备(设备停用的除外)
EquOperationRecord equipmentIntactRate = equOperationRecordMapper.getEquipmentIntactRate(equOperationRecord);
return success(equipmentIntactRate);
}
}

@ -149,4 +149,34 @@
#{id}
</foreach>
</delete>
<!--设备稳定性 MTBF-->
<select id="getMTBFList" parameterType="EquOperationRecord" resultType="com.op.device.domain.EquOperationRecord">
select
row_number() over (ORDER BY sum(CASE WHEN eor.type = 'on' THEN cast(datediff(minute, eor.start_time,eor.end_time)*1.0/60 as decimal(10,2)) ELSE null END )/sum(CASE WHEN type = 'off' THEN 1 ELSE 0 END) DESC) AS serialNumber,
eor.equipment_code AS equipmentCode,
sum(CASE WHEN eor.type = 'on' THEN cast(datediff(minute, eor.start_time,eor.end_time)*1.0/60 as decimal(10,2)) ELSE null END ) AS onTime,
sum(CASE WHEN eor.type = 'off' THEN 1 ELSE 0 END) AS shutDownNumber,
cast(sum(CASE WHEN eor.type = 'on' THEN datediff(minute, eor.start_time,eor.end_time)*1.0/60 ELSE null END )/sum(CASE WHEN type = 'off' THEN 1 ELSE 0 END)as decimal(10,2)) as mtbf
from equ_operation_record eor
left join base_equipment be on eor.equipment_code = be.equipment_code
where be.status = '1'
and be.del_flag = '0'
and eor.start_time is not null
and eor.end_time is not null
GROUP BY eor.equipment_code
ORDER BY onTime desc
</select>
<!--完好设备占比-->
<select id="getEquipmentIntactRate" parameterType="EquOperationRecord" resultType="com.op.device.domain.EquOperationRecord">
SELECT
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 = '0' THEN 1 Else 0 END) AS faultEquipment,
COUNT(*) AS totalEquipment,
CONCAT(cast(SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END)*100/COUNT(*)as decimal(10,2)),'%') AS intactRate
FROM base_equipment
WHERE del_flag = '0' AND status = '1'
</select>
</mapper>
Loading…
Cancel
Save