Commit 2582cb93175cc0fcd1af10cc147e678d16afc0e3

Authored by liquanyu
1 parent c60ff8ce7e
Exists in master and in 1 other branch dev

统计

Showing 1 changed file with 49 additions and 36 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RiskReportFacade.java View file @ 2582cb9
... ... @@ -557,43 +557,11 @@
557 557 }
558 558 map.put("data",items);
559 559 series.add(map);
560   -
561   -
562   -
563   -// List<Map<String,Object>> bfbItem = new ArrayList<>();
564   -//
565   -// if (CollectionUtils.isNotEmpty(series))
566   -// {
567   -// int index = 0;
568   -// for (Map<String,Object> seriseMap : series)
569   -// {
570   -// Map<String,Object> percent = new HashMap<>();
571   -// percent.put("name",seriseMap.get("name"));
572   -// percent.put("type","line");
573   -//
574   -//
575   -// //占比/环比百分比
576   -// List<String> bfb = new ArrayList<>();
577   -//
578   -//
579   -// index++;
580   -// List colums = (List)seriseMap.get("data");
581   -// Object obj = colums.get(index);
582   -// int total = 0;
583   -//
584   -// for (Map<String,Object> sMap : series)
585   -// {
586   -// List colums1 = (List)sMap.get("data");
587   -// Object obj1 = colums1.get(index);
588   -//
589   -// total += Integer.valueOf(String.valueOf(obj1));
590   -// }
591   -// bfb.add(MathUtil.getProportion(Integer.valueOf(String.valueOf(obj)),total);
592   -// }
593   -// }
594   -
595   -
596 560 }
  561 +
  562 + //计算占比
  563 + List<Map<String,Object>> bfbItem = handzb(series);
  564 + series.addAll(bfbItem);
597 565 }
598 566 }
599 567 else if (addrType == 3)
... ... @@ -639,6 +607,10 @@
639 607 }
640 608 series.add(map);
641 609 }
  610 +
  611 + //计算占比
  612 + List<Map<String,Object>> bfbItem = handzb(series);
  613 + series.addAll(bfbItem);
642 614 }
643 615 }
644 616 datas.put("series",series);
... ... @@ -648,6 +620,47 @@
648 620 return new BaseObjectResponse()
649 621 .setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(datas);
650 622 }
  623 +
  624 + /**
  625 + * 占比计算
  626 + * @param series
  627 + * @return
  628 + */
  629 + private List<Map<String,Object>> handzb(List<Map<String,Object>> series)
  630 + {
  631 + List<Map<String,Object>> bfbItem = new ArrayList<>();
  632 + if (CollectionUtils.isNotEmpty(series))
  633 + {
  634 + for (Map<String,Object> seriseMap : series)
  635 + {
  636 + List<String> bfb = new ArrayList<>();
  637 + Map<String,Object> bfbMap = new HashMap<>();
  638 + bfbMap.put("name",seriseMap.get("name"));
  639 + bfbMap.put("type","line");
  640 +
  641 + List colums = (List)seriseMap.get("data");
  642 +
  643 + for (int i = 0 ;i < colums.size() ;i++)
  644 + {
  645 + Object obj = colums.get(i);
  646 + int total = 0;
  647 + for (int j = 0 ;j < colums.size() ;j++)
  648 + {
  649 + Object obj1 = colums.get(j);
  650 +
  651 + total += Integer.valueOf(String.valueOf(obj1));
  652 + }
  653 + bfb.add(MathUtil.getProportion(Integer.valueOf(String.valueOf(obj)),total));
  654 + bfbMap.put("data",bfb);
  655 + }
  656 + bfbItem.add(bfbMap);
  657 + }
  658 + }
  659 +
  660 + return bfbItem;
  661 +
  662 + }
  663 +
651 664  
652 665 /**
653 666 * 表格标题