diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/ControlEntity.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/ControlEntity.java new file mode 100644 index 0000000..889b04a --- /dev/null +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/ControlEntity.java @@ -0,0 +1,59 @@ +package com.hnac.hzims.bigmodel.maintenance.entity; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.SqlCondition; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/08/19 18:33 + */ +@Data +@EqualsAndHashCode +@ApiModel("设备控制实体类") +@TableName("data_yk") +public class ControlEntity extends TenantEntity implements Serializable { + + @ApiModelProperty(value = "itemId",required = true) + private String itemId; + + @ApiModelProperty(value = "站点名称",required = true) + @QueryField(condition = SqlCondition.LIKE) + private String stationName; + + @ApiModelProperty(value = "站点ID") + @QueryField(condition = SqlCondition.EQUAL) + private String stationId; + + @ApiModelProperty(value = "遥控的设备名称") + @QueryField(condition = SqlCondition.LIKE) + private String deviceName; + + @ApiModelProperty(value = "遥控的设备ID") + @QueryField(condition = SqlCondition.EQUAL) + private String deviceId; + + @TableField("yk_name") + @JSONField(name = "yk_name") + @ApiModelProperty(value = "遥控名称(不包含站点)",required = true) + @QueryField(condition = SqlCondition.LIKE) + private String remoteName; + + @ApiModelProperty(value = "用于展示和匹配的全称,一般可设为 站点名称-遥控名称",required = true) + @QueryField(condition = SqlCondition.LIKE) + private String itemName; + + @ApiModelProperty(value = "类型,可为平台、业务",required = true) + @QueryField(condition = SqlCondition.LIKE) + private String type; + +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDeviceVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDeviceVo.java deleted file mode 100644 index f3ce2b7..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDeviceVo.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.hnac.hzims.operational.homePage.Hydroelectric.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author ysj - */ -@Data -@ApiModel(value = "站点首页-设备信息") -public class HydroelectricDeviceVo { - - @ApiModelProperty(value = "设备编号") - private String deivceCode; - - @ApiModelProperty(value = "设备名称") - private String deivceName; - - @ApiModelProperty(value = "开关机状态: 0 - 关机 1 - 开机") - private Boolean state; - - @ApiModelProperty(value = "总装机容量") - private Double installedCapacity; - - @ApiModelProperty(value = "有功功率") - private Double activePower; - - @ApiModelProperty(value = "容量利用率") - private Double capacityRate; - - @ApiModelProperty(value = "无功功率") - private Double reactivePower; - - @ApiModelProperty(value = "导叶开度") - private Double guideOpen; - - @ApiModelProperty(value = "今日发电量") - private Float powerDay; - - @ApiModelProperty(value = "昨日发电量") - private Float powerYesterDay; - - @ApiModelProperty(value = "当年发电量") - private Float powerYear; - - @ApiModelProperty(value = "去年发电量") - private Float powerYesterYear; - - @ApiModelProperty(value = "当月发电量") - private Float powerMon; - - @ApiModelProperty(value = "本次开机时间") - private String startDownTime; - - @ApiModelProperty(value = "本次开机时长") - private Double startupDownDuration; - - @ApiModelProperty(value = "年停机时长") - private Double shutDownDurationYear; - - @ApiModelProperty(value = "年开机时长") - private Double startupDurationYear; - - @ApiModelProperty(value = "设备近24小时有功功率") - private List powers; - - @ApiModelProperty(value = "设备近30日发电量") - private List generates; -} \ No newline at end of file diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricPowerRainVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricPowerRainVo.java deleted file mode 100644 index a2aae0e..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricPowerRainVo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hnac.hzims.operational.homePage.Hydroelectric.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author ysj - */ -@Data -@ApiModel(value = "站点首页-最近30日发电量/降雨量") -public class HydroelectricPowerRainVo { - - @ApiModelProperty(value = "日期") - private String date; - - @ApiModelProperty(value = "发电量") - private Double generate; - - @ApiModelProperty(value = "降雨") - private Double rain; -} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/constant/HydroelectricConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/constant/HydroelectricConstant.java similarity index 100% rename from hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/constant/HydroelectricConstant.java rename to hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/constant/HydroelectricConstant.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricAreaStationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricAreaStationVo.java similarity index 100% rename from hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricAreaStationVo.java rename to hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricAreaStationVo.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricAreaVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricAreaVo.java similarity index 97% rename from hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricAreaVo.java rename to hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricAreaVo.java index 14b6f1b..2266d43 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricAreaVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricAreaVo.java @@ -54,7 +54,7 @@ public class HydroelectricAreaVo { @JsonSerialize(nullsUsing = NullSerializer.class) private Double generatePlanYear; - @ApiModelProperty(value = "电量完成吕") + @ApiModelProperty(value = "电量完成率") @JsonSerialize(nullsUsing = NullSerializer.class) private Double generateRate; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDeviceGenerateVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricDeviceGenerateVo.java similarity index 100% rename from hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDeviceGenerateVo.java rename to hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricDeviceGenerateVo.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDevicePowerVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricDevicePowerVo.java similarity index 100% rename from hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricDevicePowerVo.java rename to hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricDevicePowerVo.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricGenerateMonVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricGenerateMonVo.java similarity index 100% rename from hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricGenerateMonVo.java rename to hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricGenerateMonVo.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricGenerateYearVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricGenerateYearVo.java similarity index 100% rename from hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricGenerateYearVo.java rename to hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricGenerateYearVo.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricGroupAreaVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricGroupAreaVo.java similarity index 100% rename from hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricGroupAreaVo.java rename to hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricGroupAreaVo.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricGroupVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricGroupVo.java similarity index 100% rename from hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricGroupVo.java rename to hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricGroupVo.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricStationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java similarity index 93% rename from hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricStationVo.java rename to hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java index ad3b959..320c530 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/Hydroelectric/vo/HydroelectricStationVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java @@ -60,9 +60,9 @@ public class HydroelectricStationVo { @ApiModelProperty(value = "设备集合") private List devices; - @ApiModelProperty(value = "降雨/发电量曲线") + @ApiModelProperty(value = "降雨曲线") private List powerRains; - @ApiModelProperty(value = "降雨/发电量曲线") + @ApiModelProperty(value = "发电量曲线") private List generateMons; } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeApi.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeApi.java index d6365af..c11b4b6 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeApi.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeApi.java @@ -56,4 +56,10 @@ public class BigModelInvokeApi { * 起数据分析问答 */ private String assistantAnalyseAsk; + + /** + * 更新数据 + */ + private String updateKnowledge; + } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IHznlmInvokeService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IHznlmInvokeService.java index 1833f09..51ed3f3 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IHznlmInvokeService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IHznlmInvokeService.java @@ -87,4 +87,10 @@ public interface IHznlmInvokeService { */ void smartReportGeneratePower(RunReportAnalyseRequest req); + /** + * 更新数据 + * @param name 数据名 + */ + void updateKnowledge(String name); + } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java index 90074ba..b8bdb15 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java @@ -145,6 +145,13 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { } @Override + public void updateKnowledge(String name) { + Map params = new HashMap<>(); + params.put("name",name); + RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getUpdateKnowledge(), params); + } + + @Override public List hotQuestions() { try { return RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getHotQuestion(), null, new TypeReference>(){}); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/ControlController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/ControlController.java new file mode 100644 index 0000000..17f18bc --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/ControlController.java @@ -0,0 +1,74 @@ +package com.hnac.hzims.bigmodel.maintenance.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService; +import com.hnac.hzims.bigmodel.maintenance.entity.ControlEntity; +import com.hnac.hzims.bigmodel.maintenance.entity.DatasourceEntity; +import com.hnac.hzims.bigmodel.maintenance.service.ControlService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; + +/** + * @Author: huangxing + * @Date: 2024/08/19 18:50 + */ +@RestController +@RequestMapping("/control") +@Api(tags = "设备控制指令管理",value = "设备控制指令管理") +@AllArgsConstructor +public class ControlController { + + private final ControlService service; + private final IHznlmInvokeService invokeService; + + @GetMapping("/listPage") + @ApiOperation(value = "分页查询") + @ApiOperationSupport(order = 1) + public R> listPage(Query query, ControlEntity req) { + return R.data(service.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda())); + } + + @GetMapping("/detail") + @ApiOperation(value = "查看详情") + @ApiOperationSupport(order = 2) + public R detail(@RequestParam @ApiParam("主键ID") Long id) { + return R.data(service.getById(id)); + } + + @PostMapping("/save") + @ApiOperation(value = "保存设备控制指令配置") + @ApiOperationSupport(order = 3) + public R save(@RequestBody ControlEntity req) { + return R.status(service.save(req)); + } + + @DeleteMapping("/remove") + @ApiOperation(value = "删除设备控制指令配置") + @ApiOperationSupport(order = 4) + public R remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) { + return R.status(service.removeByIds(Func.toLongList(",",ids))); + } + + @PutMapping("/updateById") + @ApiOperation(value = "编辑设备控制指令") + @ApiOperationSupport(order = 5) + public R updateById(@RequestBody ControlEntity req) { + return R.status(service.updateById(req)); + } + + @PutMapping("/updateKnowledge") + @ApiOperation(value = "更新设备控制知识库") + @ApiOperationSupport(order = 6) + public R updateKnowledge() { + invokeService.updateKnowledge("yk"); + return R.success("操作成功!"); + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/ControlMapper.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/ControlMapper.java new file mode 100644 index 0000000..470d734 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/ControlMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.bigmodel.maintenance.mapper; + +import com.hnac.hzims.bigmodel.maintenance.entity.ControlEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @Author: huangxing + * @Date: 2024/08/19 18:42 + */ +public interface ControlMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/ControlService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/ControlService.java new file mode 100644 index 0000000..264e7ef --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/ControlService.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.bigmodel.maintenance.service; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.bigmodel.maintenance.entity.ControlEntity; +import com.hnac.hzims.bigmodel.maintenance.mapper.ControlMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @Author: huangxing + * @Date: 2024/08/19 18:48 + */ +@Service +@DS("hznlm") +@AllArgsConstructor +@Slf4j +public class ControlService extends ServiceImpl { + +} diff --git a/hzims-service/hzims-big-model/src/main/resources/template/template.yml b/hzims-service/hzims-big-model/src/main/resources/template/template.yml index be2f075..77287f6 100644 --- a/hzims-service/hzims-big-model/src/main/resources/template/template.yml +++ b/hzims-service/hzims-big-model/src/main/resources/template/template.yml @@ -61,6 +61,7 @@ gglm: hotQuestion: "/qa/question_recommand" smartReportGeneratePower: "/custom/smart_report_generate_power" assistantAnalyseAsk: "/qa/assistant_analyse_ask" + updateKnowledge: "/kn/update_knowledge" swagger: base-packages: com.hnac.hzims.bigmodel diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java index aef388a..cbec557 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java @@ -254,7 +254,7 @@ public class HydroelectricServiceImpl implements HydroelectricService { // 日发电量 area.setGenerateDay(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum()); // 年计划发电量 - area.setGeneratePlanYear(planClient.getPlanPowerYear(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), DateUtil.format(new Date(),"yyyy"))); + area.setGeneratePlanYear(plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); if(area.getGeneratePlanYear() <= 0 || area.getGenerateYear() <= 0){ area.setGenerateRate(0.0); }else{