PySpark学习---销售情况数据统计分析案例

news2024/11/16 19:35:42

需求分析:

某公司是做零售相关业务,旗下出品各类收银机.
目前公司的收银机已经在全国铺开,在各个省份均有店铺使用.机器是联网的,每一次使用都会将售卖商品数据上传到公司后台.老板现在想对省份维度的销售情况进行统计分析

 逻辑需求:

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 * ,这个可能会导致未知错误,一些重复命名等问题

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1637872.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

APScheduler定时器使用:django中使用apscheduler,使用mysql做存储后端

一、基本环境 python版本&#xff1a;3.8.5 APScheduler3.10.4 Django3.2.7 djangorestframework3.15.1 SQLAlchemy2.0.29 PyMySQL1.1.0二、django基本设置 2.1、新增一个app 该app用来写apscheduler相关的代码 python manage.py startapp gs_scheduler 2.2、修改配置文件s…

Qt在任务栏图标和系统托盘图标上显示红点

在任务栏图标上显示红点 关键类&#xff1a;QWinTaskbarButton #include <QWinTaskbarButton>QPointer<QWinTaskbarButton> taskbarBtn nullptr; if (!taskbarBtn) {taskbarBtn new QWinTaskbarButton(window);taskbarBtn->setWindow(window->windowHand…

重定义大语言模型的记忆能力:对抗性压缩如何挑战现有测量法

DeepVisionary 每日深度学习前沿科技推送&顶会论文分享&#xff0c;与你一起了解前沿深度学习信息&#xff01; Rethinking LLM Memorization through the Lens of Adversarial Compression 引言&#xff1a;探索大型语言模型的记忆能力 在当今信息时代&#xff0c;大型…

ROS1快速入门学习笔记 - 11参数的使用与编程方法

目录 一、参数模型&#xff08;全局字典&#xff09; 二、使用方法 1. 创建功能包 2. 参数命令行的使用 3. 通过C实现参数设置 4. 在CMakeLists中进行编译 5. 运行程序 6. 编程方法&#xff08;Python&#xff09; 一、参数模型&#xff08;全局字典&#xff09; 每个节…

2024.5.5 机器学习周报

引言 Abstract 文献阅读 1、题目 SuperGlue: Learning Feature Matching with Graph Neural Networks 2、引言 本文介绍了SuperGlue&#xff0c;这是一种神经网络&#xff0c;它通过联合寻找对应关系并拒绝不匹配的点来匹配两组局部特征。通过求解一个可微的最优运输问题…

【PCL】教程 example2 3D点云之间的精确配准(FPFH特征对应关系估计变换矩阵)

这段代码主要实现了点云之间的配准功能&#xff0c;旨在通过估计点云的特征并找到最佳的对应关系来计算一个变换矩阵&#xff0c;从而可以将源点云&#xff08;src&#xff09;变换到目标点云&#xff08;tgt&#xff09;的坐标系统中。 代码功能和方法总结如下&#xff1a; 估…

STM32 DMA直接存储器存取

单片机学习&#xff01; 目录 文章目录 前言 一、DMA简介 1.1 DMA是什么 1.2 DMA作用 1.3 DMA通道 1.4 软硬件触发 1.5 芯片资源 二、存储器映像 2.1 存储器 2.2 STM32存储器 三、DMA框图 3.1 内核与存储器 3.2 寄存器 3.3 DMA数据转运 3.4 DMA总线作用 3.5 DMA请求 3.6 DMA结构…

Flutter笔记:Widgets Easier组件库(3)使用按钮组件

Flutter笔记 Widgets Easier组件库&#xff08;3&#xff09;&#xff1a;使用按钮组件 - 文章信息 - Author: 李俊才 (jcLee95) Visit me at CSDN: https://jclee95.blog.csdn.netMy WebSite&#xff1a;http://thispage.tech/Email: 291148484163.com. Shenzhen ChinaAddre…

数字旅游以科技创新为核心:推动旅游服务的智能化、精准化、个性化,为游客提供更加贴心、专业、高效的旅游服务

目录 一、引言 二、数字旅游以科技创新推动旅游服务智能化 1、智能化技术的应用 2、提升旅游服务的效率和质量 三、数字旅游以科技创新推动旅游服务精准化 1、精准化需求的识别与满足 2、精准化营销与推广 四、数字旅游以科技创新推动旅游服务个性化 1、个性化服务的创…

Cloudflare高级防御规则 看看我的网站如何用防御的

网站已趋于稳定&#xff0c;并且经过nginx调优。我想先分享一下Cloudflare的WAF规则&#xff0c;因为这是最有效的防御之一&#xff0c;可以抵御大量恶意攻击流量&#xff0c;我已经验证了数月。 对于海外独立站电商网站&#xff0c;Cloudflare的CDN服务是首选&#xff0c;它强…

File contains parsing errors: file:///etc/yum.repos.d/nginx.repo报错解决,文件配置出现问题

执行yum指令出现以下错误&#xff1a; 解决方案&#xff1a;yum的配置文件出现问题&#xff0c; 先删除yum.repos.d目录下所有文件 rm -f /etc/yum.repos.d/* 然后重新下载阿里的资源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.…

VPX双路***至强高性能服务器模块

VPX双路***至强高性能服务器模块 1 产品介绍 1.1 产品概述 是一款基于Intel Xeon Gold系列处理器设计的双至强VPX模块&#xff0c;连接器采用VPX规范的高速连接器&#xff0c;专为高性能全加固服务器设计&#xff0c;具有贴片内存颗粒128GB DDR4内存&#xff0c;并提供了丰富…

翻译: 什么是ChatGPT 通过图形化的方式来理解 Transformer 架构 深度学习三

合集 ChatGPT 通过图形化的方式来理解 Transformer 架构 翻译: 什么是ChatGPT 通过图形化的方式来理解 Transformer 架构 深度学习一翻译: 什么是ChatGPT 通过图形化的方式来理解 Transformer 架构 深度学习二翻译: 什么是ChatGPT 通过图形化的方式来理解 Transformer 架构 深…

图像处理:乘法滤波器(Multiplying Filter)和逆FFT位移

一、乘法滤波器&#xff08;Multiplying Filter&#xff09; 乘法滤波器是一种以像素值为权重的滤波器&#xff0c;它通过将滤波器的权重与图像的像素值相乘&#xff0c;来获得滤波后的像素值。具体地&#xff0c;假设乘法滤波器的权重为h(i,j)&#xff0c;图像的像素值为f(m,…

【氮化镓】GaN器件在航天器高可靠正向转换器中应用

文章是发表在《IEEE Journal of Emerging and Selected Topics in Power Electronics》2022年10月第10卷第5期上的一篇关于GaN(氮化镓)器件在航天器高可靠性正向转换器中应用的研究。文章的作者是匹兹堡大学电气与计算机工程系的Aidan Phillips, Thomas Cook和Brandon M. Gra…

code-server容器webpack的ws无法连接解决方法

TLDR 通过指定client的wsrul去连接ws devServer.client.webSocketURL ‘wss://<Forwarded uri>/ws’ 拓扑 1、code-server: 用于编写代码、启动webpack dev-server 服务&#xff1b;[https://<domain>:8001] 2、webpack: 用于浏览dev-server服务&#xff1b;[ht…

【计算机网络】网络层总结

目录 知识梗概 IP地址 子网划分 IP包头格式 路由 网络层协议 ARP病毒/ARP欺骗 知识梗概 IP地址 IP相关介绍&#xff1a;机器之间需要交流&#xff0c;必须要一个地址才能找到对应的主机&#xff0c;IP地址是主机的一种表示&#xff0c;保证主机之间的正常通信&#xff…

农牧渔农业信息网整站源码优化版

下载地址&#xff1a;农牧渔农业信息网整站源码优化版.zip 适合做农产品、农业物资、农活用人信息平台

记录一次恢复假卡750ti的过程

有一张卡&#xff0c;一直上不了144hz我就很纳闷&#xff0c;下载了一个gpuz查看了一下 了解了一下gf116是550ti或者gts450.我到挺希望他是550ti的。 很坑

【STM32F407+CUBEMX+FreeRTOS+lwIP netconn UDP TCP记录】

STM32F407CUBEMXFreeRTOSlwIP netconn UDP TCP记录 注意UDPUDP1UDP2 TCPTCP clientTCP server图片 注意 1、超时 #include “lwipopts.h” #define LWIP_SO_RCVTIMEO 12、先保证能ping通 3、关于工程创建可参考 【STM32F407CUBEMXFreeRTOSlwIP之UDP记录】 4、…