Browse Source

修改灵敏感知大屏

main
sjh 1 year ago
parent
commit
318dfb0e0f
  1. 14
      src/main/java/com/biutag/supervision/service/RiskStatisticsService.java

14
src/main/java/com/biutag/supervision/service/RiskStatisticsService.java

@ -10,6 +10,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@ -70,7 +71,18 @@ public class RiskStatisticsService {
for (Map<String, Object> map : maps) {
RiskStatisticsVo tmp = new RiskStatisticsVo();
tmp.setLabel(map.get("membersName").toString());
tmp.setValue((Integer) map.get(type));
Object valueObj = map.get(type);
if (valueObj instanceof Long) {
tmp.setValue(((Long) valueObj).intValue());
} else if (valueObj instanceof BigDecimal) {
tmp.setScore(((BigDecimal) valueObj).doubleValue());
} else if (valueObj instanceof Double) {
tmp.setScore((Double) valueObj);
} else if (valueObj instanceof Integer) {
tmp.setValue((Integer) valueObj);
} else {
throw new IllegalArgumentException("Unsupported type: " + valueObj.getClass().getName());
}
result.add(tmp);
}
result.sort(Comparator.comparing(RiskStatisticsVo::getValue, Comparator.reverseOrder()));

Loading…
Cancel
Save