|
@@ -260,12 +260,12 @@ public class BigScreenSbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, Sb
|
|
Optional<RemoteDegreeLogVO> lastR = lastList.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum())).findFirst();
|
|
Optional<RemoteDegreeLogVO> lastR = lastList.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum())).findFirst();
|
|
if(lastR.isPresent()){
|
|
if(lastR.isPresent()){
|
|
log.info(JSONObject.toJSONString(lastR.get()));
|
|
log.info(JSONObject.toJSONString(lastR.get()));
|
|
- positiveTotal = positiveTotal.subtract(new BigDecimal(lastR.get().getResult()));
|
|
|
|
|
|
+ positiveTotal = positiveTotal.subtract(new BigDecimal(lastR.get().getResult()).abs());
|
|
}
|
|
}
|
|
}else{// 从今天上个时间找,减去上个小时的数据
|
|
}else{// 从今天上个时间找,减去上个小时的数据
|
|
Optional<RemoteDegreeLogVO> lastR = list.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum()) && item.getHour().equals(degreeLog.getHour()-1)).findFirst();
|
|
Optional<RemoteDegreeLogVO> lastR = list.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum()) && item.getHour().equals(degreeLog.getHour()-1)).findFirst();
|
|
if(lastR.isPresent()){
|
|
if(lastR.isPresent()){
|
|
- positiveTotal = positiveTotal.subtract(new BigDecimal(lastR.get().getResult()));
|
|
|
|
|
|
+ positiveTotal = positiveTotal.subtract(new BigDecimal(lastR.get().getResult()).abs());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
dictJsonObject.put("positive", positiveTotal.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).doubleValue());
|
|
dictJsonObject.put("positive", positiveTotal.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).doubleValue());
|
|
@@ -276,12 +276,12 @@ public class BigScreenSbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, Sb
|
|
Optional<RemoteDegreeLogVO> lastR = lastList.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum())).findFirst();
|
|
Optional<RemoteDegreeLogVO> lastR = lastList.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum())).findFirst();
|
|
if(lastR.isPresent()){
|
|
if(lastR.isPresent()){
|
|
log.info(JSONObject.toJSONString(lastR.get()));
|
|
log.info(JSONObject.toJSONString(lastR.get()));
|
|
- negativeTotal = negativeTotal.subtract(new BigDecimal(lastR.get().getResult()));
|
|
|
|
|
|
+ negativeTotal = negativeTotal.subtract(new BigDecimal(lastR.get().getResult()).abs());
|
|
}
|
|
}
|
|
}else{// 从今天上个时间找,减去上个小时的数据
|
|
}else{// 从今天上个时间找,减去上个小时的数据
|
|
Optional<RemoteDegreeLogVO> lastR = list.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum()) && item.getHour().equals(degreeLog.getHour()-1)).findFirst();
|
|
Optional<RemoteDegreeLogVO> lastR = list.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum()) && item.getHour().equals(degreeLog.getHour()-1)).findFirst();
|
|
if(lastR.isPresent()){
|
|
if(lastR.isPresent()){
|
|
- negativeTotal = negativeTotal.subtract(new BigDecimal(lastR.get().getResult()));
|
|
|
|
|
|
+ negativeTotal = negativeTotal.subtract(new BigDecimal(lastR.get().getResult()).abs());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
dictJsonObject.put("negative", negativeTotal.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).doubleValue());
|
|
dictJsonObject.put("negative", negativeTotal.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).doubleValue());
|
|
@@ -308,6 +308,11 @@ public class BigScreenSbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, Sb
|
|
lastDay.setDay(calendar.getActualMaximum(Calendar.DATE));
|
|
lastDay.setDay(calendar.getActualMaximum(Calendar.DATE));
|
|
List<RemoteDegreeLogVO> lastList = remoteDegreeLogMapper.selectList(lastDay);
|
|
List<RemoteDegreeLogVO> lastList = remoteDegreeLogMapper.selectList(lastDay);
|
|
|
|
|
|
|
|
+ // 全部取绝对值,有负数的去掉
|
|
|
|
+ for (RemoteDegreeLogVO degreeLog : lastList) {
|
|
|
|
+ degreeLog.setResult(degreeLog.getResult().replace("-", ""));
|
|
|
|
+ }
|
|
|
|
+
|
|
for (int i = 1; i <= days; i++) {
|
|
for (int i = 1; i <= days; i++) {
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put("time", i);
|
|
jsonObject.put("time", i);
|
|
@@ -333,13 +338,13 @@ public class BigScreenSbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, Sb
|
|
Optional<RemoteDegreeLogVO> lastR = lastList.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum())).findFirst();
|
|
Optional<RemoteDegreeLogVO> lastR = lastList.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum())).findFirst();
|
|
if(lastR.isPresent()){
|
|
if(lastR.isPresent()){
|
|
//log.info("1: " + degreeLog.getDay() + "," + degreeLog.getDay() + ","+ degreeLog.getDay() + ","+ lastR.get().getDay());
|
|
//log.info("1: " + degreeLog.getDay() + "," + degreeLog.getDay() + ","+ degreeLog.getDay() + ","+ lastR.get().getDay());
|
|
- positiveTotal = positiveTotal.subtract(new BigDecimal(lastR.get().getResult()));
|
|
|
|
|
|
+ positiveTotal = positiveTotal.subtract(new BigDecimal(lastR.get().getResult()).abs());
|
|
}
|
|
}
|
|
}else{// 从后天时间找,减去昨天的数据
|
|
}else{// 从后天时间找,减去昨天的数据
|
|
Optional<RemoteDegreeLogVO> lastR = list.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum()) && item.getDay().equals(degreeLog.getDay()+1)).findFirst();
|
|
Optional<RemoteDegreeLogVO> lastR = list.stream().filter(item -> item.getPositionNum().equals(degreeLog.getPositionNum()) && item.getDay().equals(degreeLog.getDay()+1)).findFirst();
|
|
if(lastR.isPresent()){
|
|
if(lastR.isPresent()){
|
|
//log.info("2: " + degreeLog.getDay() + "," + lastR.get().getDay());
|
|
//log.info("2: " + degreeLog.getDay() + "," + lastR.get().getDay());
|
|
- positiveTotal = new BigDecimal(lastR.get().getResult()).subtract(positiveTotal);
|
|
|
|
|
|
+ positiveTotal = new BigDecimal(lastR.get().getResult()).abs().subtract(positiveTotal);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|