Merge remote-tracking branch 'origin/master'
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | @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); |
| | |
| | | |
| | | List<DaPointDTO> getCumulatePoint(String freq); |
| | | |
| | | List<DaPointDTO> getCumulatePoint(DaPointPageReqVO reqVO); |
| | | |
| | | DaPointDTO getByNo(String pointNo); |
| | | |
| | | List<DaPointDTO> getByNos(List<String> pointNos); |
| | |
| | | |
| | | @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(); |
| | | } |
| | |
| | | |
| | | @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); |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | |
| | | @Schema(description = "计算公式") |
| | | @ExcelProperty("计算公式") |
| | | private String expression; |
| | | |
| | | @Schema(description = "瞬时测点") |
| | | @ExcelProperty("瞬时测点") |
| | | private String momentPoint; |
| | | |
| | | @Schema(description = "累计长度") |
| | | @ExcelProperty("累计长度") |
| | | private Integer length; |
| | | |
| | | @Schema(description = "除数") |
| | | @ExcelProperty("除数") |
| | | private Integer divisor; |
| | | } |
| | |
| | | @ExcelProperty("计算公式") |
| | | private String expression; |
| | | |
| | | @ExcelProperty("瞬时测点") |
| | | private String momentPoint; |
| | | |
| | | @ExcelProperty("累计长度") |
| | | private Integer length; |
| | | |
| | | @ExcelProperty("除数") |
| | | private Integer divisor; |
| | | |
| | | } |
| | |
| | | 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 配置项 |
| | |
| | | @Schema(description = "调度方案时间") |
| | | @NotNull(message="调度方案时间不能为空") |
| | | private Date scheduleTime; |
| | | |
| | | private String modelCode; |
| | | |
| | | private Map<String, Object> params; |
| | | } |
| | |
| | | ( |
| | | id varchar(36) not null, |
| | | itemid varchar(36), |
| | | expression varchar(255), |
| | | expression varchar(1000), |
| | | num integer, |
| | | primary key (id), |
| | | UNIQUE INDEX uk_itemid (itemid) |
| | |
| | | |
| | | |
| | | 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; |
| | |
| | | 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) { |
| | |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * 项目ID |
| | | */ |
| | | private String mpkprojectid; |
| | | } |
| | |
| | | } |
| | | |
| | | @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); |
| | | } |
| | | |
| | |
| | | @Schema(description = "状态(0正常 1停用)", example = "0") |
| | | private Integer status; |
| | | |
| | | |
| | | @Schema(description = "项目ID") |
| | | private String mpkprojectid; |
| | | } |
| | |
| | | public class StScheduleSchemeSaveReqVO { |
| | | |
| | | @Schema(description = "ID") |
| | | private Long id; |
| | | private String id; |
| | | |
| | | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "编号不能为空") |
| | |
| | | |
| | | @Schema(description = "备注") |
| | | private String remark; |
| | | |
| | | @Schema(description = "项目ID") |
| | | private String mpkprojectid; |
| | | } |
| | |
| | | } |
| | | 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)); |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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)); |
| | |
| | | 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); |
| | |
| | | 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); |
| | | |