From f0466dee96ca8972b6aa590db1ccd6650c8c4bca Mon Sep 17 00:00:00 2001 From: pd <2776455882@qq.com> Date: Fri, 24 Jul 2020 22:04:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=80=83=E6=A0=B8=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AssesmentController.java | 405 +++++++++++------- .../controller/MakeuplistController.java | 90 ++-- .../com/yipin/liuwanr/entity/Makeuplist.java | 78 +++- .../yipin/liuwanr/helper/AssesmentHelper.java | 7 +- .../liuwanr/helper/ExcelImportHelper.java | 38 +- .../liuwanr/mapper/MakeuplistMapper.java | 43 +- .../liuwanr/service/AssesmentService.java | 9 +- .../liuwanr/service/MakeuplistService.java | 115 ++++- 8 files changed, 547 insertions(+), 238 deletions(-) diff --git a/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java b/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java index 27de3e2..e3fa018 100644 --- a/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java +++ b/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -38,8 +39,9 @@ public class AssesmentController { * @return */ @GetMapping("/queryAssesmentcondition") - Response queryAssementCondition(Integer staffId,Integer courseId,String className, - Integer assesmentState,Integer releaseType, String creationTime,String endTime,Integer month, + Response queryAssementCondition(@RequestParam Integer staffId,@RequestParam Integer courseId,@RequestParam String className, + @RequestParam Integer assesmentState,@RequestParam Integer releaseType, + @RequestParam String creationTime,@RequestParam String endTime,@RequestParam Integer month, @RequestParam(defaultValue = "0")Integer pageSize, @RequestParam(defaultValue = "0")Integer pageNo ) { Response resp = new Response(); @@ -89,15 +91,25 @@ public class AssesmentController { @PostMapping("/addAssesment") Response addAssesment(@RequestBody AssesmentStudentVo vo) { Response resp = new Response(); - HashMap ret = service.addAssesment(vo); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + Assesment assesment=vo.getAssesment(); + List studentIds=vo.getStudentIds(); + if(StringUtils.isEmpty(assesment)){ + resp.setStatus(300); + resp.setErrmessage("考核信息为空"); + }else if(studentIds.isEmpty()&&studentIds.size()<=0){ + resp.setStatus(300); + resp.setErrmessage("学生信息为空"); + }else{ + HashMap ret = service.addAssesment(assesment, studentIds); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -110,15 +122,20 @@ public class AssesmentController { @GetMapping("/queryStudentisAssess") Response queryStudentisAssess(@RequestParam List studentIds) { Response resp = new Response(); - HashMap ret = service.queryStudentisAssess(studentIds); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(studentIds.isEmpty()&&studentIds.size()<=0){ + resp.setStatus(300); + resp.setErrmessage("学生信息为空"); + }else{ + HashMap ret = service.queryStudentisAssess(studentIds); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -128,17 +145,22 @@ public class AssesmentController { * @return */ @GetMapping("/queryGetById") - Response getByAssesmentId(Integer id) { + Response getByAssesmentId(@RequestParam Integer id) { Response resp = new Response(); - HashMap ret = service.queryGetById(id); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(id)){ + resp.setStatus(300); + resp.setErrmessage("项目信息为空"); + }else{ + HashMap ret = service.queryGetById(id); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -152,15 +174,23 @@ public class AssesmentController { Response resp = new Response(); Assesment assesment=vo.getAssesment(); List studentIds=vo.getStudentIds(); - HashMap ret = service.updateAssesment(assesment,studentIds); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(assesment)){ + resp.setStatus(300); + resp.setErrmessage("考核信息为空"); + }else if(studentIds.isEmpty()&&studentIds.size()<=0){ + resp.setStatus(300); + resp.setErrmessage("学生信息为空"); + }else{ + HashMap ret = service.updateAssesment(assesment,studentIds); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -170,38 +200,46 @@ public class AssesmentController { * @return */ @GetMapping("/assessmentJudgment") - Response updateState(Integer assesmentId) { + Response updateState(@RequestParam Integer assesmentId) { Response resp = new Response(); - HashMap ret = service.assessmentJudgment(assesmentId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(assesmentId)){ + resp.setStatus(300); + resp.setErrmessage("考核信息为空"); + }else{ + HashMap ret = service.assessmentJudgment(assesmentId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } /** * 修改考核状态 - * @param id - * @param state * @return */ @PostMapping("/updateState") Response updateState(@RequestBody Assesment assesment) { Response resp = new Response(); - HashMap ret = service.updateState(assesment); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(assesment)){ + resp.setStatus(300); + resp.setErrmessage("考核信息为空"); + }else{ + HashMap ret = service.updateState(assesment); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -212,17 +250,22 @@ public class AssesmentController { * @return */ @GetMapping("/getExperimentalClass") - Response getExperimentalClass(Integer staffId) { + Response getExperimentalClass(@RequestParam Integer staffId) { Response resp = new Response(); - HashMap ret = service.queryCretionTime(staffId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(staffId)){ + resp.setStatus(300); + resp.setErrmessage("教师信息为空"); + }else{ + HashMap ret = service.queryCretionTime(staffId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -233,17 +276,25 @@ public class AssesmentController { * @return */ @GetMapping("/getCreationTime") - Response getCreationTime(String creationTime,Integer staffId) { + Response getCreationTime(@RequestParam String creationTime,@RequestParam Integer staffId) { Response resp = new Response(); - HashMap ret = service.queryCretionTime(creationTime,staffId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(staffId)){ + resp.setStatus(300); + resp.setErrmessage("教师信息为空"); + }else if(StringUtils.isEmpty(creationTime)){ + resp.setStatus(300); + resp.setErrmessage("实验班级创建时间信息为空"); + }else { + HashMap ret = service.queryCretionTime(creationTime,staffId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -254,17 +305,22 @@ public class AssesmentController { * @return */ @GetMapping("/queryAssesmet") - Response queryAssesmet(Integer assesmentId) { + Response queryAssesmet(@RequestParam Integer assesmentId) { Response resp = new Response(); - HashMap ret = service.queryAssesment(assesmentId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(assesmentId)){ + resp.setStatus(300); + resp.setErrmessage("考核信息为空"); + }else{ + HashMap ret = service.queryAssesment(assesmentId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -277,15 +333,20 @@ public class AssesmentController { @GetMapping("/getByclass") Response getByclass(Integer assesmentId) { Response resp = new Response(); - HashMap ret = service.getByclass(assesmentId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(assesmentId)){ + resp.setStatus(300); + resp.setErrmessage("考核信息为空"); + }else{ + HashMap ret = service.getByclass(assesmentId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -299,17 +360,29 @@ public class AssesmentController { * @return */ @GetMapping("/queryClassScore") - Response queryClassScore(Integer assesmentId,Integer experimentalClassId,@RequestParam List classId) { + Response queryClassScore(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,@RequestParam List classId) { Response resp = new Response(); - HashMap ret = service.queryScore(assesmentId,experimentalClassId,classId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(assesmentId)){ + resp.setStatus(300); + resp.setErrmessage("考核信息为空"); + }else if(StringUtils.isEmpty(experimentalClassId)){ + resp.setStatus(300); + resp.setErrmessage("实验班级信息为空"); + }else if(classId.isEmpty()&&classId.size()<0){ + resp.setStatus(300); + resp.setErrmessage("行政信息为空"); + }else{ + HashMap ret = service.queryScore(assesmentId,experimentalClassId,classId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; } @@ -322,18 +395,29 @@ public class AssesmentController { * @return */ @GetMapping("/queryHistogram") - Response queryHistogram(Integer assesmentId,Integer experimentalClassId, + Response queryHistogram(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId, @RequestParam List classId) { Response resp = new Response(); - HashMap ret = service.queryHistogram(assesmentId,experimentalClassId,classId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(assesmentId)){ + resp.setStatus(300); + resp.setErrmessage("考核信息为空"); + }else if(StringUtils.isEmpty(experimentalClassId)){ + resp.setStatus(300); + resp.setErrmessage("实验班级信息为空"); + }else if(classId.isEmpty()&&classId.size()<0){ + resp.setStatus(300); + resp.setErrmessage("行政信息为空"); + }else { + HashMap ret = service.queryHistogram(assesmentId, experimentalClassId, classId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -346,18 +430,29 @@ public class AssesmentController { * @return */ @GetMapping("/getLinechart") - Response getLinechart(Integer assesmentId,Integer experimentalClassId, + Response getLinechart(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId, @RequestParam List classId) { Response resp = new Response(); - HashMap ret = service.getLinechart(assesmentId,experimentalClassId,classId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(assesmentId)){ + resp.setStatus(300); + resp.setErrmessage("考核信息为空"); + }else if(StringUtils.isEmpty(experimentalClassId)){ + resp.setStatus(300); + resp.setErrmessage("实验班级信息为空"); + }else if(classId.isEmpty()&&classId.size()<0){ + resp.setStatus(300); + resp.setErrmessage("行政信息为空"); + }else{ + HashMap ret = service.getLinechart(assesmentId,experimentalClassId,classId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -370,18 +465,29 @@ public class AssesmentController { * @return */ @GetMapping("/queryAssesmentScore") - Response queryAssesmentScore(Integer assesmentId,Integer experimentalClassId, + Response queryAssesmentScore(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId, @RequestParam List classId) { Response resp = new Response(); - HashMap ret = service.queryAssesmentScore(assesmentId,experimentalClassId,classId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + if(StringUtils.isEmpty(assesmentId)){ + resp.setStatus(300); + resp.setErrmessage("考核信息为空"); + }else if(StringUtils.isEmpty(experimentalClassId)){ + resp.setStatus(300); + resp.setErrmessage("实验班级信息为空"); + }else if(classId.isEmpty()&&classId.size()<0){ + resp.setStatus(300); + resp.setErrmessage("行政信息为空"); + }else{ + HashMap ret = service.queryAssesmentScore(assesmentId,experimentalClassId,classId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } return resp; } @@ -394,14 +500,19 @@ public class AssesmentController { @GetMapping("/releaseAssesment") Response releaseAssesment(@RequestParam Integer courseId){ Response resp = new Response(); - HashMap ret = service.releaseAssesment(courseId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); + if(StringUtils.isEmpty(courseId)){ + resp.setStatus(300); + resp.setErrmessage("课程信息为空"); + }else{ + HashMap ret = service.releaseAssesment(courseId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } } return resp; } diff --git a/src/main/java/com/yipin/liuwanr/controller/MakeuplistController.java b/src/main/java/com/yipin/liuwanr/controller/MakeuplistController.java index c456548..d749b50 100644 --- a/src/main/java/com/yipin/liuwanr/controller/MakeuplistController.java +++ b/src/main/java/com/yipin/liuwanr/controller/MakeuplistController.java @@ -6,14 +6,11 @@ import java.util.HashMap; import javax.servlet.http.HttpServletResponse; +import com.yipin.liuwanr.vo.MakeupStudentsVo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import com.yipin.liuwanr.entity.Response; @@ -33,38 +30,59 @@ public class MakeuplistController { * @return */ @PostMapping("/importMakeuplist") - Response queryCustomer(@RequestParam("file") MultipartFile file,@RequestParam Integer staffId) { + Response queryCustomer( MakeupStudentsVo vo) { Response resp = new Response(); + MultipartFile file=vo.getFile(); + Integer staffId=vo.getStaffId(); + Integer uploadType=vo.getUploadType(); + Integer schoolId=vo.getSchoolId(); + long uploadTime=vo.getUploadTime(); + if(StringUtils.isEmpty(staffId)) { resp.setStatus(300); - resp.setMessage("staffId cannot be empty "); - return resp; - } - HashMap ret = makeuplistService.addMakeuplist(file,staffId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); + resp.setMessage("教师信息为空"); + }else if(StringUtils.isEmpty(uploadTime)){ + resp.setStatus(300); + resp.setMessage("文件上传时间为空"); + }else if(StringUtils.isEmpty(uploadType)){ + resp.setStatus(300); + resp.setMessage("文件上传选项为空"); + }else if(StringUtils.isEmpty(schoolId)){ + resp.setStatus(300); + resp.setMessage("学校为空"); + }else{ + HashMap ret = makeuplistService.addMakeuplist(file,schoolId,staffId,uploadType,uploadTime); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } } + return resp; } /** - * 在补考名单中,渲染表格,根据班级名称查询信息 - * @param className + * 在补考名单中,渲染表格 * @return */ @GetMapping("/queryGetByClassName") - Response queryGetByClassName(@RequestParam Integer staffId,@RequestParam String className) { + Response queryGetByClassName(@RequestParam Integer staffId,@RequestParam String uploadTime,Integer uploadType) { Response resp = new Response(); if(StringUtils.isEmpty(staffId)) { resp.setStatus(300); resp.setMessage("staffId cannot be empty "); - } else { - HashMap ret = makeuplistService.queryAllMakeuplist(staffId,className); + } else if(StringUtils.isEmpty(uploadTime)){ + resp.setStatus(300); + resp.setMessage("文件上传时间为空"); + }else if(StringUtils.isEmpty(uploadType)){ + resp.setStatus(300); + resp.setMessage("文件上传选项为空"); + }else { + HashMap ret = makeuplistService.queryAllMakeuplist(staffId,uploadTime,uploadType); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); @@ -100,8 +118,32 @@ public class MakeuplistController { } return null; } - - + + @GetMapping("/getStudent") + Response getStudent(Integer staffId,String uploadTime,Integer uploadType){ + Response resp = new Response(); + if(StringUtils.isEmpty(staffId)) { + resp.setStatus(300); + resp.setMessage("staffId cannot be empty "); + } else if(StringUtils.isEmpty(uploadTime)){ + resp.setStatus(300); + resp.setMessage("文件上传时间为空"); + }else if(StringUtils.isEmpty(uploadType)){ + resp.setStatus(300); + resp.setMessage("文件上传选项为空"); + }else { + HashMap ret = makeuplistService.getStudent(staffId,uploadTime,uploadType); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } } diff --git a/src/main/java/com/yipin/liuwanr/entity/Makeuplist.java b/src/main/java/com/yipin/liuwanr/entity/Makeuplist.java index 7fdde40..6ba6d17 100644 --- a/src/main/java/com/yipin/liuwanr/entity/Makeuplist.java +++ b/src/main/java/com/yipin/liuwanr/entity/Makeuplist.java @@ -6,13 +6,18 @@ package com.yipin.liuwanr.entity; * */ public class Makeuplist { - - private String professionalName; - private Integer gradeName; + private String className; - private Integer studentNumber; + private Integer classId; + private Integer experimentalClassId; + private String experimentalClassName; + private String studentNumber; + private Integer studentId; private String studentName; private Integer staffId; + private Integer schoolId; + private String professionalName; + private String gradeName; public String getProfessionalName() { return professionalName; @@ -22,20 +27,36 @@ public class Makeuplist { this.professionalName = professionalName; } - public Integer getGradeName() { + public String getGradeName() { return gradeName; } - public Integer getStaffId() { - return staffId; + public void setGradeName(String gradeName) { + this.gradeName = gradeName; } - public void setStaffId(Integer staffId) { - this.staffId = staffId; + public String getExperimentalClassName() { + return experimentalClassName; } - public void setGradeName(Integer gradeName) { - this.gradeName = gradeName; + public void setExperimentalClassName(String experimentalClassName) { + this.experimentalClassName = experimentalClassName; + } + + public void setStudentId(Integer studentId) { + this.studentId = studentId; + } + + public Integer getStudentId() { + return studentId; + } + + public String getStudentName() { + return studentName; + } + + public void setStudentName(String studentName) { + this.studentName = studentName; } public String getClassName() { @@ -46,20 +67,43 @@ public class Makeuplist { this.className = className; } - public Integer getStudentNumber() { + public Integer getClassId() { + return classId; + } + + public void setClassId(Integer classId) { + this.classId = classId; + } + + public Integer getExperimentalClassId() { + return experimentalClassId; + } + + public void setExperimentalClassId(Integer experimentalClassId) { + this.experimentalClassId = experimentalClassId; + } + + public String getStudentNumber() { return studentNumber; } - public void setStudentNumber(Integer studentNumber) { + public void setStudentNumber(String studentNumber) { this.studentNumber = studentNumber; } - public String getStudentName() { - return studentName; + public Integer getStaffId() { + return staffId; } - public void setStudentName(String studentName) { - this.studentName = studentName; + public void setStaffId(Integer staffId) { + this.staffId = staffId; + } + + public Integer getSchoolId() { + return schoolId; } + public void setSchoolId(Integer schoolId) { + this.schoolId = schoolId; + } } diff --git a/src/main/java/com/yipin/liuwanr/helper/AssesmentHelper.java b/src/main/java/com/yipin/liuwanr/helper/AssesmentHelper.java index 9cadc03..e423384 100644 --- a/src/main/java/com/yipin/liuwanr/helper/AssesmentHelper.java +++ b/src/main/java/com/yipin/liuwanr/helper/AssesmentHelper.java @@ -16,9 +16,12 @@ public class AssesmentHelper { */ public static String getGapTime(long time) { long hours = time / (1000 * 60 * 60); - String minutes = String.format("%02d", (time - hours * (1000 * 60 * 60)) / (1000 * 60)); + long minutes = (time - hours * (1000 * 60 * 60)) / (1000 * 60); StringBuffer buffer = new StringBuffer(); - buffer.append(hours).append("h").append(minutes).append("m"); + buffer.append(hours).append("h"); + if(minutes!=0) { + buffer.append(minutes).append("m"); + } return buffer.toString(); } diff --git a/src/main/java/com/yipin/liuwanr/helper/ExcelImportHelper.java b/src/main/java/com/yipin/liuwanr/helper/ExcelImportHelper.java index 733185c..e732d78 100644 --- a/src/main/java/com/yipin/liuwanr/helper/ExcelImportHelper.java +++ b/src/main/java/com/yipin/liuwanr/helper/ExcelImportHelper.java @@ -21,12 +21,12 @@ public class ExcelImportHelper { /** * 读取补考名单 - * * @param file * @return */ - public static List readExcel(MultipartFile file, Integer staffId) { + public static List readExcel(MultipartFile file,Integer uploadType) { List list = new ArrayList(); + List names=new ArrayList(); try { String fileName = file.getOriginalFilename(); Workbook workbook = null; @@ -49,27 +49,33 @@ public class ExcelImportHelper { if (row != null) { makeuplist = new Makeuplist(); row.getCell(0).setCellType(CellType.STRING); - Cell professionalName = row.getCell(0); + Cell className = row.getCell(0); row.getCell(1).setCellType(CellType.STRING); - Cell gradeName = row.getCell(1); + Cell studentNumber = row.getCell(1); row.getCell(2).setCellType(CellType.STRING); - Cell className = row.getCell(2); - row.getCell(3).setCellType(CellType.STRING); - Cell studentNumber = row.getCell(3); - row.getCell(4).setCellType(CellType.STRING); - Cell studentName = row.getCell(4); - - makeuplist.setProfessionalName(professionalName.getStringCellValue()); - makeuplist.setGradeName(Integer.parseInt(gradeName.getStringCellValue())); + Cell studentName = row.getCell(2); + if(uploadType.equals(0)){ + String name=className.getStringCellValue(); + names.add(name); + } makeuplist.setClassName(className.getStringCellValue()); - makeuplist.setStudentNumber(Integer.parseInt(studentNumber.getStringCellValue())); + makeuplist.setStudentNumber(studentNumber.getStringCellValue()); makeuplist.setStudentName(studentName.getStringCellValue()); - makeuplist.setStaffId(staffId); - list.add(makeuplist); } } + if(uploadType.equals(0)){ + if(!names.isEmpty()&&names.size()>0){ + for (int i=0;i readStaff(MultipartFile file) { diff --git a/src/main/java/com/yipin/liuwanr/mapper/MakeuplistMapper.java b/src/main/java/com/yipin/liuwanr/mapper/MakeuplistMapper.java index 7ef3da3..fd12520 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/MakeuplistMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/MakeuplistMapper.java @@ -2,12 +2,13 @@ package com.yipin.liuwanr.mapper; import java.util.List; +import com.yipin.liuwanr.entity.Makeuplist; +import com.yipin.liuwanr.entity.Student; +import com.yipin.liuwanr.vo.MakeupStudentsVo; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; -import com.yipin.liuwanr.entity.Makeuplist; - /** * * @@ -16,17 +17,31 @@ import com.yipin.liuwanr.entity.Makeuplist; */ public interface MakeuplistMapper { - @Select({""}) - List queryAllMakeuplist(@Param("staffId")Integer staffId,@Param("className")String className); + @Select("select professionalName,gradeName,className,m.studentNumber,studentName from makeuplist m,student s,class c,grade g,professional p" + + "where m.studentId=s.studentId and m.classId=c.classId and c.gradeId=g.gradeId and s.professionalId=p.professionalId and m.staffId=#{staffId} and m.uploadTime=#{uploadTime}") + List queryClassMakeuplist(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime); + + @Select("select professionalName,gradeName,experimentalClassName,m.studentNumber,studentName from makeuplist m,student s,class c,experimental_class_ning ecn,grade g,professional p" + + "where m.studentId=s.studentId and s.classId=c.classId and c.gradeId=g.gradeId and s.professionalId=p.professionalId and m.experimentalClassId=ecn.experimentalClassId and m.staffId=#{staffId} and m.uploadTime=#{uploadTime}") + List queryExperimentalClassMakeuplist(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime); + + @Select("select experimentalClassId,studentId,classId from makeuplist where staffId=#{staffId} and uploadTime=#{uploadTime}") + List getstudent(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime); + + @Select("select classId,studentId from makeuplist where staffId=#{staffId} and uploadTime=#{uploadTime}") + List getClass(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime); - @Insert({""}) - void addMakeuplist(@Param("makeuplists") List makeuplists); + @Insert( + "insert into makeuplist (schoolId,classId,experimentalClassId,studentNumber,studentId,staffId,uploadType,uploadTime) values" + + "(#{schoolId},#{classId},#{experimentalClassId},#{studentNumber},#{studentId},#{staffId},#{uploadType},#{time})") + void addMakeuplist(MakeupStudentsVo vo); + + //实验班级信息 + @Select("SELECT exn.experimentalClassId,studentNumber,s.studentId from student s left join experimental_class_student ecs on s.studentId=ecs.studentId left join experimental_class_ning exn on ecs.experimentalClassId=exn.experimentalClassId " + + " where exn.experimentalClassName='111' and exn.schoolId=1 and s.studentNumber='123'") + Student queryExperimentalClassStudent(@Param("experimentalClassName") String experimentalClassName,@Param("schoolId")Integer schoolId,@Param("studentNumber")String studentNumber); + + //行政班级信息 + @Select("select classId,studentNumber,studentId from student where studentNumber=#{studentNumber} and schoolId=#{schoolId}") + Student queryClassStudent(@Param("studentNumber")String studentNumber,@Param("schoolId")Integer schoolId); } diff --git a/src/main/java/com/yipin/liuwanr/service/AssesmentService.java b/src/main/java/com/yipin/liuwanr/service/AssesmentService.java index f3f69d9..f8ba085 100644 --- a/src/main/java/com/yipin/liuwanr/service/AssesmentService.java +++ b/src/main/java/com/yipin/liuwanr/service/AssesmentService.java @@ -67,15 +67,11 @@ public class AssesmentService { /** * 创建考核 - * - * @param vo * @return */ @Transactional - public HashMap addAssesment(AssesmentStudentVo vo) { + public HashMap addAssesment(Assesment assesment, List studentIds ) { HashMap resp = new HashMap(); - Assesment assesment = vo.getAssesment(); - List studentIds = vo.getStudentIds(); try { //转换时间格式 assesment = AssesmentHelper.helpAssesment(assesment); @@ -222,6 +218,7 @@ public class AssesmentService { return resp; } + /** * 启动考核前的判断 * @@ -239,7 +236,6 @@ public class AssesmentService { if (datas.contains(stu.getStudentId())) { obj.add(stu); } - } resp.put("retvalue", obj); resp.put("retcode", 200); @@ -269,7 +265,6 @@ public class AssesmentService { String endTime = assesment.getEndTime(); String timeSum = assesment.getTimesum(); - if (createTime != null && !createTime.equals("")) { starttime = Long.parseLong(assesment.getCreationTime()); assesment.setCreationTime(AssesmentHelper.longPointDate(starttime)); diff --git a/src/main/java/com/yipin/liuwanr/service/MakeuplistService.java b/src/main/java/com/yipin/liuwanr/service/MakeuplistService.java index 7f21a66..bbf281f 100644 --- a/src/main/java/com/yipin/liuwanr/service/MakeuplistService.java +++ b/src/main/java/com/yipin/liuwanr/service/MakeuplistService.java @@ -3,9 +3,13 @@ package com.yipin.liuwanr.service; import java.util.HashMap; import java.util.List; +import com.yipin.liuwanr.entity.Student; +import com.yipin.liuwanr.helper.AssesmentHelper; +import com.yipin.liuwanr.vo.MakeupStudentsVo; import org.jboss.logging.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import com.yipin.liuwanr.entity.Makeuplist; @@ -30,13 +34,18 @@ public class MakeuplistService { /** * 查询数据 * @param staffId - * @param className * @return */ - public HashMap queryAllMakeuplist(Integer staffId,String className) { + public HashMap queryAllMakeuplist(Integer staffId,String uploadTime,Integer uploadType) { HashMap resp = new HashMap(); try { - resp.put("retvalue", makeuplistMapper.queryAllMakeuplist(staffId,className)); + if(uploadType.equals(0)){ + List makeuplists=makeuplistMapper.queryExperimentalClassMakeuplist(staffId,uploadTime); + resp.put("retvalue", makeuplists); + }else if(uploadType.equals(1)){ + List makeuplists=makeuplistMapper.queryClassMakeuplist(staffId,uploadTime); + resp.put("retvalue", makeuplists); + } resp.put("retcode", 200); } catch (RuntimeException e) { logger.error(e.getMessage()); @@ -47,27 +56,113 @@ public class MakeuplistService { return resp; } + public HashMap getStudent(Integer staffId,String uploadTime,Integer uploadType){ + HashMap resp = new HashMap(); + try{ + resp.put("retvalue",makeuplistMapper.getstudent(staffId,uploadTime)); + resp.put("retcode", 200); + }catch (RuntimeException e){ + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + + + public HashMap getByMakeuplist(Integer staffId,String uploadTime,Integer uploadType){ + HashMap resp = new HashMap(); + try{ + if(uploadType.equals(0)){ + List makeuplists=makeuplistMapper.queryExperimentalClassMakeuplist(staffId,uploadTime); + resp.put("retvalue", makeuplists); + }else if(uploadType.equals(1)){ + List makeuplists=makeuplistMapper.queryClassMakeuplist(staffId,uploadTime); + resp.put("retvalue", makeuplists); + } + resp.put("retcode", 200); + }catch(RuntimeException e){ + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + /** * 导入数据 * @param file * @param staffId * @return */ - public HashMap addMakeuplist( MultipartFile file,Integer staffId) { + @Transactional + public HashMap addMakeuplist( MultipartFile file,Integer schoolId,Integer staffId,Integer uploadType,long uploadTime) { HashMap resp = new HashMap(); + MakeupStudentsVo vo; + String time= AssesmentHelper.longPointDate(uploadTime); try { - List makeuplists= ExcelImportHelper.readExcel(file,staffId); - if(!makeuplists.equals(null)&&makeuplists.size()>0) { - makeuplistMapper.addMakeuplist(makeuplists); - } - resp.put("retcode", 200); + //补考学生信息 + List makeuplists= ExcelImportHelper.readExcel(file,uploadType); + if(!makeuplists.isEmpty()&&makeuplists.size()>0){ + if(uploadType.equals(0)){ + addMakeuplist(makeuplists,schoolId,staffId,uploadType,time); + }else if(uploadType.equals(1)){ + addMakeuplist(makeuplists,schoolId,staffId,uploadType,time); + } + resp.put("retcode", 200); + }else{ + resp.put("retcode", 300); + resp.put("retvalue", "导入文件失败"); + } } catch (RuntimeException e) { logger.error(e.getMessage()); resp.put("retcode", 500); resp.put("retvalue", "文件格式有误"); - return resp; + throw new RuntimeException(); } return resp; } + private void addMakeuplist(List makeuplists,Integer schoolId,Integer staffId,Integer uploadType,String time){ + Student student=null; + MakeupStudentsVo vo=null; + for (int i=0;i