修改考核管理查看成绩页面+实验班级层级展示

master
pd 4 years ago
parent b59945cedf
commit fdc8a892a9
  1. 6
      src/main/java/com/yipin/liuwanr/Test.java
  2. 33
      src/main/java/com/yipin/liuwanr/controller/AssesmentController.java
  3. 10
      src/main/java/com/yipin/liuwanr/entity/Record.java
  4. 52
      src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java
  5. 68
      src/main/java/com/yipin/liuwanr/service/AssesmentService.java

@ -15,9 +15,9 @@ public class Test {
public static void main(String[] args) throws Exception {
//方法一
System.out.println((new Test()).getURLContent());
String urlStr = "http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData?page=1&num=40&sort=symbol&asc=1&node=hs_a&symbol=&_s_r_a=init";
System.out.println((new Test()).getURLContent(urlStr));
// System.out.println((new Test()).getURLContent());
// String urlStr = "http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData?page=1&num=40&sort=symbol&asc=1&node=hs_a&symbol=&_s_r_a=init";
// System.out.println((new Test()).getURLContent(urlStr));
}

@ -367,12 +367,6 @@ public class AssesmentController {
if(StringUtils.isEmpty(assesmentId)){
resp.setStatus(300);
resp.setErrmessage("考核信息为空");
}else if(StringUtils.isEmpty(experimentalClassId)){
resp.setStatus(300);
resp.setErrmessage("实验班级信息为空");
}else if(StringUtils.isEmpty(classId)){
resp.setStatus(300);
resp.setErrmessage("行政信息为空");
}else{
HashMap<String, Object> ret = service.queryScore(assesmentId,experimentalClassId,classId);
int status = (int) ret.get("retcode");
@ -397,18 +391,11 @@ public class AssesmentController {
* @return
*/
@GetMapping("/queryHistogram")
Response queryHistogram(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,
@RequestParam List<Integer> classId) {
Response queryHistogram(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,@RequestParam Integer classId) {
Response resp = new Response();
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");
@ -432,18 +419,11 @@ public class AssesmentController {
* @return
*/
@GetMapping("/getLinechart")
Response getLinechart(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,
@RequestParam List<Integer> classId) {
Response getLinechart(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,@RequestParam Integer classId) {
Response resp = new Response();
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");
@ -467,18 +447,11 @@ public class AssesmentController {
* @return
*/
@GetMapping("/queryAssesmentScore")
Response queryAssesmentScore(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,
@RequestParam List<Integer> classId) {
Response queryAssesmentScore(@RequestParam Integer assesmentId,@RequestParam Integer experimentalClassId,@RequestParam Integer classId) {
Response resp = new Response();
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");

@ -17,6 +17,16 @@ public class Record {
private Integer integral;
private String projectName;
private String studentName;
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
private Integer number;
public Integer getNumber() {

@ -127,7 +127,8 @@ public interface AssesmentMapper {
* @param studentIds
* @return
*/
@Select({"<script>", "select classId from student WHERE studentId in "
@Select({"<script>",
"select classId from student WHERE studentId in "
+ "<foreach collection='studentIds' item='stu' open='(' separator=',' close=')'>#{stu}</foreach> ",
"GROUP BY classId",
"</script>"})
@ -186,7 +187,7 @@ public interface AssesmentMapper {
* @return
*/
@Select("select DISTINCT DATE_FORMAT(creationTime,'%Y') as creationTime from experimental_class_ning " +
" WHERE isdel=0 and founder=(select staffName from staff where staffId=#{staffId}) and schoolId={schoolId} GROUP BY creationTime ORDER BY creationTime desc ")
" WHERE isdel=0 and founder=(select staffName from staff where staffId=#{staffId}) and schoolId=#{schoolId} GROUP BY creationTime ORDER BY creationTime desc ")
List<ExperimentalClass> queryCreationTime(@Param("staffId") Integer staffId,@Param("schoolId")Integer schoolId);
@ -234,12 +235,12 @@ public interface AssesmentMapper {
@Select("SELECT c.classId as classId,c.className as className from assessment ass left join class c on FIND_IN_SET(c.classId,ass.classId) where ass.id=#{assesmentId}")
List<SutdentClass> queryClass(Integer assesmentId);
@Select("select s.studentId,studentName from student s left join experimental_class_student ecs on s.studentId=ecs.studentId where s.isdel=0 and ecs.experimentalClassId=#{experimentalClassId} ")
//s.isdel=0 and
@Select("select s.studentId,studentName from student s left join experimental_class_student ecs on s.studentId=ecs.studentId where ecs.experimentalClassId=#{experimentalClassId} ")
List<Student> getByExperimentalClassId(Integer experimentalClassId);
@Select("SELECT studentId,studentName from student where isdel=0 and classId=#{classId} ")
//isdel=0 and
@Select("SELECT studentId,studentName from student where classId=#{classId} ")
List<Student> getByclassId(Integer classId);
@ -257,23 +258,13 @@ public interface AssesmentMapper {
/**
* 分组查询分数和对应人数
*
* @param assesmentId
* @param experimentalClassId
* @param classId
* @return
*/
@Select({"<script>",
"select re.score as score,count(re.recordId) as number FROM (record re left join assessment ass on ass.id=re.assesmentId) left join student stu on re.studentId=stu.studentId "
+ " where re.assesmentId=#{assesmentId} ",
" <if test=' experimentalClassId!=null '> and FIND_IN_SET(#{experimentalClassId},stu.experimentalClassId) </if>",
" <if test=' classId!=null '>"
+ "<foreach collection='classId' item='id' open='and stu.classId in (' separator=',' close=')'>#{id}</foreach>"
+ "</if>",
" and re.score is not null GROUP BY re.score",
"select score,count(studentId) as number from record where assesmentId=#{assesmentId}",
"<foreach collection='students' item='stu' open='and studentId in (' separator=',' close=')'>#{stu.studentId}</foreach>",
" and score is not null GROUP BY score",
"</script>"})
List<Record> queryScore2(@Param("assesmentId") Integer assesmentId, @Param("experimentalClassId") Integer experimentalClassId,
@Param("classId") List<Integer> classId);
List<Record> getGroupByScore(@Param("assesmentId") Integer assesmentId,@Param("students") List<Student> students);
/**
@ -312,28 +303,21 @@ public interface AssesmentMapper {
* @return
*/
@Select({"<script>",
"select judgmentPointsName,count(pr.judgmentPointsId) as number from PointRecord pr left join hr_judgment_points jp on pr.judgmentPointsId=jp.judgmentPointsId where rightAndWrong=-1 and assesmentId=#{assesmentId} ",
"select judgmentPointsName,count(pr.judgmentPointsId) as number from PointRecord pr left join hr_judgment_points jp on pr.judgmentPointsId=jp.judgmentPointsId "
+ "where rightAndWrong=-1 and assesmentId=#{assesmentId} ",
" <if test='experimentalClassId!=null '> and experimentalClassId=#{experimentalClassId}</if>",
" <if test='classId!=null '>"
+ "<foreach collection='classId' item='id' open='and classId in (' separator=',' close=')'>#{id} </foreach>"
+ "</if>",
" <if test='classId!=null '> and classId =#{classId} </if>",
"GROUP BY pr.judgmentPointsId",
"</script>"})
List<PointRecord> queryError(@Param("assesmentId") Integer assesmentId, @Param("experimentalClassId") Integer experimentalClassId,
@Param("classId") List<Integer> classId);
@Param("classId") Integer classId);
@Select({"<script>",
"select stu.studentName as studentName,re.score as score FROM (record re left join assessment ass on ass.id=re.assesmentId) left join student stu on re.studentId=stu.studentId "
+ " where re.assesmentId=#{assesmentId} ",
" <if test=' experimentalClassId!=null '>and FIND_IN_SET(#{experimentalClassId},stu.experimentalClassId) </if>",
" <if test=' classId!=null '>"
+ "<foreach collection='classId' item='id' open='and stu.classId in (' separator=',' close=')'> #{id} </foreach>"
+ "</if>",
" and re.score is not null",
"select studentName,score from record r left join student s on r.studentId=s.studentId where r.assesmentId=#{assesmentId}",
"<foreach collection='students' item='stu' open=' and r.studentId in (' separator=',' close=')'> #{stu.studentId} </foreach>",
"</script>"})
List<HashMap<String, Integer>> queryScore3(@Param("assesmentId") Integer assesmentId, @Param("experimentalClassId") Integer experimentalClassId,
@Param("classId") List<Integer> classId);
List<Record> queryScoreDetailed(@Param("assesmentId") Integer assesmentId,@Param("students") List<Student> students);
//开始考核

@ -76,9 +76,9 @@ public class AssesmentService {
try {
//转换时间格式
assesment = AssesmentHelper.helpAssesment(assesment);
if (assesment.getExperimentalClassId() != null) {
//行政班级id
List<String> classid = mapper.queryClassId(studentIds);
String experimentalClassId=assesment.getExperimentalClassId();
if (!StringUtils.isEmpty(experimentalClassId)) {
List<String> classid = mapper.queryClassId(studentIds);//行政班级id
String classId = String.join(",", classid);
assesment.setClassId(classId);
}
@ -92,13 +92,6 @@ public class AssesmentService {
//得到考核id
Integer assesmentId = assesment.getId();
String name = assesment.getAssesmentName();
Integer number = mapper.getByAssesmentName(name);
if (number != null && number > 0) {
name += (number + 1);
assesment.setAssesmentName(name);
}
//往记录表中添加选中的学生信息,哪名学生要参与某一课程的什么考核,该考核下的 哪一项目
mapper.insertRecore(studentIds, assesment.getExperimentId(), assesment.getCourseId(), assesmentId);
@ -180,16 +173,14 @@ public class AssesmentService {
Assesment before = mapper.queryGetById(assesment.getId());
//数据库存储的学生
List<Student> students = mapper.queryStudent(assesment.getId());
if (assesment.getExperimentalClassId() != null) {
//新的行政班级id
List<String> classid = mapper.queryClassId(studentIds);
String experimentalClassId=assesment.getExperimentalClassId();
if (!StringUtils.isEmpty(experimentalClassId)) {
List<String> classid = mapper.queryClassId(studentIds);//新的行政班级id
String classId = String.join(",", classid);
if (!classId.equals(before.getClassId())) {
assesment.setClassId(classId);
} else {
assesment.setClassId(before.getClassId());
}
} else if (assesment.getClassId() != null) {
} else if (!StringUtils.isEmpty(assesment.getClassId())) {
assesment.setExperimentalClassId(null);
}
// 比较两批学生的信息
@ -217,13 +208,6 @@ public class AssesmentService {
Integer pointNumber = mapper.queryPointNumber(assesment.getExperimentId());
assesment.setAssessmentNumber(pointNumber);
String name = assesment.getAssesmentName();
Integer number = mapper.getByAssesmentName(name);
if (number != null && number > 0) {
name += (number + 1);
assesment.setAssesmentName(name);
}
mapper.updateAssesment(assesment);
resp.put("retcode", 200);
@ -391,7 +375,7 @@ public class AssesmentService {
try {
List<ExperimentalClass> experimentalClasses = mapper.queryExperimental(assesmentId);
List<SutdentClass> classes = mapper.queryClass(assesmentId);
obj.put("xperimentalClass", experimentalClasses);
obj.put("experimentalClass", experimentalClasses);
obj.put("class", classes);
resp.put("retvalue", obj);
@ -412,15 +396,9 @@ public class AssesmentService {
public HashMap<String, Object> queryScore(Integer assesmentId, Integer experimentalClassId, Integer classId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
Score score;
List<Student> students = null;
int size = 0;
try {
if (experimentalClassId != null) {
students = mapper.getByExperimentalClassId(experimentalClassId);
} else if (classId != null) {
students = mapper.getByclassId(classId);
}
List<Student> students=queryStudents(experimentalClassId,classId);
//判分点数量
Integer pointNumber = mapper.getAssesmentNumber(assesmentId);
if (StringUtils.isEmpty(pointNumber)) {
@ -467,7 +445,6 @@ public class AssesmentService {
} else {
score = new Score(0.0, 0.0, 0, 0, 0, pointNumber, 0.0);
}
resp.put("retvalue", score);
resp.put("retcode", 200);
} catch (Exception e) {
@ -479,16 +456,25 @@ public class AssesmentService {
return resp;
}
private List<Student> queryStudents(Integer experimentalClassId, Integer classId){
List<Student> students=null;
if (experimentalClassId != null) {
students = mapper.getByExperimentalClassId(experimentalClassId);
} else if (classId != null) {
students = mapper.getByclassId(classId);
}
return students;
}
/**
* 成绩柱状图
*
* @param assesmentId
* @param experimentalClassId
* @param classId
* @return
*/
public HashMap<String, Object> queryHistogram(Integer assesmentId, Integer experimentalClassId, List<Integer> classId) {
public HashMap<String, Object> queryHistogram(Integer assesmentId, Integer experimentalClassId,Integer classId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
List<Integer> obj = new ArrayList<Integer>();
try {
@ -503,7 +489,9 @@ public class AssesmentService {
Integer nine = 0;
Integer ten = 0;
List<Record> scores = mapper.queryScore2(assesmentId, experimentalClassId, classId);
List<Student> students=queryStudents(experimentalClassId,classId);
List<Record> scores = mapper.getGroupByScore(assesmentId,students);
for (int i = 0; i < scores.size(); i++) {
Integer score = scores.get(i).getScore();
Integer number = scores.get(i).getNumber();
@ -563,7 +551,7 @@ public class AssesmentService {
* @param classId
* @return
*/
public HashMap<String, Object> getLinechart(Integer assesmentId, Integer experimentalClassId, List<Integer> classId) {
public HashMap<String, Object> getLinechart(Integer assesmentId, Integer experimentalClassId,Integer classId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
List<Object> obj = new ArrayList<Object>();
try {
@ -599,10 +587,14 @@ public class AssesmentService {
* @param classId
* @return
*/
public HashMap<String, Object> queryAssesmentScore(Integer assesmentId, Integer experimentalClassId, List<Integer> classId) {
public HashMap<String, Object> queryAssesmentScore(Integer assesmentId, Integer experimentalClassId,Integer classId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", mapper.queryScore3(assesmentId, experimentalClassId, classId));
List<Student> students=queryStudents(experimentalClassId,classId);
if(!students.isEmpty() && students.size()>0){
List<Record> records=mapper.queryScoreDetailed(assesmentId,students);
resp.put("retvalue",records );
}
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());

Loading…
Cancel
Save