|
@@ -27,6 +27,7 @@ import com.xy.device.EnumDeviceFaultLevelPayThreshold;
|
|
|
import com.xy.device.EnumDeviceOnlineStatus;
|
|
|
import com.xy.device.EnumQualityMercSets;
|
|
|
import com.xy.dto.*;
|
|
|
+import com.xy.dto.api.biz.ContainerAddDTO;
|
|
|
import com.xy.dto.be.MercDto;
|
|
|
import com.xy.entity.*;
|
|
|
import com.xy.enums.FileExportType;
|
|
@@ -75,6 +76,7 @@ import static com.xy.utils.PlusBeans.*;
|
|
|
@Api(tags = "设备-信息")
|
|
|
public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceInfo> implements DeviceInfoService {
|
|
|
|
|
|
+ private final CloudWalkApiService cloudWalkApiService;
|
|
|
/**
|
|
|
* 质检商户code
|
|
|
*/
|
|
@@ -271,7 +273,17 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
DeviceInfo deviceInfo = copy(DeviceInfo.class, update)
|
|
|
.setUpdateTime(LocalDateTime.now());
|
|
|
updateById(deviceInfo);
|
|
|
- DeviceInfoDto.Vo device = R.feignCheckData(this.obj(new DeviceInfoDto.Obj().setDeviceId(update.getDeviceId()).setIsSysinfo(true)));
|
|
|
+ Long deviceId = deviceInfo.getDeviceId();
|
|
|
+ DeviceInfoDto.Vo device = R.feignCheckData(this.obj(new DeviceInfoDto.Obj().setDeviceId(deviceId).setIsSysinfo(true)));
|
|
|
+ Long algorithmId = update.getAlgorithmId();
|
|
|
+ if (algorithmId != null && AlgorithmTypeEnum.CLOUD.getId() == algorithmId) {
|
|
|
+ //云从算法
|
|
|
+ boolean b = cloudWalkApiService.checkDeviceExist(deviceId);
|
|
|
+ if (!b) {
|
|
|
+ //货柜不存在,新增
|
|
|
+ cloudWalkApiService.containerAdd(new ContainerAddDTO().setContainerCode(String.valueOf(deviceId)));
|
|
|
+ }
|
|
|
+ }
|
|
|
Integer deviceType = device.getDeviceType();
|
|
|
if (ObjectUtil.equals(DeviceTypeEnum.TYPE5.getCode(), deviceType)) {
|
|
|
DeviceUpdateDTO deviceUpdateDTO = new DeviceUpdateDTO();
|
|
@@ -415,9 +427,21 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
List<DeviceInfo> deviceInfos = this.listByIds(deviceIds);
|
|
|
for (DeviceInfo deviceInfo : deviceInfos) {
|
|
|
Integer deviceType = deviceInfo.getDeviceType();
|
|
|
+ Long deviceId = deviceInfo.getDeviceId();
|
|
|
+
|
|
|
if (ObjectUtil.equals(deviceType, DeviceTypeEnum.TYPE5.getCode())) {
|
|
|
//支付宝设备算法
|
|
|
algorithmId = AlgorithmTypeEnum.ALIPAY.getId();
|
|
|
+ } else {
|
|
|
+ //非支付宝算法
|
|
|
+ if (AlgorithmTypeEnum.CLOUD.getId() == algorithmId) {
|
|
|
+ //云从算法
|
|
|
+ boolean b = cloudWalkApiService.checkDeviceExist(deviceId);
|
|
|
+ if (!b) {
|
|
|
+ //货柜不存在,新增
|
|
|
+ cloudWalkApiService.containerAdd(new ContainerAddDTO().setContainerCode(String.valueOf(deviceId)));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
int refMercId = deviceInfo.getMercId().intValue();
|
|
|
String refMercCode = deviceInfo.getMercCode();
|
|
@@ -654,6 +678,27 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
} else {
|
|
|
dto.setActiveState("1");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ Integer busyStatus = dto.getBusyStatus();
|
|
|
+ Integer onlineStatus = dto.getOnlineStatus();
|
|
|
+ Integer deviceType = dto.getDeviceType();
|
|
|
+ //条件查询 在线状态,运营状态,设备类型,
|
|
|
+ List<Long> deviceIdList = new ArrayList<>();
|
|
|
+ if (deviceId != null) {
|
|
|
+ deviceIdList.add(deviceId);
|
|
|
+ }
|
|
|
+ if (onlineStatus != null) {
|
|
|
+ List<DeviceStatus> deviceStatusList = deviceStatusService.list(Wrappers.<DeviceStatus>lambdaQuery()
|
|
|
+ .eq(onlineStatus != null, DeviceStatus::getNetState, onlineStatus)
|
|
|
+ );
|
|
|
+ if (CollUtil.isNotEmpty(deviceStatusList)) {
|
|
|
+ List<Long> dbDeviceIdList = deviceStatusList.stream().map(DeviceStatus::getDeviceId).collect(Collectors.toList());
|
|
|
+ deviceIdList.addAll(dbDeviceIdList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dto.setDeviceIdList(deviceIdList);
|
|
|
+
|
|
|
List<DeviceInfoDto.MercHomeCountVO> list = this.baseMapper.merHomeCountList(dto);
|
|
|
if (CollUtil.isEmpty(list)) {
|
|
|
return R.ok(Collections.emptyList());
|
|
@@ -664,7 +709,9 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
//非质检商户才需要激活
|
|
|
lqw.eq(!isQa, DeviceInfo::getActiveState, DeviceActiveStateEnum.TRUE.getCode());
|
|
|
lqw.eq(mercId != null, DeviceInfo::getMercId, mercId);
|
|
|
- lqw.eq(deviceId != null, DeviceInfo::getDeviceId, deviceId);
|
|
|
+ lqw.eq(busyStatus != null, DeviceInfo::getBusyState, busyStatus);
|
|
|
+ lqw.eq(deviceType != null, DeviceInfo::getDeviceType, deviceType);
|
|
|
+ lqw.in(CollUtil.isNotEmpty(deviceIdList), DeviceInfo::getDeviceId, deviceIdList);
|
|
|
lqw.like(StrUtil.isNotEmpty(deviceName), DeviceInfo::getDeviceName, deviceName).orderByAsc(true, DeviceInfo::getDeviceName, DeviceInfo::getDeviceId);
|
|
|
List<DeviceInfo> deviceInfoList = this.list(lqw);
|
|
|
//未分配线路的设置默认值
|