助力工业物联网,工业大数据之服务域:安装主题分析实现【三十】

			```
+ 分析
+ 实现\*\*


	- 建表
	
	 
	```
	drop table if exists one_make_st.subj_customer;
	create table if not exists one_make_st.subj_customer(
	    sum_install_num int comment '安装数量'
	    ,max_install_num int comment '安装最大数量'
	    ,min_install_num int comment '安装最小数量'
	    ,avg_min_install_num decimal(20, 1) comment '安装平均数量'
	    ,sum_repair_num int comment '维修数量'
	    ,max_repair_num int comment '维修最大数量'
	    ,min_repair_num int comment '维修最小数量'
	    ,avg_repair_num decimal(20, 1) comment '维修平均数量'
	    ,sum_wo_num int comment '派工数量'
	    ,max_sum_wo_num int comment '派工最大数量'
	    ,min_sum_wo_num int comment '派工最小数量'
	    ,avg_sum_wo_num decimal(20, 1) comment '派工平均数量'
	    ,sum_remould_num int comment '巡检数量'
	    ,max_remould_num int comment '巡检最大数量'
	    ,min_remould_num int comment '巡检最小数量'
	    ,avg_remould_num decimal(20, 1) comment '巡检平均数量'
	    ,sum_alread_complete_num int comment '回访数量'
	    ,max_alread_complete_num int comment '回访最大数量'
	    ,min_alread_complete_num int comment '回访最小数量'
	    ,avg_alread_complete_num decimal(20, 1) 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\_customer'
	;
	
	```
  • 构建
insert overwrite table one_make_st.subj_customer partition(month = '202101', week='2021W1', day='20210101')

  select

      sum(fwo.install_num) sum_install_num,                  --安装数量

  	max(fwo.install_num) max_install_num,                  --最大安装数量

  	min(fwo.install_num) min_install_num,                  --最小安装数量

      avg(fwo.install_num) avg_min_install_num,              --平均安装数量

  	sum(fwo.repair_num) sum_repair_num,                    --维修数量

  	max((fwo.repair_num)) max_repair_num,                  --最大维修数量

      min(fwo.repair_num) min_repair_num,                    --最小维修数量

  	avg((fwo.repair_num)) avg_repair_num,                  --平均维修数量

  	sum(fwo.wo_num) sum_wo_num,                            --派工数量

  	max(fwo.wo_num) max_sum_wo_num,                        --最大派工数量

      min(fwo.wo_num) min_sum_wo_num,                        --最小派工数量

  	avg(fwo.wo_num) avg_wo_num,                            --平均派工数量

  	sum(fwo.remould_num) sum_remould_num,                  --改造数量

  	max(fwo.remould_num) max_remould_num,                  --最大改造数量

      min(fwo.remould_num) min_remould_num,                  --最小改造数量

  	avg(fwo.remould_num) avg_remould_num,                  --平均改造数量

  	sum(fwo.alread_complete_num) sum_alread_complete_num,  --回访数量

      max(fwo.alread_complete_num) max_alread_complete_num,  --最大回访数量

  	min(fwo.alread_complete_num) min_alread_complete_num,  --最小回访数量

      avg(fwo.alread_complete_num) avg_alread_complete_num,  --平均回访数量

  	dd.date_id dws_day,                                    --日期天

  	dd.week_in_year_id dws_week,                           --日期周

  	dd.year_month_id dws_month,                            --日期月

  	dimoil.company_name oil_type,                          --油站类型

      dimoil.province_name oil_province,                     --油站省份

  	dimoil.city_name oil_city,                             --油站城市

  	dimoil.county_name oil_county,                         --油站区域

  	dimoil.customer_classify_name customer_classify,       --客户类型

      dimoil.customer_province_name customer_province        --客户省份

  --工单事务事实表

  from one_make_dwb.fact_worker_order fwo

  --日期维度表

  left join one_make_dws.dim_date dd on fwo.dt = dd.date_id

  --油站维度表

  left join one_make_dws.dim_oilstation dimoil on fwo.oil_station_id = dimoil.id

  where dd.year_month_id = '202101'and dd.week_in_year_id = '2021W1' and  dd.date_id = '20210101'

  group by dd.date_id, dd.week_in_year_id, dd.year_month_id, dimoil.company_name, dimoil.province_name, dimoil.city_name, dimoil.county_name,

           dimoil.customer_classify_name, dimoil.customer_province_name

  ;


  • 小结

    • 掌握客户主题的需求分析及实现

17:物料域:主题模型

  • 目标了解物料域主题的设计模型

  • 路径

    • step1:良品核销主题模型
    • step2:不良品核销主题模型
  • 实施

    • 良品核销主题模型

    image-20211004145025841

    • 不良品核销主题模型

    image-20211004145135124

  • 小结

    • 了解物料域主题的设计模型

18:DM层:设计及运营部门主题

  • 目标掌握DM层的设计

  • 路径

    • step1:DM层设计
    • step2:运营部门主题
  • 实施

    • DM层设计

      • 功能:数据集市层,用于支撑对每个部门的各种数据的需求
      • 来源:对DW层的数据按照一定的部门分类进行抽取
    • 运营部门主题

      • 需求:统计不同维度下的运营主题指标

      image-20211004150559165

      • 实现

        • 建库
        create database if not exists one_make_dm;
        
        
          + **建表**
          
           
          ```
          drop table if exists one_make_dm.mart_operation_dept;
          create table if not exists one_make_dm.mart_operation_dept(
              wo_id string comment '工单ID'
              ,userids string comment '工单服务用户ID'
              ,callaccept_id string comment '来电受理ID'
              ,oil_station_id string comment '油站ID'
              ,os_name string comment '油站名称'
              ,service_total_duration decimal(20,2) comment '服务工时(小时)'
              ,repair_num bigint comment '维修工单数量'
              ,wo_num bigint comment '工单数量'
              ,avg_wo_num int comment '平均工单'
              ,sum_os_online int comment '加油机在线设备总数'
              ,atu_num_rate decimal(5,2) comment '客户回访满意度率'
              ,rtn_visit_duration decimal(20,2) comment '来电受理时长(小时)'
              ,dws_day string comment '日期维度-按天'
              ,dws_week string comment '日期维度-按周'
              ,dws_month string comment '日期维度-按月'
          ) comment '运营部数据集市表'
          partitioned by (month String, week String, day String)
          stored as orc
          location '/data/dw/dm/one\_make/mart\_operation\_dept';
          
          ```
        
        • 构建
        insert overwrite table one_make_dm.mart_operation_dept partition(month = '202101', week='2021W1', day='20210101')
            select
                fwo.wo_id                                                                            --工单id
                , max(fwo.userids) userids                                                           --工程师id
                , max(fwo.callaccept_id) callaccept_id                                               --来电受理id
                , max(fwo.oil_station_id) oil_station_id                                             --油站id
            	, max(fos.os_name) os_name 															 --油站名称
                , max(fwo.service_total_duration) service_total_duration                             --服务工时
                , sum(fwo.wo_num) wo_num                                                             --维修工单数量
                , count(fos.os_id) sum_os_num                                                        --工单数量
                , avg(fwo.wo_num) avg_wo_num                                                         --平均工单
        
        
        

img
img
img

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

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

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

外链图片转存中…(img-LFMFK70p-1714288958746)]

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

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

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

  • 8
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值