|
@@ -542,16 +542,18 @@ public class DeviceService {
|
|
|
double angleInRadians = Math.toRadians(selected == null ? 0L : Double.parseDouble(selected.getVal()));
|
|
double angleInRadians = Math.toRadians(selected == null ? 0L : Double.parseDouble(selected.getVal()));
|
|
|
double cosValue = Math.cos(angleInRadians);
|
|
double cosValue = Math.cos(angleInRadians);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(val)) {
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(val)) {
|
|
|
- double doubleValue = (new BigDecimal(val).subtract(currentValue)).divide(new BigDecimal(360),9, RoundingMode.HALF_UP).doubleValue();
|
|
|
|
|
|
|
+ double doubleValue = (new BigDecimal(val).subtract(currentValue)).divide(new BigDecimal(360), 9, RoundingMode.HALF_UP).doubleValue();
|
|
|
offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
|
|
offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// currentMeasurement.put(itemName, offsetValue);
|
|
// currentMeasurement.put(itemName, offsetValue);
|
|
|
vo.setCurrentMeasurementValue(offsetValue == null ? null : offsetValue.toString());
|
|
vo.setCurrentMeasurementValue(offsetValue == null ? null : offsetValue.toString());
|
|
|
- Date date = slopeData.getTs();
|
|
|
|
|
- if (date!=null){
|
|
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm:ss");
|
|
|
|
|
- vo.setCurrentMeasurementTime(simpleDateFormat.format(date));
|
|
|
|
|
|
|
+ if (slopeData != null) {
|
|
|
|
|
+ Date date = slopeData.getTs();
|
|
|
|
|
+ if (date != null) {
|
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm:ss");
|
|
|
|
|
+ vo.setCurrentMeasurementTime(simpleDateFormat.format(date));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
itemList.clear();
|
|
itemList.clear();
|
|
@@ -564,10 +566,12 @@ public class DeviceService {
|
|
|
// currentMeasurement.put(itemName, offsetValue);
|
|
// currentMeasurement.put(itemName, offsetValue);
|
|
|
// vo.setCurrentMeasurementValue(offsetValue == null ? null : offsetValue.toString());
|
|
// vo.setCurrentMeasurementValue(offsetValue == null ? null : offsetValue.toString());
|
|
|
vo.setCurrentMeasurementValue(val);
|
|
vo.setCurrentMeasurementValue(val);
|
|
|
- Date date = slopeData.getTs();
|
|
|
|
|
- if (date!=null){
|
|
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm:ss");
|
|
|
|
|
- vo.setCurrentMeasurementTime(simpleDateFormat.format(date));
|
|
|
|
|
|
|
+ if (slopeData != null) {
|
|
|
|
|
+ Date date = slopeData.getTs();
|
|
|
|
|
+ if (date != null) {
|
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm:ss");
|
|
|
|
|
+ vo.setCurrentMeasurementTime(simpleDateFormat.format(date));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -581,10 +585,12 @@ public class DeviceService {
|
|
|
// currentMeasurement.put(itemName, offsetValue);
|
|
// currentMeasurement.put(itemName, offsetValue);
|
|
|
// vo.setCurrentMeasurementValue(offsetValue == null ? null : offsetValue.toString());
|
|
// vo.setCurrentMeasurementValue(offsetValue == null ? null : offsetValue.toString());
|
|
|
vo.setCurrentMeasurementValue(val);
|
|
vo.setCurrentMeasurementValue(val);
|
|
|
- Date date = slopeData.getTs();
|
|
|
|
|
- if (date!=null){
|
|
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm:ss");
|
|
|
|
|
- vo.setCurrentMeasurementTime(simpleDateFormat.format(date));
|
|
|
|
|
|
|
+ if (slopeData != null) {
|
|
|
|
|
+ Date date = slopeData.getTs();
|
|
|
|
|
+ if (date != null) {
|
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm:ss");
|
|
|
|
|
+ vo.setCurrentMeasurementTime(simpleDateFormat.format(date));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
map.put(itemName, vo);
|
|
map.put(itemName, vo);
|