补正提醒

This commit is contained in:
xiaofajia 2024-12-13 15:06:19 +08:00
parent 409ba7e88e
commit e1aaa4ac12
2 changed files with 11 additions and 3 deletions

View File

@ -4,8 +4,11 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -13,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.iocoder.yudao.util.DateUtils;
import cn.iocoder.yudao.module.inspection.entity.WarnMessage;
import cn.iocoder.yudao.module.inspection.service.IWarnMessageService;
import io.prometheus.client.CollectorRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.iocoder.yudao.module.inspection.mapper.InspectionEquInfoMapper;
@ -30,6 +34,7 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
{
@Autowired
private IWarnMessageService messageService;
private CollectorRegistry collectorRegistry;
/**
* 查询equInfo
@ -92,14 +97,16 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
* @return 结果
*/
@Override
@DSTransactional
public int updateInspectionEquInfo(InspectionEquInfo inspectionEquInfo)
{
LambdaQueryWrapper<WarnMessage> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(WarnMessage::getType,"equ").eq(WarnMessage::getObjectId,inspectionEquInfo.getId());
WarnMessage one = messageService.getOne(queryWrapper);
if (ObjectUtil.isNotEmpty(one)){
List<WarnMessage> list = messageService.list(queryWrapper);
if (CollUtil.isNotEmpty(list)){
//更新处理
messageService.removeById(one.getId());
List<Long> ids = list.stream().map(WarnMessage::getId).collect(Collectors.toList());
messageService.removeBatchByIds(ids);
}
if (ObjectUtil.isNotEmpty(inspectionEquInfo.getNextCheckTime())){
//同时处理提醒信息

View File

@ -27,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warnMessage.title != null and warnMessage.title != ''"> and title = #{warnMessage.title}</if>
<if test="warnMessage.partnerId != null "> and partner_id = #{warnMessage.partnerId}</if>
<if test="warnMessage.isRead != null and warnMessage.isRead != ''"> and is_read = #{warnMessage.isRead}</if>
and deleted = '0'
</where>
order by create_time desc
</select>