fix(dorm): 点名请假仅认审批完成,并修正点名时间时区

宿舍点名/卫生检查只展示 finish 请假;点名提交改用服务端本地时间,避免 toISOString 少 8 小时。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
“wuzhen”andCursor committed 2026-09-22 15:37:46 +08:00
1 parent a6a5b88f47
commit 64f805cca4
5 files changed
+17 -6

No files matched your search

@@ -69,7 +69,8 @@ public interface IXgStudentLeaveService {
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 根据学生ID列表和检查日期查询学生请假信息
* 根据学生ID列表和检查日期查询已审批结束的请假信息。
* 审批中(waiting)、草稿、退回、撤销不返回,宿舍点名和卫生检查因此不显示请假。
*
* @param studentIds 学生ID列表
* @param checkDate 检查日期
@@ -252,6 +252,9 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
} catch (Exception ignored) {
}
}
// 点名时间以服务端本地时间为准。前端 toISOString() 会提交 UTC,北京时间会少 8 小时。
bo.setCheckDate(new Date());
}
@Override
@@ -613,7 +613,8 @@ public class XgStudentLeaveServiceImpl implements IXgStudentLeaveService {
}
/**
* 根据学生ID列表和检查日期查询学生请假信息
* 根据学生ID列表和检查日期查询已审批结束的请假信息。
* 仅 approval_status = finish 且检查时间落在请假区间内的记录会返回。
*
* @param studentIds 学生ID列表
* @param checkDate 检查日期
@@ -627,8 +628,8 @@ public class XgStudentLeaveServiceImpl implements IXgStudentLeaveService {
LambdaQueryWrapper<XgStudentLeave> lqw = Wrappers.lambdaQuery();
lqw.in(XgStudentLeave::getStudentId, studentIds);
// 查询审核状态为"waiting"(待审核)或"finish"(已完成)的请假记录
lqw.in(XgStudentLeave::getApprovalStatus, "waiting", "finish");
// 宿舍点名、卫生检查等状态展示:审批未结束不视为请假,仅 finish(审批全部结束)
lqw.eq(XgStudentLeave::getApprovalStatus, BusinessStatusEnum.FINISH.getStatus());
// 检查日期在请假时间段内
lqw.le(XgStudentLeave::getStartTime, checkDate);
lqw.ge(XgStudentLeave::getEndTime, checkDate);
@@ -267,6 +267,11 @@ export default {
}
},
formatLocalDateTime(date) {
const pad = (n) => String(n).padStart(2, '0');
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
},
async handleSubmit() {
if (!this.buildingId || !this.roomId) {
uni.showToast({ title: '缺少必要参数', icon: 'none' });
@@ -296,7 +301,7 @@ export default {
const submitData = {
batchNo: this.batchNo,
checkDate: new Date().toISOString().slice(0, 19).replace('T', ' '),
checkDate: this.formatLocalDateTime(new Date()),
buildingId: this.buildingId,
roomId: this.roomId,
roomName: this.roomName,
@@ -47,6 +47,7 @@ import { submitRollCall } from '@/api/xg/xgss/dormRollCall/dormRollCall/index';
import { DormRollCallDetailForm, DormRollCallForm } from '@/api/xg/xgss/dormRollCall/dormRollCall/types';
import { getRoomStudents } from '@/api/xg/xgss/dormBedStudent/dormBedStudent/index';
import request from '@/utils/request';
import { parseTime } from '@/utils/ruoyi';
console.log('[点名调试] RoomRollCallPopup 组件已加载');
@@ -251,7 +252,7 @@ const handleSubmit = async () => {
const submitData: DormRollCallForm = {
batchNo: props.batchNo,
checkDate: new Date().toISOString().slice(0, 19).replace('T', ' '),
checkDate: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}'),
buildingId: props.buildingId,
roomId: props.roomId,
roomName: props.roomName,