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>
......
......@@ -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
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);
}
}
}
......@@ -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