Browse Source

异常设备筛选条件

develop
王兴琳 10 hours ago
parent
commit
b148b1854b
  1. 18
      zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java
  2. 11
      zc-business/src/main/java/com/zc/business/domain/DcDeviceOfflineRecord.java
  3. 2
      zc-business/src/main/resources/mapper/business/DcDeviceOfflineRecordMapper.xml

18
zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java

@ -367,9 +367,15 @@ public class DcDeviceOnlineController extends BaseController {
String FAIL_RATE = "failRate";//离线率 String FAIL_RATE = "failRate";//离线率
String SUM_USE_STATE = "sumUseState";//在用数 String SUM_USE_STATE = "sumUseState";//在用数
String SUM = "sum";//总数 String SUM = "sum";//总数
Map<String, Object> returnMap = new HashMap<>(); Map<String, Object> returnMap = new LinkedHashMap<>();
List<DcDevice> dcDeviceList = dcDeviceService.list(); List<DcDevice> dcDeviceList = dcDeviceService.list();
List<DcRoadSection> dcRoadSections = dcRoadSectionService.selectDcRoadSectionList(new DcRoadSection()); List<DcRoadSection> dcRoadSections = dcRoadSectionService.selectDcRoadSectionList(new DcRoadSection());
// 创建一个映射存储roadId到sectionName
Map<String, String> roadIdToSectionNameMap = new HashMap<>();
for (DcRoadSection dcRoadSection : dcRoadSections) {
roadIdToSectionNameMap.put(dcRoadSection.getId().toString(), dcRoadSection.getSectionName());
}
/* // 去重设备列表 /* // 去重设备列表
dcDeviceList = dcDeviceList.stream() dcDeviceList = dcDeviceList.stream()
.distinct() .distinct()
@ -417,6 +423,7 @@ public class DcDeviceOnlineController extends BaseController {
devicesInRoad.forEach(device -> System.out.println("Device ID: " + device.getId() + ", Stake Mark: " + device.getStakeMark())); devicesInRoad.forEach(device -> System.out.println("Device ID: " + device.getId() + ", Stake Mark: " + device.getStakeMark()));
}*/ }*/
} }
List<Map.Entry<String, Object>> sortedEntries = new ArrayList<>();
for (DcRoadSection dcRoadSection : dcRoadSections) { for (DcRoadSection dcRoadSection : dcRoadSections) {
Map<String, Object> itemMap = new HashMap<>(); Map<String, Object> itemMap = new HashMap<>();
String roadId = dcRoadSection.getId().toString(); String roadId = dcRoadSection.getId().toString();
@ -445,8 +452,15 @@ public class DcDeviceOnlineController extends BaseController {
// 丢包率暂时设置为空 // 丢包率暂时设置为空
itemMap.put(LOST_RATE, ""); itemMap.put(LOST_RATE, "");
// 添加到列表中
sortedEntries.add(new AbstractMap.SimpleEntry<>(roadId, itemMap));
// 将排序后的条目添加到returnMap中,使用sectionName作为键
for (Map.Entry<String, Object> entry : sortedEntries) {
String Id = entry.getKey();
String sectionName = roadIdToSectionNameMap.get(Id);
returnMap.put(sectionName, entry.getValue());
}
returnMap.put(dcRoadSection.getSectionName(), itemMap);
} }
return AjaxResult.success(returnMap); return AjaxResult.success(returnMap);

11
zc-business/src/main/java/com/zc/business/domain/DcDeviceOfflineRecord.java

@ -1,5 +1,6 @@
package com.zc.business.domain; package com.zc.business.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
@ -62,6 +63,9 @@ public class DcDeviceOfflineRecord extends BaseEntity
@Excel(name = "所在桩号") @Excel(name = "所在桩号")
@ApiModelProperty(value="所在桩号") @ApiModelProperty(value="所在桩号")
private String stakeMark; private String stakeMark;
@TableField(exist = false)
private String endStakeMark;
/** 方向1-上行,2-中,3-下行 */ /** 方向1-上行,2-中,3-下行 */
@ApiModelProperty(value="方向") @ApiModelProperty(value="方向")
@ -126,6 +130,13 @@ public class DcDeviceOfflineRecord extends BaseEntity
@Excel(name = "诊断结果") @Excel(name = "诊断结果")
private String diagnostics; private String diagnostics;
public String getEndStakeMark() {
return endStakeMark;
}
public void setEndStakeMark(String endStakeMark) {
this.endStakeMark = endStakeMark;
}
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;

2
zc-business/src/main/resources/mapper/business/DcDeviceOfflineRecordMapper.xml

@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="iotDeviceId != null "> and iot_device_id = #{iotDeviceId}</if> <if test="iotDeviceId != null "> and iot_device_id = #{iotDeviceId}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if> <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if> <if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if>
<if test="stakeMark != null and stakeMark != ''"> and stake_mark = #{stakeMark}</if> <if test="stakeMark != null and stakeMark != ''"> and stake_mark BETWEEN #{stakeMark} and #{endStakeMark} </if>
<if test="direction != null and direction != ''"> and direction = #{direction}</if> <if test="direction != null and direction != ''"> and direction = #{direction}</if>
<if test="installationSite != null and installationSite != ''"> and installation_site = #{installationSite}</if> <if test="installationSite != null and installationSite != ''"> and installation_site = #{installationSite}</if>
<if test="deviceIp != null and deviceIp != ''"> and device_ip = #{deviceIp}</if> <if test="deviceIp != null and deviceIp != ''"> and device_ip = #{deviceIp}</if>

Loading…
Cancel
Save