diff --git a/pom.xml b/pom.xml index d485cadb3..a0463dd70 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ 2.4.4 1.8.1 1.7.0.RELEASE - 1.2.0.RELEASE + 1.2.2.RELEASE 1.3.0.RELEASE 2.3.2 UTF-8 diff --git a/src/main/java/com/techlooper/config/CoreConfiguration.java b/src/main/java/com/techlooper/config/CoreConfiguration.java index 4ac4b190a..2cf4da62c 100644 --- a/src/main/java/com/techlooper/config/CoreConfiguration.java +++ b/src/main/java/com/techlooper/config/CoreConfiguration.java @@ -2,20 +2,13 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; -import com.google.api.client.util.DateTime; -import com.google.api.client.util.store.FileDataStoreFactory; import com.google.api.services.calendar.Calendar; import com.google.api.services.calendar.CalendarScopes; -import com.google.api.services.calendar.model.Event; -import com.google.api.services.calendar.model.EventAttendee; -import com.google.api.services.calendar.model.EventDateTime; import com.techlooper.converter.ListCSVStringConverter; import com.techlooper.converter.LocaleConverter; import com.techlooper.converter.ProfileNameConverter; @@ -56,15 +49,12 @@ import javax.mail.MessagingException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; -import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; import java.nio.file.Paths; import java.security.GeneralSecurityException; import java.util.*; -import java.util.stream.Collector; -import java.util.stream.Collectors; @Configuration @ComponentScan(basePackages = "com.techlooper") @@ -181,6 +171,10 @@ protected void configure() { mapping(VnwJobAlert.class, VnwJobAlertRequest.class) .fields("jobLocations", "locationId", FieldsMappingOptions.customConverter(ListCSVStringConverter.class)) .fields("minSalary", "netSalary"); + +// mapping(WebinarInfoDto.class, WebinarEntity.class) +// .fields("startDate", "startDate", FieldsMappingOptions.customConverter(DateTime2BasicOrdinalDateTimeConverter.class)) +// .fields("endDate", "endDate", FieldsMappingOptions.customConverter(DateTime2BasicOrdinalDateTimeConverter.class)); } }); return dozerBeanMapper; diff --git a/src/main/java/com/techlooper/config/web/sec/SwitchingAuthenticationProvider.java b/src/main/java/com/techlooper/config/web/sec/SwitchingAuthenticationProvider.java index aa71b1fe3..fab2d7832 100644 --- a/src/main/java/com/techlooper/config/web/sec/SwitchingAuthenticationProvider.java +++ b/src/main/java/com/techlooper/config/web/sec/SwitchingAuthenticationProvider.java @@ -12,33 +12,34 @@ public class SwitchingAuthenticationProvider implements AuthenticationProvider { - private static final Logger LOGGER = LoggerFactory.getLogger(SwitchingAuthenticationProvider.class); - - private Map providers; - - public Authentication authenticate(Authentication authentication) throws AuthenticationException { - try { - SocialProvider socialProvider = SocialProvider.valueOf(authentication.getCredentials().toString()); - if (socialProvider != null) { - AuthenticationProvider delegateTo = providers.get(socialProvider); - return delegateTo.authenticate(authentication); - } - } catch (Exception ex) { - LOGGER.error(ex.getMessage(), ex); - } - - return providers.get(SocialProvider.VIETNAMWORKS).authenticate(authentication); - } + private static final Logger LOGGER = LoggerFactory.getLogger(SwitchingAuthenticationProvider.class); - public boolean supports(Class authentication) { - return UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication); - } + private Map providers; - public Map getProviders() { - return providers; + public Authentication authenticate(Authentication authentication) throws AuthenticationException { + try { + SocialProvider socialProvider = SocialProvider.valueOf(authentication.getCredentials().toString()); + if (socialProvider != null) { + AuthenticationProvider delegateTo = providers.get(socialProvider); + return delegateTo.authenticate(authentication); + } } - - public void setProviders(Map providers) { - this.providers = providers; + catch (Exception ex) { + LOGGER.debug(ex.getMessage(), ex); } + + return providers.get(SocialProvider.VIETNAMWORKS).authenticate(authentication); + } + + public boolean supports(Class authentication) { + return UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication); + } + + public Map getProviders() { + return providers; + } + + public void setProviders(Map providers) { + this.providers = providers; + } } diff --git a/src/main/java/com/techlooper/controller/JobAlertController.java b/src/main/java/com/techlooper/controller/JobAlertController.java index ef7e2adbf..fae404612 100644 --- a/src/main/java/com/techlooper/controller/JobAlertController.java +++ b/src/main/java/com/techlooper/controller/JobAlertController.java @@ -4,6 +4,7 @@ import com.techlooper.entity.ScrapeJobEntity; import com.techlooper.model.JobAlertRegistration; import com.techlooper.service.JobAlertService; +import com.techlooper.service.impl.JobAlertServiceImpl; import com.techlooper.util.DateTimeUtils; import org.joda.time.DateTime; import org.joda.time.Days; @@ -19,6 +20,8 @@ import java.util.Date; import java.util.List; +import static com.techlooper.service.impl.JobAlertServiceImpl.*; + @Controller public class JobAlertController { @@ -67,8 +70,12 @@ public void sendJobAlertEmail() throws Exception { List scrapeJobEntities = jobAlertService.searchJob(jobAlertRegistrationEntity); if (!scrapeJobEntities.isEmpty()) { jobAlertService.sendEmail(numberOfJobs, jobAlertRegistrationEntity, scrapeJobEntities); + } else { + jobAlertService.updateSendEmailResultCode(jobAlertRegistrationEntity, JOB_ALERT_JOB_NOT_FOUND); } } + } else { + jobAlertService.updateSendEmailResultCode(jobAlertRegistrationEntity, JOB_ALERT_ALREADY_SENT_ON_TODAY); } } } diff --git a/src/main/java/com/techlooper/entity/JobAlertRegistrationEntity.java b/src/main/java/com/techlooper/entity/JobAlertRegistrationEntity.java index 86d32eb20..613a031ec 100644 --- a/src/main/java/com/techlooper/entity/JobAlertRegistrationEntity.java +++ b/src/main/java/com/techlooper/entity/JobAlertRegistrationEntity.java @@ -37,6 +37,9 @@ public class JobAlertRegistrationEntity { @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "dd/MM/yyyy HH:mm") private String lastEmailSentDateTime; + @Field(type = Integer) + private Integer lastEmailSentCode; + public Long getJobAlertRegistrationId() { return jobAlertRegistrationId; } @@ -108,4 +111,12 @@ public Integer getLocationId() { public void setLocationId(Integer locationId) { this.locationId = locationId; } + + public Integer getLastEmailSentCode() { + return lastEmailSentCode; + } + + public void setLastEmailSentCode(Integer lastEmailSentCode) { + this.lastEmailSentCode = lastEmailSentCode; + } } diff --git a/src/main/java/com/techlooper/entity/WebinarEntity.java b/src/main/java/com/techlooper/entity/WebinarEntity.java index 29891007b..088855747 100644 --- a/src/main/java/com/techlooper/entity/WebinarEntity.java +++ b/src/main/java/com/techlooper/entity/WebinarEntity.java @@ -3,6 +3,7 @@ import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.*; +import java.util.Collection; import java.util.Date; import java.util.Set; @@ -15,6 +16,7 @@ public class WebinarEntity { @Id private Long createdDateTime = new Date().getTime(); + @Field(type = FieldType.String) private String name; @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "dd/MM/yyyy hh:mm a") @@ -23,57 +25,27 @@ public class WebinarEntity { @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "dd/MM/yyyy hh:mm a") private String endDate; + @Field(type = FieldType.String) private String description; - private Set attendees; + @Field(type = FieldType.String) + private Collection attendees; - @Field(index = FieldIndex.not_analyzed) + @Field(type = FieldType.String, index = FieldIndex.not_analyzed) private String organiser; - @Field(index = FieldIndex.not_analyzed) + @Field(type = FieldType.String, index = FieldIndex.not_analyzed) private String where = "Google Hangout"; - @Field(index = FieldIndex.not_analyzed) + @Field(type = FieldType.String, index = FieldIndex.not_analyzed) private String calendarUrl; - - @Field(index = FieldIndex.not_analyzed) + @Field(type = FieldType.String, index = FieldIndex.not_analyzed) private String hangoutLink; + @Field(type = FieldType.String) private String whatEvent; - public String getWhatEvent() { - return whatEvent; - } - - public void setWhatEvent(String whatEvent) { - this.whatEvent = whatEvent; - } - - public String getWhere() { - return where; - } - - public void setWhere(String where) { - this.where = where; - } - - public String getHangoutLink() { - return hangoutLink; - } - - public void setHangoutLink(String hangoutLink) { - this.hangoutLink = hangoutLink; - } - - public String getCalendarUrl() { - return calendarUrl; - } - - public void setCalendarUrl(String calendarUrl) { - this.calendarUrl = calendarUrl; - } - public Long getCreatedDateTime() { return createdDateTime; } @@ -114,11 +86,11 @@ public void setDescription(String description) { this.description = description; } - public Set getAttendees() { + public Collection getAttendees() { return attendees; } - public void setAttendees(Set attendees) { + public void setAttendees(Collection attendees) { this.attendees = attendees; } @@ -129,4 +101,36 @@ public String getOrganiser() { public void setOrganiser(String organiser) { this.organiser = organiser; } + + public String getWhere() { + return where; + } + + public void setWhere(String where) { + this.where = where; + } + + public String getCalendarUrl() { + return calendarUrl; + } + + public void setCalendarUrl(String calendarUrl) { + this.calendarUrl = calendarUrl; + } + + public String getHangoutLink() { + return hangoutLink; + } + + public void setHangoutLink(String hangoutLink) { + this.hangoutLink = hangoutLink; + } + + public String getWhatEvent() { + return whatEvent; + } + + public void setWhatEvent(String whatEvent) { + this.whatEvent = whatEvent; + } } diff --git a/src/main/java/com/techlooper/model/JobResponse.java b/src/main/java/com/techlooper/model/JobResponse.java index 2e98ded1f..9b21019c0 100644 --- a/src/main/java/com/techlooper/model/JobResponse.java +++ b/src/main/java/com/techlooper/model/JobResponse.java @@ -1,5 +1,10 @@ package com.techlooper.model; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.techlooper.entity.CompanyBenefit; + +import java.util.List; + /** * Created by phuonghqh on 10/15/14. */ @@ -23,6 +28,16 @@ public class JobResponse { private String salary; + private Long salaryMin; + + private Long salaryMax; + + private Integer techlooperJobType = 0; + + private List benefits; + + private List skills; + public static class Builder { private JobResponse instance = new JobResponse(); @@ -72,6 +87,31 @@ public Builder withSalary(String salary) { return this; } + public Builder withSalaryMin(Long salaryMin) { + instance.salaryMin = salaryMin; + return this; + } + + public Builder withSalaryMax(Long salaryMax) { + instance.salaryMax = salaryMax; + return this; + } + + public Builder withTechlooperJobType(Integer techlooperJobType) { + instance.techlooperJobType = techlooperJobType; + return this; + } + + public Builder withBenefits(List benefits) { + instance.benefits = benefits; + return this; + } + + public Builder withSkills(List skills) { + instance.skills = skills; + return this; + } + public JobResponse build() { return instance; } @@ -163,4 +203,44 @@ public String getSalary() { public void setSalary(String salary) { this.salary = salary; } + + public Long getSalaryMin() { + return salaryMin; + } + + public void setSalaryMin(Long salaryMin) { + this.salaryMin = salaryMin; + } + + public Long getSalaryMax() { + return salaryMax; + } + + public void setSalaryMax(Long salaryMax) { + this.salaryMax = salaryMax; + } + + public Integer getTechlooperJobType() { + return techlooperJobType; + } + + public void setTechlooperJobType(Integer techlooperJobType) { + this.techlooperJobType = techlooperJobType; + } + + public List getBenefits() { + return benefits; + } + + public void setBenefits(List benefits) { + this.benefits = benefits; + } + + public List getSkills() { + return skills; + } + + public void setSkills(List skills) { + this.skills = skills; + } } diff --git a/src/main/java/com/techlooper/model/VNWJobSearchRequest.java b/src/main/java/com/techlooper/model/VNWJobSearchRequest.java index d7845d51d..3e41346dd 100644 --- a/src/main/java/com/techlooper/model/VNWJobSearchRequest.java +++ b/src/main/java/com/techlooper/model/VNWJobSearchRequest.java @@ -13,69 +13,91 @@ @JsonInclude(JsonInclude.Include.NON_EMPTY) public class VNWJobSearchRequest { - @JsonProperty(value = "job_title") - private String jobTitle; + @JsonProperty(value = "job_title") + private String jobTitle; - @JsonProperty(value = "job_location") - private String jobLocation; + @JsonProperty(value = "job_location") + private String jobLocation; - @JsonProperty(value = "job_category") - private String jobCategories; + @JsonProperty(value = "job_category") + private String jobCategories; - @JsonProperty(value = "job_level") - private List jobLevel; + @JsonProperty(value = "job_level") + private List jobLevel; - @JsonProperty(value = "page_number") - private String pageNumber; + @JsonProperty(value = "page_number") + private Integer pageNumber; - @JsonProperty(value = "job_salary") - private Integer jobSalary; + @JsonProperty(value = "job_salary") + private Integer jobSalary; - public String getJobTitle() { - return jobTitle; - } + @JsonProperty(value = "tl_type") + private Integer techlooperJobType; - public void setJobTitle(String jobTitle) { - this.jobTitle = jobTitle; - } + @JsonProperty(value = "page_size") + private Integer pageSize; - public String getJobLocation() { - return jobLocation; - } + public String getJobTitle() { + return jobTitle; + } - public void setJobLocation(String jobLocation) { - this.jobLocation = jobLocation; - } + public void setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + } - public String getJobCategories() { - return jobCategories; - } + public String getJobLocation() { + return jobLocation; + } - public void setJobCategories(String jobCategories) { - this.jobCategories = jobCategories; - } + public void setJobLocation(String jobLocation) { + this.jobLocation = jobLocation; + } - public List getJobLevel() { - return jobLevel; - } + public String getJobCategories() { + return jobCategories; + } - public void setJobLevel(List jobLevel) { - this.jobLevel = jobLevel; - } + public void setJobCategories(String jobCategories) { + this.jobCategories = jobCategories; + } - public String getPageNumber() { - return pageNumber; - } + public List getJobLevel() { + return jobLevel; + } - public void setPageNumber(String pageNumber) { - this.pageNumber = pageNumber; - } + public void setJobLevel(List jobLevel) { + this.jobLevel = jobLevel; + } - public Integer getJobSalary() { - return jobSalary; - } + public Integer getJobSalary() { + return jobSalary; + } - public void setJobSalary(Integer jobSalary) { - this.jobSalary = jobSalary; - } + public void setJobSalary(Integer jobSalary) { + this.jobSalary = jobSalary; + } + + public Integer getTechlooperJobType() { + return techlooperJobType; + } + + public void setTechlooperJobType(Integer techlooperJobType) { + this.techlooperJobType = techlooperJobType; + } + + public Integer getPageNumber() { + return pageNumber; + } + + public void setPageNumber(Integer pageNumber) { + this.pageNumber = pageNumber; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } } diff --git a/src/main/java/com/techlooper/model/VNWJobSearchResponseDataItem.java b/src/main/java/com/techlooper/model/VNWJobSearchResponseDataItem.java index bbd7f3b65..b03792626 100644 --- a/src/main/java/com/techlooper/model/VNWJobSearchResponseDataItem.java +++ b/src/main/java/com/techlooper/model/VNWJobSearchResponseDataItem.java @@ -3,6 +3,9 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.techlooper.entity.CompanyBenefit; + +import java.util.List; @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.ALWAYS) @@ -36,6 +39,18 @@ public class VNWJobSearchResponseDataItem { @JsonProperty(value = "job_video_url") private String videoUrl = ""; + @JsonProperty(value = "salary_min") + private Long salaryMin; + + @JsonProperty(value = "salary_max") + private Long salaryMax; + + @JsonProperty(value = "benefits") + private List benefits; + + @JsonProperty(value = "skills") + private List skills; + public String getUrl() { return url; } @@ -100,6 +115,38 @@ public void setLogoUrl(String logoUrl) { this.logoUrl = logoUrl; } + public Long getSalaryMin() { + return salaryMin; + } + + public void setSalaryMin(Long salaryMin) { + this.salaryMin = salaryMin; + } + + public Long getSalaryMax() { + return salaryMax; + } + + public void setSalaryMax(Long salaryMax) { + this.salaryMax = salaryMax; + } + + public List getBenefits() { + return benefits; + } + + public void setBenefits(List benefits) { + this.benefits = benefits; + } + + public List getSkills() { + return skills; + } + + public void setSkills(List skills) { + this.skills = skills; + } + public JobResponse toJobResponse() { final JobResponse.Builder builder = new JobResponse.Builder(); return builder.withCompany(getCompany()) diff --git a/src/main/java/com/techlooper/repository/elasticsearch/WebinarRepository.java b/src/main/java/com/techlooper/repository/userimport/WebinarRepository.java similarity index 88% rename from src/main/java/com/techlooper/repository/elasticsearch/WebinarRepository.java rename to src/main/java/com/techlooper/repository/userimport/WebinarRepository.java index 3b9e583df..d0f931194 100644 --- a/src/main/java/com/techlooper/repository/elasticsearch/WebinarRepository.java +++ b/src/main/java/com/techlooper/repository/userimport/WebinarRepository.java @@ -1,4 +1,4 @@ -package com.techlooper.repository.elasticsearch; +package com.techlooper.repository.userimport; import com.techlooper.entity.SalaryReviewEntity; import com.techlooper.entity.WebinarEntity; diff --git a/src/main/java/com/techlooper/service/GoogleCalendarService.java b/src/main/java/com/techlooper/service/GoogleCalendarService.java index f056439bd..977503a36 100644 --- a/src/main/java/com/techlooper/service/GoogleCalendarService.java +++ b/src/main/java/com/techlooper/service/GoogleCalendarService.java @@ -3,6 +3,7 @@ import com.techlooper.dto.WebinarInfoDto; import java.io.IOException; +import java.util.Collection; /** * Created by phuonghqh on 8/17/15. @@ -11,4 +12,6 @@ public interface GoogleCalendarService { WebinarInfoDto createWebinarInfo(WebinarInfoDto webinarInfoDto, String organiser) throws IOException; + Collection findAvailableWebinars(); + } diff --git a/src/main/java/com/techlooper/service/JobAlertService.java b/src/main/java/com/techlooper/service/JobAlertService.java index 6af13e658..54a92b097 100644 --- a/src/main/java/com/techlooper/service/JobAlertService.java +++ b/src/main/java/com/techlooper/service/JobAlertService.java @@ -27,4 +27,6 @@ public interface JobAlertService { boolean checkIfUserExceedRegistrationLimit(String email); + void updateSendEmailResultCode(JobAlertRegistrationEntity jobAlertRegistrationEntity, Integer code); + } diff --git a/src/main/java/com/techlooper/service/impl/GoogleCalendarServiceImpl.java b/src/main/java/com/techlooper/service/impl/GoogleCalendarServiceImpl.java index 286189468..8dfa69a99 100644 --- a/src/main/java/com/techlooper/service/impl/GoogleCalendarServiceImpl.java +++ b/src/main/java/com/techlooper/service/impl/GoogleCalendarServiceImpl.java @@ -8,18 +8,22 @@ import com.techlooper.dto.WebinarInfoDto; import com.techlooper.entity.WebinarEntity; import com.techlooper.entity.vnw.VnwUser; -import com.techlooper.repository.couchbase.UserRepository; -import com.techlooper.repository.elasticsearch.WebinarRepository; +import com.techlooper.repository.userimport.WebinarRepository; import com.techlooper.repository.vnw.VnwUserRepo; import com.techlooper.service.GoogleCalendarService; import org.dozer.Mapper; +import org.elasticsearch.search.aggregations.AggregationBuilders; +import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramBuilder; +import org.elasticsearch.search.facet.datehistogram.DateHistogramFacetBuilder; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; +import org.springframework.integration.annotation.Aggregator; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.IOException; import java.util.Arrays; +import java.util.Collection; /** * Created by phuonghqh on 8/18/15. @@ -73,4 +77,10 @@ public WebinarInfoDto createWebinarInfo(WebinarInfoDto webinarInfoDto, String or entity = webinarRepository.save(entity); return dozerMapper.map(entity, WebinarInfoDto.class); } + + public Collection findAvailableWebinars() { + AggregationBuilders.dateHistogram("availableWebinars").field("startDate").format(""); + + return null; + } } diff --git a/src/main/java/com/techlooper/service/impl/JobAlertServiceImpl.java b/src/main/java/com/techlooper/service/impl/JobAlertServiceImpl.java index 7670b4222..a563a2332 100644 --- a/src/main/java/com/techlooper/service/impl/JobAlertServiceImpl.java +++ b/src/main/java/com/techlooper/service/impl/JobAlertServiceImpl.java @@ -2,13 +2,11 @@ import com.techlooper.entity.JobAlertRegistrationEntity; import com.techlooper.entity.ScrapeJobEntity; -import com.techlooper.model.JobAlertRegistration; -import com.techlooper.model.JobListingCriteria; -import com.techlooper.model.JobResponse; -import com.techlooper.model.Language; +import com.techlooper.model.*; import com.techlooper.repository.userimport.JobAlertRegistrationRepository; import com.techlooper.repository.userimport.ScrapeJobRepository; import com.techlooper.service.JobAlertService; +import com.techlooper.service.JobSearchService; import freemarker.template.Template; import org.apache.commons.lang3.StringUtils; import org.dozer.Mapper; @@ -47,12 +45,21 @@ public class JobAlertServiceImpl implements JobAlertService { private static final long CONFIGURED_JOB_ALERT_LIMIT_REGISTRATION = 5; + public final static int JOB_ALERT_SENT_OK = 200; + + public final static int JOB_ALERT_JOB_NOT_FOUND = 400; + + public final static int JOB_ALERT_ALREADY_SENT_ON_TODAY = 301; + @Value("${jobAlert.period}") private int CONFIGURED_JOB_ALERT_PERIOD; @Value("${jobAlert.launchDate}") private String CONFIGURED_JOB_ALERT_LAUNCH_DATE; + @Value("${vnw.api.configuration.category.it.software.en}") + private String JOB_CATEGORY_IT_SOFTWARE; + @Resource private ScrapeJobRepository scrapeJobRepository; @@ -83,6 +90,9 @@ public class JobAlertServiceImpl implements JobAlertService { @Resource private JavaMailSender mailSender; + @Resource + private JobSearchService vietnamWorksJobSearchService; + @Override public List searchJob(JobAlertRegistrationEntity jobAlertRegistrationEntity) { NativeSearchQueryBuilder searchQueryBuilder = getJobAlertSearchQueryBuilder(jobAlertRegistrationEntity); @@ -158,15 +168,22 @@ public void sendEmail(Long numberOfJobs, JobAlertRegistrationEntity jobAlertRegi jobAlertRegistrationEntity.setLastEmailSentDateTime(parseDate2String(new Date(), "dd/MM/yyyy HH:mm")); + jobAlertRegistrationEntity.setLastEmailSentCode(JOB_ALERT_SENT_OK); jobAlertRegistrationRepository.save(jobAlertRegistrationEntity); } @Override public List listJob(JobListingCriteria criteria) { + List result = new ArrayList<>(); + VNWJobSearchRequest vnwJobSearchRequest = getTopPriorityJobSearchRequest(criteria); + VNWJobSearchResponse vnwJobSearchResponse = vietnamWorksJobSearchService.searchJob(vnwJobSearchRequest); + if (vnwJobSearchResponse.hasData()) { + Set vnwJobs = vnwJobSearchResponse.getData().getJobs(); + result.addAll(aggregateJobs(vnwJobs)); + } + NativeSearchQueryBuilder searchQueryBuilder = getJobListingQueryBuilder(criteria); List jobs = scrapeJobRepository.search(searchQueryBuilder.build()).getContent(); - - List result = new ArrayList<>(); if (!jobs.isEmpty()) { for (ScrapeJobEntity jobEntity : jobs) { JobResponse.Builder builder = new JobResponse.Builder(); @@ -182,6 +199,33 @@ public List listJob(JobListingCriteria criteria) { return result; } + private List aggregateJobs(Set vnwJobs) { + List result = new ArrayList<>(); + for(VNWJobSearchResponseDataItem job : vnwJobs) { + JobResponse.Builder builder = new JobResponse.Builder(); + if (job.getSalaryMax() != null && job.getSalaryMax() > 0) { + JobResponse jobResponse = builder.withTitle(job.getTitle()).withUrl(job.getUrl()).withLocation(job.getLocation()) + .withCompany(job.getCompany()).withLevel(job.getLevel()).withLogoUrl(job.getLogoUrl()) + .withPostedOn(job.getPostedOn()).withSalaryMin(job.getSalaryMin()).withSalaryMax(job.getSalaryMax()) + .withTechlooperJobType(1).withSkills(job.getSkills()).withBenefits(job.getBenefits()) + .build(); + result.add(jobResponse); + } + } + return result; + } + + private VNWJobSearchRequest getTopPriorityJobSearchRequest(JobListingCriteria criteria) { + VNWJobSearchRequest vnwJobSearchRequest = new VNWJobSearchRequest(); + vnwJobSearchRequest.setJobTitle(criteria.getKeyword()); + vnwJobSearchRequest.setJobLocation(criteria.getLocation()); + vnwJobSearchRequest.setJobCategories(JOB_CATEGORY_IT_SOFTWARE); + vnwJobSearchRequest.setTechlooperJobType(1); + vnwJobSearchRequest.setPageNumber(1); + vnwJobSearchRequest.setPageSize(20); + return vnwJobSearchRequest; + } + @Override public Long countJob(JobListingCriteria criteria) { NativeSearchQueryBuilder searchQueryBuilder = getJobListingQueryBuilder(criteria); @@ -249,6 +293,14 @@ public boolean checkIfUserExceedRegistrationLimit(String email) { return numberOfRegistrations >= CONFIGURED_JOB_ALERT_LIMIT_REGISTRATION; } + @Override + public void updateSendEmailResultCode(JobAlertRegistrationEntity jobAlertRegistrationEntity, Integer code) { + if (jobAlertRegistrationEntity != null) { + jobAlertRegistrationEntity.setLastEmailSentCode(code); + jobAlertRegistrationRepository.save(jobAlertRegistrationEntity); + } + } + private NativeSearchQueryBuilder getJobAlertSearchQueryBuilder(JobAlertRegistrationEntity jobAlertRegistrationEntity) { NativeSearchQueryBuilder searchQueryBuilder = new NativeSearchQueryBuilder().withTypes("job"); BoolQueryBuilder queryBuilder = boolQuery(); diff --git a/src/main/resources/template/jobAlert.en.ftl b/src/main/resources/template/jobAlert.en.ftl index 779c4e9c9..b5ef4c93c 100644 --- a/src/main/resources/template/jobAlert.en.ftl +++ b/src/main/resources/template/jobAlert.en.ftl @@ -158,6 +158,17 @@ + + + + Job Search Innovation Hackathon + + + + + + + Hey ${email}, @@ -179,115 +190,115 @@ <#list jobs as job> - - - - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- ${job.jobTitle} -
- -
- <#if job.company??>${job.company} -
- -
- Location: <#if job.location??>${job.location} -
- -
- Salary: <#if job.salary?has_content>${job.salary}<#else>Negotiable -
- - - - - - - + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ${job.jobTitle} +
+ +
+ <#if job.company??>${job.company} +
+ +
+ Location: <#if job.location??>${job.location} +
+ +
+ Salary: <#if job.salary?has_content>${job.salary}<#else>Negotiable +
+ + + + + + + - - - - - - - - - - -
- View More -
- - - - - -
- - - -
-

FOLLOW US

+
- - LinkedIn - + + + + + +
+ View More +
- - -
+ +
+ + + + + + + +
+

FOLLOW US

+
+ + LinkedIn + +
+ + + + + +
- - - diff --git a/src/main/resources/template/jobAlert.vi.ftl b/src/main/resources/template/jobAlert.vi.ftl index b5b80f324..6639e9c3b 100644 --- a/src/main/resources/template/jobAlert.vi.ftl +++ b/src/main/resources/template/jobAlert.vi.ftl @@ -158,6 +158,17 @@ + + + + Job Search Innovation Hackathon + + + + + + + Xin chào ${email}, diff --git a/src/main/webapp/assets/images/hackathon-job-search.png b/src/main/webapp/assets/images/hackathon-job-search.png new file mode 100644 index 000000000..eba1916fc Binary files /dev/null and b/src/main/webapp/assets/images/hackathon-job-search.png differ diff --git a/src/main/webapp/assets/images/ic-general.png b/src/main/webapp/assets/images/ic-general.png new file mode 100644 index 000000000..dd2f3a884 Binary files /dev/null and b/src/main/webapp/assets/images/ic-general.png differ diff --git a/src/main/webapp/assets/modules/common/json.val.js b/src/main/webapp/assets/modules/common/json.val.js index 93dddb5f8..9d3259603 100644 --- a/src/main/webapp/assets/modules/common/json.val.js +++ b/src/main/webapp/assets/modules/common/json.val.js @@ -229,6 +229,16 @@ techlooper.factory("jsonValue", function () { name: "rootPage", url: "/" }, + { + name: "home", + url: "/home", + ignoreIfLastFoot: true + }, + { + name: "employerDashboard", + url: "/employer-dashboard", + ignoreIfLastFoot: true + }, { name: "postEvent", url: "/post-event", @@ -926,6 +936,23 @@ techlooper.factory("jsonValue", function () { {id: 12, name: "19 years"}, {id: 12, name: "> 20 years"} ], + "benefitIcons": [ + {id: '1',iconClass: 'fa-dollar'}, + {id: '2', iconClass: 'fa-user-md'}, + {id: '3', iconClass: 'fa-file-image-o'}, + {id: '4', iconClass: 'fa-graduation-cap'}, + {id: '5', iconClass: 'fa-trophy'}, + {id: '6', iconClass: 'fa-book'}, + {id: '7', iconClass: 'fa-laptop'}, + {id: '8', iconClass: 'fa-mobile'}, + {id: '9', iconClass: 'fa-plane'}, + {id: '10', iconClass: 'fa-glass'}, + {id: '11', iconClass: 'fa-cab'}, + {id: '12', iconClass: 'fa-coffee'}, + {id: '13', iconClass: 'fa-gift'}, + {id: '14', iconClass: 'fa-child'}, + {id: '15', iconClass: 'fa-check-square-o'} + ], "companyPromotion": { "title": "companyTitle", "tagLine": "companyMessages", @@ -971,5 +998,8 @@ techlooper.factory("jsonValue", function () { var currentYear = new Date().getFullYear();//yrs old from 15 to 99 instance.yobs = Array.apply(0, Array(84)).map(function (x, y) { return {value: currentYear - (y + 15)}; }); + instance.benefitIconsMap = {}; + $.each(instance.benefitIcons, function (i, icon) {instance.benefitIconsMap[icon.id] = icon;}); + return instance; }); \ No newline at end of file diff --git a/src/main/webapp/assets/modules/common/listInput.html b/src/main/webapp/assets/modules/common/listInput.html index 630a2e4ef..44eaeb29e 100644 --- a/src/main/webapp/assets/modules/common/listInput.html +++ b/src/main/webapp/assets/modules/common/listInput.html @@ -4,7 +4,7 @@ + name="inputItem" ng-required="true" />