Commit 74f828a6 authored by 黄奎's avatar 黄奎

页面修改

parent 57689a45
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Mall
{
/// <summary>
/// 活动参与人员配置表
/// </summary>
[Serializable]
[DB(ConnectionName = "MallConnection")]
public class RB_ActivitySurvey_Guest
{
/// <summary>
/// 主键编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 客户类型(1-小程序用户,2-学员用户)
/// </summary>
public int GuestType { get; set; }
/// <summary>
/// 对应客户类型Id
/// </summary>
public int GuestId { get; set; }
/// <summary>
/// 是否完成
/// </summary>
public int IsFinish { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime EndTime { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 集团
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// 公司
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 活动编号
/// </summary>
public int SurveyId { get; set; }
}
}
using Edu.Model.Entity.Mall;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Mall
{
/// <summary>
/// 活动参与人员配置表扩展实体
/// </summary>
public class RB_ActivitySurvey_Guest_Extend : RB_ActivitySurvey_Guest
{
/// <summary>
/// 学员名称
/// </summary>
public string GuestName { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
}
}
using Edu.Model.Entity.Mall;
using Edu.Model.ViewModel.Mall;
using Edu.Model.ViewModel.User;
using Edu.Repository.Mall;
using Edu.Repository.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB;
namespace Edu.Module.Goods
{
......@@ -16,6 +21,16 @@ namespace Edu.Module.Goods
/// </summary>
private readonly RB_ActivitySurveyRepository activitySurveyRepository = new RB_ActivitySurveyRepository();
/// <summary>
/// 活动参与人员仓储层对象
/// </summary>
private readonly RB_ActivitySurvey_GuestRepository activitySurvey_GuestRepository = new RB_ActivitySurvey_GuestRepository();
/// <summary>
/// 账号仓储层对象
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 获取问卷调查列表
/// </summary>
......@@ -26,5 +41,105 @@ namespace Edu.Module.Goods
{
return activitySurveyRepository.GetActivitySurveyListRepository(where, StuId);
}
#region 活动参与人员
/// <summary>
/// 新增修改活动参与人员
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetActivitySurveyGuestModule(RB_ActivitySurvey_Guest_Extend model)
{
bool flag = false;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_ActivitySurvey_Guest_Extend.GuestType),model.GuestType },
{nameof(RB_ActivitySurvey_Guest_Extend.GuestId),model.GuestId },
{nameof(RB_ActivitySurvey_Guest_Extend.StartTime),model.StartTime },
{nameof(RB_ActivitySurvey_Guest_Extend.EndTime),model.EndTime },
};
flag = activitySurvey_GuestRepository.Update(fileds, new WhereHelper(nameof(RB_ActivitySurvey_Guest_Extend.Id), model.Id));
}
else
{
var newId = activitySurvey_GuestRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 根据编号删除活动参与人员
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool RemoveActivitySurveyGuestModule(int Id)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_ActivitySurvey_Guest_Extend.Status),1 },
};
bool flag = activitySurvey_GuestRepository.Update(fileds, new WhereHelper(nameof(RB_ActivitySurvey_Guest_Extend.Id), Id));
return flag;
}
/// <summary>
/// 根据编号获取参与人员信息
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_ActivitySurvey_Guest_Extend GetActivitySurveyGuestModule(int Id)
{
var extModel = activitySurvey_GuestRepository.GetEntity<RB_ActivitySurvey_Guest_Extend>(Id);
return extModel;
}
/// <summary>
/// 获取活动参与人员分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_ActivitySurvey_Guest_Extend> GetActivitySurveyGuestPageModule(int pageIndex, int pageSize, out long rowsCount, RB_ActivitySurvey_Guest_Extend query)
{
var list = activitySurvey_GuestRepository.GetActivitySurveyGuestPageRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count > 0)
{
string Ids = string.Join(",", list.Where(qitem => qitem.GuestType == 2).Select(qitem => qitem.GuestId));
List<RB_Account_ViewModel> stuList = new List<RB_Account_ViewModel>();
if (!string.IsNullOrEmpty(Ids))
{
stuList=accountRepository.GetStudentExt(new RB_Account_ViewModel() {QIds=Ids });
}
foreach (var item in list)
{
item.GuestName = "";
if (item.GuestType == 2)
{
item.GuestName = stuList?.FirstOrDefault(qitem => qitem.Id == item.GuestId)?.AccountName ?? "";
}
}
}
return list;
}
/// <summary>
/// 获取活动参与人员列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_ActivitySurvey_Guest_Extend> GetActivitySurveyGuestListModule(RB_ActivitySurvey_Guest_Extend query)
{
var list = activitySurvey_GuestRepository.GetActivitySurveyGuestListRepository(query);
return list;
}
#endregion
}
}
using Edu.Model.Entity.Mall;
using Edu.Model.ViewModel.Mall;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.Mall
{
/// <summary>
/// 活动参与人员配置仓储层
/// </summary>
public class RB_ActivitySurvey_GuestRepository : BaseRepository<RB_ActivitySurvey_Guest>
{
/// <summary>
/// 获取活动参与人员分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_ActivitySurvey_Guest_Extend> GetActivitySurveyGuestPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_ActivitySurvey_Guest_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_ActivitySurvey_Guest AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_ActivitySurvey_Guest_Extend.Status), 0);
if (query != null)
{
if (query.TenantId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_ActivitySurvey_Guest_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_ActivitySurvey_Guest_Extend.MallBaseId), query.MallBaseId);
}
if (query.SurveyId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_ActivitySurvey_Guest_Extend.SurveyId), query.SurveyId);
}
}
return GetPage<RB_ActivitySurvey_Guest_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取活动参与人员列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_ActivitySurvey_Guest_Extend> GetActivitySurveyGuestListRepository(RB_ActivitySurvey_Guest_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_ActivitySurvey_Guest AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_ActivitySurvey_Guest_Extend.Status), 0);
if (query != null)
{
if (query.TenantId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_ActivitySurvey_Guest_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_ActivitySurvey_Guest_Extend.MallBaseId), query.MallBaseId);
}
if (query.SurveyId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_ActivitySurvey_Guest_Extend.SurveyId), query.SurveyId);
}
}
return Get<RB_ActivitySurvey_Guest_Extend>(builder.ToString()).ToList();
}
}
}
......@@ -246,7 +246,7 @@ namespace Edu.WebApi.Controllers.Applet
}
}
}
catch(Exception ex)
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetIndexInfo_V2_OpenBankLevel");
}
......@@ -442,6 +442,7 @@ namespace Edu.WebApi.Controllers.Applet
};
return ApiResult.Success("", result);
}
#endregion
#region 我的学习
......
using Edu.Common.API;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Mall;
using Edu.Module.Goods;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Edu.WebApi.Controllers.Goods
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class SurveyController : BaseController
{
/// <summary>
/// 问卷调查处理类对象
/// </summary>
private readonly ActivitySurveyModule activitySurveyModule = new ActivitySurveyModule();
/// <summary>
/// 获取文件调查参与学员分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetActivitySurveyGuestPage()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_ActivitySurvey_Guest_Extend()
{
SurveyId=base.ParmJObj.GetInt("SurveyId")
};
query.TenantId = Convert.ToInt32(base.UserInfo.JHTenantId);
query.MallBaseId = Convert.ToInt32(base.UserInfo.JHMallBaseId);
var list = activitySurveyModule.GetActivitySurveyGuestPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
List<object> result = new List<object>();
foreach (var item in list)
{
result.Add(new
{
item.Id,
item.GuestId,
item.GuestName,
item.GuestType,
item.CreateByName,
CreateDate = Common.ConvertHelper.FormatTime(item.CreateDate),
StartTime =Common.ConvertHelper.FormatTime(item.StartTime ),
EndTime = Common.ConvertHelper.FormatTime(item.EndTime),
});
}
pageModel.Count = rowsCount;
pageModel.PageData = result;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 添加修改意见调查表学生
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetActivitySurveyGuest()
{
var extModel = new RB_ActivitySurvey_Guest_Extend()
{
Id = base.ParmJObj.GetInt("Id"),
GuestType = base.ParmJObj.GetInt("GuestType"),
GuestId = base.ParmJObj.GetInt("GuestId"),
StartTime = base.ParmJObj.GetDateTime("StartTime"),
EndTime = base.ParmJObj.GetDateTime("EndTime"),
SurveyId = base.ParmJObj.GetInt("SurveyId"),
};
extModel.Status = 0;
extModel.CreateBy = base.UserInfo.Id;
extModel.CreateDate = DateTime.Now;
extModel.TenantId = Convert.ToInt32(base.UserInfo.JHTenantId);
extModel.MallBaseId = Convert.ToInt32(base.UserInfo.JHMallBaseId);
bool flag = activitySurveyModule.SetActivitySurveyGuestModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 根据编号获取意见调查表学员详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetActivitySurveyGuestModule()
{
var Id = base.ParmJObj.GetInt("Id");
var extModel = activitySurveyModule.GetActivitySurveyGuestModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 根据编号删除意见调查表学员详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult RemoveActivitySurveyGuest()
{
var Id = base.ParmJObj.GetInt("Id");
bool flag = activitySurveyModule.RemoveActivitySurveyGuestModule(Id);
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