基于大数据技术Hadoop的气象分析可视化大屏设计和实现

博主介绍:硕士研究生,专注于信息化技术领域开发与管理,会使用java、标准c/c++等开发语言,以及毕业项目实战✌

从事基于java BS架构、CS架构、c/c++ 编程工作近16年,拥有近12年的管理工作经验,拥有较丰富的技术架构思想、较扎实的技术功底和资深的项目管理经验。

先后担任过技术总监、部门经理、项目经理、开发组长、java高级工程师及c++工程师等职位,在工业互联网、国家标识解析体系、物联网、分布式集群架构、大数据通道处理、接口开发、远程教育、办公OA、财务软件(工资、记账、决策、分析、报表统计等方面)、企业内部管理软件(ERP、CRM等)、arggis地图等信息化建设领域有较丰富的实战工作经验;拥有BS分布式架构集群、数据库负载集群架构、大数据存储集群架构,以及高并发分布式集群架构的设计、开发和部署实战经验;拥有大并发访问、大数据存储、即时消息等瓶颈解决方案和实战经验。

拥有产品研发和发明专利申请相关工作经验,完成发明专利构思、设计、编写、申请等工作,并获得发明专利1枚。


大家在毕设选题、项目升级、论文写作,就业毕业等相关问题都可以给我留言咨询,非常乐意帮助更多的人或加w 908925859。

相关博客地址:

csdn专业技术博客:https://blog.csdn.net/mr_lili_1986?type=blog

Iteye博客: https://www.iteye.com/blog/user/mr-lili-1986-163-com

获取论文及源代码:请加微908925859

注:每个学校每个老师对论文的格式要求不一样,故本论文只供参考,本论文页数达到60页以上,字数在6000及以上。

目录

一、前言介绍:

二、功能设计:

三、功能实现:

四、库表设计:

五、关键代码:

六、论文参考:

七、其他案例:

一、前言介绍:

信息化社会内需要与之针对性的信息获取途径,但是途径的扩展基本上为人们所努力的方向,由于站在的角度存在偏差,人们经常能够获得不同类型信息,这也是技术最为难以攻克的课题。针对气象分析大屏可视化等问题,对气象进行研究分析,然后开发设计出气象分析大屏可视化系统以解决问题。

气象分析大屏可视化系统主要功能模块包括后台首页,系统用户(管理员),模块管理(日照时数,平均相对湿度,年降水量,平均气温,贵阳气象分析,气温对比),采取面对对象的开发模式进行软件的开发和硬体的架设,能很好的满足实际使用的需求,完善了对应的软体架设以及程序编码的工作,采取MySQL作为后台数据的主要存储单元,采用Hadoop框架、python技术、Ajax技术进行业务系统的编码及其开发,实现了本系统的全部功能。本次报告,首先分析了研究的背景、作用、意义,为研究工作的合理性打下了基础。针对气象分析大屏可视化系统的各项需求以及技术问题进行分析,证明了系统的必要性和技术可行性,然后对设计系统需要使用的技术软件以及设计思想做了基本的介绍,最后来实现气象分析大屏可视化系统和部署运行使用它。

关键词:气象分析大屏可视化;Hadoop框架;MySQL数据库 ;分布式;大数据;流数据;

二、功能设计:

气象分析大屏可视化系统只要由管理员模块构成。

模块的功能都是根据先前完成的需求分析,并查阅相关资料后整理制作的。

综上所述,系统功能结构图如下图所示。

三、功能实现:

要由两部分组成,登录前的登录界面以及登录后的用户功能界面。登录界面,要求用户输入用户名和密码,当用户名和密码其中一个输入为空时,给出提示"用户名,密码不能为空"。获取用户名和密码后到数据库中查找,如果用户名存在,以及对应的密码正确,则登录成功,否则登录失败。登录失败后给出提示,并把焦点停在文本框中。登录成功后将该次会话的全局变量username设置为用户名。登录成功后进入会员的功能模块,主要有会员基本信息修改,已经发布商品信息管理,发布信息,和退出功能。退出功能是清除全局变量username的值,并跳回到首页。

登录流程图如下图所示。

登录界面:

系统用户模块的实现

用户登录/注册成功之后可以修改自己的基本信息。修改页面的表单中每一个input的name值都要与实体类中的参数相匹配,在用户点击修改页面的时候,如果改后用户名与数据库里面重复了,页面会提示该用户名已经存在了,否则通过Id来查询用户,并将用户的信息修改为表单提交的数据。

模块管理的实现

管理员登录系统后,可对模块管理中的日照时数,平均相对湿度,年降水量,平均气温,贵阳气象分析,气温对比等信息进行查询,重置,删除,添加等维护操作,可以导入数据或者下载导入的文档。如下图所示。

展示大屏的实现

展示大屏模块调用echarts.min.js初始化图表的样式和框架,首先要初始化类目参数和数量参数,本系统在日照时数,年降水量,平均气温等模块上使用了可视化图表,其的类目参数为日照时数,年降水量,平均气温等参数,从参数表里读取,遍历参数表中的数据,分别加入到类目数组和数量数组中,做好数据初始化准备,其次是用pythonScript开始画图,设置图的类型,设置图的标题,设置类目数,设置数量和可视化图表的尺寸,设置背景颜色,设置画图样式,调用画图函数,可视化图表就自动生成了。

展示大屏界面如下图所示。

四、库表设计:

五、关键代码:

java 复制代码
package com.qixia.hadoop;
 
import lombok.extern.slf4j.Slf4j;
import org.apache.hadoop.fs.FileSystem;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
 
 
/**
 * @author:li
 * @date:2023/7/28
 * @descripion:
 */
@Slf4j
@Configuration
public class HadoopConfig {
    @Value("${hdfs.hdfsPath}")
    private  String hdfsPath;
    @Value("${hdfs.hdfsName}")
    private  String hdfsName;
    @Bean
    public org.apache.hadoop.conf.Configuration getConfiguration(){
        org.apache.hadoop.conf.Configuration config = new org.apache.hadoop.conf.Configuration();
        config.set("fs.defaultFS",hdfsPath);
        return  config;
    }
    @Bean
    public FileSystem getFileSystem(){
        FileSystem fileSystem=null;
        try {
            fileSystem= FileSystem.get(new URI(hdfsPath), getConfiguration(), hdfsName);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
        return fileSystem;
    }
}
java 复制代码
package com.qixia.hadoop.hdfs;
 
import lombok.extern.slf4j.Slf4j;
import org.apache.hadoop.fs.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
 
import java.io.IOException;
import java.util.*;
 
/**
 * @author:li
 * @date:2023/7/31
 * @descripion:
 */
@Service
@Slf4j
public class HDFSServiceImpl  implements  HDFSService{
    @Autowired
    private FileSystem fileSystem;
    @Override
    public boolean existFile(String path) {
        if (StringUtils.isEmpty(path)){
            return false;
        }
        Path src = new Path(path);
        try {
            return fileSystem.exists(src);
        } catch (IOException e) {
            log.error(e.getMessage());
        }
        return false;
    }
 
    @Override
    public List<Map<String, Object>> readCatalog(String path) {
        if (StringUtils.isEmpty(path)){
            return Collections.emptyList();
        }
        if (!existFile(path)){
            log.error("catalog is not exist!!");
            return Collections.emptyList();
        }
 
        Path src = new Path(path);
        FileStatus[] fileStatuses = null;
        try {
            fileStatuses = fileSystem.listStatus(src);
        } catch (IOException e) {
            log.error(e.getMessage());
        }
        List<Map<String, Object>> result = new ArrayList<>(fileStatuses.length);
 
        if (null != fileStatuses && 0 < fileStatuses.length) {
            for (FileStatus fileStatus : fileStatuses) {
                Map<String, Object> cataLogMap = new HashMap<>();
                cataLogMap.put("filePath", fileStatus.getPath());
                cataLogMap.put("fileStatus", fileStatus);
                result.add(cataLogMap);
            }
        }
        return result;
    }
 
    @Override
    public boolean createFile(String path, MultipartFile file) {
        boolean target = false;
        if (StringUtils.isEmpty(path)) {
            return false;
        }
        String fileName = file.getOriginalFilename();
//        String fileName = file.getName();
        Path newPath = new Path(path + "/" + fileName);
 
        FSDataOutputStream outputStream = null;
        try {
            outputStream = fileSystem.create(newPath);
            outputStream.write(file.getBytes());
            target = true;
        } catch (IOException e) {
            log.error(e.getMessage());
        } finally {
            if (null != outputStream) {
                try {
                    outputStream.close();
                } catch (IOException e) {
                    log.error(e.getMessage());
                }
            }
        }
        return target;
    }
 
    @Override
    public boolean uploadFile(String path, String uploadPath) {
        if (StringUtils.isEmpty(path) || StringUtils.isEmpty(uploadPath)) {
            return false;
        }
 
        Path clientPath = new Path(path);
 
        Path serverPath = new Path(uploadPath);
 
        try {
            fileSystem.copyFromLocalFile(false,clientPath,serverPath);
            return true;
        } catch (IOException e) {
            log.error(e.getMessage(), e);
        }
        return false;
    }
 
    @Override
    public boolean downloadFile(String path, String downloadPath) {
        if (StringUtils.isEmpty(path) || StringUtils.isEmpty(downloadPath)) {
            return false;
        }
 
        Path clienPath = new Path(path);
 
        Path targetPath = new Path(downloadPath);
 
        try {
            fileSystem.copyToLocalFile(false,clienPath, targetPath);
            return true;
        } catch (IOException e) {
            log.error(e.getMessage());
        }
        return false;
    }
 
    @Override
    public boolean deleteFile(String path) {
        boolean target = false;
        if (StringUtils.isEmpty(path)) {
            return false;
        }
        if (!existFile(path)) {
            return false;
        }
        Path src = new Path(path);
        try {
            target = fileSystem.deleteOnExit(src);
        } catch (IOException e) {
            log.error(e.getMessage());
        }
        return target;
    }
 
    @Override
    public BlockLocation[] getFileBlockLocations(String path) {
        if (StringUtils.isEmpty(path)) {
            return null;
        }
        if (!existFile(path)) {
            return null;
        }
        BlockLocation[] blocks = null;
        Path src = new Path(path);
        try{
            FileStatus fileStatus = fileSystem.getFileStatus(src);
            blocks = fileSystem.getFileBlockLocations(fileStatus, 0, fileStatus.getLen());
        }catch(Exception e){
            log.error(e.getMessage());
        }
        return blocks;
    }
 
    @Override
    public String readFileContent(String path) {
        if (StringUtils.isEmpty(path)){
            return null;
        }
 
        if (!existFile(path)) {
            return null;
        }
 
        Path src = new Path(path);
 
        FSDataInputStream inputStream = null;
        StringBuilder sb = new StringBuilder();
        try {
            inputStream = fileSystem.open(src);
            String lineText = "";
            while ((lineText = inputStream.readLine()) != null) {
                sb.append(lineText);
            }
        } catch (IOException e) {
            log.error(e.getMessage());
        } finally {
            if (null != inputStream) {
                try {
                    inputStream.close();
                } catch (IOException e) {
                    log.error(e.getMessage());
                }
            }
        }
        return sb.toString();
    }
}
java 复制代码
# -*- coding: utf-8 -*-
import os
import importlib
 
services_abspath_arr = []
services_arr = []
services_dir_ = os.getcwd() + "\\hadoop"
 
# 遍历模块文件(绝对路径)加到services_abspath_arr数组
 
 
# 选择服务函数
def service_hadoop_select(str):
    for service_item in services_arr:
        if str.capitalize() == service_item.__class__.__name__:
            return service_item
 
 
def foreach_file(path_name):
    for root, dirs, files in os.walk(path_name):
        for f in files:
            services_abspath_arr.append(os.path.join(root, f))
 
 
# 读取模块
# f:文件路径
def loadModule(f):
    # 将f变成相对路径
    f = f.replace(services_dir_ + "\\", "").replace(".py", "").replace("\\", "/")
    # print(f)
    mod = importlib.import_module(
        "jobs."+f.replace("/", ".")
    )
    arr_1 = f.split("/")
    cs_service = getattr(mod, arr_1[len(arr_1) - 1].capitalize())
    # service的class形式
    service = cs_service()
    services_arr.append(service)
 
 
foreach_file(services_dir_)
 
for f in services_abspath_arr:
    if f.find(".pyc") == -1 and f.find("__init__") == -1:
        # print(f)
        loadModule(f)

六、论文参考:

七、其他案例:

相关推荐
Jason不在家24 分钟前
Flink 本地 idea 调试开启 WebUI
大数据·flink·intellij-idea
Elastic 中国社区官方博客2 小时前
使用 Vertex AI Gemini 模型和 Elasticsearch Playground 快速创建 RAG 应用程序
大数据·人工智能·elasticsearch·搜索引擎·全文检索
极客先躯2 小时前
高级java每日一道面试题-2024年10月3日-分布式篇-分布式系统中的容错策略都有哪些?
java·分布式·版本控制·共识算法·超时重试·心跳检测·容错策略
niu_sama2 小时前
仿RabbitMQ实现消息队列三种主题的调试及源码
分布式·rabbitmq
鸡c3 小时前
rabbitMq------客户端模块
分布式·rabbitmq·ruby
CHICX12293 小时前
【Hadoop】改一下core-site.xml和hdfs-site.xml配置就可以访问Web UI
xml·大数据·hadoop
权^3 小时前
MySQL--聚合查询、联合查询、子查询、合并查询(上万字超详解!!!)
大数据·数据库·学习·mysql
Dylanioucn3 小时前
【分布式微服务云原生】探索Redis:数据结构的艺术与科学
数据结构·redis·分布式·缓存·中间件
路上^_^4 小时前
00_概览_kafka
分布式·kafka
bin91538 小时前
【EXCEL数据处理】000010 案列 EXCEL文本型和常规型转换。使用的软件是微软的Excel操作的。处理数据的目的是让数据更直观的显示出来,方便查看。
大数据·数据库·信息可视化·数据挖掘·数据分析·excel·数据可视化