需求分析:
某公司是做零售相关业务,旗下出品各类收银机.
目前公司的收银机已经在全国铺开,在各个省份均有店铺使用.机器是联网的,每一次使用都会将售卖商品数据上传到公司后台.老板现在想对省份维度的销售情况进行统计分析
逻辑需求:
1.各省销售指标每个省份的销售额统计
2.TOP3销售省份中,有多少家店铺日均销售额1000+
3.TOP3省份中各个省份的平均单价
4.TOP3省份中,各个省份的支付类型比例
操作需求:
1.将需求结果写出到mysql
2.将数据写入到Spark On Hive中
数据来源:mini.json -------mini.json数据源下载:
{"discountRate": 1, "dayOrderSeq": 8, "storeDistrict": "雨花区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "113.01567856440359", "discount": 0, "storeID": 4064, "productCount": 4, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "alipay", "discountType": 2, "storeName": "杨光峰南食店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1563758583000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "百事可乐可乐型汽水", "unitID": 0, "barcode": "6940159410029", "pricePer": 3, "retailPrice": 3, "tradePrice": 0, "categoryID": 1}, {"count": 1, "name": "馋大嘴盐焗鸡筋110g", "unitID": 0, "barcode": "6951027300076", "pricePer": 2.5, "retailPrice": 2.5, "tradePrice": 0, "categoryID": 1}, {"count": 2, "name": "糯米锅巴", "unitID": 0, "barcode": "6970362690000", "pricePer": 2.5, "retailPrice": 2.5, "tradePrice": 0, "categoryID": 1}, {"count": 1, "name": "南京包装", "unitID": 0, "barcode": "6901028300056", "pricePer": 12, "retailPrice": 12, "tradePrice": 0, "categoryID": 1}], "storeGPSAddress": "", "orderID": "156375858240940641230", "moneyBeforeWholeDiscount": 22.5, "storeCategory": "normal", "receivable": 22.5, "faceID": "", "storeOwnUserId": 4082, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 22.5, "payedTotal": 22.5, "storeGPSLatitude": "28.121213726311993", "storeCreateDateTS": 1557733046000, "payStatus": -1, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "277551253310005", "dayOrderSeq": 6, "storeDistrict": "岳麓区", "isSigned": 1, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "112.95106", "discount": 0, "storeID": 718, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "alipay", "discountType": 2, "storeName": "芙蓉兴盛汶强食品店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1546737450000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "白沙", "unitID": 8, "barcode": "6901028191012", "pricePer": 7, "retailPrice": 7, "tradePrice": 0, "categoryID": 21}], "storeGPSAddress": "None", "orderID": "15467374316307186813", "moneyBeforeWholeDiscount": 7, "storeCategory": "normal", "receivable": 7, "faceID": "", "storeOwnUserId": 577, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 7, "payedTotal": 7, "storeGPSLatitude": "28.158909", "storeCreateDateTS": 1534920455000, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "None", "dayOrderSeq": 26, "storeDistrict": "芙蓉区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "113.03312", "discount": 0, "storeID": 1786, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "cash", "discountType": 2, "storeName": "裕丰超市", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1546478081000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "双喜经典包装", "unitID": 8, "barcode": "6901028000826", "pricePer": 10, "retailPrice": 10, "tradePrice": 8.58, "categoryID": 21}], "storeGPSAddress": "None", "orderID": "154647808086017867144", "moneyBeforeWholeDiscount": 10, "storeCategory": "normal", "receivable": 10, "faceID": "", "storeOwnUserId": 1714, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 10, "payedTotal": 10, "storeGPSLatitude": "28.198982", "storeCreateDateTS": 1540802164000, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 144, "storeDistrict": "龙华区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "", "discount": 0, "storeID": 3702, "productCount": 2, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "wechat", "discountType": 2, "storeName": "天福便利店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1559133703000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "自然食用盐250g", "unitID": 8, "barcode": "6970855690265", "pricePer": 2, "retailPrice": 2, "tradePrice": 0, "categoryID": 2}, {"count": 1, "name": "吉祥好日子", "unitID": 4, "barcode": "6901028942843", "pricePer": 8.5, "retailPrice": 8.5, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "155913370213437026067", "moneyBeforeWholeDiscount": 10.5, "storeCategory": "normal", "receivable": 10.5, "faceID": "", "storeOwnUserId": 3692, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 10.5, "payedTotal": 10.5, "storeGPSLatitude": "", "storeCreateDateTS": 1552977317000, "payStatus": -1, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "None", "dayOrderSeq": 57, "storeDistrict": "象山区", "isSigned": 0, "storeProvince": "广西壮族自治区", "origin": 0, "storeGPSLongitude": "110.28186410665509", "discount": 0, "storeID": 1156, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "cash", "discountType": 2, "storeName": "吉顺食品自选商店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1548594458000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "中南海8包装", "unitID": 8, "barcode": "6901028010108", "pricePer": 10, "retailPrice": 10, "tradePrice": 8.8, "categoryID": 21}], "storeGPSAddress": "None", "orderID": "154859445786811565860", "moneyBeforeWholeDiscount": 10, "storeCategory": "normal", "receivable": 10, "faceID": "", "storeOwnUserId": 1040, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 10, "payedTotal": 10, "storeGPSLatitude": "25.248390759610427", "storeCreateDateTS": 1537601490000, "storeCity": "桂林市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "277585253310024", "dayOrderSeq": 36, "storeDistrict": "香洲区", "isSigned": 1, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "113.51813376850318", "discount": 0, "storeID": 318, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "wechat", "discountType": 2, "storeName": "芙蓉兴盛3626", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1548292824000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "进口维他奶原味250ml", "unitID": 3, "barcode": "4891028164395", "pricePer": 3, "retailPrice": 3, "tradePrice": 2, "categoryID": 1}], "storeGPSAddress": "None", "orderID": "15482928201153183933", "moneyBeforeWholeDiscount": 3, "storeCategory": "normal", "receivable": 3, "faceID": "", "storeOwnUserId": 229, "paymentChannel": 1, "paymentScenarios": "PURC", "storeAddress": "StoreAddress", "totalNoDiscount": 3, "payedTotal": 3, "storeGPSLatitude": "22.274088374908985", "storeCreateDateTS": 1518114308000, "storeCity": "珠海市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "None", "dayOrderSeq": 12, "storeDistrict": "芙蓉区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "113.01619246602056", "discount": 0, "storeID": 1699, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "cash", "discountType": 2, "storeName": "亿户便利海欣食品店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1545356344000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "白沙包装", "unitID": 8, "barcode": "6901028191012", "pricePer": 6.5, "retailPrice": 6.5, "tradePrice": 3.81, "categoryID": 1}], "storeGPSAddress": "None", "orderID": "154535634370716996481", "moneyBeforeWholeDiscount": 6.5, "storeCategory": "normal", "receivable": 6.5, "faceID": "", "storeOwnUserId": 1620, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 6.5, "payedTotal": 6.5, "storeGPSLatitude": "28.214493749156052", "storeCreateDateTS": 1540530941000, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "None", "dayOrderSeq": 111, "storeDistrict": "武陵区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "111.68978109955786", "discount": 0, "storeID": 1167, "productCount": 2, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "alipay", "discountType": 2, "storeName": "芙蓉兴盛子轩商行", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1547284514000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "无码商品", "unitID": 0, "barcode": "99999999-1", "pricePer": 2, "retailPrice": 2, "tradePrice": 0, "categoryID": 1}, {"count": 1, "name": "15元叼嘴巴食用槟榔", "unitID": 8, "barcode": "6958214656787", "pricePer": 15, "retailPrice": 15, "tradePrice": 12, "categoryID": 1}], "storeGPSAddress": "None", "orderID": "154728450254711678227", "moneyBeforeWholeDiscount": 17, "storeCategory": "normal", "receivable": 17, "faceID": "", "storeOwnUserId": 1051, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 17, "payedTotal": 17, "storeGPSLatitude": "29.05939118356865", "storeCreateDateTS": 1537621831000, "storeCity": "常德市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 10, "storeDistrict": "开福区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "112.99777", "discount": 0, "storeID": 3466, "productCount": 2, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "芙蓉兴盛蔡兰食品店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1563845059000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "小洋人妙恋大果粒原味420ml", "unitID": 0, "barcode": "6932452818091", "pricePer": 5, "retailPrice": 5, "tradePrice": 0, "categoryID": 1}, {"count": 1, "name": "利群版包装", "unitID": 8, "barcode": "6901028118170", "pricePer": 14, "retailPrice": 14, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "156384505862634667509", "moneyBeforeWholeDiscount": 19, "storeCategory": "normal", "receivable": 19, "faceID": "", "storeOwnUserId": 3434, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 19, "payedTotal": 19, "storeGPSLatitude": "28.340324", "storeCreateDateTS": 1547892928000, "payStatus": -1, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "227585253310046", "dayOrderSeq": 337, "storeDistrict": "香洲区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "113.55951672652247", "discount": 0, "storeID": 333, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hft", "serverSaved": true, "payType": "wechat", "discountType": 2, "storeName": "3A福利社", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1557231358000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "福隆红油鸡90g", "unitID": 8, "barcode": "6936455900067", "pricePer": 4, "retailPrice": 4, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "15572313547723331851", "moneyBeforeWholeDiscount": 4, "storeCategory": "normal", "receivable": 4, "faceID": "", "storeOwnUserId": 235, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 4, "payedTotal": 4, "storeGPSLatitude": "22.280635051859548", "storeCreateDateTS": 1520206281000, "storeCity": "珠海市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 47, "storeDistrict": "岳麓区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "112.9422938816664", "discount": 0, "storeID": 3354, "productCount": 2, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "雅堂小超龙凌云食品店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1560692925000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "白沙品包装", "unitID": 8, "barcode": "6901028191043", "pricePer": 10, "retailPrice": 10, "tradePrice": 0, "categoryID": 2}, {"count": 1, "name": "双喜经典包装", "unitID": 8, "barcode": "6901028000642", "pricePer": 12, "retailPrice": 12, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "156069292447933547332", "moneyBeforeWholeDiscount": 22, "storeCategory": "normal", "receivable": 22, "faceID": "", "storeOwnUserId": 3324, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 22, "payedTotal": 22, "storeGPSLatitude": "28.14020117156302", "storeCreateDateTS": 1546940546000, "payStatus": -1, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "None", "dayOrderSeq": 3, "storeDistrict": "龙华区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "113.99223893880843", "discount": 0, "storeID": 3367, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "cash", "discountType": 2, "storeName": "58优品便利店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1552019799000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "无码商品", "unitID": 0, "barcode": "99999999-1", "pricePer": 19, "retailPrice": 19, "tradePrice": 0, "categoryID": 1}], "storeGPSAddress": "None", "orderID": "155201979900933677797", "moneyBeforeWholeDiscount": 19, "storeCategory": "normal", "receivable": 19, "faceID": "", "storeOwnUserId": 3337, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 19, "payedTotal": 19, "storeGPSLatitude": "22.68867017558772", "storeCreateDateTS": 1547023238000, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 20, "storeDistrict": "石峰区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "113.0943855643273", "discount": 0, "storeID": 832, "productCount": 4, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "wechat", "discountType": 2, "storeName": "四季春商店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1563413959000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "百事可乐可乐型汽水", "unitID": 2, "barcode": "6940159410029", "pricePer": 3, "retailPrice": 3, "tradePrice": 0, "categoryID": 2}, {"count": 1, "name": "白沙精品三代包装", "unitID": 8, "barcode": "6901028192729", "pricePer": 15, "retailPrice": 15, "tradePrice": 0, "categoryID": 2}, {"count": 1, "name": "张新发槟榔35g20元的", "unitID": 8, "barcode": "6925909980151", "pricePer": 17, "retailPrice": 17, "tradePrice": 0, "categoryID": 2}, {"count": 1, "name": "娇子阳光包装", "unitID": 8, "barcode": "6901028084314", "pricePer": 10, "retailPrice": 10, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "15634139565318326739", "moneyBeforeWholeDiscount": 45, "storeCategory": "normal", "receivable": 45, "faceID": "", "storeOwnUserId": 690, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 45, "payedTotal": 45, "storeGPSLatitude": "27.88922284307604", "storeCreateDateTS": 1535856054000, "payStatus": -1, "storeCity": "株洲市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "277551753310007", "dayOrderSeq": 46, "storeDistrict": "开福区", "isSigned": 1, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "112.97533", "discount": 0, "storeID": 949, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "天猫小超(英桥便利店)", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1565683992000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "星球筒", "unitID": 0, "barcode": "6926617930049", "pricePer": 6, "retailPrice": 6, "tradePrice": 0, "categoryID": 1}], "storeGPSAddress": "", "orderID": "15656839914979495195", "moneyBeforeWholeDiscount": 6, "storeCategory": "normal", "receivable": 6, "faceID": "", "storeOwnUserId": 809, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 6, "payedTotal": 6, "storeGPSLatitude": "28.211737", "storeCreateDateTS": 1536655716000, "payStatus": -1, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": -1, "storeShopNo": "277584553310040", "dayOrderSeq": 200, "storeDistrict": "宝安区", "isSigned": 1, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "114.014565", "discount": 1.5, "storeID": 4213, "productCount": 2, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 4, "storeName": "云兜便利店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1561301033000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 3, "name": "红牛维生素功能饮料", "unitID": 0, "barcode": "6920202888883", "pricePer": 6, "retailPrice": 6, "tradePrice": 0, "categoryID": 1}, {"count": 1, "name": "优益C活菌型乳酸菌饮品原味340ml", "unitID": 0, "barcode": "6934665087653", "pricePer": 6, "retailPrice": 6, "tradePrice": 0, "categoryID": 1}], "storeGPSAddress": "", "orderID": "156130102845742139251", "moneyBeforeWholeDiscount": 24, "storeCategory": "normal", "receivable": 22.5, "faceID": "", "storeOwnUserId": 4250, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 24, "payedTotal": 22.5, "storeGPSLatitude": "22.630766", "storeCreateDateTS": 1558930437000, "payStatus": -1, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 209, "storeDistrict": "龙华区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "114.03267357993454", "discount": 0, "storeID": 3487, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "友淇便利店(富联店)", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1563104184000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "炫迈水蜜西瓜味无糖口香糖", "unitID": 0, "barcode": "6954432710249", "pricePer": 6, "retailPrice": 6, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "156310418355034879683", "moneyBeforeWholeDiscount": 6, "storeCategory": "normal", "receivable": 6, "faceID": "", "storeOwnUserId": 3456, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 6, "payedTotal": 6, "storeGPSLatitude": "22.669731307672212", "storeCreateDateTS": 1548392420000, "payStatus": -1, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 1, "storeDistrict": "天心区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "", "discount": 0, "storeID": 2583, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "保富烟酒店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1557558714000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 2, "name": "中华条装", "unitID": 10, "barcode": "6901028075015", "pricePer": 450, "retailPrice": 450, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "155755871335925837481", "moneyBeforeWholeDiscount": 900, "storeCategory": "normal", "receivable": 900, "faceID": "", "storeOwnUserId": 2534, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 900, "payedTotal": 900, "storeGPSLatitude": "", "storeCreateDateTS": 1542779631000, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 92, "storeDistrict": "福田区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "", "discount": 0, "storeID": 3561, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "cash", "discountType": 2, "storeName": "新安喜乐惠(友捷)", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1552703028000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "玉溪条装", "unitID": 0, "barcode": "6901028316866", "pricePer": 215, "retailPrice": 215, "tradePrice": 0, "categoryID": 1}], "storeGPSAddress": "", "orderID": "155270302815435615521", "moneyBeforeWholeDiscount": 215, "storeCategory": "normal", "receivable": 215, "faceID": "", "storeOwnUserId": 3541, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 215, "payedTotal": 215, "storeGPSLatitude": "", "storeCreateDateTS": 1551762981000, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 15, "storeDistrict": "芙蓉区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "113.03765", "discount": 0, "storeID": 1975, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "鼎亨烟酒", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1560845929000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "食用槟榔运当头8g", "unitID": 8, "barcode": "6931273213559", "pricePer": 15, "retailPrice": 15, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "156084592836019756928", "moneyBeforeWholeDiscount": 15, "storeCategory": "normal", "receivable": 15, "faceID": "", "storeOwnUserId": 1913, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 15, "payedTotal": 15, "storeGPSLatitude": "28.201408", "storeCreateDateTS": 1541145961000, "payStatus": -1, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "277585253310012", "dayOrderSeq": 283, "storeDistrict": "香洲区", "isSigned": 1, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "113.53829251118407", "discount": 0, "storeID": 389, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "cash", "discountType": 2, "storeName": "日日佳超市", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1542464496000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 4, "name": "冰蓝薄荷万宝路", "unitID": 8, "barcode": "7622100916345", "pricePer": 18, "retailPrice": 18, "tradePrice": 16.2, "categoryID": 1}], "storeGPSAddress": "None", "orderID": "15424644956013899408", "moneyBeforeWholeDiscount": 72, "storeCategory": "normal", "receivable": 72, "faceID": "", "storeOwnUserId": 285, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 72, "payedTotal": 72, "storeGPSLatitude": "22.219455067668832", "storeCreateDateTS": 1522260134000, "storeCity": "珠海市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "None", "dayOrderSeq": 6, "storeDistrict": "斗门区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "None", "discount": 0, "storeID": 528, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "wechat", "discountType": 2, "storeName": "日兴旺商店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1551943482000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "硬白沙(单盒)", "unitID": 0, "barcode": "6901028191029", "pricePer": 6, "retailPrice": 6, "tradePrice": 0, "categoryID": 1}], "storeGPSAddress": "None", "orderID": "15519434816425281813", "moneyBeforeWholeDiscount": 6, "storeCategory": "normal", "receivable": 6, "faceID": "", "storeOwnUserId": 378, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 6, "payedTotal": 6, "storeGPSLatitude": "None", "storeCreateDateTS": 1525635891000, "storeCity": "珠海市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 2, "storeDistrict": "坪山区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "114.34535", "discount": 0, "storeID": 3848, "productCount": 3, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "wechat", "discountType": 2, "storeName": "福家百货", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1560617096000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 8, "name": "盐焗鱼棒", "unitID": 3, "barcode": "6933213200933", "pricePer": 1, "retailPrice": 1, "tradePrice": 0, "categoryID": 2}, {"count": 2, "name": "硬云烟", "unitID": 0, "barcode": "6901028046886", "pricePer": 11, "retailPrice": 11, "tradePrice": 0, "categoryID": 1}, {"count": 4, "name": "9度珠江0度精品啤酒600ml", "unitID": 2, "barcode": "6970644591117", "pricePer": 4, "retailPrice": 4, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "156061709472738486267", "moneyBeforeWholeDiscount": 46, "storeCategory": "normal", "receivable": 46, "faceID": "", "storeOwnUserId": 3846, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 46, "payedTotal": 46, "storeGPSLatitude": "22.694502", "storeCreateDateTS": 1554968575000, "payStatus": -1, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "None", "dayOrderSeq": 360, "storeDistrict": "岳麓区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "112.91247278451918", "discount": 0, "storeID": 2541, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "wechat", "discountType": 2, "storeName": "芙蓉兴盛兢业商店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1551441739000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "吉列威锋剃须刀架", "unitID": 9, "barcode": "6900068900035", "pricePer": 10, "retailPrice": 10, "tradePrice": 7.9, "categoryID": 8}], "storeGPSAddress": "None", "orderID": "155144173636925411265", "moneyBeforeWholeDiscount": 10, "storeCategory": "normal", "receivable": 10, "faceID": "", "storeOwnUserId": 2491, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 10, "payedTotal": 10, "storeGPSLatitude": "28.21208175040942", "storeCreateDateTS": 1542692669000, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "277584253310011", "dayOrderSeq": 285, "storeDistrict": "龙华区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "114.03908", "discount": 0, "storeID": 3981, "productCount": 2, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "wechat", "discountType": 2, "storeName": "阿里之门(共和新村)", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1558796138000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "南街村北京干吃便面65g", "unitID": 0, "barcode": "6904417011274", "pricePer": 1, "retailPrice": 1, "tradePrice": 0, "categoryID": 1}, {"count": 1, "name": "红塔山经典包装", "unitID": 0, "barcode": "6901028314978", "pricePer": 8, "retailPrice": 8, "tradePrice": 0, "categoryID": 1}], "storeGPSAddress": "", "orderID": "155879613075539818016", "moneyBeforeWholeDiscount": 9, "storeCategory": "normal", "receivable": 9, "faceID": "", "storeOwnUserId": 3994, "paymentChannel": 1, "paymentScenarios": "PURC", "storeAddress": "StoreAddress", "totalNoDiscount": 9, "payedTotal": 9, "storeGPSLatitude": "22.652893", "storeCreateDateTS": 1557041947000, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 555, "storeDistrict": "南山区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "113.99646351072916", "discount": 0, "storeID": 3921, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "每易分便利店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1561902475000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 2, "name": "N哈尔滨冰纯啤酒", "unitID": 0, "barcode": "6948960100221", "pricePer": 5.5, "retailPrice": 5.5, "tradePrice": 0, "categoryID": 1}], "storeGPSAddress": "", "orderID": "156190247503339219232", "moneyBeforeWholeDiscount": 11, "storeCategory": "normal", "receivable": 11, "faceID": "", "storeOwnUserId": 3928, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 11, "payedTotal": 11, "storeGPSLatitude": "22.585739888612377", "storeCreateDateTS": 1555918632000, "payStatus": -1, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 36, "storeDistrict": "宝安区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "113.79651", "discount": 0, "storeID": 4187, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "wechat", "discountType": 2, "storeName": "真心美百货", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1562584535000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "双喜精品好日子包装", "unitID": 0, "barcode": "6901028942898", "pricePer": 11, "retailPrice": 11, "tradePrice": 0, "categoryID": 1}], "storeGPSAddress": "", "orderID": "156258453426641873476", "moneyBeforeWholeDiscount": 11, "storeCategory": "normal", "receivable": 11, "faceID": "", "storeOwnUserId": 4224, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 11, "payedTotal": 11, "storeGPSLatitude": "22.727442", "storeCreateDateTS": 1558750396000, "payStatus": -1, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 21, "storeDistrict": "天心区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "", "discount": 0, "storeID": 2484, "productCount": 2, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "wechat", "discountType": 2, "storeName": "芙蓉兴盛桢红便利店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1554514709000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "张新发木糖醇20元槟榔", "unitID": 4, "barcode": "6925909980342", "pricePer": 18, "retailPrice": 18, "tradePrice": 0, "categoryID": 2}, {"count": 1, "name": "小郎酒100ml4", "unitID": 2, "barcode": "6901683821255", "pricePer": 12, "retailPrice": 12, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "155451470752024843308", "moneyBeforeWholeDiscount": 30, "storeCategory": "normal", "receivable": 30, "faceID": "", "storeOwnUserId": 2431, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 30, "payedTotal": 30, "storeGPSLatitude": "", "storeCreateDateTS": 1542598441000, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "277584553310011", "dayOrderSeq": 56, "storeDistrict": "龙华区", "isSigned": 1, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "114.00903", "discount": 0, "storeID": 3108, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "喜洋洋便利店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1566007335000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "红双喜上海包装", "unitID": 8, "barcode": "6901028018425", "pricePer": 11, "retailPrice": 11, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "156600733456431083481", "moneyBeforeWholeDiscount": 11, "storeCategory": "normal", "receivable": 11, "faceID": "", "storeOwnUserId": 3080, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 11, "payedTotal": 11, "storeGPSLatitude": "22.68606", "storeCreateDateTS": 1544672005000, "payStatus": -1, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 43, "storeDistrict": "南山区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "113.939705", "discount": 0, "storeID": 3722, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "顺百旺商店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1563710919000, "smallChange": 15, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "红双喜条装", "unitID": 0, "barcode": "6901028075084", "pricePer": 85, "retailPrice": 85, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "156371091810237225374", "moneyBeforeWholeDiscount": 85, "storeCategory": "normal", "receivable": 85, "faceID": "", "storeOwnUserId": 3709, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 85, "payedTotal": 100, "storeGPSLatitude": "22.621307", "storeCreateDateTS": 1553073703000, "payStatus": -1, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "277552953310010", "dayOrderSeq": 13, "storeDistrict": "天元区", "isSigned": 1, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "undefined", "discount": 0, "storeID": 793, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "cash", "discountType": 2, "storeName": "天元区汇惠佳商行", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1546571056000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "白沙包装", "unitID": 8, "barcode": "6901028191012", "pricePer": 4.5, "retailPrice": 4.5, "tradePrice": 3.81, "categoryID": 1}], "storeGPSAddress": "None", "orderID": "15465710556637938315", "moneyBeforeWholeDiscount": 4.5, "storeCategory": "normal", "receivable": 4.5, "faceID": "", "storeOwnUserId": 650, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 4.5, "payedTotal": 4.5, "storeGPSLatitude": "undefined", "storeCreateDateTS": 1535530065000, "storeCity": "株洲市", "memberID": "0"}
{"discountRate": -1, "storeShopNo": "None", "dayOrderSeq": 17, "storeDistrict": "宝安区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "undefined", "discount": 31.5, "storeID": 2146, "productCount": 2, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "cash", "discountType": 1, "storeName": "旺竹商行", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1544420438000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "双喜(硬经典)【条装】", "unitID": 4, "barcode": "6901028000659", "pricePer": 120, "retailPrice": 120, "tradePrice": 100.17, "categoryID": 21}, {"count": 1, "name": "双喜软经典条装", "unitID": 4, "barcode": "6901028000833", "pricePer": 110, "retailPrice": 110, "tradePrice": 85.86, "categoryID": 21}], "storeGPSAddress": "None", "orderID": "154442043410321468951", "moneyBeforeWholeDiscount": 198.5, "storeCategory": "normal", "receivable": 198.5, "faceID": "", "storeOwnUserId": 2093, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 230, "payedTotal": 198.5, "storeGPSLatitude": "undefined", "storeCreateDateTS": 1541659036000, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 58, "storeDistrict": "宝安区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "113.85742434240024", "discount": 0, "storeID": 3810, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "快乐购便利店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1565941171000, "smallChange": 16, "storeGPSName": "", "erase": 0, "product": [{"count": 2, "name": "中怡宝", "unitID": 4, "barcode": "33", "pricePer": 2, "retailPrice": 2, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "156594117071738108450", "moneyBeforeWholeDiscount": 4, "storeCategory": "normal", "receivable": 4, "faceID": "", "storeOwnUserId": 3806, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 4, "payedTotal": 20, "storeGPSLatitude": "22.706607254239632", "storeCreateDateTS": 1554275574000, "payStatus": -1, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 15, "storeDistrict": "宝安区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "113.84907", "discount": 0, "storeID": 3812, "productCount": 3, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "诚信达便利店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1557505263000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "无码商品", "unitID": 0, "barcode": "99999999-1", "pricePer": 12, "retailPrice": 12, "tradePrice": 0, "categoryID": 1}, {"count": 1, "name": "康师傅茉莉清茶", "unitID": 0, "barcode": "6921294398434", "pricePer": 3, "retailPrice": 3, "tradePrice": 0, "categoryID": 1}, {"count": 2, "name": "大瓶东鹏", "unitID": 0, "barcode": "6934502301850", "pricePer": 5, "retailPrice": 5, "tradePrice": 0, "categoryID": 1}], "storeGPSAddress": "", "orderID": "155750526255838124039", "moneyBeforeWholeDiscount": 25, "storeCategory": "normal", "receivable": 25, "faceID": "", "storeOwnUserId": 3808, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 25, "payedTotal": 25, "storeGPSLatitude": "22.609636", "storeCreateDateTS": 1554353157000, "storeCity": "深圳市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 47, "storeDistrict": "雨花区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "113.00244882702829", "discount": 0, "storeID": 2071, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "wechat", "discountType": 2, "storeName": "紫荆卷烟零售店庆誉园南食店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1564998316000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "白沙软包装", "unitID": 4, "barcode": "6901028191012", "pricePer": 7, "retailPrice": 7, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "156499831475020713883", "moneyBeforeWholeDiscount": 7, "storeCategory": "normal", "receivable": 7, "faceID": "", "storeOwnUserId": 2013, "paymentChannel": 0, "paymentScenarios": "PASV", "storeAddress": "StoreAddress", "totalNoDiscount": 7, "payedTotal": 7, "storeGPSLatitude": "28.184128846471438", "storeCreateDateTS": 1541492605000, "payStatus": -1, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "277617253310001", "dayOrderSeq": 89, "storeDistrict": "秀峰区", "isSigned": 1, "storeProvince": "广西壮族自治区", "origin": 0, "storeGPSLongitude": "110.26522502303122", "discount": 0, "storeID": 1260, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "cash", "discountType": 2, "storeName": "黄玲丽烟酒店", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1553349153000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "双喜包装", "unitID": 8, "barcode": "6901028001489", "pricePer": 6.5, "retailPrice": 6.5, "tradePrice": 0, "categoryID": 2}], "storeGPSAddress": "", "orderID": "155334915334912606819", "moneyBeforeWholeDiscount": 6.5, "storeCategory": "normal", "receivable": 6.5, "faceID": "", "storeOwnUserId": 1142, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 6.5, "payedTotal": 6.5, "storeGPSLatitude": "25.26454421886171", "storeCreateDateTS": 1537933327000, "storeCity": "桂林市", "memberID": "0"}
{"discountRate": 1, "dayOrderSeq": 50, "storeDistrict": "芙蓉区", "isSigned": 0, "storeProvince": "湖南省", "origin": 0, "storeGPSLongitude": "113.0332370325186", "discount": 0, "storeID": 2658, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "corporator": "hnzy", "serverSaved": true, "payType": "cash", "discountType": 2, "storeName": "蔚然锦和厚千批发", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1558531377000, "smallChange": 0, "storeGPSName": "", "erase": 0, "product": [{"count": 1, "name": "油炸休闲小食品味油炸糕点", "unitID": 0, "barcode": "6921527220525", "pricePer": 2, "retailPrice": 2, "tradePrice": 0, "categoryID": 1}], "storeGPSAddress": "", "orderID": "155853137686226583820", "moneyBeforeWholeDiscount": 2, "storeCategory": "normal", "receivable": 2, "faceID": "", "storeOwnUserId": 2612, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 2, "payedTotal": 2, "storeGPSLatitude": "28.19972922323995", "storeCreateDateTS": 1542950224000, "storeCity": "长沙市", "memberID": "0"}
{"discountRate": 1, "storeShopNo": "None", "dayOrderSeq": 13, "storeDistrict": "斗门区", "isSigned": 0, "storeProvince": "广东省", "origin": 0, "storeGPSLongitude": "113.27462", "discount": 0, "storeID": 1286, "productCount": 1, "operatorName": "OperatorName", "operator": "NameStr", "storeStatus": "open", "storeOwnUserTel": 12345678910, "payType": "cash", "discountType": 2, "storeName": "丰辉超市", "storeOwnUserName": "OwnUserNameStr", "dateTS": 1546442282000, "smallChange": 0, "storeGPSName": "None", "erase": 0, "product": [{"count": 1, "name": "统一阿萨姆原味奶茶500ml", "unitID": 2, "barcode": "6925303730574", "pricePer": 4, "retailPrice": 4, "tradePrice": 3, "categoryID": 1}], "storeGPSAddress": "None", "orderID": "154644228136112861470", "moneyBeforeWholeDiscount": 4, "storeCategory": "normal", "receivable": 4, "faceID": "", "storeOwnUserId": 1168, "paymentChannel": 0, "paymentScenarios": "OTHER", "storeAddress": "StoreAddress", "totalNoDiscount": 4, "payedTotal": 4, "storeGPSLatitude": "22.173456", "storeCreateDateTS": 1537952224000, "storeCity": "珠海市", "memberID": "0"}
代码:存入数据库和写入hive操作一样;
#coding:utf-8
from pyspark.sql import SparkSession
from pyspark.sql import functions as F
from pyspark.storagelevel import StorageLevel
from pyspark.sql.types import StringType
"""
需求1.各省销售指标每个省份的销售额统计
需求2.TOP3销售省份中,有多少家店铺日均销售额1000+
需求3.TOP3省份中各个省份的平均单单价
需求4.TOP3省份中,各个省份的支付类型比例
receivable:订单金额
storeprovince:店铺省份
dateType:支付类型
storeID:店铺ID
"""
if __name__ == '__main__':
spark = SparkSession.builder. \
appName("SparkSQL Example"). \
master("local[*]"). \
config("spark.sql.shuffle.partitions", "2"). \
config("spark.sql.warehouse.dir", "hdfs://192.168.88.161:8020/user/hive/warehouse"). \
config("hive.metastore.uris", "thrift://192.168.88.161:9083").\
enableHiveSupport(). \
getOrCreate()
#1.读取数据
#省份信息,缺失值过滤,null值过滤
#订单金额单笔超过10000异常数据过滤
#列值裁剪,将不需要的属性删除
df =spark.read.format("json").load("../../data/input/mini.json"). \
dropna(thresh=1, subset=['storeProvince']). \
filter("storeProvince != 'null'"). \
filter("receivable < 10000"). \
select("storeProvince", "storeID", "receivable", "dateTS", "payType")
# TODO 需求1: 各省 销售额统计
province_sale_df = df.groupBy("storeProvince").sum("receivable"). \
withColumnRenamed("sum(receivable)", "money"). \
withColumn("money", F.round("money", 2)). \
orderBy("money", ascending=False)
# province_sale_df.show(truncate=False)
# TODO 需求一写出到本地Mysql数据库
try:
province_sale_df.write.mode("overwrite"). \
format("jdbc"). \
option("driver", "com.mysql.jdbc.Driver"). \
option("url", "jdbc:mysql://192.168.88.161:3306/bigdata?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf8"). \
option("dbtable", "province_sale"). \
option("user", "root"). \
option("password", "123456"). \
option("encoding", "utf-8"). \
save()
except Exception as e:
print("-----数据加载失败,错误异常信息:", e)
# TODO 写出Hive表 saveAsTable 可以写出表 要求已经配置好Spark On Hive, 配置好后会将表写入到Hive的数据仓库中
province_sale_df.write.mode("overwrite").saveAsTable("default.province_sale", "parquet")
#TODO 需求2:TOP3销售省份中,有多少家店铺日均销售额1000+
#现过滤top3
top3_province_df=province_sale_df.limit(3).select("storeProvince").withColumnRenamed("storeProvince", "top3_province")
# 2.2 和 原始的DF进行内关联, 数据关联后, 就是全部都是TOP3省份的销售数据了
top3_province_df_joined = df.join(top3_province_df, on = df['storeProvince'] == top3_province_df['top3_province'])
top3_province_df_joined.persist(StorageLevel.MEMORY_AND_DISK)
# from_unixtime时间戳的转换的精度是秒级, 数据的精度是毫秒级, 要对数据进行精度的裁剪
province_hot_store_count_df = top3_province_df_joined.groupBy("storeProvince", "storeID",
F.from_unixtime(df['dateTS'].substr(0, 10),
"yyyy-MM-dd").alias("day")). \
sum("receivable").withColumnRenamed("sum(receivable)", "money"). \
filter("money > 1000"). \
dropDuplicates(subset=["storeID"]). \
groupBy("storeProvince").count()
# TODO 需求二写出到本地Mysql数据库
try:
province_hot_store_count_df.write.mode("overwrite"). \
format("jdbc"). \
option("driver", "com.mysql.jdbc.Driver"). \
option("url", "jdbc:mysql://192.168.88.161:3306/bigdata?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf8"). \
option("dbtable", "province_hot_store_count"). \
option("user", "root"). \
option("password", "123456"). \
option("encoding", "utf-8"). \
save()
except Exception as e:
print("-----数据加载失败,错误异常信息:", e)
# TODO 写出Hive表 saveAsTable 可以写出表 要求已经配置好Spark On Hive, 配置好后会将表写入到Hive的数据仓库中
province_hot_store_count_df.write.mode("overwrite").saveAsTable("province_hot_store_count", "parquet")
# TODO 需求3: TOP3 省份中 各个省份的平均订单价格(单价)
top3_province_order_avg_df = top3_province_df_joined.groupBy("storeProvince"). \
avg("receivable"). \
withColumnRenamed("avg(receivable)", "money"). \
withColumn("money", F.round("money", 2)). \
orderBy("money", ascending=False)
# TODO 需求三写出到本地Mysql数据库
try:
top3_province_order_avg_df.write.mode("overwrite"). \
format("jdbc"). \
option("driver", "com.mysql.jdbc.Driver"). \
option("url",
"jdbc:mysql://192.168.88.161:3306/bigdata?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf8"). \
option("dbtable", "top3_province_order_avg"). \
option("user", "root"). \
option("password", "123456"). \
option("encoding", "utf-8"). \
save()
except Exception as e:
print("-----数据加载失败,错误异常信息:", e)
# TODO 写出Hive表 saveAsTable 可以写出表 要求已经配置好Spark On Hive, 配置好后会将表写入到Hive的数据仓库中
top3_province_order_avg_df.write.mode("overwrite").saveAsTable("top3_province_order_avg", "parquet")
# TODO 需求4: TOP3 省份中, 各个省份的支付比例
#窗口函数,可以用sql语句
top3_province_df_joined.createTempView("province_pay")
def udf_func(percent):
return str(round(percent * 100, 2)) + "%"
# 注册UDF
my_udf = F.udf(udf_func, StringType())
#可读性较差,大概是从一个表中抽取另一个表
pay_type_df = spark.sql("""
SELECT storeProvince, payType, (COUNT(payType) / total) AS percent FROM
(SELECT storeProvince, payType, count(1) OVER(PARTITION BY storeProvince) AS total FROM province_pay) AS sub
GROUP BY storeProvince, payType, total
""").withColumn("percent", my_udf("percent"))
# TODO 需求四写出到本地Mysql数据库
try:
pay_type_df.write.mode("overwrite"). \
format("jdbc"). \
option("driver", "com.mysql.jdbc.Driver"). \
option("url",
"jdbc:mysql://192.168.88.161:3306/bigdata?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf8"). \
option("dbtable", "pay_type_df"). \
option("user", "root"). \
option("password", "123456"). \
option("encoding", "utf-8"). \
save()
except Exception as e:
print("-----数据加载失败,错误异常信息:", e)
# TODO 写出Hive表 saveAsTable 可以写出表 要求已经配置好Spark On Hive, 配置好后会将表写入到Hive的数据仓库中
pay_type_df.write.mode("overwrite").saveAsTable("pay_type_df", "parquet")
top3_province_df_joined.unpersist()
运行结果:
MySQL:
hive:
可能遇到的错误:
一定看看对应的环境中有对应的mysql的jar包,MySQL-connector-java-jar,并且版本一定要对应,如果出现下面的情况一定是没有jar包或版本不一致,登录自己的数据库看一看:
com.mysql.cj.jdbc.Driver
对应数据库要写入的对象的编码规则要与写入的表的编码规则一致,否则会报下面的错:
Incorrect string value: '\\xE6\\xB5\\x8B\\xE8\\xAF\\x95...' for colu......
其中所有的服务都要开启,尤其注意hive的元数据存储服务和远程jdbc连接服务,看看9083端口,可能是集群中的任何一个节点,所有节点试着找一遍。
端口查看命令:
netstat -anp|grep 9083
导包的时候最好一个一个功能的导,不要用import * ,这个可能会导致未知错误,一些重复命名等问题