From 866dc1b2ef2cc8bbf2ec0afb7f66d1480dc03087 Mon Sep 17 00:00:00 2001 From: wans <747101512@qq.com> Date: Wed, 16 Jun 2021 15:09:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=B2=E5=B8=88=E6=8E=88?= =?UTF-8?q?=E8=AF=BE=E6=97=B6=E5=88=BB=E8=A1=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classplan/impl/ClassPlanServiceImpl.java | 63 +++++++++++++++---- .../teacher/impl/TeacherServiceImpl.java | 18 +++--- .../static/route/classplan/update.html | 2 +- 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java b/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java index 39780d1..c04df66 100644 --- a/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java @@ -160,10 +160,10 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl params.put("teacherName",item.getString("teacherName")); params.put("startDate",item.getString("startDate")); params.put("endDate",item.getString("endDate")); - params.put("startTime",item.getString("startTime") + ":00"); - params.put("endTime",item.getString("endTime") + ":00"); + params.put("startTime",item.getString("startTime")); + params.put("endTime",item.getString("endTime")); classPlanDao.saveClassPlanLesson(params); - // TODO 这里还需要将讲师的课程安排时刻表进行拆分整理单独存表(e_teach_lessons_time) + saveTeacherLessonsTime(params); } // 处理完成后自动提交审核 ExamCheckVO checkVO = new ExamCheckVO(); @@ -194,14 +194,11 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl classPlanVO.setPlanPDF(obj.getString("planPDF")); Map params = HashMapUtil.beanToMap(classPlanVO); setUpdateInfo(params); - //classPlanDao.update(params); - + classPlanDao.update(params); // 删除历史课程信息 classPlanDao.deleteClassPlanLessons(params); - - // TODO 这里需要在添加了讲师时刻后进行添加 - // classPlanDao.deleteTeacherLessonsTime(params); - + // 删除该培训计划下所有授课时刻表 + classPlanDao.deleteTeacherLessonsTime(params); //保存课程及讲师 JSONArray array = obj.getJSONArray("lessonList"); params.clear(); @@ -216,12 +213,11 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl params.put("teacherName",item.getString("teacherName")); params.put("startDate",item.getString("startDate")); params.put("endDate",item.getString("endDate")); - params.put("startTime",item.getString("startTime") + ":00"); - params.put("endTime",item.getString("endTime") + ":00"); + params.put("startTime",item.getString("startTime")); + params.put("endTime",item.getString("endTime")); classPlanDao.saveClassPlanLesson(params); - // TODO 这里还需要将讲师的课程安排时刻表进行拆分整理单独存表(e_teach_lessons_time) + saveTeacherLessonsTime(params); } - // 更新完成后修改审核状态 ExamCheckVO checkVO = new ExamCheckVO(); checkVO.setPlanId(classPlanId); @@ -232,6 +228,47 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl examCheckService.updateByClassPlanId(classPlanId,checkVO); } + /** + * 保存讲师各课程授课时刻表 + */ + private void saveTeacherLessonsTime(Map params) throws Exception{ + TeacherDTO teacherDTO = teacher.getById(params.get("teacherId").toString()); + if(teacherDTO == null){ + return; + } + String startDate = params.get("startDate").toString(); + String endDate = params.get("endDate").toString(); + String startTime = params.get("endTime").toString(); + String endTime = params.get("endTime").toString(); + List dayList = new ArrayList<>(); + long daySub = DateUtil.getDaySub(startDate, endDate); + if(daySub == 0L){ + dayList.add(startDate); + } else { + for(long i = 0; i <= daySub; i++){ + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); + Date sDate = sd.parse(startDate); + String formatDate = sd.format(sDate.getTime() + (i * 24 * 60 * 60 * 1000)); + dayList.add(formatDate); + } + } + Map saveParam = new HashMap<>(); + for(String tempDate : dayList){ + String sDateTime = tempDate + " " + startTime; + String eDateTime = tempDate + " " + endTime; + saveParam.put("classPlanId",params.get("classPlanId").toString()); + saveParam.put("teacherId",teacherDTO.getTeacherId()); + saveParam.put("teacherIdCard",teacherDTO.getIdCardNumber()); + saveParam.put("orgId",params.get("orgId").toString()); + saveParam.put("projectCatalogId",""); + saveParam.put("workerCatalog",params.get("workTypeId").toString()); + saveParam.put("lessonId",params.get("lessonId").toString()); + saveParam.put("startTime",sDateTime); + saveParam.put("endTime",eDateTime); + teacher.saveTeacherLessonsTime(saveParam); + } + } + @Override public void remove(List ids) { remove(null, ids); diff --git a/src/main/java/cn/com/tenlion/service/teacher/impl/TeacherServiceImpl.java b/src/main/java/cn/com/tenlion/service/teacher/impl/TeacherServiceImpl.java index bf97c7a..70a6758 100644 --- a/src/main/java/cn/com/tenlion/service/teacher/impl/TeacherServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/teacher/impl/TeacherServiceImpl.java @@ -187,23 +187,23 @@ public class TeacherServiceImpl extends DefaultBaseService implements ITeacherSe public List listTeacherLessonsTime(Map params) { List list = teacherDao.listTeacherLessonsTimeDTO(params); for(TeacherLessonsTimeDTO item : list){ - item.setOrgName(""); + if(item.getOrgId() != null && item.getOrgId().length() != 0){ + InstitutionDTO institutionDTO = iInstitutionService.get(item.getOrgId()); + item.setOrgName(institutionDTO == null ? "" : institutionDTO.getInstitutionName()); + } // 查询讲师名称 TeacherDTO byId = getById(item.getTeacherId()); - item.setTeacherName(byId.getTeacherName()); - item.setTeacherIdCard(byId.getIdCardNumber()); + item.setTeacherName(byId == null ? "" : byId.getTeacherName()); + item.setTeacherIdCard(byId == null ? "" : byId.getIdCardNumber()); // 查询开班计划名称 ClassPlanDTO classPlanDTO = classPlanService.get(item.getClassPlanId()); - item.setClassPlanName(classPlanDTO.getPlanName()); - // 查询培训项目 - DataDTO dataDTO = dataService.get(item.getProjectCatalogId()); - item.setProjectCatalogName(dataDTO.getDataName()); + item.setClassPlanName(classPlanDTO == null ? "" : classPlanDTO.getPlanName()); // 查询课程 LessonsDTO lessonsDTO = lessonsService.get(item.getLessonId()); - item.setLessonName(lessonsDTO.getLessonName()); + item.setLessonName(lessonsDTO == null ? "" : lessonsDTO.getLessonName()); // 查询工种 WorkTypeDTO workTypeDTO = workTypeService.get(item.getWorkerCatalog()); - item.setWorkerCatalogName(workTypeDTO.getWorkTypeName()); + item.setWorkerCatalogName(workTypeDTO == null ? "" : workTypeDTO.getWorkTypeName()); } return list; } diff --git a/src/main/resources/static/route/classplan/update.html b/src/main/resources/static/route/classplan/update.html index 8e22436..e508ac2 100644 --- a/src/main/resources/static/route/classplan/update.html +++ b/src/main/resources/static/route/classplan/update.html @@ -25,7 +25,7 @@
+ autocomplete="off" placeholder="班号不可重复" lay-verify="required" maxlength="100" readonly="readonly">