Commit 1980c6b3 authored by 吴春's avatar 吴春

提交代码

parent 0293d2a6
...@@ -51,8 +51,9 @@ ...@@ -51,8 +51,9 @@
<Reference Include="Aliyun.OSS, Version=2.11.0.0, Culture=neutral, PublicKeyToken=0ad4175f0dac0b9b, processorArchitecture=MSIL"> <Reference Include="Aliyun.OSS, Version=2.11.0.0, Culture=neutral, PublicKeyToken=0ad4175f0dac0b9b, processorArchitecture=MSIL">
<HintPath>..\packages\Aliyun.OSS.SDK.2.11.0\lib\net45\Aliyun.OSS.dll</HintPath> <HintPath>..\packages\Aliyun.OSS.SDK.2.11.0\lib\net45\Aliyun.OSS.dll</HintPath>
</Reference> </Reference>
<Reference Include="Aspose.Pdf, Version=17.1.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL"> <Reference Include="Aspose.PDF, Version=23.4.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
<HintPath>..\packages\Aspose.Pdf.17.1.0\lib\net40-client\Aspose.Pdf.dll</HintPath> <HintPath>..\packages\Aspose.PDF.23.4.0\lib\net4.0\Aspose.PDF.dll</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="Aspose.Slides, Version=17.1.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL"> <Reference Include="Aspose.Slides, Version=17.1.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
<HintPath>..\packages\Aspose.Slides.NET.17.1\lib\net4.0-client\Aspose.Slides.dll</HintPath> <HintPath>..\packages\Aspose.Slides.NET.17.1\lib\net4.0-client\Aspose.Slides.dll</HintPath>
......
...@@ -419,5 +419,10 @@ namespace Mall.Model.Entity.Product ...@@ -419,5 +419,10 @@ namespace Mall.Model.Entity.Product
/// 耗材对应的ID /// 耗材对应的ID
/// </summary> /// </summary>
public int MaterialId { get; set; } public int MaterialId { get; set; }
/// <summary>
/// 和平商旅下单自定义表单内容
/// </summary>
public string CustomFormInfo { get; set; }
} }
} }
...@@ -221,6 +221,13 @@ namespace Mall.Module.Product ...@@ -221,6 +221,13 @@ namespace Mall.Module.Product
/// </summary> /// </summary>
private readonly RB_Goods_RelevanceRepository goods_RelevanceRepository = new RB_Goods_RelevanceRepository(); private readonly RB_Goods_RelevanceRepository goods_RelevanceRepository = new RB_Goods_RelevanceRepository();
/// <summary>
/// 关联商品仓储层对象
/// </summary>
private readonly Repository.TradePavilion.RB_Custom_FormRepository custom_FormRepository = new Repository.TradePavilion.RB_Custom_FormRepository();
#region 教育咖啡劵 #region 教育咖啡劵
/// <summary> /// <summary>
/// 教育商品 /// 教育商品
...@@ -1459,7 +1466,7 @@ namespace Mall.Module.Product ...@@ -1459,7 +1466,7 @@ namespace Mall.Module.Product
System.Threading.Tasks.Task.Run(() => CacheManager.AppletWeChat.WeiXinReidsCache.Set(appletWeChatModel.MiniAppId, token)); System.Threading.Tasks.Task.Run(() => CacheManager.AppletWeChat.WeiXinReidsCache.Set(appletWeChatModel.MiniAppId, token));
} }
if (!string.IsNullOrEmpty(token)) if (!string.IsNullOrEmpty(token))
{ {
string GetImageUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + token;//获取小程序码 string GetImageUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + token;//获取小程序码
var postData = new var postData = new
{ {
...@@ -1477,6 +1484,195 @@ namespace Mall.Module.Product ...@@ -1477,6 +1484,195 @@ namespace Mall.Module.Product
#endregion #endregion
#region 自定义表单解析
/// <summary>
/// 解析表单组件
/// </summary>
/// <param name="formData"></param>
/// <param name="isGetAnswer"></param>
/// <returns></returns>
public List<Model.Extend.TradePavilion.FormDataItem> AnalyzeFormComponent(string formData, bool isGetAnswer = false)
{
List<Model.Extend.TradePavilion.FormDataItem> dataList = new List<Model.Extend.TradePavilion.FormDataItem>();
if (!string.IsNullOrEmpty(formData))
{
JArray jArray = JArray.Parse(formData);
if (jArray != null && jArray.Count > 0)
{
foreach (var jItem in jArray)
{
JObject jObj = JObject.Parse(jItem.ToString());
Model.Extend.TradePavilion.FormDataItem dataItem = new Model.Extend.TradePavilion.FormDataItem()
{
CompKey = jObj.GetStringValue("CompKey"),
CompData = new object(),
isCked = false,
};
if (!string.IsNullOrEmpty(dataItem.CompKey))
{
string compData = jObj.GetStringValue("CompData");
switch (dataItem.CompKey)
{
//单行文本
case "SingleLineText":
Model.Extend.TradePavilion.TextItem txtItem = GetTextItem(compData);
if (!isGetAnswer)
{
txtItem.TextValue = "";
}
dataItem.CompData = txtItem;
break;
//多行文本
case "MultiLineText":
Model.Extend.TradePavilion.TextItem multiItem = GetTextItem(compData);
if (!isGetAnswer)
{
multiItem.TextValue = "";
}
dataItem.CompData = multiItem;
break;
//下拉框
case "DorpDownList":
Model.Extend.TradePavilion.SelectItem selectItem = GetSelectItem(compData);
if (!isGetAnswer)
{
selectItem.OptionValue = "";
}
dataItem.CompData = selectItem;
break;
//图片上传组件
case "ImageUploadComp":
Model.Extend.TradePavilion.UploadItem imgItem = GetUploadItem(compData);
if (!isGetAnswer)
{
imgItem.FileList = new List<string>();
}
dataItem.CompData = imgItem;
break;
//视频上传组件
case "VideoUploadComp":
Model.Extend.TradePavilion.UploadItem videoItem = GetUploadItem(compData);
if (!isGetAnswer)
{
videoItem.FileList = new List<string>();
}
dataItem.CompData = videoItem;
break;
//通用上传组件
case "CommonUploadComp":
Model.Extend.TradePavilion.UploadItem commonUpload = GetUploadItem(compData);
if (!isGetAnswer)
{
commonUpload.FileList = new List<string>();
}
dataItem.CompData = commonUpload;
break;
}
dataList.Add(dataItem);
}
}
}
}
return dataList;
}
/// <summary>
/// 获取文本框信息
/// </summary>
/// <param name="CompData"></param>
/// <returns></returns>
private Model.Extend.TradePavilion.TextItem GetTextItem(string CompData)
{
JObject textObj = JObject.Parse(CompData);
Model.Extend.TradePavilion.TextItem txtItem = new Model.Extend.TradePavilion.TextItem()
{
Name = textObj.GetStringValue("Name"),
WordsLength = textObj.GetInt("WordsLength"),
IsRequire = textObj.GetBoolValue("IsRequire"),
Remark = textObj.GetStringValue("Remark"),
TextValue = textObj.GetStringValue("TextValue"),
};
return txtItem;
}
/// <summary>
/// 获取下拉框信息
/// </summary>
/// <param name="CompData"></param>
/// <returns></returns>
private Model.Extend.TradePavilion.SelectItem GetSelectItem(string CompData)
{
JObject dropdownObj = JObject.Parse(CompData);
Model.Extend.TradePavilion.SelectItem selectItem = new Model.Extend.TradePavilion.SelectItem()
{
Name = dropdownObj.GetStringValue("Name"),
IsMultiple = dropdownObj.GetBoolValue("IsMultiple"),
IsRequire = dropdownObj.GetBoolValue("IsRequire"),
OptionList = new List<Model.Extend.TradePavilion.SelectOption>(),
Remark = dropdownObj.GetStringValue("Remark"),
};
if (selectItem.IsMultiple)
{
List<int> valueList = Common.ConvertHelper.StringToList(dropdownObj.GetStringValue("OptionValue").Split(','));
if (valueList != null && valueList.Count > 0)
{
selectItem.OptionValue = string.Join(",", valueList);
}
}
else
{
selectItem.OptionValue = dropdownObj.GetStringValue("OptionValue");
}
var optionList = JArray.Parse(dropdownObj.GetStringValue("OptionList"));
if (optionList != null && optionList.Count > 0)
{
foreach (var oItem in optionList)
{
JObject optionObj = JObject.Parse(oItem.ToString());
Model.Extend.TradePavilion.SelectOption option = new Model.Extend.TradePavilion.SelectOption()
{
Id = optionObj.GetInt("Id"),
Name = optionObj.GetStringValue("Name"),
};
selectItem.OptionList.Add(option);
}
}
return selectItem;
}
/// <summary>
/// 获取上传配置信息
/// </summary>
/// <param name="CompData"></param>
/// <returns></returns>
private Model.Extend.TradePavilion.UploadItem GetUploadItem(string CompData)
{
JObject uploadObj = JObject.Parse(CompData);
Model.Extend.TradePavilion.UploadItem uploadItem = new Model.Extend.TradePavilion.UploadItem()
{
Name = uploadObj.GetStringValue("Name"),
FileCount = uploadObj.GetInt("FileCount"),
FileType = uploadObj.GetStringValue("FileType"),
FileSizeLimit = uploadObj.GetInt("FileSizeLimit"),
Remark = uploadObj.GetStringValue("Remark"),
FileList = new List<string>(),
};
if (!string.IsNullOrEmpty(uploadObj.GetStringValue("FileList")))
{
try
{
uploadItem.FileList = JsonHelper.DeserializeObject<List<string>>(uploadObj.GetStringValue("FileList"));
}
catch
{
}
}
return uploadItem;
}
#endregion
/// <summary> /// <summary>
/// 获取小程序商品详情 /// 获取小程序商品详情
/// </summary> /// </summary>
...@@ -2175,8 +2371,8 @@ namespace Mall.Module.Product ...@@ -2175,8 +2371,8 @@ namespace Mall.Module.Product
{ {
attr_group_name = smodel.Name, attr_group_name = smodel.Name,
attr_group_id = smodel.Sort, attr_group_id = smodel.Sort,
attr_id = svmodel?.Id??0, attr_id = svmodel?.Id ?? 0,
attr_name = svmodel?.Name??"" attr_name = svmodel?.Name ?? ""
}); });
} }
decimal price_member = item.SellingPrice ?? 0;//未设会员价格的话 就为销售价格 decimal price_member = item.SellingPrice ?? 0;//未设会员价格的话 就为销售价格
...@@ -2430,6 +2626,15 @@ namespace Mall.Module.Product ...@@ -2430,6 +2626,15 @@ namespace Mall.Module.Product
GetGoodsOrderPeopleInfo(out decimal payment_amount, out int payment_num, out int payment_order, out int payment_people, goodsId); GetGoodsOrderPeopleInfo(out decimal payment_amount, out int payment_num, out int payment_order, out int payment_people, goodsId);
#endregion #endregion
#region 获取商品的自定义表单
Model.Entity.TradePavilion.RB_Custom_Form customFormModel = new Model.Entity.TradePavilion.RB_Custom_Form();
if (model.FormsId > 1)
{
customFormModel = custom_FormRepository.GetEntity(model.FormsId);
var dataList = AnalyzeFormComponent(customFormModel.FormData, isGetAnswer: false);
}
#endregion
#region 返回参数 #region 返回参数
string shipping = ""; string shipping = "";
...@@ -2494,9 +2699,9 @@ namespace Mall.Module.Product ...@@ -2494,9 +2699,9 @@ namespace Mall.Module.Product
var goodsRelevanceList = goods_RelevanceRepository.GetGoodsRelevanceListRepository(new RB_Goods_Relevance_Extend() var goodsRelevanceList = goods_RelevanceRepository.GetGoodsRelevanceListRepository(new RB_Goods_Relevance_Extend()
{ {
MallBaseId=model.MallBaseId, MallBaseId = model.MallBaseId,
TenantId=model.TenantId, TenantId = model.TenantId,
GoodsId=model.Id GoodsId = model.Id
}); });
List<RB_Goods_Preferential_Extend> goodsPreferentialList = new List<RB_Goods_Preferential_Extend>(); List<RB_Goods_Preferential_Extend> goodsPreferentialList = new List<RB_Goods_Preferential_Extend>();
goodsPreferentialList = RB_Goods_PreferentialRepository.GetGoodsPreferentialListRepostory(new RB_Goods_Preferential_Extend { TenantId = model.TenantId, MallBaseId = model.MallBaseId, GoodsId = model.Id }); goodsPreferentialList = RB_Goods_PreferentialRepository.GetGoodsPreferentialListRepostory(new RB_Goods_Preferential_Extend { TenantId = model.TenantId, MallBaseId = model.MallBaseId, GoodsId = model.Id });
...@@ -2520,13 +2725,13 @@ namespace Mall.Module.Product ...@@ -2520,13 +2725,13 @@ namespace Mall.Module.Product
use_attr = model.IsCustomSpecification, use_attr = model.IsCustomSpecification,
remark = model?.Remark ?? "", remark = model?.Remark ?? "",
edu_data = eduDataJson, edu_data = eduDataJson,
EduTeacherId= model?.EduTeacherId??0, EduTeacherId = model?.EduTeacherId ?? 0,
attr_groups = model.SpecificationList.Select(x => new attr_groups = model.SpecificationList.Select(x => new
{ {
attr_group_id = x.Sort, attr_group_id = x.Sort,
attr_group_name = x.Name, attr_group_name = x.Name,
//购买次数(进阶小课堂使用) //购买次数(进阶小课堂使用)
service_time= model.ServiceTime, service_time = model.ServiceTime,
attr_list = x.SpecificationValueList.Select(z => new attr_list = x.SpecificationValueList.Select(z => new
{ {
attr_id = z.Sort, attr_id = z.Sort,
...@@ -2560,7 +2765,7 @@ namespace Mall.Module.Product ...@@ -2560,7 +2765,7 @@ namespace Mall.Module.Product
//sign = "", //sign = "",
//model?.CustomShareImagePath??"",HK 2021-10-15修改 //model?.CustomShareImagePath??"",HK 2021-10-15修改
app_share_pic = "", app_share_pic = "",
app_share_title = model?.CustomShareTitles??"", app_share_title = model?.CustomShareTitles ?? "",
is_default_services = model.IsDefaultService, is_default_services = model.IsDefaultService,
sort = model.Sort, sort = model.Sort,
created_at = model.CreateDate.HasValue ? model.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", created_at = model.CreateDate.HasValue ? model.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
...@@ -2579,15 +2784,16 @@ namespace Mall.Module.Product ...@@ -2579,15 +2784,16 @@ namespace Mall.Module.Product
area_type=x.AreaType area_type=x.AreaType
}) } }, }) } },
form_id = model.FormsId, form_id = model.FormsId,
//form_data_json= new { formData = !string.IsNullOrWhiteSpace(customFormModel.FormData)?JsonConvert.DeserializeObject<List<Model.Extend.TradePavilion.FormDataItem>>(customFormModel.FormData):new List<Model.Extend.TradePavilion.FormDataItem>(), formType=customFormModel.FormType },
sales = (model.SalesNum ?? 0) + payment_num,//已售出数量 + 订单商品数量// sales = (model.SalesNum ?? 0) + payment_num,//已售出数量 + 订单商品数量//
name = model.Name, name = model.Name,
subname = model?.SubName??"", subname = model?.SubName ?? "",
original_price = model.OriginalPrice, original_price = model.OriginalPrice,
jjxkt_original_price = oldOriginalPrice, jjxkt_original_price = oldOriginalPrice,
cover_pic = model.CoverImage, cover_pic = model.CoverImage,
unit = model.Unit, unit = model.Unit,
detail = model.GoodsDetails, detail = model.GoodsDetails,
video_url = model?.VideoAddress??"", video_url = model?.VideoAddress ?? "",
level_show = (userModel?.MemberGrade ?? 0) > 0 ? 1 : 2,//是否显示会员价 level_show = (userModel?.MemberGrade ?? 0) > 0 ? 1 : 2,//是否显示会员价
is_sales = model.GoodsStatus == 1 && model.InventoryNum > 0 ? 1 : 2,//是否可购买 is_sales = model.GoodsStatus == 1 && model.InventoryNum > 0 ? 1 : 2,//是否可购买
attr = priceList, attr = priceList,
...@@ -2646,7 +2852,7 @@ namespace Mall.Module.Product ...@@ -2646,7 +2852,7 @@ namespace Mall.Module.Product
is_quick_shop = model.IsQuickBuy, is_quick_shop = model.IsQuickBuy,
is_sell_well = model.IsSellWell, is_sell_well = model.IsSellWell,
is_negotiable = model.IsGoodsNegotiable, is_negotiable = model.IsGoodsNegotiable,
freeShippingName = model.FreeShippingModel?.Name??"", freeShippingName = model.FreeShippingModel?.Name ?? "",
fullMoneyPinkage = model.FreeShippingModel?.FullMoneyPinkage ?? 0, fullMoneyPinkage = model.FreeShippingModel?.FullMoneyPinkage ?? 0,
fullNumPinkage = model?.FreeShippingModel?.FullNumPinkage ?? 0, fullNumPinkage = model?.FreeShippingModel?.FullNumPinkage ?? 0,
freeShippingUrl = model?.FreeShippingModel?.FreeShippingUrl, freeShippingUrl = model?.FreeShippingModel?.FreeShippingUrl,
...@@ -7871,9 +8077,11 @@ namespace Mall.Module.Product ...@@ -7871,9 +8077,11 @@ namespace Mall.Module.Product
#endregion #endregion
#region 修改咖啡劵商品 #region 修改咖啡劵商品
if (goodsModel.GoodsEduType == 1 || goodsModel.GoodsEduType == 2) { if (goodsModel.GoodsEduType == 1 || goodsModel.GoodsEduType == 2)
{
var eduGoodsMdoel = eduGoodsRepository.GetList(new Model.Extend.Education.RB_Goods_ViewModel() { MallBaseId = goodsModel.MallBaseId, MallGoodsId = goodsModel.Id }).FirstOrDefault(); var eduGoodsMdoel = eduGoodsRepository.GetList(new Model.Extend.Education.RB_Goods_ViewModel() { MallBaseId = goodsModel.MallBaseId, MallGoodsId = goodsModel.Id }).FirstOrDefault();
if (eduGoodsMdoel != null) { if (eduGoodsMdoel != null)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() { Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(Model.Extend.Education.RB_Goods_ViewModel.CoverImage), demodel.CarouselImageList.Where(x => x.Type == 0).FirstOrDefault()?.Path ?? ""}, { nameof(Model.Extend.Education.RB_Goods_ViewModel.CoverImage), demodel.CarouselImageList.Where(x => x.Type == 0).FirstOrDefault()?.Path ?? ""},
{ nameof(Model.Extend.Education.RB_Goods_ViewModel.GoodsName), demodel.Name}, { nameof(Model.Extend.Education.RB_Goods_ViewModel.GoodsName), demodel.Name},
...@@ -7939,7 +8147,7 @@ namespace Mall.Module.Product ...@@ -7939,7 +8147,7 @@ namespace Mall.Module.Product
Sort = item.Sort, Sort = item.Sort,
Status = 0, Status = 0,
TenantId = demodel.TenantId, TenantId = demodel.TenantId,
IsDateFormat=item.IsDateFormat, IsDateFormat = item.IsDateFormat,
}); });
if (sid > 0) if (sid > 0)
{ {
...@@ -8041,7 +8249,8 @@ namespace Mall.Module.Product ...@@ -8041,7 +8249,8 @@ namespace Mall.Module.Product
} }
} }
if (demodel.GoodsEduType == 1 || demodel.GoodsEduType == 2) { if (demodel.GoodsEduType == 1 || demodel.GoodsEduType == 2)
{
//咖啡劵商品 (分布式事务 无法跨服保存) //咖啡劵商品 (分布式事务 无法跨服保存)
eduGoodsRepository.Insert(new Model.Entity.Coffee.RB_Goods() eduGoodsRepository.Insert(new Model.Entity.Coffee.RB_Goods()
{ {
...@@ -8078,7 +8287,7 @@ namespace Mall.Module.Product ...@@ -8078,7 +8287,7 @@ namespace Mall.Module.Product
/// <returns></returns> /// <returns></returns>
public RB_Goods_Extend GetProductGoodsInfo(int goodsId, int TenantId, int MallBaseId) public RB_Goods_Extend GetProductGoodsInfo(int goodsId, int TenantId, int MallBaseId)
{ {
var model = goodsRepository.GetEntity(goodsId).RefMapperTo<RB_Goods_Extend>(); var model = goodsRepository.GetEntity(goodsId).RefMapperTo<RB_Goods_Extend>();
if (model == null || model.TenantId != TenantId || model.MallBaseId != MallBaseId) if (model == null || model.TenantId != TenantId || model.MallBaseId != MallBaseId)
{ {
...@@ -8120,8 +8329,8 @@ namespace Mall.Module.Product ...@@ -8120,8 +8329,8 @@ namespace Mall.Module.Product
{ {
SName = smodel.Name, SName = smodel.Name,
SId = smodel.Id, SId = smodel.Id,
SVId = svmodel?.Sort??0, SVId = svmodel?.Sort ?? 0,
SVName = svmodel?.Name??"", SVName = svmodel?.Name ?? "",
}); });
} }
item.AttrList = AttrList; item.AttrList = AttrList;
...@@ -8410,7 +8619,7 @@ namespace Mall.Module.Product ...@@ -8410,7 +8619,7 @@ namespace Mall.Module.Product
{ {
model.FormsName = "默认表单"; model.FormsName = "默认表单";
} }
model.RelevanceList= goods_RelevanceRepository.GetGoodsRelevanceListRepository(new RB_Goods_Relevance_Extend() model.RelevanceList = goods_RelevanceRepository.GetGoodsRelevanceListRepository(new RB_Goods_Relevance_Extend()
{ {
TenantId = model.TenantId, TenantId = model.TenantId,
MallBaseId = model.MallBaseId, MallBaseId = model.MallBaseId,
...@@ -8974,12 +9183,12 @@ namespace Mall.Module.Product ...@@ -8974,12 +9183,12 @@ namespace Mall.Module.Product
return false; return false;
} }
var pModel = plist.FirstOrDefault(); var pModel = plist.FirstOrDefault();
Dictionary<string, object> keyValues = new Dictionary<string, object>() Dictionary<string, object> keyValues = new Dictionary<string, object>()
{ {
{ nameof(RB_Goods_Proxy.Status),1}, { nameof(RB_Goods_Proxy.Status),1},
{ nameof(RB_Goods_Proxy.Remark),DateTime.Now.ToString("yyyy-MM-dd")+ " 取消代理"} { nameof(RB_Goods_Proxy.Remark),DateTime.Now.ToString("yyyy-MM-dd")+ " 取消代理"}
}; };
List<WhereHelper> wheres = new List<WhereHelper>() List<WhereHelper> wheres = new List<WhereHelper>()
{ {
new WhereHelper() new WhereHelper()
{ {
...@@ -8992,12 +9201,12 @@ namespace Mall.Module.Product ...@@ -8992,12 +9201,12 @@ namespace Mall.Module.Product
if (flag) if (flag)
{ {
//删除商品 //删除商品
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() Dictionary<string, object> keyValues1 = new Dictionary<string, object>()
{ {
{ nameof(RB_Goods.Status),1}, { nameof(RB_Goods.Status),1},
{ nameof(RB_Goods.UpdateDate),DateTime.Now} { nameof(RB_Goods.UpdateDate),DateTime.Now}
}; };
List<WhereHelper> wheres1 = new List<WhereHelper>() List<WhereHelper> wheres1 = new List<WhereHelper>()
{ {
new WhereHelper() new WhereHelper()
{ {
......
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