liuxm
2024-05-23 fd3819392c0c3fafc4f1d7d254b952207ddca3b5
产品文件相关修改
6个文件已修改
79 ■■■■ 已修改文件
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java
@@ -8,8 +8,6 @@
    int deleteByPrimaryKey(Long id);
    int insert(PltProductFile record);
    int insertSelective(PltProductFile record);
    PltProductFile selectByPrimaryKey(Long id);
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java
@@ -85,17 +85,8 @@
    @NotNull(message = "技术参数不能为空")
    public List<PltProductParams> params;
    /**
     * 文件类型:01:工艺文件,02:用户手册,03:物料清单
     */
    @NotNull(message = "工艺文件不能为空")
    public List<PltProductFile> processDocuments;
    @NotNull(message = "用户手册不能为空")
    public List<PltProductFile> userManual;
    @NotNull(message = "物料清单不能为空")
    public List<PltProductFile> materials;
    @NotNull(message = "产品文件不能为空")
    public List<PltProductFile> proFiles;
}
pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml
@@ -27,17 +27,10 @@
        delete from plt_product_file
        where  id = #{id,jdbcType=BIGINT} 
    </delete>
  <delete id="deleteByProId">
    delete from plt_product_file
    where  pro_id = #{proId,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile" useGeneratedKeys="true">
        insert into plt_product_file
        ( id,pro_id,file_id
        ,file_type)
        values (#{id,jdbcType=BIGINT},#{proId,jdbcType=BIGINT},#{fileId,jdbcType=BIGINT}
        ,#{fileType,jdbcType=VARCHAR})
    </insert>
    <delete id="deleteByProId">
      delete from plt_product_file
      where  pro_id = #{proId,jdbcType=BIGINT}
    </delete>
    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile" useGeneratedKeys="true">
        insert into plt_product_file
        <trim prefix="(" suffix=")" suffixOverrides=",">
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
@@ -18,9 +18,7 @@
  <resultMap id="BaseResultMap2" type="com.dy.pmsGlobal.pojoPlt.PltProduct" extends="BaseResultMap">
    <collection property="params" ofType="com.dy.pmsGlobal.pojoPlt.PltProductParams" fetchType="eager" select="selectParams" column="id" />
    <collection property="processDocuments" ofType="com.dy.pmsGlobal.pojoPlt.PltProductFile" fetchType="eager" select="selectDocuments" column="id"/>
    <collection property="userManual" ofType="com.dy.pmsGlobal.pojoPlt.PltProductFile" fetchType="eager" select="selectUserManual" column="id" />
    <collection property="materials" ofType="com.dy.pmsGlobal.pojoPlt.PltProductFile" fetchType="eager" select="selectMaterials" column="id"/>
    <collection property="proFiles" ofType="com.dy.pmsGlobal.pojoPlt.PltProductFile" fetchType="eager" select="selectDocuments" column="id"/>
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
@@ -37,17 +35,7 @@
  <select id="selectDocuments" resultMap="com.dy.pmsGlobal.daoPlt.PltProductFileMapper.BaseResultMap">
    select *
    from plt_product_file
    where pro_id = #{proId,jdbcType=BIGINT} and file_type = '01'
  </select>
  <select id="selectUserManual" resultMap="com.dy.pmsGlobal.daoPlt.PltProductFileMapper.BaseResultMap">
    select *
    from plt_product_file
    where pro_id = #{proId,jdbcType=BIGINT} and file_type = '02'
  </select>
  <select id="selectMaterials" resultMap="com.dy.pmsGlobal.daoPlt.PltProductFileMapper.BaseResultMap">
    select *
    from plt_product_file
    where pro_id = #{proId,jdbcType=BIGINT} and file_type = '03'
    where pro_id = #{proId,jdbcType=BIGINT}
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap2">
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java
@@ -1,7 +1,6 @@
package com.dy.pmsPlatform.product;
import com.alibaba.excel.converters.Converter;
import com.alibaba.fastjson2.JSON;
import com.dy.common.aop.SsoPowerAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
@@ -14,26 +13,13 @@
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.http.ContentDisposition;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StreamUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
 * 产品管理
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
@@ -123,16 +123,15 @@
                paramDao.insert(param);
            }
        });
        saveRel(p, p.processDocuments, "01");
        saveRel(p, p.userManual, "02");
        saveRel(p, p.materials, "03");
        saveRel(p, p.proFiles);
    }
    private void saveRel(PltProduct p, List<PltProductFile> docs, String fileType) {
    private void saveRel(PltProduct p, List<PltProductFile> docs) {
        docs.forEach(doc -> {
            doc.proId = p.id;
            doc.fileType = fileType;
            pfDao.insert(doc);
            if(doc.id == null){
                doc.proId = p.id;
                pfDao.insertSelective(doc);
            }
        });
    }
@@ -162,11 +161,7 @@
                pro.imageWebPathZip = fileOperate.getImgFileZipPath(filePathWithWebUrl);
            }
            Stream.concat(
                     pro.userManual.stream(),
                     Stream.concat(pro.processDocuments.stream(), pro.materials.stream())
             )
             .forEach(doc -> {
            pro.proFiles.stream().forEach(doc -> {
                 OthFile file = othFileMapper.selectByPrimaryKey(doc.fileId);
                 FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);