|
@@ -7,6 +7,7 @@ import com.jpsoft.smart.modules.common.dto.Sort;
|
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.smart.modules.base.entity.DeviceInfo;
|
|
|
import com.jpsoft.smart.modules.base.service.DeviceInfoService;
|
|
|
+import com.jpsoft.smart.modules.lapi.service.ILapiService;
|
|
|
import com.jpsoft.smart.modules.sys.service.DataDictionaryService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
@@ -34,6 +35,9 @@ public class DeviceInfoController {
|
|
|
@Autowired
|
|
|
private DataDictionaryService dataDictionaryService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ILapiService lapiService;
|
|
|
+
|
|
|
@ApiOperation(value="添加设备")
|
|
|
@PostMapping("add")
|
|
|
public MessageResult<DeviceInfo> add(@RequestBody DeviceInfo deviceInfo,@RequestAttribute String subject){
|
|
@@ -245,4 +249,24 @@ public class DeviceInfoController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="根据IP地址和端口号查找设备")
|
|
|
+ @PostMapping("getByIpAddressAndPort")
|
|
|
+ public MessageResult<DeviceInfo> getByIpAddressAndPort( String ipAddress,String port,@RequestAttribute String subject) {
|
|
|
+ MessageResult<DeviceInfo> msgResult = new MessageResult<>();
|
|
|
+ try {
|
|
|
+ DeviceInfo device = lapiService.findByIpAddressAndPort(ipAddress, port);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(device);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|