From a82313d17b2b5d1c02e880122efc1b701c401dcf Mon Sep 17 00:00:00 2001 From: houzhongjian <houzhongyi@126.com> Date: 星期三, 04 十二月 2024 09:58:58 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/PointImportExcelVO.java | 9 ++++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/DaPointExcelVO.java | 12 ++++++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleSchemeEntity.java | 5 ++ iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java | 30 +++++++++++---- iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml | 5 ++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java | 2 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java | 4 +- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java | 18 ++++++--- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeRespVO.java | 3 + iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java | 2 iailab-module-model/iailab-module-model-biz/db/mysql.sql | 7 ++- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java | 2 + iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkScheduleReqDTO.java | 4 -- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java | 3 + iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeSaveReqVO.java | 5 ++ 16 files changed, 85 insertions(+), 28 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java index 8bc84b7..8482d62 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java @@ -137,6 +137,8 @@ dataList.addAll(ConvertUtils.sourceToTarget(mathPointList, DaPointExcelVO.class)); List<DaPointDTO> constantPointList = daPointService.getConstantPoint(exportReqVO); dataList.addAll(ConvertUtils.sourceToTarget(constantPointList, DaPointExcelVO.class)); + List<DaPointDTO> cumulatePointList = daPointService.getCumulatePoint(exportReqVO); + dataList.addAll(ConvertUtils.sourceToTarget(cumulatePointList, DaPointExcelVO.class)); ExcelUtils.write(response, "测点列表.xls", "测点列表", DaPointExcelVO.class, dataList); } @@ -193,7 +195,6 @@ @Parameter(name = "file", description = "Excel 文件", required = true), @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") }) -// @PreAuthorize("@ss.hasPermission('data:point:import')") public CommonResult<PointImportRespVO> importExcel(@RequestParam("file") MultipartFile file, @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception { List<PointImportExcelVO> list = ExcelUtils.read(file, PointImportExcelVO.class); diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java index d2bb00c..34bc23e 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java @@ -45,6 +45,8 @@ List<DaPointDTO> getCumulatePoint(String freq); + List<DaPointDTO> getCumulatePoint(DaPointPageReqVO reqVO); + DaPointDTO getByNo(String pointNo); List<DaPointDTO> getByNos(List<String> pointNos); diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java index 000e7e4..2374f2f 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java @@ -215,10 +215,11 @@ @Override @DSTransactional(rollbackFor = Exception.class) - public void delete(String[] id) { - daPointDao.deleteBatchIds(Arrays.asList(id)); - daMeasurePointService.deleteByPoint(id); - daMathPointService.deleteByPoint(id); + public void delete(String[] ids) { + daPointDao.deleteBatchIds(Arrays.asList(ids)); + daMeasurePointService.deleteByPoint(ids); + daMathPointService.deleteByPoint(ids); + daCumulatePointService.deleteByPoint(ids); // 清空缓存 clearCache(); } @@ -319,10 +320,19 @@ @Override public List<DaPointDTO> getCumulatePoint(String freq) { - Map<String, Object> params = new HashMap<>(); + Map<String, Object> params = new HashMap<>(3); params.put("pointType", PointTypeEnum.CUMULATE.getCode()); params.put("isEnable", CommonConstant.IS_ENABLE); params.put("minfreqid", freq); + return daPointDao.getCumulatePoint(params); + } + + @Override + public List<DaPointDTO> getCumulatePoint(DaPointPageReqVO reqVO) { + Map<String, Object> params = new HashMap<>(3); + params.put("pointType", PointTypeEnum.CUMULATE.getCode()); + params.put("pointNo", reqVO.getPointNo()); + params.put("pointName", reqVO.getPointName()); return daPointDao.getCumulatePoint(params); } @@ -395,6 +405,13 @@ case CONSTANT: daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_F.name())); break; + case CUMULATE: + DaCumulatePointDTO cumulatePoint = new DaCumulatePointDTO(); + cumulatePoint.setMomentPoint(importPoint.getMomentPoint()); + cumulatePoint.setLength(importPoint.getLength()); + cumulatePoint.setDivisor(importPoint.getDivisor()); + daCumulatePointService.add(cumulatePoint, daPointEntity.getId()); + daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_L.name())); default: break; } @@ -418,9 +435,6 @@ measurePoint.setSourceId(sourcesIdMap.get(importPoint.getSourceType()).get(importPoint.getSourceName())); measurePoint.setTagNo(importPoint.getTagNo()); daMeasurePointService.update(measurePoint, new QueryWrapper<DaMeasurePointEntity>().eq("point_id",updatePoint.getId())); - - - respVO.getUpdatePointnames().add(importPoint.getPointName()); }); return respVO; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/DaPointExcelVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/DaPointExcelVO.java index 9e236f0..1bd2051 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/DaPointExcelVO.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/DaPointExcelVO.java @@ -84,4 +84,16 @@ @Schema(description = "计算公式") @ExcelProperty("计算公式") private String expression; + + @Schema(description = "瞬时测点") + @ExcelProperty("瞬时测点") + private String momentPoint; + + @Schema(description = "累计长度") + @ExcelProperty("累计长度") + private Integer length; + + @Schema(description = "除数") + @ExcelProperty("除数") + private Integer divisor; } \ No newline at end of file diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/PointImportExcelVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/PointImportExcelVO.java index 7cf3b6d..902d3f7 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/PointImportExcelVO.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/PointImportExcelVO.java @@ -86,4 +86,13 @@ @ExcelProperty("计算公式") private String expression; + @ExcelProperty("瞬时测点") + private String momentPoint; + + @ExcelProperty("累计长度") + private Integer length; + + @ExcelProperty("除数") + private Integer divisor; + } diff --git a/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml b/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml index 8e3ceef..435f343 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml +++ b/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml @@ -133,6 +133,11 @@ group: ${spring.application.name}_PRODUCER # 生产者分组 spring: + rabbitmq: + host: 172.16.8.200 # RabbitMQ 服务的地址 + port: 5672 # RabbitMQ 服务的端口 + username: admin # RabbitMQ 服务的账号 + password: admin123 # RabbitMQ 服务的密码 # Kafka 配置项,对应 KafkaProperties 配置类 kafka: # Kafka Producer 配置项 diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkScheduleReqDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkScheduleReqDTO.java index b0ae867..6e1d455 100644 --- a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkScheduleReqDTO.java +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkScheduleReqDTO.java @@ -23,8 +23,4 @@ @Schema(description = "调度方案时间") @NotNull(message="调度方案时间不能为空") private Date scheduleTime; - - private String modelCode; - - private Map<String, Object> params; } \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/db/mysql.sql b/iailab-module-model/iailab-module-model-biz/db/mysql.sql index 649f596..4768887 100644 --- a/iailab-module-model/iailab-module-model-biz/db/mysql.sql +++ b/iailab-module-model/iailab-module-model-biz/db/mysql.sql @@ -115,7 +115,7 @@ ( id varchar(36) not null, itemid varchar(36), - expression varchar(255), + expression varchar(1000), num integer, primary key (id), UNIQUE INDEX uk_itemid (itemid) @@ -875,4 +875,7 @@ INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1629, 2, 'double[][]', '2', 'model_result_type', 0, '', '', '', '141', '2024-11-11 15:21:17', '141', '2024-11-11 15:21:17', b'0'); -alter table t_mm_item_output add column `result_name` varchar(50) DEFAULT NULL; \ No newline at end of file +alter table t_mm_item_output add column `result_name` varchar(50) DEFAULT NULL; + + +alter table t_st_schedule_scheme add column `mpkprojectid` varchar(36) DEFAULT NULL; \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java index ddb8638..9fe6967 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java @@ -193,7 +193,7 @@ resp.setScheduleTime(reqDTO.getScheduleTime()); try { log.info("调度计算开始: " + System.currentTimeMillis()); - ScheduleResultVO scheduleResult = scheduleModelHandler.doSchedule(reqDTO.getModelCode(), reqDTO.getScheduleTime()); + ScheduleResultVO scheduleResult = scheduleModelHandler.doSchedule(reqDTO.getScheduleCode(), reqDTO.getScheduleTime()); resp.setResult(scheduleResult.getResult()); log.info("预测计算结束: " + System.currentTimeMillis()); } catch (Exception ex) { diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleSchemeEntity.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleSchemeEntity.java index e00d8e1..dc62207 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleSchemeEntity.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleSchemeEntity.java @@ -78,4 +78,9 @@ * 备注 */ private String remark; + + /** + * 项目ID + */ + private String mpkprojectid; } diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java index 3461fc6..4ed005f 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java @@ -35,8 +35,8 @@ } @Override - public void update(StScheduleSchemeSaveReqVO createReqVO) { - StScheduleSchemeEntity entity = BeanUtils.toBean(createReqVO, StScheduleSchemeEntity.class); + public void update(StScheduleSchemeSaveReqVO updateReqVO) { + StScheduleSchemeEntity entity = BeanUtils.toBean(updateReqVO, StScheduleSchemeEntity.class); baseDao.updateById(entity); } diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeRespVO.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeRespVO.java index 6c7ba4a..00aa623 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeRespVO.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeRespVO.java @@ -50,5 +50,6 @@ @Schema(description = "状态(0正常 1停用)", example = "0") private Integer status; - + @Schema(description = "项目ID") + private String mpkprojectid; } \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeSaveReqVO.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeSaveReqVO.java index aa8e8c0..2f18386 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeSaveReqVO.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeSaveReqVO.java @@ -16,7 +16,7 @@ public class StScheduleSchemeSaveReqVO { @Schema(description = "ID") - private Long id; + private String id; @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "编号不能为空") @@ -52,4 +52,7 @@ @Schema(description = "备注") private String remark; + + @Schema(description = "项目ID") + private String mpkprojectid; } \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java index 9d5359b..da91e2d 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java @@ -93,7 +93,7 @@ } modelResult = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT); //打印结果 - log.info("模型计算完成:modelId=" + modelId + modelResult); + log.info("预测模型计算完成:modelId=" + modelId + modelResult); JSONObject jsonObjResult = new JSONObject(); jsonObjResult.put("result", modelResult); log.info(String.valueOf(jsonObjResult)); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java index ed4d4c8..48a5efb 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.iail.IAILMDK; import com.iail.model.IAILModel; +import com.iailab.module.model.common.enums.CommonConstant; import com.iailab.module.model.mcs.sche.entity.StScheduleModelEntity; import com.iailab.module.model.mcs.sche.entity.StScheduleModelSettingEntity; import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity; @@ -16,6 +17,7 @@ import com.iailab.module.model.mdk.sample.dto.SampleData; import com.iailab.module.model.mdk.schedule.ScheduleModelHandler; import com.iailab.module.model.mdk.vo.ScheduleResultVO; +import com.iailab.module.model.mpk.common.utils.DllUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -88,7 +90,7 @@ param2Values[count] = settings_predict; //打印参数 - log.info("##############调度模型:modelId=" + modelId + " ##########################"); + log.info("##############调度模型:scheduleScheme=" + scheduleScheme.getCode() + " ##########################"); JSONObject jsonObjNewModelBean = new JSONObject(); jsonObjNewModelBean.put("newModelBean", newModelBean); log.info(String.valueOf(jsonObjNewModelBean)); @@ -96,17 +98,21 @@ jsonObjParam2Values.put("param2Values", param2Values); log.info(String.valueOf(jsonObjParam2Values)); - //IAILMDK.run - HashMap<String, Object> result = IAILMDK.run(newModelBean, param2Values); + //运行模型 + HashMap<String, Object> modelResult = DllUtils.run(newModelBean, param2Values, scheduleScheme.getMpkprojectid()); + if (!modelResult.containsKey(CommonConstant.MDK_STATUS_CODE) || !modelResult.containsKey(CommonConstant.MDK_RESULT) || + !modelResult.get(CommonConstant.MDK_STATUS_CODE).toString().equals(CommonConstant.MDK_STATUS_100)) { + throw new RuntimeException("模型结果异常:" + modelResult); + } + modelResult = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT); //打印结果 JSONObject jsonObjResult = new JSONObject(); - jsonObjResult.put("result", result); + jsonObjResult.put("result", modelResult); log.info(String.valueOf(jsonObjResult)); - log.info("调度模型计算完成:modelId=" + modelId + result); //5.返回调度结果 - scheduleResult.setResult(result); + scheduleResult.setResult(modelResult); scheduleResult.setModelId(modelId); scheduleResult.setSchemeId(scheduleScheme.getId()); scheduleResult.setScheduleTime(scheduleTime); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java index 4de8772..8560966 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java @@ -99,7 +99,7 @@ String label = (String) params.get("label"); QueryWrapper<MpkFileEntity> wrapper = new QueryWrapper<>(); - wrapper.like(StringUtils.isNotBlank(pyName), "py_name", pyName) + wrapper.like(StringUtils.isNotBlank(pyName), "py_chinese_name", pyName) .eq(StringUtils.isNotBlank(pyType), "py_type", pyType) .like(StringUtils.isNotBlank(remark), "remark", remark); -- Gitblit v1.9.3