设备流程判断
This commit is contained in:
@@ -61,8 +61,10 @@ public enum AccessResponseEnum {
|
||||
LDEVINFO_IS_NULL("A0309","逻辑设备信息为空"),
|
||||
SOFTINFO_IS_NULL("A0309","软件信息为空"),
|
||||
|
||||
LINE_POSITION_REPEAT("A0310","监测点位置重复")
|
||||
LINE_POSITION_REPEAT("A0310","监测点位置重复"),
|
||||
|
||||
PROCESS_SAME_ERROR("A0311","当前调试已完成,请勿重复调试"),
|
||||
PROCESS_MISSING_ERROR("A0311","调试流程缺失,请核查功能调试、出厂调试"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.njcn.web.annotation.ReturnMsg;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -37,10 +38,13 @@ public class CsDeviceController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/register")
|
||||
@ApiOperation("直连设备状态判断")
|
||||
@ApiImplicitParam(name = "nDid", value = "设备识别码", required = true)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "nDid", value = "设备识别码", required = true),
|
||||
@ApiImplicitParam(name = "type", value = "流程标识", required = true)
|
||||
})
|
||||
@ReturnMsg
|
||||
public HttpResult<String> devRegister(@RequestParam String nDid){
|
||||
csDeviceService.devRegister(nDid);
|
||||
public HttpResult<String> devRegister(@RequestParam String nDid,@RequestParam Integer type){
|
||||
csDeviceService.devRegister(nDid,type);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "设备MQTT通讯状态!");
|
||||
}
|
||||
|
||||
|
||||
@@ -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