Browse Source

# 站点集中监控属性排序赋值优化

zhongwei
haungxing 1 year ago
parent
commit
414b954d36
  1. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentEntity.java
  2. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java

2
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentEntity.java

@ -133,7 +133,7 @@ public class ContentEntity extends TenantEntity {
@ApiModelProperty(value = "绑定物模型属性标识") @ApiModelProperty(value = "绑定物模型属性标识")
private String attrSignage; private String attrSignage;
@ApiModelProperty(value = "绑定物模型属性标识") @ApiModelProperty(value = "绑定物模型属性名称")
private String attrName; private String attrName;
@ApiModelProperty(value = "绑定采集点ID") @ApiModelProperty(value = "绑定采集点ID")

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java

@ -39,6 +39,7 @@ import org.springframework.util.Assert;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* @author hx * @author hx
@ -237,6 +238,8 @@ public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttribut
.map(stationAttr -> this.fillAttrId(stationAttrList,stationAttr)) .map(stationAttr -> this.fillAttrId(stationAttrList,stationAttr))
.sorted(Comparator.comparing(StationAttributeVo::getSort,Comparator.nullsLast(Integer::compareTo))) .sorted(Comparator.comparing(StationAttributeVo::getSort,Comparator.nullsLast(Integer::compareTo)))
.collect(Collectors.toList()); .collect(Collectors.toList());
// 排序完成之后循环赋值
Stream.iterate(1,n -> n+1).limit(result.size()).forEach(index -> result.get(index-1).setSort(index));
return result; return result;
} }
@ -282,7 +285,6 @@ public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttribut
result.setUpdateTime(null); result.setUpdateTime(null);
return result; return result;
} }
stationAttr.setSort(null);
} }
return stationAttr; return stationAttr;
} }

Loading…
Cancel
Save