From 00f4926e66eae720377c9542d3e70a62dc919b68 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Mon, 17 Apr 2023 19:53:57 +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=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspect/task/aspect/TaskGenerateAspect.java | 47 +++++++++------------- .../inspect/task/job/service/TaskJobService.java | 5 +++ .../operational/src/main/resources/db/1.0.1.sql | 8 +++- 3 files changed, 31 insertions(+), 29 deletions(-) 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 7b20057..3a7b5bb 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 @@ -8,9 +8,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.hnac.hzims.message.dto.PlanMsgRecordDto; import com.hnac.hzims.message.fegin.IMessageClient; +import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; import com.hnac.hzinfo.inspect.task.entity.TaskEntity; import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity; import com.hnac.hzinfo.inspect.task.job.service.TaskRemindManager; +import com.hnac.hzinfo.inspect.task.service.ITaskService; import com.hnac.hzinfo.inspect.task.service.ITaskUserService; import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; @@ -47,6 +49,7 @@ import java.util.Map; public class TaskGenerateAspect { private final IMessageClient messageClient; + private final ITaskService taskService; private final ITaskUserService taskUserService; /** @@ -61,38 +64,26 @@ public class TaskGenerateAspect { @Value("${hzims.inspect.task.templateCode.taskEnd}") private String taskEndTemplateCode; - @Pointcut("execution(* com.hnac.hzinfo.inspect.task.service.ITaskService.save(..))") + @Pointcut("execution(* com.hnac.hzinfo.inspect.task.job.service.ITaskJobService.sendTask(..))") public void taskSaveCut() { } - @Pointcut("execution(* com.hnac.hzinfo.inspect.task.service.ITaskService.saveBatch(..))") - public void taskSaveCutBatch() { - } - - @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); + @AfterReturning(value = "taskSaveCut()") + private void saveTask(JoinPoint joinPoint) { + Object[] args = joinPoint.getArgs(); + new Thread(() -> { + if(ObjectUtil.isNotEmpty(args[0]) && args[0] instanceof PlanEntity) { + PlanEntity plan = (PlanEntity) args[0]; + List list = taskService.list( + Wrappers.lambdaQuery().eq(TaskEntity::getPlanId,plan.getId()) + ); + if(CollectionUtil.isNotEmpty(list)) { + list.forEach(this::pushMessageByTask); } - },"巡检任务消息推送"); - } - } - - @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(); - } + TaskEntity task = JSONObject.parseObject(JSON.toJSONString(args[0]),TaskEntity.class); + this.pushMessageByTask(task); + } + },"巡检任务消息推送").start(); } /** diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/job/service/TaskJobService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/job/service/TaskJobService.java index 501bef5..b256697 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/job/service/TaskJobService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/job/service/TaskJobService.java @@ -18,6 +18,7 @@ import com.hnac.hzinfo.inspect.plan.entity.*; import com.hnac.hzinfo.inspect.plan.service.*; import com.hnac.hzinfo.inspect.task.TaskContants; import com.hnac.hzinfo.inspect.task.TaskContants.ClaimStatusEnum; +import com.hnac.hzinfo.inspect.task.aspect.TaskGenerateAspect; import com.hnac.hzinfo.inspect.task.entity.*; import com.hnac.hzinfo.inspect.task.service.ITaskObjectProjectContentService; import com.hnac.hzinfo.inspect.task.service.ITaskObjectProjectService; @@ -89,6 +90,9 @@ public class TaskJobService { @Autowired private IDutyMainClient dutyMainClient; + @Autowired + private TaskGenerateAspect taskGenerateAspect; + private final String dateSplit = "_"; /** @@ -401,6 +405,7 @@ public class TaskJobService { task.setCreateUser(plan.getCreateUser()); task.setCreateDept(plan.getCreateDept()); task.setAutoVideo(plan.getAutoVideo()); + task.setMessageTemplateId(plan.getMessageTemplateId()); task.setMethod(plan.getMethod()); task.setEndRemindFlag(true); task.setStartRemindFlag(true); diff --git a/hzims-service/operational/src/main/resources/db/1.0.1.sql b/hzims-service/operational/src/main/resources/db/1.0.1.sql index 0ab54ec..1beb842 100644 --- a/hzims-service/operational/src/main/resources/db/1.0.1.sql +++ b/hzims-service/operational/src/main/resources/db/1.0.1.sql @@ -3,4 +3,10 @@ alter table hzims_oper_maintenance_library add COLUMN `MESSAGE_TEMPLATE_ID` bigi -- 日常维护计划添加消息模板ID alter table hzims_oper_maintenance_plan add COLUMN `MESSAGE_TEMPLATE_ID` bigint(20) comment '消息推送模板ID'; -- 日常维护任务添加消息模板ID -alter table hzims_oper_maintenance_task add COLUMN `MESSAGE_TEMPLATE_ID` bigint(20) comment '消息推送模板ID'; \ No newline at end of file +alter table hzims_oper_maintenance_task add COLUMN `MESSAGE_TEMPLATE_ID` bigint(20) comment '消息推送模板ID'; +-- 日常维护库设备库编码长度修改 +alter table hzims_oper_maintenance_library MODIFY COLUMN `em_code` VARCHAR(50) comment '设备编码'; +-- 日常维护库设备计划编码长度修改 +alter table hzims_oper_maintenance_plan MODIFY COLUMN `em_code` VARCHAR(50) comment '设备编码'; +-- 日常维护库设备任务编码长度修改 +alter table hzims_oper_maintenance_task MODIFY COLUMN `em_code` VARCHAR(50) comment '设备编码'; \ No newline at end of file