代码优化

This commit is contained in:
xy
2025-01-13 16:25:41 +08:00
parent cc22afd877
commit 87fc735969
3 changed files with 8 additions and 3 deletions

View File

@@ -100,6 +100,8 @@ public class AccessApplicationRunner implements ApplicationRunner {
csDeviceService.devAccessAskTemplate(item.getNdid(),version,1); csDeviceService.devAccessAskTemplate(item.getNdid(),version,1);
} }
redisUtil.saveByKey(AppRedisKey.DEVICE_MID + item.getNdid(),1); redisUtil.saveByKey(AppRedisKey.DEVICE_MID + item.getNdid(),1);
} else {
log.info("{},装置主题缺少版本信息", item.getNdid());
} }
}); });
} }

View File

@@ -95,6 +95,8 @@ public class AutoAccessTimer implements ApplicationRunner {
csDeviceService.devAccessAskTemplate(item.getNdid(),version,1); csDeviceService.devAccessAskTemplate(item.getNdid(),version,1);
} }
redisUtil.saveByKey(AppRedisKey.DEVICE_MID + item.getNdid(),1); redisUtil.saveByKey(AppRedisKey.DEVICE_MID + item.getNdid(),1);
} else {
log.info("{},装置主题缺少版本信息", item.getNdid());
} }
}); });
} }

View File

@@ -38,6 +38,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -370,7 +371,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Async
public String wlDevRegister(String nDid) { public String wlDevRegister(String nDid) {
String result = "fail"; String result = "fail";
// 设备状态判断 // 设备状态判断
@@ -386,7 +387,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
logDto.setOperate("便携式设备"+nDid+"注册、接入"); logDto.setOperate("便携式设备"+nDid+"注册、接入");
logDto.setResult(1); logDto.setResult(1);
try { try {
Thread.sleep(5000); Thread.sleep(2000);
//获取版本 //获取版本
String version = csTopicService.getVersion(nDid); String version = csTopicService.getVersion(nDid);
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(nDid).getData(); CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(nDid).getData();
@@ -439,7 +440,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
csDevModelRelationAddParm.setDid(modelList.get(0).getDid()); csDevModelRelationAddParm.setDid(modelList.get(0).getDid());
csDevModelRelationService.addDevModelRelation(csDevModelRelationAddParm); csDevModelRelationService.addDevModelRelation(csDevModelRelationAddParm);
//5.发起自动接入请求 //5.发起自动接入请求
Thread.sleep(5000); Thread.sleep(2000);
devAccessAskTemplate(nDid,version,1); devAccessAskTemplate(nDid,version,1);
//6.修改流程,便携式设备接入成功即为实际环境 //6.修改流程,便携式设备接入成功即为实际环境
csEquipmentDeliveryService.updateProcessBynDid(nDid,4); csEquipmentDeliveryService.updateProcessBynDid(nDid,4);