Commit 2ef5972d authored by 吴春's avatar 吴春

提交代码

parent eddebdbe
......@@ -58,7 +58,7 @@ namespace Mall.Model.Extend.Product
/// 教师id
/// </summary>
public int TeacherId { get; set; }
#region 司导信息
/// <summary>
......@@ -218,6 +218,12 @@ namespace Mall.Model.Extend.Product
/// 商品ids
/// </summary>
public string GoodsIds { get; set; }
/// <summary>
/// 分享来源商品ids
/// </summary>
public string SourceGoodsIdIds { get; set; }
/// <summary>
/// 商品str
/// </summary>
......@@ -359,6 +365,11 @@ namespace Mall.Model.Extend.Product
/// 门店名称
/// </summary>
public List<string> StoreNameList { get; set; }
/// <summary>
/// 供应商名称
/// </summary>
public string SupplierName { get; set; }
}
/// <summary>
......
......@@ -7214,6 +7214,7 @@ namespace Mall.Module.Product
{ nameof(RB_Goods.FatCode),demodel.FatCode },
{ nameof(RB_Goods.GoodsUrl),demodel.GoodsUrl },
{ nameof(RB_Goods.goodsLogo),demodel.goodsLogo },
{ nameof(RB_Goods.RetailStore),demodel.RetailStore },
};
if (goodsModel.IsProcurement == 1)
{
......@@ -7251,6 +7252,7 @@ namespace Mall.Module.Product
{ nameof(RB_Goods.EnjoyMember),demodel.EnjoyMember},
{ nameof(RB_Goods.SeparateSetMember),demodel.SeparateSetMember},
{ nameof(RB_Goods.IsQuickBuy),demodel.IsQuickBuy},
{ nameof(RB_Goods.RetailStore),demodel.RetailStore },
};
}
......
......@@ -103,6 +103,10 @@ namespace Mall.Repository.Product
{
where += $@" and g.{nameof(RB_Goods_Extend.SupplierId)}={dmodel.SupplierId}";
}
if (dmodel.CreateBy > -1)
{
where += $@" and g.{nameof(RB_Goods_Extend.CreateBy)}={dmodel.CreateBy}";
}
if (dmodel.MinProfitRate > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.MinProfitRate)} <{dmodel.MinProfitRate}";
......@@ -160,8 +164,9 @@ namespace Mall.Repository.Product
orderBy = " g.InventoryNum desc";
}
string sql = $@"select g.* from RB_Goods g
string sql = $@"select g.*,s.`Name` as SupplierName from RB_Goods g
inner join rb_goods_category c on g.Id=c.GoodsId
LEFT JOIN rb_supplier as s on g.SupplierId=s.ID
where {where} group by g.Id order by {orderBy}";
return GetPage<RB_Goods_Extend>(pageIndex, pageSize, out rowCount, sql, parameters).ToList();
}
......@@ -579,6 +584,10 @@ where {where} group by g.Id order by {orderBy}";
{
where += $@" and g.{nameof(RB_Goods_Extend.Id)} in({dmodel.GoodsIds})";
}
if (!string.IsNullOrEmpty(dmodel.SourceGoodsIdIds))
{
where += $@" and g.{nameof(RB_Goods_Extend.SourceGoodsId)} in({dmodel.SourceGoodsIdIds})";
}
if (!string.IsNullOrEmpty(dmodel.StoresIds))
{
where += $@" and locate(',{dmodel.StoresIds},', CONCAT(',',g.{nameof(RB_Goods_Extend.StoresIds)},',') )";
......
......@@ -417,82 +417,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
/// <summary>
/// 把分享平台的商品加入商品列表
/// </summary>
/// <returns></returns>
public ApiResult SynchroGoods()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var CategoryList = JsonHelper.DeserializeObject<List<RB_Goods_Category_Extend>>(parms.GetStringValue("CategoryList"));//商品分类
string GoodsIds = parms.GetStringValue("GoodsIds");//商品ids
//根据商品id获取商品信息
var goodsList = productModule.GetGoodsList(new RB_Goods_Extend { GoodsIds = GoodsIds });
if (goodsList.Any(x => x.SourceGoodsId > 0))
{
return ApiResult.Failed("分享平台的商品不能多次分享添加");
}
//获取商品的规格以及价格
var goodsSpecificationList = productModule.GetSpecificationList(new RB_Goods_Specification_Extend { GoodsIds = GoodsIds });
var goodsSpecificationValueList = productModule.GetSpecificationValueList(new RB_Goods_SpecificationValue_Extend { GoodsIds = GoodsIds });
var goodsSpecificationPriceList = productModule.GetSpecificationPriceList(new RB_Goods_SpecificationPrice_Extend { GoodsIds = GoodsIds });
var newGoodsList = new List<RB_Goods_Extend>();
foreach (var item in goodsList)
{
RB_Goods_Extend model = new RB_Goods_Extend();
item.IsDefaultService = 1;
item.IsAreaBuy = 2;
item.SeparateDistribution = 2;
item.SeparateSetMember = 2;
item.EnjoyMember = 2;
item.FreightId = 0;
item.FreightName = "";
item.FormsId = -1;
item.FormsName = "";
item.PresentFXGrade = 0;
item.PresentFXMonth = 0;
item.IsNoTax = 0;
item.CategoryList = CategoryList;
item.SpecificationList = new List<RB_Goods_Specification_Extend>();
item.SpecificationList = goodsSpecificationList.Where(x => x.GoodsId == item.Id).ToList();
foreach (var itemSpecification in item.SpecificationList)
{
itemSpecification.SpecificationValueList = new List<RB_Goods_SpecificationValue_Extend>();
itemSpecification.SpecificationValueList = goodsSpecificationValueList.Where(x => x.GoodsId == item.Id && x.SpecificationId == itemSpecification.Id).ToList();
if (itemSpecification.SpecificationValueList != null && itemSpecification.SpecificationValueList.Any())
{
itemSpecification.SpecificationValueList.ForEach(x => x.Id = 0);
itemSpecification.SpecificationValueList.ForEach(x => x.TenantId = RequestParm.TenantId);
itemSpecification.SpecificationValueList.ForEach(x => x.MallBaseId = RequestParm.MallBaseId);
itemSpecification.SpecificationValueList.ForEach(x => x.CreateDate = System.DateTime.Now);
}
}
item.SpecificationList.ForEach(x => x.Id = 0);
item.SpecificationList.ForEach(x => x.TenantId = RequestParm.TenantId);
item.SpecificationList.ForEach(x => x.CreateDate = System.DateTime.Now);
item.SpecificationList.ForEach(x => x.MallBaseId = RequestParm.MallBaseId);
item.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
item.SpecificationPriceList = goodsSpecificationPriceList.Where(x => x.GoodsId == item.Id).ToList();
item.SpecificationPriceList.ForEach(x => x.Id = 0);
item.SpecificationPriceList.ForEach(x => x.TenantId = RequestParm.TenantId);
item.SpecificationPriceList.ForEach(x => x.CreateDate = System.DateTime.Now);
item.SpecificationPriceList.ForEach(x => x.MallBaseId = RequestParm.MallBaseId);
model = item;
model.TenantId = RequestParm.TenantId;
model.MallBaseId = RequestParm.MallBaseId;
model.SourceTenantId = item.TenantId;
model.SourceMallBaseId = item.MallBaseId;
model.SourceGoodsId = item.Id;
model.RetailStore = 0;
model.Id = 0;
model.CreateDate = System.DateTime.Now;
model.UpdateDate = System.DateTime.Now;
newGoodsList.Add(model);
}
bool result = productModule.SynchroGoods(newGoodsList);
return result ? ApiResult.Success("") : ApiResult.Failed("加入到商品列表失败");
}
......@@ -1306,6 +1231,14 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
if (UserInfo.IsOtherUpdateGoods == 0 && parms.TenantId == 1 && parms.MallBaseId == 1)
{
demodel.CreateBy = UserInfo.EmpId;
}
else
{
demodel.CreateBy = -1;
}
decimal MinProfitRate = 0;
if (demodel.TenantId == 1)
{
......@@ -1342,7 +1275,10 @@ namespace Mall.WebApi.Controllers.MallBase
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
x.IsNoTax,
IsLowProfit = MinProfitRate > 0 ? x.MinProfitRate < MinProfitRate ? 1 : 2 : 2,
x.CreateBy
x.CreateBy,
x.SourceGoodsId,
x.RetailStore,
x.SupplierName
});
return ApiResult.Success("", pagelist);
}
......@@ -1950,6 +1886,7 @@ namespace Mall.WebApi.Controllers.MallBase
FatCode = parms.GetStringValue("FatCode"),
GoodsUrl = parms.GetStringValue("GoodsUrl"),
goodsLogo = parms.GetStringValue("goodsLogo"),
RetailStore = parms.GetInt("RetailStore"),
};
if (!string.IsNullOrEmpty(parms.GetStringValue("ShelvesDate")))
{
......@@ -2554,6 +2491,19 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.ParamIsNull("请选择供应商");
}
}
else if (Type == 13)
{
var goodsList = productModule.GetGoodsList(new RB_Goods_Extend { GoodsIds = GoodsIds });
if (goodsList != null && goodsList.Any())
{
if (goodsList.Any(x => x.SourceGoodsId > 0))
{
return ApiResult.ParamIsNull("同步商品不能加入分销平台");
}
}
}
bool flag = productModule.SetProductGoodsQuickUpdate(GoodsIds, Type, Sort, GoodsName, FreightId, LimitBuyGoodsNum, LimitBuyOrderNum, IntegralPresent
, IntegralPresentType, PointsDeduction, PointsDeductionType, IsMultipleDeduction, IsQuickBuy, IsGoodsNegotiable, SupplierId, RetailStore, req.TenantId, req.MallBaseId);
......@@ -3103,5 +3053,168 @@ namespace Mall.WebApi.Controllers.MallBase
}
#endregion
#region 分享平台
/// <summary>
/// 商品后台分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductGoodsSynchroPageList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
JObject parameters = JObject.Parse(RequestParm.msg.ToString());
RB_Goods_Extend demodel = new RB_Goods_Extend()
{
Name = parameters.GetStringValue("Name"),
GoodsStatus = parameters.GetInt("GoodsStatus"),
IsSelectSellOut = parameters.GetInt("IsSelectSellOut"),
CategoryIds = parameters.GetStringValue("CategoryIds"),
Id = parameters.GetInt("Id"),
StartTime = parameters.GetStringValue("StartTime"),
EndTime = parameters.GetStringValue("EndTime"),
OrderBy = parameters.GetInt("OrderBy"),
RetailStore = parameters.GetInt("RetailStore", -1),
SupplierId = parameters.GetInt("SupplierId", 0),
};
//demodel.TenantId = parms.TenantId;
// demodel.MallBaseId = parms.MallBaseId;s
decimal MinProfitRate = 0;
if (demodel.TenantId == 1)
{
//MinProfitRate = Convert.ToDecimal(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("MinProfitRate")["TenantId1"]);
}
if (demodel.IsSelectLowProfit == 1)
{
demodel.MinProfitRate = MinProfitRate;
}
var list = productModule.GetProductGoodsPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
List<RB_Goods_Extend> goodsList = new List<RB_Goods_Extend>();
if (list != null && list.Any())
{
string GoodsIds = string.Join(",", list.Select(x => x.Id));//商品ids
//根据商品id获取商品信息
goodsList = productModule.GetGoodsList(new RB_Goods_Extend { SourceGoodsIdIds = GoodsIds, TenantId = parms.TenantId, MallBaseId = parms.MallBaseId });
}
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.Name,
x.Sort,
x.CoverImage,
CategoryList = x.CategoryList.Select(y => new { y.Id, y.CategoryName }),
x.SellingPrice,
x.InventoryNum,
x.SalesNum,
x.GoodsBuyNum,
x.IsQuickBuy,
x.IsProxy,
x.IsProcurement,
x.ProcurementStatus,
x.GoodsStatus,
x.TenantId,
x.MallBaseId,
x.SendArea,
x.Remark,
GoodsPageTypeStr = x.GoodsPageType.GetEnumName(),
CarouselImageList = x.CarouselImageList.Select(qitem => qitem.Path).ToList(),
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
x.IsNoTax,
IsLowProfit = MinProfitRate > 0 ? x.MinProfitRate < MinProfitRate ? 1 : 2 : 2,
x.CreateBy,
x.SourceGoodsId,
x.RetailStore,
x.SupplierName,
Isynchro = (goodsList != null && goodsList.Any()) ? goodsList.Where(x => x.SourceGoodsId == x.Id).Count() : 0
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 把分享平台的商品加入商品列表
/// </summary>
/// <returns></returns>
public ApiResult SynchroGoods()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var CategoryList = JsonHelper.DeserializeObject<List<RB_Goods_Category_Extend>>(parms.GetStringValue("CategoryList"));//商品分类
string GoodsIds = parms.GetStringValue("GoodsIds");//商品ids
//根据商品id获取商品信息
var goodsList = productModule.GetGoodsList(new RB_Goods_Extend { GoodsIds = GoodsIds });
if (goodsList.Any(x => x.SourceGoodsId > 0))
{
return ApiResult.Failed("分享平台的商品不能多次分享添加");
}
//获取商品的规格以及价格
var goodsSpecificationList = productModule.GetSpecificationList(new RB_Goods_Specification_Extend { GoodsIds = GoodsIds });
var goodsSpecificationValueList = productModule.GetSpecificationValueList(new RB_Goods_SpecificationValue_Extend { GoodsIds = GoodsIds });
var goodsSpecificationPriceList = productModule.GetSpecificationPriceList(new RB_Goods_SpecificationPrice_Extend { GoodsIds = GoodsIds });
var newGoodsList = new List<RB_Goods_Extend>();
foreach (var item in goodsList)
{
RB_Goods_Extend model = new RB_Goods_Extend();
item.IsDefaultService = 1;
item.IsAreaBuy = 2;
item.SeparateDistribution = 2;
item.SeparateSetMember = 2;
item.EnjoyMember = 2;
item.FreightId = 0;
item.FreightName = "";
item.FormsId = -1;
item.FormsName = "";
item.PresentFXGrade = 0;
item.PresentFXMonth = 0;
item.CostPrice = 0;
item.IsNoTax = 0;
item.CategoryList = CategoryList;
item.SpecificationList = new List<RB_Goods_Specification_Extend>();
item.SpecificationList = goodsSpecificationList.Where(x => x.GoodsId == item.Id).ToList();
foreach (var itemSpecification in item.SpecificationList)
{
itemSpecification.SpecificationValueList = new List<RB_Goods_SpecificationValue_Extend>();
itemSpecification.SpecificationValueList = goodsSpecificationValueList.Where(x => x.GoodsId == item.Id && x.SpecificationId == itemSpecification.Id).ToList();
if (itemSpecification.SpecificationValueList != null && itemSpecification.SpecificationValueList.Any())
{
itemSpecification.SpecificationValueList.ForEach(x => x.Id = 0);
itemSpecification.SpecificationValueList.ForEach(x => x.TenantId = RequestParm.TenantId);
itemSpecification.SpecificationValueList.ForEach(x => x.MallBaseId = RequestParm.MallBaseId);
itemSpecification.SpecificationValueList.ForEach(x => x.CreateDate = System.DateTime.Now);
}
}
item.SpecificationList.ForEach(x => x.Id = 0);
item.SpecificationList.ForEach(x => x.TenantId = RequestParm.TenantId);
item.SpecificationList.ForEach(x => x.CreateDate = System.DateTime.Now);
item.SpecificationList.ForEach(x => x.MallBaseId = RequestParm.MallBaseId);
item.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
item.SpecificationPriceList = goodsSpecificationPriceList.Where(x => x.GoodsId == item.Id).ToList();
item.SpecificationPriceList.ForEach(x => x.Id = 0);
item.SpecificationPriceList.ForEach(x => x.TenantId = RequestParm.TenantId);
item.SpecificationPriceList.ForEach(x => x.CostMoney = 0);
item.SpecificationPriceList.ForEach(x => x.CreateDate = System.DateTime.Now);
item.SpecificationPriceList.ForEach(x => x.MallBaseId = RequestParm.MallBaseId);
model = item;
model.TenantId = RequestParm.TenantId;
model.MallBaseId = RequestParm.MallBaseId;
model.SourceTenantId = item.TenantId;
model.SourceMallBaseId = item.MallBaseId;
model.SourceGoodsId = item.Id;
model.RetailStore = 0;
model.Id = 0;
model.CreateDate = System.DateTime.Now;
model.UpdateDate = System.DateTime.Now;
newGoodsList.Add(model);
}
bool result = productModule.SynchroGoods(newGoodsList);
return result ? ApiResult.Success("") : ApiResult.Failed("加入到商品列表失败");
}
#endregion
}
}
\ No newline at end of file
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