Ver código fonte

Merge remote-tracking branch 'origin/dev' into pre

dzx 11 meses atrás
pai
commit
67ea8d1525
27 arquivos alterados com 1339 adições e 7 exclusões
  1. 3 0
      src/main/java/com/xjrsoft/module/student/service/impl/PbVXsxxsfytbServiceImpl.java
  2. 35 0
      src/main/java/com/xjrsoft/module/veb/util/ImportExcelUtil.java
  3. 3 0
      src/main/java/com/xjrsoft/module/xycxedu/controller/ExamPlanController.java
  4. 53 1
      src/main/java/com/xjrsoft/module/xycxedu/controller/ExamSubjectScoreController.java
  5. 130 0
      src/main/java/com/xjrsoft/module/xycxedu/controller/ExamSubjectScoreEnterController.java
  6. 42 0
      src/main/java/com/xjrsoft/module/xycxedu/dto/AddExamSubjectScoreEnterDto.java
  7. 29 0
      src/main/java/com/xjrsoft/module/xycxedu/dto/ExamSubjectScoreEnterDto.java
  8. 52 0
      src/main/java/com/xjrsoft/module/xycxedu/dto/ExamSubjectScoreEnterImportDto.java
  9. 30 0
      src/main/java/com/xjrsoft/module/xycxedu/dto/ExamSubjectScoreEnterPageDto.java
  10. 34 0
      src/main/java/com/xjrsoft/module/xycxedu/dto/UpdateExamSubjectScoreDto.java
  11. 24 0
      src/main/java/com/xjrsoft/module/xycxedu/dto/UpdateExamSubjectScoreEnterDto.java
  12. 7 1
      src/main/java/com/xjrsoft/module/xycxedu/entity/ExamSubjectScore.java
  13. 98 0
      src/main/java/com/xjrsoft/module/xycxedu/entity/ExamSubjectScoreEnter.java
  14. 24 0
      src/main/java/com/xjrsoft/module/xycxedu/mapper/ExamSubjectScoreEnterMapper.java
  15. 33 0
      src/main/java/com/xjrsoft/module/xycxedu/service/IExamSubjectScoreEnterService.java
  16. 10 0
      src/main/java/com/xjrsoft/module/xycxedu/service/IExamSubjectScoreService.java
  17. 322 0
      src/main/java/com/xjrsoft/module/xycxedu/service/impl/ExamSubjectScoreEnterServiceImpl.java
  18. 61 0
      src/main/java/com/xjrsoft/module/xycxedu/service/impl/ExamSubjectScoreServiceImpl.java
  19. 1 1
      src/main/java/com/xjrsoft/module/xycxedu/util/DataUtil.java
  20. 57 0
      src/main/java/com/xjrsoft/module/xycxedu/vo/ExamSubjectScoreEnterImportVo.java
  21. 69 0
      src/main/java/com/xjrsoft/module/xycxedu/vo/ExamSubjectScoreEnterPageVo.java
  22. 69 0
      src/main/java/com/xjrsoft/module/xycxedu/vo/ExamSubjectScoreEnterStudentVo.java
  23. 79 0
      src/main/java/com/xjrsoft/module/xycxedu/vo/ExamSubjectScoreEnterVo.java
  24. 4 1
      src/main/java/com/xjrsoft/module/xycxedu/vo/ExamSubjectScorePageVo.java
  25. 41 0
      src/main/resources/mapper/xycxedu/ExamSubjectScoreEnterMappper.xml
  26. 3 3
      src/main/resources/mapper/xycxedu/ExamSubjectScoreMappper.xml
  27. 26 0
      src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java

+ 3 - 0
src/main/java/com/xjrsoft/module/student/service/impl/PbVXsxxsfytbServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.enums.ArchivesStatusEnum;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseClass;
@@ -141,6 +142,8 @@ public class PbVXsxxsfytbServiceImpl extends MPJBaseServiceImpl<PbVXsxxsfytbMapp
                 .eq(dto.getSemesterId() != null && dto.getSemesterId() > 0, PbSemesterConfig::getBaseSemesterId, dto.getSemesterId())
                 .like(dto.getJfzt() != null && !"".equals(dto.getJfzt()), PbVXsxxsfytb::getJfzt, dto.getJfzt())
                 .eq(dto.getTeacherId() != null, BaseClass::getTeacherId, dto.getTeacherId())
+                .eq(BaseStudentSchoolRoll::getArchivesStatus, ArchivesStatusEnum.FB2901.getCode())
+                .eq("t1.delete_mark",0)
                 .leftJoin(XjrUser.class, XjrUser::getCredentialNumber, PbVXsxxsfytb::getPersonalid)
                 .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, XjrUser::getId)
                 .leftJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)

+ 35 - 0
src/main/java/com/xjrsoft/module/veb/util/ImportExcelUtil.java

@@ -374,4 +374,39 @@ public class ImportExcelUtil {
         }
         return false; // 所有必需字段都不为空
     }
+
+
+    public static List<ImportConfig> getAllFieldCN(Class<?> clazz) {
+        List<ImportConfig> importConfigs = new ArrayList<>();
+
+        Field[] fields = clazz.getDeclaredFields();
+
+        int index = 0;
+        for (int i = 0; i < fields.length; i++) {
+            Field field = fields[i];
+            ImportConfig importConfig = new ImportConfig();
+            field.setAccessible(true); // 访问私有字段
+            if (field.isAnnotationPresent(Required.class)) {
+                Required required = field.getAnnotation(Required.class);
+                boolean value = required.value();
+                importConfig.setRequired(value);
+            }
+
+            if (field.isAnnotationPresent(ExcelProperty.class)) {
+                ExcelProperty excelProperty = field.getAnnotation(ExcelProperty.class);
+                String[] annotationValues = excelProperty.value();
+                importConfig.setLabel(annotationValues.length > 0 ? annotationValues[0] : "");
+            }
+
+            if (field.isAnnotationPresent(ExcelIgnore.class)) {
+                continue;
+            }
+            importConfig.setFieldName(field.getName());
+            importConfig.setSortCode(index++);
+            importConfig.setWidth(0);
+            importConfigs.add(importConfig);
+        }
+
+        return importConfigs;
+    }
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/xycxedu/controller/ExamPlanController.java

@@ -76,6 +76,9 @@ public class ExamPlanController {
         IPage<ExamPlanPageVo> page = examPlanService.selectJoinListPage(ConventPage.getPage(dto), ExamPlanPageVo.class, queryWrapper);
         PageOutput<ExamPlanPageVo> pageOutput = ConventPage.getPageOutput(page, ExamPlanPageVo.class);
         for (ExamPlanPageVo record : pageOutput.getList()) {
+            if(StrUtil.isEmpty(record.getMilexamids())){
+                continue;
+            }
             String[] split = record.getMilexamids().split(",");
             List<Long> milexamids = Arrays.asList(split).stream()
                     .map(Long::parseLong)

+ 53 - 1
src/main/java/com/xjrsoft/module/xycxedu/controller/ExamSubjectScoreController.java

@@ -1,21 +1,36 @@
 package com.xjrsoft.module.xycxedu.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.annotation.XjrLog;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.xycxedu.dto.AddExamSubjectScoreEnterDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.dto.UpdateExamSubjectScoreDto;
+import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
 import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreService;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.List;
 
 /**
 * @title: 考试计划维护
@@ -34,7 +49,8 @@ public class ExamSubjectScoreController {
 
     @GetMapping(value = "/page")
     @ApiOperation(value="考试成绩查询(分页)")
-    @SaCheckPermission("examplan:detail")
+    @SaCheckPermission("examsubjectscore:detail")
+    @XjrLog("查询考试成绩")
     public RT<PageOutput<ExamSubjectScorePageVo>> page(@Valid ExamSubjectScoreDto dto){
         Page<ExamSubjectScorePageVo> page = scoreService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         PageOutput<ExamSubjectScorePageVo> pageOutput = ConventPage.getPageOutput(page, ExamSubjectScorePageVo.class);
@@ -42,4 +58,40 @@ public class ExamSubjectScoreController {
     }
 
 
+    @GetMapping(value = "/enter-list")
+    @ApiOperation(value="根据录入id考试成绩查询")
+    @SaCheckPermission("examsubjectscore:enter-list")
+    @XjrLog("根据录入id查询考试成绩")
+    public RT<List<ExamSubjectScoreEnterImportVo>> enterList(@Valid ExamSubjectScoreEnterDto dto){
+        List<ExamSubjectScoreEnterImportVo> result = scoreService.getEnterScoreStudentList(dto);
+        return RT.ok(result);
+    }
+
+    @GetMapping(value = "/enter-page")
+    @ApiOperation(value="根据录入id考试成绩查询(分页)")
+    @SaCheckPermission("examsubjectscore:enter-page")
+    @XjrLog("根据录入id查询考试成绩")
+    public RT<PageOutput<ExamSubjectScoreEnterImportVo>> enterPage(@Valid ExamSubjectScoreEnterDto dto){
+        PageOutput<ExamSubjectScoreEnterImportVo> result = scoreService.getEnterScoreStudentPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        return RT.ok(result);
+    }
+
+
+    @PutMapping
+    @ApiOperation(value = "修改学生成绩")
+    @SaCheckPermission("examsubjectscore:update")
+    @XjrLog("修改学生成绩")
+    public RT<Boolean> add(@Valid @RequestBody List<UpdateExamSubjectScoreDto> dtoList){
+        for (UpdateExamSubjectScoreDto dto : dtoList) {
+            ExamSubjectScore subjectScore = scoreService.getById(dto.getId());
+            subjectScore.setScore(dto.getScore());
+            subjectScore.setClassRanking(dto.getClassRanking());
+            subjectScore.setGradeRanking(dto.getGradeRanking());
+            scoreService.updateById(subjectScore);
+        }
+
+        return RT.ok(true);
+    }
+
+
 }

+ 130 - 0
src/main/java/com/xjrsoft/module/xycxedu/controller/ExamSubjectScoreEnterController.java

@@ -0,0 +1,130 @@
+package com.xjrsoft.module.xycxedu.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.excel.support.ExcelTypeEnum;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.model.result.RT;
+import com.xjrsoft.common.page.ConventPage;
+import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.base.service.IBaseClassService;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.xycxedu.dto.AddExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterPageDto;
+import com.xjrsoft.module.xycxedu.dto.UpdateExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
+import com.xjrsoft.module.xycxedu.entity.ExamSubjectScoreEnter;
+import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreEnterService;
+import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreService;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterPageVo;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+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 javax.validation.Valid;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+* @title: 成绩录入
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@RestController
+@RequestMapping("/xycxedu" + "/examSubjectScoreEnter")
+@Api(value = "/xycxedu"  + "/examSubjectScoreEnter",tags = "成绩录入代码")
+@AllArgsConstructor
+public class ExamSubjectScoreEnterController {
+
+    private final IExamSubjectScoreEnterService enterService;
+
+    private final IBaseClassService classService;
+
+    @GetMapping(value = "/page")
+    @ApiOperation(value="成绩录入列表(分页)")
+    @SaCheckPermission("examsubjectscoreenter:detail")
+    public RT<PageOutput<ExamSubjectScoreEnterPageVo>> page(@Valid ExamSubjectScoreEnterPageDto dto){
+
+        Page<ExamSubjectScoreEnterPageVo> page = enterService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        PageOutput<ExamSubjectScoreEnterPageVo> pageOutput = ConventPage.getPageOutput(page, ExamSubjectScoreEnterPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
+    @GetMapping(value = "/info")
+    @ApiOperation(value="根据id查询成绩录入信息")
+    @SaCheckPermission("examsubjectscoreenter:detail")
+    public RT<ExamSubjectScoreEnterVo> info(@RequestParam Long id){
+        ExamSubjectScoreEnterVo examSubjectScoreEnter = enterService.getInfo(id);
+        if (examSubjectScoreEnter == null) {
+           return RT.error("找不到此数据!");
+        }
+        List<String> classIds = Arrays.asList(examSubjectScoreEnter.getClassIds().split(","));
+        List<BaseClass> classList = classService.listByIds(classIds);
+
+        examSubjectScoreEnter.setClassList(classList);
+
+        return RT.ok(examSubjectScoreEnter);
+    }
+
+
+    @PostMapping
+    @ApiOperation(value = "新增成绩录入")
+    @SaCheckPermission("examsubjectscoreenter:add")
+    public RT<Boolean> add(@Valid @RequestBody AddExamSubjectScoreEnterDto dto){
+        Boolean isSuccess = enterService.save(dto);
+        return RT.ok(isSuccess);
+    }
+
+    @PutMapping
+    @ApiOperation(value = "修改成绩录入")
+    @SaCheckPermission("examsubjectscoreenter:edit")
+    public RT<Boolean> update(@Valid @RequestBody UpdateExamSubjectScoreEnterDto dto){
+
+        ExamSubjectScoreEnter examSubjectScoreEnter = BeanUtil.toBean(dto, ExamSubjectScoreEnter.class);
+        examSubjectScoreEnter.setModifyDate(new Date());
+        return RT.ok(enterService.updateById(examSubjectScoreEnter));
+
+    }
+
+    @DeleteMapping
+    @ApiOperation(value = "删除成绩录入")
+    @SaCheckPermission("examsubjectscoreenter:delete")
+    public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
+        return RT.ok(enterService.removeBatchByIds(ids));
+
+    }
+    @PostMapping("/import")
+    @ApiOperation(value = "导入")
+    public RT<Boolean> importData(@RequestParam Long id, @RequestParam MultipartFile file) throws IOException {
+        Boolean result = enterService.importData(id, file);
+        return RT.ok(result);
+    }
+
+    @PostMapping("/export-query")
+    @ApiOperation(value = "下载模板")
+    public ResponseEntity<byte[]> exportData(@Valid @RequestBody ExamSubjectScoreEnterDto dto) throws IOException {
+
+        byte[] bytes = enterService.downloadTemplate(dto);
+        return RT.fileStream(bytes, "ExamSubjectScoreEnter" + ExcelTypeEnum.XLSX.getValue());
+    }
+}

+ 42 - 0
src/main/java/com/xjrsoft/module/xycxedu/dto/AddExamSubjectScoreEnterDto.java

@@ -0,0 +1,42 @@
+package com.xjrsoft.module.xycxedu.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+* @title: 成绩录入
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@Data
+public class AddExamSubjectScoreEnterDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 科目id
+    */
+    @ApiModelProperty("科目id")
+    private Long courseSubjectId;
+    /**
+    * 考试计划id
+    */
+    @ApiModelProperty("考试计划id")
+    private Long examPlanId;
+    /**
+    * 学期id
+    */
+    @ApiModelProperty("学期id")
+    private Long semesterId;
+    /**
+    * 班级id
+    */
+    @ApiModelProperty("班级id")
+    private List<Long> classIds;
+
+}

+ 29 - 0
src/main/java/com/xjrsoft/module/xycxedu/dto/ExamSubjectScoreEnterDto.java

@@ -0,0 +1,29 @@
+package com.xjrsoft.module.xycxedu.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ExamSubjectScoreEnterDto extends PageInput{
+    private static final long serialVersionUID = 1L;
+    /**
+     * 用户ID(xjr_user)
+     */
+    @ApiModelProperty("班级")
+    private Long classId;
+
+    @ApiModelProperty("学生姓名")
+    private String studentName;
+
+    @ApiModelProperty("身份证号")
+    private String credentialNumber;
+
+    @ApiModelProperty("是否已录入(1:是 0:否)")
+    private Integer isEnter;
+
+    @ApiModelProperty("录入id")
+    private Long examSubjectScoreEnterId;
+}

+ 52 - 0
src/main/java/com/xjrsoft/module/xycxedu/dto/ExamSubjectScoreEnterImportDto.java

@@ -0,0 +1,52 @@
+package com.xjrsoft.module.xycxedu.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.xjrsoft.common.annotation.Required;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+* @title: 成绩录入
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@Data
+public class ExamSubjectScoreEnterImportDto {
+
+
+    @ExcelProperty("班级")
+    @ApiModelProperty("班级")
+    @Required
+    private String className;
+
+    @ExcelProperty("学生姓名")
+    @ApiModelProperty("学生姓名")
+    @Required
+    private String studentName;
+
+    @ExcelProperty("学生身份证")
+    @ApiModelProperty("学生身份证")
+    @Required
+    private String credentialNumber;
+
+    @ExcelProperty("科目")
+    @ApiModelProperty("科目")
+    @Required
+    private String courseSubjectName;
+
+    @ExcelProperty("成绩")
+    @ApiModelProperty("成绩")
+    @Required
+    private String score;
+
+    @ExcelProperty("班级排名")
+    @ApiModelProperty("班级排名")
+    private Integer classRanking;
+
+    @ExcelProperty("年级排名")
+    @ApiModelProperty("年级排名")
+    private Integer gradeRanking;
+
+}

+ 30 - 0
src/main/java/com/xjrsoft/module/xycxedu/dto/ExamSubjectScoreEnterPageDto.java

@@ -0,0 +1,30 @@
+package com.xjrsoft.module.xycxedu.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+/**
+* @title: 成绩录入分页查询入参
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ExamSubjectScoreEnterPageDto extends PageInput {
+
+    @ApiModelProperty("科目名称")
+    private String courseSubjectName;
+
+    @ApiModelProperty("学期")
+    private Long semesterId;
+
+    @ApiModelProperty("班级名称")
+    private String className;
+
+    @ApiModelProperty("考试计划")
+    private String examPlanName;
+}

+ 34 - 0
src/main/java/com/xjrsoft/module/xycxedu/dto/UpdateExamSubjectScoreDto.java

@@ -0,0 +1,34 @@
+package com.xjrsoft.module.xycxedu.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+* @title: 考试计划维护
+* @Author dzx
+* @Date: 2024-07-18
+* @Version 1.0
+*/
+@Data
+public class UpdateExamSubjectScoreDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 
+    */
+    @ApiModelProperty("主键id")
+    private Long id;
+
+    @ApiModelProperty("分数")
+    private Float score;
+
+    @ApiModelProperty("班级排名")
+    private Integer classRanking;
+
+    @ApiModelProperty("年级排名")
+    private Integer gradeRanking;
+}

+ 24 - 0
src/main/java/com/xjrsoft/module/xycxedu/dto/UpdateExamSubjectScoreEnterDto.java

@@ -0,0 +1,24 @@
+package com.xjrsoft.module.xycxedu.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+
+/**
+* @title: 成绩录入
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@Data
+public class UpdateExamSubjectScoreEnterDto extends AddExamSubjectScoreEnterDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 主键
+    */
+    @ApiModelProperty("主键")
+    private Long id;
+}

+ 7 - 1
src/main/java/com/xjrsoft/module/xycxedu/entity/ExamSubjectScore.java

@@ -86,7 +86,7 @@ public class ExamSubjectScore implements Serializable {
     private Long userId;
 
     @ApiModelProperty("分数")
-    private Integer score;
+    private Float score;
 
     @ApiModelProperty("班级排名")
     private Integer classRanking;
@@ -94,4 +94,10 @@ public class ExamSubjectScore implements Serializable {
     @ApiModelProperty("年级排名")
     private Integer gradeRanking;
 
+    @ApiModelProperty("录入id")
+    private Long examSubjectScoreEnterId;
+
+    @ApiModelProperty("考试计划id")
+    private Long examPlanId;
+
 }

+ 98 - 0
src/main/java/com/xjrsoft/module/xycxedu/entity/ExamSubjectScoreEnter.java

@@ -0,0 +1,98 @@
+package com.xjrsoft.module.xycxedu.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+* @title: 成绩录入
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@Data
+@TableName("exam_subject_score_enter")
+@ApiModel(value = "exam_subject_score_enter", description = "成绩录入")
+public class ExamSubjectScoreEnter implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 主键
+    */
+    @ApiModelProperty("主键")
+    @TableId
+    private Long id;
+    /**
+    * 创建人
+    */
+    @ApiModelProperty("创建人")
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUserId;
+    /**
+    * 创建时间
+    */
+    @ApiModelProperty("创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createDate;
+    /**
+    * 修改人id
+    */
+    @ApiModelProperty("修改人id")
+    @TableField(fill = FieldFill.UPDATE)
+    private Long modifyUserId;
+    /**
+    * 修改日期
+    */
+    @ApiModelProperty("修改日期")
+    @TableField(fill = FieldFill.UPDATE)
+    private Date modifyDate;
+    /**
+    * 删除标记
+    */
+    @ApiModelProperty("删除标记")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleteMark;
+    /**
+    * 有效标记
+    */
+    @ApiModelProperty("有效标记")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer enabledMark;
+    /**
+    * 科目id
+    */
+    @ApiModelProperty("科目id")
+    private Long courseSubjectId;
+    /**
+    * 科目名称
+    */
+    @ApiModelProperty("科目名称")
+    private String coursename;
+    /**
+    * 考试计划id
+    */
+    @ApiModelProperty("考试计划id")
+    private Long examPlanId;
+    /**
+    * 学期id
+    */
+    @ApiModelProperty("学期id")
+    private Long semesterId;
+    /**
+    * 班级id
+    */
+    @ApiModelProperty("班级id")
+    private String classIds;
+
+}

+ 24 - 0
src/main/java/com/xjrsoft/module/xycxedu/mapper/ExamSubjectScoreEnterMapper.java

@@ -0,0 +1,24 @@
+package com.xjrsoft.module.xycxedu.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterPageDto;
+import com.xjrsoft.module.xycxedu.entity.ExamSubjectScoreEnter;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterPageVo;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+* @title: 成绩录入
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@Mapper
+public interface ExamSubjectScoreEnterMapper extends MPJBaseMapper<ExamSubjectScoreEnter> {
+
+    Page<ExamSubjectScoreEnterPageVo> getPage(Page<ExamSubjectScoreEnterPageVo> page, @Param("dto")ExamSubjectScoreEnterPageDto dto);
+
+    ExamSubjectScoreEnterVo getInfo(@Param("id") Long id);
+}

+ 33 - 0
src/main/java/com/xjrsoft/module/xycxedu/service/IExamSubjectScoreEnterService.java

@@ -0,0 +1,33 @@
+package com.xjrsoft.module.xycxedu.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.xycxedu.dto.AddExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterPageDto;
+import com.xjrsoft.module.xycxedu.entity.ExamSubjectScoreEnter;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterPageVo;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterVo;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+
+/**
+* @title: 成绩录入
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+
+public interface IExamSubjectScoreEnterService extends MPJBaseService<ExamSubjectScoreEnter> {
+
+    Boolean importData(Long id, MultipartFile file) throws IOException;
+
+    Boolean save(AddExamSubjectScoreEnterDto dto);
+
+    Page<ExamSubjectScoreEnterPageVo> getPage(Page<ExamSubjectScoreEnterPageVo> page, ExamSubjectScoreEnterPageDto dto);
+
+    ExamSubjectScoreEnterVo getInfo(Long id);
+
+    byte[] downloadTemplate(ExamSubjectScoreEnterDto dto) throws IOException;
+}

+ 10 - 0
src/main/java/com/xjrsoft/module/xycxedu/service/IExamSubjectScoreService.java

@@ -2,12 +2,17 @@ package com.xjrsoft.module.xycxedu.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
 import com.xjrsoft.module.xycxedu.vo.ExamStatisticsPageVo;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
 
+import java.util.List;
+
 /**
  * @title: 晓羊策学考试计划表
  * @Author dzx
@@ -22,4 +27,9 @@ public interface IExamSubjectScoreService extends MPJBaseService<ExamSubjectScor
     Page<ExamSubjectScorePageVo> getPage(Page<ExamSubjectScorePageVo> page, ExamSubjectScoreDto dto);
 
     Page<ExamStatisticsPageVo> getStatisticsPage(Page<ExamStatisticsPageVo> page, ExamStatisticsPageDto dto);
+
+
+    List<ExamSubjectScoreEnterImportVo> getEnterScoreStudentList(ExamSubjectScoreEnterDto dto);
+
+    PageOutput<ExamSubjectScoreEnterImportVo> getEnterScoreStudentPage(Page<ExamSubjectScoreEnterImportVo> page, ExamSubjectScoreEnterDto dto);
 }

+ 322 - 0
src/main/java/com/xjrsoft/module/xycxedu/service/impl/ExamSubjectScoreEnterServiceImpl.java

@@ -0,0 +1,322 @@
+package com.xjrsoft.module.xycxedu.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.excel.EasyExcel;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.enums.ArchivesStatusEnum;
+import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.base.entity.BaseCourseSubject;
+import com.xjrsoft.module.base.service.IBaseCourseSubjectService;
+import com.xjrsoft.module.generator.entity.ImportConfig;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.service.IUserService;
+import com.xjrsoft.module.student.entity.BaseStudent;
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.veb.util.ImportExcelUtil;
+import com.xjrsoft.module.xycxedu.dto.AddExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterImportDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterPageDto;
+import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
+import com.xjrsoft.module.xycxedu.entity.ExamSubjectScoreEnter;
+import com.xjrsoft.module.xycxedu.mapper.ExamSubjectScoreEnterMapper;
+import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreEnterService;
+import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreService;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterPageVo;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterVo;
+import lombok.AllArgsConstructor;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.FillPatternType;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.VerticalAlignment;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+* @title: 成绩录入
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@Service
+@AllArgsConstructor
+public class ExamSubjectScoreEnterServiceImpl extends MPJBaseServiceImpl<ExamSubjectScoreEnterMapper, ExamSubjectScoreEnter> implements IExamSubjectScoreEnterService {
+
+    private final IBaseCourseSubjectService courseSubjectService;
+    private final IUserService userService;
+    private final IExamSubjectScoreService scoreService;
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean importData(Long id, MultipartFile file) throws IOException {
+        ExamSubjectScoreEnter enter = this.getById(id);
+        List<ExamSubjectScoreEnterImportDto> dataList = EasyExcel.read(file.getInputStream()).headRowNumber(3).head(ExamSubjectScoreEnterImportDto.class).sheet().doReadSync();
+        List<BaseCourseSubject> classList = courseSubjectService.list(
+                new QueryWrapper<BaseCourseSubject>().lambda()
+                        .eq(BaseCourseSubject::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+        Map<Long, String> courseSubjectMaps = classList.stream().collect(Collectors.toMap(BaseCourseSubject::getId, BaseCourseSubject::getName));
+
+        List<String> credentialNumbers = dataList.stream().filter(x -> StrUtil.isNotEmpty(x.getCredentialNumber())).map(ExamSubjectScoreEnterImportDto::getCredentialNumber).collect(Collectors.toList());
+        if(credentialNumbers.isEmpty()){
+            return true;
+        }
+        List<User> userList = userService.list(
+                new QueryWrapper<User>().lambda()
+                        .eq(User::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .in(User::getCredentialNumber, credentialNumbers)
+        );
+        Map<String, Long> userMaps = userList.stream().collect(Collectors.toMap(User::getCredentialNumber, User::getId));
+
+        List<ExamSubjectScore> scoreList = scoreService.list(
+                new QueryWrapper<ExamSubjectScore>().lambda()
+                        .eq(ExamSubjectScore::getExamSubjectScoreEnterId, enter.getId())
+                        .eq(ExamSubjectScore::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+
+        Map<Long, ExamSubjectScore> listMap = scoreList.stream().collect(Collectors.toMap(ExamSubjectScore::getUserId, x -> x));
+
+        List<ExamSubjectScore> updateList = new ArrayList<>();
+        for (ExamSubjectScoreEnterImportDto importVo : dataList) {
+            Long userId = userMaps.get(importVo.getCredentialNumber());
+            ExamSubjectScore examSubjectScores = listMap.get(userId);
+            examSubjectScores.setCourseSubjectId(enter.getCourseSubjectId());
+            examSubjectScores.setScore(importVo.getScore()==null?null:Float.parseFloat(importVo.getScore()));
+            examSubjectScores.setSemesterId(enter.getSemesterId());
+            examSubjectScores.setExamSubjectScoreEnterId(enter.getId());
+            examSubjectScores.setSemesterId(enter.getSemesterId());
+            examSubjectScores.setClassRanking(importVo.getClassRanking());
+            examSubjectScores.setGradeRanking(importVo.getGradeRanking());
+            examSubjectScores.setCoursename(courseSubjectMaps.get(enter.getCourseSubjectId()));
+            examSubjectScores.setMilexamid(enter.getExamPlanId());
+            updateList.add(examSubjectScores);
+        }
+
+        if(!updateList.isEmpty()){
+            scoreService.updateBatchById(updateList);
+        }
+
+        return true;
+    }
+
+    @Override
+    public Boolean save(AddExamSubjectScoreEnterDto dto) {
+        ExamSubjectScoreEnter examSubjectScoreEnter = BeanUtil.toBean(dto, ExamSubjectScoreEnter.class);
+        examSubjectScoreEnter.setCreateDate(new Date());
+        String classIds = dto.getClassIds().toString().replace("[", "").replace("]", "").replace(" ", "");
+        examSubjectScoreEnter.setClassIds(classIds);
+        BaseCourseSubject courseSubject = courseSubjectService.getById(examSubjectScoreEnter.getCourseSubjectId());
+        examSubjectScoreEnter.setCoursename(courseSubject.getName());
+        boolean isSuccess = this.save(examSubjectScoreEnter);
+        List<User> userList = userService.list(
+                new MPJLambdaWrapper<User>()
+                        .select(User::getId)
+                        .select(User.class, x -> VoToColumnUtil.fieldsToColumns(User.class).contains(x.getProperty()))
+                        .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, User::getId)
+                        .innerJoin(BaseStudent.class, BaseStudent::getUserId, User::getId)
+                        .eq(BaseStudentSchoolRoll::getArchivesStatus, ArchivesStatusEnum.FB2901.getCode())
+                        .eq(BaseStudent::getIsNormal, 1)
+                        .in(BaseStudentSchoolRoll::getClassId, dto.getClassIds())
+        );
+        List<ExamSubjectScore> insertList = new ArrayList<>();
+        for (User importVo : userList) {
+            insertList.add(
+                    new ExamSubjectScore(){{
+                        setCreateDate(new Date());
+                        setExamSubjectScoreEnterId(examSubjectScoreEnter.getId());
+                        setUserId(importVo.getId());
+                        setSemesterId(examSubjectScoreEnter.getSemesterId());
+                        setCourseSubjectId(examSubjectScoreEnter.getCourseSubjectId());
+                        setCoursename(examSubjectScoreEnter.getCoursename());
+                        setExamPlanId(examSubjectScoreEnter.getExamPlanId());
+                    }}
+            );
+        }
+
+        if(!insertList.isEmpty()){
+            scoreService.remove(new QueryWrapper<ExamSubjectScore>().lambda().eq(ExamSubjectScore::getExamSubjectScoreEnterId, examSubjectScoreEnter.getId()));
+
+            scoreService.saveBatch(insertList);
+        }
+        return isSuccess;
+    }
+
+    @Override
+    public Page<ExamSubjectScoreEnterPageVo> getPage(Page<ExamSubjectScoreEnterPageVo> page, ExamSubjectScoreEnterPageDto dto) {
+        return this.baseMapper.getPage(page, dto);
+    }
+
+    @Override
+    public ExamSubjectScoreEnterVo getInfo(Long id) {
+        return this.baseMapper.getInfo(id);
+    }
+
+    @Override
+    public byte[] downloadTemplate(ExamSubjectScoreEnterDto dto) throws IOException {
+        ExamSubjectScoreEnter scoreEnter = this.getById(dto.getExamSubjectScoreEnterId());
+        BaseCourseSubject courseSubject = courseSubjectService.getById(scoreEnter.getCourseSubjectId());
+
+        List<ExamSubjectScoreEnterImportVo> result = scoreService.getEnterScoreStudentList(new ExamSubjectScoreEnterDto(){{
+            setExamSubjectScoreEnterId(dto.getExamSubjectScoreEnterId());
+        }});
+        List<ArrayList<String>> dataList = new ArrayList<>();
+        for (ExamSubjectScoreEnterImportVo recordVo : result) {
+            ArrayList<String> data = new ArrayList<>();
+            data.add(recordVo.getClassName());
+            data.add(recordVo.getStudentName());
+            data.add(recordVo.getCredentialNumber());
+            data.add(courseSubject.getName());
+            data.add(recordVo.getScore());
+            data.add(recordVo.getClassRanking()==null?"":recordVo.getClassRanking() + "");
+            data.add(recordVo.getGradeRanking()==null?"":recordVo.getGradeRanking() + "");
+            dataList.add(data);
+        }
+
+        Workbook workbook = new XSSFWorkbook();
+        // 创建一个工作表(sheet)
+        String sheetName = "数据";
+        Sheet sheet = workbook.createSheet(sheetName);
+
+        createFirstTitle(workbook, sheet);
+        createSecondTitle(workbook, sheet);
+        createThirdTitle(workbook, sheet, ExamSubjectScoreEnterImportVo.class);
+
+        int dataRowNumber = 3;
+
+        for (ArrayList<String> rowData : dataList) {
+            Row dataRow = sheet.createRow(dataRowNumber);
+            for (int i = 0; i < rowData.size(); i ++){
+                String content = rowData.get(i);
+                Font font = workbook.createFont();
+                font.setBold(false);// 设置为粗体
+                font.setFontName("宋体");
+                font.setFontHeightInPoints((short)12);
+
+                CellStyle cellStyle = workbook.createCellStyle();
+                cellStyle.setFont(font); // 将字体应用到样式
+                cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+                Cell row1cell2 = dataRow.createCell(i);
+                row1cell2.setCellValue(content);
+                row1cell2.setCellStyle(cellStyle);
+            }
+
+            dataRowNumber ++;
+        }
+
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+        workbook.write(bot);
+        return bot.toByteArray();
+    }
+
+    void createFirstTitle(Workbook workbook, Sheet sheet) {
+        int rowNumber = 0;
+        Font font = workbook.createFont();
+        font.setBold(true);// 设置为粗体
+        font.setFontName("宋体");
+//        font.setColor(IndexedColors.RED.getIndex()); // 设置字体颜色为红色
+        font.setFontHeightInPoints((short)24);
+
+        CellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setFont(font); // 将字体应用到样式
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+
+        Row row = sheet.createRow(rowNumber);
+        //合并第一行的列
+        sheet.addMergedRegion(new CellRangeAddress(rowNumber, rowNumber, 0, 6));
+
+        //3、处理表头
+        String title1 = "学生成绩导入模板";
+        // 创建单元格并设置值
+        Cell cell = row.createCell(0);
+        cell.setCellValue(title1);
+        cell.setCellStyle(cellStyle);
+    }
+
+    void createSecondTitle(Workbook workbook, Sheet sheet) {
+        int rowNumber = 1;
+        Font font = workbook.createFont();
+        font.setBold(true);// 设置为粗体
+        font.setFontName("宋体");
+        font.setColor(IndexedColors.RED.getIndex()); // 设置字体颜色为红色
+        font.setFontHeightInPoints((short)12);
+
+        CellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setFont(font); // 将字体应用到样式
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+
+        Row row = sheet.createRow(rowNumber);
+        //合并第一行的列
+        sheet.addMergedRegion(new CellRangeAddress(rowNumber, rowNumber, 0, 6));
+
+        //3、处理表头
+        String title1 = "说明:导入的学生信息必须保证与系统现有信息一致,导入时请将示例数据删除,避免导入失败!黄底红字为必填项,白底黑字为非必填项;";
+        // 创建单元格并设置值
+        Cell cell = row.createCell(0);
+        cell.setCellValue(title1);
+        cell.setCellStyle(cellStyle);
+    }
+
+    void createThirdTitle(Workbook workbook, Sheet sheet, Class<?> clazz) {
+        int rowNumber = 2;
+        Font font = workbook.createFont();
+        font.setFontName("宋体");
+        font.setFontHeightInPoints((short)12);
+
+        CellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setFont(font); // 将字体应用到样式
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+
+        Font font2 = workbook.createFont();
+        font2.setFontName("宋体");
+        font2.setFontHeightInPoints((short)12);
+        font2.setColor(IndexedColors.RED.getIndex()); // 设置字体颜色为红色
+        CellStyle cellStyle2 = workbook.createCellStyle();
+        cellStyle2.setFont(font2); // 将字体应用到样式
+        cellStyle2.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle2.setAlignment(HorizontalAlignment.CENTER);
+        cellStyle2.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
+        cellStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND);//设置填充模式
+
+        Row row1 = sheet.createRow(rowNumber);
+        List<ImportConfig> importConfigs = ImportExcelUtil.getAllFieldCN(clazz);
+        List<ImportConfig> list = importConfigs.stream().filter(x -> x.getLabel() != null).collect(Collectors.toList());
+        for(int i = 0; i < list.size(); i ++){
+            sheet.setColumnWidth(i, 24 * 256);
+            ImportConfig importConfig = list.get(i);
+            Cell rowcell = row1.createCell(i);
+            rowcell.setCellValue(importConfig.getLabel());
+            if(importConfig.getRequired() != null && importConfig.getRequired()){
+                rowcell.setCellStyle(cellStyle2);
+            }else{
+                rowcell.setCellStyle(cellStyle);
+            }
+        }
+    }
+}

+ 61 - 0
src/main/java/com/xjrsoft/module/xycxedu/service/impl/ExamSubjectScoreServiceImpl.java

@@ -1,17 +1,29 @@
 package com.xjrsoft.module.xycxedu.service.impl;
 
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.page.ConventPage;
+import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
 import com.xjrsoft.module.xycxedu.mapper.ExamSubjectScoreMappper;
 import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreService;
 import com.xjrsoft.module.xycxedu.vo.ExamStatisticsPageVo;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @title: 晓羊策学考试计划表
  * @Author dzx
@@ -35,4 +47,53 @@ public class ExamSubjectScoreServiceImpl extends MPJBaseServiceImpl<ExamSubjectS
     public Page<ExamStatisticsPageVo> getStatisticsPage(Page<ExamStatisticsPageVo> page, ExamStatisticsPageDto dto) {
         return this.baseMapper.getStatisticsPage(page, dto);
     }
+
+    @Override
+    public List<ExamSubjectScoreEnterImportVo> getEnterScoreStudentList(ExamSubjectScoreEnterDto dto) {
+        List<ExamSubjectScoreEnterImportVo> result = this.selectJoinList(ExamSubjectScoreEnterImportVo.class,
+                new MPJLambdaWrapper<ExamSubjectScore>()
+                        .select(ExamSubjectScore::getId)
+                        .selectAs(BaseClass::getName, ExamSubjectScoreEnterImportVo::getClassName)
+                        .selectAs(User::getName, ExamSubjectScoreEnterImportVo::getStudentName)
+                        .selectAs(User::getCredentialNumber, ExamSubjectScoreEnterImportVo::getCredentialNumber)
+                        .select(ExamSubjectScore::getScore)
+                        .select(ExamSubjectScore::getClassRanking)
+                        .select(ExamSubjectScore::getGradeRanking)
+                        .innerJoin(User.class, User::getId, ExamSubjectScore::getUserId)
+                        .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, ExamSubjectScore::getUserId)
+                        .innerJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)
+                        .eq(dto.getClassId() != null, BaseClass::getId, dto.getClassId())
+                        .like(StrUtil.isNotEmpty(dto.getStudentName()), User::getName, dto.getStudentName())
+                        .like(StrUtil.isNotEmpty(dto.getCredentialNumber()), User::getCredentialNumber, dto.getCredentialNumber())
+                        .isNotNull(dto.getIsEnter() != null && dto.getIsEnter() == 1, ExamSubjectScore::getScore)
+                        .isNull(dto.getIsEnter() != null && dto.getIsEnter() == 0, ExamSubjectScore::getScore)
+                        .eq(dto.getExamSubjectScoreEnterId() != null, ExamSubjectScore::getExamSubjectScoreEnterId, dto.getExamSubjectScoreEnterId())
+        );
+        return result;
+    }
+
+    @Override
+    public PageOutput<ExamSubjectScoreEnterImportVo> getEnterScoreStudentPage(Page<ExamSubjectScoreEnterImportVo> page, ExamSubjectScoreEnterDto dto) {
+        IPage<ExamSubjectScoreEnterImportVo> voIPage = this.selectJoinListPage(page, ExamSubjectScoreEnterImportVo.class,
+                new MPJLambdaWrapper<ExamSubjectScore>()
+                        .select(ExamSubjectScore::getId)
+                        .selectAs(BaseClass::getName, ExamSubjectScoreEnterImportVo::getClassName)
+                        .selectAs(User::getName, ExamSubjectScoreEnterImportVo::getStudentName)
+                        .selectAs(User::getCredentialNumber, ExamSubjectScoreEnterImportVo::getCredentialNumber)
+                        .select(ExamSubjectScore::getScore)
+                        .select(ExamSubjectScore::getClassRanking)
+                        .select(ExamSubjectScore::getGradeRanking)
+                        .innerJoin(User.class, User::getId, ExamSubjectScore::getUserId)
+                        .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, ExamSubjectScore::getUserId)
+                        .innerJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)
+                        .eq(dto.getClassId() != null, BaseClass::getId, dto.getClassId())
+                        .like(StrUtil.isNotEmpty(dto.getStudentName()), User::getName, dto.getStudentName())
+                        .like(StrUtil.isNotEmpty(dto.getCredentialNumber()), User::getCredentialNumber, dto.getCredentialNumber())
+                        .isNotNull(dto.getIsEnter() != null && dto.getIsEnter() == 1, ExamSubjectScore::getScore)
+                        .isNull(dto.getIsEnter() != null && dto.getIsEnter() == 0, ExamSubjectScore::getScore)
+                        .eq(dto.getExamSubjectScoreEnterId() != null, ExamSubjectScore::getExamSubjectScoreEnterId, dto.getExamSubjectScoreEnterId())
+        );
+        PageOutput<ExamSubjectScoreEnterImportVo> pageOutput = ConventPage.getPageOutput(voIPage, ExamSubjectScoreEnterImportVo.class);
+        return pageOutput;
+    }
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/xycxedu/util/DataUtil.java

@@ -110,7 +110,7 @@ public class DataUtil {
                 }
                 ExamSubjectScore score = new ExamSubjectScore() {{
                     setUserId(userId);
-                    setScore(scoreObj.get("score").getAsInt());
+                    setScore(scoreObj.get("score").getAsFloat());
                     setMilexamid(examidXMilexamidMap.get(examid).longValue());
                     setGradeRanking(scoreObj.get("gradeorder").getAsInt());
                     setClassRanking(scoreObj.get("classorder").getAsInt());

+ 57 - 0
src/main/java/com/xjrsoft/module/xycxedu/vo/ExamSubjectScoreEnterImportVo.java

@@ -0,0 +1,57 @@
+package com.xjrsoft.module.xycxedu.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.xjrsoft.common.annotation.Required;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+* @title: 成绩录入
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@Data
+public class ExamSubjectScoreEnterImportVo{
+
+
+    @ApiModelProperty("主键id")
+    private Long id;
+
+    @ExcelProperty("班级")
+    @ApiModelProperty("班级")
+    @Required
+    private String className;
+
+    @ExcelProperty("学生姓名")
+    @ApiModelProperty("学生姓名")
+    @Required
+    private String studentName;
+
+    @ExcelProperty("学生身份证")
+    @ApiModelProperty("学生身份证")
+    @Required
+    private String credentialNumber;
+
+    @ExcelProperty("科目")
+    @ApiModelProperty("科目")
+    @Required
+    private String courseSubjectName;
+
+    @ExcelProperty("成绩")
+    @ApiModelProperty("成绩")
+    @Required
+    private String score;
+
+    @ExcelProperty("班级排名")
+    @ApiModelProperty("班级排名")
+    private Integer classRanking;
+
+    @ExcelProperty("年级排名")
+    @ApiModelProperty("年级排名")
+    private Integer gradeRanking;
+
+}

+ 69 - 0
src/main/java/com/xjrsoft/module/xycxedu/vo/ExamSubjectScoreEnterPageVo.java

@@ -0,0 +1,69 @@
+package com.xjrsoft.module.xycxedu.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+* @title: 成绩录入分页列表出参
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@Data
+public class ExamSubjectScoreEnterPageVo {
+
+    /**
+    * 主键
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("主键")
+    @ApiModelProperty("主键")
+    private Long id;
+    /**
+    * 创建人
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("创建人")
+    @ApiModelProperty("创建人")
+    private String createUserName;
+    /**
+    * 创建时间
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("创建时间")
+    @ApiModelProperty("创建时间")
+    private Date createDate;
+    /**
+    * 科目名称
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("科目名称")
+    @ApiModelProperty("科目名称")
+    private String courseSubjectName;
+    /**
+    * 考试计划id
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("考试计划")
+    @ApiModelProperty("考试计划")
+    private String examPlanName;
+    /**
+    * 学期id
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学期")
+    @ApiModelProperty("学期")
+    private String semesterName;
+    /**
+    * 班级id
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("班级名称")
+    @ApiModelProperty("班级名称")
+    private String className;
+
+}

+ 69 - 0
src/main/java/com/xjrsoft/module/xycxedu/vo/ExamSubjectScoreEnterStudentVo.java

@@ -0,0 +1,69 @@
+package com.xjrsoft.module.xycxedu.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+* @title: 成绩录入分页列表出参
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@Data
+public class ExamSubjectScoreEnterStudentVo {
+
+    /**
+    * 主键
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("主键")
+    @ApiModelProperty("主键")
+    private Long id;
+    /**
+    * 创建人
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("创建人")
+    @ApiModelProperty("创建人")
+    private String createUserName;
+    /**
+    * 创建时间
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("创建时间")
+    @ApiModelProperty("创建时间")
+    private Date createDate;
+    /**
+    * 科目名称
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("科目名称")
+    @ApiModelProperty("科目名称")
+    private String courseSubjectName;
+    /**
+    * 考试计划id
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("考试计划")
+    @ApiModelProperty("考试计划")
+    private String examPlanName;
+    /**
+    * 学期id
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学期")
+    @ApiModelProperty("学期")
+    private String semesterName;
+    /**
+    * 班级id
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("班级名称")
+    @ApiModelProperty("班级名称")
+    private String className;
+
+}

+ 79 - 0
src/main/java/com/xjrsoft/module/xycxedu/vo/ExamSubjectScoreEnterVo.java

@@ -0,0 +1,79 @@
+package com.xjrsoft.module.xycxedu.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.xjrsoft.module.base.entity.BaseClass;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+* @title: 成绩录入表单出参
+* @Author dzx
+* @Date: 2025-01-06
+* @Version 1.0
+*/
+@Data
+public class ExamSubjectScoreEnterVo {
+
+    /**
+     * 主键
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("主键")
+    @ApiModelProperty("主键")
+    private Long id;
+    /**
+     * 创建人
+     */
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("创建人")
+    private String createUserName;
+    /**
+     * 创建时间
+     */
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("创建时间")
+    private Date createDate;
+    /**
+     * 科目名称
+     */
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("科目名称")
+    private String courseSubjectName;
+    /**
+     * 考试计划id
+     */
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("考试计划")
+    private String examPlanName;
+    /**
+     * 学期id
+     */
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("学期")
+    private String semesterName;
+    /**
+     * 班级id
+     */
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("班级名称")
+    private String className;
+
+    @ApiModelProperty("所有学生数量")
+    private Integer allCount;
+
+
+    @ApiModelProperty("已录入学生数量")
+    private Integer handleCount;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("班级名称")
+    private String classIds;
+
+    @ApiModelProperty("班级")
+    private List<BaseClass> classList;
+
+}

+ 4 - 1
src/main/java/com/xjrsoft/module/xycxedu/vo/ExamSubjectScorePageVo.java

@@ -27,10 +27,13 @@ public class ExamSubjectScorePageVo {
     private String coursename;
 
     @ApiModelProperty("成绩")
-    private Integer score;
+    private String score;
 
     @ApiModelProperty("年级排名")
     private Integer gradeRanking;
 
+    @ApiModelProperty("班级排名")
+    private Integer classRanking;
+
 
 }

+ 41 - 0
src/main/resources/mapper/xycxedu/ExamSubjectScoreEnterMappper.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xjrsoft.module.xycxedu.mapper.ExamSubjectScoreEnterMapper">
+    <select id="getPage" parameterType="com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterPageDto" resultType="com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterPageVo">
+        SELECT t1.id, t2.name AS semester_name,t3.name AS exam_plan_name,t4.name AS course_subject_name,t1.create_date,t5.name create_user_name,
+        (SELECT GROUP_CONCAT(NAME) FROM base_class WHERE t1.class_ids LIKE CONCAT('%', id, '%')) AS class_name FROM exam_subject_score_enter t1
+        LEFT JOIN base_semester t2 ON t1.semester_id = t2.id
+        LEFT JOIN exam_plan t3 ON t1.exam_plan_id = t3.id
+        LEFT JOIN base_course_subject t4 ON t1.course_subject_id = t4.id
+        LEFT JOIN xjr_user t5 ON t1.create_user_id = t5.id
+        WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
+        <if test="dto.semesterId != null">
+            and t2.id = #{dto.semesterId}
+        </if>
+        <if test="dto.examPlanName != null and dto.examPlanName != ''">
+            and t3.name like concat('%', #{dto.examPlanName}, '%')
+        </if>
+        <if test="dto.className != null and dto.className != ''">
+            and t1.class_ids like concat('%', (select id from base_class where name like concat('%', #{dto.className}, '%')), '%')
+        </if>
+        <if test="dto.courseSubjectName != null and dto.courseSubjectName != ''">
+            and t4.name like concat('%', #{dto.courseSubjectName}, '%')
+        </if>
+        order by t1.id desc
+    </select>
+    <select id="getInfo" resultType="com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterVo">
+        SELECT t1.id, t2.name AS semester_name,t3.name AS exam_plan_name,t4.name AS course_subject_name,t1.create_date,t5.name create_user_name,t1.class_ids
+        ,(SELECT GROUP_CONCAT(NAME) FROM base_class WHERE t1.class_ids LIKE CONCAT('%', id, '%')) AS class_name
+        ,(SELECT COUNT(*) FROM exam_subject_score WHERE delete_mark = 0 AND exam_subject_score_enter_id = t1.id AND enabled_mark = 1) AS all_count
+        ,(SELECT COUNT(*) FROM exam_subject_score WHERE delete_mark = 0 AND exam_subject_score_enter_id = t1.id AND enabled_mark = 1 AND score IS NOT NULL) AS handle_count
+        FROM exam_subject_score_enter t1
+        LEFT JOIN base_semester t2 ON t1.semester_id = t2.id
+        LEFT JOIN exam_plan t3 ON t1.exam_plan_id = t3.id
+        LEFT JOIN base_course_subject t4 ON t1.course_subject_id = t4.id
+        LEFT JOIN xjr_user t5 ON t1.create_user_id = t5.id
+        WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
+        and t1.id = #{id}
+    </select>
+</mapper>

+ 3 - 3
src/main/resources/mapper/xycxedu/ExamSubjectScoreMappper.xml

@@ -10,9 +10,9 @@
     </select>
 
     <select id="getPage" parameterType="com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto" resultType="com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo">
-        SELECT t4.name AS semester_name,t2.milexamname,t1.coursename,t1.score,t1.grade_ranking FROM exam_subject_score t1
-        INNER JOIN xycxedu_exam_list t2 ON t1.milexamid = t2.milexamid
-        LEFT JOIN exam_plan t3 ON t3.milexamids LIKE CONCAT('%', t1.milexamid, '%')
+        SELECT t4.name AS semester_name,t2.milexamname,t1.coursename,t1.score,t1.grade_ranking,t1.class_ranking FROM exam_subject_score t1
+        LEFT JOIN xycxedu_exam_list t2 ON t1.milexamid = t2.milexamid
+        LEFT JOIN exam_plan t3 ON (t3.milexamids LIKE CONCAT('%', t1.milexamid, '%') or t1.exam_plan_id = t3.id)
         LEFT JOIN base_semester t4 ON t3.semester_id = t4.id
         WHERE t1.delete_mark = 0 AND t1.user_id = #{dto.userId}
         <if test="dto.semesterId != null">

+ 26 - 0
src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java

@@ -4196,4 +4196,30 @@ public class FreeMarkerGeneratorTest {
 
         apiGeneratorService.generateCodes(params);
     }
+
+
+    @Test
+    public void gcExamSubjectScoreEnter() throws IOException {
+        List<TableConfig> tableConfigs = new ArrayList<>();
+        TableConfig mainTable = new TableConfig();
+        mainTable.setTableName("exam_subject_score_enter");//init_sql中的表名
+        mainTable.setIsMain(true);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        tableConfigs.add(mainTable);
+
+        ApiGenerateCodesDto params = new ApiGenerateCodesDto();
+        params.setAuthor("dzx");//作者名称
+        params.setPackageName("xycxedu");//包名
+        params.setTableConfigs(tableConfigs);
+        params.setPage(true);//是否生成分页接口
+        params.setImport(true);//是否生成导入接口
+        params.setExport(true);//是否生成导出接口
+        params.setOutMainDir(true);//是否生成在主目录,前期测试可设置成false
+        params.setDs(ds);
+
+        IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
+
+        apiGeneratorService.generateCodes(params);
+    }
 }