PostServiceImpl.java 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. package com.hz.employmentsite.services.impl.companyService;
  2. import com.github.pagehelper.PageHelper;
  3. import com.github.pagehelper.PageInfo;
  4. import com.hz.employmentsite.filter.exception.BaseException;
  5. import com.hz.employmentsite.mapper.*;
  6. import com.hz.employmentsite.mapper.cquery.LabelCQuery;
  7. import com.hz.employmentsite.mapper.cquery.PostCQuery;
  8. import com.hz.employmentsite.mapper.cquery.RecommendMgtCQuery;
  9. import com.hz.employmentsite.model.*;
  10. import com.hz.employmentsite.services.service.companyService.PostService;
  11. import com.hz.employmentsite.services.service.system.DictionaryService;
  12. import com.hz.employmentsite.util.RegexUtils;
  13. import com.hz.employmentsite.util.StringUtils;
  14. import com.hz.employmentsite.vo.companyService.PostVo;
  15. import com.hz.employmentsite.vo.companyService.RecommendPostVo;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.stereotype.Service;
  18. import java.util.*;
  19. import java.util.stream.Collectors;
  20. @Service("PostService")
  21. public class PostServiceImpl implements PostService {
  22. @Autowired
  23. private PostCQuery postCQuery;
  24. @Autowired
  25. private StringUtils stringUtils;
  26. @Autowired
  27. private RegexUtils regexUtils;
  28. @Autowired
  29. private PcPostMapper pcPostMapper;
  30. @Autowired
  31. private PcRecommendMapper pcRecommendMapper;
  32. @Autowired
  33. private PcRecommendMgtMapper pcRecommendMgtMapper;
  34. @Autowired
  35. private PcProfessionMapper pcProfessionMapper;
  36. @Autowired
  37. private PcCompanyMapper companyMapper;
  38. @Autowired
  39. private PcSiteUserMapper pcSiteUserMapper;
  40. @Autowired
  41. private DictionaryService dictionaryService;
  42. @Autowired
  43. private PcLabelPostMapper pcLabelPostMapper;
  44. @Autowired
  45. private LabelCQuery labelCQuery;
  46. @Autowired
  47. private PcWorkcategoryMapper pcWorkcategoryMapper;
  48. @Override
  49. public PageInfo<PostVo> getList(Integer page, Integer rows, List<String> postIDList,
  50. String professionName, Integer minCount, Integer maxCount,
  51. String companyName, String recordStatus, String companyID,
  52. String loginUserID, String siteID, Date startDate,
  53. Date endDate) {
  54. List<String> curLoginUserSiteCompanyIDs = new ArrayList<>();
  55. if (!stringUtils.IsNullOrEmpty(loginUserID)) {
  56. PcSiteUserExample siteUserExp = new PcSiteUserExample();
  57. siteUserExp.or().andUserIDEqualTo(loginUserID);
  58. var curLoginUserSiteID = pcSiteUserMapper.selectByExample(siteUserExp).get(0).getSiteID();
  59. PcCompanyExample companyExp = new PcCompanyExample();
  60. companyExp.or().andSiteIDEqualTo(curLoginUserSiteID);
  61. var curLoginUserSiteCompanyList = companyMapper.selectByExample(companyExp).stream().toList();
  62. for (PcCompany curLoginUserSiteCompany : curLoginUserSiteCompanyList) {
  63. curLoginUserSiteCompanyIDs.add(curLoginUserSiteCompany.getCompanyID());
  64. }
  65. }
  66. PageHelper.startPage(page, rows);
  67. List<PostVo> list = postCQuery.selectPostList(stringUtils.ListToInSql(postIDList), professionName, minCount, maxCount, companyName, recordStatus, companyID, stringUtils.ListToInSql(curLoginUserSiteCompanyIDs), siteID, startDate, endDate);
  68. if(list != null && list.size()>0){
  69. for(PostVo curPost : list){
  70. curPost.listLabel = labelCQuery.getPostLabelList(curPost.getPostID());
  71. var curPcPost = pcPostMapper.selectByPrimaryKey(curPost.getPostID());
  72. if (!stringUtils.IsNullOrEmpty(curPost.professionID)&&stringUtils.IsNullOrEmpty(curPost.postName)){
  73. PcProfessionExample professionExp = new PcProfessionExample();
  74. professionExp.or().andProfessionIDEqualTo(curPost.professionID);
  75. var curProfession = pcProfessionMapper.selectByExample(professionExp).stream().findFirst().orElse(null);
  76. if( curProfession!=null){
  77. curPcPost.setPostName(curProfession.getProfessionName());
  78. pcPostMapper.updateByPrimaryKey(curPcPost);
  79. }
  80. }
  81. if (!stringUtils.IsNullOrEmpty(curPost.workCode)&&stringUtils.IsNullOrEmpty(curPost.workName)){
  82. PcWorkcategoryExample workCategoryExp = new PcWorkcategoryExample();
  83. workCategoryExp.or().andWorkCategoryIDEqualTo(curPost.workCode);
  84. var curWorkCategory = pcWorkcategoryMapper.selectByExample(workCategoryExp).stream().findFirst().orElse(null);
  85. if( curWorkCategory!=null){
  86. curPcPost.setWorkName(curWorkCategory.getWorkCategoryName());
  87. pcPostMapper.updateByPrimaryKey(curPcPost);
  88. }
  89. }
  90. if (curPost.endTime != null && curPost.endTime.before(new Date()) && curPost.recordStatus.equals(1)) {
  91. curPcPost.setRecordStatus(0);
  92. pcPostMapper.updateByPrimaryKey(curPcPost);
  93. }
  94. }
  95. }
  96. PageInfo<PostVo> result = new PageInfo(list);
  97. return result;
  98. }
  99. @Override
  100. public PageInfo<RecommendPostVo> getCommendPostList(Integer page, Integer rows, String jobUserID) {
  101. PageHelper.startPage(page, rows);
  102. List<RecommendPostVo> list = postCQuery.selectRecommendPostList(jobUserID);
  103. PageInfo<RecommendPostVo> result = new PageInfo(list);
  104. return result;
  105. }
  106. @Override
  107. public Integer saveCommendPost(RecommendPostVo data, String userId) {
  108. int result = 0;
  109. PcRecommend dbData = null;
  110. if (data.recommendID != null) {
  111. PcRecommendExample exp = new PcRecommendExample();
  112. PcRecommendExample.Criteria cro = exp.createCriteria();
  113. cro.andPostIDEqualTo(data.recommendID);
  114. dbData = pcRecommendMapper.selectByExample(exp).stream().findFirst().orElse(null);
  115. }
  116. Boolean isExist = dbData != null;
  117. if (!isExist) {
  118. dbData = new PcRecommend();
  119. dbData.setRecommendID(UUID.randomUUID().toString());
  120. dbData.setJobuserID(data.jobUserID);
  121. dbData.setPostID(data.postID);
  122. dbData.setIsRead(data.isRead == null ? false : true);
  123. dbData.setIsSendnotes(data.isSendNotes == null ? false : true);
  124. dbData.setCreateTime(new Date());
  125. dbData.setCreateUserID(userId);
  126. result = pcRecommendMapper.insert(dbData);
  127. } else {
  128. dbData.setJobuserID(data.jobUserID);
  129. dbData.setPostID(data.postID);
  130. dbData.setIsRead(data.isRead == null ? false : true);
  131. dbData.setIsSendnotes(data.isSendNotes == null ? false : true);
  132. dbData.setModifyTime(new Date());
  133. dbData.setModifyUserID(userId);
  134. result = pcRecommendMapper.updateByPrimaryKeySelective(dbData);
  135. }
  136. return result;
  137. }
  138. @Override
  139. public int updatePostStatus(String postID, Integer status) {
  140. PcPost post = pcPostMapper.selectByPrimaryKey(postID);
  141. if(status.equals(1)&&post.getEndTime().before(new Date())){
  142. throw new BaseException("","该岗位招聘日期已结束,不能启用!");
  143. }
  144. post.setRecordStatus(status);
  145. return pcPostMapper.updateByPrimaryKey(post);
  146. }
  147. @Override
  148. public int save(PostVo data, String userId) {
  149. int result = 0;
  150. PcPost dbData = null;
  151. Boolean isExist = data.getPostID() != null;
  152. PcPostExample exp = new PcPostExample();
  153. PcPostExample.Criteria cro = exp.createCriteria();
  154. if (isExist) {
  155. cro.andPostIDEqualTo(data.getPostID());
  156. dbData = pcPostMapper.selectByExample(exp).stream().findFirst().orElse(null);
  157. }
  158. //判断岗位id是否为空
  159. if (stringUtils.IsNullOrEmpty(data.getProfessionID())) {
  160. PcProfessionExample proEmp = new PcProfessionExample();
  161. PcProfessionExample.Criteria proCia = proEmp.or();
  162. proCia.andParentProfessionIDNotEqualTo("");
  163. proCia.andProfessionNameEqualTo("其他");
  164. //获取二级其他信息
  165. PcProfession proOther = pcProfessionMapper.selectByExample(proEmp).stream().findFirst().orElse(null);
  166. if (proOther != null) {
  167. proEmp = new PcProfessionExample();
  168. proEmp.or().andParentProfessionIDEqualTo(proOther.getProfessionID()).andProfessionNameIsNotNull();
  169. // proCia.andProfessionNameEqualTo(data.getProfessionName());
  170. //查询其他岗位
  171. List<PcProfession> proOtherSonList = pcProfessionMapper.selectByExample(proEmp);
  172. PcProfession proOtherSon = proOtherSonList.stream()
  173. .filter(x -> x.getProfessionName().equals(data.getProfessionName())).findFirst().orElse(null);
  174. if (proOtherSon != null) {
  175. data.setProfessionID(proOtherSon.getProfessionID());
  176. } else {
  177. data.setProfessionID(UUID.randomUUID().toString());
  178. PcProfession proModel = new PcProfession();
  179. proModel.setProfessionID(data.getProfessionID());
  180. proModel.setParentProfessionID(proOther.getProfessionID());
  181. proModel.setProfessionName(data.getProfessionName());
  182. proModel.setStatus(Integer.parseInt("1"));
  183. proModel.setOrderNo(proOtherSonList.size() + 1);
  184. pcProfessionMapper.insert(proModel);
  185. }
  186. }
  187. }
  188. if (dbData == null) {
  189. dbData = new PcPost();
  190. dbData.setPostID(UUID.randomUUID().toString());
  191. dbData.setProfessionID(data.getProfessionID());
  192. dbData.setWorkCode(data.getWorkCode());
  193. dbData.setWorkName(data.getWorkName());
  194. dbData.setValidTime(data.getValidTime());
  195. dbData.setRecruitCount(data.getRecruitCount());
  196. dbData.setCompanyID(data.getCompanyID());
  197. dbData.setPostName(data.getPostName());
  198. dbData.setRecordStatus(data.getRecordStatus());
  199. dbData.setWorkNature(data.getWorkNature());
  200. dbData.setValidDay(data.getValidDay());
  201. dbData.setWorkYear(data.getWorkYear());
  202. dbData.setWorkNature(data.getWorkNature());
  203. dbData.setCultureRank(data.getCultureRank());
  204. dbData.setPostDesc(data.getPostDesc());
  205. dbData.setMaxSalary(data.getMaxSalary());
  206. dbData.setMinSalary(data.getMinSalary());
  207. dbData.setWelfare(data.getWelfare());
  208. dbData.setUserName(data.getUserName());
  209. dbData.setUserMobile(data.getUserMobile());
  210. dbData.setPostEmail(data.getPostEmail());
  211. dbData.setWorkTime(data.getWorkTime());
  212. dbData.setIsTrail(data.getIsTrail());
  213. dbData.setTrailMonths(data.getTrailMonths());
  214. dbData.setTrailMaxSalary(data.getTrailMaxSalary());
  215. dbData.setTrailMinSalary(data.getTrailMinSalary());
  216. dbData.setCreateTime(new Date());
  217. dbData.setCreateUserID(userId);
  218. dbData.setJobPlace(data.getJobPlace());
  219. dbData.setStartTime(data.getStartTime());
  220. dbData.setEndTime(data.getEndTime());
  221. dbData.setContactName(data.getContactName());
  222. dbData.setContactMobile(data.getContactMobile());
  223. dbData.setContactEmail(data.getContactEmail());
  224. dbData.setWorkNatureID(data.getWorkNatureID());
  225. // dbData.setTagID(data.getTagID());
  226. result = pcPostMapper.insert(dbData);
  227. } else {
  228. dbData.setProfessionID(data.getProfessionID());
  229. dbData.setWorkCode(data.getWorkCode());
  230. dbData.setValidTime(data.getValidTime());
  231. dbData.setWorkName(data.getWorkName());
  232. dbData.setRecruitCount(data.getRecruitCount());
  233. dbData.setCompanyID(data.getCompanyID());
  234. dbData.setPostName(data.getPostName());
  235. dbData.setRecordStatus(data.getRecordStatus());
  236. dbData.setWorkNature(data.getWorkNature());
  237. dbData.setValidDay(data.getValidDay());
  238. dbData.setWorkYear(data.getWorkYear());
  239. dbData.setWorkNature(data.getWorkNature());
  240. dbData.setCultureRank(data.getCultureRank());
  241. dbData.setPostDesc(data.getPostDesc());
  242. dbData.setMaxSalary(data.getMaxSalary());
  243. dbData.setMinSalary(data.getMinSalary());
  244. dbData.setWelfare(data.getWelfare());
  245. dbData.setUserName(data.getUserName());
  246. dbData.setUserMobile(data.getUserMobile());
  247. dbData.setPostEmail(data.getPostEmail());
  248. dbData.setWorkTime(data.getWorkTime());
  249. dbData.setIsTrail(data.getIsTrail());
  250. dbData.setTrailMonths(data.getTrailMonths());
  251. dbData.setTrailMaxSalary(data.getTrailMaxSalary());
  252. dbData.setTrailMinSalary(data.getTrailMinSalary());
  253. dbData.setModifyTime(new Date());
  254. dbData.setModifyUserID(userId);
  255. dbData.setJobPlace(data.getJobPlace());
  256. dbData.setStartTime(data.getStartTime());
  257. dbData.setEndTime(data.getEndTime());
  258. dbData.setContactName(data.getContactName());
  259. dbData.setContactMobile(data.getContactMobile());
  260. dbData.setContactEmail(data.getContactEmail());
  261. dbData.setWorkNatureID(data.getWorkNatureID());
  262. // dbData.setTagID(data.getTagID());
  263. result = pcPostMapper.updateByPrimaryKeyWithBLOBs(dbData);
  264. }
  265. PcLabelPostExample labelEmp = new PcLabelPostExample();
  266. labelEmp.or().andPostIDEqualTo(data.getPostID());
  267. pcLabelPostMapper.deleteByExample(labelEmp);
  268. if (data.listLabel != null && data.listLabel.size() > 0) {
  269. data.listLabel.forEach(x -> {
  270. PcLabelPost labelModel = new PcLabelPost();
  271. labelModel.setPostID(data.getPostID());
  272. labelModel.setLabelID(x.getLabelID());
  273. pcLabelPostMapper.insert(labelModel);
  274. });
  275. }
  276. return result;
  277. }
  278. @Override
  279. public int delete(List<String> ids) {
  280. int result = 0;
  281. PcPostExample postExp = new PcPostExample();
  282. postExp.or().andPostIDIn(ids);
  283. result = pcPostMapper.deleteByExample(postExp);
  284. if (result > 0) {
  285. PcLabelPostExample labelEmp = new PcLabelPostExample();
  286. labelEmp.or().andPostIDIn(ids);
  287. pcLabelPostMapper.deleteByExample(labelEmp);
  288. }
  289. return result;
  290. }
  291. @Override
  292. public int deletePostAndRecommendMgt(String id) {
  293. try {
  294. PcRecommendMgtExample exp = new PcRecommendMgtExample();
  295. PcRecommendMgtExample.Criteria cro = exp.or();
  296. cro.andPostIDEqualTo(id);
  297. pcRecommendMgtMapper.deleteByExample(exp);
  298. PcLabelPostExample labelEmp = new PcLabelPostExample();
  299. labelEmp.or().andPostIDEqualTo(id);
  300. pcLabelPostMapper.deleteByExample(labelEmp);
  301. return pcPostMapper.deleteByPrimaryKey(id);
  302. } catch (Exception e) {
  303. e.printStackTrace();
  304. return 0;
  305. }
  306. }
  307. @Override
  308. public PostVo getDataById(String id) {
  309. if (stringUtils.IsNullOrEmpty(id)) {
  310. return null;
  311. }
  312. PostVo data = postCQuery.selectPostList(stringUtils.ListToInSql(Arrays.asList(id)), null, null, null, null, null, null, null, null, null, null).stream().findFirst().orElse(null);
  313. if (data != null) {
  314. data.listLabel = labelCQuery.getPostLabelList(id);
  315. }
  316. return data;
  317. }
  318. @Override
  319. public List<PostVo> getDataListByCompanyID(String companyId) {
  320. List<PostVo> resultList = new ArrayList<>();
  321. PcPostExample postExp = new PcPostExample();
  322. postExp.or().andCompanyIDEqualTo(companyId);
  323. var postList = pcPostMapper.selectByExample(postExp);
  324. for (PcPost curPost : postList) {
  325. PostVo item = new PostVo();
  326. item.setPostID(curPost.getPostID());
  327. item.setProfessionID(curPost.getProfessionID());
  328. PcProfessionExample professionExp = new PcProfessionExample();
  329. professionExp.or().andProfessionIDEqualTo(curPost.getProfessionID());
  330. var curProfession = pcProfessionMapper.selectByExample(professionExp).get(0);
  331. item.setProfessionName(curProfession.getProfessionName());
  332. item.setCompanyID(curPost.getCompanyID());
  333. item.setRecruitCount(curPost.getRecruitCount());
  334. item.setStartTime(curPost.getStartTime());
  335. item.setEndTime(curPost.getEndTime());
  336. resultList.add(item);
  337. }
  338. return resultList;
  339. }
  340. @Override
  341. public List<PostVo> importPost(List<PostVo> dataList, String userID) {
  342. if (dataList.size() <= 0)
  343. throw new BaseException("", "请添加导入数据!");
  344. //所属企业
  345. PcCompanyExample companyExp = new PcCompanyExample();
  346. companyExp.or().andRecordStatusEqualTo(1);
  347. List<PcCompany> companyList = companyMapper.selectByExample(companyExp);
  348. //岗位信息
  349. List<SysDictionaryItem> thirdLevelProfessionList = new ArrayList<>();
  350. PcProfessionExample professionExp = new PcProfessionExample();
  351. professionExp.or().andParentProfessionIDEqualTo("").andStatusEqualTo(1);
  352. var firstLevelData = pcProfessionMapper.selectByExample(professionExp);
  353. for (PcProfession curProfession : firstLevelData) {
  354. professionExp = new PcProfessionExample();
  355. professionExp.or().andParentProfessionIDEqualTo(curProfession.getProfessionID()).andStatusEqualTo(1);
  356. var secondLevelData = pcProfessionMapper.selectByExample(professionExp);
  357. for (PcProfession curParentProfession : secondLevelData) {
  358. professionExp = new PcProfessionExample();
  359. professionExp.or().andParentProfessionIDEqualTo(curParentProfession.getProfessionID()).andStatusEqualTo(1).andProfessionNameIsNotNull();
  360. var thirdLevelData = pcProfessionMapper.selectByExample(professionExp);
  361. for (PcProfession curItem : thirdLevelData) {
  362. SysDictionaryItem item = new SysDictionaryItem();
  363. item.setCode(curItem.getProfessionID());
  364. item.setName(curItem.getProfessionName());
  365. thirdLevelProfessionList.add(item);
  366. }
  367. }
  368. }
  369. // 工种信息
  370. List<SysDictionaryItem> WorkCategoryList = new ArrayList<>();
  371. // 获取第一级工种
  372. PcWorkcategoryExample workCategoryExample = new PcWorkcategoryExample();
  373. workCategoryExample.or().andParentWorkCategoryIDEqualTo("").andStatusEqualTo(1);
  374. List<PcWorkcategory> firstLevelWorkCategoryList = pcWorkcategoryMapper.selectByExample(workCategoryExample);
  375. for (PcWorkcategory pcWorkcategory : firstLevelWorkCategoryList) {
  376. // 获取第二级工种
  377. workCategoryExample = new PcWorkcategoryExample();
  378. workCategoryExample.or().andParentWorkCategoryIDEqualTo(pcWorkcategory.getWorkCategoryID()).andStatusEqualTo(1);
  379. List<PcWorkcategory> secondLevelWorkCategoryList = pcWorkcategoryMapper.selectByExample(workCategoryExample);
  380. for (PcWorkcategory workCategory : secondLevelWorkCategoryList) {
  381. // 获取第三级工种
  382. workCategoryExample = new PcWorkcategoryExample();
  383. workCategoryExample.or().andParentWorkCategoryIDEqualTo(workCategory.getWorkCategoryID()).andStatusEqualTo(1);
  384. List<PcWorkcategory> thirdLevelWorkCategoryList = pcWorkcategoryMapper.selectByExample(workCategoryExample);
  385. for (PcWorkcategory pcWorkCategory1 : thirdLevelWorkCategoryList) {
  386. SysDictionaryItem item = new SysDictionaryItem();
  387. item.setCode(pcWorkCategory1.getWorkCategoryID());
  388. item.setName(pcWorkCategory1.getWorkCategoryName());
  389. WorkCategoryList.add(item);
  390. }
  391. }
  392. }
  393. //文化程度
  394. List<SysDictionaryItem> dicCultureDataList = dictionaryService.getDictionaryItemList("CultureLevel");
  395. // 工作年限
  396. List<SysDictionaryItem> dicWorkYearDataList = dictionaryService.getDictionaryItemList("WorkYearType");
  397. // 最终处理数据
  398. List<PostVo> resultList = new ArrayList<>(); // 岗位
  399. List<PcProfession> pcProfessionList = new ArrayList<>(); // 岗位字典
  400. // 获取二级的“其他”岗位
  401. PcProfessionExample proEmp = new PcProfessionExample();
  402. PcProfessionExample.Criteria proCia = proEmp.or();
  403. proCia.andParentProfessionIDNotEqualTo("");
  404. proCia.andProfessionNameEqualTo("其他");
  405. PcProfession proOther = pcProfessionMapper.selectByExample(proEmp).stream().findFirst().orElse(null);
  406. proEmp = new PcProfessionExample();
  407. proEmp.or().andParentProfessionIDEqualTo(proOther.getProfessionID()).andProfessionNameIsNotNull();
  408. //查询已存在的三级“其他”岗位
  409. List<PcProfession> proOtherSonList = pcProfessionMapper.selectByExample(proEmp);
  410. dataList.forEach(item -> {
  411. String errorInfo = "";
  412. item.setPostID(UUID.randomUUID().toString());
  413. item.setRecordStatus(1);
  414. if (stringUtils.IsNullOrEmpty(item.companyName))
  415. errorInfo += "请填写企业名称!";
  416. else {
  417. item.companyID = companyList.stream().filter(it -> it.getCompanyName().equals(item.getCompanyName().trim()))
  418. .findFirst().orElse(new PcCompany()).getCompanyID();
  419. if (item.companyID == null)
  420. errorInfo += "企业不存在!";
  421. }
  422. if (stringUtils.IsNullOrEmpty(item.professionName))
  423. errorInfo += "请填写岗位名称!";
  424. else {
  425. item.professionID = thirdLevelProfessionList.stream().filter(it -> it.getName() != null && it.getName().equals(item.getProfessionName().trim()))
  426. .findFirst().orElse(new SysDictionaryItem()).getCode();
  427. if (item.professionID == null || item.professionID == "") {
  428. // 如果岗位不存在,则在“其他”下添加一个
  429. if (proOther != null) {
  430. item.setProfessionID(UUID.randomUUID().toString());
  431. PcProfession proModel = new PcProfession();
  432. proModel.setProfessionID(item.getProfessionID());
  433. proModel.setParentProfessionID(proOther.getProfessionID());
  434. proModel.setProfessionName(item.getProfessionName());
  435. proModel.setStatus(Integer.parseInt("1"));
  436. proModel.setOrderNo(proOtherSonList.size() + 1);
  437. pcProfessionList.add(proModel);
  438. // 先将该岗位临时存储在第三级数据中,防止在最终添加之前,向pcProfessionList生成多个相同名称的岗位字典数据
  439. SysDictionaryItem dictionaryItem = new SysDictionaryItem();
  440. dictionaryItem.setCode(item.getProfessionID());
  441. dictionaryItem.setName(item.getProfessionName());
  442. thirdLevelProfessionList.add(dictionaryItem);
  443. }
  444. }
  445. }
  446. if (stringUtils.IsNullOrEmpty(item.getWorkCategoryName())) {
  447. errorInfo += "请填写工种名称";
  448. } else {
  449. item.workCode = WorkCategoryList.stream().filter(it -> it.getName() != null && it.getName().equals(item.getWorkCategoryName().trim()))
  450. .findFirst().orElse(new SysDictionaryItem()).getCode();
  451. if (item.workCode == null || item.workCode == "") {
  452. errorInfo += "工种不存在!";
  453. }
  454. }
  455. if (stringUtils.IsNullOrEmpty(String.valueOf(item.recruitCount)) || item.recruitCount == null)
  456. errorInfo += "请填写招聘人数!";
  457. if (stringUtils.IsNullOrEmpty(String.valueOf(item.startTime)) || item.startTime == null)
  458. errorInfo += "请填写开始日期!";
  459. if (stringUtils.IsNullOrEmpty(String.valueOf(item.startTime)) || item.startTime == null)
  460. errorInfo += "请填写结束日期!";
  461. if (stringUtils.IsNullOrEmpty(item.jobPlace))
  462. errorInfo += "请填写工作地点!";
  463. if (!stringUtils.IsNullOrEmpty(item.getWorkYearName())) {
  464. item.workYear = dicWorkYearDataList.stream().filter(it -> it.getName() != null && it.getName().equals(item.getWorkYearName().trim()))
  465. .findFirst().orElse(new SysDictionaryItem()).getValue();
  466. if (item.workYear == null)
  467. errorInfo += "工作年限不存在!";
  468. }
  469. if (item.isTrailName.trim().equals("是")) item.isTrail = true;
  470. else if (item.isTrailName.trim().equals("否")) item.isTrail = false;
  471. if (!stringUtils.IsNullOrEmpty(item.cultureLevelName)) {
  472. item.cultureRank = dicCultureDataList.stream().filter(it -> it.getName() != null && it.getName().equals(item.cultureLevelName.trim()))
  473. .findFirst().orElse(new SysDictionaryItem()).getValue();
  474. if (item.cultureRank == null || item.cultureRank == 0)
  475. errorInfo += "输入的学历要求不存在!";
  476. }
  477. if (!stringUtils.IsNullOrEmpty(item.getContactMobile())) {
  478. if (!regexUtils.theMobileIsValid( item.contactMobile,true)) {
  479. errorInfo += "输入的联系人电话格式不正确";
  480. }
  481. }
  482. if (!stringUtils.IsNullOrEmpty(item.getCompanyEmail())) {
  483. if (!regexUtils.theEmailIsValid(item.contactEmail)) {
  484. errorInfo += "输入的邮箱格式不正确";
  485. }
  486. }
  487. if (stringUtils.IsNullOrEmpty(errorInfo)) {
  488. resultList.add(item);
  489. } else {
  490. item.setErrorMessage(errorInfo);
  491. }
  492. });
  493. if (dataList.stream().filter(it -> !stringUtils.IsNullOrEmpty(it.errorMessage)).collect(Collectors.toList()).size() > 0)
  494. return dataList;
  495. resultList.forEach(item -> {
  496. save(item, userID);
  497. });
  498. // 添加岗位名称字典
  499. pcProfessionList.forEach(item -> {
  500. pcProfessionMapper.insert(item);
  501. });
  502. return null;
  503. }
  504. /**
  505. * 企业数据可视化地图页面获取岗位
  506. *
  507. * @param companyID 企业ID
  508. * @return 岗位信息
  509. */
  510. @Override
  511. public PageInfo<PostVo> selectCompanyMapPostList(int pageIndex, int pageSize, String companyID) {
  512. PageHelper.startPage(pageIndex, pageSize);
  513. List<PostVo> postVos = postCQuery.selectCompanyMapPostList(companyID);
  514. PageInfo<PostVo> result = new PageInfo(postVos);
  515. return result;
  516. }
  517. }