1. 根据型号返回型号名称
This commit is contained in:
parent
28d17976a3
commit
81ad0e724f
|
@ -1,17 +1,16 @@
|
||||||
package com.ruoyi.device.app;
|
package com.ruoyi.device.app;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.utils.ip.IpUtils;
|
|
||||||
import com.ruoyi.device.domain.AsUserCollection;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
import com.ruoyi.common.utils.baidu.GetToken;
|
import com.ruoyi.common.utils.baidu.GetToken;
|
||||||
import com.ruoyi.common.utils.http.HttpUtils;
|
import com.ruoyi.common.utils.http.HttpUtils;
|
||||||
|
import com.ruoyi.common.utils.ip.IpUtils;
|
||||||
import com.ruoyi.device.domain.*;
|
import com.ruoyi.device.domain.*;
|
||||||
import com.ruoyi.device.domain.vo.IdentifyRes;
|
import com.ruoyi.device.domain.vo.IdentifyRes;
|
||||||
import com.ruoyi.device.service.*;
|
import com.ruoyi.device.service.*;
|
||||||
|
@ -400,15 +399,17 @@ public class AppController extends BaseController
|
||||||
/**
|
/**
|
||||||
* 根据型号返回型号名称
|
* 根据型号返回型号名称
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getModelName")
|
@PostMapping("/getModelName")
|
||||||
public AjaxResult getModelName(String[] asModels)
|
public AjaxResult getModelName(@RequestBody String asDevicesRes)
|
||||||
{
|
{
|
||||||
List<AsModel> asModelList = new ArrayList<>();
|
logger.info("根据型号返回型号名称参数-----"+asDevicesRes);
|
||||||
for (String model:asModels) {
|
List<AsDevice> devices = JSONArray.parseArray(asDevicesRes, AsDevice.class);
|
||||||
AsModel asModel = asModelService.selectAsModelByModel(model);
|
List<AsDevice> asDevices = new ArrayList<>();
|
||||||
asModelList.add(asModel);
|
for (AsDevice device:devices) {
|
||||||
|
AsDevice asDevice = asDeviceService.selectAsDeviceByMac(device);
|
||||||
|
asDevices.add(asDevice);
|
||||||
}
|
}
|
||||||
return AjaxResult.success(asModelList);
|
return AjaxResult.success(asDevices);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,10 @@ public class AsDevice extends BaseEntity
|
||||||
@Excel(name = "型号")
|
@Excel(name = "型号")
|
||||||
private String model;
|
private String model;
|
||||||
|
|
||||||
|
/** 型号名称 */
|
||||||
|
@Excel(name = "型号名称")
|
||||||
|
private String modelName;
|
||||||
|
|
||||||
/** 设备Mac号 */
|
/** 设备Mac号 */
|
||||||
@Excel(name = "设备Mac号")
|
@Excel(name = "设备Mac号")
|
||||||
private String mac;
|
private String mac;
|
||||||
|
|
|
@ -22,6 +22,14 @@ public interface IAsDeviceService
|
||||||
*/
|
*/
|
||||||
public AsDevice selectAsDeviceByDeviceId(Long deviceId);
|
public AsDevice selectAsDeviceByDeviceId(Long deviceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据mac号查询设备信息
|
||||||
|
*
|
||||||
|
* @param device 设备对象
|
||||||
|
* @return 设备列表
|
||||||
|
*/
|
||||||
|
public AsDevice selectAsDeviceByMac(AsDevice device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备列表列表
|
* 查询设备列表列表
|
||||||
*
|
*
|
||||||
|
|
|
@ -123,6 +123,29 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据mac号查询设备信息
|
||||||
|
*
|
||||||
|
* @param mac 设备列表主键
|
||||||
|
* @return 设备信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AsDevice selectAsDeviceByMac(AsDevice asDevice)
|
||||||
|
{
|
||||||
|
AsDevice device = asDeviceMapper.selectAsDeviceByMac(asDevice.getMac());
|
||||||
|
if(ObjectUtils.isEmpty(device)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
device.setBluetoothId(asDevice.getBluetoothId());
|
||||||
|
device.setBluetoothName(asDevice.getBluetoothName());
|
||||||
|
asDeviceMapper.updateAsDevice(device);
|
||||||
|
/** 请求onenet更新设备参数*/
|
||||||
|
AsModel model = modelMapper.selectAsModelByModelId(device.getModelId());
|
||||||
|
device.setPicture(model.getPicture());
|
||||||
|
device.setModelName(model.getModelName());
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从onenet更新设备参数
|
* 从onenet更新设备参数
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user