|
|
@@ -13,7 +13,6 @@ import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystem;
|
|
|
import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystemLog;
|
|
|
import com.xunmei.common.core.domain.iot.domain.IotDevice;
|
|
|
import com.xunmei.common.core.enums.CategoryDataEnum;
|
|
|
-import com.xunmei.common.core.thread.ThreadPoolConfig;
|
|
|
import com.xunmei.common.core.util.BeanHelper;
|
|
|
import com.xunmei.common.core.utils.IDHelper;
|
|
|
import com.xunmei.common.redis.utils.RedisUtils;
|
|
|
@@ -41,9 +40,6 @@ import com.xunmei.system.api.util.LogUtils;
|
|
|
import com.xunmei.system.api.vo.SysOrgVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -53,7 +49,6 @@ import java.time.Duration;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -79,9 +74,7 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
private IotAlarmDefenceAreaService defenceAreService;
|
|
|
@Resource
|
|
|
private NorthErrorService northErrorService;
|
|
|
- @Autowired
|
|
|
- @Qualifier(ThreadPoolConfig.MEDIATOR_EXECUTOR)
|
|
|
- private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
|
|
+
|
|
|
@Resource
|
|
|
private IotAlarmSubsystemMapper iotAlarmSubsystemMapper;
|
|
|
|
|
|
@@ -198,10 +191,10 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
protection.setStatusUpdatorName(null);
|
|
|
this.updateById(protection);
|
|
|
//临时换文件处理,等下次打完整包的时候删除这段代码
|
|
|
- LambdaUpdateWrapper<IotAlarmSubsystem> updateWrapper=new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.eq(IotAlarmSubsystem::getId,protection.getId());
|
|
|
- updateWrapper.set(IotAlarmSubsystem::getStatusUpdatorId,null);
|
|
|
- updateWrapper.set(IotAlarmSubsystem::getStatusUpdatorName,null);
|
|
|
+ LambdaUpdateWrapper<IotAlarmSubsystem> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.eq(IotAlarmSubsystem::getId, protection.getId());
|
|
|
+ updateWrapper.set(IotAlarmSubsystem::getStatusUpdatorId, null);
|
|
|
+ updateWrapper.set(IotAlarmSubsystem::getStatusUpdatorName, null);
|
|
|
this.update(updateWrapper);
|
|
|
|
|
|
this.northStatisticsSyncService.saveOrUpdateBusinessCountByDateAndDataType(DateUtil.today(), DataType.protectionStatusCount.getIndex(), 1L);
|
|
|
@@ -234,9 +227,7 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
}
|
|
|
LogUtils.BASE_INFO_DEFENCEAREA.info("获取全部的报警主机子系统及防区信息,开始数据处理界面!");
|
|
|
this.northStatisticsSyncService.saveOrUpdateBaseCountByDataType(DataType.protectionCount.getIndex(), defenceareaList.size(), false);
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- this.saveAndUpdate(defenceareaList, msgId);
|
|
|
- }, threadPoolTaskExecutor);
|
|
|
+ this.saveAndUpdate(defenceareaList, msgId);
|
|
|
return ReceiveErrorDto.success();
|
|
|
}
|
|
|
|
|
|
@@ -253,9 +244,9 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
public IotAlarmSubsystem getByDeviceNameAndSubSystemId(String iotToken, String deviceName, String subSystemId) {
|
|
|
String key = DeviceCacheEnum.IOT_SUB_SYSTEM.getCode() + iotToken + "_" + deviceName + "_" + subSystemId;
|
|
|
IotAlarmSubsystem info = RedisUtils.getCacheObject(key);
|
|
|
- if (info == null){
|
|
|
+ if (info == null) {
|
|
|
IotAlarmSubsystem subsystem = iotAlarmSubsystemMapper.getByDeviceNameAndSubSystemId(iotToken, deviceName, String.valueOf(subSystemId));
|
|
|
- if (subsystem != null){
|
|
|
+ if (subsystem != null) {
|
|
|
updateSubSystemCache(subsystem);
|
|
|
return subsystem;
|
|
|
}
|
|
|
@@ -266,7 +257,7 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void saveSubSystemInfos(List<IotAlarmSubsystem> list) {
|
|
|
- if (!list.isEmpty()){
|
|
|
+ if (!list.isEmpty()) {
|
|
|
saveBatch(list);
|
|
|
for (IotAlarmSubsystem data : list) {
|
|
|
updateSubSystemCache(data);
|
|
|
@@ -277,7 +268,7 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateSubSystemInfos(List<IotAlarmSubsystem> list) {
|
|
|
- if (!list.isEmpty()){
|
|
|
+ if (!list.isEmpty()) {
|
|
|
updateBatchById(list);
|
|
|
for (IotAlarmSubsystem data : list) {
|
|
|
updateSubSystemCache(data);
|
|
|
@@ -290,7 +281,7 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
return baseMapper.findSubSystem(orgId, productName, deviceName, deviceId);
|
|
|
}
|
|
|
|
|
|
- private void updateSubSystemCache(IotAlarmSubsystem subsystem){
|
|
|
+ private void updateSubSystemCache(IotAlarmSubsystem subsystem) {
|
|
|
String key = DeviceCacheEnum.IOT_SUB_SYSTEM.getCode() + subsystem.getIotToken() + "_" + subsystem.getAlarmHostCode() + "_" + subsystem.getCode();
|
|
|
RedisUtils.setCacheObject(key, subsystem, Duration.ofMillis(1000 * 60 * 60));
|
|
|
}
|