Browse Source

#离线修改

zhongwei
yang_shj 1 year ago
parent
commit
f7b213e3b6
  1. 7
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java
  2. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java
  3. 48
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java
  4. 16
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/EventRecordSyncBO.java
  5. 9
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/sync/SyncBO.java
  6. 16
      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,8 +16,11 @@ public class AreaAssetDeviceVo {
@ApiModelProperty(value = "机构Id") @ApiModelProperty(value = "机构Id")
private Long deptId; private Long deptId;
@ApiModelProperty(value = "机构名称") @ApiModelProperty(value = "设备名称")
private String deptName; private String deviceCode;
@ApiModelProperty(value = "设备名称")
private String deviceName;
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "状态")
private Integer status; private Integer status;

2
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java

@ -638,7 +638,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
} }
paramMap.put("stationIds", list.toArray(new String[0])); paramMap.put("stationIds", list.toArray(new String[0]));
}else{ }else{
paramMap.put("stationIds", stations); paramMap.put("stationIds", stations);
} }
String result = HttpRequestUtil.postCall(paramMap, autoFaultPath, "POST"); String result = HttpRequestUtil.postCall(paramMap, autoFaultPath, "POST");
if (StringUtil.isBlank(result)) { if (StringUtil.isBlank(result)) {

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

@ -832,6 +832,9 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
List<TaskObjectSyncBO> taskObjects = JsonFileUtil.readJsonFile(upload + "/HZ_ST_EX_OBJECT.json", TaskObjectSyncBO.class); 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); 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, eventRecords);
this.batchUploadImg(upload, eventAttachments); this.batchUploadImg(upload, eventAttachments);
@ -873,6 +876,49 @@ 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 * @param sourceDir
@ -909,7 +955,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
} catch (Exception ex) { } catch (Exception ex) {
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString(), 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); bo.setFiles(urls);
}); });

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

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

Loading…
Cancel
Save