|
@@ -25,9 +25,9 @@ import com.citu.module.menduner.system.dal.dataobject.job.JobInterestedDO;
|
|
import com.citu.module.menduner.system.dal.mysql.job.JobAdvertisedMapper;
|
|
import com.citu.module.menduner.system.dal.mysql.job.JobAdvertisedMapper;
|
|
import com.citu.module.menduner.system.dal.mysql.job.JobInterestedMapper;
|
|
import com.citu.module.menduner.system.dal.mysql.job.JobInterestedMapper;
|
|
import com.citu.module.menduner.system.enums.MathOperationEnum;
|
|
import com.citu.module.menduner.system.enums.MathOperationEnum;
|
|
-import com.citu.module.menduner.system.enums.MendunerStatusEnum;
|
|
|
|
import com.citu.module.menduner.system.enums.account.BalanceBizTypeEnum;
|
|
import com.citu.module.menduner.system.enums.account.BalanceBizTypeEnum;
|
|
import com.citu.module.menduner.system.enums.account.PointBizTypeEnum;
|
|
import com.citu.module.menduner.system.enums.account.PointBizTypeEnum;
|
|
|
|
+import com.citu.module.menduner.system.enums.job.JobStatusEnum;
|
|
import com.citu.module.menduner.system.mq.producer.ESProducer;
|
|
import com.citu.module.menduner.system.mq.producer.ESProducer;
|
|
import com.citu.module.menduner.system.service.enterprise.EnterpriseService;
|
|
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.service.enterprise.bind.EnterpriseUserBindService;
|
|
@@ -40,7 +40,10 @@ import org.springframework.validation.annotation.Validated;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
-import java.util.*;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Collection;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.citu.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
import static com.citu.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
@@ -209,18 +212,6 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public PageResult<AppEnterpriseJobHomeRespVO> getHotEnterpriseJobPage(PageParam pageParam) {
|
|
public PageResult<AppEnterpriseJobHomeRespVO> getHotEnterpriseJobPage(PageParam pageParam) {
|
|
-// PageResult<AppEnterpriseJobHomeRespVO> result = new PageResult<>();
|
|
|
|
-// PageResult<AppEnterpriseSimpleRespVO> enterpriseSimplePage = enterpriseService.getEnterpriseSimplePage(pageParam);
|
|
|
|
-// result.setTotal(enterpriseSimplePage.getTotal());
|
|
|
|
-// List<AppEnterpriseJobHomeRespVO> list = new ArrayList<>();
|
|
|
|
-// enterpriseSimplePage.getList().forEach(enterprise -> {
|
|
|
|
-// AppEnterpriseJobHomeRespVO respVO = new AppEnterpriseJobHomeRespVO();
|
|
|
|
-// respVO.setEnterprise(enterprise);
|
|
|
|
-// List<JobAdvertisedDO> jobList = jobAdvertisedMapper.selectByEnterpriseId(enterprise.getId());
|
|
|
|
-// respVO.setJobList(JobAdvertisedConvert.INSTANCE.convertListSimple(jobList));
|
|
|
|
-// list.add(respVO);
|
|
|
|
-// });
|
|
|
|
-// result.setList(list);
|
|
|
|
PageResult<AppEnterpriseJobHomeRespVO> result =
|
|
PageResult<AppEnterpriseJobHomeRespVO> result =
|
|
jobAdvertisedMapper.getEnterpriseJobPage(pageParam);
|
|
jobAdvertisedMapper.getEnterpriseJobPage(pageParam);
|
|
if (result.getList().isEmpty()) {
|
|
if (result.getList().isEmpty()) {
|
|
@@ -314,7 +305,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@DSTransactional
|
|
@DSTransactional
|
|
- public boolean save(AppAdminJobSaveReqVO reqVO) {
|
|
|
|
|
|
+ public Long save(AppAdminJobSaveReqVO reqVO) {
|
|
LoginUser loginUser = LoginUserContext.get();
|
|
LoginUser loginUser = LoginUserContext.get();
|
|
JobAdvertisedDO job = JobAdvertisedConvert.INSTANCE.convert3(reqVO);
|
|
JobAdvertisedDO job = JobAdvertisedConvert.INSTANCE.convert3(reqVO);
|
|
Long enterpriseId = LoginUserContext.getEnterpriseId(loginUser);
|
|
Long enterpriseId = LoginUserContext.getEnterpriseId(loginUser);
|
|
@@ -322,11 +313,12 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
// 新增
|
|
// 新增
|
|
job.setUserId(loginUser.getId());
|
|
job.setUserId(loginUser.getId());
|
|
job.setEnterpriseId(enterpriseId);
|
|
job.setEnterpriseId(enterpriseId);
|
|
- job.setStatus(MendunerStatusEnum.ENABLE.getStatus());
|
|
|
|
|
|
+ job.setStatus(JobStatusEnum.ENABLE.getStatus());
|
|
job.setTop(false);
|
|
job.setTop(false);
|
|
if (!job.getHire()) {
|
|
if (!job.getHire()) {
|
|
job.setHirePoint(0);
|
|
job.setHirePoint(0);
|
|
job.setHirePrice(BigDecimal.ZERO);
|
|
job.setHirePrice(BigDecimal.ZERO);
|
|
|
|
+ job.setStatus(JobStatusEnum.WAIT_ENABLE.getStatus());
|
|
}
|
|
}
|
|
// 后置处理
|
|
// 后置处理
|
|
jobOperateAfter(enterpriseId, loginUser.getId(), job, ESOperateEnum.ADD);
|
|
jobOperateAfter(enterpriseId, loginUser.getId(), job, ESOperateEnum.ADD);
|
|
@@ -336,40 +328,18 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
JobAdvertisedDO entity = get(reqVO.getId());
|
|
JobAdvertisedDO entity = get(reqVO.getId());
|
|
// 效验
|
|
// 效验
|
|
validUpdate(enterpriseId, loginUser.getId(), entity, reqVO);
|
|
validUpdate(enterpriseId, loginUser.getId(), entity, reqVO);
|
|
-
|
|
|
|
|
|
+ // 是否是平台职位切换成众聘的职位
|
|
|
|
+ if (reqVO.getHire() && !entity.getHire()) {
|
|
|
|
+ // 普通职位切换众聘职位则进入判断,众聘切普通不进入判断
|
|
|
|
+ job.setStatus(JobStatusEnum.WAIT_ENABLE.getStatus());
|
|
|
|
+ }
|
|
job.setId(entity.getId());
|
|
job.setId(entity.getId());
|
|
// 后置处理
|
|
// 后置处理
|
|
jobOperateAfter(enterpriseId, loginUser.getId(), job, ESOperateEnum.UPDATE);
|
|
jobOperateAfter(enterpriseId, loginUser.getId(), job, ESOperateEnum.UPDATE);
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
|
|
+ return job.getId();
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 效验职位发布的编辑
|
|
|
|
- *
|
|
|
|
- * @param enterpriseId 当前操作账户所在的企业
|
|
|
|
- * @param userId 操作的用户
|
|
|
|
- * @param reqVO 发布的职位信息
|
|
|
|
- **/
|
|
|
|
- public void validAdd(Long enterpriseId,
|
|
|
|
- Long userId,
|
|
|
|
- AppAdminJobSaveReqVO reqVO) {
|
|
|
|
- if (reqVO.getHire()) {
|
|
|
|
- if (null != reqVO.getHirePrice()) {
|
|
|
|
- // // 计算需要支付的额外费用(如果是新职位,就是全额;如果是修改,就是差额)
|
|
|
|
- // boolean result = enterpriseAccountService
|
|
|
|
- // .checkBalance(enterpriseId, userId, reqVO.getHirePrice());
|
|
|
|
- // if (!result) {
|
|
|
|
- // // 余额不足
|
|
|
|
- // throw exception(MDE_ENTERPRISE_ACCOUNT_BALANCE_NOT_ENOUGH);
|
|
|
|
- // }
|
|
|
|
- }
|
|
|
|
- if (null != reqVO.getHirePoint()) {
|
|
|
|
- // 积分
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 效验职位发布的编辑
|
|
* 效验职位发布的编辑
|
|
@@ -384,40 +354,23 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
JobAdvertisedDO entity,
|
|
JobAdvertisedDO entity,
|
|
AppAdminJobSaveReqVO reqVO) {
|
|
AppAdminJobSaveReqVO reqVO) {
|
|
|
|
|
|
- if (!Objects.equals(userId, entity.getUserId())
|
|
|
|
- || !Objects.equals(enterpriseId, entity.getEnterpriseId())) {
|
|
|
|
- // TODO 不是自己的数据 (企业管理员更改企业其他用户发布的职位信息)
|
|
|
|
- // throw exception(FORBIDDEN);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (reqVO.getHire()) {
|
|
if (reqVO.getHire()) {
|
|
-// if (null != reqVO.getHirePrice()) {
|
|
|
|
-// // 计算需要支付的额外费用(如果是新职位,就是全额;如果是修改,就是差额)
|
|
|
|
-// BigDecimal extraCost = reqVO.getId() == null ? reqVO.getHirePrice()
|
|
|
|
-// : reqVO.getHirePrice().subtract(entity.getHirePrice());
|
|
|
|
-//
|
|
|
|
-// boolean result = enterpriseAccountService
|
|
|
|
-// .checkBalance(enterpriseId, userId, extraCost);
|
|
|
|
-// if (!result) {
|
|
|
|
-// // 余额不足
|
|
|
|
-// throw exception(MDE_ENTERPRISE_ACCOUNT_BALANCE_NOT_ENOUGH);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
- // TODO 暂时不给改,不清楚逻辑
|
|
|
|
- if (null != reqVO.getHirePrice()) {
|
|
|
|
|
|
+ // price 不为空 && 之前是众聘的职位(防止平台职位切换成众聘职位这种情况)
|
|
|
|
+ if (null != reqVO.getHirePrice() && entity.getHire()) {
|
|
if (entity.getHirePrice().compareTo(reqVO.getHirePrice()) != 0) {
|
|
if (entity.getHirePrice().compareTo(reqVO.getHirePrice()) != 0) {
|
|
throw exception(MDE_JOB_ADVERTISED_BALANCE_UPDATE);
|
|
throw exception(MDE_JOB_ADVERTISED_BALANCE_UPDATE);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (null != reqVO.getHirePoint()) {
|
|
|
|
|
|
+ // price 不为空 && 之前是众聘的职位(防止平台职位切换成众聘职位这种情况)
|
|
|
|
+ if (null != reqVO.getHirePoint() && entity.getHire()) {
|
|
// 积分
|
|
// 积分
|
|
if (!entity.getHirePoint().equals(reqVO.getHirePoint())) {
|
|
if (!entity.getHirePoint().equals(reqVO.getHirePoint())) {
|
|
throw exception(MDE_JOB_ADVERTISED_POINT_UPDATE);
|
|
throw exception(MDE_JOB_ADVERTISED_POINT_UPDATE);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
public JobAdvertisedDO get(Long id) {
|
|
public JobAdvertisedDO get(Long id) {
|
|
@@ -433,11 +386,11 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
public boolean enable(List<Long> ids) {
|
|
public boolean enable(List<Long> ids) {
|
|
for (Long id : ids) {
|
|
for (Long id : ids) {
|
|
JobAdvertisedDO job = get(id);
|
|
JobAdvertisedDO job = get(id);
|
|
- if (MendunerStatusEnum.ENABLE.getStatus().equals(job.getStatus())) {
|
|
|
|
|
|
+ if (JobStatusEnum.ENABLE.getStatus().equals(job.getStatus())) {
|
|
// 已经是开启状态
|
|
// 已经是开启状态
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
- job.setStatus(MendunerStatusEnum.ENABLE.getStatus());
|
|
|
|
|
|
+ job.setStatus(JobStatusEnum.ENABLE.getStatus());
|
|
jobAdvertisedMapper.updateById(job);
|
|
jobAdvertisedMapper.updateById(job);
|
|
jobDataSync(job, ESOperateEnum.UPDATE);
|
|
jobDataSync(job, ESOperateEnum.UPDATE);
|
|
}
|
|
}
|
|
@@ -449,11 +402,11 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
public boolean disable(List<Long> ids) {
|
|
public boolean disable(List<Long> ids) {
|
|
for (Long id : ids) {
|
|
for (Long id : ids) {
|
|
JobAdvertisedDO job = get(id);
|
|
JobAdvertisedDO job = get(id);
|
|
- if (MendunerStatusEnum.DISABLE.getStatus().equals(job.getStatus())) {
|
|
|
|
|
|
+ if (JobStatusEnum.DISABLE.getStatus().equals(job.getStatus())) {
|
|
// 已经是关闭状态
|
|
// 已经是关闭状态
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
- job.setStatus(MendunerStatusEnum.DISABLE.getStatus());
|
|
|
|
|
|
+ job.setStatus(JobStatusEnum.DISABLE.getStatus());
|
|
jobAdvertisedMapper.updateById(job);
|
|
jobAdvertisedMapper.updateById(job);
|
|
jobDataSync(job, ESOperateEnum.UPDATE);
|
|
jobDataSync(job, ESOperateEnum.UPDATE);
|
|
}
|
|
}
|
|
@@ -513,31 +466,33 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
}
|
|
}
|
|
|
|
|
|
// ========== 众聘处理 ==========
|
|
// ========== 众聘处理 ==========
|
|
- if (job.getHire()) {
|
|
|
|
- if (null != job.getHirePrice()) {
|
|
|
|
- // 创建记录 并扣除余额
|
|
|
|
- accountRecordService.createBalanceRecord(
|
|
|
|
- userId,
|
|
|
|
- BalanceBizTypeEnum.PUBLISH.getName(),
|
|
|
|
- MathOperationEnum.SUBTRACT,
|
|
|
|
- job.getHirePrice(),
|
|
|
|
- BalanceBizTypeEnum.PUBLISH,
|
|
|
|
- String.valueOf(job.getId()));
|
|
|
|
- }
|
|
|
|
- if (null != job.getHirePoint()) {
|
|
|
|
- // 创建记录 并扣除积分
|
|
|
|
- accountRecordService.createPointRecord(
|
|
|
|
- userId,
|
|
|
|
- "",
|
|
|
|
- PointBizTypeEnum.PUBLISH.getName(),
|
|
|
|
- MathOperationEnum.SUBTRACT,
|
|
|
|
- job.getHirePoint(),
|
|
|
|
- PointBizTypeEnum.PUBLISH,
|
|
|
|
- String.valueOf(job.getId()));
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ // TODO 待改
|
|
|
|
+
|
|
|
|
+ // if (job.getHire()) {
|
|
|
|
+ // if (null != job.getHirePrice()) {
|
|
|
|
+ // // 创建记录 并扣除余额
|
|
|
|
+ // accountRecordService.createBalanceRecord(
|
|
|
|
+ // userId,
|
|
|
|
+ // BalanceBizTypeEnum.PUBLISH.getName(),
|
|
|
|
+ // MathOperationEnum.SUBTRACT,
|
|
|
|
+ // job.getHirePrice(),
|
|
|
|
+ // BalanceBizTypeEnum.PUBLISH,
|
|
|
|
+ // String.valueOf(job.getId()));
|
|
|
|
+ // }
|
|
|
|
+ // if (null != job.getHirePoint()) {
|
|
|
|
+ // // 创建记录 并扣除积分
|
|
|
|
+ // accountRecordService.createPointRecord(
|
|
|
|
+ // userId,
|
|
|
|
+ // "",
|
|
|
|
+ // PointBizTypeEnum.PUBLISH.getName(),
|
|
|
|
+ // MathOperationEnum.SUBTRACT,
|
|
|
|
+ // job.getHirePoint(),
|
|
|
|
+ // PointBizTypeEnum.PUBLISH,
|
|
|
|
+ // String.valueOf(job.getId()));
|
|
|
|
+ //
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
|
// ========== ES数据同步处理 ==========
|
|
// ========== ES数据同步处理 ==========
|