| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.model.dtos.community.QuestnaireAnswersDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActQuestnaireAnswerContentVO; |
| | | import com.panzhihua.common.model.vos.community.ComActQuestnaireSubVO; |
| | | import com.panzhihua.service_community.dao.ComActReserveAnswerContentMapper; |
| | | import com.panzhihua.service_community.dao.ComActReserveSubMapper; |
| | | import com.panzhihua.service_community.model.dos.ComActQuestnaireAnswerContentDO; |
| | | import com.panzhihua.service_community.model.dos.ComActQuestnaireSubDO; |
| | | import com.panzhihua.service_community.model.dos.ComActReserveAnswerContentDO; |
| | | import com.panzhihua.service_community.model.dos.ComActReserveSubDO; |
| | | import com.panzhihua.service_community.service.ComActReserveAnswerContentService; |
| | | import com.panzhihua.service_community.service.ComActReserveSubService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @auther lyq |
| | |
| | | @Service |
| | | public class ComActReserveAnswerContentServiceImpl extends ServiceImpl<ComActReserveAnswerContentMapper, ComActReserveAnswerContentDO> implements ComActReserveAnswerContentService { |
| | | |
| | | @Resource |
| | | private ComActReserveSubMapper comActReserveSubMapper; |
| | | |
| | | @Override |
| | | public R exportRegisterAdmin(Long reserveId){ |
| | | QuestnaireAnswersDTO result = new QuestnaireAnswersDTO(); |
| | | |
| | | //查询题目 |
| | | List<ComActReserveSubDO> list = comActReserveSubMapper.selectList(new QueryWrapper<ComActReserveSubDO>().lambda().eq(ComActReserveSubDO::getReserveId, reserveId)); |
| | | List<ComActQuestnaireSubVO> listSubVo = new ArrayList<>(); |
| | | list.forEach(subDo -> { |
| | | ComActQuestnaireSubVO comActQuestnaireSubVO = new ComActQuestnaireSubVO(); |
| | | BeanUtils.copyProperties(subDo, comActQuestnaireSubVO); |
| | | listSubVo.add(comActQuestnaireSubVO); |
| | | }); |
| | | result.setSubs(listSubVo); |
| | | |
| | | //查询用户回答 |
| | | List<ComActReserveAnswerContentDO> questnaireAnswerContentDOList = this.baseMapper.selectListByReserve(reserveId); |
| | | List<ComActQuestnaireAnswerContentVO> vos = new ArrayList<>(); |
| | | questnaireAnswerContentDOList.forEach(dos -> { |
| | | ComActQuestnaireAnswerContentVO vo = new ComActQuestnaireAnswerContentVO(); |
| | | BeanUtils.copyProperties(dos, vo); |
| | | vos.add(vo); |
| | | }); |
| | | result.setAnswers(vos); |
| | | return R.ok(result); |
| | | } |
| | | } |