|
|
|
@ -0,0 +1,119 @@
|
|
|
|
|
package com.weaver.seconddev.sxjg.service.Impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfig;
|
|
|
|
|
import com.weaver.seconddev.sxjg.service.JoinPositionRule;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service
|
|
|
|
|
public class JoinPositionRuleImpl implements JoinPositionRule {
|
|
|
|
|
|
|
|
|
|
private JdbcTemplate jdbcTemplate = new JdbcTemplate(EbDbDataSourceConfig.dbDataSource());
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, String> JoinPositionRule(String talentId,String userId,String userName,String positionId) {
|
|
|
|
|
Map<String,String> rs8 = new HashMap<>();
|
|
|
|
|
Map<String,String> rs7 = schoolcheck(talentId,positionId);
|
|
|
|
|
if(rs7.get("result").equals("error")) {
|
|
|
|
|
return rs7;
|
|
|
|
|
}
|
|
|
|
|
//一人一岗
|
|
|
|
|
if(checkOnePersonOnce(talentId,positionId)) {
|
|
|
|
|
rs8.put("result","error");
|
|
|
|
|
rs8.put("message","同一职位不能重复投递!");
|
|
|
|
|
return rs8;
|
|
|
|
|
}
|
|
|
|
|
//当前人再所有组织的岗位数量
|
|
|
|
|
String sql = "select count(a.id) as nums,b.sub_company from uf_rcrt_candidate_batch a " +
|
|
|
|
|
"INNER JOIN uf_rcrt_position b on a.position_id = b.ID" +
|
|
|
|
|
" where a.talent_id = '"+talentId+"' GROUP BY b.sub_company";
|
|
|
|
|
List<Map<String,Object>> rs2 = jdbcTemplate.queryForList(sql);
|
|
|
|
|
log.error("sql1:"+sql);
|
|
|
|
|
if(CollectionUtil.isNotEmpty(rs2)) {
|
|
|
|
|
sql = "select sub_company from uf_rcrt_position where id = '"+positionId+"'";
|
|
|
|
|
log.error("sql2:"+sql);
|
|
|
|
|
List<Map<String,Object>> rs3 = jdbcTemplate.queryForList(sql);
|
|
|
|
|
if(CollectionUtil.isEmpty(rs3)) {
|
|
|
|
|
rs8.put("result","ok");
|
|
|
|
|
return rs8;
|
|
|
|
|
}
|
|
|
|
|
for(Map<String,Object> map3: rs3) {
|
|
|
|
|
String companyid = (String)map3.get("sub_company");
|
|
|
|
|
for(Map<String,Object> map2: rs2) {
|
|
|
|
|
String companyid2 = (String)map2.get("sub_company");
|
|
|
|
|
long nums = (long)map2.get("nums");
|
|
|
|
|
if(companyid2.equals(companyid)) {
|
|
|
|
|
if(nums >=3l) {
|
|
|
|
|
rs8.put("result","error");
|
|
|
|
|
rs8.put("message","同一单位投递职位数量已上限,请选择其他单位职位投递!");
|
|
|
|
|
return rs8;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rs8.put("result","ok");
|
|
|
|
|
return rs8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 岗位学校配置
|
|
|
|
|
*/
|
|
|
|
|
private Map<String,String> schoolcheck(String talentId,String positionId){
|
|
|
|
|
Map<String, String> result = new HashMap<>();
|
|
|
|
|
//判断该职位是否需要做学校限制
|
|
|
|
|
String sql = "select xx from uf_position_schoollimit where zwxx = '"+positionId+"'";
|
|
|
|
|
List<Map<String, Object>> rs1 = jdbcTemplate.queryForList(sql);
|
|
|
|
|
if(CollectionUtil.isEmpty(rs1)) {
|
|
|
|
|
result.put("result", "ok");
|
|
|
|
|
result.put("message", "该职位不需要做学校限制");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据人才基本信息id获取教育背景
|
|
|
|
|
sql = "select school from rcrt_education_exp where form_data_id = '"+talentId+"'";
|
|
|
|
|
List<Map<String, Object>> rs2 = jdbcTemplate.queryForList(sql);
|
|
|
|
|
if(CollectionUtil.isNotEmpty(rs2)) {
|
|
|
|
|
//根据职位id获取高校
|
|
|
|
|
boolean flag = false;
|
|
|
|
|
for(Map<String, Object> map2 : rs2) {
|
|
|
|
|
String school2 = (String)map2.get("school");
|
|
|
|
|
for(Map<String, Object> map1 : rs1) {
|
|
|
|
|
String school1 = (String)map1.get("xx");
|
|
|
|
|
if(school1.equals(school2)) {
|
|
|
|
|
flag = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!flag) {
|
|
|
|
|
result.put("result", "error");
|
|
|
|
|
result.put("message", "您不符合当前职位的招聘要求,请选择其他职位投递!");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
result.put("result", "error");
|
|
|
|
|
result.put("message", "该人员没有教育经历信息!");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
result.put("result", "ok");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 规则校验:一个人一个职位投递一次
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkOnePersonOnce(String talentId,String positionId) {
|
|
|
|
|
String sql = "select count(id) as nums from uf_rcrt_candidate_batch where position_id = '"+positionId+"' and talent_id = '"+talentId+"'";
|
|
|
|
|
Map<String, Object> rs = jdbcTemplate.queryForMap(sql);
|
|
|
|
|
long nums = (long)rs.get("nums");
|
|
|
|
|
return nums >0l;
|
|
|
|
|
}
|
|
|
|
|
}
|