Browse Source

#平台接口改造修复

zhongwei
yang_shj 5 months ago
parent
commit
9ea4f65782
  1. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java
  2. 64
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  3. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java
  4. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java

21
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java

@ -165,7 +165,12 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
generate.setCreateDept(station.getRefDept()); generate.setCreateDept(station.getRefDept());
generate.setCreateUser(station.getCreateUser()); generate.setCreateUser(station.getCreateUser());
generate.setUpdateUser(station.getUpdateUser()); generate.setUpdateUser(station.getUpdateUser());
Date time = DateUtil.parse(records.get(0).getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time;
if(records.get(0).getTs().contains(".0")){
time = DateUtil.parse(records.get(0).getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
time = DateUtil.parse(records.get(0).getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
generate.setStrDay(DateUtil.format(time,DateUtil.PATTERN_DATETIME)); generate.setStrDay(DateUtil.format(time,DateUtil.PATTERN_DATETIME));
generate.setDay(time.getDate()); generate.setDay(time.getDate());
if(StringUtil.isEmpty(records.get(0).getVal())){ if(StringUtil.isEmpty(records.get(0).getVal())){
@ -293,7 +298,12 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
generate.setCreateDept(station.getRefDept()); generate.setCreateDept(station.getRefDept());
generate.setCreateUser(station.getCreateUser()); generate.setCreateUser(station.getCreateUser());
generate.setUpdateUser(station.getUpdateUser()); generate.setUpdateUser(station.getUpdateUser());
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time;
if(record.getTs().contains(".0")){
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
generate.setStrDay(DateUtil.format(time,DateUtil.PATTERN_DATETIME)); generate.setStrDay(DateUtil.format(time,DateUtil.PATTERN_DATETIME));
generate.setDay(time.getDate()); generate.setDay(time.getDate());
if(StringUtil.isEmpty(record.getVal())){ if(StringUtil.isEmpty(record.getVal())){
@ -364,7 +374,12 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
generate.setCreateDept(station.getRefDept()); generate.setCreateDept(station.getRefDept());
generate.setCreateUser(station.getCreateUser()); generate.setCreateUser(station.getCreateUser());
generate.setUpdateUser(station.getUpdateUser()); generate.setUpdateUser(station.getUpdateUser());
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time;
if(record.getTs().contains(".0")){
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE));
generate.setMonth(time.getMonth() + 1); generate.setMonth(time.getMonth() + 1);
if(StringUtil.isEmpty(record.getVal())){ if(StringUtil.isEmpty(record.getVal())){

64
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -633,6 +633,8 @@ public class RealTargetServiceImpl implements RealTargetService {
multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL));
multiAnalyzeCodePOList.add(multiAnalyzeCodePO); multiAnalyzeCodePOList.add(multiAnalyzeCodePO);
R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList); R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList);
if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData())){ if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData())){
WaterLevelVo waterLevelVo=new WaterLevelVo(); WaterLevelVo waterLevelVo=new WaterLevelVo();
waterLevelVo.setStationCode(item.getStationId()); waterLevelVo.setStationCode(item.getStationId());
@ -934,7 +936,12 @@ public class RealTargetServiceImpl implements RealTargetService {
} }
return datas.stream().map(data->{ return datas.stream().map(data->{
ActivePowerVo active = new ActivePowerVo(); ActivePowerVo active = new ActivePowerVo();
Date dateTime = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date dateTime;
if(data.getTs().contains(".0")){
dateTime = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
dateTime = DateUtil.parse(data.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
active.setHour(dateTime.getHours()); active.setHour(dateTime.getHours());
if (StringUtil.isBlank(data.getVal())) { if (StringUtil.isBlank(data.getVal())) {
active.setActivePower("0"); active.setActivePower("0");
@ -961,7 +968,12 @@ public class RealTargetServiceImpl implements RealTargetService {
} }
return records.stream().map(record -> { return records.stream().map(record -> {
UsrPowerVo usr = new UsrPowerVo(); UsrPowerVo usr = new UsrPowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time;
if(record.getTs().contains(".0")){
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
usr.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); usr.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE));
usr.setUsrPower(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); usr.setUsrPower(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0")));
return usr; return usr;
@ -991,7 +1003,12 @@ public class RealTargetServiceImpl implements RealTargetService {
} }
return records.stream().map(record -> { return records.stream().map(record -> {
PowerMonthVo generate = new PowerMonthVo(); PowerMonthVo generate = new PowerMonthVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time;
if(record.getTs().contains(".0")){
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE)); generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE));
if(StringUtil.isEmpty(record.getVal())){ if(StringUtil.isEmpty(record.getVal())){
generate.setPower(0f); generate.setPower(0f);
@ -1232,7 +1249,11 @@ public class RealTargetServiceImpl implements RealTargetService {
} }
return datas.stream().collect(Collectors.toMap( return datas.stream().collect(Collectors.toMap(
key-> { key-> {
Date dateTime = DateUtil.parse(key.getTs(), "yyyy-MM-dd HH:mm:ss.s"); if(key.getTs().contains(".0")){
Date dateTime = DateUtil.parse(key.getTs(), "yyyy-MM-dd HH:mm:ss.s");
return dateTime.getHours();
}
Date dateTime = DateUtil.parse(key.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
return dateTime.getHours(); return dateTime.getHours();
}, },
value -> { value -> {
@ -1404,7 +1425,12 @@ public class RealTargetServiceImpl implements RealTargetService {
} }
datas.addAll(records.stream().map(record -> { datas.addAll(records.stream().map(record -> {
PowerMonthVo generate = new PowerMonthVo(); PowerMonthVo generate = new PowerMonthVo();
Date time = DateUtil.parse(record.get("ts"), "yyyy-MM-dd HH:mm:ss.s"); Date time;
if(record.get("ts").contains(".0")){
time = DateUtil.parse(record.get("ts"), "yyyy-MM-dd HH:mm:ss.s");
}else{
time = DateUtil.parse(record.get("ts") + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE));
String val = record.get(HomePageConstant.HYDROPOWER_GENERATE_POWER); String val = record.get(HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(StringUtil.isEmpty(val)){ if(StringUtil.isEmpty(val)){
@ -1480,7 +1506,12 @@ public class RealTargetServiceImpl implements RealTargetService {
} }
return records.stream().map(record -> { return records.stream().map(record -> {
ActivePowerVo load = new ActivePowerVo(); ActivePowerVo load = new ActivePowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time;
if(record.getTs().contains(".0")){
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH")); load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH"));
load.setHour(time.getHours()); load.setHour(time.getHours());
if(StringUtil.isNotBlank(record.getVal())){ if(StringUtil.isNotBlank(record.getVal())){
@ -1508,7 +1539,12 @@ public class RealTargetServiceImpl implements RealTargetService {
} }
datas.addAll(records.stream().map(record -> { datas.addAll(records.stream().map(record -> {
PowerMonthVo generate = new PowerMonthVo(); PowerMonthVo generate = new PowerMonthVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time;
if(record.getTs().contains(".0")){
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE)); generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE));
if(StringUtil.isEmpty(record.getVal())){ if(StringUtil.isEmpty(record.getVal())){
generate.setPower(0f); generate.setPower(0f);
@ -1751,7 +1787,12 @@ public class RealTargetServiceImpl implements RealTargetService {
} }
return records.stream().map(record -> { return records.stream().map(record -> {
PhotovoltaicPowerVo load = new PhotovoltaicPowerVo(); PhotovoltaicPowerVo load = new PhotovoltaicPowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time;
if(records.get(0).getTs().contains(".0")){
time = DateUtil.parse(records.get(0).getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
time = DateUtil.parse(records.get(0).getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
load.setHour(time.getHours()); load.setHour(time.getHours());
load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0"));
return load; return load;
@ -1778,7 +1819,12 @@ public class RealTargetServiceImpl implements RealTargetService {
} }
return records.stream().map(record -> { return records.stream().map(record -> {
GenerationPowerVo generate = new GenerationPowerVo(); GenerationPowerVo generate = new GenerationPowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time;
if(record.getTs().contains(".0")){
time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
time = DateUtil.parse(record.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
generate.setDate(DateUtil.format(time, DateUtil.PATTERN_DATE)); generate.setDate(DateUtil.format(time, DateUtil.PATTERN_DATE));
generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0")));
return generate; return generate;

7
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java

@ -993,7 +993,12 @@ public class ReportServiceImpl implements ReportService {
} }
analyseDatas.addAll(data.getList().stream().peek(item->{ analyseDatas.addAll(data.getList().stream().peek(item->{
item.setSignage(data.getSignage()); item.setSignage(data.getSignage());
Date date = DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date date;
if(item.getTs().contains(".0")){
date = DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
date = DateUtil.parse(item.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
}
day.setTime(date); day.setTime(date);
item.setTs(String.valueOf(day.get(Calendar.DAY_OF_MONTH))); item.setTs(String.valueOf(day.get(Calendar.DAY_OF_MONTH)));
}).collect(Collectors.toList())); }).collect(Collectors.toList()));

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java

@ -456,7 +456,12 @@ public class HzimsDataServiceImpl implements HzimsDataService {
} }
datas.forEach(data->{ datas.forEach(data->{
ConverElectricityVo electricity = new ConverElectricityVo(); ConverElectricityVo electricity = new ConverElectricityVo();
Date date = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date date;
if(data.getTs().contains(".0")){
date = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s");
}else{
date = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss");
}
electricity.setTime(DateUtil.format(date,DateUtil.PATTERN_DATE)); electricity.setTime(DateUtil.format(date,DateUtil.PATTERN_DATE));
if(StringUtil.isEmpty(data.getVal())){ if(StringUtil.isEmpty(data.getVal())){
electricity.setElectricity(0.0); electricity.setElectricity(0.0);

Loading…
Cancel
Save