|
@@ -2,8 +2,9 @@ package com.jpsoft.smart.modules.base.service.impl;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
-import java.util.UUID;
|
|
|
import javax.annotation.Resource;
|
|
|
+
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.jpsoft.smart.modules.base.dao.DeviceInfoDAO;
|
|
@@ -13,6 +14,7 @@ import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.smart.modules.common.dto.Sort;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
|
+@Slf4j
|
|
|
@Transactional
|
|
|
@Component(value="deviceInfoService")
|
|
|
public class DeviceInfoServiceImpl implements DeviceInfoService {
|
|
@@ -69,9 +71,14 @@ public class DeviceInfoServiceImpl implements DeviceInfoService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int updateByDeviceNo(String deviceNo, String ip) {
|
|
|
+ public void updateByDeviceNo(String deviceNo, String ip) {
|
|
|
DeviceInfo deviceInfo= deviceInfoDAO.findByDeviceNo(deviceNo);
|
|
|
+ String oldIp = deviceInfo.getIpAddress();
|
|
|
+ if (deviceInfo.getIsAutoUpdate() && !deviceInfo.getIpAddress().equals(ip)){
|
|
|
+ deviceInfo.setIpAddress(ip);
|
|
|
+ deviceInfoDAO.update(deviceInfo);
|
|
|
+ log.warn(deviceNo+"的ip由原来的:"+oldIp+"自动更新为:"+ip);
|
|
|
+ }
|
|
|
|
|
|
- return 0;
|
|
|
}
|
|
|
}
|