|
@@ -1,5 +1,6 @@
|
|
package com.fdkankan.mqcontroller.service.impl;
|
|
package com.fdkankan.mqcontroller.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUnit;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -15,6 +16,7 @@ import org.springframework.stereotype.Service;
|
|
import rx.internal.util.unsafe.MessagePassingQueue;
|
|
import rx.internal.util.unsafe.MessagePassingQueue;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -82,6 +84,19 @@ public class MqEcsServiceImpl extends ServiceImpl<IMqEcsMapper, MqEcs> implement
|
|
LambdaQueryWrapper<MqEcs> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<MqEcs> wrapper = new LambdaQueryWrapper<>();
|
|
wrapper.eq(MqEcs::getIsScaling,1);
|
|
wrapper.eq(MqEcs::getIsScaling,1);
|
|
wrapper.isNull(MqEcs::getEcsName);
|
|
wrapper.isNull(MqEcs::getEcsName);
|
|
- return this.list(wrapper);
|
|
|
|
|
|
+ List<MqEcs> list = this.list(wrapper);
|
|
|
|
+
|
|
|
|
+ if(!list.isEmpty()){
|
|
|
|
+ for (MqEcs mqEcs : list) {
|
|
|
|
+ Date createTime = mqEcs.getCreateTime();
|
|
|
|
+ long between = DateUtil.between(createTime, new Date(), DateUnit.MINUTE);
|
|
|
|
+ //30分钟未启动。启动失败,删除并通知
|
|
|
|
+ if(between >=30){
|
|
|
|
+ this.removeById(mqEcs.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return list;
|
|
}
|
|
}
|
|
}
|
|
}
|