|
|
@@ -241,87 +241,32 @@ public class EquipmentSyncService {
|
|
|
device.setCameraPassword(datum.getCameraPassword());
|
|
|
device.setEquipmentAddr(datum.getEquipmentAddr());
|
|
|
device.setCameraCode(datum.getCameraCode());
|
|
|
+ device.setDeviceType(datum.getDeviceType());
|
|
|
device.setDeleted(0);
|
|
|
device.setSource(1);
|
|
|
- String categoryCode = null;
|
|
|
switch (datum.getEquipmentType()) {
|
|
|
case 1:
|
|
|
//监控主机
|
|
|
- device.setDeviceType(String.valueOf(DeviceType.Dvs.ordinal()));
|
|
|
- categoryCode = "14";
|
|
|
device.setCategoryId(CategoryDataEnum.MONITOR_HOST_DEVICE.getId());
|
|
|
break;
|
|
|
case 2:
|
|
|
//对讲主机
|
|
|
- device.setDeviceType(String.valueOf(DeviceType.Intercom_Equipment.ordinal()));
|
|
|
- categoryCode = "16";
|
|
|
device.setCategoryId(CategoryDataEnum.TALK_HOST_DEVICE.getId());
|
|
|
break;
|
|
|
case 3:
|
|
|
//报警主机
|
|
|
- device.setDeviceType(String.valueOf(DeviceType.Alarm_Equipment.ordinal()));
|
|
|
- categoryCode = "15";
|
|
|
device.setCategoryId(CategoryDataEnum.ALARM_HOST_DEVICE.getId());
|
|
|
break;
|
|
|
case 4:
|
|
|
//门禁主机
|
|
|
- device.setDeviceType(String.valueOf(DeviceType.Guard_Equipment.ordinal()));
|
|
|
- categoryCode = "17";
|
|
|
device.setCategoryId(CategoryDataEnum.DOOR_HOST_DEVICE.getId());
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ //报警主机传感器
|
|
|
+ device.setCategoryId(CategoryDataEnum.IOT_DETECTION_DEVICE.getId());
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 此处因为是统一处理,所以如果存在新的brand,就会存放一样的品牌到数据库多条记录
|
|
|
- * 所以存储brand应该是个单独的事务
|
|
|
- */
|
|
|
- //处理设备品牌
|
|
|
- /* if(datum.getEquipmentCode().contains("GXX")||datum.getEquipmentCode().contains("gxx")){
|
|
|
- datum.setProducer("高新兴");
|
|
|
- }
|
|
|
- if (datum.getEquipmentType() == 5) {
|
|
|
- if (datum.getEquipmentCode().contains("XSD") || datum.getEquipmentCode().contains("xsd")) {
|
|
|
- datum.setProducer("新世电");
|
|
|
- } else {
|
|
|
- datum.setProducer("高新兴");
|
|
|
- }
|
|
|
- }
|
|
|
- Brand brand = brands.get(datum.getProducer());
|
|
|
- if (brand == null) {
|
|
|
- if (StringUtils.isNotEmpty(datum.getProducer())) {
|
|
|
- //不存在该品牌则新建该品牌
|
|
|
- brand = new Brand();
|
|
|
- brand.setName(datum.getProducer());
|
|
|
- brand.setCreateTime(new Date());
|
|
|
- baseInfoService.saveBrandInfo(brand);
|
|
|
- brands.put(datum.getProducer(), brand);
|
|
|
- device.setBrandId(brand.getId());
|
|
|
- }
|
|
|
- } else {
|
|
|
- device.setBrandId(brand.getId());
|
|
|
- }*/
|
|
|
-
|
|
|
- //处理设备分类,视频物联网监控主机由于清楚DeviceType暂定14写死,和固定写死categoryId
|
|
|
- if (datum.getEquipmentType() == 5) {
|
|
|
- if (datum.getEquipmentCode().contains("XSD") || datum.getEquipmentCode().contains("xsd")) {
|
|
|
- device.setCategoryId(3712199107215361L);
|
|
|
- } else {
|
|
|
- device.setCategoryId(3712199107215360L);
|
|
|
- }
|
|
|
- device.setDeviceType(String.valueOf(DeviceType.Spwlw_Jczj.ordinal()));
|
|
|
- } else {
|
|
|
- MediatorCategory cate = categorys.get(categoryCode);
|
|
|
- if (cate == null) {
|
|
|
- MediatorCategory category = categoryService.findCategoryByCodeAndParentId(categoryCode, -1L);
|
|
|
- if (category != null) {
|
|
|
- device.setCategoryId(category.getId());
|
|
|
- categorys.put(categoryCode, category);
|
|
|
- }
|
|
|
- } else {
|
|
|
- device.setCategoryId(cate.getId());
|
|
|
- }
|
|
|
- }
|
|
|
device.setCreateTime(LocalDateTime.now());
|
|
|
device.setUpdateTime(LocalDateTime.now());
|
|
|
map.put("device", device);
|