西格玛许 2 天之前
父節點
當前提交
4e6aed2be6

+ 17 - 5
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/controller/MainBackCandidateController.java

@@ -5,11 +5,7 @@ import org.dromara.common.core.domain.R;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.common.web.core.BaseController;
 import org.dromara.main.service.IMainBackCandidateService;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 import java.util.Map;
@@ -63,4 +59,20 @@ public class MainBackCandidateController extends BaseController {
         Boolean result = mainBackCandidateService.rejectOffer(id, studentId);
         return toAjax(result);
     }
+
+
+    @PostMapping("/apply")
+    public R<Void> apply(@RequestBody Map<String, Object> params) {
+        Long studentId = LoginHelper.getUserId();
+        if (studentId == null) {
+            return R.fail("未登录");
+        }
+        Object postIdObj = params.get("postId");
+        if (postIdObj == null) {
+            return R.fail("岗位ID不能为空");
+        }
+        Long postId = Long.valueOf(postIdObj.toString());
+        Boolean result = mainBackCandidateService.applyPosition(studentId, postId);
+        return toAjax(result);
+    }
 }

+ 2 - 1
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/mapper/MainExamApplyMapper.java

@@ -24,7 +24,7 @@ public interface MainExamApplyMapper extends BaseMapperPlus<MainExamApply, MainE
             a.id,
             a.evaluation_id AS evaluationId,
             e.evaluation_name AS evaluationName,
-            e.position AS positionName,
+            p.post_name AS positionName,
             a.student_id AS studentId,
             a.apply_status AS applyStatus,
             a.final_result AS finalResult,
@@ -46,6 +46,7 @@ public interface MainExamApplyMapper extends BaseMapperPlus<MainExamApply, MainE
             a.create_time AS createTime
         FROM main_exam_apply a
         LEFT JOIN main_exam_evaluation e ON a.evaluation_id = e.id AND IFNULL(e.del_flag, '0') = '0'
+        LEFT JOIN main_position p ON e.position_id = p.id
         WHERE IFNULL(a.del_flag, '0') = '0'
           AND a.student_id = #{studentId}
         ORDER BY COALESCE(a.finished_time, a.update_time, a.create_time) DESC, a.id DESC

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

@@ -35,4 +35,14 @@ public interface IMainBackCandidateService {
      * @return 是否成功
      */
     Boolean rejectOffer(Long id, Long studentId);
+
+
+    /**
+     * 学员投递简历(应聘岗位)
+     *
+     * @param studentId 学员ID
+     * @param postId    岗位ID
+     * @return 是否成功
+     */
+    Boolean applyPosition(Long studentId, Long postId);
 }

+ 32 - 0
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/service/impl/MainBackCandidateServiceImpl.java

@@ -129,4 +129,36 @@ public class MainBackCandidateServiceImpl implements IMainBackCandidateService {
 
         return mainBackCandidateMapper.updateById(update) > 0;
     }
+
+
+    @Override
+    public Boolean applyPosition(Long studentId, Long postId) {
+        // 查询岗位信息获取 tenantId
+        MainPosition position = mainPositionMapper.selectById(postId);
+        if (position == null) {
+            throw new ServiceException("岗位不存在");
+        }
+
+        // 检查是否已投递过
+        LambdaQueryWrapper<MainBackCandidate> existsWrapper = new LambdaQueryWrapper<>();
+        existsWrapper.eq(MainBackCandidate::getStudentId, studentId)
+            .eq(MainBackCandidate::getPostId, postId)
+            .eq(MainBackCandidate::getDelFlag, "0");
+        Long count = mainBackCandidateMapper.selectCount(existsWrapper);
+        if (count > 0) {
+            throw new ServiceException("您已投递过该岗位");
+        }
+
+        // 创建候选记录
+        MainBackCandidate candidate = new MainBackCandidate();
+        candidate.setStudentId(studentId);
+        candidate.setPostId(postId);
+        candidate.setTenantId(position.getTenantId());
+        candidate.setSource("student_apply");
+        candidate.setEnterpriseStatus("pending");
+        candidate.setStudentStatus("pending");
+        candidate.setStatus("pending");
+
+        return mainBackCandidateMapper.insert(candidate) > 0;
+    }
 }

+ 1 - 1
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/service/impl/MainExamEvaluationServiceImpl.java

@@ -90,7 +90,6 @@ public class MainExamEvaluationServiceImpl implements IMainExamEvaluationService
         lqw.eq(StringUtils.isNotBlank(bo.getGrade()), "e.grade", bo.getGrade());
         lqw.eq(bo.getPositionId() != null, "e.position_id", bo.getPositionId());
         lqw.eq(StringUtils.isNotBlank(bo.getPositionType()), "e.position_type", bo.getPositionType());
-
         // 2. 业务状态搜索逻辑
         if (StringUtils.isNotBlank(bo.getStatus())) {
             Date now = new Date();
@@ -126,6 +125,7 @@ public class MainExamEvaluationServiceImpl implements IMainExamEvaluationService
             }
         }
 
+        lqw.eq("e.del_flag", "0");
         lqw.orderByDesc("e.create_time");
         return lqw;
     }