补正提醒
This commit is contained in:
parent
409ba7e88e
commit
e1aaa4ac12
@ -4,8 +4,11 @@ import java.util.Arrays;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
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.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.util.DateUtils;
|
||||||
import cn.iocoder.yudao.module.inspection.entity.WarnMessage;
|
import cn.iocoder.yudao.module.inspection.entity.WarnMessage;
|
||||||
import cn.iocoder.yudao.module.inspection.service.IWarnMessageService;
|
import cn.iocoder.yudao.module.inspection.service.IWarnMessageService;
|
||||||
|
import io.prometheus.client.CollectorRegistry;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import cn.iocoder.yudao.module.inspection.mapper.InspectionEquInfoMapper;
|
import cn.iocoder.yudao.module.inspection.mapper.InspectionEquInfoMapper;
|
||||||
@ -30,6 +34,7 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
|
|||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private IWarnMessageService messageService;
|
private IWarnMessageService messageService;
|
||||||
|
private CollectorRegistry collectorRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询equInfo
|
* 查询equInfo
|
||||||
@ -92,14 +97,16 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DSTransactional
|
||||||
public int updateInspectionEquInfo(InspectionEquInfo inspectionEquInfo)
|
public int updateInspectionEquInfo(InspectionEquInfo inspectionEquInfo)
|
||||||
{
|
{
|
||||||
LambdaQueryWrapper<WarnMessage> queryWrapper =new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<WarnMessage> queryWrapper =new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(WarnMessage::getType,"equ").eq(WarnMessage::getObjectId,inspectionEquInfo.getId());
|
queryWrapper.eq(WarnMessage::getType,"equ").eq(WarnMessage::getObjectId,inspectionEquInfo.getId());
|
||||||
WarnMessage one = messageService.getOne(queryWrapper);
|
List<WarnMessage> list = messageService.list(queryWrapper);
|
||||||
if (ObjectUtil.isNotEmpty(one)){
|
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())){
|
if (ObjectUtil.isNotEmpty(inspectionEquInfo.getNextCheckTime())){
|
||||||
//同时处理提醒信息
|
//同时处理提醒信息
|
||||||
|
@ -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.title != null and warnMessage.title != ''"> and title = #{warnMessage.title}</if>
|
||||||
<if test="warnMessage.partnerId != null "> and partner_id = #{warnMessage.partnerId}</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>
|
<if test="warnMessage.isRead != null and warnMessage.isRead != ''"> and is_read = #{warnMessage.isRead}</if>
|
||||||
|
and deleted = '0'
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
Loading…
Reference in New Issue
Block a user