|
@@ -2,21 +2,25 @@ package org.dromara.main.service.impl;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
import org.dromara.main.domain.MainBackCandidate;
|
|
import org.dromara.main.domain.MainBackCandidate;
|
|
|
-import org.dromara.main.domain.MainPostCandidateHireAttachment;
|
|
|
|
|
|
|
+import org.dromara.main.domain.MainStudent;
|
|
|
import org.dromara.main.domain.bo.MainPostCandidateHireBo;
|
|
import org.dromara.main.domain.bo.MainPostCandidateHireBo;
|
|
|
import org.dromara.main.domain.bo.MainPostCandidateQueryBo;
|
|
import org.dromara.main.domain.bo.MainPostCandidateQueryBo;
|
|
|
import org.dromara.main.domain.bo.MainPostCandidateStatusBo;
|
|
import org.dromara.main.domain.bo.MainPostCandidateStatusBo;
|
|
|
import org.dromara.main.domain.vo.MainPostCandidateVo;
|
|
import org.dromara.main.domain.vo.MainPostCandidateVo;
|
|
|
import org.dromara.main.mapper.MainBackCandidateMapper;
|
|
import org.dromara.main.mapper.MainBackCandidateMapper;
|
|
|
-import org.dromara.main.mapper.MainPostCandidateHireAttachmentMapper;
|
|
|
|
|
|
|
+import org.dromara.main.mapper.MainStudentMapper;
|
|
|
import org.dromara.main.service.IMainPostCandidateService;
|
|
import org.dromara.main.service.IMainPostCandidateService;
|
|
|
|
|
+import org.dromara.system.service.ISysOssService;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
@@ -28,7 +32,8 @@ public class MainPostCandidateServiceImpl implements IMainPostCandidateService {
|
|
|
private static final String ENTERPRISE_STATUS_PENDING = "pending";
|
|
private static final String ENTERPRISE_STATUS_PENDING = "pending";
|
|
|
|
|
|
|
|
private final MainBackCandidateMapper mainBackCandidateMapper;
|
|
private final MainBackCandidateMapper mainBackCandidateMapper;
|
|
|
- private final MainPostCandidateHireAttachmentMapper hireAttachmentMapper;
|
|
|
|
|
|
|
+ private final MainStudentMapper mainStudentMapper;
|
|
|
|
|
+ private final ISysOssService sysOssService;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public TableDataInfo<MainPostCandidateVo> queryPageList(MainPostCandidateQueryBo bo, PageQuery pageQuery) {
|
|
public TableDataInfo<MainPostCandidateVo> queryPageList(MainPostCandidateQueryBo bo, PageQuery pageQuery) {
|
|
@@ -59,24 +64,9 @@ public class MainPostCandidateServiceImpl implements IMainPostCandidateService {
|
|
|
entity.setId(bo.getId());
|
|
entity.setId(bo.getId());
|
|
|
entity.setEnterpriseStatus(ENTERPRISE_STATUS_ADOPTED);
|
|
entity.setEnterpriseStatus(ENTERPRISE_STATUS_ADOPTED);
|
|
|
entity.setRemark(bo.getRemark());
|
|
entity.setRemark(bo.getRemark());
|
|
|
- boolean updated = mainBackCandidateMapper.updateById(entity) > 0;
|
|
|
|
|
- if (!updated) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- MainPostCandidateHireAttachment attachment = hireAttachmentMapper.selectOne(
|
|
|
|
|
- Wrappers.<MainPostCandidateHireAttachment>lambdaQuery()
|
|
|
|
|
- .eq(MainPostCandidateHireAttachment::getCandidateId, bo.getId())
|
|
|
|
|
- .last("limit 1")
|
|
|
|
|
- );
|
|
|
|
|
- if (attachment == null) {
|
|
|
|
|
- attachment = new MainPostCandidateHireAttachment();
|
|
|
|
|
- attachment.setCandidateId(bo.getId());
|
|
|
|
|
- attachment.setOssIds(bo.getOfferAttachment());
|
|
|
|
|
- return hireAttachmentMapper.insert(attachment) > 0;
|
|
|
|
|
- }
|
|
|
|
|
- attachment.setOssIds(bo.getOfferAttachment());
|
|
|
|
|
- return hireAttachmentMapper.updateById(attachment) > 0;
|
|
|
|
|
|
|
+ entity.setOfferFileUrl(bo.getOfferAttachment());
|
|
|
|
|
+ entity.setOfferTime(LocalDateTime.now());
|
|
|
|
|
+ return mainBackCandidateMapper.updateById(entity) > 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -106,4 +96,23 @@ public class MainPostCandidateServiceImpl implements IMainPostCandidateService {
|
|
|
default -> null;
|
|
default -> null;
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void downloadResume(Long candidateId, HttpServletResponse response) throws IOException {
|
|
|
|
|
+ if (candidateId == null) {
|
|
|
|
|
+ throw new ServiceException("候选人ID不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ MainBackCandidate candidate = mainBackCandidateMapper.selectById(candidateId);
|
|
|
|
|
+ if (candidate == null) {
|
|
|
|
|
+ throw new ServiceException("候选人记录不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (candidate.getStudentId() == null) {
|
|
|
|
|
+ throw new ServiceException("候选人未关联学员");
|
|
|
|
|
+ }
|
|
|
|
|
+ MainStudent student = mainStudentMapper.selectById(candidate.getStudentId());
|
|
|
|
|
+ if (student == null || student.getResumeFile() == null) {
|
|
|
|
|
+ throw new ServiceException("该候选人暂无简历附件");
|
|
|
|
|
+ }
|
|
|
|
|
+ sysOssService.download(student.getResumeFile(), response);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|