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/DefectiveProductsService.java |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/whyc/service/DefectiveProductsService.java b/src/main/java/com/whyc/service/DefectiveProductsService.java
index 7a53227..469e625 100644
--- a/src/main/java/com/whyc/service/DefectiveProductsService.java
+++ b/src/main/java/com/whyc/service/DefectiveProductsService.java
@@ -1,6 +1,5 @@
 package com.whyc.service;
 
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.github.pagehelper.PageHelper;
@@ -58,6 +57,7 @@
         defective.setSenderName(senderName);
         Date date=new Date();
         defective.setRecordTime(date);
+        defective.setRestProduct(defective.getBadProduct());
         if(defective.getStartTime()==null){
             //淇濆瓨
             defective.setStartTime(date);
@@ -83,7 +83,7 @@
                 multipartFile.transferTo(file);
             }
             //ZipUtils.toZip(fileList,new FileOutputStream(new File(rootFile+feedbackZipPath)));
-            defective.setFileUrl( File.separator + defectiveDirSuffix);
+            defective.setFileUrl(defectiveDirSuffix);
         }
 
 
@@ -115,7 +115,8 @@
         }
 
         String subject = "銆愪笉鑹搧璁板綍銆�-"+senderName;
-        String content = defective.getContent();
+        String content = senderName+"涓婁紶浜嗕笉鑹搧璁板綍,淇℃伅濡備笅:\n鍘傚晢:"+defective.getProvideName()+"\n浜у搧:"+defective.getProductName()+"\n鍨嬪彿:"+defective.getType()
+                +"\n涓嶈壇鍝佹暟閲�:"+defective.getBadProduct()+"\n鍏蜂綋涓嶈壇淇℃伅:"+defective.getContent();
 
         MailDTO mailDTO = new MailDTO();
         mailDTO.setTitle(subject);
@@ -135,16 +136,19 @@
         String rootFile = CommonUtil.getRootFile();//涓昏矾寰�
         for (DefectiveProducts defective:list) {
             String filePath=defective.getFileUrl();
-            defective.setFileUrl("doc_file"+File.separator+filePath);
+            String startTimeEx=ActionUtil.sdfwithday.format(defective.getStartTime());
+            defective.setStartTimeEx(startTimeEx);
             if(filePath!=null&&!filePath.isEmpty()){
+                defective.setFileUrl("doc_file"+File.separator+filePath);
                 defective.setNameList(FileUtil.getFileNameWithOutDirectory(rootFile+filePath));
+
             }
             List<DefectiveProductsHistory> hisList=defective.getHisList();
             if(hisList!=null&&hisList.size()>0){
                 for (DefectiveProductsHistory his:defective.getHisList()) {
                     String hisDelPath=his.getDelUrl();
-                    his.setDelUrl("doc_file"+File.separator+hisDelPath);
                     if(hisDelPath!=null&&!hisDelPath.isEmpty()){
+                        his.setDelUrl("doc_file"+File.separator+hisDelPath);
                         his.setHisNameList(FileUtil.getFileNameWithOutDirectory(rootFile+hisDelPath));
                     }
                 }
@@ -179,8 +183,10 @@
         UpdateWrapper wrapper=new UpdateWrapper();
         wrapper.set("receiver_ids",defectiveHis.getReceiverIds());
         wrapper.set("receiver_names",defectiveHis.getReceiverNames());
-        wrapper.set("bad_product",defectiveHis.getBadProduct());
-        if(defectiveHis.getBadProduct()==0){
+        int resProduct=defective.getRestProduct()-defectiveHis.getDelProduct();
+        defectiveHis.setRestProduct(resProduct);
+        wrapper.set("rest_product",resProduct);
+        if(resProduct==0){
             defectiveHis.setConfirmStatus(2);//涓嶈壇鍝佹暟閲忎负0缁撴潫
         }else {
             defectiveHis.setConfirmStatus(1);
@@ -189,8 +195,8 @@
         wrapper.set("note",defectiveHis.getNote());
         wrapper.eq("id",defectiveHis.getDeftId());
         mapper.update(null,wrapper);
-
         //璁板綍澶勭悊璁板綍
+
         defectiveHisService.updateDefective(defective,defectiveHis,multipartFileList);
 
         //鍙戦�侀偖浠�
@@ -211,7 +217,9 @@
         }
 
         String subject = "銆愪笉鑹搧澶勭悊璁板綍銆�-"+senderName;
-        String content = defective.getContent();
+        String content = defectiveHis.getDelName()+"淇浜嗕笉鑹搧,璁板綍淇℃伅濡備笅:\n鍘傚晢:"+defective.getProvideName()+"\n浜у搧:"+defective.getProductName()+"\n鍨嬪彿:"+defective.getType()+
+                "\n涓嶈壇鍝佹暟閲�:"+defective.getBadProduct()+"\n淇涓嶈壇鍝佷釜鏁�:"+defectiveHis.getDelProduct()+"\n鍓╀綑涓嶈壇鍝佷釜鏁�:"+defectiveHis.getRestProduct()+"\n"
+                +"淇鏂瑰紡:"+defectiveHis.getNote();
 
         MailDTO mailDTO = new MailDTO();
         mailDTO.setTitle(subject);
@@ -230,7 +238,7 @@
         wrapper.set("confirm_status",3);//褰掓。
         wrapper.set("receiver_ids","");
         wrapper.set("receiver_names","");
-        wrapper.set("bad_product",0);
+        wrapper.set("rest_product",0);
         wrapper.set("note","");
         wrapper.eq("id",deftId);
         mapper.update(null,wrapper);
@@ -239,8 +247,9 @@
         defectiveHis.setDeftId(deftId);
         defectiveHis.setDelId(ActionUtil.getUser().getId().intValue());
         defectiveHis.setConfirmStatus(3);
-        defectiveHis.setBadProduct(0);
-        defectiveHis.setDelId(ActionUtil.getUser().getId().intValue());
+        defectiveHis.setDelProduct(0);
+        defectiveHis.setDelName(ActionUtil.getUser().getName());
+        defectiveHis.setRestProduct(0);
         defectiveHisService.stopDefective(defectiveHis);
         return new Response().set(1,true);
     }

--
Gitblit v1.9.1