|
|
|
@ -11,9 +11,13 @@ import com.project.ding.domain.entity.UserEntity; |
|
|
|
import com.project.ding.domain.param.UserParam; |
|
|
|
import com.project.ding.domain.service.SearchUserDomainService; |
|
|
|
import com.project.ding.mapper.UserMapper; |
|
|
|
import com.project.task.domain.entity.TaskUserEntity; |
|
|
|
import com.project.task.domain.enums.TaskUserStatusEnum; |
|
|
|
import com.project.task.domain.service.TaskUserBaseService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
@Service |
|
|
|
@ -22,6 +26,9 @@ public class SearchUserDomainServiceImpl implements SearchUserDomainService { |
|
|
|
@Autowired |
|
|
|
private UserMapper userMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private TaskUserBaseService taskUserBaseService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<PageResult<UserDTO>> search(UserParam param) throws Exception { |
|
|
|
LambdaQueryWrapper<UserEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
@ -45,8 +52,16 @@ public class SearchUserDomainServiceImpl implements SearchUserDomainService { |
|
|
|
|
|
|
|
private UserDTO buildDTO(UserEntity entity) { |
|
|
|
UserDTO dto = entity.toDTO(UserDTO::new); |
|
|
|
// todo 构建考试信息
|
|
|
|
|
|
|
|
// 构建考试信息
|
|
|
|
dto.setNeedExamTaskCount(Long.valueOf(taskUserBaseService.count(new LambdaQueryWrapper<TaskUserEntity>() |
|
|
|
.eq(TaskUserEntity::getUserId, dto.getId()) |
|
|
|
.in(TaskUserEntity::getStatus, List.of(TaskUserStatusEnum.Not_Start.getValue(), TaskUserStatusEnum.Fail.getValue(), TaskUserStatusEnum.Pass.getValue())))).intValue()); |
|
|
|
dto.setParticipatedExamTaskCount(Long.valueOf(taskUserBaseService.count(new LambdaQueryWrapper<TaskUserEntity>() |
|
|
|
.eq(TaskUserEntity::getUserId, dto.getId()) |
|
|
|
.in(TaskUserEntity::getStatus, List.of(TaskUserStatusEnum.Fail.getValue(), TaskUserStatusEnum.Pass.getValue())))).intValue()); |
|
|
|
dto.setPassedExamTaskCount(Long.valueOf(taskUserBaseService.count(new LambdaQueryWrapper<TaskUserEntity>() |
|
|
|
.eq(TaskUserEntity::getUserId, dto.getId()) |
|
|
|
.in(TaskUserEntity::getStatus, List.of(TaskUserStatusEnum.Pass.getValue())))).intValue()); |
|
|
|
|
|
|
|
return dto; |
|
|
|
} |
|
|
|
|