| | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | |
| | | private String id; |
| | | |
| | | @Schema(description = "标题") |
| | | @NotNull(message = "应用编号不能为空") |
| | | private String title; |
| | | |
| | | @Schema(description = "内容") |
| | | @NotNull(message = "应用编号不能为空") |
| | | private String content; |
| | | |
| | | @Schema(description = "排序") |
| | | @NotNull(message = "应用编号不能为空") |
| | | private Integer sort; |
| | | |
| | | @Schema(description = "方案ID") |
| | | private String schemeId; |
| | | |
| | | @Schema(description = "预警ID") |
| | | private String alarmId; |
| | |
| | | private String modelId; |
| | | |
| | | @Schema(description = "调整对象") |
| | | private String adjustObj; |
| | | @NotNull(message = "应用编号不能为空") |
| | | private String scheduleObj; |
| | | |
| | | @Schema(description = "调整介质") |
| | | private String adjustMedium; |
| | | @Schema(description = "调整类型") |
| | | private String scheduleType; |
| | | |
| | | @Schema(description = "调整策略") |
| | | private String adjustStrategy; |
| | | private String scheduleStrategy; |
| | | |
| | | @Schema(description = "调整方式") |
| | | private String adjustMode; |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date adjustEnd; |
| | | |
| | | @Schema(description = "建议时间") |
| | | private Date suggestTime; |
| | | @Schema(description = "调度时间") |
| | | private Date scheduleTime; |
| | | |
| | | @Schema(description = "状态(0未处理 1已采纳 2已忽略)") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "处理人") |
| | | private String handler; |
| | | |
| | | @Schema(description = "处理时间") |
| | | private Date handleTime; |
| | | |
| | | @Schema(description = "创建时间") |
| | | private Date createTime; |
| | | } |
| | |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSuggestEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleSchemeService; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleSuggestService; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestSaveReqVO; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mpk.service.ChartService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @Override |
| | | public Boolean createScheduleSuggest(ScheduleSuggestRespDTO dto) { |
| | | stScheduleSuggestService.create(ConvertUtils.sourceToTarget(dto, StScheduleSuggestSaveReqVO.class)); |
| | | return true; |
| | | } |
| | | |
| | |
| | | List<ItemVO> normalItems = predictItemList.stream().filter(e -> e.getItemType().equals("NormalItem")).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(normalItems)) { |
| | | predictModuleHandler.predict(normalItems, reqDTO.getPredictTime(), intervalTime,predictResultMap); |
| | | List<ItemVO> mergeItem = predictItemList.stream().filter(e -> e.getItemType().equals("MergeItem")).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(mergeItem)) { |
| | | predictModuleHandler.predict(mergeItem, reqDTO.getPredictTime(), intervalTime,predictResultMap); |
| | | List<ItemVO> mergeItems = predictItemList.stream().filter(e -> e.getItemType().equals("MergeItem")).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(mergeItems)) { |
| | | predictModuleHandler.predict(mergeItems, reqDTO.getPredictTime(), intervalTime,predictResultMap); |
| | | } |
| | | } |
| | | // 更新Module时间 |
| | |
| | | @Override |
| | | public MdkPredictItemRespDTO predictItem(MdkPredictReqDTO reqDTO) { |
| | | MdkPredictItemRespDTO resp = new MdkPredictItemRespDTO(); |
| | | |
| | | try { |
| | | log.info("预测计算开始: " + System.currentTimeMillis()); |
| | | Map<String, List<MdkPredictDataDTO>> predictData = new HashMap<>(); |
| | | ItemVO predictItem = itemEntityFactory.getItemByItemNo(reqDTO.getItemNo()); |
| | | PredictItemHandler predictItemHandler = predictItemFactory.create(predictItem.getId()); |
| | | PredictResultVO predictResult = predictItemHandler.predict(reqDTO.getPredictTime(), predictItem,null,null); |
| | | Map<String, List<DataValueVO>> resultMap = predictResultHandler.convertToPredictData(predictResult); |
| | | if (!CollectionUtils.isEmpty(resultMap)) { |
| | | for (Map.Entry<String, List<DataValueVO>> entry : resultMap.entrySet()) { |
| | | List<MdkPredictDataDTO> data = ConvertUtils.sourceToTarget(entry.getValue(), MdkPredictDataDTO.class); |
| | | predictData.put(entry.getKey(), data); |
| | | } |
| | | |
| | | ItemVO itemByItemNo = mmPredictItemService.getItemByItemNo(reqDTO.getItemNo()); |
| | | List<ItemVO> predictItemList = new ArrayList<>(); |
| | | predictItemList.add(itemByItemNo); |
| | | Map<String, PredictResultVO> predictResultMap = new HashMap<>(predictItemList.size()); |
| | | predictModuleHandler.predict(predictItemList, reqDTO.getPredictTime(), 0,predictResultMap); |
| | | |
| | | Map<String, List<MdkPredictDataDTO>> itemPredictData = new HashMap<>(); |
| | | |
| | | Map<String, List<DataValueVO>> predictLists = predictResultHandler.convertToPredictData2(predictResultMap.get(reqDTO.getItemNo())); |
| | | for (Map.Entry<String, List<DataValueVO>> dataListEntry : predictLists.entrySet()) { |
| | | List<MdkPredictDataDTO> predictData = dataListEntry.getValue().stream().map(t -> { |
| | | MdkPredictDataDTO dto1 = new MdkPredictDataDTO(); |
| | | dto1.setDataTime(t.getDataTime()); |
| | | dto1.setDataValue(t.getDataValue()); |
| | | return dto1; |
| | | }).collect(Collectors.toList()); |
| | | itemPredictData.put(dataListEntry.getKey(), predictData); |
| | | } |
| | | resp.setPredictData(predictData); |
| | | resp.setItemId(predictItem.getId()); |
| | | resp.setItemId(reqDTO.getItemNo()); |
| | | resp.setPredictTime(reqDTO.getPredictTime()); |
| | | log.info("预测计算结束: " + System.currentTimeMillis()); |
| | | } catch (Exception ex) { |
| | | log.info("预测计算异常: " + System.currentTimeMillis(), ex); |
| | | return resp; |
| | | resp.setPredictData(itemPredictData); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | return resp; |
对比新文件 |
| | |
| | | package com.iailab.module.model.common.exception; |
| | | |
| | | /** |
| | | * 模型结果错误异常 |
| | | */ |
| | | public class ModelResultErrorException extends RuntimeException { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String msg; |
| | | private int code = 200; |
| | | |
| | | public ModelResultErrorException(String msg) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public ModelResultErrorException(String msg, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public ModelResultErrorException(String msg, int code) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public ModelResultErrorException(String msg, int code, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | private List<MmModelParamEntity> mmModelParamList; |
| | | |
| | | private List<MmItemResultEntity> mmItemResultList; |
| | | |
| | | /** |
| | | * 计算预测项真实数据点 |
| | | */ |
| | | private String pointId; |
| | | } |
| | |
| | | PROCESSING(1, "处理中"), |
| | | SUCCESS(2, "成功"), |
| | | FAIL(3, "失败"), |
| | | MODELRESULTERROR(4, "模型结果异常"); |
| | | MODELRESULTERROR(4, "模型结果异常"), |
| | | MODELRESULTSAVEERROR(5, "模型结果保存异常"); |
| | | |
| | | private Integer code; |
| | | private String desc; |
| | |
| | | @Override |
| | | public void updatePyFile(String pyModule, String fileName) { |
| | | baseMapper.updatePyFile(pyModule + "." + fileName.substring(0,fileName.lastIndexOf("_")+1),pyModule + "." + fileName); |
| | | // 清空缓存 |
| | | modelIdMap.clear(); |
| | | } |
| | | } |
| | |
| | | MmPredictMergeItemEntity mMmPredictMergeItem = mmPredictItemDto.getMmPredictMergeItem(); |
| | | mMmPredictMergeItem.setItemid(predictItem.getId()); |
| | | mmPredictMergeItemService.savePredictMergeItem(mMmPredictMergeItem); |
| | | // 添加一条默认output |
| | | List<MmItemOutputEntity> mergeItemOutput = new ArrayList<>(1); |
| | | MmItemOutputEntity entity = new MmItemOutputEntity(); |
| | | entity.setPointid(mmPredictItemDto.getPointId()); |
| | | entity.setResultName(mmPredictItemDto.getMmPredictItem().getItemname()); |
| | | entity.setResultstr("result"); |
| | | mergeItemOutput.add(entity); |
| | | mmPredictItemDto.setMmItemOutputList(mergeItemOutput); |
| | | } |
| | | mmPredictItemDao.insert(predictItem); |
| | | DmModuleItemEntity dmModuleItem = mmPredictItemDto.getDmModuleItem(); |
| | |
| | | } else if (itemType != null && ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | MmPredictMergeItemEntity mMmPredictMergeItem = mmPredictItemDto.getMmPredictMergeItem(); |
| | | mmPredictMergeItemService.update(mMmPredictMergeItem); |
| | | // 修改默认output |
| | | List<MmItemOutputEntity> mmItemOutputList = mmPredictItemDto.getMmItemOutputList(); |
| | | if (CollectionUtils.isEmpty(mmItemOutputList)) { |
| | | mmItemOutputList = new ArrayList<>(1); |
| | | MmItemOutputEntity entity = new MmItemOutputEntity(); |
| | | entity.setPointid(mmPredictItemDto.getPointId()); |
| | | entity.setResultName(mmPredictItemDto.getMmPredictItem().getItemname()); |
| | | entity.setResultstr("result"); |
| | | mmItemOutputList.add(entity); |
| | | mmPredictItemDto.setMmItemOutputList(mmItemOutputList); |
| | | } else { |
| | | mmPredictItemDto.getMmItemOutputList().forEach(e -> e.setPointid(mmPredictItemDto.getPointId())); |
| | | } |
| | | } |
| | | DmModuleItemEntity dmModuleItem = mmPredictItemDto.getDmModuleItem(); |
| | | if (!"".equals(dmModuleItem.getId()) && dmModuleItem.getId() != null) { |
| | |
| | | mmPredictItemDto.setMmModelParamList(new ArrayList<>()); |
| | | mmPredictItemDto.setMmPredictMergeItem(new MmPredictMergeItemEntity()); |
| | | mmPredictItemDto.setMmPredictMergeItem(mmPredictMergeItemService.getByItemid(id)); |
| | | if (!CollectionUtils.isEmpty(mmPredictItemDto.getMmItemOutputList())) { |
| | | mmPredictItemDto.setPointId(mmPredictItemDto.getMmItemOutputList().get(0).getPointid()); |
| | | } |
| | | } |
| | | return mmPredictItemDto; |
| | | } |
| | |
| | | @Override |
| | | public List<StScheduleSchemeDTO> list(Map<String, Object> params) { |
| | | QueryWrapper<StScheduleSchemeEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("trigger_method", "1"); |
| | | queryWrapper.eq("trigger_method", params.get("trigger_method")); |
| | | queryWrapper.eq("trigger_condition", params.get("trigger_condition")); |
| | | List<StScheduleSchemeEntity> list = baseDao.selectList(queryWrapper); |
| | | return ConvertUtils.sourceToTarget(list, StScheduleSchemeDTO.class); |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | |
| | | private BigDecimal adjustTimes; |
| | | |
| | | @Schema(description = "调整开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date adjustStart; |
| | | |
| | | @Schema(description = "调整结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date adjustEnd; |
| | | |
| | | @Schema(description = "调度时间") |
| | |
| | | * @return |
| | | * @throws ItemInvokeException |
| | | */ |
| | | PredictResultVO predict(Date predictTime, ItemVO predictItemDto, Map<String, double[]> predictValueMap, ItemRunStatusEnum itemRunStatusEnum) throws ItemInvokeException; |
| | | PredictResultVO predict(Date predictTime, ItemVO predictItemDto, Map<String, double[]> predictValueMap) throws ItemInvokeException; |
| | | } |
| | |
| | | * @return |
| | | * @throws ModelInvokeException |
| | | */ |
| | | PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel,String itemName, ItemRunStatusEnum itemRunStatusEnum) throws ModelInvokeException; |
| | | PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel,String itemName) throws ModelInvokeException; |
| | | } |
| | |
| | | package com.iailab.module.model.mdk.predict; |
| | | |
| | | import com.iailab.module.model.common.exception.ModelResultErrorException; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum; |
| | | import com.iailab.module.model.mcs.pre.enums.ItemStatus; |
| | |
| | | * @return |
| | | */ |
| | | public void predict(List<ItemVO> predictItemList, Date predictTime, int intervalTime,Map<String, PredictResultVO> predictResultMap) { |
| | | PredictResultVO predictResult; |
| | | Map<String, double[]> predictValueMap = null; |
| | | if (!CollectionUtils.isEmpty(predictResultMap)) { |
| | | // 将predictResultMap处理成Map<outPutId, double[]> |
| | |
| | | } |
| | | } |
| | | for (ItemVO predictItem : predictItemList) { |
| | | PredictResultVO predictResult; |
| | | if (!predictItem.getStatus().equals(ItemStatus.STATUS1.getCode())) { |
| | | continue; |
| | | } |
| | |
| | | long start = System.currentTimeMillis(); |
| | | try { |
| | | // 预测项开始预测 |
| | | predictResult = predictItemHandler.predict(predictTime, predictItem, predictValueMap,itemRunStatusEnum); |
| | | predictResult = predictItemHandler.predict(predictTime, predictItem, predictValueMap); |
| | | } catch (ModelResultErrorException e) { |
| | | itemRunStatusEnum = ItemRunStatusEnum.MODELRESULTERROR; |
| | | continue; |
| | | } catch (Exception e) { |
| | | itemRunStatusEnum = ItemRunStatusEnum.FAIL; |
| | | continue; |
| | | } |
| | | long end = System.currentTimeMillis(); |
| | | Long drtPre = end - start; |
| | | log.info(MessageFormat.format("预测项:{0},预测时间:{1}ms", predictItem.getItemName(), drtPre)); |
| | | totalDur = totalDur + drtPre; |
| | | |
| | | predictResult.setGranularity(predictItem.getGranularity()); |
| | | predictResult.setT(intervalTime); |
| | | predictResult.setSaveIndex(predictItem.getSaveIndex()); |
| | | predictResult.setLt(1); |
| | | predictResultMap.put(predictItem.getItemNo(), predictResult); |
| | | |
| | | // 保存预测结果 |
| | | predictResultHandler.savePredictResult(predictResult); |
| | | long endSave = System.currentTimeMillis(); |
| | | Long drtSave = endSave - end; |
| | | log.info(MessageFormat.format("预测项:{0},保存时间:{1}ms", predictItem.getItemName(), |
| | | drtSave)); |
| | | totalDur = totalDur + drtSave; |
| | | predictResultMap.put(predictItem.getItemNo(), predictResult); |
| | | try { |
| | | predictResultHandler.savePredictResult(predictResult); |
| | | } catch (Exception e) { |
| | | itemRunStatusEnum = ItemRunStatusEnum.MODELRESULTSAVEERROR; |
| | | throw new RuntimeException("模型结果保存异常,result:" + predictResult); |
| | | } |
| | | itemRunStatusEnum = ItemRunStatusEnum.SUCCESS; |
| | | // long endSave = System.currentTimeMillis(); |
| | | // Long drtSave = endSave - end; |
| | | // log.info(MessageFormat.format("预测项:{0},保存时间:{1}ms", predictItem.getItemName(), |
| | | // drtSave)); |
| | | // totalDur = totalDur + drtSave; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error(MessageFormat.format("预测项编号:{0},预测项名称:{1},预测失败:{2} 预测时刻:{3}", |
| | | predictItem.getId(), predictItem.getItemName(), e.getMessage(), predictTime)); |
| | | itemRunStatusEnum = ItemRunStatusEnum.FAIL; |
| | | } finally { |
| | | mmItemStatusService.recordStatus(predictItem.getId(), itemRunStatusEnum, totalDur, predictTime); |
| | | } |
| | |
| | | package com.iailab.module.model.mdk.predict.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import com.iailab.module.data.api.point.dto.ApiPointDTO; |
| | | import com.iailab.module.data.enums.DataPointFreqEnum; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemResultService; |
| | | import com.iailab.module.model.mdk.common.enums.ItemPredictStatus; |
| | | import com.iailab.module.model.mdk.common.exceptions.ItemInvokeException; |
| | | import com.iailab.module.model.mdk.factory.ItemEntityFactory; |
| | | import com.iailab.module.model.mdk.factory.PredictItemFactory; |
| | | import com.iailab.module.model.mdk.predict.PredictItemHandler; |
| | | import com.iailab.module.model.mdk.predict.PredictResultHandler; |
| | | import com.iailab.module.model.mdk.vo.DataValueVO; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.PredictResultVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | * @throws ItemInvokeException |
| | | */ |
| | | @Override |
| | | public PredictResultVO predict(Date predictTime, ItemVO predictItemDto, Map<String, double[]> predictValueMap, ItemRunStatusEnum itemRunStatusEnum) |
| | | public PredictResultVO predict(Date predictTime, ItemVO predictItemDto, Map<String, double[]> predictValueMap) |
| | | throws ItemInvokeException { |
| | | PredictResultVO predictResult = new PredictResultVO(); |
| | | ItemPredictStatus itemStatus = ItemPredictStatus.PREDICTING; |
| | | String itemId = predictItemDto.getId(); |
| | | try { |
| | | String expression = itemEntityFactory.getMergeItem(itemId).getExpression(); |
| | | int predictLength = itemEntityFactory.getItemById(itemId).getPredictLength(); |
| | | double[][] predictResultMat = new double[predictLength][1]; |
| | | double[] predictResultMat = new double[predictLength]; |
| | | String[] mathOutPutId = expression.split("[\\+ \\-]"); |
| | | ArrayList<Character> operator = new ArrayList<>(); |
| | | for (int i = 0; i < expression.length(); i++) { |
| | |
| | | if (operator.get(j-1)=='-') |
| | | {sum -= predictValueMap.get(mathOutPutId[j])[i];} |
| | | } |
| | | predictResultMat[i][0] = sum; |
| | | predictResultMat[i] = sum; |
| | | } |
| | | } |
| | | //是否为组合预测项 |
| | |
| | | // predictResult.setPredictMatrix(matrix); |
| | | // } |
| | | predictResult.setPredictId(itemId); |
| | | predictResult.setPredictMatrix(predictResultMat); |
| | | List<MmItemOutputEntity> outputServiceByItemid = mmItemOutputService.getByItemid(itemId); |
| | | if (!CollectionUtils.isEmpty(outputServiceByItemid)) { |
| | | Map<MmItemOutputEntity, double[]> predictMatrixs = new HashMap<>(); |
| | | predictMatrixs.put(outputServiceByItemid.get(0),predictResultMat); |
| | | predictResult.setPredictMatrixs(predictMatrixs); |
| | | } |
| | | predictResult.setPredictTime(predictTime); |
| | | //预测项预测成功的状态 |
| | | itemStatus = ItemPredictStatus.SUCCESS; |
| | | } catch (Exception e) { |
| | | //预测项预测失败的状态 |
| | | itemStatus = ItemPredictStatus.FAILED; |
| | | log.debug("merge项预测失败,itemId:" + itemId); |
| | | log.error("merge项预测失败,itemId:" + itemId); |
| | | e.printStackTrace(); |
| | | throw e; |
| | | } |
| | | log.debug("预测完成,itemId:" + itemId + ",itemStatus:" + itemStatus.getValue()); |
| | | log.info("merge项预测完成,itemId:" + itemId + ",结果:" + JSON.toJSONString(predictResult)); |
| | | return predictResult; |
| | | } |
| | | } |
| | |
| | | * @throws ItemInvokeException |
| | | */ |
| | | @Override |
| | | public PredictResultVO predict(Date predictTime, ItemVO predictItemDto, Map<String, double[]> predictValueMap, ItemRunStatusEnum itemRunStatusEnum) throws ItemInvokeException { |
| | | public PredictResultVO predict(Date predictTime, ItemVO predictItemDto, Map<String, double[]> predictValueMap) throws ItemInvokeException { |
| | | PredictResultVO predictResult = new PredictResultVO(); |
| | | String itemId = predictItemDto.getId(); |
| | | try { |
| | |
| | | throw new ModelInvokeException(MessageFormat.format("{0},itemId={1}", |
| | | ModelInvokeException.errorGetModelEntity, itemId)); |
| | | } |
| | | predictResult = predictModelHandler.predictByModel(predictTime, predictModel,predictItemDto.getItemName(),itemRunStatusEnum); |
| | | predictResult = predictModelHandler.predictByModel(predictTime, predictModel,predictItemDto.getItemName()); |
| | | predictResult.setPredictId(itemId); |
| | | } catch (Exception ex) { |
| | | throw new ItemInvokeException(MessageFormat.format("{0},itemId={1}", |
| | |
| | | import com.iail.model.IAILModel; |
| | | import com.iailab.module.model.common.enums.CommonConstant; |
| | | import com.iailab.module.model.common.enums.OutResultType; |
| | | import com.iailab.module.model.common.exception.ModelResultErrorException; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; |
| | |
| | | * @throws ModelInvokeException |
| | | */ |
| | | @Override |
| | | public synchronized PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel,String itemName, ItemRunStatusEnum itemRunStatusEnum) throws ModelInvokeException { |
| | | public synchronized PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel,String itemName) throws ModelInvokeException { |
| | | PredictResultVO result = new PredictResultVO(); |
| | | if (predictModel == null) { |
| | | throw new ModelInvokeException("modelEntity is null"); |
| | |
| | | HashMap<String, Object> modelResult = DllUtils.run(newModelBean, param2Values, predictModel.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)) { |
| | | itemRunStatusEnum = ItemRunStatusEnum.MODELRESULTERROR; |
| | | throw new RuntimeException("模型结果异常:" + modelResult); |
| | | throw new ModelResultErrorException("模型结果异常:" + modelResult); |
| | | } |
| | | modelResult = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT); |
| | | //打印结果 |
| | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.framework.datapermission.core.annotation.DataPermission; |
| | | import com.iailab.module.system.api.user.dto.AdminUserRespDTO; |
| | | import com.iailab.module.system.controller.admin.user.vo.user.UserSaveReqVO; |
| | | import com.iailab.module.system.dal.dataobject.dept.DeptDO; |
| | |
| | | private PermissionService permissionService; |
| | | |
| | | @Override |
| | | @DataPermission(enable = false) // 关闭数据权限,避免只查看自己时,查询不到部门。 |
| | | public CommonResult<AdminUserRespDTO> getUser(Long id) { |
| | | AdminUserDO user = userService.getUser(id); |
| | | return success(BeanUtils.toBean(user, AdminUserRespDTO.class)); |
| | |
| | | Set<Long> menuIds = permissionService.getRoleMenuListByRoleId(convertSet(roles, RoleDO::getId)); |
| | | List<MenuDO> menuList = menuService.getMenuList(menuIds); |
| | | menuList = menuService.filterDisableMenus(menuList); |
| | | // menuList = menuService.filterMenus(menuList, "system"); |
| | | menuList = menuService.filterMenus(menuList, "system"); |
| | | |
| | | // 2. 拼接结果返回 |
| | | return success(AuthConvert.INSTANCE.convert(user, roles, menuList)); |
| | |
| | | } |
| | | children.retainAll(menuList); |
| | | List<MenuDO> tempChildren = new LinkedList<>(); |
| | | //为每一个二级菜单增加一个隐藏父级目录 |
| | | //为每一个二级菜单(非外链菜单)增加一个隐藏父级目录 |
| | | children.stream().forEach(menu -> { |
| | | if (menu.getParentId().equals(menuDO.getId())) { |
| | | if(menu.getType().equals(MenuTypeEnum.MENU.getType())) { |
| | |
| | | tempChildren.add(parentMenu); |
| | | } else if(menu.getType().equals(MenuTypeEnum.DIR.getType())) { |
| | | // 为应用菜单二级目录前增加“/” |
| | | menu.setPath("/" + menu.getPath()); |
| | | if(!menu.getPath().contains("http:") && !menu.getPath().contains("https:")) { |
| | | menu.setPath("/" + menu.getPath()); |
| | | } |
| | | } |
| | | } |
| | | tempChildren.add(menu); |