|
@@ -1,17 +1,29 @@
|
|
|
package com.xjrsoft.module.student.service.impl;
|
|
package com.xjrsoft.module.student.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
|
+import com.xjrsoft.common.enums.ArchivesStatusEnum;
|
|
|
|
|
+import com.xjrsoft.module.student.dto.AddBaseStudentGraduateDto;
|
|
|
import com.xjrsoft.module.student.dto.BaseStudentGraduatePageDto;
|
|
import com.xjrsoft.module.student.dto.BaseStudentGraduatePageDto;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentGraduate;
|
|
import com.xjrsoft.module.student.entity.BaseStudentGraduate;
|
|
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
import com.xjrsoft.module.student.mapper.BaseStudentGraduateMapper;
|
|
import com.xjrsoft.module.student.mapper.BaseStudentGraduateMapper;
|
|
|
|
|
+import com.xjrsoft.module.student.mapper.BaseStudentSchoolRollMapper;
|
|
|
import com.xjrsoft.module.student.service.IBaseStudentGraduateService;
|
|
import com.xjrsoft.module.student.service.IBaseStudentGraduateService;
|
|
|
import com.xjrsoft.module.student.vo.BaseStudentGraduatePageVo;
|
|
import com.xjrsoft.module.student.vo.BaseStudentGraduatePageVo;
|
|
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentGraduateVo;
|
|
|
import com.xjrsoft.module.system.entity.File;
|
|
import com.xjrsoft.module.system.entity.File;
|
|
|
import com.xjrsoft.module.system.service.IFileService;
|
|
import com.xjrsoft.module.system.service.IFileService;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @title: 学生毕业管理
|
|
* @title: 学生毕业管理
|
|
@@ -24,13 +36,49 @@ import org.springframework.stereotype.Service;
|
|
|
public class BaseStudentGraduateServiceImpl extends MPJBaseServiceImpl<BaseStudentGraduateMapper, BaseStudentGraduate> implements IBaseStudentGraduateService {
|
|
public class BaseStudentGraduateServiceImpl extends MPJBaseServiceImpl<BaseStudentGraduateMapper, BaseStudentGraduate> implements IBaseStudentGraduateService {
|
|
|
private final BaseStudentGraduateMapper baseStudentGraduateMapper;
|
|
private final BaseStudentGraduateMapper baseStudentGraduateMapper;
|
|
|
|
|
|
|
|
|
|
+ private final BaseStudentSchoolRollMapper baseStudentSchoolRollMapper;
|
|
|
|
|
+
|
|
|
private final IFileService fileService;
|
|
private final IFileService fileService;
|
|
|
@Override
|
|
@Override
|
|
|
public Page<BaseStudentGraduatePageVo> getPage(Page<BaseStudentGraduatePageDto> page, BaseStudentGraduatePageDto dto) {
|
|
public Page<BaseStudentGraduatePageVo> getPage(Page<BaseStudentGraduatePageDto> page, BaseStudentGraduatePageDto dto) {
|
|
|
Page<BaseStudentGraduatePageVo> voPage = baseStudentGraduateMapper.getPage(page, dto);
|
|
Page<BaseStudentGraduatePageVo> voPage = baseStudentGraduateMapper.getPage(page, dto);
|
|
|
for (BaseStudentGraduatePageVo record : voPage.getRecords()) {
|
|
for (BaseStudentGraduatePageVo record : voPage.getRecords()) {
|
|
|
- record.setFileInfos(fileService.list(Wrappers.<File>query().lambda().eq(File::getFolderId,record.getFolderId())));
|
|
|
|
|
|
|
+ if(record.getFolderId() != null){
|
|
|
|
|
+ record.setFileInfos(fileService.list(Wrappers.<File>query().lambda().eq(File::getFolderId,record.getFolderId())));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return voPage;
|
|
return voPage;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public BaseStudentGraduateVo getInfoById(Long id) {
|
|
|
|
|
+ BaseStudentGraduateVo baseStudentGraduateVo = baseStudentGraduateMapper.getInfoById(id);
|
|
|
|
|
+ if(baseStudentGraduateVo != null && baseStudentGraduateVo.getFolderId() != null){
|
|
|
|
|
+ baseStudentGraduateVo.setFileInfos(fileService.list(Wrappers.<File>query().lambda().eq(File::getFolderId,baseStudentGraduateVo.getFolderId())));
|
|
|
|
|
+ }
|
|
|
|
|
+ return baseStudentGraduateVo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public Boolean addOne(AddBaseStudentGraduateDto dto) {
|
|
|
|
|
+ BaseStudentGraduate baseStudentGraduate = BeanUtil.toBean(dto, BaseStudentGraduate.class);
|
|
|
|
|
+ baseStudentGraduate.setCreateUserId(StpUtil.getLoginIdAsLong());
|
|
|
|
|
+ baseStudentGraduate.setCreateDate(new Date());
|
|
|
|
|
+ QueryWrapper<BaseStudentGraduate> queryWrapperSortcode = new QueryWrapper<>();
|
|
|
|
|
+ queryWrapperSortcode.select("IFNULL(MAX(sort_code),0) as sortCode");
|
|
|
|
|
+ BaseStudentGraduate t = this.getOne(queryWrapperSortcode);
|
|
|
|
|
+ baseStudentGraduate.setSortCode(t.getSortCode() + 1);
|
|
|
|
|
+ //修改学籍状态
|
|
|
|
|
+ LambdaQueryWrapper<BaseStudentSchoolRoll> baseStudentSchoolRollLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ baseStudentSchoolRollLambdaQueryWrapper
|
|
|
|
|
+ .eq(BaseStudentSchoolRoll::getUserId, dto.getUserId());
|
|
|
|
|
+ baseStudentSchoolRollMapper.update(new BaseStudentSchoolRoll(){{
|
|
|
|
|
+ setArchivesStatus(ArchivesStatusEnum.FB2907.getCode());
|
|
|
|
|
+ }}, baseStudentSchoolRollLambdaQueryWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ //保存毕业信息
|
|
|
|
|
+ this.save(baseStudentGraduate);
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|