Gqingci 4 일 전
부모
커밋
cec02ca4fd

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

@@ -9,6 +9,7 @@ import org.dromara.common.core.exception.ServiceException;
 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.domain.bo.BackgroundCheckFormBo;
 import org.dromara.main.domain.bo.MainBackCategoryBo;
 import org.dromara.main.domain.bo.MainBackClauseBo;
 import org.dromara.main.domain.bo.PortalCheckOrderCreateBo;
@@ -220,6 +221,15 @@ public class PortalCheckController extends BaseController {
         return R.ok();
     }
 
+    /**
+     * 提交背景调查表单(总控填写后提交)
+     */
+    @PostMapping("/bgform/submit")
+    public R<Void> submitBackgroundCheckForm(@Validated @RequestBody BackgroundCheckFormBo bo) {
+        mainBackOrderService.submitBackgroundCheckForm(bo);
+        return R.ok();
+    }
+
     private PortalCheckCategoryVo toPortalCategoryVo(MainBackCategoryVo category) {
         PortalCheckCategoryVo vo = new PortalCheckCategoryVo();
         vo.setId(category.getId());

+ 96 - 0
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/domain/bo/BackgroundCheckFormBo.java

@@ -0,0 +1,96 @@
+package org.dromara.main.domain.bo;
+
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 背景调查表单提交BO
+ */
+@Data
+public class BackgroundCheckFormBo {
+
+    /** 背调记录ID(必填,标识哪条背调记录) */
+    @NotNull(message = "背调记录ID不能为空")
+    private Long recordId;
+
+    // ===== 1. 候选人基本信息 =====
+    private String candidateName;
+    private String applyPosition;
+    private String checkTime;
+
+    // ===== 2. 学历核实 =====
+    private String gradSchool;
+    private String eduCertNo;
+    /** 属实 / 不属实 / 无法核实 */
+    private String eduVerifyStatus;
+
+    // ===== 3. 最近工作单位 =====
+    private String companyName;
+    /** [开始日期, 结束日期] */
+    private List<String> workPeriod;
+    private String position;
+    private String lastSalary;
+    private String leaveReasonVerify;
+    /** 备注/信息来源(社保记录/证明人) */
+    private String attachment1Remark;
+
+    // ===== 4. 工作表现评估 - 上级评价 =====
+    private String leaderEvalAdvantage;
+    private String leaderEvalImprove;
+    private String leaderEvalProf;
+    private String leaderEvalAttitude;
+    private String leaderEvalTeam;
+    private String leaderEvalMorals;
+
+    // ===== 4. 工作表现评估 - 同事评价 =====
+    private String colleagueEvalTeamwork;
+    private String colleagueEvalProf;
+
+    // ===== 4. 工作表现评估 - HR评价 =====
+    /** 无 / 有 */
+    private String hrEvalDispute;
+    /** 良好 / 一般 / 需关注 */
+    private String hrEvalTransfer;
+    /** 备注/信息来源(访谈记录/补充材料) */
+    private String attachment2Remark;
+
+    // ===== 5. 法务风险 =====
+    private Boolean hasNonCompete;
+    private Boolean hasNda;
+    private String agreementRemark;
+    private Boolean hasDisputeStatus;
+    private String disputeRemark;
+
+    // ===== 6. 访谈记录 =====
+    private InterviewInfo interviewSupervisor;
+    private InterviewInfo interviewHR;
+    private InterviewInfo interviewColleague;
+
+    // ===== 7. 调查结论 =====
+    /** 推荐入职 / 有条件推荐 / 不推荐 */
+    private String conclusion;
+    private String conclusionReason;
+    private String investigatorName;
+    private String investigatorDate;
+
+    @Data
+    public static class InterviewInfo {
+        private String name;
+        private String relationship;
+        private String contact;
+        private String q1;
+        private String q2;
+        private String q3;
+        private String q4;
+        private String q5;
+
+        /** 判断是否有实质内容 */
+        public boolean hasContent() {
+            return (name != null && !name.isBlank())
+                || (q1 != null && !q1.isBlank())
+                || (q2 != null && !q2.isBlank());
+        }
+    }
+}

+ 5 - 0
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/service/IMainBackOrderService.java

@@ -74,4 +74,9 @@ public interface IMainBackOrderService {
      * 下载门户候选人报告
      */
     void downloadPortalCandidateReport(Long recordId, String tenantId, HttpServletResponse response);
+
+    /**
+     * 提交背景调查表单(总控填写)
+     */
+    void submitBackgroundCheckForm(org.dromara.main.domain.bo.BackgroundCheckFormBo bo);
 }

+ 227 - 0
ruoyi-modules/ruoyi-main/src/main/java/org/dromara/main/service/impl/MainBackOrderServiceImpl.java

@@ -26,6 +26,7 @@ import org.dromara.main.domain.MainOrder;
 import org.dromara.main.domain.MainPosition;
 import org.dromara.main.domain.MainPostCandidateReview;
 import org.dromara.main.domain.MainBackInterview;
+import org.dromara.main.domain.bo.BackgroundCheckFormBo;
 import org.dromara.main.domain.bo.MainBackOrderBo;
 import org.dromara.main.domain.bo.PortalCheckOrderCreateBo;
 import org.dromara.main.domain.MainStudent;
@@ -1334,6 +1335,232 @@ public class MainBackOrderServiceImpl implements IMainBackOrderService {
         }
     }
 
+    /**
+     * 提交背景调查表单(总控填写后提交)
+     * 将前端表单数据拆分写入 education / experience / review / interview 四张表,
+     * 并将 record 的 report_status 设为 1(已出具)。
+     */
+    @Override
+    public void submitBackgroundCheckForm(BackgroundCheckFormBo bo) {
+        // 1. 校验 record 存在
+        MainBackRecord record = recordMapper.selectById(bo.getRecordId());
+        if (record == null) {
+            throw new ServiceException("背调记录不存在");
+        }
+
+        MainBackCandidate candidate = mainBackCandidateMapper.selectById(record.getCandidateId());
+        if (candidate == null) {
+            throw new ServiceException("候选人记录不存在");
+        }
+        Long studentId = candidate.getStudentId();
+
+        // 2. 更新学历信息
+        saveEducation(studentId, bo);
+
+        // 3. 更新工作经历
+        saveExperience(studentId, bo);
+
+        // 4. 更新/创建评价记录
+        saveReview(candidate, bo);
+
+        // 5. 保存访谈记录(先删旧的,再插入新的)
+        saveInterviews(record, candidate, bo);
+
+        // 6. 更新 record 状态为已出具,清除缓存的报告URL
+        MainBackRecord update = new MainBackRecord();
+        update.setId(record.getId());
+        update.setReportStatus(1);
+        update.setReportUrl(null);
+        update.setFinishTime(LocalDateTime.now());
+        recordMapper.updateById(update);
+    }
+
+    private void saveEducation(Long studentId, BackgroundCheckFormBo bo) {
+        MainStudentEducation education = mainStudentEducationMapper.selectOne(
+            Wrappers.<MainStudentEducation>lambdaQuery()
+                .eq(MainStudentEducation::getStudentId, studentId)
+                .orderByDesc(MainStudentEducation::getCreateTime)
+                .last("limit 1")
+        );
+        if (education == null) {
+            education = new MainStudentEducation();
+            education.setStudentId(studentId);
+        }
+        if (StringUtils.isNotBlank(bo.getGradSchool())) {
+            education.setSchool(bo.getGradSchool());
+        }
+        if (StringUtils.isNotBlank(bo.getEduCertNo())) {
+            education.setCertNo(bo.getEduCertNo());
+        }
+        if (StringUtils.isNotBlank(bo.getEduVerifyStatus())) {
+            education.setCheckResult(bo.getEduVerifyStatus());
+        }
+        if (education.getId() == null) {
+            mainStudentEducationMapper.insert(education);
+        } else {
+            mainStudentEducationMapper.updateById(education);
+        }
+    }
+
+    private void saveExperience(Long studentId, BackgroundCheckFormBo bo) {
+        MainStudentExperience experience = mainStudentExperienceMapper.selectOne(
+            Wrappers.<MainStudentExperience>lambdaQuery()
+                .eq(MainStudentExperience::getStudentId, studentId)
+                .orderByDesc(MainStudentExperience::getCreateTime)
+                .last("limit 1")
+        );
+        if (experience == null) {
+            experience = new MainStudentExperience();
+            experience.setStudentId(studentId);
+        }
+        if (StringUtils.isNotBlank(bo.getCompanyName())) {
+            experience.setCompany(bo.getCompanyName());
+        }
+        if (bo.getWorkPeriod() != null && bo.getWorkPeriod().size() >= 2) {
+            experience.setStartTime(bo.getWorkPeriod().get(0));
+            experience.setEndTime(bo.getWorkPeriod().get(1));
+        }
+        if (StringUtils.isNotBlank(bo.getPosition())) {
+            experience.setJobTitle(bo.getPosition());
+        }
+        if (StringUtils.isNotBlank(bo.getLastSalary())) {
+            experience.setLastSalary(bo.getLastSalary());
+        }
+        if (StringUtils.isNotBlank(bo.getAttachment1Remark())) {
+            experience.setCheckRemark(bo.getAttachment1Remark());
+        }
+        if (experience.getId() == null) {
+            mainStudentExperienceMapper.insert(experience);
+        } else {
+            mainStudentExperienceMapper.updateById(experience);
+        }
+    }
+
+    private void saveReview(MainBackCandidate candidate, BackgroundCheckFormBo bo) {
+        MainPostCandidateReview review = mainPostCandidateReviewMapper.selectOne(
+            Wrappers.<MainPostCandidateReview>lambdaQuery()
+                .eq(MainPostCandidateReview::getCandidateId, candidate.getId())
+                .last("limit 1")
+        );
+        if (review == null) {
+            review = new MainPostCandidateReview();
+            review.setCandidateId(candidate.getId());
+            review.setStudentId(candidate.getStudentId());
+            review.setPostId(candidate.getPostId());
+        }
+
+        // 离职原因核实
+        if (StringUtils.isNotBlank(bo.getLeaveReasonVerify())) {
+            review.setLeaveReason(bo.getLeaveReasonVerify());
+        }
+
+        // 上级评价
+        if (StringUtils.isNotBlank(bo.getLeaderEvalAdvantage())) {
+            review.setStrength(bo.getLeaderEvalAdvantage());
+        }
+        if (StringUtils.isNotBlank(bo.getLeaderEvalImprove())) {
+            review.setImprovement(bo.getLeaderEvalImprove());
+        }
+        // 能力维度(名称 + 评语)
+        if (StringUtils.isNotBlank(bo.getLeaderEvalProf())) {
+            review.setAbilityAName("专业能力");
+            review.setAbilityARemark(bo.getLeaderEvalProf());
+        }
+        if (StringUtils.isNotBlank(bo.getLeaderEvalAttitude())) {
+            review.setAbilityBName("工作态度");
+            review.setAbilityBRemark(bo.getLeaderEvalAttitude());
+        }
+        if (StringUtils.isNotBlank(bo.getLeaderEvalTeam())) {
+            review.setAbilityCName("团队协作");
+            review.setAbilityCRemark(bo.getLeaderEvalTeam());
+        }
+        if (StringUtils.isNotBlank(bo.getLeaderEvalMorals())) {
+            review.setAbilityDName("职业操守");
+            review.setAbilityDRemark(bo.getLeaderEvalMorals());
+        }
+
+        // 同事评价
+        if (StringUtils.isNotBlank(bo.getColleagueEvalTeamwork())) {
+            review.setCooperation(bo.getColleagueEvalTeamwork());
+        }
+        if (StringUtils.isNotBlank(bo.getColleagueEvalProf())) {
+            review.setColleagueAbility(bo.getColleagueEvalProf());
+        }
+
+        // HR评价
+        if (StringUtils.isNotBlank(bo.getHrEvalDispute())) {
+            review.setViolation(bo.getHrEvalDispute());
+        }
+        if (StringUtils.isNotBlank(bo.getHrEvalTransfer())) {
+            review.setHandover(bo.getHrEvalTransfer());
+        }
+        if (StringUtils.isNotBlank(bo.getAttachment2Remark())) {
+            review.setPerformRemark(bo.getAttachment2Remark());
+        }
+
+        // 法务风险
+        if (bo.getHasNonCompete() != null) {
+            review.setNonCompeteAgreement(bo.getHasNonCompete() ? 1 : 0);
+        }
+        if (bo.getHasNda() != null) {
+            review.setConfidentialityAgreement(bo.getHasNda() ? 1 : 0);
+        }
+        if (StringUtils.isNotBlank(bo.getAgreementRemark())) {
+            review.setAgreementRemark(bo.getAgreementRemark());
+        }
+        if (bo.getHasDisputeStatus() != null) {
+            review.setLaborDispute(bo.getHasDisputeStatus() ? 1 : 0);
+        }
+        if (StringUtils.isNotBlank(bo.getDisputeRemark())) {
+            review.setDisputeRemark(bo.getDisputeRemark());
+        }
+
+        // 调查结论
+        if (StringUtils.isNotBlank(bo.getConclusion())) {
+            review.setConclusionResult(bo.getConclusion());
+        }
+        if (StringUtils.isNotBlank(bo.getConclusionReason())) {
+            review.setTotalRemark(bo.getConclusionReason());
+        }
+
+        review.setReviewStatus("1"); // 已填写
+
+        if (review.getId() == null) {
+            mainPostCandidateReviewMapper.insert(review);
+        } else {
+            mainPostCandidateReviewMapper.updateById(review);
+        }
+    }
+
+    private void saveInterviews(MainBackRecord record, MainBackCandidate candidate, BackgroundCheckFormBo bo) {
+        // 先删掉该 record 下的旧访谈记录
+        mainBackInterviewMapper.delete(
+            Wrappers.<MainBackInterview>lambdaQuery()
+                .eq(MainBackInterview::getRecordId, record.getId())
+        );
+
+        // 逐条插入
+        BackgroundCheckFormBo.InterviewInfo[] interviews = {
+            bo.getInterviewSupervisor(), bo.getInterviewHR(), bo.getInterviewColleague()
+        };
+        for (BackgroundCheckFormBo.InterviewInfo info : interviews) {
+            if (info != null && info.hasContent()) {
+                MainBackInterview interview = new MainBackInterview();
+                interview.setCandidateId(candidate.getId());
+                interview.setRecordId(record.getId());
+                interview.setIntervieweeName(info.getName());
+                interview.setIntervieweeRelation(info.getRelationship());
+                interview.setIntervieweeContact(info.getContact());
+                interview.setQa1(info.getQ1());
+                interview.setQa2(info.getQ2());
+                interview.setQa3(info.getQ3());
+                interview.setQa4(info.getQ4());
+                interview.setQa5(info.getQ5());
+                mainBackInterviewMapper.insert(interview);
+            }
+        }
+    }
+
     private static class ReportContext {
         private MainStudent student;
         private MainPostCandidateReview review;