|
|
@@ -16,18 +16,13 @@ import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
-import org.dromara.main.domain.MainStudent;
|
|
|
-import org.dromara.main.domain.MainStudentEducation;
|
|
|
-import org.dromara.main.domain.MainStudentExperience;
|
|
|
-import org.dromara.main.domain.MainStudentProject;
|
|
|
+import org.dromara.main.domain.*;
|
|
|
import org.dromara.main.domain.bo.MainStudentBo;
|
|
|
+import org.dromara.main.domain.vo.MainStudentAppendixVo;
|
|
|
import org.dromara.main.domain.vo.MainStudentVo;
|
|
|
|
|
|
import org.dromara.main.domain.vo.MiniappLoginVo;
|
|
|
-import org.dromara.main.mapper.MainStudentEducationMapper;
|
|
|
-import org.dromara.main.mapper.MainStudentExperienceMapper;
|
|
|
-import org.dromara.main.mapper.MainStudentMapper;
|
|
|
-import org.dromara.main.mapper.MainStudentProjectMapper;
|
|
|
+import org.dromara.main.mapper.*;
|
|
|
import org.dromara.main.service.IMainStudentService;
|
|
|
import org.dromara.main.utils.WechatMiniAppUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -46,17 +41,74 @@ public class MainStudentServiceImpl implements IMainStudentService {
|
|
|
private final MainStudentEducationMapper educationMapper;
|
|
|
private final MainStudentProjectMapper projectMapper;
|
|
|
private final MainStudentExperienceMapper experienceMapper;
|
|
|
+ private final MainStudentAppendixMapper appendixMapper;
|
|
|
+ private final CsSessionMapper sessionMapper;
|
|
|
+ private final MainOrderMapper orderMapper;
|
|
|
+ private final MainExamApplyMapper examApplyMapper;
|
|
|
+ private final MainBackCandidateMapper candidateMapper;
|
|
|
|
|
|
@Override
|
|
|
public MainStudentVo queryById(Long id){
|
|
|
MainStudentVo vo = baseMapper.selectVoById(id);
|
|
|
if(vo != null){
|
|
|
+ // 数据标准化:确保性别等字段与字典对应
|
|
|
+ if ("F".equalsIgnoreCase(vo.getGender())) {
|
|
|
+ vo.setGender("1"); // 字典中通常 1 为女
|
|
|
+ } else if ("M".equalsIgnoreCase(vo.getGender())) {
|
|
|
+ vo.setGender("0"); // 字典中通常 0 为男
|
|
|
+ }
|
|
|
+
|
|
|
+ // 确保所有字典字段为字符串,匹配字典 key
|
|
|
+ if (vo.getUserType() != null) vo.setUserType(String.valueOf(vo.getUserType()));
|
|
|
+ if (vo.getEducation() != null) vo.setEducation(String.valueOf(vo.getEducation()));
|
|
|
+ if (vo.getGrade() != null) vo.setGrade(String.valueOf(vo.getGrade()));
|
|
|
+ if (vo.getJobType() != null) vo.setJobType(String.valueOf(vo.getJobType()));
|
|
|
+ if (vo.getInternshipDuration() != null) vo.setInternshipDuration(String.valueOf(vo.getInternshipDuration()));
|
|
|
+ if (vo.getAvailability() != null) vo.setAvailability(String.valueOf(vo.getAvailability()));
|
|
|
+
|
|
|
vo.setEducationList(educationMapper.selectVoList(new LambdaQueryWrapper<MainStudentEducation>()
|
|
|
.eq(MainStudentEducation::getStudentId, id)));
|
|
|
vo.setExperienceList(experienceMapper.selectVoList(new LambdaQueryWrapper<MainStudentExperience>()
|
|
|
.eq(MainStudentExperience::getStudentId, id)));
|
|
|
vo.setProjectList(projectMapper.selectVoList(new LambdaQueryWrapper<MainStudentProject>()
|
|
|
.eq(MainStudentProject::getStudentId, id)));
|
|
|
+
|
|
|
+ // 查询所有简历附件
|
|
|
+ List<MainStudentAppendixVo> appendixList = appendixMapper.selectVoList(new LambdaQueryWrapper<MainStudentAppendix>()
|
|
|
+ .eq(MainStudentAppendix::getStudentId, id)
|
|
|
+ .orderByDesc(MainStudentAppendix::getCreateTime));
|
|
|
+ vo.setAppendixList(appendixList);
|
|
|
+
|
|
|
+ // 为兼容旧逻辑,设置最新的附件 ID 到 resumeFile
|
|
|
+ if (ObjectUtil.isNotEmpty(appendixList)) {
|
|
|
+ vo.setResumeFile(appendixList.get(0).getOssId());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 统计咨询数 (从 cs_session 表查询)
|
|
|
+ Long consultationCount = sessionMapper.selectCount(new LambdaQueryWrapper<CsSession>()
|
|
|
+ .eq(CsSession::getFromUserId, id)
|
|
|
+ .eq(CsSession::getSessionType, 1));
|
|
|
+ vo.setConsultationCount(consultationCount.intValue());
|
|
|
+
|
|
|
+ // 3. 统计测评数 (从 main_exam_apply 表查询)
|
|
|
+ Long evaluationCount = examApplyMapper.selectCount(new LambdaQueryWrapper<MainExamApply>()
|
|
|
+ .eq(MainExamApply::getStudentId, id));
|
|
|
+ vo.setEvaluationCount(evaluationCount.intValue());
|
|
|
+
|
|
|
+ // 4. 查询是否入职 (从 main_back_candidate 表查询:双方确认状态即为入职)
|
|
|
+ Long employedCount = candidateMapper.selectCount(new LambdaQueryWrapper<MainBackCandidate>()
|
|
|
+ .eq(MainBackCandidate::getStudentId, id)
|
|
|
+ .eq(MainBackCandidate::getEnterpriseStatus, "adopted") // 企业录用
|
|
|
+ .eq(MainBackCandidate::getStudentStatus, "accepted")); // 学员接受
|
|
|
+ vo.setIsEmployed(employedCount > 0 ? "1" : "0");
|
|
|
+
|
|
|
+ // 5. 查询最近3条订单 (直接使用 MainOrder 实体类)
|
|
|
+ List<MainOrder> orders = orderMapper.selectList(new LambdaQueryWrapper<MainOrder>()
|
|
|
+ .eq(MainOrder::getBuyerId, id)
|
|
|
+ .eq(MainOrder::getBuyerType, 2) // 2表示学员
|
|
|
+ .orderByDesc(MainOrder::getCreateTime)
|
|
|
+ .last("LIMIT 3"));
|
|
|
+ vo.setOrderList(orders);
|
|
|
}
|
|
|
return vo;
|
|
|
}
|
|
|
@@ -65,6 +117,19 @@ public class MainStudentServiceImpl implements IMainStudentService {
|
|
|
public TableDataInfo<MainStudentVo> queryPageList(MainStudentBo bo, PageQuery pageQuery) {
|
|
|
LambdaQueryWrapper<MainStudent> lqw = buildQueryWrapper(bo);
|
|
|
Page<MainStudentVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+
|
|
|
+ List<MainStudentVo> records = result.getRecords();
|
|
|
+ if (ObjectUtil.isNotEmpty(records)) {
|
|
|
+ List<Long> studentIds = records.stream().map(MainStudentVo::getId).toList();
|
|
|
+ // 批量查询测评数
|
|
|
+ // 注意:这里需要根据您的业务逻辑,通过 examApplyMapper 或对应的 SQL 统计出每个学员的测评数并填充
|
|
|
+ // 简单示例如下:
|
|
|
+ records.forEach(vo -> {
|
|
|
+ Long count = examApplyMapper.selectCount(new LambdaQueryWrapper<MainExamApply>()
|
|
|
+ .eq(MainExamApply::getStudentId, vo.getId()));
|
|
|
+ vo.setEvaluationCount(count.intValue());
|
|
|
+ });
|
|
|
+ }
|
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
|
|
|
|
@@ -88,6 +153,14 @@ public class MainStudentServiceImpl implements IMainStudentService {
|
|
|
lqw.like(ObjectUtil.isNotNull(bo.getSchoolName()), MainStudent::getSchoolName, bo.getSchoolName());
|
|
|
lqw.eq(ObjectUtil.isNotNull(bo.getEducation()), MainStudent::getEducation, bo.getEducation());
|
|
|
lqw.eq(ObjectUtil.isNotNull(bo.getStatus()), MainStudent::getStatus, bo.getStatus());
|
|
|
+ // 新增:处理黑名单筛选逻辑
|
|
|
+ if (StringUtils.isNotBlank(bo.getIsBlacklist())) {
|
|
|
+ if ("Y".equals(bo.getIsBlacklist())) {
|
|
|
+ lqw.eq(MainStudent::getUserType, "3"); // 3 为黑名单用户类型
|
|
|
+ } else if ("N".equals(bo.getIsBlacklist())) {
|
|
|
+ lqw.ne(MainStudent::getUserType, "3"); // 排除黑名单用户
|
|
|
+ }
|
|
|
+ }
|
|
|
return lqw;
|
|
|
}
|
|
|
|
|
|
@@ -214,6 +287,10 @@ public class MainStudentServiceImpl implements IMainStudentService {
|
|
|
.setExtra(LoginHelper.USER_KEY, student.getId())
|
|
|
.setExtra(LoginHelper.USER_NAME_KEY, student.getName());
|
|
|
StpUtil.login(student.getId(), loginModel);
|
|
|
+ MainStudent loginUpdate = new MainStudent();
|
|
|
+ loginUpdate.setId(student.getId());
|
|
|
+ loginUpdate.setLoginDate(new java.util.Date()); // 设置当前时间为最近登录时间
|
|
|
+ baseMapper.updateById(loginUpdate);
|
|
|
String token = StpUtil.getTokenValue();
|
|
|
// 5. 组合组装返回结果
|
|
|
MiniappLoginVo result = new MiniappLoginVo();
|