Browse Source

工作端--心理咨询-我回答的问题列表app接口

hotfix/yujt_opt
zhangyuan 5 years ago
parent
commit
2e7382f34f
  1. 14
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/AppPsychologistController.java
  2. 2
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologistTitleController.java
  3. 2
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologistTitleRelationController.java
  4. 2
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyAnswerController.java
  5. 2
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyQuestionController.java
  6. 13
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyAnswerDao.java
  7. 13
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyQuestionDao.java
  8. 12
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologistService.java
  9. 24
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologistServiceImpl.java
  10. 4
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologistTitleRelationServiceImpl.java
  11. 4
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyAnswerServiceImpl.java
  12. 4
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyQuestionServiceImpl.java
  13. 12
      epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyAnswerDao.xml
  14. 20
      epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyQuestionDao.xml

14
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/AppPsychologistController.java

@ -77,16 +77,22 @@ public class AppPsychologistController {
}
@GetMapping("listQuestion")
public Result<List<PsychologyAnswerListResultDTO>> listQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception {
List<PsychologyAnswerListResultDTO> data = psychologistService.listQuestion(formDto);
public Result<List<PsychologyAnswerListResultDTO>> listAllQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception {
List<PsychologyAnswerListResultDTO> data = psychologistService.listAllQuestion(formDto);
return new Result<List<PsychologyAnswerListResultDTO>>().ok(data);
}
@GetMapping("listUnansweredQuestion")
public Result<List<PsychologyUnansweredResultDTO>> listUnansweredQuestion(@RequestBody PsychologyUnansweredFormDTO formDto) throws Exception {
UserDetail user = SecurityUser.getUser();
formDto.setUserId(user.getId().toString());
List<PsychologyUnansweredResultDTO> data = psychologistService.listUnansweredQuestion(formDto);
return new Result<List<PsychologyUnansweredResultDTO>>().ok(data);
}
@GetMapping("listMyQuestion")
public Result<List<PsychologyAnswerOfMineResultDTO>> listMyQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception {
UserDetail user = SecurityUser.getUser();
formDto.setUserId(user.getId().toString());
List<PsychologyAnswerOfMineResultDTO> data = psychologistService.listMyQuestion(formDto);
return new Result<List<PsychologyAnswerOfMineResultDTO>>().ok(data);
}
}

2
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologistTitleController.java

@ -23,8 +23,8 @@ import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.dto.psychology.PsychologistTitleDTO;
import com.elink.esua.epdc.modules.psychology.excel.PsychologistTitleExcel;
import com.elink.esua.epdc.modules.psychology.service.PsychologistTitleService;

2
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologistTitleRelationController.java

@ -23,8 +23,8 @@ import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.dto.psychology.PsychologistTitleRelationDTO;
import com.elink.esua.epdc.modules.psychology.excel.PsychologistTitleRelationExcel;
import com.elink.esua.epdc.modules.psychology.service.PsychologistTitleRelationService;

2
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyAnswerController.java

@ -23,8 +23,8 @@ import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.dto.psychology.PsychologyAnswerDTO;
import com.elink.esua.epdc.modules.psychology.excel.PsychologyAnswerExcel;
import com.elink.esua.epdc.modules.psychology.service.PsychologyAnswerService;

2
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyQuestionController.java

@ -23,8 +23,8 @@ import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.dto.psychology.PsychologyQuestionDTO;
import com.elink.esua.epdc.modules.psychology.excel.PsychologyQuestionExcel;
import com.elink.esua.epdc.modules.psychology.service.PsychologyQuestionService;

13
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyAnswerDao.java

@ -53,5 +53,16 @@ public interface PsychologyAnswerDao extends BaseDao<PsychologyAnswerEntity> {
* @author zhangyuan
* @since 2020/5/21 14:54
*/
List<PsychologyAnswerInfoResultDTO> listQuestion(@Param("questionId") String questionId);
List<PsychologyAnswerInfoResultDTO> listAllQuestion(@Param("questionId") String questionId);
/**
* 工作端--心理咨询-我回答的问题列表
*
* @return java.util.List<com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity>
* @params [params]
* @author zhangyuan
* @since 2020/5/21 14:54
*/
List<PsychologyAnswerEntity> listMyQuestion(@Param("userId") String userId);
}

13
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyQuestionDao.java

@ -22,6 +22,7 @@ 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.PsychologyAnswerListResultDTO;
import com.elink.esua.epdc.dto.psychology.result.PsychologyAnswerListUserResultDTO;
import com.elink.esua.epdc.dto.psychology.result.PsychologyAnswerOfMineResultDTO;
import com.elink.esua.epdc.dto.psychology.result.PsychologyUnansweredResultDTO;
import com.elink.esua.epdc.modules.psychology.entity.PsychologyQuestionEntity;
import org.apache.ibatis.annotations.Mapper;
@ -55,7 +56,7 @@ public interface PsychologyQuestionDao extends BaseDao<PsychologyQuestionEntity>
* @author zhangyuan
* @since 2020/5/21 14:54
*/
List<PsychologyAnswerListResultDTO> listQuestion(PsychologyAnswerFormDTO dto);
List<PsychologyAnswerListResultDTO> listAllQuestion(PsychologyAnswerFormDTO dto);
/**
* 工作端--待解答的心理咨询问题列表
@ -67,4 +68,14 @@ public interface PsychologyQuestionDao extends BaseDao<PsychologyQuestionEntity>
*/
List<PsychologyUnansweredResultDTO> listUnansweredQuestion(PsychologyUnansweredFormDTO dto);
/**
* 工作端--心理咨询-我回答的问题列表
*
* @return java.util.List<com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerOfMineResultDTO>
* @params [params]
* @author zhangyuan
* @since 2020/5/21 14:54
*/
List<PsychologyAnswerOfMineResultDTO> listMyQuestion(PsychologyAnswerFormDTO dto);
}

12
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologistService.java

@ -136,7 +136,7 @@ public interface PsychologistService extends BaseService<PsychologistEntity> {
* @author zhangyuan
* @date 2020-06-04
*/
List<PsychologyAnswerListResultDTO> listQuestion(PsychologyAnswerFormDTO dto);
List<PsychologyAnswerListResultDTO> listAllQuestion(PsychologyAnswerFormDTO dto);
/**
* 工作端--待解答的心理咨询问题列表
@ -147,4 +147,14 @@ public interface PsychologistService extends BaseService<PsychologistEntity> {
* @date 2020-06-04
*/
List<PsychologyUnansweredResultDTO> listUnansweredQuestion(PsychologyUnansweredFormDTO dto);
/**
* 工作端--心理咨询-我回答的问题列表
*
* @param dto
* @return List<PsychologyAnswerOfMineResultDTO>
* @author zhangyuan
* @date 2020-06-04
*/
List<PsychologyAnswerOfMineResultDTO> listMyQuestion(PsychologyAnswerFormDTO dto);
}

24
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologistServiceImpl.java

@ -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;
}
}

4
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologistTitleRelationServiceImpl.java

@ -20,11 +20,11 @@ package com.elink.esua.epdc.modules.psychology.service.impl;
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.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.modules.psychology.dao.PsychologistTitleRelationDao;
import com.elink.esua.epdc.dto.psychology.PsychologistTitleRelationDTO;
import com.elink.esua.epdc.modules.psychology.dao.PsychologistTitleRelationDao;
import com.elink.esua.epdc.modules.psychology.entity.PsychologistTitleRelationEntity;
import com.elink.esua.epdc.modules.psychology.redis.PsychologistTitleRelationRedis;
import com.elink.esua.epdc.modules.psychology.service.PsychologistTitleRelationService;

4
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyAnswerServiceImpl.java

@ -20,11 +20,11 @@ package com.elink.esua.epdc.modules.psychology.service.impl;
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.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.modules.psychology.dao.PsychologyAnswerDao;
import com.elink.esua.epdc.dto.psychology.PsychologyAnswerDTO;
import com.elink.esua.epdc.modules.psychology.dao.PsychologyAnswerDao;
import com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity;
import com.elink.esua.epdc.modules.psychology.redis.PsychologyAnswerRedis;
import com.elink.esua.epdc.modules.psychology.service.PsychologyAnswerService;

4
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyQuestionServiceImpl.java

@ -20,12 +20,12 @@ package com.elink.esua.epdc.modules.psychology.service.impl;
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.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.dto.psychology.PsychologyQuestionDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologyQuestionFormDTO;
import com.elink.esua.epdc.modules.psychology.dao.PsychologyQuestionDao;
import com.elink.esua.epdc.dto.psychology.PsychologyQuestionDTO;
import com.elink.esua.epdc.modules.psychology.entity.PsychologyQuestionEntity;
import com.elink.esua.epdc.modules.psychology.redis.PsychologyQuestionRedis;
import com.elink.esua.epdc.modules.psychology.service.PsychologyQuestionService;

12
epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyAnswerDao.xml

@ -34,7 +34,7 @@
CREATED_TIME DESC
</select>
<select id="listQuestion" resultType="com.elink.esua.epdc.dto.psychology.result.PsychologyAnswerInfoResultDTO">
<select id="listAllQuestion" resultType="com.elink.esua.epdc.dto.psychology.result.PsychologyAnswerInfoResultDTO">
SELECT
PSYCHOLOGIST_ID, PSYCHOLOGIST_NAME, ANSWER_CONTENT
FROM
@ -47,4 +47,14 @@
ORDER BY
CREATED_TIME DESC
</select>
<select id="listMyQuestion" resultType="com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity">
SELECT
DISTINCT(QUESTION_ID) AS QUESTION_ID
FROM
epdc_psychology_answer
WHERE
DEL_FLAG = '0'
AND PSYCHOLOGIST_ID = #{userId}
</select>
</mapper>

20
epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyQuestionDao.xml

@ -39,7 +39,7 @@
LIMIT #{pageIndex}, #{pageSize};
</select>
<select id="listQuestion" resultType="com.elink.esua.epdc.dto.psychology.result.PsychologyAnswerListResultDTO">
<select id="listAllQuestion" resultType="com.elink.esua.epdc.dto.psychology.result.PsychologyAnswerListResultDTO">
SELECT
ID, USER_ID, USER_NAME, USER_AVATAR, QUESTION_CONTENT
FROM
@ -70,4 +70,22 @@
CREATED_TIME DESC
LIMIT #{pageIndex}, #{pageSize};
</select>
<select id="listMyQuestion" resultType="com.elink.esua.epdc.dto.psychology.result.PsychologyAnswerOfMineResultDTO">
SELECT
ID, QUESTION_CONTENT, CREATED_TIME AS QUESTION_TIME
FROM
epdc_psychology_question
WHERE
DEL_FLAG = '0'
<if test="questionIds != null and questionIds.size() > 0">
AND ID IN
<foreach item="questionId" collection="questionIds" open="(" separator="," close=")">
#{questionId}
</foreach>
</if>
ORDER BY
CREATED_TIME DESC
LIMIT #{pageIndex}, #{pageSize};
</select>
</mapper>
Loading…
Cancel
Save