|
|
@@ -0,0 +1,465 @@
|
|
|
+package org.dromara.zsjy.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.dromara.common.core.exception.ServiceException;
|
|
|
+import org.dromara.common.core.utils.MapstructUtils;
|
|
|
+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.zsjy.domain.ZsjyInternshipMonthly;
|
|
|
+import org.dromara.zsjy.domain.bo.ZsjyInternshipMonthlyAddBo;
|
|
|
+import org.dromara.zsjy.domain.bo.ZsjyInternshipMonthlyQueryBo;
|
|
|
+import org.dromara.zsjy.domain.vo.ZsjyInternshipMonthlyVo;
|
|
|
+import org.dromara.zsjy.mapper.ZsjyInternshipMonthlyMapper;
|
|
|
+import org.dromara.zsjy.mapper.ZsjyInternshipInfoMapper;
|
|
|
+import org.dromara.zsjy.domain.ZsjyInternshipInfo;
|
|
|
+import org.dromara.zsjy.service.IZsjyInternshipMonthlyService;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.time.YearMonth;
|
|
|
+import java.util.*;
|
|
|
+import java.time.ZoneId;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 学生月度实习总结Service业务层处理
|
|
|
+ *
|
|
|
+ * @author system
|
|
|
+ * @date 2025-01-03
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@RequiredArgsConstructor
|
|
|
+@Service
|
|
|
+public class ZsjyInternshipMonthlyServiceImpl implements IZsjyInternshipMonthlyService {
|
|
|
+
|
|
|
+ private final ZsjyInternshipMonthlyMapper baseMapper;
|
|
|
+ private final ZsjyInternshipInfoMapper internshipInfoMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询学生月度实习总结
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ZsjyInternshipMonthlyVo queryById(Long monthlyId) {
|
|
|
+ ZsjyInternshipMonthlyVo vo = baseMapper.selectVoById(monthlyId);
|
|
|
+ if (ObjectUtil.isNull(vo)) {
|
|
|
+ throw new ServiceException("月度总结不存在");
|
|
|
+ }
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询学生月度实习总结分页列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TableDataInfo<ZsjyInternshipMonthlyVo> queryPageList(ZsjyInternshipMonthlyQueryBo queryBo, PageQuery pageQuery) {
|
|
|
+ // 如果没有指定学生ID,则使用当前登录用户ID(学生端)
|
|
|
+ if (ObjectUtil.isNull(queryBo.getStudentId())) {
|
|
|
+ queryBo.setStudentId(LoginHelper.getUserId());
|
|
|
+ }
|
|
|
+
|
|
|
+ Page<ZsjyInternshipMonthlyVo> result = baseMapper.selectVoPage(pageQuery.build(), queryBo);
|
|
|
+ return TableDataInfo.build(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询学生月度实习总结列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<ZsjyInternshipMonthlyVo> queryList(ZsjyInternshipMonthlyQueryBo queryBo) {
|
|
|
+ // 如果没有指定学生ID,则使用当前登录用户ID(学生端)
|
|
|
+ if (ObjectUtil.isNull(queryBo.getStudentId())) {
|
|
|
+ queryBo.setStudentId(LoginHelper.getUserId());
|
|
|
+ }
|
|
|
+ return baseMapper.selectVoList(queryBo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增学生月度实习总结
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean insertByBo(ZsjyInternshipMonthlyAddBo addBo) {
|
|
|
+ Long studentId = LoginHelper.getUserId();
|
|
|
+
|
|
|
+ // 如果前端没有传递实习ID,则自动获取当前学生的实习ID
|
|
|
+ if (ObjectUtil.isNull(addBo.getInternshipId())) {
|
|
|
+ ZsjyInternshipInfo internshipInfo = internshipInfoMapper.selectOne(
|
|
|
+ new LambdaQueryWrapper<ZsjyInternshipInfo>()
|
|
|
+ .eq(ZsjyInternshipInfo::getStudentId, studentId)
|
|
|
+ .eq(ZsjyInternshipInfo::getStatus, "1") // 查询进行中状态的实习
|
|
|
+ .eq(ZsjyInternshipInfo::getDeleted, 0)
|
|
|
+ .orderByDesc(ZsjyInternshipInfo::getCreateTime)
|
|
|
+ .last("LIMIT 1")
|
|
|
+ );
|
|
|
+
|
|
|
+ if (ObjectUtil.isNull(internshipInfo)) {
|
|
|
+ throw new ServiceException("您当前没有进行中的实习记录,无法创建月度总结");
|
|
|
+ }
|
|
|
+
|
|
|
+ addBo.setInternshipId(internshipInfo.getInternshipId());
|
|
|
+ log.info("自动获取到学生实习ID:{}", internshipInfo.getInternshipId());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查该学生该月份是否已有总结
|
|
|
+ if (checkMonthExists(studentId, addBo.getSummaryMonth(), null)) {
|
|
|
+ throw new ServiceException("该月份已存在总结记录,请勿重复创建");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 手动转换BO到实体,解决字段映射问题
|
|
|
+ ZsjyInternshipMonthly add = new ZsjyInternshipMonthly();
|
|
|
+ add.setId(addBo.getMonthlyId()); // monthlyId -> id
|
|
|
+ add.setInternshipId(addBo.getInternshipId());
|
|
|
+ add.setSummaryMonth(addBo.getSummaryMonth());
|
|
|
+ add.setWorkContent(addBo.getWorkContent());
|
|
|
+ add.setAchievements(addBo.getAchievements());
|
|
|
+ add.setLearningGains(addBo.getLearningGains());
|
|
|
+ add.setProblemsEncountered(addBo.getProblemsEncountered());
|
|
|
+ add.setSelfEvaluation(addBo.getSelfEvaluation());
|
|
|
+ add.setNextMonthPlan(addBo.getNextMonthPlan());
|
|
|
+ add.setProfessionalSkills(addBo.getProfessionalSkills());
|
|
|
+ add.setCommunicationSkills(addBo.getCommunicationSkills());
|
|
|
+ add.setTeamworkAbility(addBo.getTeamworkAbility());
|
|
|
+ add.setLearningAbility(addBo.getLearningAbility());
|
|
|
+ add.setWorkAttitude(addBo.getWorkAttitude());
|
|
|
+ add.setAttachments(addBo.getAttachments());
|
|
|
+
|
|
|
+ add.setStudentId(studentId);
|
|
|
+ add.setTenantId("000000"); // 默认租户
|
|
|
+
|
|
|
+ // 处理审核状态和提交时间
|
|
|
+ if (addBo.getReviewStatus() != null) {
|
|
|
+ add.setReviewStatus(addBo.getReviewStatus());
|
|
|
+ // 如果状态为待审核(0),设置提交时间
|
|
|
+ if (addBo.getReviewStatus() == 0) {
|
|
|
+ add.setSubmitTime(addBo.getSubmitTime() != null ? addBo.getSubmitTime() : new Date());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ add.setReviewStatus(3); // 默认为草稿状态
|
|
|
+ }
|
|
|
+
|
|
|
+ // 解析月份序号
|
|
|
+ if (StringUtils.isNotBlank(addBo.getSummaryMonth())) {
|
|
|
+ String[] parts = addBo.getSummaryMonth().split("-");
|
|
|
+ if (parts.length == 2) {
|
|
|
+ add.setMonthNumber(Integer.parseInt(parts[1]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 计算字数
|
|
|
+ add.setWordCount(calculateWordCount(addBo));
|
|
|
+
|
|
|
+ // 设置默认截止日期(下月5号)
|
|
|
+ try {
|
|
|
+ YearMonth ym = YearMonth.parse(addBo.getSummaryMonth());
|
|
|
+ add.setSubmitDeadline(Date.from(ym.plusMonths(1).atDay(5).atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("解析月份失败: {}", addBo.getSummaryMonth());
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean flag = baseMapper.insert(add) > 0;
|
|
|
+ if (flag) {
|
|
|
+ addBo.setMonthlyId(add.getId());
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改学生月度实习总结
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean updateByBo(ZsjyInternshipMonthlyAddBo addBo) {
|
|
|
+ Long studentId = LoginHelper.getUserId();
|
|
|
+
|
|
|
+ // 查询原记录,验证权限和状态
|
|
|
+ ZsjyInternshipMonthly original = baseMapper.selectById(addBo.getMonthlyId());
|
|
|
+ if (ObjectUtil.isNull(original)) {
|
|
|
+ throw new ServiceException("月度总结不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 权限检查:只能修改自己的总结
|
|
|
+ if (!Objects.equals(original.getStudentId(), studentId)) {
|
|
|
+ throw new ServiceException("您只能修改自己的月度总结");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 状态检查:只有草稿状态才能修改
|
|
|
+ if (!Objects.equals(original.getReviewStatus(), 3)) {
|
|
|
+ throw new ServiceException("只有草稿状态的总结才能修改");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果前端没有传递实习ID,则使用原记录的实习ID
|
|
|
+ if (ObjectUtil.isNull(addBo.getInternshipId())) {
|
|
|
+ addBo.setInternshipId(original.getInternshipId());
|
|
|
+ log.info("使用原记录的实习ID:{}", original.getInternshipId());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查月份是否被其他记录占用
|
|
|
+ if (!Objects.equals(original.getSummaryMonth(), addBo.getSummaryMonth())) {
|
|
|
+ if (checkMonthExists(studentId, addBo.getSummaryMonth(), addBo.getMonthlyId())) {
|
|
|
+ throw new ServiceException("该月份已存在其他总结记录");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 手动转换BO到实体,解决字段映射问题
|
|
|
+ ZsjyInternshipMonthly update = new ZsjyInternshipMonthly();
|
|
|
+ update.setId(addBo.getMonthlyId()); // monthlyId -> id
|
|
|
+ update.setInternshipId(addBo.getInternshipId());
|
|
|
+ update.setSummaryMonth(addBo.getSummaryMonth());
|
|
|
+ update.setWorkContent(addBo.getWorkContent());
|
|
|
+ update.setAchievements(addBo.getAchievements());
|
|
|
+ update.setLearningGains(addBo.getLearningGains());
|
|
|
+ update.setProblemsEncountered(addBo.getProblemsEncountered());
|
|
|
+ update.setSelfEvaluation(addBo.getSelfEvaluation());
|
|
|
+ update.setNextMonthPlan(addBo.getNextMonthPlan());
|
|
|
+ update.setProfessionalSkills(addBo.getProfessionalSkills());
|
|
|
+ update.setCommunicationSkills(addBo.getCommunicationSkills());
|
|
|
+ update.setTeamworkAbility(addBo.getTeamworkAbility());
|
|
|
+ update.setLearningAbility(addBo.getLearningAbility());
|
|
|
+ update.setWorkAttitude(addBo.getWorkAttitude());
|
|
|
+ update.setAttachments(addBo.getAttachments());
|
|
|
+
|
|
|
+ // 处理审核状态和提交时间
|
|
|
+ if (addBo.getReviewStatus() != null) {
|
|
|
+ update.setReviewStatus(addBo.getReviewStatus());
|
|
|
+ // 如果状态从草稿(3)变为待审核(0),设置提交时间
|
|
|
+ if (addBo.getReviewStatus() == 0 && original.getReviewStatus() == 3) {
|
|
|
+ update.setSubmitTime(addBo.getSubmitTime() != null ? addBo.getSubmitTime() : new Date());
|
|
|
+ }
|
|
|
+ // 如果状态变回草稿(3),清空提交时间
|
|
|
+ else if (addBo.getReviewStatus() == 3) {
|
|
|
+ update.setSubmitTime(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 解析月份序号
|
|
|
+ if (StringUtils.isNotBlank(addBo.getSummaryMonth())) {
|
|
|
+ String[] parts = addBo.getSummaryMonth().split("-");
|
|
|
+ if (parts.length == 2) {
|
|
|
+ update.setMonthNumber(Integer.parseInt(parts[1]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 重新计算字数
|
|
|
+ update.setWordCount(calculateWordCount(addBo));
|
|
|
+
|
|
|
+ return baseMapper.updateById(update) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除学生月度实习总结
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean deleteByIds(Collection<Long> ids) {
|
|
|
+ Long studentId = LoginHelper.getUserId();
|
|
|
+
|
|
|
+ // 验证权限:只能删除自己的草稿状态总结
|
|
|
+ for (Long id : ids) {
|
|
|
+ ZsjyInternshipMonthly monthly = baseMapper.selectById(id);
|
|
|
+ if (ObjectUtil.isNull(monthly)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!Objects.equals(monthly.getStudentId(), studentId)) {
|
|
|
+ throw new ServiceException("您只能删除自己的月度总结");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!Objects.equals(monthly.getReviewStatus(), 3)) {
|
|
|
+ throw new ServiceException("只有草稿状态的总结才能删除");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return baseMapper.deleteByIds(ids.toArray(new Long[0])) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 提交月度总结审批
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean submitForApproval(Long monthlyId) {
|
|
|
+ Long studentId = LoginHelper.getUserId();
|
|
|
+
|
|
|
+ ZsjyInternshipMonthly monthly = baseMapper.selectById(monthlyId);
|
|
|
+ if (ObjectUtil.isNull(monthly)) {
|
|
|
+ throw new ServiceException("月度总结不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 权限检查
|
|
|
+ if (!Objects.equals(monthly.getStudentId(), studentId)) {
|
|
|
+ throw new ServiceException("您只能提交自己的月度总结");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 状态检查
|
|
|
+ if (!Objects.equals(monthly.getReviewStatus(), 3)) {
|
|
|
+ throw new ServiceException("只有草稿状态的总结才能提交");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 必填字段检查
|
|
|
+ if (StringUtils.isBlank(monthly.getWorkContent())) {
|
|
|
+ throw new ServiceException("工作内容不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新状态为待审核
|
|
|
+ ZsjyInternshipMonthly update = new ZsjyInternshipMonthly();
|
|
|
+ update.setId(monthlyId);
|
|
|
+ update.setReviewStatus(0); // 待审核
|
|
|
+ update.setSubmitTime(new Date());
|
|
|
+
|
|
|
+ return baseMapper.updateById(update) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自动保存草稿
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean autoSaveDraft(ZsjyInternshipMonthlyAddBo addBo) {
|
|
|
+ try {
|
|
|
+ if (ObjectUtil.isNull(addBo.getMonthlyId())) {
|
|
|
+ // 新增草稿
|
|
|
+ return insertByBo(addBo);
|
|
|
+ } else {
|
|
|
+ // 更新草稿
|
|
|
+ return updateByBo(addBo);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("自动保存草稿失败: {}", e.getMessage());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查学生某月是否已有总结
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean checkMonthExists(Long studentId, String summaryMonth, Long monthlyId) {
|
|
|
+ return baseMapper.existsByStudentAndMonth(studentId, summaryMonth, monthlyId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取月度总结模板信息
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ZsjyInternshipMonthlyVo getMonthlyTemplate(String summaryMonth) {
|
|
|
+ ZsjyInternshipMonthlyVo template = new ZsjyInternshipMonthlyVo();
|
|
|
+ template.setSummaryMonth(summaryMonth);
|
|
|
+
|
|
|
+ // 解析月份序号
|
|
|
+ if (StringUtils.isNotBlank(summaryMonth)) {
|
|
|
+ String[] parts = summaryMonth.split("-");
|
|
|
+ if (parts.length == 2) {
|
|
|
+ template.setMonthNumber(Integer.parseInt(parts[1]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置默认截止日期(下月5号)
|
|
|
+ try {
|
|
|
+ YearMonth ym = YearMonth.parse(summaryMonth);
|
|
|
+ template.setSubmitDeadline(Date.from(ym.plusMonths(1).atDay(5).atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("解析月份失败: {}", summaryMonth);
|
|
|
+ }
|
|
|
+
|
|
|
+ template.setReviewStatus(3); // 草稿
|
|
|
+ template.setStatusText("草稿");
|
|
|
+ template.setEditable(true);
|
|
|
+ template.setDeletable(true);
|
|
|
+ template.setSubmittable(true);
|
|
|
+
|
|
|
+ return template;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询学生指定实习的月度总结列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<ZsjyInternshipMonthlyVo> queryByStudentAndInternship(Long studentId, Long internshipId) {
|
|
|
+ if (ObjectUtil.isNull(studentId)) {
|
|
|
+ studentId = LoginHelper.getUserId();
|
|
|
+ }
|
|
|
+ return baseMapper.selectByStudentAndInternship(studentId, internshipId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 统计学生各状态的总结数量
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<Object> countByStatus(Long studentId) {
|
|
|
+ if (ObjectUtil.isNull(studentId)) {
|
|
|
+ studentId = LoginHelper.getUserId();
|
|
|
+ }
|
|
|
+ return baseMapper.countByStatus(studentId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算总结内容字数
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Integer calculateWordCount(ZsjyInternshipMonthlyAddBo addBo) {
|
|
|
+ int wordCount = 0;
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(addBo.getWorkContent())) {
|
|
|
+ wordCount += addBo.getWorkContent().length();
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(addBo.getAchievements())) {
|
|
|
+ wordCount += addBo.getAchievements().length();
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(addBo.getLearningGains())) {
|
|
|
+ wordCount += addBo.getLearningGains().length();
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(addBo.getProblemsEncountered())) {
|
|
|
+ wordCount += addBo.getProblemsEncountered().length();
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(addBo.getSelfEvaluation())) {
|
|
|
+ wordCount += addBo.getSelfEvaluation().length();
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(addBo.getNextMonthPlan())) {
|
|
|
+ wordCount += addBo.getNextMonthPlan().length();
|
|
|
+ }
|
|
|
+
|
|
|
+ return wordCount;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取学生当前实习信息
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getCurrentInternshipInfo() {
|
|
|
+ Long currentUserId = LoginHelper.getUserId();
|
|
|
+ log.info("获取学生当前实习信息, 用户ID: {}", currentUserId);
|
|
|
+
|
|
|
+ // 查询学生当前进行中的实习记录(与insertByBo方法保持一致)
|
|
|
+ LambdaQueryWrapper<ZsjyInternshipInfo> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(ZsjyInternshipInfo::getStudentId, currentUserId)
|
|
|
+ .eq(ZsjyInternshipInfo::getStatus, "1") // 查询进行中状态的实习
|
|
|
+ .eq(ZsjyInternshipInfo::getDeleted, 0)
|
|
|
+ .orderByDesc(ZsjyInternshipInfo::getCreateTime)
|
|
|
+ .last("LIMIT 1");
|
|
|
+
|
|
|
+ ZsjyInternshipInfo internshipInfo = internshipInfoMapper.selectOne(wrapper);
|
|
|
+
|
|
|
+ if (internshipInfo == null) {
|
|
|
+ log.warn("学生{}没有找到进行中的实习记录", currentUserId);
|
|
|
+ return new HashMap<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("internshipId", internshipInfo.getInternshipId());
|
|
|
+ result.put("companyName", internshipInfo.getCompanyName());
|
|
|
+ result.put("position", internshipInfo.getPositionName());
|
|
|
+ result.put("startDate", internshipInfo.getStartDate());
|
|
|
+ result.put("endDate", internshipInfo.getEndDate());
|
|
|
+
|
|
|
+ log.info("找到学生实习信息: {}", result);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|