|
|
@ -7,9 +7,12 @@ import com.storeroom.annotaion.rest.AnonymousGetMapping; |
|
|
|
import com.storeroom.annotaion.rest.AnonymousPostMapping; |
|
|
|
import com.storeroom.exception.BaseException; |
|
|
|
import com.storeroom.modules.device.domain.AlarmDeseCaBinetLog; |
|
|
|
import com.storeroom.modules.device.domain.DeviceInfo; |
|
|
|
import com.storeroom.modules.device.service.ArchivesCasesService; |
|
|
|
import com.storeroom.modules.device.service.DeviceService; |
|
|
|
import com.storeroom.modules.device.service.OperatingStateService; |
|
|
|
import com.storeroom.modules.storeroom3d.service.AlarmInfoService; |
|
|
|
import com.storeroom.modules.storeroom3d.service.ThirdApiService; |
|
|
|
import com.storeroom.utils.ApiResponse; |
|
|
|
import com.storeroom.utils.StringUtils; |
|
|
|
import com.storeroom.utils.enums.ResponseStatus; |
|
|
@ -24,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
@ -36,6 +40,8 @@ public class DeviceController { |
|
|
|
private final DeviceService deviceService; |
|
|
|
private final OperatingStateService operatingStateService; |
|
|
|
private final ArchivesCasesService archivesCaseService; |
|
|
|
private final AlarmInfoService alarmInfoService; |
|
|
|
private final ThirdApiService thirdApiService; |
|
|
|
|
|
|
|
@ApiOperation("获取所有设备") |
|
|
|
@AnonymousGetMapping("all") |
|
|
@ -93,6 +99,42 @@ public class DeviceController { |
|
|
|
return ApiResponse.success(ResponseStatus.SUCCESS); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("获取在线设备数量") |
|
|
|
@AnonymousGetMapping("num") |
|
|
|
public ApiResponse<Object> onlineDevice() { |
|
|
|
int count; |
|
|
|
String url = alarmInfoService.getAddressUrl(); |
|
|
|
String token = thirdApiService.getToken(url); |
|
|
|
//查询密集架 |
|
|
|
List<DeviceInfo> deviceInfoList = deviceService.findByDevicetype("DD656054BE3D1DF1E2F1FC"); |
|
|
|
String url1 = "http://" + deviceInfoList.get(0).getDeviceIp() + ":" + deviceInfoList.get(0).getDevicePort(); |
|
|
|
String storeroomCode = deviceInfoList.get(0).getStoreroomCode(); |
|
|
|
Integer QuNo = deviceInfoList.get(0).getAreaNo(); |
|
|
|
if (StringUtils.isEmpty(storeroomCode)) { |
|
|
|
storeroomCode = "12345678"; |
|
|
|
} |
|
|
|
Object obj = thirdApiService.getCabinetState(url1, storeroomCode, QuNo); |
|
|
|
if (ObjectUtils.isEmpty(obj)) { |
|
|
|
count = 0; |
|
|
|
} else { |
|
|
|
count = deviceService.getDeviceTypeNum("DD656054BE3D1DF1E2F1FC"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
count += deviceService.getDeviceTypeNum("65D1886B0F864291766421"); |
|
|
|
count += deviceService.getDeviceTypeNum("7305DE3D273B0CAC079538"); |
|
|
|
if (!StringUtils.isEmpty(token)) { |
|
|
|
count += deviceService.getDeviceTypeNum("7882487E0C15304A3758AF"); |
|
|
|
count += deviceService.getDeviceTypeNum("250AE644EC43E4EC954A81"); |
|
|
|
count += deviceService.getDeviceTypeNum("C09A1946216E496BB3FA88"); |
|
|
|
count += deviceService.getDeviceTypeNum("89284777EFADA87FA342A7"); |
|
|
|
count += deviceService.getDeviceTypeNum("E58C8D7C896BCB9A408A78"); |
|
|
|
} |
|
|
|
return ApiResponse.success(count); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//第三方文档功能:平台是否跟密集架连接 |
|
|
|
@ApiOperation("第三方对接-返回通信状态") |
|
|
|
@AnonymousPostMapping("getdDevStatus") |
|
|
|