TG.WXCRM.V4/BLL/ActivityProduct/ActivityProduct_BL.cs

78 lines
3.2 KiB
C#

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WX.CRM.BLL.Base;
using WX.CRM.BLL.Util;
using WX.CRM.Common;
using WX.CRM.Common.Layui;
using WX.CRM.Common.StockHelper;
using WX.CRM.IBLL.ActivityProduct;
using WX.CRM.Model.Enum;
using WX.CRM.Model.MAP;
namespace WX.CRM.BLL.ActivityProduct
{
public class ActivityProduct_BL : IActivityProduct
{
private CACHE_BL _cache = new CACHE_BL();
public BAS_BUSSINESSLINE_BL line_BL = new BAS_BUSSINESSLINE_BL();
public List<ActivityModel> GetActivityModelList(ref Laypage pager, QueryUserComboDto usercomboDto, ActivityQueryDto dto, decimal userId)
{
var zxdCrmUrl = _cache.GetValue_Parameter(Parameter.Core_ZxdService_WebApi) + "Api/QwOnlinePay/GetActivityList";
//zxdCrmUrl = "https://localhost:7163/Api/QwOnlinePay/GetActivityList";
var postModel = $"pageIndex={pager.page}&pageSize= {pager.limit}";
var paras = Utility.BuildQueryParams<ActivityQueryDto>(dto);
if (!string.IsNullOrWhiteSpace(paras))
{
postModel += paras;
}
if (!string.IsNullOrWhiteSpace(usercomboDto.txt_deptIds))
{
postModel += $"&DeptIds={usercomboDto.txt_deptIds}";
}
else
{
var lineList = line_BL.GetBusinessLineByRoot(userId);
postModel += $"&DeptIds={string.Join(",", lineList.Select(o => o.BUSINESSID))}";
}
postModel += "&IsCrm=1";
var cmsdata = Utility.GetData(zxdCrmUrl, postModel, Encoding.UTF8);
ApiResult<PageResult<ActivityModel>> reqInfo = JsonConvert.DeserializeObject<ApiResult<PageResult<ActivityModel>>>(cmsdata);
pager.count = reqInfo.Data.Total;
return reqInfo.Data.Data.ToList();
}
public List<ActProductModel> GetActProductList(ref Laypage pager, QueryUserComboDto usercomboDto, ActProductQueryDto dto, decimal userId)
{
var zxdCrmUrl = _cache.GetValue_Parameter(Parameter.Core_ZxdService_WebApi) + "Api/QwOnlinePay/GetActProductList";
//zxdCrmUrl = "https://localhost:7163/Api/QwOnlinePay/GetActProductList";
var postModel = $"pageIndex={pager.page}&pageSize= {pager.limit}";
var paras = Utility.BuildQueryParams<ActProductQueryDto>(dto);
if (!string.IsNullOrWhiteSpace(paras))
{
postModel += paras;
}
if (!string.IsNullOrWhiteSpace(usercomboDto.txt_deptIds))
{
postModel += $"&DeptIds={usercomboDto.txt_deptIds}";
}
else
{
var lineList = line_BL.GetBusinessLineByRoot(userId);
postModel += $"&DeptIds={string.Join(",", lineList.Select(o => o.BUSINESSID))}";
}
var cmsdata = Utility.GetData(zxdCrmUrl, postModel, Encoding.UTF8);
ApiResult<PageResult<ActProductModel>> reqInfo = JsonConvert.DeserializeObject<ApiResult<PageResult<ActProductModel>>>(cmsdata);
pager.count = reqInfo.Data.Total;
return reqInfo.Data.Data.ToList();
}
}
}