助力工业物联网,工业大数据之服务域:派单主题分析实现【二十九】_工业订单数据域如何分析

			```
			+ fact\_worker\_order:工单事务事实表
			
			 
			```
			select
			    callaccept_id,--呼叫受理id
			    install_num,--安装数量
			    repair_num,--维修数量
			    remould_num,--改造数量
			    inspection_num,--巡检数量
			    wo_num, --工单数量
			    people_num, --工单人数
			    repair_service_duration,--报修响应时长
			    service_total_duration --服务总时长
			from fact_worker_order;
			
			```
			 ![image-20211013144809058](https://img-blog.csdnimg.cn/img_convert/dfc39a2ae68ddcc22784526ddce17f86.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;
				
				```
				- dim\_emporg:组织机构维度
				
				 
				```
				select      
				empid,--人员id      
				orgname,--部门名称      
				posiname,--岗位名称      
				empname --员工名称  
				from dim_emporg;
				
				```
+ **实现**


	- 建表
	
	 
	```
	drop table if exists one_make_st.subj_dispatch;
	create table if not exists one_make_st.subj_dispatch(
	    install_sumnum int comment '安装单数量'
	    ,repair_sumnum int comment '维修单数量'
	    ,remould_sumnum int comment '改造单数量'
	    ,inspection_sumnum int comment '巡检单数量'
	    ,max_wo_num int comment '派单数最大值'
	    ,min_wo_num int comment '派单数最小值'
	    ,avg_wo_num decimal(20, 1) comment '派单数平均值'
	    ,call_srv_user int comment '呼叫中心派单人'
	    ,max_dispatch_cnt int comment '呼叫中心最大派单'
	    ,min_dispatch_cnt int comment '呼叫中心最小派单'
	    ,avg_dispatch_cnt decimal(20, 1) comment '呼叫中心平均派单'
	    ,people_wo_num decimal(20, 1) comment '派单平均值'
	    ,srv_reps_duration int comment '派单响应时长'
	    ,srv_duration int comment '服务时长'
	    ,pepople_sumnum int comment '工单人数'
	    ,dws_day string comment '日期维度-按天'
	    ,dws_week string comment '日期维度-按周'
	    ,dws_month string comment '日期维度-按月'
	    ,orgname string comment '组织机构维度-回访人员所属部门'
	    ,posiname string comment '组织机构维度-回访人员所属岗位'
	    ,empname 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\_dispatch'
	;
	
	```
	- 构建
	
	 
	```
	insert overwrite table one_make_st.subj_dispatch partition(month = '202101', week='2021W1', day='20210101')
	select
		sum(fwo.install_num) install_sumnum,                       --安装单数量
		sum(fwo.repair_num) repair_sumnum,                         --维修单数量
		sum(fwo.remould_num) remould_sumnum,                       --改造单数量
		sum(fwo.inspection_num) inspection_sumnum,                 --巡检单数量
	    max(fwo.wo_num) max_wo_num,                                --最大派单数
		min(fwo.wo_num) min_wo_num,                                --最小派单数
		avg(fwo.wo_num) avg_wo_num,                                --平均派单数
		sum(fcs.userid) call_srv_user,                             --呼叫中心派单人
		max(fcs.dispatch_cnt) max_dispatch_cnt,                    --呼叫中心最大派单
	    min(fcs.dispatch_cnt) min_dispatch_cnt,                    --呼叫中心最小派单
		avg(fcs.dispatch_cnt) avg_dispatch_cnt,                    --呼叫中心平均派单
		sum(fwo.wo_num) / sum(fwo.people_num) people_wo_num,       --派单平均值
	    sum(fwo.repair_service_duration) srv_reps_duration,        --派单响应时长
		sum(fwo.service_total_duration) srv_duration,              --服务时长
		sum(fwo.people_num) pepople_sumnum,                        --工单人数
	    dd.date_id dws_day,                                        --日期日
		dd.week_in_year_id dws_week,                               --日期周
		dd.year_month_id dws_month,                                --日期月
		emp.orgname,                                               --组织机构人员部门
		emp.posiname,                                              --组织机构人员岗位
		emp.empname,                                               --组织机构人员名称
		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_call_service fcs
	--关联工单事实表
	left join one_make_dwb.fact_worker_order fwo on fcs.id = fwo.callaccept_id
	--关联组织机构维度表
	left join one_make_dws.dim_emporg emp on fcs.userid = emp.empid
	--关联日期维度表
	left join one_make_dws.dim_date dd on fcs.dt = dd.date_id
	--关联油站维度表
	left join one_make_dws.dim_oilstation dimoil on fcs.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, emp.orgname, emp.posiname, emp.empname, dimoil.company_name, dimoil.province_name,
	         dimoil.city_name, dimoil.county_name, dimoil.customer_classify_name, dimoil.customer_province_name
	;
	
	```
  • 小结

    • 掌握派单主题的需求分析及实现

14:服务域:费用主题分析

  • 目标掌握费用主题的需求分析

  • 路径

    • step1:需求
    • step2:分析
  • 实施

    • 需求:统计不同维度下的费用主题指标的结果
    字段名称字段说明来源
    install_money安装费用one_make_dwb.fact_srv_install
    max_install_money最大安装费用one_make_dwb.fact_srv_install
    min_install_money最小安装费用one_make_dwb.fact_srv_install
    avg_install_money平均安装费用one_make_dwb.fact_srv_install
    sumbiz_trip_money外出差旅费用金额总计one_make_dwb.fact_trvl_exp
    sumin_city_traffic_money市内交通费用金额总计one_make_dwb.fact_trvl_exp
    sumhotel_money住宿费费用金额总计one_make_dwb.fact_trvl_exp
    sumfars_money车船费用金额总计one_make_dwb.fact_trvl_exp
    sumsubsidy_money补助费用金额总计one_make_dwb.fact_trvl_exp
    sumroad_toll_money过桥过路费用金额总计one_make_dwb.fact_trvl_exp
    sumoil_money油费金额总计one_make_dwb.fact_trvl_exp
    exp_item_total差旅费用扣款明细总计one_make_dwb.fact_regular_exp
    actual_total_money差旅费用总额统计one_make_dwb.fact_trvl_exp
    sum_secondary_money差旅费用二阶段扣款总计one_make_dwb.fact_trvl_exp
    sum_third_money差旅费用三阶段扣款总计one_make_dwb.fact_trvl_exp
    max_secondary_money差旅费用二阶段最大扣款总计one_make_dwb.fact_trvl_exp
    max_third_money差旅费用三阶段最大扣款总计one_make_dwb.fact_trvl_exp
    sum_srv_user报销人员总数量one_make_dwb.fact_trvl_exp
    max_srv_user报销人员最大数量one_make_dwb.fact_trvl_exp
    min_srv_user报销人员最小数量one_make_dwb.fact_trvl_exp
    avg_srv_user报销人员平均数量one_make_dwb.fact_trvl_exp
    dws_day string日期维度-按天one_make_dws.dim_date
    dws_week string日期维度-按周one_make_dws.dim_date
    dws_month string日期维度-按月one_make_dws.dim_date
    oil_type string油站类型one_make_dws.dim_oilstation
    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_trvl_exp:差旅事务事实表
          select
              biz_trip_money,--外出差旅费用
              in_city_traffic_money,--市内交通费用
              hotel_money,--住宿费用
              fars_money,--车船费用
              subsidy_money,--补助费用
              road_toll_money,--过桥过路费用
              oil_money,--油费
              secondary_money,--二单补助费用总计
              third_money, --三单补助费用总计
              actual_total_money,--费用报销总计
              ss_id,--服务网点id
              srv_user_id,--工程师id
              dt --日期
          from fact_trvl_exp;
          
          
          • fact_regular_exp:报销事务事实表
          select
              ss_id,--服务网点id
              srv_user_id,--工程师id
              exp_item_name --费用项目名称
          from fact_regular_exp;
          
          
          • fact_srv_install:安装事务事实表
          select
              ss_id,--服务网点id
              exp_device_money,--安装费用
              os_id --油站id
          from fact_srv_install;
          
          
        • 维度表

          • 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;
          
          
  • 小结

    • 掌握费用主题的需求分析

15:服务域:费用主题实现

  • 目标实现费用主题表的维度指标构建
  • 实施

img
img
img

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

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

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

tvNeaeQB-1714755010502)]
[外链图片转存中…(img-Z7EadV8m-1714755010502)]
[外链图片转存中…(img-rdqXeOY9-1714755010503)]

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

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

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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值