Skip to content

Commit

Permalink
Merge pull request KCS-final#99 from KCS-final/fix/bid-schedule-getIt…
Browse files Browse the repository at this point in the history
…em-98

🐛스케줄링 작업 중 물품 정보를 받아오지 못하는 문제 해결
  • Loading branch information
hahyeon-cho authored Jun 7, 2024
2 parents 31629ef + 908ba70 commit e9909f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public interface AuctionProgressItemRepository extends JpaRepository<AuctionProg
"WHERE api.auctionProgressItemId = :auctionProgressItemId")
Optional<AuctionBidHighestDto> findHighestBidByAuctionProgressItemId(@Param("auctionProgressItemId") Long auctionProgressItemId);

@Query("SELECT api FROM AuctionProgressItem api JOIN FETCH api.item WHERE api.bidFinishTime < :now")
Optional<List<AuctionProgressItem>> findAllByBidFinishTimeBefore(LocalDateTime now);
}

Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,24 @@ public void finishAuctionsByTime() {
}//end transferCompletedAuctions()

@Transactional
protected void transferItemToComplete(AuctionProgressItem item) {
protected void transferItemToComplete(AuctionProgressItem auctionProgressItem) {

try {
boolean isComplete = checkBidCompletionStatus(item);
AuctionCompleteItem completeItem = buildAuctionCompleteItem(item, isComplete);
boolean isComplete = checkBidCompletionStatus(auctionProgressItem);
AuctionCompleteItem completeItem = buildAuctionCompleteItem(auctionProgressItem, isComplete);

Item auctionItem = item.getItem();
Item auctionItem = auctionProgressItem.getItem();
auctionItem.endAuction();

saveAlarm(isComplete,completeItem);
itemRepository.save(auctionItem);
auctionCompleteItemRepo.save(completeItem);
auctionProgressItemRepo.delete(item);
auctionProgressItemRepo.delete(auctionProgressItem);
} catch (CommonException e) {
log.error("에러 발생 물품 {}: {}", item.getAuctionProgressItemId(), e.getMessage());
log.error("에러 발생 물품 {}: {}", auctionProgressItem.getAuctionProgressItemId(), e.getMessage());
throw e;
} catch (Exception e) {
log.error("에러 발생 물품 {}: {}", item.getAuctionProgressItemId(), e.getMessage());
log.error("에러 발생 물품 {}: {}", auctionProgressItem.getAuctionProgressItemId(), e.getMessage());
throw new CommonException(ErrorCode.INTERNAL_SERVER_ERROR);
}
}//end transferItemToComplete()
Expand Down

0 comments on commit e9909f4

Please sign in to comment.