Esempio n. 1
0
 private void updateZoneRate(Location location, boolean isLike, boolean isModifyPreRecord)
     throws IOException {
   String zipCode =
       geoCodingHelper
           .getZipCode(location.getLatitude().doubleValue(), location.getLongitude().doubleValue())
           .getZip_code();
   zoneRateHandler.updateRateByCoordiate(
       location.getLatitude(), location.getLongitude(), isLike, isModifyPreRecord);
   zoneRateHandler.updateRateByZip(zipCode, isLike, isModifyPreRecord);
 }
Esempio n. 2
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");
 }