重构
This commit is contained in:
@ -25,6 +25,10 @@ public class EmsSiteSetting extends BaseEntity
|
||||
@Excel(name = "站点名称")
|
||||
private String siteName;
|
||||
|
||||
/** 站点简称 */
|
||||
@Excel(name = "站点简称")
|
||||
private String siteShortName;
|
||||
|
||||
/** 站点地址 */
|
||||
@Excel(name = "站点地址")
|
||||
private String siteAddress;
|
||||
@ -77,6 +81,16 @@ public class EmsSiteSetting extends BaseEntity
|
||||
return siteName;
|
||||
}
|
||||
|
||||
public void setSiteShortName(String siteShortName)
|
||||
{
|
||||
this.siteShortName = siteShortName;
|
||||
}
|
||||
|
||||
public String getSiteShortName()
|
||||
{
|
||||
return siteShortName;
|
||||
}
|
||||
|
||||
public void setSiteAddress(String siteAddress)
|
||||
{
|
||||
this.siteAddress = siteAddress;
|
||||
@ -162,6 +176,7 @@ public class EmsSiteSetting extends BaseEntity
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("siteName", getSiteName())
|
||||
.append("siteShortName", getSiteShortName())
|
||||
.append("siteAddress", getSiteAddress())
|
||||
.append("runningTime", getRunningTime())
|
||||
.append("latitude", getLatitude())
|
||||
|
||||
@ -135,6 +135,8 @@ public class DevicePointMatchDataProcessor {
|
||||
return new HashMap<>();
|
||||
}
|
||||
return pointEnumMatchList.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(data -> StringUtils.isNotEmpty(data.getMatchField()))
|
||||
.collect(Collectors.groupingBy(data -> StringUtils.toCamelCase(data.getMatchField())));
|
||||
}
|
||||
|
||||
@ -237,8 +239,14 @@ public class DevicePointMatchDataProcessor {
|
||||
* 转换字段值为配置枚举值
|
||||
*/
|
||||
public void convertFieldValueToEnumMatch(String siteId, String deviceCategory, Object entity) {
|
||||
if (entity == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = this.getPointEnumMatchMap(siteId, deviceCategory);
|
||||
if (pointEnumMatchMap == null || pointEnumMatchMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Field[] fields = entity.getClass().getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
String fieldName = field.getName();
|
||||
@ -252,7 +260,9 @@ public class DevicePointMatchDataProcessor {
|
||||
if (CollectionUtils.isNotEmpty(pointEnumMatchList) && matchValue != null) {
|
||||
String finalMatchValue = String.valueOf(matchValue).replace(".0", "");
|
||||
Optional<EmsPointEnumMatch> enumMatch = pointEnumMatchList.stream()
|
||||
.filter(data -> data.getDataEnumCode().equals(finalMatchValue)).findFirst();
|
||||
.filter(Objects::nonNull)
|
||||
.filter(data -> Objects.equals(data.getDataEnumCode(), finalMatchValue))
|
||||
.findFirst();
|
||||
if (enumMatch.isPresent()) {
|
||||
matchValue = enumMatch.get().getEnumCode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user