From cf9a5039e6db9d1d5963e3fe1a37d00169ec2ef7 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期三, 25 六月 2025 11:18:22 +0800
Subject: [PATCH] 验收报告修改

---
 src/main/java/com/whyc/service/ProductBomService.java |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/whyc/service/ProductBomService.java b/src/main/java/com/whyc/service/ProductBomService.java
index 5fee0ef..d688662 100644
--- a/src/main/java/com/whyc/service/ProductBomService.java
+++ b/src/main/java/com/whyc/service/ProductBomService.java
@@ -21,12 +21,14 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.awt.image.BufferedImage;
 import java.io.*;
+import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.LinkedList;
@@ -243,7 +245,8 @@
         return new Response().setII(1,list!=null,pageInfo,"杩斿洖鏁版嵁");
     }*/
     //浜у搧涓嬭浇(浜у搧id鍜岀増鏈�)
-    public  void downloadProduct(HttpServletRequest req, HttpServletResponse resp, int productId , int version) {
+    public  void downloadProduct(HttpServletRequest req, HttpServletResponse resp, int productId , int version
+       , @RequestParam String oprateReason, @RequestParam String oprateInfo) {
         HSSFWorkbook wb = new HSSFWorkbook();
         //璇诲彇浜у搧淇℃伅
         QueryWrapper wrapper=new QueryWrapper();
@@ -285,18 +288,13 @@
             withOutDwg+=File.separator+"standard"+File.separator+version;
         }
         //鐢熸垚excel骞跺皢dwg鏂囦欢鏀惧湪鍚屼竴鎶ヤ笅鍘嬬缉
-        creatBomExcel(req,resp,product,endList,wb,withOutDwg);
-        //璁板綍鏃ュ織
-        DocUser docUser= ActionUtil.getUser();
-        String operationDetail="鍏蜂綋浜у搧淇℃伅涓�:"+product.toString();
-        String opreationMsg="鎵ц浜嗘渶鏂扮増浜у搧涓嬭浇鎿嶄綔";
-        String terminalIp=req.getRemoteAddr();
-        logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail);
+        creatBomExcel(req,resp,product,endList,wb,withOutDwg,ActionUtil.sdfwithALL.format(product.getVersionTime()),oprateReason,oprateInfo);
     }
 
 
     //鏍规嵁浜у搧淇℃伅鍒涘缓excel琛ㄦ牸骞跺瓨鏀惧湪鎸囧畾鐩綍
-    private void creatBomExcel(HttpServletRequest req, HttpServletResponse resp,Product product,List list, HSSFWorkbook wb,String withOutDwg){
+    private void creatBomExcel(HttpServletRequest req, HttpServletResponse resp,Product product,List list, HSSFWorkbook wb,String withOutDwg
+            , String oprateVersion, @RequestParam String oprateReason, @RequestParam String oprateInfo){
         String fileDirName = FileDirPath.getFileDirName();
         String rootFace="";
         String excelName="";
@@ -486,9 +484,10 @@
             ZipUtils.toZip(rootFace, forootFace,true);
 
             // 杞爜闃叉涔辩爜
-            resp.addHeader("Content-Disposition", "attachment;filename="
+            /*resp.addHeader("Content-Disposition", "attachment;filename="
                     + new String(excelName.getBytes("UTF-8"), "ISO8859-1")
-                    + ".zip");
+                    + ".zip");*/
+            resp.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode (excelName+".zip", "utf-8"));
             OutputStream out = resp.getOutputStream();
             FileInputStream in = new FileInputStream(rootFace+".zip");
             int len=0;
@@ -506,6 +505,9 @@
         } catch (IOException e) {
             e.printStackTrace();
         }
+        //璁板綍鏃ュ織
+        logService.recordOperationLogDownLoad(ActionUtil.getUser().getId(),ActionUtil.getUser().getName(), UserOperation.TYPE_DOWNLOAD_PRODUCT.getType(),new Date(),req.getRemoteAddr()
+                ,excelName+".zip",rootFace+".zip",oprateReason,oprateInfo,oprateVersion);
     }
     //鏌ヨ鎵�鏈変骇鍝佷腑娌℃湁涓庢寚瀹氭暎瑁呬欢鍏宠仈鐨勫瓙浠�
     public Response getAllSubWithOutMaterial(int materialId) {
@@ -602,4 +604,8 @@
         return mapper.getEnabledBomListByParentCodeAndCustomCode(parentCode,customCode);
     }
 
+    public void updateMaterialField2Bom() {
+        List<ProductBom> bomList = mapper.selectListWithMaterialField();
+        mapper.updateMaterialField2BomBatch(bomList);
+    }
 }

--
Gitblit v1.9.1