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. 6
      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 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(); long sum = reals.stream().filter(real->entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId())).count();
if(Math.abs(sum) > 0){ 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; 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 javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Time; import java.sql.Time;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; 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(); 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();
} }

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

Loading…
Cancel
Save