Commit be020b6e authored by 黄奎's avatar 黄奎

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents eac47786 e1c6451e
......@@ -164,7 +164,11 @@ namespace Edu.Common.Plugin
/// <returns>T</returns>
public static T DeserializeObject<T>(this string value) where T : class
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(value);
JsonSerializerSettings jsSetting = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
};
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(value, jsSetting);
}
#region Json 字符串 转换为 DataTable数据集合
......
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using VT.FW.DB;
namespace Edu.Model.Entity.Course
{
/// <summary>
/// 教育合同协调实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Education_ContractAdjust
{
/// <summary>
/// Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 合同id
/// </summary>
public int ContractId { get; set; }
/// <summary>
/// 调整价格(正数表示减去)
/// </summary>
public decimal AdjustPrice { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// CreateBy
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// CreateTime
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateTime { get; set; }
}
}
......@@ -339,5 +339,10 @@ namespace Edu.Model.Entity.Finance
/// 财务单据类型 1erp 2教育
/// </summary>
public int? FinanceType { get => financeType; set => financeType = value; }
/// <summary>
/// 学生名单id (教育)
/// </summary>
public int GuestId { get; set; }
}
}
using System;
using Edu.Common.Enum.Finance;
using VT.FW.DB;
namespace Edu.Model.Entity.Finance
{
/// <summary>
/// 教育轧账实体
/// </summary>
[Serializable]
[DB(ConnectionName = "FinanceConnection")]
public class RB_RollingAccount
{
/// <summary>
/// Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 月份
/// </summary>
public string Month { get; set; }
/// <summary>
/// 校区ids(-1表全部) 英文逗号分隔
/// </summary>
public string SchoolIds { get; set; }
/// <summary>
/// 状态 1正常 2停用
/// </summary>
public int State { get; set; }
/// <summary>
/// 集团id
/// </summary>
public int GroupId { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateTime { get; set; }
}
}
......@@ -28,6 +28,10 @@ namespace Edu.Model.ViewModel.Course
public int CheckNum { get; set; }
/// <summary>
/// 已上课分钟数
/// </summary>
public int MinutesNum { get; set; }
/// 学员名称
/// </summary>
public string GuestName { get; set; }
......
using Edu.Model.Entity.Course;
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 教育合同视协调图实体类
/// </summary>
public class RB_Education_ContractAdjust_ViewModel : RB_Education_ContractAdjust
{
}
}
......@@ -9,6 +9,78 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public class RB_Education_Contract_ViewModel : RB_Education_Contract
{
#region 财务相关
/// <summary>
/// 财务单据
/// </summary>
public int FinanceId { get; set; }
/// <summary>
/// 交易方式
/// </summary>
public int TradeWay { get; set; }
/// <summary>
/// 账户id
/// </summary>
public int AccountId { get; set; }
#endregion
#region 统计相关
/// <summary>
/// 班级名称
/// </summary>
public string ClassName { get; set; }
/// <summary>
/// 调整金额
/// </summary>
public decimal AdjustPrice { get; set; }
/// <summary>
/// 财务单据列表
/// </summary>
public List<Model.ViewModel.Finance.RB_Finance_Extend> FinanceList { get; set; }
/// <summary>
/// 客人已交金额(出纳已审核)
/// </summary>
public decimal Income { get; set; }
/// <summary>
/// 支出金额
/// </summary>
public decimal Expend { get; set; }
/// <summary>
/// 已使用课时
/// </summary>
public int UseClassHours { get; set; }
/// <summary>
/// 单价
/// </summary>
public decimal Unit_Price { get; set; }
/// <summary>
/// 已使用课程费
/// </summary>
public decimal UseCourseFee { get; set; }
/// <summary>
/// 使用教材费
/// </summary>
public decimal UseBookFee { get; set; }
/// <summary>
/// 使用课件费
/// </summary>
public decimal UseCoursewareFee { get; set; }
#endregion
/// <summary>
/// 是否审核(1-是)
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.Finance;
using VT.FW.DB;
namespace Edu.Model.ViewModel.Finance
{
/// <summary>
/// 教育轧账扩展表
/// </summary>
[Serializable]
[DB(ConnectionName = "FinanceConnection")]
public class RB_RollingAccount_Extend : RB_RollingAccount
{
/// <summary>
/// 校区id
/// </summary>
public int? SchoolId { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string UpdateByName { get; set; }
/// <summary>
/// 校区列表
/// </summary>
public List<Model.ViewModel.User.RB_School_ViewModel> SchoolList { get; set; }
}
}
This diff is collapsed.
......@@ -10,6 +10,7 @@ using Edu.Repository.Course;
using Edu.Repository.Finance;
using Edu.Repository.StudyAbroad;
using Edu.Repository.User;
using VT.FW.DB;
namespace Edu.Module.Finance
{
......@@ -103,9 +104,13 @@ namespace Edu.Module.Finance
/// </summary>
private readonly RB_StudyAbroadRepository studyAbroadRepository = new RB_StudyAbroadRepository();
/// <summary>
/// 供应商
/// 月结设置
/// </summary>
private readonly RB_SupplierRepository supplierRepository = new RB_SupplierRepository();
private readonly RB_RollingAccountRepository rollingAccountRepository = new RB_RollingAccountRepository();
/// <summary>
/// 账户
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
......@@ -2173,5 +2178,103 @@ namespace Edu.Module.Finance
}
#endregion
#region 月结窗口
/// <summary>
/// 月结设置分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_RollingAccount_Extend> GetFinanceMonthStatementPageList(int pageIndex, int pageSize, out long count, RB_RollingAccount_Extend dmodel)
{
var list = rollingAccountRepository.GetPageList(pageIndex, pageSize, out count, dmodel);
if (list.Any()) {
//查询校区
List<int> SchoolIdList = JsonHelper.DeserializeObject<List<int>>("[" + string.Join(",", list.Select(x => x.SchoolIds)) + "]");
string SchoolIds = string.Join(",", SchoolIdList.Where(x => x >= 0).Distinct().ToList());
var schoolList = schoolRepository.GetSchoolListRepository(new Model.ViewModel.User.RB_School_ViewModel() { Group_Id = dmodel.GroupId, QSIds = SchoolIds });
//查询创建人
string userIds = string.Join(',', list.Select(x => x.UpdateBy).Distinct());
var userList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = dmodel.GroupId, QIds = userIds });
foreach (var item in list) {
item.UpdateByName = userList.Where(x => x.Id == item.UpdateBy).FirstOrDefault()?.EmployeeName ?? "";
item.SchoolList = new List<Model.ViewModel.User.RB_School_ViewModel>();
if (item.SchoolIds == "-1")
{
item.SchoolList.Add(new Model.ViewModel.User.RB_School_ViewModel()
{
SId = -1,
SName = "全部"
});
}
else {
List<int> SchoolId2List = JsonHelper.DeserializeObject<List<int>>("[" + item.SchoolIds + "]");
var sList = schoolList.Where(x => SchoolId2List.Contains(x.SId)).ToList();
item.SchoolList = sList;
}
}
}
return list;
}
/// <summary>
/// 新增/修改 月结设置
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public string SetFinanceMonthStatementInfo(RB_RollingAccount_Extend dmodel)
{
if (dmodel.Id > 0)
{
//验证 除此之外 其他是否有包含
var list = rollingAccountRepository.GetList(new RB_RollingAccount_Extend() { GroupId = dmodel.GroupId, Month = dmodel.Month });
list = list.Where(x => x.Id != dmodel.Id).ToList();
if (list.Any()) {
foreach (var item in dmodel.SchoolList) {
if (list.Where(x => ("," + x.SchoolIds + ",").Contains("," + item.SId + ",")).Any()) {
return item.SName + "已存在其他设置里,请核实后再试";
}
}
}
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_RollingAccount_Extend.Month), dmodel.Month},
{ nameof(RB_RollingAccount_Extend.SchoolIds), dmodel.SchoolIds},
{ nameof(RB_RollingAccount_Extend.State), dmodel.State},
{ nameof(RB_RollingAccount_Extend.UpdateBy), dmodel.UpdateBy},
{ nameof(RB_RollingAccount_Extend.UpdateTime), dmodel.UpdateTime},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_RollingAccount_Extend.Id),
FiledValue=dmodel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = rollingAccountRepository.Update(keyValues, wheres);
return flag ? "" : "出错了,请联系管理员";
}
else {
var list = rollingAccountRepository.GetList(new RB_RollingAccount_Extend() { GroupId = dmodel.GroupId, Month = dmodel.Month });
if (list.Any())
{
foreach (var item in dmodel.SchoolList)
{
if (list.Where(x => ("," + x.SchoolIds + ",").Contains("," + item.SId + ",")).Any())
{
return item.SName + "已存在其他设置里,请核实后再试";
}
}
}
bool flag = rollingAccountRepository.Insert(dmodel) >0;
return flag ? "" : "出错了,请联系管理员";
}
}
#endregion
}
}
......@@ -234,5 +234,16 @@ GROUP BY A.ClassId
return Get<RB_Class_Check_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 获取学生的上课时间
/// </summary>
/// <param name="groupId"></param>
/// <param name="guestIds"></param>
/// <returns></returns>
public List<RB_Class_Check_ViewModel> GetClassGuestStudentTimeList(int groupId,string guestIds)
{
string sql = $@"SELECT OrderGuestId, SUM(StudyNum) as MinutesNum FROM rb_class_check where `Status`=0 and Group_Id ={groupId} and CheckStatus =0 and OrderGuestId in ({guestIds}) group by OrderGuestId";
return Get<RB_Class_Check_ViewModel>(sql).ToList();
}
}
}
using Edu.Common.Enum;
using Edu.Model.Entity.Course;
using Edu.Model.ViewModel.Course;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Course
{
/// <summary>
/// 教育合同仓储层
/// </summary>
public class RB_Education_ContractAdjustRepository : BaseRepository<RB_Education_ContractAdjust>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <param name="orderIds"></param>
/// <returns></returns>
public List<RB_Education_ContractAdjust_ViewModel> GetList(RB_Education_ContractAdjust_ViewModel demodel)
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" AND {nameof(RB_Education_ContractAdjust_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.ContractId > 0)
{
where += $@" AND {nameof(RB_Education_ContractAdjust_ViewModel.ContractId)} ={demodel.ContractId}";
}
string sql = $@" SELECT * FROM RB_Education_ContractAdjust WHERE {where} ORDER BY Id DESC";
return Get<RB_Education_ContractAdjust_ViewModel>(sql).ToList();
}
}
}
......@@ -157,5 +157,81 @@ namespace Edu.Repository.Course
var obj = base.ExecuteScalar(builder.ToString(), parameters);
return obj == null ? 0 : Convert.ToInt32(obj);
}
/// <summary>
/// 获取订单完成情况一览 分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="demodel"></param>
/// <param name="datebaseStr"></param>
/// <returns></returns>
public List<RB_Education_Contract_ViewModel> GetContractPageListForFinance(int pageIndex, int pageSize, out long rowsCount, RB_Education_Contract_ViewModel demodel, string datebaseStr)
{
DynamicParameters parameters = new DynamicParameters();
string where = $@" 1=1";
where += $@" AND c.{nameof(RB_Education_Contract_ViewModel.Status)} =2 ";//只查询已审核通过的
if (demodel.Group_Id > 0)
{
where += $@" AND c.{nameof(RB_Education_Contract_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.School_Id > 0)
{
where += $@" AND c.{nameof(RB_Education_Contract_ViewModel.School_Id)} ={demodel.School_Id}";
}
if (demodel.OrderId > 0)
{
where += $@" AND c.{nameof(RB_Education_Contract_ViewModel.OrderId)} ={demodel.OrderId}";
}
if (demodel.CType > 0)
{
where += $@" AND c.{nameof(RB_Education_Contract_ViewModel.CType)} ={(int)demodel.CType}";
}
if (!string.IsNullOrEmpty(demodel.ContractNo))
{
where += $@" AND c.{nameof(RB_Education_Contract_ViewModel.ContractNo)} LIKE @ContractNo ";
parameters.Add("ContractNo", "%" + demodel.ContractNo.Trim() + "%");
}
if (!string.IsNullOrEmpty(demodel.StudentName))
{
where += $@" AND c.{nameof(RB_Education_Contract_ViewModel.StudentName)} LIKE @StudentName ";
parameters.Add("StudentName", "%" + demodel.StudentName.Trim() + "%");
}
if (!string.IsNullOrEmpty(demodel.CourseName))
{
where += $@" AND c.{nameof(RB_Education_Contract_ViewModel.CourseName)} LIKE @CourseName ";
parameters.Add("CourseName", "%" + demodel.CourseName.Trim() + "%");
}
if (!string.IsNullOrEmpty(demodel.ClassName))
{
where += $@" AND c1.{nameof(RB_Education_Contract_ViewModel.ClassName)} LIKE @ClassName ";
parameters.Add("ClassName", "%" + demodel.ClassName.Trim() + "%");
}
if (demodel.CreateBy > 0)
{
where += $@" AND c.{nameof(RB_Education_Contract_ViewModel.CreateBy)} ={demodel.CreateBy}";
}
if (demodel.FinanceId > 0)
{
where += $@" AND f.FrID ={demodel.FinanceId}";
}
if (demodel.TradeWay > 0)
{
where += $@" AND t.Type ={demodel.TradeWay}";
}
if (demodel.AccountId > 0)
{
where += $@" AND t.AccountId ={demodel.AccountId}";
}
string sql = $@" SELECT c.*,c1.ClassName,ca.AdjustPrice FROM RB_Education_Contract c
left join RB_Education_ContractAdjust ca on c.Id = ca.ContractId
left join rb_order o on c.OrderId = o.OrderId
left join rb_class c1 on o.ClassId = c1.ClassId
left join {datebaseStr}.rb_finance f on c.GuestId = f.GuestId and c.OrderId = f.OrderID and f.`Status` !=4
left join {datebaseStr}.rb_tradeway t on f.FrID = t.FinanceId
WHERE {where} GROUP BY c.Id ORDER BY c.Id DESC ";
return GetPage<RB_Education_Contract_ViewModel>(pageIndex, pageSize, out rowsCount, sql, parameters).ToList();
}
}
}
......@@ -85,6 +85,14 @@ namespace Edu.Repository.Finance
{
where += string.Format(" AND A." + nameof(RB_Finance.OrderID) + " in({0})", model.OrderIdStr);
}
if (model.GuestId > 0)
{
where += string.Format(" AND A." + nameof(RB_Finance.GuestId) + " ={0}", model.GuestId);
}
if (!string.IsNullOrWhiteSpace(model.GuestIdStr))
{
where += string.Format(" AND A." + nameof(RB_Finance.GuestId) + " in({0})", model.GuestIdStr);
}
if (model.Type > 0)
{
where += string.Format(" AND A." + nameof(RB_Finance.Type) + " ={0}", (int)model.Type);
......
using System.Collections.Generic;
using System.Linq;
using Edu.Common.Enum;
using Edu.Model.Entity.Finance;
using Edu.Model.ViewModel.Finance;
namespace Edu.Repository.Finance
{
/// <summary>
/// 教育轧账仓储层
/// </summary>
public class RB_RollingAccountRepository : BaseRepository<RB_RollingAccount>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<RB_RollingAccount_Extend> GetList(RB_RollingAccount_Extend model)
{
string where = " WHERE 1=1 ";
if (model.GroupId > 0)
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.GroupId) + "={0} ", model.GroupId);
}
if (model.State > 0)
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.State) + "={0} ", model.State);
}
if (!string.IsNullOrEmpty(model.Month))
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.Month) + "='{0}' ", model.Month);
}
if (model.SchoolId >= 0)
{
where += string.Format(" AND FIND_IN_SET('{0}',"+ nameof(RB_RollingAccount_Extend.SchoolIds) + ") ", model.SchoolId);
}
string sql = "select * from RB_RollingAccount " + where +" order by Id desc";
return Get<RB_RollingAccount_Extend>(sql).ToList();
}
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="model"></param>
/// <returns></returns>
public List<RB_RollingAccount_Extend> GetPageList(int pageIndex,int pageSize,out long count,RB_RollingAccount_Extend model)
{
string where = " WHERE 1=1 ";
if (model.GroupId > 0)
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.GroupId) + "={0} ", model.GroupId);
}
if (model.State > 0)
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.State) + "={0} ", model.State);
}
if (!string.IsNullOrEmpty(model.Month))
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.Month) + "='{0}' ", model.Month);
}
if (model.SchoolId >= 0)
{
where += string.Format(" AND FIND_IN_SET('{0}'," + nameof(RB_RollingAccount_Extend.SchoolIds) + ") ", model.SchoolId);
}
string sql = "select * from RB_RollingAccount " + where + " order by Id desc";
return GetPage<RB_RollingAccount_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
}
}
......@@ -29,6 +29,7 @@
"WkHtmlToPdfPath": "D:/wkhtmltopdf/bin/",
"FinanceKey": "FinanceMallInsertToERPViitto2020",
"PaymentFinanceApi": "http://192.168.1.13:8083/api/Mall/InsertFinanceBatchForMallOut",
"FinanceDateBase": "test_reborn_finance",
"RabbitMqConfig": {
"HostName": "47.96.25.130",
"VirtualHost": "/",
......
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