diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java index f9b0dbc..6263434 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java @@ -13,6 +13,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.hibernate.validator.constraints.Range; import org.springblade.core.tenant.mp.TenantEntity; +import org.springblade.core.tool.utils.DateUtil; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; @@ -251,6 +252,8 @@ public class EmInfoEntity extends TenantEntity { private List infoChildren; @ApiModelProperty("最后下发时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) private LocalDateTime lastDistributeTime; @ApiModelProperty("机组类别") diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamServiceImpl.java index 12fced6..ffbdb7f 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamServiceImpl.java @@ -40,6 +40,9 @@ import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; import org.springframework.util.Assert; + +import java.math.BigDecimal; +import java.math.RoundingMode; import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; @@ -75,24 +78,32 @@ public class ParamServiceImpl implements IParamService { throw new ServiceException("获取设备实例物模型属性失败!"); }); // 获取实时数据 - List signageList = paramDeviceAttrR.getData().stream().filter(o->StringUtil.isNotBlank(o.getSignage()) && StringUtil.isNotBlank(o.getFacDeviceAttrId())).map(DeviceInstanceAttrVO::getSignage).collect(Collectors.toList()); + List signageList = paramDeviceAttrR.getData().stream() + .filter(o->StringUtil.isNotBlank(o.getSignage()) && StringUtil.isNotBlank(o.getFacDeviceAttrId())) + .map(DeviceInstanceAttrVO::getSignage).collect(Collectors.toList()); Result realDataR = deviceDataClient.getDeviceRealDataByCode(emCode, signageList); Assert.isTrue(realDataR.isSuccess(),() -> { throw new ServiceException("参数召回获取实时数据失败"); }); - Map> paramGroupVOListMap = paramDeviceAttrR.getData().stream().filter(o->StringUtil.isNotBlank(o.getFacDeviceAttrId())).map(this::convert).collect(Collectors.groupingBy(p -> { - ParamGroupVO paramGroupVO = new ParamGroupVO(); - paramGroupVO.setGroupId(String.valueOf(p.getModelClassifyId())); - paramGroupVO.setGroupName(p.getModelClassifyName()); - return paramGroupVO; - })); + Map> paramGroupVOListMap = paramDeviceAttrR.getData().stream() + .filter(o->StringUtil.isNotBlank(o.getFacDeviceAttrId()) && o.getIsParam() == 1) + .map(this::convert).collect(Collectors.groupingBy(p -> { + ParamGroupVO paramGroupVO = new ParamGroupVO(); + paramGroupVO.setGroupId(String.valueOf(p.getModelClassifyId())); + paramGroupVO.setGroupName(p.getModelClassifyName()); + return paramGroupVO; + })); paramGroupVOListMap.forEach((groupVO,list) -> { ParamTreeVO paramTreeVO = new ParamTreeVO(); paramTreeVO.setParamGroup(groupVO); list.stream().filter(p -> realDataR.getData().getDataMap().containsKey(p.getSignage())).forEach(p -> { String realData = JSON.toJSONString(realDataR.getData().getDataMap().get(p.getSignage())); if("0".equals(JSONObject.parseObject(realData).getString("q"))) { - p.setValue(JSONObject.parseObject(realData).getString("v")); + String value = JSONObject.parseObject(realData).getString("v"); + if(StringUtil.isNotBlank(p.getDbType()) && "double".equals(p.getDbType())) { + value = String.valueOf(new BigDecimal(value).setScale(p.getKeepFigures(), RoundingMode.HALF_UP).doubleValue()); + } + p.setValue(value); } }); paramTreeVO.setParamList(list);