|
@@ -2,6 +2,7 @@ package com.citu.module.menduner.system.service.job;
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.http.HtmlUtil;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.citu.framework.common.pojo.PageParam;
|
|
@@ -32,6 +33,7 @@ import com.citu.module.menduner.system.enums.sync.SyncConstants;
|
|
|
import com.citu.module.menduner.system.mq.producer.ESProducer;
|
|
|
import com.citu.module.menduner.system.mq.producer.GraphProducer;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
@@ -42,12 +44,14 @@ import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.citu.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
+import static com.citu.module.menduner.common.util.TimeUtils.generateDateTimeRange;
|
|
|
+import static com.citu.module.menduner.system.dal.redis.RedisKeyConstants.JOB_SHARE;
|
|
|
import static com.citu.module.menduner.system.enums.DictTypeConstants.*;
|
|
|
import static com.citu.module.menduner.system.enums.ErrorCodeConstants.*;
|
|
|
-import static com.citu.module.menduner.common.util.TimeUtils.generateDateTimeRange;
|
|
|
|
|
|
/**
|
|
|
* 招聘职位 Service 实现类
|
|
@@ -72,6 +76,9 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
@Resource
|
|
|
private GraphApi graphApi;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private RedisTemplate<String, Object> redisTemplate;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Long createJobAdvertised(JobAdvertisedSaveReqVO createReqVO) {
|
|
@@ -468,7 +475,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
@Override
|
|
|
public void renewal(AppRecruitJobRenewalReqVO reqVO) {
|
|
|
JobAdvertisedDO job = get(reqVO.getId());
|
|
|
- if(null == reqVO.getTime() || LocalDateTime.now().isAfter(reqVO.getTime())) {
|
|
|
+ if (null == reqVO.getTime() || LocalDateTime.now().isAfter(reqVO.getTime())) {
|
|
|
// 时间不能小于当前时间
|
|
|
throw exception(MDE_JOB_ADVERTISED_TIME_ERROR);
|
|
|
}
|
|
@@ -476,6 +483,32 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
mapper.updateById(job);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Object getShareById(Long id) {
|
|
|
+
|
|
|
+ Map<Object, Object> value = redisTemplate.opsForHash().entries(JOB_SHARE + "_" + id);
|
|
|
+
|
|
|
+ if (null == value || value.isEmpty()) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return value.get("data");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long share(Map<String, Object> map) {
|
|
|
+ // 生成一个唯一的ID
|
|
|
+ Long id = IdUtil.getSnowflakeNextId();
|
|
|
+ String key = JOB_SHARE + "_" + id;
|
|
|
+ // 将数据存入Redis哈希表
|
|
|
+ redisTemplate.opsForHash().put(key, "data", map);
|
|
|
+
|
|
|
+ // 设置整个键的过期时间(例如:30天后过期)
|
|
|
+ redisTemplate.expire(key, 30, TimeUnit.DAYS);
|
|
|
+
|
|
|
+ return id;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 职位操作最后的操作
|
|
|
*
|