forked from liweijie/education
bug修复
This commit is contained in:
+1
-1
@@ -178,7 +178,7 @@ public interface CourseRunningImportService {
|
||||
PageResult<ScheduleAdjustApplyVO> queryScheduleAdjustList(ScheduleAdjustQueryDTO query);
|
||||
|
||||
/**
|
||||
* 查询当前教员可供调课的课次,关联学员队任务表、课表、课程表。
|
||||
* 查询当前教员可供调课的课次,字段对齐调课提交默认值。
|
||||
*
|
||||
* @param nd 年度,可空
|
||||
* @return 可选课次列表
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.roomroot.jwgl.entity.KCB;
|
||||
import com.roomroot.jwgl.unit.PageQuery;
|
||||
import com.roomroot.jwgl.unit.PageResult;
|
||||
import com.roomroot.jwgl.vo.kcb.ClassTimetableVO;
|
||||
import com.roomroot.jwgl.vo.kcb.DailyWeeklyTimetableVO;
|
||||
import com.roomroot.jwgl.vo.kcb.DailyWeeklyTimetableRangeVO;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.util.List;
|
||||
@@ -59,14 +59,14 @@ public interface KCBService {
|
||||
List<KCB> list();
|
||||
|
||||
/**
|
||||
* 今日课表。未传年度时按当前时间取本学期。
|
||||
* 今日课表。rq 为当前查看日期,offset 为相对天数,可连续切换。
|
||||
*/
|
||||
List<DailyWeeklyTimetableVO> listToday(TimetableQuery cond);
|
||||
DailyWeeklyTimetableRangeVO listToday(String rq, Integer offset);
|
||||
|
||||
/**
|
||||
* 本周课表(周一至周日)。未传年度时按当前时间取本学期。
|
||||
* 本周课表(周一至周日)。rq 为当前查看日期,offset 为相对周数,可连续切换。
|
||||
*/
|
||||
List<DailyWeeklyTimetableVO> listWeek(TimetableQuery cond);
|
||||
DailyWeeklyTimetableRangeVO listWeek(String rq, Integer offset);
|
||||
|
||||
/**
|
||||
* 班次课表。未传年度时按当前时间取本学期,可按队别班次筛选。
|
||||
|
||||
+158
-22
@@ -898,7 +898,9 @@ public class CourseRunningImportServiceImpl implements CourseRunningImportServic
|
||||
|
||||
@Override
|
||||
public List<AdjustableLessonVO> listAdjustableLessons(Integer nd) {
|
||||
return ssdksqMapper.selectAdjustableLessons(jwglRoleHelper.requireTeacherId(), nd);
|
||||
List<AdjustableLessonVO> lessons = ssdksqMapper.selectAdjustableLessons(jwglRoleHelper.requireTeacherId(), nd);
|
||||
fillAdjustableLessonSubmitDefaults(lessons);
|
||||
return lessons;
|
||||
}
|
||||
|
||||
private void applyScheduleAdjustDataScope(ScheduleAdjustQueryDTO query) {
|
||||
@@ -973,6 +975,7 @@ public class CourseRunningImportServiceImpl implements CourseRunningImportServic
|
||||
|
||||
AdjustableLessonVO picked = null;
|
||||
List<AdjustableLessonVO> mine = ssdksqMapper.selectAdjustableLessons(teacherId, lesson.getNd());
|
||||
fillAdjustableLessonSubmitDefaults(mine);
|
||||
if (mine != null) {
|
||||
for (AdjustableLessonVO item : mine) {
|
||||
if (lesson.getBh().equals(item.getSskcbbh())) {
|
||||
@@ -992,23 +995,23 @@ public class CourseRunningImportServiceImpl implements CourseRunningImportServic
|
||||
apply.setYdsjap(resolveYdsjap(lesson));
|
||||
apply.setZxzt(0);
|
||||
apply.setYszt(0);
|
||||
apply.setXydrwbh(cut(StringUtils.isNotEmpty(dto.getXydrwbh()) ? dto.getXydrwbh() : picked.getXydrwbh(), 50));
|
||||
apply.setKbh(cut(StringUtils.isNotEmpty(dto.getKbh()) ? dto.getKbh() : picked.getKbh(), 50));
|
||||
apply.setKcbbh(cut(StringUtils.isNotEmpty(dto.getKcbbh()) ? dto.getKcbbh() : picked.getKcbbh(), 50));
|
||||
apply.setXydrwbh(cut(firstNonEmpty(dto.getXydrwbh(), picked.getXydrwbh()), 50));
|
||||
apply.setKbh(cut(firstNonEmpty(dto.getKbh(), picked.getKbh()), 50));
|
||||
apply.setKcbbh(cut(firstNonEmpty(dto.getKcbbh(), picked.getKcbbh()), 50));
|
||||
apply.setJysdh(cut(picked.getJysdh(), 50));
|
||||
apply.setYjsbh(cut(picked.getJsbh(), 50));
|
||||
apply.setXjsbh(cut(resolveNewClassroom(dto), 50));
|
||||
apply.setYjsbh(cut(firstNonEmpty(picked.getYjsbh(), picked.getJsbh()), 50));
|
||||
apply.setXjsbh(cut(resolveNewClassroom(dto, picked), 50));
|
||||
apply.setSqjybh(cut(teacherId, 50));
|
||||
apply.setSy(cut(dto.getSy(), 200));
|
||||
apply.setRq(dto.getRq());
|
||||
apply.setJc(dto.getJc() != null ? dto.getJc() : 0);
|
||||
apply.setNd(dto.getNd() != null ? dto.getNd() : (lesson.getNd() != null ? lesson.getNd() : 0));
|
||||
apply.setJxnr(cut(dto.getJxnr(), 500));
|
||||
apply.setJxyd(dto.getJxyd());
|
||||
String jxff = cut(dto.getJxff(), 50);
|
||||
apply.setJxnr(cut(firstNonEmpty(dto.getJxnr(), picked.getJxnr()), 500));
|
||||
apply.setJxyd(firstNonEmpty(dto.getJxyd(), picked.getJxyd()));
|
||||
String jxff = cut(firstNonEmpty(dto.getJxff(), picked.getJxff()), 50);
|
||||
apply.setJxff(jxff == null ? "" : jxff);
|
||||
apply.setJxbzbz(dto.getJxbzbz());
|
||||
apply.setYcxx(dto.getYcxx());
|
||||
apply.setJxbzbz(firstNonEmpty(dto.getJxbzbz(), picked.getJxbzbz()));
|
||||
apply.setYcxx(firstNonEmpty(dto.getYcxx(), picked.getYcxx()));
|
||||
apply.setBz(cut(dto.getBz(), 50));
|
||||
apply.setJyspzzt(0);
|
||||
apply.setJyscszt(0);
|
||||
@@ -1018,8 +1021,9 @@ public class CourseRunningImportServiceImpl implements CourseRunningImportServic
|
||||
apply.setCjsj(LocalDateTime.now());
|
||||
ssdksqMapper.insert(apply);
|
||||
|
||||
if (dto.getRoomList() != null && !dto.getRoomList().isEmpty()) {
|
||||
for (AdjustRoomDTO roomDto : dto.getRoomList()) {
|
||||
List<AdjustRoomDTO> roomList = dto.getRoomList() != null ? dto.getRoomList() : picked.getRoomList();
|
||||
if (roomList != null && !roomList.isEmpty()) {
|
||||
for (AdjustRoomDTO roomDto : roomList) {
|
||||
if (StringUtils.isEmpty(roomDto.getJsbh())) {
|
||||
continue;
|
||||
}
|
||||
@@ -1043,8 +1047,9 @@ public class CourseRunningImportServiceImpl implements CourseRunningImportServic
|
||||
roomEntity.setJc(apply.getJc());
|
||||
dksqjsMapper.insert(roomEntity);
|
||||
}
|
||||
if (dto.getTeacherList() != null && !dto.getTeacherList().isEmpty()) {
|
||||
for (AdjustTeacherDTO teacherDto : dto.getTeacherList()) {
|
||||
List<AdjustTeacherDTO> teacherList = dto.getTeacherList() != null ? dto.getTeacherList() : picked.getTeacherList();
|
||||
if (teacherList != null && !teacherList.isEmpty()) {
|
||||
for (AdjustTeacherDTO teacherDto : teacherList) {
|
||||
if (StringUtils.isEmpty(teacherDto.getFzjybh())) {
|
||||
continue;
|
||||
}
|
||||
@@ -1060,8 +1065,9 @@ public class CourseRunningImportServiceImpl implements CourseRunningImportServic
|
||||
dksqfzjyMapper.insert(teacherEntity);
|
||||
}
|
||||
}
|
||||
if (dto.getTeamList() != null && !dto.getTeamList().isEmpty()) {
|
||||
for (AdjustTeamDTO teamDto : dto.getTeamList()) {
|
||||
List<AdjustTeamDTO> teamList = dto.getTeamList() != null ? dto.getTeamList() : picked.getTeamList();
|
||||
if (teamList != null && !teamList.isEmpty()) {
|
||||
for (AdjustTeamDTO teamDto : teamList) {
|
||||
if (StringUtils.isEmpty(teamDto.getXydbh())) {
|
||||
continue;
|
||||
}
|
||||
@@ -1075,8 +1081,9 @@ public class CourseRunningImportServiceImpl implements CourseRunningImportServic
|
||||
dksqxydMapper.insert(teamEntity);
|
||||
}
|
||||
}
|
||||
if (dto.getSupportList() != null && !dto.getSupportList().isEmpty()) {
|
||||
for (AdjustSupportDTO supportDto : dto.getSupportList()) {
|
||||
List<AdjustSupportDTO> supportList = dto.getSupportList() != null ? dto.getSupportList() : picked.getSupportList();
|
||||
if (supportList != null && !supportList.isEmpty()) {
|
||||
for (AdjustSupportDTO supportDto : supportList) {
|
||||
if (StringUtils.isEmpty(supportDto.getBztgmxbh()) || supportDto.getSl() == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -1152,17 +1159,146 @@ public class CourseRunningImportServiceImpl implements CourseRunningImportServic
|
||||
return text.length() <= max ? text : text.substring(0, max);
|
||||
}
|
||||
|
||||
private String resolveNewClassroom(ScheduleAdjustApplyDTO dto) {
|
||||
if (StringUtils.isNotEmpty(dto.getXjsbh())) {
|
||||
private String firstNonEmpty(String... values) {
|
||||
if (values == null) {
|
||||
return null;
|
||||
}
|
||||
for (String value : values) {
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String resolveNewClassroom(ScheduleAdjustApplyDTO dto, AdjustableLessonVO picked) {
|
||||
if (dto != null && StringUtils.isNotEmpty(dto.getXjsbh())) {
|
||||
return dto.getXjsbh().trim();
|
||||
}
|
||||
if (dto.getRoomList() != null && !dto.getRoomList().isEmpty()
|
||||
if (dto != null && dto.getRoomList() != null && !dto.getRoomList().isEmpty()
|
||||
&& StringUtils.isNotEmpty(dto.getRoomList().get(0).getJsbh())) {
|
||||
return dto.getRoomList().get(0).getJsbh().trim();
|
||||
}
|
||||
if (picked != null && StringUtils.isNotEmpty(picked.getXjsbh())) {
|
||||
return picked.getXjsbh().trim();
|
||||
}
|
||||
if (picked != null && picked.getRoomList() != null && !picked.getRoomList().isEmpty()
|
||||
&& StringUtils.isNotEmpty(picked.getRoomList().get(0).getJsbh())) {
|
||||
return picked.getRoomList().get(0).getJsbh().trim();
|
||||
}
|
||||
if (picked != null && StringUtils.isNotEmpty(picked.getJsbh())) {
|
||||
return picked.getJsbh().trim();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把当前课次的教室、辅助教员、学员队、保障明细回填到可选课次上,供提交调课直接使用。
|
||||
*/
|
||||
private void fillAdjustableLessonSubmitDefaults(List<AdjustableLessonVO> lessons) {
|
||||
if (lessons == null || lessons.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<String> ids = new ArrayList<>();
|
||||
Map<String, AdjustableLessonVO> byId = new HashMap<>();
|
||||
for (AdjustableLessonVO lesson : lessons) {
|
||||
if (lesson == null || StringUtils.isEmpty(lesson.getSskcbbh())) {
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isEmpty(lesson.getSqjybh())) {
|
||||
lesson.setSqjybh(lesson.getJybh());
|
||||
}
|
||||
if (StringUtils.isEmpty(lesson.getYjsbh())) {
|
||||
lesson.setYjsbh(lesson.getJsbh());
|
||||
}
|
||||
if (StringUtils.isEmpty(lesson.getXjsbh())) {
|
||||
lesson.setXjsbh(lesson.getJsbh());
|
||||
}
|
||||
if (lesson.getJxff() == null) {
|
||||
lesson.setJxff("");
|
||||
}
|
||||
lesson.setRoomList(new ArrayList<>());
|
||||
lesson.setTeacherList(new ArrayList<>());
|
||||
lesson.setTeamList(new ArrayList<>());
|
||||
lesson.setSupportList(new ArrayList<>());
|
||||
ids.add(lesson.getSskcbbh());
|
||||
byId.put(lesson.getSskcbbh(), lesson);
|
||||
}
|
||||
if (ids.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<AdjustableLessonVO.ChildRow> rooms = ssdksqMapper.selectLessonRooms(ids);
|
||||
if (rooms != null) {
|
||||
for (AdjustableLessonVO.ChildRow row : rooms) {
|
||||
AdjustableLessonVO lesson = byId.get(row.getSskcbbh());
|
||||
if (lesson == null || StringUtils.isEmpty(row.getJsbh())) {
|
||||
continue;
|
||||
}
|
||||
AdjustRoomDTO dto = new AdjustRoomDTO();
|
||||
dto.setJsbh(row.getJsbh());
|
||||
dto.setBz(row.getBz());
|
||||
lesson.getRoomList().add(dto);
|
||||
}
|
||||
}
|
||||
List<AdjustableLessonVO.ChildRow> teachers = ssdksqMapper.selectLessonTeachers(ids);
|
||||
if (teachers != null) {
|
||||
for (AdjustableLessonVO.ChildRow row : teachers) {
|
||||
AdjustableLessonVO lesson = byId.get(row.getSskcbbh());
|
||||
if (lesson == null || StringUtils.isEmpty(row.getFzjybh())) {
|
||||
continue;
|
||||
}
|
||||
AdjustTeacherDTO dto = new AdjustTeacherDTO();
|
||||
dto.setFzjybh(row.getFzjybh());
|
||||
dto.setZjy(row.getZjy() == null ? 0 : row.getZjy());
|
||||
dto.setBz(row.getBz());
|
||||
lesson.getTeacherList().add(dto);
|
||||
}
|
||||
}
|
||||
List<AdjustableLessonVO.ChildRow> teams = ssdksqMapper.selectLessonTeams(ids);
|
||||
if (teams != null) {
|
||||
for (AdjustableLessonVO.ChildRow row : teams) {
|
||||
AdjustableLessonVO lesson = byId.get(row.getSskcbbh());
|
||||
if (lesson == null || StringUtils.isEmpty(row.getXydbh())) {
|
||||
continue;
|
||||
}
|
||||
AdjustTeamDTO dto = new AdjustTeamDTO();
|
||||
dto.setXydbh(row.getXydbh());
|
||||
lesson.getTeamList().add(dto);
|
||||
}
|
||||
}
|
||||
List<AdjustableLessonVO.ChildRow> supports = ssdksqMapper.selectLessonSupports(ids);
|
||||
if (supports != null) {
|
||||
for (AdjustableLessonVO.ChildRow row : supports) {
|
||||
AdjustableLessonVO lesson = byId.get(row.getSskcbbh());
|
||||
if (lesson == null || StringUtils.isEmpty(row.getBztgmxbh()) || row.getSl() == null) {
|
||||
continue;
|
||||
}
|
||||
AdjustSupportDTO dto = new AdjustSupportDTO();
|
||||
dto.setBztgmxbh(row.getBztgmxbh());
|
||||
dto.setSl(row.getSl());
|
||||
dto.setBz(row.getBz());
|
||||
lesson.getSupportList().add(dto);
|
||||
}
|
||||
}
|
||||
for (AdjustableLessonVO lesson : lessons) {
|
||||
if (lesson.getRoomList() != null && !lesson.getRoomList().isEmpty()) {
|
||||
if (StringUtils.isEmpty(lesson.getXjsbh())) {
|
||||
lesson.setXjsbh(lesson.getRoomList().get(0).getJsbh());
|
||||
}
|
||||
if (StringUtils.isEmpty(lesson.getYjsbh())) {
|
||||
lesson.setYjsbh(lesson.getRoomList().get(0).getJsbh());
|
||||
}
|
||||
if (StringUtils.isEmpty(lesson.getJsbh())) {
|
||||
lesson.setJsbh(lesson.getRoomList().get(0).getJsbh());
|
||||
}
|
||||
} else if (StringUtils.isNotEmpty(lesson.getJsbh())) {
|
||||
AdjustRoomDTO dto = new AdjustRoomDTO();
|
||||
dto.setJsbh(lesson.getJsbh());
|
||||
lesson.getRoomList().add(dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 教研室审批调课申请。
|
||||
* <p>
|
||||
|
||||
+35
-11
@@ -9,11 +9,14 @@ import com.roomroot.jwgl.mapper.KCBMapper;
|
||||
import com.roomroot.jwgl.mapper.KcbTimetableMapper;
|
||||
import com.roomroot.jwgl.mapper.SystemInitializationMapper;
|
||||
import com.roomroot.jwgl.service.KCBService;
|
||||
import com.roomroot.jwgl.unit.BusinessException;
|
||||
import com.roomroot.jwgl.unit.PageQuery;
|
||||
import com.roomroot.jwgl.unit.PageResult;
|
||||
import com.roomroot.jwgl.utils.UuidUtil;
|
||||
import com.roomroot.jwgl.utils.BasicManagementConstants;
|
||||
import com.roomroot.jwgl.utils.JwglRoleHelper;
|
||||
import com.roomroot.jwgl.vo.kcb.ClassTimetableVO;
|
||||
import com.roomroot.jwgl.vo.kcb.DailyWeeklyTimetableRangeVO;
|
||||
import com.roomroot.jwgl.vo.kcb.DailyWeeklyTimetableVO;
|
||||
import com.roomroot.jwgl.vo.kcb.SemesterGradeExportVO;
|
||||
import com.roomroot.jwgl.vo.systeminitialization.SemesterInitializationVO;
|
||||
@@ -25,6 +28,7 @@ import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -85,20 +89,19 @@ public class KCBServiceImpl implements KCBService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyWeeklyTimetableVO> listToday(TimetableQuery cond) {
|
||||
TimetableQuery filter = prepareFilter(cond);
|
||||
String today = LocalDate.now().format(DATE_FORMAT);
|
||||
return kcbTimetableMapper.selectLessonTimetable(filter, today, today);
|
||||
public DailyWeeklyTimetableRangeVO listToday(String rq, Integer offset) {
|
||||
int dayOffset = offset == null ? 0 : offset;
|
||||
LocalDate day = parseViewDate(rq).plusDays(dayOffset);
|
||||
return buildRangeResult(day, day, day);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyWeeklyTimetableVO> listWeek(TimetableQuery cond) {
|
||||
TimetableQuery filter = prepareFilter(cond);
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate monday = today.with(DayOfWeek.MONDAY);
|
||||
LocalDate sunday = today.with(DayOfWeek.SUNDAY);
|
||||
return kcbTimetableMapper.selectLessonTimetable(filter,
|
||||
monday.format(DATE_FORMAT), sunday.format(DATE_FORMAT));
|
||||
public DailyWeeklyTimetableRangeVO listWeek(String rq, Integer offset) {
|
||||
int weekOffset = offset == null ? 0 : offset;
|
||||
LocalDate day = parseViewDate(rq).plusWeeks(weekOffset);
|
||||
LocalDate monday = day.with(DayOfWeek.MONDAY);
|
||||
LocalDate sunday = day.with(DayOfWeek.SUNDAY);
|
||||
return buildRangeResult(monday, monday, sunday);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,6 +139,27 @@ public class KCBServiceImpl implements KCBService {
|
||||
util.exportExcel(response, list, "班次课程列表");
|
||||
}
|
||||
|
||||
private LocalDate parseViewDate(String rq) {
|
||||
if (StringUtils.isEmpty(rq)) {
|
||||
return LocalDate.now();
|
||||
}
|
||||
try {
|
||||
return LocalDate.parse(rq.trim(), DATE_FORMAT);
|
||||
} catch (DateTimeParseException e) {
|
||||
throw new BusinessException(BasicManagementConstants.BAD_REQUEST, "日期格式应为 yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
|
||||
private DailyWeeklyTimetableRangeVO buildRangeResult(LocalDate viewDate, LocalDate start, LocalDate end) {
|
||||
DailyWeeklyTimetableRangeVO result = new DailyWeeklyTimetableRangeVO();
|
||||
result.setRq(viewDate.format(DATE_FORMAT));
|
||||
result.setStartDate(start.format(DATE_FORMAT));
|
||||
result.setEndDate(end.format(DATE_FORMAT));
|
||||
result.setList(kcbTimetableMapper.selectLessonTimetable(
|
||||
null, result.getStartDate(), result.getEndDate()));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 未传年度时按当前学期填充;队别班次名称去空白。
|
||||
* 学员强制只看本人所在学员队课表。
|
||||
|
||||
Reference in New Issue
Block a user