Browse Source

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

大数据与最优化研究所 4 months ago
parent
commit
a02de5f241
42 changed files with 946 additions and 134 deletions
  1. 92 32
      src/main/java/com/xjrsoft/module/banding/controller/BandingTaskClassController.java
  2. 10 13
      src/main/java/com/xjrsoft/module/banding/controller/BandingTaskController.java
  3. 24 0
      src/main/java/com/xjrsoft/module/banding/dto/BandingTaskClassListDto.java
  4. 6 0
      src/main/java/com/xjrsoft/module/banding/dto/BandingTaskClassPageDto.java
  5. 6 0
      src/main/java/com/xjrsoft/module/banding/dto/BandingTaskClassStudentPageDto.java
  6. 3 1
      src/main/java/com/xjrsoft/module/banding/dto/BandingTaskPageDto.java
  7. 3 0
      src/main/java/com/xjrsoft/module/banding/dto/ChangeClassDto.java
  8. 3 0
      src/main/java/com/xjrsoft/module/banding/dto/SureBandingTaskDto.java
  9. 1 1
      src/main/java/com/xjrsoft/module/banding/entity/BandingTaskClass.java
  10. 4 0
      src/main/java/com/xjrsoft/module/banding/mapper/BandingTaskMapper.java
  11. 5 0
      src/main/java/com/xjrsoft/module/banding/service/IBandingTaskClassService.java
  12. 6 0
      src/main/java/com/xjrsoft/module/banding/service/IBandingTaskService.java
  13. 78 0
      src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassServiceImpl.java
  14. 199 0
      src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassStudentServiceImpl.java
  15. 161 36
      src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskServiceImpl.java
  16. 1 1
      src/main/java/com/xjrsoft/module/banding/vo/BandingTaskClassSureListVo.java
  17. 12 0
      src/main/java/com/xjrsoft/module/banding/vo/BandingTaskPageVo.java
  18. 1 1
      src/main/java/com/xjrsoft/module/job/InsertOutInRecordTask.java
  19. 19 0
      src/main/java/com/xjrsoft/module/organization/controller/UserController.java
  20. 17 0
      src/main/java/com/xjrsoft/module/organization/dto/UserChangeStatusDto.java
  21. 8 0
      src/main/java/com/xjrsoft/module/organization/mapper/UserMapper.java
  22. 17 0
      src/main/java/com/xjrsoft/module/personnel/controller/StundentFaceProcessController.java
  23. 8 3
      src/main/java/com/xjrsoft/module/student/controller/BaseNewStudentController.java
  24. 20 0
      src/main/java/com/xjrsoft/module/student/controller/BaseStudentInfoController.java
  25. 1 0
      src/main/java/com/xjrsoft/module/student/controller/EnrollmentPlanController.java
  26. 3 3
      src/main/java/com/xjrsoft/module/student/dto/BaseNewStudentPageDto.java
  27. 15 0
      src/main/java/com/xjrsoft/module/student/dto/BaseStudentSimpleInfoDto.java
  28. 3 0
      src/main/java/com/xjrsoft/module/student/dto/EnrollmentPlanPageDto.java
  29. 6 0
      src/main/java/com/xjrsoft/module/student/service/IBaseStudentSchoolRollService.java
  30. 19 7
      src/main/java/com/xjrsoft/module/student/service/impl/BaseNewStudentServiceImpl.java
  31. 10 0
      src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentSchoolRollServiceImpl.java
  32. 6 0
      src/main/java/com/xjrsoft/module/student/vo/BaseNewStudentPageVo.java
  33. 13 0
      src/main/java/com/xjrsoft/module/student/vo/BaseNewStudentVo.java
  34. 46 0
      src/main/java/com/xjrsoft/module/student/vo/BaseStudentSompleInfoVo.java
  35. 1 1
      src/main/resources/application-dev.yml
  36. 1 1
      src/main/resources/application-pre.yml
  37. 59 23
      src/main/resources/mapper/banding/BandingTaskClassMapper.xml
  38. 15 7
      src/main/resources/mapper/banding/BandingTaskClassStudentMapper.xml
  39. 1 1
      src/main/resources/mapper/banding/BandingTaskMajorConditionMapper.xml
  40. 24 0
      src/main/resources/mapper/banding/BandingTaskMapper.xml
  41. 7 0
      src/main/resources/mapper/organization/UserMapper.xml
  42. 12 3
      src/main/resources/mapper/student/BaseNewStudentMapper.xml

+ 92 - 32
src/main/java/com/xjrsoft/module/banding/controller/BandingTaskClassController.java

@@ -5,14 +5,20 @@ 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.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.model.result.RT;
+import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.banding.dto.AddBandingTaskClassDto;
+import com.xjrsoft.module.banding.dto.BandingTaskClassListDto;
 import com.xjrsoft.module.banding.dto.BandingTaskClassPageDto;
 import com.xjrsoft.module.banding.dto.BandingTaskClassStudentPageDto;
 import com.xjrsoft.module.banding.dto.ChangeClassDto;
 import com.xjrsoft.module.banding.dto.StudentDto;
+import com.xjrsoft.module.banding.dto.SureBandingTaskDto;
 import com.xjrsoft.module.banding.dto.UpdateBandingClassDto;
+import com.xjrsoft.module.banding.entity.BandingTask;
 import com.xjrsoft.module.banding.entity.BandingTaskClass;
+import com.xjrsoft.module.banding.entity.BandingTaskClassStudent;
 import com.xjrsoft.module.banding.service.IBandingTaskClassService;
 import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
 import com.xjrsoft.module.banding.vo.BandingTaskClassExcelVo;
@@ -20,7 +26,6 @@ import com.xjrsoft.module.banding.vo.BandingTaskClassPageVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassStudentListVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassSureListVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassVo;
-import com.xjrsoft.module.banding.vo.BandingTaskPageVo;
 import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -39,7 +44,10 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.validation.Valid;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
 * @title: 新生分班任务
@@ -97,72 +105,108 @@ public class BandingTaskClassController {
     @PostMapping
     @ApiOperation(value = "新增新生分班")
     @SaCheckPermission("bandingTaskClass:add")
-    public RT<Boolean> add(@Valid @RequestBody AddBandingTaskClassDto dto){
-        if(dto.getSortCode() != null){
-            List<BandingTaskClass> list = bandingTaskClassService.list(
-                    new QueryWrapper<BandingTaskClass>().lambda()
-                            .eq(BandingTaskClass::getSortCode, dto.getSortCode())
-                            .eq(BandingTaskClass::getBandingTaskId, dto.getBandingTaskId())
-            );
-            if(!list.isEmpty()){
-                return RT.error("班级编号重复");
+    public RT<Boolean> add(@Valid @RequestBody List<AddBandingTaskClassDto> dtoList){
+        List<BandingTaskClass> dataList = new ArrayList<>();
+        List<String> errorList = new ArrayList<>();
+        for (AddBandingTaskClassDto dto : dtoList) {
+            if(dto.getSortCode() != null){
+                List<BandingTaskClass> list = bandingTaskClassService.list(
+                        new QueryWrapper<BandingTaskClass>().lambda()
+                                .eq(BandingTaskClass::getSortCode, dto.getSortCode())
+                                .eq(BandingTaskClass::getBandingTaskId, dto.getBandingTaskId())
+                );
+                if(!list.isEmpty()){
+                    errorList.add(dto.getName());
+                }
             }
+
+            BandingTaskClass bandingTask = BeanUtil.toBean(dto, BandingTaskClass.class);
+            bandingTask.setCreateDate(new Date());
+        }
+        if(!errorList.isEmpty()){
+            return RT.error(errorList.toString().replace("[", "").replace("]", "") + ",分班排序重复");
         }
 
-        BandingTaskClass bandingTask = BeanUtil.toBean(dto, BandingTaskClass.class);
-        boolean isSuccess = bandingTaskClassService.add(bandingTask);
+        boolean isSuccess = bandingTaskClassService.saveBatch(dataList);
         return RT.ok(isSuccess);
     }
 
     @PutMapping
-    @ApiOperation(value = "修改新生分班")
+    @ApiOperation(value = "批量新增或者修改新生分班")
     @SaCheckPermission("bandingTaskClass:edit")
-    public RT<Boolean> update(@Valid @RequestBody UpdateBandingClassDto dto){
-        if(dto.getSortCode() != null){
-            List<BandingTaskClass> list = bandingTaskClassService.list(
-                    new QueryWrapper<BandingTaskClass>().lambda()
-                            .eq(BandingTaskClass::getSortCode, dto.getSortCode())
-                            .eq(BandingTaskClass::getBandingTaskId, dto.getBandingTaskId())
-            );
-            if(!list.isEmpty()){
-                return RT.error("班级编号重复");
+    public RT<Boolean> update(@Valid @RequestBody List<UpdateBandingClassDto> dtoList){
+        List<BandingTaskClass> insList = new ArrayList<>();
+        List<BandingTaskClass> updList = new ArrayList<>();
+        List<String> errorList = new ArrayList<>();
+        for (UpdateBandingClassDto dto : dtoList) {
+            if(dto.getSortCode() != null){
+                List<BandingTaskClass> list = bandingTaskClassService.list(
+                        new QueryWrapper<BandingTaskClass>().lambda()
+                                .eq(BandingTaskClass::getSortCode, dto.getSortCode())
+                                .eq(BandingTaskClass::getBandingTaskId, dto.getBandingTaskId())
+                                .ne(dto.getId() != null,BandingTaskClass::getId, dto.getId())
+                );
+                if(!list.isEmpty()){
+                    errorList.add(dto.getName());
+                }
             }
+
+            BandingTaskClass bandingTask = BeanUtil.toBean(dto, BandingTaskClass.class);
+            if(bandingTask.getId() != null){
+                bandingTask.setModifyDate(new Date());
+                updList.add(bandingTask);
+            }else{
+                bandingTask.setCreateDate(new Date());
+                insList.add(bandingTask);
+            }
+
         }
-        BandingTaskClass bandingTask = BeanUtil.toBean(dto, BandingTaskClass.class);
-        return RT.ok(bandingTaskClassService.update(bandingTask));
+        if(!errorList.isEmpty()){
+            return RT.error(errorList.toString().replace("[", "").replace("]", "") + ",分班排序重复");
+        }
+        boolean saveBatch = bandingTaskClassService.saveBatch(insList);
+        boolean isSuccess = bandingTaskClassService.updateBatchById(updList);
+        return RT.ok(isSuccess);
     }
 
     @DeleteMapping
     @ApiOperation(value = "删除新生分班")
     @SaCheckPermission("bandingTaskClass:delete")
     public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
+        if(!ids.isEmpty()){
+            classStudentService.remove(
+                    new QueryWrapper<BandingTaskClassStudent>().lambda()
+                            .in(BandingTaskClassStudent::getBandingTaskClassId, ids)
+            );
+        }
+
         return RT.ok(bandingTaskClassService.delete(ids));
 
     }
     @PostMapping("/import")
     @ApiOperation(value = "导入")
-    public RT<Boolean> importData(@RequestParam MultipartFile file) throws IOException {
-        List<BandingTaskPageVo> savedDataList = EasyExcel.read(file.getInputStream()).head(BandingTaskPageVo.class).sheet().doReadSync();
-        Boolean result = bandingTaskClassService.saveBatch(BeanUtil.copyToList(savedDataList, BandingTaskClass.class));
+    public RT<Boolean> importData(@RequestParam Long bandingTaskId, @RequestParam MultipartFile file) throws IOException {
+        List<Map<Integer, Object>> excelDataList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(3).doReadSync();
+        Boolean result = bandingTaskClassService.importData(bandingTaskId, excelDataList);
         return RT.ok(result);
     }
 
-    @GetMapping("/export")
+    @PostMapping("/export-query")
     @ApiOperation(value = "导出学生列表")
-    public ResponseEntity<byte[]> exportData(@Valid BandingTaskClassStudentPageDto dto, @RequestParam(defaultValue = "false") Boolean isTemplate) {
+    public ResponseEntity<byte[]> exportData(@Valid @RequestBody BandingTaskClassStudentPageDto dto) {
         List<BandingTaskClassStudentListVo> listVos = bandingTaskClassService.classStudent(dto);
         List<BandingTaskClassExcelVo> list = BeanUtil.copyToList(listVos, BandingTaskClassExcelVo.class);
         ByteArrayOutputStream bot = new ByteArrayOutputStream();
         EasyExcel.write(bot, BandingTaskClassExcelVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(list);
 
-        return RT.fileStream(bot.toByteArray(), "学生分班情况" + ExcelTypeEnum.XLSX.getValue());
+        return RT.fileStream(bot.toByteArray(), "banding" + ExcelTypeEnum.XLSX.getValue());
     }
 
     @PostMapping("/reset")
     @ApiOperation(value = "重置功能")
     @SaCheckPermission("bandingTaskClass:add")
-    public RT<Boolean> reset(@Valid @RequestBody Long bandingTaskId){
-        boolean isSuccess = bandingTaskClassService.reset(bandingTaskId);
+    public RT<Boolean> reset(@Valid @RequestBody SureBandingTaskDto dto){
+        boolean isSuccess = bandingTaskClassService.reset(dto.getBandingTaskId());
         return RT.ok(isSuccess);
     }
 
@@ -206,4 +250,20 @@ public class BandingTaskClassController {
         List<BaseNewStudentPageDto> list = classStudentService.surplusStudent(dto.getBandingTaskClassId());
         return RT.ok(list);
     }
+
+
+    @GetMapping("/classListParam")
+    @ApiOperation(value = "根据专业和年级查询班级")
+    @SaCheckPermission("bandingTaskClass:surplus-student")
+    public RT<List<BandingTaskClassVo>> classListParam(@Valid BandingTaskClassListDto dto){
+        List<BandingTaskClassVo> list = bandingTaskClassService.selectJoinList(BandingTaskClassVo.class,
+                new MPJLambdaWrapper<BandingTaskClass>()
+                        .select(BandingTaskClass::getId)
+                        .select(BandingTaskClass.class, x -> VoToColumnUtil.fieldsToColumns(BandingTaskClass.class).contains(x.getProperty()))
+                        .leftJoin(BandingTask.class, BandingTask::getId, BandingTaskClass::getBandingTaskId)
+                        .eq(BandingTask::getGradeId, dto.getGradeId())
+                        .eq(BandingTaskClass::getMajorSetId, dto.getMajorSetId())
+        );
+        return RT.ok(list);
+    }
 }

+ 10 - 13
src/main/java/com/xjrsoft/module/banding/controller/BandingTaskController.java

@@ -4,11 +4,10 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
-import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.banding.dto.AddBandingTaskDto;
 import com.xjrsoft.module.banding.dto.AddBandingTaskRuleDto;
 import com.xjrsoft.module.banding.dto.AutomaticBandingTaskDto;
@@ -24,8 +23,6 @@ import com.xjrsoft.module.banding.service.IBandingTaskService;
 import com.xjrsoft.module.banding.vo.BandingTaskPageVo;
 import com.xjrsoft.module.banding.vo.BandingTaskRuleVo;
 import com.xjrsoft.module.banding.vo.BandingTaskVo;
-import com.xjrsoft.module.base.entity.BaseGrade;
-import com.xjrsoft.module.system.entity.DictionaryDetail;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -67,15 +64,7 @@ public class BandingTaskController {
     @SaCheckPermission("bandingtask:detail")
     public RT<PageOutput<BandingTaskPageVo>> page(@Valid BandingTaskPageDto dto){
 
-        IPage<BandingTaskPageVo> page = bandingTaskService.selectJoinListPage(ConventPage.getPage(dto), BandingTaskPageVo.class,
-                new MPJLambdaWrapper<BandingTask>()
-                        .select(BandingTask::getId)
-                        .select(BandingTask.class, x -> VoToColumnUtil.fieldsToColumns(BandingTaskPageVo.class).contains(x.getProperty()))
-                        .selectAs(DictionaryDetail::getName, BandingTaskPageVo::getEnrollTypeCn)
-                        .selectAs(BaseGrade::getName, BandingTaskPageVo::getGradeName)
-                        .leftJoin(BaseGrade.class, BaseGrade::getId, BandingTask::getGradeId)
-                        .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, BandingTask::getEnrollType)
-        );
+        IPage<BandingTaskPageVo> page = bandingTaskService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         PageOutput<BandingTaskPageVo> pageOutput = ConventPage.getPageOutput(page, BandingTaskPageVo.class);
         return RT.ok(pageOutput);
     }
@@ -96,6 +85,14 @@ public class BandingTaskController {
     @ApiOperation(value = "新增新生分班任务")
     @SaCheckPermission("bandingtask:add")
     public RT<Boolean> add(@Valid @RequestBody AddBandingTaskDto dto){
+        List<BandingTask> list = bandingTaskService.list(
+                new QueryWrapper<BandingTask>().lambda()
+                        .eq(BandingTask::getGradeId, dto.getGradeId())
+                        .eq(BandingTask::getEnrollType, dto.getEnrollType())
+        );
+        if (!list.isEmpty()) {
+            return RT.error("已存在一个任务,无法添加");
+        }
         BandingTask bandingTask = BeanUtil.toBean(dto, BandingTask.class);
         boolean isSuccess = bandingTaskService.add(bandingTask);
         return RT.ok(isSuccess);

+ 24 - 0
src/main/java/com/xjrsoft/module/banding/dto/BandingTaskClassListDto.java

@@ -0,0 +1,24 @@
+package com.xjrsoft.module.banding.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+/**
+* @title: 新生分班任务分页查询入参
+* @Author dzx
+* @Date: 2024-07-01
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BandingTaskClassListDto {
+
+    @ApiModelProperty("年级id")
+    private Long gradeId;
+
+    @ApiModelProperty("专业id")
+    private Long majorSetId;
+
+}

+ 6 - 0
src/main/java/com/xjrsoft/module/banding/dto/BandingTaskClassPageDto.java

@@ -18,4 +18,10 @@ public class BandingTaskClassPageDto{
 
     @ApiModelProperty("任务id")
     private Long bandingTaskId;
+
+    @ApiModelProperty("年级id")
+    private Long gradeId;
+
+    @ApiModelProperty("招生类型")
+    private String enrollType;
 }

+ 6 - 0
src/main/java/com/xjrsoft/module/banding/dto/BandingTaskClassStudentPageDto.java

@@ -39,4 +39,10 @@ public class BandingTaskClassStudentPageDto extends PageInput {
 
     @ApiModelProperty("班级状态")
     private String status;
+
+    @ApiModelProperty("招生类型")
+    private String enrollType;
+
+    @ApiModelProperty("年级id")
+    private Long gradeId;
 }

+ 3 - 1
src/main/java/com/xjrsoft/module/banding/dto/BandingTaskPageDto.java

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.banding.dto;
 
 import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -15,5 +16,6 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = false)
 public class BandingTaskPageDto extends PageInput {
 
-
+    @ApiModelProperty("招生类型")
+    private String enrollType;
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/banding/dto/ChangeClassDto.java

@@ -26,4 +26,7 @@ public class ChangeClassDto implements Serializable {
     @ApiModelProperty("班级id")
     private Long bandingTaskClassId;
 
+    @ApiModelProperty("是否手动分班(1:是 0:否)")
+    private Integer isHandle = 0;
+
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/banding/dto/SureBandingTaskDto.java

@@ -23,4 +23,7 @@ public class SureBandingTaskDto implements Serializable {
     @ApiModelProperty("id")
     private Long id;
 
+    @ApiModelProperty("任务id")
+    private Long bandingTaskId;
+
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/banding/entity/BandingTaskClass.java

@@ -104,7 +104,7 @@ public class BandingTaskClass implements Serializable {
     * 是否订单班(0:否 1:是)
     */
     @ApiModelProperty("是否订单班(0:否 1:是)")
-    private Long isOrderClass;
+    private Integer isOrderClass;
     /**
     * 身高
     */

+ 4 - 0
src/main/java/com/xjrsoft/module/banding/mapper/BandingTaskMapper.java

@@ -1,7 +1,10 @@
 package com.xjrsoft.module.banding.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.banding.dto.BandingTaskPageDto;
 import com.xjrsoft.module.banding.entity.BandingTask;
+import com.xjrsoft.module.banding.vo.BandingTaskPageVo;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -13,4 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface BandingTaskMapper extends MPJBaseMapper<BandingTask> {
 
+    Page<BandingTaskPageVo> getPage(Page<BandingTaskPageVo> page, BandingTaskPageDto dto);
 }

+ 5 - 0
src/main/java/com/xjrsoft/module/banding/service/IBandingTaskClassService.java

@@ -8,8 +8,11 @@ import com.xjrsoft.module.banding.vo.BandingTaskClassPageVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassStudentListVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassSureListVo;
 import org.apache.ibatis.annotations.Param;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
+import java.util.Map;
 
 /**
 * @title: 新生分班任务
@@ -51,4 +54,6 @@ public interface IBandingTaskClassService extends MPJBaseService<BandingTaskClas
     List<BandingTaskClassStudentListVo> classStudent(BandingTaskClassStudentPageDto dto);
 
     List<BandingTaskClassSureListVo> getClassSure(BandingTaskClassStudentPageDto dto);
+
+    Boolean importData(Long bandingTaskId, List<Map<Integer, Object>> excelDataList);
 }

+ 6 - 0
src/main/java/com/xjrsoft/module/banding/service/IBandingTaskService.java

@@ -1,9 +1,12 @@
 package com.xjrsoft.module.banding.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.banding.dto.AutomaticBandingTaskDto;
+import com.xjrsoft.module.banding.dto.BandingTaskPageDto;
 import com.xjrsoft.module.banding.dto.SureBandingTaskDto;
 import com.xjrsoft.module.banding.entity.BandingTask;
+import com.xjrsoft.module.banding.vo.BandingTaskPageVo;
 
 import java.util.List;
 
@@ -43,4 +46,7 @@ public interface IBandingTaskService extends MPJBaseService<BandingTask> {
 
 
     Boolean sure(SureBandingTaskDto dto);
+
+    Page<BandingTaskPageVo> getPage(Page<BandingTaskPageVo> page, BandingTaskPageDto dto);
+
 }

+ 78 - 0
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassServiceImpl.java

@@ -2,8 +2,13 @@ package com.xjrsoft.module.banding.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.enums.YesOrNoEnum;
+import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.banding.dto.BandingTaskClassPageDto;
 import com.xjrsoft.module.banding.dto.BandingTaskClassStudentPageDto;
+import com.xjrsoft.module.banding.entity.BandingTask;
 import com.xjrsoft.module.banding.entity.BandingTaskClass;
 import com.xjrsoft.module.banding.entity.BandingTaskClassStudent;
 import com.xjrsoft.module.banding.mapper.BandingTaskClassMapper;
@@ -13,12 +18,22 @@ import com.xjrsoft.module.banding.service.IBandingTaskClassService;
 import com.xjrsoft.module.banding.vo.BandingTaskClassPageVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassStudentListVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassSureListVo;
+import com.xjrsoft.module.base.entity.BaseClassroom;
+import com.xjrsoft.module.base.entity.BaseMajorSet;
+import com.xjrsoft.module.base.service.IBaseClassroomService;
+import com.xjrsoft.module.base.service.IBaseMajorSetService;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.service.IUserService;
+import com.xjrsoft.module.teacher.entity.BaseTeacher;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -33,6 +48,9 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
 
     private final BandingTaskMapper bandingTaskMapper;
     private final BandingTaskClassStudentMapper classStudentMapper;
+    private final IBaseClassroomService classroomService;
+    private final IUserService userService;
+    private final IBaseMajorSetService majorSetService;
     @Override
     public Boolean add(BandingTaskClass bandingTaskClass) {
         bandingTaskClass.setCreateDate(new Date());
@@ -56,6 +74,9 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
 
     @Override
     public List<BandingTaskClassPageVo> getList(BandingTaskClassPageDto dto) {
+        BandingTask bandingTask = bandingTaskMapper.selectById(dto.getBandingTaskId());
+        dto.setGradeId(bandingTask.getGradeId());
+        dto.setEnrollType(bandingTask.getEnrollType());
         return this.baseMapper.getList(dto);
     }
 
@@ -85,6 +106,9 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
 
     @Override
     public List<BandingTaskClassStudentListVo> classStudent(BandingTaskClassStudentPageDto dto) {
+        BandingTask bandingTask = bandingTaskMapper.selectById(dto.getBandingTaskId());
+        dto.setGradeId(bandingTask.getGradeId());
+        dto.setEnrollType(bandingTask.getEnrollType());
         return this.baseMapper.getClassStudent(dto);
     }
 
@@ -92,4 +116,58 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
     public List<BandingTaskClassSureListVo> getClassSure(BandingTaskClassStudentPageDto dto) {
         return this.baseMapper.getClassSure(dto);
     }
+
+    @Override
+    public Boolean importData(Long bandingTaskId, List<Map<Integer, Object>> excelDataList) {
+        List<BaseClassroom> classroomList = classroomService.list(
+                new QueryWrapper<BaseClassroom>().lambda()
+                        .eq(BaseClassroom::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+        Map<String, Long> classroomMap = new HashMap<>();
+        for (BaseClassroom classroom : classroomList) {
+            classroomMap.put(classroom.getName(), classroom.getId());
+        }
+        List<User> userList = userService.list(
+                new MPJLambdaWrapper<User>()
+                        .select(User::getId)
+                        .select(User.class, x -> VoToColumnUtil.fieldsToColumns(User.class).contains(x.getProperty()))
+                        .innerJoin(BaseTeacher.class, BaseTeacher::getUserId, User::getId)
+        );
+        Map<String, Long> userMap = new HashMap<>();
+        for (User user : userList) {
+            userMap.put(user.getName(), user.getId());
+        }
+
+        List<BaseMajorSet> majorSetList = majorSetService.list(
+                new QueryWrapper<BaseMajorSet>().lambda()
+        );
+
+        Map<String, Long> majorSetMap = new HashMap<>();
+        for (BaseMajorSet majorSet : majorSetList) {
+            majorSetMap.put(majorSet.getName(), majorSet.getId());
+        }
+
+
+        List<BandingTaskClass> classList = new ArrayList<>();
+        Date createDate = new Date();
+        for (Map<Integer, Object> taskClass : excelDataList) {
+            classList.add(new BandingTaskClass(){{
+                setBandingTaskId(bandingTaskId);
+                setCreateDate(createDate);
+                setName(taskClass.get(1).toString());
+                setMajorSetId(majorSetMap.get(taskClass.get(0).toString().trim()));
+                setNumber(Integer.parseInt(taskClass.get(2).toString()));
+                setClassroomId(classroomMap.get(taskClass.get(4).toString()));
+                if(taskClass.get(5) != null){
+                    setIsOrderClass(YesOrNoEnum.getCode(taskClass.get(5).toString()));
+                }
+                if(taskClass.get(6) != null){
+                    setSortCode(Integer.parseInt(taskClass.get(6).toString()));
+                }
+                setTeacherId(userMap.get(taskClass.get(3).toString()));
+            }});
+        }
+        Boolean result = this.saveBatch(classList);
+        return result;
+    }
 }

+ 199 - 0
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassStudentServiceImpl.java

@@ -1,22 +1,56 @@
 package com.xjrsoft.module.banding.service.impl;
 
+import cn.dev33.satoken.secure.BCrypt;
 import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.common.enums.ArchivesStatusEnum;
+import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.enums.EnabledMark;
+import com.xjrsoft.common.enums.RoleEnum;
+import com.xjrsoft.config.CommonPropertiesConfig;
+import com.xjrsoft.module.banding.dto.BandingTaskClassStudentPageDto;
 import com.xjrsoft.module.banding.dto.ChangeClassDto;
+import com.xjrsoft.module.banding.entity.BandingTask;
 import com.xjrsoft.module.banding.entity.BandingTaskClass;
 import com.xjrsoft.module.banding.entity.BandingTaskClassStudent;
 import com.xjrsoft.module.banding.mapper.BandingTaskClassMapper;
 import com.xjrsoft.module.banding.mapper.BandingTaskClassStudentMapper;
+import com.xjrsoft.module.banding.mapper.BandingTaskMapper;
 import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
+import com.xjrsoft.module.banding.vo.BandingTaskClassSureListVo;
+import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.base.entity.BaseMajorSet;
+import com.xjrsoft.module.base.mapper.BaseMajorSetMapper;
+import com.xjrsoft.module.base.service.IBaseClassService;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.entity.UserRoleRelation;
+import com.xjrsoft.module.organization.service.IUserRoleRelationService;
+import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
+import com.xjrsoft.module.student.entity.BaseClassMajorSet;
+import com.xjrsoft.module.student.entity.BaseNewStudent;
+import com.xjrsoft.module.student.entity.BaseStudent;
+import com.xjrsoft.module.student.entity.BaseStudentFamily;
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.student.mapper.BaseClassMajorSetMapper;
+import com.xjrsoft.module.student.service.IBaseNewStudentService;
+import com.xjrsoft.module.student.service.IBaseStudentFamilyService;
+import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
+import com.xjrsoft.module.student.service.IBaseStudentService;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
 * @title: 新生分班任务
@@ -28,6 +62,18 @@ import java.util.List;
 @AllArgsConstructor
 public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<BandingTaskClassStudentMapper, BandingTaskClassStudent> implements IBandingTaskClassStudentService {
     private final BandingTaskClassMapper taskClassMapper;
+    private final BandingTaskMapper bandingTaskMapper;
+    private final IBaseNewStudentService newStudentService;
+
+    private final IBaseClassService classService;
+    private final BaseClassMajorSetMapper classMajorSetMapper;
+    private final CommonPropertiesConfig propertiesConfig;
+    private final IUserService userService;
+    private final IUserRoleRelationService roleRelationService;
+    private final IBaseStudentSchoolRollService schoolRollService;
+    private final IBaseStudentService studentService;
+    private final IBaseStudentFamilyService familyService;
+    private final BaseMajorSetMapper majorSetMapper;
     @Override
     public Boolean add(BandingTaskClassStudent bandingTaskClass) {
         bandingTaskClass.setCreateDate(new Date());
@@ -64,15 +110,167 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
                         setNewStudentId(newStudentId);
                         setBandingTaskClassId(dto.getBandingTaskClassId());
                         setCreateUserId(createUserId);
+                        if(dto.getIsHandle() != null && dto.getIsHandle() == 1){
+                            setStatus(1);
+                        }
                     }}
             );
         }
         if(!dataList.isEmpty()){
             this.saveBatch(dataList);
         }
+        if(dto.getIsHandle() != null && dto.getIsHandle() == 1){
+            BandingTaskClass taskClass = taskClassMapper.selectById(dto.getBandingTaskClassId());
+            List<Long> studentIds = dataList.stream().map(BandingTaskClassStudent::getNewStudentId).collect(Collectors.toList());
+            List<BaseNewStudent> list = newStudentService.list(
+                    new QueryWrapper<BaseNewStudent>().lambda()
+                            .in(BaseNewStudent::getId, studentIds)
+            );
+            List<BaseNewStudent> updateList = new ArrayList<>();
+            for (BaseNewStudent student : list) {
+                student.setStatus(1);
+                updateList.add(student);
+            }
+            if(!updateList.isEmpty()){
+                newStudentService.updateBatchById(updateList);
+            }
+            createStudentData(taskClass.getBandingTaskId(), dataList, updateList);
+        }
         return true;
     }
 
+    void createStudentData(Long badingTaskId,List<BandingTaskClassStudent> classStudents, List<BaseNewStudent> updateList){
+        Date createDate = new Date();
+        BandingTask bandingTask = bandingTaskMapper.selectById(badingTaskId);
+        List<BandingTaskClassSureListVo> classSure = taskClassMapper.getClassSure(new BandingTaskClassStudentPageDto() {{
+            setBandingTaskId(badingTaskId);
+        }});
+
+        Map<Long, Integer> classTotal = classSure.stream().collect(Collectors.toMap(BandingTaskClassSureListVo::getId, BandingTaskClassSureListVo::getNumber));
+        Map<Long, Integer> classBoy = classSure.stream().collect(Collectors.toMap(BandingTaskClassSureListVo::getId, BandingTaskClassSureListVo::getMaleCount));
+        Map<Long, Integer> classGirl = classSure.stream().collect(Collectors.toMap(BandingTaskClassSureListVo::getId, BandingTaskClassSureListVo::getFemaleCount));
+
+
+        //生成班级数据
+        Map<Long, Long> classMap = new HashMap<>();
+        Map<Long, Long> taskClassMajorMap = new HashMap<>();
+        //查询出需要新增的班级信息
+        List<Long> classIds = classStudents.stream().map(BandingTaskClassStudent::getBandingTaskClassId).collect(Collectors.toList());
+        List<BandingTaskClass> classList = taskClassMapper.selectList(new QueryWrapper<BandingTaskClass>().lambda().in(BandingTaskClass::getId, classIds));
+        Map<Long, Long> majorDeptMap = majorSetMapper.selectList(new QueryWrapper<BaseMajorSet>()).stream().collect(Collectors.toMap(BaseMajorSet::getId, BaseMajorSet::getDepartmentId));
+        for (BandingTaskClass taskClass : classList) {
+            BaseClass baseClass = new BaseClass() {{
+                setName(taskClass.getName());
+                setClassroomId(taskClass.getClassroomId());
+                setTeacherId(taskClass.getTeacherId());
+                setIsGraduate(1);
+                setOrgId(majorDeptMap.get(taskClass.getMajorSetId()));
+                setIsOrderClass(taskClass.getIsOrderClass()==null?0:taskClass.getIsOrderClass().intValue());
+                setGradeId(bandingTask.getGradeId());
+                setDeleteMark(DeleteMark.NODELETE.getCode());
+                setEnrollType(bandingTask.getEnrollType());
+            }};
+
+            classService.save(baseClass);
+
+            BaseClassMajorSet majorSet = new BaseClassMajorSet() {{
+                setCreateDate(createDate);
+                setMajorSetId(taskClass.getMajorSetId());
+                setClassId(baseClass.getId());
+                setPlanTotalStudent(taskClass.getNumber());
+                setTotalStudent(classTotal.get(taskClass.getId()));
+                setBoyNum(classBoy.get(taskClass.getId()));
+                setGirlNum(classGirl.get(taskClass.getId()));
+            }};
+            classMajorSetMapper.insert(majorSet);
+
+            classMap.put(taskClass.getId(), baseClass.getId());
+            taskClassMajorMap.put(taskClass.getId(), taskClass.getMajorSetId());
+        }
+
+        /**
+         * 新增学生数据
+         * 1、新增用户xjr_user
+         * 2、新增用户与角色的关系xjr_user_role_relation
+         * 3、新增学生基本信息base_student
+         * 4、新增学籍信息表base_student_school_roll
+         * 5、新增家庭信息表base_student_family
+         */
+        LocalDateTime now = LocalDateTime.now();
+        Map<Long, Long> studentClassRelation = classStudents.stream().collect(Collectors.toMap(BandingTaskClassStudent::getNewStudentId, BandingTaskClassStudent::getBandingTaskClassId));
+        for (BaseNewStudent student : updateList) {
+            LocalDate birthDate = getBirthDate(student.getCredentialNumber());
+            User xjrUser = new User() {{
+                setCreateDate(now);
+                setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
+                setName(student.getName());
+                setUserName(student.getCredentialNumber());
+                setCredentialNumber(student.getCredentialNumber());
+                setCredentialType("ZZLS10007");
+                setMobile(student.getMobile());
+                setEnabledMark(EnabledMark.DISABLED.getCode());
+                setGender(student.getGender());
+                setIsChangePassword(1);
+                setBirthDate(birthDate.atStartOfDay());
+            }};
+            userService.save(xjrUser);
+
+            UserRoleRelation userRoleRelation = new UserRoleRelation() {{
+                setRoleId(RoleEnum.STUDENT.getCode());
+                setUserId(xjrUser.getId());
+            }};
+            roleRelationService.save(userRoleRelation);
+
+            BaseStudent baseStudent = new BaseStudent() {{
+                setUserId(xjrUser.getId());
+                setCreateDate(now);
+                setStudentId(student.getCredentialNumber());
+                if(student.getHeight() != null){
+                    setHeight(student.getHeight().doubleValue());
+                }
+                if(student.getWeight() != null){
+                    setWeight(student.getWeight().doubleValue());
+                }
+            }};
+            studentService.save(baseStudent);
+
+            BaseStudentSchoolRoll schoolRoll = new BaseStudentSchoolRoll() {{
+                setUserId(xjrUser.getId());
+                if(student.getScore() != null){
+                    setGraduatedScore(student.getScore().doubleValue());
+                }
+
+                setGraduatedUniversity(student.getGraduateSchool());
+                setClassId(classMap.get(studentClassRelation.get(student.getId())));
+                setMajorSetId(taskClassMajorMap.get(studentClassRelation.get(student.getId())));
+                setStduyStatus(student.getStduyStatus());
+                setEnrollType(bandingTask.getEnrollType());
+                setStudentSource(student.getSource());
+                setGradeId(bandingTask.getGradeId());
+                setArchivesStatus(ArchivesStatusEnum.FB2901.getCode());
+                setCreateDate(now);
+            }};
+            schoolRollService.save(schoolRoll);
+
+            BaseStudentFamily studentFamily = new BaseStudentFamily() {{
+                setCreateDate(now);
+                setUserId(xjrUser.getId());
+                setTelephone(student.getFamilyMobile());
+                setAddress(student.getFamilyAddress());
+            }};
+            familyService.save(studentFamily);
+        }
+    }
+
+    LocalDate getBirthDate(String idCardNumber){
+        // 获取出生日期前6位,即yyyyMM
+        String birthdayString = idCardNumber.substring(6, 14);
+
+        // 将字符串解析为LocalDate对象
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
+        return LocalDate.parse(birthdayString, formatter);
+    }
+
     @Override
     public Boolean removeStudent(ChangeClassDto dto) {
         this.baseMapper.delete(
@@ -111,6 +309,7 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
         if(!dataList.isEmpty()){
            this.saveBatch(dataList);
         }
+
         return true;
     }
 

+ 161 - 36
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskServiceImpl.java

@@ -3,9 +3,12 @@ package com.xjrsoft.module.banding.service.impl;
 import cn.dev33.satoken.secure.BCrypt;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+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.enums.EnabledMark;
 import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.enums.RoleEnum;
 import com.xjrsoft.common.exception.MyException;
@@ -13,6 +16,7 @@ import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.config.CommonPropertiesConfig;
 import com.xjrsoft.module.banding.dto.AutomaticBandingTaskDto;
 import com.xjrsoft.module.banding.dto.BandingTaskClassStudentPageDto;
+import com.xjrsoft.module.banding.dto.BandingTaskPageDto;
 import com.xjrsoft.module.banding.dto.SureBandingTaskDto;
 import com.xjrsoft.module.banding.entity.BandingRule;
 import com.xjrsoft.module.banding.entity.BandingTask;
@@ -28,7 +32,10 @@ import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
 import com.xjrsoft.module.banding.service.IBandingTaskMajorConditionService;
 import com.xjrsoft.module.banding.service.IBandingTaskService;
 import com.xjrsoft.module.banding.vo.BandingTaskClassSureListVo;
+import com.xjrsoft.module.banding.vo.BandingTaskPageVo;
 import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.base.entity.BaseMajorSet;
+import com.xjrsoft.module.base.mapper.BaseMajorSetMapper;
 import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.entity.UserRoleRelation;
@@ -50,6 +57,8 @@ import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
@@ -88,6 +97,8 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
     private final IBaseStudentService studentService;
     private final IBaseStudentFamilyService familyService;
 
+    private final BaseMajorSetMapper majorSetMapper;
+
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -131,7 +142,7 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
         }
         //1、查询需要分班的学生信息
         List<String> orderColumn = new ArrayList();
-        orderColumn.add("height");orderColumn.add("score");
+        orderColumn.add("score");
         List<BaseNewStudent> baseNewStudents = newStudentService.selectJoinList(BaseNewStudent.class,
                 new MPJLambdaWrapper<BaseNewStudent>()
                         .select(BaseNewStudent::getId)
@@ -144,6 +155,14 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
         );
         //2、查询所有班级信息
         List<BandingTaskClass> classList = taskClassMapper.getListOrderByAsc(bandingTask.getId());
+        if(!classList.isEmpty()){
+            //清除数据
+            List<Long> classIds = classList.stream().map(BandingTaskClass::getId).collect(Collectors.toList());
+            classStudentService.remove(
+                    new QueryWrapper<BandingTaskClassStudent>().lambda()
+                            .in(BandingTaskClassStudent::getBandingTaskClassId, classIds)
+            );
+        }
 
         //3、查询所用到的规则
         List<BandingRule> ruleList = ruleMapper.selectJoinList(BandingRule.class,
@@ -159,8 +178,8 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
         Map<Long, Integer> classLimitMap = new HashMap<>();
         if(ruleCodes.contains("BR0004")){
             //查询每个专业下面有多少个班级
-            Map<Long, Integer> majorClassCount = taskClassMapper.getMajorClassCount(bandingTask.getId())
-                    .stream().collect(Collectors.toMap(IdCountVo::getId, IdCountVo::getCount));
+            List<IdCountVo> majorClassCountList = taskClassMapper.getMajorClassCount(bandingTask.getId());
+            Map<Long, Integer> majorClassCount = majorClassCountList.stream().collect(Collectors.toMap(IdCountVo::getId, IdCountVo::getCount));
             //查询每个专业下面的班级人数
             Map<Long, Integer> majorClassStudentCount = taskClassMapper.getMajorClassStudentCount(bandingTask.getId())
                     .stream().collect(Collectors.toMap(IdCountVo::getId, IdCountVo::getCount));
@@ -170,8 +189,14 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
 
             Map<Long, Integer> majorLimitMap = new HashMap<>();
             for (Long majorSetId : majorClassStudentCount.keySet()) {
-                Integer majorClassNumber = majorClassStudentCount.get(majorSetId);
-                Integer majorStudentNumber = majorStudentCount.get(majorSetId);
+                int majorClassNumber = 0;
+                if(majorClassStudentCount.get(majorSetId) != null){
+                    majorClassNumber = majorClassStudentCount.get(majorSetId);
+                }
+                int majorStudentNumber = 0;
+                if(majorStudentCount.get(majorSetId) != null){
+                    majorStudentNumber = majorStudentCount.get(majorSetId);
+                }
                 Integer classCount = majorClassCount.get(majorSetId);
                 if(majorStudentNumber < majorClassNumber){//报名人数小于班级人数
                     Integer classLimtCount = majorStudentNumber / classCount;
@@ -202,6 +227,7 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
         }
         //存班级和学生的关系
         Map<Long, Long> studentClassMap = new HashMap<>();
+        Map<Long, List<String>> classNameMap = new HashMap<>();
         //4、开始分班
         for (BandingTaskClass taskClass : classList) {
             Integer number = taskClass.getNumber();//班级总人数
@@ -228,11 +254,12 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
                 }
             }
             List<String> nameList = new ArrayList<>();
-            List<BaseNewStudent> maleList = new ArrayList();
-            List<BaseNewStudent> femaleList = new ArrayList();
+            List<BaseNewStudent> maleList = new ArrayList();//男生
+            List<BaseNewStudent> femaleList = new ArrayList();//女生
+
             List<BaseNewStudent> studentList = new ArrayList<>();
             studentList.addAll(baseNewStudents);
-            if(ruleCodes.contains("BR0002") && !classStudentMap.get(taskClass.getMajorSetId()).isEmpty()){
+            if(ruleCodes.contains("BR0002") && classStudentMap.get(taskClass.getMajorSetId()) != null && !classStudentMap.get(taskClass.getMajorSetId()).isEmpty()){
                 studentList.clear();
                 studentList.addAll(classStudentMap.get(taskClass.getMajorSetId()));
             }
@@ -262,23 +289,30 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
                     }
                 }
 
+                if(taskClass.getSortCode() == null && !Objects.equals(taskClass.getMajorSetId(), newStudent.getFirstAmbitionId())){//如果未给班级设置优先级,只匹配一志愿的学生
+                    continue;
+                }
+
                 List<Boolean> conditionList = new ArrayList<>();
                 BandingTaskMajorCondition condition = classConditionMap.get(taskClass.getMajorSetId());
-                if(condition.getHeight() !=null && newStudent.getHeight() != null && newStudent.getHeight().compareTo(condition.getHeight()) >= 0 ){
-                    conditionList.add(true);
-                }else if(condition.getHeight() !=null && newStudent.getHeight() != null && newStudent.getHeight().compareTo(condition.getHeight()) < 0){
-                    conditionList.add(false);
-                }else if(condition.getHeight() !=null && newStudent.getHeight() == null){
-                    conditionList.add(false);
-                }
+                if(condition != null){
+                    if(condition.getHeight() !=null && newStudent.getHeight() != null && newStudent.getHeight().compareTo(condition.getHeight()) >= 0 ){
+                        conditionList.add(true);
+                    }else if(condition.getHeight() !=null && newStudent.getHeight() != null && newStudent.getHeight().compareTo(condition.getHeight()) < 0){
+                        conditionList.add(false);
+                    }else if(condition.getHeight() !=null && newStudent.getHeight() == null){
+                        conditionList.add(false);
+                    }
 
-                if(condition.getScore() !=null && newStudent.getScore() != null && newStudent.getScore().compareTo(condition.getScore()) >= 0 ){
-                    conditionList.add(true);
-                }else if(condition.getScore() !=null && newStudent.getScore() != null && newStudent.getScore().compareTo(condition.getScore()) < 0){
-                    conditionList.add(false);
-                }else if(condition.getScore() !=null && newStudent.getScore() == null){
-                    conditionList.add(false);
+                    if(condition.getScore() !=null && newStudent.getScore() != null && newStudent.getScore().compareTo(condition.getScore()) >= 0 ){
+                        conditionList.add(true);
+                    }else if(condition.getScore() !=null && newStudent.getScore() != null && newStudent.getScore().compareTo(condition.getScore()) < 0){
+                        conditionList.add(false);
+                    }else if(condition.getScore() !=null && newStudent.getScore() == null){
+                        conditionList.add(false);
+                    }
                 }
+
                 //如果包含false,则表明不符合条件,这个学生跳过
                 if(conditionList.contains(false)){
                     continue;
@@ -291,7 +325,74 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
                 }
                 nameList.add(newStudent.getName());
             }
+            classNameMap.put(taskClass.getId(), nameList);
         }
+        // 4.1、二次循环班级,对没有设置排序的班级进行分班,
+        for (BandingTaskClass taskClass : classList) {
+            Integer number = taskClass.getNumber();//班级总人数
+            if(classLimitMap.get(taskClass.getId()) != null){
+                if(number > classLimitMap.get(taskClass.getId())){
+                    number = classLimitMap.get(taskClass.getId());
+                }
+            }
+            List<String> nameList = classNameMap.get(taskClass.getId());
+            if(nameList.size() == number){
+                continue;
+            }
+            List<BaseNewStudent> studentList = new ArrayList<>();
+            studentList.addAll(baseNewStudents);
+            if(ruleCodes.contains("BR0002") && classStudentMap.get(taskClass.getMajorSetId()) != null && !classStudentMap.get(taskClass.getMajorSetId()).isEmpty()){
+                studentList.clear();
+                studentList.addAll(classStudentMap.get(taskClass.getMajorSetId()));
+            }
+
+            for (BaseNewStudent newStudent : studentList) {
+                //人数已满,进行下一个班级的的循环
+                if(nameList.size() == number){
+                    break;
+                }
+                //该学生已被分配
+                if(studentClassMap.containsKey(newStudent.getId())){
+                    continue;
+                }
+                if(ruleCodes.contains("BR0003") && nameList.contains(newStudent.getName())){
+                    continue;
+                }
+                //专业不匹配,直接跳过
+                if(!Objects.equals(taskClass.getMajorSetId(), newStudent.getFirstAmbitionId()) && !Objects.equals(taskClass.getMajorSetId(), newStudent.getSecondAmbitionId())){
+                    continue;
+                }
+                //判断该班性别是否已满
+                List<Boolean> conditionList = new ArrayList<>();
+                BandingTaskMajorCondition condition = classConditionMap.get(taskClass.getMajorSetId());
+                if(condition != null){
+                    if(condition.getHeight() !=null && newStudent.getHeight() != null && newStudent.getHeight().compareTo(condition.getHeight()) >= 0 ){
+                        conditionList.add(true);
+                    }else if(condition.getHeight() !=null && newStudent.getHeight() != null && newStudent.getHeight().compareTo(condition.getHeight()) < 0){
+                        conditionList.add(false);
+                    }else if(condition.getHeight() !=null && newStudent.getHeight() == null){
+                        conditionList.add(false);
+                    }
+
+                    if(condition.getScore() !=null && newStudent.getScore() != null && newStudent.getScore().compareTo(condition.getScore()) >= 0 ){
+                        conditionList.add(true);
+                    }else if(condition.getScore() !=null && newStudent.getScore() != null && newStudent.getScore().compareTo(condition.getScore()) < 0){
+                        conditionList.add(false);
+                    }else if(condition.getScore() !=null && newStudent.getScore() == null){
+                        conditionList.add(false);
+                    }
+                }
+
+                //如果包含false,则表明不符合条件,这个学生跳过
+                if(conditionList.contains(false)){
+                    continue;
+                }
+                studentClassMap.put(newStudent.getId(), taskClass.getId());
+                nameList.add(newStudent.getName());
+            }
+        }
+
+
         List<BandingTaskClassStudent> dataList = new ArrayList<>();
         Date createDate = new Date();
         for (Long studentId : studentClassMap.keySet()) {
@@ -319,6 +420,15 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
                                                          List<BandingTaskClass> classList){
         Map<Long, List<BaseNewStudent>> classStudentMap = new HashMap<>();
         for (Long majorSetId : classConditionMap.keySet()) {
+            //查询该专业下面有几个班级,把这部分学生按照成绩均匀分组
+            List<List<BaseNewStudent>> result = new ArrayList<>();
+            for (int i = 0; i < classList.size(); i++) {
+                result.add(new ArrayList<>());
+            }
+            if(result.size() == 1){
+                continue;
+            }
+
             // 1、先把每个专业匹配的学生分组存一起,并按照分数高低排序
             List<BaseNewStudent> stuList = new ArrayList<>();
 
@@ -350,17 +460,18 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
                 }
                 stuList.add(newStudent);
             }
-
-            Collections.sort(stuList, (s1, s2) -> (int) (s2.getScore().doubleValue() - s1.getScore().doubleValue())); //按照成绩降序排序
-            //查询该专业下面有几个班级,把这部分学生按照成绩均匀分组
-            List<List<BaseNewStudent>> result = new ArrayList<>();
-            for (int i = 0; i < classList.size(); i++) {
-                result.add(new ArrayList<>());
+            if(!stuList.isEmpty()){
+                for (BaseNewStudent student : stuList) {
+                    if(student.getScore() == null){
+                        student.setScore(BigDecimal.ZERO);
+                    }
+                }
+                Collections.sort(stuList, (s1, s2) -> (int) (s2.getScore().doubleValue() - s1.getScore().doubleValue())); //按照成绩降序排序
             }
 
             for (int i = 0; i < stuList.size(); i++) {
                 BaseNewStudent currentStudent = stuList.get(i);
-                int classIndex = i % stuList.size(); //分配班级
+                int classIndex = i % result.size(); //分配班级
                 result.get(classIndex).add(currentStudent);
             }
 
@@ -381,9 +492,12 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
                         .select(BandingTaskClassStudent.class, x -> VoToColumnUtil.fieldsToColumns(BandingTaskClassStudent.class).contains(x.getProperty()))
                         .leftJoin(BandingTaskClass.class, BandingTaskClass::getId, BandingTaskClassStudent::getBandingTaskClassId)
                         .eq(BandingTaskClass::getBandingTaskId, dto.getId())
-                        .eq(BandingTaskClassStudent::getStatus, 1)
+                        .eq(BandingTaskClassStudent::getStatus, 0)
         );
         List<Long> studentIds = classStudents.stream().map(BandingTaskClassStudent::getNewStudentId).collect(Collectors.toList());
+        if(studentIds.isEmpty()){
+            throw new MyException("未能查询到学生,无法确认");
+        }
         List<BaseNewStudent> list = newStudentService.list(
                 new QueryWrapper<BaseNewStudent>().lambda()
                         .in(BaseNewStudent::getId, studentIds)
@@ -401,7 +515,6 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
         //形成学生数据
         createStudentData(dto.getId(), classStudents, updateList);
 
-
         BandingTask bandingTask = this.getById(dto.getId());
         bandingTask.setStatus(1);
         bandingTask.setModifyDate(new Date());
@@ -409,6 +522,11 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
         return isSuccess;
     }
 
+    @Override
+    public Page<BandingTaskPageVo> getPage(Page<BandingTaskPageVo> page, BandingTaskPageDto dto) {
+        return this.baseMapper.getPage(page, dto);
+    }
+
     void createStudentData(Long badingTaskId,List<BandingTaskClassStudent> classStudents, List<BaseNewStudent> updateList){
         Date createDate = new Date();
         BandingTask bandingTask = this.getById(badingTaskId);
@@ -427,15 +545,19 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
         //查询出需要新增的班级信息
         List<Long> classIds = classStudents.stream().map(BandingTaskClassStudent::getBandingTaskClassId).collect(Collectors.toList());
         List<BandingTaskClass> classList = taskClassMapper.selectList(new QueryWrapper<BandingTaskClass>().lambda().in(BandingTaskClass::getId, classIds));
+
+        Map<Long, Long> majorDeptMap = majorSetMapper.selectList(new QueryWrapper<BaseMajorSet>()).stream().collect(Collectors.toMap(BaseMajorSet::getId, BaseMajorSet::getDepartmentId));
         for (BandingTaskClass taskClass : classList) {
             BaseClass baseClass = new BaseClass() {{
                 setName(taskClass.getName());
                 setClassroomId(taskClass.getClassroomId());
                 setTeacherId(taskClass.getTeacherId());
                 setIsGraduate(1);
-                setIsOrderClass(taskClass.getIsOrderClass().intValue());
+                setIsOrderClass(taskClass.getIsOrderClass()==null?0:taskClass.getIsOrderClass().intValue());
                 setGradeId(bandingTask.getGradeId());
+                setDeleteMark(DeleteMark.NODELETE.getCode());
                 setEnrollType(bandingTask.getEnrollType());
+                setOrgId(majorDeptMap.get(taskClass.getMajorSetId()));
             }};
 
             classService.save(baseClass);
@@ -466,7 +588,7 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
         LocalDateTime now = LocalDateTime.now();
         Map<Long, Long> studentClassRelation = classStudents.stream().collect(Collectors.toMap(BandingTaskClassStudent::getNewStudentId, BandingTaskClassStudent::getBandingTaskClassId));
         for (BaseNewStudent student : updateList) {
-            LocalDateTime birthDate = getBirthDate(student.getCredentialNumber());
+            LocalDate birthDate = getBirthDate(student.getCredentialNumber());
             User xjrUser = new User() {{
                 setCreateDate(now);
                 setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
@@ -475,9 +597,10 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
                 setCredentialNumber(student.getCredentialNumber());
                 setCredentialType("ZZLS10007");
                 setMobile(student.getMobile());
+                setEnabledMark(EnabledMark.DISABLED.getCode());
                 setGender(student.getGender());
                 setIsChangePassword(1);
-                setBirthDate(birthDate);
+                setBirthDate(birthDate.atStartOfDay());
             }};
             userService.save(xjrUser);
 
@@ -498,7 +621,9 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
 
             BaseStudentSchoolRoll schoolRoll = new BaseStudentSchoolRoll() {{
                 setUserId(xjrUser.getId());
-                setGraduatedScore(student.getScore().doubleValue());
+                if(student.getScore() != null){
+                    setGraduatedScore(student.getScore().doubleValue());
+                }
                 setGraduatedUniversity(student.getGraduateSchool());
                 setClassId(classMap.get(studentClassRelation.get(student.getId())));
                 setMajorSetId(taskClassMajorMap.get(studentClassRelation.get(student.getId())));
@@ -521,12 +646,12 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
         }
     }
 
-    LocalDateTime getBirthDate(String idCardNumber){
+    LocalDate getBirthDate(String idCardNumber){
         // 获取出生日期前6位,即yyyyMM
         String birthdayString = idCardNumber.substring(6, 14);
 
         // 将字符串解析为LocalDate对象
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
-        return LocalDateTime.parse(birthdayString, formatter);
+        return LocalDate.parse(birthdayString, formatter);
     }
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/banding/vo/BandingTaskClassSureListVo.java

@@ -39,7 +39,7 @@ public class BandingTaskClassSureListVo {
     private Integer number;
 
     @ApiModelProperty("是否是订单班")
-    private Integer isOrdeClass;
+    private Integer isOrderClass;
 
     @ApiModelProperty("男生人数")
     private Integer maleCount;

+ 12 - 0
src/main/java/com/xjrsoft/module/banding/vo/BandingTaskPageVo.java

@@ -56,4 +56,16 @@ public class BandingTaskPageVo {
     @ApiModelProperty("分班任务名称")
     private String name;
 
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("任务状态(0:未确认 1:已确认)")
+    private Integer status;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("已录取人数")
+    private Integer admissionsCount;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("已分班人数")
+    private Integer dividedCount;
+
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/job/InsertOutInRecordTask.java

@@ -20,7 +20,7 @@ public class InsertOutInRecordTask {
 
     OutInRecordUtil out_in_recordUtil = new OutInRecordUtil();
 
-    @Scheduled(cron = "* */30 * * * ?")
+    @Scheduled(cron = "0 */30 * * * ?")
     public void RefreshConnectionPool() {
         String active = SpringUtil.getActiveProfile();
         if(!"prod".equals(active)){

+ 19 - 0
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -1,5 +1,6 @@
 package com.xjrsoft.module.organization.controller;
 
+import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.dev33.satoken.secure.BCrypt;
 import cn.dev33.satoken.session.SaSession;
 import cn.dev33.satoken.stp.StpUtil;
@@ -29,7 +30,9 @@ import com.xjrsoft.common.utils.RedisUtil;
 import com.xjrsoft.common.utils.TreeUtil;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.config.CommonPropertiesConfig;
+import com.xjrsoft.module.base.dto.BaseClassroomChangeStatusDto;
 import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.base.entity.BaseClassroom;
 import com.xjrsoft.module.base.entity.BaseGrade;
 import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.base.service.IBaseGradeService;
@@ -43,6 +46,7 @@ import com.xjrsoft.module.organization.dto.UpdateInfoDto;
 import com.xjrsoft.module.organization.dto.UpdatePasswordDto;
 import com.xjrsoft.module.organization.dto.UpdateUserDto;
 import com.xjrsoft.module.organization.dto.UploadSignDto;
+import com.xjrsoft.module.organization.dto.UserChangeStatusDto;
 import com.xjrsoft.module.organization.dto.UserPageDto;
 import com.xjrsoft.module.organization.dto.UserStudentAddDto;
 import com.xjrsoft.module.organization.dto.UserStudentBindDto;
@@ -604,6 +608,21 @@ public class UserController {
         return R.ok(userService.deleteBatch(ids));
     }
 
+    @PostMapping(value = "/change-status")
+    @ApiOperation(value="修改状态")
+    @SaCheckPermission("classroom:detail")
+    public RT<Boolean> changeStatus(@Valid @RequestBody UserChangeStatusDto dto) throws Exception {
+        List<User> list = userService.list(new QueryWrapper<User>().lambda()
+                .in(User::getId, dto.getUserIds())
+        );
+
+        for (User user : list) {
+            user.setEnabledMark(dto.getStatus());
+            userService.updateById(user);
+        }
+        return RT.ok(true);
+    }
+
     @GetMapping("/info/multi")
     @ApiOperation(value = "批量获取用户信息")
     public R usersInfo(@RequestParam String ids) {

+ 17 - 0
src/main/java/com/xjrsoft/module/organization/dto/UserChangeStatusDto.java

@@ -0,0 +1,17 @@
+package com.xjrsoft.module.organization.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class UserChangeStatusDto {
+
+
+    @ApiModelProperty("用户ids")
+    private List<Long> userIds;
+
+    @ApiModelProperty("启用状态(0:停用 1:启用)")
+    private Integer status;
+}

+ 8 - 0
src/main/java/com/xjrsoft/module/organization/mapper/UserMapper.java

@@ -5,7 +5,13 @@ import com.github.yulichang.base.MPJBaseMapper;
 import com.xjrsoft.module.organization.dto.UserPageDto;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.vo.ResetUserPageVo;
+import com.xjrsoft.module.student.dto.BaseStudentSimpleInfoDto;
+import com.xjrsoft.module.student.vo.BaseStudentSompleInfoVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
 /**
  * <p>
  * 用户 Mapper 接口
@@ -17,4 +23,6 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface UserMapper extends MPJBaseMapper<User> {
     Page<ResetUserPageVo> getResetUserPage(Page<ResetUserPageVo> page, UserPageDto dto);
+
+    List<BaseStudentSompleInfoVo> getInfosByParam(@Param("dto") BaseStudentSimpleInfoDto dto);
 }

+ 17 - 0
src/main/java/com/xjrsoft/module/personnel/controller/StundentFaceProcessController.java

@@ -141,6 +141,23 @@ public class StundentFaceProcessController {
         return RT.ok(BeanUtil.toBean(stundentFaceProcess, StundentFaceProcessVo.class));
     }
 
+    @GetMapping(value = "/info-userId")
+    @ApiOperation(value="根据用户id查询学生人脸信息审核信息")
+    @SaCheckPermission("stundentfaceprocess:detail")
+    public RT<StundentFaceProcessVo> infoUserId(@RequestParam Long userId){
+        List<StundentFaceProcess> stundentFaceProcess = stundentFaceProcessService.list(
+                new QueryWrapper<StundentFaceProcess>().lambda()
+                        .eq(StundentFaceProcess::getUserId, userId)
+                        .eq(StundentFaceProcess::getStatus, 1)
+                        .orderByDesc(StundentFaceProcess::getCreateDate)
+
+        );
+        if (stundentFaceProcess == null || stundentFaceProcess.isEmpty()) {
+            return RT.error("找不到此数据!");
+        }
+        return RT.ok(BeanUtil.toBean(stundentFaceProcess.get(0), StundentFaceProcessVo.class));
+    }
+
 
     @PostMapping
     @ApiOperation(value = "新增学生人脸信息审核")

+ 8 - 3
src/main/java/com/xjrsoft/module/student/controller/BaseNewStudentController.java

@@ -35,7 +35,9 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.validation.Valid;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -114,6 +116,9 @@ public class BaseNewStudentController {
     @SaCheckPermission("basenewstudent:add")
     public RT<Boolean> add(@Valid @RequestBody AddBaseNewStudentDto dto){
         BaseNewStudent baseNewStudent = BeanUtil.toBean(dto, BaseNewStudent.class);
+        baseNewStudent.setFirstAmbitionId(Long.parseLong(dto.getFirstAmbition()));
+        baseNewStudent.setSecondAmbitionId(Long.parseLong(dto.getSecondAmbition()));
+        baseNewStudent.setCreateDate(new Date());
         boolean isSuccess = baseNewStudentService.save(baseNewStudent);
         return RT.ok(isSuccess);
     }
@@ -142,7 +147,7 @@ public class BaseNewStudentController {
         List<Map<String, String>> result = new ArrayList<>();
 
         for (Map<Integer, Object> objectMap : errorList) {
-            Map<String, String> object = new HashMap<>();
+            Map<String, String> object = new LinkedHashMap<>();
             object.put("毕业学校", objectMap.get(0)==null?"":objectMap.get(0).toString());
             object.put("学生姓名", objectMap.get(1)==null?"":objectMap.get(1).toString());
             object.put("性别", objectMap.get(2)==null?"":objectMap.get(2).toString());
@@ -171,13 +176,13 @@ public class BaseNewStudentController {
         List<Map<String, String>> result = new ArrayList<>();
 
         for (BaseNewStudentScoreExcelVo objectMap : errorList) {
-            Map<String, String> object = new HashMap<>();
+            Map<String, String> object = new LinkedHashMap<>();
             object.put("毕业学校", objectMap.getGraduateSchool());
             object.put("姓名", objectMap.getName());
             object.put("性别", objectMap.getGender());
             object.put("班级", objectMap.getGraduateClass());
             object.put("总成绩", objectMap.getScore().intValue() + "");
-            object.put("错误信息", "未能查询到该学生");
+            object.put("错误信息", "未能查询到该学生或该学生存在多个");
             result.add(object);
         }
         return RT.ok(result);

+ 20 - 0
src/main/java/com/xjrsoft/module/student/controller/BaseStudentInfoController.java

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.module.banding.dto.ChangeClassDto;
+import com.xjrsoft.module.student.dto.BaseStudentSimpleInfoDto;
 import com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto;
 import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto;
@@ -15,11 +17,13 @@ import com.xjrsoft.module.student.service.IStudentManagerService;
 import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageDataVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
+import com.xjrsoft.module.student.vo.BaseStudentSompleInfoVo;
 import com.xjrsoft.module.student.vo.MobileClassStatisticsVo;
 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;
@@ -27,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.List;
 
 /**
 * @title: 学生职务设置
@@ -91,4 +96,19 @@ public class BaseStudentInfoController {
         }
         return RT.ok(BeanUtil.toBean(detailVo, BaseStudentInfoDetailVo.class));
     }
+
+    @GetMapping(value = "/studentinfoByKeyWord")
+    @ApiOperation(value="根据姓名或者身份证号查询详情信息")
+    @SaCheckPermission("room:detail")
+    public RT<List<BaseStudentSompleInfoVo>> info(@Valid BaseStudentSimpleInfoDto dto){
+        List<BaseStudentSompleInfoVo> infos = baseStudentSchoolRollService.getInfosByParam(dto);
+        return RT.ok(infos);
+    }
+
+    @PostMapping("/change-class")
+    @ApiOperation(value = "调整班级")
+    @SaCheckPermission("bandingTaskClass:change-class")
+    public RT<Boolean> changeClass(@Valid @RequestBody ChangeClassDto dto){
+        return RT.ok(true);
+    }
 }

+ 1 - 0
src/main/java/com/xjrsoft/module/student/controller/EnrollmentPlanController.java

@@ -80,6 +80,7 @@ public class EnrollmentPlanController {
                 .like(dto.getName() != null && !dto.getName().isEmpty(), EnrollmentPlan::getName, dto.getName())
                 .eq(dto.getEnrollType() != null && !dto.getEnrollType().isEmpty(), EnrollmentPlan::getEnrollType, dto.getEnrollType())
                 .eq(EnrollmentPlan::getDeleteMark, DeleteMark.NODELETE)
+                .eq(dto.getGradeId() != null, EnrollmentPlan::getGradeId, dto.getGradeId())
                 .orderByDesc(EnrollmentPlan::getStartDate)
                 ;
         IPage<EnrollmentPlanPageVo> page = enrollmentPlanService.selectJoinListPage(ConventPage.getPage(dto), EnrollmentPlanPageVo.class, queryWrapper);

+ 3 - 3
src/main/java/com/xjrsoft/module/student/dto/BaseNewStudentPageDto.java

@@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import java.util.Date;
+import java.time.LocalDateTime;
 
 
 /**
@@ -38,10 +38,10 @@ public class BaseNewStudentPageDto extends PageInput {
 
 
     @ApiModelProperty("添加时间-开始")
-    private Date startDate;
+    private LocalDateTime startDate;
 
     @ApiModelProperty("添加时间-结束")
-    private Date endDate;
+    private LocalDateTime endDate;
 
     @ApiModelProperty("毕业学校")
     private String graduateSchool;

+ 15 - 0
src/main/java/com/xjrsoft/module/student/dto/BaseStudentSimpleInfoDto.java

@@ -0,0 +1,15 @@
+package com.xjrsoft.module.student.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author dzx
+ * @date 2024/7/9
+ */
+@Data
+public class BaseStudentSimpleInfoDto {
+
+    @ApiModelProperty("关键字")
+    private String keyword;
+}

+ 3 - 0
src/main/java/com/xjrsoft/module/student/dto/EnrollmentPlanPageDto.java

@@ -27,4 +27,7 @@ public class EnrollmentPlanPageDto extends PageInput {
     @ApiModelProperty("招生类型(xjr_dictionary_detail[enroll_type])")
     private String enrollType;
 
+    @ApiModelProperty("所属年级id")
+    private Long gradeId;
+
 }

+ 6 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseStudentSchoolRollService.java

@@ -2,6 +2,7 @@ package com.xjrsoft.module.student.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.student.dto.BaseStudentSimpleInfoDto;
 import com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto;
 import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto;
@@ -9,8 +10,11 @@ import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageDataVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
+import com.xjrsoft.module.student.vo.BaseStudentSompleInfoVo;
 import com.xjrsoft.module.student.vo.MobileClassStatisticsVo;
 
+import java.util.List;
+
 /**
 * @title: 奖学金申请
 * @Author dzx
@@ -45,4 +49,6 @@ public interface IBaseStudentSchoolRollService extends MPJBaseService<BaseStuden
     MobileClassStatisticsVo getMobileClassStatistics(BaseStudentInfoPageDto dto);
 
     Boolean updateStudentClass(Long classId, Long userId);
+
+    List<BaseStudentSompleInfoVo> getInfosByParam(BaseStudentSimpleInfoDto dto);
 }

+ 19 - 7
src/main/java/com/xjrsoft/module/student/service/impl/BaseNewStudentServiceImpl.java

@@ -91,7 +91,8 @@ public class BaseNewStudentServiceImpl extends MPJBaseServiceImpl<BaseNewStudent
         }
 
         //查询专业数据
-        Map<String, Long> majorSetMap = majorSetService.list().stream().collect(Collectors.toMap(BaseMajorSet::getName, BaseMajorSet::getId));
+        Map<String, Long> majorSetMap = majorSetService.list(new QueryWrapper<BaseMajorSet>().lambda().eq(BaseMajorSet::getDeleteMark, 0))
+                .stream().collect(Collectors.toMap(BaseMajorSet::getName, BaseMajorSet::getId));
         
         //查询已有的学生数据
         List<BaseNewStudent> baseNewStudents = this.baseMapper.selectList(
@@ -117,6 +118,16 @@ public class BaseNewStudentServiceImpl extends MPJBaseServiceImpl<BaseNewStudent
                 errorList.add(objectMap);
                 continue;
             }
+            if(majorSetMap.get(objectMap.get(10).toString()) == null){
+                objectMap.put(15, "第一志愿未匹配,无法导入");
+                errorList.add(objectMap);
+                continue;
+            }
+            if(majorSetMap.get(objectMap.get(11).toString()) == null){
+                objectMap.put(15, "第二志愿未匹配,无法导入");
+                errorList.add(objectMap);
+                continue;
+            }
             if(student != null && student.getStatus() == 0){
                 student.setGraduateSchool(objectMap.get(0).toString());
                 student.setName(objectMap.get(1).toString());
@@ -131,9 +142,9 @@ public class BaseNewStudentServiceImpl extends MPJBaseServiceImpl<BaseNewStudent
                 student.setSource(dictMap.get(objectMap.get(7).toString()));
                 student.setStduyStatus(dictMap.get(objectMap.get(8).toString()));
                 student.setMobile(objectMap.get(9).toString());
-                student.setFirstAmbition(objectMap.get(10).toString());
+                student.setFirstAmbition(majorSetMap.get(objectMap.get(10).toString()).toString());
                 student.setFirstAmbitionId(majorSetMap.get(objectMap.get(10).toString()));
-                student.setSecondAmbition(objectMap.get(11).toString());
+                student.setSecondAmbition(majorSetMap.get(objectMap.get(11).toString()).toString());
                 student.setSecondAmbitionId(majorSetMap.get(objectMap.get(11).toString()));
                 student.setIsAdjust(YesOrNoEnum.getCode(objectMap.get(12).toString()));
                 if(objectMap.get(13) != null){
@@ -163,9 +174,9 @@ public class BaseNewStudentServiceImpl extends MPJBaseServiceImpl<BaseNewStudent
                     setSource(dictMap.get(objectMap.get(7).toString()));
                     setStduyStatus(dictMap.get(objectMap.get(8).toString()));
                     setMobile(objectMap.get(9).toString());
-                    setFirstAmbition(objectMap.get(10).toString());
+                    setFirstAmbition(majorSetMap.get(objectMap.get(10).toString()).toString());
                     setFirstAmbitionId(majorSetMap.get(objectMap.get(10).toString()));
-                    setSecondAmbition(objectMap.get(11).toString());
+                    setSecondAmbition(majorSetMap.get(objectMap.get(11).toString()).toString());
                     setSecondAmbitionId(majorSetMap.get(objectMap.get(11).toString()));
                     setIsAdjust(YesOrNoEnum.getCode(objectMap.get(12).toString()));
                     if(objectMap.get(13) != null){
@@ -204,17 +215,18 @@ public class BaseNewStudentServiceImpl extends MPJBaseServiceImpl<BaseNewStudent
         List<BaseNewStudentScoreExcelVo> errorList = new ArrayList<>();
         List<BaseNewStudent> updateList = new ArrayList<>();
         for (BaseNewStudentScoreExcelVo el : excelDataList) {
-            BaseNewStudent student = this.baseMapper.selectOne(
+            List<BaseNewStudent> studentList = this.baseMapper.selectList(
                     new QueryWrapper<BaseNewStudent>().lambda()
                             .eq(BaseNewStudent::getGender, genderMap.get(el.getGender()))
                             .eq(BaseNewStudent::getGraduateSchool, el.getGraduateSchool())
                             .eq(BaseNewStudent::getGraduateClass, el.getGraduateClass())
                             .eq(BaseNewStudent::getName, el.getName())
             );
-            if(student == null){
+            if(studentList.size() != 1){
                 errorList.add(el);
                 continue;
             }
+            BaseNewStudent student = studentList.get(0);
             student.setScore(el.getScore());
             updateList.add(student);
         }

+ 10 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentSchoolRollServiceImpl.java

@@ -10,8 +10,10 @@ import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.enums.StudyStatusEnum;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.mapper.BaseClassMapper;
+import com.xjrsoft.module.organization.mapper.UserMapper;
 import com.xjrsoft.module.room.mapper.RoomBedMapper;
 import com.xjrsoft.module.room.vo.RoomBedInfoVo;
+import com.xjrsoft.module.student.dto.BaseStudentSimpleInfoDto;
 import com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto;
 import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
 import com.xjrsoft.module.student.dto.PbVXsxxsfytbDto;
@@ -25,6 +27,7 @@ import com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageDataVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
+import com.xjrsoft.module.student.vo.BaseStudentSompleInfoVo;
 import com.xjrsoft.module.student.vo.MobileClassStatisticsVo;
 import com.xjrsoft.module.student.vo.PbVXsxxsfytbVo;
 import lombok.AllArgsConstructor;
@@ -50,6 +53,7 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
     private final BaseClassMapper baseClassMapper;
     private final PbSemesterConfigMapper pbSemesterConfigMapper;
     private final PbVXsxxsfytbMapper pbVXsxxsfytbMapper;
+    private final UserMapper userMapper;
 
 
     @Override
@@ -197,4 +201,10 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
     public Boolean updateStudentClass(Long classId, Long userId) {
         return baseStudentSchoolRollMapper.updateStudentClass(classId, userId);
     }
+
+    @Override
+    public List<BaseStudentSompleInfoVo> getInfosByParam(BaseStudentSimpleInfoDto dto) {
+        List<BaseStudentSompleInfoVo> userList = userMapper.getInfosByParam(dto);
+        return userList;
+    }
 }

+ 6 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseNewStudentPageVo.java

@@ -99,6 +99,12 @@ public class BaseNewStudentPageVo {
     @ExcelProperty("学生来源")
     @ApiModelProperty("学生来源")
     private String source;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学生来源中文")
+    @ApiModelProperty("学生来源中文")
+    private String sourceCn;
+
     /**
     * 住宿类型
     */

+ 13 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseNewStudentVo.java

@@ -98,4 +98,17 @@ public class BaseNewStudentVo {
     @ApiModelProperty("是否可调配(0:否,1:是)")
     private Integer isAdjust;
 
+    @ApiModelProperty("家庭电话")
+    private String familyMobile;
+
+    @ApiModelProperty("家庭地址")
+    private String familyAddress;
+
+    @ApiModelProperty("第一志愿id")
+    private Long firstAmbitionId;
+    /**
+     * 第二志愿
+     */
+    @ApiModelProperty("第二志愿")
+    private Long secondAmbitionId;
 }

+ 46 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseStudentSompleInfoVo.java

@@ -0,0 +1,46 @@
+package com.xjrsoft.module.student.vo;
+
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+* @title: 移动端学生修改信息列表
+* @Author dzx
+* @Date: 2024年2月26日
+* @Version 1.0
+*/
+@Data
+public class BaseStudentSompleInfoVo {
+
+
+    @ApiModelProperty("主键编号")
+    private Long id;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("启用状态(0:禁用 1:启用)")
+    private Integer enabledMark;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("学生姓名")
+    private String studentName;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("身份证号")
+    private String credentialNumber;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("本人电话")
+    private String mobile;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("班主任名称")
+    private String teacherName;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("班级名称")
+    private String className;
+
+}

+ 1 - 1
src/main/resources/application-dev.yml

@@ -64,7 +64,7 @@ xjrsoft:
     access-key: root
     secret-key: qwe123QWE
     endpoint: http://10.150.10.140:9000
-    endpoint-preview: https://test.minio.yingcaibx.com
+    endpoint-preview: http://10.150.10.140:9000
     bucket-name: learun
     prefix: xjr
   generate:

+ 1 - 1
src/main/resources/application-pre.yml

@@ -49,7 +49,7 @@ xjrsoft:
     access-key: root
     secret-key: qwe123QWE
     endpoint: http://10.150.10.140:9000
-    endpoint-preview: https://test.minio.yingcaibx.com
+    endpoint-preview: http://10.150.10.140:9000
     bucket-name: learun
     prefix: xjr
   generate:

+ 59 - 23
src/main/resources/mapper/banding/BandingTaskClassMapper.xml

@@ -5,34 +5,55 @@
 <mapper namespace="com.xjrsoft.module.banding.mapper.BandingTaskClassMapper">
     <select id="getList" parameterType="com.xjrsoft.module.banding.dto.BandingTaskClassPageDto" resultType="com.xjrsoft.module.banding.vo.BandingTaskClassPageVo">
         SELECT t1.id, t1.major_set_id,t2.name AS major_set_name, t1.name, t1.number,t1.sort_code,t1.is_order_class,
-        (SELECT COUNT(*) FROM base_new_student WHERE delete_mark = 0 AND first_ambition_id = t1.major_set_id) AS first_ambition_count,
-        (SELECT COUNT(*) FROM base_new_student WHERE delete_mark = 0 AND second_ambition_id = t1.major_set_id) AS second_ambition_count,
-        t1.height, t1.score, (
+        (SELECT COUNT(*) FROM base_new_student a1
+        INNER JOIN enrollment_plan a2 ON a1.enrollment_plan_id = a2.id
+        WHERE a1.delete_mark = 0 AND a1.first_ambition_id = t1.major_set_id
+        AND a2.enroll_type = #{dto.enrollType} AND a2.grade_id =#{dto.gradeId} ) AS first_ambition_count,
+        (SELECT COUNT(*) FROM base_new_student a1
+        INNER JOIN enrollment_plan a2 ON a1.enrollment_plan_id = a2.id
+        WHERE a1.delete_mark = 0 AND a1.second_ambition_id = t1.major_set_id
+        AND a2.enroll_type = #{dto.enrollType} AND a2.grade_id =#{dto.gradeId} ) AS second_ambition_count,
+        t5.height, t5.score, (
             SELECT count(a1.id) FROM base_new_student a1
             INNER JOIN banding_task_class_student t5 ON a1.id = t5.new_student_id
             WHERE a1.delete_mark = 0 AND t5.delete_mark = 0 AND t5.banding_task_class_id = t1.id
         ) as satisfy_count, (
             SELECT count(a1.id) FROM base_new_student a1
-            WHERE a1.delete_mark = 0
+            LEFT JOIN enrollment_plan a2 ON a1.enrollment_plan_id = a2.id
+            LEFT JOIN banding_task a3 ON a2.grade_id = a3.grade_id AND a2.enroll_type = a3.enroll_type
+            WHERE a1.delete_mark = 0 AND a3.id = t1.banding_task_id
             AND (a1.first_ambition_id = t1.major_set_id or a1.second_ambition_id = t1.major_set_id)
-            and a1.id not in (select new_student_id from banding_task_class_student
-            where delete_mark = 0 and banding_task_class_id = t1.id
+            and a1.id not in (SELECT new_student_id FROM banding_task_class_student c1
+            INNER JOIN banding_task_class c2 ON c1.banding_task_class_id = c2.id
+            WHERE c1.delete_mark = 0 AND c2.delete_mark = 0 AND c2.banding_task_id = t1.banding_task_id
             )
         ) as surplus_count, t3.name as teacher_name,t3.id as teacher_id, t4.name as classroom_name,t4.id as classroom_id FROM banding_task_class t1
         LEFT JOIN base_major_set t2 ON t1.major_set_id = t2.id
         LEFT JOIN xjr_user t3 ON t1.teacher_id = t3.id
         LEFT JOIN base_classroom t4 ON t1.classroom_id = t4.id
+        LEFT JOIN banding_task_major_condition t5 ON t1.major_set_id = t5.major_set_id AND t5.delete_mark = 0
+        AND t5.banding_task_id = #{dto.bandingTaskId}
         WHERE t1.delete_mark = 0 and t1.banding_task_id = #{dto.bandingTaskId}
     </select>
 
     <select id="getClassSure" parameterType="com.xjrsoft.module.banding.dto.BandingTaskClassPageDto" resultType="com.xjrsoft.module.banding.vo.BandingTaskClassSureListVo">
         SELECT t1.id, t1.major_set_id,t2.name AS major_set_name, t1.name,t1.sort_code,
-        (SELECT COUNT(*) FROM base_new_student WHERE delete_mark = 0) as number,
-        (SELECT COUNT(*) FROM base_new_student WHERE delete_mark = 0 AND gender = 'SB10001') AS male_count,
-        (SELECT COUNT(*) FROM base_new_student WHERE delete_mark = 0 AND gender = 'SB10002') AS female_count,
-        (SELECT COUNT(*) FROM base_new_student WHERE delete_mark = 0 AND stduy_status = 'FB3001') AS not_stay_count,
-        (SELECT COUNT(*) FROM base_new_student WHERE delete_mark = 0 AND stduy_status = 'FB3002') AS stay_count,
-        t3.name AS teacher_name FROM banding_task_class t1
+        (SELECT COUNT(*) FROM base_new_student a1
+        INNER JOIN banding_task_class_student a2 ON a1.id = a2.new_student_id
+        WHERE a1.delete_mark = 0 AND a2.delete_mark = 0 AND a2.banding_task_class_id = t1.id) AS number,
+        (SELECT COUNT(*) FROM base_new_student a1
+        INNER JOIN banding_task_class_student a2 ON a1.id = a2.new_student_id
+        WHERE a1.delete_mark = 0 AND a2.delete_mark = 0 AND a2.banding_task_class_id = t1.id AND a1.gender = 'SB10001') AS male_count,
+        (SELECT COUNT(*) FROM base_new_student a1
+        INNER JOIN banding_task_class_student a2 ON a1.id = a2.new_student_id
+        WHERE a1.delete_mark = 0 AND a2.delete_mark = 0 AND a2.banding_task_class_id = t1.id AND a1.gender = 'SB10002') AS female_count,
+        (SELECT COUNT(*) FROM base_new_student a1
+        INNER JOIN banding_task_class_student a2 ON a1.id = a2.new_student_id
+        WHERE a1.delete_mark = 0 AND a2.delete_mark = 0 AND a2.banding_task_class_id = t1.id AND a1.stduy_status = 'FB3001') AS not_stay_count,
+        (SELECT COUNT(*) FROM base_new_student a1
+        INNER JOIN banding_task_class_student a2 ON a1.id = a2.new_student_id
+        WHERE a1.delete_mark = 0 AND a2.delete_mark = 0 AND a2.banding_task_class_id = t1.id AND a1.stduy_status = 'FB3002') AS stay_count,
+        t3.name AS teacher_name,t4.name as classroom_name, t1.is_order_class FROM banding_task_class t1
         LEFT JOIN base_major_set t2 ON t1.major_set_id = t2.id
         LEFT JOIN xjr_user t3 ON t1.teacher_id = t3.id
         LEFT JOIN base_classroom t4 ON t1.classroom_id = t4.id
@@ -43,15 +64,17 @@
         SELECT t1.id,t1.credential_number,t1.name,t4.name AS gender_cn,t1.graduate_school,t1.graduate_class,
         t5.name AS first_ambition, t6.name AS second_ambition,t7.name AS stduy_status_cn,t1.height,t1.weight,t1.score,t3.name AS class_name,
         t8.name AS teacher_name FROM base_new_student t1
-        INNER JOIN banding_task_class_student t2 ON t1.id = t2.new_student_id
-        INNER JOIN banding_task_class t3 ON t2.banding_task_class_id = t3.id
+        LEFT JOIN banding_task_class_student t2 ON t1.id = t2.new_student_id AND t2.delete_mark = 0
+        LEFT JOIN banding_task_class t3 ON t2.banding_task_class_id = t3.id
+        AND t3.delete_mark = 0 AND t3.banding_task_id = #{dto.bandingTaskId}
         LEFT JOIN xjr_dictionary_detail t4 ON t1.gender = t4.code
         LEFT JOIN base_major_set t5 ON t1.first_ambition_id = t5.id
         LEFT JOIN base_major_set t6 ON t1.second_ambition_id = t6.id
-        LEFT JOIN xjr_dictionary_detail t7 ON t1.stduy_status = t6.code
+        LEFT JOIN xjr_dictionary_detail t7 ON t1.stduy_status = t7.code
         LEFT JOIN xjr_user t8 ON t3.teacher_id = t8.id
-        WHERE t1.delete_mark = 0 AND t2.delete_mark = 0 AND t3.delete_mark = 0
-        AND t3.banding_task_id = #{dto.bandingTaskId}
+        INNER JOIN enrollment_plan t9 ON t1.enrollment_plan_id = t9.id
+        WHERE t1.delete_mark = 0
+        and t9.grade_id = #{dto.gradeId} and t9.enroll_type = #{dto.enrollType}
         <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
             AND t1.credential_number like concat('%', #{dto.credentialNumber}, '%')
         </if>
@@ -59,7 +82,7 @@
             AND t1.name like concat('%', #{dto.name}, '%')
         </if>
         <if test="dto.graduateSchool != null and dto.graduateSchool != ''">
-            AND t1.graduate_school = #{dto.graduateSchool}
+            AND t1.graduate_school like concat('%', #{dto.graduateSchool}, '%')
         </if>
         <if test="dto.graduateClass != null and dto.graduateClass != ''">
             AND t1.graduate_class like concat('%', #{dto.graduateClass}, '%')
@@ -68,22 +91,35 @@
             AND t1.stduy_status = #{dto.stduyStatus}
         </if>
         <if test="dto.status != null">
-            AND t3.status = #{dto.status}
+            <if test="dto.status == 1">
+                AND t3.name is not null
+            </if>
+            <if test="dto.status == 0">
+                AND t3.name is null
+            </if>
         </if>
         <if test="dto.className != null and dto.className != ''">
             AND t3.name like concat('%', #{dto.className}, '%')
         </if>
+        <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
+            <if test="dto.order == 'descend'">
+                order by t1.score desc
+            </if>
+            <if test="dto.order == 'ascend'">
+                order by t1.score asc
+            </if>
+        </if>
     </select>
 
     <select id="getMajorClassCount" resultType="com.xjrsoft.module.outint.vo.IdCountVo">
-        SELECT major_set_id,COUNT(*) FROM banding_task_class WHERE banding_task_id = #{id} AND delete_mark = 0 GROUP BY major_set_id
+        SELECT major_set_id as id,COUNT(*) as count FROM banding_task_class WHERE banding_task_id = #{id} AND delete_mark = 0 GROUP BY major_set_id
     </select>
 
     <select id="getMajorClassStudentCount" resultType="com.xjrsoft.module.outint.vo.IdCountVo">
-        SELECT major_set_id,sum(number) FROM banding_task_class WHERE banding_task_id = #{id} AND delete_mark = 0 GROUP BY major_set_id
+        SELECT major_set_id as id,sum(number) as count FROM banding_task_class WHERE banding_task_id = #{id} AND delete_mark = 0 GROUP BY major_set_id
     </select>
 
-    <select id="getMajorClassStudentCount" resultType="com.xjrsoft.module.banding.entity.BandingTaskClass">
-        SELECT * FROM banding_task_class WHERE delete_mark = 0 and banding_task_id = #{id} ORDER BY IF(ISNULL(sort_code),1,0)  ASC
+    <select id="getListOrderByAsc" resultType="com.xjrsoft.module.banding.entity.BandingTaskClass">
+        SELECT * FROM banding_task_class WHERE delete_mark = 0 and banding_task_id = #{id} ORDER BY sort_code IS NULL, sort_code ASC
     </select>
 </mapper>

+ 15 - 7
src/main/resources/mapper/banding/BandingTaskClassStudentMapper.xml

@@ -5,26 +5,34 @@
 <mapper namespace="com.xjrsoft.module.banding.mapper.BandingTaskClassStudentMapper">
     <select id="satisfyStudent" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
         SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
-        t1.score,t1.graduate_class,t1.source,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t1.first_ambition,
-        t1.second_ambition,t1.is_adjust,t1.status FROM base_new_student t1
+        t1.score,t1.graduate_class,t6.name as source,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
+        t8.name as second_ambition,t1.is_adjust,t1.status FROM base_new_student t1
         INNER JOIN banding_task_class_student t5 ON t1.id = t5.new_student_id
         LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
         LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
+        LEFT JOIN xjr_dictionary_detail t6 ON t1.source = t6.code AND t6.item_id = 2023000000000000028
         LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
+        LEFT JOIN base_major_set t7 ON t1.first_ambition = t7.id
+        LEFT JOIN base_major_set t8 ON t1.second_ambition = t8.id
         WHERE t1.delete_mark = 0 AND t5.delete_mark = 0 AND t5.banding_task_class_id = #{bandingTaskClassId}
     </select>
 
     <select id="surplusStudent" parameterType="com.xjrsoft.module.banding.entity.BandingTaskClass" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
         SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
-        t1.score,t1.graduate_class,t1.source,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t1.first_ambition,
-        t1.second_ambition,t1.is_adjust,t1.status FROM base_new_student t1
+        t1.score,t1.graduate_class,t6.name as source,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
+        t8.name as second_ambition,t1.is_adjust,t1.status FROM base_new_student t1
         LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
         LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
         LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
-        WHERE t1.delete_mark = 0
+        LEFT JOIN banding_task t5 ON t4.grade_id = t5.grade_id AND t4.enroll_type = t5.enroll_type
+        LEFT JOIN xjr_dictionary_detail t6 ON t1.source = t6.code AND t6.item_id = 2023000000000000028
+        LEFT JOIN base_major_set t7 ON t1.first_ambition = t7.id
+        LEFT JOIN base_major_set t8 ON t1.second_ambition = t8.id
+        WHERE t1.delete_mark = 0 AND t5.id = #{taskClass.bandingTaskId}
         AND (t1.first_ambition_id = #{taskClass.majorSetId} or t1.second_ambition_id = #{taskClass.majorSetId})
-            and t1.id not in (select new_student_id from banding_task_class_student
-            where delete_mark = 0 and banding_task_class_id = #{taskClass.id}
+            and t1.id not in (SELECT new_student_id FROM banding_task_class_student c1
+            INNER JOIN banding_task_class c2 ON c1.banding_task_class_id = c2.id
+            WHERE c1.delete_mark = 0 AND c2.delete_mark = 0 AND c2.banding_task_id = #{taskClass.bandingTaskId}
         )
     </select>
 </mapper>

+ 1 - 1
src/main/resources/mapper/banding/BandingTaskMajorConditionMapper.xml

@@ -6,7 +6,7 @@
     <select id="getList" parameterType="com.xjrsoft.module.banding.dto.BandingTaskMajorConditionListDto"
             resultType="com.xjrsoft.module.banding.vo.BandingTaskMajorConditionListVo">
         SELECT t1.id, t.id AS major_set_id, t.name AS major_set_name,t1.banding_task_id,t1.height,t1.score, t1.sort_code FROM base_major_set t
-        LEFT JOIN banding_task_major_condition t1 ON t1.major_set_id = t.id and t1.banding_task_id = #{dto.bandingTaskId}
+        LEFT JOIN banding_task_major_condition t1 ON t1.major_set_id = t.id and t1.banding_task_id = #{dto.bandingTaskId} and t1.delete_mark = 0
         WHERE t.delete_mark = 0
     </select>
 

+ 24 - 0
src/main/resources/mapper/banding/BandingTaskMapper.xml

@@ -0,0 +1,24 @@
+<?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.banding.mapper.BandingTaskMapper">
+    <select id="getPage" parameterType="com.xjrsoft.module.banding.dto.BandingTaskPageDto" resultType="com.xjrsoft.module.banding.vo.BandingTaskPageVo">
+        SELECT t.id, t.sort_code, t.grade_id, t.enroll_type, t.name, t.status, t2.name AS enrollTypeCn, t1.name AS gradeName,
+        (SELECT COUNT(*) FROM base_new_student a1
+        INNER JOIN enrollment_plan a2 ON a1.enrollment_plan_id = a2.id
+        WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
+        AND a2.grade_id = t.grade_id AND a2.enroll_type = t.enroll_type
+        ) AS admissions_count,
+        (SELECT COUNT(*) FROM banding_task_class_student a1
+        INNER JOIN banding_task_class a2 ON a1.banding_task_class_id = a2.id
+        WHERE a1.delete_mark = 0 AND a2.delete_mark = 0 AND a2.banding_task_id = t.id) AS divided_count
+        FROM banding_task t
+        LEFT JOIN base_grade t1 ON (t1.id = t.grade_id)
+        LEFT JOIN xjr_dictionary_detail t2 ON (t2.code = t.enroll_type)
+        WHERE t.delete_mark = 0 AND t2.delete_mark = 0
+        <if test="dto.enrollType != null and dto.enrollType != ''">
+            and t.enroll_type = #{dto.enrollType}
+        </if>
+    </select>
+</mapper>

+ 7 - 0
src/main/resources/mapper/organization/UserMapper.xml

@@ -15,4 +15,11 @@
             and t2.role_id = #{dto.roleId}
         </if>
     </select>
+    <select id="getInfosByParam" parameterType="com.xjrsoft.module.student.dto.BaseStudentSimpleInfoDto" resultType="com.xjrsoft.module.student.vo.BaseStudentSompleInfoVo">
+        SELECT t1.id, t1.name, t1.enabled_mark, t1.credential_number, t4.name AS class_name FROM xjr_user t1
+        INNER JOIN base_student t2 ON t1.id = t2.user_id
+        INNER JOIN base_student_school_roll t3 ON t1.id = t3.user_id
+        INNER JOIN base_class t4 ON t4.id = t3.class_id
+        WHERE t1.delete_mark = 0 AND (t1.name = #{dto.keyword} OR t1.credential_number = #{dto.keyword})
+    </select>
 </mapper>

+ 12 - 3
src/main/resources/mapper/student/BaseNewStudentMapper.xml

@@ -5,11 +5,14 @@
 <mapper namespace="com.xjrsoft.module.student.mapper.BaseNewStudentMapper">
     <select id="getPage" parameterType="com.xjrsoft.module.student.dto.BaseNewStudentPageDto" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
         SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
-        t1.score,t1.graduate_class,t1.source,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t1.first_ambition,
-        t1.second_ambition,t1.is_adjust,t1.status FROM base_new_student t1
+        t1.score,t1.graduate_class,t1.source,t5.name as source_cn,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
+        t8.name as second_ambition,t1.is_adjust,t1.status FROM base_new_student t1
         LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
         LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
+        LEFT JOIN xjr_dictionary_detail t5 ON t1.source = t5.code AND t5.item_id = 2023000000000000028
         LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
+        LEFT JOIN base_major_set t7 ON t1.first_ambition = t7.id
+        LEFT JOIN base_major_set t8 ON t1.second_ambition = t8.id
         WHERE t1.delete_mark = 0
         <if test="dto.name != null and dto.name != ''">
             and t1.name like concat('%', #{dto.name}, '%')
@@ -17,6 +20,9 @@
         <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
             and t1.credential_number like concat('%', #{dto.credentialNumber}, '%')
         </if>
+        <if test="dto.graduateSchool != null and dto.graduateSchool != ''">
+            and t1.graduate_school like concat('%', #{dto.graduateSchool}, '%')
+        </if>
         <if test="dto.isImportScore != null">
             <if test="dto.isImportScore == 1">
                 and t1.score is not null
@@ -41,6 +47,9 @@
         <if test="dto.status != null">
             AND t1.status = #{dto.status}
         </if>
+        <if test="dto.isAdjust != null">
+            AND t1.is_adjust = #{dto.isAdjust}
+        </if>
         <if test="dto.enrollmentPlanId != null">
             AND t1.enrollment_plan_id = #{dto.enrollmentPlanId}
         </if>
@@ -84,7 +93,7 @@
         SELECT t1.id,(
         SELECT COUNT(id) FROM base_new_student WHERE delete_mark = 0
         AND (first_ambition_id = t1.id OR second_ambition_id = t1.id)
-        ) FROM base_major_set t1 WHERE delete_mark = 0
+        ) as count FROM base_major_set t1 WHERE delete_mark = 0
     </select>
 
 </mapper>