Skip to content

feature: 매칭 스케줄 조정관련 수정, 공통조건 확인 추가 #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 18, 2025

Conversation

okluckyok
Copy link
Collaborator

매칭 스케줄 조정관련 수정, 공통조건 확인 추가

@okluckyok okluckyok requested a review from f-lab-nolan April 23, 2025 12:58
@okluckyok okluckyok self-assigned this Apr 23, 2025
/*log.info("zzz1");
matchingScheduleVOs.stream().map(el -> {
log.info("zzz2");
matchingScheduleVOs.stream().forEach(el -> {
matchingScheduleRepository.findMatchingScheduleByMatchingIdAndUserIdAndMatchingDateAndMatchingTime(id, userId, el.matchingDate(), el.matchingTime())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

matchingScheduleRepository.findMatchingScheduleByMatchingIdAndUserIdAndMatchingDateAndMatchingTime(id, userId, el.matchingDate(), el.matchingTime())
.orElseGet(() -> {
log.info("zzzXXXX");
return matchingScheduleRepository.save(matchingScheduleMapper.INSTANCE.matchingScheduleVOToMatchingSchedule(el));
});


@Transactional
public void acceptMatchingSchedule(final Long id, final Long scheduleId) {
matchingScheduleRepository.findMatchingScheduleByIdAndScheduleIdAndScheduleStatus(id, scheduleId, MatchingType.REQUEST.getCode())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.scheduling(final Long id, final Long scheduleId, MatchingType.REQUEST, MatchingType.MATCHED)

.map(el -> {
el.setScheduleStatus(MatchingType.END.getCode());
return el;
}).orElseThrow(() -> new BusinessException(MessageCode.MATCHING_SCHEDULE_NOT_FOUND));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private void scheduling(final Long id, final Long scheduleId, MatchingType condType, MatchingType changeType, ) {
matchingScheduleRepository.findMatchingScheduleByIdAndScheduleIdAndScheduleStatus(id, scheduleId, type.getCode())
.map(el -> {
el.setScheduleStatus(changeType.getCode());
return el;
}).orElseThrow(() -> new BusinessException(MessageCode.MATCHING_SCHEDULE_NOT_FOUND));
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private void scheduling(final Long id, final Long scheduleId, String matchgCond) {
MatchingType cond;
MatchingType change;
if (matchgCond == "reject") {
cond = MatchingType.SAME
cond = MatchingType. END
}

matchingScheduleRepository.findMatchingScheduleByIdAndScheduleIdAndScheduleStatus(id, scheduleId, cond.getCode())
.map(el -> {
el.setScheduleStatus(change.getCode());
return el;
}).orElseThrow(() -> new BusinessException(MessageCode.MATCHING_SCHEDULE_NOT_FOUND));
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public void rejectScheduling(final Long id, final Long scheduleId, String matchgCond) {
// 추가되는 로직
this. scheduling(id, scheduleId, matchgCond)
}


@PutMapping(value = "/v1/matches/{id}/users/{userId}/reject-schedules/{scheduleId}")
public void rejectMatchSchedule(@PathVariable final Long id, @PathVariable("scheduleId") final Long scheduleId, @RequestHeader("Authorization") String authentication) {
matchingScheduleService.rejectMatchingSchedule(id, scheduleId);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    matchingScheduleService.schedule(id, scheduleId, "reject");

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Result vo = matchingScheduleService.rejectMatchingSchedule(id, scheduleId);
if vo.getCode() == 1{
memberService.reject(id, scheduleId); -> Ok
}else{
matchingScheduleService.request(id, scheduleId); -> X
}

@@ -28,12 +28,21 @@ public class MatchingSchedule {
@Column(name = "user_id")
private Long userId;

@Column(name = "schedule_status")
private String scheduleStatus;
Copy link
Collaborator

@f-lab-nolan f-lab-nolan Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user_id, title
sss, 교육, O, X,X,O

user_id, mon1, mon2~~~
sss, O, X,X,O

user_id, tile
sss, 교육
user_id, mon
sss, jan
sss, may

List<MatchingSchedule> matchingScheduleList = matchingScheduleVOs.stream()
.map(el -> matchingScheduleRepository
.findMatchingScheduleByMatchingIdAndUserIdAndMatchingDateAndMatchingTime(id, userId, el.matchingDate(), el.matchingTime())
.orElseGet(() -> matchingScheduleRepository.save(matchingScheduleMapper.INSTANCE.matchingScheduleVOToMatchingSchedule(el))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if enum == str
else if enum == int
else
switch (enum)
case str:
break;
case int:
break;
...

matchingeRepository.save(matching);
} else {
}*/
if (matchingVO.requId() == userId) { // 요청자 업데이트
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (matchingVO.requId() == userId) { // 요청자 업데이트
this.updateMatchingInfRequ(matchingVO, userId);
return;
}
// 수신자 업데이트
this.updateMatchingInfRecv(matchingVO, userId, authentication);

return matching;
}

private void updateMatchingInfRequ(final MatchingVO matchingVO, final long userId) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private void updateMatchingInfRequ(final MatchingVO matchingVO, final long userId) {
match = matchingeRepository.findByIdAndRequId(matchingVO.id(), userId)
.orElseThrow(() -> new BusinessException(MessageCode.MATCHING_NOT_FOUND));
if (match.getStatusCd().equals("010")) {
//el.setMatchPlace(matchingVO.matchPlace());
} else if (match.getStatusCd().equals("020")) {
//el.setMatchPlace(matchingVO.matchTime());
}else{
//el.setRequStatusCd(matchingVO.requStatusCd());
}
}

@okluckyok okluckyok merged commit 3071f65 into main May 18, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants