Commit c687a920 authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/mall.oytour.com into sdzq-ld

parents ab291858 bc0602cc
using Mall.Common.Plugin;
namespace Mall.Common.Enum.TradePavilion
{
/// <summary>
///自定义表单枚举
/// </summary>
public enum CustomFormTypeEnum
{
/// <summary>
/// 招引贡献
/// </summary>
[EnumField("招引贡献")]
ZYGX = 1,
/// <summary>
/// 首展
/// </summary>
[EnumField("首展")]
SZ = 2,
/// <summary>
/// 首秀
/// </summary>
[EnumField("首秀")]
SX = 3,
/// <summary>
/// 首发
/// </summary>
[EnumField("首发")]
SF = 4,
}
}
using Mall.Common.Enum;
using Mall.Common.Enum.TradePavilion;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Model.Entity.TradePavilion
{
/// <summary>
/// 自定义表单实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Custom_Form
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 表单名称
/// </summary>
public string FormName { get; set; }
/// <summary>
/// 表单类型(见枚举)
/// </summary>
public CustomFormTypeEnum FormType { get; set; }
/// <summary>
/// 表单内容
/// </summary>
public string FormData { get; set; }
/// <summary>
/// 商户号id
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateDate { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
}
}
......@@ -23,7 +23,7 @@ namespace Mall.Model.Entity.User
}
/// <summary>
/// 插件类型(1-基础组件,2-营销组件,3-其他组件)
/// 插件类型(1-基础组件,2-营销组件,3-其他组件,4-表单组件)
/// </summary>
public int PlugType
{
......@@ -61,7 +61,7 @@ namespace Mall.Model.Entity.User
/// <summary>
/// 状态
/// </summary>
public int? Status
public int Status
{
get;
set;
......
using Mall.Model.Entity.TradePavilion;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Extend.TradePavilion
{
/// <summary>
/// 自定义表单扩展实体类
/// </summary>
public class RB_Custom_Form_Extend : RB_Custom_Form
{
/// <summary>
/// 表单内容
/// </summary>
public List<FormDataItem> FormDataList { get; set; }
}
/// <summary>
/// 组件对象
/// </summary>
public class FormDataItem
{
/// <summary>
///组件Key
/// </summary>
public string CompKey { get; set; }
/// <summary>
/// 组件对象
/// </summary>
public object CompData { get; set; }
}
/// <summary>
/// 文本对象
/// </summary>
public class TextItem
{
/// <summary>
/// 名字
/// </summary>
public string Name { get; set; }
/// <summary>
/// 字数(0-不限)
/// </summary>
public int WordsLength { get; set; }
/// <summary>
/// 是否必填
/// </summary>
public bool IsRequire { get; set; }
}
/// <summary>
/// 下拉框对象
/// </summary>
public class SelectItem
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 是否多选
/// </summary>
public bool IsMultiple { get; set; }
/// <summary>
/// 选项值(以英文逗号相隔)
/// </summary>
public string OptionValue { get; set; }
/// <summary>
/// 是否必填
/// </summary>
public bool IsRequire { get; set; }
}
/// <summary>
/// 上传组件
/// </summary>
public class UploadItem
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 上传文件数量
/// </summary>
public int FileCount { get; set; }
/// <summary>
/// 上传文件大小M
/// </summary>
public int FileSizeLimit { get; set; }
}
}
......@@ -10,7 +10,7 @@ namespace Mall.Model.Extend.User
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_PlugIn_Extend : Model.Entity.User.RB_PlugIn
public class RB_PlugIn_Extend : Entity.User.RB_PlugIn
{
/// <summary>
/// 组件分类名称
......@@ -22,11 +22,12 @@ namespace Mall.Model.Extend.User
string str = "";
switch (this.PlugType)
{
case 1: str = "基础组件";break;
case 1: str = "基础组件"; break;
case 2: str = "营销组件"; break;
case 3: str = "其他组件"; break;
case 3: str = "其它组件"; break;
case 4: str = "表单组件"; break;
}
return str;
return str;
}
}
......@@ -34,5 +35,10 @@ namespace Mall.Model.Extend.User
/// 商城编号
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 查询插件类型【查询使用】
/// </summary>
public string QPlugTypeStr { get; set; }
}
}
using Mall.Model.Extend.TradePavilion;
using Mall.Repository.TradePavilion;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.AOP.CustomerAttribute;
using Mall.Common.Enum;
using VT.FW.DB;
namespace Mall.Module.TradePavilion
{
/// <summary>
/// 自定义表单处理类
/// </summary>
public class CustomFormModule
{
/// <summary>
/// 自定义表单仓储层对象
/// </summary>
private readonly RB_Custom_FormRepository custom_FormRepository = new RB_Custom_FormRepository();
/// <summary>
/// 获取自定义表单分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Custom_Form_Extend> GetCustomFormPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Custom_Form_Extend query)
{
return custom_FormRepository.GetCustomFormPageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取自定义表单列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Custom_Form_Extend> GetCustomFormListModule(RB_Custom_Form_Extend query)
{
return custom_FormRepository.GetCustomFormListRepository(query);
}
/// <summary>
/// 新增修改自定义表单
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[TransactionCallHandler]
public virtual bool SetCustomFormModule(RB_Custom_Form_Extend model)
{
bool flag = false;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Custom_Form_Extend.FormName),model.FormName.Trim()},
{ nameof(RB_Custom_Form_Extend.FormType),model.FormType},
{ nameof(RB_Custom_Form_Extend.FormData),model.FormData},
{ nameof(RB_Custom_Form_Extend.UpdateBy),model.UpdateBy},
{ nameof(RB_Custom_Form_Extend.UpdateDate),model.UpdateDate},
};
custom_FormRepository.Update(fileds, new WhereHelper(nameof(RB_Custom_Form_Extend.Id), model.Id));
}
else
{
var newId = custom_FormRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 根据编号获取自定义表单
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Custom_Form_Extend GetCustomFormModule(object Id)
{
var extModel = custom_FormRepository.GetEntity<RB_Custom_Form_Extend>(Id);
return extModel;
}
/// <summary>
/// 根据编号删除自定义表单
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool RemoveCustomFormModule(int Id)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Custom_Form_Extend.Status),(int)DateStateEnum.Delete}
};
return custom_FormRepository.Update(fileds, new WhereHelper(nameof(RB_Custom_Form_Extend.Id),Id));
}
}
}
using Mall.Common.Enum;
using Mall.Model.Entity.TradePavilion;
using Mall.Model.Extend.TradePavilion;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Mall.Repository.TradePavilion
{
/// <summary>
/// 自定义表单仓储层
/// </summary>
public class RB_Custom_FormRepository : BaseRepository<RB_Custom_Form>
{
/// <summary>
/// 获取自定义表单分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Custom_Form_Extend> GetCustomFormPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Custom_Form_Extend query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Custom_Form AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.TenantId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrEmpty(query.FormName))
{
builder.AppendFormat(" AND A.{0} LIKE @FormName ", nameof(RB_Custom_Form_Extend.FormName));
parameters.Add("FormName", "%" + query.FormName.Trim() + "%");
}
if (query.Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.Id), query.Id);
}
}
return GetPage<RB_Custom_Form_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取自定义表单列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Custom_Form_Extend> GetCustomFormListRepository(RB_Custom_Form_Extend query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Custom_Form AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.TenantId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrEmpty(query.FormName))
{
builder.AppendFormat(" AND A.{0} LIKE @FormName ", nameof(RB_Custom_Form_Extend.FormName));
parameters.Add("FormName", "%" + query.FormName.Trim() + "%");
}
if (query.Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.Id), query.Id);
}
if (query.FormType > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.FormType), (int)query.FormType);
}
}
return Get<RB_Custom_Form_Extend>(builder.ToString(), parameters).ToList();
}
}
}
......@@ -31,6 +31,10 @@ WHERE 1=1 AND A.Status=0 ");
{
builder.AppendFormat(@" AND A.PlugId IN(SELECT PlugId FROM rb_tenant_plug WHERE TenantId={0}) ", query.TenantId);
}
if (!string.IsNullOrEmpty(query.QPlugTypeStr))
{
builder.AppendFormat(@" AND A.{0} IN({1}) ", nameof(RB_PlugIn_Extend.PlugType), query.QPlugTypeStr);
}
}
return Get<RB_PlugIn_Extend>(builder.ToString()).ToList();
}
......@@ -67,6 +71,10 @@ WHERE 1=1 AND A.Status=0 ");
{
builder.AppendFormat(@" AND {0}={1} ", nameof(RB_PlugIn_Extend.PlugId), query.PlugId);
}
if (!string.IsNullOrEmpty(query.QPlugTypeStr))
{
builder.AppendFormat(@" AND {0} IN({1}) ", nameof(RB_PlugIn_Extend.PlugType), query.QPlugTypeStr);
}
}
return GetPage<RB_PlugIn_Extend>(pageIndex,pageSize,out rowsCount,builder.ToString(),parameters).ToList();
}
......
using Mall.Common.API;
using Mall.Common.Plugin;
using Mall.Model.Extend.TradePavilion;
using Mall.Module.TradePavilion;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Mall.WebApi.Controllers.MallBase
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class CustomFormController : BaseController
{
/// <summary>
/// 自定义表单处理类对象
/// </summary>
private readonly CustomFormModule customFormModule = new CustomFormModule();
/// <summary>
/// 获取自定义表单分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCustomFormPage()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var query = new RB_Custom_Form_Extend()
{
FormName = parms.GetStringValue("FormName"),
FormType = (Common.Enum.TradePavilion.CustomFormTypeEnum)parms.GetInt("FormType")
};
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = customFormModule.GetCustomFormPageModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取自定义表单列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCustomFormList()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var query = new RB_Custom_Form_Extend()
{
FormName = parms.GetStringValue("FormName"),
FormType = (Common.Enum.TradePavilion.CustomFormTypeEnum)parms.GetInt("FormType")
};
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = customFormModule.GetCustomFormListModule( query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 新增修改自定义表单
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetCustomForm()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var model = new RB_Custom_Form_Extend()
{
Id=parms.GetInt("Id"),
FormName = parms.GetStringValue("FormName"),
FormType = (Common.Enum.TradePavilion.CustomFormTypeEnum)parms.GetInt("FormType")
};
var formData = parms.GetStringValue("FormData");
model.MallBaseId = RequestParm.MallBaseId;
model.TenantId = RequestParm.TenantId;
model.CreateBy = base.UserInfo.TenantId;
model.UpdateBy = base.UserInfo.TenantId;
model.CreateDate = DateTime.Now;
model.UpdateDate = DateTime.Now;
model.Status = Common.Enum.DateStateEnum.Normal;
var flag = customFormModule.SetCustomFormModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 根据编号编号获取自定义表单
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCustomForm()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id");
var extModel = customFormModule.GetCustomFormModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 根据编号删除自定义表单
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult RemoveCustomeForm()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id");
var flag = customFormModule.RemoveCustomFormModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取自定义表单类型
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCustomType()
{
var list = EnumHelper.EnumToList(typeof(Common.Enum.TradePavilion.CustomFormTypeEnum));
return ApiResult.Success(data:list);
}
}
}
......@@ -3090,6 +3090,7 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.SourceMallBaseId = parms.MallBaseId;
demodel.SourceTenantId = parms.TenantId;
demodel.CreateBy = -1;
decimal MinProfitRate = 0;
if (demodel.TenantId == 1)
{
......@@ -3214,7 +3215,7 @@ namespace Mall.WebApi.Controllers.MallBase
item.SpecificationPriceList.ForEach(x => x.CreateDate = System.DateTime.Now);
item.SpecificationPriceList.ForEach(x => x.MallBaseId = RequestParm.MallBaseId);
model = item;
model.SourceTenantId = TenantId;
model.SourceMallBaseId = MallBaseId;
model.TenantId = RequestParm.TenantId;
......
......@@ -682,7 +682,9 @@ namespace Mall.WebApi.Controllers.User
public ApiResult GetTenantPlugList()
{
List<object> result = new List<object>();
var plugList = plugInModule.GetPlugInListModule(new RB_PlugIn_Extend());
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var QPlugTypeStr = parms.GetStringValue("QPlugTypeStr");
var plugList = plugInModule.GetPlugInListModule(new RB_PlugIn_Extend() { QPlugTypeStr= QPlugTypeStr });
if (plugList != null && plugList.Count > 0)
{
var tenantPlugList = tenantPlugModule.GetTenantPlugListModule( new RB_Tenant_Plug_Extend { TenantId = RequestParm.TenantId });
......@@ -751,7 +753,16 @@ namespace Mall.WebApi.Controllers.User
/// <returns></returns>
public ApiResult SetPlugIn()
{
var extModel = JsonConvert.DeserializeObject<RB_PlugIn_Extend>(RequestParm.msg.ToString());
JObject jobj = JObject.Parse(RequestParm.msg.ToString());
var extModel = new RB_PlugIn_Extend()
{
PlugId = jobj.GetInt("PlugId"),
PlugType = jobj.GetInt("PlugType"),
Id = jobj.GetStringValue("Id"),
Name = jobj.GetStringValue("Name"),
Icon = jobj.GetStringValue("Icon"),
QPlugTypeStr = "",
};
extModel.Status = 0;
extModel.TenantId = RequestParm.TenantId;
var flag = plugInModule.SetPlugInModule(extModel);
......
......@@ -1825,9 +1825,11 @@ namespace Mall.WebApi.Controllers.User
/// <returns></returns>
public ApiResult GetPlugInList()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var extModel = new RB_PlugIn_Extend()
{
TenantId = RequestParm.TenantId
TenantId = RequestParm.TenantId,
QPlugTypeStr= parms.GetStringValue("QPlugTypeStr"),
};
var list = plugInModule.GetPlugInListModule(extModel);
var distinctList = list.GroupBy(qitem => new { qitem.PlugType, qitem.GroupName }).Select(qitem => new { qitem.Key.PlugType, qitem.Key.GroupName });
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Controller</Controller_SelectedScaffolderCategoryPath>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
<WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
<WebStackScaffolding_LayoutPageFile />
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>E:\Work\Git_Project\Mall_Api\Mall.WebApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>
\ 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