Commit 319f0725 authored by 吴春's avatar 吴春

首店接口调整

parent 80a4e01b
......@@ -11,26 +11,26 @@ namespace Mall.Common.Enum.TradePavilion
/// 商业载体
/// </summary>
[EnumField("商业载体")]
Business = 1,
ZaiTi = 1,
/// <summary>
/// 活力楼宇
/// </summary>
[EnumField("楼宇")]
VitalityBuilding = 2,
LouYu = 2,
/// <summary>
/// 消费品牌
/// </summary>
[EnumField("消费品牌")]
ConsumerBrand = 3,
PinPai = 3,
/// <summary>
/// 企业服务
/// </summary>
[EnumField("企业服务")]
EnterpriseServices = 4,
QiYeFuWu = 4,
}
}
......@@ -16,6 +16,7 @@ using RabbitMQ.Client;
using Mall.Common.Enum.TradePavilion;
using Mall.Model.Query;
using Mall.Model.Extend.User;
using DnsClient;
namespace Mall.Module.TradePavilion
{
......@@ -56,12 +57,12 @@ namespace Mall.Module.TradePavilion
/// 用户
/// </summary>
private readonly Repository.User.RB_Member_UserRepository member_UserRepository = new Repository.User.RB_Member_UserRepository();
/// <summary>
/// 品牌信息仓储层对象
/// </summary>
private readonly RB_BrandRepository brandRepository = new RB_BrandRepository();
/// <summary>
/// 品牌分类信息仓储层对象
/// </summary>
......@@ -78,13 +79,16 @@ namespace Mall.Module.TradePavilion
private readonly RB_PrizeRepository prizeRepository = new RB_PrizeRepository();
/// <summary>
/// 【商载通】楼宇、载体仓储层
/// 活力楼宇仓储层
/// </summary>
private readonly RB_Building_CarrierRepository building_CarrierRepository = new RB_Building_CarrierRepository();
private readonly RB_BuildingRepository buildingRepository = new RB_BuildingRepository();
/// <summary>
/// 【商载通】楼宇、载体地铁仓储层
/// 企业服务仓储层
/// </summary>
private readonly RB_Building_CarriermetroRepository building_CarriermetroRepository = new RB_Building_CarriermetroRepository();
private readonly RB_EnterpriseServicesRepository enterpriseServicesRepository = new RB_EnterpriseServicesRepository();
private readonly TradeIndexRepository tradeIndexRepository = new TradeIndexRepository();
#region 载体
/// <summary>
......@@ -171,8 +175,6 @@ namespace Mall.Module.TradePavilion
return list;
}
/// <summary>
/// 载体信息列表
/// </summary>
......@@ -554,7 +556,6 @@ namespace Mall.Module.TradePavilion
return flag;
}
/// <summary>
///删除载体信息状态
/// </summary>
......@@ -598,7 +599,6 @@ namespace Mall.Module.TradePavilion
}
#endregion
......@@ -658,7 +658,6 @@ namespace Mall.Module.TradePavilion
}
}
#endregion
......@@ -671,9 +670,9 @@ namespace Mall.Module.TradePavilion
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Brand_Extend> GetBrandPageList(int pageIndex, int pageSize, out long rowsCount, RB_Brand_Extend query, bool IsSelectUser = false)
public List<RB_Brand_Extend> GetBrandPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Brand_Extend query, bool IsSelectUser = false)
{
var list = brandRepository.GetBrandPageList(pageIndex, pageSize, out rowsCount, query);
var list = brandRepository.GetBrandPageListRepository(pageIndex, pageSize, out rowsCount, query);
List<RB_Member_User_Extend> ulist = new List<RB_Member_User_Extend>();
if (list != null && list.Any())//绑定奖章
{
......@@ -683,7 +682,7 @@ namespace Mall.Module.TradePavilion
{
ulist = member_UserRepository.GetList(new Model.Extend.User.RB_Member_User_Extend() { MallBaseId = query.MallBaseId, UserIds = userIds });
}
var brandClassList = GetBrandClassListModule(new RB_BrandClass_Extend() { BrandCategory = BrandCategoryEnum.ConsumerBrand, TenantId = query.TenantId, MallBaseId = query.MallBaseId });
var brandClassList = GetBrandClassListModule(new RB_BrandClass_Extend() { BrandCategory = BrandCategoryEnum.PinPai, TenantId = query.TenantId, MallBaseId = query.MallBaseId });
string sourceIds = string.Join(",", list.Where(x => !string.IsNullOrWhiteSpace(x.SourceIds)).Select(x => x.SourceIds));
List<RB_Prize_Extend> prizeList = new List<RB_Prize_Extend>();
if (!string.IsNullOrWhiteSpace(sourceIds))
......@@ -697,8 +696,11 @@ namespace Mall.Module.TradePavilion
if (item.UserId > 0)
{
var umodel = ulist.Where(x => x.Id == item.UserId).FirstOrDefault();
item.UserName = umodel.Name;
item.UserIcon = umodel.Photo;
if (umodel != null && umodel.Id > 0)
{
item.UserName = umodel?.Name ?? "";
item.UserIcon = umodel?.Photo ?? "";
}
}
var tempSourceList = Common.ConvertHelper.StringToList(item.SourceIds);
foreach (var itemSourceId in tempSourceList)
......@@ -1379,7 +1381,6 @@ namespace Mall.Module.TradePavilion
return collectRepository.GetList(query);
}
/// <summary>
/// 新增/修改我关注的会员配置
/// </summary>
......@@ -1421,14 +1422,11 @@ namespace Mall.Module.TradePavilion
return flag;
}
#endregion
#region 奖项
/// <summary>
/// 分页列表
/// </summary>
......@@ -1442,7 +1440,6 @@ namespace Mall.Module.TradePavilion
return prizeRepository.GetPageList(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 奖项列表
/// </summary>
......@@ -1477,7 +1474,6 @@ namespace Mall.Module.TradePavilion
}
}
/// <summary>
///删除奖项状态
/// </summary>
......@@ -1541,5 +1537,158 @@ namespace Mall.Module.TradePavilion
};
return obj;
}
/// <summary>
/// 获取首店-首页(推荐、品牌、项目、租写字楼、服务)
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="query"></param>
/// <param name="rowsCount"></param>
/// <returns></returns>
public List<TradeIndexResult> GetTradeIndexDataModule(int pageIndex, int pageSize, TradeIndexQuery query, out long rowsCount)
{
List<TradeIndexResult> rList = new List<TradeIndexResult>();
BrandCategoryEnum categoryEnum = (BrandCategoryEnum)query.qType;
rowsCount = 0;
//推荐
if (categoryEnum==0)
{
var tiList = tradeIndexRepository.GetTradeIndexPageRepository(pageIndex, pageSize, out rowsCount, query);
foreach (var tItem in tiList)
{
TradeIndexResult tModel = new TradeIndexResult()
{
DataId = tItem.DataId,
DataName = tItem.DataName,
DataType = tItem.DataType,
CoverImg = ""
};
if (tModel.DataType == BrandCategoryEnum.LouYu || tModel.DataType == BrandCategoryEnum.QiYeFuWu)
{
string CoverImg = "";
if (!string.IsNullOrEmpty(tItem.CoverImg))
{
try
{
List<string> imgList = Common.Plugin.JsonHelper.DeserializeObject<List<string>>(tItem.CoverImg);
CoverImg = imgList?.FirstOrDefault() ?? "";
}
catch
{
}
}
tModel.CoverImg = CoverImg;
}
else
{
tModel.CoverImg = tItem.CoverImg;
}
rList.Add(tModel);
}
}
//载体
else if (categoryEnum== BrandCategoryEnum.ZaiTi)
{
var carrierList = GetCarrierPageList(pageIndex, pageSize, out rowsCount, new RB_Carrier_Extend() { MallBaseId = query.MallBaseId });
if (carrierList != null && carrierList.Count > 0)
{
foreach (var cItem in carrierList)
{
var ctirModel = new TradeIndexResult()
{
DataId=cItem.ID,
DataName=cItem.CarrierName,
DataType= BrandCategoryEnum.ZaiTi,
CoverImg=cItem.Logo,
};
rList.Add(ctirModel);
}
}
}
//楼宇
else if (categoryEnum == BrandCategoryEnum.LouYu)
{
var buildList = buildingRepository.GetBuildingPageRepository(pageIndex, pageSize, out rowsCount, new RB_Building_Extend() { MallBaseId = query.MallBaseId });
foreach (var bItem in buildList)
{
var btirModel = new TradeIndexResult()
{
DataId = bItem.BuildId,
DataName = bItem.Name,
DataType = BrandCategoryEnum.LouYu,
};
string CoverImg = "";
if (!string.IsNullOrEmpty(bItem.Banner))
{
try
{
List<string> imgList = Common.Plugin.JsonHelper.DeserializeObject<List<string>>(bItem.Banner);
CoverImg = imgList?.FirstOrDefault() ?? "";
}
catch
{
}
}
btirModel.CoverImg = CoverImg;
rList.Add(btirModel);
}
}
//品牌
else if (categoryEnum == BrandCategoryEnum.PinPai)
{
var brandList = GetBrandPageListModule(pageIndex, pageSize, out rowsCount, new RB_Brand_Extend() { MallBaseId = query.MallBaseId });
foreach (var bItem in brandList)
{
var btirModel = new TradeIndexResult()
{
DataId = bItem.ID,
DataName = bItem.BrandName,
DataType = BrandCategoryEnum.PinPai,
CoverImg = bItem.Logo,
};
rList.Add(btirModel);
}
}
//企业服务
else if (categoryEnum == BrandCategoryEnum.QiYeFuWu)
{
var esList = enterpriseServicesRepository.GetEnterpriseServicesPageRepository(pageIndex, pageSize, out rowsCount, new RB_EnterpriseServices_Extend() { MallBaseId = query.MallBaseId });
foreach (var esItem in esList)
{
var esModel = new TradeIndexResult()
{
DataId = esItem.ServiceId,
DataName = esItem.Name,
DataType = BrandCategoryEnum.QiYeFuWu,
};
string CoverImg = "";
if (!string.IsNullOrEmpty(esItem.Banner))
{
try
{
List<string> imgList = Common.Plugin.JsonHelper.DeserializeObject<List<string>>(esItem.Banner);
CoverImg = imgList?.FirstOrDefault() ?? "";
}
catch
{
}
}
esModel.CoverImg = CoverImg;
rList.Add(esModel);
}
}
foreach (var item in rList)
{
if (string.IsNullOrEmpty(item.CoverImg))
{
item.CoverImg = "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1616552371000_195.png";
}
}
return rList;
}
}
}
......@@ -19,7 +19,7 @@ namespace Mall.Repository.TradePavilion
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Brand_Extend> GetBrandPageList(int pageIndex, int pageSize, out long rowsCount, RB_Brand_Extend query)
public List<RB_Brand_Extend> GetBrandPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Brand_Extend query)
{
rowsCount = 0;
DynamicParameters parameters = new DynamicParameters();
......@@ -59,7 +59,7 @@ WHERE 1=1
}
if (query.BrandClassId > 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Brand_Extend.BrandClassId), query.BrandClassId);
builder.AppendFormat(" AND (a.{0}={2} OR FIND_IN_SET('{2}',a.{1}) > 0 ", nameof(RB_Brand_Extend.BrandClassId), nameof(RB_Brand_Extend.MoreBrandClassId), query.BrandClassId);
}
if (query.ProjectType.HasValue && query.ProjectType > 0)
{
......
......@@ -6,8 +6,8 @@ using Mall.Common.Enum.Goods;
using Mall.Common.Enum.TradePavilion;
using Mall.Common.Enum.User;
using Mall.Common.Plugin;
using Mall.Model.Entity.TradePavilion;
using Mall.Model.Extend.TradePavilion;
using Mall.Model.Query;
using Mall.Module.TradePavilion;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Authorization;
......@@ -15,16 +15,9 @@ using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Org.BouncyCastle.Ocsp;
using RabbitMQ.Client.Framing.Impl;
using Senparc.Weixin.Annotations;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Drawing;
using System.Linq;
using System.Reflection;
namespace Mall.WebApi.Controllers.TradePavilion
{
......@@ -2056,7 +2049,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
}
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = carrierModule.GetBrandPageList(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
var list = carrierModule.GetBrandPageListModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
List<RB_FirstShop_ListEnroll_Extend> listEnroll = new List<RB_FirstShop_ListEnroll_Extend>();
if (list != null && list.Any())
{
......@@ -2166,7 +2159,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
}
/// <summary>
/// 获取品牌分类分页列表
/// 获取品牌分类列表
/// </summary>
/// <returns></returns>
[HttpGet]
......@@ -2187,13 +2180,34 @@ namespace Mall.WebApi.Controllers.TradePavilion
int BrandCategory = parms.GetInt("BrandCategory");
if (BrandCategory == 0)
{
query.BrandCategory = BrandCategoryEnum.ConsumerBrand;
query.BrandCategory = BrandCategoryEnum.PinPai;
}
}
var list = carrierModule.GetBrandClassListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取品牌分类树形列表
/// </summary>
/// <returns></returns>
[HttpGet]
[HttpPost]
[AllowAnonymous]
[RateValve(Policy = Policy.Ip, Limit = 20, Duration = 60)]
public ApiResult GetBrandClassTreeList()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var query = new RB_BrandClass_Extend
{
MallBaseId = RequestParm.MallBaseId,
TenantId = RequestParm.TenantId,
BrandCategory = (BrandCategoryEnum)parms.GetInt("BrandCategory"),
};
var list = carrierModule.GetBrandClassTreeModule(query);
return ApiResult.Success(data: list);
}
#region 奖章
[HttpPost]
[AllowAnonymous]
......@@ -4323,6 +4337,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
return ApiResult.Success(data: pageModel);
}
#endregion
/// <summary>
/// 获取配置项
/// </summary>
......@@ -4337,7 +4352,31 @@ namespace Mall.WebApi.Controllers.TradePavilion
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取配置项
/// </summary>
/// <returns></returns>
[HttpGet]
[HttpPost]
[AllowAnonymous]
[RateValve(Policy = Policy.Ip, Limit = 20, Duration = 60)]
public ApiResult GetTradeIndexData()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
ResultPageModel pageModel = new ResultPageModel()
{
pageIndex = parms.GetInt("pageIndex"),
pageSize = parms.GetInt("pageSize")
};
TradeIndexQuery query = new TradeIndexQuery()
{
qType = parms.GetInt("qType"),
MallBaseId = RequestParm.MallBaseId
};
var dataList = carrierModule.GetTradeIndexDataModule(pageModel.pageIndex, pageModel.pageSize, query, out long rowsCount);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = dataList;
return ApiResult.Success(data: pageModel);
}
}
}
\ No newline at end of file
......@@ -1975,7 +1975,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
query.TenantId = RequestParm.TenantId;
List<object> list = new List<object>();
var dataList = carrierModule.GetBrandPageList(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query, true);
var dataList = carrierModule.GetBrandPageListModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query, true);
foreach (var item in dataList)
{
item.ProjectName = item.ProjectType.GetEnumName();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment