手动发起接入

This commit is contained in:
xy
2024-08-15 08:36:12 +08:00
parent adbb9a16f4
commit ab9215f13e
4 changed files with 69 additions and 47 deletions

View File

@@ -80,6 +80,16 @@ public class CsDeviceController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/manualAccess")
@ApiOperation("手动发起接入")
@ApiImplicitParam(name = "nDid", value = "设备id", required = true)
public HttpResult<String> manualAccess(@RequestParam String nDid){
String methodDescribe = getMethodDescribe("manualAccess");
csDeviceService.manualAccess(nDid);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/wlRegister") @PostMapping("/wlRegister")
@ApiOperation("便携式设备注册") @ApiOperation("便携式设备注册")

View File

@@ -1,47 +1,47 @@
//package com.njcn.access.runner; package com.njcn.access.runner;
//
//import com.njcn.access.service.ICsEquipmentDeliveryService; import com.njcn.access.service.ICsEquipmentDeliveryService;
//import com.njcn.access.service.ICsTopicService; import com.njcn.access.service.ICsTopicService;
//import com.njcn.access.service.impl.CsDeviceServiceImpl; import com.njcn.access.service.impl.CsDeviceServiceImpl;
//import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO; import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
//import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
//import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
//import org.springframework.boot.ApplicationRunner; import org.springframework.boot.ApplicationRunner;
//import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource; import javax.annotation.Resource;
//import java.util.List; import java.util.List;
//import java.util.Objects; import java.util.Objects;
//
///** /**
// * 类的介绍:用来重新发起设备的接入,存在程序意外停止了,缓存失效导致无法更新装置的状态,所以需要在程序启动时发起设备的接入 * 类的介绍:用来重新发起设备的接入,存在程序意外停止了,缓存失效导致无法更新装置的状态,所以需要在程序启动时发起设备的接入
// * *
// * @author xuyang * @author xuyang
// * @version 1.0.0 * @version 1.0.0
// * @createTime 2023/8/28 13:57 * @createTime 2023/8/28 13:57
// */ */
//@Component @Component
//@Slf4j @Slf4j
//public class AccessApplicationRunner implements ApplicationRunner { public class AccessApplicationRunner implements ApplicationRunner {
//
// @Resource @Resource
// private CsDeviceServiceImpl csDeviceService; private CsDeviceServiceImpl csDeviceService;
//
// @Resource @Resource
// private ICsTopicService csTopicService; private ICsTopicService csTopicService;
//
// @Resource @Resource
// private ICsEquipmentDeliveryService csEquipmentDeliveryService; private ICsEquipmentDeliveryService csEquipmentDeliveryService;
//
// @Override @Override
// public void run(ApplicationArguments args){ public void run(ApplicationArguments args){
// List<CsEquipmentDeliveryPO> list = csEquipmentDeliveryService.getAll(); List<CsEquipmentDeliveryPO> list = csEquipmentDeliveryService.getAll();
// list.forEach(item->{ list.forEach(item->{
// String version = csTopicService.getVersion(item.getNdid()); String version = csTopicService.getVersion(item.getNdid());
// if (!Objects.isNull(version)){ if (!Objects.isNull(version)){
// csDeviceService.devAccess(item.getNdid(),version); csDeviceService.devAccess(item.getNdid(),version);
// } }
// }); });
// } }
//
//} }

View File

@@ -37,6 +37,12 @@ public interface ICsDeviceService {
*/ */
void resetFactory(String nDid); void resetFactory(String nDid);
/**
* 手动发起接入
* @param nDid
*/
void manualAccess(String nDid);
/** /**
* 直连设备注册 * 直连设备注册
* @param nDid 设备识别码 * @param nDid 设备识别码

View File

@@ -359,6 +359,12 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
} }
} }
@Override
public void manualAccess(String nDid) {
String version = csTopicService.getVersion(nDid);
devAccess(nDid,version);
}
@Override @Override
@Transactional(rollbackFor = {Exception.class}) @Transactional(rollbackFor = {Exception.class})