98 lines
3.3 KiB
C#
98 lines
3.3 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 客服接口实现类
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-10-21
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(ICustomerServiceService), ServiceLifetime = LifeTime.Transient)]
|
|
public class CustomerServiceServiceImpl : BaseService<CustomerService>, ICustomerServiceService
|
|
{
|
|
private readonly CustomerServiceRepository _CustomerServiceRepository;
|
|
|
|
public CustomerServiceServiceImpl(CustomerServiceRepository CustomerServiceRepository)
|
|
{
|
|
this._CustomerServiceRepository = CustomerServiceRepository;
|
|
}
|
|
|
|
#region 业务逻辑代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询客服分页列表
|
|
/// </summary>
|
|
public async Task<PagedInfo<CustomerServiceVo>> GetCustomerServiceList(CustomerServiceQueryDto parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<CustomerService>();
|
|
|
|
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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加或修改客服
|
|
/// </summary>
|
|
public async Task<string> 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
|
|
|
|
}
|
|
}
|