|
|
|
@ -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<TaskEntity> list = taskService.list( |
|
|
|
|
Wrappers.<TaskEntity>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<TaskEntity> 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(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|