7 changed files with 193 additions and 3 deletions
@ -0,0 +1,81 @@ |
|||||||
|
package com.mh.common.core.domain.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author LJF |
||||||
|
* @version 1.0 |
||||||
|
* @date 2025-02-14 09:30:47 |
||||||
|
* @description 设备统计状态表 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class DeviceState { |
||||||
|
|
||||||
|
/** |
||||||
|
* 当前时间 |
||||||
|
*/ |
||||||
|
private Date curDate; |
||||||
|
|
||||||
|
/** |
||||||
|
* 设备数目 |
||||||
|
*/ |
||||||
|
private int deviceNum; |
||||||
|
|
||||||
|
/** |
||||||
|
* 电表数目 |
||||||
|
*/ |
||||||
|
private int electNum; |
||||||
|
|
||||||
|
/** |
||||||
|
* 水表数目 |
||||||
|
*/ |
||||||
|
private int waterNum; |
||||||
|
|
||||||
|
/** |
||||||
|
* 泵数目 |
||||||
|
*/ |
||||||
|
private int pumpNum; |
||||||
|
|
||||||
|
/** |
||||||
|
* 压力表数目 |
||||||
|
*/ |
||||||
|
private int pressureNum; |
||||||
|
|
||||||
|
/** |
||||||
|
* 在线设备数目 |
||||||
|
*/ |
||||||
|
private int onlineNum; |
||||||
|
|
||||||
|
/** |
||||||
|
* 离线设备数目 |
||||||
|
*/ |
||||||
|
private int offlineNum; |
||||||
|
|
||||||
|
/** |
||||||
|
* 故障设备数目 |
||||||
|
*/ |
||||||
|
private int faultNum; |
||||||
|
|
||||||
|
/** |
||||||
|
* 上次故障数目 |
||||||
|
*/ |
||||||
|
private int lastFaultNum; |
||||||
|
|
||||||
|
/** |
||||||
|
* 故障环比 |
||||||
|
*/ |
||||||
|
private String faultP; |
||||||
|
|
||||||
|
/** |
||||||
|
* 热泵正在运行的数目 |
||||||
|
*/ |
||||||
|
private int pumpOnline; |
||||||
|
|
||||||
|
/** |
||||||
|
* 其他设备数目 |
||||||
|
*/ |
||||||
|
private int otherNum; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
package com.mh.quartz.task; |
||||||
|
|
||||||
|
import com.mh.system.service.device.IDeviceLedgerService; |
||||||
|
import jakarta.annotation.Resource; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author LJF |
||||||
|
* @version 1.0 |
||||||
|
* @project EEMCS |
||||||
|
* @description 生活热水供水系统定时器 |
||||||
|
* @date 2025-06-17 16:12:04 |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@Component("hotWaterTask") |
||||||
|
public class HotWaterTask { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private IDeviceLedgerService deviceLedgerService; |
||||||
|
|
||||||
|
private boolean createOrUpdateDeviceState = false; |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增或者更新设备状态表 |
||||||
|
*/ |
||||||
|
public void createOrUpdateDeviceState() { |
||||||
|
try { |
||||||
|
if (!createOrUpdateDeviceState) { |
||||||
|
createOrUpdateDeviceState = true; |
||||||
|
deviceLedgerService.createOrUpdateDeviceState(); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
log.error("新增或者更新设备状态表失败", e); |
||||||
|
createOrUpdateDeviceState = false; |
||||||
|
} finally { |
||||||
|
createOrUpdateDeviceState = false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package com.mh.system.mapper.device; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.mh.common.core.domain.entity.DeviceState; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Select; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author LJF |
||||||
|
* @version 1.0 |
||||||
|
* @project EEMCS |
||||||
|
* @description 设备状态mapper类 |
||||||
|
* @date 2025-06-17 17:40:14 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface DeviceStateMapper extends BaseMapper<DeviceState> { |
||||||
|
|
||||||
|
@Select("select * from device_state where system_type = #{systemType} and date(cur_date) = date(curdate()) limit 1") |
||||||
|
List<DeviceState> deviceState(String systemType); |
||||||
|
} |
Loading…
Reference in new issue