|
|
@ -2,40 +2,40 @@ package com.bellmann.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.bellmann.common.base.IBaseEnum; |
|
|
|
import com.bellmann.common.base.IBaseEnum; |
|
|
|
import com.bellmann.common.constant.SecurityConstants; |
|
|
|
import com.bellmann.common.constant.SecurityConstants; |
|
|
|
import com.bellmann.common.constant.StringUtilsConstants; |
|
|
|
import com.bellmann.common.constant.StringUtilsConstants; |
|
|
|
import com.bellmann.common.constant.SystemConstants; |
|
|
|
import com.bellmann.common.constant.SystemConstants; |
|
|
|
import com.bellmann.common.enums.DevOnlineEnum; |
|
|
|
import com.bellmann.common.enums.*; |
|
|
|
import com.bellmann.common.enums.DevOwnerClassEnum; |
|
|
|
|
|
|
|
import com.bellmann.common.enums.DevRegStatusEnum; |
|
|
|
|
|
|
|
import com.bellmann.common.enums.DevStatusEnum; |
|
|
|
|
|
|
|
import com.bellmann.common.exception.BusinessException; |
|
|
|
import com.bellmann.common.exception.BusinessException; |
|
|
|
import com.bellmann.common.result.PageResult; |
|
|
|
import com.bellmann.common.result.PageResult; |
|
|
|
import com.bellmann.common.result.Result; |
|
|
|
import com.bellmann.common.result.Result; |
|
|
|
import com.bellmann.common.result.ResultCode; |
|
|
|
import com.bellmann.common.result.ResultCode; |
|
|
|
import com.bellmann.converter.DeviceStaticConverter; |
|
|
|
import com.bellmann.converter.DeviceStaticConverter; |
|
|
|
import com.bellmann.manger.CustomerManager; |
|
|
|
import com.bellmann.manger.*; |
|
|
|
import com.bellmann.manger.DeviceTypeManager; |
|
|
|
|
|
|
|
import com.bellmann.manger.FileRecordManager; |
|
|
|
|
|
|
|
import com.bellmann.manger.IpAddressDomainManager; |
|
|
|
|
|
|
|
import com.bellmann.mapper.*; |
|
|
|
import com.bellmann.mapper.*; |
|
|
|
import com.bellmann.model.bo.EquipmentBO; |
|
|
|
import com.bellmann.model.bo.EquipmentBO; |
|
|
|
|
|
|
|
import com.bellmann.model.bo.RemoteEquipmentBO; |
|
|
|
import com.bellmann.model.entity.*; |
|
|
|
import com.bellmann.model.entity.*; |
|
|
|
import com.bellmann.model.form.EquipmentAddForm; |
|
|
|
import com.bellmann.model.form.EquipmentAddForm; |
|
|
|
import com.bellmann.model.form.EquipmentDetailForm; |
|
|
|
import com.bellmann.model.form.EquipmentDetailForm; |
|
|
|
import com.bellmann.model.form.PrivateProfileForm; |
|
|
|
import com.bellmann.model.form.PrivateProfileForm; |
|
|
|
|
|
|
|
import com.bellmann.model.form.UnBindingForm; |
|
|
|
import com.bellmann.model.query.DevOuiSnoQuery; |
|
|
|
import com.bellmann.model.query.DevOuiSnoQuery; |
|
|
|
import com.bellmann.model.query.SelectQuery; |
|
|
|
import com.bellmann.model.query.SelectQuery; |
|
|
|
import com.bellmann.model.vo.EquipmentCustomerVO; |
|
|
|
import com.bellmann.model.vo.*; |
|
|
|
import com.bellmann.model.vo.EquipmentDetailVO; |
|
|
|
|
|
|
|
import com.bellmann.model.vo.EquipmentTypeVO; |
|
|
|
|
|
|
|
import com.bellmann.model.vo.EquipmentVO; |
|
|
|
|
|
|
|
import com.bellmann.security.util.SecurityUtils; |
|
|
|
import com.bellmann.security.util.SecurityUtils; |
|
|
|
import com.bellmann.service.DeviceStaticService; |
|
|
|
import com.bellmann.service.DeviceStaticService; |
|
|
|
|
|
|
|
import com.zznode.itms.api.InventoryManager; |
|
|
|
|
|
|
|
import com.zznode.itms.api.NBIManager; |
|
|
|
|
|
|
|
import com.zznode.itms.idl.order.OrderInfoStructListHolder; |
|
|
|
|
|
|
|
import com.zznode.itms.idl.order.OrderStatus; |
|
|
|
|
|
|
|
import com.zznode.itms.idl.order.OrderType; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -70,6 +70,14 @@ public class DeviceStaticServiceImpl implements DeviceStaticService { |
|
|
|
|
|
|
|
|
|
|
|
private final FileDevMapMapper fileDevMapMapper; |
|
|
|
private final FileDevMapMapper fileDevMapMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ServiceManager serviceManager; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final LibDeviceCodeMapper libDeviceCodeMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final OrderInfoMapper orderInfoMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final DeviceServiceMapMapper deviceServiceMapMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Page<EquipmentVO> resourcePage(SelectQuery query) { |
|
|
|
public Page<EquipmentVO> resourcePage(SelectQuery query) { |
|
|
|
int pageNum = query.getPageNum(); |
|
|
|
int pageNum = query.getPageNum(); |
|
|
@ -262,4 +270,146 @@ public class DeviceStaticServiceImpl implements DeviceStaticService { |
|
|
|
stringPage.setTotal(list.size()); |
|
|
|
stringPage.setTotal(list.size()); |
|
|
|
return PageResult.success(stringPage); |
|
|
|
return PageResult.success(stringPage); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Page<RemoteEquipmentVO> remotePage(SelectQuery query) { |
|
|
|
|
|
|
|
int pageNum = query.getPageNum(); |
|
|
|
|
|
|
|
int pageSize = query.getPageSize(); |
|
|
|
|
|
|
|
Page<RemoteEquipmentBO> page = new Page<>(pageNum,pageSize); |
|
|
|
|
|
|
|
Page<RemoteEquipmentBO> boPage = deviceStaticMapper.remotePage(page,query.getSelectName(),query.getSelectValue()); |
|
|
|
|
|
|
|
return deviceStaticConverter.remoteBOPage2VOPage(boPage); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Result<RemoteDevInfoVO> remoteDevInfo(Long devId) { |
|
|
|
|
|
|
|
RemoteDevInfoVO remoteDevInfoVO = new RemoteDevInfoVO(); |
|
|
|
|
|
|
|
DeviceStatic deviceStatic = deviceStaticMapper.selectOne( |
|
|
|
|
|
|
|
new QueryWrapper<DeviceStatic>() |
|
|
|
|
|
|
|
.select("dev_id","dev_ad_no","dev_sno","region_area_id","dev_remark1","dev_remark4","dev_status","cust_id as custom_id","type_and_ver_id") |
|
|
|
|
|
|
|
.eq("dev_id",devId) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(deviceStatic,remoteDevInfoVO); |
|
|
|
|
|
|
|
if (deviceStatic.getCustomId()!=null){ |
|
|
|
|
|
|
|
Customer customer = customerManager.findByCustomId(deviceStatic.getCustomId()); |
|
|
|
|
|
|
|
if (customer!=null) { |
|
|
|
|
|
|
|
remoteDevInfoVO.setCustomType(IBaseEnum.getLabelByValue(customer.getCustomType(), CustomTypeEnum.class)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (deviceStatic.getTypeAndVerId()!=null) { |
|
|
|
|
|
|
|
EquipmentTypeVO devType = deviceTypeManager.findEquipmentType(deviceStatic.getTypeAndVerId()); |
|
|
|
|
|
|
|
if (devType!=null) { |
|
|
|
|
|
|
|
remoteDevInfoVO.setDevAccessType(devType.getDevAccessType()); |
|
|
|
|
|
|
|
remoteDevInfoVO.setDevTypeNameDetail(devType.getEquipmentTypeVer()); |
|
|
|
|
|
|
|
remoteDevInfoVO.setDevTypeName(devType.getDevTypeName()); |
|
|
|
|
|
|
|
remoteDevInfoVO.setDevHardVer(devType.getDevHardVer()); |
|
|
|
|
|
|
|
remoteDevInfoVO.setSoftVer(devType.getSoftVer()); |
|
|
|
|
|
|
|
remoteDevInfoVO.setDevVendorName(devType.getDevVendorName()); |
|
|
|
|
|
|
|
remoteDevInfoVO.setDevVendorOui(devType.getDevVendorOui()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
DeviceDynamic deviceDynamic = deviceDynamicMapper.selectOne(new LambdaQueryWrapper<DeviceDynamic>() |
|
|
|
|
|
|
|
.eq(DeviceDynamic::getDevId, devId) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (deviceDynamic!=null){ |
|
|
|
|
|
|
|
remoteDevInfoVO.setDevOnlineTime(deviceDynamic.getDevOnlineTime()); |
|
|
|
|
|
|
|
remoteDevInfoVO.setDevIp(deviceDynamic.getDevIp()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
DeviceStaticDetail staticDetail = deviceStaticDetailMapper.selectOne(new QueryWrapper<DeviceStaticDetail>() |
|
|
|
|
|
|
|
.select("user_sn_no","remark2") |
|
|
|
|
|
|
|
.eq("dev_id",devId) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (staticDetail!=null){ |
|
|
|
|
|
|
|
remoteDevInfoVO.setUserSnNo(staticDetail.getUserSnNo()); |
|
|
|
|
|
|
|
String remark2 = staticDetail.getRemark2(); |
|
|
|
|
|
|
|
remoteDevInfoVO.setUseState(remark2==null|| remark2.isEmpty() ?"未装":remark2); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
remoteDevInfoVO.setDevStatus(IBaseEnum.getLabelByValue(deviceStatic.getDevStatus(),DevStatusEnum.class)); |
|
|
|
|
|
|
|
remoteDevInfoVO.setDomain((String) redisTemplate.opsForHash() |
|
|
|
|
|
|
|
.get(SecurityConstants.DOMAIN_PREFIX, |
|
|
|
|
|
|
|
deviceStatic.getRegionAreaId().toString())); |
|
|
|
|
|
|
|
String conType = serviceManager.getConnType(devId); |
|
|
|
|
|
|
|
remoteDevInfoVO.setConType(conType); |
|
|
|
|
|
|
|
Long count = libDeviceCodeMapper.selectCount(new LambdaQueryWrapper<LibDeviceCode>() |
|
|
|
|
|
|
|
.eq(LibDeviceCode::getDevOui, deviceStatic.getDevRemark3()) |
|
|
|
|
|
|
|
.eq(LibDeviceCode::getDevSno, deviceStatic.getDevSno()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
remoteDevInfoVO.setBlacklist(count>0?"是":"否"); |
|
|
|
|
|
|
|
return Result.success(remoteDevInfoVO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Result<String> unbindingLogicId(UnBindingForm form) { |
|
|
|
|
|
|
|
int res = 0; |
|
|
|
|
|
|
|
if(form.getDevRemark4().contains("^")){ |
|
|
|
|
|
|
|
res = upDeviceStaticGetDevId3(form); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (res!=1){ |
|
|
|
|
|
|
|
return Result.failed(ResultCode.LOGICID_ALREADY_UNBINDING_ORDER_ALREADY_EXIST); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return upDeviceStaticGetDevId2(form); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Result<String> upDeviceStaticGetDevId2(UnBindingForm form) { |
|
|
|
|
|
|
|
deviceStaticMapper.update(null,new LambdaUpdateWrapper<DeviceStatic>() |
|
|
|
|
|
|
|
.eq(DeviceStatic::getDevId,form.getDevId()) |
|
|
|
|
|
|
|
.set(DeviceStatic::getDevPppoe,null) |
|
|
|
|
|
|
|
.set(DeviceStatic::getDevAdNo,null) |
|
|
|
|
|
|
|
.set(DeviceStatic::getCustomId,null) |
|
|
|
|
|
|
|
.set(DeviceStatic::getDevRemark4,null) |
|
|
|
|
|
|
|
.set(DeviceStatic::getDevStatus,DevStatusEnum.NORMAL.getValue()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
deviceStaticDetailMapper.update(null,new LambdaUpdateWrapper<DeviceStaticDetail>() |
|
|
|
|
|
|
|
.set(DeviceStaticDetail::getUserSnNo,null) |
|
|
|
|
|
|
|
.set(DeviceStaticDetail::getBandAccess,null) |
|
|
|
|
|
|
|
.set(DeviceStaticDetail::getIptvAccess,null) |
|
|
|
|
|
|
|
.eq(DeviceStaticDetail::getDevId,form.getDevId()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
String devSno = form.getDevSno(); |
|
|
|
|
|
|
|
String devVendorOui = form.getDevVendorOui(); |
|
|
|
|
|
|
|
if (!devVendorOui.isEmpty()){ |
|
|
|
|
|
|
|
devSno = devVendorOui+"-"+devSno; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
orderInfoMapper.update(null,new LambdaUpdateWrapper<OrderInfo>() |
|
|
|
|
|
|
|
.eq(OrderInfo::getDevSnoOui,devSno) |
|
|
|
|
|
|
|
.eq(OrderInfo::getUniqueUserId,form.getDevRemark4()) |
|
|
|
|
|
|
|
.set(OrderInfo::getDevSnoOui,null) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
deviceServiceMapMapper.delete(new LambdaQueryWrapper<DeviceServiceMap>() |
|
|
|
|
|
|
|
.eq(DeviceServiceMap::getDevId,form.getDevId()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int upDeviceStaticGetDevId3(UnBindingForm form) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (form.getDevRemark4() != null && !form.getDevRemark4().isEmpty()) { |
|
|
|
|
|
|
|
OrderInfoStructListHolder orderInfoList = new OrderInfoStructListHolder(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String sb = " FROM ITMS_ORDER_INFO A,ITMS_ORDER_INFO_DETAIL B " + |
|
|
|
|
|
|
|
" WHERE A.ORDER_ID=B.ORDER_ID AND (UNIQUE_USER_ID = '" + form.getDevRemark4() + "'" + |
|
|
|
|
|
|
|
") " + |
|
|
|
|
|
|
|
" ORDER BY ORDER_DATE DESC "; |
|
|
|
|
|
|
|
NBIManager.queryOrderInfoBySql(sb, 1, 15, false, orderInfoList); |
|
|
|
|
|
|
|
if (orderInfoList.value != null && orderInfoList.value.length > 0) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < orderInfoList.value.length; i++) { |
|
|
|
|
|
|
|
if ((OrderType._ORDER_SERVICE_REPLACE == orderInfoList.value[i].orderServiceType.value() && (OrderStatus._ORDER_UNSETTLE == orderInfoList.value[i].order_Status |
|
|
|
|
|
|
|
.value() |
|
|
|
|
|
|
|
|| OrderStatus._ORDER_FAILURE == orderInfoList.value[i].order_Status.value() || OrderStatus._ORDER_SETTLE == orderInfoList.value[i].order_Status |
|
|
|
|
|
|
|
.value()))) { |
|
|
|
|
|
|
|
return 3; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
InventoryManager.unbundlingReplaceDevice(form.getDevRemark4().substring(0, form.getDevRemark4().indexOf("^")), form.getDevRemark4()); |
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
throw new BusinessException(ResultCode.UPDATE_DEVICE_FAILED); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return 2; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|