diff --git a/ARW.Model/Dto/Api/CustomerServices/CustomerServiceApiDto.cs b/ARW.Model/Dto/Api/CustomerServices/CustomerServiceApiDto.cs new file mode 100644 index 0000000..09306e5 --- /dev/null +++ b/ARW.Model/Dto/Api/CustomerServices/CustomerServiceApiDto.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using ARW.Model.Models.Business.CustomerServices; + +namespace ARW.Model.Dto.Api.CustomerServices +{ + + /// + /// 客服查询对象Api + /// + /// @author lwh + /// @date 2023-10-21 + /// + public class CustomerServiceQueryDtoApi + { + public string CustomerServiceName { get; set; } + public string CustomerServicePhone { get; set; } + } + +} diff --git a/ARW.Model/Dto/Business/CustomerServices/CustomerServiceDto.cs b/ARW.Model/Dto/Business/CustomerServices/CustomerServiceDto.cs new file mode 100644 index 0000000..b0928f9 --- /dev/null +++ b/ARW.Model/Dto/Business/CustomerServices/CustomerServiceDto.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using ARW.Model.Models.Business.CustomerServices; +using Org.BouncyCastle.Asn1.Cms; + +namespace ARW.Model.Dto.Business.CustomerServices +{ + /// + /// 客服输入对象 + /// + /// @author lwh + /// @date 2023-10-21 + /// + public class CustomerServiceDto + { + + public int CustomerServiceId { get; set; } + + public long CustomerServiceGuid { get; set; } + + [Required(ErrorMessage = "名称不能为空")] + public string CustomerServiceName { get; set; } + + [Required(ErrorMessage = "电话不能为空")] + public string CustomerServicePhone { get; set; } + + [Required(ErrorMessage = "图片不能为空")] + public string CustomerServiceImg { get; set; } + + [Required(ErrorMessage = "工作时间-上班时间不能为空")] + public string WorkingHoursBeginTime { get; set; } + + [Required(ErrorMessage = "工作时间-下班时间不能为空")] + public string WorkingHoursEndTime { get; set; } + + [Required(ErrorMessage = "排序不能为空")] + public int CustomerServiceSort { get; set; } + + + + + + } + + + /// + /// 客服查询对象 + /// + /// @author lwh + /// @date 2023-10-21 + /// + public class CustomerServiceQueryDto : PagerInfo + { + + public string CustomerServiceName { get; set; } + + public string CustomerServicePhone { get; set; } + + public string ids { get; set; } + } + + + + +} diff --git a/ARW.Model/Models/Business/CustomerServices/CustomerService.cs b/ARW.Model/Models/Business/CustomerServices/CustomerService.cs new file mode 100644 index 0000000..3a32f5a --- /dev/null +++ b/ARW.Model/Models/Business/CustomerServices/CustomerService.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using SqlSugar; +using OfficeOpenXml.Attributes; +using Newtonsoft.Json; +using Org.BouncyCastle.Asn1.Cms; + +namespace ARW.Model.Models.Business.CustomerServices +{ + /// + /// 客服,数据实体对象 + /// + /// @author lwh + /// @date 2023-10-21 + /// + [SugarTable("tb_customer_service")] + public class CustomerService : BusinessBase + { + + /// + /// 描述 : + /// 空值 : false + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "customer_service_id")] + public int CustomerServiceId { get; set; } + + + /// + /// 描述 : + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "customer_service_guid")] + public long CustomerServiceGuid { get; set; } + + + /// + /// 描述 :名称 + /// 空值 : false + /// + [SugarColumn(ColumnName = "customer_service_name")] + public string CustomerServiceName { get; set; } + + + /// + /// 描述 :电话 + /// 空值 : false + /// + [SugarColumn(ColumnName = "customer_service_phone")] + public string CustomerServicePhone { get; set; } + + + /// + /// 描述 :图片 + /// 空值 : false + /// + [SugarColumn(ColumnName = "customer_service_img")] + public string CustomerServiceImg { get; set; } + + + /// + /// 描述 :工作时间-上班时间 + /// 空值 : false + /// + [SugarColumn(ColumnName = "working_hours_begin_time")] + public string WorkingHoursBeginTime { get; set; } + + + /// + /// 描述 :工作时间-下班时间 + /// 空值 : false + /// + [SugarColumn(ColumnName = "working_hours_end_time")] + public string WorkingHoursEndTime { get; set; } + + + /// + /// 描述 :排序 + /// 空值 : false + /// + [SugarColumn(ColumnName = "customer_service_sort")] + public int CustomerServiceSort { get; set; } + + + + + + + } +} \ No newline at end of file diff --git a/ARW.Model/Vo/Api/CustomerServices/CustomerServiceApiVo.cs b/ARW.Model/Vo/Api/CustomerServices/CustomerServiceApiVo.cs new file mode 100644 index 0000000..1477793 --- /dev/null +++ b/ARW.Model/Vo/Api/CustomerServices/CustomerServiceApiVo.cs @@ -0,0 +1,86 @@ +using Newtonsoft.Json; +using OfficeOpenXml.Attributes; +using SqlSugar; +using System; + +namespace ARW.Model.Vo.Api.CustomerServices +{ + /// + /// 客服展示对象Api + /// + /// @author lwh + /// @date 2023-10-21 + /// + public class CustomerServiceVoApi + { + + + /// + /// 描述 : + /// + public int CustomerServiceId { get; set; } + + + /// + /// 描述 : + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long CustomerServiceGuid { get; set; } + + + /// + /// 描述 :名称 + /// + public string CustomerServiceName { get; set; } + + + /// + /// 描述 :电话 + /// + public string CustomerServicePhone { get; set; } + + + /// + /// 描述 :图片 + /// + public string CustomerServiceImg { get; set; } + + + /// + /// 描述 :工作时间-上班时间 + /// + public string WorkingHoursBeginTime { get; set; } + + + /// + /// 描述 :工作时间-下班时间 + /// + public string WorkingHoursEndTime { get; set; } + + + /// + /// 描述 :排序 + /// + public int CustomerServiceSort { get; set; } + + } + + + /// + /// 客服详情展示对象Api + /// + public class CustomerServiceApiDetailsVo + { + public int CustomerServiceId { get; set; } + [JsonConverter(typeof(ValueToStringConverter))] + public long CustomerServiceGuid { get; set; } + public string CustomerServiceName { get; set; } + public string CustomerServicePhone { get; set; } + public string CustomerServiceImg { get; set; } + public DateTime? WorkingHoursBeginTime { get; set; } + public DateTime? WorkingHoursEndTime { get; set; } + public int CustomerServiceSort { get; set; } + + } + +} diff --git a/ARW.Model/Vo/Business/CustomerServices/CustomerServiceVo.cs b/ARW.Model/Vo/Business/CustomerServices/CustomerServiceVo.cs new file mode 100644 index 0000000..29a0215 --- /dev/null +++ b/ARW.Model/Vo/Business/CustomerServices/CustomerServiceVo.cs @@ -0,0 +1,68 @@ +using Newtonsoft.Json; +using OfficeOpenXml.Attributes; +using Org.BouncyCastle.Asn1.Cms; +using SqlSugar; +using System; + +namespace ARW.Model.Vo.Business.CustomerServices +{ + /// + /// 客服展示对象 + /// + /// @author lwh + /// @date 2023-10-21 + /// + public class CustomerServiceVo + { + + + /// + /// 描述 : + /// + public int CustomerServiceId { get; set; } + + + /// + /// 描述 : + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long CustomerServiceGuid { get; set; } + + + /// + /// 描述 :名称 + /// + public string CustomerServiceName { get; set; } + + + /// + /// 描述 :电话 + /// + public string CustomerServicePhone { get; set; } + + + /// + /// 描述 :图片 + /// + public string CustomerServiceImg { get; set; } + + + /// + /// 描述 :工作时间-上班时间 + /// + public string WorkingHoursBeginTime { get; set; } + + + /// + /// 描述 :工作时间-下班时间 + /// + public string WorkingHoursEndTime { get; set; } + + + /// + /// 描述 :排序 + /// + public int CustomerServiceSort { get; set; } + + } +} diff --git a/ARW.Repository/Business/CustomerServices/CustomerServiceRepository.cs b/ARW.Repository/Business/CustomerServices/CustomerServiceRepository.cs new file mode 100644 index 0000000..17ba26b --- /dev/null +++ b/ARW.Repository/Business/CustomerServices/CustomerServiceRepository.cs @@ -0,0 +1,20 @@ +using System; +using Infrastructure.Attribute; +using ARW.Repository.System; +using ARW.Model.Models.Business.CustomerServices; + +namespace ARW.Repository.Business.CustomerServices +{ + /// + /// 客服仓储 + /// + /// @author lwh + /// @date 2023-10-21 + /// + [AppService(ServiceLifetime = LifeTime.Transient)] + public class CustomerServiceRepository : BaseRepository + { + #region 业务逻辑代码 + #endregion + } +} \ No newline at end of file diff --git a/ARW.Service/Api/BusinessService/CustomerServices/CustomerServiceServiceApi.cs b/ARW.Service/Api/BusinessService/CustomerServices/CustomerServiceServiceApi.cs new file mode 100644 index 0000000..f067810 --- /dev/null +++ b/ARW.Service/Api/BusinessService/CustomerServices/CustomerServiceServiceApi.cs @@ -0,0 +1,73 @@ +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 ARW.Model; +using ARW.Repository; +using ARW.Repository.Business.CustomerServices; +using ARW.Service.Api.IBusinessService.CustomerServices; +using ARW.Model.Dto.Api.CustomerServices; +using ARW.Model.Models.Business.CustomerServices; +using ARW.Model.Vo.Api.CustomerServices; + +namespace ARW.Service.Api.BusinessService.CustomerServices +{ + /// + /// 客服接口实现类Api + /// + /// @author lwh + /// @date 2023-10-21 + /// + [AppService(ServiceType = typeof(ICustomerServiceServiceApi), ServiceLifetime = LifeTime.Transient)] + public class CustomerServiceServiceImplApi : BaseService, ICustomerServiceServiceApi + { + private readonly CustomerServiceRepository _CustomerServiceRepository; + + public CustomerServiceServiceImplApi(CustomerServiceRepository CustomerServiceRepository) + { + this._CustomerServiceRepository = CustomerServiceRepository; + } + + #region Api接口代码 + + + /// + /// 查询客服列表(Api) + /// + /// + /// + public async Task> GetCustomerServiceListApi(CustomerServiceQueryDtoApi parm) + { + //开始拼装查询条件d + var predicate = Expressionable.Create(); + + predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerServiceName), s => s.CustomerServiceName.Contains(parm.CustomerServiceName)); + predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerServicePhone), s => s.CustomerServicePhone.Contains(parm.CustomerServicePhone)); + var query = _CustomerServiceRepository + .Queryable() + .Where(predicate.ToExpression()) + .OrderBy(s => s.CustomerServiceSort, OrderByType.Desc) + .Select(s => new CustomerServiceVoApi + { + CustomerServiceId = s.CustomerServiceId, + CustomerServiceGuid = s.CustomerServiceGuid, + CustomerServiceName = s.CustomerServiceName, + CustomerServicePhone = s.CustomerServicePhone, + CustomerServiceImg = s.CustomerServiceImg, + WorkingHoursBeginTime = s.WorkingHoursBeginTime, + WorkingHoursEndTime = s.WorkingHoursEndTime, + CustomerServiceSort = s.CustomerServiceSort, + }); + + + return await query.ToListAsync(); + } + + #endregion + + } +} diff --git a/ARW.Service/Api/IBusinessService/CustomerServices/ICustomerServiceServiceApi.cs b/ARW.Service/Api/IBusinessService/CustomerServices/ICustomerServiceServiceApi.cs new file mode 100644 index 0000000..a57c7cd --- /dev/null +++ b/ARW.Service/Api/IBusinessService/CustomerServices/ICustomerServiceServiceApi.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ARW.Model; +using ARW.Model.Dto.Api.CustomerServices; +using ARW.Model.Models.Business.CustomerServices; +using ARW.Model.Vo.Api.CustomerServices; + +namespace ARW.Service.Api.IBusinessService.CustomerServices +{ + /// + /// 客服接口类Api + /// + /// @author lwh + /// @date 2023-10-21 + /// + public interface ICustomerServiceServiceApi : IBaseService + { + /// + /// 获取客服分页列表(Api) + /// + /// + /// + Task> GetCustomerServiceListApi(CustomerServiceQueryDtoApi parm); + + } +} diff --git a/ARW.Service/Business/BusinessService/CustomerServices/CustomerServiceService.cs b/ARW.Service/Business/BusinessService/CustomerServices/CustomerServiceService.cs new file mode 100644 index 0000000..fe9dabb --- /dev/null +++ b/ARW.Service/Business/BusinessService/CustomerServices/CustomerServiceService.cs @@ -0,0 +1,97 @@ +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.CustomerServices; +using ARW.Service.Business.IBusinessService.CustomerServices; +using ARW.Model.Dto.Business.CustomerServices; +using ARW.Model.Models.Business.CustomerServices; +using ARW.Model.Vo.Business.CustomerServices; + +namespace ARW.Service.Business.BusinessService.CustomerServices +{ + /// + /// 客服接口实现类 + /// + /// @author lwh + /// @date 2023-10-21 + /// + [AppService(ServiceType = typeof(ICustomerServiceService), ServiceLifetime = LifeTime.Transient)] + public class CustomerServiceServiceImpl : BaseService, ICustomerServiceService + { + private readonly CustomerServiceRepository _CustomerServiceRepository; + + public CustomerServiceServiceImpl(CustomerServiceRepository CustomerServiceRepository) + { + this._CustomerServiceRepository = CustomerServiceRepository; + } + + #region 业务逻辑代码 + + + /// + /// 查询客服分页列表 + /// + public async Task> GetCustomerServiceList(CustomerServiceQueryDto parm) + { + //开始拼装查询条件d + var predicate = Expressionable.Create(); + + predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerServiceName), s => s.CustomerServiceName.Contains(parm.CustomerServiceName)); + predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerServicePhone), s => s.CustomerServicePhone.Contains(parm.CustomerServicePhone)); + var query = _CustomerServiceRepository + .Queryable() + .Where(predicate.ToExpression()) + .OrderBy(s => s.CustomerServiceSort, OrderByType.Asc) + .Select(s => new CustomerServiceVo + { + CustomerServiceId = s.CustomerServiceId, + CustomerServiceGuid = s.CustomerServiceGuid, + CustomerServiceName = s.CustomerServiceName, + CustomerServicePhone = s.CustomerServicePhone, + CustomerServiceImg = s.CustomerServiceImg, + WorkingHoursBeginTime = s.WorkingHoursBeginTime, + WorkingHoursEndTime = s.WorkingHoursEndTime, + CustomerServiceSort = s.CustomerServiceSort, + }); + + + return await query.ToPageAsync(parm); + } + + /// + /// 添加或修改客服 + /// + public async Task AddOrUpdateCustomerService(CustomerService model) + { + if (model.CustomerServiceId != 0) + { + var response = await _CustomerServiceRepository.UpdateAsync(model); + return "修改成功!"; + } + else + { + + var response = await _CustomerServiceRepository.InsertReturnSnowflakeIdAsync(model); + return "添加成功!"; + } + } + + #region Excel处理 + + + #endregion + + + + #endregion + + } +} diff --git a/ARW.Service/Business/IBusinessService/CustomerServices/ICustomerServiceService.cs b/ARW.Service/Business/IBusinessService/CustomerServices/ICustomerServiceService.cs new file mode 100644 index 0000000..9d562ee --- /dev/null +++ b/ARW.Service/Business/IBusinessService/CustomerServices/ICustomerServiceService.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.CustomerServices; +using ARW.Model.Models.Business.CustomerServices; +using ARW.Model.Vo.Business.CustomerServices; + +namespace ARW.Service.Business.IBusinessService.CustomerServices +{ + /// + /// 客服接口类 + /// + /// @author lwh + /// @date 2023-10-21 + /// + public interface ICustomerServiceService : IBaseService + { + /// + /// 获取客服分页列表 + /// + /// + /// + Task> GetCustomerServiceList(CustomerServiceQueryDto parm); + + + /// + /// 添加或修改客服 + /// + /// + /// + Task AddOrUpdateCustomerService(CustomerService parm); + + + + + + } +} diff --git a/ARW.WebApi/Controllers/Api/CustomerServices/CustomerServiceApiController.cs b/ARW.WebApi/Controllers/Api/CustomerServices/CustomerServiceApiController.cs new file mode 100644 index 0000000..e6a8459 --- /dev/null +++ b/ARW.WebApi/Controllers/Api/CustomerServices/CustomerServiceApiController.cs @@ -0,0 +1,56 @@ +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.Admin.WebApi.Controllers; +using ARW.Model.Dto.Api.CustomerServices; +using ARW.Service.Api.IBusinessService.CustomerServices; +using ARW.Model.Models.Business.CustomerServices; +using ARW.Model.Vo.Api.CustomerServices; +using Microsoft.AspNetCore.Authorization; +using Geocoding; + +namespace ARW.WebApi.Controllers.Api.CustomerServices +{ + /// + /// 客服控制器Api + /// + /// @author lwh + /// @date 2023-10-21 + /// + //[Verify] + [Route("api/[controller]")] + public class CustomerServiceApiController : BaseController + { + private readonly ICustomerServiceServiceApi _CustomerServiceServiceApi; + + /// + /// 依赖注入 + /// + /// 客服客服Api服务 + public CustomerServiceApiController(ICustomerServiceServiceApi CustomerServiceServiceApi) + { + _CustomerServiceServiceApi = CustomerServiceServiceApi; + } + + + /// + /// 获取客服列表(Api) + /// + /// 查询参数 + /// + [HttpGet("getCustomerServiceList")] + public async Task GetCustomerServiceListApi([FromQuery] CustomerServiceQueryDtoApi parm) + { + var res = await _CustomerServiceServiceApi.GetCustomerServiceListApi(parm); + return SUCCESS(res); + } + + } +} diff --git a/ARW.WebApi/Controllers/Business/CustomerServices/CustomerServiceController.cs b/ARW.WebApi/Controllers/Business/CustomerServices/CustomerServiceController.cs new file mode 100644 index 0000000..5d5e0f6 --- /dev/null +++ b/ARW.WebApi/Controllers/Business/CustomerServices/CustomerServiceController.cs @@ -0,0 +1,97 @@ +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.CustomerServices; +using ARW.Service.Business.IBusinessService.CustomerServices; +using ARW.Admin.WebApi.Controllers; +using ARW.Model.Models.Business.CustomerServices; +using ARW.Model.Vo.Business.CustomerServices; +using Microsoft.AspNetCore.Authorization; +using ARW.Admin.WebApi.Framework; + + +namespace ARW.WebApi.Controllers.Business.CustomerServices +{ + /// + /// 客服控制器 + /// + /// @author lwh + /// @date 2023-10-21 + /// + [Verify] + [Route("business/[controller]")] + public class CustomerServiceController : BaseController + { + private readonly ICustomerServiceService _CustomerServiceService; + + /// + /// 依赖注入 + /// + /// 客服服务 + public CustomerServiceController(ICustomerServiceService CustomerServiceService) + { + _CustomerServiceService = CustomerServiceService; + } + + + /// + /// 获取客服列表 + /// + /// 查询参数 + /// + [HttpGet("getCustomerServiceList")] + [ActionPermissionFilter(Permission = "business:customerservice:list")] + public async Task GetCustomerServiceList([FromQuery] CustomerServiceQueryDto parm) + { + var res = await _CustomerServiceService.GetCustomerServiceList(parm); + return SUCCESS(res); + } + + /// + /// 添加或修改客服 + /// + /// + /// + [HttpPost("addOrUpdateCustomerService")] + [ActionPermissionFilter(Permission = "business:customerservice:addOrUpdate")] + [Log(Title = "添加或修改客服", BusinessType = BusinessType.ADDORUPDATE)] + public async Task AddOrUpdateCustomerService([FromBody] CustomerServiceDto parm) + { + if (parm == null) { throw new CustomException("请求参数错误"); } + var modal = new CustomerService(); + if (parm.CustomerServiceId != 0) modal = parm.Adapt().ToUpdate(HttpContext); + else modal = parm.Adapt().ToCreate(HttpContext); + + var res = await _CustomerServiceService.AddOrUpdateCustomerService(modal); + return SUCCESS(res); + } + + /// + /// 删除客服 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "business:customerservice: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 = _CustomerServiceService.Delete(idsArr); + return SUCCESS("删除成功!"); + } + + + + + + + } +}