public UserTree(User user) { this.setUid(user.getUid()); this.setUsername(user.getUsername()); this.setPassword(user.getPassword()); this.setIsadmin(user.isIsadmin()); this.setEmployeename(user.getEmployeename()); this.setUsertype(user.getUsertype()); this.setUsertypename(user.getUsertypename()); this.setEmail(user.getEmail()); this.setComment(user.getComment()); this.setCreateby(user.getCreateby()); this.setCreatetime(user.getCreatetime()); this.setEditby(user.getEditby()); this.setEdittime(user.getEdittime()); this.setLastlogin(user.getLastlogin()); this.setSex(user.getSex()); this.setBirthday(user.getBirthday()); this.setIdcard(user.getIdcard()); this.setAddress(user.getAddress()); this.setMobile(user.getMobile()); this.setTelephone(user.getTelephone()); this.setEmergencycontact(user.getEmergencycontact()); this.setAvatarurl(user.getAvatarurl()); this.setPostuid(user.getPostuid()); this.setPostname(user.getPostname()); this.setParentuid(user.getParentuid()); }
@Override public void run() { System.out.println("notifications job running"); List<User> users = userService.queryUsers(Filters.eq("notifications", true)); for (User user : users) { String query = user.getNotificationQuery(); query = query + "&createdOn[$gt]=" + user.getLastNotificationAt(); List<Document> documents = adService.queryAds(query); if (!documents.isEmpty()) { List<BaseAd> adsList = adService.getListAs(BaseAd.class, documents); twilioService.sendSMS(user.getMobile(), "New ads for your query"); user.setLastNotificationAt(ZonedDateTime.now().toEpochSecond()); userService.updateUser(user); } } }