|
@@ -29,6 +29,8 @@ import com.xy.dto.*;
|
|
import com.xy.dto.api.biz.ContainerAddDTO;
|
|
import com.xy.dto.api.biz.ContainerAddDTO;
|
|
import com.xy.dto.be.MercDto;
|
|
import com.xy.dto.be.MercDto;
|
|
import com.xy.dto.common.MercPlaceDto;
|
|
import com.xy.dto.common.MercPlaceDto;
|
|
|
|
+import com.xy.dto.device.DeviceQueryDTO;
|
|
|
|
+import com.xy.dto.device.DeviceRegDTO;
|
|
import com.xy.entity.*;
|
|
import com.xy.entity.*;
|
|
import com.xy.enums.FileExportType;
|
|
import com.xy.enums.FileExportType;
|
|
import com.xy.error.CommRuntimeException;
|
|
import com.xy.error.CommRuntimeException;
|
|
@@ -45,6 +47,7 @@ import com.xy.utils.enums.DeviceActiveStateEnum;
|
|
import com.xy.utils.enums.DeviceLockState;
|
|
import com.xy.utils.enums.DeviceLockState;
|
|
import com.xy.utils.enums.DeviceNetSateType;
|
|
import com.xy.utils.enums.DeviceNetSateType;
|
|
import com.xy.utils.enums.DeviceTypeEnum;
|
|
import com.xy.utils.enums.DeviceTypeEnum;
|
|
|
|
+import com.xy.vo.DeviceQueryVO;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import jodd.introspector.MapperFunction;
|
|
import jodd.introspector.MapperFunction;
|
|
@@ -108,15 +111,17 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
private final MercPlaceService mercPlaceService;
|
|
private final MercPlaceService mercPlaceService;
|
|
|
|
|
|
|
|
+ private final TyApiService tyApiService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@ApiOperation("设备列表-管理员")
|
|
@ApiOperation("设备列表-管理员")
|
|
public R<List<DeviceInfoDto.ListByAdminName>> listByAdminName(@RequestBody @Validated DeviceInfoDto.GroupByAdminNameDto dto) {
|
|
public R<List<DeviceInfoDto.ListByAdminName>> listByAdminName(@RequestBody @Validated DeviceInfoDto.GroupByAdminNameDto dto) {
|
|
String noAdmin = "未分配管理员";
|
|
String noAdmin = "未分配管理员";
|
|
List<DeviceInfoDto.ListByAdminName> deviceInfoList = baseMapper.listByAdminName(dto);
|
|
List<DeviceInfoDto.ListByAdminName> deviceInfoList = baseMapper.listByAdminName(dto);
|
|
- deviceInfoList.forEach(i->{
|
|
|
|
|
|
+ deviceInfoList.forEach(i -> {
|
|
SysDictRedis dictDeviceType = SysDictUtils.get(DictConsts.DEVICE_TYPE, String.valueOf(i.getDeviceType()));
|
|
SysDictRedis dictDeviceType = SysDictUtils.get(DictConsts.DEVICE_TYPE, String.valueOf(i.getDeviceType()));
|
|
i.setDeviceTypeName(dictDeviceType.getMsg());
|
|
i.setDeviceTypeName(dictDeviceType.getMsg());
|
|
- if(!Emptys.check(i.getDeviceName())){
|
|
|
|
|
|
+ if (!Emptys.check(i.getDeviceName())) {
|
|
i.setDeviceName("");
|
|
i.setDeviceName("");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -133,17 +138,17 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
PageBean page = dto.getPage();
|
|
PageBean page = dto.getPage();
|
|
String noAdmin = "未分配管理员";
|
|
String noAdmin = "未分配管理员";
|
|
IPage<DeviceInfoDto.ListByAdminName> deviceInfoList = baseMapper.pageByAdminName(toIPage(page), dto);
|
|
IPage<DeviceInfoDto.ListByAdminName> deviceInfoList = baseMapper.pageByAdminName(toIPage(page), dto);
|
|
- deviceInfoList.getRecords().forEach(i->{
|
|
|
|
|
|
+ deviceInfoList.getRecords().forEach(i -> {
|
|
SysDictRedis dictDeviceType = SysDictUtils.get(DictConsts.DEVICE_TYPE, String.valueOf(i.getDeviceType()));
|
|
SysDictRedis dictDeviceType = SysDictUtils.get(DictConsts.DEVICE_TYPE, String.valueOf(i.getDeviceType()));
|
|
i.setDeviceTypeName(dictDeviceType.getMsg());
|
|
i.setDeviceTypeName(dictDeviceType.getMsg());
|
|
- if(!Emptys.check(i.getDeviceName())){
|
|
|
|
|
|
+ if (!Emptys.check(i.getDeviceName())) {
|
|
i.setDeviceName("");
|
|
i.setDeviceName("");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
//没有管理员的的设置默认值
|
|
//没有管理员的的设置默认值
|
|
deviceInfoList.getRecords().stream().filter(s -> s.getAdminName() == null).forEach(s -> s.setAdminName(noAdmin));
|
|
deviceInfoList.getRecords().stream().filter(s -> s.getAdminName() == null).forEach(s -> s.setAdminName(noAdmin));
|
|
- return R.ok(toPageBean(DeviceInfoDto.ListByAdminName.class,deviceInfoList));
|
|
|
|
|
|
+ return R.ok(toPageBean(DeviceInfoDto.ListByAdminName.class, deviceInfoList));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -156,9 +161,9 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
List<DeviceInfoDto.GroupByAdminNameVo> list = new ArrayList<>();
|
|
List<DeviceInfoDto.GroupByAdminNameVo> list = new ArrayList<>();
|
|
//不包含未分配管理员的
|
|
//不包含未分配管理员的
|
|
deviceMap.forEach(
|
|
deviceMap.forEach(
|
|
- (k,i)->{
|
|
|
|
|
|
+ (k, i) -> {
|
|
DeviceInfoDto.GroupByAdminNameVo vo = new DeviceInfoDto.GroupByAdminNameVo();
|
|
DeviceInfoDto.GroupByAdminNameVo vo = new DeviceInfoDto.GroupByAdminNameVo();
|
|
- if(!noAdmin.equals(k)){
|
|
|
|
|
|
+ if (!noAdmin.equals(k)) {
|
|
vo.setAdminName(k)
|
|
vo.setAdminName(k)
|
|
.setDeviceNum(i.size())
|
|
.setDeviceNum(i.size())
|
|
.setDeviceInfos(i);
|
|
.setDeviceInfos(i);
|
|
@@ -168,7 +173,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
);
|
|
);
|
|
//包含分配管理员的
|
|
//包含分配管理员的
|
|
List<DeviceInfoDto.ListByAdminName> noAdminNamesList = deviceMap.get(noAdmin);
|
|
List<DeviceInfoDto.ListByAdminName> noAdminNamesList = deviceMap.get(noAdmin);
|
|
- if(Emptys.check(noAdminNamesList)){
|
|
|
|
|
|
+ if (Emptys.check(noAdminNamesList)) {
|
|
DeviceInfoDto.GroupByAdminNameVo vo = new DeviceInfoDto.GroupByAdminNameVo();
|
|
DeviceInfoDto.GroupByAdminNameVo vo = new DeviceInfoDto.GroupByAdminNameVo();
|
|
vo.setAdminName(noAdmin)
|
|
vo.setAdminName(noAdmin)
|
|
.setDeviceNum(noAdminNamesList.size())
|
|
.setDeviceNum(noAdminNamesList.size())
|
|
@@ -624,6 +629,18 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
//货柜不存在,新增
|
|
//货柜不存在,新增
|
|
cloudWalkApiService.containerAdd(new ContainerAddDTO().setContainerCode(String.valueOf(deviceId)));
|
|
cloudWalkApiService.containerAdd(new ContainerAddDTO().setContainerCode(String.valueOf(deviceId)));
|
|
}
|
|
}
|
|
|
|
+ } else if (AlgorithmTypeEnum.TY.getId() == algorithmId) {
|
|
|
|
+ //拓元算法
|
|
|
|
+ //查询登记设备
|
|
|
|
+ DeviceQueryVO deviceQueryVO = tyApiService.deviceQuery(new DeviceQueryDTO().setCpuId(String.valueOf(deviceId)));
|
|
|
|
+ Integer status = deviceQueryVO.getStatus();
|
|
|
|
+ if (status != null && 1000 == status.intValue()) {
|
|
|
|
+ //未知的设备CPUID,进行登记
|
|
|
|
+ tyApiService.deviceReg(new DeviceRegDTO()
|
|
|
|
+ .setCpuId(String.valueOf(deviceId))
|
|
|
|
+ .setDeviceNumber(String.valueOf(deviceId))
|
|
|
|
+ );
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
int refMercId = deviceInfo.getMercId().intValue();
|
|
int refMercId = deviceInfo.getMercId().intValue();
|