From e7f03acfa5ee4ad4fd6d1ee9e9ae9a5655488f6d Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期二, 09 十一月 2021 17:04:46 +0800
Subject: [PATCH] 1109修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java |   41 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 40 insertions(+), 1 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 dda34f8..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
@@ -37,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;
@@ -114,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>()
@@ -313,6 +317,7 @@
                     subSelectionDO.setCreateAt(nowDate);
                     subSelectionDO.setType(subSelect.getType());
                     subSelectionDO.setKey(subSelect.getKey());
+                    subSelectionDO.setUrl(subSelect.getUrl());
                     subSelectionList.add(subSelectionDO);
                 }
             }
@@ -631,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