配置下发修改

This commit is contained in:
huguanghan 2024-10-22 16:38:40 +08:00
parent 205ee8b56f
commit 098e1331ef
3 changed files with 50 additions and 25 deletions

View File

@ -28,7 +28,9 @@ public interface SysImptabmappingMapper extends BaseMapperPlus<SysImptabmapping,
List<Long> getEquipmentId(Long linkId);
List<IotModelVo> getIotModelFieldByEquipmentId(Long equipmentId);
List<IotModelVo> getIotModelFieldByDeviceId(@Param("deviceId") Long deviceId);
List<IotModelVo> getIotModelServiceByDeviceId(@Param("deviceId") Long deviceId);
List<IotModelVo> getIotModelServiceByEquipmentId(Long equipmentId);

View File

@ -142,10 +142,11 @@ public class DataServiceImpl implements DataService {
List<NewIotModelVo> newIotModelFieldList = new ArrayList<>();
List<NewIotModelVo> newIotModelServiceList = new ArrayList<>();
// 根据设备Id获取对应的物模型属性和动作
List<IotModelVo> iotModelFieldList = sysImptabmappingMapper.getIotModelFieldByEquipmentId(equipmentId);
List<IotModelVo> iotModelFieldList = sysImptabmappingMapper.getIotModelFieldByDeviceId(equipmentId);
List<IotModelVo> iotModelServiceList = sysImptabmappingMapper.getIotModelServiceByDeviceId(equipmentId);
if (!CollectionUtils.isEmpty(iotModelFieldList)) {
for (IotModelVo info : iotModelFieldList) {
if (info.getServiceType() == null) {
NewIotModelVo newIotModelVo = new NewIotModelVo();
newIotModelVo.setName(info.getEquipmentAttribute());
newIotModelVo.setHighSpeed(info.getHighSpeed());
@ -162,21 +163,23 @@ public class DataServiceImpl implements DataService {
newIotModelVo.setType("yx");
}
newIotModelFieldList.add(newIotModelVo);
} else if (info.getAttributeType() == null) {
NewIotModelVo newIotModelVo = new NewIotModelVo();
newIotModelVo.setName(info.getEquipmentService());
if (info.getParams() == null) {
newIotModelVo.setParams(equipJsonNode);
} else {
newIotModelVo.setParams(equipObjectMapper.readTree(info.getParams().toString()));
}
if (info.getServiceType() == BaseIotModelType.TYPE_PSR_SETPOINT) {
newIotModelVo.setType("yt");
} else if (info.getServiceType() == BaseIotModelType.TYPE_PSR_CONTROL) {
newIotModelVo.setType("yk");
}
newIotModelServiceList.add(newIotModelVo);
}
}
if (!CollectionUtils.isEmpty(iotModelServiceList)){
for (IotModelVo info : iotModelServiceList) {
NewIotModelVo newIotModelVo = new NewIotModelVo();
newIotModelVo.setName(info.getEquipmentService());
if (info.getParams() == null) {
newIotModelVo.setParams(equipJsonNode);
} else {
newIotModelVo.setParams(equipObjectMapper.readTree(info.getParams().toString()));
}
if (info.getServiceType() == BaseIotModelType.TYPE_PSR_SETPOINT) {
newIotModelVo.setType("yt");
} else if (info.getServiceType() == BaseIotModelType.TYPE_PSR_CONTROL) {
newIotModelVo.setType("yk");
}
newIotModelServiceList.add(newIotModelVo);
}
}
EquipmentVo equipment = new EquipmentVo();

View File

@ -58,14 +58,6 @@
where sc.id = #{linkId}
</select>
<select id="getIotModelFieldByEquipmentId" resultType="com.das.modules.node.domain.vo.IotModelVo">
select simf.attribute_type as attributeType,sims.service_type as serviceType, se.iot_addr as iotAddr,si.equipment_attribute as equipmentAttribute,si.equipment_service as equipmentService, si.params, simf.highspeed as highSpeed from sys_imptabmapping si
left join sys_equipment se on si.equipment_id = se.id
left join sys_iot_model_field simf on si.equipment_attribute = simf.attribute_code and se.iot_model_id = simf.iot_model_id
left join sys_iot_model_service sims on si.equipment_service = sims.service_code and se.iot_model_id = sims.iot_model_id
where si.equipment_id = #{equipmentId}
</select>
<select id="getIotModelServiceByEquipmentId" resultType="com.das.modules.node.domain.vo.IotModelVo">
select sims.service_code as name ,sims.service_type as type ,si.params from sys_imptabmapping si
@ -95,5 +87,33 @@
left join sys_equipment se on si.equipment_id = se.id
where si.link_id = #{linkId}
</select>
<select id="getIotModelFieldByDeviceId" resultType="com.das.modules.node.domain.vo.IotModelVo">
select
field.attribute_type as attributeType,
null as serviceType,
(select iot_addr from sys_equipment e where e.id=1846101273013739522) as iot_addr,
field.attribute_code as equipmentAttribute,
null as equipmentService,
si.params,
field.highspeed
from sys_iot_model_field field
left join sys_imptabmapping si on (field.attribute_code=si.equipment_attribute)
where field.iot_model_id = (select equip.iot_model_id from sys_equipment equip where equip.id = #{deviceId}) and si.equipment_id = #{deviceId}
order by field.attribute_type ,field.porder
</select>
<select id="getIotModelServiceByDeviceId" resultType="com.das.modules.node.domain.vo.IotModelVo">
select
null as attributeType,
service.service_type as serviceType,
(select iot_addr from sys_equipment e where e.id=1846101273013739522) as iot_addr,
null as equipmentAttribute,
service.service_code as equipmentService,
si.params,
null as highspeed
from sys_iot_model_service service
left join sys_imptabmapping si on (service.service_code=si.equipment_service)
where service.iot_model_id = (select equip.iot_model_id from sys_equipment equip where equip.id = #{deviceId}) and si.equipment_id = #{deviceId}
order by service.service_type ,service.porder
</select>
</mapper>