|
@@ -11,12 +11,14 @@ import com.example.opc_da.dao.MessageNoticeDao;
|
|
|
import com.example.opc_da.dynamicSchedule.CronTaskRegister;
|
|
|
import com.example.opc_da.util.OpcDaUtil;
|
|
|
import com.example.opc_da.util.RedisUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.openscada.opc.lib.da.Item;
|
|
|
import org.openscada.opc.lib.da.*;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
|
|
|
+@Slf4j
|
|
|
public class OpcDaFrequencyTask extends TimerTask {
|
|
|
|
|
|
private final RedisUtil redisUtil;
|
|
@@ -160,6 +162,24 @@ public class OpcDaFrequencyTask extends TimerTask {
|
|
|
if (Blank.isEmpty(flage)) {
|
|
|
flage = false;
|
|
|
}
|
|
|
+ if (!access.isActive()) {
|
|
|
+ //执行组装数据库的数据,以及生成驱动报表
|
|
|
+ String sqlCurrentYmdh = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id));
|
|
|
+ opcAsyncTask.packageRawDataList(itemList, dataSourceId, sqlCurrentYmdh);
|
|
|
+ redisUtil.del(ConstantStr.VALUE_BELONG_TIME + id);
|
|
|
+ messageNoticeDao.addMessageNotice(new MessageNotice(itemGroup.getUserId(),
|
|
|
+ itemGroup.getGroupName() + DateUtil.dateChangeStrYmdhms(new Date()) + "运行失败",
|
|
|
+ "服务异常停止了",
|
|
|
+ ConstantStr.NO_READ));
|
|
|
+ if (Blank.isNotEmpty(server)) {
|
|
|
+ server.dispose();
|
|
|
+ }
|
|
|
+ itemGroupDao.stopItemGroupById(id, ConstantStr.EXCEPT_STOP_UP);
|
|
|
+ cronTaskRegister.removeCronTask(cronId);
|
|
|
+ redisUtil.del(ConstantStr.ITEM_GROUP + id);
|
|
|
+ timer.cancel();
|
|
|
+ break;
|
|
|
+ }
|
|
|
if (!flage) {
|
|
|
//执行组装数据库的数据,以及生成驱动报表
|
|
|
String sqlCurrentYmdh = String.valueOf(redisUtil.get(ConstantStr.VALUE_BELONG_TIME + id));
|