|
@@ -1,11 +1,17 @@
|
|
|
package com.jpsoft.employment.modules.job.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.entity.UserBrowse;
|
|
|
-import com.jpsoft.employment.modules.job.service.UserBrowseService;
|
|
|
+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.entity.User;
|
|
|
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
|
|
|
+import com.jpsoft.employment.modules.sys.service.UserService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -25,6 +31,30 @@ public class UserBrowseController {
|
|
|
@Autowired
|
|
|
private UserBrowseService userBrowseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RecruitmentService recruitmentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeService rsumeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WorkCategoryService workCategoryService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeWorkExperienceService resumeWorkExperienceService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private JobUserService jobUserService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
@ApiOperation(value="添加信息")
|
|
|
@PostMapping("add")
|
|
|
public MessageResult<UserBrowse> add(@ModelAttribute UserBrowse userBrowse){
|
|
@@ -107,11 +137,18 @@ public class UserBrowseController {
|
|
|
|
|
|
@ApiOperation(value="删除用户")
|
|
|
@PostMapping("delete/{id}")
|
|
|
- public MessageResult<UserBrowse> delete(@PathVariable("id") String id){
|
|
|
+ public MessageResult<UserBrowse> delete(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
|
MessageResult<UserBrowse> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
- int affectCount = userBrowseService.delete(id);
|
|
|
+ UserBrowse userBrowse = userBrowseService.get(id);
|
|
|
+
|
|
|
+ userBrowse.setUpdateBy(subject);
|
|
|
+ userBrowse.setDelFlag(true);
|
|
|
+ userBrowse.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ int affectCount = userBrowseService.update(userBrowse);
|
|
|
+
|
|
|
|
|
|
if (affectCount > 0) {
|
|
|
msgResult.setResult(true);
|
|
@@ -145,7 +182,8 @@ public class UserBrowseController {
|
|
|
@ApiOperation(value="列表")
|
|
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
|
|
public MessageResult<Map> list(
|
|
|
- String id,
|
|
|
+ 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){
|
|
@@ -159,10 +197,56 @@ public class UserBrowseController {
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
+ 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");
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
- searchParams.put("id","%" + id + "%");
|
|
|
+ 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);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -174,4 +258,169 @@ public class UserBrowseController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="HR列表")
|
|
|
+ @RequestMapping(value = "pageListHR",method = RequestMethod.POST)
|
|
|
+ public MessageResult<Map> pageListHR(
|
|
|
+ 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);
|
|
|
+
|
|
|
+ User user = userService.get(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);
|
|
|
+ }
|
|
|
+
|
|
|
+ searchParams.put("companyId",user.getCompanyId());
|
|
|
+
|
|
|
+ Page<UserBrowse> page = userBrowseService.pageSearchHR(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+
|
|
|
+ Page<ResumeDeliverHrDTO> pageDto = new Page<>();
|
|
|
+
|
|
|
+ for (UserBrowse userBrowse:page) {
|
|
|
+ ResumeDeliverHrDTO dto = new ResumeDeliverHrDTO();
|
|
|
+
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(userBrowse.getJobRecruitmentId())){
|
|
|
+ Recruitment recruitment = recruitmentService.get(userBrowse.getJobRecruitmentId());
|
|
|
+
|
|
|
+ dto.setId(userBrowse.getId());
|
|
|
+ dto.setCreateTime(userBrowse.getCreateTime());
|
|
|
+
|
|
|
+
|
|
|
+ String positionName = "";
|
|
|
+
|
|
|
+ if(recruitment!=null){
|
|
|
+ WorkCategory workCategory = workCategoryService.get(recruitment.getPosition());
|
|
|
+ if(workCategory!=null){
|
|
|
+ positionName = workCategory.getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ dto.setPositionName(positionName);
|
|
|
+
|
|
|
+ JobUser jobUser = jobUserService.get(userBrowse.getJobUserId());
|
|
|
+
|
|
|
+ if(jobUser!=null){
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Resume resume = rsumeService.findByUserId(userBrowse.getJobUserId());
|
|
|
+
|
|
|
+ String workExpName="";
|
|
|
+ String dreamMoneyName="";
|
|
|
+ String educationName="";
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ 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;
|
|
|
+ }
|
|
|
}
|