2024-1-10-1 设备-看板-年月日-设备稳定性

master
A0010407 1 year ago
parent 3e965d7b70
commit 0c5cf3f18f

@ -52,6 +52,7 @@ public class DeviceInterfaceController {
/** /**
* -MTBF top10 * -MTBF top10
* / * /
* //
* @param equOperation * @param equOperation
* @return * @return
*/ */

@ -112,6 +112,9 @@ public class EquOperation extends BaseEntity {
// 创建日期结束 // 创建日期结束
private String createTimeEnd; private String createTimeEnd;
//时间维度 区分每日/每月/每年
private String timeDimension;
//MTBF接口字段 //MTBF接口字段
//序号 //序号
private String serialNumber; private String serialNumber;
@ -377,6 +380,14 @@ public class EquOperation extends BaseEntity {
return shutdownTimes; return shutdownTimes;
} }
//时间维度
public void setTimeDimension(String timeDimension) {
this.timeDimension = timeDimension;
}
public String getTimeDimension() {
return timeDimension;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -117,14 +117,14 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
public AjaxResult getEquipmentStabilityList(EquOperation equOperation) { public AjaxResult getEquipmentStabilityList(EquOperation equOperation) {
//查询所有设备(设备停用的除外) //查询所有设备(设备停用的除外)
//判断查询年/月/日 //判断查询年/月/日
//需要加逻辑
//当日时间
equOperation.setCreateTime(DateUtils.getNowDate()); equOperation.setCreateTime(DateUtils.getNowDate());
if(equOperation.getTimeDimension()==null){
equOperation.setTimeDimension("dd");
}
List<EquOperation> equipmentList = deviceInterfaceMapper.getMTBFList(equOperation); List<EquOperation> equipmentList = deviceInterfaceMapper.getMTBFList(equOperation);
return success(equipmentList); return success(equipmentList);
} }
/** /**
* *
* / * /

@ -76,15 +76,27 @@
<!--设备稳定性 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 cast(eo.actual_operation_time as decimal(6, 2))/2 desc) as serialNumber, row_number() over (order by sum(
eo.equipment_code as equipmentCode,
eo.equipment_name as equipmentName,
case case
when eo.shutdown_times > 0 THEN cast(cast(eo.actual_operation_time as decimal(18,2))/eo.shutdown_times as decimal(18,2)) when eo.shutdown_times > 0 THEN cast(cast(eo.actual_operation_time as decimal(18,2))/eo.shutdown_times as decimal(18,2))
else 0 else 0
end as mtbf end
) desc) as serialNumber,
eo.equipment_code as equipmentCode,
eo.equipment_name as equipmentName,
cast(sum(
case
when eo.shutdown_times > 0 THEN cast(eo.actual_operation_time as decimal(18,2))/eo.shutdown_times
else 0
end
)/COUNT(equipment_code) as decimal(18,2))as mtbf
from equ_operation eo from equ_operation eo
where day(eo.create_time) = day(getdate()) <where>
<if test="timeDimension == 'dd' "> and day(eo.create_time) = day(getdate())</if>
<if test="timeDimension == 'mm' "> and month(eo.create_time) = month(getdate())</if>
<if test="timeDimension == 'yyyy' "> and year(eo.create_time) = year(getdate())</if>
</where>
GROUP BY equipment_code,equipment_name
</select> </select>
<!--完好设备占比--> <!--完好设备占比-->

Loading…
Cancel
Save