AI测试反馈的报错调整

This commit is contained in:
2026-09-18 18:12:59 +08:00
parent 68b02ea58e
commit f36b1f4701
16 changed files with 90 additions and 25 deletions
@@ -198,7 +198,7 @@ public class LogController {
@GetMapping("/teaching-log/download-template") @GetMapping("/teaching-log/download-template")
public void downloadTemplate(HttpServletResponse response) { public void downloadTemplate(HttpServletResponse response) {
try { try {
java.io.InputStream is = getClass().getClassLoader().getResourceAsStream("template/导入教学日志模板.xls"); java.io.InputStream is = getClass().getClassLoader().getResourceAsStream("file/导入教学日志模板.xls");
if (is == null) { if (is == null) {
response.setStatus(404); response.setStatus(404);
return; return;
@@ -92,11 +92,8 @@ public class TeachingPlanController {
* 下载教学实施计划导入模板 * 下载教学实施计划导入模板
*/ */
@GetMapping("/template") @GetMapping("/template")
public ResponseEntity<org.springframework.core.io.Resource> downloadTemplate() throws IOException { public ResponseEntity<byte[]> downloadTemplate() throws Exception {
ClassPathResource resource = new ClassPathResource("template/教学实施计划导入模板.xlsx"); byte[] bytes = teachingPlanService.buildImportTemplate();
if (!resource.exists()) {
return ResponseEntity.notFound().build();
}
String fileName = URLEncoder.encode("教学实施计划导入模板.xlsx", "UTF-8"); String fileName = URLEncoder.encode("教学实施计划导入模板.xlsx", "UTF-8");
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
@@ -105,6 +102,6 @@ public class TeachingPlanController {
return ResponseEntity.ok() return ResponseEntity.ok()
.headers(headers) .headers(headers)
.body(resource); .body(bytes);
} }
} }
@@ -60,7 +60,7 @@ public class XYXJYDSQB {
private String xydgbbh; private String xydgbbh;
/** 学员队干部审核时间 */ /** 学员队干部审核时间 */
@TableField("学员队干部审核时间") @TableField("学员队审核时间")
private LocalDateTime xydshsj; private LocalDateTime xydshsj;
/** 管理员审核时间 */ /** 管理员审核时间 */
@@ -24,7 +24,7 @@
a.停用, a.停用,
a.备注 a.备注
FROM "保障提供明细" a FROM "保障提供明细" a
LEFT JOIN "保障类别" l ON a.保障类别编号 = l.编号 LEFT JOIN "保障类别" l ON a.保障类别编号 = l."BH"
WHERE a.停用 = 0 WHERE a.停用 = 0
<if test="bzlbbh != null and bzlbbh != ''"> <if test="bzlbbh != null and bzlbbh != ''">
AND a.保障类别编号 = #{bzlbbh} AND a.保障类别编号 = #{bzlbbh}
@@ -31,6 +31,7 @@ public interface JYBMapper extends BaseMapper<JYB> {
@Select("SELECT TRIM(b.\"教员编号\") FROM \"教员登录表\" b " @Select("SELECT TRIM(b.\"教员编号\") FROM \"教员登录表\" b "
+ "JOIN \"登录信息表\" a ON TRIM(a.\"编号\") = TRIM(b.\"登录信息编号\") " + "JOIN \"登录信息表\" a ON TRIM(a.\"编号\") = TRIM(b.\"登录信息编号\") "
+ "WHERE TRIM(a.\"账号\") = #{username}") + "WHERE LOWER(TRIM(a.\"账号\")) = LOWER(TRIM(#{username})) "
+ "OR LOWER(TRIM(a.\"统一账号\")) = LOWER(TRIM(#{username}))")
String selectTeacherIdByAccount(@Param("username") String username); String selectTeacherIdByAccount(@Param("username") String username);
} }
@@ -14,6 +14,7 @@ public interface JYSDLBMapper extends BaseMapper<JYSDLB> {
@Select("SELECT TRIM(b.\"教研室代号\") FROM \"教研室登录表\" b " @Select("SELECT TRIM(b.\"教研室代号\") FROM \"教研室登录表\" b "
+ "JOIN \"登录信息表\" a ON TRIM(a.\"编号\") = TRIM(b.\"登录信息编号\") " + "JOIN \"登录信息表\" a ON TRIM(a.\"编号\") = TRIM(b.\"登录信息编号\") "
+ "WHERE TRIM(a.\"账号\") = #{username}") + "WHERE LOWER(TRIM(a.\"账号\")) = LOWER(TRIM(#{username})) "
+ "OR LOWER(TRIM(a.\"统一账号\")) = LOWER(TRIM(#{username}))")
String selectResearchOfficeIdByAccount(@Param("username") String username); String selectResearchOfficeIdByAccount(@Param("username") String username);
} }
@@ -49,7 +49,7 @@
FROM "课程表_保障明细" a FROM "课程表_保障明细" a
INNER JOIN "实施_课程表" b ON a.课程表编号 = b.编号 INNER JOIN "实施_课程表" b ON a.课程表编号 = b.编号
LEFT JOIN "保障提供明细" m ON a.保障提供明细编号 = m.编号 LEFT JOIN "保障提供明细" m ON a.保障提供明细编号 = m.编号
LEFT JOIN "保障类别" l ON m.保障类别编号 = l.编号 LEFT JOIN "保障类别" l ON m.保障类别编号 = l."BH"
WHERE b.实施_课程编号 = #{sskcbh} WHERE b.实施_课程编号 = #{sskcbh}
AND a.课程表编号 != #{sskcbbh} AND a.课程表编号 != #{sskcbbh}
GROUP BY GROUP BY
@@ -96,7 +96,7 @@
a.日期 AS 创建时间 a.日期 AS 创建时间
FROM "课程表_保障明细" a FROM "课程表_保障明细" a
LEFT JOIN "保障提供明细" m ON a.保障提供明细编号 = m.编号 LEFT JOIN "保障提供明细" m ON a.保障提供明细编号 = m.编号
LEFT JOIN "保障类别" l ON m.保障类别编号 = l.编号 LEFT JOIN "保障类别" l ON m.保障类别编号 = l."BH"
LEFT JOIN "教员表" t ON ( LEFT JOIN "教员表" t ON (
CASE CASE
WHEN a.备注 LIKE '%"confirmed":true%' THEN WHEN a.备注 LIKE '%"confirmed":true%' THEN
@@ -61,7 +61,7 @@
b.变动时间 b.变动时间
FROM "实施_课程表" b FROM "实施_课程表" b
LEFT JOIN "实施_课程" a ON LOWER(RAWTOHEX(a."编号")) = LOWER(REPLACE(TRIM(b.实施_课程编号), '-', '')) LEFT JOIN "实施_课程" a ON LOWER(RAWTOHEX(a."编号")) = LOWER(REPLACE(TRIM(b.实施_课程编号), '-', ''))
LEFT JOIN "课表" c ON a.编号 = c.课编号 LEFT JOIN "课表" c ON a.科目编号 = c.课编号
WHERE b.删除状态 = 0 WHERE b.删除状态 = 0
<if test="sskcbh != null and sskcbh != ''"> <if test="sskcbh != null and sskcbh != ''">
AND b.实施_课程编号 = #{sskcbh} AND b.实施_课程编号 = #{sskcbh}
@@ -117,7 +117,7 @@
b.变动时间 b.变动时间
FROM "实施_课程表" b FROM "实施_课程表" b
LEFT JOIN "实施_课程" a ON LOWER(RAWTOHEX(a."编号")) = LOWER(REPLACE(TRIM(b.实施_课程编号), '-', '')) LEFT JOIN "实施_课程" a ON LOWER(RAWTOHEX(a."编号")) = LOWER(REPLACE(TRIM(b.实施_课程编号), '-', ''))
LEFT JOIN "课表" c ON a.编号 = c.课编号 LEFT JOIN "课表" c ON a.科目编号 = c.课编号
WHERE b.编号 = #{sskcbbh} WHERE b.编号 = #{sskcbbh}
AND b.删除状态 = 0 AND b.删除状态 = 0
</select> </select>
@@ -67,4 +67,11 @@ public interface TeachingPlanService {
* @throws Exception 解析或导入异常 * @throws Exception 解析或导入异常
*/ */
int importFromExcel(MultipartFile file) throws Exception; int importFromExcel(MultipartFile file) throws Exception;
/**
* 生成导入模板 Excel(列序与 {@link #importFromExcel} 解析一致)。
*
* @return xlsx 字节
*/
byte[] buildImportTemplate() throws Exception;
} }
@@ -11,10 +11,15 @@ import com.roomroot.jwgl.unit.PageResult;
import com.roomroot.jwgl.utils.ExcelParseUtil; import com.roomroot.jwgl.utils.ExcelParseUtil;
import com.roomroot.jwgl.utils.UuidUtil; import com.roomroot.jwgl.utils.UuidUtil;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayOutputStream;
import java.util.List; import java.util.List;
/** /**
@@ -104,4 +109,44 @@ public class TeachingPlanServiceImpl implements TeachingPlanService {
} }
return list.size(); return list.size();
} }
@Override
public byte[] buildImportTemplate() throws Exception {
String[] headers = {
"序号", "年度", "原序号", "日期", "原节次", "节次", "课程名称", "班次",
"责任单位", "授课教员", "教学场地", "教学内容", "教学方法",
"教员备注", "教务备注", "检查结果", "课程表编号"
};
String[] example = {
"1", "2026", "", "2026-03-02 08:00:00", "", "1", "高等数学", "1班",
"基础教研室", "张三", "教学楼A-101", "函数与极限", "讲授",
"", "", "", ""
};
try (Workbook wb = new XSSFWorkbook(); ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
Sheet sheet = wb.createSheet("教学实施计划");
Row header = sheet.createRow(0);
for (int i = 0; i < headers.length; i++) {
header.createCell(i).setCellValue(headers[i]);
sheet.setColumnWidth(i, 14 * 256);
}
Row row = sheet.createRow(1);
for (int i = 0; i < example.length; i++) {
row.createCell(i).setCellValue(example[i]);
}
Sheet help = wb.createSheet("填写说明");
String[] notes = {
"1. 数据从第2行开始填写,第1行表头请勿修改,列顺序固定不可调整。",
"2. 「课程名称」必填,课程名称为空的行将被跳过;其余列可留空。",
"3. 「序号」「年度」「节次」为整数;「日期」支持 yyyy-MM-dd 或 yyyy-MM-dd HH:mm:ss。",
"4. 第2行为示例数据,导入前请删除。",
"5. 标识号、登录编号由系统自动生成,无需填写。"
};
for (int i = 0; i < notes.length; i++) {
help.createRow(i).createCell(0).setCellValue(notes[i]);
}
help.setColumnWidth(0, 100 * 256);
wb.write(bos);
return bos.toByteArray();
}
}
} }
+1 -1
View File
@@ -103,7 +103,7 @@ service.interceptors.response.use(res => {
return Promise.reject('error') return Promise.reject('error')
} else if (code !== 200) { } else if (code !== 200) {
Notification.error({ title: msg }) Notification.error({ title: msg })
return Promise.reject('error') return Promise.reject(new Error(msg))
} else { } else {
return res.data return res.data
} }
@@ -55,8 +55,8 @@
<div v-loading="loading" class="course-list"> <div v-loading="loading" class="course-list">
<div v-if="!courses.length" class="empty-tip">该班次学期暂无可排课程</div> <div v-if="!courses.length" class="empty-tip">该班次学期暂无可排课程</div>
<div <div
v-for="c in courses" v-for="(c, i) in courses"
:key="c.sskcbh" :key="c.sskcbh + '#' + i"
class="course-item" class="course-item"
:class="{ 'is-active': currentCourse && currentCourse.sskcbh === c.sskcbh, 'is-full': c.full, 'is-readonly': !c.editable }" :class="{ 'is-active': currentCourse && currentCourse.sskcbh === c.sskcbh, 'is-full': c.full, 'is-readonly': !c.editable }"
@click="selectCourse(c)" @click="selectCourse(c)"
@@ -22,7 +22,7 @@
</el-form-item> </el-form-item>
<el-form-item :label="dimLabel"> <el-form-item :label="dimLabel">
<el-select v-model="targetId" :placeholder="'请选择' + dimLabel" clearable filterable :loading="optionsLoading" style="width: 240px"> <el-select v-model="targetId" :placeholder="'请选择' + dimLabel" clearable filterable :loading="optionsLoading" style="width: 240px">
<el-option v-for="o in targetOptions" :key="o.value" :label="o.label" :value="o.value" /> <el-option v-for="(o, i) in targetOptions" :key="(o.value || '') + '_' + i" :label="o.label" :value="o.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="日期范围"> <el-form-item label="日期范围">
@@ -16,7 +16,7 @@
/> />
<el-button size="small" @click="shiftDay(1)">下一天<i class="el-icon-arrow-right" /></el-button> <el-button size="small" @click="shiftDay(1)">下一天<i class="el-icon-arrow-right" /></el-button>
</div> </div>
<el-table v-loading="todayLoading" :data="todayRows" border stripe size="small" max-height="560"> <el-table v-loading="todayLoading" :data="todayRows" border stripe size="small" max-height="560" :empty-text="todayError || '暂无数据'">
<el-table-column prop="sksj" label="上课时间" width="170" align="center" /> <el-table-column prop="sksj" label="上课时间" width="170" align="center" />
<el-table-column prop="kc" label="课程" min-width="150" align="center" show-overflow-tooltip /> <el-table-column prop="kc" label="课程" min-width="150" align="center" show-overflow-tooltip />
<el-table-column prop="bc" label="班次" min-width="130" align="center" show-overflow-tooltip /> <el-table-column prop="bc" label="班次" min-width="130" align="center" show-overflow-tooltip />
@@ -39,7 +39,7 @@
<el-button type="primary" icon="el-icon-search" @click="loadCourses">查询</el-button> <el-button type="primary" icon="el-icon-search" @click="loadCourses">查询</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table v-loading="courseLoading" :data="courseRows" border stripe size="small" max-height="560"> <el-table v-loading="courseLoading" :data="courseRows" border stripe size="small" max-height="560" :empty-text="courseError || '暂无数据'">
<el-table-column prop="kcmcksxs" label="课程名称/课时系数" min-width="180" align="center" show-overflow-tooltip /> <el-table-column prop="kcmcksxs" label="课程名称/课时系数" min-width="180" align="center" show-overflow-tooltip />
<el-table-column prop="zrjykc" label="责任教员/课次" min-width="140" align="center" show-overflow-tooltip /> <el-table-column prop="zrjykc" label="责任教员/课次" min-width="140" align="center" show-overflow-tooltip />
<el-table-column prop="jhxs" label="计划学时" width="80" align="center" /> <el-table-column prop="jhxs" label="计划学时" width="80" align="center" />
@@ -52,7 +52,7 @@
<!-- ==================== 本室教员 ==================== --> <!-- ==================== 本室教员 ==================== -->
<el-tab-pane label="本室教员" name="teachers"> <el-tab-pane label="本室教员" name="teachers">
<el-table v-loading="teacherLoading" :data="teacherRows" border stripe size="small" max-height="560"> <el-table v-loading="teacherLoading" :data="teacherRows" border stripe size="small" max-height="560" :empty-text="teacherError || '暂无数据'">
<el-table-column prop="jybh" label="教员编号" width="140" align="center" /> <el-table-column prop="jybh" label="教员编号" width="140" align="center" />
<el-table-column prop="jyxm" label="姓名" min-width="140" align="center"> <el-table-column prop="jyxm" label="姓名" min-width="140" align="center">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
@@ -76,11 +76,14 @@ export default {
day: '', day: '',
todayRows: [], todayRows: [],
todayLoading: false, todayLoading: false,
todayError: '',
courseQuery: { nd: null, xqdc: null }, courseQuery: { nd: null, xqdc: null },
courseRows: [], courseRows: [],
courseLoading: false, courseLoading: false,
courseError: '',
teacherRows: [], teacherRows: [],
teacherLoading: false teacherLoading: false,
teacherError: ''
} }
}, },
created() { created() {
@@ -103,20 +106,26 @@ export default {
}, },
loadToday() { loadToday() {
this.todayLoading = true this.todayLoading = true
this.todayError = ''
myOfficeToday({ rq: this.day }) myOfficeToday({ rq: this.day })
.then(res => { this.todayRows = res.data || [] }) .then(res => { this.todayRows = res.data || [] })
.catch(err => { this.todayRows = []; this.todayError = (err && err.message) || '加载失败' })
.finally(() => { this.todayLoading = false }) .finally(() => { this.todayLoading = false })
}, },
loadCourses() { loadCourses() {
this.courseLoading = true this.courseLoading = true
this.courseError = ''
myOfficeCourses(this.courseQuery) myOfficeCourses(this.courseQuery)
.then(res => { this.courseRows = res.data || [] }) .then(res => { this.courseRows = res.data || [] })
.catch(err => { this.courseRows = []; this.courseError = (err && err.message) || '加载失败' })
.finally(() => { this.courseLoading = false }) .finally(() => { this.courseLoading = false })
}, },
loadTeachers() { loadTeachers() {
this.teacherLoading = true this.teacherLoading = true
this.teacherError = ''
myOfficeTeachers() myOfficeTeachers()
.then(res => { this.teacherRows = res.data || [] }) .then(res => { this.teacherRows = res.data || [] })
.catch(err => { this.teacherRows = []; this.teacherError = (err && err.message) || '加载失败' })
.finally(() => { this.teacherLoading = false }) .finally(() => { this.teacherLoading = false })
} }
} }
@@ -385,6 +385,10 @@ export default {
eventCalendarVisible: false, eventCalendarVisible: false,
eventCalendarSemester: null, eventCalendarSemester: null,
// ==================== 教学配当 ====================
allocationVisible: false,
allocationSemester: null,
// ==================== 批量创建班次学期 ==================== // ==================== 批量创建班次学期 ====================
batchAddVisible: false, batchAddVisible: false,
batchAddForm: { nd: undefined, xqdc: undefined, startTime: '', endTime: '' }, batchAddForm: { nd: undefined, xqdc: undefined, startTime: '', endTime: '' },
@@ -1330,8 +1330,9 @@ export default {
this.roleLoading = true this.roleLoading = true
listRole({ pageNum: 1, pageSize: 200, status: '0' }).then(res => { listRole({ pageNum: 1, pageSize: 200, status: '0' }).then(res => {
this.roleOptions = res.rows || res.data || [] this.roleOptions = res.rows || res.data || []
}).catch(e => { }).catch(() => {
console.error('加载角色列表失败', e) // 无角色管理权限(如教研室账号)时只保留默认教员角色,不影响新增
this.roleOptions = [{ roleId: 101, roleName: '教员' }]
}).finally(() => { }).finally(() => {
this.roleLoading = false this.roleLoading = false
}) })