待上传列表查询 批量上传到草稿箱功能
This commit is contained in:
1 parent
f2135af339
commit
13f536e840
31 files changed
+3881
-635
No files matched your search
@@ -1,6 +1,7 @@
|
||||
using KJD_Web.Model;
|
||||
using KJD_Web.Utils;
|
||||
using MySql.Data.MySqlClient;
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -62,12 +63,11 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string GetProductList(string inputData, bool isAdmin = false)
|
||||
public string GetProductList(string inputData, bool isDetail = false)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var time = 0;
|
||||
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":20000,\"msg\":\"校验失败\"}";
|
||||
@@ -80,14 +80,10 @@ namespace KJD_Web.BLL
|
||||
var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'");
|
||||
var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'");
|
||||
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
|
||||
var s_page = RegexUtils.GetStringQuery(ref inputData, "page");
|
||||
int page = 0;
|
||||
int.TryParse(s_page, out page);
|
||||
var s_page_size = RegexUtils.GetStringQuery(ref inputData, "page_size");
|
||||
int page_size;
|
||||
int.TryParse(s_page_size, out page_size);
|
||||
if (page_size == 0)
|
||||
page_size = 50;
|
||||
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
@@ -105,6 +101,8 @@ namespace KJD_Web.BLL
|
||||
sql += " and product_name like '%" + search_prod_name + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_notes))
|
||||
sql += " and notes like '%" + search_notes + "%'";
|
||||
if (!string.IsNullOrEmpty(search_db_ids))
|
||||
sql += " and id in (" + search_db_ids + ")";
|
||||
var count = mySql.ExecuteRowCount(sql);
|
||||
|
||||
DataTable dt;
|
||||
@@ -114,7 +112,11 @@ namespace KJD_Web.BLL
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "select id,spu_id,skc_id,cat_id,cat_name,ext_code,product_name,main_img,notes,add_time,mdy_time from kjd.product where 1=1";
|
||||
if (isDetail)
|
||||
sql = "select * from kjd.product where 1=1";
|
||||
else
|
||||
sql = "select id,spu_id,skc_id,cat_id,cat_name,ext_code,product_name,main_img,notes,add_time,mdy_time from kjd.product where 1=1";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(search_spu))
|
||||
sql += " and spu_id like '%" + search_spu + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_skc))
|
||||
@@ -127,6 +129,8 @@ namespace KJD_Web.BLL
|
||||
sql += " and product_name like '%" + search_prod_name + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_notes))
|
||||
sql += " and notes like '%" + search_notes + "%'";
|
||||
if (!string.IsNullOrEmpty(search_db_ids))
|
||||
sql += " and id in (" + search_db_ids + ")";
|
||||
sql += " order by id desc";
|
||||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
dt = mySql.ExecuteDataTable(sql);
|
||||
@@ -156,6 +160,11 @@ namespace KJD_Web.BLL
|
||||
mdy_time = Convert.ToDateTime(row["mdy_time"]),
|
||||
notes = row["notes"].ToString(),
|
||||
};
|
||||
if (isDetail)
|
||||
{
|
||||
prod.product_json = row["product_json"].ToString();
|
||||
prod.size_json = row["size_json"].ToString();
|
||||
}
|
||||
productLst.Add(prod);
|
||||
}
|
||||
var data = JsonUtils.SerializerObjectToString(productLst);
|
||||
@@ -163,12 +172,12 @@ namespace KJD_Web.BLL
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
@@ -178,8 +187,7 @@ namespace KJD_Web.BLL
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var time = 0;
|
||||
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":20000,\"msg\":\"校验失败\"}";
|
||||
@@ -208,8 +216,7 @@ namespace KJD_Web.BLL
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var time = 0;
|
||||
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":20000,\"msg\":\"校验失败\"}";
|
||||
@@ -250,8 +257,7 @@ namespace KJD_Web.BLL
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var time = 0;
|
||||
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":20000,\"msg\":\"校验失败\"}";
|
||||
@@ -270,7 +276,7 @@ namespace KJD_Web.BLL
|
||||
}
|
||||
if (string.IsNullOrEmpty(shop_id))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"店铺信息\"}";
|
||||
return "{\"code\":500,\"msg\":\"没有店铺信息\"}";
|
||||
}
|
||||
|
||||
|
||||
@@ -294,5 +300,190 @@ namespace KJD_Web.BLL
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string MdyUserSelectProductStatus(string inputData, bool isAdmin = false)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":20000,\"msg\":\"校验失败\"}";
|
||||
|
||||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
|
||||
var draft_id = RegexUtils.GetStringQuery(ref inputData, "draft_id");
|
||||
var status = RegexUtils.GetStringQuery(ref inputData, "status");
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "update kjd.product_select set";
|
||||
if (draft_id != null)
|
||||
sql += " draft_id='" + draft_id + "',";
|
||||
if (status != null)
|
||||
sql += " status='" + status + "',";
|
||||
sql += " mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " where id=" + id + ";";
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
if (rst)
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string GetUserSelectProductList(string inputData, bool isAdmin = false)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":20000,\"msg\":\"校验失败\"}";
|
||||
|
||||
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||||
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "\\'");
|
||||
var search_shop_id = RegexUtils.GetStringQuery(ref inputData, "search_shop_id")?.Replace("'", "\\'");
|
||||
var search_shop_account = RegexUtils.GetStringQuery(ref inputData, "search_shop_account")?.Replace("'", "\\'");
|
||||
var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'");
|
||||
var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.Replace("'", "\\'");
|
||||
var search_cat = RegexUtils.GetStringQuery(ref inputData, "search_cat")?.Replace("'", "\\'");
|
||||
var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'");
|
||||
var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'");
|
||||
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
|
||||
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
|
||||
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "select count(s.id) from kjd.product_select s left join kjd.product p on s.out_product_id=p.id" +
|
||||
" where 1=1";
|
||||
if (!isAdmin)
|
||||
sql += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
|
||||
if (!string.IsNullOrEmpty(search_db_ids))
|
||||
sql += " and s.id in (" + search_db_ids + ")";
|
||||
if (!string.IsNullOrEmpty(shop_ids))
|
||||
sql += " and s.shop_id in (" + shop_ids + ")";
|
||||
if (!string.IsNullOrWhiteSpace(status))
|
||||
sql += " and s.status = '" + status + "'";
|
||||
if (!string.IsNullOrWhiteSpace(search_shop_id))
|
||||
sql += " and s.shop_id like '%" + search_shop_id + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_shop_account))
|
||||
sql += " and s.shop_account like '%" + search_shop_account + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_notes))
|
||||
sql += " and s.notes like '%" + search_notes + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_spu))
|
||||
sql += " and p.spu_id like '%" + search_spu + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_skc))
|
||||
sql += " and p.skc_id like '%" + search_skc + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_cat))
|
||||
sql += " and p.cat_name like '%" + search_cat + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_ext_code))
|
||||
sql += " and p.ext_code like '%" + search_ext_code + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_prod_name))
|
||||
sql += " and p.product_name like '%" + search_prod_name + "%'";
|
||||
var count = mySql.ExecuteRowCount(sql);
|
||||
|
||||
DataTable dt;
|
||||
if (count == 0)
|
||||
{
|
||||
dt = new DataTable();
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (isDetail)
|
||||
//sql = "select * from kjd.product_select where 1=1";
|
||||
//else
|
||||
sql = "select s.id,s.out_product_id,s.shop_id,s.shop_account,s.user_name," +
|
||||
"s.sub_user_name,s.notes,s.status,s.draft_id,s.add_time,s.mdy_time," +
|
||||
"p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img " +
|
||||
"from kjd.product_select s left join kjd.product p on s.out_product_id=p.id where 1=1";
|
||||
if (!isAdmin)
|
||||
sql += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
|
||||
if (!string.IsNullOrEmpty(search_db_ids))
|
||||
sql += " and s.id in (" + search_db_ids + ")";
|
||||
if (!string.IsNullOrEmpty(shop_ids))
|
||||
sql += " and s.shop_id in (" + shop_ids + ")";
|
||||
if (!string.IsNullOrWhiteSpace(status))
|
||||
sql += " and s.status = '" + status + "'";
|
||||
if (!string.IsNullOrWhiteSpace(search_shop_id))
|
||||
sql += " and s.shop_id like '%" + search_shop_id + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_shop_account))
|
||||
sql += " and s.shop_account like '%" + search_shop_account + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_notes))
|
||||
sql += " and s.notes like '%" + search_notes + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_spu))
|
||||
sql += " and p.spu_id like '%" + search_spu + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_skc))
|
||||
sql += " and p.skc_id like '%" + search_skc + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_cat))
|
||||
sql += " and p.cat_name like '%" + search_cat + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_ext_code))
|
||||
sql += " and p.ext_code like '%" + search_ext_code + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_prod_name))
|
||||
sql += " and p.product_name like '%" + search_prod_name + "%'";
|
||||
sql += " order by id desc";
|
||||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
dt = mySql.ExecuteDataTable(sql);
|
||||
}
|
||||
|
||||
mySql.Close();
|
||||
if (dt != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<ProductSelectResultParam> productLst = new List<ProductSelectResultParam>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
ProductSelectResultParam prodSelect = new ProductSelectResultParam()
|
||||
{
|
||||
id = row["id"].ParseToInt(),
|
||||
out_product_Id = row["out_product_Id"].ParseToString(),
|
||||
shop_account = row["shop_account"].ParseToString(),
|
||||
shop_id = row["shop_id"].ParseToString(),
|
||||
status = row["status"].ParseToString(),
|
||||
sub_user_name = row["sub_user_name"].ParseToString(),
|
||||
user_name = row["user_name"].ParseToString(),
|
||||
cat_id = row["cat_id"].ParseToString(),
|
||||
cat_name = row["cat_name"].ParseToString(),
|
||||
product_name = row["product_name"].ParseToString(),
|
||||
main_img = row["main_img"].ParseToString(),
|
||||
ext_code = row["ext_code"].ParseToString(),
|
||||
add_time = Convert.ToDateTime(row["add_time"]),
|
||||
mdy_time = Convert.ToDateTime(row["mdy_time"]),
|
||||
notes = row["notes"].ParseToString(),
|
||||
draft_id = row["draft_id"].ParseToString(),
|
||||
skc_id = row["skc_id"].ToString(),
|
||||
spu_id = row["spu_id"].ToString(),
|
||||
//product_json = row["product_json"].ToString(),
|
||||
//size_json = row["size_json"].ToString(),
|
||||
};
|
||||
productLst.Add(prodSelect);
|
||||
}
|
||||
var data = JsonUtils.SerializerObjectToString(productLst);
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
|
||||
}
|
||||
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\":\"输入为空\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user