修改考核管理接口

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 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<String, Object> 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<Integer> 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<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;
}
@ -110,15 +122,20 @@ public class AssesmentController {
@GetMapping("/queryStudentisAssess")
Response queryStudentisAssess(@RequestParam List<Integer> studentIds) {
Response resp = new Response();
HashMap<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<Integer> studentIds=vo.getStudentIds();
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());
}
if(StringUtils.isEmpty(assesment)){
resp.setStatus(300);
resp.setErrmessage("考核信息为空");
}else if(studentIds.isEmpty()&&studentIds.size()<=0){
resp.setStatus(300);
resp.setErrmessage("学生信息为空");
}else{
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;
}
@ -170,38 +200,46 @@ public class AssesmentController {
* @return
*/
@GetMapping("/assessmentJudgment")
Response updateState(Integer assesmentId) {
Response updateState(@RequestParam Integer assesmentId) {
Response resp = new Response();
HashMap<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<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());
}
if(StringUtils.isEmpty(staffId)){
resp.setStatus(300);
resp.setErrmessage("教师信息为空");
}else if(StringUtils.isEmpty(creationTime)){
resp.setStatus(300);
resp.setErrmessage("实验班级创建时间信息为空");
}else {
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;
}
@ -254,17 +305,22 @@ public class AssesmentController {
* @return
*/
@GetMapping("/queryAssesmet")
Response queryAssesmet(Integer assesmentId) {
Response queryAssesmet(@RequestParam Integer assesmentId) {
Response resp = new Response();
HashMap<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<Integer> classId) {
Response queryClassScore(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,@RequestParam List<Integer> classId) {
Response resp = new Response();
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());
}
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<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;
}
@ -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<Integer> classId) {
Response resp = new Response();
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());
}
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<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;
}
@ -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<Integer> classId) {
Response resp = new Response();
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());
}
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<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;
}
@ -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<Integer> classId) {
Response resp = new Response();
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());
}
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<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;
}
@ -394,14 +500,19 @@ public class AssesmentController {
@GetMapping("/releaseAssesment")
Response releaseAssesment(@RequestParam Integer courseId){
Response resp = new Response();
HashMap<String, Object> 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<String, Object> 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;
}

@ -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<String, Object> 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<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;
}
/**
* 在补考名单中渲染表格根据班级名称查询信息
* @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<String, Object> 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<String, Object> 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<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 {
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;
}
}

@ -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();
}

@ -21,12 +21,12 @@ public class ExcelImportHelper {
/**
* 读取补考名单
*
* @param file
* @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<String> names=new ArrayList<String>();
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<names.size()-1;i++){
String name1=names.get(i);
String name2=names.get(i+1);
if(!name1.equals(name2)){
return null;
}
}
}
}
}
} catch (Exception e) {
}
@ -79,7 +85,6 @@ public class ExcelImportHelper {
/**
* 读取学生管理
*
* @param file
* @return
*/
@ -146,7 +151,6 @@ public class ExcelImportHelper {
/**
* 读取员工管理
* @param file
* @param schoolId
* @return
*/
public static List<Staff> readStaff(MultipartFile file) {

@ -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({"<script>",
"select professionalName,gradeName,className,studentNumber,studentName from makeuplist where staffId=#{staffId} ",
"<if test='className!=null'>and className like concat('%',#{className},'%')</if>",
"</script>"})
List<Makeuplist> 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<Makeuplist> 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<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 into makeuplist (professionalName,gradeName,className,studentNumber,studentName,staffId) values"
+ "<foreach collection = 'makeuplists' item='mak' separator=','>"
+ "(#{mak.professionalName},#{mak.gradeName},#{mak.className},#{mak.studentNumber},#{mak.studentName},#{mak.staffId})"
+ "</foreach>",
"</script>"})
void addMakeuplist(@Param("makeuplists") List<Makeuplist> 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);
}

@ -67,15 +67,11 @@ public class AssesmentService {
/**
* 创建考核
*
* @param vo
* @return
*/
@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>();
Assesment assesment = vo.getAssesment();
List<Integer> 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));

@ -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<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>();
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);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -47,27 +56,113 @@ public class MakeuplistService {
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 staffId
* @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>();
MakeupStudentsVo vo;
String time= AssesmentHelper.longPointDate(uploadTime);
try {
List<Makeuplist> makeuplists= ExcelImportHelper.readExcel(file,staffId);
if(!makeuplists.equals(null)&&makeuplists.size()>0) {
makeuplistMapper.addMakeuplist(makeuplists);
}
resp.put("retcode", 200);
//补考学生信息
List<Makeuplist> 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<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