Commit eccade2a by guanghui.cui

实现集中店功能,添加 store_type 和 child_store_id字段

parent 2f737d48
#ifndef COMMON_STRUCT_H #ifndef COMMON_STRUCT_H
#define COMMON_STRUCT_H #define COMMON_STRUCT_H
#include <iostream> #include <iostream>
...@@ -98,6 +98,8 @@ struct store ...@@ -98,6 +98,8 @@ struct store
std::string pos_id; //订单推送 POS 编号 std::string pos_id; //订单推送 POS 编号
std::string vem_id; //自助终端编号 std::string vem_id; //自助终端编号
std::string vem_shelf; //自助终端货架号 std::string vem_shelf; //自助终端货架号
std::string store_type; //门店类型: “”:非集中店 “1”:普通门店 “2”:集中店
std::string child_store_id; //子门店号
}; };
//配送信息 //配送信息
......
...@@ -3,8 +3,8 @@ port=24446 ...@@ -3,8 +3,8 @@ port=24446
[ODS] [ODS]
ip=103.13.247.72 ip=103.13.247.72
pushPort=30001 pushPort=30009
recvPort=30002 recvPort=30010
socketTimeout=120 socketTimeout=120
[POS] [POS]
......
...@@ -461,6 +461,8 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order) ...@@ -461,6 +461,8 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
GetJsonStringSafe(shopInfo_obj,"operator"); GetJsonStringSafe(shopInfo_obj,"operator");
order.storeInfo.pos_id = GetJsonStringSafe(shopInfo_obj,"posId"); order.storeInfo.pos_id = GetJsonStringSafe(shopInfo_obj,"posId");
order.storeInfo.store_id = GetJsonStringSafe(shopInfo_obj,"storeId"); order.storeInfo.store_id = GetJsonStringSafe(shopInfo_obj,"storeId");
order.storeInfo.store_type = GetJsonStringSafe(shopInfo_obj, "store_type");
order.storeInfo.child_store_id = GetJsonStringSafe(shopInfo_obj, "child_store_id");
//自助机信息 //自助机信息
rapidjson::Value& selfHelpMac_obj = shopInfo_obj["selfHelpMac"]; rapidjson::Value& selfHelpMac_obj = shopInfo_obj["selfHelpMac"];
...@@ -802,6 +804,19 @@ bool JsonModule::getOdsResponseData(int status_code, const std::string &msg, IN ...@@ -802,6 +804,19 @@ bool JsonModule::getOdsResponseData(int status_code, const std::string &msg, IN
writer.Key("pk_id"); writer.Key("pk_id");
writer.Uint64(pk_id); writer.Uint64(pk_id);
std::string child_store_id;
if (document.HasMember("shopInfo"))
{
rapidjson::Value& shopInfo_obj = document["shopInfo"];
if (shopInfo_obj.IsObject()) {
child_store_id = GetJsonStringSafe(shopInfo_obj, "child_store_id");
}
}
writer.Key("child_store_id");
writer.String(child_store_id.c_str());
writer.EndObject(); writer.EndObject();
result = buffer.GetString(); result = buffer.GetString();
...@@ -1016,6 +1031,12 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj) ...@@ -1016,6 +1031,12 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
writer.Key("vem_shelf"); writer.Key("vem_shelf");
writer.String(obj.storeInfo.vem_shelf.c_str()); writer.String(obj.storeInfo.vem_shelf.c_str());
writer.Key("store_type");
writer.String(obj.storeInfo.store_type.c_str());
writer.Key("child_store_id");
writer.String(obj.storeInfo.child_store_id.c_str());
writer.EndObject(); writer.EndObject();
//----------------门店信息 结束----------- //----------------门店信息 结束-----------
...@@ -1778,6 +1799,14 @@ bool JsonModule::_getOrderResponseJson(IN const std::string& posResponse, IN con ...@@ -1778,6 +1799,14 @@ bool JsonModule::_getOrderResponseJson(IN const std::string& posResponse, IN con
std::string channel = document1["channel"].GetString(); std::string channel = document1["channel"].GetString();
uint64_t pk_id = GetJsonIntSafe(document2,"pk_id"); uint64_t pk_id = GetJsonIntSafe(document2,"pk_id");
std::string child_store_id;
if (document2.HasMember("shopInfo"))
{
rapidjson::Value& shopInfo_obj = document2["shopInfo"];
if (shopInfo_obj.IsObject()) {
child_store_id = GetJsonStringSafe(shopInfo_obj, "child_store_id");
}
}
rapidjson::StringBuffer buffer; rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
...@@ -1804,6 +1833,9 @@ bool JsonModule::_getOrderResponseJson(IN const std::string& posResponse, IN con ...@@ -1804,6 +1833,9 @@ bool JsonModule::_getOrderResponseJson(IN const std::string& posResponse, IN con
writer.Key("pk_id"); writer.Key("pk_id");
writer.Uint64(pk_id); writer.Uint64(pk_id);
writer.Key("child_store_id");
writer.String(child_store_id.c_str());
//该状态表示商品在pos中不存在,需要返回字段给中台,由于双方命名规则不一致,所以这里拼上中台需要字段 //该状态表示商品在pos中不存在,需要返回字段给中台,由于双方命名规则不一致,所以这里拼上中台需要字段
if (103 == status_code) { if (103 == status_code) {
writer.Key("orderId"); writer.Key("orderId");
......
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