src/main/java/com/whyc/aop/OperationLogAspect.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/controller/ProductBomController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/ProductBomService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/aop/OperationLogAspect.java
@@ -40,7 +40,6 @@ "|| execution(public * com.whyc..controller.*.get*(..))" + "|| execution(public * com.whyc..controller.*.search*(..))"+ "|| execution(public * com.whyc..controller.*.change*(..))"+ "|| execution(public * com.whyc..controller.*.download*(..))"+ "|| execution(public * com.whyc..controller.*.login*(..))" ) private void operationLogPointcut(){}; @@ -83,11 +82,7 @@ }else if (methodName.contains("login")){ operationTypeName = UserOperation.TYPE_LOGIN.getTypeName(); operationType = UserOperation.TYPE_LOGIN.getType(); }else if (methodName.contains("download")){ operationTypeName = UserOperation.TYPE_DOWNLOAD.getTypeName(); operationType = UserOperation.TYPE_DOWNLOAD.getType(); } //获取类型 String[] fullClassNameSplit = fullClassName.split("\\."); String className = fullClassNameSplit[fullClassNameSplit.length-1].replace("Controller","模块"); src/main/java/com/whyc/controller/ProductBomController.java
@@ -1,8 +1,12 @@ package com.whyc.controller; import com.whyc.constant.UserOperation; import com.whyc.dto.Response; import com.whyc.pojo.DocUser; import com.whyc.pojo.ProductBom; import com.whyc.service.DocLogService; import com.whyc.service.ProductBomService; import com.whyc.util.ActionUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -11,6 +15,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.Date; import java.util.List; @Api(tags = "图纸管理") @@ -19,6 +24,9 @@ public class ProductBomController { @Autowired private ProductBomService service; @Autowired private DocLogService logService; @ApiOperation("图纸查询分类检索") @PostMapping("searchCadDrawer") @@ -29,16 +37,22 @@ @ApiOperation("图纸文件打包下载") @PostMapping("downloadCadDrawer") public void downloadCadDrawer(HttpServletRequest req, HttpServletResponse resp,@RequestBody ArrayList<String> pictureUrls){ service.downloadCadDrawer(req,resp,pictureUrls); service.downloadCadDrawer(req,resp,pictureUrls); } @ApiOperation(value = "根据子件code获取最终的信息") @GetMapping("getBomBySubcode") public Response getBomBySubcode(@RequestParam String scode){ return service.getBomBySubcode(scode); } @ApiOperation(value = "下载操作日志记录") @GetMapping("downloadLog") public Response downloadLog(@RequestParam(required = false) String parentModel,@RequestParam(required = false) String subModel){ public Response downloadLog(HttpServletRequest req,@RequestParam(required = false) String parentModel,@RequestParam(required = false) String subModel){ DocUser docUser= ActionUtil.getUser(); String operationDetail="具体文件型号为:"+parentModel+"母料型号下的"+subModel+"子料型号"; String opreationMsg="执行了文件下载操作"; String terminalIp=req.getRemoteAddr(); logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail); return new Response().set(1,true,"记录下载日志"); } src/main/java/com/whyc/service/ProductBomService.java
@@ -5,10 +5,12 @@ 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; import com.whyc.mapper.ProductBomMapper; import com.whyc.pojo.DocUser; import com.whyc.pojo.ProductBom; import com.whyc.pojo.ProductBomApproving; import com.whyc.pojo.ProductBomHistory; @@ -30,6 +32,9 @@ @Autowired(required = false) private ProductBomMapper mapper; @Autowired private DocLogService logService; //图纸分类检索 public Response searchCadDrawer(ProductBom productBom,int pageCurr,int pageSize) { PageHelper.startPage(pageCurr,pageSize); @@ -41,9 +46,11 @@ public void downloadCadDrawer(HttpServletRequest req, HttpServletResponse resp, ArrayList<String> pictureUrls) { String fileDirName = FileDirPath.getFileDirName(); String rootFace=fileDirName+ File.separator+"downLoad"; String pictureName=""; //将选中的文件存入指定目录下打包下载 if(pictureUrls!=null&&pictureUrls.size()>0){ for (String picUrl:pictureUrls) { pictureName+=picUrl.substring(picUrl.lastIndexOf("\\")+1)+","; File sourceFile=new File(fileDirName+ File.separator+picUrl); copyFile(sourceFile,rootFace); } @@ -73,6 +80,13 @@ } catch (IOException e) { e.printStackTrace(); } //记录日志 DocUser docUser= ActionUtil.getUser(); String operationDetail="具体图纸为:"+pictureName.substring(0,pictureName.lastIndexOf(",")); String opreationMsg="执行了文件打包下载操作"; String terminalIp=req.getRemoteAddr(); logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail); } //根据子件code获取最终的信息 public Response getBomBySubcode(String scode) {