This commit is contained in:
zlwu committed 2026-01-19 18:35:05 +08:00
1 parent 9e6cccf846
commit 7e5bd95470
6 files changed
+52 -19

No files matched your search

@@ -133,6 +133,18 @@ public class XgConductScoreController extends BaseController {
@PostMapping("/listByDeptId")
public TableDataInfo<XgConductScoreVo> listByDeptId(@RequestBody Map<String, Object> requestBody,
PageQuery pageQuery) {
// 从请求体中解析分页参数
if (requestBody.containsKey("pageNum") && requestBody.get("pageNum") != null) {
pageQuery.setPageNum(Integer.valueOf(requestBody.get("pageNum").toString()));
} else {
pageQuery.setPageNum(1);
}
if (requestBody.containsKey("pageSize") && requestBody.get("pageSize") != null) {
pageQuery.setPageSize(Integer.valueOf(requestBody.get("pageSize").toString()));
} else {
pageQuery.setPageSize(10);
}
// 从请求体中解析排序参数
if (requestBody.containsKey("orderByColumn")) {
pageQuery.setOrderByColumn((String) requestBody.get("orderByColumn"));
@@ -747,6 +759,7 @@ public class XgConductScoreController extends BaseController {
XgConductScoreImportVo example = new XgConductScoreImportVo();
// 设置示例数据
example.setMonth(9);
example.setStudentNo("2024001");
example.setStudentName("张三");
example.setScore(85);
@@ -771,17 +784,15 @@ public class XgConductScoreController extends BaseController {
public R<Void> importData(@RequestPart("file") MultipartFile file,
@NotNull(message = "学年不能为空") Integer academicYear,
@NotNull(message = "学期不能为空") Integer semester,
@NotNull(message = "月份不能为空") Integer month,
String classId) throws Exception {
log.info("导入操行分数据,学年: {}, 学期: {}, 月份: {}, 班级ID: {}", academicYear, semester, month, classId);
log.info("导入操行分数据,学年: {}, 学期: {}, 班级ID: {}", academicYear, semester, classId);
log.info("导入文件名: {}, 文件大小: {} bytes", file.getOriginalFilename(), file.getSize());
try {
ExcelResult<XgConductScoreImportVo> result = ExcelUtil.importExcel(
file.getInputStream(),
XgConductScoreImportVo.class,
new XgConductScoreImportListener(academicYear, semester, month, classId)
);
new XgConductScoreImportListener(academicYear, semester, classId));
log.info("Excel导入完成,结果: {}", result.getAnalysis());
return R.ok(result.getAnalysis());
@@ -20,6 +20,15 @@ public class XgConductScoreImportVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 月份
*/
@ExcelProperty("月份")
@NotNull(message = "月份不能为空")
@Min(value = 1, message = "月份必须在1-12之间")
@Max(value = 12, message = "月份必须在1-12之间")
private Integer month;
/**
* 学号
*/
@@ -40,7 +40,6 @@ public class XgConductScoreImportListener extends AnalysisEventListener<XgConduc
private final IXgStudentMsgService studentMsgService;
private final Integer academicYear;
private final Integer semester;
private final Integer month;
private final String classId; // 可选,指定班级ID
private final Long operUserId;
@@ -49,12 +48,11 @@ public class XgConductScoreImportListener extends AnalysisEventListener<XgConduc
private final StringBuilder successMsg = new StringBuilder();
private final StringBuilder failureMsg = new StringBuilder();
public XgConductScoreImportListener(Integer academicYear, Integer semester, Integer month, String classId) {
public XgConductScoreImportListener(Integer academicYear, Integer semester, String classId) {
this.conductScoreService = SpringUtils.getBean(IXgConductScoreService.class);
this.studentMsgService = SpringUtils.getBean(IXgStudentMsgService.class);
this.academicYear = academicYear;
this.semester = semester;
this.month = month;
this.classId = classId;
this.operUserId = LoginHelper.getUserId();
}
@@ -65,6 +63,9 @@ public class XgConductScoreImportListener extends AnalysisEventListener<XgConduc
// 1. 验证数据完整性
validateImportData(importVo);
// 2. 获取月份参数(从Excel数据中读取)
Integer month = importVo.getMonth();
// 2. 根据学号查找学生信息
XgStudentMsgBo queryBo = new XgStudentMsgBo();
queryBo.setStudentNo(importVo.getStudentNo());
@@ -179,6 +180,12 @@ public class XgConductScoreImportListener extends AnalysisEventListener<XgConduc
}
// 验证必填字段
if (importVo.getMonth() == null) {
throw new ServiceException("月份不能为空");
}
if (importVo.getMonth() < 1 || importVo.getMonth() > 12) {
throw new ServiceException("月份必须在1-12之间");
}
if (StringUtils.isBlank(importVo.getStudentNo())) {
throw new ServiceException("学号不能为空");
}
@@ -39,7 +39,7 @@
| 查询操行分列表 | GET | /api/xg/conduct-score/list | xg:conduct:score:list | 分页查询操行分记录 |
| 查询操行分详情 | GET | /api/xg/conduct-score/{id} | xg:conduct:score:query | 根据ID查询操行分详情 |
| 新增操行分 | POST | /api/xg/conduct-score | xg:conduct:score:add | 创建新的操行分记录 |
| 更新操行分 | PUT | /api/xg/conduct-score/{id} | xg:conduct:score:edit | 更新指定操行分记录 |
| 更新操行分 | PUT | /api/xg/conduct-score/{id} | xg:conductScore:update | 更新指定操行分记录 |
| 删除操行分 | DELETE | /api/xg/conduct-score/{ids} | xg:conduct:score:remove | 删除指定操行分记录 |
#### 业务逻辑接口
@@ -369,14 +369,21 @@
```java
// 操行分管理权限
xg:conduct:score:list // 查看操行分列表
xg:conduct:score:query // 查看操行分详情
xg:conduct:score:add // 新增操行分
xg:conduct:score:edit // 编辑操行分
xg:conduct:score:remove // 删除操行分
xg:conduct:score:batchAdd // 批量录入操行分
xg:conduct:score:classStudents // 查看班主任班级学生
xg:conduct:score:semester // 学期统计查看
xg:conductScore:list // 查看操行分列表
xg:conductScore:list // 查看操行分列表(按部门)
xg:conductScore:batchAdd // 批量录入操行分
xg:conductScore:batchUpdate // 批量更新操行分
xg:conductScore:classStudents // 查看班主任班级学生
xg:conductScore:export // 导出操行分数据
xg:conductScore:semesterAverage // 学期平均分统计
xg:conductScore:exportSemester // 导出学期统计
xg:conductScore:studentRecords // 获取学生详细记录
xg:conductScore:classDetail // 查看班级详情
xg:conductScore:update // 更新操行分
xg:conductScore:remove // 删除操行分
xg:conductScore:checkPermission // 验证录入权限
xg:conductScore:importTemplate // 导入模板
xg:conductScore:importData // 导入数据
xg:conduct:score:export // 数据导出
xg:conduct:score:studentRecords // 获取学生详细记录
```
@@ -197,7 +197,7 @@
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<template #tip>
<div class="text-center el-upload__tip">
<div class="el-upload__tip" style="color: #409eff; margin-bottom: 5px">模板包含4列:学号、学生姓名、分数、备注</div>
<div class="el-upload__tip" style="color: #409eff; margin-bottom: 5px">模板包含5列:月份、学号、学生姓名、分数、备注</div>
<div class="el-upload__tip" style="color: red">仅处理班主任负责班级的学生数据,学号不存在或姓名不匹配的数据将被跳过</div>
<span>仅允许导入xls、xlsx格式文件。</span>
<el-link
@@ -1007,7 +1007,6 @@ const getImportUrl = () => {
const params = new URLSearchParams();
params.append('academicYear', queryParams.academicYear.toString());
params.append('semester', queryParams.semester.toString());
params.append('month', queryParams.month.toString());
// 如果选择了特定班级,则只导入该班级数据
if (activeTab.value) {
@@ -240,7 +240,7 @@
<el-table-column label="操作" fixed="right" width="180" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
<el-button link type="primary" icon="Edit" v-hasPermi="['xg:conductScore:update']" @click="handleUpdate(scope.row)"></el-button>
</el-tooltip>
</template>
</el-table-column>