2024年最新助力工业物联网,工业大数据之ST层的设计【二十五】,终局之战

img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化资料的朋友,可以戳这里获取

| oil\_province | 油站所属省 | one\_make\_dws.dim\_oilstation |
| oil\_city string | 油站所属市 | one\_make\_dws.dim\_oilstation |
| oil\_county string | 油站所属区 | one\_make\_dws.dim\_oilstation |
| customer\_classify | 客户类型 | one\_make\_dws.dim\_oilstation |
| customer\_province | 客户所属省 | one\_make\_dws.dim\_oilstation |


	- 呼叫中心主题事实
+ **分析**


	- **指标**
	
	
		* 工单自处理个数、工单转派工个数
		* 工单总数、最大值、最小值、平均值
		* 安装总数、维修总数、巡检总数、改造总数、完工总数
		* 中石化数量、经销商数量、其他直销数量、中石油数量、其他往来户数量、中化集团数量、中海油数量
		* 供应商数量、一站制造数量、服务工程师数量、中铁数量、合资公司数量、军供数量、中航油数量
	- **维度**
	
	
		* 日期维度:天、周、月
		* 油站维度:类型、省份、城市、地区
		* 客户维度:类型、省份
	- **数据表**
	
	
		* 事实表
		
		
			+ fact\_worker\_order:工单事实表
			
			 
			```
			select
			    wo_num, --工单数量
			    callaccept_id,--来电受理单id
			    oil_station_id, --油站id
			    dt --日期
			from fact_worker_order;
			
			```
			+ fact\_call\_service:呼叫中心事实表
		```
		select      
		id,--来电受理单id    
		process_way_name --处理方式  
		from fact_call_service;  
		
		```
		 ![image-20211013101145353](https://img-blog.csdnimg.cn/img_convert/34338014edb8808c08da582a4f7b4821.png)
		* **维度表**
		
		
			+ dim\_oilstation:油站维度表
			
			 
			```
			select
			    id,--油站id
			    company_name,--公司名称
			    province_name,--省份名称
			    city_name,--城市名称
			    county_name,--区域名称
			    customer_classify_name,--客户名称
			    customer_province_name--客户省份
			from dim_oilstation;
			
			```
			+ dim\_date:时间维度表
			
			 
			```
			select
				date_id,--天
				week_in_year_id,--周
				year_month_id --月
			from dim_date;
			
			```
			 ![image-20211013101244275](https://img-blog.csdnimg.cn/img_convert/527c6c88afa618d954fd87c92a72d294.png)
			+ 实现分析
		```
		-- 工单事实表
		select
		sum(case when b.process_way_name = '自己处理' then 1 else 0
		end) as own,
		sum(case when b.process_way_name = '转派工' then 1 else 0
		end) as other,
		sum(a.wo_num), --工单数量
		max(a.wo_num),
		min(a.wo_num),
		avg(a.wo_num),
		sum(a.install_num),
		sum(a.repair_num),
		sum(a.remould_num),
		sum(a.inspection_num),
		sum(a.alread_complete_num),
		sum(case when c.customer_classify_name = '中石化' then 1
		else 0 end) as zsy_count,
		……
		a.callaccept_id,--来电受理单id
		c.id, --油站id
		c.company_name,--公司名称
		c.province_name,--省份名称
		c.city_name,--城市名称
		c.county_name,--区域名称
		c.customer_classify_name,--客户名称
		c.customer_province_name ,--客户省份
		d.date_id,--天
		d.week_in_year_id,--周
		d.year_month_id --月
		from fact_worker_order a
		left join fact_call_service b on a.callaccept_id = b.id
		left join one_make_dws.dim_oilstation c on a.oil_station_id =
		c.id
		left join one_make_dws.dim_date d on a.dt = d.date_id
		group by
		c.id, --油站id
		c.company_name,--公司名称
		c.province_name,--省份名称
		c.city_name,--城市名称
		c.county_name,--区域名称
		c.customer_classify_name,--客户名称
		c.customer_province_name ,--客户省份
		d.date_id,--天
		d.week_in_year_id,--周
		d.year_month_id; --月;
		
		```
  • 小结

    • 掌握工单主题的需求分析

06:服务域:工单主题实现

  • 目标实现工单主题表的维度指标构建

  • 实施

    • 建库
    create database if not exists one_make_st;
    
    
    • 建表
    -- 创建工单主题表
    drop table if exists one_make_st.subj_worker_order;
    create table if not exists one_make_st.subj_worker_order(
        owner_process bigint comment '派工方式-自己处理数量'
        ,tran_process bigint comment '派工方式-转派工数量'
        ,wokerorder_num bigint comment '工单总数'
        ,wokerorder_num_max int comment '工单总数最大值'
        ,wokerorder_num_min int comment '工单总数最小值'
        ,wokerorder_num_avg int comment '工单总数平均值'
        ,install_sumnum bigint comment '派工类型-安装总数'
        ,repair_sumnum bigint comment '派工类型-维修总数'
        ,remould_sumnum bigint comment '派工类型-巡检总数'
        ,inspection_sumnum bigint comment '派工类型-改造总数'
        ,alread_complete_sumnum bigint comment '完工总数'
        ,customer_classify_zsh bigint comment '客户类型-中石化数量'
        ,customer_classify_jxs bigint comment '客户类型-经销商数量'
        ,customer_classify_qtzx bigint comment '客户类型-其他直销数量'
        ,customer_classify_zsy bigint comment '客户类型-中石油数量'
        ,customer_classify_qtwlh bigint comment '客户类型-其他往来户数量'
        ,customer_classify_zhjt bigint comment '客户类型-中化集团数量'
        ,customer_classify_zhy bigint comment '客户类型-中海油数量'
        ,customer_classify_gys bigint comment '客户类型-供应商数量'
        ,customer_classify_onemake bigint comment '客户类型-一站制造\*\*数量'
        ,customer_classify_fwy bigint comment '客户类型-服务员数量'
        ,customer_classify_zt bigint comment '客户类型-中铁数量'
        ,customer_classify_hzgs bigint comment '客户类型-合资公司数量'
        ,customer_classify_jg bigint comment '客户类型-军供数量'
        ,customer_classify_zhhangy bigint comment '客户类型-中航油数量'
        ,dws_day string comment '日期维度-按天'
        ,dws_week string comment '日期维度-按周'
        ,dws_month string comment '日期维度-按月'
        ,oil_type string comment '油站维度-油站类型'
        ,oil_province string comment '油站维度-油站所属省'
        ,oil_city string comment '油站维度-油站所属市'
        ,oil_county string comment '油站维度-油站所属区'
        ,customer_classify string comment '客户维度-客户类型'
        ,customer_province string comment '客户维度-客户所属省'
    ) comment '工单主题表'
    partitioned by (month String, week String, day String)
    stored as orc
    location '/data/dw/st/one\_make/subj\_worker\_order'
    ;
    
    
    • 构建
    insert overwrite table one_make_st.subj_worker_order partition(month = '202101', week='2021W1', day='20210101')
    select
        sum(case when fcs.process_way_name = '自己处理' then 1 else 0 end) owner_process, --工单自处理个数
    	sum(case when fcs.process_way_name = '转派工' then 1 else 0 end) tran_process,    --工单转派工个数
    	sum(fwo.wo_num) wokerorder_num,                                      --工单总数
    	max(fwo.wo_num) wokerorder_num_max,                                  --最大值
        min(fwo.wo_num) wokerorder_num_min,                                  --最小值
    	avg(fwo.wo_num) wokerorder_num_avg,                                  --平均值
    	sum(fwo.install_num) install_sumnum,                                     --安装总数
    	sum(fwo.repair_num) repair_sumnum,                                       --维修总数
        sum(fwo.remould_num) remould_sumnum,                                     --巡检总数
    	sum(fwo.inspection_num) inspection_sumnum,                               --改造总数
    	sum(fwo.alread_complete_num) alread_complete_sumnum,                     --完工总数
        sum(case when oil.customer_classify_name ='中石化' then 1 else 0 end) customer_classify_zsh,       --中石化数量
    	sum(case when oil.customer_classify_name ='经销商' then 1 else 0 end) customer_classify_jxs,       --经销商数量
        sum(case when oil.customer_classify_name ='其他直销' then 1 else 0 end) customer_classify_qtzx,      --其他直销数量
    	sum(case when oil.customer_classify_name ='中石油' then 1 else 0 end) customer_classify_zsy,       --中石油数量
        sum(case when oil.customer_classify_name ='其他往来户' then 1 else 0 end) customer_classify_qtwlh,     --其他往来户数量
    	sum(case when oil.customer_classify_name ='中化集团' then 1 else 0 end) customer_classify_zhjt,      --中化集团数量
        sum(case when oil.customer_classify_name ='中海油' then 1 else 0 end) customer_classify_zhy,       --中海油数量
    	sum(case when oil.customer_classify_name ='供应商' then 1 else 0 end) customer_classify_gys,        --供应商数量
        sum(case when oil.customer_classify_name ='一站制造\*\*' then 1 else 0 end) customer_classify_onemake,     --一站制造数量
    
    
    

img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化资料的朋友,可以戳这里获取

存中…(img-Y4DxPEXj-1714916418892)]

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化资料的朋友,可以戳这里获取

  • 9
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值