Browse Source

#大模型发电量修改

zhongwei
yang_shj 8 months ago
parent
commit
4c1eb9c1d2
  1. 26
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/feign/IGenerateClient.java
  2. 15
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/feign/IGenerateClientFallback.java
  3. 9
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java
  4. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java
  5. 31
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java
  6. 38
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/feign/GenerateClient.java

26
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/feign/IGenerateClient.java

@ -0,0 +1,26 @@
package com.hnac.hzims.operational.fill.feign;
import com.hnac.hzims.operational.OperationalConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author ysj
*/
@FeignClient(
value = OperationalConstants.APP_NAME,
fallback = IGenerateClientFallback.class
)
public interface IGenerateClient {
String API_PREFIX = "/feign/generate/";
String STATION_GENERATE_BY_TIME = API_PREFIX + "/stationGenerateByTime";
@GetMapping(STATION_GENERATE_BY_TIME)
Double stationGenerateByTime(@RequestParam("stationId") String stationId,
@RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime);
}

15
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/feign/IGenerateClientFallback.java

@ -0,0 +1,15 @@
package com.hnac.hzims.operational.fill.feign;
import org.springframework.stereotype.Component;
/**
* @author hx
*/
@Component
public class IGenerateClientFallback implements IGenerateClient {
@Override
public Double stationGenerateByTime(String stationId, String startTime, String endTime) {
return 0.0;
}
}

9
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java

@ -77,4 +77,13 @@ public class InteractiveController {
public R sendRemoteControl(@RequestBody ControlDTO operate) { public R sendRemoteControl(@RequestBody ControlDTO operate) {
return interactiveService.sendRemoteControl(operate); return interactiveService.sendRemoteControl(operate);
} }
@ApiOperation("站点发电量")
@ApiOperationSupport(order = 7)
@RequestMapping(value = "/generation",method = {RequestMethod.GET,RequestMethod.POST})
public R generation(@RequestParam @ApiParam("站点编号") String stationId,
@RequestParam @ApiParam("开始时间") String startTime,
@RequestParam @ApiParam("结束时间")String endTime) {
return R.data(interactiveService.generation(stationId,startTime,endTime) + "kwh");
}
} }

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java

@ -43,4 +43,6 @@ public interface IInteractiveService {
R knowledgeAsk(String question, String sessionId, String userId, String knowledge); R knowledgeAsk(String question, String sessionId, String userId, String knowledge);
R<Object> sendRemoteControl(ControlDTO operate); R<Object> sendRemoteControl(ControlDTO operate);
Double generation(String stationId, String startTime, String endTime);
} }

31
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java

@ -14,6 +14,9 @@ import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService;
import com.hnac.hzims.bigmodel.interactive.service.IJumpPageService; import com.hnac.hzims.bigmodel.interactive.service.IJumpPageService;
import com.hnac.hzims.bigmodel.interactive.service.IParamsService; import com.hnac.hzims.bigmodel.interactive.service.IParamsService;
import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO; import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO;
import com.hnac.hzims.operational.fill.feign.IGenerateClient;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.xxl.job.core.log.XxlJobLogger; import com.xxl.job.core.log.XxlJobLogger;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -54,6 +57,10 @@ public class InteractiveServiceImpl implements IInteractiveService {
private final IRemoteClient remoteClient; private final IRemoteClient remoteClient;
private final IStationClient stationClient;
private final IGenerateClient generateClient;
private final IJumpPageService jumpPageService; private final IJumpPageService jumpPageService;
private final IParamsService paramsService; private final IParamsService paramsService;
@ -277,4 +284,28 @@ public class InteractiveServiceImpl implements IInteractiveService {
public R<Object> sendRemoteControl(ControlDTO operate) { public R<Object> sendRemoteControl(ControlDTO operate) {
return remoteClient.sendCtrl(operate); return remoteClient.sendCtrl(operate);
} }
/**
* 站点发电量
* @param stationId
* @param startTime
* @param endTime
* @return
*/
@Override
public Double generation(String stationId, String startTime, String endTime) {
// 步骤1.查询站点
R<StationEntity> station = stationClient.getStationByCode(stationId);
if(!station.isSuccess() || ObjectUtil.isEmpty(station.getData())){
return 0.0;
}
// 步骤2.查询填报发电量
double fill = generateClient.stationGenerateByTime(stationId,startTime,endTime);
// 步骤3.查询设备
// 步骤4.遍历设备查询发电量
return fill;
}
} }

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

@ -0,0 +1,38 @@
package com.hnac.hzims.operational.fill.feign;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.fill.service.GenerateService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author ysj
*/
@RestController
@Slf4j
@AllArgsConstructor
public class GenerateClient implements IGenerateClient {
private final GenerateService generateService;
@Override
@GetMapping(STATION_GENERATE_BY_TIME)
public Double stationGenerateByTime(String stationId, String startTime, String endTime) {
List<GenerateEntity> generates = generateService.list(Wrappers.<GenerateEntity>lambdaQuery()
.eq(GenerateEntity::getStationCode,stationId)
.ge(GenerateEntity::getFillDate,startTime)
.le(GenerateEntity::getGenerate,endTime)
);
if(CollectionUtil.isEmpty(generates)){
return 0.0;
}
return generates.stream().mapToDouble(GenerateEntity::getGenerate).sum();
}
}
Loading…
Cancel
Save