From 7530b82e64eee79b8bec0294733737991750cd16 Mon Sep 17 00:00:00 2001 From: feng <279202647@qq.com> Date: Mon, 16 May 2022 22:09:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=BB=9F=E8=AE=A1=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HuiYan/teamitemsController.cs | 15 +++ .../HuiYan/teamitemsBusiness.cs | 107 ++++++++++++++++++ src/Coldairarrow.Entity/DTO/TaskInfoDto.cs | 53 +++++++++ .../HuiYan/pricetasklog.cs | 4 + src/Coldairarrow.Entity/HuiYan/teamitems.cs | 10 ++ .../HuiYan/IteamitemsBusiness.cs | 3 + .../UserControls/ItemControl.xaml.cs | 5 + .../vuepage/client/src/api/http.js | 2 +- .../vuepage/client/src/router/index.js | 6 + .../vuepage/client/src/views/info/Index.vue | 58 ++++++++++ .../vuepage/client/src/views/items/Index.vue | 22 +++- .../client/src/views/pricetask/Index.vue | 20 ++++ 12 files changed, 303 insertions(+), 2 deletions(-) create mode 100644 src/Coldairarrow.Entity/DTO/TaskInfoDto.cs create mode 100644 客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/info/Index.vue diff --git a/src/Coldairarrow.Api/Controllers/HuiYan/teamitemsController.cs b/src/Coldairarrow.Api/Controllers/HuiYan/teamitemsController.cs index fd4ee64..98920b0 100644 --- a/src/Coldairarrow.Api/Controllers/HuiYan/teamitemsController.cs +++ b/src/Coldairarrow.Api/Controllers/HuiYan/teamitemsController.cs @@ -4,6 +4,7 @@ using Coldairarrow.Entity.HuiYan; using Coldairarrow.Util; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -114,5 +115,19 @@ namespace Coldairarrow.Api.Controllers.HuiYan { return _teamitemsBus.GetTeamCount(); } + + + /// + /// 获取比价统计信息 + /// + /// + /// + /// + /// + [HttpGet] + public Task GetMyTaskInfo(int type, DateTime start, DateTime end) + { + return _teamitemsBus.GetMyTaskInfo(type, start, end); + } } } \ No newline at end of file diff --git a/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs b/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs index 1655616..30ac307 100644 --- a/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs +++ b/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs @@ -255,6 +255,57 @@ namespace Coldairarrow.Business.HuiYan return Error("操作失败!"); } + public async Task GetMyTaskInfo(int type,DateTime start,DateTime end) + { + Expression> select = (a, b) => new TaskInfoDto + { + IsPass = b.IsQualified==true, + TeamId = b.TeamId, + TeamUserId = b.UserId, + TeamDate = b.CreateTime, + TeamOverDate = b.UpdateDate + }; + + select = select.BuildExtendSelectExpre(); + + + var q_titem = Db.GetIQueryable(); + var q = from a in q_titem.AsExpandable() + join b in Db.GetIQueryable() on a.Id equals b.TeamItemId into ab + from b in ab.DefaultIfEmpty() + select @select.Invoke(b, a); + + var where = LinqHelper.True(); + + where = where.And(c => c.CreateTime >= start && c.CreateTime <= end); + + //团队 + if (type == 0) + { + where = where.And(c => c.TeamId == _operator.TeamId); + } + //比价 + else + { + where = where.And(c => c.UserId == _operator.UserId); + } + + var list = await q.Where(where).ToListAsync(); + + var model = new PriceTaskInfo() + { + AuditCount = list.Count(c => c.State == PriceTaskState.已比价), + OverCount = list.Count(c => c.State == PriceTaskState.比价完成), + PassCount = list.Count(c => c.IsPass), + PublishCount = list.Count + }; + + if (list.Count > 0) { + model.PassRate = Math.Round(((decimal)model.PassCount / list.Count) * 100, 2); + } + return model; + } + public AjaxResult SetState(string id, int state) { @@ -271,6 +322,14 @@ namespace Coldairarrow.Business.HuiYan int row = Db.Update(c => c.Id == id, (item) => { item.State = state; + if ((Entity.Enum.TeamItemState)state == TeamItemState.精选) + { + //完成日期 + item.UpdateDate = DateTime.Now; + + //判断是否合格 + item.IsQualified = CheckIsPass(item); + } }); if (row <= 0) @@ -313,6 +372,54 @@ namespace Coldairarrow.Business.HuiYan return Error("操作失败!"); } + /// + /// 检测是否合格 + /// + /// + private bool CheckIsPass(teamitems item) + { + decimal profits = 0; + var extList= Newtonsoft.Json.JsonConvert.DeserializeObject>(item.ExtensionJson); + + var ex= extList.OrderByDescending(c => c.Profits).FirstOrDefault(); + + if (ex == null) + return false; + //利润率 + profits = ex.Profits; + + //竞品客单为50元以下,利润率达80% + if (item.RivalPrice < 50) + { + return profits >= 80; + } + + //竞品客单为50-100元,利润率达70% + if (item.RivalPrice >= 50&&item.RivalPrice<100) + { + return profits >= 70; + } + + //竞品客单为100-150元,利润率达60% + if (item.RivalPrice >= 100 && item.RivalPrice < 150) + { + return profits >= 60; + } + + //竞品客单为150-300元,利润率达50% + if (item.RivalPrice >= 150 && item.RivalPrice < 300) + { + return profits >= 50; + } + + //竞品客单为300元以上,利润率达40% + if (item.RivalPrice >= 300) + { + return profits >= 40; + } + + return false; + } public AjaxResult DeleteItem(string id) { diff --git a/src/Coldairarrow.Entity/DTO/TaskInfoDto.cs b/src/Coldairarrow.Entity/DTO/TaskInfoDto.cs new file mode 100644 index 0000000..8785613 --- /dev/null +++ b/src/Coldairarrow.Entity/DTO/TaskInfoDto.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Coldairarrow.Entity.DTO +{ + public class TaskInfoDto:HuiYan.pricetasklog + { + /// + /// 是否通过 + /// + public bool IsPass { get; set; } + + public string TeamId { get; set; } + + public string TeamUserId { get; set; } + + public DateTime? TeamDate { get; set; } + + public DateTime? TeamOverDate { get; set; } + } + + + public class PriceTaskInfo + { + /// + /// 待审核任务数量 + /// + public int AuditCount { get; set; } + + /// + /// 完成任务数量 + /// + public int OverCount { get; set; } + + /// + /// 合格任务数量 + /// + public int PassCount { get; set; } + + /// + /// 发布任务数 + /// + public int PublishCount { get; set; } + + /// + /// 合格率 + /// + public decimal PassRate { get; set; } + } +} diff --git a/src/Coldairarrow.Entity/HuiYan/pricetasklog.cs b/src/Coldairarrow.Entity/HuiYan/pricetasklog.cs index af5841e..449616a 100644 --- a/src/Coldairarrow.Entity/HuiYan/pricetasklog.cs +++ b/src/Coldairarrow.Entity/HuiYan/pricetasklog.cs @@ -53,5 +53,9 @@ namespace Coldairarrow.Entity.HuiYan /// public PriceTaskState State { get; set; } + /// + /// 审核提交时间,超过24小时将自动完成 + /// + public DateTime? WorkDate { get; set; } } } \ No newline at end of file diff --git a/src/Coldairarrow.Entity/HuiYan/teamitems.cs b/src/Coldairarrow.Entity/HuiYan/teamitems.cs index 657aa94..e405f10 100644 --- a/src/Coldairarrow.Entity/HuiYan/teamitems.cs +++ b/src/Coldairarrow.Entity/HuiYan/teamitems.cs @@ -115,5 +115,15 @@ namespace Coldairarrow.Entity.HuiYan /// 品类词ID /// public string CatId { get; set; } + + /// + /// 是否合格 + /// + public bool? IsQualified { get; set; } + + /// + /// 完成时间 + /// + public DateTime? UpdateDate { get; set; } } } \ No newline at end of file diff --git a/src/Coldairarrow.IBusiness/HuiYan/IteamitemsBusiness.cs b/src/Coldairarrow.IBusiness/HuiYan/IteamitemsBusiness.cs index 9d1f5e3..cee474c 100644 --- a/src/Coldairarrow.IBusiness/HuiYan/IteamitemsBusiness.cs +++ b/src/Coldairarrow.IBusiness/HuiYan/IteamitemsBusiness.cs @@ -1,6 +1,7 @@ using Coldairarrow.Entity.DTO; using Coldairarrow.Entity.HuiYan; using Coldairarrow.Util; +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -22,5 +23,7 @@ namespace Coldairarrow.Business.HuiYan AjaxResult SetItem(TeamitemDto model); AjaxResult SetState(string id, int state); AjaxResult GetTeamCount(); + + Task GetMyTaskInfo(int type, DateTime start, DateTime end); } } \ No newline at end of file diff --git a/客户端/齐越慧眼/齐越慧眼/UserControls/ItemControl.xaml.cs b/客户端/齐越慧眼/齐越慧眼/UserControls/ItemControl.xaml.cs index c12a151..a2377ad 100644 --- a/客户端/齐越慧眼/齐越慧眼/UserControls/ItemControl.xaml.cs +++ b/客户端/齐越慧眼/齐越慧眼/UserControls/ItemControl.xaml.cs @@ -103,6 +103,11 @@ namespace 齐越慧眼.UserControls return ApiHelper.JwtToken; } + public bool getType() + { + return App.IsPriceTaskUser; + } + public string getItemInfoByUrl(string url) { // https://item.jd.com/10030884795783.html diff --git a/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/api/http.js b/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/api/http.js index f41313c..c0b0c71 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) => { diff --git a/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/router/index.js b/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/router/index.js index 3dbf47e..a23d97e 100644 --- a/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/router/index.js +++ b/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/router/index.js @@ -3,6 +3,7 @@ import VueRouter from 'vue-router' import Home from '../views/cats/Index.vue' import Items from '../views/items/Index.vue' import PriceTask from '../views/pricetask/Index.vue' +import Info from '../views/info/Index.vue' Vue.use(VueRouter) @@ -21,6 +22,11 @@ const routes = [ path: '/task', name: 'task', component: PriceTask + }, + { + path: '/info', + name: 'info', + component: Info } ] diff --git a/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/info/Index.vue b/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/info/Index.vue new file mode 100644 index 0000000..d0dd4e4 --- /dev/null +++ b/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/info/Index.vue @@ -0,0 +1,58 @@ + + + diff --git a/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/items/Index.vue b/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/items/Index.vue index 91ac4ff..8775f02 100644 --- a/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/items/Index.vue +++ b/客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/items/Index.vue @@ -366,7 +366,7 @@
- {{ + {{ item.Title }}
@@ -398,6 +398,26 @@ + + + + 阿里巴巴 + + + 京东 + + + + 竞品图搜款 + + + + + + + + 阿里巴巴 + + + 京东 + + + + 竞品图搜款 + +