润阳项目
新增相关字段和判断
This commit is contained in:
parent
7a7fa73a12
commit
82e104e21e
@ -65,4 +65,9 @@ public class SysIotModelFieldDto implements Serializable {
|
|||||||
private Integer visible;
|
private Integer visible;
|
||||||
|
|
||||||
|
|
||||||
|
private String orderColumn;
|
||||||
|
|
||||||
|
private String orderType;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,4 +46,9 @@ public class SysIotModelServiceDto implements Serializable {
|
|||||||
* 当前页数
|
* 当前页数
|
||||||
*/
|
*/
|
||||||
private Integer pageNum;
|
private Integer pageNum;
|
||||||
|
|
||||||
|
|
||||||
|
private String orderColumn;
|
||||||
|
|
||||||
|
private String orderType;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,10 @@ public interface SysEquipmentMapper extends BaseMapperPlus<SysEquipment, SysEqui
|
|||||||
// 获取设备的属性信息
|
// 获取设备的属性信息
|
||||||
List<BaseImptabmappingVo> getEquipmentAttributeInfo(Long equipmentId);
|
List<BaseImptabmappingVo> getEquipmentAttributeInfo(Long equipmentId);
|
||||||
|
|
||||||
|
List<BaseImptabmappingVo> getAttributeImpInfo(String code, Long equipmentId, Long linkId);
|
||||||
|
|
||||||
|
List<BaseImptabmappingVo> getServiceImpInfo(String code, Long equipmentId, Long linkId);
|
||||||
|
|
||||||
// 获取设备的动作信息
|
// 获取设备的动作信息
|
||||||
List<BaseImptabmappingVo> getEquipmentServiceInfo(Long equipmentId);
|
List<BaseImptabmappingVo> getEquipmentServiceInfo(Long equipmentId);
|
||||||
|
|
||||||
|
@ -165,13 +165,13 @@ public class SysNodeController {
|
|||||||
public R<?> getMappingList(@RequestBody SysImptabmappingDto sysImptabmappingDto) {
|
public R<?> getMappingList(@RequestBody SysImptabmappingDto sysImptabmappingDto) {
|
||||||
|
|
||||||
//判断是否有权限
|
//判断是否有权限
|
||||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
// boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||||
if(!hasPermission){
|
// if(!hasPermission){
|
||||||
return R.fail("没有节点管理权限");
|
// return R.fail("没有节点管理权限");
|
||||||
}
|
// }
|
||||||
if (sysImptabmappingDto.getLinkId() == null) {
|
// if (sysImptabmappingDto.getLinkId() == null) {
|
||||||
throw new ServiceException("参数缺失");
|
// throw new ServiceException("参数缺失");
|
||||||
}
|
// }
|
||||||
List<ImptabmappingVo> list = sysNodeService.getMappingList(sysImptabmappingDto);
|
List<ImptabmappingVo> list = sysNodeService.getMappingList(sysImptabmappingDto);
|
||||||
return R.success(list);
|
return R.success(list);
|
||||||
}
|
}
|
||||||
|
@ -210,6 +210,9 @@ public class SysNodeServiceImpl implements SysNodeService {
|
|||||||
public void bindDeviceMeas(List<BindEquipmentInfoDto> equipmentId, Long linkId) {
|
public void bindDeviceMeas(List<BindEquipmentInfoDto> equipmentId, Long linkId) {
|
||||||
List<SysImptabmapping> addList = new ArrayList<>();
|
List<SysImptabmapping> addList = new ArrayList<>();
|
||||||
List<Long> addList2 = new ArrayList<>();
|
List<Long> addList2 = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isEmpty(equipmentId)) {
|
||||||
|
sysImptabmappingMapper.deleteBindDevice(linkId);
|
||||||
|
}
|
||||||
// 先更新设备地址
|
// 先更新设备地址
|
||||||
for (BindEquipmentInfoDto info : equipmentId) {
|
for (BindEquipmentInfoDto info : equipmentId) {
|
||||||
// 更新设备表里面的设备地址
|
// 更新设备表里面的设备地址
|
||||||
@ -217,16 +220,15 @@ public class SysNodeServiceImpl implements SysNodeService {
|
|||||||
}
|
}
|
||||||
// 获取已经绑定的设备
|
// 获取已经绑定的设备
|
||||||
List<SysImptabmappingVo> bindDeviceList = sysImptabmappingMapper.getBindDevice(linkId);
|
List<SysImptabmappingVo> bindDeviceList = sysImptabmappingMapper.getBindDevice(linkId);
|
||||||
// 过滤已经绑定的设备
|
|
||||||
for (SysImptabmappingVo bindDevice : bindDeviceList) {
|
|
||||||
addList2.add(bindDevice.getEquipmentId());
|
|
||||||
}
|
|
||||||
//过滤
|
//过滤
|
||||||
equipmentId.removeIf(item -> addList2.contains(item.getEquipmentId()));
|
// equipmentId.removeIf(item -> addList2.contains(item.getEquipmentId()));
|
||||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||||
addSysImptabmapping(equipmentId, linkId, sysUserVo, addList);
|
addSysImptabmapping(equipmentId, linkId, sysUserVo, addList);
|
||||||
if (!CollectionUtils.isEmpty(addList)) {
|
if (!CollectionUtils.isEmpty(addList)) {
|
||||||
sysImptabmappingMapper.insertBatch(addList);
|
sysImptabmappingMapper.deleteBindDevice(linkId);
|
||||||
|
sysImptabmappingMapper.insertOrUpdateBatch(addList);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -364,23 +366,48 @@ public class SysNodeServiceImpl implements SysNodeService {
|
|||||||
// 获取设备的测点信息
|
// 获取设备的测点信息
|
||||||
for (BindEquipmentInfoDto info : equipmentId) {
|
for (BindEquipmentInfoDto info : equipmentId) {
|
||||||
List<BaseImptabmappingVo> fieldList = sysEquipmentMapper.getEquipmentAttributeInfo(info.getEquipmentId());
|
List<BaseImptabmappingVo> fieldList = sysEquipmentMapper.getEquipmentAttributeInfo(info.getEquipmentId());
|
||||||
|
// 获取映射表相关信息
|
||||||
List<BaseImptabmappingVo> serviceList = sysEquipmentMapper.getEquipmentServiceInfo(info.getEquipmentId());
|
List<BaseImptabmappingVo> serviceList = sysEquipmentMapper.getEquipmentServiceInfo(info.getEquipmentId());
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(fieldList)) {
|
if (!CollectionUtils.isEmpty(fieldList)) {
|
||||||
for (BaseImptabmappingVo field : fieldList) {
|
for (BaseImptabmappingVo field : fieldList) {
|
||||||
|
List<BaseImptabmappingVo> fieldImpList = sysEquipmentMapper.getAttributeImpInfo(field.getCode(), info.getEquipmentId(), linkId);
|
||||||
|
if (!CollectionUtils.isEmpty(fieldImpList)) {
|
||||||
|
for (BaseImptabmappingVo fieldImp : fieldImpList) {
|
||||||
|
if(field.getCode().equals(fieldImp.getCode())) {
|
||||||
SysImptabmapping sysImptabmapping = getSysImptabmapping(linkId, sysUserVo, info);
|
SysImptabmapping sysImptabmapping = getSysImptabmapping(linkId, sysUserVo, info);
|
||||||
sysImptabmapping.setEquipmentAttribute(field.getCode());
|
sysImptabmapping.setEquipmentAttribute(field.getCode());
|
||||||
sysImptabmapping.setParams(field.getParams());
|
sysImptabmapping.setParams(fieldImp.getParams());
|
||||||
addList.add(sysImptabmapping);
|
addList.add(sysImptabmapping);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
SysImptabmapping sysImptabmapping = getSysImptabmapping(linkId, sysUserVo, info);
|
||||||
|
sysImptabmapping.setEquipmentAttribute(field.getCode());
|
||||||
|
addList.add(sysImptabmapping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!CollectionUtils.isEmpty(serviceList)) {
|
if (!CollectionUtils.isEmpty(serviceList)) {
|
||||||
for (BaseImptabmappingVo service : serviceList) {
|
for (BaseImptabmappingVo service : serviceList) {
|
||||||
|
List<BaseImptabmappingVo> serviceImpList = sysEquipmentMapper.getServiceImpInfo(service.getCode(), info.getEquipmentId(), linkId);
|
||||||
|
|
||||||
|
if (!CollectionUtils.isEmpty(serviceImpList)) {
|
||||||
|
for (BaseImptabmappingVo serviceImp : serviceImpList) {
|
||||||
|
if(service.getCode().equals(serviceImp.getCode())) {
|
||||||
SysImptabmapping sysImptabmapping = getSysImptabmapping(linkId, sysUserVo, info);
|
SysImptabmapping sysImptabmapping = getSysImptabmapping(linkId, sysUserVo, info);
|
||||||
sysImptabmapping.setEquipmentService(service.getCode());
|
sysImptabmapping.setEquipmentService(service.getCode());
|
||||||
sysImptabmapping.setParams(service.getParams());
|
sysImptabmapping.setParams(serviceImp.getParams());
|
||||||
addList.add(sysImptabmapping);
|
addList.add(sysImptabmapping);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
SysImptabmapping sysImptabmapping = getSysImptabmapping(linkId, sysUserVo, info);
|
||||||
|
sysImptabmapping.setEquipmentService(service.getCode());
|
||||||
|
addList.add(sysImptabmapping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,16 +129,29 @@
|
|||||||
|
|
||||||
|
|
||||||
<select id="getEquipmentAttributeInfo" resultType="com.das.modules.equipment.domain.vo.BaseImptabmappingVo">
|
<select id="getEquipmentAttributeInfo" resultType="com.das.modules.equipment.domain.vo.BaseImptabmappingVo">
|
||||||
select simf.attribute_code as code, si.params from sys_iot_model_field simf
|
select simf.attribute_code as code from sys_iot_model_field simf
|
||||||
left join sys_equipment se on simf.iot_model_id = se.iot_model_id
|
left join sys_equipment se on simf.iot_model_id = se.iot_model_id
|
||||||
left join sys_imptabmapping si on si.equipment_attribute = simf.attribute_code
|
|
||||||
where se.id = #{id}
|
where se.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getEquipmentServiceInfo" resultType="com.das.modules.equipment.domain.vo.BaseImptabmappingVo">
|
|
||||||
select sims.service_code as code, si.params from sys_iot_model_service sims
|
<select id="getAttributeImpInfo" resultType="com.das.modules.equipment.domain.vo.BaseImptabmappingVo">
|
||||||
|
select simf.attribute_code as code, si.params,si.id,si.revision from sys_imptabmapping si
|
||||||
|
left join sys_iot_model_field simf on si.equipment_attribute = simf.attribute_code
|
||||||
|
left join sys_equipment se on simf.iot_model_id = se.iot_model_id
|
||||||
|
where si.equipment_id = #{equipmentId} and si.link_id = #{linkId} and si.equipment_attribute = #{code}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getServiceImpInfo" resultType="com.das.modules.equipment.domain.vo.BaseImptabmappingVo">
|
||||||
|
select sims.service_code as code, si.params,si.id,si.revision from sys_imptabmapping si
|
||||||
|
left join sys_iot_model_service sims on si.equipment_service = sims.service_code
|
||||||
|
left join sys_equipment se on sims.iot_model_id = se.iot_model_id
|
||||||
|
where si.equipment_id = #{equipmentId} and si.link_id = #{linkId} and sims.service_code = #{code}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getEquipmentServiceInfo" resultType="com.das.modules.equipment.domain.vo.BaseImptabmappingVo">
|
||||||
|
select sims.service_code as code from sys_iot_model_service sims
|
||||||
left join sys_equipment se on sims.iot_model_id = se.iot_model_id
|
left join sys_equipment se on sims.iot_model_id = se.iot_model_id
|
||||||
left join sys_imptabmapping si on si.equipment_service = sims.service_code
|
|
||||||
where se.id = #{id}
|
where se.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
left join sys_equipment se on si.equipment_id = se.id
|
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_field simf on si.equipment_attribute = simf.attribute_code and se.iot_model_id = simf.iot_model_id
|
||||||
where si.link_id = #{linkId} and simf.attribute_type = #{type}
|
where si.link_id = #{linkId} and simf.attribute_type = #{type}
|
||||||
order by si.porder
|
order by simf.porder
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getMappingControlList" resultType="com.das.modules.node.domain.vo.ImptabmappingVo">
|
<select id="getMappingControlList" resultType="com.das.modules.node.domain.vo.ImptabmappingVo">
|
||||||
@ -37,7 +37,7 @@
|
|||||||
left join sys_equipment se on si.equipment_id = se.id
|
left join sys_equipment se on si.equipment_id = se.id
|
||||||
left join sys_iot_model_service sims on si.equipment_service = sims.service_code and se.iot_model_id = sims.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.link_id = #{linkId} and sims.service_type = #{type}
|
where si.link_id = #{linkId} and sims.service_type = #{type}
|
||||||
order by si.porder
|
order by sims.porder
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getBindDevice" resultMap="SysImptabmappingMap">
|
<select id="getBindDevice" resultMap="SysImptabmappingMap">
|
||||||
|
@ -24,6 +24,12 @@
|
|||||||
<if test="info.attributeCode != null and info.attributeCode != ''">
|
<if test="info.attributeCode != null and info.attributeCode != ''">
|
||||||
and t.attribute_code like concat('%',#{info.attributeCode},'%')
|
and t.attribute_code like concat('%',#{info.attributeCode},'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="info.orderColumn != null and info.orderType != ''">
|
||||||
|
order by ${info.orderColumn} ${info.orderType}
|
||||||
|
</if>
|
||||||
|
<if test="info.orderColumn == null or info.orderColumn == '' or info.orderType == null or info.orderType == ''">
|
||||||
|
order by t.porder asc
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -24,6 +24,12 @@
|
|||||||
<if test="info.serviceCode != null and info.serviceCode != ''">
|
<if test="info.serviceCode != null and info.serviceCode != ''">
|
||||||
and t.service_code like concat('%',#{info.serviceCode},'%')
|
and t.service_code like concat('%',#{info.serviceCode},'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="info.orderColumn != null and info.orderType != ''">
|
||||||
|
order by ${info.orderColumn} ${info.orderType}
|
||||||
|
</if>
|
||||||
|
<if test="info.orderColumn == null or info.orderColumn == '' or info.orderType == null or info.orderType == ''">
|
||||||
|
order by t.porder asc
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user