|
|
|
@ -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<TaskEntity> 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<TaskEntity> taskList = JSONArray.parseArray(JSON.toJSONString(args[0]),TaskEntity.class); |
|
|
|
|
taskList.forEach(this::pushMessageByTask); |
|
|
|
|
} |
|
|
|
|
},"巡检任务消息批量推送").start(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|