diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceInterfaceMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceInterfaceMapper.java index 05406ff0..68ef5667 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceInterfaceMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceInterfaceMapper.java @@ -26,6 +26,7 @@ public interface DeviceInterfaceMapper { * @return */ List selectEquipmentList(EquOperation equOperation); + List selectEquipmentVOList(EquOperation equOperation); /** * 获取维修工单中设备信息 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java index 9045db32..238a36b6 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java @@ -53,7 +53,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { /** * 获取设备信息 * 故障停机率:(设备停机时间总和/一定时间内运行总时间(年)) - * 设备有效利用率:(实际产量/理论产量) + * 设备有效利用率:(实际产量/理论产量)改为:一定天数内该设备的总开机时间/(天数*24小时) * * @return */ @@ -61,10 +61,10 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { @DS("#header.poolName") public AjaxResult getEquipmentInfo(EquOperation equOperation) { if (equOperation.getTimeDimension() == null) { - equOperation.setTimeDimension("dd"); + equOperation.setTimeDimension("yyyy"); } // 获取所有设备信息 - List equipmentVOList = deviceInterfaceMapper.selectEquipmentList(equOperation); + List equipmentVOList = deviceInterfaceMapper.selectEquipmentVOList(equOperation); return success(equipmentVOList); } @@ -107,7 +107,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { // 按照raparQuantity字段进行排序,并使用subList获取前10个结果 List top10 = equipmentVOList.stream() .sorted(Comparator.comparing(IEquipmentVO::getRapairQuantity).reversed())// 由正序改为 反转排序 倒序 -// .limit(10) // 限制结果数量为10 改为不限制结果数量 + .limit(10) // 限制结果数量为10 改为不限制结果数量 .collect(Collectors.toList()); //将结果收集到List中 return success(top10); } @@ -138,7 +138,6 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { @DS("#header.poolName") public AjaxResult getEquipmentIntactRate(EquOperation equOperation) { //查询所有设备(设备停用的除外) - // 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); Double totalEquipment = new Double(equipmentIntactRate.getTotalEquipment()); Double operationEquipment = new Double(equipmentIntactRate.getOperationEquipment()); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java index 77360fa0..3698d7ec 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java @@ -150,7 +150,14 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String key = "#header.poolName"; equRepairWorkOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", "")); - return equRepairWorkOrderMapper.insertEquRepairWorkOrder(equRepairWorkOrder); + int result = equRepairWorkOrderMapper.insertEquRepairWorkOrder(equRepairWorkOrder); + + //2.修改设备状态 + EquEquipment equEquipment = new EquEquipment(); + equEquipment.setEquipmentCode(equipmentCode); + equEquipment.setEquipmentStatus("0");//0故障 + equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment); + return result; } /** diff --git a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml index 9cd330cc..05bcf387 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml @@ -42,6 +42,28 @@ and be.equipment_category = '0' + +