iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/admin/ApiDataController.java
@@ -38,7 +38,6 @@ import javax.annotation.security.PermitAll; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
@@ -52,6 +52,10 @@ @Operation(summary = "获取预警信息列表") List<AlarmMessageRespDTO> listAlarmMessage(@RequestParam Map<String, Object> params); @GetMapping(PREFIX + "/alarm-message/last") @Operation(summary = "获取最新预警信息") AlarmMessageRespDTO getLastAlarmMessage(@RequestParam("alarmObj") String alarmObj); @PostMapping(PREFIX + "/schedule-suggest/create") @Operation(summary = "添加调度建议") Boolean createScheduleSuggest(@RequestBody ScheduleSuggestRespDTO dto); iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
@@ -15,7 +15,9 @@ import com.iailab.module.model.common.enums.PreLineTypeEnum; import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmMessageEntity; import com.iailab.module.model.mcs.pre.service.*; import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessageSaveReqVO; import com.iailab.module.model.mdk.vo.ItemVO; import com.iailab.module.model.mpk.service.ChartService; import lombok.extern.slf4j.Slf4j; @@ -62,6 +64,9 @@ @Autowired private ChartService chartService; @Autowired private MmPredictAlarmMessageService mmPredictAlarmMessageService; @Autowired private PlanItemApi planItemApi; @@ -452,9 +457,20 @@ return result; } /** * 新增预警信息 * * @param dto * @return */ @Override public Boolean createAlarmMessage(AlarmMessageRespDTO dto) { return true; try { mmPredictAlarmMessageService.create(ConvertUtils.sourceToTarget(dto, MmPredictAlarmMessageSaveReqVO.class)); return true; } catch (Exception e) { return false; } } @Override @@ -463,6 +479,12 @@ } @Override public AlarmMessageRespDTO getLastAlarmMessage(String alarmObj) { MmPredictAlarmMessageEntity entity = mmPredictAlarmMessageService.getLast(alarmObj); return ConvertUtils.sourceToTarget(entity, AlarmMessageRespDTO.class); } @Override public Boolean createScheduleSuggest(ScheduleSuggestRespDTO dto) { return true; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictAlarmMessageService.java
@@ -17,6 +17,8 @@ MmPredictAlarmMessageEntity getInfo(String id); MmPredictAlarmMessageEntity getLast(String alarmObj); void create(MmPredictAlarmMessageSaveReqVO reqVO); void update(MmPredictAlarmMessageSaveReqVO reqVO); iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmMessageServiceImpl.java
@@ -1,5 +1,6 @@ package com.iailab.module.model.mcs.pre.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.BeanUtils; @@ -9,8 +10,10 @@ import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessagePageReqVO; import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessageSaveReqVO; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.Date; import java.util.List; import java.util.UUID; /** @@ -34,6 +37,15 @@ } @Override public MmPredictAlarmMessageEntity getLast(String alarmObj) { QueryWrapper<MmPredictAlarmMessageEntity> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("alarm_obj", alarmObj) .orderByDesc("alarm_time") .last("limit 1"); return baseDao.selectOne(queryWrapper); } @Override public void create(MmPredictAlarmMessageSaveReqVO reqVO) { MmPredictAlarmMessageEntity entity = BeanUtils.toBean(reqVO, MmPredictAlarmMessageEntity.class); entity.setId(UUID.randomUUID().toString());