Browse Source

#填报发电量保存

zhongwei
yang_shj 6 months ago
parent
commit
afbab4cc47
  1. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/feign/GenerateClient.java
  2. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java
  3. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/feign/GenerateClient.java

@ -6,10 +6,12 @@ import com.hnac.hzims.operational.fill.service.GenerateService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List; import java.util.List;
@ -28,9 +30,10 @@ public class GenerateClient implements IGenerateClient {
public Double stationGenerateByTime(@RequestParam("stationId") String stationId, public Double stationGenerateByTime(@RequestParam("stationId") String stationId,
@RequestParam("startTime") String startTime, @RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime) { @RequestParam("endTime") String endTime) {
Date start = DateUtil.parse(startTime,DateUtil.PATTERN_DATETIME);
List<GenerateEntity> generates = generateService.list(Wrappers.<GenerateEntity>lambdaQuery() List<GenerateEntity> generates = generateService.list(Wrappers.<GenerateEntity>lambdaQuery()
.eq(GenerateEntity::getStationCode,stationId) .eq(GenerateEntity::getStationCode,stationId)
.ge(GenerateEntity::getFillDate,startTime) .ge(GenerateEntity::getFillDate,DateUtil.format(start,DateUtil.PATTERN_DATE))
.le(GenerateEntity::getFillDate,endTime) .le(GenerateEntity::getFillDate,endTime)
); );
if(CollectionUtil.isEmpty(generates)){ if(CollectionUtil.isEmpty(generates)){

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

@ -258,7 +258,7 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
while (end.compareTo(start) > 0){ while (end.compareTo(start) > 0){
entity.setId(null); entity.setId(null);
entity.setFillDate(DateUtil.format(start,DateUtil.PATTERN_DATE)); entity.setFillDate(DateUtil.format(start,DateUtil.PATTERN_DATE));
entity.setGenerate((random.nextDouble() * 2800) + 12000); entity.setGenerate((random.nextDouble() * 1360) + 19000);
this.save(entity); this.save(entity);
calendar.add(Calendar.DAY_OF_MONTH,1); calendar.add(Calendar.DAY_OF_MONTH,1);
start = calendar.getTime(); start = calendar.getTime();

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

@ -631,6 +631,8 @@ public class HydropowerServiceImpl implements HydropowerService {
// 年发电量 // 年发电量
kpi.setGenerateYear(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum()); kpi.setGenerateYear(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum());
// 月发电量 // 月发电量
kpi.setGenerateMon(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum()); kpi.setGenerateMon(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum());
// 日发电量 // 日发电量
kpi.setGenerateDay(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum()); kpi.setGenerateDay(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum());

Loading…
Cancel
Save