From ca120d70593f7a29a150bb6fb17f8ff4cdfadbc8 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期三, 19 三月 2025 11:31:27 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/ApiPointValueDTO.java | 22 ++ iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PredictItemVO.java | 41 +++++ iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/AlarmMessageRespDTO.java | 55 ++++++ iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataChartRespVO.java | 34 ++++ iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/MmItemOutputDTO.java | 40 +++++ iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java | 56 ++++++ iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PowerRunStateDTO.java | 26 +++ iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataViewDTO.java | 82 ++++++++++ iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java | 17 ++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java | 20 ++ iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataSingleChartReqVO.java | 30 +++ iailab-plat-sdk/src/test/java/com/iailab/sdk/IailabClientTest.java | 7 12 files changed, 426 insertions(+), 4 deletions(-) diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java index 9affbfd..d498e79 100644 --- a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam; import java.math.BigDecimal; +import java.util.Date; import java.util.List; import java.util.Map; @@ -135,4 +136,20 @@ @Operation(summary = "修改图表参数配置") Boolean updateChartParam(@RequestBody ChartDTO chartDTO); + @GetMapping(PREFIX + "/item/output/itemId") + @Operation(summary = "获取") + MmItemOutputDTO getItemOutputByItemid(@RequestParam("itemid") String itemid, @RequestParam("resultstr")String resultstr, @RequestParam("resultIndex")String resultIndex); + + + @GetMapping(PREFIX + "/item/result") + @Operation(summary = "获取") + List<Object[]> getItemResult(@RequestParam("outputid") String outputid, @RequestParam("startTime") Date startTime, @RequestParam("endTime") Date endTime, @RequestParam("timeFormat") String timeFormat); + + @GetMapping(PREFIX + "/predict-item/itemNo") + @Operation(summary = "获取") + PredictItemVO getPredictItemByItemNo(@RequestParam("itemNo") String itemNo); + + @GetMapping(PREFIX + "/item/result/last-point") + @Operation(summary = "获取") + List<Object[]> getItemResultLastPoint(@RequestParam("outputid") String outputid, @RequestParam("startTime") Date startTime, @RequestParam("endTime") Date endTime, @RequestParam("timeFormat") String timeFormat); } \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/MmItemOutputDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/MmItemOutputDTO.java new file mode 100644 index 0000000..ebb623a --- /dev/null +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/MmItemOutputDTO.java @@ -0,0 +1,40 @@ +package com.iailab.module.model.api.mcs.dto; + +import lombok.Data; + +/** + * @author PanZhibao + * @date 2021年07月23日 10:13 + */ +@Data +public class MmItemOutputDTO { + /** + * 主键 + */ + private String id; + + /** + * 预测项ID + */ + private String itemid; + + /** + * 数据点ID + */ + private String pointid; + + /** + * 存放表ID + */ + private String resulttableid; + + /** + * 数据点名称 + */ + private String tagname; + + /** + * 预测项名称 + */ + private String itemname; +} diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PredictItemVO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PredictItemVO.java new file mode 100644 index 0000000..05414bd --- /dev/null +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PredictItemVO.java @@ -0,0 +1,41 @@ +package com.iailab.module.model.api.mcs.dto; + +import lombok.Data; + +import java.util.Date; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年09月01日 + */ +@Data +public class PredictItemVO { + private String id; + private String itemNo; + private String itemName; + private String itemType; + private Integer predictLength; + private Integer granularity; + private Integer status; + private Integer isFuse; + private Integer predictPhase; + private Integer workChecked; + private Integer isDisplay; + private Integer unitTransFactor; + + /** + * 保留的预测点位 (T+2 则n=2, T+30则n=30, T+n则表示从最后点位开始,n=预测长度;n由系统配置得出) + */ + private String saveIndex; + + /** + * 项目id + */ + private String mpkProjectId; + + /** + * 最后运行时间 + */ + private Date lastTime; +} \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java index 8cf7c27..c7ef32f 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java @@ -843,6 +843,26 @@ return true; } + @Override + public MmItemOutputDTO getItemOutputByItemid(String itemid, String resultstr, String resultIndex) { + return ConvertUtils.sourceToTarget(mmItemOutputService.getByItemid(itemid,resultstr,resultIndex),MmItemOutputDTO.class); + } + + @Override + public List<Object[]> getItemResult(String outputid, Date startTime, Date endTime, String timeFormat) { + return mmItemResultService.getData(outputid,startTime,endTime,timeFormat); + } + + @Override + public PredictItemVO getPredictItemByItemNo(String itemNo) { + return ConvertUtils.sourceToTarget(mmPredictItemService.getItemByItemNo(itemNo),PredictItemVO.class); + } + + @Override + public List<Object[]> getItemResultLastPoint(String outputid, Date startTime, Date endTime, String timeFormat) { + return mmItemResultLastPointService.getData(outputid,startTime,endTime,timeFormat); + } + private Date[] calResultTime(ItemVO predictItem, Date startTimeReq, Date endTimeReq, int lengthLeft, int lengthRight) { Date[] result = new Date[3]; Date predictTime = predictItem.getLastTime(); diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java index b97e900..667a51a 100644 --- a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java +++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java @@ -6,10 +6,7 @@ import com.iailab.sdk.auth.client.common.exception.enums.GlobalErrorCodeConstants; import com.iailab.sdk.auth.client.common.pojo.CommonResult; import com.iailab.sdk.auth.client.common.pojo.PageResult; -import com.iailab.sdk.auth.client.dto.ApiPointsValueQueryDTO; -import com.iailab.sdk.auth.client.dto.StAlarmAndSuggestPageReqDTO; -import com.iailab.sdk.auth.client.dto.StAlarmAndSuggestRespDTO; -import com.iailab.sdk.auth.client.dto.TokenDTO; +import com.iailab.sdk.auth.client.dto.*; import com.iailab.sdk.auth.config.SdkAutoConfiguration; import com.iailab.sdk.auth.constants.SdkErrorCodeConstants; import com.iailab.sdk.util.http.IailabHttpUtils; @@ -19,6 +16,7 @@ import org.springframework.util.Base64Utils; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.client.RestTemplate; import java.nio.charset.StandardCharsets; @@ -304,4 +302,54 @@ } return CommonResult.success(data); } + + /** + * 发电厂机组运行情况 + * @return + */ + public CommonResult<List<PowerRunStateDTO>> getPowerRunState() { + List<PowerRunStateDTO> list = new ArrayList<>(); + try { + String url = BASE_URL + "/ansteel/api/mcs/power-run-state/list"; + String resp = IailabHttpUtils.doGet(url, new HashMap<>(), "UTF-8"); + if (StringUtils.isEmpty(resp)) { + return CommonResult.error(GlobalErrorCodeConstants.EMPTY_RESP); + } + JSONObject jsonObject = JSON.parseObject(resp); + Integer respCode = jsonObject.getInteger(RESP_CODE); + if (!GlobalErrorCodeConstants.SUCCESS.getCode().equals(respCode)) { + CommonResult.error(respCode, jsonObject.getString(RESP_MSG)); + } + Long total = Long.parseLong(jsonObject.getJSONObject(RESP_DATA).get("total").toString()); + list = jsonObject.getJSONObject(RESP_DATA).getJSONArray("list").toJavaList(PowerRunStateDTO.class); + } catch (Exception ex) { + return CommonResult.error(GlobalErrorCodeConstants.UNKNOWN.getCode(), ex.getMessage()); + } + return CommonResult.success(list); + } + + /** + * 预测数据图表 + * @param reqVO + * @return + */ + public CommonResult<PreDataChartRespVO> getPreDataChart(PreDataSingleChartReqVO reqVO) { + PreDataChartRespVO respVO = new PreDataChartRespVO(); + try { + String url = BASE_URL + "/ansteel/api/mcs/predict-data/charts"; + String resp = IailabHttpUtils.doPost(url, JSON.toJSONString(reqVO), "UTF-8"); + if (StringUtils.isEmpty(resp)) { + return CommonResult.error(GlobalErrorCodeConstants.EMPTY_RESP); + } + JSONObject jsonObject = JSON.parseObject(resp); + Integer respCode = jsonObject.getInteger(RESP_CODE); + if (!GlobalErrorCodeConstants.SUCCESS.getCode().equals(respCode)) { + CommonResult.error(respCode, jsonObject.getString(RESP_MSG)); + } + respVO = jsonObject.getJSONObject(RESP_DATA).toJavaObject(PreDataChartRespVO.class); + } catch (Exception ex) { + return CommonResult.error(GlobalErrorCodeConstants.UNKNOWN.getCode(), ex.getMessage()); + } + return CommonResult.success(respVO); + } } \ No newline at end of file diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/AlarmMessageRespDTO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/AlarmMessageRespDTO.java new file mode 100644 index 0000000..8a5ba62 --- /dev/null +++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/AlarmMessageRespDTO.java @@ -0,0 +1,55 @@ +package com.iailab.sdk.auth.client.dto; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年08月29日 + */ + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年08月29日 + */ +@Data +public class AlarmMessageRespDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String id; + + private String configId; + + private String title; + + private String content; + + private String alarmObj; + + private String pointId; + + private String itemId; + + private BigDecimal currentValue; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date outTime; + + private BigDecimal outValue; + + private String alarmType; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date alarmTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; + +} \ No newline at end of file diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/ApiPointValueDTO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/ApiPointValueDTO.java new file mode 100644 index 0000000..d74dbeb --- /dev/null +++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/ApiPointValueDTO.java @@ -0,0 +1,22 @@ +package com.iailab.sdk.auth.client.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年08月19日 + */ +@Data +public class ApiPointValueDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date t; + + private double v; +} \ No newline at end of file diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PowerRunStateDTO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PowerRunStateDTO.java new file mode 100644 index 0000000..09099ec --- /dev/null +++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PowerRunStateDTO.java @@ -0,0 +1,26 @@ +package com.iailab.sdk.auth.client.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author lirm + * @date 2025年03月13日 + */ +@Data +public class PowerRunStateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String id; + private String machineName; + private String qhRate; + private String fhRate; + private String gasTotal; + private String gasCost; + private String gasSurplus; + private String bfg; + private String ldg; + private String cog; +} diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataChartRespVO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataChartRespVO.java new file mode 100644 index 0000000..8193b1b --- /dev/null +++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataChartRespVO.java @@ -0,0 +1,34 @@ +package com.iailab.sdk.auth.client.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年11月18日 + */ +@Data +public class PreDataChartRespVO implements Serializable { + private static final long serialVersionUID = 1L; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date predictTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date startTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date endTime; + + private List<String> legend; + + private List<String> categories; + + private PreDataViewDTO dataView; + +} \ No newline at end of file diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataSingleChartReqVO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataSingleChartReqVO.java new file mode 100644 index 0000000..b15bd6f --- /dev/null +++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataSingleChartReqVO.java @@ -0,0 +1,30 @@ +package com.iailab.sdk.auth.client.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年11月18日 + */ +@Data +public class PreDataSingleChartReqVO implements Serializable { + private static final long serialVersionUID = 1L; + + private String chartCode; + + private String timeFormat; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date predictTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date startTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date endTime; +} \ No newline at end of file diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataViewDTO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataViewDTO.java new file mode 100644 index 0000000..4da8f64 --- /dev/null +++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataViewDTO.java @@ -0,0 +1,82 @@ +package com.iailab.sdk.auth.client.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年08月26日 + */ +@Data +public class PreDataViewDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private String itemId; + + private String itemName; + + private String outId; + + private String resultstr; + + private String resultName; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date predictTime; + + private BigDecimal rangeH; + + private BigDecimal rangeL; + + private BigDecimal deadLineH; + + private BigDecimal deadLineL; + + private BigDecimal limitH; + + private BigDecimal limitL; + + private List<ApiPointValueDTO> trendsDataH; + + private List<ApiPointValueDTO> trendsDataL; + + private BigDecimal currValue; + + private BigDecimal maxValue; + + private BigDecimal minValue; + + private BigDecimal hisMax; + + private BigDecimal hisMin; + + private BigDecimal hisCumulant; + + private BigDecimal preMax; + + private BigDecimal preMin; + + private BigDecimal preLast; + + private BigDecimal preCumulant; + + private List<Object[]> realData; + + private List<Object[]> preData; + + private List<AlarmMessageRespDTO> alarmList; + + private String alarmMessage; + + private String lineType; + + private List<Object[]> cumulantRealData; + + private List<Object[]> cumulantPreData; +} \ No newline at end of file diff --git a/iailab-plat-sdk/src/test/java/com/iailab/sdk/IailabClientTest.java b/iailab-plat-sdk/src/test/java/com/iailab/sdk/IailabClientTest.java index 13fc2ca..aff430f 100644 --- a/iailab-plat-sdk/src/test/java/com/iailab/sdk/IailabClientTest.java +++ b/iailab-plat-sdk/src/test/java/com/iailab/sdk/IailabClientTest.java @@ -2,6 +2,7 @@ import com.iailab.sdk.auth.client.IailabClient; import com.iailab.sdk.auth.client.common.pojo.CommonResult; +import com.iailab.sdk.auth.client.dto.PowerRunStateDTO; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -54,4 +55,10 @@ System.out.println(stringObjectMap); } + @Test + public void testGetPowerRunState() { + CommonResult<List<PowerRunStateDTO>> list = IailabClient.getInstance().getPowerRunState(); + System.out.println(list); + } + } -- Gitblit v1.9.3