Browse Source

移动端求职接口

wkyy 4 years ago
parent
commit
e7a24f70c7

+ 27 - 0
web/src/main/java/com/jpsoft/employment/modules/mobile/controller/PersonalApiController.java

@@ -0,0 +1,27 @@
+package com.jpsoft.employment.modules.mobile.controller;
+
+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 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.*;
+
+@Slf4j
+@RestController
+@RequestMapping("/mobile/personalApi")
+@Api(description = "移动端求职者个人中心接口")
+public class PersonalApiController {
+}

+ 143 - 11
web/src/main/java/com/jpsoft/employment/modules/mobile/controller/RecruitmentApiController.java

@@ -1,17 +1,22 @@
 package com.jpsoft.employment.modules.mobile.controller;
 
 import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.base.entity.Company;
+import com.jpsoft.employment.modules.base.service.CompanyService;
 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.Recruitment;
+import com.jpsoft.employment.modules.job.entity.WorkCategory;
 import com.jpsoft.employment.modules.job.service.RecruitmentService;
+import com.jpsoft.employment.modules.job.service.WorkCategoryService;
 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.apache.poi.hslf.record.CString;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,10 +36,25 @@ public class RecruitmentApiController {
     @Autowired
     private RecruitmentService recruitmentService;
 
+    @Autowired
+    private WorkCategoryService workCategoryService;
+
+    @Autowired
+    private CompanyService companyService;
+
+
     @PostMapping("getRecruitmentList")
     @ApiOperation(value = "职位列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "title", value = "标题", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "type", value = "类型(1:最新,2:最热)", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "monthlySalary", value = "月薪范围", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "workExperience", value = "工作经验", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "education", value = "学历", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "recruitmentPosition", value = "招聘岗位", required = false, paramType = "form"),
+    })
     public MessageResult<Map> getRecruitmentList(
-            String id,
+            String title,String type,String monthlySalary,String workExperience,String education,String recruitmentPosition,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             HttpServletRequest request){
@@ -48,21 +68,133 @@ public class RecruitmentApiController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        int tabId = 0;
-        switch (tabId) {
-            case 0:
-                sortList.add(new Sort("create_time","asc"));
-                break;
-            case 1:
-                sortList.add(new Sort("reading_times","desc"));
-                break;
+        if ("1".equals(type)) {
+            sortList.add(new Sort("jr.create_time","desc"));
+        }
+        //"2".equals(null)
+        if ("2".equals(type)) {
+            sortList.add(new Sort("jr.reading_times","desc"));
+        }
+        if (type == null) {
+            sortList.add(new Sort("jr.id_","asc"));
+        }
+
+        if (StringUtils.isNotEmpty(title)) {
+            searchParams.put("title", "%"+title+"%");
+        }
+        searchParams.put("monthlySalary", monthlySalary);
+        searchParams.put("workExperience", workExperience);
+        searchParams.put("education", education);
+        searchParams.put("recruitmentPosition", recruitmentPosition);
+
+        Page<Map> page = recruitmentService.foundPageList(searchParams,pageIndex,pageSize,true,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+    @PostMapping("getScreenList")
+    @ApiOperation(value = "筛选标题列表")
+    public MessageResult<List> getScreenList(HttpServletRequest request) {
+        String subject = (String)request.getAttribute("subject");
+
+        //当前用户ID
+
+        MessageResult<List> msgResult = new MessageResult<>();
+
+        List<WorkCategory> page = workCategoryService.list();
+
+        msgResult.setResult(true);
+        msgResult.setData(page);
+
+        return msgResult;
+    }
+
+    @PostMapping("getRecruitmentDetails/{id}")
+    @ApiOperation(value = "招聘详情")
+    public MessageResult<Map> getRecruitmentDetails(
+            @PathVariable("id") String id,
+            String token,
+            @RequestAttribute  String subject){
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+        Map<String, Object> map = new HashMap<>();
+        try {
+            Recruitment recruitment = recruitmentService.get(id);
+            Company company = companyService.get(recruitment.getCompanyId());
+
+            map.put("recruitment",recruitment);
+            map.put("company",company);
+
+            if (recruitment != null) {
+                msgResult.setResult(true);
+                msgResult.setData(map);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
         }
+        catch(Exception ex){
+            msgResult.setCode(400);
+            msgResult.setMessage(ex.getMessage());
+            msgResult.setResult(false);
+        }
+
+        return msgResult;
+    }
+
+    @PostMapping("getRelevantList")
+    @ApiOperation(value = "相关推荐")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", required = true, paramType = "form")
+    })
+    public MessageResult<Map> getRecruitmentList(
+            String id,
+            String token){
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+
+        Recruitment recruitment = recruitmentService.get(id);//id 数据
+        String relevantTitle = recruitment.getTitle();//标题
+
+        sortList.add(new Sort("id_","asc"));
+
+        searchParams.put("relevantTitle", relevantTitle);
+        searchParams.put("notrelevantId", id);
+
+        Page<Recruitment> page = recruitmentService.pageSearch(searchParams,1,5,true,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+    @PostMapping("getCompanyDetails")
+    @ApiOperation(value = "企业详情")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", required = true, paramType = "form")
+    })
+    public MessageResult<Map> getCompanyDetails(String id,String token) {
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+
+        sortList.add(new Sort("bc.id_","asc"));
 
         if (StringUtils.isNotEmpty(id)) {
-            searchParams.put("id","%" + id + "%");
+            searchParams.put("id", "%"+id+"%");
         }
 
-        Page<Recruitment> page = recruitmentService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+        Page<Map> page = recruitmentService.foundPageList(searchParams,1,20,true,sortList);
 
         msgResult.setResult(true);
         msgResult.setData(PojoUtils.pageWrapper(page));