Commit 35ee652f authored by liudong1993's avatar liudong1993

1

parent 97066140
......@@ -3360,7 +3360,6 @@ namespace REBORN.Module.FinanceModule
}
var clientModel = RB_ClientBankAccountRepository.GetEntity(model.ClientID ?? 0);
var jgModel = RB_FinancialInstitutionsRepository.GetEntity((clientModel?.BankId ?? 0));
if (clientModel != null)
{
......@@ -3369,6 +3368,10 @@ namespace REBORN.Module.FinanceModule
model.AccountNumber = clientModel.CardNum;
model.SupplierName = clientModel.SupplierName ?? "暂无";
model.DutyNo = clientModel.DutyNo ?? "暂无";
if (string.IsNullOrEmpty(model.DutyNo) && !(",7,8,9,10,").Contains("," + (int)model.ClientType + ","))
{
model.DutyNo = Rb_SupplierRepository.GetEntity(clientModel.ObjID)?.DutyParagraph ?? "";
}
model.AccountTypeStr = (clientModel.Type == Common.Enum.Finance.ClientTypeEnum.Employee || clientModel.Type == Common.Enum.Finance.ClientTypeEnum.Leader || clientModel.Type == Common.Enum.Finance.ClientTypeEnum.Other) ? "1" : "0";
model.AccountCreateTime = StringHelper.FormatDateTimeStr(clientModel.CreateDate);
if (jgModel != null)
......
......@@ -1139,34 +1139,35 @@ namespace REBORN.Module.UserModule
msg = "大红包结算账户暂不支持修改!";
return false;
}
string LogMsg = $"只修改账户类型及类型对象:由【{model.Type}】【{model.ObjID}】修改为【{dmodel.Type}】【{dmodel.ObjID}】";
//string LogMsg = $"只修改账户类型及类型对象:由【{model.Type}】【{model.ObjID}】修改为【{dmodel.Type}】【{dmodel.ObjID}】";
string LogMsg = "";
if (model.AccountAlias != dmodel.AccountAlias)
{
LogMsg += $",修改账户别名,由【{model.AccountAlias}】修改为【{dmodel.AccountAlias}】";
model.AccountAlias = dmodel.AccountAlias;
}
model.Type = dmodel.Type;
model.ObjID = dmodel.ObjID;
clientBankAccountRepository.Update(model);
msg = "此帐号已关联" + list.Count() + "张有效单据,无法修改基本信息,成功修改账户别名及客户类型";
#region 记录日志
finance_InfoChange_LogRepository.Insert(new Model.Entity.Log.RB_Finance_Infochange_Log()
{
LogId = 0,
RB_Branch_id = dmodel.RB_Branch_Id,
RB_Group_id = dmodel.RB_Group_Id,
UpdateBy = dmodel.CreateBy,
UpdateDate = System.DateTime.Now,
ResourceId = dmodel.ID,
StartValue = LogMsg,
Type = Common.Enum.Log.TemplateEnum.ClientPay,
EndValue = "",
Description = ""
});
#endregion
//model.Type = dmodel.Type;
//model.ObjID = dmodel.ObjID;
clientBankAccountRepository.Update(model);
return false;
#region 记录日志
finance_InfoChange_LogRepository.Insert(new Model.Entity.Log.RB_Finance_Infochange_Log()
{
LogId = 0,
RB_Branch_id = dmodel.RB_Branch_Id,
RB_Group_id = dmodel.RB_Group_Id,
UpdateBy = dmodel.CreateBy,
UpdateDate = System.DateTime.Now,
ResourceId = dmodel.ID,
StartValue = LogMsg,
Type = Common.Enum.Log.TemplateEnum.ClientPay,
EndValue = "",
Description = ""
});
#endregion
}
msg = "此帐号已关联" + list.Count() + "张有效单据,无法修改卡号等信息,成功修改账户别名";
return true;
}
else
{
......@@ -1204,30 +1205,30 @@ namespace REBORN.Module.UserModule
dmodel.AccountHolder = dmodel.AccountAlias;//复制为同一个
}
#region 检查是否包含日语
if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.BankName) && StringHelper.IsIncludeJapan(dmodel.BankName))
{
dmodel.ClientAccountType = 1;
}
if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.OpenBankName) && StringHelper.IsIncludeJapan(dmodel.OpenBankName))
{
dmodel.ClientAccountType = 1;
}
if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.CardNum) && StringHelper.IsIncludeJapan(dmodel.CardNum))
{
dmodel.ClientAccountType = 1;
}
if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.AccountAlias) && StringHelper.IsIncludeJapan(dmodel.AccountAlias))
{
dmodel.ClientAccountType = 1;
}
if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.AccountHolder) && StringHelper.IsIncludeJapan(dmodel.AccountHolder))
{
dmodel.ClientAccountType = 1;
}
if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.CardNum) && (dmodel.CardNum.Contains("普通") || dmodel.CardNum.Length == 7))
{
dmodel.ClientAccountType = 1;
}
//if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.BankName) && StringHelper.IsIncludeJapan(dmodel.BankName))
//{
// dmodel.ClientAccountType = 1;
//}
//if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.OpenBankName) && StringHelper.IsIncludeJapan(dmodel.OpenBankName))
//{
// dmodel.ClientAccountType = 1;
//}
//if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.CardNum) && StringHelper.IsIncludeJapan(dmodel.CardNum))
//{
// dmodel.ClientAccountType = 1;
//}
//if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.AccountAlias) && StringHelper.IsIncludeJapan(dmodel.AccountAlias))
//{
// dmodel.ClientAccountType = 1;
//}
//if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.AccountHolder) && StringHelper.IsIncludeJapan(dmodel.AccountHolder))
//{
// dmodel.ClientAccountType = 1;
//}
//if (dmodel.ClientAccountType == 0 && !string.IsNullOrEmpty(dmodel.CardNum) && (dmodel.CardNum.Contains("普通") || dmodel.CardNum.Length == 7))
//{
// dmodel.ClientAccountType = 1;
//}
#endregion
if (dmodel.ID > 0)
......
using Dapper;
using REBORN.Common;
using REBORN.Common.Enum;
using REBORN.Model.Entity;
using REBORN.Model.Entity.Finance;
......@@ -75,64 +76,85 @@ namespace REBORN.Repository.Finance
string where = " WHERE 1=1 ";
if (!isAll)
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.Status) + "={0} ", (int)DateStateEnum.Normal);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.Status) + "={0} ", (int)DateStateEnum.Normal);
}
if (model.RB_Group_Id > 0)
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.RB_Group_Id) + "={0} ", model.RB_Group_Id);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.RB_Group_Id) + "={0} ", model.RB_Group_Id);
}
if (model.RB_Branch_Id >= 0)
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.RB_Branch_Id) + "={0} ", model.RB_Branch_Id);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.RB_Branch_Id) + "={0} ", model.RB_Branch_Id);
}
if (model.AccountClassify > 0)
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.AccountClassify) + "={0} ", model.AccountClassify);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.AccountClassify) + "={0} ", model.AccountClassify);
}
if (model.ID > 0)
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.ID) + "={0} ", model.ID);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.ID) + "={0} ", model.ID);
}
if (ClientIdStr != "")
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.ID) + " in({0}) ", ClientIdStr);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.ID) + " in({0}) ", ClientIdStr);
}
if (model.Type > 0)
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.Type) + "={0}", (int)model.Type);
if ((",7,8,9,10,").Contains("," + (int)model.Type + ","))
{
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.Type) + "={0}", (int)model.Type);
}
else {
//查询供应商表的 类型
where += string.Format(" AND t." + nameof(RB_ClientBankAccount.Type) + "={0}", (int)model.Type);
// where += $@" and Type =1 AND { nameof(RB_ClientBankAccount.ObjID)} in(
//select s.ID from {(Config.IsOnline? "uat_reborn_dmc" : "reborn_dmc")}.rb_supplier s
//left join {(Config.IsOnline ? "uat_reborn_dmc" : "reborn_dmc")}.rb_supplier_type t on s.ID =t.SupplierId and t.Status=0
//where t.Type={(int)model.Type} {(model.RB_Group_Id > 0 ? " and s.RB_Group_id=" + model.RB_Group_Id : "")}
//)";
}
}
if (model.ObjID > 0)
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.ObjID) + "={0}", model.ObjID);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.ObjID) + "={0}", model.ObjID);
}
if (!string.IsNullOrWhiteSpace(model.RB_CreateByName))
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.ObjID) + " in({0})", model.RB_CreateByName);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.ObjID) + " in({0})", model.RB_CreateByName);
}
if (!string.IsNullOrEmpty(model.AccountAlias))
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.AccountAlias) + "='{0}'", model.AccountAlias);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.AccountAlias) + "='{0}'", model.AccountAlias);
}
if (AccountAlias != "")
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.AccountAlias) + " like @AccountAlias ", AccountAlias);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.AccountAlias) + " like @AccountAlias ", AccountAlias);
parameters.Add("@AccountAlias", "%" + AccountAlias + "%");
}
if (!string.IsNullOrEmpty(model.CardNum))
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.CardNum) + " like @CardNum ", model.CardNum);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.CardNum) + " like @CardNum ", model.CardNum);
parameters.Add("@CardNum", "%" + model.CardNum + "%");
}
if (model.CategoryId > 0)
{
where += string.Format(" AND " + nameof(RB_ClientBankAccount.CategoryId) + "={0}", model.CategoryId);
where += string.Format(" AND c." + nameof(RB_ClientBankAccount.CategoryId) + "={0}", model.CategoryId);
}
if (!string.IsNullOrWhiteSpace(keyWord))
{
where += $@" and ({nameof(RB_ClientBankAccount.AccountAlias)} like @keyWord or {nameof(RB_ClientBankAccount.CardNum)} like @keyWord or {nameof(RB_ClientBankAccount.AccountHolder)} like @keyWord or {nameof(RB_ClientBankAccount.OpenBankName)} like @keyWord )";
where += $@" and (c.{nameof(RB_ClientBankAccount.AccountAlias)} like @keyWord or c.{nameof(RB_ClientBankAccount.CardNum)} like @keyWord or c.{nameof(RB_ClientBankAccount.AccountHolder)} like @keyWord or c.{nameof(RB_ClientBankAccount.OpenBankName)} like @keyWord )";
parameters.Add("@keyWord", "%" + keyWord + "%");
}
return Get<RB_ClientBankAccount>("select * from " + TableName + " " + where, parameters).ToList();
string sql = $@"select* from {TableName} c {where}";
if (model.Type > 0 && !(",7,8,9,10,").Contains("," + (int)model.Type + ","))
{
sql = $@"select* from {TableName} c
left join {(Config.IsOnline ? "uat_reborn_dmc" : "reborn_dmc")}.rb_supplier s on c.ObjID =s.ID and c.Type=1
left join {(Config.IsOnline ? "uat_reborn_dmc" : "reborn_dmc")}.rb_supplier_type t on s.ID =t.SupplierId and t.Status=0
{where} group by c.ID";
}
return Get<RB_ClientBankAccount>(sql, parameters).ToList();
}
/// <summary>
......@@ -217,7 +239,14 @@ namespace REBORN.Repository.Finance
}
if (Type > 0)
{
where += $@" and c.{nameof(RB_ClientBankAccount.Type)}={Type}";
if (Type == 7 || Type == 8 || Type == 9 || Type == 10)
{
where += $@" and c.{nameof(RB_ClientBankAccount.Type)}={Type}";
}
else {
//使用子表查询
where += $@" and t.{nameof(RB_ClientBankAccount.Type)}={Type}";
}
}
if (bankId > 0)
{
......@@ -252,9 +281,11 @@ namespace REBORN.Repository.Finance
{
where += $@" and (c.{nameof(RB_ClientBankAccount.AccountAlias)} like '%{keyWord}%' or c.{nameof(RB_ClientBankAccount.CardNum)} like '%{keyWord}%' or c.{nameof(RB_ClientBankAccount.AccountHolder)} like '%{keyWord}%' or c.{nameof(RB_ClientBankAccount.OpenBankName)} like '%{keyWord}%' )";
}
//left join (SELECT ClientType,ClientID, sum(IFNULL(PayMoney,0)) as PayMoney from {nameof(RB_Finance)} where `Status`=2 GROUP BY ClientType,ClientID) as f on f.ClientType=c.Type and f.ClientID=c.ObjID
string sql = $@" select c.Type,c.ID,c.BankId,c.ObjID,c.AccountHolder,c.AccountAlias,c.OpenBankName,c.CardNum,c.AccountType,c.AccountClassify,c.`Status`,c.CategoryId,c.CreateDate,c.CreateBy,b.Name as BankName,c.RB_CreateByName,c.IsDefaultCommission,c.ClientAccountType
string sql = $@" select c.Type,c.ID,c.BankId,c.ObjID,c.AccountHolder,c.AccountAlias,c.OpenBankName,c.CardNum,c.AccountType,c.AccountClassify,c.`Status`,c.CategoryId,c.CreateDate,c.CreateBy,
b.Name as BankName,c.RB_CreateByName,c.IsDefaultCommission,c.ClientAccountType,s.Name as SupplierName
from {TableName} c left join {nameof(RB_FinancialInstitutions)} b on c.{nameof(RB_ClientBankAccount.BankId)}=b.{nameof(RB_FinancialInstitutions.ID)}
left join {(Config.IsOnline ? "uat_reborn_dmc" : "reborn_dmc")}.rb_supplier s on c.Type=1 and c.ObjID=s.ID
left join {(Config.IsOnline ? "uat_reborn_dmc" : "reborn_dmc")}.rb_supplier_type t on s.ID =t.SupplierId and t.Status=0
where {where} group by c.ID,B.Name order by c.ID desc";
return GetPage<RB_ClientBankAccount_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
......
......@@ -1017,18 +1017,15 @@ namespace REBORN.Services.FinanceService
{
list = list.Where(x => x.Value != "11" && x.Value != "12" && x.Value != "13" && x.Value != "14" && x.Value != "3").ToList();
int MaxId = list.Max(x => Convert.ToInt32(x.Value)) + 1;
foreach (var item in list.Where(x => x.Value == "15").OrderBy(x => Convert.ToInt32(x.Value)))
var SortList = list.Where(x => x.Value == "15").ToList();
SortList.AddRange(list.Where(x => x.Value == "16").ToList());
SortList.AddRange(list.Where(x => x.Value != "15" && x.Value != "16").OrderBy(x => Convert.ToInt32(x.Value)).ToList());
list = SortList;
foreach (var item in list)
{
var obj = new { ID = Convert.ToInt32(item.Value), Name = item.Key, CategoryList = CategoryList.Where(x => x.ParentId == Convert.ToInt32(item.Value)).Select(x => new { ID = MaxId++, CategoryId = x.Id, x.ParentId, x.Name }) };
objlist.Add(obj);
}
foreach (var item in list.Where(x => x.Value != "15").OrderBy(x => Convert.ToInt32(x.Value)))
{
string Name = item.Key;
if (item.Value == "2") { Name = "邮轮供应商"; }
var obj = new { ID = Convert.ToInt32(item.Value), Name = Name, CategoryList = CategoryList.Where(x => x.ParentId == Convert.ToInt32(item.Value)).Select(x => new { ID = MaxId++, CategoryId = x.Id, x.ParentId, x.Name }) };
objlist.Add(obj);
}
return ApiResult.Success("", objlist);
}
else {
......
......@@ -1017,7 +1017,7 @@ namespace REBORN.Services.UserService
{
x.ID,
x.Type,
TypeName = x.Type.GetEnumName(),
TypeName = (",7,8,9,10,").Contains("," + (int)x.Type + ",") ? x.Type.GetEnumName() : "供应商",
x.ObjID,
x.BankId,
x.BankName,
......@@ -1036,8 +1036,7 @@ namespace REBORN.Services.UserService
CreateByName = request.requestFrom == Common.Enum.ApiRequestFromEnum.Edu ? x.RB_CreateByName : CacheManager.User.RbUserCache.GetUserLoginInfo(x.CreateBy.ToString())?.emName,
x.DutyNo,
x.SupplierName,
x.IsDefaultCommission
x.IsDefaultCommission,
});
return ApiResult.Success("", pageModel);
}
......@@ -1100,14 +1099,33 @@ namespace REBORN.Services.UserService
}
if (!string.IsNullOrWhiteSpace(dmodel.CardNum))//判断是否只是中文数字字母
{
if (!StringHelper.IsNumber(dmodel.CardNum))
{
return ApiResult.Failed("卡号只能输入数字");
}
//if (!StringHelper.IsNumber(dmodel.CardNum))
//{
// return ApiResult.Failed("卡号只能输入数字");
//}
//if (dmodel.CardNum.Substring(0, 1) == "0")
//{
// return ApiResult.Failed("卡号不能0开头");
//}
string CardNum = System.Text.RegularExpressions.Regex.Replace(dmodel.CardNum, @"[^0-9]+", "");
var oldInfoList = employeemodule.GetBankAccountListModule(new RB_ClientBankAccount_Extend
{
RB_Group_Id = userInfo.RB_Group_id,
CardNum = CardNum.Replace(" ", ""),
AccountClassify = dmodel.AccountClassify,
});
if (dmodel.ID > 0)
{
oldInfoList = oldInfoList.Where(x => x.ID != dmodel.ID).ToList();
}
if (oldInfoList.Any()) {
foreach (var item in oldInfoList) {
string cardNum2 = System.Text.RegularExpressions.Regex.Replace(item.CardNum, @"[^0-9]+", "");
if (CardNum.Replace(" ", "") == cardNum2.Replace(" ", "")) {
return ApiResult.ParamIsNull("存在相同数字卡号,请核实后再试");
}
}
}
}
if (dmodel.AccountClassify == 2)
......@@ -1201,13 +1219,29 @@ namespace REBORN.Services.UserService
{
dmodel.CardNum = System.Text.RegularExpressions.Regex.Replace(dmodel.CardNum, @"[^0-9]+", "");
}
if (string.IsNullOrWhiteSpace(dmodel.CardNum))
{
return ApiResult.ParamIsNull("请输入卡号数字");
}
var oldInfoList = employeemodule.GetBankAccountListModule(new RB_ClientBankAccount_Extend
{
RB_Group_Id = userInfo.RB_Group_id,
CardNum = string.IsNullOrWhiteSpace(dmodel.CardNum) ? "" : dmodel.CardNum.Replace(" ", ""),
AccountClassify = dmodel.AccountClassify,
});
if (oldInfoList.Any())
{
var cflist = new List<RB_ClientBankAccount_Extend>();
foreach (var item in oldInfoList) {
string cardNum2 = System.Text.RegularExpressions.Regex.Replace(item.CardNum, @"[^0-9]+", "");
if (dmodel.CardNum.Replace(" ", "") == cardNum2.Replace(" ", ""))
{
cflist.Add(item);
}
}
oldInfoList = cflist;
}
return ApiResult.Success("", oldInfoList.Where(x => x.ID != dmodel.ID).Select(x => new
{
x.ID,
......
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