@Bean public Map<Long, String> locationMap() { Map<Long, String> locations = new HashMap<>(); locations.put(29L, "Ho Chi Minh"); locations.put(24L, "Ha Noi"); return locations; }
@Scheduled(cron = "${scheduled.cron}") public void countTechnicalJobs() { jsonConfigRepository .getSkillConfig() .stream() .forEach( term -> { Map<String, Double> avgSalary = vietnamWorksJobStatisticService.getAverageSalaryBySkill(term, JOB_LEVEL_ALL); messagingTemplate.convertAndSend( "/topic/jobs/term/" + term.getKey(), new TechnicalTermResponse.Builder() .withTerm(term.getKey()) .withLabel(term.getLabel()) .withAverageSalaryMin(avgSalary.get("SALARY_MIN")) .withAverageSalaryMax(avgSalary.get("SALARY_MAX")) .withCount(vietnamWorksJobStatisticService.count(term)) .build()); }); }
@SendTo("/topic/jobs/terms") @MessageMapping("/jobs/terms") public List<TechnicalTermResponse> countTechnicalTerms() { List<TechnicalTermResponse> terms = new LinkedList<>(); jsonConfigRepository .getSkillConfig() .stream() .forEach( term -> { Map<String, Double> avgSalary = vietnamWorksJobStatisticService.getAverageSalaryBySkill(term, JOB_LEVEL_ALL); terms.add( new TechnicalTermResponse.Builder() .withTerm(term.getKey()) .withLabel(term.getLabel()) .withCount(vietnamWorksJobStatisticService.count(term)) .withAverageSalaryMin(avgSalary.get("SALARY_MIN")) .withAverageSalaryMax(avgSalary.get("SALARY_MAX")) .build()); }); return terms; }