|
|
@ -36,7 +36,7 @@ import com.elink.esua.epdc.modules.psychology.dao.PsychologyAnswerDao; |
|
|
|
import com.elink.esua.epdc.modules.psychology.dao.PsychologyQuestionDao; |
|
|
|
import com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity; |
|
|
|
import com.elink.esua.epdc.modules.psychology.entity.PsychologistTitleRelationEntity; |
|
|
|
import com.elink.esua.epdc.modules.psychology.entity.PsychologyQuestionEntity; |
|
|
|
import com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity; |
|
|
|
import com.elink.esua.epdc.modules.psychology.redis.PsychologistRedis; |
|
|
|
import com.elink.esua.epdc.modules.psychology.service.PsychologistService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -49,6 +49,7 @@ import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 心理咨询师表 |
|
|
@ -178,12 +179,12 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PsychologyAnswerListResultDTO> listQuestion(PsychologyAnswerFormDTO dto) { |
|
|
|
public List<PsychologyAnswerListResultDTO> listAllQuestion(PsychologyAnswerFormDTO dto) { |
|
|
|
// sql limit条件转换
|
|
|
|
dto.setPageIndex((dto.getPageIndex() - 1) * dto.getPageSize()); |
|
|
|
List<PsychologyAnswerListResultDTO> data = psychologyQuestionDao.listQuestion(dto); |
|
|
|
List<PsychologyAnswerListResultDTO> data = psychologyQuestionDao.listAllQuestion(dto); |
|
|
|
data.forEach(item -> { |
|
|
|
List<PsychologyAnswerInfoResultDTO> list = psychologyAnswerDao.listQuestion(item.getId()); |
|
|
|
List<PsychologyAnswerInfoResultDTO> list = psychologyAnswerDao.listAllQuestion(item.getId()); |
|
|
|
item.setAnswerList(list == null ? new ArrayList<>() : ConvertUtils.sourceToTarget(list, PsychologyAnswerInfoResultDTO.class)); |
|
|
|
}); |
|
|
|
|
|
|
@ -197,4 +198,19 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps |
|
|
|
|
|
|
|
return psychologyQuestionDao.listUnansweredQuestion(dto); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PsychologyAnswerOfMineResultDTO> listMyQuestion(PsychologyAnswerFormDTO dto) { |
|
|
|
List<String> questionIds = psychologyAnswerDao.listMyQuestion(dto.getUserId()).stream().map(PsychologyAnswerEntity::getId).collect(Collectors.toList()); |
|
|
|
dto.setQuestionIds(questionIds); |
|
|
|
// sql limit条件转换
|
|
|
|
dto.setPageIndex((dto.getPageIndex() - 1) * dto.getPageSize()); |
|
|
|
List<PsychologyAnswerOfMineResultDTO> data = psychologyQuestionDao.listMyQuestion(dto); |
|
|
|
data.forEach(item -> { |
|
|
|
List<PsychologyAnswerUserInfoResultDTO> list = psychologyAnswerDao.listUserQuestion(item.getId()); |
|
|
|
item.setAnswerList(list == null ? new ArrayList<>() : ConvertUtils.sourceToTarget(list, PsychologyAnswerUserInfoResultDTO.class)); |
|
|
|
}); |
|
|
|
|
|
|
|
return data; |
|
|
|
} |
|
|
|
} |