diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java index fa6f71d..56ce3a8 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java @@ -16,8 +16,11 @@ public class AreaAssetDeviceVo { @ApiModelProperty(value = "机构Id") private Long deptId; - @ApiModelProperty(value = "机构名称") - private String deptName; + @ApiModelProperty(value = "设备名称") + private String deviceCode; + + @ApiModelProperty(value = "设备名称") + private String deviceName; @ApiModelProperty(value = "状态") private Integer status; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java index ccf9ee1..ba577d3 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java @@ -638,7 +638,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl taskObjects = JsonFileUtil.readJsonFile(upload + "/HZ_ST_EX_OBJECT.json", TaskObjectSyncBO.class); List projectContents = JsonFileUtil.readJsonFile(upload + "/HZ_ST_EX_OBJECT_PROJECT_CONTENT.json", TaskObjectProjectContentBO.class); + // 内容图片 + this.batchCurrentImg(upload, eventRecords); + // 文件上传 this.batchUploadImg(upload, eventRecords); this.batchUploadImg(upload, eventAttachments); @@ -873,6 +876,49 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { } /** + * 上传内容文件 + * + * @param sourceDir + * @param data + */ + private void batchCurrentImg(String sourceDir, List data) { + if (CollectionUtil.isEmpty(data)) { + return; + } + + data.forEach(bo -> { + if (CollectionUtil.isEmpty(bo.getCurrentValues())) { + return; + } + List urls = bo.getCurrentValues().stream().map(o -> { + if (StringUtils.isBlank(o) || !o.contains("file:")) { + return null; + } + /**wxq begin**/ + String fileName = o.substring(o.lastIndexOf("/") >= 0 ? o.lastIndexOf("/") + 1 : 0); + File file = new File(sourceDir + "/" + fileName); + if (!file.exists()) { + throw new RuntimeException("文件名称为:" + fileName + "不存在,上传失败!"); + } + R r = null; + try { + MultipartFile multipartFile = this.getMultipartFile(file); + r = ossClient.putFile(multipartFile); + if (!r.isSuccess()) { + throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString()); + } + BladeFile bladeFile = r.getData(); + return bladeFile != null ? bladeFile.getLink() : null; + } catch (Exception ex) { + throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString(), ex); + } + }).filter(StringUtils::isNotBlank).collect(Collectors.toList()); + bo.setCurrentValues(urls); + }); + + } + + /** * 上传文件 * * @param sourceDir @@ -909,7 +955,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { } catch (Exception ex) { throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString(), ex); } - }).filter(o -> StringUtils.isNotBlank(o)).collect(Collectors.toList()); + }).filter(StringUtils::isNotBlank).collect(Collectors.toList()); bo.setFiles(urls); }); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/EventRecordSyncBO.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/EventRecordSyncBO.java index c90b919..1cc9c64 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/EventRecordSyncBO.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/EventRecordSyncBO.java @@ -40,4 +40,20 @@ public class EventRecordSyncBO extends EventRecordEntity implements SyncBO { super.setFileUrl(urls.get(0)); } } + + @Override + public List getCurrentValues() { + return new ArrayList() {{ + if (StringUtil.isNotBlank(getCurrentValue())) { + add(getCurrentValue()); + } + }}; + } + + @Override + public void setCurrentValues(List urls) { + if (CollectionUtil.isNotEmpty(urls)) { + super.setCurrentValue(urls.get(0)); + } + } } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/SyncBO.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/SyncBO.java index 628053e..f03fd08 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/SyncBO.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/SyncBO.java @@ -13,6 +13,15 @@ public interface SyncBO { } default void setFiles(List urls) { + + } + + default List getCurrentValues() { + return null; + } + + default void setCurrentValues(List urls) { + } Object getPrimaryKey(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java index f67fa82..1a75a11 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java @@ -151,7 +151,13 @@ public class AreaDutyServiceImpl implements AreaDutyService { AreaTimelyVo timely = new AreaTimelyVo(); timely.setEventId(early.getFaultId()); timely.setContent(early.getFinfo()); - timely.setDeptName(early.getStation()); + timely.setDeptName("未知"); + if(!StringUtil.isEmpty(early.getStation())){ + List names = stations.stream().filter(o->o.getCode().equals(early.getStation())).map(StationEntity::getName).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(names)){ + timely.setDeptName(names.get(0)); + } + } timely.setTime(early.getCreateTime()); int sum = this.eventToHours(LocalDateTime.parse(early.getCreateTime(),DateUtil.DATETIME_FORMATTER)); timely.setSum(sum); @@ -301,12 +307,12 @@ public class AreaDutyServiceImpl implements AreaDutyService { asset.setDevices(entry.getValue().stream().map(value->{ AreaAssetDeviceVo item = new AreaAssetDeviceVo(); item.setDeptId(entry.getKey()); - item.setDeptName(asset.getDeptName()); + item.setDeviceCode(value.getEmCode()); + item.setDeviceName(value.getName()); // 状态 HydropowerUnitRealVo real = reals.stream().filter(o->o.getDeviceCode().equals(value.getEmCode())).min(Comparator.comparing(HydropowerUnitRealVo::getDeviceCode)).get(); - if(ObjectUtil.isEmpty(real)){ - item.setStatus(2); - }else if(Math.abs(real.getActivePower()) > 0){ + item.setStatus(2); + if(ObjectUtil.isNotEmpty(real) && Math.abs(real.getActivePower()) > 0){ item.setStatus(1); } return item;