From 984cecaa40100ee69e9038082a477e6af5d56aca Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期五, 21 三月 2025 11:27:24 +0800 Subject: [PATCH] ALARM_TITLE --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/DmModuleServiceImpl.java | 63 ++++++++++++++++++++++--------- 1 files changed, 45 insertions(+), 18 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/DmModuleServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/DmModuleServiceImpl.java index 027832f..ba748e2 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/DmModuleServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/DmModuleServiceImpl.java @@ -1,11 +1,8 @@ package com.iailab.module.model.mcs.pre.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.pojo.PageResult; -import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.module.model.mcs.pre.dao.DmModuleDao; import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; import com.iailab.module.model.mcs.pre.service.DmModuleService; @@ -13,9 +10,8 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; -import javax.annotation.Resource; import java.util.*; /** @@ -36,13 +32,22 @@ @Override public List<DmModuleEntity> list(Map<String, Object> params) { QueryWrapper<DmModuleEntity> wrapper = getWrapper(params); - wrapper.orderByDesc("CREATE_TIME"); + wrapper.orderByDesc("create_time"); return dmModuleDao.selectList(wrapper); } @Override public DmModuleEntity info(String id) { return dmModuleDao.selectById(id); + } + + @Override + public DmModuleEntity getModuleByItemId(String itemId) { + List<DmModuleEntity> list = dmModuleDao.getModuleByItemId(itemId); + if (CollectionUtils.isEmpty(list)) { + return null; + } + return list.get(0); } private QueryWrapper<DmModuleEntity> getWrapper(Map<String, Object> params) { @@ -57,21 +62,17 @@ } @Override - public void saveModule(DmModuleEntity module) { - module.setId(UUID.randomUUID().toString()); - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.SECOND, 0); - calendar.set(Calendar.MILLISECOND, 0); - module.setPredicttime(calendar.getTime()); - module.setCollecttime(calendar.getTime()); - module.setUpdateTime(new Date()); - dmModuleDao.insert(module); + public void saveModule(DmModuleEntity entity) { + entity.setId(UUID.randomUUID().toString()); + entity.setCreateTime(new Date()); + entity.setUpdateTime(new Date()); + dmModuleDao.insert(entity); } @Override - public void update(DmModuleEntity module) { - module.setUpdateTime(new Date()); - dmModuleDao.updateById(module); + public void update(DmModuleEntity entity) { + entity.setUpdateTime(new Date()); + dmModuleDao.updateById(entity); } @Override @@ -85,7 +86,33 @@ params.put("moduletype", moduletype); QueryWrapper<DmModuleEntity> wrapper = getWrapper(params); return dmModuleDao.selectList(wrapper); + } + @Override + public void updatePredictTime(String id, Date predictTime) { + DmModuleEntity entity = dmModuleDao.selectById(id); + if (entity == null) { + return; + } + entity.setPredicttime(predictTime); + dmModuleDao.updateById(entity); + } + + @Override + public List<String> geModuleByIds(List<String> ids) { + List<String> result = new ArrayList<>(); + QueryWrapper<DmModuleEntity> wrapper = new QueryWrapper<>(); + wrapper.in("id", ids); + List<DmModuleEntity> list = dmModuleDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return result; + } + list.forEach(item -> { + if (StringUtils.isNotBlank(item.getModulenavconfig())) { + result.addAll(Arrays.asList(item.getModulenavconfig().split(","))); + } + }); + return result; } @Override -- Gitblit v1.9.3