Skip to content

Commit 2471a18

Browse files
committed
api
1 parent b0d1f9a commit 2471a18

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

src/main/java/com/dduckddak/domain/data/population/dto/PopulationTransitionResponse.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public record PopulationTransitionResponse(
66
List<PopulationData> populationList
77
) {
88
public record PopulationData(
9+
String townName,
910
long quarter,
1011
long populationOfTown,
1112
int rankAtCity,

src/main/java/com/dduckddak/domain/data/population/service/PopulationService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public PopulationTransitionResponse getFloatingPopulationTransition(String code)
7878
List<Population> populations = populationRepository.findFloatingPopulationTransition(code);
7979
List<PopulationData> populationDataList = new ArrayList<>();
8080

81-
long[] quarterArr = new long[]{20241L, 20234L, 20233L, 20232L, 20231L};
81+
long[] quarterArr = new long[]{20231L, 20232L, 20233L, 20234L ,20241L };
8282
for(long quarter : quarterArr){
8383

8484
List<Population> listOfCity = populations.stream().filter
@@ -97,7 +97,7 @@ public PopulationTransitionResponse getFloatingPopulationTransition(String code)
9797
int rankAtDistrict = listOfDistrict.indexOf(population) + 1; // 20241분기 구 내 등수
9898
long populationAvgOfDistrict = (long) listOfDistrict.stream().mapToLong(Population::getTotalPopulation).average().getAsDouble();
9999

100-
populationDataList.add(new PopulationData(quarter, populationOfTown, rankAtCity, populationAvgOfCity, rankAtDistrict, populationAvgOfDistrict));
100+
populationDataList.add(new PopulationData(population.getTown().getName().split(" ")[1] ,quarter, populationOfTown, rankAtCity, populationAvgOfCity, rankAtDistrict, populationAvgOfDistrict));
101101
}
102102

103103
return PopulationTransitionResponse.from(populationDataList);

src/main/java/com/dduckddak/domain/data/sales/dto/SalesTransitionByIndustryResponse.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ public record SalesTransitionByIndustryResponse(
66
List<SalesData> salesList
77
) {
88
public record SalesData(
9+
String townName,
10+
String industryName,
911
long quarter,
1012
long salesOfTown,
1113
int rankAtCity,

src/main/java/com/dduckddak/domain/data/sales/dto/SalesTransitionResponse.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public record SalesTransitionResponse(
66
List<SalesData> salesList
77
) {
88
public record SalesData(
9+
String townName,
910
long quarter,
1011
long salesOfTown,
1112
int rankAtCity,

src/main/java/com/dduckddak/domain/data/sales/service/SalesService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public SalesTransitionResponse getSalesTransition(String code) {
4242

4343
List<SalesTransitionResponse.SalesData> salesDataList = new ArrayList<>();
4444

45-
long[] quarterArr = new long[]{20241L, 20234L, 20233L, 20232L, 20231L};
45+
long[] quarterArr = new long[]{20231L, 20232L, 20233L, 20234L ,20241L };
4646
for(long quarter : quarterArr){
4747

4848
List<SalesForTransitionData> listOfCity = salesForTransitionData.stream().filter
@@ -61,7 +61,7 @@ public SalesTransitionResponse getSalesTransition(String code) {
6161
int rankAtDistrict = listOfDistrict.indexOf(sales) + 1; // 20241분기 구 내 등수
6262
long populationAvgOfDistrict = (long) listOfDistrict.stream().mapToLong(s -> s.getSalesAtTown()).average().getAsDouble();
6363

64-
salesDataList.add(new SalesTransitionResponse.SalesData(quarter, sales.getSalesAtTown(), rankAtCity, salesAvgOfCity, rankAtDistrict, populationAvgOfDistrict));
64+
salesDataList.add(new SalesTransitionResponse.SalesData(sales.getTownName().split(" ")[1] ,quarter, sales.getSalesAtTown(), rankAtCity, salesAvgOfCity, rankAtDistrict, populationAvgOfDistrict));
6565
}
6666

6767
return SalesTransitionResponse.from(salesDataList);
@@ -73,7 +73,7 @@ public SalesTransitionByIndustryResponse getSalesTransitionByIndustry(String tow
7373

7474
List<SalesTransitionByIndustryResponse.SalesData> salesDataList = new ArrayList<>();
7575

76-
long[] quarterArr = new long[]{20241L, 20234L, 20233L, 20232L, 20231L};
76+
long[] quarterArr = new long[]{20231L, 20232L, 20233L, 20234L ,20241L };
7777
for(long quarter : quarterArr){
7878

7979
List<SalesForTransitionData> listOfCity = salesForTransitionData.stream().filter
@@ -92,7 +92,7 @@ public SalesTransitionByIndustryResponse getSalesTransitionByIndustry(String tow
9292
int rankAtDistrict = listOfDistrict.indexOf(sales) + 1; // 20241분기 구 내 등수
9393
long populationAvgOfDistrict = (long) listOfDistrict.stream().mapToLong(s -> s.getSalesAtTown()).average().getAsDouble();
9494

95-
salesDataList.add(new SalesTransitionByIndustryResponse.SalesData(quarter, sales.getSalesAtTown(), rankAtCity, salesAvgOfCity, rankAtDistrict, populationAvgOfDistrict));
95+
salesDataList.add(new SalesTransitionByIndustryResponse.SalesData(sales.getTownName().split(" ")[1], industryName, quarter, sales.getSalesAtTown(), rankAtCity, salesAvgOfCity, rankAtDistrict, populationAvgOfDistrict));
9696
}
9797

9898
return SalesTransitionByIndustryResponse.from(salesDataList);

0 commit comments

Comments
 (0)