Browse Source

#配电比支持小数

zhongwei
yang_shj 8 months ago
parent
commit
1ef2d1e4df
  1. 6
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/EminfoAndEmParamVo.java
  2. 26
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  3. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java
  4. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java

6
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/EminfoAndEmParamVo.java

@ -16,15 +16,15 @@ public class EminfoAndEmParamVo extends EmInfoExtendVo {
@ApiModelProperty(value = "ct")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ct;
private Double ct;
@ApiModelProperty(value = "pt")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer pt;
private Double pt;
@ApiModelProperty(value = "ct * pt")
@JsonSerialize(nullsUsing = NullSerializer.class)
private int rideCount;
private Double rideCount;
@ApiModelProperty(value = "经度")
@JsonSerialize(nullsUsing = NullSerializer.class)

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

@ -129,7 +129,7 @@ public class RealTargetServiceImpl implements RealTargetService {
});
// 设备遍历
devices.forEach(item->{
item.setRideCount(1);
item.setRideCount(1.0);
item.setInstalledCapacity(0.0);
// 站点设置
if(CollectionUtil.isNotEmpty(stations)){
@ -152,10 +152,10 @@ public class RealTargetServiceImpl implements RealTargetService {
String param_name = param.getParamName();
switch (param_name){
case "ct":
item.setCt(Integer.valueOf(param.getParamValue()));
item.setCt(Double.valueOf(param.getParamValue()));
break;
case "pt":
item.setPt(Integer.valueOf(param.getParamValue()));
item.setPt(Double.valueOf(param.getParamValue()));
break;
case "installedCapacity":
item.setInstalledCapacity(Double.valueOf(param.getParamValue()));
@ -744,7 +744,11 @@ public class RealTargetServiceImpl implements RealTargetService {
PowerMonthVo generate = new PowerMonthVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE));
generate.setPower(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
if(StringUtil.isEmpty(record.getVal())){
generate.setPower(0f);
}else{
generate.setPower(Float.parseFloat(String.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount())));
}
return generate;
}).collect(Collectors.toMap(PowerMonthVo::getStrMonth,PowerMonthVo::getPower));
}
@ -1161,7 +1165,11 @@ public class RealTargetServiceImpl implements RealTargetService {
PowerMonthVo generate = new PowerMonthVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE));
generate.setPower(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
if(StringUtil.isEmpty(record.getVal())){
generate.setPower(0f);
}else{
generate.setPower(Float.parseFloat(String.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount())));
}
return generate;
}).collect(Collectors.toList()));
});
@ -1320,7 +1328,7 @@ public class RealTargetServiceImpl implements RealTargetService {
* @param type
* @return
*/
private float sumValueByTime(String deviceCode, int rideCount, String type) {
private float sumValueByTime(String deviceCode, Double rideCount, String type) {
Calendar calendar = Calendar.getInstance();
String start, end;
int cycleType = 3;
@ -1612,7 +1620,11 @@ public class RealTargetServiceImpl implements RealTargetService {
GenerationPowerVo generate = new GenerationPowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE));
generate.setGenerate(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
if(StringUtil.isEmpty(record.getVal())){
generate.setGenerate(0f);
}else{
generate.setGenerate(Float.parseFloat(String.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount())));
}
return generate;
}).collect(Collectors.toList());
}

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java

@ -23,5 +23,5 @@ public interface DataService {
List<AnalyseDataTaosVO> periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages);
Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Integer ride ,String signages);
Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Double ride ,String signages);
}

7
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java

@ -118,7 +118,7 @@ public class DataServiceImpl implements DataService {
* @return
*/
@Override
public Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Integer ride,String signages) {
public Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Double ride,String signages) {
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
@ -154,7 +154,10 @@ public class DataServiceImpl implements DataService {
if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) {
return 0f;
}
return Float.parseFloat(Optional.ofNullable(analyseDataTaosVO.getVal()).orElse("0")) * ride;
if(StringUtil.isEmpty(analyseDataTaosVO.getVal())){
return 0f;
}
return Float.parseFloat(String.valueOf(Double.parseDouble(analyseDataTaosVO.getVal()) * ride));
}

Loading…
Cancel
Save