|
|
@@ -37,6 +37,7 @@ import com.xjrsoft.module.organization.mapper.UserMapper;
|
|
|
import com.xjrsoft.module.organization.mapper.UserRoleRelationMapper;
|
|
|
import com.xjrsoft.module.organization.service.IDepartmentService;
|
|
|
import com.xjrsoft.module.organization.service.IUserDeptRelationService;
|
|
|
+import com.xjrsoft.module.organization.service.IUserRoleRelationService;
|
|
|
import com.xjrsoft.module.organization.service.IUserService;
|
|
|
import com.xjrsoft.module.student.dto.AddBaseStudentUserDto;
|
|
|
import com.xjrsoft.module.student.dto.BaseStudentSimpleInfoDto;
|
|
|
@@ -83,6 +84,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
private final IBaseStudentService baseStudentService;
|
|
|
private final BaseClassMapper baseClassMapper;
|
|
|
private final IBaseStudentContactService studentContactService;
|
|
|
+ private final IUserRoleRelationService userRoleRelationService;
|
|
|
private final BaseStudentFamilyMapper familyMapper;
|
|
|
private final BaseStudentFamilyMemberMapper familyMemberMapper;
|
|
|
|
|
|
@@ -222,7 +224,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
.eq(BaseStudentUser::getCredentialNumber, dto.getCredentialNumber())
|
|
|
.ne(BaseStudentUser::getId, dto.getId())
|
|
|
);
|
|
|
- if(!studentUserList.isEmpty()){
|
|
|
+ if (!studentUserList.isEmpty()) {
|
|
|
throw new MyException("该身份证已被其他人占用,请检查是否正确");
|
|
|
}
|
|
|
BaseStudentUser baseStudentUser = BeanUtil.toBean(dto, BaseStudentUser.class);
|
|
|
@@ -508,12 +510,12 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
idNumbers.add(integerObjectMap.get(0).toString());
|
|
|
}
|
|
|
|
|
|
- List<BaseStudentSompleInfoVo> infos = userMapper.getInfosByParam(new BaseStudentSimpleInfoDto() {{
|
|
|
- setIdNumberList(idNumbers);
|
|
|
- }});
|
|
|
- if(!infos.isEmpty()){
|
|
|
- return infos;
|
|
|
- }
|
|
|
+// List<BaseStudentSompleInfoVo> infos = userMapper.getInfosByParam(new BaseStudentSimpleInfoDto() {{
|
|
|
+// setIdNumberList(idNumbers);
|
|
|
+// }});
|
|
|
+// if(!infos.isEmpty()){
|
|
|
+// return infos;
|
|
|
+// }
|
|
|
|
|
|
//查询所有学生的用户信息,组装起来备用
|
|
|
List<BaseStudentUser> studentUsers = this.selectJoinList(BaseStudentUser.class,
|
|
|
@@ -602,6 +604,12 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
for (BaseStudentContact el : contactList) {
|
|
|
contactMap.put(el.getUserId(), el);
|
|
|
}
|
|
|
+ //查询用户角色
|
|
|
+ List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectList(null);
|
|
|
+ Map<Long, UserRoleRelation> userRoleRelationsMap = new HashMap<>();
|
|
|
+ for (UserRoleRelation el : userRoleRelations) {
|
|
|
+ userRoleRelationsMap.put(el.getUserId(), el);
|
|
|
+ }
|
|
|
|
|
|
List<BaseStudentUser> updateStudentUserList = new ArrayList();
|
|
|
List<BaseStudent> updateBaseStudentList = new ArrayList();
|
|
|
@@ -609,6 +617,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
List<BaseStudentSubsidize> updateSubsidizeList = new ArrayList();
|
|
|
List<BaseStudentFamily> updateFamilyList = new ArrayList();
|
|
|
List<BaseStudentContact> updateContactList = new ArrayList();
|
|
|
+ List<UserRoleRelation> updateRoleRelationList = new ArrayList();
|
|
|
|
|
|
List<BaseStudentUser> insertStudentUserList = new ArrayList();
|
|
|
List<BaseStudent> insertBaseStudentList = new ArrayList();
|
|
|
@@ -616,6 +625,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
List<BaseStudentSubsidize> insertSubsidizeList = new ArrayList();
|
|
|
List<BaseStudentFamily> insertFamilyList = new ArrayList();
|
|
|
List<BaseStudentContact> insertContactList = new ArrayList();
|
|
|
+ List<UserRoleRelation> insertRoleRelationList = new ArrayList();
|
|
|
|
|
|
//异动记录
|
|
|
List<StudentChangeRecord> changeRecordList = new ArrayList();
|
|
|
@@ -635,6 +645,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
BaseStudentSubsidize subsidize;
|
|
|
BaseStudentFamily studentFamily;
|
|
|
BaseStudentContact contact;
|
|
|
+ UserRoleRelation roleRelation;
|
|
|
long userId = IdUtil.getSnowflakeNextId();
|
|
|
if (user != null) {
|
|
|
userId = user.getId();
|
|
|
@@ -684,6 +695,14 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
contact.setCreateDate(LocalDateTime.now());
|
|
|
}
|
|
|
contact.setDeleteMark(DeleteMark.NODELETE.getCode());
|
|
|
+
|
|
|
+ // 更新角色
|
|
|
+ roleRelation = userRoleRelationsMap.get(user.getId());
|
|
|
+ if (roleRelation == null) {
|
|
|
+ roleRelation = new UserRoleRelation();
|
|
|
+ roleRelation.setUserId(userId);
|
|
|
+ roleRelation.setRoleId(RoleEnum.STUDENT.getCode());
|
|
|
+ }
|
|
|
} else {
|
|
|
user = new BaseStudentUser();
|
|
|
user.setId(userId);
|
|
|
@@ -720,6 +739,11 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
contact.setUserId(userId);
|
|
|
contact.setCreateUserId(createUserId);
|
|
|
contact.setCreateDate(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 角色
|
|
|
+ roleRelation = new UserRoleRelation();
|
|
|
+ roleRelation.setUserId(userId);
|
|
|
+ roleRelation.setRoleId(RoleEnum.STUDENT.getCode());
|
|
|
}
|
|
|
//设置字段值
|
|
|
if (dataMaps.get(1) != null && !"".equals(dataMaps.get(1).toString())) {
|
|
|
@@ -884,7 +908,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
}
|
|
|
if (dataMaps.get(53) != null && !"".equals(dataMaps.get(53).toString()) && schoolRoll.getId() == null) {
|
|
|
schoolRoll.setClassId(classMap.get(dataMaps.get(53).toString()).getId());//班级
|
|
|
- if(schoolRoll.getMajorSetId() == null){
|
|
|
+ if (schoolRoll.getMajorSetId() == null) {
|
|
|
schoolRoll.setMajorSetId(classMap.get(dataMaps.get(53).toString()).getMajorSetId());
|
|
|
}
|
|
|
}
|
|
|
@@ -984,45 +1008,51 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
studentFamily.setRailwayStation(dataMaps.get(83).toString());//离家最近火车站
|
|
|
}
|
|
|
|
|
|
- if(studentUserMap.containsKey(credentialNumber)){
|
|
|
+ if (studentUserMap.containsKey(credentialNumber)) {
|
|
|
updateStudentUserList.add(user);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
insertStudentUserList.add(user);
|
|
|
}
|
|
|
|
|
|
- if(baseStudent.getId() == null){
|
|
|
+ if (baseStudent.getId() == null) {
|
|
|
insertBaseStudentList.add(baseStudent);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
updateBaseStudentList.add(baseStudent);
|
|
|
}
|
|
|
|
|
|
- if(schoolRoll.getId() == null){
|
|
|
- if(schoolRoll.getArchivesStatus() == null){
|
|
|
+ if (schoolRoll.getId() == null) {
|
|
|
+ if (schoolRoll.getArchivesStatus() == null) {
|
|
|
schoolRoll.setArchivesStatus(ArchivesStatusEnum.FB2901.getCode());
|
|
|
}
|
|
|
insertSchoolRollList.add(schoolRoll);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
updateSchoolRollList.add(schoolRoll);
|
|
|
}
|
|
|
|
|
|
- if(subsidize.getId() == null){
|
|
|
+ if (subsidize.getId() == null) {
|
|
|
insertSubsidizeList.add(subsidize);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
updateSubsidizeList.add(subsidize);
|
|
|
}
|
|
|
|
|
|
- if(studentFamily.getId() == null){
|
|
|
+ if (studentFamily.getId() == null) {
|
|
|
insertFamilyList.add(studentFamily);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
updateFamilyList.add(studentFamily);
|
|
|
}
|
|
|
|
|
|
- if(contact.getId() == null){
|
|
|
+ if (contact.getId() == null) {
|
|
|
insertContactList.add(contact);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
updateContactList.add(contact);
|
|
|
}
|
|
|
|
|
|
+ if (roleRelation.getId() == null) {
|
|
|
+ insertRoleRelationList.add(roleRelation);
|
|
|
+ } else {
|
|
|
+ updateRoleRelationList.add(roleRelation);
|
|
|
+ }
|
|
|
+
|
|
|
row++;
|
|
|
}
|
|
|
//批量修改
|
|
|
@@ -1044,6 +1074,9 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
if (!updateContactList.isEmpty()) {
|
|
|
studentContactService.updateBatchById(updateContactList);
|
|
|
}
|
|
|
+ if (!updateRoleRelationList.isEmpty()) {
|
|
|
+ userRoleRelationService.updateBatchById(updateRoleRelationList);
|
|
|
+ }
|
|
|
//批量新增
|
|
|
if (!insertStudentUserList.isEmpty()) {
|
|
|
this.saveBatch(insertStudentUserList);
|
|
|
@@ -1063,6 +1096,9 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
if (!insertContactList.isEmpty()) {
|
|
|
studentContactService.saveBatch(insertContactList);
|
|
|
}
|
|
|
+ if (!insertRoleRelationList.isEmpty()) {
|
|
|
+ userRoleRelationService.saveBatch(insertRoleRelationList);
|
|
|
+ }
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
|