Преглед на файлове

学生数据添加增加唯一性验证

dzx преди 7 месеца
родител
ревизия
6f345c3ad2

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

@@ -6,6 +6,7 @@ import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xjrsoft.common.annotation.XjrLog;
+import com.xjrsoft.common.enums.ArchivesStatusEnum;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
@@ -105,6 +106,7 @@ public class BaseStudentInfoController {
     @SaCheckPermission("room:detail")
     @XjrLog(value = "根据姓名或者身份证号查询详情信息")
     public RT<List<BaseStudentSompleInfoVo>> info(@Valid BaseStudentSimpleInfoDto dto) {
+        dto.setArchivesStatus(ArchivesStatusEnum.FB2901.getCode());
         List<BaseStudentSompleInfoVo> infos = baseStudentSchoolRollService.getInfosByParam(dto);
         return RT.ok(infos);
     }

+ 37 - 5
src/main/java/com/xjrsoft/module/student/controller/StudentManagerController.java

@@ -27,25 +27,40 @@ import com.xjrsoft.module.base.entity.BaseGrade;
 import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.base.service.IBaseGradeService;
 import com.xjrsoft.module.concat.service.IXjrUserService;
-import com.xjrsoft.module.feedback.entity.FeedbackItem;
 import com.xjrsoft.module.hikvision.util.DataUtil;
 import com.xjrsoft.module.organization.entity.UserDeptRelation;
 import com.xjrsoft.module.organization.service.IUserDeptRelationService;
 import com.xjrsoft.module.room.service.IRoomBedService;
 import com.xjrsoft.module.student.dto.AddBaseStudentUserDto;
+import com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto;
+import com.xjrsoft.module.student.dto.BaseStudentSimpleInfoDto;
 import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.dto.MajorGradeClassDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentUserDto;
 import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.entity.BaseStudentUser;
+import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
 import com.xjrsoft.module.student.service.IStudentManagerService;
-import com.xjrsoft.module.student.vo.*;
+import com.xjrsoft.module.student.vo.BaseDepMajorGradeClassStudenTreeVo;
+import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
+import com.xjrsoft.module.student.vo.BaseStudentSchoolRollVo;
+import com.xjrsoft.module.student.vo.BaseStudentSompleInfoVo;
+import com.xjrsoft.module.student.vo.BaseStudentTreeVo;
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
+import com.xjrsoft.module.student.vo.BaseStudentUserVo;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
@@ -53,7 +68,16 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.text.ParseException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
@@ -65,6 +89,7 @@ import java.util.zip.ZipFile;
 public class StudentManagerController {
 
     private final IStudentManagerService studentManagerService;
+    private final IBaseStudentSchoolRollService schoolRollService;
     private final IBaseGradeService baseGradeService;
     private final IBaseClassService baseClassService;
     private final IXjrUserService xjrUserService;
@@ -210,7 +235,14 @@ public class StudentManagerController {
     @SaCheckPermission("studentmanager:add")
     @XjrLog(value = "新增学生", saveResponseData = true)
     public R add(@Valid @RequestBody AddBaseStudentUserDto dto) {
-        return R.ok(studentManagerService.add(dto));
+        List<BaseStudentSompleInfoVo> infos = schoolRollService.getInfosByParam(new BaseStudentSimpleInfoDto() {{
+            setIdNumber(dto.getCredentialNumber());
+        }});
+        if(!infos.isEmpty()){
+            return R.ok(infos.get(0));
+        }
+        studentManagerService.add(dto);
+        return R.ok();
     }
 
     @PostMapping("upload-image")

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

@@ -274,7 +274,6 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
 
     @Override
     public List<BaseStudentSompleInfoVo> getInfosByParam(BaseStudentSimpleInfoDto dto) {
-        dto.setArchivesStatus(ArchivesStatusEnum.FB2901.getCode());
         List<BaseStudentSompleInfoVo> userList = userMapper.getInfosByParam(dto);
         if(userList.isEmpty()){
             userList = newStudentMapper.getInfosByParam(dto);

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

@@ -72,6 +72,9 @@ public class BaseStudentSompleInfoVo {
     @ApiModelProperty("学籍状态")
     private String archivesStatus;
 
+    @ApiModelProperty("学籍状态-中文")
+    private String archivesStatusCn;
+
     @ApiModelProperty("年级id")
     private Long gradeId;
 

+ 5 - 1
src/main/resources/mapper/organization/UserMapper.xml

@@ -29,7 +29,7 @@
         (SELECT name FROM base_student_family_member WHERE delete_mark = 0 AND user_id = t1.id ORDER BY create_date ASC LIMIT 0,1) as parent_name,
         (SELECT mobile FROM base_student_family_member WHERE delete_mark = 0 AND user_id = t1.id ORDER BY create_date ASC LIMIT 0,1) as parent_mobile,
         t1.gender,t4.id as class_id, t4.teacher_id,t6.name as teacher_name,t6.user_name as teacher_user_name,t6.mobile as teacher_mobile,t5.name as classroom_name,
-        t3.archives_status,t7.id as grade_id,t7.name as grade_name
+        t3.archives_status,t7.id as grade_id,t7.name as grade_name,t8.name as archives_status_cn
         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
@@ -37,6 +37,7 @@
         left join base_classroom t5 on t4.classroom_id = t5.id
         left join xjr_user t6 on t4.teacher_id = t6.id
         left join base_grade t7 on t4.grade_id = t7.id
+        left join xjr_dictionary_detail t8 on t3.archives_status = t8.code
         WHERE t1.delete_mark = 0
         <if test="dto.keyword != null and dto.keyword != ''">
             AND (t1.name like concat('%', #{dto.keyword}, '%') OR t1.credential_number like concat('%', #{dto.keyword}, '%'))
@@ -44,6 +45,9 @@
         <if test="dto.name != null and dto.name != '' and dto.idNumber != null and dto.idNumber != ''">
             AND t1.name = #{dto.name} and t1.credential_number = #{dto.idNumber}
         </if>
+        <if test="dto.idNumber != null and dto.idNumber != ''">
+            and t1.credential_number = #{dto.idNumber}
+        </if>
         <if test="dto.userId != null">
             AND t1.id = #{dto.userId}
         </if>