Browse Source

#站点修改测试

zhongwei
yang_shj 1 year ago
parent
commit
61d731589c
  1. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  2. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  3. 24
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -1149,7 +1149,7 @@ public class HydropowerServiceImpl implements HydropowerService {
long on = reals.stream().filter(real -> entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId()) && real.getState()).count();
long sum = reals.stream().filter(real->entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId())).count();
if(Math.abs(sum) > 0){
scale.setDeviceUse(BigDecimal.valueOf(on / sum * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
scale.setDeviceUse(BigDecimal.valueOf(on / (double)sum * 100).setScale(1, RoundingMode.HALF_UP).doubleValue());
}
}
return scale;

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java

@ -57,6 +57,7 @@ import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
@ -1139,7 +1140,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
}
// 机组开机总数
int onOffCount = map.entrySet().stream().filter(o->deptIds.contains(o.getKey())).mapToInt(vo-> vo.getValue().getStartingUpCount()).sum();
return BigDecimal.valueOf(onOffCount / (double)unitSumCount * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
return BigDecimal.valueOf(onOffCount / (double)unitSumCount * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
}

24
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -95,11 +95,11 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
});
Optional<Integer> sort = Optional.ofNullable(this.getStationMaxOrder());
req.setSort(sort.isPresent() ? sort.get() + 1 : 1);
this.pushStation(req);
boolean updateResult = this.saveOrUpdate(req);
Assert.isTrue(updateResult, () -> {
throw new ServiceException("创建/修改站点信息失败!");
});
this.pushStation(req);
}
/**
@ -130,6 +130,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
new Thread(dataPush,"数据平台站点推送").start();
boolean flag;
try {
log.error("pushStationsend : {},{}",fdpPush.get(),dataPush.get());
flag = fdpPush.get().isSuccess() && dataPush.get().isSuccess();
}
catch (ExecutionException e) {
@ -147,18 +148,15 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
if (Func.isEmpty(req.getSecretKey()) || Func.isEmpty(req.getDataSource())) {
return true;
}
if (super.updateById(req)) {
ProjectDTO projectDTO = new ProjectDTO();
projectDTO.setName(req.getName());
projectDTO.setSource(1);
projectDTO.setSecretKey(req.getSecretKey());
projectDTO.setListenKind(req.getDataSource());
projectDTO.setId(req.getCode());
Result result = projectClient.saveOrUpdate(projectDTO);
logger.info("operational:station:buildStation:" + req.getCode(), JSON.toJSONString(result));
return result.getCode() == ResultCode.SUCCESS.getCode() && result.isSuccess();
}
return false;
ProjectDTO projectDTO = new ProjectDTO();
projectDTO.setName(req.getName());
projectDTO.setSource(1);
projectDTO.setSecretKey(req.getSecretKey());
projectDTO.setListenKind(req.getDataSource());
projectDTO.setId(req.getCode());
Result result = projectClient.saveOrUpdate(projectDTO);
logger.info("operational:station:buildStation:" + req.getCode(), JSON.toJSONString(result));
return result.getCode() == ResultCode.SUCCESS.getCode() && result.isSuccess();
}
@Override

Loading…
Cancel
Save