Example #1
0
 @Override
 public void like(Notification notification, Credential credential) throws IOException {
   LOG.info("Like operation");
   Location location = mirrorClient.getUserLocation(credential);
   if (location == null) {
     LOG.info("Location load failed");
     throw new IOException();
   }
   int isRateBefore =
       transService.isRateBefore(
           notification.getUserToken(), location.getLatitude(), location.getLongitude());
   if (isRateBefore == 0) {
     transService.upsertRateRecord(
         notification.getUserToken(), location.getLatitude(), location.getLongitude(), 1);
     updateZoneRate(location, true, false);
   } else if (isRateBefore == -1) {
     transService.upsertRateRecord(
         notification.getUserToken(), location.getLatitude(), location.getLongitude(), 1);
     updateZoneRate(location, true, true);
   } else {
     insertTimelineHandler.insertHasSameRateBefore(credential);
   }
   LOG.info("Like Successfully");
 }