|
|
@ -4,6 +4,8 @@ import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import com.ruoyi.common.core.domain.Ztree;
|
|
|
|
import com.ruoyi.common.core.domain.Ztree;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
|
|
|
import com.ruoyi.common.exception.BusinessException;
|
|
|
|
import com.ruoyi.common.exception.BusinessException;
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
import com.ruoyi.common.utils.ShiroUtils;
|
|
|
|
import com.ruoyi.common.utils.ShiroUtils;
|
|
|
@ -202,4 +204,52 @@ public class BaseMonitorunitInfoServiceImpl implements IBaseMonitorunitInfoServi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ztrees;
|
|
|
|
return ztrees;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<Ztree> roleMonitorUnitTreeData(SysRole role, Long userId) {
|
|
|
|
|
|
|
|
Long roleId = role.getRoleId();
|
|
|
|
|
|
|
|
List<Ztree> ztrees = new ArrayList<Ztree>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取所以监控单元
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfo> baseMonitorunitInfos = this.selectBaseMonitorunitInfoList(new BaseMonitorunitInfo());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotNull(roleId))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<String> roleMonitorUnitList = baseMonitorunitInfoMapper.selectMonitorUnitTreeByRoleId(roleId);
|
|
|
|
|
|
|
|
ztrees = initZtree(baseMonitorunitInfos, roleMonitorUnitList, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ztrees = initZtree(baseMonitorunitInfos, null, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ztrees;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 对象转菜单树
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param monitorunitInfoList
|
|
|
|
|
|
|
|
* @param roleMonitorUnitList
|
|
|
|
|
|
|
|
* @param permsFlag
|
|
|
|
|
|
|
|
* @return 树结构列表
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public List<Ztree> initZtree(List<BaseMonitorunitInfo> monitorunitInfoList, List<String> roleMonitorUnitList, boolean permsFlag)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<Ztree> ztrees = new ArrayList<Ztree>();
|
|
|
|
|
|
|
|
boolean isCheck = StringUtils.isNotNull(roleMonitorUnitList);
|
|
|
|
|
|
|
|
for (BaseMonitorunitInfo monitorunitInfo : monitorunitInfoList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Ztree ztree = new Ztree();
|
|
|
|
|
|
|
|
ztree.setId(monitorunitInfo.getMonitorunitId());
|
|
|
|
|
|
|
|
ztree.setpId(monitorunitInfo.getParentId());
|
|
|
|
|
|
|
|
ztree.setName(monitorunitInfo.getMonitorunitName());
|
|
|
|
|
|
|
|
ztree.setTitle(monitorunitInfo.getMonitorunitName());
|
|
|
|
|
|
|
|
if (isCheck)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ztree.setChecked(roleMonitorUnitList.contains(monitorunitInfo.getMonitorunitId()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ztrees.add(ztree);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ztrees;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|