From 6874b8647a6355823b2057bbd59e2910c9382293 Mon Sep 17 00:00:00 2001 From: yangbo Date: Sun, 2 Feb 2020 03:42:22 +0800 Subject: [PATCH] =?UTF-8?q?[feature]=20=E5=A2=9E=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=94=B9=E7=94=A8=E5=BA=93=E8=A1=A8=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../d420115/D420115DataController.java | 49 +++++++++++++------ .../PatientAreaRuntimeServiceImpl.java | 2 + 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gsafety/gemp/wuhanncov/controller/d420115/D420115DataController.java b/src/main/java/com/gsafety/gemp/wuhanncov/controller/d420115/D420115DataController.java index 42f3331..50769cd 100644 --- a/src/main/java/com/gsafety/gemp/wuhanncov/controller/d420115/D420115DataController.java +++ b/src/main/java/com/gsafety/gemp/wuhanncov/controller/d420115/D420115DataController.java @@ -5,6 +5,7 @@ package com.gsafety.gemp.wuhanncov.controller.d420115; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import javax.annotation.Resource; @@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.fasterxml.jackson.annotation.JsonProperty; +import com.gsafety.gemp.wuhanncov.contract.dto.ChinaCountStatisticsJSON; import com.gsafety.gemp.wuhanncov.contract.dto2.PatientAreaInfoDailyDTO2; import com.gsafety.gemp.wuhanncov.contract.service.NcovCommonDataService; import com.gsafety.gemp.wuhanncov.contract.service.PatientAreaRuntimeService; @@ -134,19 +136,27 @@ public class D420115DataController { @ApiParam(value = "单个区域行政区划编码", example = "420115") @RequestParam("area_id") String areaId) { List list = new ArrayList<>(); - list.add(new PatientAreaD420115Add("江夏区", 19, 105)); - list.add(new PatientAreaD420115Add("纸坊街", 13, 56)); - list.add(new PatientAreaD420115Add("庙山产业园", 3, 5)); - list.add(new PatientAreaD420115Add("藏龙岛产业园", 2, 6)); - list.add(new PatientAreaD420115Add("金口街", 1, 9)); - list.add(new PatientAreaD420115Add("大桥产业园", 0, 9)); - list.add(new PatientAreaD420115Add("郑店街", 0, 5)); - list.add(new PatientAreaD420115Add("山坡街", 0, 4)); - list.add(new PatientAreaD420115Add("五里界街", 0, 4)); - list.add(new PatientAreaD420115Add("湖泗街", 0, 3)); - list.add(new PatientAreaD420115Add("法泗街", 0, 2)); - list.add(new PatientAreaD420115Add("安山街", 0, 2)); - list.add(new PatientAreaD420115Add("乌龙泉街", 0, 1)); + ChinaCountStatisticsJSON one = patientAreaRuntimeService.findByAreaCode(areaId); + list.add(new PatientAreaD420115Add(one.getAreaName(), one.getNewCase(), one.getNew_probable())); + + List records = patientAreaRuntimeService.findByParentNo(areaId); + records.forEach(record -> list + .add(new PatientAreaD420115Add(record.getAreaName(), record.getNewCase(), record.getNew_probable()))); + Collections.sort(list); + Collections.reverse(list); + // list.add(new PatientAreaD420115Add("江夏区", 19, 105)); + // list.add(new PatientAreaD420115Add("纸坊街", 13, 56)); + // list.add(new PatientAreaD420115Add("庙山产业园", 3, 5)); + // list.add(new PatientAreaD420115Add("藏龙岛产业园", 2, 6)); + // list.add(new PatientAreaD420115Add("金口街", 1, 9)); + // list.add(new PatientAreaD420115Add("大桥产业园", 0, 9)); + // list.add(new PatientAreaD420115Add("郑店街", 0, 5)); + // list.add(new PatientAreaD420115Add("山坡街", 0, 4)); + // list.add(new PatientAreaD420115Add("五里界街", 0, 4)); + // list.add(new PatientAreaD420115Add("湖泗街", 0, 3)); + // list.add(new PatientAreaD420115Add("法泗街", 0, 2)); + // list.add(new PatientAreaD420115Add("安山街", 0, 2)); + // list.add(new PatientAreaD420115Add("乌龙泉街", 0, 1)); return list; } @@ -270,7 +280,7 @@ public class D420115DataController { @Data @AllArgsConstructor @NoArgsConstructor - class PatientAreaD420115Add { + class PatientAreaD420115Add implements Comparable { @JsonProperty("name") @ApiModelProperty(value = "地区") @@ -284,6 +294,17 @@ public class D420115DataController { @ApiModelProperty(value = "新增疑似") private Integer newProbable = 0; + @Override + public int compareTo(PatientAreaD420115Add o) { + if (o == null) { + return -1; + } + if (this.newCase.compareTo(o.newCase) == 0) { + return this.newProbable.compareTo(o.newProbable); + } + return this.newCase.compareTo(o.newCase); + } + } /** diff --git a/src/main/java/com/gsafety/gemp/wuhanncov/service/PatientAreaRuntimeServiceImpl.java b/src/main/java/com/gsafety/gemp/wuhanncov/service/PatientAreaRuntimeServiceImpl.java index af0a23e..5d9e7f8 100644 --- a/src/main/java/com/gsafety/gemp/wuhanncov/service/PatientAreaRuntimeServiceImpl.java +++ b/src/main/java/com/gsafety/gemp/wuhanncov/service/PatientAreaRuntimeServiceImpl.java @@ -48,6 +48,7 @@ public class PatientAreaRuntimeServiceImpl implements PatientAreaRuntimeService list.stream().forEach(temp -> { ChinaCountStatisticsJSON json = new ChinaCountStatisticsJSON(); BeanUtils.copyProperties(temp, json); + json.setNew_probable(temp.getNewProbable()); listResult.add(json); }); return listResult.iterator().next(); @@ -62,6 +63,7 @@ public class PatientAreaRuntimeServiceImpl implements PatientAreaRuntimeService list.stream().forEach(temp -> { ChinaCountStatisticsJSON json = new ChinaCountStatisticsJSON(); BeanUtils.copyProperties(temp, json); + json.setNew_probable(temp.getNewProbable()); listResult.add(json); }); return listResult; -- Gitee