From a02391fc9182bf6652f6fff925a23a2012155050 Mon Sep 17 00:00:00 2001 From: feng <279202647@qq.com> Date: Sat, 14 May 2022 22:03:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=93=81=E7=B1=BB=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HuiYan/itemlabelsBusiness.cs | 3 +- .../HuiYan/pricetasklogBusiness.cs | 2 - .../HuiYan/teamitemsBusiness.cs | 94 +++++++++++-------- src/Coldairarrow.Entity/DTO/ItemLabelDto.cs | 3 +- src/Coldairarrow.Entity/DTO/TeamitemDto.cs | 5 + src/Coldairarrow.Entity/HuiYan/teamitems.cs | 4 + .../齐越慧眼/Models/ItemLabelDto.cs | 2 + .../UserControls/BrowerControl.xaml.cs | 9 +- .../vuepage/client/src/api/http.js | 2 +- 9 files changed, 76 insertions(+), 48 deletions(-) diff --git a/src/Coldairarrow.Business/HuiYan/itemlabelsBusiness.cs b/src/Coldairarrow.Business/HuiYan/itemlabelsBusiness.cs index ccce236..7038e48 100644 --- a/src/Coldairarrow.Business/HuiYan/itemlabelsBusiness.cs +++ b/src/Coldairarrow.Business/HuiYan/itemlabelsBusiness.cs @@ -275,7 +275,8 @@ namespace Coldairarrow.Business.HuiYan Platform = item.Platform, Sales = model.Sales, Title = model.Title, - GoodsUrl=item.GoodsUrl + GoodsUrl=item.GoodsUrl, + CatId=model.CatId }).Success) { throw new Exception("添加产品库失败!"); diff --git a/src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs b/src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs index b4ab370..2054e50 100644 --- a/src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs +++ b/src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs @@ -166,7 +166,6 @@ namespace Coldairarrow.Business.HuiYan teamItemList.ForEach(teamItem => { - var user = userList.Where(c => c.Count < c.MaxCount).OrderBy(c => c.Count).FirstOrDefault(); if (user == null) @@ -178,7 +177,6 @@ namespace Coldairarrow.Business.HuiYan user.Count += 1; - pricetasklogs.Add(new pricetasklog() { CreateTime = DateTime.Now, diff --git a/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs b/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs index 0c8fad1..1655616 100644 --- a/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs +++ b/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs @@ -79,54 +79,70 @@ namespace Coldairarrow.Business.HuiYan public PageResult GetItems(PageInput input, string keyWord) { - Expression> select = (a, b) => new TeamitemDto + try { - GoodsId = b.GoodsId, - HasFilter = b.HasFilter, - Platform = b.Platform, - GoodsUrl = b.GoodsUrl, - Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject>(a.ExtensionJson) - }; - - var search = input.Search; - select = select.BuildExtendSelectExpre(); - - var q_titem = GetIQueryable(); - var q = from a in q_titem.AsExpandable() - join b in Db.GetIQueryable() on a.ItemId equals b.Id into ab - from b in ab.DefaultIfEmpty() - select @select.Invoke(a, b); - - int state = int.Parse(search.Keyword); - - //查询对应状态 - var where = LinqHelper.True(); - if (state == 0) - { - where = where.And(c => c.State == state || c.State == (int)TeamItemState.已发布比价); - } - else { - if (state == 6) + Expression> select = (a, b, c) => new TeamitemDto { - where = where.And(c => c.State == state || c.State == (int)TeamItemState.待修改); - } - else + GoodsId = b.GoodsId, + HasFilter = b.HasFilter, + Platform = b.Platform, + GoodsUrl = b.GoodsUrl, + CatName = c == null ? String.Empty : c.Name, + Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject>(a.ExtensionJson) + }; + + var search = input.Search; + select = select.BuildExtendSelectExpre(); + + var q_titem = GetIQueryable(); + var q = from a in q_titem.AsExpandable() + join b in Db.GetIQueryable() on a.ItemId equals b.Id into ab + from b in ab.DefaultIfEmpty() + join c in Db.GetIQueryable() on a.CatId equals c.Id into bc + from c in bc.DefaultIfEmpty() + select @select.Invoke(a, b, c); + + int state = 0; + bool searchState= int.TryParse(search.Keyword, out state); + + //查询对应状态 + var where = LinqHelper.True(); + + if (searchState) { - where = where.And(c => c.State == state); + if (state == 0) + { + where = where.And(c => c.State == state || c.State == (int)TeamItemState.已发布比价); + } + else + { + if (state == 6) + { + where = where.And(c => c.State == state || c.State == (int)TeamItemState.待修改); + } + else + { + where = where.And(c => c.State == state); + } + } } - } - where = where.AndIf(!string.IsNullOrEmpty(keyWord), d => d.Title.Contains(keyWord)); + where = where.AndIf(!string.IsNullOrEmpty(keyWord), d => string.IsNullOrEmpty(d.CatName) ? true : d.CatName.Contains(keyWord)); - where = where.And(c => c.TeamId == _operator.TeamId); + where = where.And(c => c.TeamId == _operator.TeamId); - input.SortField = "CreateTime"; - input.SortType = "desc"; + input.SortField = "CreateTime"; + input.SortType = "desc"; - var list = q.Where(where).GetPageResultAsync(input).Result; + var list = q.Where(where).GetPageResultAsync(input).Result; - return list; + return list; + } + catch (Exception ex) + { + throw new Exception(ex.StackTrace); + } } @@ -194,7 +210,7 @@ namespace Coldairarrow.Business.HuiYan ItemImg = model.ItemImg, Sales = model.Sales, Title = model.Title, - + CatId=model.CatId, ItemId = model.ItemId }); diff --git a/src/Coldairarrow.Entity/DTO/ItemLabelDto.cs b/src/Coldairarrow.Entity/DTO/ItemLabelDto.cs index 49e6924..55b42a1 100644 --- a/src/Coldairarrow.Entity/DTO/ItemLabelDto.cs +++ b/src/Coldairarrow.Entity/DTO/ItemLabelDto.cs @@ -17,8 +17,7 @@ namespace Coldairarrow.Entity.DTO public string Sales { get; set; } public string Img { get; set; } - - + public string CatId { get; set; } /// /// 标签状态 /// diff --git a/src/Coldairarrow.Entity/DTO/TeamitemDto.cs b/src/Coldairarrow.Entity/DTO/TeamitemDto.cs index eb39ca8..d716819 100644 --- a/src/Coldairarrow.Entity/DTO/TeamitemDto.cs +++ b/src/Coldairarrow.Entity/DTO/TeamitemDto.cs @@ -35,6 +35,11 @@ namespace Coldairarrow.Entity.DTO /// public int? PriceTaskState { get; set; } + /// + /// 品类词名称 + /// + public string CatName { get; set; } + /// /// 扩展信息 /// diff --git a/src/Coldairarrow.Entity/HuiYan/teamitems.cs b/src/Coldairarrow.Entity/HuiYan/teamitems.cs index b674aea..657aa94 100644 --- a/src/Coldairarrow.Entity/HuiYan/teamitems.cs +++ b/src/Coldairarrow.Entity/HuiYan/teamitems.cs @@ -111,5 +111,9 @@ namespace Coldairarrow.Entity.HuiYan /// 接比价任务的用户ID /// public string PriceTaskUserId { get; set; } + /// + /// 品类词ID + /// + public string CatId { get; set; } } } \ No newline at end of file diff --git a/客户端/齐越慧眼/齐越慧眼/Models/ItemLabelDto.cs b/客户端/齐越慧眼/齐越慧眼/Models/ItemLabelDto.cs index ff55b05..21adec5 100644 --- a/客户端/齐越慧眼/齐越慧眼/Models/ItemLabelDto.cs +++ b/客户端/齐越慧眼/齐越慧眼/Models/ItemLabelDto.cs @@ -16,6 +16,8 @@ namespace 齐越慧眼.Models public string Img { get; set; } + public string CatId { get; set; } + /// /// 标签状态 /// diff --git a/客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs b/客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs index 45a19f4..c2aeaf4 100644 --- a/客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs +++ b/客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs @@ -926,7 +926,8 @@ namespace 齐越慧眼.UserControls Price = Convert.ToDecimal(price), Sales = sales, Status = (ItemLabelStatus)type, - Title = title + Title = title, + CatId=MainWindow.Main.LastKeyWord }); if (result.isOk) @@ -1027,7 +1028,8 @@ namespace 齐越慧眼.UserControls Price = Convert.ToDecimal(price), Sales = sales, Status = (ItemLabelStatus)type, - Title = title + Title = title, + CatId = MainWindow.Main.LastKeyWord }); if (result.isOk) @@ -1161,7 +1163,8 @@ namespace 齐越慧眼.UserControls Price = Convert.ToDecimal(price), Sales = sales, Status = (ItemLabelStatus)type, - Title = title + Title = title, + CatId = MainWindow.Main.LastKeyWord }); if (result.isOk) diff --git a/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/api/http.js b/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/api/http.js index b599bd8..7361755 100644 --- a/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/api/http.js +++ b/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/api/http.js @@ -19,7 +19,7 @@ else if (process.env.NODE_ENV == 'production') { let ipAddress = axios.defaults.baseURL; -axios.defaults.baseURL = 'http://localhost:5000/'; +//axios.defaults.baseURL = 'http://localhost:5000/'; //axios.defaults.baseURL = 'http://hyapi.qiyue666.com/'; axios.interceptors.request.use((config) => {