Browse Source

修改 aop日志输出

zhongwei
段飞宇 2 years ago
parent
commit
485880458e
  1. 23
      hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java
  2. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java
  3. 28
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/core/ProcessIdWorker.java

23
hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java

@ -75,6 +75,17 @@ public class SysLogAspect {
/** /**
* 开始时间
*/
private Long startTime = 0L;
/**
* 结束时间
*/
private Long endTime = 0L;
/**
* 设置操作日志切入点 在注解的位置切入代码 * 设置操作日志切入点 在注解的位置切入代码
*/ */
@Pointcut("@annotation(com.hnac.hzims.common.logs.annotation.OperationAnnotation)") @Pointcut("@annotation(com.hnac.hzims.common.logs.annotation.OperationAnnotation)")
@ -87,7 +98,10 @@ public class SysLogAspect {
*/ */
@Before(value = "logPointCut()") @Before(value = "logPointCut()")
public void before(JoinPoint joinPoint) { public void before(JoinPoint joinPoint) {
stopWatch.start(); // if (!stopWatch.isRunning()) {
// stopWatch.start();
// }
startTime = System.currentTimeMillis();
log.info("前置通知"); log.info("前置通知");
} }
@ -224,8 +238,11 @@ public class SysLogAspect {
sysLog.setOperationUserId(userId); sysLog.setOperationUserId(userId);
sysLog.setTenantId(Func.toStr(AuthUtil.getTenantId(), BladeConstant.ADMIN_TENANT_ID)); sysLog.setTenantId(Func.toStr(AuthUtil.getTenantId(), BladeConstant.ADMIN_TENANT_ID));
sysLog.setLocalIp(WebUtil.getIP(request));// 请求IP sysLog.setLocalIp(WebUtil.getIP(request));// 请求IP
stopWatch.stop(); // if (stopWatch.isRunning()) {
sysLog.setCostTime(stopWatch.getTotalTimeMillis() + "ms"); // stopWatch.stop();
// }
endTime = System.currentTimeMillis();
sysLog.setCostTime((endTime - startTime) + "ms");
sysLog.setPath(requestPath); sysLog.setPath(requestPath);
sysLog.setTitle(title); sysLog.setTitle(title);
sysLog.setAction(action); sysLog.setAction(action);

4
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, @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
OperPhenomenonEntity entity, String taskIds, Date findTimeEnd) { OperPhenomenonEntity entity, String taskIds, Date findTimeEnd) {
Page<OperPhenomenonEntity> operDefectEntityPage = new Page<>(page, size); Page<OperPhenomenonEntity> operDefectEntityPage = new Page<>(page, size);
LambdaQueryWrapper<OperPhenomenonEntity> queryWrapper = Condition.getQueryWrapper(new OperPhenomenonEntity(), entity); LambdaQueryWrapper<OperPhenomenonEntity> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtil.isNotBlank(taskIds)) { if (StringUtil.isNotBlank(taskIds)) {
queryWrapper.in(OperPhenomenonEntity::getId, Lists.newArrayList(taskIds.split(","))); queryWrapper.in(OperPhenomenonEntity::getId, Lists.newArrayList(taskIds.split(",")));
} }
@ -222,7 +222,7 @@ public class AreaMonthlyDetailsController {
} }
// 区域Id // 区域Id
if (Func.isNotEmpty(entity.getAreaId())) { if (Func.isNotEmpty(entity.getAreaId())) {
queryWrapper.eq(OperPhenomenonEntity::getCreateDept, entity.getAreaId()); queryWrapper.eq(OperPhenomenonEntity::getCreateDept, Long.valueOf(entity.getAreaId()));
} }
// 年份 // 年份
if (Func.isNotEmpty(entity.getYearMonth())) { if (Func.isNotEmpty(entity.getYearMonth())) {

28
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); 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);
}
} }

Loading…
Cancel
Save