Commit 2a952a5e by guanghui.cui

getOrder数据字段更新

parent 55b0bee9
...@@ -84,76 +84,337 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order) ...@@ -84,76 +84,337 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
rapidjson::Value& channel = document["channel"]; rapidjson::Value& channel = document["channel"];
order.channel=channel.GetString(); order.channel=channel.GetString();
rapidjson::Value& order_id = document["order_id"]; rapidjson::Value& token = document["token"];
order.order_id=order_id.GetString(); token.GetString();
rapidjson::Value& create_time = document["create_time"]; rapidjson::Value& ver = document["ver"];
order.create_time=create_time.GetString(); ver.GetInt();
rapidjson::Value& delivery_time = document["delivery_time"]; //配送信息
order.delivery_time=delivery_time.GetString(); {
rapidjson::Value& status = document["status"]; rapidjson::Value& delivery_obj = document["delivery"];
order.status=_getPOSOrderStatus(status.GetInt()); rapidjson::Value& customerAddress = delivery_obj["customerAddress"];
order.customerInfo.address=customerAddress.GetString();
rapidjson::Value& customerName = delivery_obj["customerName"];
order.customerInfo.name = customerName.GetString();
rapidjson::Value& customerPhone = delivery_obj["customerPhone"];
order.customerInfo.phone = customerPhone.GetString();
rapidjson::Value& deliveryTime = delivery_obj["deliveryTime"];
order.delivery_time = deliveryTime.GetString();
rapidjson::Value& name = delivery_obj["name"];
order.deliveryInfo.driver_name = name.GetString();
rapidjson::Value& phone = delivery_obj["phone"];
order.deliveryInfo.driver_phone = phone.GetString();
rapidjson::Value& type = delivery_obj["type"];
order.deliveryInfo.type = type.GetString();
}
rapidjson::Value& status_desc = document["status_desc"]; //发票信息
order.status_desc=status_desc.GetString(); {
rapidjson::Value& invoice_obj = document["invoice"];
rapidjson::Value& companyName = invoice_obj["companyName"];
companyName.GetString();
rapidjson::Value& invoiceType = invoice_obj["invoiceType"];
invoiceType.GetInt();
rapidjson::Value& taxNum = invoice_obj["taxNum"];
taxNum.GetString();
rapidjson::Value& title = invoice_obj["title"];
title.GetString();
rapidjson::Value& transNum = invoice_obj["transNum"];
transNum.GetString();
}
rapidjson::Value& total_fee = document["total_fee"]; //订单内容
order.total_price=total_fee.GetInt(); {
rapidjson::Value& orderContent_obj = document["orderContent"];
rapidjson::Value& send_fee = document["send_fee"]; rapidjson::Value& createTime = orderContent_obj["createTime"];
order.delivery_price=send_fee.GetInt(); order.create_time = createTime.GetString();
rapidjson::Value& discount_fee = document["discount_fee"]; //用户信息
order.reduced_price=discount_fee.GetInt(); rapidjson::Value& customer_array = orderContent_obj["customer"];
if(customer_array.IsArray())
{
for(unsigned int i=0;i<customer_array.Size();i++){
rapidjson::Value& customer_obj = customer_array[i];
//配送 rapidjson::Value& accountId = customer_obj["accountId"];
rapidjson::Value& delivery_type = document["delivery_type"]; order.customerInfo.account = accountId.GetString();
order.deliveryInfo.type=_getDeliveryTypeString(delivery_type.GetInt());
rapidjson::Value& delivery_status = document["delivery_status"]; rapidjson::Value& accountType= customer_obj["accountType"];
order.deliveryInfo.status=delivery_status.GetInt(); order.customerInfo.account_type = atoi(accountType.GetString().data());
rapidjson::Value& courier_name = document["courier_name"]; rapidjson::Value& level = customer_obj["level"];
order.deliveryInfo.driver_name=courier_name.GetString(); order.customerInfo.account_level = level.GetString();
rapidjson::Value& courier_phone = document["courier_phone"]; }
order.deliveryInfo.driver_phone=courier_phone.GetString(); }
//顾客信息 rapidjson::Value& deliveryFee = orderContent_obj["deliveryFee"];
rapidjson::Value& customer = document["customer"]; order.delivery_price = deliveryFee.GetInt();
order.customerInfo.name=customer.GetString();
rapidjson::Value& phone = document["phone"]; //订单信息
order.customerInfo.phone=phone.GetString(); {
rapidjson::Value& orders_obj = orderContent_obj["orders"];
rapidjson::Value& deliveryStatus = orders_obj["deliveryStatus"];
order.deliveryInfo.status = atoi(deliveryStatus.GetString().data());
rapidjson::Value& deliveryStatusDesc = orders_obj["deliveryStatusDesc"];
order.deliveryInfo.status_desc = deliveryStatusDesc.GetString();
rapidjson::Value& orderId = orders_obj["orderId"];
order.order_id = orderId.GetString();
rapidjson::Value& pickupCode = orders_obj["pickupCode"];
order.pickup_code= pickupCode.GetString();
rapidjson::Value& pickupPoint = orders_obj["pickupPoint"];
order.pickup_point = pickupPoint.GetString();
rapidjson::Value& remark = orders_obj["remark"];
remark.GetString();
rapidjson::Value& status = orders_obj["status"];
order.status = atoi(status.GetString().data());
rapidjson::Value& statusDesc = orders_obj["statusDesc"];
order.status_desc = statusDesc.GetString();
//订单商品
{
rapidjson::Value& products_array = orders_obj["products"];
if(products_array.IsArray())
{
for(unsigned int i=0;i<products_array.Size();i++){
rapidjson::Value& product_obj = products_array[i];
rapidjson::Value& address = document["address"]; productAttr structProduct;
order.customerInfo.address=address.GetString();
//商品列表 rapidjson::Value& attributes = product_obj["attributes"];
rapidjson::Value& products_array = document["products"]; structProduct.pro.attributes = attributes.GetString();
if(products_array.IsArray()){
for(unsigned int i=0;i<products_array.Size();i++){ rapidjson::Value& catgId= product_obj["catgId"];
productAttr proAttr; structProduct.pro.combo_id = catgId.GetString();
rapidjson::Value& objProductValue = products_array[i];
rapidjson::Value& groupIndex = product_obj["groupIndex"];
structProduct.pro.bom_id = groupIndex.GetString();
rapidjson::Value& name = product_obj["name"];
structProduct.pro.name = name.GetString();
rapidjson::Value& price= product_obj["price"];
structProduct.pro.price = price.GetInt();
rapidjson::Value& productType = product_obj["productType"];
productType.GetString();
rapidjson::Value& qty = product_obj["qty"];
structProduct.pro.qty = qty.GetInt();
rapidjson::Value& sku= product_obj["sku"];
structProduct.pro.sku = sku.GetString();
rapidjson::Value& source = product_obj["source"];
structProduct.pro.source = source.GetString();
//子商品信息
{
rapidjson::Value& specs_array = product_obj["specs"];
if(specs_array.IsArray())
{
for(unsigned int i=0;i<specs_array.Size();i++){
rapidjson::Value& specs_obj = specs_array[i];
productSpec structProductSpec;
rapidjson::Value& name = specs_obj["name"];
structProductSpec.name = name.GetString();
rapidjson::Value& name = objProductValue["name"]; rapidjson::Value& price= specs_obj["price"];
proAttr.pro.name=name.GetString(); structProductSpec.price = price.GetInt();
rapidjson::Value& pid = objProductValue["pid"]; rapidjson::Value& qty = specs_obj["qty"];
proAttr.pro.sku=pid.GetString(); structProductSpec.qty = qty.GetInt();
rapidjson::Value& price = objProductValue["price"]; rapidjson::Value& sku = specs_obj["sku"];
proAttr.pro.price=price.GetInt(); structProductSpec.sku = sku.GetString();
structProduct.vecSpec.push_back(structProductSpec);
}
}
}
order.vecProducts.push_back(structProduct);
}
}
}
}
rapidjson::Value& productAmount = objProductValue["productAmount"]; //支付信息
proAttr.pro.qty=atoi(productAmount.GetString()); {
//TODO
//sumary未映射字段值
rapidjson::Value& payInfos_array = orderContent_obj["payInfos"];
if(payInfos_array.IsArray())
{
for(unsigned int i=0;i<payInfos_array.Size();i++){
rapidjson::Value& payInfos_obj = payInfos_array[i];
paymentDetail detail;
order.vecProducts.push_back(proAttr); rapidjson::Value& amount= payInfos_obj["amount"];
detail.amount = amount.GetInt();
rapidjson::Value& payType = payInfos_obj["payType"];
detail.type = atoi(payType.GetString().data());
rapidjson::Value& transNum = payInfos_obj["transNum"];
detail.trans_id = transNum.GetString();
order.payInfo.vecDetail.push_back(detail);
}
} }
} }
rapidjson::Value& payType = orderContent_obj["payType"];
payType.GetString();
//积分信息
{
rapidjson::Value& points_obj = orderContent_obj["points"];
rapidjson::Value& totalPoint= points_obj["totalPoint"];
char temp[20]={0};
int iPoint=totalPoint.GetInt();
itoa(iPoint,temp,10);
order.bonusInfo.summary = temp;
//积分信息详情
{
rapidjson::Value& pointDetails_array = points_obj["pointDetails"];
if(pointDetails_array.IsArray())
{
for(unsigned int i=0;i<pointDetails_array.Size();i++){
rapidjson::Value& pointDetails_obj = pointDetails_array[i];
bonusDetail detail;
rapidjson::Value& bomId= pointDetails_obj["bomId"];
bomId.GetString();
rapidjson::Value& comboId = pointDetails_obj["comboId"];
comboId.GetString();
rapidjson::Value& desc = pointDetails_obj["desc"];
detail.desc = desc.GetString();
rapidjson::Value& groupId = pointDetails_obj["groupId"];
groupId.GetString();
rapidjson::Value& point = pointDetails_obj["point"];
detail.point = point.GetInt();
rapidjson::Value& sku = pointDetails_obj["sku"];
detail.sku = sku.GetString();
rapidjson::Value& type = pointDetails_obj["type"];
detail.type = atoi(type.GetString().data());
order.bonusInfo.vecDetail.push_back(detail);
}
}
}
}
//优惠信息
{
rapidjson::Value& promotions_obj = orderContent_obj["promotions"];
rapidjson::Value& totalDiscount= promotions_obj["totalDiscount"];
totalDiscount.GetInt();
rapidjson::Value& totalOriginalPrice= promotions_obj["totalOriginalPrice"];
totalOriginalPrice.GetInt();
rapidjson::Value& totalPrmotionPrice= promotions_obj["totalPrmotionPrice"];
totalPrmotionPrice.GetInt();
//优惠信息详情
{
rapidjson::Value& promtionDetails_array = promotions_obj["promtionDetails"];
if(promtionDetails_array.IsArray())
{
for(unsigned int i=0;i<promtionDetails_array.Size();i++){
rapidjson::Value& promtionDetails_obj = promtionDetails_array[i];
rapidjson::Value& bomId= promtionDetails_obj["bomId"];
bomId.GetString();
rapidjson::Value& comboId = promtionDetails_obj["comboId"];
comboId.GetString();
rapidjson::Value& desc = promtionDetails_obj["desc"];
desc.GetString();
rapidjson::Value& discount = promtionDetails_obj["discount"];
discount.GetInt();
rapidjson::Value& groupId = promtionDetails_obj["groupId"];
groupId.GetString();
rapidjson::Value& originalPrice = promtionDetails_obj["originalPrice"];
originalPrice.GetInt();
rapidjson::Value& pcode = promtionDetails_obj["pcode"];
pcode.GetString();
rapidjson::Value& prmotionPrice = promtionDetails_obj["prmotionPrice"];
prmotionPrice.GetInt();
rapidjson::Value& sku = promtionDetails_obj["sku"];
sku.GetString();
rapidjson::Value& type = promtionDetails_obj["type"];
type.GetString();
}
}
}
}
rapidjson::Value& sessionId = orderContent_obj["sessionId"];
sessionId.GetString();
rapidjson::Value& totalAmount = orderContent_obj["totalAmount"];
order.total_price = totalAmount.GetInt();
rapidjson::Value& totalDiscount = orderContent_obj["totalDiscount"];
order.reduced_price = totalDiscount.GetInt();
}
//第三方商户信息
{
rapidjson::Value& sellerInfo_obj = document["sellerInfo"];
rapidjson::Value& sellerId = sellerInfo_obj["sellerId"];
sellerId.GetString();
rapidjson::Value& sellerName = sellerInfo_obj["sellerName"];
sellerName.GetString();
}
//门店信息
{
rapidjson::Value& shopInfo_obj = document["shopInfo"];
rapidjson::Value& barCounter = shopInfo_obj["barCounter"];
barCounter.GetString();
rapidjson::Value& vOperator = shopInfo_obj["operator"];
vOperator.GetString();
rapidjson::Value& posId = shopInfo_obj["posId"];
order.storeInfo.pos_id = posId.GetString();
rapidjson::Value& storeId = shopInfo_obj["storeId"];
order.storeInfo.store_id = storeId.GetString();
//自助机信息
rapidjson::Value& selfHelpMac_obj = shopInfo_obj["selfHelpMac"];
rapidjson::Value& id = selfHelpMac_obj["id"];
order.storeInfo.vem_id = id.GetString();
rapidjson::Value& shelf = selfHelpMac_obj["shelf"];
order.storeInfo.vem_shelf = shelf.GetString();
}
} }
return true; return true;
} }
...@@ -323,7 +584,7 @@ bool JsonModule::convertDataOds2Pos(const std::string &data, std::string &result ...@@ -323,7 +584,7 @@ bool JsonModule::convertDataOds2Pos(const std::string &data, std::string &result
if(ORDERSTATUS_NEW==order.status){ if(ORDERSTATUS_NEW==order.status){
result = _convertToNewOrderJson(order); result = _convertToNewOrderJson(order);
} }
else if(ORDERSTATUS_CONFIRMED==order.status||ORDERSTATUS_CANCELED==order.status||ORDERSTATUS_SHIPPING==order.status||ORDERSTATUS_COMPLETE==order.status||ORDERSTATUS_REFUND_COMPLETE){ else if(ORDERSTATUS_CONFIRMED==order.status||ORDERSTATUS_CANCELED==order.status||ORDERSTATUS_SHIPPING==order.status||ORDERSTATUS_COMPLETE==order.status){
orderStatusObj statusObj; orderStatusObj statusObj;
_getStatusObj(order,statusObj); _getStatusObj(order,statusObj);
result = _convertToOrderStatusJson(statusObj); result = _convertToOrderStatusJson(statusObj);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment