|
|
@@ -77,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;
|
|
|
@@ -122,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());
|
|
|
@@ -206,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()));
|
|
|
@@ -431,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));
|
|
|
@@ -1019,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)) {
|
|
|
@@ -1035,7 +1042,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
}
|
|
|
};
|
|
|
studentUser.setAvatar(map.get(suffix) + base64String);
|
|
|
- studentbaseManagerBaseStudentUserMapper.updateById(studentUser);
|
|
|
+ baseStudentUserMapper.updateById(studentUser);
|
|
|
return true;
|
|
|
}
|
|
|
|