package com.hxzk.gps.service.impl.Warning;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageInfo;
|
import com.hxzk.gps.controller.System.SystemLogUtil;
|
import com.hxzk.gps.controller.Warning.dto.TableSearchResult.TableSearchResult;
|
|
import com.hxzk.gps.entity.Warning.TbWarning;
|
import com.hxzk.gps.mapper.Company.TbCompanyMapper;
|
import com.hxzk.gps.mapper.Warning.TbWarningMapper;
|
import com.hxzk.gps.result.ListDataResult;
|
import com.hxzk.gps.result.ResultTable;
|
import com.hxzk.gps.result.table;
|
import com.hxzk.gps.service.Company.TbCompanyService;
|
import com.hxzk.gps.service.Warning.TbWarningService;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.hxzk.gps.util.GetUser.UserInfoUtil;
|
import com.hxzk.gps.util.MessageUtils.MessageUtils;
|
import com.hxzk.gps.util.Result.ReturnMessage;
|
|
|
|
import com.hxzk.gps.util.Time.TimeUtil;
|
import com.hxzk.gps.util.UDP.UDP_Warning;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
import java.util.Optional;
|
|
/**
|
* <p>
|
* 服务实现类
|
* 告警管理
|
* </p>
|
*
|
* @author YuZhiTong
|
* @since 2025-05-23
|
*/
|
@Service
|
public class TbWarningServiceImpl extends ServiceImpl<TbWarningMapper, TbWarning> implements TbWarningService {
|
|
@Autowired
|
TbCompanyService companyService;
|
@Autowired
|
TbWarningMapper warningMapper;
|
|
@Override
|
public ResultTable FindWarningInfo(TableSearchResult TableSearchResult) {
|
PageHelper.startPage(TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize());
|
PageInfo<TbWarning> info = new PageInfo<>(warningMapper.FindWarningInfo(UserInfoUtil.getUserCompany(),TableSearchResult.getWarning().getObjectid(),TableSearchResult.getWarning().getBaoliu10(),TableSearchResult.getWarning().getType()));
|
table<TbWarning> achortable = new table<>(info.getList(),TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize(),info.getTotal());
|
return ListDataResult.resultTableSuccess(achortable, MessageUtils.getMessage("Success"));
|
}
|
|
@Override
|
public ResultTable FindWarningUntreated(TableSearchResult TableSearchResult) {
|
PageHelper.startPage(TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize());
|
List<Long> list = companyService.getChildCompanyIds(UserInfoUtil.getUserCompanyId());
|
PageInfo<TbWarning> info = new PageInfo<>(warningMapper.FindWarningUntreated(list,MessageUtils.getMessage("UnHandle")));
|
table<TbWarning> achortable = new table<>(info.getList(),TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize(),info.getTotal());
|
return ListDataResult.resultTableSuccess(achortable, MessageUtils.getMessage("Success"));
|
}
|
|
@Override
|
public ReturnMessage AllHandle() {
|
/*
|
声明操作状态
|
* */
|
boolean isSuccess = false;
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
try {
|
/*
|
发送指令到CS
|
* */
|
UDP_Warning.AllHandle();
|
TbWarning tbWarning = new TbWarning();
|
tbWarning.setStatus(MessageUtils.getMessage("Handle"));
|
baseMapper.update(tbWarning,queryWrapper);
|
isSuccess = true;
|
}catch (Exception e){
|
|
}
|
return SystemLogUtil.handleUpdateResult(isSuccess,"HandleWarning",MessageUtils.getMessage("ALL"));
|
}
|
|
@Override
|
public ReturnMessage Handle(TbWarning warning) {
|
/*
|
声明操作状态
|
* */
|
boolean isSuccess = false;
|
try {
|
/*
|
发送指令到CS
|
* */
|
UDP_Warning.Handle(warning);
|
QueryWrapper queryWrapper =new QueryWrapper<>();
|
queryWrapper.eq("id",warning.getId());
|
warning.setStatus(MessageUtils.getMessage("Handle"));
|
warning.setBaoliu6(TimeUtil.GetTime());
|
warning.setBaoliu5(UserInfoUtil.getUserName());
|
baseMapper.update(warning,queryWrapper);
|
isSuccess = true;
|
}catch (Exception e){
|
|
}
|
return SystemLogUtil.handleUpdateResult(isSuccess,"HandleWarning",warning.getObjectid());
|
}
|
}
|