|
|
@ -21,12 +21,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.dto.psychology.PsychologistDTO; |
|
|
|
import com.elink.esua.epdc.dto.psychology.form.PsychologistFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.psychology.form.PsychologistInfoFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.psychology.form.PsychologyAnswerFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.psychology.form.PsychologyUnansweredFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.psychology.result.*; |
|
|
|
import com.elink.esua.epdc.modules.psychology.dao.PsychologistDao; |
|
|
|
import com.elink.esua.epdc.modules.psychology.dao.PsychologistTitleRelationDao; |
|
|
@ -34,6 +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.redis.PsychologistRedis; |
|
|
|
import com.elink.esua.epdc.modules.psychology.service.PsychologistService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -104,6 +107,11 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(PsychologistDTO dto) { |
|
|
|
List<PsychologistEntity> check = baseDao.checkPsychiatrist(dto); |
|
|
|
if (check.size() > 0) { |
|
|
|
throw new RenException("该用户已经注册心理咨询师"); |
|
|
|
} |
|
|
|
|
|
|
|
List<String> relation = dto.getTitles(); |
|
|
|
PsychologistEntity entity = ConvertUtils.sourceToTarget(dto, PsychologistEntity.class); |
|
|
|
int num = baseDao.insert(entity); |
|
|
@ -158,6 +166,8 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PsychologyAnswerListUserResultDTO> listUserQuestion(PsychologyAnswerFormDTO dto) { |
|
|
|
// sql limit条件转换
|
|
|
|
dto.setPageIndex((dto.getPageIndex() - 1) * dto.getPageSize()); |
|
|
|
List<PsychologyAnswerListUserResultDTO> data = psychologyQuestionDao.listUserQuestion(dto); |
|
|
|
data.forEach(item -> { |
|
|
|
List<PsychologyAnswerUserInfoResultDTO> list = psychologyAnswerDao.listUserQuestion(item.getId()); |
|
|
@ -169,6 +179,8 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PsychologyAnswerListResultDTO> listQuestion(PsychologyAnswerFormDTO dto) { |
|
|
|
// sql limit条件转换
|
|
|
|
dto.setPageIndex((dto.getPageIndex() - 1) * dto.getPageSize()); |
|
|
|
List<PsychologyAnswerListResultDTO> data = psychologyQuestionDao.listQuestion(dto); |
|
|
|
data.forEach(item -> { |
|
|
|
List<PsychologyAnswerInfoResultDTO> list = psychologyAnswerDao.listQuestion(item.getId()); |
|
|
@ -177,4 +189,13 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps |
|
|
|
|
|
|
|
return data; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PsychologyUnansweredResultDTO> listUnansweredQuestion(PsychologyUnansweredFormDTO dto) { |
|
|
|
// sql limit条件转换
|
|
|
|
dto.setPageIndex((dto.getPageIndex() - 1) * dto.getPageSize()); |
|
|
|
List<PsychologyQuestionEntity> data = psychologyQuestionDao.listUnansweredQuestion(dto); |
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(data, PsychologyUnansweredResultDTO.class); |
|
|
|
} |
|
|
|
} |