|
@@ -288,34 +288,44 @@ namespace MySystem
|
|
MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantAddInfo();
|
|
MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantAddInfo();
|
|
//发起分账
|
|
//发起分账
|
|
decimal fee = order.PayMoney;
|
|
decimal fee = order.PayMoney;
|
|
- string applyNo = "FZ" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8); //批次号
|
|
|
|
- string mchtNo = merchantAdd.OutMchtNo; //慧掌柜商户号
|
|
|
|
- string orderNo = order.SeoTitle; //交易订单号(好哒平台订单号,G开头)
|
|
|
|
- string acctNo = AppConfig.Haoda.AcctNo; //账户号,分账接收方账户号
|
|
|
|
- string sacctNo = merchantAdd.MchtNo; //账户号,收款商户号
|
|
|
|
- string acctType = "0"; //账户类型(0:商户收款账户(大B),1:分账接收方账户(小B))
|
|
|
|
- decimal settleAmount = (decimal)order.SettleAmount / 100M;
|
|
|
|
- decimal divideAmt = (1 - 0.0038M) * order.SettleAmount;
|
|
|
|
- divideAmt = decimal.Parse(divideAmt.ToString("f2"));
|
|
|
|
- decimal hdfee = 0.0038M * order.SettleAmount * (1 - set.GetPercent / 100 - 0.01M);
|
|
|
|
- hdfee = decimal.Parse(hdfee.ToString("f2"));
|
|
|
|
- decimal servicefee = 0.01M * order.SettleAmount - hdfee;
|
|
|
|
- servicefee = decimal.Parse(servicefee.ToString("f2"));
|
|
|
|
- decimal amount = order.SettleAmount * (1 - 0.0038M) - servicefee;
|
|
|
|
- amount = decimal.Parse(amount.ToString("f2"));
|
|
|
|
- decimal otherAmt = divideAmt - servicefee - amount;
|
|
|
|
- if (otherAmt != 0)
|
|
|
|
|
|
+ if (fee >= 1)
|
|
{
|
|
{
|
|
- amount += otherAmt;
|
|
|
|
- }
|
|
|
|
|
|
+ string applyNo = "FZ" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8); //批次号
|
|
|
|
+ string mchtNo = merchantAdd.OutMchtNo; //慧掌柜商户号
|
|
|
|
+ string orderNo = order.SeoTitle; //交易订单号(好哒平台订单号,G开头)
|
|
|
|
+ string acctNo = AppConfig.Haoda.AcctNo; //账户号,分账接收方账户号
|
|
|
|
+ string sacctNo = merchantAdd.MchtNo; //账户号,收款商户号
|
|
|
|
+ string acctType = "0"; //账户类型(0:商户收款账户(大B),1:分账接收方账户(小B))
|
|
|
|
|
|
- amount = amount * 100; //金额(分)
|
|
|
|
- servicefee = servicefee * 100;
|
|
|
|
- string seviceAmount = servicefee.ToString("f0"); //服务费
|
|
|
|
- string amountAmount = amount.ToString("f0");
|
|
|
|
- string result = HaoDaHelper.Instance.OrderDivideAccounts(OrderDivideAccountsUtil.AddValue(applyNo, mchtNo, orderNo, acctNo, sacctNo, acctType, amountAmount, seviceAmount));
|
|
|
|
- order.DivideLog = "请求分账日志:" + result;
|
|
|
|
- db.SaveChanges();
|
|
|
|
|
|
+ decimal settleAmount = (decimal)order.SettleAmount / 100M;
|
|
|
|
+ decimal divideAmt = (1 - 0.0038M) * order.PayMoney;
|
|
|
|
+ divideAmt = decimal.Parse(divideAmt.ToString("f2"));
|
|
|
|
+ decimal hdfee = 0.0038M * order.PayMoney * (1 - set.GetPercent / 100 - 0.01M);
|
|
|
|
+ hdfee = decimal.Parse(hdfee.ToString("f2"));
|
|
|
|
+ decimal servicefee = 0.01M * order.PayMoney - hdfee;
|
|
|
|
+ servicefee = decimal.Parse(servicefee.ToString("f2"));
|
|
|
|
+ decimal amount = order.PayMoney * (1 - 0.0038M) - servicefee;
|
|
|
|
+ amount = decimal.Parse(amount.ToString("f2"));
|
|
|
|
+ decimal otherAmt = settleAmount - servicefee - amount;
|
|
|
|
+ if (otherAmt != 0)
|
|
|
|
+ {
|
|
|
|
+ amount += otherAmt;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ amount = amount * 100; //金额(分)
|
|
|
|
+ servicefee = servicefee * 100;
|
|
|
|
+ string seviceAmount = servicefee.ToString("f0"); //服务费
|
|
|
|
+ string amountAmount = amount.ToString("f0");
|
|
|
|
+ string result = HaoDaHelper.Instance.OrderDivideAccounts(OrderDivideAccountsUtil.AddValue(applyNo, mchtNo, orderNo, acctNo, sacctNo, acctType, amountAmount, seviceAmount));
|
|
|
|
+ order.DivideLog = "请求分账日志:" + result;
|
|
|
|
+
|
|
|
|
+ //开始监听分账状态
|
|
|
|
+ // Dictionary<string, object> req = new Dictionary<string, object>();
|
|
|
|
+ // req.Add("ApplyNo", applyNo);
|
|
|
|
+ // req.Add("OrderNo", order.OrderNo);
|
|
|
|
+ // req.Add("MchtNo", mchtNo);
|
|
|
|
+ // RedisDbconn.Instance.AddList("ProfitShareHdQueue", Newtonsoft.Json.JsonConvert.SerializeObject(req));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
db.Dispose();
|
|
db.Dispose();
|