Commit 69b90b23 authored by 吴春's avatar 吴春
parents 43a7af41 3fabc1cb
using Mall.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Common.Enum.Finance
{
/// <summary>
/// 客户类型枚举
/// </summary>
public enum FinanceConfigurationEnum
{
/// <summary>
///收款
/// </summary>
[EnumField("收款")]
HotelSupplier = 1,
/// <summary>
/// 成本
/// </summary>
[EnumField("成本")]
TicketSupplier = 2,
/// <summary>
/// 退款
/// </summary>
[EnumField("退款")]
DiningSupplier = 3,
/// <summary>
/// 打款
/// </summary>
[EnumField("打款")]
CarSupplier = 4,
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Model.Entity.Finance
{
/// <summary>
/// 账户类型
/// </summary>
[Serializable]
[DB(ConnectionName = "FinanceConnection")]
public class RB_AccountType
{
/// <summary>
/// 编号
/// </summary>
public int ID
{
get;
set;
}
/// <summary>
/// 创建人
/// </summary>
public int? CreateBy
{
get;
set;
}
/// <summary>
/// 创建日期
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 集团
/// </summary>
public int? RB_Group_Id
{
get;
set;
}
/// <summary>
/// 公司
/// </summary>
public int? RB_Branch_Id
{
get;
set;
}
/// <summary>
/// 状态
/// </summary>
public Common.Enum.DateStateEnum? Status
{
get;
set;
}
/// <summary>
/// 备注
/// </summary>
public string Remark
{
get;
set;
}
/// <summary>
/// 类型名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 是否对公
/// </summary>
public int? IsPublic
{
get;
set;
}
/// <summary>
/// 虚拟类型
/// </summary>
public int? IsVirtual
{
get;
set;
}
}
}
using Mall.Common.AOP;
using System;
namespace Mall.Model.Entity.Finance
{
/// <summary>
/// 公司银行账户表 实体
/// </summary>
[Serializable]
[DB(ConnectionName = "FinanceConnection")]
public class RB_BackAccount
{
/// <summary>
/// ID
/// </summary>
public int ID
{
get;
set;
}
/// <summary>
/// 账户别名
/// </summary>
public string Alias
{
get;
set;
}
/// <summary>
/// 账户类型
/// </summary>
public int? TypeId
{
get;
set;
}
/// <summary>
/// 银行机构
/// </summary>
public int? BackId
{
get;
set;
}
/// <summary>
/// 开户人
/// </summary>
public string Accountholder
{
get;
set;
}
/// <summary>
/// 开户行
/// </summary>
public string Openingbank
{
get;set;
}
/// <summary>
/// 银行卡号
/// </summary>
public string BackNo
{
get;
set;
}
/// <summary>
/// 初始余额
/// </summary>
public decimal? Initialbalance
{
get;
set;
}
/// <summary>
/// 账户币种
/// </summary>
public int? CurrencyId
{
get;
set;
}
/// <summary>
/// 操作人
/// </summary>
public int? CreateBy
{
get;
set;
}
/// <summary>
/// 操作日期
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 集团
/// </summary>
public int? RB_Group_Id
{
get;
set;
}
/// <summary>
/// 公司
/// </summary>
public int? RB_Branch_Id
{
get;
set;
}
/// <summary>
/// 风险上线
/// </summary>
public decimal? RiskLimitMoney
{
get;
set;
}
/// <summary>
/// 风险下限
/// </summary>
public decimal? RiskLowerLimitMoney
{
get;set;
}
/// <summary>
/// 收入负责人
/// </summary>
public int? InCharge
{
get;set;
}
/// <summary>
/// 支出负责人
/// </summary>
public int? OutCharge
{
get; set;
}
/// <summary>
/// 状态
/// </summary>
public Common.Enum.DateStateEnum? Status
{
get;
set;
}
/// <summary>
/// 账户2019-01-01 初始金额
/// </summary>
private decimal? accountStartMoney=0;
/// <summary>
/// 账户2019-01-01 初始金额
/// </summary>
public decimal? AccountStartMoney { get => accountStartMoney; set => accountStartMoney = value; }
/// <summary>
/// 账户2019-01-01 初始原币金额
/// </summary>
private decimal? accountStartWBMoney = 0;
/// <summary>
/// 账户2019-01-01 初始原币金额
/// </summary>
public decimal? AccountStartWBMoney { get => accountStartWBMoney; set => accountStartWBMoney = value; }
/// <summary>
/// 期初应用时间
/// </summary>
public DateTime? BeginTime { get; set; }
}
}
\ No newline at end of file
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Model.Entity.Finance
{
/// <summary>
/// 费用类型表
/// </summary>
[Serializable]
[DB(ConnectionName = "FinanceConnection")]
public class RB_Costtype
{
/// <summary>
/// ID
/// </summary>
public int ID
{
get;
set;
}
/// <summary>
/// 父级节点
/// </summary>
public int? ParentId { get; set; }
/// <summary>
/// 层级
/// </summary>
public int? Tier { get; set; }
/// <summary>
/// 根节点ID
/// </summary>
public int? RootId { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? Sort { get; set; }
/// <summary>
/// 是否摊账0-否1-是
/// </summary>
public int? IsShareAccount { get; set; }
/// <summary>
/// 费用类型
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 1-收入2-支出3-收支
/// </summary>
public Common.Enum.Finance.WFTempLateClassEnum? Type
{
get; set;
}
/// <summary>
/// 集团ID
/// </summary>
public int? RB_Group_Id
{
get;
set;
}
/// <summary>
/// 操作人
/// </summary>
public int? UpdateBy
{
get;
set;
}
/// <summary>
/// 操作时间
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
/// <summary>
/// 删除标识
/// </summary>
public Common.Enum.DateStateEnum Status
{
get;
set;
}
/// <summary>
/// 是否进入营收报表
/// </summary>
public int? Is_Report { get; set; }
/// <summary>
/// 是否是机密费用 1是 0否
/// </summary>
public int? IsSecret { get; set; }
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Model.Entity.Finance
{
/// <summary>
/// 币种表
/// </summary>
[Serializable]
[DB(ConnectionName = "FinanceConnection")]
public class RB_Currency
{
/// <summary>
/// ID
/// </summary>
public int ID
{
get;
set;
}
/// <summary>
/// 货币代码
/// </summary>
public string Code
{
get; set;
}
/// <summary>
/// 名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 是否本位币
/// </summary>
public int? IsStandardCurrency
{
get;
set;
}
/// <summary>
/// 汇率
/// </summary>
public decimal? Rate
{
get;
set;
}
/// <summary>
/// 当前汇率
/// </summary>
public decimal? CurrentRate
{
get; set;
}
/// <summary>
/// 买入现钞汇率
/// </summary>
public decimal? InCashRate { get; set; }
/// <summary>
/// 卖出现汇汇率
/// </summary>
public decimal? OutRemitRate { get; set; }
/// <summary>
/// 卖出现钞汇率
/// </summary>
public decimal? OutCashRate { get; set; }
/// <summary>
/// 上调汇率
/// </summary>
public decimal? ExchangeRates { get; set; }
/// <summary>
/// 集团ID
/// </summary>
public int? RB_Group_Id
{
get;
set;
}
/// <summary>
/// 公司ID
/// </summary>
public int? RB_Branch_Id
{
get;
set;
}
/// <summary>
/// 操作人
/// </summary>
public int? UpdateBy
{
get;
set;
}
/// <summary>
/// 操作时间
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
/// <summary>
/// 是否删除
/// </summary>
public Common.Enum.DateStateEnum Status
{
get;
set;
}
}
}
......@@ -135,14 +135,6 @@ namespace Mall.Model.Entity.User
set;
}
/// <summary>
/// 使用公司id
/// </summary>
public int? BranchId
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
......
using Mall.Common.AOP;
using Mall.Model.Entity.Finance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Model.Extend.Finance
{
/// <summary>
/// 账户类型扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "FinanceConnection")]
public class RB_AccountType_Extend : RB_AccountType
{
}
}
using Mall.Common.AOP;
using Mall.Model.Entity.Finance;
using System;
using System.Collections.Generic;
namespace Mall.Model.Extend.Finance
{
/// <summary>
/// 公司银行账户表扩展 实体
/// </summary>
[Serializable]
[DB(ConnectionName = "FinanceConnection")]
public class RB_BackAccount_Extend : RB_BackAccount
{
/// <summary>
/// 期初开始时间str
/// </summary>
public string BeginTimeStr { get; set; }
/// <summary>
/// 账户id Str
/// </summary>
public string AccountIdStr { get; set; }
/// <summary>
/// 模板ID
/// </summary>
public int? TemplateId { get; set; }
/// <summary>
/// 账户是否配置收款0-否1-是
/// </summary>
public int? Is_Income { get; set; }
/// <summary>
/// 账户是否配置支款0-否1-是
/// </summary>
public int? Is_Outcome { get; set; }
/// <summary>
/// 收款负责人名称
/// </summary>
public string InemName { get; set; }
/// <summary>
/// 付款负责人
/// </summary>
public string OutemName { get; set; }
/// <summary>
/// 上期损益
/// </summary>
public decimal? ProfitLossMoney { get; set; }
/// <summary>
/// 公司ID
/// </summary>
public int? BranchId
{
get;
set;
}
/// <summary>
/// 账户分类名称
/// </summary>
public string AccountTypeName { set; get; }
/// <summary>
/// 币种
/// </summary>
public string CurrencyName { get; set; }
/// <summary>
/// 银行名称
/// </summary>
public string BackName { get; set; }
/// <summary>
/// 银行logo
/// </summary>
public string BackLogo { get; set; }
/// <summary>
/// 账户类型
/// </summary>
public string TypeName { get; set; }
/// <summary>
/// 汇率
/// </summary>
public decimal? Rate { get; set; }
/// <summary>
/// 币种汇率
/// </summary>
public decimal? CurrencyRate { get; set; }
/// <summary>
/// 付款汇率
/// </summary>
public decimal PayRate { get; set; }
/// <summary>
/// 上调汇率
/// </summary>
public decimal ExchangeRates { get; set; }
/// <summary>
/// 币种类型
/// </summary>
public int IsStandardCurrency { get; set; }
/// <summary>
/// 外币货币代码
/// </summary>
public string CurrencyCode { get; set; }
/// <summary>
/// 本位币货币代码
/// </summary>
public string StandardCurrencyCode { get; set; }
/// <summary>
/// 账户分类
/// </summary>
public int? BankType { get; set; }
/// <summary>
///公私
/// </summary>
public int? Is_Public { get; set; }
/// <summary>
/// 公司名称
/// </summary>
public string BranchName { get; set; }
}
}
\ No newline at end of file
using Mall.Common.AOP;
using Mall.Model.Entity.Finance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Model.Extend.Finance
{
/// <summary>
/// 费用类型扩展表
/// </summary>
[Serializable]
[DB(ConnectionName = "FinanceConnection")]
public class RB_Costtype_Extend : RB_Costtype
{
}
}
using Mall.Common.AOP;
using Mall.Model.Entity.Finance;
using System;
namespace Mall.Model.Extend.Finance
{
/// <summary>
/// 币种扩展表
/// </summary>
[Serializable]
[DB(ConnectionName = "FinanceConnection")]
public class RB_Currency_Extend : RB_Currency
{
}
}
......@@ -21,5 +21,9 @@ namespace Mall.Model.Extend.Product
/// 商品ids
/// </summary>
public string GoodsIds { get; set; }
/// <summary>
/// 是否可以分享
/// </summary>
public int? IsForeignShare { get; set; }
}
}
......@@ -7,10 +7,11 @@ using Mall.Common;
using Mall.Common.API;
using Mall.Common.Plugin;
using Mall.Model.Extend.Finance;
using Mall.Repository.Product;
using Mall.Repository;
using Mall.Repository.Finance;
using Newtonsoft.Json;
namespace Mall.Module.Product
namespace Mall.Module.Finance
{
/// <summary>
/// 财务处理层
......@@ -21,8 +22,26 @@ namespace Mall.Module.Product
/// 财务配置
/// </summary>
private readonly RB_Finance_ConfigurineRepository finance_ConfigurineRepository = new RB_Finance_ConfigurineRepository();
/// <summary>
/// 财务流程
/// </summary>
private readonly Rb_Workflow_TemplateRepository workflow_TemplateRepository = new Rb_Workflow_TemplateRepository();
/// <summary>
/// 费用类型
/// </summary>
private readonly RB_CosttypeRepository costtypeRepository = new RB_CosttypeRepository();
/// <summary>
/// 账户类型
/// </summary>
private readonly RB_AccountTypeRepository accountTypeRepository = new RB_AccountTypeRepository();
/// <summary>
/// 银行账户
/// </summary>
private readonly RB_BackAccountRepository backAccountRepository = new RB_BackAccountRepository();
/// <summary>
/// 币种
/// </summary>
private readonly RB_CurrencyRepository currencyRepository = new RB_CurrencyRepository();
/// <summary>
......@@ -63,13 +82,80 @@ namespace Mall.Module.Product
fmodel.WorkFlowId,
fmodel.Type,
StartTime = fmodel.StartTime.HasValue?fmodel.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"):"",
fmodel.IntervalDay,
fmodel.BranchId
fmodel.IntervalDay
}
};
}
}
/// <summary>
/// 新增 修改 财务配置
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public bool SetFinanceConfigurationInfo(RB_Finance_Configurine_Extend demodel)
{
var fmodel = finance_ConfigurineRepository.GetList(new RB_Finance_Configurine_Extend() { Type = demodel.Type, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }).FirstOrDefault();
if (fmodel == null)
{
return finance_ConfigurineRepository.Insert(demodel) > 0;
}
else
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Finance_Configurine_Extend.IsPublic),demodel.IsPublic},
{ nameof(RB_Finance_Configurine_Extend.AccountType),demodel.AccountType},
{ nameof(RB_Finance_Configurine_Extend.AccountId),demodel.AccountId},
{ nameof(RB_Finance_Configurine_Extend.RemitterName),demodel.RemitterName},
{ nameof(RB_Finance_Configurine_Extend.CurrencyId),demodel.CurrencyId},
{ nameof(RB_Finance_Configurine_Extend.IncomeCostTypeId),demodel.IncomeCostTypeId},
{ nameof(RB_Finance_Configurine_Extend.FreightCostTypeId),demodel.FreightCostTypeId},
{ nameof(RB_Finance_Configurine_Extend.RefundCostTypeId),demodel.RefundCostTypeId},
{ nameof(RB_Finance_Configurine_Extend.CBCostTypeId),demodel.CBCostTypeId},
{ nameof(RB_Finance_Configurine_Extend.RemitCostTypeId),demodel.RemitCostTypeId},
{ nameof(RB_Finance_Configurine_Extend.WorkFlowId),demodel.WorkFlowId},
{ nameof(RB_Finance_Configurine_Extend.StartTime),demodel.StartTime},
{ nameof(RB_Finance_Configurine_Extend.IntervalDay),demodel.IntervalDay}
};
List<WhereHelper> whereHelpers = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Finance_Configurine_Extend.Id),
FiledValue=fmodel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
return finance_ConfigurineRepository.Update(keyValues, whereHelpers);
}
}
/// <summary>
/// 获取费用类型列表
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public object GetFinanceCostTypeList(int type)
{
var list = costtypeRepository.GetList(new RB_Costtype_Extend() { RB_Group_Id = 2, Type = (Common.Enum.Finance.WFTempLateClassEnum)type });
return list.Select(x => new
{
Id = x.ID,
x.Name
});
}
/// <summary>
/// 获取币种
/// </summary>
/// <returns></returns>
public object GetFinanceCurrencyList() {
var list = currencyRepository.GetList(new Model.Entity.Finance.RB_Currency() { RB_Group_Id = 2 });
return list.Select(x => new
{
Id = x.ID,
x.Name
});
}
/// <summary>
/// 获取流程列表
/// </summary>
......@@ -83,5 +169,32 @@ namespace Mall.Module.Product
x.Name
});
}
/// <summary>
/// 获取账户类型
/// </summary>
/// <returns></returns>
public object GetAccountTypeList()
{
var list = accountTypeRepository.GetList(new RB_AccountType_Extend() { RB_Group_Id = 2 });
return list.Select(x => new
{
Id = x.ID,
x.Name
});
}
/// <summary>
/// 获取账户列表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<RB_BackAccount_Extend> GetAccountList(RB_BackAccount_Extend model)
{
var list = backAccountRepository.GetAccountList(model);
return list;
}
}
}
......@@ -1608,6 +1608,7 @@ namespace Mall.Module.Product
id = gmodel.Id,
name = gmodel.Name,
categoryIdList = item.CategoryIdList,
specificationNameList = gmodel.SpecificationNameList,
num = item.Number,
forehead_integral = gmodel.PointsDeduction,
forehead_integral_type = gmodel.PointsDeductionType,
......@@ -2606,7 +2607,7 @@ namespace Mall.Module.Product
}));
}
goods_OrderRepository.DBSession.Commit();
return ApiResult.Success();
return ApiResult.Success("", new { OrderId });
}
catch (Exception ex)
{
......
......@@ -1508,6 +1508,11 @@ namespace Mall.Module.Product
if (model.AreaList.Any()) {
limit = "仅限" + string.Join(",", model.AreaList.Select(x => x.AreaName)) + "购买";
}
int IsAllowShare = 1;
if (model.CategoryList.Where(x => x.IsForeignShare == 2).Any()) {
IsAllowShare = 2;
}
return new
{
goods = new
......@@ -1517,6 +1522,7 @@ namespace Mall.Module.Product
mch_id = model.TenantId,//暂 商户id
//goods_warehouse_id = 0,//
status = model.GoodsStatus,
isAllowShare = IsAllowShare,//是否可以分享
price = model.SellingPrice,
use_attr = model.IsCustomSpecification,
attr_groups = model.SpecificationList.Select(x => new
......
using Mall.Model.Entity.Finance;
using Mall.Model.Extend.Finance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Repository.Finance
{
/// <summary>
/// 账号类型扩展方法
/// </summary>
public class RB_AccountTypeRepository : RepositoryBase<RB_AccountType>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_AccountType); } }
/// <summary>
/// 获取账号类型列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="model"></param>
/// <param name="count"></param>
/// <returns></returns>
public List<RB_AccountType_Extend> GetPageList(int pageIndex, int pageSize, RB_AccountType_Extend model, out long count)
{
string where = string.Format(" where A." + nameof(RB_AccountType_Extend.Status) + "={0}", (int)Common.Enum.DateStateEnum.Normal);
if (model.RB_Group_Id > 0)
{
where += string.Format(" AND A." + nameof(RB_AccountType_Extend.RB_Group_Id) + "={0}", model.RB_Group_Id);
}
//if (model.RB_Branch_Id >= 0)
//{
// where += string.Format(" AND A." + nameof(RB_AccountType_Extend.RB_Branch_Id) + "={0}", model.RB_Branch_Id);
//}
string sql = string.Format(" SELECT *,((SELECT COUNT(1) FROM rb_backaccount where TypeId=A.ID AND `Status`=0)+(SELECT COUNT(1) FROM rb_cashaccount where TypeId=A.ID AND `Status`=0)+(SELECT COUNT(1) FROM rb_cashpoolaccount where TypeId=A.ID AND `Status`=0)+(SELECT COUNT(1) FROM rb_platformaccount where TypeId=A.ID AND `Status`=0)) as PeopleNum FROM {0} as A {1}", TableName, where);
return GetPage<RB_AccountType_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
/// 获取账号类型列表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<RB_AccountType_Extend> GetList(RB_AccountType_Extend model)
{
string where = string.Format(" where " + nameof(RB_AccountType_Extend.Status) + "={0}", (int)Common.Enum.DateStateEnum.Normal);
if (model.RB_Group_Id > 0)
{
where += string.Format(" AND " + nameof(RB_AccountType_Extend.RB_Group_Id) + "={0}", model.RB_Group_Id);
}
//if (model.RB_Branch_Id >= 0)
//{
// where += string.Format(" AND " + nameof(RB_AccountType_Extend.RB_Branch_Id) + "={0}", model.RB_Branch_Id);
//}
if (model.IsPublic >= 0)
{
where += string.Format(" AND " + nameof(RB_AccountType_Extend.IsPublic) + "={0}", model.IsPublic);
}
if (!string.IsNullOrEmpty(model.Name))
{
where += string.Format(" AND " + nameof(RB_AccountType_Extend.Name) + " like '%{0}%'", model.Name);
}
string sql = string.Format(" SELECT * FROM {0} {1}", TableName, where);
return Get<RB_AccountType_Extend>(sql).ToList();
}
/// <summary>
/// 获取所有的账户信息列表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<RB_BackAccount_Extend> GetAccountList(RB_BackAccount_Extend model)
{
string where = " where 1=1 ";
if (model.BankType > 0)
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.BankType) + " ={0}", (int)model.BankType);
}
if (model.TypeId > 0)
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.TypeId) + " ={0}", model.TypeId);
}
if (!string.IsNullOrEmpty(model.Alias))
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.Alias) + " like '%{0}%' ", model.Alias);
}
if (model.BranchId >= 0)
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.BranchId) + " ={0}", model.BranchId);
}
string sql = string.Format(@"select t.ID,t.BranchId,t.Alias,t.AccountType as AccountTypeName,BackNo,t.backId,t.TypeId,t.BankType,t.CreateBy,t.CreateDate,t.CurrencyName,t.Rate,t.Initialbalance from (
SELECT ID,BranchId,Alias,'银行' as AccountType,backNo AS BackNo,backId,TypeId,1 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_backaccount as A where `Status`=0
UNION ALL
SELECT ID,BranchId,Alias,'平台' as AccountType,PlatformNo AS BackNo,BackId as backId,TypeId,2 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_platformaccount as A where `Status`=0
UNION ALL
SELECT ID,BranchId,Alias,'现金' as AccountType,'' AS BackNo,0 as backId,TypeId,3 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_cashaccount as A where `Status`=0
UNION ALL
SELECT ID,BranchId,Alias,'资金池' as AccountType,'' AS BackNo,0 as backId,TypeId,4 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_cashpoolaccount as A where `Status`=0
)as t {0}", where);
return Get<RB_BackAccount_Extend>(sql).ToList();
}
/// <summary>
/// 通过公司ID获取公司对应的账户列表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<RB_BackAccount_Extend> GetAccountByBranchList(RB_BackAccount_Extend model)
{
string where = " where 1=1 and a.`Status`=0 and a.Type=2 ";
if (model.BankType > 0)
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.BankType) + " ={0}", (int)model.BankType);
}
if (model.RB_Branch_Id >= 0)
{
where += string.Format(" AND a." + nameof(RB_BackAccount_Extend.RB_Branch_Id) + " ={0}", model.RB_Branch_Id);
}
if (model.ID > 0)
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.ID) + " ={0}", model.ID);
}
if (model.TypeId > 0)
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.TypeId) + " ={0}", model.TypeId);
}
if (!string.IsNullOrEmpty(model.Alias))
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.Alias) + " like '%{0}%' ", model.Alias);
}
string sql = string.Format(@"select t.ID,t.Alias,t.AccountType as AccountTypeName,BackNo,t.backId,t.TypeId,t.BankType,t.CreateBy,t.CreateDate,t.CurrencyName,t.Rate,t.Initialbalance,IFNULL(a.RB_Branch_Id,-1) as RB_Branch_Id from (
SELECT ID,Alias,'银行' as AccountType,BackNo AS BackNo,backId,TypeId,1 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_backaccount as A where `Status`=0
UNION ALL
SELECT ID,Alias,'平台' as AccountType,PlatformNo AS BackNo,BackId as backId,TypeId,2 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_platformaccount as A where `Status`=0
UNION ALL
SELECT ID,Alias,'现金' as AccountType,'' AS BackNo,0 as backId,TypeId,3 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_cashaccount as A where `Status`=0
UNION ALL
SELECT ID,Alias,'资金池' as AccountType,'' AS BackNo,0 as backId,TypeId,4 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_cashpoolaccount as A where `Status`=0
)as t LEFT JOIN rb_accountrelation as a on t.ID=a.AccountID AND t.BankType=a.AccountType {0}", where);
return Get<RB_BackAccount_Extend>(sql).ToList();
}
}
}
using Mall.Common.Enum;
using Mall.Common.Enum.User;
using Mall.Model.Entity.Finance;
using Mall.Model.Extend.Finance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Repository.Finance
{
/// <summary>
/// 费用类型仓储
/// </summary>
public partial class RB_CosttypeRepository : RepositoryBase<RB_Costtype>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_Costtype); } }
/// <summary>
/// 获取列表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<RB_Costtype_Extend> GetList(RB_Costtype_Extend model)
{
string where = " WHERE 1=1 ";
where += string.Format(" AND " + nameof(RB_Costtype.Status) + "={0} ", (int)DateStateEnum.Normal);
if (model.RB_Group_Id > 0)
{
where += string.Format(" AND " + nameof(RB_Costtype.RB_Group_Id) + "={0} ", model.RB_Group_Id);
}
if (model.Type > 0)
{
where += string.Format(" AND " + nameof(RB_Costtype_Extend.Type) + " in({0},{1})", (int)model.Type, (int)Common.Enum.Finance.WFTempLateClassEnum.INAndOUT);
}
if (model.Tier > 0)
{
where += string.Format(" AND " + nameof(RB_Costtype.Tier) + "={0} ", model.Tier);
}
if (model.Is_Report >= 0)
{
where += string.Format(" AND " + nameof(RB_Costtype.Is_Report) + "={0} ", model.Is_Report);
}
if ((model.IsSecret??-1) >= 0)
{
where += string.Format(" AND " + nameof(RB_Costtype.IsSecret) + "={0} ", model.IsSecret);
}
if (!string.IsNullOrEmpty(model.Name))
{
where += string.Format(" AND " + nameof(RB_Costtype.Name) + " like '%{0}%' ", model.Name);
}
return Get<RB_Costtype_Extend>("select * from " + TableName + where).ToList();
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="model"></param>
/// <param name="count"></param>
/// <returns></returns>
public List<RB_Costtype_Extend> GetPageList(int pageIndex, int pageSize, RB_Costtype_Extend model, out long count)
{
string where = " WHERE 1=1 ";
where += string.Format(" AND " + nameof(RB_Costtype_Extend.Status) + "={0}", (int)DateStateEnum.Normal);
if (model.RB_Group_Id > 0)
{
where += string.Format(" AND " + nameof(RB_Costtype_Extend.RB_Group_Id) + "={0}", model.RB_Group_Id);
}
if (model.Type > 0)
{
where += string.Format(" AND " + nameof(RB_Costtype_Extend.Type) + "={0}", (int)model.Type);
}
if (model.ParentId > 0)
{
where += string.Format(" AND " + nameof(RB_Costtype_Extend.ParentId) + "={0}", model.ParentId);
}
if (model.Tier > 0)
{
where += string.Format(" AND " + nameof(RB_Costtype_Extend.Tier) + "={0}", model.Tier);
}
if (!string.IsNullOrEmpty(model.Name))
{
where += string.Format(" AND " + nameof(RB_Costtype_Extend.Name) + " like '%{0}%' ", model.Name);
}
return GetPage<RB_Costtype_Extend>(pageIndex, pageSize, out count, " select * from " + TableName + where).ToList();
}
}
}
using Mall.Common.Enum;
using Mall.Model.Entity.Finance;
using Mall.Model.Extend.Finance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Repository.Finance
{
/// <summary>
/// 财务单据币种仓储
/// </summary>
public partial class RB_CurrencyRepository : RepositoryBase<RB_Currency>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_Currency); } }
/// <summary>
/// 获取币种列表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<RB_Currency> GetList(RB_Currency model)
{
string where = " WHERE 1=1 ";
where += string.Format(" AND " + nameof(RB_Currency.Status) + "={0} ", (int)DateStateEnum.Normal);
if (model.RB_Group_Id > 0)
{
where += string.Format(" AND " + nameof(RB_Currency.RB_Group_Id) + "={0} ", model.RB_Group_Id);
}
//if (model.RB_Branch_Id >= 0)
//{
// where += string.Format(" AND " + nameof(RB_Currency.RB_Branch_Id) + "={0} ", model.RB_Branch_Id);
//}
if (!string.IsNullOrEmpty(model.Name))
{
where += string.Format(" AND " + nameof(RB_Currency_Extend.Name) + " like '%{0}%' ", model.Name);
}
if (model.IsStandardCurrency >= 0)
{
where += string.Format(" AND " + nameof(RB_Currency_Extend.IsStandardCurrency) + "={0} ", model.IsStandardCurrency);
}
return Get<RB_Currency>("select * from " + TableName + " " + where + " order by IsStandardCurrency desc ").ToList();
}
/// <summary>
/// 获取币种分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="model"></param>
/// <param name="count"></param>
/// <returns></returns>
public List<RB_Currency_Extend> GetPageList(int pageIndex, int pageSize, RB_Currency_Extend model, out long count)
{
string where = " WHERE 1=1 ";
where += string.Format(" AND " + nameof(RB_Currency_Extend.Status) + "={0}", (int)Common.Enum.DateStateEnum.Normal);
if (model.RB_Group_Id > 0)
{
where += string.Format(" AND " + nameof(RB_Currency_Extend.RB_Group_Id) + "={0}", model.RB_Group_Id);
}
//if (model.RB_Branch_Id >= 0)
//{
// where += string.Format(" AND " + nameof(RB_Currency_Extend.RB_Branch_Id) + "={0}", model.RB_Branch_Id);
//}
if (!string.IsNullOrEmpty(model.Code))
{
where += string.Format(" AND " + nameof(RB_Currency_Extend.Code) + " like '%{0}%' ", model.Code);
}
if (!string.IsNullOrEmpty(model.Name))
{
where += string.Format(" AND " + nameof(RB_Currency_Extend.Name) + " like '%{0}%' ", model.Name);
}
return GetPage<RB_Currency_Extend>(pageIndex, pageSize, out count, " select * from " + TableName + "" + where).ToList();
}
}
}
......@@ -7,7 +7,7 @@ using System.Linq;
using Mall.Model.Entity.User;
using Mall.Model.Extend.Finance;
namespace Mall.Repository.Product
namespace Mall.Repository.Finance
{
/// <summary>
/// 财务配置仓储层
......
using Mall.Model.Entity.Finance;
using Mall.Model.Extend.Finance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Repository.Finance
{
/// <summary>
/// 银行
/// </summary>
public class RB_BackAccountRepository : RepositoryBase<RB_BackAccount>
{
/// <summary>
/// 获取账户列表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<RB_BackAccount_Extend> GetAccountList(RB_BackAccount_Extend model)
{
string where = " where 1=1 ";
if (model.ID > 0)
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.ID) + " ={0}", model.ID);
}
if (model.BackId > 0)
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.BackId) + " ={0}", model.BackId);
}
if (model.TypeId > 0)
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.TypeId) + " ={0}", model.TypeId);
}
if (!string.IsNullOrEmpty(model.Alias))
{
where += string.Format(" AND t." + nameof(RB_BackAccount_Extend.Alias) + " like '%{0}%' ", model.Alias);
}
if (model.BranchId.HasValue && model.BranchId >= 0) {
where += $@" and al.RB_Branch_Id={model.BranchId}";
}
string sql = string.Format(@"select distinct t.ID,t.Alias,t.BackNo,t.CurrencyId,t.AccountType as AccountTypeName,t.backId,t.TypeId,t.BankType,t.CreateBy,t.CreateDate,t.CurrencyName,t.Rate,t.Initialbalance from (
SELECT ID,Alias,backNo AS BackNo,CurrencyId,'银行' as AccountType,backId,TypeId,1 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT (IFNULL(CurrentRate,0)+IFNULL(ExchangeRates,0)) as CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_backaccount as A where `Status`=0 and RB_Group_Id={0}
UNION ALL
SELECT ID,Alias,PlatformNo AS BackNo,CurrencyId,'平台' as AccountType,BackId as backId,TypeId,2 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT (IFNULL(CurrentRate,0)+IFNULL(ExchangeRates,0)) as CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_platformaccount as A where `Status`=0 and RB_Group_Id={0}
UNION ALL
SELECT ID,Alias,'' AS BackNo,CurrencyId,'现金' as AccountType,0 as backId,TypeId,3 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT (IFNULL(CurrentRate,0)+IFNULL(ExchangeRates,0)) as CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_cashaccount as A where `Status`=0 and RB_Group_Id={0}
UNION ALL
SELECT ID,Alias,'' AS BackNo,CurrencyId,'资金池' as AccountType,0 as backId,TypeId,4 as BankType,CreateBy,CreateDate,(SELECT `Name` from rb_currency where ID=currencyId ) as CurrencyName,IFNULL((SELECT (IFNULL(CurrentRate,0)+IFNULL(ExchangeRates,0)) as CurrentRate from rb_currency where ID=currencyId) ,0)as Rate,Initialbalance FROM rb_cashpoolaccount as A where `Status`=0 and RB_Group_Id={0}
)as t
left join rb_accountrelation al on t.BankType=al.AccountType and t.ID=al.AccountID and al.Type=2 and al.Status=0
{1} {2}", model.RB_Group_Id, where, " order by t.ID asc ");
return Get<RB_BackAccount_Extend>(sql).ToList();
}
}
}
......@@ -7,7 +7,7 @@ using System.Linq;
using Mall.Model.Extend.Finance;
using Mall.Model.Entity.Finance;
namespace Mall.Repository.Product
namespace Mall.Repository.Finance
{
/// <summary>
/// 财务流程仓储层
......
......@@ -37,7 +37,7 @@ namespace Mall.Repository.Product
where += $@" and gc.{nameof(RB_Goods_Category.GoodsId)} in({dmodel.GoodsIds})";
}
string sql = $@"select gc.*,pc.Name as CategoryName from RB_Goods_Category gc
string sql = $@"select gc.*,pc.Name as CategoryName,pc.IsForeignShare from RB_Goods_Category gc
inner join rb_product_category pc on gc.CategoryId=pc.Id
where {where} order by gc.Id desc";
return Get<RB_Goods_Category_Extend>(sql).ToList();
......
......@@ -11,10 +11,10 @@ using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Mall.Common.Plugin;
using Mall.Common.Enum.User;
using Mall.CacheManager.User;
using Newtonsoft.Json.Linq;
using Mall.Common;
using Mall.Module.Product;
using Mall.Module.Finance;
using Mall.Model.Extend.Finance;
namespace Mall.WebApi.Controllers.Finance
{
......@@ -27,7 +27,7 @@ namespace Mall.WebApi.Controllers.Finance
private readonly FinanceModule financeModule = new FinanceModule();
#region 财务配置
/// <summary>
/// 获取财务配置信息
/// </summary>
......@@ -47,13 +47,126 @@ namespace Mall.WebApi.Controllers.Finance
return ApiResult.Success("", obj);
}
/// <summary>
/// 新增财务配置信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetFinanceConfigurationInfo() {
var req = RequestParm;
RB_Finance_Configurine_Extend demodel = JsonConvert.DeserializeObject<RB_Finance_Configurine_Extend>(req.msg.ToString());
if (demodel.Type == 1)
{
if ((demodel.IsPublic ?? 0) <= 0)
{
return ApiResult.Failed("请传递账户类型");
}
if ((demodel.AccountType ?? 0) <= 0)
{
return ApiResult.Failed("请传递账户分类");
}
if ((demodel.AccountId ?? 0) <= 0)
{
return ApiResult.Failed("请传递账户id");
}
if (string.IsNullOrEmpty(demodel.RemitterName))
{
return ApiResult.Failed("请传递汇款人");
}
if ((demodel.IncomeCostTypeId ?? 0) <= 0)
{
return ApiResult.Failed("请传递收款费用类型");
}
if ((demodel.FreightCostTypeId ?? 0) <= 0)
{
return ApiResult.Failed("请传递运费收入费用类型");
}
if (!demodel.StartTime.HasValue)
{
return ApiResult.Failed("请传递开始时间");
}
if ((demodel.IntervalDay ?? 0) <= 0)
{
return ApiResult.Failed("请传递周期");
}
}
else if (demodel.Type == 2)
{
if ((demodel.CurrencyId ?? 0) <= 0)
{
return ApiResult.Failed("请选择币种");
}
if ((demodel.CBCostTypeId ?? 0) <= 0)
{
return ApiResult.Failed("请选择成本费用类型");
}
}
else if (demodel.Type == 3)
{
if ((demodel.CurrencyId ?? 0) <= 0)
{
return ApiResult.Failed("请选择币种");
}
if ((demodel.RefundCostTypeId ?? 0) <= 0)
{
return ApiResult.Failed("请选择退款费用类型");
}
}
else if (demodel.Type == 4)
{
if ((demodel.CurrencyId ?? 0) <= 0)
{
return ApiResult.Failed("请选择币种");
}
if ((demodel.RemitCostTypeId ?? 0) <= 0)
{
return ApiResult.Failed("请选择提现费用类型");
}
}
else {
return ApiResult.Failed("type不正确");
}
if ((demodel.WorkFlowId ?? 0) <= 0) {
return ApiResult.Failed("请选择使用流程");
}
demodel.Status = 0;
demodel.TenantId = req.TenantId;
demodel.MallBaseId = req.MallBaseId;
demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now;
bool flag = financeModule.SetFinanceConfigurationInfo(demodel);
if (flag)
{
return ApiResult.Success();
}
else {
return ApiResult.Failed();
}
}
/// <summary>
/// 获取配置枚举
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetFinanceConfigurationEnumList()
{
var list = EnumHelper.GetEnumList(typeof(Common.Enum.Finance.FinanceConfigurationEnum));
return ApiResult.Success("", list.Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
/// <summary>
/// 获取流程列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetFinanceWorkFlowTemplateList() {
var requestParm = RequestParm;
var parms = JObject.Parse(requestParm.msg.ToString());
int TempLateClass = parms.GetInt("TempLateClass", 0);
......@@ -65,6 +178,76 @@ namespace Mall.WebApi.Controllers.Finance
return ApiResult.Success("", List);
}
/// <summary>
/// 获取费用类型
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetFinanceCostTypeList() {
var requestParm = RequestParm;
var parms = JObject.Parse(requestParm.msg.ToString());
int Type = parms.GetInt("Type", 0);// 1收入 2支出
if (Type <= 0)
{
return ApiResult.ParamIsNull();
}
var List = financeModule.GetFinanceCostTypeList(Type);
return ApiResult.Success("", List);
}
/// <summary>
/// 获取币种列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetFinanceCurrencyList() {
var List = financeModule.GetFinanceCurrencyList();
return ApiResult.Success("", List);
}
/// <summary>
/// 获取账户类型列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAccountTypeList()
{
var List = financeModule.GetAccountTypeList();
return ApiResult.Success("", List);
}
/// <summary>
/// 获取账户列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public ApiResult GetBankAccountList()
{
var req = RequestParm;
RB_BackAccount_Extend model = JsonConvert.DeserializeObject<RB_BackAccount_Extend>(req.msg.ToString());
if (model.TypeId == 0)
{
return ApiResult.ParamIsNull();
}
model.RB_Group_Id = 2;
var data = financeModule.GetAccountList(model);
var list = data.Select(x => new
{
Id = x.ID,
x.Alias,
x.BackNo,
x.CurrencyId,
x.CurrencyName,
x.Rate,
x.BankType,
x.TypeName,
x.AccountTypeName,
x.Initialbalance,
RBNInitialbalance = Math.Round(x.Initialbalance.Value * x.Rate.Value, 2, MidpointRounding.AwayFromZero)
}).ToList();
return ApiResult.Success("", list);
}
#endregion
}
......
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