lxw
2023-09-19 59fb1df6902d467edc9cb397efdf214eac604253
下载日志修改
8个文件已修改
65 ■■■■■ 已修改文件
src/main/java/com/whyc/constant/UserOperation.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ProcedureDocController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BOMFeedbakService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProcedureDocService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductBomHistoryService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductBomService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductSoftwareService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SoftwareService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/constant/UserOperation.java
@@ -15,6 +15,7 @@
    TYPE_STOP(9,"终止"),
    TYPE_GET(10,"读取"),
    TYPE_DOWNLOAD(11,"下载"),
    TYPE_DOWNLOAD_New(12,"新版下载"),
    TYPE_UNRECOGNIZED(-1,"无法识别的操作类型"),
    
src/main/java/com/whyc/controller/ProcedureDocController.java
@@ -8,6 +8,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Api(tags = "流程卡和SOP")
@@ -26,8 +27,8 @@
    @GetMapping("download")
    @ApiOperation("文件下载")
    public void download(@RequestParam String filePath, HttpServletResponse response){
        service.download(filePath, response);
    public void download(@RequestParam String filePath, HttpServletRequest req, HttpServletResponse response){
        service.download(filePath,req, response);
    }
    @PostMapping("listPage")
src/main/java/com/whyc/service/BOMFeedbakService.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.UserOperation;
import com.whyc.dto.FileDirPath;
import com.whyc.dto.Response;
import com.whyc.dto.ZipUtils;
@@ -36,6 +37,9 @@
    private MailUtil mailUtil;
    @Resource
    private DocUserMapper userMapper;
    @Autowired
    private DocLogService logService;
    //统计
    public Map<String, Integer> getFkStatistic(DocUser user,Map<String, Integer> map) {
        int sendFk=0;
@@ -271,6 +275,8 @@
        } catch (IOException e) {
            e.printStackTrace();
        }
        //记录新版下载日志
        logService.recordOperationLog(ActionUtil.getUser().getId(),ActionUtil.getUser().getName(), UserOperation.TYPE_DOWNLOAD_New.getType(),new Date(),req.getRemoteAddr(),fileName,fileDirName+File.separator+filePath);
    }
    public Response updateEcrNumber(int id, String ecrNumber) {
src/main/java/com/whyc/service/ProcedureDocService.java
@@ -2,17 +2,22 @@
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.UserOperation;
import com.whyc.dto.Response;
import com.whyc.mapper.ProcedureDocMapper;
import com.whyc.pojo.ProcedureDoc;
import com.whyc.util.ActionUtil;
import com.whyc.util.CommonUtil;
import com.whyc.util.FileUtil;
import com.whyc.util.Word2PdfAsposeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.Date;
import java.util.List;
@Service
@@ -20,6 +25,9 @@
    @Resource
    private ProcedureDocMapper mapper;
    @Autowired
    private DocLogService logService;
    public void insert(ProcedureDoc procedureDoc) {
        mapper.insert(procedureDoc);
@@ -39,11 +47,13 @@
        return new Response().setII(1,suffixOutFilePath);
    }
    public void download(String filePath, HttpServletResponse response) {
    public void download(String filePath, HttpServletRequest req, HttpServletResponse response) {
        String projectDir = CommonUtil.getProjectDir();
        String absolutePath = projectDir + File.separator + filePath;
        String filename = filePath.substring(filePath.lastIndexOf(File.separator)+1);
        FileUtil.download(response,absolutePath,filename);
        //记录日志
        logService.recordOperationLog(ActionUtil.getUser().getId(),ActionUtil.getUser().getName(), UserOperation.TYPE_DOWNLOAD_New.getType(),new Date(),req.getRemoteAddr(),filename,absolutePath);
    }
    public Response getListPage(ProcedureDoc procedureDoc, int pageNum, int pageSize) {
src/main/java/com/whyc/service/ProductBomHistoryService.java
@@ -25,6 +25,7 @@
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
@@ -247,12 +248,6 @@
        }
        //生成excel并将dwg文件放在同一报下压缩
        creatBomHsitoryExcel(req,resp,pHistory,endList,withOutDwg);
        //记录日志
        DocUser docUser= ActionUtil.getUser();
        String operationDetail="具体产品为:"+pHistory.toString();
        String opreationMsg="执行了"+pHistory.getVersion()+"版本产品的下载操作";
        String terminalIp=req.getRemoteAddr();
        logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail);
    }
    //根据产品信息创建excel表格并存放在指定目录
    public void creatBomHsitoryExcel(HttpServletRequest req, HttpServletResponse resp,ProductHistory pHistory,List<ProductBomHistory> list,String withOutDwg){
@@ -445,9 +440,10 @@
            FileOutputStream forootFace = new FileOutputStream(file);
            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;
@@ -465,6 +461,8 @@
        } catch (IOException e) {
            e.printStackTrace();
        }
        //记录日志
        logService.recordOperationLog(ActionUtil.getUser().getId(),ActionUtil.getUser().getName(), UserOperation.TYPE_DOWNLOAD_New.getType(),new Date(),req.getRemoteAddr(),excelName+".zip",rootFace+".zip");
    }
    //将物料存放为一个bomHistory为下载做准备
src/main/java/com/whyc/service/ProductBomService.java
@@ -27,6 +27,7 @@
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;
@@ -286,12 +287,6 @@
        }
        //生成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);
    }
@@ -486,9 +481,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 +502,8 @@
        } catch (IOException e) {
            e.printStackTrace();
        }
        //记录日志
        logService.recordOperationLog(ActionUtil.getUser().getId(),ActionUtil.getUser().getName(), UserOperation.TYPE_DOWNLOAD_New.getType(),new Date(),req.getRemoteAddr(),excelName,rootFace+".zip");
    }
    //查询所有产品中没有与指定散装件关联的子件
    public Response getAllSubWithOutMaterial(int materialId) {
src/main/java/com/whyc/service/ProductSoftwareService.java
@@ -74,11 +74,7 @@
            e.printStackTrace();
        }
        //记录日志
        DocUser docUser= ActionUtil.getUser();
        String operationDetail="具体软件名称为:"+softwareName;
        String opreationMsg="执行了软件下载操作";
        String terminalIp=req.getRemoteAddr();
        logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail);
        logService.recordOperationLog(ActionUtil.getUser().getId(),ActionUtil.getUser().getName(), UserOperation.TYPE_DOWNLOAD_New.getType(),new Date(),req.getRemoteAddr(),software.getSoftwareUrl(),fileDirName+File.separator+software.getSoftwareUrl());
    }
    public void insert(ProductSoftware productSoftware) {
src/main/java/com/whyc/service/SoftwareService.java
@@ -180,11 +180,8 @@
            e.printStackTrace();
        }
        //记录日志
        DocUser docUser= ActionUtil.getUser();
        String operationDetail="具体软件名称为:"+software.getFileName();
        String opreationMsg="执行了软件下载操作";
        String terminalIp=req.getRemoteAddr();
        logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail);
        logService.recordOperationLog(ActionUtil.getUser().getId(),ActionUtil.getUser().getName(), UserOperation.TYPE_DOWNLOAD_New.getType(),new Date(),req.getRemoteAddr(),filename,fileDirName+File.separator+software.getFileUrl());
    }
    @Transactional