From 485880458e0fbf674ca30662739fcb3bbe8946e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Wed, 19 Apr 2023 16:05:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20aop=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/common/logs/aop/SysLogAspect.java | 25 +++++++++++++++---- .../web/AreaMonthlyDetailsController.java | 4 ++-- .../processflow/strategy/core/ProcessIdWorker.java | 28 ---------------------- 3 files changed, 23 insertions(+), 34 deletions(-) diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java index 47884ef..bcecd2b 100644 --- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java +++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java @@ -50,7 +50,7 @@ public class SysLogAspect { @Autowired - private SysLogQueue sysLogQueue; + private SysLogQueue sysLogQueue; /** * 请求地址 @@ -75,6 +75,17 @@ public class SysLogAspect { /** + * 开始时间 + */ + private Long startTime = 0L; + + /** + * 结束时间 + */ + private Long endTime = 0L; + + + /** * 设置操作日志切入点 在注解的位置切入代码 */ @Pointcut("@annotation(com.hnac.hzims.common.logs.annotation.OperationAnnotation)") @@ -87,7 +98,10 @@ public class SysLogAspect { */ @Before(value = "logPointCut()") public void before(JoinPoint joinPoint) { - stopWatch.start(); + // if (!stopWatch.isRunning()) { + // stopWatch.start(); + // } + startTime = System.currentTimeMillis(); log.info("前置通知"); } @@ -224,8 +238,11 @@ public class SysLogAspect { sysLog.setOperationUserId(userId); sysLog.setTenantId(Func.toStr(AuthUtil.getTenantId(), BladeConstant.ADMIN_TENANT_ID)); sysLog.setLocalIp(WebUtil.getIP(request));// 请求IP - stopWatch.stop(); - sysLog.setCostTime(stopWatch.getTotalTimeMillis() + "ms"); + // if (stopWatch.isRunning()) { + // stopWatch.stop(); + // } + endTime = System.currentTimeMillis(); + sysLog.setCostTime((endTime - startTime) + "ms"); sysLog.setPath(requestPath); sysLog.setTitle(title); sysLog.setAction(action); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java index 17c2874..79e2618 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java @@ -207,7 +207,7 @@ public class AreaMonthlyDetailsController { @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, OperPhenomenonEntity entity, String taskIds, Date findTimeEnd) { Page operDefectEntityPage = new Page<>(page, size); - LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new OperPhenomenonEntity(), entity); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); if (StringUtil.isNotBlank(taskIds)) { queryWrapper.in(OperPhenomenonEntity::getId, Lists.newArrayList(taskIds.split(","))); } @@ -222,7 +222,7 @@ public class AreaMonthlyDetailsController { } // 区域Id if (Func.isNotEmpty(entity.getAreaId())) { - queryWrapper.eq(OperPhenomenonEntity::getCreateDept, entity.getAreaId()); + queryWrapper.eq(OperPhenomenonEntity::getCreateDept, Long.valueOf(entity.getAreaId())); } // 年份 if (Func.isNotEmpty(entity.getYearMonth())) { diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/core/ProcessIdWorker.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/core/ProcessIdWorker.java index 70aafab..e29a875 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/core/ProcessIdWorker.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/core/ProcessIdWorker.java @@ -184,32 +184,4 @@ public class ProcessIdWorker { private AtomicInteger sequencing = new AtomicInteger(1); } - public static void main(String[] args) { - - // TicketIdWorker standardTicketIdWorker = new TicketIdWorker(); - // int count = 1; - // while (count <= 1000) { - // - // System.out.println("1 ===> " + standardTicketIdWorker.getTicketCode("aa", "bb", "2304")); - // System.out.println("================================="); - // //System.out.println("2 ===》" + standardTicketIdWorker.getTicketCode("aa", "bb", "2204")); - // count++; - // - // } - - // NumberFormat numberFormatter = NumberFormat.getInstance(); - // numberFormatter.setGroupingUsed(false); - // numberFormatter.setMinimumIntegerDigits(3); - // numberFormatter.setMaximumFractionDigits(3); - // - // String format = numberFormatter.format(2); - // System.out.println(format); - - - String msg = "2021"; - String substring = msg.substring(msg.length() - 2); - System.out.println(substring); - } - - }