Commit 29cf2614 authored by tangwei's avatar tangwei

修改iotcode 验证

parent 126173f8
......@@ -168,6 +168,21 @@ public class CarController extends AbstractBaseController {
// saveFile(carInstance); 图片视频后期统一处理
//验证车辆code唯一性
if(car.getIotCode()!=null){
Car ar= carMapper.getCarsByIotCode(car.getIotCode());
if(ar!=null){
throw new BadRequest("物联编码重复");
}
if(car.getIotCode().startsWith("20210003")||car.getIotCode().startsWith("20210004")||car.getIotCode().startsWith("20210005")){
throw new BadRequest("物联编码航班已占用");
}
}
EquipmentSpecificSerivceImpl.registerMqttTopic(car.getIotCode(), equipmentIotMqttReceiveConfig);
car.setQrCode(QRCodeUtil.generateQRCode());
List<CarProperty> carPropertyList = car.getCarPropertyList();
......@@ -298,6 +313,20 @@ public class CarController extends AbstractBaseController {
// carInstance = iCarService.saveCar(getUserInfo(), carInstance, carInfo, carpList);
// saveFile(carInstance);视频图片文件后期统一处理
if(car.getIotCode()!=null){
Car ar= carMapper.getCarsByIotCode(car.getIotCode());
if(ar!=null){
throw new BadRequest("物联编码重复");
}
if(car.getIotCode().startsWith("20210003")||car.getIotCode().startsWith("20210004")||car.getIotCode().startsWith("20210005")){
throw new BadRequest("物联编码航班已占用");
}
}
//用来解绑车辆
jcsFeign.getUserCar(car.getId(),car.getTeamId());
......
......@@ -256,6 +256,10 @@ public class EquipmentDetailController extends AbstractBaseController {
if (iotCode > 0) {
throw new BadRequest("设备物联编码重复");
}
if(sysCode.startsWith("20210003")||sysCode.startsWith("20210004")||sysCode.startsWith("20210005")){
throw new BadRequest("物联编码航班已占用");
}
}
//1.更新装备实例Detail数据
EquipmentDetail equipmentDetail = equipmentDate.getEquipmentDetail();
......
......@@ -222,13 +222,24 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Transactional(rollbackFor = Exception.class)
public void handlerMqttIncrementMessage(String topic, String message) {
TopicEntityVo topicEntity = new TopicEntityVo();
topicEntity.setTopic(topic);
topicEntity.setMessage(message);
int endIndex = topic.lastIndexOf("/");
String iotCode = topic.substring(0, endIndex).replace("/", "");
topicEntity.setIotCode(iotCode);
List<EquipmentSpecificVo> eqIotCodeList = iEquipmentSpecificSerivce.getEquipAndCarIotcodeByIotcode(iotCode);
List<EquipmentSpecificVo> eqIotCodeList =null;
if(iotCode!=null&&!iotCode.startsWith("20210003")&&!iotCode.startsWith("20210004")&&!iotCode.startsWith("20210005")){
eqIotCodeList = iEquipmentSpecificSerivce.getEquipAndCarIotcodeByIotcode(iotCode);
}else{
log.info("不是装备物联code!", iotCode);
return;
}
if (eqIotCodeList.isEmpty()) {
log.info("该数据{}不存在!", iotCode);
return;
......
......@@ -549,6 +549,10 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
if (iot_code != 0) {
throw new RuntimeException(String.format("物联编码[%S]填写重复,请重新输入!",iot));
}
if(iot.startsWith("20210003")||iot.startsWith("20210004")||iot.startsWith("20210005")){
throw new BadRequest("物联编码航班已占用");
}
}
AtomicReference<String> fightSysIds = new AtomicReference<>("");
String fightingSysCodes = equipmentDetailDownloadVOS.getFightingSysCodes();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment