|
|
@@ -144,6 +144,17 @@ public class DeviceService {
|
|
|
}
|
|
|
List<Long> devicesId = list.stream().map(DeviceVo::getId).toList();
|
|
|
List<Map<String, Long>> alarmData = alarmMapper.selectByDevicesId(devicesId);
|
|
|
+
|
|
|
+ Map<String, SystemDict> deviceType = commonService.getDictList(null, new HashMap<>() {{
|
|
|
+ put("code", DictEnum.DEVICE_TYPE.getCodeType());
|
|
|
+ put("type", "1");
|
|
|
+ }});
|
|
|
+ /*for (SystemDict value : deviceType.values()) {
|
|
|
+ if (vo.getDeviceType().toString().equals(value.getValue())) {
|
|
|
+ vo.setDeviceTypeName(value.getLabel());
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
for (DeviceVo vo : list) {
|
|
|
vo.setStatusText(DeviceEnum.getName(vo.getStatus()));
|
|
|
if (!CollectionUtils.isEmpty(alarmData)) {
|
|
|
@@ -158,6 +169,23 @@ public class DeviceService {
|
|
|
}*/
|
|
|
}
|
|
|
}
|
|
|
+ for (SystemDict value : deviceType.values()) {
|
|
|
+ if (vo.getDeviceType().toString().equals(value.getValue())) {
|
|
|
+ vo.setDeviceTypeName(value.getLabel());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ KwsDeviceReference deviceHas = deviceReferenceMapper.selectOne(new LambdaQueryWrapper<KwsDeviceReference>()
|
|
|
+ .eq(KwsDeviceReference::getDeviceId, vo.getId())
|
|
|
+ .eq(KwsDeviceReference::getDelFlag, NumberConstant.ZERO)
|
|
|
+ .last("LIMIT 1")
|
|
|
+ .orderByDesc(KwsDeviceReference::getId)
|
|
|
+ );
|
|
|
+ if(!Objects.isNull(deviceHas)){
|
|
|
+ vo.setChangeBy(deviceHas.getCreateBy());
|
|
|
+ vo.setChangeTime(deviceHas.getCreateTime());
|
|
|
+ }
|
|
|
}
|
|
|
return PageRes.build(pageInfo, list);
|
|
|
}
|
|
|
@@ -227,9 +255,10 @@ public class DeviceService {
|
|
|
KwsDeviceModel deviceModel = deviceModelMapper.selectOne(new LambdaQueryWrapper<KwsDeviceModel>()
|
|
|
.eq(KwsDeviceModel::getId, vo.getModelId()));
|
|
|
if (deviceModel != null) {
|
|
|
+ vo.setDeviceType(Integer.parseInt(deviceModel.getDeviceType()));
|
|
|
vo.setManufacturer(deviceModel.getManufacturer());
|
|
|
- vo.setManufacturer_contacts(deviceModel.getManufacturerContacts());
|
|
|
- vo.setManufacturer_phone(deviceModel.getManufacturerPhone());
|
|
|
+ vo.setManufacturerContacts(deviceModel.getManufacturerContacts());
|
|
|
+ vo.setManufacturerPhone(deviceModel.getManufacturerPhone());
|
|
|
}
|
|
|
//获取字典
|
|
|
Map<String, SystemDict> dictList = commonService.getDictList(null, new HashMap<>() {{
|
|
|
@@ -252,19 +281,39 @@ public class DeviceService {
|
|
|
for (SystemDict value : dictList.values()) {
|
|
|
if (part.getPartName().equals(value.getValue())) {
|
|
|
part.setPartNameDesc(value.getLabel());
|
|
|
+ part.setUnit(value.getUrl());
|
|
|
}
|
|
|
}
|
|
|
references.forEach(re -> {
|
|
|
if (part.getPartName().equals(re.getItem())) {
|
|
|
SlopeData slopeData = slopeDataMapper.selectListByLine(snCode, re.getItem());//获取到当前测量值
|
|
|
part.setPartBaseData(re.getOriginalValue().toString());
|
|
|
+ part.setPartCurrentBaseData(re.getCurrentValue().toString());
|
|
|
if(!Objects.isNull(slopeData)){
|
|
|
part.setCurrentData(slopeData.getVal());
|
|
|
}
|
|
|
-
|
|
|
+ part.setOffset(re.getOffset().toString());
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ //获取字典
|
|
|
+ Map<String, SystemDict> deviceType= commonService.getDictList(null, new HashMap<>() {{
|
|
|
+ put("code", DictEnum.DEVICE_TYPE.getCodeType());
|
|
|
+ put("type", "1");
|
|
|
+ }});
|
|
|
+ for (SystemDict value : deviceType.values()) {
|
|
|
+ if (vo.getDeviceType().toString().equals(value.getValue())) {
|
|
|
+ vo.setDeviceTypeName(value.getLabel());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //获取项目详情
|
|
|
+ KwsProjectDevice projectDevice = projectDeviceMapper.selectOne(new LambdaQueryWrapper<KwsProjectDevice>()
|
|
|
+ .eq(KwsProjectDevice::getDeviceId, vo.getId())
|
|
|
+ .eq(KwsProjectDevice::getDelFlag, NumberConstant.ZERO)
|
|
|
+ );
|
|
|
+ if(!Objects.isNull(projectDevice)){
|
|
|
+ vo.setProjectId(projectDevice.getProjectId().toString());
|
|
|
+ }
|
|
|
vo.setPart(partData);
|
|
|
}
|
|
|
|
|
|
@@ -280,9 +329,12 @@ public class DeviceService {
|
|
|
if(!Objects.isNull(slopeData)){
|
|
|
inter.setCurrentData(slopeData.getVal());
|
|
|
}
|
|
|
-
|
|
|
+ inter.setIntegrationCurrentBaseData(re.getCurrentValue().toString());
|
|
|
+ inter.setOffset(re.getOffset().toString());
|
|
|
}
|
|
|
+
|
|
|
});
|
|
|
+
|
|
|
}
|
|
|
vo.setIntegration(intergData);
|
|
|
}
|
|
|
@@ -623,14 +675,14 @@ public class DeviceService {
|
|
|
//BigDecimal offset = value.subtract(reference.getValue());
|
|
|
kwsDeviceReference.setOriginalValue(reference.getOriginalValue());//原始基准不变
|
|
|
//调整经纬度
|
|
|
- if(type.equals(NumberConstant.ONE)){
|
|
|
+ if(type.equals(String.valueOf(NumberConstant.ONE))){
|
|
|
BigDecimal offset = commonService.computeOffset(value.toString(), obj.get("item").toString(), reference);
|
|
|
kwsDeviceReference.setOffset(offset);//当前位置-上一次的位置的距离的距离
|
|
|
kwsDeviceReference.setCurrentValue(value);
|
|
|
kwsDeviceReference.setValue(reference.getCurrentValue());
|
|
|
|
|
|
}else{
|
|
|
- BigDecimal currentValue = commonService.computeOffset(value.toString(), obj.get("item").toString(), reference);
|
|
|
+ BigDecimal currentValue = commonService.getValueByOffset(value.toString(), obj.get("item").toString(), reference);
|
|
|
kwsDeviceReference.setValue(reference.getCurrentValue());
|
|
|
kwsDeviceReference.setOffset(value);
|
|
|
kwsDeviceReference.setCurrentValue(currentValue);//原始位置+偏移的坐标
|