houzhongjian
2024-12-04 a82313d17b2b5d1c02e880122efc1b701c401dcf
Merge remote-tracking branch 'origin/master'
已修改16个文件
111 ■■■■ 文件已修改
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/DaPointExcelVO.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/PointImportExcelVO.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkScheduleReqDTO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/db/mysql.sql 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleSchemeEntity.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeRespVO.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeSaveReqVO.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/schedule/impl/ScheduleModelHandlerImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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);
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);
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;
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;
}
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;
}
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 配置项
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;
}
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)
@@ -876,3 +876,6 @@
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;
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) {
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;
}
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);
    }
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;
}
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;
}
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));
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);
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);