forked from liweijie/education
登录 权限 放行 功能整理
This commit is contained in:
@@ -5,6 +5,7 @@ import com.roomroot.jwgl.entity.*;
|
||||
import com.roomroot.jwgl.unit.PageQuery;
|
||||
import com.roomroot.jwgl.unit.PageResult;
|
||||
import com.roomroot.jwgl.vo.faculty.TeacherListVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 教研室与教员管理服务接口
|
||||
@@ -42,6 +43,16 @@ public interface FacultyService {
|
||||
*/
|
||||
PageResult<JYSB> pageJYSB(PageQuery query, JYSB cond);
|
||||
|
||||
/**
|
||||
* 从 Excel 文件导入教研室数据。
|
||||
* <p>教研室标识号不填时系统自动创建;教研室名称、简称为必填字段,未填写返回"XX未填写";
|
||||
* 序号、停用、虚实类型等非空字段由后台按默认值填充。</p>
|
||||
*
|
||||
* @param file 上传的 .xls 文件
|
||||
* @return 成功导入的记录数
|
||||
*/
|
||||
int importJYSBFromExcel(MultipartFile file) throws Exception;
|
||||
|
||||
// ==================== 教员管理 ====================
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -986,7 +986,7 @@ public class AffiliationSettingServiceImpl implements AffiliationSettingService
|
||||
vo.setDepartment(researchOffice.getBx());
|
||||
|
||||
// 第三步:将停用标志转换为更直观的启用状态,并保留停用时间。
|
||||
vo.setEnabled(!Boolean.TRUE.equals(researchOffice.getTy()));
|
||||
vo.setEnabled(1);
|
||||
vo.setDisabledAt(researchOffice.getTysj());
|
||||
|
||||
// 第四步:复制虚实类型、备注、序号和机关性质。
|
||||
@@ -1032,7 +1032,7 @@ public class AffiliationSettingServiceImpl implements AffiliationSettingService
|
||||
vo.setResearchOfficeName(researchOffice.getJysmc());
|
||||
vo.setAbbreviation(researchOffice.getJc());
|
||||
vo.setDepartment(researchOffice.getBx());
|
||||
vo.setEnabled(!Boolean.TRUE.equals(researchOffice.getTy()));
|
||||
vo.setEnabled(1);
|
||||
vo.setDisabledAt(researchOffice.getTysj());
|
||||
vo.setVirtual(researchOffice.getXslx());
|
||||
vo.setRemark(researchOffice.getBz());
|
||||
|
||||
+48
-4
@@ -6,14 +6,19 @@ import com.roomroot.jwgl.entity.*;
|
||||
import com.roomroot.jwgl.mapper.*;
|
||||
import com.roomroot.jwgl.mapper.*;
|
||||
import com.roomroot.jwgl.service.FacultyService;
|
||||
import com.roomroot.jwgl.unit.BusinessException;
|
||||
import com.roomroot.jwgl.unit.PageQuery;
|
||||
import com.roomroot.jwgl.unit.PageResult;
|
||||
import com.roomroot.jwgl.utils.ExcelParseUtil;
|
||||
import com.roomroot.jwgl.utils.UuidUtil;
|
||||
import com.roomroot.jwgl.vo.faculty.TeacherListVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 教研室与教员管理服务实现类
|
||||
@@ -44,9 +49,9 @@ public class FacultyServiceImpl implements FacultyService {
|
||||
@Override
|
||||
@Transactional
|
||||
public void addJYSB(JYSB entity) {
|
||||
if (entity.getTy() == null) {
|
||||
entity.setTy(false);
|
||||
}
|
||||
entity.setTy(0);
|
||||
entity.setXslx(0);
|
||||
entity.setJgxz(0);
|
||||
jysbMapper.insert(entity);
|
||||
}
|
||||
|
||||
@@ -55,7 +60,7 @@ public class FacultyServiceImpl implements FacultyService {
|
||||
public void disableJYSB(String jysdh) {
|
||||
JYSB entity = new JYSB();
|
||||
entity.setJysdh(jysdh);
|
||||
entity.setTy(true);
|
||||
entity.setTy(1);
|
||||
entity.setTysj(LocalDateTime.now());
|
||||
jysbMapper.updateById(entity);
|
||||
}
|
||||
@@ -79,6 +84,45 @@ public class FacultyServiceImpl implements FacultyService {
|
||||
query.getPageNum(), query.getPageSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int importJYSBFromExcel(MultipartFile file) throws Exception {
|
||||
if (file == null || file.isEmpty()) {
|
||||
throw new BusinessException("导入文件不能为空");
|
||||
}
|
||||
List<JYSB> list = ExcelParseUtil.parseJYSBExcel(
|
||||
file.getInputStream(), file.getOriginalFilename());
|
||||
if (list.isEmpty()) {
|
||||
throw new BusinessException("Excel中无有效数据");
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JYSB entity = list.get(i);
|
||||
// 必填字段校验:教研室名称、简称
|
||||
if (entity.getJysmc() == null || entity.getJysmc().trim().isEmpty()) {
|
||||
throw new BusinessException("教研室名称未填写");
|
||||
}
|
||||
if (entity.getJc() == null || entity.getJc().trim().isEmpty()) {
|
||||
throw new BusinessException("简称未填写");
|
||||
}
|
||||
// 教研室标识号不填,则系统自动创建
|
||||
if (entity.getJysdh() == null || entity.getJysdh().trim().isEmpty()) {
|
||||
entity.setJysdh(UuidUtil.getUUID());
|
||||
}
|
||||
// 序号为空时默认取行号
|
||||
if (entity.getXh() == null || entity.getXh().trim().isEmpty()) {
|
||||
entity.setXh(String.valueOf(i + 1));
|
||||
}
|
||||
// 停用默认为0
|
||||
entity.setTy(0);
|
||||
// 虚实类型默认为0
|
||||
entity.setXslx(0);
|
||||
//机关类型默认为0
|
||||
entity.setJgxz(0);
|
||||
jysbMapper.insert(entity);
|
||||
}
|
||||
return list.size();
|
||||
}
|
||||
|
||||
// ==================== 教员管理 ====================
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user