| | |
| | | TYPE_STOP(9,"终止"), |
| | | TYPE_GET(10,"读取"), |
| | | TYPE_DOWNLOAD(11,"下载"), |
| | | TYPE_DOWNLOAD_New(12,"新版下载"), |
| | | |
| | | TYPE_UNRECOGNIZED(-1,"无法识别的操作类型"), |
| | | |
| | |
| | | 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") |
| | |
| | | |
| | | @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") |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | } 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) { |
| | |
| | | |
| | | 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 |
| | |
| | | |
| | | @Resource |
| | | private ProcedureDocMapper mapper; |
| | | |
| | | @Autowired |
| | | private DocLogService logService; |
| | | |
| | | public void insert(ProcedureDoc procedureDoc) { |
| | | mapper.insert(procedureDoc); |
| | |
| | | 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) { |
| | |
| | | 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; |
| | | |
| | |
| | | } |
| | | //生成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){ |
| | |
| | | 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; |
| | |
| | | } 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为下载做准备 |
| | |
| | | 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; |
| | |
| | | } |
| | | //生成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); |
| | | } |
| | | |
| | | |
| | |
| | | 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; |
| | |
| | | } 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) { |
| | |
| | | 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) { |
| | |
| | | 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 |