设备流程判断
This commit is contained in:
@@ -15,8 +15,9 @@ public interface ICsDeviceService {
|
||||
/**
|
||||
* 直连设备注册
|
||||
* @param nDid 设备识别码
|
||||
* @param type 流程标识
|
||||
*/
|
||||
void devRegister(String nDid);
|
||||
void devRegister(String nDid,Integer type);
|
||||
|
||||
/**
|
||||
* MQTT连接成功,获取装置所用的模板信息
|
||||
|
||||
@@ -101,7 +101,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void devRegister(String nDid) {
|
||||
public void devRegister(String nDid,Integer type) {
|
||||
//日志实体
|
||||
DeviceLogDTO logDto = new DeviceLogDTO();
|
||||
logDto.setUserName(RequestUtil.getUserNickname());
|
||||
@@ -140,10 +140,16 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
csLogsFeignClient.addUserLog(logDto);
|
||||
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||
}
|
||||
//4.询问设备支持的主题信息
|
||||
//4.判断当前流程是否是合法的
|
||||
if (csEquipmentDeliveryVO.getProcess() > type){
|
||||
throw new BusinessException(AccessResponseEnum.PROCESS_SAME_ERROR);
|
||||
} else if (csEquipmentDeliveryVO.getProcess() < type){
|
||||
throw new BusinessException(AccessResponseEnum.PROCESS_MISSING_ERROR);
|
||||
}
|
||||
//5.询问设备支持的主题信息
|
||||
//将支持的主题入库
|
||||
askTopic(nDid);
|
||||
//5.MQTT询问装置用的模板,并判断库中是否存在模板
|
||||
//6.MQTT询问装置用的模板,并判断库中是否存在模板
|
||||
//存在则建立关系;不存在则告警出来
|
||||
SysDicTreePO dictData = dictTreeFeignClient.queryById(csEquipmentDeliveryVO.getDevModel()).getData();
|
||||
if (Objects.isNull(dictData)){
|
||||
@@ -364,6 +370,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
||||
reqAndResParam.setType(Integer.parseInt(TypeEnum.TYPE_5.getCode()));
|
||||
reqAndResParam.setExpire(-1);
|
||||
logger.info("设备接入报文为:" + new Gson().toJson(reqAndResParam));
|
||||
publisher.send("/Pfm/DevCmd/"+version+"/"+nDid, new Gson().toJson(reqAndResParam),1,false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user