|
@@ -1,9 +1,274 @@
|
|
package com.jpsoft.employment.modules.job.controller;
|
|
package com.jpsoft.employment.modules.job.controller;
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+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.TalentPoolDTO;
|
|
|
|
+import com.jpsoft.employment.modules.job.entity.JobUser;
|
|
|
|
+import com.jpsoft.employment.modules.job.entity.Resume;
|
|
|
|
+import com.jpsoft.employment.modules.job.entity.ResumeWorkExperience;
|
|
|
|
+import com.jpsoft.employment.modules.job.entity.WorkCategory;
|
|
|
|
+import com.jpsoft.employment.modules.job.service.JobUserService;
|
|
|
|
+import com.jpsoft.employment.modules.job.service.ResumeService;
|
|
|
|
+import com.jpsoft.employment.modules.job.service.ResumeWorkExperienceService;
|
|
|
|
+import com.jpsoft.employment.modules.job.service.WorkCategoryService;
|
|
|
|
+import com.jpsoft.employment.modules.sys.entity.DataDictionary;
|
|
|
|
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+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.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
-@RequestMapping("/job/jobser")
|
|
|
|
|
|
+@RequestMapping("/job/jobUser")
|
|
public class JobUserController {
|
|
public class JobUserController {
|
|
|
|
+
|
|
|
|
+ private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private JobUserService jobUserService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ResumeService resumeService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private WorkCategoryService workCategoryService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ResumeWorkExperienceService resumeWorkExperienceService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="列表")
|
|
|
|
+ @RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
|
+ public MessageResult<Map> pageList(
|
|
|
|
+ @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("create_time","desc"));
|
|
|
|
+
|
|
|
|
+ searchParams.put("not_jobStatus","1");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Page<JobUser> page = jobUserService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
+
|
|
|
|
+ Page<TalentPoolDTO> pageDto = new Page<>();
|
|
|
|
+
|
|
|
|
+ for (JobUser jobUser:page) {
|
|
|
|
+ TalentPoolDTO dto = new TalentPoolDTO();
|
|
|
|
+
|
|
|
|
+ dto.setId(jobUser.getId());
|
|
|
|
+
|
|
|
|
+ String realName = jobUser.getRealName();
|
|
|
|
+ if(StringUtils.isNotEmpty(realName)){
|
|
|
|
+ String familyName = realName.substring(0,1);
|
|
|
|
+ int num = realName.length();
|
|
|
|
+ if(num==2){
|
|
|
|
+ dto.setRealName(familyName+"*");
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ dto.setRealName(familyName+"**");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dto.setHeadImageUrl(jobUser.getHeadImageUrl());
|
|
|
|
+ dto.setSex(jobUser.getSex());
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isNotEmpty(jobUser.getIdCard())){
|
|
|
|
+ int age = IdcardUtil.getAgeByIdCard(jobUser.getIdCard());
|
|
|
|
+ dto.setAge(age);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Resume resume = resumeService.findByUserId(jobUser.getId());
|
|
|
|
+
|
|
|
|
+ String workExpName="";
|
|
|
|
+ String positionCategoryName="";
|
|
|
|
+ String dreamMoneyName="";
|
|
|
|
+ String dreamAdd="";
|
|
|
|
+ String introduction="";
|
|
|
|
+ String educationName="";
|
|
|
|
+
|
|
|
|
+ if(resume!=null){
|
|
|
|
+ DataDictionary dataDictionary = dataDictionaryService.get(resume.getWorkExp());
|
|
|
|
+
|
|
|
|
+ if(dataDictionary!=null){
|
|
|
|
+ workExpName = dataDictionary.getName();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ WorkCategory workCategory = workCategoryService.get(resume.getPositionCategoryId());
|
|
|
|
+ if(workCategory!=null){
|
|
|
|
+ positionCategoryName = workCategory.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();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ dreamAdd = resume.getDreamAdd();
|
|
|
|
+ introduction = resume.getIntroduction();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dto.setWorkExpName(workExpName);
|
|
|
|
+ dto.setEducationName(educationName);
|
|
|
|
+ dto.setPositionCategoryName(positionCategoryName);
|
|
|
|
+ dto.setDreamMoneyName(dreamMoneyName);
|
|
|
|
+ dto.setJobStatus(jobUser.getJobStatus());
|
|
|
|
+ dto.setDreamAdd(dreamAdd);
|
|
|
|
+ dto.setIntroduction(introduction);
|
|
|
|
+
|
|
|
|
+ pageDto.add(dto);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ pageDto.setPageSize(page.getPageSize());
|
|
|
|
+ pageDto.setTotal(page.getTotal());
|
|
|
|
+ pageDto.setPageNum(page.getPageNum());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(pageDto));
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="获取信息")
|
|
|
|
+ @GetMapping("edit/{id}")
|
|
|
|
+ public MessageResult<TalentPoolDTO> edit(@PathVariable("id") String id){
|
|
|
|
+ MessageResult<TalentPoolDTO> msgResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ JobUser jobUser = jobUserService.get(id);
|
|
|
|
+
|
|
|
|
+ if (jobUser != null) {
|
|
|
|
+ TalentPoolDTO dto = new TalentPoolDTO();
|
|
|
|
+
|
|
|
|
+ dto.setId(jobUser.getId());
|
|
|
|
+
|
|
|
|
+ String realName = jobUser.getRealName();
|
|
|
|
+ if(StringUtils.isNotEmpty(realName)){
|
|
|
|
+ String familyName = realName.substring(0,1);
|
|
|
|
+ int num = realName.length();
|
|
|
|
+ if(num==2){
|
|
|
|
+ dto.setRealName(familyName+"*");
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ dto.setRealName(familyName+"**");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dto.setHeadImageUrl(jobUser.getHeadImageUrl());
|
|
|
|
+ dto.setSex(jobUser.getSex());
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isNotEmpty(jobUser.getIdCard())){
|
|
|
|
+ int age = IdcardUtil.getAgeByIdCard(jobUser.getIdCard());
|
|
|
|
+ dto.setAge(age);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Resume resume = resumeService.findByUserId(jobUser.getId());
|
|
|
|
+
|
|
|
|
+ String workExpName="";
|
|
|
|
+ String positionCategoryName="";
|
|
|
|
+ String dreamMoneyName="";
|
|
|
|
+ String dreamAdd="";
|
|
|
|
+ String introduction="";
|
|
|
|
+ String educationName="";
|
|
|
|
+
|
|
|
|
+ List<ResumeWorkExperience> resumeWorkExperienceList = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ if(resume!=null){
|
|
|
|
+ DataDictionary dataDictionary = dataDictionaryService.get(resume.getWorkExp());
|
|
|
|
+
|
|
|
|
+ if(dataDictionary!=null){
|
|
|
|
+ workExpName = dataDictionary.getName();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ WorkCategory workCategory = workCategoryService.get(resume.getPositionCategoryId());
|
|
|
|
+ if(workCategory!=null){
|
|
|
|
+ positionCategoryName = workCategory.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();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ dreamAdd = resume.getDreamAdd();
|
|
|
|
+ introduction = resume.getIntroduction();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ resumeWorkExperienceList = resumeWorkExperienceService.findByResumeId(resume.getId());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dto.setWorkExpName(workExpName);
|
|
|
|
+ dto.setEducationName(educationName);
|
|
|
|
+ dto.setPositionCategoryName(positionCategoryName);
|
|
|
|
+ dto.setDreamMoneyName(dreamMoneyName);
|
|
|
|
+ dto.setJobStatus(jobUser.getJobStatus());
|
|
|
|
+ dto.setDreamAdd(dreamAdd);
|
|
|
|
+ dto.setIntroduction(introduction);
|
|
|
|
+ dto.setResumeWorkExperienceList(resumeWorkExperienceList);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(dto);
|
|
|
|
+ } else {
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage("数据库不存在该记录!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch(Exception ex){
|
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|