Skip to content

Commit 4bc7a3e

Browse files
CLAP-256 팀 작업 현황 에러 재수정 (#364)
* CLAP-110 Feature : 담당자별 작업 처리량 조회 API 구현 <footer> - 관련: #73 * CLAP-111 Refactor : 통계 조회 API 리팩토링 및 기능 수정 <footer> - 관련: #74 * 내 작업한 내용에 대한 설명 * 담당자 조회 API 구현 * CLAP-111 Refactor : 통계 조회 API 주소 통합, 리팩토링, 예외처리 <footer> - 관련: #74 * Bug : 프로퍼티파일 수정 * CLAP-104 CI/CD : CI에서 s3.yml 파일 생성하도록 수정 * CLAP-146 Feature : 카테고리 목록 조회 API 구현 <footer> - 관련: #118 * CLAP-147 Feature : 카테고리 수정 API 구현 <footer> - 관련: #119 * CLAP-147 Feature : 카테고리 추가, 수정 API 리뷰반영 수정 <footer> - 관련: #119 * CLAP-148 Feature : 카테고리 삭제 API 구현 <footer> - 관련: #120 * CLAP-148 Feature : 카테고리 삭제 API 수정 <footer> - 관련: #120 * CLAP-148 Docs : 카테고리 API 스웨거 수정 <footer> - 관련: #120 * CLAP-107 Bug : CI test yml파일 key 중복 수정 <footer> - 관련: #60 * CLAP-148 Feature : 카테고리 CUD 리뷰 반영 수정, 조회 반환 양식 수정 <footer> - 관련: #120 * CLAP-214 Cleanup : 통계, 카테고리 미흡한부분 리팩토링 <footer> - 관련: #216 * CLAP-214 Fix : 통계조회 API 파라미터 바인딩 오류 수정 <footer> - 관련: #216 * CLAP-214 Fix : addConverter 수정 <footer> - 관련: #216 * CLAP-214 Hotfix : 추가한 파일들 제거 <footer> - 관련: #216 * CLAP-214 Hotfix : FindStatisticsController 스위치문 수정 <footer> - 관련: #216 * CLAP-214 Hotfix : AddCategoryService 지연로딩 오류 수정 <footer> - 관련: #216 * CLAP-214 Hotfix : DeleteCategoryService 카테고리 삭제 로직 수정 <footer> - 관련: #216 * CLAP-249 Refactor : 통계 조회 서비스 리팩토링 <footer> - 관련: #265 * CLAP-250 Test : 통계 조회 테스트코드 작성 <footer> - 관련: #266 * CLAP-214 Hotifx : 카테고리 수정 로직 수정 <footer> - 관련: #216 * CLAP-214 Hotifx : 카테고리 수정 로직 수정 <footer> - 관련: #216 * CLAP-256 fix: 스웨거 명세 추가 * CLAP-214 Hotifx : 카테고리 저장 트랜잭션 추가 <footer> - 관련: #216 * CLAP-214 Hotifx : 카테고리 저장 시간 수정 <footer> - 관련: #216 * CLAP-285 Hotifx : 모든 카테고리 조회 <footer> - 관련: #331 * CLAP-214 Hotifx : 카테고리 조회 Secured 설정 <footer> - 관련: #216 * CLAP-256 fix: convert 동작 mapper 추가 * CLAP-256 fix: 충돌해결 * CLAP-256 fix: 불필요한 테스트 파일 제거 * CLAP-256 fix: mapper statuslabel 수정 * CLAP-256 Fix : 팀 작업 현황 필터링 조회 수정 <footer> - 관련: #281 * CLAP-299 Feature : 사용자 작업 취소 <footer> - 관련: #352 * CLAP-299 Fix: 사용자 작업 취소 api 주소 수정 <footer> - 관련: #352 * CLAP-256 전체 작업수 계산 로직 개선 * fix: env 파일 제거 * fix: 어노테이션 수정 * fix: @RestController 제거 * fix: @ApplicationService로 수정 * CLAP-256 Fix : TeamStatusService 누락된 import 수정 <footer> - 관련: #281 * CLAP-256 Fix : TeamStatusService Secured 추가 <footer> - 관련: #281 * fix: 팀 작업 현황 필터링 조회 수정 및 정렬 기능 개선 * Delete src/main/resources/env.properties * Delete src/test/resources/application.yml * 충돌 해결: develop 브랜치와 병합 * Update application.yml * Revert application.yml files to match develop branch * CLAP-256 fix: Update application.yml * CLAP-256 fix: Update application.yml * CLAP-256 Fix : 팀 현황 필터조회 기여도순 정렬 수정 <footer> - 관련: #281 --------- Co-authored-by: hyoseong-Choi <gytjd9516@naver.com> Co-authored-by: Choi hyoseong <105284587+hyoseong-Choi@users.noreply.github.com>
1 parent 21fc5a7 commit 4bc7a3e

File tree

5 files changed

+45
-16
lines changed

5 files changed

+45
-16
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package clap.server.adapter.inbound.web.dto.task.request;
22

33
import io.swagger.v3.oas.annotations.media.Schema;
4-
import jakarta.validation.constraints.NotNull;
54

65
import java.util.List;
76

87
public record FilterTeamStatusRequest(
98
@Schema(description = "정렬 기준 (기여도순, 기본)", example = "기여도순")
10-
String sortBy,
9+
SortBy sortBy, // Enum 타입으로 수정
1110

1211
@Schema(description = "1차 카테고리 ID 목록", example = "[10, 20, 30]")
1312
List<Long> mainCategoryIds,
@@ -19,10 +18,11 @@ public record FilterTeamStatusRequest(
1918
String taskTitle
2019
) {
2120
public FilterTeamStatusRequest {
22-
sortBy = (sortBy == null || sortBy.isEmpty()) ? "기본" : sortBy;
21+
// 기본값 설정
22+
sortBy = (sortBy == null) ? SortBy.DEFAULT : sortBy; // 기본값을 DEFAULT로 설정
2323
mainCategoryIds = mainCategoryIds == null ? List.of() : mainCategoryIds;
2424
categoryIds = categoryIds == null ? List.of() : categoryIds;
2525
taskTitle = taskTitle == null ? "" : taskTitle;
2626
}
27-
2827
}
28+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package clap.server.adapter.inbound.web.dto.task.request;
2+
3+
public enum SortBy {
4+
DEFAULT("기본순"),
5+
CONTRIBUTE("기여도순");
6+
7+
private final String value;
8+
9+
SortBy(String value) {
10+
this.value = value;
11+
}
12+
13+
public String getValue() {
14+
return value;
15+
}
16+
}
17+

src/main/java/clap/server/adapter/outbound/persistense/repository/task/TaskCustomRepositoryImpl.java

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
import clap.server.adapter.inbound.web.dto.task.request.FilterTaskBoardRequest;
44
import clap.server.adapter.inbound.web.dto.task.request.FilterTaskListRequest;
55
import clap.server.adapter.inbound.web.dto.task.request.FilterTeamStatusRequest;
6-
import clap.server.adapter.inbound.web.dto.task.response.TeamTaskResponse;
6+
import clap.server.adapter.inbound.web.dto.task.request.SortBy;
77
import clap.server.adapter.inbound.web.dto.task.response.TeamTaskItemResponse;
8+
import clap.server.adapter.inbound.web.dto.task.response.TeamTaskResponse;
89
import clap.server.adapter.outbound.persistense.entity.task.TaskEntity;
910
import clap.server.adapter.outbound.persistense.entity.task.constant.TaskStatus;
1011
import com.querydsl.core.BooleanBuilder;
@@ -19,9 +20,9 @@
1920
import org.springframework.stereotype.Repository;
2021

2122
import java.time.LocalDateTime;
23+
import java.util.LinkedHashMap;
2224
import java.util.List;
2325
import java.util.stream.Collectors;
24-
import java.util.Optional;
2526

2627
import static clap.server.adapter.outbound.persistense.entity.task.QTaskEntity.taskEntity;
2728
import static com.querydsl.core.types.Order.ASC;
@@ -87,14 +88,22 @@ public List<TeamTaskResponse> findTeamStatus(Long memberId, FilterTeamStatusRequ
8788
}
8889

8990
// 정렬 조건 적용
90-
OrderSpecifier<?> orderBy = "기여도순".equals(filter != null ? filter.sortBy() : "")
91-
? new CaseBuilder()
92-
.when(taskEntity.taskStatus.eq(TaskStatus.IN_PROGRESS)
93-
.or(taskEntity.taskStatus.eq(TaskStatus.IN_REVIEWING)))
94-
.then(1)
95-
.otherwise(0)
96-
.desc()
97-
: taskEntity.processor.nickname.asc();
91+
SortBy sortBy = (filter != null && filter.sortBy() != null) ? filter.sortBy() : SortBy.DEFAULT;
92+
93+
assert filter != null;
94+
OrderSpecifier<?> orderBy;
95+
if (sortBy == SortBy.CONTRIBUTE) {
96+
// 기여도순 (진행 중 + 검토 중 작업 개수 합 기준 내림차순)
97+
orderBy = new CaseBuilder()
98+
.when(taskEntity.taskStatus.eq(TaskStatus.IN_PROGRESS)
99+
.or(taskEntity.taskStatus.eq(TaskStatus.IN_REVIEWING)))
100+
.then(1)
101+
.otherwise(0)
102+
.desc();
103+
} else {
104+
// 기본순 (닉네임 오름차순)
105+
orderBy = taskEntity.processor.nickname.asc();
106+
}
98107

99108
// 쿼리 실행
100109
List<TaskEntity> taskEntities = queryFactory
@@ -109,7 +118,7 @@ public List<TeamTaskResponse> findTeamStatus(Long memberId, FilterTeamStatusRequ
109118
}
110119

111120
return taskEntities.stream()
112-
.collect(Collectors.groupingBy(t -> t.getProcessor().getMemberId()))
121+
.collect(Collectors.groupingBy(t -> t.getProcessor().getMemberId(), LinkedHashMap::new, Collectors.toList()))
113122
.entrySet().stream()
114123
.map(entry -> {
115124
List<TeamTaskItemResponse> taskResponses = entry.getValue().stream()

src/main/java/clap/server/application/service/task/TeamStatusService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
import java.util.List;
1313

14+
import static clap.server.adapter.inbound.web.dto.task.request.SortBy.CONTRIBUTE;
15+
1416
@ApplicationService
1517
public class TeamStatusService implements LoadTeamStatusUsecase, FilterTeamStatusUsecase {
1618

@@ -41,6 +43,7 @@ public TeamStatusResponse filterTeamStatus(FilterTeamStatusRequest filter) {
4143
// 전체 팀의 진행 중 & 검토 중 작업 수 계산
4244
int totalInProgressTaskCount = members.stream().mapToInt(TeamTaskResponse::inProgressTaskCount).sum();
4345
int totalInReviewingTaskCount = members.stream().mapToInt(TeamTaskResponse::inReviewingTaskCount).sum();
46+
if (filter.sortBy().equals(CONTRIBUTE)) members.sort((a, b) -> b.totalTaskCount() - a.totalTaskCount());
4447

4548
return new TeamStatusResponse(members, totalInProgressTaskCount, totalInReviewingTaskCount);
4649
}

src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ logging:
6060
spring.config.activate.on-profile: prod
6161
logging:
6262
level:
63-
root: INFO
63+
root: INFO

0 commit comments

Comments
 (0)