|
|
@@ -1,9 +1,11 @@
|
|
|
package org.dromara.main.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
@@ -15,6 +17,7 @@ import org.dromara.main.domain.bo.MainPostCandidateStatusBo;
|
|
|
import org.dromara.main.domain.vo.MainPostCandidateVo;
|
|
|
import org.dromara.main.mapper.MainBackCandidateMapper;
|
|
|
import org.dromara.main.mapper.MainStudentMapper;
|
|
|
+import org.dromara.main.service.IMainMessageService;
|
|
|
import org.dromara.main.service.IMainPostCandidateService;
|
|
|
import org.dromara.system.service.ISysOssService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -23,6 +26,7 @@ import java.io.IOException;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
|
|
|
|
+@Slf4j
|
|
|
@RequiredArgsConstructor
|
|
|
@Service
|
|
|
public class MainPostCandidateServiceImpl implements IMainPostCandidateService {
|
|
|
@@ -34,6 +38,7 @@ public class MainPostCandidateServiceImpl implements IMainPostCandidateService {
|
|
|
private final MainBackCandidateMapper mainBackCandidateMapper;
|
|
|
private final MainStudentMapper mainStudentMapper;
|
|
|
private final ISysOssService sysOssService;
|
|
|
+ private final IMainMessageService mainMessageService;
|
|
|
|
|
|
@Override
|
|
|
public TableDataInfo<MainPostCandidateVo> queryPageList(MainPostCandidateQueryBo bo, PageQuery pageQuery) {
|
|
|
@@ -66,7 +71,12 @@ public class MainPostCandidateServiceImpl implements IMainPostCandidateService {
|
|
|
entity.setRemark(bo.getRemark());
|
|
|
entity.setOfferFileUrl(bo.getOfferAttachment());
|
|
|
entity.setOfferTime(LocalDateTime.now());
|
|
|
- return mainBackCandidateMapper.updateById(entity) > 0;
|
|
|
+ boolean hired = mainBackCandidateMapper.updateById(entity) > 0;
|
|
|
+ if (hired) {
|
|
|
+ MainBackCandidate candidate = mainBackCandidateMapper.selectById(bo.getId());
|
|
|
+ sendCandidateNotification(candidate, "投递进度更新", "企业已发送Offer,请及时查看");
|
|
|
+ }
|
|
|
+ return hired;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -85,7 +95,13 @@ public class MainPostCandidateServiceImpl implements IMainPostCandidateService {
|
|
|
entity.setId(bo.getId());
|
|
|
entity.setEnterpriseStatus(normalizedStatus);
|
|
|
entity.setRemark(bo.getRemark());
|
|
|
- return mainBackCandidateMapper.updateById(entity) > 0;
|
|
|
+ boolean updated = mainBackCandidateMapper.updateById(entity) > 0;
|
|
|
+ if (updated) {
|
|
|
+ MainBackCandidate candidate = mainBackCandidateMapper.selectById(bo.getId());
|
|
|
+ String msgContent = ENTERPRISE_STATUS_ADOPTED.equals(normalizedStatus) ? "企业已录用" : "企业已拒绝";
|
|
|
+ sendCandidateNotification(candidate, "投递进度更新", msgContent);
|
|
|
+ }
|
|
|
+ return updated;
|
|
|
}
|
|
|
|
|
|
private String normalizeStatus(String status) {
|
|
|
@@ -115,4 +131,16 @@ public class MainPostCandidateServiceImpl implements IMainPostCandidateService {
|
|
|
}
|
|
|
sysOssService.download(student.getResumeFile(), response);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 投递进度变化时发送通知消息给学员
|
|
|
+ */
|
|
|
+ private void sendCandidateNotification(MainBackCandidate candidate, String title, String content) {
|
|
|
+ try {
|
|
|
+ if (candidate == null || candidate.getStudentId() == null) return;
|
|
|
+ mainMessageService.sendNotification(candidate.getStudentId(), title, content, candidate.getPostId());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("投递进度变化发送通知消息失败,candidateId={}, error={}", candidate != null ? candidate.getId() : null, e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|