Gqingci 2 дней назад
Родитель
Сommit
7d8fcf1b6b

+ 10 - 0
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/controller/MainPostCandidateController.java

@@ -15,12 +15,14 @@ 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.service.IMainPostCandidateService;
 import org.dromara.main.service.IMainPostCandidateService;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
+import java.io.IOException;
 import java.util.List;
 import java.util.List;
 
 
 @RequiredArgsConstructor
 @RequiredArgsConstructor
@@ -51,4 +53,12 @@ public class MainPostCandidateController extends BaseController {
     public R<Void> updateStatus(@RequestBody MainPostCandidateStatusBo bo) {
     public R<Void> updateStatus(@RequestBody MainPostCandidateStatusBo bo) {
         return toAjax(mainPostCandidateService.updateStatus(bo));
         return toAjax(mainPostCandidateService.updateStatus(bo));
     }
     }
+
+    /**
+     * 下载候选人简历附件
+     */
+    @GetMapping("/resume/{candidateId}")
+    public void downloadResume(@PathVariable Long candidateId, HttpServletResponse response) throws IOException {
+        mainPostCandidateService.downloadResume(candidateId, response);
+    }
 }
 }

+ 3 - 0
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/domain/vo/MainPostCandidateVo.java

@@ -50,4 +50,7 @@ public class MainPostCandidateVo implements Serializable {
 
 
     @ExcelProperty(value = "备注")
     @ExcelProperty(value = "备注")
     private String remark;
     private String remark;
+
+    @ExcelIgnore
+    private Long evaluationId;
 }
 }

+ 10 - 0
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/service/IMainPostCandidateService.java

@@ -1,5 +1,6 @@
 package org.dromara.main.service;
 package org.dromara.main.service;
 
 
+import jakarta.servlet.http.HttpServletResponse;
 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.bo.MainPostCandidateHireBo;
 import org.dromara.main.domain.bo.MainPostCandidateHireBo;
@@ -7,6 +8,7 @@ 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 java.io.IOException;
 import java.util.List;
 import java.util.List;
 
 
 public interface IMainPostCandidateService {
 public interface IMainPostCandidateService {
@@ -18,4 +20,12 @@ public interface IMainPostCandidateService {
     Boolean hireCandidate(MainPostCandidateHireBo bo);
     Boolean hireCandidate(MainPostCandidateHireBo bo);
 
 
     Boolean updateStatus(MainPostCandidateStatusBo bo);
     Boolean updateStatus(MainPostCandidateStatusBo bo);
+
+    /**
+     * 下载候选人简历附件
+     *
+     * @param candidateId 候选人记录ID
+     * @param response    HTTP响应
+     */
+    void downloadResume(Long candidateId, HttpServletResponse response) throws IOException;
 }
 }

+ 30 - 21
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/service/impl/MainPostCandidateServiceImpl.java

@@ -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);
+    }
 }
 }

+ 3 - 1
ruoyi-modules/ruoyi-main/src/main/resources/mapper/MainBackCandidateMapper.xml

@@ -34,12 +34,14 @@
             END AS statusType,
             END AS statusType,
             DATE_FORMAT(COALESCE(c.update_time, c.create_time), '%Y-%m-%d %H:%i:%s') AS evaluateTime,
             DATE_FORMAT(COALESCE(c.update_time, c.create_time), '%Y-%m-%d %H:%i:%s') AS evaluateTime,
             s.resume_file AS resumeFile,
             s.resume_file AS resumeFile,
-            c.remark
+            c.remark,
+            e.id AS evaluationId
     </sql>
     </sql>
 
 
     <sql id="selectPostCandidateFromWhere">
     <sql id="selectPostCandidateFromWhere">
         FROM main_back_candidate c
         FROM main_back_candidate c
         LEFT JOIN main_student s ON c.student_id = s.id AND IFNULL(s.del_flag, '0') = '0'
         LEFT JOIN main_student s ON c.student_id = s.id AND IFNULL(s.del_flag, '0') = '0'
+        LEFT JOIN main_exam_evaluation e ON c.post_id = e.position_id AND IFNULL(e.del_flag, '0') = '0'
         WHERE IFNULL(c.del_flag, '0') = '0'
         WHERE IFNULL(c.del_flag, '0') = '0'
           AND c.post_id = #{bo.postId}
           AND c.post_id = #{bo.postId}
         <if test="bo.keyword != null and bo.keyword != ''">
         <if test="bo.keyword != null and bo.keyword != ''">