|
|
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.CacheConstants;
|
|
|
+import com.xunmei.common.core.constant.Constants;
|
|
|
import com.xunmei.common.core.constant.DictConstants;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
import com.xunmei.common.core.domain.device.domain.SysMultiLayerDictionary;
|
|
|
@@ -229,6 +230,7 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
|
|
QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
queryWrapper.eq("org_id", orgId);
|
|
|
queryWrapper.eq("device_name", name);
|
|
|
+ queryWrapper.last(Constants.LIMIT1);
|
|
|
return baseMapper.selectOne(queryWrapper);
|
|
|
}
|
|
|
|
|
|
@@ -263,12 +265,12 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
|
|
if (null != sysDevice1) {
|
|
|
throw new RuntimeException("设备名称重复");
|
|
|
}
|
|
|
- if (!checkAssetNoRepeat(sysDevice.getOrgId(), sysDevice.getAssetNo(),null)) {
|
|
|
+ if (!checkAssetNoRepeat(sysDevice.getOrgId(), sysDevice.getAssetNo(), null)) {
|
|
|
throw new RuntimeException("资产编号重复");
|
|
|
}
|
|
|
int insert = sysDeviceMapper.insert(sysDevice);
|
|
|
//如果已经存在了主机同步上来的子系统,那么设备新增的就不能再同步到子系统表去
|
|
|
- final int exitDevice = remoteProtectionService.checkExitDevice(sysOrg.getId(), SecurityConstants.INNER);
|
|
|
+ final int exitDevice = remoteProtectionService.checkExitDevice(sysOrg.getId(), null, SecurityConstants.INNER);
|
|
|
|
|
|
//未报废的子系统且当前机构不存在主机同步子系统的情况下才需要同步到子系统表
|
|
|
if ("6".equals(sysDevice.getDeviceType()) && sysDevice.getDeviceStatus() != 3 && exitDevice == 0) {
|
|
|
@@ -337,7 +339,7 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
|
|
*/
|
|
|
@Override
|
|
|
public int updateSysDevice(SysDevice sysDevice) {
|
|
|
- if (!checkAssetNoRepeat(sysDevice.getOrgId(), sysDevice.getAssetNo(),sysDevice.getId())) {
|
|
|
+ if (!checkAssetNoRepeat(sysDevice.getOrgId(), sysDevice.getAssetNo(), sysDevice.getId())) {
|
|
|
throw new RuntimeException("资产编号重复");
|
|
|
}
|
|
|
sysDevice.setUpdateTime(DateUtils.getNowDate());
|
|
|
@@ -345,7 +347,7 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
|
|
SysOrg sysOrg = orgService.selectSysOrgById(sysDevice.getOrgId());
|
|
|
sysDevice.setOrgName(sysOrg.getShortName());
|
|
|
//如果已经存在了主机同步上来的子系统,那么设备新增的就不能再同步到子系统表去
|
|
|
- final int exitDevice = remoteProtectionService.checkExitDevice(sysDevice.getOrgId(), SecurityConstants.INNER);
|
|
|
+ final int exitDevice = remoteProtectionService.checkExitDevice(sysDevice.getOrgId(), sysDevice.getId(), SecurityConstants.INNER);
|
|
|
if ("6".equals(sysDevice.getDeviceType()) && ObjectUtil.isNull(sysDevice.getBusinessDeviceId()) && exitDevice == 0) {
|
|
|
ProtectionVO byDeviceId = remoteProtectionService.getByDeviceId(sysDevice.getId(), SecurityConstants.INNER);
|
|
|
ProtectionDTO protectionDTO = new ProtectionDTO();
|
|
|
@@ -370,6 +372,11 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
|
|
return sysDeviceMapper.updateById(sysDevice);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public int checkExitSyncSubSystem(Long orgId, Long deviceId) {
|
|
|
+ return remoteProtectionService.checkExitDevice(orgId, deviceId, SecurityConstants.INNER);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 批量删除【请填写功能名称】
|
|
|
*
|
|
|
@@ -473,7 +480,7 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
|
|
if (StringUtils.isEmpty(assetNo)) {
|
|
|
msgList.add("资产编号为空");
|
|
|
} else {
|
|
|
- if (device.getOrgId() != null && !checkAssetNoRepeat(device.getOrgId(), assetNo,null)) {
|
|
|
+ if (device.getOrgId() != null && !checkAssetNoRepeat(device.getOrgId(), assetNo, null)) {
|
|
|
msgList.add("资产编号重复");
|
|
|
} else {
|
|
|
device.setAssetNo(assetNo);
|