登录 权限 放行 功能整理
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
package com.roomroot.jwgl.dto.login;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 登录请求参数
|
||||
*/
|
||||
@Data
|
||||
public class LoginDTO {
|
||||
|
||||
/** 单位编号(管理员登录时可为空) */
|
||||
private String orgId;
|
||||
|
||||
/** 登录名/账号 */
|
||||
private String loginName;
|
||||
|
||||
/** 密码 */
|
||||
private String password;
|
||||
|
||||
/** 用户类型: ADMIN-行政 TEACHER-教员 STUDENT-学员 MANAGER-管理员 */
|
||||
private String userType;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class JYSB {
|
||||
|
||||
/** 停用 */
|
||||
@TableField("停用")
|
||||
private Boolean ty;
|
||||
private Integer ty;
|
||||
|
||||
/** 停用时间 */
|
||||
@TableField("停用时间")
|
||||
@@ -42,7 +42,7 @@ public class JYSB {
|
||||
|
||||
/** 虚实类型 */
|
||||
@TableField("虚实类型")
|
||||
private Boolean xslx;
|
||||
private Integer xslx;
|
||||
|
||||
/** 简称 */
|
||||
@TableField("简称")
|
||||
@@ -50,6 +50,6 @@ public class JYSB {
|
||||
|
||||
/** 机关性质 */
|
||||
@TableField("机关性质")
|
||||
private Boolean jgxz;
|
||||
private Integer jgxz;
|
||||
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
ORDER BY q."创建时间" DESC
|
||||
</select>
|
||||
|
||||
<resultMap id="LeaveLessonMap" type="courserunning.vo.com.roomroot.LeaveLessonVO">
|
||||
<resultMap id="LeaveLessonMap" type="com.roomroot.jwgl.vo.courserunning.LeaveLessonVO">
|
||||
<result column="课次编号" property="sskcbbh"/>
|
||||
<result column="课程名称" property="kcmc"/>
|
||||
<result column="上课日期" property="rq"/>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.roomroot.jwgl.dto.courserunning.SemesterImportDTO;
|
||||
import com.roomroot.jwgl.dto.courserunning.SingleCourseImportDTO;
|
||||
import com.roomroot.jwgl.dto.departmentpersonnel.DepartmentPersonnelCreateDTO;
|
||||
import com.roomroot.jwgl.entity.JXSSJH;
|
||||
import com.roomroot.jwgl.entity.JYSB;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
@@ -169,6 +170,51 @@ public class ExcelParseUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析教研室数据导入 Excel 文件。
|
||||
* Excel 表头顺序:教研室标识号、序号、教研室名称、简称、部系
|
||||
*
|
||||
* @param inputStream Excel 文件输入流
|
||||
* @param fileName 文件名
|
||||
* @return 教研室实体列表(默认字段与必填校验由外部完成)
|
||||
* @throws Exception 解析异常
|
||||
*/
|
||||
public static List<JYSB> parseJYSBExcel(InputStream inputStream, String fileName) throws Exception {
|
||||
List<JYSB> result = new ArrayList<>();
|
||||
|
||||
Workbook workbook = createWorkbook(inputStream, fileName);
|
||||
try {
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
int firstDataRow = 1;
|
||||
int lastRowNum = sheet.getLastRowNum();
|
||||
|
||||
for (int rowNum = firstDataRow; rowNum <= lastRowNum; rowNum++) {
|
||||
Row row = sheet.getRow(rowNum);
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
JYSB entity = new JYSB();
|
||||
// 教研室标识号
|
||||
entity.setJysdh(getCellStringValue(row.getCell(0)));
|
||||
// 序号
|
||||
entity.setXh(getCellStringValue(row.getCell(1)));
|
||||
// 教研室名称
|
||||
entity.setJysmc(getCellStringValue(row.getCell(2)));
|
||||
// 简称
|
||||
entity.setJc(getCellStringValue(row.getCell(3)));
|
||||
// 部系
|
||||
entity.setBx(getCellStringValue(row.getCell(4)));
|
||||
|
||||
result.add(entity);
|
||||
}
|
||||
} finally {
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Workbook createWorkbook(InputStream inputStream, String fileName) throws Exception {
|
||||
String name = fileName == null ? "" : fileName.toLowerCase();
|
||||
if (!name.endsWith(".xlsx") && !name.endsWith(".xls")) {
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@ public class ResearchOfficeAffiliationVO {
|
||||
/**
|
||||
* 是否启用,由数据库“停用”字段反向转换得到。
|
||||
*/
|
||||
private Boolean enabled;
|
||||
private Integer enabled;
|
||||
|
||||
/**
|
||||
* 停用时间。
|
||||
@@ -58,7 +58,7 @@ public class ResearchOfficeAffiliationVO {
|
||||
/**
|
||||
* 是否为虚拟教研室。
|
||||
*/
|
||||
private Boolean virtual;
|
||||
private Integer virtual;
|
||||
|
||||
/**
|
||||
* 教研室备注。
|
||||
@@ -73,5 +73,5 @@ public class ResearchOfficeAffiliationVO {
|
||||
/**
|
||||
* 是否具有机关性质。
|
||||
*/
|
||||
private Boolean organNature;
|
||||
private Integer organNature;
|
||||
}
|
||||
|
||||
+4
-4
@@ -33,7 +33,7 @@ public class ResearchOfficeVO {
|
||||
/**
|
||||
* 是否启用,由数据库“停用”字段反向转换得到。
|
||||
*/
|
||||
private Boolean enabled;
|
||||
private Integer enabled;
|
||||
|
||||
/**
|
||||
* 停用时间。
|
||||
@@ -43,7 +43,7 @@ public class ResearchOfficeVO {
|
||||
/**
|
||||
* 是否为虚拟教研室。
|
||||
*/
|
||||
private Boolean virtual;
|
||||
private Integer virtual;
|
||||
|
||||
/**
|
||||
* 教研室备注。
|
||||
@@ -56,7 +56,7 @@ public class ResearchOfficeVO {
|
||||
private String sequenceNumber;
|
||||
|
||||
/**
|
||||
* 是否具有机关性质。
|
||||
* 机关性质。
|
||||
*/
|
||||
private Boolean organNature;
|
||||
private Integer organNature;
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.roomroot.jwgl.vo.login;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 登录响应结果
|
||||
*/
|
||||
@Data
|
||||
public class LoginResultVO {
|
||||
|
||||
/** 用户编号(登录信息表编号) */
|
||||
private String userId;
|
||||
|
||||
/** 用户姓名 */
|
||||
private String userName;
|
||||
|
||||
/** 登录账号 */
|
||||
private String loginName;
|
||||
|
||||
/** 用户类型: ADMIN-行政 TEACHER-教员 STUDENT-学员 MANAGER-管理员 */
|
||||
private String userType;
|
||||
|
||||
/** 单位编号 */
|
||||
private String orgId;
|
||||
|
||||
/** 单位名称 */
|
||||
private String orgName;
|
||||
|
||||
/** 角色列表 */
|
||||
private List<RoleInfo> roles;
|
||||
|
||||
@Data
|
||||
public static class RoleInfo {
|
||||
private String roleType;
|
||||
private String roleName;
|
||||
private String targetId;
|
||||
private String targetName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user