|
|
|
@ -14,6 +14,7 @@ import com.bellmann.common.result.ResultCode; |
|
|
|
|
import com.bellmann.common.util.CommonUtils; |
|
|
|
|
import com.bellmann.converter.OrderInfoConverter; |
|
|
|
|
import com.bellmann.mapper.*; |
|
|
|
|
import com.bellmann.model.bo.DevOnlineStatus; |
|
|
|
|
import com.bellmann.model.bo.DeviceDetailBO; |
|
|
|
|
import com.bellmann.model.entity.DeviceStatic; |
|
|
|
|
import com.bellmann.model.entity.OrderInfo; |
|
|
|
@ -62,37 +63,60 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
private final OrderInfoConverter orderInfoConverter; |
|
|
|
|
|
|
|
|
|
private final DeviceTypeVerMapper deviceTypeVerMapper; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Page<OrderInfoTableVO> tablePage(SelectQuery query) { |
|
|
|
|
int pageNum = query.getPageNum(); |
|
|
|
|
int pageSize = query.getPageSize(); |
|
|
|
|
Object value = query.getSelectValue(); |
|
|
|
|
String column = query.getSelectName(); |
|
|
|
|
Page<OrderInfoTableVO> page = new Page<>(pageNum,pageSize); |
|
|
|
|
Page<OrderInfoTableVO> page = new Page<>(pageNum, pageSize); |
|
|
|
|
Long domain = SecurityUtils.getGroupId(); |
|
|
|
|
List<OrderInfoTableVO> list = orderInfoMapper.tablePage(page, column, value,domain); |
|
|
|
|
List<OrderInfoTableVO> list = orderInfoMapper.tablePage(page, column, value, domain); |
|
|
|
|
return getOrderInfoTableVOPage(page, list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String devOnlineStatus(String devSnoOui,String pppoe){ |
|
|
|
|
String devOui=""; |
|
|
|
|
String devSno=""; |
|
|
|
|
String status = "无设备上线记录"; |
|
|
|
|
if (devSnoOui==null || devSnoOui.isEmpty()){ |
|
|
|
|
if (pppoe==null ||pppoe.isEmpty()) { |
|
|
|
|
return status; |
|
|
|
|
private String devOnlineStatus(String devSnoOui, String pppoe) { |
|
|
|
|
// 提前检查devSnoOui是否为空或空字符串
|
|
|
|
|
if (devSnoOui == null || devSnoOui.isEmpty()) { |
|
|
|
|
return "无设备上线记录"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 解析devSnoOui
|
|
|
|
|
String devSno = devSnoOui.trim(); |
|
|
|
|
if (devSnoOui.contains("-")) { |
|
|
|
|
String[] devOS = devSnoOui.split("-"); |
|
|
|
|
devSno = devOS[1].trim(); |
|
|
|
|
} |
|
|
|
|
if (!devSnoOui.contains("-")){ |
|
|
|
|
devSno = devSnoOui.trim(); |
|
|
|
|
}else { |
|
|
|
|
String[] devOS = devSnoOui.trim().split("-"); |
|
|
|
|
devOui = devOS[0]; |
|
|
|
|
devSno = devOS[1]; |
|
|
|
|
|
|
|
|
|
// 尝试根据SN号或PPPoE获取设备在线状态
|
|
|
|
|
DevOnlineStatus onlineStatus = null; |
|
|
|
|
if (devSno != null) { |
|
|
|
|
onlineStatus = deviceStaticMapper.devOnlineStatusBySno(devSno); |
|
|
|
|
} else if (pppoe != null) { |
|
|
|
|
onlineStatus = deviceStaticMapper.devOnlineStatusByPppoe(pppoe); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果没有找到在线状态,返回"无设备上线记录"
|
|
|
|
|
if (onlineStatus == null) { |
|
|
|
|
return "无设备上线记录"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 根据获取的在线状态字段确定设备状态
|
|
|
|
|
String devOnline = onlineStatus.getDevOnline(); |
|
|
|
|
if (devOnline == null || devOnline.isEmpty()) { |
|
|
|
|
return "无设备上线记录"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 假设getDevOnline1()用于表示某种辅助的在线状态,这里简单处理
|
|
|
|
|
String devOnline1 = onlineStatus.getDevOnline1(); |
|
|
|
|
if ("0".equals(devOnline)) { |
|
|
|
|
return (devOnline1 != null && "0".equals(devOnline1)) ? "设备在线" : "设备离线"; |
|
|
|
|
} else { |
|
|
|
|
return "设备离线"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Result<OrderInfoVO> getOrderById(Long orderId) { |
|
|
|
|
OrderInfoVO orderInfoVO = orderInfoMapper.getOrderById(orderId); |
|
|
|
@ -110,16 +134,16 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
orderInfoVO.getDummyFlag(), DummyFlagEnum.class)); |
|
|
|
|
orderInfoVO.setOrderDoneFlag( |
|
|
|
|
IBaseEnum.getLabelByValue( |
|
|
|
|
orderInfoVO.getOrderDoneFlag(),OrderDoneFlagEnum.class)); |
|
|
|
|
orderInfoVO.getOrderDoneFlag(), OrderDoneFlagEnum.class)); |
|
|
|
|
orderInfoVO.setDomain( |
|
|
|
|
(String) redisTemplate |
|
|
|
|
.opsForHash() |
|
|
|
|
.get(SecurityConstants.DOMAIN_PREFIX, |
|
|
|
|
orderInfoVO.getSystemDomain().toString())); |
|
|
|
|
orderInfoVO.setDevOnlineStatus(devOnlineStatus(orderInfoVO.getDevSnoOui(),orderInfoVO.getPppoeAccount())); |
|
|
|
|
if (orderInfoVO.getAdNo()!=null) { |
|
|
|
|
orderInfoVO.setDevOnlineStatus(devOnlineStatus(orderInfoVO.getDevSnoOui(), orderInfoVO.getPppoeAccount())); |
|
|
|
|
if (orderInfoVO.getAdNo() != null) { |
|
|
|
|
String devAccessType = deviceTypeVerDetailMapper.findDevAccessType(orderInfoVO.getAdNo()); |
|
|
|
|
if (devAccessType!=null){ |
|
|
|
|
if (devAccessType != null) { |
|
|
|
|
orderInfoVO.setDevAccessType(IBaseEnum.getLabelByValue( |
|
|
|
|
devAccessType, DevAccessTypeEnum.class)); |
|
|
|
|
} |
|
|
|
@ -129,24 +153,24 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Result<String> updateOrderStatus(Long orderId, String orderStatus) { |
|
|
|
|
if (OrderStatusEnum.MANUAL_INTERVENTION.getValue().equals(orderStatus)){ |
|
|
|
|
if (OrderStatusEnum.MANUAL_INTERVENTION.getValue().equals(orderStatus)) { |
|
|
|
|
throw new BusinessException(ResultCode.BAN_UPDATE_ORDER_STATUS_MANUAL_INTERVENTION); |
|
|
|
|
} |
|
|
|
|
OrderInfo orderInfo = orderInfoMapper.selectOne(new QueryWrapper<OrderInfo>() |
|
|
|
|
.select("order_status") |
|
|
|
|
.eq("order_id", orderId) |
|
|
|
|
); |
|
|
|
|
if (OrderStatusEnum.MANUAL_INTERVENTION.getValue().equals(orderInfo.getOrderStatus())){ |
|
|
|
|
if (OrderStatusEnum.MANUAL_INTERVENTION.getValue().equals(orderInfo.getOrderStatus())) { |
|
|
|
|
throw new BusinessException(ResultCode.BAN_UPDATE_ORDER_STATUS_MANUAL_INTERVENTION); |
|
|
|
|
} |
|
|
|
|
orderInfoMapper.update(null,new LambdaUpdateWrapper<OrderInfo>() |
|
|
|
|
.eq(OrderInfo::getOrderId,orderId) |
|
|
|
|
.set(OrderInfo::getOrderStatus,orderStatus) |
|
|
|
|
orderInfoMapper.update(null, new LambdaUpdateWrapper<OrderInfo>() |
|
|
|
|
.eq(OrderInfo::getOrderId, orderId) |
|
|
|
|
.set(OrderInfo::getOrderStatus, orderStatus) |
|
|
|
|
); |
|
|
|
|
if (OrderStatusEnum.NOT_PROCESSED.getValue().equals(orderStatus)){ |
|
|
|
|
orderServiceMapper.update(null,new LambdaUpdateWrapper<OrderService>() |
|
|
|
|
.eq(OrderService::getOrderId,orderId) |
|
|
|
|
.set(OrderService::getServiceId,-999) |
|
|
|
|
if (OrderStatusEnum.NOT_PROCESSED.getValue().equals(orderStatus)) { |
|
|
|
|
orderServiceMapper.update(null, new LambdaUpdateWrapper<OrderService>() |
|
|
|
|
.eq(OrderService::getOrderId, orderId) |
|
|
|
|
.set(OrderService::getServiceId, -999) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
return Result.success(); |
|
|
|
@ -155,16 +179,16 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
@Override |
|
|
|
|
public Result<String> executeOrder(Long orderId) { |
|
|
|
|
OrderInfo orderInfo = orderInfoMapper.selectOne(new QueryWrapper<OrderInfo>() |
|
|
|
|
.select("order_status","pppoe_account","dev_sno_oui","unique_user_id","order_service_type") |
|
|
|
|
.select("order_status", "pppoe_account", "dev_sno_oui", "unique_user_id", "order_service_type") |
|
|
|
|
.eq("order_id", orderId) |
|
|
|
|
); |
|
|
|
|
if(!OrderStatusEnum.NOT_PROCESSED.getValue().equals(orderInfo.getOrderStatus())){ |
|
|
|
|
if (!OrderStatusEnum.NOT_PROCESSED.getValue().equals(orderInfo.getOrderStatus())) { |
|
|
|
|
throw new BusinessException(ResultCode.NOT_OPERATE_ORDER); |
|
|
|
|
} |
|
|
|
|
orderInfoMapper.update(null,new LambdaUpdateWrapper<OrderInfo>() |
|
|
|
|
.eq(OrderInfo::getOrderId,orderId) |
|
|
|
|
.set(OrderInfo::getOrderStatus,OrderStatusEnum.NOT_PROCESSED.getValue()) |
|
|
|
|
.set(OrderInfo::getOrderDoneFlag,OrderDoneFlagEnum.THE_ORDER_HAS_NOT_BEEN_RETURNED.getValue()) |
|
|
|
|
orderInfoMapper.update(null, new LambdaUpdateWrapper<OrderInfo>() |
|
|
|
|
.eq(OrderInfo::getOrderId, orderId) |
|
|
|
|
.set(OrderInfo::getOrderStatus, OrderStatusEnum.NOT_PROCESSED.getValue()) |
|
|
|
|
.set(OrderInfo::getOrderDoneFlag, OrderDoneFlagEnum.THE_ORDER_HAS_NOT_BEEN_RETURNED.getValue()) |
|
|
|
|
); |
|
|
|
|
boolean ouiFlag = false; |
|
|
|
|
boolean pppoeFlag = false; |
|
|
|
@ -172,7 +196,7 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
DeviceDetailBO bo = null; |
|
|
|
|
OrderInfo obj = orderInfoMapper.orderSnoOuiPppoeUnique(orderId); |
|
|
|
|
String devSnoOui = obj.getDevSnoOui(); |
|
|
|
|
if (devSnoOui!=null&& !devSnoOui.trim().isEmpty()) { |
|
|
|
|
if (devSnoOui != null && !devSnoOui.trim().isEmpty()) { |
|
|
|
|
if (devSnoOui.startsWith("12$")) { |
|
|
|
|
devSnoOui = orderInfo.getDevSnoOui(); |
|
|
|
|
if (devSnoOui.isEmpty()) { |
|
|
|
@ -186,45 +210,45 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
sno = split[0]; |
|
|
|
|
oui = split[1]; |
|
|
|
|
} |
|
|
|
|
bo = deviceStaticMapper.orderByDevSnoOui(sno, oui,null); |
|
|
|
|
bo = deviceStaticMapper.orderByDevSnoOui(sno, oui, null); |
|
|
|
|
if (bo == null) { |
|
|
|
|
throw new BusinessException(ResultCode.NOT_GET_DEVICE); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
ouiFlag = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
String uniqueUserId = obj.getUniqueUserId(); |
|
|
|
|
if ( |
|
|
|
|
uniqueUserId!=null&& |
|
|
|
|
!uniqueUserId.isEmpty()&& |
|
|
|
|
!ouiFlag&& |
|
|
|
|
uniqueUserId != null && |
|
|
|
|
!uniqueUserId.isEmpty() && |
|
|
|
|
!ouiFlag && |
|
|
|
|
!OrderServiceTypeEnum.EQUIPMENT_REPLACEMENT.getValue().equals(orderInfo.getOrderServiceType()) |
|
|
|
|
){ |
|
|
|
|
bo = deviceStaticMapper.orderByDevSnoOui(null,null,uniqueUserId); |
|
|
|
|
if (bo!=null){ |
|
|
|
|
) { |
|
|
|
|
bo = deviceStaticMapper.orderByDevSnoOui(null, null, uniqueUserId); |
|
|
|
|
if (bo != null) { |
|
|
|
|
uniqueUserIdFlag = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
String pppoeAccount = obj.getPppoeAccount(); |
|
|
|
|
if (pppoeAccount!=null&&!pppoeAccount.isEmpty()&&!ouiFlag&&uniqueUserIdFlag){ |
|
|
|
|
bo = deviceStaticMapper.orderByPppoeAccount(DevStatusEnum.NORMAL.getValue(),pppoeAccount); |
|
|
|
|
if (bo==null){ |
|
|
|
|
if (pppoeAccount != null && !pppoeAccount.isEmpty() && !ouiFlag && uniqueUserIdFlag) { |
|
|
|
|
bo = deviceStaticMapper.orderByPppoeAccount(DevStatusEnum.NORMAL.getValue(), pppoeAccount); |
|
|
|
|
if (bo == null) { |
|
|
|
|
throw new BusinessException(ResultCode.NOT_GET_DEVICE); |
|
|
|
|
} |
|
|
|
|
pppoeFlag = true; |
|
|
|
|
} |
|
|
|
|
if (!pppoeFlag&&!ouiFlag&&!uniqueUserIdFlag){ |
|
|
|
|
if (!pppoeFlag && !ouiFlag && !uniqueUserIdFlag) { |
|
|
|
|
throw new BusinessException(ResultCode.NOT_GET_DEVICE); |
|
|
|
|
} |
|
|
|
|
RDeviceDetailStruct struct = conversionStruct(bo); |
|
|
|
|
int res = NBIManager.informConfigure(struct, orderId, true); |
|
|
|
|
if (res!=0){ |
|
|
|
|
if (res != 0) { |
|
|
|
|
throw new BusinessException(ResultCode.NBI_ERROR); |
|
|
|
|
} |
|
|
|
|
return Result.success(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private RDeviceDetailStruct conversionStruct(DeviceDetailBO bo){ |
|
|
|
|
private RDeviceDetailStruct conversionStruct(DeviceDetailBO bo) { |
|
|
|
|
RDeviceDetailStruct struct = new RDeviceDetailStruct(); |
|
|
|
|
RDeviceDynamicStruct devDynamic = struct.devDynamic; |
|
|
|
|
RDeviceStaticStruct devStatic = struct.devStatic; |
|
|
|
@ -258,15 +282,15 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String devRegStatus = bo.getDevRegStatus(); |
|
|
|
|
if(devRegStatus == null || devRegStatus.isEmpty()){ |
|
|
|
|
if (devRegStatus == null || devRegStatus.isEmpty()) { |
|
|
|
|
devRegStatus = "0"; |
|
|
|
|
} |
|
|
|
|
String devOwnerClass = bo.getDevOwnerClass(); |
|
|
|
|
if(devOwnerClass == null || devOwnerClass.isEmpty()){ |
|
|
|
|
if (devOwnerClass == null || devOwnerClass.isEmpty()) { |
|
|
|
|
devOwnerClass = "0"; |
|
|
|
|
} |
|
|
|
|
devStaticDetail.devRegStatus =RDevRegStatus.from_int(Integer.parseInt(devRegStatus)); |
|
|
|
|
devStaticDetail.devOwnerClass =RDevOwnerClass.from_int(Integer.parseInt(devOwnerClass)); |
|
|
|
|
devStaticDetail.devRegStatus = RDevRegStatus.from_int(Integer.parseInt(devRegStatus)); |
|
|
|
|
devStaticDetail.devOwnerClass = RDevOwnerClass.from_int(Integer.parseInt(devOwnerClass)); |
|
|
|
|
devStaticDetail.remark1 = bo.getRemark1(); |
|
|
|
|
devStaticDetail.remark2 = bo.getRemark2(); |
|
|
|
|
devStaticDetail.remark3 = bo.getRemark3(); |
|
|
|
@ -310,62 +334,63 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Result<String> bindingOuiSno(String devOuiSno, Long orderId) { |
|
|
|
|
checkDevice(devOuiSno,orderId); |
|
|
|
|
checkDevice(devOuiSno, orderId); |
|
|
|
|
OrderInfo orderInfo = orderInfoMapper.selectOne(new QueryWrapper<OrderInfo>() |
|
|
|
|
.eq("order_id", orderId) |
|
|
|
|
.select("order_id","order_status","unique_user_id","pppoe_account","ad_no") |
|
|
|
|
.select("order_id", "order_status", "unique_user_id", "pppoe_account", "ad_no") |
|
|
|
|
); |
|
|
|
|
if (OrderStatusEnum.PROCESSING.getValue().equals(orderInfo.getOrderStatus())){ |
|
|
|
|
if (OrderStatusEnum.PROCESSING.getValue().equals(orderInfo.getOrderStatus())) { |
|
|
|
|
devOuiSno = CommonUtils.getRandomString(14); |
|
|
|
|
createDevice(devOuiSno,orderInfo); |
|
|
|
|
createDevice(devOuiSno, orderInfo); |
|
|
|
|
} |
|
|
|
|
int result = NBIManager.bindDevice(orderId, devOuiSno); |
|
|
|
|
if (result!=0){ |
|
|
|
|
if (result != 0) { |
|
|
|
|
throw new BusinessException(ResultCode.DEVICE_BINDING_FAILED); |
|
|
|
|
} |
|
|
|
|
return Result.success(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void createDevice(String ouiSno,OrderInfo order){ |
|
|
|
|
RDeviceStaticStruct deviceStaticStruct=new RDeviceStaticStruct(); |
|
|
|
|
private void createDevice(String ouiSno, OrderInfo order) { |
|
|
|
|
RDeviceStaticStruct deviceStaticStruct = new RDeviceStaticStruct(); |
|
|
|
|
deviceStaticStruct.typeAndVerId = deviceTypeVerMapper.getTypeAndVerId(); |
|
|
|
|
deviceStaticStruct.custId= Utils.LONG_NULL; |
|
|
|
|
deviceStaticStruct.regionAreaId=order.getSystemDomain(); |
|
|
|
|
deviceStaticStruct.custId = Utils.LONG_NULL; |
|
|
|
|
deviceStaticStruct.regionAreaId = order.getSystemDomain(); |
|
|
|
|
deviceStaticStruct.corpAreaId = Utils.LONG_NULL; |
|
|
|
|
deviceStaticStruct.devSNo=ouiSno; |
|
|
|
|
deviceStaticStruct.devMac=""; |
|
|
|
|
deviceStaticStruct.devPPPoE=order.getPppoeAccount(); |
|
|
|
|
deviceStaticStruct.devADNo=order.getAdNo(); |
|
|
|
|
deviceStaticStruct.devCreateTime=new Date().getTime(); |
|
|
|
|
deviceStaticStruct.devModifyTime=Utils.LONG_NULL; |
|
|
|
|
deviceStaticStruct.devSoapFlag=true; |
|
|
|
|
deviceStaticStruct.devInformFlag=true; |
|
|
|
|
deviceStaticStruct.devSNo = ouiSno; |
|
|
|
|
deviceStaticStruct.devMac = ""; |
|
|
|
|
deviceStaticStruct.devPPPoE = order.getPppoeAccount(); |
|
|
|
|
deviceStaticStruct.devADNo = order.getAdNo(); |
|
|
|
|
deviceStaticStruct.devCreateTime = new Date().getTime(); |
|
|
|
|
deviceStaticStruct.devModifyTime = Utils.LONG_NULL; |
|
|
|
|
deviceStaticStruct.devSoapFlag = true; |
|
|
|
|
deviceStaticStruct.devInformFlag = true; |
|
|
|
|
deviceStaticStruct.devStatus = RDevStatus.DEV_NORMAL; |
|
|
|
|
deviceStaticStruct.devRemark1=""; |
|
|
|
|
deviceStaticStruct.devRemark2=""; |
|
|
|
|
deviceStaticStruct.devRemark3=""; |
|
|
|
|
deviceStaticStruct.devRemark4=""; |
|
|
|
|
deviceStaticStruct.devRemark5="1"; |
|
|
|
|
RDeviceStaticStructHolder holder=new RDeviceStaticStructHolder(deviceStaticStruct); |
|
|
|
|
int result= InventoryManager.addDevice(holder); |
|
|
|
|
} |
|
|
|
|
private void checkDevice(String devOuiSno,Long orderId){ |
|
|
|
|
deviceStaticStruct.devRemark1 = ""; |
|
|
|
|
deviceStaticStruct.devRemark2 = ""; |
|
|
|
|
deviceStaticStruct.devRemark3 = ""; |
|
|
|
|
deviceStaticStruct.devRemark4 = ""; |
|
|
|
|
deviceStaticStruct.devRemark5 = "1"; |
|
|
|
|
RDeviceStaticStructHolder holder = new RDeviceStaticStructHolder(deviceStaticStruct); |
|
|
|
|
int result = InventoryManager.addDevice(holder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkDevice(String devOuiSno, Long orderId) { |
|
|
|
|
String[] split = devOuiSno.split("-"); |
|
|
|
|
if (split.length!=2){ |
|
|
|
|
if (split.length != 2) { |
|
|
|
|
throw new BusinessException(ResultCode.DEV_OUI_SNO_FORMAT_ERROR); |
|
|
|
|
} |
|
|
|
|
Long count = deviceStaticMapper.selectCount(new LambdaQueryWrapper<DeviceStatic>() |
|
|
|
|
.eq(DeviceStatic::getDevSno, split[1]) |
|
|
|
|
.eq(DeviceStatic::getDevRemark3, split[0]) |
|
|
|
|
); |
|
|
|
|
if (count==0L){ |
|
|
|
|
if (count == 0L) { |
|
|
|
|
throw new BusinessException(ResultCode.DEVICE_NOT_REGISTERED); |
|
|
|
|
} |
|
|
|
|
List<DeviceStatic> list = deviceStaticMapper.selectList(new QueryWrapper<DeviceStatic>() |
|
|
|
|
.eq("dev_sno", split[1]) |
|
|
|
|
.eq("dev_remark3", split[0]) |
|
|
|
|
); |
|
|
|
|
if (!list.isEmpty()){ |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
throw new BusinessException(ResultCode.DEVICE_ALREADY_BINDING_OTHER_LOGIC); |
|
|
|
|
} |
|
|
|
|
OrderInfo orderInfo = orderInfoMapper.selectOne(new QueryWrapper<OrderInfo>() |
|
|
|
@ -373,11 +398,11 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
.eq("order_id", orderId) |
|
|
|
|
); |
|
|
|
|
String devRemark4 = deviceStaticMapper.selectDevRemark4ByOrderSN(orderInfo.getUserSnNo()); |
|
|
|
|
if (!"0".equals(devRemark4)){ |
|
|
|
|
if (!"0".equals(devRemark4)) { |
|
|
|
|
throw new BusinessException(ResultCode.LOGICID_ALREADY_DEVICE); |
|
|
|
|
} |
|
|
|
|
String devSnoOui = orderInfoMapper.selectOui(devOuiSno,orderInfo.getUserSnNo()); |
|
|
|
|
if (!"0".equals(devSnoOui)){ |
|
|
|
|
String devSnoOui = orderInfoMapper.selectOui(devOuiSno, orderInfo.getUserSnNo()); |
|
|
|
|
if (!"0".equals(devSnoOui)) { |
|
|
|
|
throw new BusinessException(ResultCode.LOGICID_ALREADY_DEVICE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -386,35 +411,35 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
public Page<OrderInfoTableVO> deviceOrderPage(DeviceOrderQuery query) { |
|
|
|
|
int pageNum = query.getPageNum(); |
|
|
|
|
int pageSize = query.getPageSize(); |
|
|
|
|
Page<OrderInfoTableVO> page = new Page<>(pageNum,pageSize); |
|
|
|
|
Page<OrderInfoTableVO> page = new Page<>(pageNum, pageSize); |
|
|
|
|
Long domain = SecurityUtils.getGroupId(); |
|
|
|
|
String devSnoOui = query.getDevOui() + "-"+ query.getDevSno(); |
|
|
|
|
String devSnoOui = query.getDevOui() + "-" + query.getDevSno(); |
|
|
|
|
String pppoeAccount = query.getPppoeAccount(); |
|
|
|
|
List<OrderInfoTableVO> list = orderInfoMapper.deviceOrderPage(page,devSnoOui,pppoeAccount ,domain); |
|
|
|
|
List<OrderInfoTableVO> list = orderInfoMapper.deviceOrderPage(page, devSnoOui, pppoeAccount, domain); |
|
|
|
|
return getOrderInfoTableVOPage(page, list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Page<OrderInfoTableVO> getOrderInfoTableVOPage(Page<OrderInfoTableVO> page, List<OrderInfoTableVO> list) { |
|
|
|
|
list.forEach(obj->{ |
|
|
|
|
list.forEach(obj -> { |
|
|
|
|
Long systemDomain = obj.getSystemDomain(); |
|
|
|
|
String orderServiceType = obj.getOrderServiceType(); |
|
|
|
|
String orderStatus = obj.getOrderStatus(); |
|
|
|
|
String orderRemark = obj.getOrderRemark(); |
|
|
|
|
String dummyFlag = obj.getDummyFlag(); |
|
|
|
|
if (systemDomain!=null){ |
|
|
|
|
obj.setDomain((String) redisTemplate.opsForHash().get(SecurityConstants.DOMAIN_PREFIX,systemDomain.toString())); |
|
|
|
|
if (systemDomain != null) { |
|
|
|
|
obj.setDomain((String) redisTemplate.opsForHash().get(SecurityConstants.DOMAIN_PREFIX, systemDomain.toString())); |
|
|
|
|
} |
|
|
|
|
if (orderServiceType!=null){ |
|
|
|
|
if (orderServiceType != null) { |
|
|
|
|
obj.setOrderServiceType(IBaseEnum.getLabelByValue(orderServiceType, OrderServiceTypeEnum.class)); |
|
|
|
|
} |
|
|
|
|
if (orderStatus!=null){ |
|
|
|
|
if (orderStatus != null) { |
|
|
|
|
obj.setOrderStatus(IBaseEnum.getLabelByValue(orderStatus, OrderStatusEnum.class)); |
|
|
|
|
} |
|
|
|
|
if (orderRemark!=null){ |
|
|
|
|
if (orderRemark != null) { |
|
|
|
|
obj.setOrderRemark(IBaseEnum.getLabelByValue(orderRemark, OrderOperateEnum.class)); |
|
|
|
|
} |
|
|
|
|
//如果是虚拟工单 不显示 pppoe帐户 和 电话号码 反之则显示 0虚拟单 1是非虚拟单
|
|
|
|
|
if ("0".equals(dummyFlag)){ |
|
|
|
|
if ("0".equals(dummyFlag)) { |
|
|
|
|
obj.setTelNum(""); |
|
|
|
|
obj.setPppoeAccount(""); |
|
|
|
|
} |
|
|
|
@ -424,8 +449,8 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Result<Map<Object,Object>> checkDev(String devSnoOui) { |
|
|
|
|
if (devSnoOui==null || !devSnoOui.contains("-")){ |
|
|
|
|
public Result<Map<Object, Object>> checkDev(String devSnoOui) { |
|
|
|
|
if (devSnoOui == null || !devSnoOui.contains("-")) { |
|
|
|
|
return Result.failed(ResultCode.NOT_GET_DEVICE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -433,10 +458,10 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
DeviceStatic deviceStatic = deviceStaticMapper.selectOne(new QueryWrapper<DeviceStatic>() |
|
|
|
|
.eq("dev_sno", split[1]) |
|
|
|
|
.eq("dev_remark3", split[0]) |
|
|
|
|
.select("dev_id","type_and_ver_id") |
|
|
|
|
.select("dev_id", "type_and_ver_id") |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (deviceStatic!=null){ |
|
|
|
|
if (deviceStatic != null) { |
|
|
|
|
Map<Object, Object> map = MapUtil |
|
|
|
|
.builder() |
|
|
|
|
.put("devId", deviceStatic.getDevId()) |
|
|
|
|