Commit da036630 authored by liudong1993's avatar liudong1993
parents 11607f42 bdb034f2
using REBORN.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Property.Model.Entity.Mall
{
/// <summary>
/// 资产管理授权实体
/// </summary>
[Serializable]
[DB(ConnectionName = "MallConnection")]
public class RB_ERP_Authorize
{
public int ID { get; set; }
/// <summary>
/// 商户id
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// 状态1待审核,2-已审核,3-已拒绝,4-已作废
/// </summary>
public int Status { get; set; }
public DateTime? CreateDate { get; set; }
public DateTime? UpdateDate { get; set; }
public int CreateBy { get; set; }
/// <summary>
/// 类型2-集团,1-员工
/// </summary>
public int Type { get; set; }
/// <summary>
/// 商城中的用户id
/// </summary>
public int MallUserId { get; set; }
/// <summary>
/// 域名
/// </summary>
public string DomainName { get; set; }
/// <summary>
/// 账号
/// </summary>
public string Account { get; set; }
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; }
///// <summary>
///// erp账号id
///// </summary>
//public int ERPUserId { get; set; }
/// <summary>
/// erp集团id
/// </summary>
public int ERPGroupId { get; set; }
}
}
......@@ -85,5 +85,16 @@ namespace Property.Model.Entity
get;
set;
}
/// <summary>
/// 商户id
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
}
}
\ No newline at end of file
using Property.Model.Entity.Mall;
using REBORN.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Property.Model.Extend.Mall
{
/// <summary>
/// 资产管理授权实体
/// </summary>
[Serializable]
[DB(ConnectionName = "MallConnection")]
public class RB_ERP_Authorize_Extend : RB_ERP_Authorize
{
/// <summary>
/// 创建人
/// </summary>
public string EmpName { get; set; }
/// <summary>
/// 电商员工信息
/// </summary>
public string MallUserName { get; set; }
}
}
using NPOI.SS.Formula.Functions;
using Property.Model.Entity.Mall;
using Property.Model.Extend.Mall;
using Property.Repository;
using Property.Repository.Mall;
using System;
using System.Collections.Generic;
namespace Property.Module.Mall
{
public class AuthorizeModule
{
/// <summary>
/// 授权仓储层
/// </summary>
private readonly RB_ERP_AuthorizeRepository authorizeRepository = new RB_ERP_AuthorizeRepository();
#region 用户/集团授权
/// <summary>
/// 授权分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_ERP_Authorize_Extend> GetAuthorizePageList(int pageIndex, int pageSize, out long rowCount, RB_ERP_Authorize_Extend query)
{
return authorizeRepository.GetAuthorizePageList(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 授权列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_ERP_Authorize_Extend> GetAuthorizeList(RB_ERP_Authorize_Extend query)
{
return authorizeRepository.GetAuthorizeList(query);
}
public bool AddERPAuthorize(RB_ERP_Authorize model)
{
if (model.ID == 0)
{
return authorizeRepository.Insert(model) > 0;
}
else if (model.ID > 0)
{
return authorizeRepository.Update(model);
}
return false;
}
/// <summary>
/// 审核权限
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool UpdateERPAuthorize(RB_ERP_Authorize model)
{
if (model.ID > 0)
{
Dictionary<string, object> files = new Dictionary<string, object>() {
{ nameof(RB_ERP_Authorize.Status),model.Status},
{ nameof(RB_ERP_Authorize.UpdateDate),model.UpdateDate}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_ERP_Authorize.ID),
FiledValue=model.ID,
OperatorEnum=OperatorEnum.Equal
}
};
return authorizeRepository.Update(files, wheres);
}
return false;
}
#endregion
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Property.Common\Property.Common.csproj" />
<ProjectReference Include="..\Property.Model\Property.Model.csproj" />
<ProjectReference Include="..\Property.Repository\Property.Repository.csproj" />
</ItemGroup>
</Project>
using Property.Model.Entity.Mall;
using Property.Model.Extend.Mall;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Property.Repository.Mall
{
public class RB_ERP_AuthorizeRepository : RepositoryBase<RB_ERP_Authorize>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_ERP_Authorize); } }
/// <summary>
/// 授权分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_ERP_Authorize_Extend> GetAuthorizePageList(int pageIndex, int pageSize, out long rowCount, RB_ERP_Authorize_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT a.*,b.EmpName,c.EmpName as MallUserName FROM {TableName} as a LEFT JOIN rb_employee as b on a.CreateBy=b.EmpId LEFT JOIN rb_employee as c on a.MallUserId=c.EmpId WHERE 1=1");
if (query != null)
{
if (query.ID > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.ID)}={query.ID}");
}
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.MallBaseId)}={query.MallBaseId}");
}
if (query.Status > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.Status)}={query.Status}");
}
if (query.Type > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.Type)}={query.Type}");
}
if (query.ERPGroupId > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.ERPGroupId)}={query.ERPGroupId}");
}
}
return GetPage<RB_ERP_Authorize_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 授权列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_ERP_Authorize_Extend> GetAuthorizeList(RB_ERP_Authorize_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT a.*,b.EmpName FROM {TableName} as a LEFT JOIN rb_employee as b on a.CreateBy=b.EmpId WHERE 1=1");
if (query != null)
{
if (query.ID > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.ID)}={query.ID}");
}
if (query.Status > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.Status)}={query.Status}");
}
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.TenantId)}={query.TenantId}");
}
if (query.MallBaseId > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.MallBaseId)}={query.MallBaseId}");
}
if (query.Type > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.Type)}={query.Type}");
}
if (query.MallUserId > 0)
{
builder.Append($" AND a.{nameof(RB_ERP_Authorize_Extend.MallUserId)}={query.MallUserId}");
}
}
return Get<RB_ERP_Authorize_Extend>(builder.ToString()).ToList();
}
}
}
......@@ -28,7 +28,14 @@ namespace Property.Repository
{
where += " and " + nameof(RB_Supplies_WareHouse_Extend.Name) + " like '%" + dmodel.Name.Trim() + "%'";
}
if (dmodel.TenantId > 0)
{
where += " and " + nameof(RB_Supplies_WareHouse_Extend.TenantId) + "="+ dmodel.TenantId;
}
if (dmodel.MallBaseId > 0)
{
where += " and " + nameof(RB_Supplies_WareHouse_Extend.MallBaseId) + "=" + dmodel.MallBaseId;
}
string sql = $@" select * from RB_Supplies_WareHouse {where} order by Id desc";
return GetPage<RB_Supplies_WareHouse_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
......@@ -48,7 +55,16 @@ namespace Property.Repository
{
where += " and " + nameof(RB_Supplies_WareHouse_Extend.Name) + " like '%" + dmodel.Name + "%'";
}
if (!string.IsNullOrEmpty(dmodel.WareHouseIdStr)) {
if (dmodel.TenantId > 0)
{
where += " and " + nameof(RB_Supplies_WareHouse_Extend.TenantId) + "=" + dmodel.TenantId;
}
if (dmodel.MallBaseId > 0)
{
where += " and " + nameof(RB_Supplies_WareHouse_Extend.MallBaseId) + "=" + dmodel.MallBaseId;
}
if (!string.IsNullOrEmpty(dmodel.WareHouseIdStr))
{
where += $@" and {nameof(RB_Supplies_WareHouse.Id)} in ({dmodel.WareHouseIdStr})";
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Property.Model.Entity.Mall;
using Property.Model.Extend.Mall;
using Property.Module.Mall;
using REBORN.Common;
using REBORN.Common.API;
namespace Property.WebApi.Controllers.Mall
{
[Route("api/[controller]")]
[ApiController]
public class AuthorizeController : PApiController
{
private readonly AuthorizeModule authorizeModule = new AuthorizeModule();
/// <summary>
/// 获取人员授权分页信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMaterialPageList()
{
var requestParm = GetRequestParm();
UserInfo userInfo = CacheManager.User.UserReidsCache.GetUserLoginInfo(requestParm.uid);
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(requestParm.msg.ToString());
RB_ERP_Authorize_Extend demodel = JsonConvert.DeserializeObject<RB_ERP_Authorize_Extend>(requestParm.msg.ToString());
demodel.ERPGroupId = userInfo.RB_Group_id;
var list = authorizeModule.GetAuthorizePageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.ID,
x.Type,
x.Status,
x.TenantId,
x.MallBaseId,
x.CreateBy,
x.EmpName,
x.DomainName,
x.Account,
x.MallUserName,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd") : "",
UpdateDate = x.UpdateDate.HasValue ? x.UpdateDate.Value.ToString("yyyy-MM-dd") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 新增授权信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult UpdateAuthorize()
{
var requestParm = GetRequestParm();
RB_ERP_Authorize demodel = JsonConvert.DeserializeObject<RB_ERP_Authorize>(requestParm.msg.ToString());
demodel.UpdateDate = System.DateTime.Now;
bool result = authorizeModule.UpdateERPAuthorize(demodel);
if (result)
{
return ApiResult.Success("操作成功");
}
else
{
return ApiResult.Failed("操作失败");
}
}
}
}
......@@ -23,6 +23,7 @@
<ProjectReference Include="..\Property.Mobule.User\Property.Module.User.csproj" />
<ProjectReference Include="..\Property.Modele.FixedAssets\Property.Module.FixedAssets.csproj" />
<ProjectReference Include="..\Property.Model\Property.Model.csproj" />
<ProjectReference Include="..\Property.Module.Mall\Property.Module.Mall.csproj" />
</ItemGroup>
<ItemGroup>
......
......@@ -7,7 +7,9 @@
"FinanceConnection": "server=192.168.2.214;port=3306;user id=reborn;password=Reborn@2018;database=test_reborn_finance;CharSet=utf8; Convert Zero Datetime=true; ",
"FinanceConnectionPName": "MySql.Data.MySqlClient",
"LogConnection": "server=192.168.2.214;port=3306;user id=reborn;password=Reborn@2018;database=reborn_log;CharSet=utf8; Convert Zero Datetime=true; ",
"LogConnectionPName": "MySql.Data.MySqlClient"
"LogConnectionPName": "MySql.Data.MySqlClient",
"MallConnection": "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=test_reborn_mall;CharSet=utf8; Convert Zero Datetime=true; ",
"MallConnectionPName": "MySql.Data.MySqlClient"
},
"Logging": {
"LogLevel": {
......
......@@ -29,7 +29,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Property.Module.User", "Pro
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Property.Component", "Property.Component", "{8B5369C6-A5B7-484F-A29F-2BF28A260316}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Property.IM", "Property.IM\Property.IM.csproj", "{45FD625D-D8D5-4B52-A448-78C873BF50E2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Property.IM", "Property.IM\Property.IM.csproj", "{45FD625D-D8D5-4B52-A448-78C873BF50E2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Property.Module.Mall", "Property.Module.Mall\Property.Module.Mall.csproj", "{D1E63AE5-90CA-4BE2-A223-CBF74C25358D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -77,6 +79,10 @@ Global
{45FD625D-D8D5-4B52-A448-78C873BF50E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45FD625D-D8D5-4B52-A448-78C873BF50E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45FD625D-D8D5-4B52-A448-78C873BF50E2}.Release|Any CPU.Build.0 = Release|Any CPU
{D1E63AE5-90CA-4BE2-A223-CBF74C25358D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1E63AE5-90CA-4BE2-A223-CBF74C25358D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1E63AE5-90CA-4BE2-A223-CBF74C25358D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1E63AE5-90CA-4BE2-A223-CBF74C25358D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -91,6 +97,7 @@ Global
{5585BF82-E3A6-4AB2-92C8-EB78BB1943E0} = {DD22A1DA-47B9-4DA1-A51A-43782C5A0715}
{05E17D78-904D-4FBE-AED6-980BA9C1AAED} = {B0E2800E-D230-43C1-B82A-479FEC01C14B}
{45FD625D-D8D5-4B52-A448-78C873BF50E2} = {8B5369C6-A5B7-484F-A29F-2BF28A260316}
{D1E63AE5-90CA-4BE2-A223-CBF74C25358D} = {B0E2800E-D230-43C1-B82A-479FEC01C14B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F12B7B58-1A24-4732-B0B6-92008AE4A06D}
......
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