|
@@ -229,11 +229,25 @@ public class ApiController extends BaseController {
|
|
|
@GetMapping("/api/formula/calc/{month}")
|
|
|
@CrossOrigin(origins = "*")
|
|
|
public R formulaDetail(@PathVariable String month) {
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
+ Map<String, Object> result = new HashMap<>(16);
|
|
|
List<SpecVO> specs = specService.selectSpec(month, null);
|
|
|
- specs.forEach(spec -> spec.setHeight(spec.getHeight().stripTrailingZeros()));
|
|
|
Map<String, List<SpecVO>> specsGroup = specs.stream().collect(Collectors.groupingBy(s -> s.getHeight().stripTrailingZeros().toPlainString(), LinkedHashMap::new, Collectors.toList()));
|
|
|
- result.put("trend", specsGroup);
|
|
|
+ List<String> time = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> dataList = new ArrayList<>();
|
|
|
+ specsGroup.forEach((height, list) -> {
|
|
|
+ Map<String, Object> data = new HashMap<>(16);
|
|
|
+ List<Integer> trend = list.stream()
|
|
|
+ .map(SpecVO::getNum)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ data.put("height", height);
|
|
|
+ data.put("trend", trend);
|
|
|
+ dataList.add(data);
|
|
|
+ if (time.size() == 0) {
|
|
|
+ time.addAll(list.stream().map(s -> DateUtils.parseDateToStr("yyyy-MM-dd", s.getTime())).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ result.put("time", time);
|
|
|
+ result.put("data", dataList);
|
|
|
TwinCalcHourSpec hour = new TwinCalcHourSpec();
|
|
|
Map<String, Object> params = new HashMap<>(16);
|
|
|
params.put("month", month);
|