|
|
@@ -0,0 +1,302 @@
|
|
|
+package com.jpsoft.employment.modules.mobile.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.employment.config.OSSConfig;
|
|
|
+import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
|
+import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
+import com.jpsoft.employment.modules.common.utils.*;
|
|
|
+import com.jpsoft.employment.modules.job.entity.*;
|
|
|
+import com.jpsoft.employment.modules.job.service.*;
|
|
|
+import com.jpsoft.employment.modules.sys.entity.SysLog;
|
|
|
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
|
|
|
+import com.jpsoft.employment.modules.sys.service.SysLogService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.joda.time.DateTime;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.data.redis.core.ValueOperations;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+import sun.misc.BASE64Decoder;
|
|
|
+
|
|
|
+import java.io.ByteArrayInputStream;
|
|
|
+import java.util.*;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/mobile/resumeApi")
|
|
|
+@Api(description = "简历接口")
|
|
|
+@Slf4j
|
|
|
+public class ResumeApiController {
|
|
|
+ @Value("${jwt.secret}")
|
|
|
+ private String jwtSecret;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private JobUserService jobUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeService resumeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RecruitmentService recruitmentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserCollectionService userCollectionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeDeliverService resumeDeliverService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeEducationExperienceService resumeEducationExperienceService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeWorkExperienceService resumeWorkExperienceService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeDeliverRecordService resumeDeliverRecordService;
|
|
|
+
|
|
|
+
|
|
|
+ private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
+
|
|
|
+ @PostMapping("resumeStatus")
|
|
|
+ @ApiOperation(value = "简历状态")
|
|
|
+ public MessageResult<String> resumeStatus(String token, @RequestAttribute String subject) {
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ //JobUser jobUser = jobUserService.get(subject);
|
|
|
+ Resume resume = resumeService.findByUserId(subject);
|
|
|
+ String returnStr = "未创建";
|
|
|
+ if(resume != null){
|
|
|
+ returnStr = dataDictionaryService.findNameByCatalogNameAndValue("简历审批状态",resume.getApproveStatus());
|
|
|
+ }
|
|
|
+
|
|
|
+ messageResult.setData(returnStr);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("collectResume")
|
|
|
+ @ApiOperation(value = "收藏简历")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "recruitmentId", value = "岗位ID", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "status", value = "状态(收藏1,取消0),默认1收藏", paramType = "form"),
|
|
|
+ })
|
|
|
+ public MessageResult<String> collectResume(
|
|
|
+ String recruitmentId,
|
|
|
+ @RequestParam(value="status",defaultValue="1") String status,
|
|
|
+ @RequestAttribute String subject) {
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ UserCollection uc = userCollectionService.findByUserIdAndRId(subject,recruitmentId);
|
|
|
+ if("1".equals(status)){
|
|
|
+ if(uc == null){
|
|
|
+ uc = new UserCollection();
|
|
|
+ uc.setId(UUID.randomUUID().toString());
|
|
|
+ uc.setCreateBy(subject);
|
|
|
+ uc.setCreateTime(new Date());
|
|
|
+ uc.setJobRecruitmentId(recruitmentId);
|
|
|
+ uc.setJobUserId(subject);
|
|
|
+ uc.setDelFlag(false);
|
|
|
+
|
|
|
+ userCollectionService.insert(uc);
|
|
|
+ }else{
|
|
|
+ uc.setUpdateBy(subject);
|
|
|
+ uc.setUpdateTime(new Date());
|
|
|
+ uc.setDelFlag(false);
|
|
|
+
|
|
|
+ userCollectionService.update(uc);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(uc != null){
|
|
|
+ uc.setUpdateBy(subject);
|
|
|
+ uc.setUpdateTime(new Date());
|
|
|
+ uc.setDelFlag(true);
|
|
|
+
|
|
|
+ userCollectionService.update(uc);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ messageResult.setData("操作成功");
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage());
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("deliverResume")
|
|
|
+ @ApiOperation(value = "投递简历")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "recruitmentId", value = "岗位ID", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "resumeId", value = "简历ID,不传则默认查当前简历", paramType = "form"),
|
|
|
+ })
|
|
|
+ public MessageResult<String> deliverResume(
|
|
|
+ String recruitmentId,
|
|
|
+ @RequestParam(value="resumeId",defaultValue="") String resumeId,
|
|
|
+ @RequestAttribute String subject) {
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ //JobUser jobUser = jobUserService.get(subject);
|
|
|
+ Resume resume = null;
|
|
|
+ if(StringUtils.isNotEmpty(resumeId)) {
|
|
|
+ resume = resumeService.get(resumeId);
|
|
|
+ }else{
|
|
|
+ resume = resumeService.findByUserId(subject);
|
|
|
+ }
|
|
|
+ if(resume == null){
|
|
|
+ messageResult.setMessage("未创建简历");
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setCode(400);
|
|
|
+ return messageResult;
|
|
|
+ }else{
|
|
|
+ if(!"0".equals(resume.getStatus())){
|
|
|
+ messageResult.setMessage("当前简历未开启");
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setCode(400);
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!"2".equals(resume.getApproveStatus())){
|
|
|
+ messageResult.setMessage("当前简历未审批");
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setCode(400);
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ResumeDeliver rd = new ResumeDeliver();
|
|
|
+ rd.setId(UUID.randomUUID().toString());
|
|
|
+ rd.setCreateBy(subject);
|
|
|
+ rd.setCreateTime(new Date());
|
|
|
+ rd.setDelFlag(false);
|
|
|
+ rd.setJobRecruitmentId(recruitmentId);
|
|
|
+ rd.setJobUserId(subject);
|
|
|
+ rd.setStatus("0");
|
|
|
+
|
|
|
+ int inCount = resumeDeliverService.insert(rd);
|
|
|
+ if(inCount > 0) {
|
|
|
+ messageResult.setMessage("投递成功");
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ }else{
|
|
|
+ messageResult.setMessage("投递失败");
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setCode(400);
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage());
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("myResumeDetail")
|
|
|
+ @ApiOperation(value = "我的简历-详情")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "resumeId", value = "简历ID,不传则默认查当前简历", paramType = "form"),
|
|
|
+ })
|
|
|
+ public MessageResult<Map> myResumeDetail(
|
|
|
+ @RequestParam(value="resumeId",defaultValue="") String resumeId,
|
|
|
+ @RequestAttribute String subject) {
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ //JobUser jobUser = jobUserService.get(subject);
|
|
|
+ Resume resume = null;
|
|
|
+ if(StringUtils.isNotEmpty(resumeId)) {
|
|
|
+ resume = resumeService.get(resumeId);
|
|
|
+ }else{
|
|
|
+ resume = resumeService.findByUserId(subject);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(resume == null){
|
|
|
+ messageResult.setMessage("未创建简历");
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setCode(400);
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ResumeEducationExperience> rexList = resumeEducationExperienceService.findByResumeId(resume.getId());
|
|
|
+ List<ResumeWorkExperience> rweList = resumeWorkExperienceService.findByResumeId(resume.getId());
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, Object> dataMap = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ dataMap.put("resume", resume);
|
|
|
+ dataMap.put("educationExperienceList", rexList);
|
|
|
+ dataMap.put("workExpList", rweList);
|
|
|
+
|
|
|
+ messageResult.setData(dataMap);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ return messageResult;
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage());
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("deliveryRecord")
|
|
|
+ @ApiOperation(value = "投递记录")
|
|
|
+ public MessageResult<Map> deliveryRecord(
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="10") int pageSize,
|
|
|
+ @RequestAttribute String subject) {
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ //JobUser jobUser = jobUserService.get(subject);
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("a.create_time","desc"));
|
|
|
+
|
|
|
+ Page<ResumeDeliver> page = resumeDeliverService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ for(ResumeDeliver rd : page.getResult()){
|
|
|
+ Recruitment recruitment = recruitmentService.get(rd.getJobRecruitmentId());
|
|
|
+ rd.setJobRecruitment(recruitment);
|
|
|
+ }
|
|
|
+
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage());
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+}
|