|
|
@@ -0,0 +1,205 @@
|
|
|
+package com.jpsoft.employment.modules.mobile.controller;
|
|
|
+
|
|
|
+import cn.hutool.core.util.IdcardUtil;
|
|
|
+import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
|
+import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
|
|
|
+import com.jpsoft.employment.modules.job.dto.ResumeDeliverHrDTO;
|
|
|
+import com.jpsoft.employment.modules.job.entity.*;
|
|
|
+import com.jpsoft.employment.modules.job.service.*;
|
|
|
+import com.jpsoft.employment.modules.sys.entity.DataDictionary;
|
|
|
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/mobile/userBrowseApi")
|
|
|
+@Api(tags = "移动端接口:招聘方[浏览记录]")
|
|
|
+@Slf4j
|
|
|
+public class UserBrowseHrApiController {
|
|
|
+ @Autowired
|
|
|
+ private UserBrowseHrService userBrowseHrService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private JobUserService jobUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeService rsumeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeWorkExperienceService resumeWorkExperienceService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WorkCategoryService workCategoryService;
|
|
|
+
|
|
|
+ @PostMapping("pageListHR")
|
|
|
+ @ApiOperation(value = "浏览记录")
|
|
|
+ public MessageResult<Map> pageListHR(
|
|
|
+ String token,String positionCategoryId,Integer age,String sex,
|
|
|
+ String workExp,String education,String createTimeRange,
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ HttpServletRequest request){
|
|
|
+ String subject = (String)request.getAttribute("subject");
|
|
|
+
|
|
|
+ //当前用户ID
|
|
|
+ System.out.println(subject);
|
|
|
+
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("a.create_time","desc"));
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(positionCategoryId)){
|
|
|
+ searchParams.put("positionCategoryId",positionCategoryId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(sex)){
|
|
|
+ if(!"100b3725-cb26-4d71-af3c-5b01c98f776b".equals(sex)) {
|
|
|
+ searchParams.put("sex", sex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(age!=null){
|
|
|
+ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+
|
|
|
+ cal.setTime(new Date());
|
|
|
+
|
|
|
+ cal.add(Calendar.YEAR,-age);
|
|
|
+
|
|
|
+ String curDate = sdf.format(cal.getTime());
|
|
|
+
|
|
|
+ searchParams.put("curDate",curDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(workExp)){
|
|
|
+ searchParams.put("workExp",workExp);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(education)){
|
|
|
+ searchParams.put("education",education);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(createTimeRange)) {
|
|
|
+ String[] timeRangeArray = createTimeRange.split(",");
|
|
|
+ String beginTime = "";
|
|
|
+ String endTime = "";
|
|
|
+ beginTime+=" 00:00:00";
|
|
|
+ if (timeRangeArray.length == 1) {
|
|
|
+ beginTime = timeRangeArray[0];
|
|
|
+ } else if (timeRangeArray.length == 2) {
|
|
|
+ beginTime = timeRangeArray[0];
|
|
|
+ endTime = timeRangeArray[1];
|
|
|
+ beginTime+=" 00:00:00";
|
|
|
+ endTime+=" 23:59:59";
|
|
|
+ }
|
|
|
+
|
|
|
+ searchParams.put("beginTime", beginTime);
|
|
|
+ searchParams.put("endTime", endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Page<UserBrowseHr> page = userBrowseHrService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+
|
|
|
+
|
|
|
+ Page<ResumeDeliverHrDTO> pageDto = new Page<>();
|
|
|
+
|
|
|
+ for (UserBrowseHr userBrowseHr:page) {
|
|
|
+
|
|
|
+ ResumeDeliverHrDTO dto = new ResumeDeliverHrDTO();
|
|
|
+
|
|
|
+ dto.setId(userBrowseHr.getId());
|
|
|
+ dto.setCreateTime(userBrowseHr.getCreateTime());
|
|
|
+
|
|
|
+ Resume resume = rsumeService.get(userBrowseHr.getJobResumeId());
|
|
|
+
|
|
|
+ String workExpName="";
|
|
|
+ String dreamMoneyName="";
|
|
|
+ String educationName="";
|
|
|
+ String positionName = "";
|
|
|
+
|
|
|
+
|
|
|
+ if(resume!=null){
|
|
|
+ DataDictionary dataDictionary = dataDictionaryService.get(resume.getWorkExp());
|
|
|
+
|
|
|
+ if(dataDictionary!=null){
|
|
|
+ workExpName = dataDictionary.getName();
|
|
|
+ }
|
|
|
+
|
|
|
+ DataDictionary dataDictionary1 = dataDictionaryService.get(resume.getDreamMoney());
|
|
|
+ if(dataDictionary1!=null){
|
|
|
+ dreamMoneyName = dataDictionary1.getName();
|
|
|
+ }
|
|
|
+
|
|
|
+ DataDictionary dataDictionary2 = dataDictionaryService.get(resume.getEducation());
|
|
|
+
|
|
|
+ if(dataDictionary2!=null){
|
|
|
+ educationName = dataDictionary2.getName();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<ResumeWorkExperience> resumeWorkExperienceList = resumeWorkExperienceService.findByResumeId(resume.getId());
|
|
|
+
|
|
|
+ dto.setResumeWorkExperienceList(resumeWorkExperienceList);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ JobUser jobUser = jobUserService.get(resume.getJobUserId());
|
|
|
+
|
|
|
+ if(jobUser!=null){
|
|
|
+ dto.setJobUserId(jobUser.getId());
|
|
|
+ dto.setHeadImageUrl(jobUser.getHeadImageUrl());
|
|
|
+ dto.setName(jobUser.getRealName());
|
|
|
+ dto.setSexN(jobUser.getSex());
|
|
|
+ dto.setUserTel(jobUser.getTel());
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(jobUser.getIdCard())){
|
|
|
+ int ageN = IdcardUtil.getAgeByIdCard(jobUser.getIdCard());
|
|
|
+ dto.setAge(ageN);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ WorkCategory workCategory = workCategoryService.get(resume.getPositionCategoryId());
|
|
|
+ if(workCategory!=null){
|
|
|
+ positionName = workCategory.getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ dto.setPositionName(positionName);
|
|
|
+ dto.setWorkExp(workExpName);
|
|
|
+ dto.setEducation(educationName);
|
|
|
+ dto.setDreamMoney(dreamMoneyName);
|
|
|
+
|
|
|
+
|
|
|
+ pageDto.add(dto);
|
|
|
+ }
|
|
|
+
|
|
|
+ pageDto.setPages(page.getPages());
|
|
|
+ pageDto.setTotal(page.getTotal());
|
|
|
+ pageDto.setPageNum(page.getPageNum());
|
|
|
+
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(pageDto));
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+}
|