From db8472b9471de96a68c7fcdb2e66124b2f16854b Mon Sep 17 00:00:00 2001 From: liriming <1343021927@qq.com> Date: 星期三, 02 四月 2025 17:14:56 +0800 Subject: [PATCH] 采纳建议接口 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSuggestServiceImpl.java | 90 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 90 insertions(+), 0 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSuggestServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSuggestServiceImpl.java index 32b7055..998bf44 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSuggestServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSuggestServiceImpl.java @@ -1,10 +1,26 @@ package com.iailab.module.model.mcs.sche.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; +import com.iailab.framework.common.util.object.ConvertUtils; +import com.iailab.module.model.api.mcs.dto.ScheduleSuggestReqDTO; +import com.iailab.module.model.api.mcs.dto.ScheduleSuggestRespDTO; +import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestReqVO; +import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestRespVO; +import com.iailab.module.model.common.enums.ScheduleSuggestStatusEnum; import com.iailab.module.model.mcs.sche.dao.StScheduleSuggestDao; +import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity; import com.iailab.module.model.mcs.sche.entity.StScheduleSuggestEntity; import com.iailab.module.model.mcs.sche.service.StScheduleSuggestService; +import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestPageReqVO; +import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestSaveReqVO; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.*; /** * @author PanZhibao @@ -14,4 +30,78 @@ @Service public class StScheduleSuggestServiceImpl extends BaseServiceImpl<StScheduleSuggestDao, StScheduleSuggestEntity> implements StScheduleSuggestService { + + @Override + public PageResult<StScheduleSuggestEntity> page(StScheduleSuggestPageReqVO reqVO) { + return baseDao.selectPage(reqVO); + } + + @Override + public void create(StScheduleSuggestSaveReqVO createReqVO) { + StScheduleSuggestEntity entity = BeanUtils.toBean(createReqVO, StScheduleSuggestEntity.class); + entity.setId(UUID.randomUUID().toString()); + entity.setStatus(ScheduleSuggestStatusEnum.S0.getCode()); + baseDao.insert(entity); + } + + @Override + public void update(StScheduleSuggestSaveReqVO createReqVO) { + StScheduleSuggestEntity entity = BeanUtils.toBean(createReqVO, StScheduleSuggestEntity.class); + baseDao.updateById(entity); + } + + @Override + public void delete(String id) { + baseDao.deleteById(id); + } + + @Override + public StScheduleSuggestEntity getInfo(String id) { + return baseDao.selectById(id); + } + + @Override + public List<StScheduleSuggestEntity> getList(String scheduleObj, Integer limit) { + QueryWrapper<StScheduleSuggestEntity> queryWrapper = new QueryWrapper<>(); + limit = limit == null ? 1 : limit; + queryWrapper.eq("schedule_obj", scheduleObj) + .orderByDesc("create_time") + .last("limit " + limit); + return baseDao.selectList(queryWrapper); + } + + @Override + public void cleanScheduleSuggest(Map<String, Date> tMap) { + baseDao.cleanScheduleSuggest(tMap); + } + + @Override + public List<ScheduleSuggestRespDTO> list(ScheduleSuggestReqDTO vo) { + QueryWrapper<StScheduleSuggestEntity> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(StringUtils.isNotBlank(vo.getScheduleObj()),"schedule_obj", vo.getScheduleObj()) + .ge(null != vo.getStartTime(),"schedule_time",vo.getStartTime()) + .le(null != vo.getEndTime(),"schedule_time",vo.getEndTime()); + return ConvertUtils.sourceToTarget(baseDao.selectList(queryWrapper),ScheduleSuggestRespDTO.class); + } + + @Override + public List<StScheduleSuggestEntity> getList(List<String> scheduleObjList, Date predictTime) { + if (CollectionUtils.isEmpty(scheduleObjList)) { + return new ArrayList<>(); + } + QueryWrapper<StScheduleSuggestEntity> queryWrapper = new QueryWrapper<>(); + queryWrapper.in("schedule_obj", scheduleObjList); + queryWrapper.eq("schedule_time", predictTime); + return baseDao.selectList(queryWrapper); + } + + @Override + public Boolean useSuggest(StAlarmAndSuggestReqVO reqVO) { + StScheduleSuggestEntity entity = new StScheduleSuggestEntity(); + entity.setId(reqVO.getId()); + entity.setStatus(ScheduleSuggestStatusEnum.S1.getCode()); + entity.setHandleTime(new Date()); + baseDao.updateById(entity); + return true; + } } \ No newline at end of file -- Gitblit v1.9.3