Commit 8808b992 authored by liudong1993's avatar liudong1993

教师奖励

parent bfed8a2f
......@@ -78,5 +78,10 @@ namespace Edu.Model.ViewModel.User
/// 教师编号
/// </summary>
public string QTIds { get; set; }
/// <summary>
/// 对应账号id
/// </summary>
public int AccountId { get; set; }
}
}
\ No newline at end of file
......@@ -363,6 +363,21 @@ namespace Edu.Module.Course
return orderRepository.GetEntity<RB_Order_ViewModel>(orderId);
}
/// <summary>
/// 获取订单详情
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
public RB_Order_ViewModel GetClassOrderInfo_V2(int orderId)
{
var model = orderRepository.GetEntity<RB_Order_ViewModel>(orderId);
if (model != null)
{
model.ClassName = classRepository.GetEntity(model.ClassId)?.ClassName ?? "";
}
return model;
}
/// <summary>
/// 获取订单阶梯价格
/// </summary>
......
......@@ -455,7 +455,7 @@ namespace Edu.Module.Course
List<RB_Class_Time_ViewModel> timeList = new List<RB_Class_Time_ViewModel>();
List<RB_Class_Type_ViewModel> typeList = new List<RB_Class_Type_ViewModel>();
List<RB_Class_Check_ViewModel> checkList = new List<RB_Class_Check_ViewModel>();
//List<RB_Teacher_ViewModel> teacherList = new List<RB_Teacher_ViewModel>();
List<RB_Teacher_ViewModel> teacherList = new List<RB_Teacher_ViewModel>();
if (plist.Any()) {
string pids = string.Join(",", plist.Select(x => x.ClassPlanId));
timeList = class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = pids });
......@@ -466,12 +466,13 @@ namespace Edu.Module.Course
string classIds = string.Join(",", plist.Select(x => x.ClassId).Distinct());
checkList = class_CheckRepository.GetClassCheckStatistics(new RB_Class_Check_ViewModel() { Group_Id = userInfo.Group_Id, Q_ClassIds = classIds, StartDate = StartTime, EndDate = EndTime });
//查询教师列表
//string teacherIds = string.Join(",", plist.Select(x => x.TeacherId).Distinct());
//teacherList = teacherRepository.GetTeacherListRepository(new RB_Teacher_ViewModel() { QTIds = teacherIds });
string teacherIds = string.Join(",", plist.Select(x => x.TeacherId).Distinct());
teacherList = teacherRepository.GetTeacherListRepository(new RB_Teacher_ViewModel() { QTIds = teacherIds });
}
var trans = teaching_BonusDetailRepository.DbTransaction;
try
{
decimal TotalMoney = 0;
foreach (var item in plist)
{
//查询课时
......@@ -481,13 +482,13 @@ namespace Edu.Module.Course
foreach (var qitem in ctimelist)
{
var ts = Convert.ToDateTime(nowTime + " " + qitem.EndTime) - Convert.ToDateTime(nowTime + " " + qitem.StartTime);
minute += ts.Minutes;
minute += (int)ts.TotalMinutes;
}
int ksNum = minute / configModel.BasicMinutes; // 未达到一课时时间 算不算一课时
//查询课单价
var typeModel = typeList.Where(x => x.CTypeId == item.ClassType).FirstOrDefault();
//var teacherModel = teacherList.Where(x => x.TId == item.TeacherId).FirstOrDefault();
decimal unitPrice = configModel.BasicHourFee + (typeModel?.AddHourFee ?? 0);
var teacherModel = teacherList.Where(x => x.TId == item.TeacherId).FirstOrDefault();
decimal unitPrice = configModel.BasicHourFee + (typeModel?.AddHourFee ?? 0) + (teacherModel?.BaseHourFee ?? 0);
//签到人数
var checkModel = checkList.Where(x => x.ClassId == item.ClassId && x.ClassDate == item.ClassDate).FirstOrDefault();
......@@ -511,11 +512,13 @@ namespace Edu.Module.Course
UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now
}, trans);
TotalMoney += ksNum * unitPrice;
}
#region 更新状态为待确认
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Teaching_Bonus_ViewModel.State), BonusStateEnum.Wait}
{ nameof(RB_Teaching_Bonus_ViewModel.State), BonusStateEnum.Wait},
{ nameof(RB_Teaching_Bonus_ViewModel.Money), TotalMoney}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
......@@ -566,13 +569,15 @@ namespace Edu.Module.Course
string msg = "";
//查询出所有需要发提成的人
List<int> EmpList = list.Select(x => x.TeacherId).Distinct().ToList();
//根据教师ids 查询 账号ids
var teachList = teacherRepository.GetTeacherList(string.Join(",", EmpList));
//查询所有的账户信息 不存在的需要提示
var banklist = clientBankAccountRepository.GetList(new RB_ClientBankAccount_Extend() { RB_Group_Id = userInfo.Group_Id, Type = Common.Enum.Finance.ClientTypeEnum.Employee, ObjIdStr = string.Join(",", EmpList) });
foreach (var item in EmpList)
var banklist = clientBankAccountRepository.GetList(new RB_ClientBankAccount_Extend() { RB_Group_Id = userInfo.Group_Id, Type = Common.Enum.Finance.ClientTypeEnum.Employee, ObjIdStr = string.Join(",", teachList.Select(x => x.AccountId)) });
foreach (var item in teachList)
{
if (!banklist.Where(x => x.ObjID == item).Any())
if (!banklist.Where(x => x.ObjID == item.AccountId).Any())
{
msg += (UserReidsCache.GetUserLoginInfo(item)?.AccountName ?? "") + "未查询到员工银行账户信息;";
msg += (UserReidsCache.GetUserLoginInfo(item.AccountId)?.AccountName ?? "") + "未查询到员工银行账户信息;";
}
}
if (msg != "")
......@@ -584,10 +589,10 @@ namespace Edu.Module.Course
foreach (var item in EmpList)
{
var tlist = list.Where(x => x.TeacherId == item).ToList();
var teacherModel = teacherRepository.GetEntity(item);
var teacherModel = teachList.Where(x => x.TId == item).FirstOrDefault();
#region 新增财务单据
//银行账户
var clientModel = banklist.Where(x => x.ObjID == item).FirstOrDefault();
var clientModel = banklist.Where(x => x.ObjID == teacherModel.AccountId).FirstOrDefault();
var detailList = new List<object> { };
decimal TotalMoney = 0;
foreach (var qitem in tlist)
......@@ -606,21 +611,27 @@ namespace Edu.Module.Course
string Remark = tmodel.Month + "月," + teacherModel.TeacherName + "教师奖励";
var financeObj = new
{
CreateBy = userInfo.Id,
IsPublic,
ClientType = (int)Common.Enum.Finance.ClientTypeEnum.Employee,
ClientID = clientModel.ID,
CurrencyId,
WBMoney = TotalMoney,
PayDate = DateTime.Now.ToString("yyyy-MM-dd"),
RB_Branch_Id = teacherModel.School_Id,
TemplateId = Config.ReadConfigKey("TeachingBonusTemplete"),
OrderSource = 17,
OtherType = 26,
ReFinanceId = bonusId,
Remark,
detailList,
RB_Depart_Id = teacherModel.Dept_Id
CreateBy = userInfo.Id,
RB_Branch_Id = teacherModel.School_Id,
RB_Depart_Id = teacherModel.Dept_Id,
RB_Group_Id = userInfo.Group_Id,
RB_CreateByName = userInfo.AccountName,
RB_DepartName = teacherModel.DeptName,
RB_BranchName = teacherModel.SName,
RB_GroupName = userInfo.GroupName,
FinanceType = 2
};
string sign = EncryptionHelper.AesEncrypt(JsonHelper.Serialize(financeObj), Config.ReadConfigKey("FinanceKey"));
var resultInfo = new
......@@ -652,7 +663,7 @@ namespace Edu.Module.Course
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Teaching_Bonus_ViewModel),
FiledName=nameof(RB_Teaching_Bonus_ViewModel.Id),
FiledValue=bonusId,
OperatorEnum=OperatorEnum.Equal
}
......
......@@ -148,5 +148,28 @@ WHERE 1=1
}
return GetPage<RB_Teacher_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取教师账户
/// </summary>
/// <param name="teacherIds"></param>
/// <returns></returns>
public List<RB_Teacher_ViewModel> GetTeacherList(string teacherIds)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT t.*,a.Id as AccountId,s.SName,d.DeptName
FROM rb_teacher AS t
LEFT JOIN rb_account as a ON (t.TId=a.AccountId AND a.AccountType=2)
LEFT JOIN rb_school AS s ON t.School_Id=s.SId
left join rb_department as d on t.Dept_Id = d.DeptId
WHERE 1=1
");
builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Teacher_ViewModel.Status), (int)DateStateEnum.Normal);
builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Teacher_ViewModel.AuditStatus), (int)AccountStatusEnum.Pass);
builder.AppendFormat(" AND t.{0} IN({1}) ", nameof(RB_Teacher_ViewModel.TId), teacherIds);
return Get<RB_Teacher_ViewModel>(builder.ToString(), parameters).ToList();
}
}
}
\ No newline at end of file
......@@ -338,6 +338,53 @@ namespace Edu.WebApi.Controllers.Course
});
}
/// <summary>
/// 订单详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetClassOrderForDetail() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int OrderId = parms.GetInt("OrderId", 0);
if (OrderId <= 0)
{
return ApiResult.ParamIsNull();
}
var model = orderModule.GetClassOrderInfo_V2(OrderId);
if (model == null)
{
return ApiResult.Failed("订单不存在");
}
return ApiResult.Success("", new
{
model.OrderId,
model.ClassId,
model.TradeWay,
model.Class_Price,
model.Unit_Price,
model.GuestNum,
model.PreferPrice,
model.Income,
model.Refund,
model.DiscountMoney,
model.PlatformTax,
DueInMoney = model.PreferPrice - (model.Income - model.Refund + model.PlatformTax + model.DiscountMoney),
model.OrderState,
OrderStateName = model.OrderState.ToName(),
model.EnterID,
EnterName = UserReidsCache.GetUserLoginInfo(model.EnterID)?.AccountName ?? "",
model.CommissionMoney,
model.ExtraRewardMoney,
model.ExtraDeductMoney,
model.IsCommissionGive,
CreateTime = model.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
CreateTime2 = model.CreateTime.ToString("yyyy年MM月dd日")
});
}
/// <summary>
/// 取消订单
/// </summary>
......
......@@ -434,6 +434,10 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.ParamIsNull("请选择月份");
}
//if (Convert.ToDateTime(dmodel.Month) >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM")))
//{
// return ApiResult.ParamIsNull("只能选择之前月份");
//}
if (string.IsNullOrEmpty(dmodel.TeacherIds))
{
return ApiResult.ParamIsNull("请选择老师");
......@@ -484,6 +488,21 @@ namespace Edu.WebApi.Controllers.Course
return ApiResult.Failed(msg);
}
}
/// <summary>
/// 获取枚举列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetBonusStateEnumList()
{
var list = EnumHelper.EnumToList(typeof(BonusStateEnum));
return ApiResult.Success("", list.Select(x => new
{
x.Name,
x.Id
}));
}
#endregion
}
}
......@@ -23,8 +23,8 @@
"Mongo": "mongodb://47.96.25.130:27017",
"MongoDBName": "Edu",
"FinanceKey": "FinanceMallInsertToERPViitto2020",
"PaymentFinanceApi": "http://192.168.2.16:8083/api/Mall/InsertFinanceBatchForMallOut",
"TeachingBonusTemplete": 134,
"PaymentFinanceApi": "http://192.168.1.13:8083/api/Mall/InsertFinanceBatchForMallOut",
"TeachingBonusTemplete": 141,
"BonusCostTypeId": 540,
"RabbitMqConfig": {
"HostName": "47.96.25.130",
......
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