From db0b8620e177ac585bed78f154c8ca7ff54d26eb Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Mon, 17 Apr 2023 17:24:46 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E5=B7=A1=E6=A3=80=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81aop=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspect/plan/controller/PlanController.java | 2 +- .../inspect/task/aspect/TaskGenerateAspect.java | 44 ++++++++++++---------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java index 247bc93..c41efa0 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java @@ -137,7 +137,7 @@ public class PlanController extends BladeController { @ApiImplicitParam(name="status",value="0:待审核-->1:已审核-->2:派发中-->3:暂停-->4:结束-->5审核不通过-->6待提交") }) public R modifyPlanStatus(@RequestParam(value = "id") @ApiParam(value = "主键ID",required = true) Long id, - @RequestParam @DictInvalid(dictKey = PlanContants.PLAN_STATUS) Integer status) { + @RequestParam Integer status) { return R.status(planService.modifyPlanStatus(id, status)); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java index 1ffced5..7b20057 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java @@ -15,8 +15,10 @@ import com.hnac.hzinfo.inspect.task.service.ITaskUserService; import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.After; +import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springblade.core.secure.utils.AuthUtil; @@ -67,28 +69,30 @@ public class TaskGenerateAspect { public void taskSaveCutBatch() { } - @After("taskSaveCut()") - private void saveTask(ProceedingJoinPoint joinPoint) throws Throwable { - Object[] args = joinPoint.getArgs(); - new Thread(() -> { - if(ObjectUtil.isNotEmpty(args[0]) && args[0] instanceof TaskEntity) { - TaskEntity task = JSONObject.parseObject(JSON.toJSONString(args[0]),TaskEntity.class); - this.pushMessageByTask(task); - } - },"巡检任务消息推送"); - joinPoint.proceed(); + @AfterReturning(value = "taskSaveCut()",returning = "result") + private void saveTask(JoinPoint joinPoint,boolean result) throws Throwable { + if(result) { + Object[] args = joinPoint.getArgs(); + new Thread(() -> { + if(ObjectUtil.isNotEmpty(args[0]) && args[0] instanceof TaskEntity) { + TaskEntity task = JSONObject.parseObject(JSON.toJSONString(args[0]),TaskEntity.class); + this.pushMessageByTask(task); + } + },"巡检任务消息推送"); + } } - @After("taskSaveCutBatch()") - private void saveTaskBatch(ProceedingJoinPoint joinPoint) throws Throwable { - Object[] args = joinPoint.getArgs(); - new Thread(() -> { - if(args.length == 1) { - List taskList = JSONArray.parseArray(JSON.toJSONString(args[0]),TaskEntity.class); - taskList.forEach(this::pushMessageByTask); - } - },"巡检任务消息批量推送").start(); - joinPoint.proceed(); + @AfterReturning(value = "taskSaveCutBatch()",returning = "result") + private void saveTaskBatch(JoinPoint joinPoint,boolean result) throws Throwable { + if(result) { + Object[] args = joinPoint.getArgs(); + new Thread(() -> { + if(args.length == 1) { + List taskList = JSONArray.parseArray(JSON.toJSONString(args[0]),TaskEntity.class); + taskList.forEach(this::pushMessageByTask); + } + },"巡检任务消息批量推送").start(); + } } /**