|
@@ -8,6 +8,9 @@ import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
+import com.zhongzheng.modules.user.domain.User;
|
|
|
+import com.zhongzheng.modules.user.service.IUserService;
|
|
|
+import com.zhongzheng.modules.user.vo.UserVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -39,6 +42,9 @@ public class UserUpdateServiceImpl extends ServiceImpl<UserUpdateMapper, UserUpd
|
|
|
@Autowired
|
|
|
private IClassGradeUserService iClassGradeUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserService iUserService;
|
|
|
+
|
|
|
@Override
|
|
|
public UserUpdateVo queryById(Long id){
|
|
|
UserUpdate db = this.baseMapper.selectById(id);
|
|
@@ -76,6 +82,26 @@ public class UserUpdateServiceImpl extends ServiceImpl<UserUpdateMapper, UserUpd
|
|
|
return voList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 实体类转化成视图对象
|
|
|
+ *
|
|
|
+ * @param collection 实体类集合
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<UserUpdateVo> entity2UserUpdateVo(Collection<UserUpdate> collection) {
|
|
|
+ List<UserUpdateVo> voList = collection.stream()
|
|
|
+ .map(any -> BeanUtil.toBean(any, UserUpdateVo.class))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (collection instanceof Page) {
|
|
|
+ Page<UserUpdate> page = (Page<UserUpdate>) collection;
|
|
|
+ Page<UserUpdateVo> pageVo = new Page<>();
|
|
|
+ BeanUtil.copyProperties(page, pageVo);
|
|
|
+ pageVo.addAll(voList);
|
|
|
+ voList = pageVo;
|
|
|
+ }
|
|
|
+ return voList;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Boolean insertByAddBo(UserUpdateAddBo bo) {
|
|
|
UserUpdate add = BeanUtil.toBean(bo, UserUpdate.class);
|
|
@@ -123,7 +149,7 @@ public class UserUpdateServiceImpl extends ServiceImpl<UserUpdateMapper, UserUpd
|
|
|
|
|
|
@Override
|
|
|
public List<UserUpdateVo> listUserChangeInfo(ConsoleQueryBo bo) {
|
|
|
- List<UserUpdateVo> userUpdateVos = baseMapper.selectChangeInfo(bo);
|
|
|
+ List<UserUpdateVo> userUpdateVos = entity2UserUpdateVo(baseMapper.selectChangeInfo(bo));
|
|
|
userUpdateVos.forEach(userUpdate->{
|
|
|
LambdaQueryWrapper<ClassGradeUser> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.eq(Validator.isNotEmpty(userUpdate.getUserId()), ClassGradeUser::getUserId, userUpdate.getUserId());
|
|
@@ -138,7 +164,12 @@ public class UserUpdateServiceImpl extends ServiceImpl<UserUpdateMapper, UserUpd
|
|
|
lqw.last("limit 1");
|
|
|
classGradeUser = iClassGradeUserService.getOne(lqw);
|
|
|
userUpdate.setLastPeriodPlushTime(classGradeUser.getPeriodPlushTime());
|
|
|
+
|
|
|
+ LambdaQueryWrapper<User> lq = Wrappers.lambdaQuery();
|
|
|
+ lq.eq(Validator.isNotEmpty(userUpdate.getUserId()), User::getUserId, userUpdate.getUserId());
|
|
|
+ User user = iUserService.getOne(lq);
|
|
|
+ userUpdate.setNowRealname(user.getRealname());
|
|
|
});
|
|
|
- return baseMapper.selectChangeInfo(bo);
|
|
|
+ return userUpdateVos;
|
|
|
}
|
|
|
}
|