W雨文

学习java

导航

返回12个月和每月数据

@Override
public List lineChart(Integer cyear) {

TerTerminalReqVo vo = new TerTerminalReqVo();

List<TerTerminalReqVo> list = terTerminalMapper.queryCount(null, vo);

long a = 0;
LinkedList<Object> resultArray = Lists.newLinkedList();
for (Month value : Month.values()) {
HashMap<String, Object> resultJson = Maps.newHashMap();
resultJson.put("cmonth", value.getValue() + "月");
long sumnumber = list.parallelStream()
.filter(data -> Objects.equals(value.getValue(), LocalDateTime.parse(data.getCmonth(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)).getMonthValue()))
.count();
a = Objects.equals(NumberUtils.LONG_ZERO, sumnumber) ? a : (sumnumber + a);
resultJson.put("totalQuantity", Objects.equals(NumberUtils.LONG_ZERO, sumnumber) ? NumberUtils.LONG_ZERO : a);
resultArray.add(resultJson);
}
return resultArray;

posted on 2023-02-06 14:38  W雨文  阅读(13)  评论(0编辑  收藏  举报