fllmoyu 5 роки тому
батько
коміт
e106cbf9a4

+ 33 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/dto/RecruitInfoListDTO.java

@@ -0,0 +1,33 @@
+package com.jpsoft.enterprise.modules.base.dto;
+
+import lombok.Data;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-1-18 10:54
+ */
+@Data
+public class RecruitInfoListDTO {
+
+    private String id;
+
+    private String positionName;
+
+    private String companyId;
+
+    private String companyName;
+
+    private String workRegionName;
+
+    private String workYearName;
+
+    private String educationName;
+
+    private String salaryLevelName;
+
+    private String describe;
+
+    private String contactPhone;
+
+    private Boolean status;
+}

+ 23 - 20
common/src/main/java/com/jpsoft/enterprise/modules/base/entity/RecruitInfo.java

@@ -4,6 +4,7 @@ import java.io.Serializable;
 import java.util.Date;
 import java.text.SimpleDateFormat;
 import java.math.BigDecimal;
+
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -11,43 +12,45 @@ import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
 /**
-  描述:base_recruit_info的实体类
+ * 描述:base_recruit_info的实体类
  */
 @Data
 @ApiModel(value = "base_recruit_info的实体类")
 public class RecruitInfo {
-        @ApiModelProperty(value = "")
+    @ApiModelProperty(value = "")
     private String id;
-        @ApiModelProperty(value = "公司id")
+    @ApiModelProperty(value = "公司id")
     private String companyId;
-        @ApiModelProperty(value = "职务名称")
+    @ApiModelProperty(value = "职务名称")
     private String positionName;
-        @ApiModelProperty(value = "公司区域(数据字典:区域)")
+    @ApiModelProperty(value = "公司区域(数据字典:区域)")
     private String workRegion;
-        @ApiModelProperty(value = "工作年限(数据字典:工作年限)")
+    @ApiModelProperty(value = "工作年限(数据字典:工作年限)")
     private String workYear;
-        @ApiModelProperty(value = "学历(数据字典:学历)")
+    @ApiModelProperty(value = "学历(数据字典:学历)")
     private String education;
-        @ApiModelProperty(value = "薪资水平(数据字典:薪资水平)")
+    @ApiModelProperty(value = "薪资水平(数据字典:薪资水平)")
     private String salaryLevel;
-        @ApiModelProperty(value = "职务描述")
+    @ApiModelProperty(value = "职务描述")
     private String describe;
-        @ApiModelProperty(value = "联系电话")
+    @ApiModelProperty(value = "联系电话")
     private String contactPhone;
-        @ApiModelProperty(value = "状态是否上架")
+    @ApiModelProperty(value = "状态是否上架")
     private Boolean status;
-        @ApiModelProperty(value = "创建人")
+    @ApiModelProperty(value = "创建人")
     private String createBy;
-        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "创建时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
     private Date createTime;
-        @ApiModelProperty(value = "更新人")
+    @ApiModelProperty(value = "更新人")
     private String updateBy;
-        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "更新时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "更新时间")
     private Date updateTime;
-        @ApiModelProperty(value = "是否删除")
+    @ApiModelProperty(value = "是否删除")
     private Boolean delFlag;
+    @ApiModelProperty(value = "关键字")
+    private String key;
 }

+ 31 - 5
common/src/main/resources/mapper/base/RecruitInfo.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!-- namespace必须指向DAO接口 -->
 <mapper namespace="com.jpsoft.enterprise.modules.base.dao.RecruitInfoDAO">
@@ -19,6 +19,7 @@
 			<result property="updateBy" column="update_by" />
 			<result property="updateTime" column="update_time" />
 			<result property="delFlag" column="del_flag" />
+			<result property="key" column="key_"/>
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.enterprise.modules.base.entity.RecruitInfo">
 	<!--
@@ -28,7 +29,7 @@
 	-->
 	<![CDATA[
 		insert into base_recruit_info
-	    (id_,company_id,position_name,work_region,work_year,education_,salary_level,describe_,contact_phone,status_,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,company_id,position_name,work_region,work_year,education_,salary_level,describe_,contact_phone,status_,create_by,create_time,update_by,update_time,del_flag,key_)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -46,6 +47,7 @@
 ,#{updateBy,jdbcType=VARCHAR}
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{delFlag,jdbcType= NUMERIC }
+,#{key,jdbcType=VARCHAR}
 		)
 	]]>
 	</insert>
@@ -97,12 +99,14 @@
 				<if test="delFlag!=null">
 		del_flag=#{delFlag,jdbcType= NUMERIC },
 		</if>
+			<if test="key!=null">
+				key_=#{key,jdbcType=VARCHAR },
+			</if>
 		</set>
 	where id_=#{id}
 	</update>
 	<select id="get" parameterType="string" resultMap="RecruitInfoMap">
-		select 
-id_,company_id,position_name,work_region,work_year,education_,salary_level,describe_,contact_phone,status_,create_by,create_time,update_by,update_time,del_flag		from base_recruit_info where id_=#{0}
+		select * from base_recruit_info where id_=#{0} and del_flag = 0
 	</select>
 	<select id="exist" parameterType="string" resultType="int">
 		select count(*) from base_recruit_info where id_=#{0}
@@ -115,8 +119,30 @@ id_,company_id,position_name,work_region,work_year,education_,salary_level,descr
 			select * from base_recruit_info
 		]]>
 		<where>
+			del_flag = 0
 			<if test="searchParams.id != null">
-				and ID_ like #{searchParams.id}
+				and ID_ = #{searchParams.id}
+			</if>
+			<if test="searchParams.region != null">
+				and work_region = #{searchParams.region}
+			</if>
+			<if test="searchParams.salaryLevel != null">
+				and salary_level = #{searchParams.salaryLevel}
+			</if>
+			<if test="searchParams.workYear != null">
+				and work_year = #{searchParams.workYear}
+			</if>
+			<if test="searchParams.education != null">
+				and education_ = #{searchParams.education}
+			</if>
+			<if test="searchParams.companyId != null">
+				and company_id = #{searchParams.companyId}
+			</if>
+			<if test="searchParams.key != null">
+				and key_ like #{searchParams.key}
+			</if>
+			<if test="searchParams.status != null">
+				and status_ = #{searchParams.status}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">

+ 2 - 0
web/src/main/java/com/jpsoft/enterprise/config/WebMvcConfig.java

@@ -74,6 +74,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
                 .excludePathPatterns("/mobile/activityInfoApi/activityDetail")
 				.excludePathPatterns("/mobile/cooperationInfoApi/cooperationInfoList")
 				.excludePathPatterns("/mobile/cooperationInfoApi/cooperationInfoDetail")
+				.excludePathPatterns("/mobile/recruitInfoApi/recruitInfoList")
+				.excludePathPatterns("/mobile/recruitInfoApi/recruitInfoDetail")
 				.excludePathPatterns("/wechat/**")
 
         ;

+ 1 - 2
web/src/main/java/com/jpsoft/enterprise/modules/mobile/controller/CompanyInfoApiController.java

@@ -177,8 +177,7 @@ public class CompanyInfoApiController {
             @ApiImplicitParam(name = "region", value = "区域", required = false, paramType = "form"),
             @ApiImplicitParam(name = "type", value = "企业类型", required = false, paramType = "form"),
             @ApiImplicitParam(name = "scale", value = "企业规模", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "industry", value = "所属行业", required = false, paramType = "form"),
-
+            @ApiImplicitParam(name = "industry", value = "所属行业", required = false, paramType = "form")
     })
     public MessageResult<Map> companyList(String region, String type, String scale, String industry, @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
         MessageResult<Map> messageResult = new MessageResult<>();

+ 304 - 0
web/src/main/java/com/jpsoft/enterprise/modules/mobile/controller/RecruitInfoApiController.java

@@ -0,0 +1,304 @@
+package com.jpsoft.enterprise.modules.mobile.controller;
+
+import cn.hutool.core.date.DateUtil;
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.base.dto.CooperationInfoListDTO;
+import com.jpsoft.enterprise.modules.base.dto.RecruitInfoListDTO;
+import com.jpsoft.enterprise.modules.base.entity.*;
+import com.jpsoft.enterprise.modules.base.service.CompanyInfoService;
+import com.jpsoft.enterprise.modules.base.service.PersonInfoService;
+import com.jpsoft.enterprise.modules.base.service.RecruitInfoService;
+import com.jpsoft.enterprise.modules.common.dto.MessageResult;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.service.DataDictionaryService;
+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.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-1-18 9:08
+ */
+@RestController
+@RequestMapping("/mobile/recruitInfoApi")
+@Slf4j
+public class RecruitInfoApiController {
+
+    @Autowired
+    private RecruitInfoService recruitInfoService;
+
+    @Autowired
+    private CompanyInfoService companyInfoService;
+
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+
+    @Autowired
+    private PersonInfoService personInfoService;
+
+
+    @PostMapping("recruitInfoList")
+    @ApiOperation(value = "招聘列表(公开接口)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "region", value = "区域", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "salaryLevel", value = "薪资水平", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "workYear", value = "工作年限", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "education", value = "学历", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "companyId", value = "公司id", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "key", value = "关键字", required = false, paramType = "form"),
+    })
+    public MessageResult<Map> recruitInfoList(String region, String salaryLevel, String workYear, String education, String companyId, String key, @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+            List<RecruitInfoListDTO> list = new ArrayList<>();
+
+            Map<String, Object> searchParams = new HashMap<>();
+
+            if (StringUtils.isNotBlank(region)) {
+                searchParams.put("region", region);
+            }
+
+            if (StringUtils.isNotBlank(salaryLevel)) {
+                searchParams.put("salaryLevel", salaryLevel);
+            }
+
+            if (StringUtils.isNotBlank(workYear)) {
+                searchParams.put("workYear", workYear);
+            }
+
+            if (StringUtils.isNotBlank(education)) {
+                searchParams.put("education", education);
+            }
+            if (StringUtils.isNotBlank(companyId)) {
+                searchParams.put("companyId", companyId);
+            }
+            if (StringUtils.isNotBlank(key)) {
+                searchParams.put("key", "%" + key + "%");
+            }
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("create_time", "desc"));
+            Page<RecruitInfo> page = recruitInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
+            List<RecruitInfo> recruitInfoList = page.getResult();
+            if (recruitInfoList.size() > 0) {
+
+                for (RecruitInfo recruitInfo : recruitInfoList) {
+                    RecruitInfoListDTO recruitInfoListDTO = new RecruitInfoListDTO();
+                    BeanUtils.copyProperties(recruitInfo, recruitInfoListDTO);
+                    CompanyInfo companyInfo = companyInfoService.get(recruitInfo.getCompanyId());
+                    recruitInfoListDTO.setCompanyName(companyInfo.getCompanyName());
+                    String workRegionName = dataDictionaryService.findNameByCatalogNameAndValue("区域", recruitInfo.getWorkRegion());
+                    recruitInfoListDTO.setWorkRegionName(workRegionName);
+                    String workYearName = dataDictionaryService.findNameByCatalogNameAndValue("工作年限", recruitInfo.getWorkYear());
+                    recruitInfoListDTO.setWorkYearName(workYearName);
+                    String educationName = dataDictionaryService.findNameByCatalogNameAndValue("学历", recruitInfo.getEducation());
+                    recruitInfoListDTO.setEducationName(educationName);
+                    String salaryLevelName = dataDictionaryService.findNameByCatalogNameAndValue("薪资水平", recruitInfo.getSalaryLevel());
+                    recruitInfoListDTO.setSalaryLevelName(salaryLevelName);
+                    list.add(recruitInfoListDTO);
+
+                }
+            }
+
+
+            Map<String, Object> pageMap = new HashMap<>();
+
+            pageMap.put("recordsTotal", page.getTotal());
+            pageMap.put("recordsFiltered", page.getTotal());
+            pageMap.put("totalPage", page.getPages());
+            pageMap.put("pageNumber", page.getPageNum());
+            pageMap.put("pageSize", page.getPageSize());
+            pageMap.put("data", list);
+
+            messageResult.setData(pageMap);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("recruitInfoDetail")
+    @ApiOperation(value = "招聘详情(公开接口)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", required = true, paramType = "form")
+    })
+    public MessageResult<Map> recruitInfoDetail(String id) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            Map<String, Object> map = new HashMap<>();
+            RecruitInfo recruitInfo = recruitInfoService.get(id);
+            if (recruitInfo == null) {
+                throw new Exception("招聘信息不存在");
+            }
+            RecruitInfoListDTO recruitInfoListDTO = new RecruitInfoListDTO();
+            BeanUtils.copyProperties(recruitInfo, recruitInfoListDTO);
+            CompanyInfo companyInfo = companyInfoService.get(recruitInfo.getCompanyId());
+            recruitInfoListDTO.setCompanyName(companyInfo.getCompanyName());
+            String workRegionName = dataDictionaryService.findNameByCatalogNameAndValue("区域", recruitInfo.getWorkRegion());
+            recruitInfoListDTO.setWorkRegionName(workRegionName);
+            String workYearName = dataDictionaryService.findNameByCatalogNameAndValue("工作年限", recruitInfo.getWorkYear());
+            recruitInfoListDTO.setWorkYearName(workYearName);
+            String educationName = dataDictionaryService.findNameByCatalogNameAndValue("学历", recruitInfo.getEducation());
+            recruitInfoListDTO.setEducationName(educationName);
+            String salaryLevelName = dataDictionaryService.findNameByCatalogNameAndValue("薪资水平", recruitInfo.getSalaryLevel());
+            recruitInfoListDTO.setSalaryLevelName(salaryLevelName);
+
+            map.put("recruitInfo", recruitInfoListDTO);
+
+            messageResult.setData(map);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("recruitInfoListForOwn")
+    @ApiOperation(value = "个人招聘信息列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
+    })
+    public MessageResult<Map> recruitInfoListForOwn(String token, @RequestAttribute String subject, @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+            List<RecruitInfoListDTO> list = new ArrayList<>();
+
+            PersonInfo personInfo = personInfoService.get(subject);
+            if (personInfo == null) {
+                throw new Exception("用户不存在");
+            }
+            CompanyInfo companyInfo = companyInfoService.get(personInfo.getCompanyId());
+            if (companyInfo == null) {
+                throw new Exception("公司信息有误");
+            }
+            Map<String, Object> searchParams = new HashMap<>();
+            searchParams.put("companyId", companyInfo.getId());
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("status", "desc"));
+            sortList.add(new Sort("create_time", "desc"));
+            Page<RecruitInfo> page = recruitInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
+            List<RecruitInfo> recruitInfoList = page.getResult();
+            if (recruitInfoList.size() > 0) {
+                for (RecruitInfo recruitInfo : recruitInfoList) {
+                    RecruitInfoListDTO recruitInfoListDTO = new RecruitInfoListDTO();
+                    BeanUtils.copyProperties(recruitInfo, recruitInfoListDTO);
+                    recruitInfoListDTO.setCompanyName(companyInfo.getCompanyName());
+                    String workRegionName = dataDictionaryService.findNameByCatalogNameAndValue("区域", recruitInfo.getWorkRegion());
+                    recruitInfoListDTO.setWorkRegionName(workRegionName);
+                    String workYearName = dataDictionaryService.findNameByCatalogNameAndValue("工作年限", recruitInfo.getWorkYear());
+                    recruitInfoListDTO.setWorkYearName(workYearName);
+                    String educationName = dataDictionaryService.findNameByCatalogNameAndValue("学历", recruitInfo.getEducation());
+                    recruitInfoListDTO.setEducationName(educationName);
+                    String salaryLevelName = dataDictionaryService.findNameByCatalogNameAndValue("薪资水平", recruitInfo.getSalaryLevel());
+                    recruitInfoListDTO.setSalaryLevelName(salaryLevelName);
+                    list.add(recruitInfoListDTO);
+
+                }
+            }
+
+            Map<String, Object> pageMap = new HashMap<>();
+
+            pageMap.put("recordsTotal", page.getTotal());
+            pageMap.put("recordsFiltered", page.getTotal());
+            pageMap.put("totalPage", page.getPages());
+            pageMap.put("pageNumber", page.getPageNum());
+            pageMap.put("pageSize", page.getPageSize());
+            pageMap.put("data", list);
+
+            messageResult.setData(pageMap);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("submitRecruitInfo")
+    @ApiOperation(value = "个人招聘信息提交")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "positionName", value = "职务名称", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "workRegion", value = "区域", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "workYear", value = "工作年限", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "education", value = "学历", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "salaryLevel", value = "薪资水平", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "describe", value = "描述", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "contactPhone", value = "联系电话", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "status", value = "是否上架(0:否,1:是)", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
+    })
+    public MessageResult<Map> submitRecruitInfo(String positionName, String workRegion, String workYear, String education, String salaryLevel, String describe, String contactPhone, String status, String token, @RequestAttribute String subject) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            PersonInfo personInfo = personInfoService.get(subject);
+            if (personInfo == null) {
+                throw new Exception("用户不存在");
+            }
+            CompanyInfo companyInfo = companyInfoService.get(personInfo.getCompanyId());
+            if (companyInfo == null) {
+                throw new Exception("公司信息有误");
+            }
+            RecruitInfo recruitInfo = new RecruitInfo();
+            recruitInfo.setId(UUID.randomUUID().toString());
+            recruitInfo.setCompanyId(companyInfo.getId());
+            recruitInfo.setPositionName(positionName);
+            recruitInfo.setWorkRegion(workRegion);
+            recruitInfo.setWorkYear(workYear);
+            recruitInfo.setEducation(education);
+            recruitInfo.setSalaryLevel(salaryLevel);
+            recruitInfo.setDescribe(describe);
+            recruitInfo.setContactPhone(contactPhone);
+            if ("0".equals(status)){
+                recruitInfo.setStatus(false);
+            }
+            if ("1".equals(status)){
+                recruitInfo.setStatus(true);
+            }
+            recruitInfo.setCreateTime(new Date());
+            recruitInfo.setCreateBy(personInfo.getId());
+            recruitInfo.setDelFlag(false);
+            recruitInfo.setKey(companyInfo.getCompanyName()+"+"+positionName);
+            recruitInfoService.insert(recruitInfo);
+
+
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+}