Browse Source

模具文档

5 years ago
parent
commit
8ac96c7f26

+ 0 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/CloudModelApplication.java

@@ -4,7 +4,6 @@ import com.github.pagehelper.PageHelper;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
 import org.springframework.context.annotation.Bean;
 
 import java.util.Properties;

+ 1 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldFileController.java

@@ -154,6 +154,7 @@ public class MouldFileController {
     @ResponseBody
     public HttpRespMsg downloadfileList(UserVO userVO){
         HttpRespMsg msg = new HttpRespMsg();
+        msg = mouldFileService.dowloadFileList(userVO);
         return msg;
     }
 }

+ 1 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/vo/MouldFileVO.java

@@ -18,4 +18,5 @@ public class MouldFileVO extends Mould {
     private List<MouldFile> mould3DFiles;
     private List<MouldFile> sparepart2DFiles;
     private List<MouldFile> sparepart3DFiles;
+    private List<MouldFile> maintainFiles;
 }

+ 2 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/MouldFileService.java

@@ -24,4 +24,6 @@ public interface MouldFileService extends IService<MouldFile> {
     HttpRespMsg getFileList(int mouldId, Integer blongType, UserVO userVO);
     HttpRespMsg delFile(MouldFile mouldFile);
     HttpRespMsg getListByUserAndProjectId(UserVO userVO, PageUtil page);
+
+    HttpRespMsg dowloadFileList(UserVO userVO);
 }

+ 46 - 4
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java

@@ -19,11 +19,10 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
+import java.util.zip.ZipOutputStream;
 
 /**
  * <p>
@@ -251,4 +250,47 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
         }
         return msg;
     }
+
+    @Override
+    public HttpRespMsg dowloadFileList(UserVO userVO) {
+        byte[] buffer = new byte[1024];
+        Date date=new Date();
+////生成zip文件存放位置
+//        String strZipPath = Constant.exportAddress +loginname+date.getTime()+".zip";
+//        File file=new File(Constant.exportAddress);
+//        if(!file.isDirectory() && !file.exists()){
+////创建单层目录
+//// f.mkdir();
+//// 创建多层目录
+//            file.mkdirs();
+//        }
+//        try {
+//            ZipOutputStream out = new ZipOutputStream(new FileOutputStream(strZipPath));
+//// 需要同时下载的多个文件
+//            for (int i = 0; i < filepath.length; i++) {
+//                File f=new File(filepath[i]);
+//                FileInputStream fis = new FileInputStream(f);
+//                System.out.println(documentname[i]);
+//                out.putNextEntry(new ZipEntry(documentname[i]));
+////设置压缩文件内的字符编码,不然会变成乱码
+//                out.setEncoding("GBK");
+//                int len;
+//// 读入需要下载的文件的内容,打包到zip文件
+//                while ((len = fis.read(buffer)) > 0) {
+//                    out.write(buffer, 0, len);
+//                }
+//                out.closeEntry();
+//                fis.close();
+//            }
+//            out.close();
+//            PublicMethod.downLoadFile(request, response, strZipPath, filename+".zip");
+//            File temp=new File(strZipPath);
+//            if(temp.exists()){
+//                temp.delete();
+//            }
+//        } catch (Exception e) {
+//            System.out.println("文件下载错误");
+//        }
+        return null;
+    }
 }

+ 15 - 0
cloud-model/src/main/resources/mapper/MouldFileMapper.xml

@@ -41,6 +41,9 @@
         <collection property="sparepart3DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
                     select="querySparepart3DFilesByMouldId" column="id">
         </collection>
+        <collection property="maintainFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
+                    select="queryMaintainFilesByMouldId" column="id">
+        </collection>
     </resultMap>
 
     <!-- 通用查询结果列 -->
@@ -112,4 +115,16 @@
         and
             dwg_type = 0
     </select>
+    <select id="queryMaintainFilesByMouldId" resultMap="BaseResultMap">
+        select
+            id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
+            project_id, file_url, file_name, blong_type, content, state,
+            file_type, file_size
+        from
+            tb_mould_file
+        where
+            model_id = #{id}
+        and
+            blong_type = 3
+    </select>
 </mapper>