|
|
@@ -6,11 +6,13 @@ import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.domain.panel.dto.PanelListDto;
|
|
|
import com.xunmei.common.core.domain.panel.vo.PanelListVo;
|
|
|
+import com.xunmei.common.core.utils.bean.BeanUtils;
|
|
|
import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.core.resumption.domain.Protection;
|
|
|
@@ -23,6 +25,7 @@ import com.xunmei.core.resumption.mapper.ProtectionMapper;
|
|
|
import com.xunmei.core.resumption.service.IProtectionService;
|
|
|
import com.xunmei.core.resumption.vo.protection.ProtectionLogPageVo;
|
|
|
import com.xunmei.core.resumption.vo.protection.ProtectionPageVo;
|
|
|
+import com.xunmei.system.api.vo.ProtectionVO;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -100,10 +103,16 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, Protect
|
|
|
if (dto.getId() != null) {
|
|
|
protection = getById(dto.getId());
|
|
|
BeanUtil.copyProperties(dto, protection);
|
|
|
+ if (null!=dto.getDeviceId()){
|
|
|
+ protection.setAlarmHostCode(dto.getDeviceId());
|
|
|
+ }
|
|
|
updateById(protection);
|
|
|
} else {
|
|
|
BeanUtil.copyProperties(dto, protection);
|
|
|
protection.setStatus("2");
|
|
|
+ if (null!=dto.getDeviceId()){
|
|
|
+ protection.setAlarmHostCode(dto.getDeviceId());
|
|
|
+ }
|
|
|
save(protection);
|
|
|
}
|
|
|
|
|
|
@@ -112,6 +121,17 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, Protect
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public ProtectionVO getByDeviceId(Long deviceId) {
|
|
|
+ QueryWrapper queryWrapper=new QueryWrapper();
|
|
|
+ queryWrapper.eq("deleted",0);
|
|
|
+ queryWrapper.eq("device_id",deviceId);
|
|
|
+ Protection protection = baseMapper.selectOne(queryWrapper);
|
|
|
+ ProtectionVO protectionVO=new ProtectionVO();
|
|
|
+ BeanUtils.copyProperties(protection,protectionVO);
|
|
|
+ return protectionVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public boolean del(Long id) {
|
|
|
int count = baseMapper.update(null, new LambdaUpdateWrapper<Protection>()
|
|
|
.eq(Protection::getId, id)
|
|
|
@@ -119,6 +139,14 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, Protect
|
|
|
return count > 0;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public int delByDeviceId(Long deviceId) {
|
|
|
+ int count = baseMapper.update(null, new LambdaUpdateWrapper<Protection>()
|
|
|
+ .eq(Protection::getDeviceId, deviceId)
|
|
|
+ .set(Protection::getDeleted, 1));
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public TableDataInfo history(ProtectionLogPageDto request) {
|