Browse Source

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

大数据与最优化研究所 1 month ago
parent
commit
d445a94f1a

+ 28 - 0
src/main/java/com/xjrsoft/module/student/controller/BaseStudentAssessmentInspectionController.java

@@ -3,10 +3,12 @@ package com.xjrsoft.module.student.controller;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xjrsoft.common.annotation.XjrLog;
 import com.xjrsoft.common.enums.EnabledMark;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
@@ -16,11 +18,14 @@ import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionMobilePageD
 import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto;
 import com.xjrsoft.module.student.dto.CalssQuantitativeAssessmentPageDto;
 import com.xjrsoft.module.student.dto.CancelStudentDto;
+import com.xjrsoft.module.student.dto.ImportBaseStudentAssessmentInspectionDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentAssessmentInspectionDto;
+import com.xjrsoft.module.student.entity.BaseMajorCategor;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentInspection;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentStudentRelation;
 import com.xjrsoft.module.student.service.IBaseStudentAssessmentInspectionService;
 import com.xjrsoft.module.student.service.IBaseStudentAssessmentStudentRelationService;
+import com.xjrsoft.module.student.vo.BaseMajorCategorPageVo;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobilePageVo;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobileVo;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionPageVo;
@@ -38,6 +43,7 @@ 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;
@@ -64,6 +70,7 @@ public class BaseStudentAssessmentInspectionController {
     @GetMapping(value = "/page")
     @ApiOperation(value = "学生班级巡查考核列表(分页)")
     @SaCheckPermission("basestudentassessmentinspection:detail")
+    @XjrLog(value = "学生班级巡查考核列表(分页)", saveRequestData = true)
     public RT<PageOutput<BaseStudentAssessmentInspectionPageVo>> page(@Valid BaseStudentAssessmentInspectionPageDto dto) {
         List<String> roleList = StpUtil.getRoleList();
         if(roleList.size() == 2 && roleList.contains("TEACHER") && roleList.contains("CLASSTE")){
@@ -76,6 +83,7 @@ public class BaseStudentAssessmentInspectionController {
     @GetMapping(value = "/info")
     @ApiOperation(value = "根据id查询学生班级巡查考核信息")
     @SaCheckPermission("basestudentassessmentinspection:detail")
+    @XjrLog(value = "根据id查询学生班级巡查考核信息")
     public RT<BaseStudentAssessmentInspectionVo> info(@RequestParam Long id) {
         BaseStudentAssessmentInspectionVo result = inspectionService.getInfo(id);
         return RT.ok(result);
@@ -84,6 +92,7 @@ public class BaseStudentAssessmentInspectionController {
     @GetMapping(value = "/mobile-page")
     @ApiOperation(value = "学生操行分记录管理列表(移动端)")
     @SaCheckPermission("basestudentbehaviormanage:detail")
+    @XjrLog(value = "学生操行分记录管理列表(移动端)")
     public RT<PageOutput<BaseStudentAssessmentInspectionMobilePageVo>> mobilePage(@Valid BaseStudentAssessmentInspectionMobilePageDto dto) {
         Page<BaseStudentAssessmentInspectionMobilePageVo> page = inspectionService.getMobilePage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         if (page == null) {
@@ -95,6 +104,7 @@ public class BaseStudentAssessmentInspectionController {
     @GetMapping(value = "/mobile-info")
     @ApiOperation(value = "根据id查询学生班级巡查考核信息(移动端)")
     @SaCheckPermission("basestudentassessmentinspection:detail")
+    @XjrLog(value = "根据id查询学生班级巡查考核信息(移动端)")
     public RT<BaseStudentAssessmentInspectionMobileVo> mobileInfo(@Valid Long id) {
         BaseStudentAssessmentInspectionMobileVo result = inspectionService.getMobileInfo(id);
         return RT.ok(result);
@@ -103,6 +113,7 @@ public class BaseStudentAssessmentInspectionController {
     @PostMapping
     @ApiOperation(value = "新增学生班级巡查考核")
     @SaCheckPermission("basestudentassessmentinspection:add")
+    @XjrLog(value = "新增学生班级巡查考核")
     public RT<Boolean> add(@Valid @RequestBody AddBaseStudentAssessmentInspectionDto dto) {
         BaseStudentAssessmentInspection inspection = BeanUtil.toBean(dto, BaseStudentAssessmentInspection.class);
         inspection.setCreateDate(new Date());
@@ -116,6 +127,7 @@ public class BaseStudentAssessmentInspectionController {
     @PutMapping
     @ApiOperation(value = "修改学生班级巡查考核")
     @SaCheckPermission("basestudentassessmentinspection:edit")
+    @XjrLog(value = "修改学生班级巡查考核")
     public RT<Boolean> update(@Valid @RequestBody UpdateBaseStudentAssessmentInspectionDto dto) {
 
         BaseStudentAssessmentInspection baseStudentAssessmentInspection = BeanUtil.toBean(dto, BaseStudentAssessmentInspection.class);
@@ -126,6 +138,7 @@ public class BaseStudentAssessmentInspectionController {
     @DeleteMapping
     @ApiOperation(value = "删除学生班级巡查考核")
     @SaCheckPermission("basestudentassessmentinspection:delete")
+    @XjrLog(value = "删除学生班级巡查考核")
     public RT<Boolean> delete(@Valid @RequestBody List<Long> ids) {
         return RT.ok(inspectionService.removeBatchByIds(ids));
     }
@@ -133,6 +146,7 @@ public class BaseStudentAssessmentInspectionController {
     @GetMapping(value = "/calss-quantitative-assessment-page")
     @ApiOperation(value = "班级量化考核列表(分页)")
     @SaCheckPermission("basestudentassessmentinspection:detail")
+    @XjrLog(value = "班级量化考核列表(分页)")
     public RT<PageOutput<CalssQuantitativeAssessmentPageVo>> calssQuantitativeAssessmentPage(@Valid CalssQuantitativeAssessmentPageDto dto) {
         IPage<CalssQuantitativeAssessmentPageVo> page = inspectionService.getCalssQuantitativeAssessmentPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         return RT.ok(ConventPage.getPageOutput(page, CalssQuantitativeAssessmentPageVo.class));
@@ -143,6 +157,8 @@ public class BaseStudentAssessmentInspectionController {
 //    public ResponseEntity<byte[]>  exportDataQuery(@Valid @RequestBody QuantitativeAssessmentExcelDto dto) {
     @PostMapping("/export-query")
     @ApiOperation(value = "导出")
+    @SaCheckPermission("basestudentassessmentinspection:detail")
+    @XjrLog(value = "导出")
     public ResponseEntity<byte[]>  exportDataQuery(@Valid  @RequestBody CalssQuantitativeAssessmentPageDto dto) throws IOException {
         byte[] bytes = inspectionService.getExcelByte(dto);
         String fileName = "recordExport" + ExcelTypeEnum.XLSX.getValue();
@@ -152,6 +168,8 @@ public class BaseStudentAssessmentInspectionController {
 
     @PostMapping("/cancel-student")
     @ApiOperation(value = "作废学生")
+    @SaCheckPermission("basestudentassessmentinspection:detail")
+    @XjrLog(value = "作废学生")
     public RT<Boolean>  cancelStudent(@RequestBody CancelStudentDto dto){
         BaseStudentAssessmentStudentRelation relation = studentRelationService.getById(dto.getId());
         relation.setEnabledMark(EnabledMark.DISABLED.getCode());
@@ -173,4 +191,14 @@ public class BaseStudentAssessmentInspectionController {
         inspectionService.updateById(inspection);
         return RT.ok(update);
     }
+
+    @PostMapping("/import")
+    @ApiOperation(value = "班级考核导入")
+    @SaCheckPermission("basestudentassessmentinspection:importData")
+    @XjrLog(value = "班级考核导入")
+    public RT<Boolean> importData(@RequestParam MultipartFile file) throws IOException {
+        List<ImportBaseStudentAssessmentInspectionDto> savedDataList = EasyExcel.read(file.getInputStream()).headRowNumber(3).head(ImportBaseStudentAssessmentInspectionDto.class).sheet().doReadSync();
+        Boolean result = inspectionService.importData(savedDataList);
+        return RT.ok(result);
+    }
 }

+ 4 - 0
src/main/java/com/xjrsoft/module/student/dto/BaseStudentUserPageDto.java

@@ -67,4 +67,8 @@ public class BaseStudentUserPageDto extends PageInput {
     @JsonIgnore
     private List<Long> classIds;
 
+    @JsonIgnore
+    @ApiModelProperty("身份证号")
+    private List<String> credentialNumbers;
+
 }

+ 69 - 0
src/main/java/com/xjrsoft/module/student/dto/ImportBaseStudentAssessmentInspectionDto.java

@@ -0,0 +1,69 @@
+package com.xjrsoft.module.student.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+
+
+/**
+* @title: 学生班级巡查考核
+* @Author dzx
+* @Date: 2023-11-16
+* @Version 1.0
+*/
+@Data
+public class ImportBaseStudentAssessmentInspectionDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("考核班级")
+    @ApiModelProperty("考核班级")
+    private String className;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("考核对象")
+    @ApiModelProperty("考核对象")
+    private String assessmentType;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("考核类别")
+    @ApiModelProperty("考核类别")
+    private String assessmentCategory;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("考核项")
+    @ApiModelProperty("考核项")
+    private String assessmentProject;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("考核项目")
+    @ApiModelProperty("考核项目")
+    private String assessmentItem;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学生")
+    @ApiModelProperty("学生")
+    private String studentName;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学生身份证号")
+    @ApiModelProperty("学生身份证号")
+    private String credentialNumber;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("考核时间")
+    @ApiModelProperty("考核时间")
+    private String assessmentDate;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("备注")
+    @ApiModelProperty("备注")
+    private String reason;
+
+
+}

+ 4 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseStudentAssessmentInspectionService.java

@@ -6,6 +6,7 @@ import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionMobilePageDto;
 import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto;
 import com.xjrsoft.module.student.dto.CalssQuantitativeAssessmentPageDto;
+import com.xjrsoft.module.student.dto.ImportBaseStudentAssessmentInspectionDto;
 import com.xjrsoft.module.student.dto.QuantitativeAssessmentExcelDto;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentInspection;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobilePageVo;
@@ -16,6 +17,7 @@ import com.xjrsoft.module.student.vo.CalssQuantitativeAssessmentPageVo;
 import org.springframework.http.ResponseEntity;
 
 import java.io.IOException;
+import java.util.List;
 
 /**
 * @title: 学生班级巡查考核
@@ -72,4 +74,6 @@ public interface IBaseStudentAssessmentInspectionService extends MPJBaseService<
     Boolean noticeTeacher(Long id);
 
     byte[] getExcelByte(CalssQuantitativeAssessmentPageDto dto) throws IOException;
+
+    Boolean importData(List<ImportBaseStudentAssessmentInspectionDto> savedDataList);
 }

+ 154 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentAssessmentInspectionServiceImpl.java

@@ -37,29 +37,35 @@ import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.organization.service.IWeChatService;
 import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionMobilePageDto;
 import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto;
+import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.dto.CalssQuantitativeAssessmentPageDto;
+import com.xjrsoft.module.student.dto.ImportBaseStudentAssessmentInspectionDto;
 import com.xjrsoft.module.student.dto.QuantitativeAssessmentExcelDto;
 import com.xjrsoft.module.student.dto.QuantitativeAssessmentSingleScoreDto;
 import com.xjrsoft.module.student.entity.BaseClassMajorSet;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentCategory;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentClassRelation;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentInspection;
+import com.xjrsoft.module.student.entity.BaseStudentAssessmentItem;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentProject;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentStudentRelation;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.mapper.BaseStudentAssessmentCategoryMapper;
 import com.xjrsoft.module.student.mapper.BaseStudentAssessmentClassRelationMapper;
 import com.xjrsoft.module.student.mapper.BaseStudentAssessmentInspectionMapper;
+import com.xjrsoft.module.student.mapper.BaseStudentAssessmentItemMapper;
 import com.xjrsoft.module.student.mapper.BaseStudentAssessmentProjectMapper;
 import com.xjrsoft.module.student.mapper.BaseStudentAssessmentStudentRelationMapper;
 import com.xjrsoft.module.student.mapper.BaseStudentSchoolRollMapper;
 import com.xjrsoft.module.student.service.IBaseStudentAssessmentInspectionService;
+import com.xjrsoft.module.student.service.IBaseStudentService;
 import com.xjrsoft.module.student.service.IQuotaFormulaRuleService;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentClassListVo;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobilePageVo;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobileVo;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionPageVo;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionVo;
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
 import com.xjrsoft.module.student.vo.CalssQuantitativeAssessmentPageVo;
 import com.xjrsoft.module.student.vo.QuantitativeAssessmentSingleScoreVo;
 import com.xjrsoft.module.student.vo.QuantitativeAssessmentSubTableExcelVo;
@@ -93,11 +99,15 @@ import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.ZoneId;
 import java.time.temporal.TemporalAdjusters;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 
@@ -137,6 +147,10 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
 
     private final CommonPropertiesConfig commonPropertiesConfig;
 
+    private final IBaseStudentService studentService;
+    
+    private final BaseStudentAssessmentItemMapper itemMapper;
+
     @Override
     public Page<BaseStudentAssessmentInspectionPageVo> getPage(Page<BaseStudentAssessmentInspectionPageDto> page, BaseStudentAssessmentInspectionPageDto dto) {
         Page<BaseStudentAssessmentInspectionPageVo> result = assessmentInspectionMapper.getPage(page, dto);
@@ -963,6 +977,146 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
         return bot.toByteArray();
     }
 
+    @Override
+    public Boolean importData(List<ImportBaseStudentAssessmentInspectionDto> savedDataList) {
+        try {
+            // 提取出所有班级名字
+            Set<String> classNames = savedDataList.stream().map(ImportBaseStudentAssessmentInspectionDto::getClassName).collect(Collectors.toSet());
+
+            Set<String> categorys = savedDataList.stream().map(ImportBaseStudentAssessmentInspectionDto::getAssessmentCategory).collect(Collectors.toSet());
+
+            Set<String> projects = savedDataList.stream().map(ImportBaseStudentAssessmentInspectionDto::getAssessmentProject).collect(Collectors.toSet());
+
+            Set<String> items = savedDataList.stream().map(ImportBaseStudentAssessmentInspectionDto::getAssessmentItem).collect(Collectors.toSet());
+
+            // 提取出所有身份证
+            Set<String> credentialNumbers = savedDataList.stream().map(ImportBaseStudentAssessmentInspectionDto::getCredentialNumber).collect(Collectors.toSet());
+
+            List<BaseClass> classList = baseClassMapper.selectList(
+                    new QueryWrapper<BaseClass>().lambda()
+                            .in(BaseClass::getName, classNames)
+            );
+            Map<String, Long> classMap = classList.stream().collect(Collectors.toMap(BaseClass::getName, BaseClass::getId));
+            Set<String> checkClassNames = new HashSet<>(classNames);
+            checkClassNames.removeAll(classMap.keySet());
+            if(!checkClassNames.isEmpty()){
+                throw new MyException("导入表格中的班级:" + checkClassNames.toString() + " 在系统中不存在");
+            }
+
+
+            List<BaseStudentAssessmentProject> projectList = projectMapper.selectList(
+                    new QueryWrapper<BaseStudentAssessmentProject>().lambda()
+                            .eq(BaseStudentAssessmentProject::getDeleteMark, DeleteMark.NODELETE.getCode())
+                            .eq(BaseStudentAssessmentProject::getEnabledMark, EnabledMark.ENABLED.getCode())
+            );
+            Map<Long, Map<String, Long>> projectMap = projectList.stream().collect(
+                    Collectors.groupingBy(
+                            BaseStudentAssessmentProject::getBaseStudentAssessmentCategoryId,
+                            Collectors.toMap(BaseStudentAssessmentProject::getName, BaseStudentAssessmentProject::getId)
+                    )
+            );
+
+            Map<String, Long> categoryMap = categoryMapper.selectList(
+                    new QueryWrapper<BaseStudentAssessmentCategory>().lambda()
+                            .eq(BaseStudentAssessmentCategory::getDeleteMark, DeleteMark.NODELETE.getCode())
+                            .eq(BaseStudentAssessmentCategory::getEnabledMark, EnabledMark.ENABLED.getCode())
+            )
+            .stream().collect(Collectors.toMap(BaseStudentAssessmentCategory::getName, BaseStudentAssessmentCategory::getId));
+
+            Set<String> checkCategorys = new HashSet<>(categorys);
+            checkCategorys.removeAll(categoryMap.keySet());
+            if(!checkCategorys.isEmpty()){
+                throw new MyException("导入表格中的考核类别:" + checkCategorys.toString() + " 在系统中不存在");
+            }
+
+            List<BaseStudentAssessmentItem> itemList = itemMapper.selectList(
+                    new QueryWrapper<BaseStudentAssessmentItem>().lambda()
+                            .eq(BaseStudentAssessmentItem::getDeleteMark, DeleteMark.NODELETE.getCode())
+                            .eq(BaseStudentAssessmentItem::getEnabledMark, EnabledMark.ENABLED.getCode())
+            );
+            Map<Long, Map<String, Long>> itemMap = itemList.stream().collect(
+                    Collectors.groupingBy(
+                            BaseStudentAssessmentItem::getBaseStudentAssessmentCategoryId,
+                            Collectors.toMap(BaseStudentAssessmentItem::getName, BaseStudentAssessmentItem::getId)
+                    )
+            );
+
+            List<BaseStudentUserPageVo> studentList = studentService.getStudentList(new BaseStudentUserPageDto() {{
+                setCredentialNumbers(new ArrayList<>(credentialNumbers));
+            }});
+            Map<String, String> studentMap = studentList.stream().collect(Collectors.toMap(BaseStudentUserPageVo::getCredentialNumber, BaseStudentUserPageVo::getId));
+
+            Set<String> checkStudents = new HashSet<>();
+            Set<String> checkProjects = new HashSet<>();
+            Set<String> checkItems = new HashSet<>();
+
+            List<BaseStudentAssessmentInspection> insertList = new ArrayList<>();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
+            for (ImportBaseStudentAssessmentInspectionDto dto : savedDataList) {
+
+                BaseStudentAssessmentInspection data = new BaseStudentAssessmentInspection();
+
+                data.setEnabledMark(EnabledMark.ENABLED.getCode());
+                data.setDeleteMark(DeleteMark.NODELETE.getCode());
+                data.setCreateDate(new Date());
+                data.setCreateUserId(StpUtil.getLoginIdAsLong());
+                if("班级".equals(dto.getAssessmentType())){
+                    data.setAssessmentType("class");
+                }else if("个人".equals(dto.getAssessmentType())){
+                    data.setAssessmentType("personal");
+                    if(!studentMap.containsKey(dto.getCredentialNumber())){
+                        checkStudents.add(dto.getStudentName());
+                        continue;
+                    }
+                    data.setPersonalStudentUserIds(studentMap.get(dto.getCredentialNumber()));
+                }
+                data.setClassIds(classMap.get(dto.getClassName()).toString());
+                data.setBaseStudentAssessmentCategoryId(categoryMap.get(dto.getAssessmentCategory()));
+
+
+                Map<String, Long> itemGroup = itemMap.get(data.getBaseStudentAssessmentCategoryId());
+                if(itemGroup == null || !itemGroup.containsKey(dto.getAssessmentItem())){
+                    checkItems.add("考核类别“" + dto.getAssessmentCategory() + "”中不存在考核项“" + dto.getAssessmentItem() + "”" ) ;
+                }
+                data.setBaseStudentAssessmentItemId(itemGroup.get(dto.getAssessmentItem()));
+
+
+                Map<String, Long> projectGroup = projectMap.get(data.getBaseStudentAssessmentItemId());
+                if(projectGroup == null || !projectGroup.containsKey(dto.getAssessmentProject())){
+                    checkProjects.add("考核项目“" + dto.getAssessmentItem() + "”中不存在考核项“" + dto.getAssessmentProject() + "”" ) ;
+                    continue;
+                }
+                data.setBaseStudentAssessmentProjectId(projectGroup.get(dto.getAssessmentProject()));
+
+                data.setReason(dto.getReason());
+                data.setAssessmentUserId(StpUtil.getLoginIdAsLong());
+                data.setAssessmentDate(sdf.parse(dto.getAssessmentDate()));
+
+                insertList.add(data);
+            }
+            if(!checkStudents.isEmpty()){
+                throw new MyException("导入表格中的学生:" + checkStudents.toString() + " 在系统中不存在");
+            }
+            if(!checkProjects.isEmpty()){
+                throw new MyException(checkProjects.toString().replace("[", "").replace("]", ""));
+            }
+            if(!checkItems.isEmpty()){
+                throw new MyException(checkItems.toString().replace("[", "").replace("]", ""));
+            }
+            if(!insertList.isEmpty()){
+               this.saveBatch(insertList);
+            }
+        }catch (Exception e){
+            Log.error(e.getMessage(), e);
+            if(e.getClass().equals(MyException.class)){
+                throw new MyException(e.getMessage());
+            }else{
+                throw new MyException("导入报错,请联系管理员");
+            }
+        }
+        return true;
+    }
+
     void createFirstTitle(Workbook workbook, Sheet sheet) {
         int rowNumber = 0;
         Font font = workbook.createFont();

+ 6 - 0
src/main/resources/mapper/student/BaseStudentMapper.xml

@@ -138,6 +138,12 @@
                 #{classId}
             </foreach>
         </if>
+        <if test="dto.credentialNumbers != null and dto.credentialNumbers.size() > 0">
+            and t1.credential_number in
+            <foreach item="credentialNumber" index="index" collection="dto.credentialNumbers" open="(" close=")" separator=",">
+                #{credentialNumber}
+            </foreach>
+        </if>
     </select>
 
 </mapper>