|
|
@@ -32,11 +32,13 @@ 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.mapper.UserDeptRelationMapper;
|
|
|
+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.IUserService;
|
|
|
import com.xjrsoft.module.student.dto.AddBaseStudentUserDto;
|
|
|
+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;
|
|
|
@@ -75,7 +77,7 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUserMapper, BaseStudentUser> implements IStudentManagerService {
|
|
|
- private final com.xjrsoft.module.student.mapper.BaseStudentUserMapper studentbaseManagerBaseStudentUserMapper;
|
|
|
+ private final com.xjrsoft.module.student.mapper.BaseStudentUserMapper baseStudentUserMapper;
|
|
|
|
|
|
private final IBaseStudentService baseStudentService;
|
|
|
private final BaseClassMapper baseClassMapper;
|
|
|
@@ -109,6 +111,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
private final IBaseGradeService baseGradeService;
|
|
|
private final IStudentChangeRecordService recordService;
|
|
|
private IDictionarydetailService dictionarydetailService;
|
|
|
+ private final UserMapper userMapper;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -119,7 +122,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
|
|
|
// 用户身份证后6位作为默认密码
|
|
|
baseStudentUser.setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
|
|
|
- studentbaseManagerBaseStudentUserMapper.insert(baseStudentUser);
|
|
|
+ baseStudentUserMapper.insert(baseStudentUser);
|
|
|
for (BaseStudent baseStudent : baseStudentUser.getBaseStudentList()) {
|
|
|
|
|
|
baseStudent.setUserId(baseStudentUser.getId());
|
|
|
@@ -203,11 +206,18 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean update(UpdateBaseStudentUserDto dto) {
|
|
|
-
|
|
|
+ List<BaseStudentUser> studentUserList = baseStudentUserMapper.selectList(
|
|
|
+ new QueryWrapper<BaseStudentUser>().lambda()
|
|
|
+ .eq(BaseStudentUser::getCredentialNumber, dto.getCredentialNumber())
|
|
|
+ .ne(BaseStudentUser::getId, dto.getId())
|
|
|
+ );
|
|
|
+ if(!studentUserList.isEmpty()){
|
|
|
+ throw new MyException("该身份证已被其他人占用,请检查是否正确");
|
|
|
+ }
|
|
|
BaseStudentUser baseStudentUser = BeanUtil.toBean(dto, BaseStudentUser.class);
|
|
|
baseStudentUser.setCode(dto.getUserName());
|
|
|
|
|
|
- studentbaseManagerBaseStudentUserMapper.updateById(baseStudentUser);
|
|
|
+ baseStudentUserMapper.updateById(baseStudentUser);
|
|
|
|
|
|
//先删除再新增
|
|
|
userDeptRelationService.remove(Wrappers.<UserDeptRelation>query().lambda().eq(UserDeptRelation::getUserId, baseStudentUser.getId()));
|
|
|
@@ -428,7 +438,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean delete(List<Long> ids) {
|
|
|
- studentbaseManagerBaseStudentUserMapper.deleteBatchIds(ids);
|
|
|
+ baseStudentUserMapper.deleteBatchIds(ids);
|
|
|
baseStudentService.remove(Wrappers.lambdaQuery(BaseStudent.class).in(BaseStudent::getUserId, ids));
|
|
|
studentContactService.remove(Wrappers.lambdaQuery(BaseStudentContact.class).in(BaseStudentContact::getUserId, ids));
|
|
|
familyMapper.delete(Wrappers.lambdaQuery(BaseStudentFamily.class).in(BaseStudentFamily::getUserId, ids));
|
|
|
@@ -481,11 +491,19 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Boolean importStudentData(List<Map<Integer, Object>> excelDataList) throws ParseException {
|
|
|
+ public List<BaseStudentSompleInfoVo> importStudentData(List<Map<Integer, Object>> excelDataList) throws ParseException {
|
|
|
List<String> idNumbers = new ArrayList<>();
|
|
|
for (Map<Integer, Object> integerObjectMap : excelDataList) {
|
|
|
idNumbers.add(integerObjectMap.get(0).toString());
|
|
|
}
|
|
|
+
|
|
|
+ List<BaseStudentSompleInfoVo> infos = userMapper.getInfosByParam(new BaseStudentSimpleInfoDto() {{
|
|
|
+ setIdNumberList(idNumbers);
|
|
|
+ }});
|
|
|
+ if(!infos.isEmpty()){
|
|
|
+ return infos;
|
|
|
+ }
|
|
|
+
|
|
|
//查询所有学生的用户信息,组装起来备用
|
|
|
List<BaseStudentUser> studentUsers = this.selectJoinList(BaseStudentUser.class,
|
|
|
new MPJLambdaWrapper<BaseStudentUser>()
|
|
|
@@ -998,7 +1016,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
if (!insertContactList.isEmpty()) {
|
|
|
studentContactService.saveBatch(insertContactList);
|
|
|
}
|
|
|
- return true;
|
|
|
+ return new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -1008,7 +1026,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
|
|
|
@Override
|
|
|
public Boolean uploadImage(Long userId, MultipartFile file) throws IOException {
|
|
|
- BaseStudentUser studentUser = studentbaseManagerBaseStudentUserMapper.selectById(userId);
|
|
|
+ BaseStudentUser studentUser = baseStudentUserMapper.selectById(userId);
|
|
|
String[] imgSuffix = new String[]{"png", "jpg", "jpeg"};
|
|
|
String suffix = StringUtils.substringAfterLast(file.getOriginalFilename(), StringPool.DOT);
|
|
|
if (!Arrays.asList(imgSuffix).contains(suffix)) {
|
|
|
@@ -1024,7 +1042,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
}
|
|
|
};
|
|
|
studentUser.setAvatar(map.get(suffix) + base64String);
|
|
|
- studentbaseManagerBaseStudentUserMapper.updateById(studentUser);
|
|
|
+ baseStudentUserMapper.updateById(studentUser);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -1037,8 +1055,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
.selectAs(BaseMajorSet::getMajorId, BaseClassMajorSetVo::getMajorId)
|
|
|
.selectAs(BaseClass::getName, BaseClassMajorSetVo::getClassName)
|
|
|
.selectAs(BaseClass::getGradeId, BaseClassMajorSetVo::getGradeId)
|
|
|
- .leftJoin(BaseClassMajorSet.class, BaseClassMajorSet::getClassId, BaseClass::getId)
|
|
|
- .leftJoin(BaseMajorSet.class, BaseMajorSet::getId, BaseClassMajorSet::getMajorSetId)
|
|
|
+ .leftJoin(BaseMajorSet.class, BaseMajorSet::getId, BaseClass::getMajorSetId)
|
|
|
.eq(dto.getIsGraduate() != null, BaseClass::getIsGraduate, dto.getIsGraduate())
|
|
|
.eq(BaseClass::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
.eq(BaseClass::getEnabledMark, EnabledMark.ENABLED.getCode())
|