Skip to content

Commit

Permalink
schedular & mail service test3
Browse files Browse the repository at this point in the history
  • Loading branch information
bongsh0112 committed Oct 2, 2023
1 parent 6fc7d01 commit b75d603
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public class StartAuctionScheduler {
@Scheduled(cron = "0 * * * * *", zone = DateStaticConstants.ZONE_SEOUL)
public void startApprovePictureToBiddingAuction() {
log.info("Start Todays Auctions Open Schedule Runtime : NowTime >>> {}", LocalDateTime.now());
// pictureService
// .changePictureStatusByPictureStatusAndBidStartDate(AFTER_APPROVE, BIDDING, LocalDate.now())
// .forEach(sendMailService::startBiddingMail);
pictureService
.changePictureStatusByPictureStatusAndBidStartDate(AFTER_APPROVE, BIDDING, LocalDate.now())
.forEach(sendMailService::startBiddingMail);
log.info("End Todays Auctions Open Schedule Runtime : NowTime >>> {}", LocalDateTime.now());
}

Expand All @@ -44,9 +44,9 @@ public void startApprovePictureToBiddingAuction() {
@Scheduled(cron = "0 0 9 * * *", zone = DateStaticConstants.ZONE_SEOUL)
public void startNotApprovePictureToRejectAuction() {
log.info("Start Reject Picture Schedule Runtime : NowTime >>> {}", LocalDateTime.now());
// pictureService
// .changePictureStatusByPictureStatusAndBidStartDate(BEFORE_APPROVE, BIDDING, LocalDate.now())
// .forEach(sendMailService::pictureRejectMailWithNotApproveAdmin);
pictureService
.changePictureStatusByPictureStatusAndBidStartDate(BEFORE_APPROVE, BIDDING, LocalDate.now())
.forEach(sendMailService::pictureRejectMailWithNotApproveAdmin);
log.info("End Todays Auctions Open Schedule Runtime : NowTime >>> {}", LocalDateTime.now());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class SendMailService {
* @param picture
*/
@Async
public void adminApproveMail(Picture picture) throws InterruptedException {
public void adminApproveMail(Picture picture) {
// sendMailUtil.sendMail(
// picture.getUser().getEmail(),
// REJECT.getMailTitle(),
Expand All @@ -55,7 +55,11 @@ public void adminApproveMail(Picture picture) throws InterruptedException {
// put("link", picassoProperties.getDomain() + "pictures/" + picture.getPictureId());
// }}
// );
Thread.sleep(500);
try {
Thread.sleep(500);
} catch (InterruptedException e) {

}
}

/**
Expand All @@ -64,7 +68,7 @@ public void adminApproveMail(Picture picture) throws InterruptedException {
* @param picture
*/
@Async
public void startBiddingMail(Picture picture) throws InterruptedException {
public void startBiddingMail(Picture picture) {
// sendMailUtil.sendMail(
// picture.getUser().getEmail(),
// BIDDING.getMailTitle(),
Expand All @@ -75,7 +79,11 @@ public void startBiddingMail(Picture picture) throws InterruptedException {
// put("link", picassoProperties.getDomain() + "pictures/" + picture.getPictureId());
// }}
// );
Thread.sleep(500);
try {
Thread.sleep(500);
} catch (InterruptedException e) {

}
}

/**
Expand All @@ -84,7 +92,7 @@ public void startBiddingMail(Picture picture) throws InterruptedException {
* @param picture
*/
@Async
public void pictureSuccessBidMail(Picture picture) throws InterruptedException {
public void pictureSuccessBidMail(Picture picture) {
// PictureBidHistory topHistory = pictureBidHistoryRepository.findTopByPictureOrderByBidAmountDesc(picture)
// .orElseThrow(() -> NotFoundException.EXCEPTION);
//
Expand All @@ -111,7 +119,11 @@ public void pictureSuccessBidMail(Picture picture) throws InterruptedException {
// put("link", picassoProperties.getDomain() + "pictures/" + picture.getPictureId());
// }}
// );
Thread.sleep(500);
try {
Thread.sleep(500);
} catch (InterruptedException e) {

}
}

/**
Expand All @@ -120,7 +132,7 @@ public void pictureSuccessBidMail(Picture picture) throws InterruptedException {
* @param picture
*/
@Async
public void pictureRejectMailWithNotApproveAdmin(Picture picture) throws InterruptedException {
public void pictureRejectMailWithNotApproveAdmin(Picture picture) {
// sendMailUtil.sendMail(
// picture.getUser().getEmail(),
// REJECT.getMailTitle(),
Expand All @@ -130,7 +142,11 @@ public void pictureRejectMailWithNotApproveAdmin(Picture picture) throws Interru
// put("link", picassoProperties.getDomain() + "pictures/" + picture.getPictureId());
// }}
// );
Thread.sleep(500);
try {
Thread.sleep(500);
} catch (InterruptedException e) {

}
}

/**
Expand All @@ -139,7 +155,7 @@ public void pictureRejectMailWithNotApproveAdmin(Picture picture) throws Interru
* @param picture
*/
@Async
public void pictureRejectMailWithFinishDate(Picture picture) throws InterruptedException {
public void pictureRejectMailWithFinishDate(Picture picture) {
// sendMailUtil.sendMail(
// picture.getUser().getEmail(),
// REJECT.getMailTitle(),
Expand All @@ -149,6 +165,10 @@ public void pictureRejectMailWithFinishDate(Picture picture) throws InterruptedE
// put("link", picassoProperties.getDomain() + "pictures/" + picture.getPictureId());
// }}
// );
Thread.sleep(500);
try {
Thread.sleep(500);
} catch (InterruptedException e) {

}
}
}

0 comments on commit b75d603

Please sign in to comment.