|
@@ -2,20 +2,25 @@ package com.citu.module.menduner.system.service.job;
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.citu.framework.common.pojo.PageParam;
|
|
|
import com.citu.framework.common.pojo.PageResult;
|
|
|
import com.citu.framework.common.util.object.BeanUtils;
|
|
|
+import com.citu.framework.security.core.LoginUser;
|
|
|
import com.citu.module.menduner.system.controller.admin.job.vo.JobAdvertisedPageReqVO;
|
|
|
import com.citu.module.menduner.system.controller.admin.job.vo.JobAdvertisedSaveReqVO;
|
|
|
import com.citu.module.menduner.system.controller.app.appbase.AppCommonRespVO;
|
|
|
import com.citu.module.menduner.system.controller.app.contact.AppEnterpriseUserContactRespVO;
|
|
|
import com.citu.module.menduner.system.controller.app.enterprise.vo.AppEnterpriseSimpleRespVO;
|
|
|
import com.citu.module.menduner.system.controller.app.job.vo.*;
|
|
|
+import com.citu.module.menduner.system.controller.appadmin.job.vo.AppAdminJobAdvertisedReqVO;
|
|
|
import com.citu.module.menduner.system.convert.EnterpriseConvert;
|
|
|
import com.citu.module.menduner.system.convert.JobAdvertisedConvert;
|
|
|
import com.citu.module.menduner.system.dal.dataobject.job.JobAdvertisedDO;
|
|
|
+import com.citu.module.menduner.system.dal.dataobject.person.PersonInfoDO;
|
|
|
import com.citu.module.menduner.system.dal.es.job.ESJobAdvertisedMergeDO;
|
|
|
import com.citu.module.menduner.system.dal.mysql.job.JobAdvertisedMapper;
|
|
|
+import com.citu.module.menduner.system.enums.MendunerStatusEnum;
|
|
|
import com.citu.module.menduner.system.service.enterprise.EnterpriseService;
|
|
|
import com.citu.module.menduner.system.service.enterprise.bind.EnterpriseUserBindService;
|
|
|
import com.citu.module.menduner.system.util.EsQueryBuildUtils;
|
|
@@ -35,9 +40,13 @@ import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.citu.framework.common.exception.enums.GlobalErrorCodeConstants.FORBIDDEN;
|
|
|
import static com.citu.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
+import static com.citu.framework.security.core.LoginUser.INFO_KEY_DATA_ID;
|
|
|
+import static com.citu.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
|
|
import static com.citu.module.menduner.system.enums.ErrorCodeConstants.MDE_JOB_ADVERTISED_NOT_EXISTS;
|
|
|
|
|
|
/**
|
|
@@ -282,22 +291,22 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageResult<AppJobAdvertisedHomeRespVO> getRecommendedJobPage(PageParam pageParam) {
|
|
|
+ public PageResult<AppJobAdvertisedHomeRespVO> getRecommendedPage(PageParam pageParam) {
|
|
|
return jobAdvertisedMapper.selectPage(pageParam);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageResult<AppJobAdvertisedHomeRespVO> getLatestJobPage(PageParam pageParam) {
|
|
|
+ public PageResult<AppJobAdvertisedHomeRespVO> getLatestPage(PageParam pageParam) {
|
|
|
return jobAdvertisedMapper.selectPage(pageParam);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageResult<AppJobAdvertisedHomeRespVO> getUrgentJobPage(PageParam pageParam) {
|
|
|
+ public PageResult<AppJobAdvertisedHomeRespVO> getUrgentPage(PageParam pageParam) {
|
|
|
return jobAdvertisedMapper.selectPage(pageParam);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageResult<AppJobAdvertisedHomeRespVO> getAcquaintedJobAdvertised(AppJobAdvertisedPageReqVO pageReqVO) {
|
|
|
+ public PageResult<AppJobAdvertisedHomeRespVO> getAcquaintedPage(AppJobAdvertisedPageReqVO pageReqVO) {
|
|
|
return jobAdvertisedMapper.selectPage(pageReqVO);
|
|
|
}
|
|
|
|
|
@@ -320,7 +329,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public AppJobAdvertisedDetailRespVO getJobAdvertisedDetail(Long id) {
|
|
|
+ public AppJobAdvertisedDetailRespVO detail(Long id) {
|
|
|
JobAdvertisedDO job = jobAdvertisedMapper.selectById(id);
|
|
|
if (null == job) {
|
|
|
throw exception(MDE_JOB_ADVERTISED_NOT_EXISTS);
|
|
@@ -337,7 +346,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
|
|
|
// 查询联系人信息
|
|
|
AppEnterpriseUserContactRespVO contactRespVO = userBindService.
|
|
|
- getEnterpriseUserContact(enterprise.getId(), respVO.getUserId());
|
|
|
+ getContact(enterprise.getId(), respVO.getUserId());
|
|
|
respVO.setContact(contactRespVO);
|
|
|
return respVO;
|
|
|
}
|
|
@@ -377,12 +386,12 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * @param list 目标对象
|
|
|
+ * @param search 搜索结果
|
|
|
+ * @return void
|
|
|
* @description 填充搜索结果
|
|
|
* @author rayson
|
|
|
- * @param list 目标对象
|
|
|
- * @param search 搜索结果
|
|
|
* @date 2024/6/4 下午2:40
|
|
|
- * @return void
|
|
|
**/
|
|
|
private void fill(List<AppJobAdvertisedRespVO> list, SearchHits<ESJobAdvertisedMergeDO> search) {
|
|
|
search.getSearchHits().stream()
|
|
@@ -404,7 +413,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
|
|
|
// 获取职位发布人
|
|
|
AppEnterpriseUserContactRespVO contactRespVO = userBindService
|
|
|
- .getEnterpriseUserContact(searchHit.getContent().getEnterpriseId(), searchHit.getContent().getUserId());
|
|
|
+ .getContact(searchHit.getContent().getEnterpriseId(), searchHit.getContent().getUserId());
|
|
|
// 设置联系人
|
|
|
respVO.setContact(contactRespVO);
|
|
|
list.add(respVO);
|
|
@@ -452,5 +461,40 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @DSTransactional
|
|
|
+ public boolean save(AppAdminJobAdvertisedReqVO reqVO) {
|
|
|
+ LoginUser user = getLoginUser();
|
|
|
+ if (null == user || !user.getInfo().containsKey(INFO_KEY_DATA_ID)) {
|
|
|
+ // 没权限
|
|
|
+ throw exception(FORBIDDEN);
|
|
|
+ }
|
|
|
+ JobAdvertisedDO job = JobAdvertisedConvert.INSTANCE.convert3(reqVO);
|
|
|
+ if (null == reqVO.getId()) {
|
|
|
+ // 新增
|
|
|
+
|
|
|
+ job.setUserId(user.getId());
|
|
|
|
|
|
+ Long enterpriseId = Long.valueOf(user.getInfo().get(INFO_KEY_DATA_ID));
|
|
|
+ job.setEnterpriseId(enterpriseId);
|
|
|
+ job.setStatus(MendunerStatusEnum.ENABLE.getStatus());
|
|
|
+
|
|
|
+ jobAdvertisedMapper.insert(job);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ // 修改
|
|
|
+ JobAdvertisedDO entity = jobAdvertisedMapper.selectById(reqVO.getId());
|
|
|
+
|
|
|
+ if (!Objects.equals(user.getId(), entity.getUserId())
|
|
|
+ || !Objects.equals(user.getId(), entity.getEnterpriseId())) {
|
|
|
+ // 不是自己的数据
|
|
|
+ throw exception(FORBIDDEN);
|
|
|
+ }
|
|
|
+ job.setId(entity.getId());
|
|
|
+ jobAdvertisedMapper.updateById(job);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|