Browse Source

# 巡检任务生成消息推送修改

zhongwei
haungxing 2 years ago
parent
commit
00f4926e66
  1. 39
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java
  2. 5
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/job/service/TaskJobService.java
  3. 6
      hzims-service/operational/src/main/resources/db/1.0.1.sql

39
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) {
@AfterReturning(value = "taskSaveCut()")
private void saveTask(JoinPoint joinPoint) {
Object[] args = joinPoint.getArgs();
new Thread(() -> {
if(ObjectUtil.isNotEmpty(args[0]) && args[0] instanceof TaskEntity) {
if(ObjectUtil.isNotEmpty(args[0]) && args[0] instanceof PlanEntity) {
PlanEntity plan = (PlanEntity) args[0];
List<TaskEntity> list = taskService.list(
Wrappers.<TaskEntity>lambdaQuery().eq(TaskEntity::getPlanId,plan.getId())
);
if(CollectionUtil.isNotEmpty(list)) {
list.forEach(this::pushMessageByTask);
}
TaskEntity task = JSONObject.parseObject(JSON.toJSONString(args[0]),TaskEntity.class);
this.pushMessageByTask(task);
}
},"巡检任务消息推送");
}
}
@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<TaskEntity> taskList = JSONArray.parseArray(JSON.toJSONString(args[0]),TaskEntity.class);
taskList.forEach(this::pushMessageByTask);
}
},"巡检任务消息批量推送").start();
}
},"巡检任务消息推送").start();
}
/**

5
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);

6
hzims-service/operational/src/main/resources/db/1.0.1.sql

@ -4,3 +4,9 @@ alter table hzims_oper_maintenance_library add COLUMN `MESSAGE_TEMPLATE_ID` bigi
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';
-- 日常维护库设备库编码长度修改
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 '设备编码';
Loading…
Cancel
Save