il y a 5 ans
Parent
commit
0679ab7ca3

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

@@ -131,7 +131,7 @@ public class MouldFileController {
 
     /**
      * 文档批量下载列表
-     * 参数: token 用户身份凭证,id 项目id
+     * 参数: token 用户身份凭证,projectId 项目id
      *
      * @return
      */
@@ -143,5 +143,18 @@ public class MouldFileController {
         msg = mouldFileService.getListByUserAndProjectId(userVO, page);
         return msg;
     }
+    /**
+     * 文档勾选批量下载
+     * 参数: mouldId 模具id
+     *
+     * @return
+     */
+    @ApiOperation("文档勾选批量下载")
+    @RequestMapping("/downloadfileList")
+    @ResponseBody
+    public HttpRespMsg downloadfileList(UserVO userVO){
+        HttpRespMsg msg = new HttpRespMsg();
+        return msg;
+    }
 }
 

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

@@ -0,0 +1,21 @@
+package com.hssx.cloudmodel.entity.vo;
+
+import com.hssx.cloudmodel.entity.Mould;
+import com.hssx.cloudmodel.entity.MouldFile;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 08 - 12 9:42
+ * Description:<描述>
+ * Version: 1.0
+ */
+@Data
+public class MouldFileVO extends Mould {
+    private List<MouldFile> mould2DFiles;
+    private List<MouldFile> mould3DFiles;
+    private List<MouldFile> sparepart2DFiles;
+    private List<MouldFile> sparepart3DFiles;
+}

+ 6 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/MouldFileMapper.java

@@ -2,6 +2,11 @@ package com.hssx.cloudmodel.mapper;
 
 import com.hssx.cloudmodel.entity.MouldFile;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.hssx.cloudmodel.entity.vo.MouldFileVO;
+import com.hssx.cloudmodel.entity.vo.UserVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +18,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface MouldFileMapper extends BaseMapper<MouldFile> {
 
+    List<MouldFileVO> getFileListByProjectId(@Param("userVO") UserVO userVO);
 }

+ 19 - 7
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java

@@ -1,8 +1,11 @@
 package com.hssx.cloudmodel.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.hssx.cloudmodel.constant.Constant;
 import com.hssx.cloudmodel.entity.*;
+import com.hssx.cloudmodel.entity.vo.MouldFileVO;
 import com.hssx.cloudmodel.entity.vo.UserVO;
 import com.hssx.cloudmodel.mapper.*;
 import com.hssx.cloudmodel.service.MouldFileService;
@@ -40,6 +43,8 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
     MouldFileMapper mouldFileMapper;
     @Resource
     MouldOperationDynamicsMapper mouldOperationDynamicsMapper;
+    @Resource
+    ProjectMapper projectMapper;
 
     @Override
     public HttpRespMsg addFile(UserVO userVO, Integer blongType, MultipartFile file, MultipartFile file2, String path) {
@@ -68,7 +73,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                     String sufix = fileName.substring(pos);
                     fileName = rand + sufix;
                     projectFile.setFileType(sufix);//文件后缀
-                    projectFile.setFileUrl("/upload/"+fileName);
+                    projectFile.setFileUrl("/upload/" + fileName);
                     projectFile.setBlongType(blongType);
                     if (user.getSubordinateType() == 0) {
                         //上传人为资产方,自动审核通过
@@ -101,7 +106,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                         sufix = fileName2.substring(pos);
                         fileName2 = rand + sufix;
                         projectFile.setFileType2(sufix);//文件后缀
-                        projectFile.setFileUrl2("/upload/"+fileName2);
+                        projectFile.setFileUrl2("/upload/" + fileName2);
 
                         File saveFile2 = new File(dir, fileName2);
 
@@ -117,7 +122,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                         }
                     }
                     //上传零件文档和上传模具文档的时候需要区分是否为2D或者3D
-                    if(userVO.getDwgType() != null){
+                    if (userVO.getDwgType() != null) {
                         projectFile.setDwgType(userVO.getDwgType());
                     }
                     mouldFileMapper.insert(projectFile);
@@ -187,7 +192,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
         HttpRespMsg msg = new HttpRespMsg();
         User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", token));
         //添加上传记录
-         MouldFile file = mouldFileMapper.selectById(projectFile.getId());
+        MouldFile file = mouldFileMapper.selectById(projectFile.getId());
         MouldOperationDynamics dynamics = new MouldOperationDynamics();
         dynamics.setContent(Constant.DOWNLOAD);
         dynamics.setFileName(file.getFileName());
@@ -235,8 +240,15 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
     @Override
     public HttpRespMsg getListByUserAndProjectId(UserVO userVO, PageUtil page) {
         HttpRespMsg msg = new HttpRespMsg();
-        User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
-
-        return null;
+        User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
+        if (currentUser != null) {
+            PageHelper.startPage(page.getPageNum(), page.getPageSize());
+            List<MouldFileVO> list = mouldFileMapper.getFileListByProjectId(userVO);
+            PageInfo<MouldFileVO> pageInfos = new PageInfo<>(list);
+            msg.data = pageInfos;
+        } else {
+            msg.setError("用户不存在或者未登录");
+        }
+        return msg;
     }
 }

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

@@ -24,10 +24,92 @@
         <result column="file_size_2" property="fileSize2" />
         <result column="dwg_type" property="dwgType" />
     </resultMap>
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.MouldFileVO">
+        <id column="id" property="id" />
+        <result column="model_no" property="modelNo"/>
+        <result column="model_name" property="modelName"/>
+        <collection property="mould2DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
+                    select="queryMould2DFilesByMouldId" column="id">
+        </collection>
+        <collection property="mould3DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
+                    select="queryMould3DFilesByMouldId" column="id">
+        </collection>
+        <collection property="sparepart2DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
+                    select="querySparepart2DFilesByMouldId" column="id">
+        </collection>
+        <collection property="sparepart3DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
+                    select="querySparepart3DFilesByMouldId" column="id">
+        </collection>
+    </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id, uplodtor_id, uploadtor, indate, model_id, sparepart_id, project_id, file_url, file_name, blong_type, content, state, file_type, file_size, file_url_2, file_name_2, file_type_2, file_size_2, dwg_type
     </sql>
 
+    <select id="getFileListByProjectId" resultMap="BaseResultMapVO">
+        select
+            id,model_no,model_name
+        from
+            tb_mould
+        where
+            project_id = #{userVO.projectId}
+    </select>
+    <select id="querySparepart3DFilesByMouldId" 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, dwg_type
+        from
+            tb_mould_file
+        where
+            model_id = #{id}
+        and
+            blong_type = 1
+        and
+            dwg_type = 1
+    </select>
+    <select id="querySparepart2DFilesByMouldId" 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, dwg_type
+        from
+            tb_mould_file
+        where
+            model_id = #{id}
+        and
+            blong_type = 1
+        and
+            dwg_type = 0
+    </select>
+    <select id="queryMould3DFilesByMouldId" 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, dwg_type
+        from
+            tb_mould_file
+        where
+            model_id = #{id}
+        and
+            blong_type = 0
+        and
+            dwg_type = 1
+    </select>
+    <select id="queryMould2DFilesByMouldId" 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, dwg_type
+        from
+            tb_mould_file
+        where
+            model_id = #{id}
+        and
+            blong_type = 0
+        and
+            dwg_type = 0
+    </select>
 </mapper>