From c1e48a47b39dbd6919bfd9cf2e7023e9f3d6fee8 Mon Sep 17 00:00:00 2001 From: 101captain <237651143@qq.com> Date: 星期五, 05 十一月 2021 10:24:21 +0800 Subject: [PATCH] 1105测试代码修改 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 49 insertions(+), 2 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java index 51c8afb..05682b6 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java @@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.Lists; +import com.panzhihua.common.model.dtos.community.OperationDetailDTO; import com.panzhihua.common.model.dtos.community.reserve.*; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComActReserveIndexVo; @@ -36,6 +37,10 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; @@ -113,7 +118,7 @@ Long queSubId = questnaireSubDO.getId(); //根据上传的类型查询不同的题目选项 - if(questnaiteSub.getType().equals(QuestnaiteSubVO.type.danxuan)){ + if(questnaiteSub.getType().equals(QuestnaiteSubVO.type.danxuan) || questnaiteSub.getType().equals(QuestnaiteSubVO.type.imgselect)){ //单选题处理 ComActReserveSubSelectionDO subSelectionDO = comActReserveSubSelectionMapper.selectOne(new QueryWrapper<ComActReserveSubSelectionDO>() @@ -312,6 +317,7 @@ subSelectionDO.setCreateAt(nowDate); subSelectionDO.setType(subSelect.getType()); subSelectionDO.setKey(subSelect.getKey()); + subSelectionDO.setUrl(subSelect.getUrl()); subSelectionList.add(subSelectionDO); } } @@ -611,7 +617,14 @@ @Override public R pageReserveList(PageUserReserveDTO pageUserReserveDTO) { - return R.ok(comActReserveRecordMapper.pageReserveList(new Page<ComActReserveDO>(pageUserReserveDTO.getPageNum(), pageUserReserveDTO.getPageSize()),pageUserReserveDTO)); + IPage<ComActReserveAppletsVO> ipage = comActReserveRecordMapper.pageReserveList(new Page<>(pageUserReserveDTO.getPageNum(), pageUserReserveDTO.getPageSize()),pageUserReserveDTO); + OperationDetailDTO operationDetailDTO = new OperationDetailDTO(); + ipage.getRecords().forEach(page -> { + operationDetailDTO.setReserveRecordId(page.getId()); + List<ComOperationListVO> operationList = comActReserveRecordMapper.queryAll(operationDetailDTO); + page.setOperationList(operationList); + }); + return R.ok(ipage); } /** @@ -623,4 +636,38 @@ public R reserveListApplets(Long communityId){ return R.ok(this.baseMapper.getReserveIndexList(communityId)); } + + + public static void getFileByBytes(byte[] bytes, String filePath, String fileName) { + BufferedOutputStream bos = null; + FileOutputStream fos = null; + File file = null; + try { + File dir = new File(filePath); + if (!dir.exists()) {// 判断文件目录是否存在 + dir.mkdirs(); + } + file = new File(filePath + fileName); + fos = new FileOutputStream(file); + bos = new BufferedOutputStream(fos); + bos.write(bytes); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (bos != null) { + try { + bos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (fos != null) { + try { + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } } -- Gitblit v1.7.1