From 574d083472c0270d7be00289fcf8683a4ff65ef2 Mon Sep 17 00:00:00 2001 From: wans <747101512@qq.com> Date: Sat, 15 May 2021 19:12:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classplan/impl/ClassPlanServiceImpl.java | 109 +++++++++++++----- 1 file changed, 78 insertions(+), 31 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 f2f19f8..8122229 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 @@ -1,14 +1,17 @@ package cn.com.tenlion.service.classplan.impl; import cn.com.tenlion.dao.classplan.IClassPlanDao; +import cn.com.tenlion.dao.examcheck.IExamCheckDao; import cn.com.tenlion.institutionmanagement.pojo.dtos.institution.InstitutionDTO; import cn.com.tenlion.institutionmanagement.service.institution.IInstitutionService; import cn.com.tenlion.pojo.bos.classplan.ClassPlanBO; import cn.com.tenlion.pojo.dtos.apply.ApplyDTO; +import cn.com.tenlion.pojo.dtos.applystudents.ApplyStudentsDTO; import cn.com.tenlion.pojo.dtos.classplan.ClassPlanDTO; import cn.com.tenlion.pojo.dtos.classplan.ClassPlanReportExamDTO; import cn.com.tenlion.pojo.dtos.distributioncard.DistributionCardDTO; import cn.com.tenlion.pojo.dtos.examapply.ExamApplyDTO; +import cn.com.tenlion.pojo.dtos.examcheck.ExamCheckDTO; import cn.com.tenlion.pojo.dtos.teacher.TeacherDTO; import cn.com.tenlion.pojo.dtos.worktype.WorkTypeDTO; import cn.com.tenlion.pojo.pos.classplan.ClassPlanPO; @@ -16,6 +19,7 @@ import cn.com.tenlion.pojo.vos.classplan.ClassPlanVO; import cn.com.tenlion.pojo.vos.examapply.ExamApplyVO; import cn.com.tenlion.pojo.vos.examcheck.ExamCheckVO; import cn.com.tenlion.service.apply.IApplyService; +import cn.com.tenlion.service.applystudents.IApplyStudentsService; import cn.com.tenlion.service.classplan.IClassPlanService; import cn.com.tenlion.service.examapply.IExamApplyService; import cn.com.tenlion.service.examcheck.IExamCheckService; @@ -57,6 +61,8 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl @Autowired private IExamCheckService examCheckService; @Autowired + private IExamCheckDao examCheckDao; + @Autowired private IDataService dataService; // 工种信息 @Autowired @@ -75,6 +81,8 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl private IDistributionCardService distributionCardService; @Autowired private ITeacherService teacher; + @Autowired + private IApplyStudentsService studentsService; @Override public void save(ClassPlanVO classPlanVO) { @@ -129,10 +137,15 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl params.put("classPlanId", classPlanId); setSaveInfo(params); classPlanDao.save(params); - // 开班申请提交后是否需要先将考试人员信息从报名表中转移到班级表 + ExamCheckVO checkVO = new ExamCheckVO(); + checkVO.setPlanId(classPlanId); + checkVO.setOrgId(obj.getString("orgId")); + checkVO.setCheckStatus(0); + checkVO.setWorkTypeId(obj.getString("workerCatalog")); + examCheckService.save(checkVO); //保存课程及讲师 List dayList = new ArrayList<>(); - long daySub = DateUtil.getDaySub("2021-05-15", "2021-05-15"); + long daySub = DateUtil.getDaySub(planStartTime, planEndTime); if(daySub == 0L){ dayList.add(planStartTime); } else { @@ -164,7 +177,8 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl || sd.parse(sDateTime).getTime() > sd.parse(eeDateTime).getTime()){ //...没有发生冲突 } else { - throw new SaveException(tlMap.toString()); + throw new SaveException("【"+teacherDTO.getTeacherName()+"】与其他课程安排时间冲突 " + + ssDateTime + " 至 " + eeDateTime + ""); } } params.put("classPlanId",classPlanId); @@ -198,6 +212,8 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl params.put("classPlanId",classPlanId); params.put("lessonId",item.getString("lessonId")); params.put("teacherId",item.getString("teacherId")); + params.put("lessonStart",item.getString("lessonStartTime")); + params.put("lessonEnd",item.getString("lessonEndTime")); params.put("isDelete",item.getString("teacherId")); classPlanDao.saveClassPlanLesson(params); } @@ -376,19 +392,37 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl //处理工种类型 WorkTypeDTO workTypeDTO = workTypeService.get(item.getWorkerCatalog()); item.setWorkerCatalogName(workTypeDTO.getWorkTypeName()); - //查询已报名人数 - queryMap.put("applyClassId",item.getClassPlanId()); - List applyAuditStates = new ArrayList<>(); - applyAuditStates.add("3"); - queryMap.put("applyAuditStates",applyAuditStates); - List list = applyService.list(queryMap); - item.setSignUpUserCount(list == null ? 0 : list.size()); - //查询待处理人数 - applyAuditStates.clear(); - applyAuditStates.add("0"); - queryMap.put("applyAuditStates",applyAuditStates); - List waitList = applyService.list(queryMap); - item.setWaitSignUpUser(waitList == null ? 0 : waitList.size()); + //查询审核状态 + queryMap.clear(); + queryMap.put("planId", item.getClassPlanId()); + queryMap.put("workTypeId", item.getWorkerCatalog()); + queryMap.put("orgId", item.getOrgId()); + ExamCheckDTO examCheck = examCheckDao.get(queryMap); + item.setReportType(examCheck.getCheckStatus() + ""); + //查询考试申请状态 + queryMap.clear(); + queryMap.put("examId",item.getClassPlanId()); + ExamApplyDTO examApplyDTO = examApplyService.get(queryMap); + if(null == examApplyDTO){ + // 未提交考试申请 + item.setExamType(""); + } else { + // 0待审核 1审核通过 2退回 + item.setExamType(examApplyDTO.getCheckStatus() + ""); + } + //查询报名人数 + if(examCheck.getCheckStatus() == 2){ + List applyStudentsDTOS = studentsService.listByClssId(item.getClassPlanId()); + item.setSignUpUserCount(applyStudentsDTOS == null ? 0 : applyStudentsDTOS.size()); + } else { + queryMap.put("applyInstitutionId",item.getOrgId()); + queryMap.put("applyWorkTypeId",item.getWorkerCatalog()); + List applyAuditStates = new ArrayList<>(); + applyAuditStates.add("2"); + queryMap.put("applyAuditStates",applyAuditStates); + List list = applyService.list(queryMap); + item.setSignUpUserCount(list == null ? 0 : list.size()); + } } PageInfo pageInfo = new PageInfo<>(classPlanDTOs); return new SuccessResultList<>(classPlanDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); @@ -463,24 +497,17 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl @Override public void updateExamType(String classPlanId, ClassPlanVO classPlanVO) { + Map query = new HashMap<>(); + query.put("classPlanId",classPlanId); + ClassPlanDTO classPlanDTO = classPlanDao.get(query); ExamApplyVO examApplyVO = new ExamApplyVO(); examApplyVO.setExamId(classPlanId); - examApplyVO.setExamType(Integer.parseInt(classPlanVO.getExamType())); - examApplyVO.setTheoryExamStartTime(classPlanVO.getEstimateStart()); - examApplyVO.setTheoryExamEndTime(classPlanVO.getEstimateEnd()); examApplyVO.setCheckStatus(0); - examApplyVO.setUserStatus(0); examApplyVO.setStatus(0); - examApplyVO.setReason("重新申请"); - if("3".equals(classPlanVO.getExamType())){ - examApplyVO.setPracticeExamStartTime(classPlanVO.getEstimateStart()); - examApplyVO.setPracticeExamEndTime(classPlanVO.getEstimateEnd()); - } - //先查询再修改 - Map queryMap = getHashMap(8); - queryMap.put("examId",classPlanId); - ExamApplyDTO history = examApplyService.get(queryMap); - examApplyService.update(history.getExamApplyId(),examApplyVO); + examApplyVO.setWorkTypeId(classPlanDTO.getWorkerCatalog()); + examApplyVO.setOrgId(classPlanDTO.getOrgId()); + examApplyVO.setPlanName(classPlanDTO.getPlanName()); + examApplyService.save(examApplyVO); } @Override @@ -526,7 +553,27 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl return list; } - + @Override + public Map getExamCheckType(Map params) { + String orgId = params.get("orgId").toString(); + if(params.get("workerCatalog") == null + || params.get("workerCatalog").toString().length() == 0){ + params.put("checkType","0"); + return params; + } + String workerCatalog = params.get("workerCatalog").toString(); + params.clear(); + params.put("workTypeId", workerCatalog); + params.put("orgId", orgId); + ExamCheckDTO examCheck = examCheckDao.getExamCheck(params); + params.clear(); + if(null == examCheck){ + params.put("checkType","1"); + } else { + params.put("checkType","0"); + } + return params; + } public Map countPlanType(String orgId){ Map parmas = new HashMap<>();