Commit f39d547f by guanghui.cui

添加订单备注字段

parent 1753cf58
...@@ -130,7 +130,7 @@ struct promotions ...@@ -130,7 +130,7 @@ struct promotions
std::string sku; //商品编号 std::string sku; //商品编号
int originalPrice=0; //原始价格 int originalPrice=0; //原始价格
int discount=0; //折扣 int discount=0; //折扣
int prmotionPrice=0; //优惠价格 int promotionPrice=0; //优惠价格
std::string giftSku; //赠品的编码 std::string giftSku; //赠品的编码
int giftQty=0; //赠品的数量 int giftQty=0; //赠品的数量
}; };
...@@ -173,6 +173,7 @@ struct orderObj ...@@ -173,6 +173,7 @@ struct orderObj
int status=0; //订单状态 int status=0; //订单状态
int ods_status=0; //ods订单状态 int ods_status=0; //ods订单状态
std::string status_desc; //订单状态描述 std::string status_desc; //订单状态描述
std::string remark; //订单备注
int total_price=0; //订单总价 int total_price=0; //订单总价
int delivery_price=0; //配送费 int delivery_price=0; //配送费
int reduced_price=0; //折扣总金额 int reduced_price=0; //折扣总金额
......
...@@ -232,11 +232,17 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order) ...@@ -232,11 +232,17 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
order.pickup_code= _getPickupCodeString(order.channel,pickupcode); order.pickup_code= _getPickupCodeString(order.channel,pickupcode);
order.pickup_point = GetJsonStringSafe(orders_obj,"pickupPoint"); order.pickup_point = GetJsonStringSafe(orders_obj,"pickupPoint");
GetJsonStringSafe(orders_obj,"remark"); order.remark = GetJsonStringSafe(orders_obj,"remark");
order.status = atoi(GetJsonStringSafe(orders_obj,"status")); order.status = atoi(GetJsonStringSafe(orders_obj,"status"));
order.ods_status=order.status; order.ods_status=order.status;
// int iCancelStatus = atoi(GetJsonStringSafe(orders_obj,"cancelStatus"));
// if(ODS_ORDERSTATUS_REFUND_FULL==iCancelStatus||ODS_ORDERSTATUS_REFUND_AGREE==iCancelStatus||ODS_ORDERSTATUS_REFUND_DISAGREE==iCancelStatus){
// order.status=iCancelStatus;
// order.ods_status=order.status;
// }
order.status_desc = GetJsonStringSafe(orders_obj,"statusDesc"); order.status_desc = GetJsonStringSafe(orders_obj,"statusDesc");
//订单商品 //订单商品
...@@ -296,6 +302,10 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order) ...@@ -296,6 +302,10 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
paymentDetail detail; paymentDetail detail;
detail.amount = GetJsonIntSafe(payInfos_obj,"amount"); detail.amount = GetJsonIntSafe(payInfos_obj,"amount");
//非自配送,第一种支付方式减去配送费
if("2"!=delivery_type&&0==i){
detail.amount = GetJsonIntSafe(payInfos_obj,"amount")-GetJsonIntSafe(orderContent_obj,"deliveryFee");
}
//支付类型需要拼接 channel+payType //支付类型需要拼接 channel+payType
std::string _strType=order.channel+GetJsonStringSafe(payInfos_obj,"payType"); std::string _strType=order.channel+GetJsonStringSafe(payInfos_obj,"payType");
...@@ -318,7 +328,7 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order) ...@@ -318,7 +328,7 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
{ {
GetJsonIntSafe(promotions_obj,"totalDiscount"); GetJsonIntSafe(promotions_obj,"totalDiscount");
GetJsonIntSafe(promotions_obj,"totalOriginalPrice"); GetJsonIntSafe(promotions_obj,"totalOriginalPrice");
GetJsonIntSafe(promotions_obj,"totalPrmotionPrice"); GetJsonIntSafe(promotions_obj,"totalPromotionPrice");
//优惠信息详情 //优惠信息详情
if(promotions_obj.HasMember("promtionDetails")) if(promotions_obj.HasMember("promtionDetails"))
...@@ -335,7 +345,7 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order) ...@@ -335,7 +345,7 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
detail.desc = GetJsonStringSafe(promtionDetails_obj,"desc"); detail.desc = GetJsonStringSafe(promtionDetails_obj,"desc");
detail.sku = GetJsonStringSafe(promtionDetails_obj,"sku"); detail.sku = GetJsonStringSafe(promtionDetails_obj,"sku");
detail.originalPrice = GetJsonIntSafe(promtionDetails_obj,"originalPrice"); detail.originalPrice = GetJsonIntSafe(promtionDetails_obj,"originalPrice");
detail.prmotionPrice = GetJsonIntSafe(promtionDetails_obj,"prmotionPrice"); detail.promotionPrice = GetJsonIntSafe(promtionDetails_obj,"promotionPrice");
detail.discount = GetJsonIntSafe(promtionDetails_obj,"discount"); detail.discount = GetJsonIntSafe(promtionDetails_obj,"discount");
if(promtionDetails_obj.HasMember("gifts")){ if(promtionDetails_obj.HasMember("gifts")){
rapidjson::Value& gifts_obj = orderContent_obj["gifts"]; rapidjson::Value& gifts_obj = orderContent_obj["gifts"];
...@@ -962,6 +972,9 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj) ...@@ -962,6 +972,9 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
writer.Key("status_desc"); writer.Key("status_desc");
writer.String(obj.status_desc.c_str()); writer.String(obj.status_desc.c_str());
writer.Key("remark");
writer.String(obj.remark.c_str());
writer.Key("total_price"); writer.Key("total_price");
writer.Int(obj.total_price); writer.Int(obj.total_price);
...@@ -1220,8 +1233,8 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj) ...@@ -1220,8 +1233,8 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
writer.Key("discount"); writer.Key("discount");
writer.Int(obj.vecPromotions[i].discount); writer.Int(obj.vecPromotions[i].discount);
writer.Key("prmotionPrice"); writer.Key("promotionPrice");
writer.Int(obj.vecPromotions[i].prmotionPrice); writer.Int(obj.vecPromotions[i].promotionPrice);
writer.Key("giftSku"); writer.Key("giftSku");
writer.String(obj.vecPromotions[i].giftSku.c_str()); writer.String(obj.vecPromotions[i].giftSku.c_str());
......
...@@ -85,10 +85,10 @@ void* listen_pos_func(void* arg) ...@@ -85,10 +85,10 @@ void* listen_pos_func(void* arg)
{ {
g_init_data_ods_back.clear(); g_init_data_ods_back.clear();
// g_init_data = posRequestData; // g_init_data = posRequestData;
LOG(INFO) <<"POS req data.:"<<posRequestData.c_str(); LOG(INFO) <<"POS req data:"<<posRequestData.c_str();
jsonTool.convertInitDataPos2Ods(posRequestData,g_init_data); jsonTool.convertInitDataPos2Ods(posRequestData,g_init_data);
//jsonTool.getPosResponseData(100, "successful!", responseData); //jsonTool.getPosResponseData(100, "successful!", responseData);
LOG(INFO) <<"POS init data.:"<<g_init_data.c_str(); LOG(INFO) <<"POS init data:"<<g_init_data.c_str();
//等待ods返回初始化结果 //等待ods返回初始化结果
while(true){ while(true){
if(!g_init_data_ods_back.empty()){ if(!g_init_data_ods_back.empty()){
...@@ -360,12 +360,12 @@ int main() ...@@ -360,12 +360,12 @@ int main()
if( ods.receive(odsPushData) ) if( ods.receive(odsPushData) )
{ {
LOG(INFO) << "----------------recved ODS data------------------."; LOG(INFO) << "---------------- ODS ===>> PLUGIN ---------------.";
LOG(INFO) << odsPushData; LOG(INFO) << odsPushData;
if(!jsonTool.isHeartbeatData(odsPushData.data())){ if(!jsonTool.isHeartbeatData(odsPushData.data())){
if( jsonTool.convertDataOds2Pos(odsPushData, pushPosData) ) if( jsonTool.convertDataOds2Pos(odsPushData, pushPosData) )
{ {
LOG(INFO) << "********convert data to pos************"; LOG(INFO) << "----------- PLUGIN ===>> POS ------------";
LOG(INFO) << pushPosData; LOG(INFO) << pushPosData;
if(!order_send_to_pos(pushPosData,odsPushData,responseData)){ if(!order_send_to_pos(pushPosData,odsPushData,responseData)){
write_failed_order(odsPushData); write_failed_order(odsPushData);
...@@ -382,7 +382,7 @@ int main() ...@@ -382,7 +382,7 @@ int main()
} }
// TODO待加入重试机制 // TODO待加入重试机制
LOG(INFO) << "pos response data convert to ODS:"<<responseData.data(); LOG(INFO) << "PLUGIN ===>> ODS:"<<responseData.data();
//test //test
//responseData="{\"fm_cmd\": 2,\"order_id\" : \"1234\",\"status\" : 1,\"channel\" : \"1234\",\"status_code\" : 100,\"msg\" : \"\"}"; //responseData="{\"fm_cmd\": 2,\"order_id\" : \"1234\",\"status\" : 1,\"channel\" : \"1234\",\"status_code\" : 100,\"msg\" : \"\"}";
...@@ -421,7 +421,7 @@ bool order_send_to_pos(IN std::string &order_json,IN std::string &ods_json,OUT s ...@@ -421,7 +421,7 @@ bool order_send_to_pos(IN std::string &order_json,IN std::string &ods_json,OUT s
char tmpBuf[BUF_SIZE] = {0}; char tmpBuf[BUF_SIZE] = {0};
if( pos.read(tmpBuf,sizeof(tmpBuf)) ) if( pos.read(tmpBuf,sizeof(tmpBuf)) )
{ {
LOG(INFO) << "pos response data:"<<tmpBuf; LOG(INFO) << "POS ===>> PLUGIN:"<<tmpBuf;
tmp=tmpBuf; tmp=tmpBuf;
//pos发送过来的数据为gb2312编码,需要转换为utf8 //pos发送过来的数据为gb2312编码,需要转换为utf8
//std::string tmpUtf8= charset_g2u(tmp); //std::string tmpUtf8= charset_g2u(tmp);
......
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