订单服务端相关功能

This commit is contained in:
wule committed 2026-06-22 21:54:34 +08:00
1 parent b064af6379
commit 257262517b
6 files changed
+285 -2

No files matched your search

@@ -137,6 +137,7 @@ namespace KJD_Web.BLL.WXXD
postal_code = row["postal_code"].ParseToString(),
predict_commission_fee = row["predict_commission_fee"].ParseToNullableInt(),
product_price = row["product_price"].ParseToNullableInt(),
profit = row["profit"].ParseToNullableInt(),
province_name = row["province_name"].ParseToString(),
purchase_price = row["purchase_price"].ParseToNullableInt(),
purchase_status = row["purchase_status"].ParseToNullableInt(),
@@ -275,7 +276,7 @@ namespace KJD_Web.BLL.WXXD
refund_status = row["refund_status"].ParseToNullableInt(),
return_address = row["return_address"].ParseToString(),
sale_price = row["sale_price"].ParseToNullableInt(),
sku_attrs = row["sale_price"].ParseToString(),
sku_attrs = row["sku_attrs"].ParseToString(),
sku_cnt = row["sku_cnt"].ParseToNullableInt(),
sku_code = row["sku_code"].ParseToString(),
sku_deliver_info = row["sku_deliver_info"].ParseToString(),
@@ -303,5 +304,126 @@ namespace KJD_Web.BLL.WXXD
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string WXGetErpRefundList(string inputData, bool isDetail = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var timeCalc = DateTime.Now;
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var erp_order_id_in = RegexUtils.GetStringQuery(ref inputData, "erp_order_id_in")?.Replace("'", "\\'");
if (erp_order_id_in.IsNullOrEmpty())
{
return "{\"code\":500,\"msg\":\"未指定订单\"}";
}
var sort_type = RegexUtils.GetStringQuery(ref inputData, "sort_type")?.Replace("'", "\\'");
var is_not_count = RegexUtils.GetStringQuery(ref inputData, "is_not_count") != "false";
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(500);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT COUNT(id) FROM erp.oms_wei_refund o WHERE 1=1 ";
string where = "";
if (!string.IsNullOrWhiteSpace(erp_order_id_in))
where += " and o.order_id in ('" + erp_order_id_in.Replace(",", "','") + "')";
sql += where;
var count = 0;
if (!is_not_count)
count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0 && !is_not_count)
{
dt = new DataTable();
}
else
{
sql = "SELECT o.* FROM" +
" erp.oms_wei_refund o " +
" WHERE 1=1";
//where子句
sql += where;
if (sort_type == "asc")
sql += " ORDER BY o.id ASC";
else
sql += " ORDER BY o.id DESC";
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<oms_wei_refund> refundItemList = new List<oms_wei_refund>();
foreach (DataRow row in dt.Rows)
{
oms_wei_refund order = new oms_wei_refund
{
id = row["id"].ParseToLong(),
merchant_id = row["merchant_id"].ParseToLong(),
order_id = row["order_id"].ParseToString(),
shop_id = row["shop_id"].ParseToLong(),
erp_goods_id = row["erp_goods_id"].ParseToNullableLong(),
erp_goods_sku_id = row["erp_goods_sku_id"].ParseToNullableLong(),
product_id = row["product_id"].ParseToString(),
sku_id = row["sku_id"].ParseToString(),
after_sale_order_id = row["after_sale_order_id"].ParseToString(),
complaint_id = row["complaint_id"].ParseToString(),
count = row["count"].ParseToNullableInt(),
create_time = row["create_time"].ParseToNullableInt(),
details = row["details"].ParseToString(),
fast_refund = row["fast_refund"].ParseToString(),
merchant_upload_info = row["merchant_upload_info"].ParseToString(),
openid = row["openid"].ParseToString(),
pull_status = row["pull_status"].ParseToNullableInt(),
pull_time = row["pull_time"].ParseToString().ParseToDateTime(),
reason = row["reason"].ParseToString(),
reason_text = row["reason_text"].ParseToString(),
refund_amount = row["refund_amount"].ParseToNullableInt(),
refund_reason = row["refund_reason"].ParseToNullableInt(),
refund_resp = row["refund_resp"].ParseToString(),
return_delivery_id = row["return_delivery_id"].ParseToString(),
return_delivery_name = row["return_delivery_name"].ParseToString(),
return_waybill_id = row["return_waybill_id"].ParseToString(),
status = row["status"].ParseToString(),
type = row["type"].ParseToString(),
unionid = row["unionid"].ParseToString(),
update_time = row["update_time"].ParseToNullableInt(),
warehouse_status = row["warehouse_status"].ParseToNullableInt(),
};
refundItemList.Add(order);
}
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var data = JsonUtils.SerializeObjectToString(refundItemList, jsonSetting);
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"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\":\"输入为空\"}";
}
}
}