wangliang 2 жил өмнө
parent
commit
621a28696c

+ 13 - 12
src/main/java/com/qmth/eds/api/ExamAssignController.java

@@ -1,8 +1,9 @@
 package com.qmth.eds.api;
 
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.boot.api.constant.ApiConstant;
-import com.qmth.eds.bean.dto.syssetting.SettingObject;
+import com.qmth.eds.bean.result.AssignResultPreviewResult;
 import com.qmth.eds.bean.result.EditResult;
 import com.qmth.eds.common.contant.SystemConstant;
 import com.qmth.eds.common.entity.ExamAssign;
@@ -14,12 +15,14 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
 import org.springframework.validation.annotation.Validated;
-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 javax.annotation.Resource;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
-import java.util.List;
 
 /**
  * <p>
@@ -67,15 +70,13 @@ public class ExamAssignController {
 
     @ApiOperation(value = "计算结果查询")
     @PostMapping("/result")
-    @ApiResponses({@ApiResponse(code = 200, message = "保存/更新成功", response = EditResult.class)})
-    public Result result(@RequestParam(value = "semesterId", required = false) Long semesterId,
-                         @RequestParam(value = "examTypeId", required = false) Long examTypeId,
-                         @RequestParam(value = "courseCode", required = false) String courseCode,
-                         @RequestParam(value = "courseName", required = false) String courseName,
-                         @RequestParam(value = "formula", required = false) String formula,
-                         @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
-                         @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
-        return ResultUtil.ok(examAssignService.result(semesterId, examTypeId, courseCode, courseName, formula, pageNumber, pageSize));
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = AssignResultPreviewResult.class)})
+    public Result assignResultPreview(@RequestParam(value = "开课学院", required = false) String collegeName,
+                                @RequestParam(value = "班级id", required = false) String clazzId,
+                                @RequestParam(value = "任课老师工号", required = false) String teacherCode,
+                                @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                                @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        return ResultUtil.ok(examAssignService.assignResultPreview(new Page<>(pageNumber, pageSize), collegeName, clazzId, teacherCode));
     }
 
     @ApiOperation(value = "计算结果对比")

+ 161 - 0
src/main/java/com/qmth/eds/bean/result/AssignResultPreviewResult.java

@@ -0,0 +1,161 @@
+package com.qmth.eds.bean.result;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 赋分计算结果result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2023/5/24
+ */
+public class AssignResultPreviewResult implements Serializable {
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "主键")
+    Long id;
+
+    @ApiModelProperty(value = "课程代码")
+    String courseCode;
+
+    @ApiModelProperty(value = "课程名称")
+    String courseName;
+
+    @ApiModelProperty(value = "学号")
+    String studentCode;
+
+    @ApiModelProperty(value = "姓名")
+    String studentName;
+
+    @ApiModelProperty(value = "客观总分")
+    String objectiveScore;
+
+    @ApiModelProperty(value = "主观总分")
+    String subjectiveScore;
+
+    @ApiModelProperty(value = "总分")
+    String totalScore;
+
+    @ApiModelProperty(value = "评分明细")
+    String scoreDetail;
+
+    @ApiModelProperty(value = "班级")
+    String clazzName;
+
+    @ApiModelProperty(value = "学院")
+    String collegeName;
+
+    @ApiModelProperty(value = "任课老师")
+    String teacherName;
+
+    @ApiModelProperty(value = "赋分后总分")
+    String assignScore;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getStudentCode() {
+        return studentCode;
+    }
+
+    public void setStudentCode(String studentCode) {
+        this.studentCode = studentCode;
+    }
+
+    public String getStudentName() {
+        return studentName;
+    }
+
+    public void setStudentName(String studentName) {
+        this.studentName = studentName;
+    }
+
+    public String getObjectiveScore() {
+        return objectiveScore;
+    }
+
+    public void setObjectiveScore(String objectiveScore) {
+        this.objectiveScore = objectiveScore;
+    }
+
+    public String getSubjectiveScore() {
+        return subjectiveScore;
+    }
+
+    public void setSubjectiveScore(String subjectiveScore) {
+        this.subjectiveScore = subjectiveScore;
+    }
+
+    public String getTotalScore() {
+        return totalScore;
+    }
+
+    public void setTotalScore(String totalScore) {
+        this.totalScore = totalScore;
+    }
+
+    public String getScoreDetail() {
+        return scoreDetail;
+    }
+
+    public void setScoreDetail(String scoreDetail) {
+        this.scoreDetail = scoreDetail;
+    }
+
+    public String getClazzName() {
+        return clazzName;
+    }
+
+    public void setClazzName(String clazzName) {
+        this.clazzName = clazzName;
+    }
+
+    public String getCollegeName() {
+        return collegeName;
+    }
+
+    public void setCollegeName(String collegeName) {
+        this.collegeName = collegeName;
+    }
+
+    public String getTeacherName() {
+        return teacherName;
+    }
+
+    public void setTeacherName(String teacherName) {
+        this.teacherName = teacherName;
+    }
+
+    public String getAssignScore() {
+        return assignScore;
+    }
+
+    public void setAssignScore(String assignScore) {
+        this.assignScore = assignScore;
+    }
+}

+ 14 - 0
src/main/java/com/qmth/eds/mapper/ExamAssignMapper.java

@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.eds.bean.dto.ExamAssignDto;
+import com.qmth.eds.bean.result.AssignResultPreviewResult;
 import com.qmth.eds.common.entity.ExamAssign;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Map;
+
 /**
  * <p>
  * 赋分管理 Mapper 接口
@@ -15,4 +18,15 @@ import org.apache.ibatis.annotations.Param;
 public interface ExamAssignMapper extends BaseMapper<ExamAssign> {
 
     IPage<ExamAssignDto> pageData(@Param("page") Page<ExamAssignDto> page, @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examTypeId") Long examTypeId, @Param("courseCode") String courseCode);
+
+    /**
+     * 赋分结果预览
+     *
+     * @param iPage
+     * @param collegeName
+     * @param clazzId
+     * @param teacherCode
+     * @return
+     */
+    IPage<AssignResultPreviewResult> assignResultPreview(IPage<Map> iPage, @Param("collegeName") String collegeName, @Param("clazzId") String clazzId, @Param("teacherCode") String teacherCode);
 }

+ 11 - 2
src/main/java/com/qmth/eds/service/ExamAssignService.java

@@ -3,7 +3,7 @@ package com.qmth.eds.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.eds.bean.dto.ExamAssignDto;
-import com.qmth.eds.common.entity.CloudMarkingScore;
+import com.qmth.eds.bean.result.AssignResultPreviewResult;
 import com.qmth.eds.common.entity.ExamAssign;
 
 import java.util.Map;
@@ -20,7 +20,16 @@ public interface ExamAssignService extends IService<ExamAssign> {
 
     boolean calcData(ExamAssign examAssign);
 
-    IPage<CloudMarkingScore> result(Long semesterId, Long examTypeId, String courseCode, String courseName, String formula, Integer pageNumber, Integer pageSize);
+    /**
+     * 赋分结果预览
+     *
+     * @param iPage
+     * @param collegeName
+     * @param clazzId
+     * @param teacherCode
+     * @return
+     */
+    IPage<AssignResultPreviewResult> assignResultPreview(IPage<Map> iPage, String collegeName, String clazzId, String teacherCode);
 
     Map contrast(Long semesterId, Long examTypeId, String courseCode);
 

+ 23 - 4
src/main/java/com/qmth/eds/service/impl/ExamAssignServiceImpl.java

@@ -5,13 +5,20 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.eds.bean.dto.ExamAssignDto;
+import com.qmth.eds.bean.result.AssignResultPreviewResult;
 import com.qmth.eds.common.contant.SystemConstant;
-import com.qmth.eds.common.entity.*;
+import com.qmth.eds.common.entity.ExamAssign;
+import com.qmth.eds.common.entity.ExamSyncStudent;
+import com.qmth.eds.common.entity.ExamSyncTotal;
+import com.qmth.eds.common.entity.SysUser;
 import com.qmth.eds.common.enums.ExamAssignStatusEnum;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
 import com.qmth.eds.common.util.ServletUtil;
 import com.qmth.eds.mapper.ExamAssignMapper;
-import com.qmth.eds.service.*;
+import com.qmth.eds.service.AsyncTaskService;
+import com.qmth.eds.service.ExamAssignService;
+import com.qmth.eds.service.ExamSyncStudentService;
+import com.qmth.eds.service.ExamSyncTotalService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -39,6 +46,9 @@ public class ExamAssignServiceImpl extends ServiceImpl<ExamAssignMapper, ExamAss
     @Resource
     AsyncTaskService asyncTaskService;
 
+    @Resource
+    ExamAssignMapper examAssignMapper;
+
     @Override
     public IPage<ExamAssignDto> pageData(Long semesterId, Long examTypeId, String courseCode, Integer pageNumber, Integer pageSize) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
@@ -89,9 +99,18 @@ public class ExamAssignServiceImpl extends ServiceImpl<ExamAssignMapper, ExamAss
         return true;
     }
 
+    /**
+     * 赋分结果预览
+     *
+     * @param iPage
+     * @param collegeName
+     * @param clazzId
+     * @param teacherCode
+     * @return
+     */
     @Override
-    public IPage<CloudMarkingScore> result(Long semesterId, Long examTypeId, String courseCode, String courseName, String formula, Integer pageNumber, Integer pageSize) {
-        return null;
+    public IPage<AssignResultPreviewResult> assignResultPreview(IPage<Map> iPage, String collegeName, String clazzId, String teacherCode) {
+        return examAssignMapper.assignResultPreview(iPage, collegeName, clazzId, teacherCode);
     }
 
     @Override

+ 46 - 0
src/main/resources/mapper/ExamAssignMapper.xml

@@ -23,4 +23,50 @@
             </if>
         </where>
     </select>
+
+    <select id="assignResultPreview" resultType="com.qmth.eds.bean.result.AssignResultPreviewResult">
+        select
+            ess.id,
+            ess.kch as courseCode,
+            ess.kcmc as courseName,
+            ess.xh as studentCode,
+            ess.xsxm as studentName,
+            cms.objective_score as objectiveScore,
+            cms.subjective_score as subjectiveScore,
+            cms.total_score as totalScore,
+            group_concat(cms.objective_score_detail, CONCAT('|', cms.subjective_score_detail)) as scoreDetail,
+            ess.jxbmc as clazzName,
+            ess.jgmc as collegeName,
+            ess.xm as teacherName,
+            cms.assign_score as assignScore
+        from
+            exam_sync_student ess
+                join cloud_marking_score cms on
+                cms.exam_sync_student_id = ess.id
+        <where>
+            <if test="collegeName != null and collegeName != ''">
+                and ecm.jgmc = #{collegeName}
+            </if>
+            <if test="clazzId != null and clazzId != ''">
+                and ecm.jxb_id = #{clazzId}
+            </if>
+            <if test="teacherCode != null and teacherCode != ''">
+                and ecm.jgh = #{teacherCode}
+            </if>
+        </where>
+        group by
+            ess.id,
+            ess.kch,
+            ess.kcmc,
+            ess.xh,
+            ess.xsxm,
+            cms.objective_score,
+            cms.subjective_score,
+            cms.total_score,
+            ess.jxbmc,
+            ess.jgmc,
+            ess.xm,
+            cms.assign_score
+        order by ess.xh
+    </select>
 </mapper>

+ 1 - 1
src/main/resources/mapper/ExamSyncStudentMapper.xml

@@ -39,7 +39,7 @@
                             #{subjectCode}
                         </foreach>
                     </if>
-                    and ess.xh = cms.student_code
+                    and ess.id = cms.exam_sync_student_id
                 </where>)
         </where>
         order by ess.jgmc