20260329:数据推送:bug修复,之前用productId查询,B设备查询到A设备物模型

This commit is contained in:
George 2026-03-29 11:23:42 +08:00
parent bcc78fe240
commit ea1d179c41
4 changed files with 39 additions and 7 deletions

View File

@ -12,6 +12,7 @@ import com.fastbee.iot.cache.ITSLCache;
import com.fastbee.iot.domain.ThingsModel; import com.fastbee.iot.domain.ThingsModel;
import com.fastbee.iot.model.ImportThingsModelInput; import com.fastbee.iot.model.ImportThingsModelInput;
import com.fastbee.iot.model.ThingsModelPerm; import com.fastbee.iot.model.ThingsModelPerm;
import com.fastbee.iot.model.dto.ThingsModelDTO;
import com.fastbee.iot.model.modbus.ModbusAndThingsVO; import com.fastbee.iot.model.modbus.ModbusAndThingsVO;
import com.fastbee.iot.service.IThingsModelService; import com.fastbee.iot.service.IThingsModelService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -52,6 +53,19 @@ public class ThingsModelController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询物模型列表
*/
@PreAuthorize("@ss.hasPermi('iot:model:list')")
@GetMapping("/listByProductIdAndSerialNumber")
@ApiOperation("产品物模型分页列表(根据产品ID和设备编号查询)")
public TableDataInfo listByProductIdAndSerialNumber(@RequestParam("productId") Long productId,
@RequestParam("serialNumber") String serialNumber) {
List<ThingsModelDTO> list = thingsModelService.getCacheAndHandleArrayByProductId(productId, serialNumber);
return getDataTable(list);
}
/** /**
* 查询物模型对应设备分享权限 * 查询物模型对应设备分享权限
*/ */

View File

@ -106,7 +106,7 @@ public interface IThingsModelService {
* 导入采集点数据 * 导入采集点数据
* *
* @param lists 数据列表 * @param lists 数据列表
* @param tempSlaveId 从机编码 * @param productId 产品ID
* @return 结果 * @return 结果
*/ */
public String importData(List<ThingsModel> lists, Long productId); public String importData(List<ThingsModel> lists, Long productId);
@ -198,7 +198,7 @@ public interface IThingsModelService {
/** /**
* 根据设备编号获取读写物模型 * 根据设备编号获取读写物模型
* *
* @param serialNumber * @param deviceId 设备id
* @return * @return
*/ */
List<ThingsModel> selectThingsModelBySerialNumber(Long deviceId); List<ThingsModel> selectThingsModelBySerialNumber(Long deviceId);

View File

@ -9,6 +9,15 @@ export function listModel(query) {
}); });
} }
// 查询物模型列表 (根据产品ID和设备编号)
export function listByProductIdAndSerialNumber(query) {
return request({
url: '/iot/model/listByProductIdAndSerialNumber',
method: 'get',
params: query,
});
}
// 查询物模型详细 // 查询物模型详细
export function getModel(modelId) { export function getModel(modelId) {
return request({ return request({

View File

@ -212,7 +212,7 @@ import {
changePushConfigStatus, delPushConfig, manualPush changePushConfigStatus, delPushConfig, manualPush
} from '@/api/iot/pushConfig'; } from '@/api/iot/pushConfig';
import { listDeviceShort } from '@/api/iot/device'; import { listDeviceShort } from '@/api/iot/device';
import { listModel } from '@/api/iot/model'; import { listByProductIdAndSerialNumber } from '@/api/iot/model';
import { listTemplate } from '@/api/notify/template'; import { listTemplate } from '@/api/notify/template';
import { listUser } from '@/api/system/user'; import { listUser } from '@/api/system/user';
@ -316,8 +316,11 @@ export default {
this.form.serialNumber = device.serialNumber; this.form.serialNumber = device.serialNumber;
this.form.items = []; this.form.items = [];
this.thingsModelOptions = []; this.thingsModelOptions = [];
listModel({ productId: device.productId, type: 1, pageNum: 1, pageSize: 500 }).then(res => { listByProductIdAndSerialNumber({
this.thingsModelOptions = res.rows || []; productId: device.productId,
serialNumber: device.serialNumber
}).then(res => {
this.thingsModelOptions = (res.rows || []).filter(m => m.type === 1);
}); });
}, },
@ -382,8 +385,14 @@ export default {
} : null; } : null;
this.loadDeviceOptions(mergeDev); this.loadDeviceOptions(mergeDev);
if (data.productId) { if (data.productId) {
listModel({ productId: data.productId, type: 1, pageNum: 1, pageSize: 500 }).then(r => { listByProductIdAndSerialNumber({
this.thingsModelOptions = r.rows || []; productId: data.productId,
serialNumber: data.serialNumber || '',
type: 1,
pageNum: 1,
pageSize: 500
}).then(r => {
this.thingsModelOptions = (r.rows || []).filter(m => m.type === 1);
}); });
} }
this.dialogTitle = '编辑推送配置'; this.dialogTitle = '编辑推送配置';