修改考核管理接口

master
pd 4 years ago
parent 09ce7e004e
commit f0466dee96
  1. 405
      src/main/java/com/yipin/liuwanr/controller/AssesmentController.java
  2. 90
      src/main/java/com/yipin/liuwanr/controller/MakeuplistController.java
  3. 78
      src/main/java/com/yipin/liuwanr/entity/Makeuplist.java
  4. 7
      src/main/java/com/yipin/liuwanr/helper/AssesmentHelper.java
  5. 38
      src/main/java/com/yipin/liuwanr/helper/ExcelImportHelper.java
  6. 43
      src/main/java/com/yipin/liuwanr/mapper/MakeuplistMapper.java
  7. 9
      src/main/java/com/yipin/liuwanr/service/AssesmentService.java
  8. 115
      src/main/java/com/yipin/liuwanr/service/MakeuplistService.java

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; 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.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -38,8 +39,9 @@ public class AssesmentController {
* @return * @return
*/ */
@GetMapping("/queryAssesmentcondition") @GetMapping("/queryAssesmentcondition")
Response queryAssementCondition(Integer staffId,Integer courseId,String className, Response queryAssementCondition(@RequestParam Integer staffId,@RequestParam Integer courseId,@RequestParam String className,
Integer assesmentState,Integer releaseType, String creationTime,String endTime,Integer month, @RequestParam Integer assesmentState,@RequestParam Integer releaseType,
@RequestParam String creationTime,@RequestParam String endTime,@RequestParam Integer month,
@RequestParam(defaultValue = "0")Integer pageSize, @RequestParam(defaultValue = "0")Integer pageSize,
@RequestParam(defaultValue = "0")Integer pageNo ) { @RequestParam(defaultValue = "0")Integer pageNo ) {
Response resp = new Response(); Response resp = new Response();
@ -89,15 +91,25 @@ public class AssesmentController {
@PostMapping("/addAssesment") @PostMapping("/addAssesment")
Response addAssesment(@RequestBody AssesmentStudentVo vo) { Response addAssesment(@RequestBody AssesmentStudentVo vo) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.addAssesment(vo); Assesment assesment=vo.getAssesment();
int status = (int) ret.get("retcode"); List<Integer> studentIds=vo.getStudentIds();
if (200 == status) { if(StringUtils.isEmpty(assesment)){
resp.setStatus(status); resp.setStatus(300);
resp.setMessage(ret.get("retvalue")); resp.setErrmessage("考核信息为空");
} else { }else if(studentIds.isEmpty()&&studentIds.size()<=0){
resp.setStatus(status); resp.setStatus(300);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage("学生信息为空");
} }else{
HashMap<String, Object> 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; return resp;
} }
@ -110,15 +122,20 @@ public class AssesmentController {
@GetMapping("/queryStudentisAssess") @GetMapping("/queryStudentisAssess")
Response queryStudentisAssess(@RequestParam List<Integer> studentIds) { Response queryStudentisAssess(@RequestParam List<Integer> studentIds) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.queryStudentisAssess(studentIds); if(studentIds.isEmpty()&&studentIds.size()<=0){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("学生信息为空");
resp.setStatus(status); }else{
resp.setMessage(ret.get("retvalue")); HashMap<String, Object> ret = service.queryStudentisAssess(studentIds);
} else { int status = (int) ret.get("retcode");
resp.setStatus(status); if (200 == status) {
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(status);
} resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp; return resp;
} }
@ -128,17 +145,22 @@ public class AssesmentController {
* @return * @return
*/ */
@GetMapping("/queryGetById") @GetMapping("/queryGetById")
Response getByAssesmentId(Integer id) { Response getByAssesmentId(@RequestParam Integer id) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.queryGetById(id); if(StringUtils.isEmpty(id)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("项目信息为空");
resp.setStatus(status); }else{
resp.setMessage(ret.get("retvalue")); HashMap<String, Object> ret = service.queryGetById(id);
} else { int status = (int) ret.get("retcode");
resp.setStatus(status); if (200 == status) {
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(status);
} resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp; return resp;
} }
@ -152,15 +174,23 @@ public class AssesmentController {
Response resp = new Response(); Response resp = new Response();
Assesment assesment=vo.getAssesment(); Assesment assesment=vo.getAssesment();
List<Integer> studentIds=vo.getStudentIds(); List<Integer> studentIds=vo.getStudentIds();
HashMap<String, Object> ret = service.updateAssesment(assesment,studentIds); if(StringUtils.isEmpty(assesment)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("考核信息为空");
resp.setStatus(status); }else if(studentIds.isEmpty()&&studentIds.size()<=0){
resp.setMessage(ret.get("retvalue")); resp.setStatus(300);
} else { resp.setErrmessage("学生信息为空");
resp.setStatus(status); }else{
resp.setErrmessage(ret.get("retvalue").toString()); HashMap<String, Object> 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; return resp;
} }
@ -170,38 +200,46 @@ public class AssesmentController {
* @return * @return
*/ */
@GetMapping("/assessmentJudgment") @GetMapping("/assessmentJudgment")
Response updateState(Integer assesmentId) { Response updateState(@RequestParam Integer assesmentId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.assessmentJudgment(assesmentId); if(StringUtils.isEmpty(assesmentId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("考核信息为空");
resp.setStatus(status); }else{
resp.setMessage(ret.get("retvalue")); HashMap<String, Object> ret = service.assessmentJudgment(assesmentId);
} else { int status = (int) ret.get("retcode");
resp.setStatus(status); if (200 == status) {
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(status);
} resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp; return resp;
} }
/** /**
* 修改考核状态 * 修改考核状态
* @param id
* @param state
* @return * @return
*/ */
@PostMapping("/updateState") @PostMapping("/updateState")
Response updateState(@RequestBody Assesment assesment) { Response updateState(@RequestBody Assesment assesment) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.updateState(assesment); if(StringUtils.isEmpty(assesment)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("考核信息为空");
resp.setStatus(status); }else{
resp.setMessage(ret.get("retvalue")); HashMap<String, Object> ret = service.updateState(assesment);
} else { int status = (int) ret.get("retcode");
resp.setStatus(status); if (200 == status) {
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(status);
} resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp; return resp;
} }
@ -212,17 +250,22 @@ public class AssesmentController {
* @return * @return
*/ */
@GetMapping("/getExperimentalClass") @GetMapping("/getExperimentalClass")
Response getExperimentalClass(Integer staffId) { Response getExperimentalClass(@RequestParam Integer staffId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.queryCretionTime(staffId); if(StringUtils.isEmpty(staffId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("教师信息为空");
resp.setStatus(status); }else{
resp.setMessage(ret.get("retvalue")); HashMap<String, Object> ret = service.queryCretionTime(staffId);
} else { int status = (int) ret.get("retcode");
resp.setStatus(status); if (200 == status) {
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(status);
} resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp; return resp;
} }
@ -233,17 +276,25 @@ public class AssesmentController {
* @return * @return
*/ */
@GetMapping("/getCreationTime") @GetMapping("/getCreationTime")
Response getCreationTime(String creationTime,Integer staffId) { Response getCreationTime(@RequestParam String creationTime,@RequestParam Integer staffId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.queryCretionTime(creationTime,staffId); if(StringUtils.isEmpty(staffId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("教师信息为空");
resp.setStatus(status); }else if(StringUtils.isEmpty(creationTime)){
resp.setMessage(ret.get("retvalue")); resp.setStatus(300);
} else { resp.setErrmessage("实验班级创建时间信息为空");
resp.setStatus(status); }else {
resp.setErrmessage(ret.get("retvalue").toString()); HashMap<String, Object> 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; return resp;
} }
@ -254,17 +305,22 @@ public class AssesmentController {
* @return * @return
*/ */
@GetMapping("/queryAssesmet") @GetMapping("/queryAssesmet")
Response queryAssesmet(Integer assesmentId) { Response queryAssesmet(@RequestParam Integer assesmentId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.queryAssesment(assesmentId); if(StringUtils.isEmpty(assesmentId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("考核信息为空");
resp.setStatus(status); }else{
resp.setMessage(ret.get("retvalue")); HashMap<String, Object> ret = service.queryAssesment(assesmentId);
} else { int status = (int) ret.get("retcode");
resp.setStatus(status); if (200 == status) {
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(status);
} resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp; return resp;
} }
@ -277,15 +333,20 @@ public class AssesmentController {
@GetMapping("/getByclass") @GetMapping("/getByclass")
Response getByclass(Integer assesmentId) { Response getByclass(Integer assesmentId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.getByclass(assesmentId); if(StringUtils.isEmpty(assesmentId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("考核信息为空");
resp.setStatus(status); }else{
resp.setMessage(ret.get("retvalue")); HashMap<String, Object> ret = service.getByclass(assesmentId);
} else { int status = (int) ret.get("retcode");
resp.setStatus(status); if (200 == status) {
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(status);
} resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp; return resp;
} }
@ -299,17 +360,29 @@ public class AssesmentController {
* @return * @return
*/ */
@GetMapping("/queryClassScore") @GetMapping("/queryClassScore")
Response queryClassScore(Integer assesmentId,Integer experimentalClassId,@RequestParam List<Integer> classId) { Response queryClassScore(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,@RequestParam List<Integer> classId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.queryScore(assesmentId,experimentalClassId,classId); if(StringUtils.isEmpty(assesmentId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("考核信息为空");
resp.setStatus(status); }else if(StringUtils.isEmpty(experimentalClassId)){
resp.setMessage(ret.get("retvalue")); resp.setStatus(300);
} else { resp.setErrmessage("实验班级信息为空");
resp.setStatus(status); }else if(classId.isEmpty()&&classId.size()<0){
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(300);
} resp.setErrmessage("行政信息为空");
}else{
HashMap<String, Object> 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; return resp;
} }
@ -322,18 +395,29 @@ public class AssesmentController {
* @return * @return
*/ */
@GetMapping("/queryHistogram") @GetMapping("/queryHistogram")
Response queryHistogram(Integer assesmentId,Integer experimentalClassId, Response queryHistogram(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,
@RequestParam List<Integer> classId) { @RequestParam List<Integer> classId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.queryHistogram(assesmentId,experimentalClassId,classId); if(StringUtils.isEmpty(assesmentId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("考核信息为空");
resp.setStatus(status); }else if(StringUtils.isEmpty(experimentalClassId)){
resp.setMessage(ret.get("retvalue")); resp.setStatus(300);
} else { resp.setErrmessage("实验班级信息为空");
resp.setStatus(status); }else if(classId.isEmpty()&&classId.size()<0){
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(300);
} resp.setErrmessage("行政信息为空");
}else {
HashMap<String, Object> 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; return resp;
} }
@ -346,18 +430,29 @@ public class AssesmentController {
* @return * @return
*/ */
@GetMapping("/getLinechart") @GetMapping("/getLinechart")
Response getLinechart(Integer assesmentId,Integer experimentalClassId, Response getLinechart(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,
@RequestParam List<Integer> classId) { @RequestParam List<Integer> classId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.getLinechart(assesmentId,experimentalClassId,classId); if(StringUtils.isEmpty(assesmentId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("考核信息为空");
resp.setStatus(status); }else if(StringUtils.isEmpty(experimentalClassId)){
resp.setMessage(ret.get("retvalue")); resp.setStatus(300);
} else { resp.setErrmessage("实验班级信息为空");
resp.setStatus(status); }else if(classId.isEmpty()&&classId.size()<0){
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(300);
} resp.setErrmessage("行政信息为空");
}else{
HashMap<String, Object> 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; return resp;
} }
@ -370,18 +465,29 @@ public class AssesmentController {
* @return * @return
*/ */
@GetMapping("/queryAssesmentScore") @GetMapping("/queryAssesmentScore")
Response queryAssesmentScore(Integer assesmentId,Integer experimentalClassId, Response queryAssesmentScore(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,
@RequestParam List<Integer> classId) { @RequestParam List<Integer> classId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.queryAssesmentScore(assesmentId,experimentalClassId,classId); if(StringUtils.isEmpty(assesmentId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("考核信息为空");
resp.setStatus(status); }else if(StringUtils.isEmpty(experimentalClassId)){
resp.setMessage(ret.get("retvalue")); resp.setStatus(300);
} else { resp.setErrmessage("实验班级信息为空");
resp.setStatus(status); }else if(classId.isEmpty()&&classId.size()<0){
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(300);
} resp.setErrmessage("行政信息为空");
}else{
HashMap<String, Object> 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; return resp;
} }
@ -394,14 +500,19 @@ public class AssesmentController {
@GetMapping("/releaseAssesment") @GetMapping("/releaseAssesment")
Response releaseAssesment(@RequestParam Integer courseId){ Response releaseAssesment(@RequestParam Integer courseId){
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.releaseAssesment(courseId); if(StringUtils.isEmpty(courseId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (200 == status) { resp.setErrmessage("课程信息为空");
resp.setStatus(status); }else{
resp.setMessage(ret.get("retvalue")); HashMap<String, Object> ret = service.releaseAssesment(courseId);
} else { int status = (int) ret.get("retcode");
resp.setStatus(status); if (200 == status) {
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
} }
return resp; return resp;
} }

@ -6,14 +6,11 @@ import java.util.HashMap;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.yipin.liuwanr.vo.MakeupStudentsVo;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.yipin.liuwanr.entity.Response; import com.yipin.liuwanr.entity.Response;
@ -33,38 +30,59 @@ public class MakeuplistController {
* @return * @return
*/ */
@PostMapping("/importMakeuplist") @PostMapping("/importMakeuplist")
Response queryCustomer(@RequestParam("file") MultipartFile file,@RequestParam Integer staffId) { Response queryCustomer( MakeupStudentsVo vo) {
Response resp = new Response(); 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)) { if(StringUtils.isEmpty(staffId)) {
resp.setStatus(300); resp.setStatus(300);
resp.setMessage("staffId cannot be empty "); resp.setMessage("教师信息为空");
return resp; }else if(StringUtils.isEmpty(uploadTime)){
} resp.setStatus(300);
HashMap<String, Object> ret = makeuplistService.addMakeuplist(file,staffId); resp.setMessage("文件上传时间为空");
int status = (int) ret.get("retcode"); }else if(StringUtils.isEmpty(uploadType)){
if (200 == status) { resp.setStatus(300);
resp.setStatus(status); resp.setMessage("文件上传选项为空");
resp.setMessage(ret.get("retvalue")); }else if(StringUtils.isEmpty(schoolId)){
} else { resp.setStatus(300);
resp.setStatus(status); resp.setMessage("学校为空");
resp.setErrmessage(ret.get("retvalue").toString()); }else{
HashMap<String, Object> 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; return resp;
} }
/** /**
* 在补考名单中渲染表格根据班级名称查询信息 * 在补考名单中渲染表格
* @param className
* @return * @return
*/ */
@GetMapping("/queryGetByClassName") @GetMapping("/queryGetByClassName")
Response queryGetByClassName(@RequestParam Integer staffId,@RequestParam String className) { Response queryGetByClassName(@RequestParam Integer staffId,@RequestParam String uploadTime,Integer uploadType) {
Response resp = new Response(); Response resp = new Response();
if(StringUtils.isEmpty(staffId)) { if(StringUtils.isEmpty(staffId)) {
resp.setStatus(300); resp.setStatus(300);
resp.setMessage("staffId cannot be empty "); resp.setMessage("staffId cannot be empty ");
} else { } else if(StringUtils.isEmpty(uploadTime)){
HashMap<String, Object> ret = makeuplistService.queryAllMakeuplist(staffId,className); resp.setStatus(300);
resp.setMessage("文件上传时间为空");
}else if(StringUtils.isEmpty(uploadType)){
resp.setStatus(300);
resp.setMessage("文件上传选项为空");
}else {
HashMap<String, Object> ret = makeuplistService.queryAllMakeuplist(staffId,uploadTime,uploadType);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -100,8 +118,32 @@ public class MakeuplistController {
} }
return null; 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<String, Object> 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;
}
} }

@ -6,13 +6,18 @@ package com.yipin.liuwanr.entity;
* *
*/ */
public class Makeuplist { public class Makeuplist {
private String professionalName;
private Integer gradeName;
private String className; 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 String studentName;
private Integer staffId; private Integer staffId;
private Integer schoolId;
private String professionalName;
private String gradeName;
public String getProfessionalName() { public String getProfessionalName() {
return professionalName; return professionalName;
@ -22,20 +27,36 @@ public class Makeuplist {
this.professionalName = professionalName; this.professionalName = professionalName;
} }
public Integer getGradeName() { public String getGradeName() {
return gradeName; return gradeName;
} }
public Integer getStaffId() { public void setGradeName(String gradeName) {
return staffId; this.gradeName = gradeName;
} }
public void setStaffId(Integer staffId) { public String getExperimentalClassName() {
this.staffId = staffId; return experimentalClassName;
} }
public void setGradeName(Integer gradeName) { public void setExperimentalClassName(String experimentalClassName) {
this.gradeName = gradeName; 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() { public String getClassName() {
@ -46,20 +67,43 @@ public class Makeuplist {
this.className = className; 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; return studentNumber;
} }
public void setStudentNumber(Integer studentNumber) { public void setStudentNumber(String studentNumber) {
this.studentNumber = studentNumber; this.studentNumber = studentNumber;
} }
public String getStudentName() { public Integer getStaffId() {
return studentName; return staffId;
} }
public void setStudentName(String studentName) { public void setStaffId(Integer staffId) {
this.studentName = studentName; this.staffId = staffId;
}
public Integer getSchoolId() {
return schoolId;
} }
public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId;
}
} }

@ -16,9 +16,12 @@ public class AssesmentHelper {
*/ */
public static String getGapTime(long time) { public static String getGapTime(long time) {
long hours = time / (1000 * 60 * 60); 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(); 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(); return buffer.toString();
} }

@ -21,12 +21,12 @@ public class ExcelImportHelper {
/** /**
* 读取补考名单 * 读取补考名单
*
* @param file * @param file
* @return * @return
*/ */
public static List<Makeuplist> readExcel(MultipartFile file, Integer staffId) { public static List<Makeuplist> readExcel(MultipartFile file,Integer uploadType) {
List<Makeuplist> list = new ArrayList<Makeuplist>(); List<Makeuplist> list = new ArrayList<Makeuplist>();
List<String> names=new ArrayList<String>();
try { try {
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
Workbook workbook = null; Workbook workbook = null;
@ -49,27 +49,33 @@ public class ExcelImportHelper {
if (row != null) { if (row != null) {
makeuplist = new Makeuplist(); makeuplist = new Makeuplist();
row.getCell(0).setCellType(CellType.STRING); row.getCell(0).setCellType(CellType.STRING);
Cell professionalName = row.getCell(0); Cell className = row.getCell(0);
row.getCell(1).setCellType(CellType.STRING); row.getCell(1).setCellType(CellType.STRING);
Cell gradeName = row.getCell(1); Cell studentNumber = row.getCell(1);
row.getCell(2).setCellType(CellType.STRING); row.getCell(2).setCellType(CellType.STRING);
Cell className = row.getCell(2); Cell studentName = row.getCell(2);
row.getCell(3).setCellType(CellType.STRING); if(uploadType.equals(0)){
Cell studentNumber = row.getCell(3); String name=className.getStringCellValue();
row.getCell(4).setCellType(CellType.STRING); names.add(name);
Cell studentName = row.getCell(4); }
makeuplist.setProfessionalName(professionalName.getStringCellValue());
makeuplist.setGradeName(Integer.parseInt(gradeName.getStringCellValue()));
makeuplist.setClassName(className.getStringCellValue()); makeuplist.setClassName(className.getStringCellValue());
makeuplist.setStudentNumber(Integer.parseInt(studentNumber.getStringCellValue())); makeuplist.setStudentNumber(studentNumber.getStringCellValue());
makeuplist.setStudentName(studentName.getStringCellValue()); makeuplist.setStudentName(studentName.getStringCellValue());
makeuplist.setStaffId(staffId);
list.add(makeuplist); list.add(makeuplist);
} }
} }
if(uploadType.equals(0)){
if(!names.isEmpty()&&names.size()>0){
for (int i=0;i<names.size()-1;i++){
String name1=names.get(i);
String name2=names.get(i+1);
if(!name1.equals(name2)){
return null;
}
}
}
}
} }
} catch (Exception e) { } catch (Exception e) {
} }
@ -79,7 +85,6 @@ public class ExcelImportHelper {
/** /**
* 读取学生管理 * 读取学生管理
*
* @param file * @param file
* @return * @return
*/ */
@ -146,7 +151,6 @@ public class ExcelImportHelper {
/** /**
* 读取员工管理 * 读取员工管理
* @param file * @param file
* @param schoolId
* @return * @return
*/ */
public static List<Staff> readStaff(MultipartFile file) { public static List<Staff> readStaff(MultipartFile file) {

@ -2,12 +2,13 @@ package com.yipin.liuwanr.mapper;
import java.util.List; 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.Insert;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; 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 { public interface MakeuplistMapper {
@Select({"<script>", @Select("select professionalName,gradeName,className,m.studentNumber,studentName from makeuplist m,student s,class c,grade g,professional p" +
"select professionalName,gradeName,className,studentNumber,studentName from makeuplist where staffId=#{staffId} ", "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}")
"<if test='className!=null'>and className like concat('%',#{className},'%')</if>", List<Makeuplist> queryClassMakeuplist(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime);
"</script>"})
List<Makeuplist> queryAllMakeuplist(@Param("staffId")Integer staffId,@Param("className")String className); @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<Makeuplist> queryExperimentalClassMakeuplist(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime);
@Select("select experimentalClassId,studentId,classId from makeuplist where staffId=#{staffId} and uploadTime=#{uploadTime}")
List<Student> getstudent(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime);
@Select("select classId,studentId from makeuplist where staffId=#{staffId} and uploadTime=#{uploadTime}")
List<Student> getClass(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime);
@Insert({"<script>", @Insert(
"insert into makeuplist (professionalName,gradeName,className,studentNumber,studentName,staffId) values" "insert into makeuplist (schoolId,classId,experimentalClassId,studentNumber,studentId,staffId,uploadType,uploadTime) values"
+ "<foreach collection = 'makeuplists' item='mak' separator=','>" + "(#{schoolId},#{classId},#{experimentalClassId},#{studentNumber},#{studentId},#{staffId},#{uploadType},#{time})")
+ "(#{mak.professionalName},#{mak.gradeName},#{mak.className},#{mak.studentNumber},#{mak.studentName},#{mak.staffId})" void addMakeuplist(MakeupStudentsVo vo);
+ "</foreach>",
"</script>"}) //实验班级信息
void addMakeuplist(@Param("makeuplists") List<Makeuplist> makeuplists); @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);
} }

@ -67,15 +67,11 @@ public class AssesmentService {
/** /**
* 创建考核 * 创建考核
*
* @param vo
* @return * @return
*/ */
@Transactional @Transactional
public HashMap<String, Object> addAssesment(AssesmentStudentVo vo) { public HashMap<String, Object> addAssesment(Assesment assesment, List<Integer> studentIds ) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
Assesment assesment = vo.getAssesment();
List<Integer> studentIds = vo.getStudentIds();
try { try {
//转换时间格式 //转换时间格式
assesment = AssesmentHelper.helpAssesment(assesment); assesment = AssesmentHelper.helpAssesment(assesment);
@ -222,6 +218,7 @@ public class AssesmentService {
return resp; return resp;
} }
/** /**
* 启动考核前的判断 * 启动考核前的判断
* *
@ -239,7 +236,6 @@ public class AssesmentService {
if (datas.contains(stu.getStudentId())) { if (datas.contains(stu.getStudentId())) {
obj.add(stu); obj.add(stu);
} }
} }
resp.put("retvalue", obj); resp.put("retvalue", obj);
resp.put("retcode", 200); resp.put("retcode", 200);
@ -269,7 +265,6 @@ public class AssesmentService {
String endTime = assesment.getEndTime(); String endTime = assesment.getEndTime();
String timeSum = assesment.getTimesum(); String timeSum = assesment.getTimesum();
if (createTime != null && !createTime.equals("")) { if (createTime != null && !createTime.equals("")) {
starttime = Long.parseLong(assesment.getCreationTime()); starttime = Long.parseLong(assesment.getCreationTime());
assesment.setCreationTime(AssesmentHelper.longPointDate(starttime)); assesment.setCreationTime(AssesmentHelper.longPointDate(starttime));

@ -3,9 +3,13 @@ package com.yipin.liuwanr.service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; 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.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.yipin.liuwanr.entity.Makeuplist; import com.yipin.liuwanr.entity.Makeuplist;
@ -30,13 +34,18 @@ public class MakeuplistService {
/** /**
* 查询数据 * 查询数据
* @param staffId * @param staffId
* @param className
* @return * @return
*/ */
public HashMap<String, Object> queryAllMakeuplist(Integer staffId,String className) { public HashMap<String, Object> queryAllMakeuplist(Integer staffId,String uploadTime,Integer uploadType) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
resp.put("retvalue", makeuplistMapper.queryAllMakeuplist(staffId,className)); if(uploadType.equals(0)){
List<Makeuplist> makeuplists=makeuplistMapper.queryExperimentalClassMakeuplist(staffId,uploadTime);
resp.put("retvalue", makeuplists);
}else if(uploadType.equals(1)){
List<Makeuplist> makeuplists=makeuplistMapper.queryClassMakeuplist(staffId,uploadTime);
resp.put("retvalue", makeuplists);
}
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -47,27 +56,113 @@ public class MakeuplistService {
return resp; return resp;
} }
public HashMap<String, Object> getStudent(Integer staffId,String uploadTime,Integer uploadType){
HashMap<String, Object> resp = new HashMap<String, Object>();
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<String, Object> getByMakeuplist(Integer staffId,String uploadTime,Integer uploadType){
HashMap<String, Object> resp = new HashMap<String, Object>();
try{
if(uploadType.equals(0)){
List<Makeuplist> makeuplists=makeuplistMapper.queryExperimentalClassMakeuplist(staffId,uploadTime);
resp.put("retvalue", makeuplists);
}else if(uploadType.equals(1)){
List<Makeuplist> 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 file
* @param staffId * @param staffId
* @return * @return
*/ */
public HashMap<String, Object> addMakeuplist( MultipartFile file,Integer staffId) { @Transactional
public HashMap<String, Object> addMakeuplist( MultipartFile file,Integer schoolId,Integer staffId,Integer uploadType,long uploadTime) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
MakeupStudentsVo vo;
String time= AssesmentHelper.longPointDate(uploadTime);
try { try {
List<Makeuplist> makeuplists= ExcelImportHelper.readExcel(file,staffId); //补考学生信息
if(!makeuplists.equals(null)&&makeuplists.size()>0) { List<Makeuplist> makeuplists= ExcelImportHelper.readExcel(file,uploadType);
makeuplistMapper.addMakeuplist(makeuplists); if(!makeuplists.isEmpty()&&makeuplists.size()>0){
} if(uploadType.equals(0)){
resp.put("retcode", 200); 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) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "文件格式有误"); resp.put("retvalue", "文件格式有误");
return resp; throw new RuntimeException();
} }
return resp; return resp;
} }
private void addMakeuplist(List<Makeuplist> makeuplists,Integer schoolId,Integer staffId,Integer uploadType,String time){
Student student=null;
MakeupStudentsVo vo=null;
for (int i=0;i<makeuplists.size();i++){
Makeuplist makeuplist=makeuplists.get(i);
vo=new MakeupStudentsVo();
String studentNumber=makeuplist.getStudentNumber();//学号
if(uploadType.equals(0)){
String experimentalClassName=makeuplist.getClassName();
student=makeuplistMapper.queryExperimentalClassStudent(experimentalClassName,schoolId,studentNumber);
if(student!=null){
vo.setExperimentalClassId(student.getIntExperimentalClassId());//实验班级id
vo.setStudentId(student.getStudentId());//学生id
vo.setStudentNumber(studentNumber);
}else{
throw new RuntimeException("该学生不存在");
}
}else if(uploadType.equals(1)){
student =makeuplistMapper.queryClassStudent(studentNumber,schoolId);
if(student!=null){
vo.setClassId(student.getClassId());//行政班级id
vo.setStudentId(student.getStudentId());//学生id
vo.setStudentNumber(studentNumber);
}else{
throw new RuntimeException("该学生不存在");
}
}
vo.setStaffId(staffId);
vo.setSchoolId(schoolId);
vo.setUploadType(uploadType);
vo.setTime(time);
if(student!=null){
makeuplistMapper.addMakeuplist(vo);
}
}
}
} }
Loading…
Cancel
Save