dev #2
@ -108,6 +108,10 @@ public class EmsDevicesSetting extends BaseEntity
|
||||
@Excel(name = "设备运行状态:0-离线、1-在线")
|
||||
private String deviceStatus;
|
||||
|
||||
/** 设备运行状态:0-离线、1-在线 */
|
||||
@Excel(name = "工作状态:0-运行 1-停机 2-故障")
|
||||
private String workStatus;
|
||||
|
||||
/** 设备图像地址 */
|
||||
@Excel(name = "设备图像地址")
|
||||
private String pictureUrl;
|
||||
@ -330,6 +334,14 @@ public class EmsDevicesSetting extends BaseEntity
|
||||
this.deviceStatus = deviceStatus;
|
||||
}
|
||||
|
||||
public String getWorkStatus() {
|
||||
return workStatus;
|
||||
}
|
||||
|
||||
public void setWorkStatus(String workStatus) {
|
||||
this.workStatus = workStatus;
|
||||
}
|
||||
|
||||
public void setPictureUrl(String pictureUrl)
|
||||
{
|
||||
this.pictureUrl = pictureUrl;
|
||||
|
||||
@ -17,6 +17,8 @@ public class SiteDeviceListVo {
|
||||
private String deviceType;
|
||||
/** 运行状态 */
|
||||
private String deviceStatus;
|
||||
/** 工作状态 */
|
||||
private String workStatus;
|
||||
/** 设备类型 */
|
||||
private String deviceCategory;
|
||||
/** 设备类型 */
|
||||
@ -86,6 +88,14 @@ public class SiteDeviceListVo {
|
||||
this.deviceStatus = deviceStatus;
|
||||
}
|
||||
|
||||
public String getWorkStatus() {
|
||||
return workStatus;
|
||||
}
|
||||
|
||||
public void setWorkStatus(String workStatus) {
|
||||
this.workStatus = workStatus;
|
||||
}
|
||||
|
||||
public String getDeviceCategory() {
|
||||
return deviceCategory;
|
||||
}
|
||||
|
||||
@ -395,6 +395,8 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
|
||||
redisCache.setCacheObject(RedisKeyConstants.STACK + siteId + "_" + deviceId, dataStack);
|
||||
|
||||
// 同步更新设备工作状态
|
||||
saveDeviceWorkStatus(deviceId, siteId, dataStack.getWorkStatus());
|
||||
}
|
||||
|
||||
private void batteryGroupDataProcess(String siteId, String deviceId, String jsonData) {
|
||||
@ -686,6 +688,8 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
|
||||
redisCache.setCacheObject(RedisKeyConstants.CLUSTER + siteId + "_" + deviceId, data);
|
||||
|
||||
// 同步更新设备工作状态
|
||||
saveDeviceWorkStatus(deviceId, siteId, data.getWorkStatus());
|
||||
}
|
||||
|
||||
private String getStackDeviceId(String deviceId) {
|
||||
@ -829,11 +833,8 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
emsPcsDataMapper.insertEmsPcsData(pcsData);
|
||||
redisCache.setCacheObject(RedisKeyConstants.PCS + siteId + "_" + deviceId, pcsData);
|
||||
|
||||
// 同步更新PCS设备状态
|
||||
// EmsDevicesSetting emsDevicesSetting = emsDevicesSettingMapper.getDeviceBySiteAndDeviceId(deviceId, siteId);
|
||||
// emsDevicesSetting.setDeviceStatus(pcsData.getDeviceStatus());
|
||||
// emsDevicesSetting.setUpdatedAt(DateUtils.getNowDate());
|
||||
// emsDevicesSettingMapper.updateEmsDevicesSetting(emsDevicesSetting);
|
||||
// 同步更新PCS设备工作状态
|
||||
saveDeviceWorkStatus(deviceId, siteId, pcsData.getWorkStatus());
|
||||
|
||||
// if (SiteEnum.FX.getCode().equals(siteId)) {
|
||||
// //更新每日充放电数据
|
||||
@ -960,10 +961,23 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
emsBatteryClusterMapper.insertEmsBatteryCluster(data);
|
||||
redisCache.setCacheObject(RedisKeyConstants.CLUSTER + siteId + "_" + deviceId, data);
|
||||
|
||||
// 同步更新设备工作状态
|
||||
saveDeviceWorkStatus(deviceId, siteId, data.getWorkStatus());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void saveDeviceWorkStatus(String deviceId, String siteId, String workStatus) {
|
||||
if (StringUtils.isBlank(workStatus)) {
|
||||
return;
|
||||
}
|
||||
EmsDevicesSetting emsDevicesSetting = emsDevicesSettingMapper.getDeviceBySiteAndDeviceId(deviceId, siteId);
|
||||
emsDevicesSetting.setWorkStatus(workStatus);
|
||||
emsDevicesSetting.setUpdatedAt(DateUtils.getNowDate());
|
||||
emsDevicesSettingMapper.updateEmsDevicesSetting(emsDevicesSetting);
|
||||
}
|
||||
|
||||
private String getDeviceParent(String siteId, String deviceId) {
|
||||
Map<String, List<EmsDevicesSetting>> map = redisCache.getCacheObject(RedisKeyConstants.INIT_DEVICE_INFO);
|
||||
if (map == null || map.isEmpty()) {
|
||||
|
||||
@ -27,11 +27,12 @@
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="deviceCategory" column="device_category" />
|
||||
<result property="deviceStatus" column="device_status" />
|
||||
<result property="workStatus" column="work_status" />
|
||||
<result property="pictureUrl" column="picture_url" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsDevicesSettingVo">
|
||||
select id, device_name, device_type, slave_id, timeout_ms, retries, ip_address, ip_port, serial_port, baud_rate, data_bits, stop_bits, parity, description, created_at, updated_at, site_id, communication_status, device_id, parent_id, device_category,device_status, picture_url from ems_devices_setting
|
||||
select id, device_name, device_type, slave_id, timeout_ms, retries, ip_address, ip_port, serial_port, baud_rate, data_bits, stop_bits, parity, description, created_at, updated_at, site_id, communication_status, device_id, parent_id, device_category,device_status, picture_url,work_status from ems_devices_setting
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsDevicesSettingList" parameterType="EmsDevicesSetting" resultMap="EmsDevicesSettingResult">
|
||||
@ -58,6 +59,7 @@
|
||||
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
|
||||
<if test="deviceCategory != null and deviceCategory != ''"> and device_category = #{deviceCategory}</if>
|
||||
<if test="deviceStatus != null and deviceStatus != ''"> and device_status = #{deviceStatus}</if>
|
||||
<if test="workStatus != null and workStatus != ''"> and work_status = #{workStatus}</if>
|
||||
<if test="pictureUrl != null and pictureUrl != ''"> and picture_url = #{pictureUrl}</if>
|
||||
</where>
|
||||
</select>
|
||||
@ -91,6 +93,7 @@
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
<if test="deviceCategory != null">device_category,</if>
|
||||
<if test="deviceStatus != null">device_status,</if>
|
||||
<if test="workStatus != null">work_status,</if>
|
||||
<if test="pictureUrl != null">picture_url,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
@ -115,6 +118,7 @@
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="deviceCategory != null">#{deviceCategory},</if>
|
||||
<if test="deviceStatus != null">#{deviceStatus},</if>
|
||||
<if test="workStatus != null">#{workStatus},</if>
|
||||
<if test="pictureUrl != null">#{pictureUrl},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
@ -143,6 +147,7 @@
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
<if test="deviceCategory != null">device_category = #{deviceCategory},</if>
|
||||
<if test="deviceStatus != null">device_status = #{deviceStatus},</if>
|
||||
<if test="workStatus != null">work_status = #{workStatus},</if>
|
||||
<if test="pictureUrl != null">picture_url = #{pictureUrl},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
|
||||
@ -136,7 +136,7 @@
|
||||
<select id="getAllSiteDeviceList" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteDeviceListVo">
|
||||
select es.site_id as siteId,es.site_name as siteName,
|
||||
ed.device_id as deviceId,ed.device_name as deviceName,
|
||||
ed.device_type as deviceType,ed.device_status as deviceStatus,
|
||||
ed.device_type as deviceType,ed.device_status as deviceStatus,ed.work_status as workStatus,
|
||||
ed.device_category as deviceCategory,
|
||||
ed.picture_url as pictureUrl,
|
||||
ed.id,
|
||||
|
||||
Reference in New Issue
Block a user