JobUserServiceImpl.java 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036
  1. package com.hz.employmentsite.services.impl.jobUserManager;
  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.JobHuntCQuery;
  7. import com.hz.employmentsite.mapper.cquery.JobUserCQuery;
  8. import com.hz.employmentsite.mapper.cquery.JobUserServiceCQuery;
  9. import com.hz.employmentsite.mapper.cquery.LabelCQuery;
  10. import com.hz.employmentsite.model.*;
  11. import com.hz.employmentsite.services.impl.system.CityAreaImpl;
  12. import com.hz.employmentsite.services.service.AccountService;
  13. import com.hz.employmentsite.services.service.jobUserManager.HonorService;
  14. import com.hz.employmentsite.services.service.jobUserManager.JobUserService;
  15. import com.hz.employmentsite.services.service.jobUserManager.JobUserServiceService;
  16. import com.hz.employmentsite.services.service.system.DictionaryService;
  17. import com.hz.employmentsite.util.*;
  18. import com.hz.employmentsite.util.ip.IpUtils;
  19. import com.hz.employmentsite.vo.dataMap.JobUserMapVo;
  20. import com.hz.employmentsite.vo.jobUserManager.ClaimJobUserVo;
  21. import com.hz.employmentsite.vo.jobUserManager.JobHuntVo;
  22. import com.hz.employmentsite.vo.jobUserManager.JobUserServiceVo;
  23. import com.hz.employmentsite.vo.jobUserManager.JobUserVo;
  24. import org.springframework.beans.factory.annotation.Autowired;
  25. import org.springframework.stereotype.Service;
  26. import javax.servlet.http.HttpServletRequest;
  27. import java.text.ParseException;
  28. import java.text.SimpleDateFormat;
  29. import java.util.*;
  30. import java.util.stream.Collectors;
  31. @Service("JobUserService")
  32. public class JobUserServiceImpl implements JobUserService {
  33. @Autowired
  34. private JobUserCQuery jobUserCQuery;
  35. @Autowired
  36. private StringUtils stringUtils;
  37. @Autowired
  38. private DateUtils dateUtils;
  39. @Autowired
  40. private DesUtils desUtils;
  41. @Autowired
  42. private CalculateUtils calculateUtils;
  43. @Autowired
  44. private RegexUtils regexUtils;
  45. @Autowired
  46. private DictionaryService dictionaryService;
  47. @Autowired
  48. private PcEducationMapper pcEducationMapper;
  49. @Autowired
  50. private PcJobuserMapper pcJobuserMapper;
  51. @Autowired
  52. private PcExperienceMapper pcExperienceMapper;
  53. @Autowired
  54. private PcJobhuntMapper pcJobhuntMapper;
  55. @Autowired
  56. private PcPostMapper pcPostMapper;
  57. @Autowired
  58. private PcSiteUserMapper pcSiteUserMapper;
  59. @Autowired
  60. private PcSiteMapper pcSiteMapper;
  61. @Autowired
  62. private PcLabelJobuserMapper pcLabelJobuserMapper;
  63. @Autowired
  64. private PcOccupationalMapper pcOccupationalMapper;
  65. @Autowired
  66. private AreaCodeMapper areaCodeMapper;
  67. @Autowired
  68. private LabelCQuery labelCQuery;
  69. @Autowired
  70. private JobHuntCQuery jobHuntCQuery;
  71. @Autowired
  72. private JobUserServiceService jobUserServiceService;
  73. @Autowired
  74. private JobUserServiceCQuery jobUserServiceCQuery;
  75. @Autowired
  76. private AccountService accountService;
  77. @Autowired
  78. private SysLogMapper sysLogMapper;
  79. @Autowired
  80. private CityAreaImpl cityAreaImpl;
  81. @Autowired
  82. private HonorService honorService;
  83. @Autowired
  84. private PcSigninMapper pcSigninMapper;
  85. @Override
  86. public PageInfo<JobUserVo> getList(Integer pageIndex, Integer pageSize,
  87. List<String> jobUserIDList, String name,
  88. String siteId, String jobStatus,
  89. Integer sexId, Integer educationTypeId,
  90. Integer emphasisTypeId, String createUserId,
  91. String workTime, String loginUserID,
  92. String regionCode, Date startDate,
  93. Date endDate, String createUserName) {
  94. String curLoginUserSiteID = "";
  95. if (!stringUtils.IsNullOrEmpty(loginUserID)) {
  96. PcSiteUserExample siteUserExp = new PcSiteUserExample();
  97. siteUserExp.or().andUserIDEqualTo(loginUserID);
  98. curLoginUserSiteID = pcSiteUserMapper.selectByExample(siteUserExp).get(0).getSiteID();
  99. }
  100. PageHelper.startPage(pageIndex, pageSize);
  101. List<JobUserVo> list = jobUserCQuery.selectJobUserList(stringUtils.ListToInSql(jobUserIDList), name, siteId, jobStatus, sexId,
  102. educationTypeId, emphasisTypeId, createUserId, workTime,
  103. curLoginUserSiteID, regionCode, startDate, endDate, false,
  104. createUserName);
  105. // 信息脱敏
  106. list.forEach(item -> {
  107. item.setUserMobile(calculateUtils.maskMobile(desUtils.decoderText(item.getUserMobile())));
  108. String idNumber = desUtils.decoderText(item.getIdentityNumber());
  109. item.setIdentityNumber(idNumber);
  110. item.setAge(dateUtils.calculateAge(dateUtils.dateToStr(item.getBirthDay())));
  111. });
  112. PageInfo<JobUserVo> result = new PageInfo(list);
  113. return result;
  114. }
  115. @Override
  116. public PageInfo<JobUserVo> getDataList(Integer page, Integer rows,String jobUserName) {
  117. PageHelper.startPage(page,rows);
  118. List<JobUserVo> resultList = new ArrayList<>();
  119. List<JobUserVo> dataList = jobUserCQuery.getJobUserDataList(jobUserName);
  120. for (JobUserVo curDataBaseItem: dataList) {
  121. for(JobUserVo curJobUserItem : resultList){
  122. if(curJobUserItem.getName().equals(curDataBaseItem.getName())){
  123. PcJobuserExample jobuserExp = new PcJobuserExample();
  124. jobuserExp.or().andJobuserIDEqualTo(curJobUserItem.getJobUserID());
  125. var curJobUser = pcJobuserMapper.selectByExample(jobuserExp).get(0);
  126. curJobUserItem.setName(curJobUser.getName()+desUtils.decoderText(curJobUser.getUserMobile()).substring(7,11));
  127. curDataBaseItem.setName(curDataBaseItem.getName()+desUtils.decoderText(curDataBaseItem.getUserMobile()).substring(7,11));
  128. }
  129. }
  130. resultList.add(curDataBaseItem);
  131. }
  132. PageInfo<JobUserVo> result = new PageInfo(resultList);
  133. return result;
  134. //var dataList = getList(1, 99999, null, null, null, null, null, null, null, null, null, null, null, null, null).getList();
  135. //for (var item: dataList) {
  136. // SelectProps itemResult = new SelectProps();
  137. // itemResult.setText(item.getName());
  138. // itemResult.setValue(item.getJobUserID());
  139. // for(SelectProps curProp : dataResult){
  140. // if(curProp.getText().equals(item.getName())){
  141. // PcJobuserExample jobuserExp = new PcJobuserExample();
  142. // jobuserExp.or().andJobuserIDEqualTo(curProp.getValue());
  143. // var curJobUser = pcJobuserMapper.selectByExample(jobuserExp).get(0);
  144. // curProp.setText(curJobUser.getName()+desUtils.decoderText(curJobUser.getUserMobile()).substring(7,11));
  145. // itemResult.setText(item.getName()+item.getUserMobile().substring(7,11));
  146. // }
  147. // }
  148. // dataResult.add(itemResult);
  149. //}
  150. //return dataResult;
  151. }
  152. @Override
  153. public int setJobUserDes() {
  154. List<PcJobuser> list1 = jobUserCQuery.getJobUserIdentityNumber();
  155. if(list1.size()>0){
  156. for (var item: list1) {
  157. item.setIdentityNumber(desUtils.encoderText(item.getIdentityNumber()));
  158. pcJobuserMapper.updateByPrimaryKey(item);
  159. }
  160. }
  161. List<PcJobuser> list2 = jobUserCQuery.getJobUserUserMobile();
  162. if(list2.size()>0){
  163. for (var item: list2) {
  164. item.setUserMobile(desUtils.encoderText(item.getUserMobile()));
  165. pcJobuserMapper.updateByPrimaryKey(item);
  166. }
  167. }
  168. return list1.size() + list2.size();
  169. }
  170. @Override
  171. public JobUserVo getDataById(String id,boolean isAllJobUser) {
  172. if (stringUtils.IsNullOrEmpty(id)) {
  173. return null;
  174. }
  175. JobUserVo data = jobUserCQuery.selectJobUserList(stringUtils.ListToInSql(Arrays.asList(id)), null, null, null, null, null, null, null, null,null,null,null,null,isAllJobUser, null).stream().findFirst().orElse(null);
  176. if(data!=null){
  177. data.listLabel = labelCQuery.getUserLabelList(id);
  178. data.setAge(calculateUtils.calculateAge(desUtils.decoderText(data.getIdentityNumber())));
  179. }
  180. return data;
  181. }
  182. @Override
  183. public List<PcEducation> getJobUserEducationList(String jobuserID,boolean isAllJobUser) {
  184. PcEducationExample exp = new PcEducationExample();
  185. exp.setOrderByClause("SchoolTime DESC");
  186. exp.or().andJobuserIDEqualTo(jobuserID);
  187. if(isAllJobUser) exp.or().andJobuserIDEqualTo("AllJobUser");
  188. List<PcEducation> educationList = pcEducationMapper.selectByExample(exp);
  189. return educationList;
  190. }
  191. @Override
  192. public List<PcExperience> getJobUserExperienceList(String jobuserID,boolean isAllJobUser) {
  193. PcExperienceExample exp = new PcExperienceExample();
  194. exp.setOrderByClause("StartTime DESC");
  195. exp.or().andJobuserIDEqualTo(jobuserID);
  196. if(isAllJobUser) exp.or().andJobuserIDEqualTo("AllJobUser");
  197. List<PcExperience> experienceList = pcExperienceMapper.selectByExample(exp);
  198. return experienceList;
  199. }
  200. @Override
  201. public List<PcPost> getUserHuntList(String jobuserID) {
  202. PcJobhuntExample huntExp = new PcJobhuntExample();
  203. PcJobhuntExample.Criteria huntCro = huntExp.or();
  204. huntCro.andJobUserIDEqualTo(jobuserID);
  205. List<PcJobhunt> jobHuntList = pcJobhuntMapper.selectByExample(huntExp);
  206. List<String> professionIDList = new ArrayList<>();
  207. if (jobHuntList.size()>0){
  208. jobHuntList.stream().forEach(item->{
  209. professionIDList.add(item.getProfessionID());
  210. });
  211. PcPostExample postExp = new PcPostExample();
  212. PcPostExample.Criteria postCro = postExp.or();
  213. postCro.andPostIDIn(professionIDList);
  214. List<PcPost> curPostList = pcPostMapper.selectByExample(postExp);
  215. return curPostList;
  216. }else{
  217. return null;
  218. }
  219. }
  220. private int deleteEducation(List<String> ids) {
  221. int educationRows = 0;
  222. PcEducationExample expEducation = new PcEducationExample();
  223. PcEducationExample.Criteria croEducation = expEducation.or();
  224. croEducation.andJobuserIDIn(ids);
  225. educationRows = pcEducationMapper.deleteByExample(expEducation);
  226. return educationRows;
  227. }
  228. private int deleteExperience(List<String> ids) {
  229. int experienceRows = 0;
  230. PcExperienceExample expExperi = new PcExperienceExample();
  231. PcExperienceExample.Criteria croExperi = expExperi.or();
  232. croExperi.andJobuserIDIn(ids);
  233. experienceRows = pcExperienceMapper.deleteByExample(expExperi);
  234. return experienceRows;
  235. }
  236. @Override
  237. public int delete(HttpServletRequest request, List<String> ids) {
  238. deleteEducation(ids);
  239. deleteExperience(ids);
  240. int result = 0;
  241. String delInfo = "删除求职人员:";
  242. for(String curJobUserID: ids){
  243. PcJobhuntExample jobHuntExample = new PcJobhuntExample();
  244. jobHuntExample.or().andJobUserIDEqualTo(curJobUserID);
  245. var curJobUserHuntList = pcJobhuntMapper.selectByExample(jobHuntExample).stream().toList();
  246. if( curJobUserHuntList != null && curJobUserHuntList.size()>0){
  247. throw new BaseException("10004","所选求职人员已有关联的求职意向,不允许删除!");
  248. }
  249. PcSigninExample pcSigninExample = new PcSigninExample();
  250. pcSigninExample.or().andJobuserIDEqualTo(curJobUserID);
  251. List<PcSignin> pcSignins = pcSigninMapper.selectByExample(pcSigninExample).stream().toList();
  252. if (pcSignins != null && pcSignins.size() > 0) {
  253. throw new BaseException("10004","所选企业已有关联的外出工作走访记录信息,暂时无法删除!");
  254. }
  255. PcJobuser pcJobuser = pcJobuserMapper.selectByPrimaryKey(curJobUserID);
  256. int count = pcJobuserMapper.deleteByPrimaryKey(curJobUserID);
  257. if(count>0){
  258. // 记录被删除的求职人员信息
  259. delInfo += pcJobuser.getName() + ",";
  260. // 删除求职人员标签
  261. PcLabelJobuserExample labelEmp = new PcLabelJobuserExample();
  262. labelEmp.or().andJobuserIDEqualTo(curJobUserID);
  263. pcLabelJobuserMapper.deleteByExample(labelEmp);
  264. }
  265. result+=count;
  266. }
  267. if (result > 0) {
  268. SysLog sysLog = new SysLog();
  269. sysLog.setLogID(UUID.randomUUID().toString());
  270. sysLog.setPageName("求职人员信息管理");
  271. sysLog.setPageUrl("/jobusermgr/jobseeker/delete");
  272. sysLog.setActionName("删除求职人员");
  273. sysLog.setUserID(accountService.getLoginUserID());
  274. sysLog.setLogTime(new Date());
  275. sysLog.setIPAddress(IpUtils.getIpAddr(request));
  276. sysLog.setOperationData(delInfo.substring(0, delInfo.length() - 1)); // 注意移除最后一个,
  277. sysLogMapper.insert(sysLog);
  278. }
  279. return result;
  280. }
  281. @Override
  282. public int save(JobUserVo data, String userId) {
  283. int result = baseInfoSave(data,userId);
  284. if( result >= 1) {
  285. SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  286. List<String> ids = new ArrayList<>();
  287. ids.add(data.getJobUserID());
  288. deleteEducation(ids);
  289. deleteExperience(ids);
  290. honorService.deleteByJobUserID(data.getJobUserID());
  291. data.getJobEducation().stream().forEach(x -> {
  292. PcEducation education = new PcEducation();
  293. education.setEducationID(UUID.randomUUID().toString());
  294. education.setJobuserID(data.getJobUserID());
  295. education.setCultureRank(Integer.parseInt(x.get("cultureRank") + ""));
  296. education.setSchoolName(x.get("schoolName").toString());
  297. try {
  298. education.setSchoolTime(dateFormat.parse(x.get("schoolTime").toString()));
  299. education.setOverTime(dateFormat.parse(x.get("overTime").toString()));
  300. } catch (ParseException e) {
  301. e.printStackTrace();
  302. }
  303. education.setMajor(x.get("major").toString());
  304. education.setCreateTime(new Date());
  305. education.setCreateUserID(userId);
  306. pcEducationMapper.insert(education);
  307. });
  308. data.getJobExperience().stream().forEach(x -> {
  309. PcExperience experience = new PcExperience();
  310. experience.setExperienceID(UUID.randomUUID().toString());
  311. experience.setJobuserID(data.getJobUserID());
  312. try {
  313. experience.setStartTime(dateFormat.parse(x.get("startTime").toString()));
  314. experience.setEndTime(dateFormat.parse(x.get("endTime").toString()));
  315. } catch (ParseException e) {
  316. e.printStackTrace();
  317. }
  318. experience.setDuties(x.get("duties").toString());
  319. experience.setWorkAddress(x.get("workAddress").toString());
  320. experience.setCreateTime(new Date());
  321. experience.setCreateUserID(userId);
  322. pcExperienceMapper.insert(experience);
  323. });
  324. if (data.getJobHonorList() != null && !data.getJobHonorList().isEmpty()){
  325. data.getJobHonorList().stream().forEach(honor -> {
  326. honor.setHonorID(UUID.randomUUID().toString());
  327. honor.setJobUserID(data.getJobUserID());
  328. honor.setCreateTime(new Date());
  329. honor.setCreateUserID(userId);
  330. honorService.save(honor);
  331. });
  332. }
  333. }
  334. return result;
  335. }
  336. private String ifHadRepeatData(JobUserVo data, boolean isEdit,String curUserID){
  337. var result = 0;
  338. PcJobuserExample jobUserExp10 = new PcJobuserExample();
  339. PcJobuserExample.Criteria criteria = jobUserExp10.or();
  340. List<PcJobuser> selectByExample = new ArrayList<>();
  341. // 未填写身份证时不进行查询与判断
  342. if (!stringUtils.IsNullOrEmpty(data.getIdentityNumber())) {
  343. criteria.andIdentityNumberEqualTo(data.getIdentityNumber());
  344. criteria.andNameEqualTo(data.getName());
  345. criteria.andJobuserIDNotEqualTo(data.getJobUserID());
  346. selectByExample = pcJobuserMapper.selectByExample(jobUserExp10);
  347. }
  348. if(!selectByExample.isEmpty()){
  349. //系统存在与当前保存求职人员相同的姓名和身份证号码则判断是否前数据是否为惠州市就业驿站人员插入
  350. var repeatData = selectByExample.stream().findFirst().orElse(null);
  351. if(repeatData != null){
  352. PcSiteUserExample siteUserExp = new PcSiteUserExample();
  353. siteUserExp.or().andUserIDEqualTo(repeatData.getCreateUserID());
  354. var createSiteUserInfo= pcSiteUserMapper.selectByExample(siteUserExp).stream().findFirst().orElse(null);
  355. if( createSiteUserInfo!=null){
  356. PcSiteExample siteExp = new PcSiteExample();
  357. siteExp.or().andSiteIDEqualTo(createSiteUserInfo.getSiteID());
  358. var curSiteInfo= pcSiteMapper.selectByExample(siteExp).stream().findFirst().orElse(null);
  359. if( curSiteInfo != null){
  360. if(isEdit){
  361. if( curSiteInfo.getSiteID().equals("66fc1176-b8a1-4b9a-b2fc-9f590ceed342")||curSiteInfo.getSiteID().equals("0c037144-99c6-4e90-bf25-2c9cea8c7b7a")){
  362. repeatData.setSiteID(data.getSiteID());
  363. repeatData.setModifyTime(new Date());
  364. repeatData.setModifyUserID(curUserID);
  365. pcJobuserMapper.updateByPrimaryKey(repeatData);
  366. return "-1";
  367. }else{
  368. throw new BaseException("1004","该求职人员已被"+curSiteInfo.getSiteName()+",工号"+createSiteUserInfo.getUserNo()+"录入!");
  369. }
  370. }
  371. return "该求职人员已被"+ curSiteInfo.getSiteName()+",工号"+createSiteUserInfo.getUserNo()+"录入!";
  372. }
  373. }
  374. }
  375. }
  376. else{
  377. boolean ifRepeatIdentity = false;
  378. if (!stringUtils.IsNullOrEmpty(data.getIdentityNumber())){
  379. PcJobuserExample jobUserExp1 = new PcJobuserExample();
  380. jobUserExp1.or().andIdentityNumberEqualTo(data.getIdentityNumber()).andJobuserIDNotEqualTo(data.getJobUserID());
  381. ifRepeatIdentity = pcJobuserMapper.selectByExample(jobUserExp1).size()>0;
  382. }
  383. PcJobuserExample jobUserExp2 = new PcJobuserExample();
  384. jobUserExp2.or().andUserMobileEqualTo(data.getUserMobile()).andJobuserIDNotEqualTo(data.getJobUserID());
  385. var ifRepeatMobile = pcJobuserMapper.selectByExample(jobUserExp2).size()>0;
  386. if(!stringUtils.IsNullOrEmpty(data.getSocialSecurityCard())){
  387. PcJobuserExample jobUserExp3 = new PcJobuserExample();
  388. jobUserExp3.or().andSocialSecurityCardEqualTo(data.getSocialSecurityCard()).andJobuserIDNotEqualTo(data.getJobUserID());
  389. var ifRepeatSocialCard = pcJobuserMapper.selectByExample(jobUserExp3).size()>0;
  390. result += ifRepeatSocialCard ? 4:0;
  391. }
  392. result += ifRepeatIdentity? 1:0;
  393. result += ifRepeatMobile? 2:0;
  394. }
  395. if(result > 0 ) {
  396. var errorMsg = "";
  397. switch (result){
  398. case 1:
  399. errorMsg = "身份证号码重复!";
  400. break;
  401. case 2:
  402. errorMsg = "联系电话已存在!";
  403. break;
  404. case 3:
  405. errorMsg = "身份证号码、联系电话重复!";
  406. break;
  407. case 4:
  408. errorMsg = "社保卡已绑定其他人员!";
  409. break;
  410. case 5:
  411. errorMsg = "身份证号码、社保卡号重复!";
  412. break;
  413. case 6:
  414. errorMsg = "联系电话、社保卡号重复!";
  415. break;
  416. case 7:
  417. errorMsg = "身份证号码、联系电话、社保卡号重复!";
  418. break;
  419. }
  420. if(isEdit) throw new BaseException("1004",errorMsg);
  421. else return errorMsg;
  422. }
  423. return "0";
  424. }
  425. @Override
  426. public int baseInfoSave(JobUserVo data, String userId) {
  427. int result = 0;
  428. PcJobuser dbData = pcJobuserMapper.selectByPrimaryKey(data.getJobUserID());
  429. var resultNum = Integer.valueOf(ifHadRepeatData(data,true,userId));
  430. if( resultNum > 0 ) {
  431. throw new BaseException("1004","该求职人员已被录入!");
  432. }
  433. // JobUserServiceVo jobUserServiceVo = new JobUserServiceVo();
  434. // jobUserServiceVo.setJobUserID(data.getJobUserID());
  435. // jobUserServiceVo.setServiceTime(new Date());
  436. // jobUserServiceVo.setServiceUserID(userId);
  437. if (dbData == null) {
  438. //这里已直接将求职人员转至当前驿站下
  439. if(resultNum.equals(-1)){
  440. result = 1;
  441. }
  442. else {
  443. dbData = new PcJobuser();
  444. dbData.setJobuserID(data.getJobUserID());
  445. dbData.setSiteID(data.getSiteID());
  446. dbData.setIdentityNumber(data.getIdentityNumber());
  447. dbData.setName(data.getName());
  448. dbData.setPyName(data.getPyName());
  449. dbData.setEngName(data.getEngName());
  450. dbData.setJobStatusID(data.getJobStatusID());
  451. dbData.setSex(data.getSex());
  452. dbData.setNation(data.getNation());
  453. dbData.setPoliticsStatusID(data.getPoliticsStatusID());
  454. dbData.setBirthplace(data.getBirthPlace());
  455. dbData.setBirthDay(data.getBirthDay());
  456. dbData.setFamilyNatureID(data.getFamilyNatureID());
  457. dbData.setFamilyAddress(data.getFamilyAddress());
  458. dbData.setCultureRank(data.getCultureRank());
  459. dbData.setHealthID(data.getHealthID());
  460. dbData.setHeight(data.getHeight());
  461. dbData.setBloodTypeID(data.getBloodTypeID());
  462. dbData.setVision(data.getVision());
  463. dbData.setWeight(data.getWeight());
  464. dbData.setMaritalStatusID(data.getMaritalStatusID());
  465. dbData.setProvinceCode(data.getProvinceCode());
  466. dbData.setRegionCode(data.getRegionCode());
  467. dbData.setStreetCode(data.getStreetCode());
  468. dbData.setUserName(data.getUserName());
  469. dbData.setUserMobile(data.getUserMobile());
  470. dbData.setAddress(data.getAddress());
  471. dbData.setPostalCode(data.getPostalCode());
  472. dbData.setEmail(data.getEmail());
  473. dbData.setHobby(data.getHobby());
  474. dbData.setKeyPersonTypeID(data.getKeyPersonTypeID());
  475. dbData.setPersonalSkills(data.getPersonalSkills());
  476. dbData.setOpenId(data.getOpenId());
  477. dbData.setIsAppInsert(data.getIsAppInsert()==null?0:1);
  478. dbData.setSocialSecurityCard(data.getSocialSecurityCard());
  479. dbData.setFinishSchool(data.getFinishSchool());
  480. dbData.setFinishDate(data.getFinishDate());
  481. dbData.setProfession(data.getProfession());
  482. dbData.setIsFullTime(data.getIsFullTime());
  483. dbData.setOccupationalCategory(data.getOccupationalCategory());
  484. dbData.setOccupationalLevel(data.getOccupationalLevel());
  485. dbData.setNativePlace(data.getNativePlace());
  486. dbData.setLongitude(data.getLongitude());
  487. dbData.setLatitude(data.getLatitude());
  488. dbData.setEducationalSystem(data.getEducationalSystem());
  489. dbData.setDifficultSituationID(data.getDifficultSituationID());
  490. dbData.setOrdinaryPersonTypeID(data.getOrdinaryPersonTypeID());
  491. dbData.setEsHouseholdRegistration(data.getEsHouseholdRegistration());
  492. dbData.setCreateTime(new Date());
  493. dbData.setCreateUserID(userId);
  494. result = pcJobuserMapper.insert(dbData);
  495. }
  496. // jobUserServiceVo.setServiceContent("登记求职者个人求职信息");
  497. }
  498. else {
  499. dbData.setJobuserID(data.getJobUserID());
  500. dbData.setSiteID(data.getSiteID());
  501. dbData.setIdentityNumber(data.getIdentityNumber());
  502. dbData.setName(data.getName());
  503. dbData.setPyName(data.getPyName());
  504. dbData.setEngName(data.getEngName());
  505. dbData.setSex(data.getSex());
  506. dbData.setJobStatusID(data.getJobStatusID());
  507. dbData.setNation(data.getNation());
  508. dbData.setPoliticsStatusID(data.getPoliticsStatusID());
  509. dbData.setBirthplace(data.getBirthPlace());
  510. dbData.setBirthDay(data.getBirthDay());
  511. dbData.setFamilyNatureID(data.getFamilyNatureID());
  512. dbData.setFamilyAddress(data.getFamilyAddress());
  513. dbData.setCultureRank(data.getCultureRank());
  514. dbData.setHealthID(data.getHealthID());
  515. dbData.setHeight(data.getHeight());
  516. dbData.setBloodTypeID(data.getBloodTypeID());
  517. dbData.setVision(data.getVision());
  518. dbData.setWeight(data.getWeight());
  519. dbData.setMaritalStatusID(data.getMaritalStatusID());
  520. dbData.setProvinceCode(data.getProvinceCode());
  521. dbData.setRegionCode(data.getRegionCode());
  522. dbData.setStreetCode(data.getStreetCode());
  523. dbData.setUserName(data.getUserName());
  524. dbData.setUserMobile(data.getUserMobile());
  525. dbData.setAddress(data.getAddress());
  526. dbData.setPostalCode(data.getPostalCode());
  527. dbData.setEmail(data.getEmail());
  528. dbData.setHobby(data.getHobby());
  529. dbData.setKeyPersonTypeID(data.getKeyPersonTypeID());
  530. dbData.setPersonalSkills(data.getPersonalSkills());
  531. dbData.setOpenId(data.getOpenId());
  532. dbData.setIsAppInsert(data.getIsAppInsert()==null?0:1);
  533. dbData.setSocialSecurityCard(data.getSocialSecurityCard());
  534. dbData.setFinishSchool(data.getFinishSchool());
  535. dbData.setFinishDate(data.getFinishDate());
  536. dbData.setProfession(data.getProfession());
  537. dbData.setIsFullTime(data.getIsFullTime());
  538. dbData.setOccupationalCategory(data.getOccupationalCategory());
  539. dbData.setOccupationalLevel(data.getOccupationalLevel());
  540. dbData.setNativePlace(data.getNativePlace());
  541. dbData.setLongitude(data.getLongitude());
  542. dbData.setLatitude(data.getLatitude());
  543. dbData.setEducationalSystem(data.getEducationalSystem());
  544. dbData.setDifficultSituationID(data.getDifficultSituationID());
  545. dbData.setOrdinaryPersonTypeID(data.getOrdinaryPersonTypeID());
  546. dbData.setEsHouseholdRegistration(data.getEsHouseholdRegistration());
  547. dbData.setModifyTime(new Date());
  548. dbData.setModifyUserID(userId);
  549. result = pcJobuserMapper.updateByPrimaryKey(dbData);
  550. // jobUserServiceVo.setServiceContent("更新求职者个人求职信息");
  551. }
  552. PcLabelJobuserExample labelEmp = new PcLabelJobuserExample();
  553. labelEmp.or().andJobuserIDEqualTo(data.getJobUserID());
  554. pcLabelJobuserMapper.deleteByExample(labelEmp);
  555. if(data.listLabel!=null && data.listLabel.size()>0){
  556. data.listLabel.forEach(x->{
  557. PcLabelJobuser labelModel = new PcLabelJobuser();
  558. labelModel.setJobuserID(data.getJobUserID());
  559. labelModel.setLabelID(x.getLabelID());
  560. pcLabelJobuserMapper.insert(labelModel);
  561. });
  562. }
  563. // 保存服务记录
  564. // if (result > 0){
  565. // jobUserServiceService.save(jobUserServiceVo, userId);
  566. // }
  567. return result;
  568. }
  569. @Override
  570. public List<JobUserVo> importJobUser(List<JobUserVo> dataList, String userID) {
  571. if (dataList.size() <= 0)
  572. throw new BaseException("", "请添加导入数据!");
  573. //性别
  574. List<SysDictionaryItem> dicJobUserGenderList = dictionaryService.getDictionaryItemList("Gender");
  575. //重点人员类别
  576. List<SysDictionaryItem> dicKeyPersonTypeList = dictionaryService.getDictionaryItemList("KeyPersonType");
  577. // 普通人员类别
  578. List<SysDictionaryItem> ordinaryPersonTypeList = dictionaryService.getDictionaryItemList("OrdinaryPersonType");
  579. //就业状态
  580. List<SysDictionaryItem> dicJobStatusList = dictionaryService.getDictionaryItemList("JobStatus");
  581. // 困难状况
  582. List<SysDictionaryItem> difficultSituationList = dictionaryService.getDictionaryItemList("DifficultSituation");
  583. //所属驿站
  584. PcSite curLoginUserSiteInfo = null;
  585. PcSiteUserExample siteUserExp = new PcSiteUserExample();
  586. siteUserExp.or().andUserIDEqualTo(userID);
  587. PcSiteUser curLoginSiteUser = pcSiteUserMapper.selectByExample(siteUserExp).stream().findFirst().orElse(null);
  588. if(curLoginSiteUser==null){
  589. throw new BaseException("", "未能查询到当前登录人的驿站人员信息!");
  590. }
  591. else{
  592. PcSiteExample siteExp = new PcSiteExample();
  593. siteExp.or().andSiteIDEqualTo(curLoginSiteUser.getSiteID());
  594. curLoginUserSiteInfo = pcSiteMapper.selectByExample(siteExp).stream().findFirst().orElse(null);
  595. }
  596. //是否全日制
  597. List<SysDictionaryItem> dicIsFullTimeList = dictionaryService.getDictionaryItemList("IsFullTime");
  598. //职业资格类别
  599. List<SysDictionaryItem> secondLevelOcCategoryList = new ArrayList<>();
  600. PcOccupationalExample occupationalExp = new PcOccupationalExample();
  601. occupationalExp.or().andParentOccupationalIDEqualTo("0").andStatusEqualTo(1);
  602. var firstLevelData = pcOccupationalMapper.selectByExample(occupationalExp);
  603. for (PcOccupational curOccupational : firstLevelData) {
  604. occupationalExp = new PcOccupationalExample();
  605. occupationalExp.or().andParentOccupationalIDEqualTo(curOccupational.getOccupationalID()).andStatusEqualTo(1);
  606. var secondLevelData = pcOccupationalMapper.selectByExample(occupationalExp);
  607. for (PcOccupational curChildOccupational : secondLevelData) {
  608. SysDictionaryItem item = new SysDictionaryItem();
  609. item.setCode(curChildOccupational.getOccupationalID());
  610. item.setName(curChildOccupational.getOccupationalName());
  611. secondLevelOcCategoryList.add(item);
  612. }
  613. }
  614. //职业资格等级
  615. List<SysDictionaryItem> dicOcclLevelList = dictionaryService.getDictionaryItemList("OccupationalLevel");
  616. //民族
  617. List<SysDictionaryItem> dicNationTypeList = dictionaryService.getDictionaryItemList("NationType");
  618. //政治面貌
  619. List<SysDictionaryItem> dicPoliticsTypeList = dictionaryService.getDictionaryItemList("PoliticsStatus");
  620. //户口性质
  621. List<SysDictionaryItem> dicFamilyNatureList = dictionaryService.getDictionaryItemList("FamilyNature");
  622. //最高学历
  623. List<SysDictionaryItem> dicHighestDegreeList = dictionaryService.getDictionaryItemList("HighestDegree");
  624. //健康状况
  625. List<SysDictionaryItem> dicHealthTypeList = dictionaryService.getDictionaryItemList("Health");
  626. //婚姻状况
  627. List<SysDictionaryItem> dicMaritalStatusList = dictionaryService.getDictionaryItemList("MaritalStatus");
  628. //市/县
  629. List<SysDictionaryItem> regionDataList = new ArrayList<>();
  630. AreaCodeExample regionExp= new AreaCodeExample();
  631. regionExp.or().andFidEqualTo("441300000000000").andLvEqualTo("3");
  632. var thirdLevelRegionList = areaCodeMapper.selectByExample(regionExp);
  633. for (AreaCode curRegionData : thirdLevelRegionList) {
  634. SysDictionaryItem item = new SysDictionaryItem();
  635. item.setCode(curRegionData.getCode());
  636. item.setName(curRegionData.getName());
  637. regionDataList.add(item);
  638. }
  639. //镇街
  640. List<SysDictionaryItem> streetDataList = new ArrayList<>();
  641. AreaCodeExample streetExp= new AreaCodeExample();
  642. streetExp.or().andLvEqualTo("4");
  643. var forthLevelStreetList = areaCodeMapper.selectByExample(streetExp);
  644. for (AreaCode curStreetData : forthLevelStreetList) {
  645. SysDictionaryItem item = new SysDictionaryItem();
  646. item.setCode(curStreetData.getCode());
  647. item.setName(curStreetData.getName());
  648. streetDataList.add(item);
  649. }
  650. List<JobUserVo> resultList = new ArrayList<>();
  651. PcSite finalCurLoginUserSiteInfo = curLoginUserSiteInfo;
  652. HashMap<String,String> idPhoneList = new HashMap<>();
  653. dataList.forEach(item->{
  654. if(!idPhoneList.containsValue(item.getIdentityNumber())){
  655. idPhoneList.put("IdentityNumber",item.getIdentityNumber());
  656. }else{
  657. throw new BaseException("","求职人员导入数据存在相同的身份证号码!");
  658. }
  659. if(!idPhoneList.containsValue(item.getUserMobile())){
  660. idPhoneList.put("UserMobile",item.getUserMobile());
  661. }else{
  662. throw new BaseException("","求职人员导入数据存在相同的联系电话!");
  663. }
  664. });
  665. dataList.forEach(item -> {
  666. String errorInfo = "";
  667. item.setJobUserID(UUID.randomUUID().toString());
  668. if (stringUtils.IsNullOrEmpty(item.getName())){
  669. errorInfo += "请填写姓名!";
  670. }
  671. if (stringUtils.IsNullOrEmpty(item.getBirthDayStr())){
  672. errorInfo += "请填写出生日期!";
  673. } else {
  674. item.setBirthDay(dateUtils.StrToDate(item.getBirthDayStr(), "yyyy-MM-dd"));
  675. }
  676. if (!stringUtils.IsNullOrEmpty(item.getIdentityNumber())){
  677. if(regexUtils.theIdCardIsValid(item.getIdentityNumber())) {
  678. var birthDay = dateUtils.StrToDate((item.getIdentityNumber().substring(6,10)+"-"+item.getIdentityNumber().substring(10,12)+"-"+item.getIdentityNumber().substring(12,14)),"yyyy-MM-dd");
  679. var sexStr = Integer.parseInt(item.getIdentityNumber().substring(16,17));
  680. if(!stringUtils.IsNullOrEmpty(item.getBirthDayStr())){
  681. if(!birthDay.equals(dateUtils.StrToDate(item.getBirthDayStr(),"yyyy-MM-dd"))){
  682. errorInfo += "出生日期与身份证号不匹配!";
  683. }
  684. }else{
  685. item.setBirthDay(birthDay);
  686. }
  687. if(!stringUtils.IsNullOrEmpty(item.getSexName())){
  688. if((sexStr%2==0&&item.getSexName().equals("男"))||(sexStr%2!=0&&item.getSexName().equals("女"))){
  689. errorInfo += "性别与身份证号不匹配!";
  690. }
  691. }
  692. item.setIdentityNumber(desUtils.encoderText(item.getIdentityNumber()));
  693. }else{
  694. errorInfo += "身份证号码不合法!";
  695. }
  696. }
  697. if (stringUtils.IsNullOrEmpty(item.getUserMobile()))
  698. errorInfo += "请填写联系电话!";
  699. else{
  700. if(!regexUtils.theMobileIsValid(item.getUserMobile(),false)){
  701. errorInfo += "联系电话不合法!";
  702. }else{
  703. item.setUserMobile(desUtils.encoderText(item.getUserMobile()));
  704. var repeatResult = ifHadRepeatData(item,false,userID);
  705. errorInfo += !repeatResult.equals("0")? repeatResult:"";
  706. }
  707. }
  708. if (stringUtils.IsNullOrEmpty(item.getSexName()))
  709. errorInfo += "请选择性别!";
  710. else {
  711. item.setSex(dicJobUserGenderList.stream().filter(it -> it.getName().equals(item.getSexName().trim()))
  712. .findFirst().orElse(new SysDictionaryItem()).getValue());
  713. if (item.getSex() == null || item.getSex() == 0)
  714. errorInfo += "性别不存在!";
  715. }
  716. if (stringUtils.IsNullOrEmpty(item.getKeyPersonTypeName()))
  717. errorInfo += "请选择重点人员类别!";
  718. else {
  719. item.setKeyPersonTypeID(dicKeyPersonTypeList.stream().filter(it -> it.getName().equals(item.getKeyPersonTypeName().trim()))
  720. .findFirst().orElse(new SysDictionaryItem()).getValue());
  721. if (item.getKeyPersonTypeID() == null){
  722. errorInfo += "重点人员类别不存在!";
  723. }
  724. }
  725. if (stringUtils.IsNullOrEmpty(item.getOrdinaryPersonTypeName()))
  726. errorInfo += "请选择人员类别!";
  727. else {
  728. item.setOrdinaryPersonTypeID(ordinaryPersonTypeList.stream().filter(it -> it.getName().equals(item.getOrdinaryPersonTypeName().trim()))
  729. .findFirst().orElse(new SysDictionaryItem()).getValue());
  730. if (item.getOrdinaryPersonTypeID() == null)
  731. errorInfo += "人员类别不存在!";
  732. else {
  733. if(item.getOrdinaryPersonTypeID().equals(2) && stringUtils.IsNullOrEmpty(item.getFinishDate())){
  734. errorInfo += "应届高校毕业生必须填写毕业日期!";
  735. }
  736. if(item.getOrdinaryPersonTypeID().equals(2) && item.getEducationalSystem() == null){
  737. errorInfo += "应届高校毕业生必须填写学制!";
  738. }
  739. if(item.getOrdinaryPersonTypeID().equals(2) && stringUtils.IsNullOrEmpty(item.getFinishSchool())){
  740. errorInfo += "应届高校毕业生必须填写毕业院校!";
  741. }
  742. }
  743. }
  744. if(!stringUtils.IsNullOrEmpty(item.getFinishDate()))
  745. item.setFinishDate(item.getFinishDate().substring(0,7));
  746. if (stringUtils.IsNullOrEmpty(item.getJobStatusName()))
  747. errorInfo += "请选择就业状态!";
  748. else {
  749. item.setJobStatusID(dicJobStatusList.stream().filter(it -> it.getName().equals(item.getJobStatusName().trim()))
  750. .findFirst().orElse(new SysDictionaryItem()).getValue());
  751. if (item.getJobStatusID() == null || item.getJobStatusID() == 0)
  752. errorInfo += "就业状态不存在!";
  753. }
  754. if (stringUtils.IsNullOrEmpty(item.getSiteName()))
  755. errorInfo += "请填写所属驿站!";
  756. else {
  757. if (finalCurLoginUserSiteInfo!=null){
  758. if(!item.getSiteName().trim().equals(finalCurLoginUserSiteInfo.getSiteName().trim())){
  759. errorInfo += "请填写您所在的驿站名称!";
  760. }else{
  761. item.setSiteID(finalCurLoginUserSiteInfo.getSiteID());
  762. }
  763. }
  764. }
  765. if (stringUtils.IsNullOrEmpty(item.getAddress()))
  766. errorInfo += "请填写地址!";
  767. if (!stringUtils.IsNullOrEmpty(item.getIsFullTimeName())){
  768. item.setIsFullTime(dicIsFullTimeList.stream().filter(it -> it.getName().equals(item.getIsFullTimeName().trim()))
  769. .findFirst().orElse(new SysDictionaryItem()).getValue());
  770. if (item.getIsFullTime() == null || item.getIsFullTime() == 0)
  771. errorInfo += "是否全日制不存在!";
  772. }
  773. if (!stringUtils.IsNullOrEmpty(item.getDifficultSituationName())){
  774. item.setDifficultSituationID(difficultSituationList.stream().filter(it -> it.getName().equals(item.getDifficultSituationName().trim()))
  775. .findFirst().orElse(new SysDictionaryItem()).getValue());
  776. if (item.getDifficultSituationID() == null){
  777. errorInfo += "困难状况不存在!";
  778. }
  779. }
  780. if (!stringUtils.IsNullOrEmpty(item.getOccupationalCategoryName())){
  781. item.setOccupationalCategory(secondLevelOcCategoryList.stream().filter(it -> it.getName().equals(item.getOccupationalCategoryName().trim()))
  782. .findFirst().orElse(new SysDictionaryItem()).getCode());
  783. if (item.getOccupationalCategory() == null)
  784. errorInfo += "职业资格类别不存在!";
  785. }
  786. if (!stringUtils.IsNullOrEmpty(item.getOccupationalLevelName())) {
  787. item.setOccupationalLevel(dicOcclLevelList.stream().filter(it -> it.getName().equals(item.getOccupationalLevelName().trim()))
  788. .findFirst().orElse(new SysDictionaryItem()).getValue());
  789. if (item.getOccupationalLevel() == null || item.getOccupationalLevel() == 0)
  790. errorInfo += "职业资格等级不存在!";
  791. }
  792. if (!stringUtils.IsNullOrEmpty(item.getNationName())) {
  793. item.setNation(dicNationTypeList.stream().filter(it -> it.getName().equals(item.getNationName().trim()))
  794. .findFirst().orElse(new SysDictionaryItem()).getValue());
  795. if (item.getNation() == null || item.getNation() == 0)
  796. errorInfo += "民族不存在!";
  797. }
  798. if (!stringUtils.IsNullOrEmpty(item.getPoliticsStatusName())) {
  799. item.setPoliticsStatusID(dicPoliticsTypeList.stream().filter(it -> it.getName().equals(item.getPoliticsStatusName().trim()))
  800. .findFirst().orElse(new SysDictionaryItem()).getValue());
  801. if (item.getPoliticsStatusID() == null || item.getPoliticsStatusID() == 0)
  802. errorInfo += "政治面貌不存在!";
  803. }
  804. if (!stringUtils.IsNullOrEmpty(item.getFamilyNatureName())) {
  805. item.setFamilyNatureID(dicFamilyNatureList.stream().filter(it -> it.getName().equals(item.getFamilyNatureName().trim()))
  806. .findFirst().orElse(new SysDictionaryItem()).getValue());
  807. if (item.getFamilyNatureID() == null || item.getFamilyNatureID() == 0)
  808. errorInfo += "户口性质不存在!";
  809. }
  810. if (!stringUtils.IsNullOrEmpty(item.getCultureRankName())) {
  811. item.setCultureRank(dicHighestDegreeList.stream().filter(it -> it.getName().equals(item.getCultureRankName().trim()))
  812. .findFirst().orElse(new SysDictionaryItem()).getValue());
  813. if (item.getCultureRank() == null || item.getCultureRank() == 0)
  814. errorInfo += "最高学历不存在!";
  815. }
  816. if (!stringUtils.IsNullOrEmpty(item.getHealthName())) {
  817. item.setHealthID(dicHealthTypeList.stream().filter(it -> it.getName().equals(item.getHealthName().trim()))
  818. .findFirst().orElse(new SysDictionaryItem()).getValue());
  819. if (item.getHealthID() == null || item.getHealthID() == 0)
  820. errorInfo += "健康状况不存在!";
  821. }
  822. if (!stringUtils.IsNullOrEmpty(item.getMaritalStatusName())) {
  823. item.setMaritalStatusID(dicMaritalStatusList.stream().filter(it -> it.getName().equals(item.getMaritalStatusName().trim()))
  824. .findFirst().orElse(new SysDictionaryItem()).getValue());
  825. if (item.getMaritalStatusID() == null || item.getMaritalStatusID() == 0)
  826. errorInfo += "婚姻状况不存在!";
  827. }
  828. if (!stringUtils.IsNullOrEmpty(item.getEmail())) {
  829. if (!regexUtils.theEmailIsValid(item.getEmail()))
  830. errorInfo += "电子邮箱不合法!";
  831. }
  832. if (!stringUtils.IsNullOrEmpty(item.getProvinceName())) {
  833. if((item.getProvinceName().trim()).equals("广东省")){
  834. item.setProvinceCode("440000000000000");
  835. }else{
  836. errorInfo += "省份不存在!";
  837. }
  838. }
  839. if (stringUtils.IsNullOrEmpty(item.getUserMobile()))
  840. errorInfo += "请选择市/县!";
  841. else{
  842. item.setRegionCode(regionDataList.stream().filter(it -> it.getName().equals(item.getRegionName().trim()))
  843. .findFirst().orElse(new SysDictionaryItem()).getCode());
  844. if (item.getRegionCode() == null)
  845. errorInfo += "市/县不存在!";
  846. else{
  847. if(!item.getRegionCode().equals(finalCurLoginUserSiteInfo.getRegionCode())){
  848. errorInfo += "请选择您所在驿站的市/县!";
  849. }
  850. }
  851. }
  852. if (!stringUtils.IsNullOrEmpty(item.getStreetName())) {
  853. item.setStreetCode(streetDataList.stream().filter(it -> it.getName().equals(item.getStreetName().trim()))
  854. .findFirst().orElse(new SysDictionaryItem()).getCode());
  855. if (item.getStreetCode() == null)
  856. errorInfo += "镇街不存在!";
  857. else{
  858. if (stringUtils.IsNullOrEmpty(item.getRegionName())){
  859. errorInfo += "请选择相关市/县!";
  860. }else{
  861. AreaCodeExample curStreetExp = new AreaCodeExample();
  862. curStreetExp.or().andCodeEqualTo(item.getStreetCode());
  863. var curStreetReginCode = areaCodeMapper.selectByExample(curStreetExp).get(0).getFid();
  864. if(item.getRegionCode()!= null&&!curStreetReginCode.equals(item.getRegionCode())){
  865. errorInfo += "镇街不属于当前市/县!";
  866. }
  867. }
  868. }
  869. }
  870. item.setJobEducation(new ArrayList<>());
  871. item.setJobExperience(new ArrayList<>());
  872. if (stringUtils.IsNullOrEmpty(errorInfo)) {
  873. resultList.add(item);
  874. } else {
  875. item.setErrorMessage(errorInfo);
  876. }
  877. });
  878. if (dataList.stream().filter(it -> !stringUtils.IsNullOrEmpty(it.errorMessage)).collect(Collectors.toList()).size() > 0)
  879. return dataList;
  880. resultList.forEach(item -> {
  881. save(item, userID);
  882. });
  883. return null;
  884. }
  885. @Override
  886. public PageInfo<JobUserMapVo> getDataMapList(int pageIndex, int pageSize, Integer keyTypeValue,
  887. String regionCode, String labelID, Integer minAge,
  888. Integer maxAge, String jobUserName) {
  889. PageHelper.startPage(pageIndex, pageSize);
  890. List<JobUserMapVo> dataMapList = jobUserCQuery.getDataMapList(keyTypeValue, regionCode, labelID, minAge, maxAge, jobUserName);
  891. PageInfo<JobUserMapVo> result = new PageInfo<>(dataMapList);
  892. // 获取所有的求职人员ID
  893. List<String> jobUserIDs = result.getList().stream()
  894. .filter(Objects::nonNull)
  895. .map(JobUserMapVo::getJobUserID)
  896. .filter(Objects::nonNull)
  897. .collect(Collectors.toList());
  898. if (!jobUserIDs.isEmpty()) {
  899. // 查询求职意向并映射到求职人员
  900. List<JobHuntVo> jobHuntList = jobHuntCQuery.selectJobHuntInCompanyIDs(stringUtils.ListToInSql(jobUserIDs));
  901. Map<String, List<JobHuntVo>> jobHuntMap = (jobHuntList != null) ?
  902. jobHuntList.stream()
  903. .filter(Objects::nonNull)
  904. .collect(Collectors.groupingBy(JobHuntVo::getJobUserID))
  905. : new HashMap<>();
  906. // 查询服务记录
  907. List<JobUserServiceVo> jobUserServiceVos = jobUserServiceCQuery.jobUserMapGetService(stringUtils.ListToInSql(jobUserIDs), null);
  908. result.getList().forEach(jobUser -> {
  909. if (jobUser != null && jobUser.getJobUserID() != null) {
  910. // 填充服务时间
  911. jobUser.setServiceTime(jobUserServiceVos
  912. .stream()
  913. .filter(service -> service.getJobUserID().equals(jobUser.getJobUserID()))
  914. .findFirst()
  915. .orElse(new JobUserServiceVo())
  916. .getServiceTime());
  917. // 填充求职意向数据
  918. jobUser.setJobHuntList(jobHuntMap.getOrDefault(jobUser.getJobUserID(), new ArrayList<>()));
  919. }
  920. });
  921. }
  922. return result;
  923. }
  924. @Override
  925. public int editOpenID(JobUserVo data) {
  926. PcJobuserExample example = new PcJobuserExample();
  927. example.or().andIdentityNumberEqualTo(desUtils.encoderText(data.getIdentityNumber()));
  928. List<PcJobuser> pcJobusers = pcJobuserMapper.selectByExample(example);
  929. if (pcJobusers.isEmpty()){
  930. throw new BaseException("1005", "该身份证在系统中未录入,请联系工作人员补录后重试");
  931. }
  932. PcJobuser pcJobuser = pcJobusers.get(0);
  933. // 已经OpenID则不修改
  934. if (!stringUtils.IsNullOrEmpty(pcJobuser.getOpenId())){
  935. return 1;
  936. }
  937. pcJobuser.setOpenId(data.openId);
  938. return pcJobuserMapper.updateByPrimaryKey(pcJobuser);
  939. }
  940. @Override
  941. public PageInfo<ClaimJobUserVo> selectClaimJobUserList(Integer pageIndex, Integer pageSize, String name, String address, Integer KeyPersonTypeID) {
  942. PageHelper.startPage(pageIndex, pageSize);
  943. List<ClaimJobUserVo> list = jobUserCQuery.selectClaimJobUserList(name, address, KeyPersonTypeID, "66fc1176-b8a1-4b9a-b2fc-9f590ceed342");
  944. // 信息脱敏
  945. list.forEach(item -> {
  946. item.setUserMobile(calculateUtils.maskMobile(desUtils.decoderText(item.getUserMobile())));
  947. String idNumber = desUtils.decoderText(item.getIdentityNumber());
  948. item.setAge(calculateUtils.calculateAge(idNumber));
  949. });
  950. PageInfo<ClaimJobUserVo> result = new PageInfo(list);
  951. return result;
  952. }
  953. @Override
  954. public int claimJobUser(List<String> ids, String siteID) {
  955. PcSite site = pcSiteMapper.selectByPrimaryKey(siteID);
  956. return jobUserCQuery.ClaimJobUserList(stringUtils.ListToInSql(ids), siteID, site.getRegionCode(), site.getStreetCode());
  957. }
  958. }