iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/ind/IndItemApi.java
@@ -1,15 +1,13 @@ package com.iailab.module.data.api.ind; import com.iailab.module.data.api.ind.dto.ApiIndItemDTO; import com.iailab.module.data.api.ind.dto.ApiIndItemQueryDTO; import com.iailab.module.data.api.ind.dto.ApiIndItemValueDTO; import com.iailab.module.data.enums.ApiConstants; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -31,4 +29,8 @@ @PostMapping(PREFIX + "/query-ind/history-value") @Operation(summary = "查询指标历史值") List<ApiIndItemValueDTO> queryIndItemHistoryValue(@RequestBody ApiIndItemQueryDTO dto); @GetMapping(PREFIX + "/info/id/{id}") @Operation(summary = "根据测点编号查询测点信息") ApiIndItemDTO getInfoById(@PathVariable("id") String id); } iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/ind/dto/ApiIndItemDTO.java
对比新文件 @@ -0,0 +1,33 @@ package com.iailab.module.data.api.ind.dto; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.Data; import java.io.Serializable; /** * @author PanZhibao * @Description * @createTime 2024年11月18日 */ @Data @Tag(name = "指标项") public class ApiIndItemDTO implements Serializable { private static final long serialVersionUID = 1L; @Schema(description = "ID") private String id; @Schema(description = "指标编码") private String itemNo; @Schema(description = "指标名称") private String itemName; @Schema(description = "指标分类") private String itemCategory; @Schema(description = "时间粒度") private String timeGranularity; } iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/plan/PlanItemApi.java
@@ -38,4 +38,8 @@ @GetMapping(PREFIX + "/info/no/{itemNo}") @Operation(summary = "根据测点编号查询测点信息") ApiPlanItemDTO getInfoByNo(@PathVariable("itemNo") String itemNo); @GetMapping(PREFIX + "/info/id/{id}") @Operation(summary = "根据测点编号查询测点信息") ApiPlanItemDTO getInfoById(@PathVariable("id") String id); } iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/enums/TimeGranularitySecEnum.java
对比新文件 @@ -0,0 +1,34 @@ package com.iailab.module.data.enums; import lombok.AllArgsConstructor; import lombok.Getter; /** * @author PanZhibao * @Description * @createTime 2024年11月18日 */ @Getter @AllArgsConstructor public enum TimeGranularitySecEnum { TG_MIN("min", 60), TG_HOUR("hour", 60 * 60), TG_DAY("day", 60 * 60 * 24); private String code; private Integer value; public static TimeGranularitySecEnum getEumByCode(String code) { if (code == null) { return null; } for (TimeGranularitySecEnum statusEnum : TimeGranularitySecEnum.values()) { if (statusEnum.getCode().equals(code)) { return statusEnum; } } return null; } } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/ind/IndItemApiImpl.java
@@ -1,9 +1,11 @@ package com.iailab.module.data.api.ind; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.data.api.ind.dto.ApiIndItemDTO; import com.iailab.module.data.api.ind.dto.ApiIndItemQueryDTO; import com.iailab.module.data.api.ind.dto.ApiIndItemValueDTO; import com.iailab.module.data.ind.collection.IndItemCollector; import com.iailab.module.data.ind.item.service.IndItemService; import com.iailab.module.data.ind.item.vo.IndItemValueVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; @@ -23,6 +25,10 @@ @Autowired private IndItemCollector indItemCollector; @Autowired private IndItemService indItemService; @Override public List<ApiIndItemValueDTO> queryIndItemDefaultValue(String itemNo){ List<IndItemValueVO> list = indItemCollector.queryValue(itemNo); return ConvertUtils.sourceToTarget(list, ApiIndItemValueDTO.class); @@ -33,4 +39,9 @@ List<IndItemValueVO> list = indItemCollector.queryValue(dto.getItemNo(), dto.getStart(), dto.getEnd()); return ConvertUtils.sourceToTarget(list, ApiIndItemValueDTO.class); } @Override public ApiIndItemDTO getInfoById(String id) { return ConvertUtils.sourceToTarget(indItemService.get(id), ApiIndItemDTO.class); } } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/plan/PlanItemApiImpl.java
@@ -59,4 +59,10 @@ return ConvertUtils.sourceToTarget(entity, ApiPlanItemDTO.class); } @Override public ApiPlanItemDTO getInfoById(String itemNo){ PlanItemEntity entity = planItemService.get(itemNo); return ConvertUtils.sourceToTarget(entity, ApiPlanItemDTO.class); } } iailab-module-data/iailab-module-data-biz/src/main/resources/application-dev.yaml
@@ -47,7 +47,7 @@ host: 172.16.8.100 # 地址 port: 6379 # 端口 database: 0 # 数据库索引 password: 123456 # 密码,建议生产环境开启 # password: 123456 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 #################### @@ -71,8 +71,7 @@ influx-db: org: iailab bucket: buk_shasteel token: Q2qsriQG3FEfZ35lik1KSkFToma3bsgfQLwJrNQfSK06MC569sZ9mrQ0vLtsVYn70HMfQcC9gf_yUG16JQtm8w== token: p-WkLXdPmHD4Cdij2PD-r92dLEQqjQ8V5KhyZYHYroBNVE0ZrW5VgzqWBNmXmiEdxEWaURC7rrKVzuM0XTEraQ== url: http://172.16.8.200:8086 username: root password: iailab12345678