-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
/*log.info("zzz1"); | ||
matchingScheduleVOs.stream().map(el -> { | ||
log.info("zzz2"); | ||
matchingScheduleVOs.stream().forEach(el -> { | ||
matchingScheduleRepository.findMatchingScheduleByMatchingIdAndUserIdAndMatchingDateAndMatchingTime(id, userId, el.matchingDate(), el.matchingTime()) |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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)); | ||
} |
There was a problem hiding this comment.
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));
}
There was a problem hiding this comment.
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));
}
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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");
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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) { // 요청자 업데이트 |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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());
}
}
매칭 스케줄 조정관련 수정, 공통조건 확인 추가