|
|
@@ -111,15 +111,11 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean add(AddBaseStudentUserDto dto, MultipartFile file) throws IOException {
|
|
|
+ public Long add(AddBaseStudentUserDto dto){
|
|
|
|
|
|
BaseStudentUser baseStudentUser = BeanUtil.toBean(dto, BaseStudentUser.class);
|
|
|
baseStudentUser.setCode(dto.getUserName());
|
|
|
|
|
|
- //存学籍照片
|
|
|
- String base64String = Base64.getEncoder().encodeToString(file.getBytes());
|
|
|
- baseStudentUser.setAvatar(base64String);
|
|
|
-
|
|
|
// 用户身份证后6位作为默认密码
|
|
|
baseStudentUser.setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
|
|
|
studentbaseManagerBaseStudentUserMapper.insert(baseStudentUser);
|
|
|
@@ -179,20 +175,16 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
List<UserRoleRelation> userRoleRelationList = userRoleRelationMapper.selectList(Wrappers.lambdaQuery(UserRoleRelation.class));
|
|
|
redisUtil.set(GlobalConstant.USER_ROLE_RELATION_CACHE_KEY, userRoleRelationList);
|
|
|
});
|
|
|
- return true;
|
|
|
+ return baseStudentUser.getId();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean update(UpdateBaseStudentUserDto dto, MultipartFile file) throws IOException {
|
|
|
+ public Boolean update(UpdateBaseStudentUserDto dto){
|
|
|
|
|
|
BaseStudentUser baseStudentUser = BeanUtil.toBean(dto, BaseStudentUser.class);
|
|
|
baseStudentUser.setCode(dto.getUserName());
|
|
|
|
|
|
- //存学籍照片
|
|
|
- String base64String = Base64.getEncoder().encodeToString(file.getBytes());
|
|
|
- baseStudentUser.setAvatar(base64String);
|
|
|
-
|
|
|
studentbaseManagerBaseStudentUserMapper.updateById(baseStudentUser);
|
|
|
|
|
|
//先删除再新增
|
|
|
@@ -967,6 +959,15 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
|
|
|
return baseStudentMapper.getStudentPage(page, dto);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean uploadImage(Long userId, MultipartFile file) throws IOException {
|
|
|
+ BaseStudentUser studentUser = studentbaseManagerBaseStudentUserMapper.selectById(userId);
|
|
|
+ String base64String = Base64.getEncoder().encodeToString(file.getBytes());
|
|
|
+ studentUser.setAvatar(base64String);
|
|
|
+ studentbaseManagerBaseStudentUserMapper.updateById(studentUser);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 初始化字典信息
|
|
|
* 身份证类型、
|