| | |
| | | |
| | | logging: |
| | | file: |
| | | name: @log.path@/iailab-data/log/${spring.application.name}.log # 日志文件名,全路径 |
| | | name: @log.path@/log/${spring.application.name}.log # 日志文件名,全路径 |
| | | level: |
| | | org: |
| | | springframework: |
| | |
| | | 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; |
| | | alter table t_st_schedule_scheme add column `mpkprojectid` varchar(36) DEFAULT NULL; |
| | | |
| | | alter table t_st_schedule_record add column `result_code` varchar(10) DEFAULT NULL; |
| | | alter table t_st_schedule_record add column `result_data` varchar(1000) DEFAULT NULL; |
| | |
| | | dataView.setRangeL(rangeL); |
| | | dataView.setLimitH(limitH); |
| | | dataView.setLimitL(limitL); |
| | | dataView.setRealData(getHisData(outPut.getPointid(), startTime, endTime, timeFormat)); |
| | | if (StringUtils.isNotBlank(outPut.getPointid())) { |
| | | dataView.setRealData(getHisData(outPut.getPointid(), startTime, endTime, timeFormat)); |
| | | } else { |
| | | dataView.setRealData(new ArrayList<>()); |
| | | } |
| | | dataView.setCurData(mmItemResultJsonService.getData(outPut.getId(), predictTime, timeFormat)); |
| | | switch (lineType) { |
| | | case TN: |
| | |
| | | package com.iailab.module.model.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.model.api.mdk.MdkApi; |
| | | import com.iailab.module.model.api.mdk.dto.*; |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
| | | import com.iailab.module.model.mcs.pre.service.DmModuleService; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleRecordService; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleSchemeService; |
| | | 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.PredictModuleHandler; |
| | | import com.iailab.module.model.mdk.predict.PredictResultHandler; |
| | | import com.iailab.module.model.mdk.schedule.ScheduleModelHandler; |
| | |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | private PredictModuleHandler predictModuleHandler; |
| | | |
| | | @Autowired |
| | | private ItemEntityFactory itemEntityFactory; |
| | | |
| | | @Autowired |
| | | private PredictItemFactory predictItemFactory; |
| | | |
| | | @Autowired |
| | | private PredictResultHandler predictResultHandler; |
| | | |
| | | @Autowired |
| | | private ScheduleModelHandler scheduleModelHandler; |
| | | |
| | | @Autowired |
| | | private StScheduleRecordService stScheduleRecordService; |
| | | |
| | | @Autowired |
| | | private StScheduleSchemeService stScheduleSchemeService; |
| | | |
| | | /** |
| | | * 按模块预测 |
| | |
| | | // 分组,先运行normal预测项,再将结果传递给merge预测项 |
| | | 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); |
| | | predictModuleHandler.predict(normalItems, 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); |
| | | predictModuleHandler.predict(mergeItems, reqDTO.getPredictTime(), intervalTime, predictResultMap); |
| | | } |
| | | } |
| | | // 更新Module时间 |
| | |
| | | List<ItemVO> predictItemList = new ArrayList<>(); |
| | | predictItemList.add(itemByItemNo); |
| | | Map<String, PredictResultVO> predictResultMap = new HashMap<>(predictItemList.size()); |
| | | predictModuleHandler.predict(predictItemList, reqDTO.getPredictTime(), 0,predictResultMap); |
| | | predictModuleHandler.predict(predictItemList, reqDTO.getPredictTime(), 0, predictResultMap); |
| | | |
| | | Map<String, List<MdkPredictDataDTO>> itemPredictData = new HashMap<>(); |
| | | |
| | |
| | | log.info("调度计算开始: " + System.currentTimeMillis()); |
| | | ScheduleResultVO scheduleResult = scheduleModelHandler.doSchedule(reqDTO.getScheduleCode(), reqDTO.getScheduleTime()); |
| | | resp.setResult(scheduleResult.getResult()); |
| | | stScheduleRecordService.create(scheduleResult); |
| | | stScheduleSchemeService.updateTime(scheduleResult.getSchemeId(), scheduleResult.getScheduleTime()); |
| | | log.info("预测计算结束: " + System.currentTimeMillis()); |
| | | } catch (Exception ex) { |
| | | log.info("调度计算异常: " + System.currentTimeMillis()); |
| | | // ex.printStackTrace(); |
| | | ex.printStackTrace(); |
| | | return resp; |
| | | } |
| | | return resp; |
| | |
| | | public enum OutResultType { |
| | | D1(1, "一维数组"), |
| | | D2(2, "二维数组"), |
| | | D(3, "二维数组"); |
| | | D(3, "double"); |
| | | |
| | | private Integer code; |
| | | private String desc; |
| | |
| | | public interface MmItemResultJsonService extends BaseService<MmItemResultJsonEntity> { |
| | | |
| | | List<Object[]> getData(String outputId, Date predictTime, String timeFormat); |
| | | |
| | | String getDoubleData(String outputId, Date predictTime); |
| | | } |
| | |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public String getDoubleData(String outputId, Date predictTime) { |
| | | QueryWrapper<MmItemResultJsonEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("outputid", outputId) |
| | | .eq("predicttime", predictTime); |
| | | MmItemResultJsonEntity mmItemResultJsonEntity = baseDao.selectOne(wrapper); |
| | | return null == mmItemResultJsonEntity ? null : mmItemResultJsonEntity.getCumulant(); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.controller.admin; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleRecordEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleRecordPageReqVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleRecordRespVO; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleRecordService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年12月25日 |
| | | */ |
| | | @Tag(name = "模型服务 - 调度记录") |
| | | @RestController |
| | | @RequestMapping("/model/sche/record") |
| | | public class StScheduleRecordController { |
| | | |
| | | @Autowired |
| | | private StScheduleRecordService stScheduleRecordService; |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得调度记录") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('sche:record:query')") |
| | | public CommonResult<StScheduleRecordRespVO> getInfo(@RequestParam("id") String id) { |
| | | StScheduleRecordRespVO respVO = stScheduleRecordService.getInfo(id); |
| | | return success(respVO); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得调度记录分页") |
| | | @PreAuthorize("@ss.hasPermission('sche:record:query')") |
| | | public CommonResult<PageResult<StScheduleRecordRespVO>> getPage(@Valid StScheduleRecordPageReqVO pageVO) { |
| | | PageResult<StScheduleRecordEntity> pageResult = stScheduleRecordService.page(pageVO); |
| | | return success(BeanUtils.toBean(pageResult, StScheduleRecordRespVO.class)); |
| | | } |
| | | } |
| | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得调度方案分页") |
| | | @PreAuthorize("@ss.hasPermission('sche:scheme:query')") |
| | | public CommonResult<PageResult<StScheduleSchemeRespVO>> getTenantPage(@Valid StScheduleSchemePageReqVO pageVO) { |
| | | public CommonResult<PageResult<StScheduleSchemeRespVO>> getPage(@Valid StScheduleSchemePageReqVO pageVO) { |
| | | PageResult<StScheduleSchemeEntity> pageResult = stScheduleSchemeService.page(pageVO); |
| | | return success(BeanUtils.toBean(pageResult, StScheduleSchemeRespVO.class)); |
| | | } |
| | |
| | | |
| | | default PageResult<StScheduleRecordEntity> selectPage(StScheduleRecordPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<StScheduleRecordEntity>() |
| | | .eqIfPresent(StScheduleRecordEntity::getSchemeId, reqVO.getSchemeId()) |
| | | .likeIfPresent(StScheduleRecordEntity::getModelName, reqVO.getModelName()) |
| | | .geIfPresent(StScheduleRecordEntity::getScheduleTime, reqVO.getStartTime()) |
| | | .leIfPresent(StScheduleRecordEntity::getScheduleTime, reqVO.getEndTime()) |
| | |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 结果code |
| | | */ |
| | | private String resultCode; |
| | | |
| | | /** |
| | | * 结果数据 |
| | | */ |
| | | private String resultData; |
| | | |
| | | } |
| | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleRecordEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleRecordPageReqVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleRecordSaveReqVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleRecordRespVO; |
| | | import com.iailab.module.model.mdk.vo.ScheduleResultVO; |
| | | |
| | | /** |
| | |
| | | |
| | | PageResult<StScheduleRecordEntity> page(StScheduleRecordPageReqVO reqVO); |
| | | |
| | | StScheduleRecordRespVO getInfo(String id); |
| | | |
| | | void create(ScheduleResultVO resultVO); |
| | | } |
| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleRecordDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleRecordDetailEntity; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleRecordEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleRecordDetailService; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleRecordService; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleRecordDetailRespVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleRecordPageReqVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleRecordRespVO; |
| | | import com.iailab.module.model.mdk.vo.ScheduleResultVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @Override |
| | | public StScheduleRecordRespVO getInfo(String id) { |
| | | StScheduleRecordEntity entity = baseDao.selectById(id); |
| | | StScheduleRecordRespVO respVO = ConvertUtils.sourceToTarget(entity, StScheduleRecordRespVO.class); |
| | | List<StScheduleRecordDetailEntity> list = stScheduleRecordDetailService.getByRecordId(id); |
| | | respVO.setDetailList(ConvertUtils.sourceToTarget(list, StScheduleRecordDetailRespVO.class)); |
| | | return respVO; |
| | | } |
| | | |
| | | @Override |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | | public void create(ScheduleResultVO resultVO) { |
| | | StScheduleRecordEntity entity = new StScheduleRecordEntity(); |
| | |
| | | entity.setSchemeId(resultVO.getSchemeId()); |
| | | entity.setScheduleTime(resultVO.getScheduleTime()); |
| | | entity.setModelId(resultVO.getModelId()); |
| | | entity.setResultCode(resultVO.getResultCode()); |
| | | entity.setResultData(JSON.toJSONString(resultVO.getResult())); |
| | | baseDao.insert(entity); |
| | | stScheduleRecordDetailService.create(entity.getId(), resultVO); |
| | | } |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | import static com.iailab.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | private String modelName; |
| | | |
| | | @Schema(description = "开始时间") |
| | | private Date startTime; |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| | | private LocalDateTime startTime; |
| | | |
| | | @Schema(description = "结束时间") |
| | | private Date endTime; |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| | | private LocalDateTime endTime; |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | |
| | | @Schema(description = "创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "结果状态") |
| | | private String resultCode; |
| | | |
| | | @Schema(description = "结果数据") |
| | | private String resultData; |
| | | |
| | | @Schema(description = "详情") |
| | | private List<StScheduleRecordDetailRespVO> detailList; |
| | | } |
| | |
| | | |
| | | //IAILMDK.run |
| | | HashMap<String, Object> modelResult = DllUtils.run(newModelBean, param2Values, predictModel.getMpkprojectid()); |
| | | //打印结果 |
| | | log.info("预测模型计算完成:modelId=" + modelId + ",modelName=" + predictModel.getMethodname() + ",modelResult=" + JSON.toJSONString(modelResult)); |
| | | //判断模型结果 |
| | | 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 ModelResultErrorException("模型结果异常:" + modelResult); |
| | | } |
| | | modelResult = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT); |
| | | //打印结果 |
| | | JSONObject jsonObjResult = new JSONObject(); |
| | | jsonObjResult.put("result", modelResult); |
| | | log.info("预测模型计算完成:modelId=" + modelId + ",modelName=" + predictModel.getMethodname() + ",modelResult=" + String.valueOf(jsonObjResult)); |
| | | |
| | | List<MmItemOutputEntity> itemOutputList = mmItemOutputService.getByItemid(predictModel.getItemid()); |
| | | Map<MmItemOutputEntity, double[]> predictMatrixs = new HashMap<>(); |
| | |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueQueryDTO; |
| | | import com.iailab.module.data.common.ApiDataQueryDTO; |
| | | import com.iailab.module.data.common.ApiDataValueDTO; |
| | | import com.iailab.module.model.common.enums.OutResultType; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemResultJsonService; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemResultService; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemTypeService; |
| | | import com.iailab.module.model.mdk.common.enums.ModelParamType; |
| | |
| | | import com.iailab.module.model.mdk.sample.dto.SampleInfo; |
| | | import com.iailab.module.model.mdk.vo.DataValueVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private MmItemResultService mmItemResultService; |
| | | |
| | | @Autowired |
| | | private MmItemResultJsonService mmItemResultJsonService; |
| | | |
| | | @Autowired |
| | | private MmItemTypeService mmItemTypeService; |
| | |
| | | case NORMALITEM: |
| | | case MERGEITEM: |
| | | MmItemOutputEntity outPut = mmItemOutputService.getOutPutById(columnItem.getParamId()); |
| | | List<DataValueVO> predictValue = mmItemResultService.getPredictValue(outPut.getId(), columnItem.getStartTime(), columnItem.getEndTime()); |
| | | OutResultType outResultType = OutResultType.getEumByCode(outPut.getResultType()); |
| | | List<DataValueVO> predictValue = new ArrayList<>(); |
| | | |
| | | // double类型特殊处理 |
| | | if (outResultType.equals(OutResultType.D)) { |
| | | // columnItem.getStartTime()就是预测时间 |
| | | String doubleData = mmItemResultJsonService.getDoubleData(outPut.getId(), columnItem.getStartTime()); |
| | | if (StringUtils.isNotBlank(doubleData)) { |
| | | DataValueVO dataValueVO = new DataValueVO(); |
| | | dataValueVO.setDataTime(columnItem.getStartTime()); |
| | | dataValueVO.setDataValue(Double.valueOf(doubleData)); |
| | | predictValue.add(dataValueVO); |
| | | } |
| | | } else { |
| | | predictValue = mmItemResultService.getPredictValue(outPut.getId(), columnItem.getStartTime(), columnItem.getEndTime()); |
| | | } |
| | | |
| | | if (CollectionUtils.isEmpty(predictValue)) { |
| | | break; |
| | | } |
| | |
| | | default: |
| | | break; |
| | | } |
| | | log.info("数据获取,columnItem:" + columnItem + ",dataList" + dataList); |
| | | // 避免生产环境日志过多,分级打印 |
| | | log.debug("数据获取,columnItem:" + columnItem + ",dataList:" + dataList); |
| | | log.info("数据获取,columnItem:" + columnItem + ",dataListLength:" + dataList.size()); |
| | | return dataList; |
| | | } |
| | | } |
| | |
| | | case MERGEITEM: |
| | | // 预测值 |
| | | oneMin = PredGranularityEnum.MIN1.getCode() * 1000L; |
| | | start = start - (start % oneMin) + oneMin; |
| | | end = end - (end % oneMin) + oneMin; |
| | | mins = ((end - start) / oneMin); |
| | | start = start - (start % oneMin); |
| | | end = end - (end % oneMin); |
| | | mins = ((end - start) / oneMin) + 1; |
| | | break; |
| | | case DATAPOINT: |
| | | // 测点值 |
| | |
| | | break; |
| | | case NORMALITEM: |
| | | case MERGEITEM: |
| | | dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), 60); |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | case IND: |
| | | dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), 60); |
| | |
| | | calendar.setTime(originalTime); |
| | | switch (ModelParamType.getEumByCode(columnItem.getParamType())) { |
| | | case DATAPOINT: |
| | | ApiPointDTO dataPoint = pointMap.get(columnItem.getParamId()); |
| | | if (dataPoint == null) { |
| | | return null; |
| | | } |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | case NORMALITEM: |
| | | case MERGEITEM: |
| | | dateTime = calendar.getTime(); |
| | | dateTime = calculateTime(originalTime, false, columnItem.getDataLength(), 60); |
| | | break; |
| | | case IND: |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | case PLAN: |
| | | ApiPlanItemDTO apiPlanItemDTO = planMap.get(columnItem.getParamId()); |
| | | if (apiPlanItemDTO == null) { |
| | | return null; |
| | | } |
| | | dateTime = calculateDate(originalTime, false, columnItem.getDataLength(), TimeGranularitySecEnum.getEumByCode(apiPlanItemDTO.getTimeGranularity()).getValue()); |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | // 数据长度 * 粒度 |
| | | calendar.add(Calendar.SECOND, timeLength * granularity); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | public Date calculateDate(Date originalTime, Boolean backward, int dataLength, int field) { |
| | | int timeLength; |
| | | if (backward) { |
| | | timeLength = (-1) * dataLength; |
| | | } else { |
| | | timeLength = dataLength - 1; |
| | | } |
| | | Date desTime = originalTime; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(desTime); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | // 数据长度 * 粒度 |
| | | calendar.add(Calendar.SECOND, timeLength); |
| | | return calendar.getTime(); |
| | | } |
| | | } |
| | |
| | | throw new RuntimeException("模型结果异常:" + modelResult); |
| | | } |
| | | modelResult = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT); |
| | | |
| | | String statusCode = modelResult.get(CommonConstant.MDK_STATUS_CODE).toString(); |
| | | //打印结果 |
| | | JSONObject jsonObjResult = new JSONObject(); |
| | | jsonObjResult.put("result", modelResult); |
| | | log.info(String.valueOf(jsonObjResult)); |
| | | |
| | | //5.返回调度结果 |
| | | scheduleResult.setResultCode(statusCode); |
| | | scheduleResult.setResult(modelResult); |
| | | scheduleResult.setModelId(modelId); |
| | | scheduleResult.setSchemeId(scheduleScheme.getId()); |
| | |
| | | private Date scheduleTime; |
| | | |
| | | /** |
| | | * resultCode |
| | | */ |
| | | private String resultCode; |
| | | |
| | | /** |
| | | * 模型结果 |
| | | */ |
| | | private Map<String, Object> result; |
| | |
| | | |
| | | logging: |
| | | file: |
| | | name: @log.path@/iailab-model/log/${spring.application.name}.log # 日志文件名,全路径 |
| | | name: @log.path@/log/${spring.application.name}.log # 日志文件名,全路径 |
| | | level: |
| | | org: |
| | | springframework: |
| | |
| | | <!-- 启动服务时,是否清理历史日志,一般不建议清理 --> |
| | | <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart> |
| | | <!-- 日志文件,到达多少容量,进行滚动 --> |
| | | <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize> |
| | | <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-100MB}</maxFileSize> |
| | | <!-- 日志文件的总大小,0 表示不限制 --> |
| | | <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap> |
| | | <!-- 日志文件的保留天数 --> |
| | | <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory> |
| | | <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-7}</maxHistory> |
| | | </rollingPolicy> |
| | | </appender> |
| | | <!-- 异步写入日志,提升性能 --> |
| | |
| | | <nacos.username>nacos</nacos.username> |
| | | <nacos.password>nacos</nacos.password> |
| | | <nacos.metadata.version>1.0.0</nacos.metadata.version> |
| | | <log.path>D:\DLUT\iailab-plat</log.path> |
| | | <log.path>D:/DLUT/iailab-plat</log.path> |
| | | <logstash.address>127.0.0.1:4560</logstash.address> |
| | | <deploy.server>172.16.216.132</deploy.server> |
| | | <deploy.server>127.0.0.1</deploy.server> |
| | | </properties> |
| | | <activation> |
| | | <!-- 默认环境 --> |
| | |
| | | <nacos.username>nacos</nacos.username> |
| | | <nacos.password>nacos</nacos.password> |
| | | <nacos.metadata.version>1.0.0</nacos.metadata.version> |
| | | <log.path>/home/iailab</log.path> |
| | | <log.path>.</log.path> |
| | | <logstash.address>127.0.0.1:4560</logstash.address> |
| | | <deploy.server>172.16.59.105</deploy.server> |
| | | </properties> |
| | |
| | | <nacos.username>nacos</nacos.username> |
| | | <nacos.password>nacos</nacos.password> |
| | | <nacos.metadata.version>1.0.0</nacos.metadata.version> |
| | | <log.path>D:\iailab</log.path> |
| | | <log.path>.</log.path> |
| | | <logstash.address>127.0.0.1:4560</logstash.address> |
| | | <deploy.server>10.88.4.131</deploy.server> |
| | | </properties> |