Commit 99496e54 by guanghui.cui

混合支付

parent 28ae9723
......@@ -222,6 +222,9 @@ struct orderObj
int bonus_basic = 0; //基本积分
int bonus_extra = 0; //额外积分
int bonus_total = 0; // 获得总积分
int totalCouponDiscount = 0; //使用优惠券发生的折扣
int totalExcessiveCharge = 0; //使用优惠券发生的溢收
int zhxPoint = 0; //甄会选积分
store storeInfo; //门店信息
delivery deliveryInfo; //配送信息
......
......@@ -2,9 +2,9 @@
port=24446
[ODS]
ip=103.13.247.72
pushPort=30009
recvPort=30010
ip=127.0.0.1
pushPort=30001
recvPort=30002
socketTimeout=120
[POS]
......
......@@ -246,6 +246,8 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
order.wmDiscount=GetJsonIntSafe(orderContent_obj,"wmDiscount");
order.wmPtSharedDiscount=GetJsonIntSafe(orderContent_obj,"wmPtSharedDiscount");
order.wmSjSharedDiscount=GetJsonIntSafe(orderContent_obj,"wmSjSharedDiscount");
order.totalCouponDiscount = GetJsonIntSafe(orderContent_obj, "totalCouponDiscount");
order.totalExcessiveCharge = GetJsonIntSafe(orderContent_obj, "totalExcessiveCharge");
//订单信息
......@@ -333,11 +335,17 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
paymentDetail detail;
detail.amount = GetJsonIntSafe(payInfos_obj,"amount");
//非自配送,第一种支付方式减去配送费
if("2"!=delivery_type&&0==i){
//非自配送且不是咖啡小程序订单,第一种支付方式减去配送费
if("2" != delivery_type && 0==i && order.channel != "213"){
detail.amount = GetJsonIntSafe(payInfos_obj,"amount")-GetJsonIntSafe(orderContent_obj,"deliveryFee");
}
//咖啡小程序订单,需要单独处理.支付类型为"10101"的金额,减去配送费
std::string payType = GetJsonStringSafe(payInfos_obj, "payType");
if (order.channel == "213" && payType== "10101") {
detail.amount = GetJsonIntSafe(payInfos_obj, "amount") - GetJsonIntSafe(orderContent_obj, "deliveryFee");
}
//支付类型需要拼接 channel+payType
std::string _strType=order.channel+GetJsonStringSafe(payInfos_obj,"payType");
detail.type = atoi(_strType.data());
......@@ -402,6 +410,7 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
order.bonus_total = GetJsonIntSafe(points_obj,"totalPoint");
order.bonus_extra = GetJsonIntSafe(points_obj, "extraPoint");
order.bonus_basic = GetJsonIntSafe(points_obj, "basicPoint");
order.zhxPoint = GetJsonIntSafe(points_obj, "zhxPoint");
//积分信息详情
if(points_obj.HasMember("pointDetails"))
{
......@@ -453,6 +462,39 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
GetJsonStringSafe(orderContent_obj,"sessionId");
order.reduced_price = GetJsonIntSafe(orderContent_obj,"totalDiscount");
//订单优惠券信息
if (orderContent_obj.HasMember("orderCoupons"))
{
rapidjson::Value& coupons_array = orderContent_obj["orderCoupons"];
if (!coupons_array.IsNull()) {
if (coupons_array.IsArray()) {
for (unsigned int i = 0; i<coupons_array.Size(); i++) {
rapidjson::Value& coupon_obj = coupons_array[i];
orderCoupon coupon;
coupon.couponId = GetJsonStringSafe(coupon_obj, "couponId");
coupon.couponName = GetJsonStringSafe(coupon_obj, "couponName");
coupon.ebcode = GetJsonStringSafe(coupon_obj, "ebcode");
coupon.securitiesTrader = GetJsonStringSafe(coupon_obj, "securitiesTrader");
coupon.transNum = GetJsonStringSafe(coupon_obj, "transNum");
coupon.type = GetJsonStringSafe(coupon_obj, "type");
coupon.discount = GetJsonIntSafe(coupon_obj, "discount");
coupon.totalAmount = GetJsonIntSafe(coupon_obj, "totalAmount");
coupon.useAmount = GetJsonIntSafe(coupon_obj, "useAmount");
coupon.usedNum = GetJsonIntSafe(coupon_obj, "usedNum");
coupon.sku = GetJsonStringSafe(coupon_obj, "sku");
coupon.campaignAmt = GetJsonIntSafe(coupon_obj, "campaignAmt");
coupon.paid = GetJsonIntSafe(coupon_obj, "paid");
coupon.price = GetJsonIntSafe(coupon_obj, "price");
coupon.remainingAmt = GetJsonIntSafe(coupon_obj, "remainingAmt");
coupon.supplierNo = GetJsonStringSafe(coupon_obj, "supplierNo");
coupon.activityId = GetJsonStringSafe(coupon_obj, "activityId");
order.vecOrderCoupons.push_back(coupon);
}
}
}
}
}
//第三方商户信息
if(document.HasMember("sellerInfo"))
......@@ -486,37 +528,6 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
}
}
//订单优惠券信息
if (document.HasMember("orderCoupons"))
{
rapidjson::Value& coupons_array = document["orderCoupons"];
if (coupons_array.IsArray()) {
for (unsigned int i = 0; i<coupons_array.Size(); i++) {
rapidjson::Value& coupon_obj = coupons_array[i];
orderCoupon coupon;
coupon.couponId = GetJsonStringSafe(coupon_obj, "couponId");
coupon.couponName = GetJsonStringSafe(coupon_obj, "couponName");
coupon.ebcode = GetJsonStringSafe(coupon_obj, "ebcode");
coupon.securitiesTrader = GetJsonStringSafe(coupon_obj, "securitiesTrader");
coupon.transNum = GetJsonStringSafe(coupon_obj, "transNum");
coupon.type = GetJsonStringSafe(coupon_obj, "type");
coupon.discount = GetJsonIntSafe(coupon_obj, "discount");
coupon.totalAmount = GetJsonIntSafe(coupon_obj, "totalAmount");
coupon.useAmount = GetJsonIntSafe(coupon_obj, "useAmount");
coupon.usedNum = GetJsonIntSafe(coupon_obj, "usedNum");
coupon.sku = GetJsonStringSafe(coupon_obj, "sku");
coupon.campaignAmt = GetJsonIntSafe(coupon_obj, "campaignAmt");
coupon.paid = GetJsonIntSafe(coupon_obj, "paid");
coupon.price = GetJsonIntSafe(coupon_obj, "price");
coupon.remainingAmt = GetJsonIntSafe(coupon_obj, "remainingAmt");
coupon.supplierNo = GetJsonStringSafe(coupon_obj, "supplierNo");
coupon.activityId = GetJsonStringSafe(coupon_obj, "activityId");
order.vecOrderCoupons.push_back(coupon);
}
}
}
}
return true;
}
......@@ -1067,6 +1078,12 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
writer.Key("order_drift");
writer.String(obj.order_drift.c_str());
writer.Key("totalCouponDiscount");
writer.Int(obj.totalCouponDiscount);
writer.Key("totalExcessiveCharge");
writer.Int(obj.totalExcessiveCharge);
//----------------门店信息----------------
writer.Key("store");
writer.StartObject();
......@@ -1275,6 +1292,9 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
writer.Key("bonusTotal");
writer.Int(obj.bonus_total);
writer.Key("zhxPoint");
writer.Int(obj.zhxPoint);
writer.Key("bonus");
writer.StartArray();
for(unsigned int i=0;i<obj.vecBonus.size();i++)
......
......@@ -19,7 +19,7 @@
INITIALIZE_EASYLOGGINGPP
#define VERSION "1.0.8" //版本号
#define VERSION "1.0.9" //版本号
std::string g_init_data;
std::string g_init_data_ods_back;
......
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