Browse Source

修改学生权限

DESKTOP-USV654P\pc 3 months ago
parent
commit
2a2d54ca93

+ 5 - 0
src/main/java/com/xjrsoft/module/student/entity/BaseStudent.java

@@ -261,4 +261,9 @@ public class BaseStudent implements Serializable {
 
     @ApiModelProperty("籍贯类型")
     private String nativePlaceType;
+    /**
+     * 是否正常数据(1:是 0:否)
+     */
+    @ApiModelProperty("是否正常数据(1:是 0:否)")
+    private Integer isNormal;
 }

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

@@ -19,4 +19,5 @@ public interface IBaseStudentService extends MPJBaseService<BaseStudent> {
     StudentPersonalInfoVo getPersonalInfo(Long userId);
 
     List<BaseStudentUserPageVo> getStudentList(BaseStudentUserPageDto dto);
+    void changeIsNormal(String archivesStatus,Integer isNormal);
 }

+ 17 - 1
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentServiceImpl.java

@@ -1,14 +1,19 @@
 package com.xjrsoft.module.student.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.entity.BaseStudent;
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.mapper.BaseStudentMapper;
 import com.xjrsoft.module.student.service.IBaseStudentService;
 import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
 import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
+import com.xjrsoft.module.teacher.entity.BaseTeacher;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 
@@ -33,5 +38,16 @@ public class BaseStudentServiceImpl extends MPJBaseServiceImpl<BaseStudentMapper
         return this.baseMapper.getStudentList(dto);
     }
 
-    ;
+    @Override
+    public void changeIsNormal(String archivesStatus,Integer isNormal) {
+        MPJLambdaWrapper<BaseStudent> wrapper = new MPJLambdaWrapper<BaseStudent>()
+                .selectAll(BaseStudent.class)
+                .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, BaseStudent::getUserId)
+                .eq(BaseStudentSchoolRoll::getArchivesStatus, archivesStatus);
+        List<BaseStudent> baseTeacherList = baseMapper.selectJoinList(BaseStudent.class, wrapper);
+        for (BaseStudent baseTeacher : baseTeacherList) {
+            baseTeacher.setIsNormal(isNormal);
+            baseMapper.updateById(baseTeacher);
+        }
+    }
 }

+ 44 - 0
src/main/java/com/xjrsoft/module/student/service/impl/StudentManagerServiceImpl.java

@@ -74,6 +74,8 @@ import com.xjrsoft.module.system.entity.DictionaryItem;
 import com.xjrsoft.module.system.mapper.DictionarydetailMapper;
 import com.xjrsoft.module.system.mapper.DictionaryitemMapper;
 import com.xjrsoft.module.system.service.IAreaService;
+import com.xjrsoft.module.system.service.IDictionarydetailService;
+import com.xjrsoft.module.teacher.entity.BaseTeacher;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
@@ -135,6 +137,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
     private final IBaseClassService baseClassService;
 
     private final IBaseGradeService baseGradeService;
+    private IDictionarydetailService dictionarydetailService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -147,8 +150,29 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
         baseStudentUser.setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
         studentbaseManagerBaseStudentUserMapper.insert(baseStudentUser);
         for (BaseStudent baseStudent : baseStudentUser.getBaseStudentList()) {
+
             baseStudent.setUserId(baseStudentUser.getId());
+
+            BaseStudentSchoolRoll baseStudentSchoolRoll=baseStudentUser.getBaseStudentSchoolRollList().get(0);
+
+            if (StrUtil.isNotBlank(baseStudentSchoolRoll.getArchivesStatus())) {
+                baseStudent.setIsNormal(1);
+            } else {
+                DictionaryDetail dictionaryDetail = dictionarydetailService.getOne(Wrappers.<DictionaryDetail>query()
+                        .lambda()
+                        .eq(DictionaryDetail::getCode, baseStudentSchoolRoll.getArchivesStatus())
+                        .inSql(DictionaryDetail::getItemId,"SELECT id from xjr_dictionary_item where code='archives_status'"));
+                if (dictionaryDetail != null) {
+                    if (dictionaryDetail.getExtendField1().equals("0")) {
+                        baseStudent.setIsNormal(0);
+                    } else {
+                        baseStudent.setIsNormal(1);
+                    }
+                }
+            }
+
             baseStudentService.save(baseStudent);
+
         }
         for (BaseStudentContact baseStudentContact : baseStudentUser.getBaseStudentContactList()) {
             baseStudentContact.setUserId(baseStudentUser.getId());
@@ -243,6 +267,25 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
             List<Long> baseStudentRemoveIds = baseStudentIds.stream().filter(item -> !baseStudentOldIds.contains(item)).collect(Collectors.toList());
 
             for (BaseStudent baseStudent : baseStudentUser.getBaseStudentList()) {
+
+                BaseStudentSchoolRoll baseStudentSchoolRoll=baseStudentUser.getBaseStudentSchoolRollList().get(0);
+
+                if (StrUtil.isNotBlank(baseStudentSchoolRoll.getArchivesStatus())) {
+                    baseStudent.setIsNormal(1);
+                } else {
+                    DictionaryDetail dictionaryDetail = dictionarydetailService.getOne(Wrappers.<DictionaryDetail>query()
+                            .lambda()
+                            .eq(DictionaryDetail::getCode, baseStudentSchoolRoll.getArchivesStatus())
+                            .inSql(DictionaryDetail::getItemId,"SELECT id from xjr_dictionary_item where code='archives_status'"));
+                    if (dictionaryDetail != null) {
+                        if (dictionaryDetail.getExtendField1().equals("0")) {
+                            baseStudent.setIsNormal(0);
+                        } else {
+                            baseStudent.setIsNormal(1);
+                        }
+                    }
+                }
+
                 //如果不等于空则修改
                 if (baseStudent.getId() != null) {
                     baseStudentService.updateById(baseStudent);
@@ -1136,4 +1179,5 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
         }
         return null;
     }
+
 }

+ 10 - 0
src/main/java/com/xjrsoft/module/system/controller/DictionarydetailController.java

@@ -12,6 +12,7 @@ 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.student.service.IBaseStudentService;
 import com.xjrsoft.module.system.dto.*;
 import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.system.entity.DictionaryItem;
@@ -46,6 +47,7 @@ public class DictionarydetailController {
     private IDictionarydetailService dictionarydetailService;
     private IDictionaryitemService dictionaryitemService;
     private ITeacherbaseManagerService teacherbaseManagerService;
+    private IBaseStudentService baseStudentService;
 
     @GetMapping
     @ApiOperation(value = "获取当前数据字典详情(不分页)")
@@ -162,6 +164,14 @@ public class DictionarydetailController {
                 }
                 teacherbaseManagerService.changeIsNormal(dictionaryDetail.getCode(), isNormal);
             }
+
+            if(dictionaryItem.getCode().equals("archives_status")){
+                Integer isNormal = 1;
+                if (dictionaryDetail.getExtendField1().equals("0")) {
+                    isNormal = 0;
+                }
+                baseStudentService.changeIsNormal(dictionaryDetail.getCode(), isNormal);
+            }
         }
 
         boolean isSuccess = dictionarydetailService.updateById(dictionaryDetail);

+ 6 - 2
src/main/java/com/xjrsoft/module/teacher/service/impl/TeacherbaseManagerServiceImpl.java

@@ -115,7 +115,9 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
             } else {
                 DictionaryDetail dictionaryDetail = dictionarydetailService.getOne(Wrappers.<DictionaryDetail>query()
                         .lambda()
-                        .eq(DictionaryDetail::getCode, baseTeacher.getJobState()));
+                        .eq(DictionaryDetail::getCode, baseTeacher.getJobState())
+                        .inSql(DictionaryDetail::getItemId,"SELECT id from xjr_dictionary_item where code='job_state'")
+                );
                 if (dictionaryDetail != null) {
                     if (dictionaryDetail.getExtendField1().equals("0")) {
                         baseTeacher.setIsNormal(0);
@@ -264,7 +266,9 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
                 } else {
                     DictionaryDetail dictionaryDetail = dictionarydetailService.getOne(Wrappers.<DictionaryDetail>query()
                             .lambda()
-                            .eq(DictionaryDetail::getCode, baseTeacher.getJobState()));
+                            .eq(DictionaryDetail::getCode, baseTeacher.getJobState())
+                            .inSql(DictionaryDetail::getItemId,"SELECT id from xjr_dictionary_item where code='job_state'")
+                    );
                     if (dictionaryDetail != null) {
                         if (dictionaryDetail.getExtendField1().equals("0")) {
                             baseTeacher.setIsNormal(0);