|
@@ -4,6 +4,7 @@ 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.model.*;
|
|
|
import com.hz.employmentsite.services.service.companyService.PostService;
|
|
@@ -14,10 +15,7 @@ import com.hz.employmentsite.vo.companyService.RecommendPostVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.UUID;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service("PostService")
|
|
@@ -50,13 +48,18 @@ public class PostServiceImpl implements PostService {
|
|
|
@Autowired
|
|
|
private DictionaryService dictionaryService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PcLabelPostMapper pcLabelPostMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private LabelCQuery labelCQuery;
|
|
|
+
|
|
|
@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) {
|
|
|
- PageHelper.startPage(page, rows);
|
|
|
List<String> curLoginUserSiteCompanyIDs = new ArrayList<>();
|
|
|
if (!stringUtils.IsNullOrEmpty(loginUserID)) {
|
|
|
PcSiteUserExample siteUserExp = new PcSiteUserExample();
|
|
@@ -69,6 +72,7 @@ public class PostServiceImpl implements PostService {
|
|
|
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);
|
|
|
PageInfo<PostVo> result = new PageInfo(list);
|
|
|
return result;
|
|
@@ -76,7 +80,7 @@ public class PostServiceImpl implements PostService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageInfo<RecommendPostVo> getCommendPostList(Integer page, Integer rows, String jobUserID){
|
|
|
+ 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);
|
|
@@ -87,7 +91,7 @@ public class PostServiceImpl implements PostService {
|
|
|
public Integer saveCommendPost(RecommendPostVo data, String userId) {
|
|
|
int result = 0;
|
|
|
PcRecommend dbData = null;
|
|
|
- if(data.recommendID !=null){
|
|
|
+ if (data.recommendID != null) {
|
|
|
PcRecommendExample exp = new PcRecommendExample();
|
|
|
PcRecommendExample.Criteria cro = exp.createCriteria();
|
|
|
cro.andPostIDEqualTo(data.recommendID);
|
|
@@ -99,16 +103,16 @@ public class PostServiceImpl implements PostService {
|
|
|
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.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.setIsRead(data.isRead == null ? false : true);
|
|
|
+ dbData.setIsSendnotes(data.isSendNotes == null ? false : true);
|
|
|
dbData.setModifyTime(new Date());
|
|
|
dbData.setModifyUserID(userId);
|
|
|
result = pcRecommendMapper.updateByPrimaryKeySelective(dbData);
|
|
@@ -206,6 +210,18 @@ public class PostServiceImpl implements PostService {
|
|
|
dbData.setTagID(data.getTagID());
|
|
|
result = pcPostMapper.updateByPrimaryKeySelective(dbData);
|
|
|
}
|
|
|
+
|
|
|
+ if (data.listLabel != null && data.listLabel.size() > 0) {
|
|
|
+ PcLabelPostExample labelEmp = new PcLabelPostExample();
|
|
|
+ labelEmp.or().andPostIDEqualTo(data.getPostID());
|
|
|
+ pcLabelPostMapper.deleteByExample(labelEmp);
|
|
|
+ data.listLabel.forEach(x -> {
|
|
|
+ PcLabelPost labelModel = new PcLabelPost();
|
|
|
+ labelModel.setPostID(data.getPostID());
|
|
|
+ labelModel.setLabelID(x.getLabelID());
|
|
|
+ pcLabelPostMapper.insert(labelModel);
|
|
|
+ });
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -216,18 +232,28 @@ public class PostServiceImpl implements PostService {
|
|
|
PcPostExample postExp = new PcPostExample();
|
|
|
postExp.or().andPostIDIn(ids);
|
|
|
result = pcPostMapper.deleteByExample(postExp);
|
|
|
+ if (result > 0) {
|
|
|
+ PcLabelPostExample labelEmp = new PcLabelPostExample();
|
|
|
+ labelEmp.or().andPostIDIn(ids);
|
|
|
+ pcLabelPostMapper.deleteByExample(labelEmp);
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int deletePostAndRecommendMgt(String id) {
|
|
|
- try{
|
|
|
+ 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){
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return 0;
|
|
|
}
|
|
@@ -235,13 +261,15 @@ public class PostServiceImpl implements PostService {
|
|
|
|
|
|
@Override
|
|
|
public PostVo getDataById(String id) {
|
|
|
- List<String> ids = new ArrayList<>();
|
|
|
if (stringUtils.IsNullOrEmpty(id)) {
|
|
|
return null;
|
|
|
- }else{
|
|
|
- ids.add(id);
|
|
|
}
|
|
|
- return postCQuery.selectPostList(stringUtils.ListToInSql(ids), null, null, null, null, null, null, null, null, null, null).stream().findFirst().orElse(null);
|
|
|
+
|
|
|
+ PostVo data = postCQuery.selectPostList(stringUtils.ListToInSql(Arrays.asList(id)), null, null, null, null, null, null, null, null, null, null).stream().findFirst().orElse(null);
|
|
|
+ if (data != null) {
|
|
|
+ data.listLabel = labelCQuery.getPostLabelList(id);
|
|
|
+ }
|
|
|
+ return data;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -250,8 +278,8 @@ public class PostServiceImpl implements PostService {
|
|
|
PcPostExample postExp = new PcPostExample();
|
|
|
postExp.or().andCompanyIDEqualTo(companyId);
|
|
|
var postList = pcPostMapper.selectByExample(postExp);
|
|
|
- for(PcPost curPost : postList){
|
|
|
- PostVo item= new PostVo();
|
|
|
+ for (PcPost curPost : postList) {
|
|
|
+ PostVo item = new PostVo();
|
|
|
item.setPostID(curPost.getPostID());
|
|
|
item.setProfessionID(curPost.getProfessionID());
|
|
|
PcProfessionExample professionExp = new PcProfessionExample();
|
|
@@ -276,19 +304,19 @@ public class PostServiceImpl implements PostService {
|
|
|
companyExp.or().andRecordStatusEqualTo(1);
|
|
|
List<PcCompany> companyList = companyMapper.selectByExample(companyExp);
|
|
|
//岗位信息
|
|
|
- List<SysDictionaryItem> thirdLevelProfessionList = new ArrayList<>();
|
|
|
+ List<SysDictionaryItem> thirdLevelProfessionList = new ArrayList<>();
|
|
|
PcProfessionExample professionExp = new PcProfessionExample();
|
|
|
professionExp.or().andParentProfessionIDEqualTo("").andStatusEqualTo(1);
|
|
|
var firstLevelData = pcProfessionMapper.selectByExample(professionExp);
|
|
|
- for(PcProfession curProfession : firstLevelData){
|
|
|
+ for (PcProfession curProfession : firstLevelData) {
|
|
|
professionExp = new PcProfessionExample();
|
|
|
professionExp.or().andParentProfessionIDEqualTo(curProfession.getProfessionID()).andStatusEqualTo(1);
|
|
|
var secondLevelData = pcProfessionMapper.selectByExample(professionExp);
|
|
|
- for(PcProfession curParentProfession: secondLevelData){
|
|
|
+ for (PcProfession curParentProfession : secondLevelData) {
|
|
|
professionExp = new PcProfessionExample();
|
|
|
professionExp.or().andParentProfessionIDEqualTo(curParentProfession.getProfessionID()).andStatusEqualTo(1);
|
|
|
var thirdLevelData = pcProfessionMapper.selectByExample(professionExp);
|
|
|
- for(PcProfession curItem : thirdLevelData){
|
|
|
+ for (PcProfession curItem : thirdLevelData) {
|
|
|
SysDictionaryItem item = new SysDictionaryItem();
|
|
|
item.setCode(curItem.getProfessionID());
|
|
|
item.setCode(curItem.getProfessionName());
|
|
@@ -317,7 +345,7 @@ public class PostServiceImpl implements PostService {
|
|
|
else {
|
|
|
item.professionID = thirdLevelProfessionList.stream().filter(it -> it.getName().equals(item.getProfessionName().trim()))
|
|
|
.findFirst().orElse(new SysDictionaryItem()).getCode();
|
|
|
- if (item.professionID == null||item.professionID=="")
|
|
|
+ if (item.professionID == null || item.professionID == "")
|
|
|
errorInfo += "岗位不存在!";
|
|
|
}
|
|
|
|
|
@@ -331,7 +359,7 @@ public class PostServiceImpl implements PostService {
|
|
|
if (stringUtils.IsNullOrEmpty(item.jobPlace))
|
|
|
errorInfo += "请填写招聘地点!";
|
|
|
|
|
|
- if (stringUtils.IsNullOrEmpty(item.workYearStr)){
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.workYearStr)) {
|
|
|
item.workYear = dicWorkYearDataList.stream().filter(it -> it.getName().equals(item.workYearStr.trim()))
|
|
|
.findFirst().orElse(new SysDictionaryItem()).getValue();
|
|
|
if (item.workYear == null || item.workYear == 0)
|
|
@@ -339,9 +367,9 @@ public class PostServiceImpl implements PostService {
|
|
|
}
|
|
|
|
|
|
if (item.isTrailName.trim().equals("是")) item.isTrail = true;
|
|
|
- else if (item.isTrailName.trim().equals("否"))item.isTrail = false;
|
|
|
+ else if (item.isTrailName.trim().equals("否")) item.isTrail = false;
|
|
|
|
|
|
- if (!stringUtils.IsNullOrEmpty(item.cultureLevelName)){
|
|
|
+ if (!stringUtils.IsNullOrEmpty(item.cultureLevelName)) {
|
|
|
item.cultureRank = dicCultureDataList.stream().filter(it -> it.getName().equals(item.cultureLevelName.trim()))
|
|
|
.findFirst().orElse(new SysDictionaryItem()).getValue();
|
|
|
if (item.cultureRank == null || item.cultureRank == 0)
|