|
|
@@ -4,14 +4,21 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
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.xjrsoft.common.constant.GlobalConstant;
|
|
|
import com.xjrsoft.common.enums.EnabledMark;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
+import com.xjrsoft.common.utils.RedisUtil;
|
|
|
+import com.xjrsoft.module.base.entity.BaseUserStudent;
|
|
|
import com.xjrsoft.module.base.entity.WhitelistManagement;
|
|
|
import com.xjrsoft.module.base.service.IWhitelistManagementService;
|
|
|
import com.xjrsoft.module.organization.entity.User;
|
|
|
+import com.xjrsoft.module.organization.entity.UserDeptRelation;
|
|
|
+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.ActiveAccountDto;
|
|
|
import com.xjrsoft.module.student.dto.AddBaseNewStudentDto;
|
|
|
@@ -48,6 +55,7 @@ import java.util.Date;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
/**
|
|
|
* @title: 新生维护信息
|
|
|
@@ -65,7 +73,8 @@ public class BaseNewStudentController {
|
|
|
private final IBaseNewStudentService baseNewStudentService;
|
|
|
private final IBaseStudentFamilyMemberService familyMemberService;
|
|
|
private final IWhitelistManagementService whitelistManagementService;
|
|
|
-
|
|
|
+ private final IUserRoleRelationService userRoleRelationService;
|
|
|
+ private final RedisUtil redisUtil;
|
|
|
@GetMapping(value = "/page")
|
|
|
@ApiOperation(value="新生维护信息列表(分页)")
|
|
|
@SaCheckPermission("basenewstudent:detail")
|
|
|
@@ -212,18 +221,47 @@ public class BaseNewStudentController {
|
|
|
.eq(BaseStudentFamilyMember::getUserId, dto.getId())
|
|
|
.eq(BaseStudentFamilyMember::getMobile, dto.getParentMobile())
|
|
|
);
|
|
|
-
|
|
|
+ BaseStudentFamilyMember member;
|
|
|
if(list.isEmpty()){
|
|
|
- BaseStudentFamilyMember member = new BaseStudentFamilyMember();
|
|
|
+ member = new BaseStudentFamilyMember();
|
|
|
member.setUserId(user.getId());
|
|
|
member.setName(dto.getParentName());
|
|
|
member.setMobile(dto.getParentMobile());
|
|
|
member.setCreateDate(LocalDateTime.now());
|
|
|
member.setCreateUserId(StpUtil.getLoginIdAsLong());
|
|
|
familyMemberService.save(member);
|
|
|
+ }else{
|
|
|
+ member = list.get(0);
|
|
|
}
|
|
|
+ List<User> parents = userService.list(
|
|
|
+ new QueryWrapper<User>().lambda()
|
|
|
+ .eq(User::getUserName, dto.getParentMobile())
|
|
|
+ .eq(User::getName, dto.getParentName())
|
|
|
+ );
|
|
|
+ if(parents.isEmpty()){
|
|
|
+ User parentUser = new User() {{
|
|
|
+ setUserName(dto.getParentMobile());
|
|
|
+ setName(dto.getParentName());
|
|
|
+ setIsChangePassword(1);
|
|
|
+ setDeleteMark(0);
|
|
|
+ setEnabledMark(1);
|
|
|
+ setMobile(dto.getMobile());
|
|
|
+ }};
|
|
|
+ userService.save(parentUser);
|
|
|
|
|
|
+ userRoleRelationService.save(new UserRoleRelation(){{
|
|
|
+ setUserId(parentUser.getId());
|
|
|
+ setRoleId(4L);
|
|
|
+ }});
|
|
|
|
|
|
+ BaseUserStudent userStudent = new BaseUserStudent();
|
|
|
+ userStudent.setStudentId(user.getId());
|
|
|
+ userStudent.setStudentNane(user.getName());
|
|
|
+ userStudent.setStudentIdentity(user.getCredentialNumber());
|
|
|
+ userStudent.setCreateDate(new Date());
|
|
|
+ userStudent.setUserId(parentUser.getId());
|
|
|
+ familyMemberService.save(member);
|
|
|
+ }
|
|
|
|
|
|
//新增白名单信息
|
|
|
List<WhitelistManagement> managementList = whitelistManagementService.list(
|
|
|
@@ -241,6 +279,16 @@ public class BaseNewStudentController {
|
|
|
whitelistManagementService.save(whitelistManagement);
|
|
|
}
|
|
|
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+ List<User> userList = userService.list();
|
|
|
+ redisUtil.set(GlobalConstant.USER_CACHE_KEY, userList);
|
|
|
+
|
|
|
+ List<UserRoleRelation> userRoleRelationList = userRoleRelationService.list(Wrappers.lambdaQuery(UserRoleRelation.class));
|
|
|
+ redisUtil.set(GlobalConstant.USER_ROLE_RELATION_CACHE_KEY, userRoleRelationList);
|
|
|
+
|
|
|
+ whitelistManagementService.loadCaches();
|
|
|
+ });
|
|
|
+
|
|
|
return RT.ok(true);
|
|
|
}
|
|
|
|