Browse Source

Revert "#离线修改"

This reverts commit f7b213e3b6.
zhongwei
tyty 1 year ago
parent
commit
9bda3a6ab5
  1. 7
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java
  2. 48
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java
  3. 16
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/EventRecordSyncBO.java
  4. 9
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/SyncBO.java
  5. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java

7
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java

@ -16,11 +16,8 @@ public class AreaAssetDeviceVo {
@ApiModelProperty(value = "机构Id")
private Long deptId;
@ApiModelProperty(value = "设备名称")
private String deviceCode;
@ApiModelProperty(value = "设备名称")
private String deviceName;
@ApiModelProperty(value = "机构名称")
private String deptName;
@ApiModelProperty(value = "状态")
private Integer status;

48
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java

@ -832,9 +832,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
List<TaskObjectSyncBO> taskObjects = JsonFileUtil.readJsonFile(upload + "/HZ_ST_EX_OBJECT.json", TaskObjectSyncBO.class);
List<TaskObjectProjectContentBO> 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);
@ -876,49 +873,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
}
/**
* 上传内容文件
*
* @param sourceDir
* @param data
*/
private void batchCurrentImg(String sourceDir, List<? extends SyncBO> data) {
if (CollectionUtil.isEmpty(data)) {
return;
}
data.forEach(bo -> {
if (CollectionUtil.isEmpty(bo.getCurrentValues())) {
return;
}
List<String> 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<BladeFile> 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
@ -955,7 +909,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
} catch (Exception ex) {
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString(), ex);
}
}).filter(StringUtils::isNotBlank).collect(Collectors.toList());
}).filter(o -> StringUtils.isNotBlank(o)).collect(Collectors.toList());
bo.setFiles(urls);
});

16
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/EventRecordSyncBO.java

@ -40,20 +40,4 @@ public class EventRecordSyncBO extends EventRecordEntity implements SyncBO {
super.setFileUrl(urls.get(0));
}
}
@Override
public List<String> getCurrentValues() {
return new ArrayList<String>() {{
if (StringUtil.isNotBlank(getCurrentValue())) {
add(getCurrentValue());
}
}};
}
@Override
public void setCurrentValues(List<String> urls) {
if (CollectionUtil.isNotEmpty(urls)) {
super.setCurrentValue(urls.get(0));
}
}
}

9
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/SyncBO.java

@ -13,15 +13,6 @@ public interface SyncBO {
}
default void setFiles(List<String> urls) {
}
default List<String> getCurrentValues() {
return null;
}
default void setCurrentValues(List<String> urls) {
}
Object getPrimaryKey();

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java

@ -151,13 +151,7 @@ public class AreaDutyServiceImpl implements AreaDutyService {
AreaTimelyVo timely = new AreaTimelyVo();
timely.setEventId(early.getFaultId());
timely.setContent(early.getFinfo());
timely.setDeptName("未知");
if(!StringUtil.isEmpty(early.getStation())){
List<String> 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.setDeptName(early.getStation());
timely.setTime(early.getCreateTime());
int sum = this.eventToHours(LocalDateTime.parse(early.getCreateTime(),DateUtil.DATETIME_FORMATTER));
timely.setSum(sum);
@ -307,12 +301,12 @@ public class AreaDutyServiceImpl implements AreaDutyService {
asset.setDevices(entry.getValue().stream().map(value->{
AreaAssetDeviceVo item = new AreaAssetDeviceVo();
item.setDeptId(entry.getKey());
item.setDeviceCode(value.getEmCode());
item.setDeviceName(value.getName());
item.setDeptName(asset.getDeptName());
// 状态
HydropowerUnitRealVo real = reals.stream().filter(o->o.getDeviceCode().equals(value.getEmCode())).min(Comparator.comparing(HydropowerUnitRealVo::getDeviceCode)).get();
if(ObjectUtil.isEmpty(real)){
item.setStatus(2);
if(ObjectUtil.isNotEmpty(real) && Math.abs(real.getActivePower()) > 0){
}else if(Math.abs(real.getActivePower()) > 0){
item.setStatus(1);
}
return item;

Loading…
Cancel
Save