Commit bbde2ef0 authored by liudong1993's avatar liudong1993

1

parent 97154239
......@@ -64,5 +64,10 @@ namespace REBORN.Model.Entity.Finance
get;
set;
}
/// <summary>
/// 集团ID
/// </summary>
public int GroupId { get; set; }
}
}
......@@ -87,24 +87,24 @@ namespace REBORN.Module.FinanceModule
/// <returns></returns>
public bool Set(RB_FinancialInstitutions model)
{
IOssService ossService = OssService.Get();
string oldpath = model.Logo;
string NewFileUrl = "";
if (!string.IsNullOrEmpty(oldpath))
{
//转移图片
string userFile = "/New/Upload/Finance/Bank/";
//IOssService ossService = OssService.Get();
//string oldpath = model.Logo;
//string NewFileUrl = "";
//if (!string.IsNullOrEmpty(oldpath))
//{
// //转移图片
// string userFile = "/New/Upload/Finance/Bank/";
if (Config.GetFilePath(oldpath).Contains("/New/"))
{
NewFileUrl = Config.GetFilePath(oldpath).Replace("Temporary", "Finance/Bank");
}
else
{
NewFileUrl = "/New" + Config.GetFilePath(oldpath).Replace("Temporary", "Finance/Bank");
}
ThirdCore.Commom.CommonHelper.OssFileMove(Config.GetFilePath(oldpath), userFile);
}
// if (Config.GetFilePath(oldpath).Contains("/New/"))
// {
// NewFileUrl = Config.GetFilePath(oldpath).Replace("Temporary", "Finance/Bank");
// }
// else
// {
// NewFileUrl = "/New" + Config.GetFilePath(oldpath).Replace("Temporary", "Finance/Bank");
// }
// ThirdCore.Commom.CommonHelper.OssFileMove(Config.GetFilePath(oldpath), userFile);
//}
bool flag = false;
if (model.ID > 0)
{
......@@ -112,7 +112,7 @@ namespace REBORN.Module.FinanceModule
{
{ nameof(RB_FinancialInstitutions.Name),model.Name},
{ nameof(RB_FinancialInstitutions.EnCode),model.EnCode},
{ nameof(RB_FinancialInstitutions.Logo),NewFileUrl},
{ nameof(RB_FinancialInstitutions.Logo),model.Logo},
{ nameof(RB_FinancialInstitutions.Type),(int)model.Type}
};
IList<WhereHelper> whereHelpers = new List<WhereHelper>()
......@@ -123,7 +123,7 @@ namespace REBORN.Module.FinanceModule
}
else
{
model.Logo = NewFileUrl;
//model.Logo = NewFileUrl;
model.Status = (int)Common.Enum.DateStateEnum.Normal;
flag = repository.Insert(model) > 0;
}
......@@ -138,11 +138,12 @@ namespace REBORN.Module.FinanceModule
/// <param name="Name">账号名称</param>
/// <param name="EnCode">机构代码</param>
/// <returns></returns>
public bool Exists(int ID, string Name, string EnCode, int Type)
public bool Exists(int ID, string Name, string EnCode, int Type, int RB_Group_id)
{
IList<WhereHelper> where = new List<WhereHelper>
{
new WhereHelper() { FiledName = nameof(RB_FinancialInstitutions.Status), FiledValue = (int)Common.Enum.DateStateEnum.Normal, OperatorEnum = OperatorEnum.Equal }
new WhereHelper() { FiledName = nameof(RB_FinancialInstitutions.Status), FiledValue = (int)Common.Enum.DateStateEnum.Normal, OperatorEnum = OperatorEnum.Equal },
new WhereHelper() { FiledName = nameof(RB_FinancialInstitutions.GroupId), FiledValue = RB_Group_id, OperatorEnum = OperatorEnum.Equal }
};
if (!string.IsNullOrEmpty(Name))
{
......
......@@ -467,7 +467,8 @@ namespace REBORN.Module.SellModule
EnCode = "",
Logo = "",
Status = DateStateEnum.Normal,
Type = (Common.Enum.Finance.FinancialInstitutionsTypeEnum)(dmodel.AccountClassify == 2 ? 0 : 1)
Type = (Common.Enum.Finance.FinancialInstitutionsTypeEnum)(dmodel.AccountClassify == 2 ? 0 : 1),
GroupId = userInfo.RB_Group_id
};
FinancialInstitutions.ID = new RB_FinancialInstitutionsRepository().Insert(FinancialInstitutions, transCB);
tempFlag = FinancialInstitutions.ID > 0;
......@@ -692,7 +693,8 @@ namespace REBORN.Module.SellModule
EnCode = "",
Logo = "",
Status = DateStateEnum.Normal,
Type = (Common.Enum.Finance.FinancialInstitutionsTypeEnum)(dmodel.AccountClassify == 2 ? 0 : 1)
Type = (Common.Enum.Finance.FinancialInstitutionsTypeEnum)(dmodel.AccountClassify == 2 ? 0 : 1),
GroupId = userInfo.RB_Group_id
};
FinancialInstitutions.ID = new RB_FinancialInstitutionsRepository().Insert(FinancialInstitutions, transCB);
tempFlag = FinancialInstitutions.ID > 0;
......@@ -1388,7 +1390,8 @@ namespace REBORN.Module.SellModule
EnCode = "",
Logo = "",
Status = DateStateEnum.Normal,
Type = (Common.Enum.Finance.FinancialInstitutionsTypeEnum)(dmodel.AccountClassify == 2 ? 0 : 1)
Type = (Common.Enum.Finance.FinancialInstitutionsTypeEnum)(dmodel.AccountClassify == 2 ? 0 : 1),
RB_Group_Id = userInfo.RB_Group_id
};
FinancialInstitutions.ID = new RB_FinancialInstitutionsRepository().Insert(FinancialInstitutions);
flag = FinancialInstitutions.ID > 0;
......
......@@ -1163,7 +1163,8 @@ namespace REBORN.Module.UserModule
EnCode = "",
Logo = "",
Status = DateStateEnum.Normal,
Type = (Common.Enum.Finance.FinancialInstitutionsTypeEnum)(dmodel.AccountClassify == 2 ? 0 : 1)
Type = (Common.Enum.Finance.FinancialInstitutionsTypeEnum)(dmodel.AccountClassify == 2 ? 0 : 1),
GroupId = dmodel.RB_Group_Id??0
};
FinancialInstitutions.ID = new RB_FinancialInstitutionsRepository().Insert(FinancialInstitutions);
flag = FinancialInstitutions.ID > 0;
......
......@@ -29,7 +29,11 @@ namespace REBORN.Repository.Finance
/// <returns></returns>
public List<RB_FinancialInstitutions_Extend> GetPageList(int pageIndex, int pageSize, RB_FinancialInstitutions_Extend model, out long count)
{
string where = string.Format(" AND A." + nameof(RB_FinancialInstitutions.Status) + "={0}", (int)Common.Enum.DateStateEnum.Normal);
string where = string.Format(" A." + nameof(RB_FinancialInstitutions.Status) + "={0}", (int)Common.Enum.DateStateEnum.Normal);
if (model.RB_Group_Id > 0)
{
where += string.Format(" AND A." + nameof(RB_FinancialInstitutions.GroupId) + " ={0}", model.RB_Group_Id);
}
if (!string.IsNullOrWhiteSpace(model.Name))
{
where += string.Format(" AND A." + nameof(RB_FinancialInstitutions.Name) + " like '%{0}%'", model.Name);
......@@ -39,18 +43,7 @@ namespace REBORN.Repository.Finance
where += string.Format(" AND A." + nameof(RB_FinancialInstitutions.Type) + " ={0}", (int)model.Type);
}
string peopletr = "";
//集团
if (model.RB_Group_Id > 0)
{
peopletr += string.Format(" AND " + nameof(Model.Entity.RB_BackAccount.RB_Group_Id) + " ={0}", model.RB_Group_Id);
}
if (model.RB_Branch_Id > 0)
{
peopletr += string.Format(" AND " + nameof(Model.Entity.RB_BackAccount.RB_Branch_Id) + " ={0}", model.RB_Branch_Id);
}
// string sql = string.Format(" SELECT *,(SELECT COUNT(1) FROM rb_backaccount where BackId=A.ID AND `Status`=0) as PeopleNum FROM {0} as A where Type=0 {1} UNION ALL SELECT *, (SELECT COUNT(1) FROM rb_platformaccount where BackId=A.ID AND `Status`=0) as PeopleNum FROM {0} as A where Type = 1 {1} {2}", TableName, where, "ORDER BY ID ASC");
string sql = string.Format(" SELECT *,(SELECT COUNT(1) FROM rb_backaccount where BackId=A.ID AND `Status`=0 {0}) as PeopleNum FROM {1} as A where Type=0 {2} UNION ALL SELECT *, (SELECT COUNT(1) FROM rb_platformaccount where BackId=A.ID AND `Status`=0 {0}) as PeopleNum FROM {1} as A where Type = 1 {2} {3}",peopletr, TableName, where, "ORDER BY ID ASC");
string sql = string.Format(" SELECT * FROM {0} as A where {1}", TableName, where, "ORDER BY ID ASC");
return GetPage<RB_FinancialInstitutions_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
......@@ -61,6 +54,10 @@ namespace REBORN.Repository.Finance
public List<RB_FinancialInstitutions_Extend> GetList(RB_FinancialInstitutions_Extend model)
{
string where = string.Format(" where " + nameof(RB_FinancialInstitutions.Status) + "={0}", (int)Common.Enum.DateStateEnum.Normal);
if (model.RB_Group_Id > 0)
{
where += string.Format(" AND " + nameof(RB_FinancialInstitutions.GroupId) + " ={0}", (int)model.RB_Group_Id);
}
if (!string.IsNullOrWhiteSpace(model.Name))
{
where += string.Format(" AND " + nameof(RB_FinancialInstitutions.Name) + " like '%{0}%'", model.Name);
......@@ -188,3 +185,4 @@ left join rb_accountrelation al on t.BankType=al.AccountType and t.ID=al.Account
}
}
}
......@@ -54,7 +54,11 @@ namespace REBORN.Services.FinanceService
/// <returns></returns>
public virtual ApiResult GetList(RequestParm request)
{
RB_FinancialInstitutions_Extend model = new RB_FinancialInstitutions_Extend();
UserInfo userInfo = request.groupId > 0 && request.requestFrom == Common.Enum.ApiRequestFromEnum.Edu ? CacheManager.User.RbUserCache.GetUserInfoForEdu(request) : CacheManager.User.RbUserCache.GetUserLoginInfo(request.uid);
RB_FinancialInstitutions_Extend model = new RB_FinancialInstitutions_Extend
{
RB_Group_Id = userInfo.RB_Group_id
};
var data = module.GetList(model);
var list = data.Select(x => new
{
......@@ -138,13 +142,13 @@ namespace REBORN.Services.FinanceService
UserInfo userInfo = CacheManager.User.RbUserCache.GetUserLoginInfo(request.uid);
RB_FinancialInstitutions model = JsonConvert.DeserializeObject<RB_FinancialInstitutions>(request.msg.ToString());
JObject parm = JObject.Parse(request.msg.ToString());
model.GroupId = userInfo.RB_Group_id;
if (string.IsNullOrWhiteSpace(model.Name))
{
return ApiResult.Failed("请填写类型名称!");
}
if (module.Exists(model.ID, model.Name, "", (int)model.Type.Value))
if (module.Exists(model.ID, model.Name, "", (int)model.Type.Value, userInfo.RB_Group_id))
{
return ApiResult.Failed("机构名称不能重复!");
}
......
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