Commit 6334cdf3 authored by 黄奎's avatar 黄奎

新增同行幸福存折

parent 63546557
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Customer
{
/// <summary>
/// 同行幸福存折实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Customer_BalanceDetail
{
/// <summary>
/// 客户幸福存折明细id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 客户Id
/// </summary>
public int CustomerId { get; set; }
/// <summary>
/// 来源id
/// </summary>
public int SourceId { get; set; }
/// <summary>
/// 来源类型
/// </summary>
public int OrderSource { get; set; }
/// <summary>
/// 类型 1存入 2扣除
/// </summary>
public int Type { get; set; }
/// <summary>
/// 变更金额
/// </summary>
public decimal Money { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 发生时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 账户余额
/// </summary>
public decimal AccountMoney { get; set; }
/// <summary>
/// 报名人数
/// </summary>
public int PeopleNum { get; set; }
/// <summary>
/// 销售编号
/// </summary>
public int EmployeeId { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 校区编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 班级编号
/// </summary>
public int ClassId { get; set; }
}
}
using Edu.Model.Entity.Customer;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Customer
{
/// <summary>
/// 客户幸福存折扩展实体类
/// </summary>
public class RB_Customer_BalanceDetail_ViewModel : RB_Customer_BalanceDetail
{
}
}
......@@ -62,6 +62,22 @@ namespace Edu.Module.Customer
{
QTaskIds = Ids
});
ParsingSubTaskTarget(detailsList);
}
foreach (var item in list)
{
item.DetailsList = detailsList?.Where(qitem => qitem.TaskId == item.Id)?.ToList();
}
}
return list;
}
/// <summary>
/// 处理子任务
/// </summary>
/// <param name="detailsList"></param>
private void ParsingSubTaskTarget(List<RB_Customer_TaskDetails_Extend> detailsList)
{
if (detailsList != null && detailsList.Count > 0)
{
var groupList = detailsList.GroupBy(qitem => new { qitem.TaskType }).Select(qitem => new { qitem.Key.TaskType });
......@@ -108,8 +124,8 @@ namespace Edu.Module.Customer
{
item.TargetList.Add(new
{
TargetId=courseModel.CourseId,
TargetName=courseModel.CourseName
TargetId = courseModel.CourseId,
TargetName = courseModel.CourseName
});
}
break;
......@@ -141,13 +157,6 @@ namespace Edu.Module.Customer
}
}
}
foreach (var item in list)
{
item.DetailsList = detailsList?.Where(qitem => qitem.TaskId == item.Id)?.ToList();
}
}
return list;
}
/// <summary>
/// 新增修改任务信息
......@@ -263,10 +272,12 @@ namespace Edu.Module.Customer
var extModel = customer_TaskRepository.GetEntity<RB_Customer_Task_Extend>(Id);
if (extModel != null)
{
extModel.DetailsList = detailsRepository.GetCustomerTaskDetailsListRepository(new RB_Customer_TaskDetails_Extend()
var detailsList = detailsRepository.GetCustomerTaskDetailsListRepository(new RB_Customer_TaskDetails_Extend()
{
TaskId = extModel.Id
});
ParsingSubTaskTarget(detailsList);
extModel.DetailsList = detailsList;
}
return extModel;
}
......
using Edu.Model.Entity.Customer;
using Edu.Model.ViewModel.Customer;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace Edu.Repository.Customer
{
/// <summary>
/// 客户幸福存折仓储层
/// </summary>
public class RB_Customer_BalanceDetailRepository : BaseRepository<RB_Customer_BalanceDetail>
{
/// <summary>
/// 获取客户幸福存折分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Customer_BalanceDetail_ViewModel> GetCustomerBalanceDetailPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Customer_BalanceDetail_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Customer_BalanceDetail AS A
WHERE 1=1
");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Customer_BalanceDetail_ViewModel.Group_Id), query.Group_Id);
}
if (query.CustomerId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Customer_BalanceDetail_ViewModel.CustomerId), query.CustomerId);
}
}
return GetPage<RB_Customer_BalanceDetail_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
}
}
......@@ -46,8 +46,9 @@ namespace Edu.WebApi.Controllers.Customer
{
Group_Id = base.UserInfo.Group_Id,
CustomerName = base.ParmJObj.GetStringValue("CustomerName"),
ApproveState=base.ParmJObj.GetInt("ApproveState"),
QCustomerState=base.ParmJObj.GetInt("QCustomerState"),
ContactNumber = base.ParmJObj.GetStringValue("ContactNumber"),
ApproveState = base.ParmJObj.GetInt("ApproveState"),
QCustomerState = base.ParmJObj.GetInt("QCustomerState"),
};
var list = customerModule.GetCustomerPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
......@@ -194,13 +195,13 @@ namespace Edu.WebApi.Controllers.Customer
var model = new RB_Customer_Task_Extend()
{
Id = base.ParmJObj.GetInt("Id"),
TaskName=base.ParmJObj.GetStringValue("TaskName"),
TaskSubTitle=base.ParmJObj.GetStringValue("TaskSubTitle"),
TaskKudo =base.ParmJObj.GetStringValue("TaskKudo"),
TaskStartTime =base.ParmJObj.GetDateTime("TaskStartTime"),
TaskEndTime=base.ParmJObj.GetDateTime("TaskEndTime"),
TaskDesc=base.ParmJObj.GetStringValue("TaskDesc"),
ExchangeEndTime=base.ParmJObj.GetDateTime("ExchangeEndTime"),
TaskName = base.ParmJObj.GetStringValue("TaskName"),
TaskSubTitle = base.ParmJObj.GetStringValue("TaskSubTitle"),
TaskKudo = base.ParmJObj.GetStringValue("TaskKudo"),
TaskStartTime = base.ParmJObj.GetDateTime("TaskStartTime"),
TaskEndTime = base.ParmJObj.GetDateTime("TaskEndTime"),
TaskDesc = base.ParmJObj.GetStringValue("TaskDesc"),
ExchangeEndTime = base.ParmJObj.GetDateTime("ExchangeEndTime"),
};
string taskImageList = base.ParmJObj.GetStringValue("TaskImageList");
List<string> imgList = new List<string>();
......@@ -246,8 +247,8 @@ namespace Edu.WebApi.Controllers.Customer
TaskId = jobj.GetInt("TaskId"),
TaskType = (TaskTypeEnum)jobj.GetInt("TaskType"),
TargetId = string.Join(",", targetIds),
TaskFinishType=jobj.GetInt("TaskFinishType"),
TaskFinishValue=jobj.GetDecimal("TaskFinishValue"),
TaskFinishType = jobj.GetInt("TaskFinishType"),
TaskFinishValue = jobj.GetDecimal("TaskFinishValue"),
});
}
}
......@@ -258,7 +259,7 @@ namespace Edu.WebApi.Controllers.Customer
}
if (model.DetailsList != null)
{
var groupList= model.DetailsList.GroupBy(qitem => new { qitem.TaskType })
var groupList = model.DetailsList.GroupBy(qitem => new { qitem.TaskType })
.Select(qitem => new { qitem.Key.TaskType, TaskTypeCount = qitem.Count() });
foreach (var item in groupList)
{
......@@ -268,6 +269,33 @@ namespace Edu.WebApi.Controllers.Customer
}
}
}
foreach (var item in model.DetailsList)
{
switch (item.TaskType)
{
case TaskTypeEnum.Course:
if (item.TargetIdList == null || (item.TargetIdList != null && item.TargetIdList.Count == 0))
{
return ApiResult.ParamIsNull(message: $"请选择【{item.TaskType.ToName()}】类型的任务条件!");
}
break;
case TaskTypeEnum.CourseCate:
if (item.TargetIdList == null || (item.TargetIdList != null && item.TargetIdList.Count == 0))
{
return ApiResult.ParamIsNull(message: $"请选择【{item.TaskType.ToName()}】类型的任务条件!");
}
break;
case TaskTypeEnum.CourseSuject:
if (item.TargetIdList == null || (item.TargetIdList != null && item.TargetIdList.Count == 0))
{
return ApiResult.ParamIsNull(message: $"请选择【{item.TaskType.ToName()}】类型的任务条件!");
}
break;
case TaskTypeEnum.GlobalUse:
item.TargetId = "";
break;
}
}
var flag = taskModule.SetCustomerTaskModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
......
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