From 34e8101b8c18d3846cf3907d35c5f550b6c22fa8 Mon Sep 17 00:00:00 2001 From: Abbh1 <86962549+Abbh1@users.noreply.github.com> Date: Fri, 24 Nov 2023 22:54:32 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=AE=8C=E5=96=84=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TableDatas/TableDataApiDto.cs | 13 +- .../CustomerFollows/CustomerFollowDto.cs | 52 ++++++ .../CustomerFollows/CustomerFollow.cs | 59 +++++++ .../TableDatas/ProductsInvolvedListApiVo.cs | 29 ++++ .../TableDatas/TableDataApiVo.cs | 2 +- .../CustomerFollows/CustomerFollowVo.cs | 49 ++++++ .../TableDataManage/TableDatas/TableDataVo.cs | 132 ++++++++-------- .../CustomerFollowRepository.cs | 20 +++ .../TableDatas/TableDataServiceApi.cs | 148 ++++++++++++++++-- .../TableDatas/ITableDataServiceApi.cs | 22 +++ .../CustomerFollows/CustomerFollowService.cs | 101 ++++++++++++ .../CustomerFollows/ICustomerFollowService.cs | 41 +++++ .../TableDatas/TableDataApiController.cs | 45 +++++- .../CustomerFollowController.cs | 98 ++++++++++++ .../TableDatas/TableDataController.cs | 2 +- 15 files changed, 724 insertions(+), 89 deletions(-) create mode 100644 ARW.Model/Dto/Business/TableDataManage/CustomerFollows/CustomerFollowDto.cs create mode 100644 ARW.Model/Models/Business/TableDataManage/CustomerFollows/CustomerFollow.cs create mode 100644 ARW.Model/Vo/Api/TableDataManage/TableDatas/ProductsInvolvedListApiVo.cs create mode 100644 ARW.Model/Vo/Business/TableDataManage/CustomerFollows/CustomerFollowVo.cs create mode 100644 ARW.Repository/Business/TableDataManage/CustomerFollows/CustomerFollowRepository.cs create mode 100644 ARW.Service/Business/BusinessService/TableDataManage/CustomerFollows/CustomerFollowService.cs create mode 100644 ARW.Service/Business/IBusinessService/TableDataManage/CustomerFollows/ICustomerFollowService.cs create mode 100644 ARW.WebApi/Controllers/Business/TableDataManage/CustomerFollows/CustomerFollowController.cs diff --git a/ARW.Model/Dto/Api/TableDataManage/TableDatas/TableDataApiDto.cs b/ARW.Model/Dto/Api/TableDataManage/TableDatas/TableDataApiDto.cs index 8559484..a86c226 100644 --- a/ARW.Model/Dto/Api/TableDataManage/TableDatas/TableDataApiDto.cs +++ b/ARW.Model/Dto/Api/TableDataManage/TableDatas/TableDataApiDto.cs @@ -15,12 +15,9 @@ namespace ARW.Model.Dto.Api.TableDataManage.TableDatas public class TableDataQueryDtoApi : PagerInfo { public string Search { get; set; } - public string TableDataProcurementContent { get; set; } - public string TableDataProcurementUnit { get; set; } - public DateTime? BeginTableDataDate { get; set; } - public DateTime? EndTableDataDate { get; set; } - public DateTime? BeginTableDataDeadline { get; set; } - public DateTime? EndTableDataDeadline { get; set; } + public int Type { get; set; } + public string Order { get; set; } + public long CustomerGuid { get; set; } } @@ -34,6 +31,10 @@ namespace ARW.Model.Dto.Api.TableDataManage.TableDatas { [Required(ErrorMessage = "TableDataId不能为空")] public int TableDataId { get; set; } + + public long TableDataGuid { get; set; } + + public long CustomerGuid { get; set; } } } diff --git a/ARW.Model/Dto/Business/TableDataManage/CustomerFollows/CustomerFollowDto.cs b/ARW.Model/Dto/Business/TableDataManage/CustomerFollows/CustomerFollowDto.cs new file mode 100644 index 0000000..b254f7b --- /dev/null +++ b/ARW.Model/Dto/Business/TableDataManage/CustomerFollows/CustomerFollowDto.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using ARW.Model.Models.Business.TableDataManage.CustomerFollows; + +namespace ARW.Model.Dto.Business.TableDataManage.CustomerFollows +{ + /// + /// 客户关注输入对象 + /// + /// @author lwh + /// @date 2023-11-24 + /// + public class CustomerFollowDto + { + + public int CustomerFollowId { get; set; } + + public long CustomerFollowGuid { get; set; } + + [Required(ErrorMessage = "客户Guid不能为空")] + public long CustomerGuid { get; set; } + + [Required(ErrorMessage = "表格数据Guid不能为空")] + public long TableDataGuid { get; set; } + + + + + + } + + + /// + /// 客户关注查询对象 + /// + /// @author lwh + /// @date 2023-11-24 + /// + public class CustomerFollowQueryDto : PagerInfo + { + public string CustomerName { get; set; } + public string CustomerPhone { get; set; } + + public string TableDataProcurementContent { get; set; } + public string ids { get; set; } + } + + + + +} diff --git a/ARW.Model/Models/Business/TableDataManage/CustomerFollows/CustomerFollow.cs b/ARW.Model/Models/Business/TableDataManage/CustomerFollows/CustomerFollow.cs new file mode 100644 index 0000000..5883aa4 --- /dev/null +++ b/ARW.Model/Models/Business/TableDataManage/CustomerFollows/CustomerFollow.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using SqlSugar; +using OfficeOpenXml.Attributes; +using Newtonsoft.Json; + +namespace ARW.Model.Models.Business.TableDataManage.CustomerFollows +{ + /// + /// 客户关注,数据实体对象 + /// + /// @author lwh + /// @date 2023-11-24 + /// + [SugarTable("tb_customer_follow")] + public class CustomerFollow : BusinessBase + { + + /// + /// 描述 : + /// 空值 : false + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "customer_follow_id")] + public int CustomerFollowId { get; set; } + + + /// + /// 描述 : + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "customer_follow_guid")] + public long CustomerFollowGuid { get; set; } + + + /// + /// 描述 :客户Guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "customer_guid")] + public long CustomerGuid { get; set; } + + + /// + /// 描述 :表格数据Guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "table_data_guid")] + public long TableDataGuid { get; set; } + + + + + + + } +} \ No newline at end of file diff --git a/ARW.Model/Vo/Api/TableDataManage/TableDatas/ProductsInvolvedListApiVo.cs b/ARW.Model/Vo/Api/TableDataManage/TableDatas/ProductsInvolvedListApiVo.cs new file mode 100644 index 0000000..a1980ed --- /dev/null +++ b/ARW.Model/Vo/Api/TableDataManage/TableDatas/ProductsInvolvedListApiVo.cs @@ -0,0 +1,29 @@ +using Newtonsoft.Json; +using OfficeOpenXml.Attributes; +using SqlSugar; +using System; +using System.Collections.Generic; + +namespace ARW.Model.Vo.Api.TableDataManage.TableDatas +{ + /// + /// 涉及产品列表展示对象Api + /// + /// @author lwh + /// @date 2023-11-24 + /// + public class ProductsInvolvedListApiVo + { + + /// + /// 描述 : 文本 + /// + public string Label { get; set; } + + /// + /// 描述 : 值 + /// + public int Value { get; set; } + + } +} diff --git a/ARW.Model/Vo/Api/TableDataManage/TableDatas/TableDataApiVo.cs b/ARW.Model/Vo/Api/TableDataManage/TableDatas/TableDataApiVo.cs index cb1c1c1..a2b43d9 100644 --- a/ARW.Model/Vo/Api/TableDataManage/TableDatas/TableDataApiVo.cs +++ b/ARW.Model/Vo/Api/TableDataManage/TableDatas/TableDataApiVo.cs @@ -105,7 +105,7 @@ namespace ARW.Model.Vo.Api.TableDataManage.TableDatas public string TableDataSingleSource { get; set; } [EpplusIgnore] public string TableDataDetails { get; set; } - + public bool IsFollow { get; set; } } } diff --git a/ARW.Model/Vo/Business/TableDataManage/CustomerFollows/CustomerFollowVo.cs b/ARW.Model/Vo/Business/TableDataManage/CustomerFollows/CustomerFollowVo.cs new file mode 100644 index 0000000..43e3906 --- /dev/null +++ b/ARW.Model/Vo/Business/TableDataManage/CustomerFollows/CustomerFollowVo.cs @@ -0,0 +1,49 @@ +using Newtonsoft.Json; +using OfficeOpenXml.Attributes; +using SqlSugar; +using System; + +namespace ARW.Model.Vo.Business.TableDataManage.CustomerFollows +{ + /// + /// 客户关注展示对象 + /// + /// @author lwh + /// @date 2023-11-24 + /// + public class CustomerFollowVo + { + + + /// + /// 描述 : + /// + public int CustomerFollowId { get; set; } + + + /// + /// 描述 : + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long CustomerFollowGuid { get; set; } + + + /// + /// 描述 :客户Guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long CustomerGuid { get; set; } + + + /// + /// 描述 :表格数据Guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long TableDataGuid { get; set; } + + public string CustomerName { get; set; } + public string CustomerPhone { get; set; } + public string TableDataName { get; set; } + + } +} diff --git a/ARW.Model/Vo/Business/TableDataManage/TableDatas/TableDataVo.cs b/ARW.Model/Vo/Business/TableDataManage/TableDatas/TableDataVo.cs index 4fb6c96..f6bae51 100644 --- a/ARW.Model/Vo/Business/TableDataManage/TableDatas/TableDataVo.cs +++ b/ARW.Model/Vo/Business/TableDataManage/TableDatas/TableDataVo.cs @@ -43,10 +43,10 @@ namespace ARW.Model.Vo.Business.TableDataManage.TableDatas public List ProductsInvolvedGuid { get; set; } /// - /// 描述 :采购内容 + /// 描述 :日期 /// - [EpplusTableColumn(Header = "采购内容")] - public string TableDataProcurementContent { get; set; } + [EpplusTableColumn(Header = "日期")] + public DateTime TableDataDate { get; set; } /// @@ -56,59 +56,6 @@ namespace ARW.Model.Vo.Business.TableDataManage.TableDatas public string TableDataProcurementUnit { get; set; } - /// - /// 描述 :采购方式 - /// - [EpplusTableColumn(Header = "采购方式")] - public string TableDataProcurementMethod { get; set; } - - - /// - /// 描述 :供应商名称 - /// - [EpplusTableColumn(Header = "供应商名称")] - public string TableDataSupplierName { get; set; } - - - /// - /// 描述 :供应商的对应报价 - /// - [EpplusIgnore] - public decimal TableDataSupplierOffer { get; set; } - - - /// - /// 描述 :项目计价形式 - /// - [EpplusTableColumn(Header = "项目计价形式")] - public string TableDataProjectPricingForm { get; set; } - - - /// - /// 描述 :链接 - /// - [EpplusTableColumn(Header = "链接")] - public string TableDataLink { get; set; } - - - /// - /// 描述 :日期 - /// - [EpplusTableColumn(Header = "日期", NumberFormat = "yyyy/m/d")] - public DateTime TableDataDate { get; set; } - - - [EpplusIgnore] - public string TableDataDateName { get; set; } - - - /// - /// 描述 :截止日期 - /// - [EpplusTableColumn(Header = "截止日期", NumberFormat = "yyyy/m/d")] - public DateTime TableDataDeadline { get; set; } - - /// /// 描述 :中标人或候选人 /// @@ -117,17 +64,17 @@ namespace ARW.Model.Vo.Business.TableDataManage.TableDatas /// - /// 描述 :中标金额 + /// 描述 :采购内容 /// - [EpplusTableColumn(Header = "中标金额")] - public decimal TableDataBidWinningPrice { get; set; } + [EpplusTableColumn(Header = "采购内容")] + public string TableDataProcurementContent { get; set; } /// - /// 描述 :是否为中标公告 + /// 描述 :采购方式 /// - [EpplusIgnore] - public int TableDataIsBidAnnouncement { get; set; } + [EpplusTableColumn(Header = "采购方式")] + public string TableDataProcurementMethod { get; set; } [EpplusTableColumn(Header = "是否为中标公告")] @@ -163,11 +110,6 @@ namespace ARW.Model.Vo.Business.TableDataManage.TableDatas public int TableDataIsOnlyBidder { get; set; } - [EpplusTableColumn(Header = "是否仅有一个中标人")] - public string TableDataIsOnlyBidderName { get; set; } - - - /// /// 描述 :单一来源理由(如有) /// @@ -175,6 +117,45 @@ namespace ARW.Model.Vo.Business.TableDataManage.TableDatas public string TableDataSingleSource { get; set; } + + [EpplusTableColumn(Header = "是否仅有一个中标人")] + public string TableDataIsOnlyBidderName { get; set; } + + + /// + /// 描述 :中标金额 + /// + [EpplusTableColumn(Header = "中标金额")] + public decimal TableDataBidWinningPrice { get; set; } + + /// + /// 描述 :供应商名称 + /// + [EpplusTableColumn(Header = "供应商名称")] + public string TableDataSupplierName { get; set; } + + + /// + /// 描述 :供应商的对应报价 + /// + [EpplusTableColumn(Header = "供应商的对应报价")] + public decimal TableDataSupplierOffer { get; set; } + + + /// + /// 描述 :项目计价形式 + /// + [EpplusTableColumn(Header = "项目计价形式")] + public string TableDataProjectPricingForm { get; set; } + + + /// + /// 描述 :链接 + /// + [EpplusTableColumn(Header = "链接")] + public string TableDataLink { get; set; } + + /// /// 描述 :详情 /// @@ -182,6 +163,23 @@ namespace ARW.Model.Vo.Business.TableDataManage.TableDatas public string TableDataDetails { get; set; } + [EpplusIgnore] + public string TableDataDateName { get; set; } + + + /// + /// 描述 :截止日期 + /// + [EpplusTableColumn(Header = "截止日期")] + public DateTime TableDataDeadline { get; set; } + + /// + /// 描述 :是否为中标公告 + /// + [EpplusIgnore] + public int TableDataIsBidAnnouncement { get; set; } + + /// /// 描述 :排序 /// diff --git a/ARW.Repository/Business/TableDataManage/CustomerFollows/CustomerFollowRepository.cs b/ARW.Repository/Business/TableDataManage/CustomerFollows/CustomerFollowRepository.cs new file mode 100644 index 0000000..719d4ad --- /dev/null +++ b/ARW.Repository/Business/TableDataManage/CustomerFollows/CustomerFollowRepository.cs @@ -0,0 +1,20 @@ +using System; +using Infrastructure.Attribute; +using ARW.Repository.System; +using ARW.Model.Models.Business.TableDataManage.CustomerFollows; + +namespace ARW.Repository.Business.TableDataManage.CustomerFollows +{ + /// + /// 客户关注仓储 + /// + /// @author lwh + /// @date 2023-11-24 + /// + [AppService(ServiceLifetime = LifeTime.Transient)] + public class CustomerFollowRepository : BaseRepository + { + #region 业务逻辑代码 + #endregion + } +} \ No newline at end of file diff --git a/ARW.Service/Api/BusinessService/TableDataManage/TableDatas/TableDataServiceApi.cs b/ARW.Service/Api/BusinessService/TableDataManage/TableDatas/TableDataServiceApi.cs index 9a3eccf..7c24088 100644 --- a/ARW.Service/Api/BusinessService/TableDataManage/TableDatas/TableDataServiceApi.cs +++ b/ARW.Service/Api/BusinessService/TableDataManage/TableDatas/TableDataServiceApi.cs @@ -22,6 +22,11 @@ using ARW.Repository.Business.Custom.GoodsCollections; using Newtonsoft.Json; using Senparc.CO2NET.Extensions; using Senparc.Weixin.WxOpen.AdvancedAPIs.WxApp.WxAppJson; +using ARW.Repository.Business.TableDataManage.CustomerFollows; +using ARW.Model.Models.Business.TableDataManage.CustomerFollows; +using Infrastructure; +using ARW.Repository.Business.SubscribeTasks; +using ARW.Model.Vo.Api.ProductsInvolveds; namespace ARW.Service.Api.BusinessService.TableDataManage.TableDatas { @@ -37,12 +42,14 @@ namespace ARW.Service.Api.BusinessService.TableDataManage.TableDatas private readonly TableDataRepository _TableDataRepository; private readonly TableDataProductsInvolveRepository _TableDataProductsInvolveRepository; private readonly ProductsInvolvedRepository _ProductsInvolvedRepository; + private readonly CustomerFollowRepository _CustomerFollowRepository; - public TableDataServiceImplApi(TableDataRepository TableDataRepository, TableDataProductsInvolveRepository tableDataProductsInvolveRepository, ProductsInvolvedRepository productsInvolveRepository) + public TableDataServiceImplApi(TableDataRepository TableDataRepository, TableDataProductsInvolveRepository tableDataProductsInvolveRepository, ProductsInvolvedRepository productsInvolveRepository, CustomerFollowRepository customerFollowRepository) { this._TableDataRepository = TableDataRepository; _TableDataProductsInvolveRepository = tableDataProductsInvolveRepository; _ProductsInvolvedRepository = productsInvolveRepository; + _CustomerFollowRepository = customerFollowRepository; } #region Api接口代码 @@ -58,14 +65,24 @@ namespace ARW.Service.Api.BusinessService.TableDataManage.TableDatas //开始拼装查询条件d var predicate = Expressionable.Create(); - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Search), s => s.TableDataProcurementContent.Contains(parm.TableDataProcurementContent)); - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Search), s => s.TableDataProcurementUnit.Contains(parm.TableDataProcurementUnit)); + predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Search), s => s.TableDataProcurementContent.Contains(parm.Search) + || s.TableDataProcurementUnit.Contains(parm.Search) + || s.TableDataProcurementMethod.Contains(parm.Search) + || s.TableDataProjectPricingForm.Contains(parm.Search) + || s.TableDataWinningBidde.Contains(parm.Search) + || s.TableDataSupplierName.Contains(parm.Search) + ); + //predicate = predicate.AndIF(parm.BeginTableDataDeadline == null, it => it.TableDataDeadline >= DateTime.Now.AddDays(-1)); //predicate = predicate.AndIF(parm.BeginTableDataDeadline != null, it => it.TableDataDeadline >= parm.BeginTableDataDeadline && it.TableDataDeadline <= parm.EndTableDataDeadline); var query = _TableDataRepository .Queryable() .Where(predicate.ToExpression()) - .OrderBy(s => s.TableDataSort, OrderByType.Desc) + .OrderByIF(parm.Order == "default", s => s.TableDataSort, OrderByType.Desc) + .OrderByIF(parm.Order == "date-down", s => s.TableDataDate, OrderByType.Desc) + .OrderByIF(parm.Order == "date-up", s => s.TableDataDate, OrderByType.Asc) + .OrderByIF(parm.Order == "price-up", s => s.TableDataBidWinningPrice, OrderByType.Desc) + .OrderByIF(parm.Order == "price-down", s => s.TableDataBidWinningPrice, OrderByType.Asc) .Select(s => new TableDataVoApi { TableDataId = s.TableDataId, @@ -75,25 +92,45 @@ namespace ARW.Service.Api.BusinessService.TableDataManage.TableDatas TableDataDeadline = s.TableDataDeadline.ToString("yyyy-MM-dd"), TableDataBidWinningPrice = s.TableDataBidWinningPrice, }); + var list = await query.ToPageAsync(parm); - foreach (var item in list.Result) + + var prorelList = new List(); + // 如果筛选了类型 + if (parm.Type != 0) { - var productsInvolvedList = await _TableDataProductsInvolveRepository.GetListAsync(s => s.TableGuid == item.TableDataGuid); - if (productsInvolvedList.Count > 0) + foreach (var item in list.Result) { - List stringName = new List(); - foreach (var item1 in productsInvolvedList) + + // 找出当前表格数据所关联的涉及产品 + var proList = await _TableDataProductsInvolveRepository.GetListAsync(s => s.TableGuid == item.TableDataGuid); + if (proList.Count > 0) { - var productsInvolved = await _ProductsInvolvedRepository.GetFirstAsync(s => s.ProductsInvolvedId == item1.ProductsInvolvedId); - if (productsInvolved != null) + foreach (var prorel in proList) { - stringName.Add(productsInvolved.ProductsInvolvedName); + if (prorel.ProductsInvolvedId == parm.Type) + { + prorelList.Add(item); + } } } - item.ProductsInvolvedName = stringName; + } + if (prorelList.Count > 0) + { + list.Result = await GetProName(prorelList); ; + } + else + { + list.Result = new List(); } } + else + { + list.Result = await GetProName(list.Result); + } + + return list; } @@ -163,6 +200,14 @@ namespace ARW.Service.Api.BusinessService.TableDataManage.TableDatas data.ProductsInvolvedName = str; } + + // 是否关注 + var follow = await _CustomerFollowRepository.GetFirstAsync(s => s.TableDataGuid == data.TableDataGuid && s.CustomerGuid == parm.CustomerGuid); + if (follow != null) + { + data.IsFollow = true; + } + json = data.ToJson(); } @@ -170,7 +215,84 @@ namespace ARW.Service.Api.BusinessService.TableDataManage.TableDatas } + /// + /// 获取涉及产品类别列表(Api) + /// + /// 查询参数 + /// + public async Task> GetProductsInvolvedList(TableDataQueryDtoApi parm) + { + var query = _ProductsInvolvedRepository + .Queryable() + .OrderBy(s => s.ProductsInvolvedSort, OrderByType.Asc) + .Select(s => new ProductsInvolvedListApiVo + { + Value = s.ProductsInvolvedId, + Label = s.ProductsInvolvedName + }); + return await query.ToListAsync(); + } + + + /// + /// 关注 + /// + /// + /// + public async Task Follow(TableDataDtoApi parm) + { + var follow = await _CustomerFollowRepository.GetFirstAsync(s => s.TableDataGuid == parm.TableDataGuid && s.CustomerGuid == parm.CustomerGuid); + if (follow != null) throw new CustomException("请勿重复关注"); + var model = new CustomerFollow + { + TableDataGuid = parm.TableDataGuid, + CustomerGuid = parm.CustomerGuid, + }; + var res = await _CustomerFollowRepository.InsertReturnSnowflakeIdAsync(model); + return "关注成功"; + } + + + /// + /// 取消关注 + /// + /// + /// + public async Task CancelFollow(TableDataDtoApi parm) + { + await _CustomerFollowRepository.DeleteAsync(s => s.TableDataGuid == parm.TableDataGuid && s.CustomerGuid == parm.CustomerGuid); + return "取消关注成功"; + } + + + /// + /// 获取涉及产品名称 + /// + /// + /// + public async Task> GetProName(List prorelList) + { + foreach (var item in prorelList) + { + var productsInvolvedList = await _TableDataProductsInvolveRepository.GetListAsync(s => s.TableGuid == item.TableDataGuid); + if (productsInvolvedList.Count > 0) + { + List stringName = new List(); + foreach (var item1 in productsInvolvedList) + { + var productsInvolved = await _ProductsInvolvedRepository.GetFirstAsync(s => s.ProductsInvolvedId == item1.ProductsInvolvedId); + if (productsInvolved != null) + { + stringName.Add(productsInvolved.ProductsInvolvedName); + } + } + item.ProductsInvolvedName = stringName; + } + } + + return prorelList; + } #endregion diff --git a/ARW.Service/Api/IBusinessService/TableDataManage/TableDatas/ITableDataServiceApi.cs b/ARW.Service/Api/IBusinessService/TableDataManage/TableDatas/ITableDataServiceApi.cs index 3ce50c9..642d455 100644 --- a/ARW.Service/Api/IBusinessService/TableDataManage/TableDatas/ITableDataServiceApi.cs +++ b/ARW.Service/Api/IBusinessService/TableDataManage/TableDatas/ITableDataServiceApi.cs @@ -32,5 +32,27 @@ namespace ARW.Service.Api.IBusinessService.TableDataManage.TableDatas /// Task GetTableDataDetails(TableDataDtoApi parm); + /// + /// 获取涉及产品类别列表(Api) + /// + /// + /// + Task> GetProductsInvolvedList(TableDataQueryDtoApi parm); + + /// + /// 关注 + /// + /// + /// + Task Follow(TableDataDtoApi parm); + + + /// + /// 取消关注 + /// + /// + /// + Task CancelFollow(TableDataDtoApi parm); + } } diff --git a/ARW.Service/Business/BusinessService/TableDataManage/CustomerFollows/CustomerFollowService.cs b/ARW.Service/Business/BusinessService/TableDataManage/CustomerFollows/CustomerFollowService.cs new file mode 100644 index 0000000..e7ee93d --- /dev/null +++ b/ARW.Service/Business/BusinessService/TableDataManage/CustomerFollows/CustomerFollowService.cs @@ -0,0 +1,101 @@ +using Infrastructure.Attribute; +using Microsoft.AspNetCore.Http; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Infrastructure; +using ARW.Model; +using ARW.Repository; +using ARW.Repository.Business.TableDataManage.CustomerFollows; +using ARW.Service.Business.IBusinessService.TableDataManage.CustomerFollows; +using ARW.Model.Dto.Business.TableDataManage.CustomerFollows; +using ARW.Model.Models.Business.TableDataManage.CustomerFollows; +using ARW.Model.Vo.Business.TableDataManage.CustomerFollows; +using ARW.Model.Models.Business.Custom.Customers; +using ARW.Model.Models.Business.TableDataManage.TableDatas; + +namespace ARW.Service.Business.BusinessService.TableDataManage.CustomerFollows +{ + /// + /// 客户关注接口实现类 + /// + /// @author lwh + /// @date 2023-11-24 + /// + [AppService(ServiceType = typeof(ICustomerFollowService), ServiceLifetime = LifeTime.Transient)] + public class CustomerFollowServiceImpl : BaseService, ICustomerFollowService + { + private readonly CustomerFollowRepository _CustomerFollowRepository; + + public CustomerFollowServiceImpl(CustomerFollowRepository CustomerFollowRepository) + { + this._CustomerFollowRepository = CustomerFollowRepository; + } + + #region 业务逻辑代码 + + + /// + /// 查询客户关注分页列表 + /// + public async Task> GetCustomerFollowList(CustomerFollowQueryDto parm) + { + //开始拼装查询条件d + var predicate = Expressionable.Create(); + + var query = _CustomerFollowRepository + .Queryable() + .LeftJoin((s, c) => s.CustomerGuid == c.CustomerGuid) + .LeftJoin((s, c, d) => s.TableDataGuid == d.TableDataGuid) + .Where(predicate.ToExpression()) + .WhereIF(!string.IsNullOrEmpty(parm.CustomerName), (s, c, d) => c.CustomerNickname.Contains(parm.CustomerName)) + .WhereIF(!string.IsNullOrEmpty(parm.CustomerName), (s, c, d) => c.CustomerMobilePhoneNumber.Contains(parm.CustomerPhone)) + .WhereIF(!string.IsNullOrEmpty(parm.TableDataProcurementContent), (s, c, d) => d.TableDataProcurementContent.Contains(parm.TableDataProcurementContent)) + .OrderBy(s => s.Create_time, OrderByType.Desc) + .Select((s, c, d) => new CustomerFollowVo + { + CustomerFollowId = s.CustomerFollowId, + CustomerFollowGuid = s.CustomerFollowGuid, + CustomerGuid = s.CustomerGuid, + TableDataGuid = s.TableDataGuid, + CustomerName = c.CustomerNickname, + CustomerPhone = c.CustomerMobilePhoneNumber, + TableDataName = d.TableDataProcurementContent + }); + + + return await query.ToPageAsync(parm); + } + + /// + /// 添加或修改客户关注 + /// + public async Task AddOrUpdateCustomerFollow(CustomerFollow model) + { + if (model.CustomerFollowId != 0) + { + var response = await _CustomerFollowRepository.UpdateAsync(model); + return "修改成功!"; + } + else + { + + var response = await _CustomerFollowRepository.InsertReturnSnowflakeIdAsync(model); + return "添加成功!"; + } + } + + #region Excel处理 + + + #endregion + + + + #endregion + + } +} diff --git a/ARW.Service/Business/IBusinessService/TableDataManage/CustomerFollows/ICustomerFollowService.cs b/ARW.Service/Business/IBusinessService/TableDataManage/CustomerFollows/ICustomerFollowService.cs new file mode 100644 index 0000000..7a71509 --- /dev/null +++ b/ARW.Service/Business/IBusinessService/TableDataManage/CustomerFollows/ICustomerFollowService.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ARW.Model; +using ARW.Model.Dto.Business.TableDataManage.CustomerFollows; +using ARW.Model.Models.Business.TableDataManage.CustomerFollows; +using ARW.Model.Vo.Business.TableDataManage.CustomerFollows; + +namespace ARW.Service.Business.IBusinessService.TableDataManage.CustomerFollows +{ + /// + /// 客户关注接口类 + /// + /// @author lwh + /// @date 2023-11-24 + /// + public interface ICustomerFollowService : IBaseService + { + /// + /// 获取客户关注分页列表 + /// + /// + /// + Task> GetCustomerFollowList(CustomerFollowQueryDto parm); + + + /// + /// 添加或修改客户关注 + /// + /// + /// + Task AddOrUpdateCustomerFollow(CustomerFollow parm); + + + + + + } +} diff --git a/ARW.WebApi/Controllers/Api/TableDataManage/TableDatas/TableDataApiController.cs b/ARW.WebApi/Controllers/Api/TableDataManage/TableDatas/TableDataApiController.cs index c506f5e..6cf5adc 100644 --- a/ARW.WebApi/Controllers/Api/TableDataManage/TableDatas/TableDataApiController.cs +++ b/ARW.WebApi/Controllers/Api/TableDataManage/TableDatas/TableDataApiController.cs @@ -15,6 +15,7 @@ using ARW.Model.Models.Business.TableDataManage.TableDatas; using ARW.Model.Vo.Api.TableDataManage.TableDatas; using Microsoft.AspNetCore.Authorization; using Geocoding; +using ARW.Admin.WebApi.Framework; namespace ARW.WebApi.Controllers.Api.TableDataManage.TableDatas { @@ -48,6 +49,7 @@ namespace ARW.WebApi.Controllers.Api.TableDataManage.TableDatas [HttpGet("getTableDataList")] public async Task GetTableDataListApi([FromQuery] TableDataQueryDtoApi parm) { + parm.CustomerGuid = JwtUtil.GetLoginUser(App.HttpContext).UserId; var res = await _TableDataServiceApi.GetTableDataListApi(parm); return SUCCESS(res); } @@ -61,7 +63,7 @@ namespace ARW.WebApi.Controllers.Api.TableDataManage.TableDatas public async Task GetTableDataDetails([FromQuery] TableDataDtoApi parm) { //if (parm == null) throw new CustomException("参数错误!"); - + parm.CustomerGuid = JwtUtil.GetLoginUser(App.HttpContext).UserId; var res = await _TableDataServiceApi.GetTableDataDetails(parm); if (res != "[]") @@ -75,5 +77,46 @@ namespace ARW.WebApi.Controllers.Api.TableDataManage.TableDatas } } + /// + /// 获取涉及产品类别列表(Api) + /// + /// 查询参数 + /// + [HttpGet("getProductsInvolvedList")] + public async Task GetProductsInvolvedList([FromQuery] TableDataQueryDtoApi parm) + { + var res = await _TableDataServiceApi.GetProductsInvolvedList(parm); + return SUCCESS(res); + } + + /// + /// 关注 + /// + /// + /// + [HttpPost("follow")] + public async Task Follow([FromBody] TableDataDtoApi parm) + { + //if (parm == null) throw new CustomException("参数错误!"); + parm.CustomerGuid = JwtUtil.GetLoginUser(App.HttpContext).UserId; + var res = await _TableDataServiceApi.Follow(parm); + return SUCCESS(res); + } + + + /// + /// 取消关注 + /// + /// + /// + [HttpPost("cancelfollow")] + public async Task CancelFollow([FromBody] TableDataDtoApi parm) + { + //if (parm == null) throw new CustomException("参数错误!"); + parm.CustomerGuid = JwtUtil.GetLoginUser(App.HttpContext).UserId; + var res = await _TableDataServiceApi.CancelFollow(parm); + return SUCCESS(res); + } + } } diff --git a/ARW.WebApi/Controllers/Business/TableDataManage/CustomerFollows/CustomerFollowController.cs b/ARW.WebApi/Controllers/Business/TableDataManage/CustomerFollows/CustomerFollowController.cs new file mode 100644 index 0000000..f9f53e8 --- /dev/null +++ b/ARW.WebApi/Controllers/Business/TableDataManage/CustomerFollows/CustomerFollowController.cs @@ -0,0 +1,98 @@ +using Infrastructure; +using Infrastructure.Attribute; +using Infrastructure.Enums; +using Infrastructure.Model; +using Mapster; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using ARW.Admin.WebApi.Extensions; +using ARW.Admin.WebApi.Filters; +using ARW.Common; +using ARW.Model.Dto.Business.TableDataManage.CustomerFollows; +using ARW.Service.Business.IBusinessService.TableDataManage.CustomerFollows; +using ARW.Admin.WebApi.Controllers; +using ARW.Model.Models.Business.TableDataManage.CustomerFollows; +using ARW.Model.Vo.Business.TableDataManage.CustomerFollows; +using Microsoft.AspNetCore.Authorization; +using ARW.Admin.WebApi.Framework; + + +namespace ARW.WebApi.Controllers.Business.TableDataManage.CustomerFollows +{ + /// + /// 客户关注控制器 + /// + /// @author lwh + /// @date 2023-11-24 + /// + [Verify] + [Route("business/[controller]")] + public class CustomerFollowController : BaseController + { + private readonly ICustomerFollowService _CustomerFollowService; + + /// + /// 依赖注入 + /// + /// 客户关注服务 + public CustomerFollowController(ICustomerFollowService CustomerFollowService) + { + _CustomerFollowService = CustomerFollowService; + } + + + /// + /// 获取客户关注列表 + /// + /// 查询参数 + /// + [HttpGet("getCustomerFollowList")] + [ActionPermissionFilter(Permission = "business:customerfollow:list")] + public async Task GetCustomerFollowList([FromQuery] CustomerFollowQueryDto parm) + { + var res = await _CustomerFollowService.GetCustomerFollowList(parm); + return SUCCESS(res); + } + + /// + /// 添加或修改客户关注 + /// + /// + /// + [HttpPost("addOrUpdateCustomerFollow")] + [ActionPermissionFilter(Permission = "business:customerfollow:addOrUpdate")] + [Log(Title = "添加或修改客户关注", BusinessType = BusinessType.ADDORUPDATE)] + public async Task AddOrUpdateCustomerFollow([FromBody] CustomerFollowDto parm) + { + if (parm == null) { throw new CustomException("请求参数错误"); } + + var modal = new CustomerFollow(); + if (parm.CustomerFollowId != 0) modal = parm.Adapt().ToUpdate(HttpContext); + else modal = parm.Adapt().ToCreate(HttpContext); + + var res = await _CustomerFollowService.AddOrUpdateCustomerFollow(modal); + return SUCCESS(res); + } + + /// + /// 删除客户关注 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "business:customerfollow:delete")] + [Log(Title = "客户关注删除", BusinessType = BusinessType.DELETE)] + public IActionResult Delete(string ids) + { + long[] idsArr = Tools.SpitLongArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + var response = _CustomerFollowService.Delete(idsArr); + return SUCCESS("删除成功!"); + } + + + + + + + } +} diff --git a/ARW.WebApi/Controllers/Business/TableDataManage/TableDatas/TableDataController.cs b/ARW.WebApi/Controllers/Business/TableDataManage/TableDatas/TableDataController.cs index cf18756..8c6365b 100644 --- a/ARW.WebApi/Controllers/Business/TableDataManage/TableDatas/TableDataController.cs +++ b/ARW.WebApi/Controllers/Business/TableDataManage/TableDatas/TableDataController.cs @@ -132,7 +132,7 @@ namespace ARW.WebApi.Controllers.Business.TableDataManage.TableDatas MemoryStream stream = new MemoryStream(); // 示例数据 - var values = new List() { "房产,人工智能", "渤银理财理财分销对接代销系统采购项目", "渤银理财有限责任公司", "竞争性采购", "北京开科唯识技术股份有限公司", "总价", "https://www.jianyu360.cn/nologin/content/ABCY1xGZCkFAjg6RHt3cFxbCzMCEjJ3XGB1Kw4ZKDogcFFzcz9UCaI=.html", "22/11/2023", "23/11/2023", "北京开科唯识技术股份有限公司","31926", "是", "否", "是", "是", "", "渤银理财理财分销对接代销系统采购项目成交公示       受渤海银行股份有限公司委托,金采联合(北京)招标有限公司于2022年8月4日以竞争性采购方式,对渤银理财理财分销对接代销系统采购项目(项目编号:FUTC-2022-H031B)组织了采购。现将成交供应商公布如下:北京开科唯识技术股份有限公司为成交供应商。公示期限:自2022年8月22日至2022年8月24日采购代理机构:金采联合(北京)招标有限公司联系地址:北京市西城区佟麟阁路95号尚信大厦联系人:刘世平、刘松樵、谭永江代理机构联系方式:13682015217、16622986307、010-51813597特此公告金采联合(北京)招标有限公司2022年8月19日", "100" }; + var values = new List() { "房产,人工智能", "22/11/2023", "渤银理财有限责任公司", "北京开科唯识技术股份有限公司", "渤银理财理财分销对接代销系统采购项目", "竞争性采购", "是", "否", "是", "", "是", "31926", "北京开科唯识技术股份有限公司", "", "总价", "https://www.jianyu360.cn/nologin/content/ABCY1xGZCkFAjg6RHt3cFxbCzMCEjJ3XGB1Kw4ZKDogcFFzcz9UCaI=.html", "渤银理财理财分销对接代销系统采购项目成交公示       受渤海银行股份有限公司委托,金采联合(北京)招标有限公司于2022年8月4日以竞争性采购方式,对渤银理财理财分销对接代销系统采购项目(项目编号:FUTC-2022-H031B)组织了采购。现将成交供应商公布如下:北京开科唯识技术股份有限公司为成交供应商。公示期限:自2022年8月22日至2022年8月24日采购代理机构:金采联合(北京)招标有限公司联系地址:北京市西城区佟麟阁路95号尚信大厦联系人:刘世平、刘松樵、谭永江代理机构联系方式:13682015217、16622986307、010-51813597特此公告金采联合(北京)招标有限公司2022年8月19日", "30/11/2023", "100" }; string sFileName = DownloadImportTemplate(TableData, stream, "表格数据导入模板", values); return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $"{sFileName}");