|
@@ -1,19 +1,25 @@
|
|
|
package com.hz.employmentsite.services.impl.companyService;
|
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.hz.employmentsite.filter.exception.BaseException;
|
|
|
+import com.hz.employmentsite.mapper.PcCompanyMapper;
|
|
|
import com.hz.employmentsite.mapper.PcPostMapper;
|
|
|
import com.hz.employmentsite.mapper.cquery.PostCQuery;
|
|
|
-import com.hz.employmentsite.model.PcPost;
|
|
|
-import com.hz.employmentsite.model.PcPostExample;
|
|
|
+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.StringUtils;
|
|
|
+import com.hz.employmentsite.vo.companyService.CompanyVo;
|
|
|
import com.hz.employmentsite.vo.companyService.PostVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.SpringApplicationRunListener;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service("PostService")
|
|
|
public class PostServiceImpl implements PostService {
|
|
@@ -25,8 +31,14 @@ public class PostServiceImpl implements PostService {
|
|
|
@Autowired
|
|
|
private PcPostMapper pcPostMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PcCompanyMapper companyMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DictionaryService dictionaryService;
|
|
|
+
|
|
|
@Override
|
|
|
- public PageInfo<PostVo> getList(Integer page, Integer rows, String postID, String postName, Integer minCount, Integer maxCount, String companyName, int recordStatus, String WorkName) {
|
|
|
+ public PageInfo<PostVo> getList(Integer page, Integer rows, String postID, String postName, Integer minCount, Integer maxCount, String companyName, String recordStatus, String WorkName) {
|
|
|
List<PostVo> list = postCQuery.selectPostList(postID, postName, minCount, maxCount, companyName, recordStatus, WorkName);
|
|
|
PageInfo<PostVo> result = new PageInfo(list);
|
|
|
return result;
|
|
@@ -37,10 +49,10 @@ public class PostServiceImpl implements PostService {
|
|
|
public Integer save(PostVo data, String userId) {
|
|
|
int result = 0;
|
|
|
PcPost dbData = null;
|
|
|
- Boolean isExist=data.getPostID()!=null;
|
|
|
+ Boolean isExist = data.getPostID() != null;
|
|
|
PcPostExample exp = new PcPostExample();
|
|
|
PcPostExample.Criteria cro = exp.createCriteria();
|
|
|
- if(isExist){
|
|
|
+ if (isExist) {
|
|
|
cro.andPostIDEqualTo(data.getPostID());
|
|
|
dbData = pcPostMapper.selectByExample(exp).stream().findFirst().orElse(null);
|
|
|
}
|
|
@@ -125,4 +137,96 @@ public class PostServiceImpl implements PostService {
|
|
|
}
|
|
|
return postCQuery.selectPostList(id, null, null, null, null, null, null).stream().findFirst().orElse(null);
|
|
|
}
|
|
|
+
|
|
|
+ @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> dicDataList = dictionaryService.getDictionaryItemList("CultureLevel");
|
|
|
+ List<PostVo> resultList = new ArrayList<>();
|
|
|
+
|
|
|
+ dataList.forEach(item -> {
|
|
|
+ String errorInfo = "";
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.postName))
|
|
|
+ errorInfo += "请填写岗位名称!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(String.valueOf(item.validTime)) || item.validTime == null)
|
|
|
+ errorInfo += "请填写有效开始时间!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(String.valueOf(item.validDay)) || item.validDay == 0)
|
|
|
+ errorInfo += "请填写有效期(天)!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.recordStatusName))
|
|
|
+ errorInfo += "请填写岗位状态!";
|
|
|
+ else {
|
|
|
+ if (item.recordStatusName.equals("启用")) item.recordStatus = 1;
|
|
|
+ else item.recordStatus = 0;
|
|
|
+ }
|
|
|
+ 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.workNature))
|
|
|
+ errorInfo += "请填写工作性质!";
|
|
|
+ if (item.workYear == null)
|
|
|
+ errorInfo += "请填写工作年限!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(String.valueOf(item.recruitCount)) || item.recruitCount == null)
|
|
|
+ errorInfo += "请填写招聘人数!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.cultureLevelName))
|
|
|
+ errorInfo += "请填写文化程度!";
|
|
|
+ else {
|
|
|
+ item.cultureRank = dicDataList.stream().filter(it -> it.getName().equals(item.cultureLevelName.trim()))
|
|
|
+ .findFirst().orElse(new SysDictionaryItem()).getValue();
|
|
|
+ if (item.cultureRank == null || item.cultureRank == 0)
|
|
|
+ errorInfo += "输入文化程度不存在!";
|
|
|
+ }
|
|
|
+ if (stringUtils.IsNullOrEmpty(String.valueOf(item.maxSalary)) || item.maxSalary == null)
|
|
|
+ errorInfo += "请填写最高薪酬!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(String.valueOf(item.minSalary)) || item.minSalary == null)
|
|
|
+ errorInfo += "请填写最低薪酬!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.welfare))
|
|
|
+ errorInfo += "请填写福利待遇!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.userName))
|
|
|
+ errorInfo += "请填写联系人!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.userMobile))
|
|
|
+ errorInfo += "请填写联系电话!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.postEmail))
|
|
|
+ errorInfo += "请填写邮箱!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(String.valueOf(item.workTime)) || item.workTime == 0 || item.workTime == null)
|
|
|
+ errorInfo += "请填写工作时长!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.isTrailName))
|
|
|
+ errorInfo += "请填写是否试用期!";
|
|
|
+ else {
|
|
|
+ if (item.isTrailName.trim().equals("是")) item.isTrail = true;
|
|
|
+ else item.isTrail = false;
|
|
|
+ }
|
|
|
+ if (stringUtils.IsNullOrEmpty(String.valueOf(item.trailtime)) || item.trailtime == 0 || item.trailtime == null)
|
|
|
+ errorInfo += "请填写试用期时长(月)!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(String.valueOf(item.trailMaxSalary)) || item.trailMaxSalary == null)
|
|
|
+ errorInfo += "请填写试用期最高薪酬!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(String.valueOf(item.trailMinSalary)) || item.trailMinSalary == null)
|
|
|
+ errorInfo += "请填写试用期最低薪酬!";
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.postDesc))
|
|
|
+ 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);
|
|
|
+ });
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|