Commit b6af9ea4 authored by 黄奎's avatar 黄奎

新增合同配置

parent 8e25bb45
......@@ -26,7 +26,6 @@ namespace Edu.Model.Entity.User
/// </summary>
public string SAddress { get; set; }
/// <summary>
/// 联系电话
/// </summary>
......@@ -86,5 +85,10 @@ namespace Edu.Model.Entity.User
/// 负责人编号
/// </summary>
public int ManagerId { get; set; }
/// <summary>
/// 合同抬头
/// </summary>
public string ContractTitle { get; set; }
}
}
\ No newline at end of file
......@@ -74,6 +74,11 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public string SchoolName { get; set; }
/// <summary>
/// 校区负责人编号
/// </summary>
public int ManagerId { get; set; }
/// <summary>
/// 班级阶梯价列表
/// </summary>
......
......@@ -6,6 +6,7 @@ using Edu.Common.Enum.Course;
using Edu.Common.Plugin;
using Edu.Model.CacheModel;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.User;
using Edu.Repository.Course;
using Edu.Repository.User;
using Newtonsoft.Json.Linq;
......@@ -36,6 +37,84 @@ namespace Edu.Module.Course
/// </summary>
private readonly RB_GroupRepository groupRepository = new RB_GroupRepository();
/// <summary>
/// 校区仓储层对象
/// </summary>
private readonly RB_SchoolRepository schoolRepository = new RB_SchoolRepository();
/// <summary>
/// 订单仓储层对象
/// </summary>
private readonly RB_OrderRepository orderRepository = new RB_OrderRepository();
/// <summary>
/// 订单学员仓储层对象
/// </summary>
private readonly RB_Order_GuestRepository order_GuestRepository = new RB_Order_GuestRepository();
/// <summary>
/// 班级仓储层对象
/// </summary>
private readonly RB_ClassRepository classRepository = new RB_ClassRepository();
/// <summary>
/// 获取学员信息
/// </summary>
/// <param name="OrderId"></param>
/// <param name="GuestId"></param>
/// <returns></returns>
public object GetStudentInfoModule(int OrderId, int GuestId)
{
var obj = new object();
var glist = order_GuestRepository.GetList(new RB_Order_Guest_ViewModel() { OrderId = OrderId, GuestState = 1 });
var orderModel = orderRepository.GetEntity(OrderId);
var guestModel = glist.Where(qitem=>qitem.Id==GuestId)?.FirstOrDefault();
var classModel =new RB_Class_ViewModel();
decimal PreferPrice = 0;//总金额
decimal DiscountMoney = 0;//优惠金额
decimal Money = 0;//实际金额
if (orderModel != null && orderModel.OrderId > 0)
{
if (orderModel.OrderType == Common.Enum.Sale.OrderTypeEnum.CourseOrder)
{
classModel = classRepository.GetClassAndCourseListRepository(new RB_Class_ViewModel() { ClassId = orderModel.ClassId })?.FirstOrDefault();
}
}
var qids = (classModel?.ManagerId ?? 0).ToString() + "," + (orderModel?.EnterID ?? 0).ToString();
var empList= accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { QIds = qids }) ;
if (glist != null && glist.Count > 0)
{
PreferPrice = orderModel.PreferPrice / glist.Count();
DiscountMoney = orderModel.DiscountMoney / glist.Count();
Money = (orderModel.PreferPrice - orderModel.DiscountMoney) / glist.Count();//平均每人费用
}
string dxMoney = StringHelper.MoneyToUpper(Money.ToString());
obj = new
{
StudentName=guestModel?.GuestName??"",
StuBirth="",
StuSex=(guestModel?.Sex??0)==1?0:1,
StuAddress=guestModel?.ContactAddress??"",
StuTel= guestModel?.Mobile??"",
StuEmail="",
CourseName=classModel?.CourseName??"",
SchoolName=classModel?.SchoolName??"",
SchoolPrincipal= empList?.Where(qitem=>qitem.Id==(classModel?.ManagerId??0))?.FirstOrDefault()?.EmployeeName??"",
StartLevel=guestModel?.Basics??"",
CourseConsultant= empList?.Where(qitem => qitem.Id == (orderModel?.EnterID ?? 0))?.FirstOrDefault()?.EmployeeName ?? "",
Payee= empList?.Where(qitem => qitem.Id == (orderModel?.EnterID ?? 0))?.FirstOrDefault()?.EmployeeName ?? "",
FirstClassHours=classModel?.ClassHours??0,
FirstCourseFee= PreferPrice,
FirstBookFee =0,
FirstClassFee=0,
FirstDiscountMoney= DiscountMoney,
FirstMoney= Money,
CNYCaps= dxMoney,
Money,
};
return obj;
}
/// <summary>
/// 获取合同分页列表
......@@ -45,10 +124,10 @@ namespace Edu.Module.Course
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Education_Contract_ViewModel> GetEducationContractPageList(int pageIndex, int pageSize, out long count, RB_Education_Contract_ViewModel dmodel)
public List<RB_Education_Contract_ViewModel> GetEducationContractPageListModule(int pageIndex, int pageSize, out long count, RB_Education_Contract_ViewModel dmodel)
{
var list = education_ContractRepository.GetPageList(pageIndex, pageSize, out count, dmodel);
if (list.Any())
var list = education_ContractRepository.GetEducationContractPageListRepository(pageIndex, pageSize, out count, dmodel);
if (list != null &&list.Count>0)
{
var userIds = string.Join(",", list.Select(x => x.CreateBy).Distinct());
var alist = accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { QIds = userIds });
......@@ -66,46 +145,98 @@ namespace Edu.Module.Course
/// 单独新增/修改合同
/// </summary>
/// <param name="dmodel"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public bool SetEducationContractInfo(RB_Education_Contract_ViewModel dmodel, UserInfo userInfo)
public bool SetEducationContractModule(RB_Education_Contract_ViewModel model)
{
//if (dmodel.Id > 0)
//{
// dmodel.CNYCaps = StringHelper.MoneyToUpper(dmodel.Money.ToString());
// Dictionary<string, object> keyValues = new Dictionary<string, object>() {
// { nameof(RB_Education_Contract_ViewModel.StudentName),dmodel.StudentName},
// { nameof(RB_Education_Contract_ViewModel.SchoolName),dmodel.SchoolName},
// { nameof(RB_Education_Contract_ViewModel.CourseName),dmodel.CourseName},
// { nameof(RB_Education_Contract_ViewModel.CourseContent),dmodel.CourseContent},
// { nameof(RB_Education_Contract_ViewModel.CNYCaps),dmodel.CNYCaps},
// { nameof(RB_Education_Contract_ViewModel.Money),dmodel.Money},
// { nameof(RB_Education_Contract_ViewModel.Exam),dmodel.Exam},
// { nameof(RB_Education_Contract_ViewModel.UpdateBy),userInfo.Id},
// { nameof(RB_Education_Contract_ViewModel.UpdateTime),dmodel.UpdateTime},
// { nameof(RB_Education_Contract_ViewModel.Sex),dmodel.Sex},
// { nameof(RB_Education_Contract_ViewModel.IDCard),dmodel.IDCard},
// { nameof(RB_Education_Contract_ViewModel.Domicile),dmodel.Domicile},
// { nameof(RB_Education_Contract_ViewModel.ContactAddress),dmodel.ContactAddress},
// { nameof(RB_Education_Contract_ViewModel.ContactMobile),dmodel.ContactMobile},
// { nameof(RB_Education_Contract_ViewModel.EmergencyContact),dmodel.EmergencyContact},
// { nameof(RB_Education_Contract_ViewModel.EmergencyMobile),dmodel.EmergencyMobile},
// };
// List<WhereHelper> wheres = new List<WhereHelper>() {
// new WhereHelper(){
// FiledName=nameof(RB_Education_Contract_ViewModel.Id),
// FiledValue=dmodel.Id,
// OperatorEnum=OperatorEnum.Equal
// }
// };
// return education_ContractRepository.Update(keyValues, wheres);
//}
//else {
// //生成合同编码
// dmodel.ContractNo = CreateContractNum(userInfo.Group_Id);
// return education_ContractRepository.Insert(dmodel) > 0;
//}
return false;
bool flag;
if (model.Id > 0)
{
model.CNYCaps = StringHelper.MoneyToUpper(model.Money.ToString());
Dictionary<string, object> keyValues = new Dictionary<string, object>()
{
{ nameof(RB_Education_Contract_ViewModel.StudentName),model.StudentName},
{ nameof(RB_Education_Contract_ViewModel.StuBirth),model.StuBirth},
{ nameof(RB_Education_Contract_ViewModel.StuSex),model.StuSex},
{ nameof(RB_Education_Contract_ViewModel.StuAddress),model.StuAddress},
{ nameof(RB_Education_Contract_ViewModel.StuTel),model.StuTel},
{ nameof(RB_Education_Contract_ViewModel.StuEmail),model.StuEmail},
{ nameof(RB_Education_Contract_ViewModel.ParentName),model.ParentName},
{ nameof(RB_Education_Contract_ViewModel.ParentRelation),model.ParentRelation},
{ nameof(RB_Education_Contract_ViewModel.ParentTel),model.ParentTel},
{ nameof(RB_Education_Contract_ViewModel.ParentEmail),model.ParentEmail},
{ nameof(RB_Education_Contract_ViewModel.UrgentName),model.UrgentName},
{ nameof(RB_Education_Contract_ViewModel.UrgentRelation),model.UrgentRelation},
{ nameof(RB_Education_Contract_ViewModel.UrgentTel),model.UrgentTel},
{ nameof(RB_Education_Contract_ViewModel.UrgentEmail),model.UrgentEmail},
{ nameof(RB_Education_Contract_ViewModel.GuardianIDCard),model.GuardianIDCard},
{ nameof(RB_Education_Contract_ViewModel.CourseName),model.CourseName},
{ nameof(RB_Education_Contract_ViewModel.SchoolName),model.SchoolName},
{ nameof(RB_Education_Contract_ViewModel.SchoolPrincipal),model.SchoolPrincipal},
{ nameof(RB_Education_Contract_ViewModel.StartLevel),model.StartLevel},
{ nameof(RB_Education_Contract_ViewModel.CourseConsultant),model.CourseConsultant},
{ nameof(RB_Education_Contract_ViewModel.Payee),model.Payee},
{ nameof(RB_Education_Contract_ViewModel.FirstClassHours),model.FirstClassHours},
{ nameof(RB_Education_Contract_ViewModel.FirstCourseFee),model.FirstCourseFee},
{ nameof(RB_Education_Contract_ViewModel.FirstBookFee),model.FirstBookFee},
{ nameof(RB_Education_Contract_ViewModel.FirstClassFee),model.FirstClassFee},
{ nameof(RB_Education_Contract_ViewModel.FirstDiscountMoney),model.FirstDiscountMoney},
{ nameof(RB_Education_Contract_ViewModel.FirstMoney),model.FirstMoney},
{ nameof(RB_Education_Contract_ViewModel.FirstPayDate),model.FirstPayDate},
{ nameof(RB_Education_Contract_ViewModel.SecondClassHours),model.SecondClassHours},
{ nameof(RB_Education_Contract_ViewModel.SecondCourseFee),model.SecondCourseFee},
{ nameof(RB_Education_Contract_ViewModel.SecondBookFee),model.SecondBookFee},
{ nameof(RB_Education_Contract_ViewModel.SecondClassFee),model.SecondClassFee},
{ nameof(RB_Education_Contract_ViewModel.SecondDiscountMoney),model.SecondDiscountMoney},
{ nameof(RB_Education_Contract_ViewModel.SecondMoney),model.SecondMoney},
{ nameof(RB_Education_Contract_ViewModel.SecondPayDate),model.SecondPayDate},
{ nameof(RB_Education_Contract_ViewModel.ThirdClassHours),model.ThirdClassHours},
{ nameof(RB_Education_Contract_ViewModel.ThirdCourseFee),model.ThirdCourseFee},
{ nameof(RB_Education_Contract_ViewModel.ThirdBookFee),model.ThirdBookFee},
{ nameof(RB_Education_Contract_ViewModel.ThirdClassFee),model.ThirdClassFee},
{ nameof(RB_Education_Contract_ViewModel.ThirdDiscountMoney),model.ThirdDiscountMoney},
{ nameof(RB_Education_Contract_ViewModel.ThirdMoney),model.ThirdMoney},
{ nameof(RB_Education_Contract_ViewModel.ThirdPayDate),model.ThirdPayDate},
{ nameof(RB_Education_Contract_ViewModel.CNYCaps),model.CNYCaps},
{ nameof(RB_Education_Contract_ViewModel.Money),model.Money},
{ nameof(RB_Education_Contract_ViewModel.Exam),model.Exam},
{ nameof(RB_Education_Contract_ViewModel.IsSupplement),model.IsSupplement},
};
flag = education_ContractRepository.Update(keyValues, new WhereHelper(nameof(RB_Education_Contract_ViewModel.Id),model.Id));
}
else
{
var orderModel = orderRepository.GetEntity(model.OrderId);
var classModel = new RB_Class_ViewModel();
if (orderModel != null && orderModel.ClassId > 0)
{
classModel = classRepository.GetClassAndCourseListRepository(new RB_Class_ViewModel() { ClassId = orderModel.ClassId })?.FirstOrDefault();
}
model.School_Id = classModel?.School_Id ?? 0;
//生成合同编码
model.ContractNo = CreateContractNumModule(model.Group_Id,model.School_Id);
var newId = education_ContractRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 生成合同编号
/// </summary>
/// <param name="GroupId"></param>
/// <returns></returns>
public string CreateContractNumModule(int GroupId,int schoolId)
{
var schoolModel= schoolRepository.GetEntity(schoolId);
string newContractNum = "JH-CD";
if (schoolModel != null && schoolModel.SId > 0)
{
newContractNum = schoolModel?.ContractTitle ?? "JH-CD";
}
var totalCount = education_ContractRepository.GetContractCount(new RB_Education_Contract_ViewModel() { Group_Id = GroupId });
string num = (totalCount + 1).ToString("D4");
return newContractNum + num;
}
/// <summary>
......@@ -113,7 +244,7 @@ namespace Edu.Module.Course
/// </summary>
/// <param name="contractId"></param>
/// <returns></returns>
public RB_Education_Contract_ViewModel GetEducationContractInfo(int contractId)
public RB_Education_Contract_ViewModel GetEducationContractModule(int contractId)
{
var model = education_ContractRepository.GetEntity<RB_Education_Contract_ViewModel>(contractId);
if (model == null) return model;
......@@ -121,30 +252,7 @@ namespace Edu.Module.Course
return model;
}
/// <summary>
/// 生成合同编号
/// </summary>
/// <param name="GroupId"></param>
/// <returns></returns>
public string CreateContractNum(int GroupId)
{
string newContractNum = "JH-CD0018";
var totalCount = education_ContractRepository.GetContractCount(new RB_Education_Contract_ViewModel() { Group_Id = GroupId });
string num = (totalCount + 1).ToString();
switch (num.Length) {
case 1:
num = "00000" + num;break;
case 2:
num = "0000" + num; break;
case 3:
num = "000" + num; break;
case 4:
num = "00" + num; break;
case 5:
num = "0" + num; break;
}
return newContractNum + num;
}
/// <summary>
/// 同和审核
......@@ -153,7 +261,7 @@ namespace Edu.Module.Course
/// <param name="state"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public bool SetEducationContractAudit(int contractId, int state, UserInfo userInfo)
public bool SetEducationContractAuditModule(int contractId, int state, UserInfo userInfo)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>();
if (state == 5)
......@@ -185,7 +293,7 @@ namespace Edu.Module.Course
/// <param name="sign"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public bool SetEducationContractSign(int contractId, string sign)
public bool SetEducationContractSignModule(int contractId, string sign)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>()
{
......
......@@ -1646,85 +1646,6 @@ namespace Edu.Module.Course
{
return orderRepository.GetMyOrderStatistics(demodel);
}
/// <summary>
/// 订单领取合同
/// </summary>
/// <param name="orderId"></param>
/// <param name="guestId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public bool SetOrderReceiveContract(int orderId, int guestId, UserInfo userInfo)
{
//var glist = order_GuestRepository.GetList(new RB_Order_Guest_ViewModel() { Group_Id = userInfo.Group_Id, Id = guestId, OrderId = orderId, GuestState = 1 });
//if (glist.Any())
//{
// //订单信息
// var omodel = orderRepository.GetEntity(orderId);
// decimal Money = (omodel.PreferPrice - omodel.DiscountMoney) / glist.Count();//平均每人费用 (看是否根据订单单价)
// string dxMoney = StringHelper.MoneyToUpper(Money.ToString());
// //班级信息
// var classmodel = classRepository.GetClassAndCourseListRepository(new RB_Class_ViewModel() { ClassId = omodel.ClassId }).FirstOrDefault();
// string newContractNum = "JH-CD0018";
// var totalCount = education_ContractRepository.GetContractCount(new RB_Education_Contract_ViewModel() { Group_Id = userInfo.Group_Id });
// //查询已有合同的
// string guestIds = string.Join(",", glist.Select(x => x.Id));
// var clist = education_ContractRepository.GetList(new RB_Education_Contract_ViewModel() { Group_Id = userInfo.Group_Id, OrderId = orderId, GuestIds = guestIds, Status = -1 }).Where(x => x.Status != 4).ToList();
// foreach (var item in glist) {
// var cmodel = clist.Where(x => x.GuestId == item.Id).FirstOrDefault();
// if (cmodel == null) {
// totalCount += 1;
// string num = totalCount.ToString();
// switch (num.Length)
// {
// case 1:
// num = "00000" + num; break;
// case 2:
// num = "0000" + num; break;
// case 3:
// num = "000" + num; break;
// case 4:
// num = "00" + num; break;
// case 5:
// num = "0" + num; break;
// }
// string ContractNo = newContractNum + num;
// education_ContractRepository.Insert(new Model.Entity.Course.RB_Education_Contract()
// {
// Id = 0,
// GuestId = item.Id,
// ContractNo = ContractNo,
// CreateBy = userInfo.Id,
// CreateTime = DateTime.Now,
// CType = ContractTypeEnum.Train,
// Exam = "",
// Group_Id = userInfo.Group_Id,
// IsCompanySeal = 0,
// CNYCaps = dxMoney,
// Money = Money.ToString(),
// OrderId = orderId,
// CourseName = classmodel.CateName,
// CourseContent = classmodel.CourseName,
// SchoolName = classmodel.SchoolName,
// School_Id = classmodel.School_Id,
// Sign = "",
// Status = 0,
// StudentName = item.GuestName,
// UpdateBy = userInfo.Id,
// UpdateTime = DateTime.Now,
// ContactAddress = item.ContactAddress,
// Domicile = item.Domicile,
// IDCard = item.IDCard,
// ContactMobile = item.Mobile,
// EmergencyContact = item.Contact,
// EmergencyMobile = item.ContactMobile,
// Sex = item.Sex
// });
// }
// }
//}
return true;
}
#endregion
#region 订单操作
......
......@@ -107,6 +107,7 @@ namespace Edu.Module.User
{nameof(RB_School_ViewModel.Status),model.Status },
{nameof(RB_School_ViewModel.Dept_Id),model.Dept_Id },
{nameof(RB_School_ViewModel.ManagerId),model.ManagerId },
{nameof(RB_School_ViewModel.ContractTitle),model.ContractTitle },
};
flag = schoolRepository.Update(fileds, new WhereHelper(nameof(RB_School_ViewModel.SId), model.SId));
}
......
......@@ -67,12 +67,12 @@ WHERE 1=1
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,B.CourseName,D.TeacherName,IFNULL(D.TeacherHead,'') AS TeacherHead ,E.SName AS SchoolName,c.CateName
FROM rb_class AS A LEFT JOIN rb_course AS B ON A.CouseId=B.CourseId
left join rb_course_category c on b.CateId = c.CateId
SELECT A.*,B.CourseName,D.TeacherName,IFNULL(D.TeacherHead,'') AS TeacherHead ,E.SName AS SchoolName,c.CateName,E.ManagerId
FROM rb_class AS A LEFT JOIN rb_course AS B ON A.CouseId=B.CourseId
LEFT JOIN rb_course_category c on b.CateId = c.CateId
LEFT JOIN rb_teacher AS D ON A.Teacher_Id=D.TId
LEFT JOIN rb_school AS E ON A.School_Id=E.SId
WHERE 1=1
LEFT JOIN rb_school AS E ON A.School_Id=E.SId
WHERE 1=1
");
if (query != null)
{
......@@ -134,7 +134,6 @@ left join rb_course_category c on b.CateId = c.CateId
/// <returns></returns>
public List<RB_Class_ViewModel> GetClassPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Class_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
......@@ -346,10 +345,10 @@ FROM (
/// <param name="GroupId"></param>
/// <returns></returns>
public List<RB_Class_ViewModel> GetTeachingPerfClassList(int GroupId) {
string sql = $@"SELECT c.* FROM rb_class c
LEFT JOIN rb_teaching_perf t on (c.ClassId = t.ClassId AND t.`Status`=0)
string sql = $@"
SELECT c.*
FROM rb_class c LEFT JOIN rb_teaching_perf t on (c.ClassId = t.ClassId AND t.`Status`=0)
WHERE c.`Status`=0 and c.Group_Id ={GroupId} and c.ClassStatus =3 and c.EndClassDate <='2030-12-16' AND t.Id IS NULL";
return Get<RB_Class_ViewModel>(sql).ToList();
}
......@@ -381,19 +380,15 @@ GROUP BY Teacher_Id
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"SELECT c.*,cp.ClassPlanId,cp.ClassDate from rb_class as c
LEFT JOIN rb_student_orderguest as sog on sog.ClassId=c.ClassId
LEFT JOIN (SELECT ClassId,MIN(ClassDate) as ClassDate,MIN(ClassPlanId) as ClassPlanId from rb_class_plan where `Status`=0 and DATE_FORMAT(ClassDate,'%y-%M-%d')>=DATE_FORMAT(now(),'%y-%M-%d') GROUP BY ClassId) as cp
on c.ClassId=cp.ClassId
where c.`Status`=0 and sog.`Status`=0 ");
builder.AppendFormat(@"
SELECT c.*,cp.ClassPlanId,cp.ClassDate
FROM rb_class as c LEFT JOIN rb_student_orderguest as sog on sog.ClassId=c.ClassId
LEFT JOIN (SELECT ClassId,MIN(ClassDate) as ClassDate,MIN(ClassPlanId) as ClassPlanId from rb_class_plan where `Status`=0 and DATE_FORMAT(ClassDate,'%y-%M-%d')>=DATE_FORMAT(now(),'%y-%M-%d') GROUP BY ClassId) as cp
on c.ClassId=cp.ClassId
WHERE c.`Status`=0 and sog.`Status`=0 ");
builder.AppendFormat(" AND sog.Student_Id={0} ", Student_Id);
builder.AppendFormat(" AND c.{0}={1} ", nameof(RB_Class_ViewModel.Group_Id), Group_Id);
return Get<RB_Class_ViewModel>(builder.ToString(), parameters).ToList();
}
}
}
}
\ No newline at end of file
......@@ -14,7 +14,6 @@ namespace Edu.Repository.Course
/// </summary>
public class RB_Education_ContractRepository : BaseRepository<RB_Education_Contract>
{
/// <summary>
/// 获取分页列表
/// </summary>
......@@ -24,40 +23,42 @@ namespace Edu.Repository.Course
/// <param name="demodel"></param>
/// <param name="orderIds"></param>
/// <returns></returns>
public List<RB_Education_Contract_ViewModel> GetPageList(int pageIndex, int pageSize, out long rowsCount, RB_Education_Contract_ViewModel demodel)
public List<RB_Education_Contract_ViewModel> GetEducationContractPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Education_Contract_ViewModel demodel)
{
DynamicParameters parameters = new DynamicParameters();
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.Group_Id)} ={demodel.Group_Id}";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.School_Id > 0)
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.School_Id)} ={demodel.School_Id}";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.School_Id)} ={demodel.School_Id}";
}
if (demodel.OrderId > 0)
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.OrderId)} ={demodel.OrderId}";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.OrderId)} ={demodel.OrderId}";
}
if (demodel.CType > 0)
{
where += $@" AND {nameof(RB_Education_Contract_ViewModel.CType)} ={(int)demodel.CType}";
}
//if (demodel.CType > 0)
//{
// where += $@" and {nameof(RB_Education_Contract_ViewModel.CType)} ={(int)demodel.CType}";
//}
if (demodel.Status >= 0)
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.Status)} ={demodel.Status}";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.Status)} ={demodel.Status}";
}
if (!string.IsNullOrEmpty(demodel.ContractNo))
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.ContractNo)} like '%{demodel.ContractNo}%'";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.ContractNo)} LIKE @ContractNo ";
parameters.Add("ContractNo", "%" + demodel.ContractNo.Trim() + "%");
}
if (!string.IsNullOrEmpty(demodel.StudentName))
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.StudentName)} like '%{demodel.StudentName}%'";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.StudentName)} LIKE @StudentName ";
parameters.Add("StudentName", "%" + demodel.StudentName.Trim() + "%");
}
string sql = $@" select * from RB_Education_Contract where {where} order by Id desc";
return GetPage<RB_Education_Contract_ViewModel>(pageIndex, pageSize, out rowsCount, sql).ToList();
string sql = $@" SELECT * FROM RB_Education_Contract WHERE {where} ORDER BY Id DESC ";
return GetPage<RB_Education_Contract_ViewModel>(pageIndex, pageSize, out rowsCount, sql, parameters).ToList();
}
/// <summary>
......@@ -68,49 +69,50 @@ namespace Edu.Repository.Course
/// <returns></returns>
public List<RB_Education_Contract_ViewModel> GetList(RB_Education_Contract_ViewModel demodel)
{
DynamicParameters parameters = new DynamicParameters();
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.Group_Id)} ={demodel.Group_Id}";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.School_Id > 0)
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.School_Id)} ={demodel.School_Id}";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.School_Id)} ={demodel.School_Id}";
}
if (demodel.OrderId > 0)
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.OrderId)} ={demodel.OrderId}";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.OrderId)} ={demodel.OrderId}";
}
if (!string.IsNullOrEmpty(demodel.OrderIds))
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.OrderId)} in({demodel.OrderIds})";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.OrderId)} IN({demodel.OrderIds})";
}
if (!string.IsNullOrEmpty(demodel.GuestIds))
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.GuestId)} in({demodel.GuestIds})";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.GuestId)} IN({demodel.GuestIds})";
}
if (demodel.CType > 0)
{
where += $@" AND {nameof(RB_Education_Contract_ViewModel.CType)} ={(int)demodel.CType}";
}
//if (demodel.CType > 0)
//{
// where += $@" and {nameof(RB_Education_Contract_ViewModel.CType)} ={(int)demodel.CType}";
//}
if (demodel.Status >= 0)
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.Status)} ={demodel.Status}";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.Status)} ={demodel.Status}";
}
if (!string.IsNullOrEmpty(demodel.ContractNo))
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.ContractNo)} like '%{demodel.ContractNo}%'";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.ContractNo)} LIKE @ContractNo ";
parameters.Add("ContractNo", "%" + demodel.ContractNo.Trim() + "%");
}
if (!string.IsNullOrEmpty(demodel.StudentName))
{
where += $@" and {nameof(RB_Education_Contract_ViewModel.StudentName)} like '%{demodel.StudentName}%'";
where += $@" AND {nameof(RB_Education_Contract_ViewModel.StudentName)} LIKE @StudentName ";
parameters.Add("StudentName", "%" + demodel.StudentName.Trim() + "%");
}
string sql = $@" select * from RB_Education_Contract where {where} order by Id desc";
return Get<RB_Education_Contract_ViewModel>(sql).ToList();
string sql = $@" SELECT * FROM RB_Education_Contract WHERE {where} ORDER BY Id DESC";
return Get<RB_Education_Contract_ViewModel>(sql, parameters).ToList();
}
/// <summary>
/// 根据查询条件获取合同的总条数
/// </summary>
......@@ -118,24 +120,23 @@ namespace Edu.Repository.Course
/// <returns></returns>
public int GetContractCount(RB_Education_Contract_ViewModel where)
{
DynamicParameters parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT COUNT(1) FROM RB_Education_Contract WHERE 1=1
");
builder.AppendFormat(@"SELECT COUNT(1) FROM RB_Education_Contract WHERE 1=1 ");
if (where != null)
{
if (where.Group_Id > 0)
{
builder.AppendFormat($" and {nameof(RB_Education_Contract_ViewModel.Group_Id)} ={where.Group_Id}");
builder.AppendFormat($" AND {nameof(RB_Education_Contract_ViewModel.Group_Id)} ={where.Group_Id}");
}
if (where.ContractNo != null && !string.IsNullOrEmpty(where.ContractNo.Trim()))
{
builder.AppendFormat(" AND ContractNo LIKE '%{0}%' ", where.ContractNo.Trim());
builder.AppendFormat($@" AND {nameof(RB_Education_Contract_ViewModel.ContractNo)} LIKE @ContractNo ");
parameters.Add("ContractNo", "%" + where.ContractNo.Trim() + "%");
}
}
var obj = base.ExecuteScalar(builder.ToString());
var obj = base.ExecuteScalar(builder.ToString(), parameters);
return obj == null ? 0 : Convert.ToInt32(obj);
}
}
}
......@@ -3,7 +3,7 @@
using System.Linq;
using Edu.Common.API;
using Edu.Common.Enum.Course;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course;
using Edu.Module.Course;
......@@ -28,6 +28,19 @@ namespace Edu.WebApi.Controllers.Course
#region 合同列表
/// <summary>
/// 获取学员信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetStudentInfo()
{
int OrderId = base.ParmJObj.GetInt("OrderId", 0);//订单编号
int GuestId = base.ParmJObj.GetInt("GuestId", 0);//学员编号
var model = educationContractModule.GetStudentInfoModule(OrderId,GuestId);
return ApiResult.Success("", model);
}
/// <summary>
/// 获取合同分页列表
/// </summary>
......@@ -37,9 +50,16 @@ namespace Edu.WebApi.Controllers.Course
{
var userInfo = base.UserInfo;
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var dmodel = JsonHelper.DeserializeObject<RB_Education_Contract_ViewModel>(RequestParm.Msg.ToString());
var dmodel = new RB_Education_Contract_ViewModel()
{
OrderId = base.ParmJObj.GetInt("OrderId"),
ContractNo = base.ParmJObj.GetStringValue("ContractNo"),
CType=(ContractTypeEnum)base.ParmJObj.GetInt("CType"),
Status=base.ParmJObj.GetInt("Status"),
StudentName=base.ParmJObj.GetStringValue("StudentName"),
};
dmodel.Group_Id = userInfo.Group_Id;
var list = educationContractModule.GetEducationContractPageList(pageModel.PageIndex, pageModel.PageSize, out long count, dmodel);
var list = educationContractModule.GetEducationContractPageListModule(pageModel.PageIndex, pageModel.PageSize, out long count, dmodel);
pageModel.Count = Convert.ToInt32(count);
pageModel.PageData = list.Select(x => new
{
......@@ -74,7 +94,7 @@ namespace Edu.WebApi.Controllers.Course
public ApiResult GetEducationContractInfo()
{
int ContractId = base.ParmJObj.GetInt("ContractId", 0);//合同id
var model = educationContractModule.GetEducationContractInfo(ContractId);
var model = educationContractModule.GetEducationContractModule(ContractId);
if (model == null)
{
return ApiResult.Failed("合同不存在");
......@@ -107,43 +127,68 @@ namespace Edu.WebApi.Controllers.Course
public ApiResult SetEducationContractInfo()
{
var userInfo = base.UserInfo;
var dmodel = JsonHelper.DeserializeObject<RB_Education_Contract_ViewModel>(RequestParm.Msg.ToString());
if (string.IsNullOrEmpty(dmodel.StudentName))
var dmodel = new RB_Education_Contract_ViewModel()
{
return ApiResult.ParamIsNull("请输入学生姓名");
}
if (string.IsNullOrEmpty(dmodel.SchoolName))
{
return ApiResult.ParamIsNull("请输入学校名称");
}
if (string.IsNullOrEmpty(dmodel.CourseName))
{
return ApiResult.ParamIsNull("请输入课程名称");
}
if (string.IsNullOrEmpty(dmodel.CNYCaps))
{
return ApiResult.ParamIsNull("请输入大写金额");
}
Id = base.ParmJObj.GetInt("Id"),
CType = (ContractTypeEnum)base.ParmJObj.GetInt("CType"),
OrderId = base.ParmJObj.GetInt("OrderId"),
GuestId = base.ParmJObj.GetInt("GuestId"),
ContractNo = base.ParmJObj.GetStringValue("ContractNo"),
StudentName = base.ParmJObj.GetStringValue("StudentName"),
StuBirth = base.ParmJObj.GetDateTime("StuBirth"),
StuSex = base.ParmJObj.GetInt("StuSex"),
StuAddress = base.ParmJObj.GetStringValue("StuAddress"),
StuTel = base.ParmJObj.GetStringValue("StuTel"),
StuEmail = base.ParmJObj.GetStringValue("StuEmail"),
ParentName = base.ParmJObj.GetStringValue("ParentName"),
ParentRelation = base.ParmJObj.GetStringValue("ParentRelation"),
ParentTel = base.ParmJObj.GetStringValue("ParentTel"),
ParentEmail = base.ParmJObj.GetStringValue("ParentEmail"),
UrgentName = base.ParmJObj.GetStringValue("UrgentName"),
UrgentRelation = base.ParmJObj.GetStringValue("UrgentRelation"),
UrgentTel = base.ParmJObj.GetStringValue("UrgentTel"),
UrgentEmail = base.ParmJObj.GetStringValue("UrgentEmail"),
GuardianIDCard = base.ParmJObj.GetStringValue("GuardianIDCard"),
CourseName = base.ParmJObj.GetStringValue("CourseName"),
SchoolName = base.ParmJObj.GetStringValue("SchoolName"),
SchoolPrincipal = base.ParmJObj.GetStringValue("SchoolPrincipal"),
StartLevel = base.ParmJObj.GetStringValue("StartLevel"),
CourseConsultant = base.ParmJObj.GetStringValue("CourseConsultant"),
Payee = base.ParmJObj.GetStringValue("Payee"),
FirstClassHours = base.ParmJObj.GetInt("FirstClassHours"),
FirstCourseFee = base.ParmJObj.GetDecimal("FirstCourseFee"),
FirstBookFee = base.ParmJObj.GetDecimal("FirstBookFee"),
FirstClassFee = base.ParmJObj.GetDecimal("FirstClassFee"),
FirstDiscountMoney = base.ParmJObj.GetDecimal("FirstDiscountMoney"),
FirstMoney = base.ParmJObj.GetDecimal("FirstMoney"),
FirstPayDate = base.ParmJObj.GetDateTime("FirstPayDate"),
SecondClassHours = base.ParmJObj.GetInt("SecondClassHours"),
SecondCourseFee = base.ParmJObj.GetDecimal("SecondCourseFee"),
SecondBookFee = base.ParmJObj.GetDecimal("SecondBookFee"),
SecondClassFee = base.ParmJObj.GetDecimal("SecondClassFee"),
SecondDiscountMoney = base.ParmJObj.GetDecimal("SecondDiscountMoney"),
SecondMoney = base.ParmJObj.GetDecimal("SecondMoney"),
SecondPayDate = base.ParmJObj.GetDateTime("SecondPayDate"),
ThirdClassHours = base.ParmJObj.GetInt("ThirdClassHours"),
ThirdCourseFee = base.ParmJObj.GetDecimal("ThirdCourseFee"),
ThirdBookFee = base.ParmJObj.GetDecimal("ThirdBookFee"),
ThirdClassFee = base.ParmJObj.GetDecimal("ThirdClassFee"),
ThirdDiscountMoney = base.ParmJObj.GetDecimal("ThirdDiscountMoney"),
ThirdMoney=base.ParmJObj.GetDecimal("ThirdMoney"),
ThirdPayDate=base.ParmJObj.GetDateTime("ThirdPayDate"),
CNYCaps=base.ParmJObj.GetStringValue("CNYCaps"),
Money=base.ParmJObj.GetDecimal("Money"),
Exam=base.ParmJObj.GetStringValue("Exam"),
IsSupplement=base.ParmJObj.GetInt("IsSupplement"),
};
dmodel.Group_Id = userInfo.Group_Id;
dmodel.School_Id = userInfo.School_Id;
dmodel.CreateBy = userInfo.Id;
dmodel.CreateTime = DateTime.Now;
dmodel.UpdateBy = userInfo.Id;
dmodel.UpdateTime = DateTime.Now;
dmodel.Status = 0;
bool flag = educationContractModule.SetEducationContractInfo(dmodel, userInfo);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
bool flag = educationContractModule.SetEducationContractModule(dmodel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
......@@ -154,23 +199,14 @@ namespace Edu.WebApi.Controllers.Course
public ApiResult SetEducationContractAudit()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int ContractId = parms.GetInt("ContractId", 0);//合同id
int State = parms.GetInt("State", 1);// 状态 1提交审核 2通过 3驳回 4取消 5盖章
int ContractId = base.ParmJObj.GetInt("ContractId", 0);//合同id
int State = base.ParmJObj.GetInt("State", 1);// 状态 1提交审核 2通过 3驳回 4取消 5盖章
if (ContractId <= 0)
{
return ApiResult.ParamIsNull("请传递合同id");
}
bool flag = educationContractModule.SetEducationContractAudit(ContractId, State, userInfo);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
bool flag = educationContractModule.SetEducationContractAuditModule(ContractId, State, userInfo);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
......@@ -181,23 +217,14 @@ namespace Edu.WebApi.Controllers.Course
[AllowAnonymous]
public ApiResult SetEducationContractSign()
{
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int ContractId = parms.GetInt("ContractId", 0);//合同id
string Sign = parms.GetStringValue("Sign");//签名
int ContractId = base.ParmJObj.GetInt("ContractId", 0);//合同id
string Sign = base.ParmJObj.GetStringValue("Sign");//签名
if (ContractId <= 0)
{
return ApiResult.ParamIsNull("请传递合同id");
}
bool flag = educationContractModule.SetEducationContractSign(ContractId, Sign);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
bool flag = educationContractModule.SetEducationContractSignModule(ContractId, Sign);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
......@@ -210,15 +237,12 @@ namespace Edu.WebApi.Controllers.Course
string path = "/upfile/Temporary/" + time + ".pdf";
string basepath = AppContext.BaseDirectory;
string tempPath = basepath + "\\upfile\\Temporary\\" + time + ".pdf";
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
var ID = parms.GetInt("ContractId");
var CType = parms.GetInt("CType");
var ID = base.ParmJObj.GetInt("ContractId");
var CType = base.ParmJObj.GetInt("CType");
string curl = Common.Config.UploadSiteUrl + string.Format(@"/Home/EducationContractInfo?ID={0}&CType={1}", ID, CType);
var flag = new ToPdfHelper().HtmlWJtoPdf(tempPath, curl);
return ApiResult.Success("", path);
}
#endregion
}
}
......@@ -1171,33 +1171,6 @@ namespace Edu.WebApi.Controllers.Course
return ApiResult.Failed();
}
}
/// <summary>
/// 订单领取合同
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetOrderReceiveContract() {
var userInfo = base.UserInfo;
JObject prams = JObject.Parse(RequestParm.Msg.ToString());
int OrderId = prams.GetInt("OrderId", 0);
int GuestId = prams.GetInt("GuestId", 0);
if (OrderId <= 0)
{
return ApiResult.ParamIsNull("请传递订单id");
}
bool flag = orderModule.SetOrderReceiveContract(OrderId, GuestId, userInfo);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
#endregion
#region 退课申请
......
......@@ -267,8 +267,8 @@ namespace Edu.WebApi.Controllers.User
SLogo=base.ParmJObj.GetStringValue("SLogo"),
SName = base.ParmJObj.GetStringValue("SName"),
Status=(DateStateEnum)base.ParmJObj.GetInt("Status"),
ContractTitle=base.ParmJObj.GetStringValue("ContractTitle"),
};
extModel.CreateBy = base.UserInfo.Id;
extModel.CreateTime = DateTime.Now;
extModel.UpdateBy = base.UserInfo.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