123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597 |
- package com.hz.employmentsite.services.impl.companyService;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import com.hz.employmentsite.filter.exception.BaseException;
- import com.hz.employmentsite.mapper.*;
- import com.hz.employmentsite.mapper.cquery.LabelCQuery;
- import com.hz.employmentsite.mapper.cquery.PostCQuery;
- import com.hz.employmentsite.mapper.cquery.RecommendMgtCQuery;
- import com.hz.employmentsite.model.*;
- import com.hz.employmentsite.services.service.companyService.PostService;
- import com.hz.employmentsite.services.service.system.DictionaryService;
- import com.hz.employmentsite.util.RegexUtils;
- import com.hz.employmentsite.util.StringUtils;
- import com.hz.employmentsite.vo.companyService.PostVo;
- import com.hz.employmentsite.vo.companyService.RecommendPostVo;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.*;
- import java.util.stream.Collectors;
- @Service("PostService")
- public class PostServiceImpl implements PostService {
- @Autowired
- private PostCQuery postCQuery;
- @Autowired
- private StringUtils stringUtils;
- @Autowired
- private RegexUtils regexUtils;
- @Autowired
- private PcPostMapper pcPostMapper;
- @Autowired
- private PcRecommendMapper pcRecommendMapper;
- @Autowired
- private PcRecommendMgtMapper pcRecommendMgtMapper;
- @Autowired
- private PcProfessionMapper pcProfessionMapper;
- @Autowired
- private PcCompanyMapper companyMapper;
- @Autowired
- private PcSiteUserMapper pcSiteUserMapper;
- @Autowired
- private DictionaryService dictionaryService;
- @Autowired
- private PcLabelPostMapper pcLabelPostMapper;
- @Autowired
- private LabelCQuery labelCQuery;
- @Autowired
- private PcWorkcategoryMapper pcWorkcategoryMapper;
- @Override
- public PageInfo<PostVo> getList(Integer page, Integer rows, List<String> postIDList,
- String professionName, Integer minCount, Integer maxCount,
- String companyName, String recordStatus, String companyID,
- String loginUserID, String siteID, Date startDate,
- Date endDate) {
- List<String> curLoginUserSiteCompanyIDs = new ArrayList<>();
- if (!stringUtils.IsNullOrEmpty(loginUserID)) {
- PcSiteUserExample siteUserExp = new PcSiteUserExample();
- siteUserExp.or().andUserIDEqualTo(loginUserID);
- var curLoginUserSiteID = pcSiteUserMapper.selectByExample(siteUserExp).get(0).getSiteID();
- PcCompanyExample companyExp = new PcCompanyExample();
- companyExp.or().andSiteIDEqualTo(curLoginUserSiteID);
- var curLoginUserSiteCompanyList = companyMapper.selectByExample(companyExp).stream().toList();
- for (PcCompany curLoginUserSiteCompany : curLoginUserSiteCompanyList) {
- curLoginUserSiteCompanyIDs.add(curLoginUserSiteCompany.getCompanyID());
- }
- }
- PageHelper.startPage(page, rows);
- List<PostVo> list = postCQuery.selectPostList(stringUtils.ListToInSql(postIDList), professionName, minCount, maxCount, companyName, recordStatus, companyID, stringUtils.ListToInSql(curLoginUserSiteCompanyIDs), siteID, startDate, endDate,false);
- if(list != null && list.size()>0){
- for(PostVo curPost : list){
- curPost.listLabel = labelCQuery.getPostLabelList(curPost.getPostID());
- var curPcPost = pcPostMapper.selectByPrimaryKey(curPost.getPostID());
- if (!stringUtils.IsNullOrEmpty(curPost.professionID)&&stringUtils.IsNullOrEmpty(curPost.postName)){
- PcProfessionExample professionExp = new PcProfessionExample();
- professionExp.or().andProfessionIDEqualTo(curPost.professionID);
- var curProfession = pcProfessionMapper.selectByExample(professionExp).stream().findFirst().orElse(null);
- if( curProfession!=null){
- curPcPost.setPostName(curProfession.getProfessionName());
- pcPostMapper.updateByPrimaryKey(curPcPost);
- }
- }
- if (!stringUtils.IsNullOrEmpty(curPost.workCode)&&stringUtils.IsNullOrEmpty(curPost.workName)){
- PcWorkcategoryExample workCategoryExp = new PcWorkcategoryExample();
- workCategoryExp.or().andWorkCategoryIDEqualTo(curPost.workCode);
- var curWorkCategory = pcWorkcategoryMapper.selectByExample(workCategoryExp).stream().findFirst().orElse(null);
- if( curWorkCategory!=null){
- curPcPost.setWorkName(curWorkCategory.getWorkCategoryName());
- pcPostMapper.updateByPrimaryKey(curPcPost);
- }
- }
- if (curPost.endTime != null && curPost.endTime.before(new Date()) && curPost.recordStatus.equals(1)) {
- curPcPost.setRecordStatus(0);
- pcPostMapper.updateByPrimaryKey(curPcPost);
- }
- }
- }
- PageInfo<PostVo> result = new PageInfo(list);
- return result;
- }
- @Override
- public PageInfo<RecommendPostVo> getCommendPostList(Integer page, Integer rows, String jobUserID) {
- PageHelper.startPage(page, rows);
- List<RecommendPostVo> list = postCQuery.selectRecommendPostList(jobUserID);
- PageInfo<RecommendPostVo> result = new PageInfo(list);
- return result;
- }
- @Override
- public Integer saveCommendPost(RecommendPostVo data, String userId) {
- int result = 0;
- PcRecommend dbData = null;
- if (data.recommendID != null) {
- PcRecommendExample exp = new PcRecommendExample();
- PcRecommendExample.Criteria cro = exp.createCriteria();
- cro.andPostIDEqualTo(data.recommendID);
- dbData = pcRecommendMapper.selectByExample(exp).stream().findFirst().orElse(null);
- }
- Boolean isExist = dbData != null;
- if (!isExist) {
- dbData = new PcRecommend();
- dbData.setRecommendID(UUID.randomUUID().toString());
- dbData.setJobuserID(data.jobUserID);
- dbData.setPostID(data.postID);
- dbData.setIsRead(data.isRead == null ? false : true);
- dbData.setIsSendnotes(data.isSendNotes == null ? false : true);
- dbData.setCreateTime(new Date());
- dbData.setCreateUserID(userId);
- result = pcRecommendMapper.insert(dbData);
- } else {
- dbData.setJobuserID(data.jobUserID);
- dbData.setPostID(data.postID);
- dbData.setIsRead(data.isRead == null ? false : true);
- dbData.setIsSendnotes(data.isSendNotes == null ? false : true);
- dbData.setModifyTime(new Date());
- dbData.setModifyUserID(userId);
- result = pcRecommendMapper.updateByPrimaryKeySelective(dbData);
- }
- return result;
- }
- @Override
- public int updatePostStatus(String postID, Integer status) {
- PcPost post = pcPostMapper.selectByPrimaryKey(postID);
- if(status.equals(1)&&post.getEndTime().before(new Date())){
- throw new BaseException("","该岗位招聘日期已结束,不能启用!");
- }
- post.setRecordStatus(status);
- return pcPostMapper.updateByPrimaryKey(post);
- }
- @Override
- public int save(PostVo data, String userId) {
- int result = 0;
- PcPost dbData = null;
- Boolean isExist = data.getPostID() != null;
- PcPostExample exp = new PcPostExample();
- PcPostExample.Criteria cro = exp.createCriteria();
- if (isExist) {
- cro.andPostIDEqualTo(data.getPostID());
- dbData = pcPostMapper.selectByExample(exp).stream().findFirst().orElse(null);
- }
- //判断岗位id是否为空
- if (stringUtils.IsNullOrEmpty(data.getProfessionID())) {
- PcProfessionExample proEmp = new PcProfessionExample();
- PcProfessionExample.Criteria proCia = proEmp.or();
- proCia.andParentProfessionIDNotEqualTo("");
- proCia.andProfessionNameEqualTo("其他");
- //获取二级其他信息
- PcProfession proOther = pcProfessionMapper.selectByExample(proEmp).stream().findFirst().orElse(null);
- if (proOther != null) {
- proEmp = new PcProfessionExample();
- proEmp.or().andParentProfessionIDEqualTo(proOther.getProfessionID()).andProfessionNameIsNotNull();
- // proCia.andProfessionNameEqualTo(data.getProfessionName());
- //查询其他岗位
- List<PcProfession> proOtherSonList = pcProfessionMapper.selectByExample(proEmp);
- PcProfession proOtherSon = proOtherSonList.stream()
- .filter(x -> x.getProfessionName().equals(data.getProfessionName())).findFirst().orElse(null);
- if (proOtherSon != null) {
- data.setProfessionID(proOtherSon.getProfessionID());
- } else {
- data.setProfessionID(UUID.randomUUID().toString());
- PcProfession proModel = new PcProfession();
- proModel.setProfessionID(data.getProfessionID());
- proModel.setParentProfessionID(proOther.getProfessionID());
- proModel.setProfessionName(data.getProfessionName());
- proModel.setStatus(Integer.parseInt("1"));
- proModel.setOrderNo(proOtherSonList.size() + 1);
- pcProfessionMapper.insert(proModel);
- }
- }
- }
- if (dbData == null) {
- dbData = new PcPost();
- dbData.setPostID(UUID.randomUUID().toString());
- dbData.setProfessionID(data.getProfessionID());
- dbData.setWorkCode(data.getWorkCode());
- dbData.setWorkName(data.getWorkName());
- dbData.setValidTime(data.getValidTime());
- dbData.setRecruitCount(data.getRecruitCount());
- dbData.setCompanyID(data.getCompanyID());
- dbData.setPostName(data.getPostName());
- dbData.setRecordStatus(data.getRecordStatus());
- dbData.setWorkNature(data.getWorkNature());
- dbData.setValidDay(data.getValidDay());
- dbData.setWorkYear(data.getWorkYear());
- dbData.setWorkNature(data.getWorkNature());
- dbData.setCultureRank(data.getCultureRank());
- dbData.setPostDesc(data.getPostDesc());
- dbData.setMaxSalary(data.getMaxSalary());
- dbData.setMinSalary(data.getMinSalary());
- dbData.setWelfare(data.getWelfare());
- dbData.setUserName(data.getUserName());
- dbData.setUserMobile(data.getUserMobile());
- dbData.setPostEmail(data.getPostEmail());
- dbData.setWorkTime(data.getWorkTime());
- dbData.setIsTrail(data.getIsTrail());
- dbData.setTrailMonths(data.getTrailMonths());
- dbData.setTrailMaxSalary(data.getTrailMaxSalary());
- dbData.setTrailMinSalary(data.getTrailMinSalary());
- dbData.setCreateTime(new Date());
- dbData.setCreateUserID(userId);
- dbData.setJobPlace(data.getJobPlace());
- dbData.setStartTime(data.getStartTime());
- dbData.setEndTime(data.getEndTime());
- dbData.setContactName(data.getContactName());
- dbData.setContactMobile(data.getContactMobile());
- dbData.setContactEmail(data.getContactEmail());
- dbData.setWorkNatureID(data.getWorkNatureID());
- // dbData.setTagID(data.getTagID());
- result = pcPostMapper.insert(dbData);
- } else {
- dbData.setProfessionID(data.getProfessionID());
- dbData.setWorkCode(data.getWorkCode());
- dbData.setValidTime(data.getValidTime());
- dbData.setWorkName(data.getWorkName());
- dbData.setRecruitCount(data.getRecruitCount());
- dbData.setCompanyID(data.getCompanyID());
- dbData.setPostName(data.getPostName());
- dbData.setRecordStatus(data.getRecordStatus());
- dbData.setWorkNature(data.getWorkNature());
- dbData.setValidDay(data.getValidDay());
- dbData.setWorkYear(data.getWorkYear());
- dbData.setWorkNature(data.getWorkNature());
- dbData.setCultureRank(data.getCultureRank());
- dbData.setPostDesc(data.getPostDesc());
- dbData.setMaxSalary(data.getMaxSalary());
- dbData.setMinSalary(data.getMinSalary());
- dbData.setWelfare(data.getWelfare());
- dbData.setUserName(data.getUserName());
- dbData.setUserMobile(data.getUserMobile());
- dbData.setPostEmail(data.getPostEmail());
- dbData.setWorkTime(data.getWorkTime());
- dbData.setIsTrail(data.getIsTrail());
- dbData.setTrailMonths(data.getTrailMonths());
- dbData.setTrailMaxSalary(data.getTrailMaxSalary());
- dbData.setTrailMinSalary(data.getTrailMinSalary());
- dbData.setModifyTime(new Date());
- dbData.setModifyUserID(userId);
- dbData.setJobPlace(data.getJobPlace());
- dbData.setStartTime(data.getStartTime());
- dbData.setEndTime(data.getEndTime());
- dbData.setContactName(data.getContactName());
- dbData.setContactMobile(data.getContactMobile());
- dbData.setContactEmail(data.getContactEmail());
- dbData.setWorkNatureID(data.getWorkNatureID());
- // dbData.setTagID(data.getTagID());
- result = pcPostMapper.updateByPrimaryKeyWithBLOBs(dbData);
- }
- PcLabelPostExample labelEmp = new PcLabelPostExample();
- labelEmp.or().andPostIDEqualTo(data.getPostID());
- pcLabelPostMapper.deleteByExample(labelEmp);
- if (data.listLabel != null && data.listLabel.size() > 0) {
- data.listLabel.forEach(x -> {
- PcLabelPost labelModel = new PcLabelPost();
- labelModel.setPostID(data.getPostID());
- labelModel.setLabelID(x.getLabelID());
- pcLabelPostMapper.insert(labelModel);
- });
- }
- return result;
- }
- @Override
- public int delete(List<String> idList) {
- int result = 0;
- PcRecommendMgtExample recommendMgtExp = new PcRecommendMgtExample();
- recommendMgtExp.or().andPostIDIn(idList);
- List<PcRecommendMgt> resultList = pcRecommendMgtMapper.selectByExample(recommendMgtExp).stream().toList();
- if( resultList.size() > 0 ) {
- throw new BaseException("10004","已存在该岗位的推荐数据,删除失败!");
- }
- PcPostExample postExp = new PcPostExample();
- postExp.or().andPostIDIn(idList);
- result = pcPostMapper.deleteByExample(postExp);
- if (result > 0) {
- PcLabelPostExample labelEmp = new PcLabelPostExample();
- labelEmp.or().andPostIDIn(idList);
- pcLabelPostMapper.deleteByExample(labelEmp);
- }
- return result;
- }
- @Override
- public int deletePostAndRecommendMgt(String id) {
- try {
- PcRecommendMgtExample exp = new PcRecommendMgtExample();
- PcRecommendMgtExample.Criteria cro = exp.or();
- cro.andPostIDEqualTo(id);
- pcRecommendMgtMapper.deleteByExample(exp);
- PcLabelPostExample labelEmp = new PcLabelPostExample();
- labelEmp.or().andPostIDEqualTo(id);
- pcLabelPostMapper.deleteByExample(labelEmp);
- return pcPostMapper.deleteByPrimaryKey(id);
- } catch (Exception e) {
- e.printStackTrace();
- return 0;
- }
- }
- @Override
- public PostVo getDataById(String id,boolean isAllPost) {
- if (stringUtils.IsNullOrEmpty(id)) {
- return null;
- }
- PostVo data = postCQuery.selectPostList(stringUtils.ListToInSql(Arrays.asList(id)), null, null, null, null, null, null, null, null, null, null,isAllPost).stream().findFirst().orElse(null);
- if (data != null) {
- data.listLabel = labelCQuery.getPostLabelList(id);
- }
- return data;
- }
- @Override
- public List<PostVo> getDataListByCompanyID(String companyId) {
- List<PostVo> resultList = new ArrayList<>();
- PcPostExample postExp = new PcPostExample();
- postExp.or().andCompanyIDEqualTo(companyId);
- var postList = pcPostMapper.selectByExample(postExp);
- for (PcPost curPost : postList) {
- PostVo item = new PostVo();
- item.setPostID(curPost.getPostID());
- item.setProfessionID(curPost.getProfessionID());
- PcProfessionExample professionExp = new PcProfessionExample();
- professionExp.or().andProfessionIDEqualTo(curPost.getProfessionID());
- var curProfession = pcProfessionMapper.selectByExample(professionExp).get(0);
- item.setProfessionName(curProfession.getProfessionName());
- item.setCompanyID(curPost.getCompanyID());
- item.setRecruitCount(curPost.getRecruitCount());
- item.setStartTime(curPost.getStartTime());
- item.setEndTime(curPost.getEndTime());
- resultList.add(item);
- }
- return resultList;
- }
- public static boolean isPositiveInteger(String str) {
- try {
- // 尝试将字符串转换为整数
- int num = Integer.parseInt(str);
- // 如果转换后的整数小于等于0,则为false
- return num > 0;
- } catch (NumberFormatException e) {
- // 字符串无法转换为整数,则为false
- return false;
- }
- }
- @Override
- public List<PostVo> importPost(List<PostVo> dataList, String userID) {
- if (dataList.size() <= 0)
- throw new BaseException("", "请添加导入数据!");
- //所属企业
- PcCompanyExample companyExp = new PcCompanyExample();
- companyExp.or().andRecordStatusEqualTo(1);
- List<PcCompany> companyList = companyMapper.selectByExample(companyExp);
- //岗位信息
- List<SysDictionaryItem> thirdLevelProfessionList = new ArrayList<>();
- PcProfessionExample professionExp = new PcProfessionExample();
- professionExp.or().andParentProfessionIDEqualTo("").andStatusEqualTo(1);
- var firstLevelData = pcProfessionMapper.selectByExample(professionExp);
- for (PcProfession curProfession : firstLevelData) {
- professionExp = new PcProfessionExample();
- professionExp.or().andParentProfessionIDEqualTo(curProfession.getProfessionID()).andStatusEqualTo(1);
- var secondLevelData = pcProfessionMapper.selectByExample(professionExp);
- for (PcProfession curParentProfession : secondLevelData) {
- professionExp = new PcProfessionExample();
- professionExp.or().andParentProfessionIDEqualTo(curParentProfession.getProfessionID()).andStatusEqualTo(1).andProfessionNameIsNotNull();
- var thirdLevelData = pcProfessionMapper.selectByExample(professionExp);
- for (PcProfession curItem : thirdLevelData) {
- SysDictionaryItem item = new SysDictionaryItem();
- item.setCode(curItem.getProfessionID());
- item.setName(curItem.getProfessionName());
- thirdLevelProfessionList.add(item);
- }
- }
- }
- // 工种信息
- List<SysDictionaryItem> WorkCategoryList = new ArrayList<>();
- // 获取第一级工种
- PcWorkcategoryExample workCategoryExample = new PcWorkcategoryExample();
- workCategoryExample.or().andParentWorkCategoryIDEqualTo("").andStatusEqualTo(1);
- List<PcWorkcategory> firstLevelWorkCategoryList = pcWorkcategoryMapper.selectByExample(workCategoryExample);
- for (PcWorkcategory pcWorkcategory : firstLevelWorkCategoryList) {
- // 获取第二级工种
- workCategoryExample = new PcWorkcategoryExample();
- workCategoryExample.or().andParentWorkCategoryIDEqualTo(pcWorkcategory.getWorkCategoryID()).andStatusEqualTo(1);
- List<PcWorkcategory> secondLevelWorkCategoryList = pcWorkcategoryMapper.selectByExample(workCategoryExample);
- for (PcWorkcategory workCategory : secondLevelWorkCategoryList) {
- // 获取第三级工种
- workCategoryExample = new PcWorkcategoryExample();
- workCategoryExample.or().andParentWorkCategoryIDEqualTo(workCategory.getWorkCategoryID()).andStatusEqualTo(1);
- List<PcWorkcategory> thirdLevelWorkCategoryList = pcWorkcategoryMapper.selectByExample(workCategoryExample);
- for (PcWorkcategory pcWorkCategory1 : thirdLevelWorkCategoryList) {
- SysDictionaryItem item = new SysDictionaryItem();
- item.setCode(pcWorkCategory1.getWorkCategoryID());
- item.setName(pcWorkCategory1.getWorkCategoryName());
- WorkCategoryList.add(item);
- }
- }
- }
- //文化程度
- List<SysDictionaryItem> dicCultureDataList = dictionaryService.getDictionaryItemList("CultureLevel");
- // 工作年限
- List<SysDictionaryItem> dicWorkYearDataList = dictionaryService.getDictionaryItemList("WorkYearType");
- // 最终处理数据
- List<PostVo> resultList = new ArrayList<>(); // 岗位
- List<PcProfession> pcProfessionList = new ArrayList<>(); // 岗位字典
- // 获取二级的“其他”岗位
- PcProfessionExample proEmp = new PcProfessionExample();
- PcProfessionExample.Criteria proCia = proEmp.or();
- proCia.andParentProfessionIDNotEqualTo("");
- proCia.andProfessionNameEqualTo("其他");
- PcProfession proOther = pcProfessionMapper.selectByExample(proEmp).stream().findFirst().orElse(null);
- proEmp = new PcProfessionExample();
- proEmp.or().andParentProfessionIDEqualTo(proOther.getProfessionID()).andProfessionNameIsNotNull();
- //查询已存在的三级“其他”岗位
- List<PcProfession> proOtherSonList = pcProfessionMapper.selectByExample(proEmp);
- dataList.forEach(item -> {
- String errorInfo = "";
- item.setPostID(UUID.randomUUID().toString());
- item.setRecordStatus(1);
- if (stringUtils.IsNullOrEmpty(item.companyName))
- errorInfo += "请填写企业名称!";
- else {
- item.companyID = companyList.stream().filter(it -> it.getCompanyName().equals(item.getCompanyName().trim()))
- .findFirst().orElse(new PcCompany()).getCompanyID();
- if (item.companyID == null)
- errorInfo += "企业不存在!";
- }
- if (stringUtils.IsNullOrEmpty(item.professionName))
- errorInfo += "请填写岗位名称!";
- else {
- item.professionID = thirdLevelProfessionList.stream().filter(it -> it.getName() != null && it.getName().equals(item.getProfessionName().trim()))
- .findFirst().orElse(new SysDictionaryItem()).getCode();
- if (item.professionID == null || item.professionID == "") {
- // 如果岗位不存在,则在“其他”下添加一个
- if (proOther != null) {
- item.setProfessionID(UUID.randomUUID().toString());
- PcProfession proModel = new PcProfession();
- proModel.setProfessionID(item.getProfessionID());
- proModel.setParentProfessionID(proOther.getProfessionID());
- proModel.setProfessionName(item.getProfessionName());
- proModel.setStatus(Integer.parseInt("1"));
- proModel.setOrderNo(proOtherSonList.size() + 1);
- pcProfessionList.add(proModel);
- // 先将该岗位临时存储在第三级数据中,防止在最终添加之前,向pcProfessionList生成多个相同名称的岗位字典数据
- SysDictionaryItem dictionaryItem = new SysDictionaryItem();
- dictionaryItem.setCode(item.getProfessionID());
- dictionaryItem.setName(item.getProfessionName());
- thirdLevelProfessionList.add(dictionaryItem);
- }
- }
- }
- if (stringUtils.IsNullOrEmpty(item.getWorkCategoryName())) {
- errorInfo += "请填写工种名称";
- } else {
- item.workCode = WorkCategoryList.stream().filter(it -> it.getName() != null && it.getName().equals(item.getWorkCategoryName().trim()))
- .findFirst().orElse(new SysDictionaryItem()).getCode();
- if (item.workCode == null || item.workCode == "") {
- errorInfo += "工种不存在!";
- }else{
- item.workName = item.getWorkCategoryName();
- }
- }
- if (stringUtils.IsNullOrEmpty(String.valueOf(item.recruitCountStr)))
- errorInfo += "请填写招聘人数!";
- else{
- if(!isPositiveInteger(item.recruitCountStr)){
- errorInfo += "招聘人数必须为一个正整数!";
- }else{
- item.setRecruitCount(Integer.valueOf(item.recruitCountStr));
- }
- }
- if (stringUtils.IsNullOrEmpty(String.valueOf(item.startTime)) || item.startTime == null)
- errorInfo += "请填写开始日期!";
- if (stringUtils.IsNullOrEmpty(String.valueOf(item.startTime)) || item.startTime == null)
- errorInfo += "请填写结束日期!";
- if (stringUtils.IsNullOrEmpty(item.jobPlace))
- errorInfo += "请填写工作地点!";
- if (!stringUtils.IsNullOrEmpty(item.getWorkYearName())) {
- item.workYear = dicWorkYearDataList.stream().filter(it -> it.getName() != null && it.getName().equals(item.getWorkYearName().trim()))
- .findFirst().orElse(new SysDictionaryItem()).getValue();
- if (item.workYear == null)
- errorInfo += "工作年限不存在!";
- }
- if (item.isTrailName.trim().equals("是")) item.isTrail = true;
- else if (item.isTrailName.trim().equals("否")) item.isTrail = false;
- if (!stringUtils.IsNullOrEmpty(item.cultureLevelName)) {
- item.cultureRank = dicCultureDataList.stream().filter(it -> it.getName() != null && it.getName().equals(item.cultureLevelName.trim()))
- .findFirst().orElse(new SysDictionaryItem()).getValue();
- if (item.cultureRank == null || item.cultureRank == 0)
- errorInfo += "输入的学历要求不存在!";
- }
- if (!stringUtils.IsNullOrEmpty(item.getContactMobile())) {
- if (!regexUtils.theMobileIsValid( item.contactMobile,true)) {
- errorInfo += "输入的联系人电话格式不正确";
- }
- }
- if (!stringUtils.IsNullOrEmpty(item.getCompanyEmail())) {
- if (!regexUtils.theEmailIsValid(item.contactEmail)) {
- errorInfo += "输入的邮箱格式不正确";
- }
- }
- if (stringUtils.IsNullOrEmpty(errorInfo)) {
- resultList.add(item);
- } else {
- item.setErrorMessage(errorInfo);
- }
- });
- if (dataList.stream().filter(it -> !stringUtils.IsNullOrEmpty(it.errorMessage)).collect(Collectors.toList()).size() > 0)
- return dataList;
- resultList.forEach(item -> {
- save(item, userID);
- });
- // 添加岗位名称字典
- pcProfessionList.forEach(item -> {
- pcProfessionMapper.insert(item);
- });
- return null;
- }
- /**
- * 企业数据可视化地图页面获取岗位
- *
- * @param companyID 企业ID
- * @return 岗位信息
- */
- @Override
- public PageInfo<PostVo> selectCompanyMapPostList(int pageIndex, int pageSize, String companyID) {
- PageHelper.startPage(pageIndex, pageSize);
- List<PostVo> postVos = postCQuery.selectCompanyMapPostList(companyID);
- PageInfo<PostVo> result = new PageInfo(postVos);
- return result;
- }
- }
|