查询商品最后几笔订单的外采金额
This commit is contained in:
1 parent
a34a0b4a78
commit
8ee4bf59b9
4 files changed
+140
-2
No files matched your search
@@ -30,6 +30,104 @@ namespace KJD_Web.BLL.WXXD
|
||||
return new BLL.BXX.BXXProductManage().GetHotProductList(inputData, isDetail);
|
||||
}
|
||||
|
||||
public string WXGetProductLatestBuyAmountList(string inputData, bool isDetail = false)
|
||||
{
|
||||
var timeCalc = DateTime.Now;
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var sign = RegexUtils.GetStringQuery(ref inputData, "sign");
|
||||
if (!WXShopManage.GetTimeSign(sign))
|
||||
return "{\"code\":500,\"msg\":\"校验失败\"}";
|
||||
|
||||
var out_product_ids = RegexUtils.GetStringQuery(ref inputData, "out_product_ids")?.Replace("'", "\\'");
|
||||
out_product_ids = string.Join("','", out_product_ids.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = @"
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT oi.id,oi.shop_id,oi.order_id,oi.product_id,oi.sku_id,oi.sku_cnt,oi.sku_code,oi.out_product_id,oi.out_sku_id,
|
||||
ROW_NUMBER() OVER (PARTITION BY out_product_id, out_sku_id ORDER BY id DESC) as rn,o.out_amount,o.create_time
|
||||
FROM `erp`.`oms_wei_order_item` oi
|
||||
LEFT JOIN `erp`.`oms_wei_order` o ON oi.order_id = o.order_id
|
||||
WHERE oi.out_product_id IN ('" + out_product_ids + @"') AND oi.refund_status = 1 AND o.status > 20 AND o.gift_order_status = 0
|
||||
) r
|
||||
WHERE r.rn <= 3;
|
||||
";
|
||||
|
||||
DataTable dt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
|
||||
if (dt != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<ProductLatestOutAmountInfo> prodOutAmountList = new List<ProductLatestOutAmountInfo>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
ProductLatestOutAmountInfo prodOutAmount = new ProductLatestOutAmountInfo
|
||||
{
|
||||
order_id = row["order_id"].ParseToString(),
|
||||
out_product_id = row["out_product_id"].ParseToString(),
|
||||
out_sku_id = row["out_sku_id"].ParseToString(),
|
||||
product_id = row["product_id"].ParseToString(),
|
||||
shop_id = row["shop_id"].ParseToString(),
|
||||
sku_cnt = row["sku_cnt"].ParseToInt(),
|
||||
sku_code = row["sku_code"].ParseToString(),
|
||||
sku_id = row["sku_id"].ParseToString(),
|
||||
out_amount = row["out_amount"].ParseToInt(),
|
||||
};
|
||||
prodOutAmountList.Add(prodOutAmount);
|
||||
}
|
||||
|
||||
var noOutAmountOrderIdLst = string.Join("','", prodOutAmountList.Where(p => p.out_amount == 0).Select(p => p.order_id));
|
||||
conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
mySql = new MysqlUtils(conn);
|
||||
sql = @"
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT id,order_no,order_sku_id,out_amount,ROW_NUMBER() OVER (PARTITION BY order_no ORDER BY id DESC) as rn
|
||||
FROM `erp`.`oms_wei_external_procurement_log`
|
||||
WHERE order_no IN ('" + noOutAmountOrderIdLst + @"')
|
||||
) oi
|
||||
WHERE oi.rn = 1;";
|
||||
DataTable transitDt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
if (mySql.Message.IsNullOrEmpty() && transitDt != null)
|
||||
{
|
||||
foreach (DataRow row in transitDt.Rows)
|
||||
{
|
||||
var outAmount = row["out_amount"].ParseToInt();
|
||||
var order_sku_id = row["order_sku_id"].ParseToString();
|
||||
var order_no = row["order_no"].ParseToString();
|
||||
if (prodOutAmountList.FirstOrDefault(p => p.sku_id == order_sku_id && p.order_id == order_no) is ProductLatestOutAmountInfo outAmountInfo)
|
||||
{
|
||||
if (outAmountInfo.out_amount == 0 && outAmount != 0)
|
||||
outAmountInfo.out_amount = outAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
||||
var data = JsonUtils.SerializeObjectToString(prodOutAmountList, jsonSetting);
|
||||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"seconds\":" + seconds + "}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string WXGetPDDProductGroups(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
@@ -155,6 +155,7 @@
|
||||
<Compile Include="Model\WxModel\order_item_ext.cs" />
|
||||
<Compile Include="Model\WxModel\order_pdd_buyer_after_sale.cs" />
|
||||
<Compile Include="Model\WxModel\order_pdd_buyer_order.cs" />
|
||||
<Compile Include="Model\WxModel\ProductLatestOutAmountInfo.cs" />
|
||||
<Compile Include="Model\WxModel\user_operate_task_status_info.cs" />
|
||||
<Compile Include="Model\WxModel\user_payment_record_info.cs" />
|
||||
<Compile Include="Model\WxModel\user_points_record_info.cs" />
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace KJD_Web.Model.WxModel
|
||||
{
|
||||
public class ProductLatestOutAmountInfo
|
||||
{
|
||||
public string order_id { get; set; } // 3739003536152355584
|
||||
|
||||
public string out_product_id { get; set; } // EC1960398929745-15938489009A
|
||||
public string out_sku_id { get; set; } // BSEC18052272175281198712A
|
||||
public int sku_cnt { get; set; } // 1
|
||||
|
||||
/// <summary>
|
||||
/// 外采金额,单位分
|
||||
/// </summary>
|
||||
public int out_amount { get; set; } // 1129
|
||||
|
||||
public string shop_id { get; set; } // 1960967267443629494
|
||||
public string product_id { get; set; } // 10001456670425
|
||||
public string sku_id { get; set; } // 26988803933
|
||||
public string sku_code { get; set; } // BSEC18052272175281198712A
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ namespace KJD_Web
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_hot_detail_product_list()
|
||||
public void get_hot_product_detail_list()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
@@ -99,6 +99,19 @@ namespace KJD_Web
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public void wx_get_product_latest_buy_amount_list()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXProductManage().WXGetProductLatestBuyAmountList(jsontext, true);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public void get_pdd_product_list_random()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user