Commit 0afbebc7 authored by 黄奎's avatar 黄奎

新增公司统计相关实体类

parent c1c640fe
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.User
{
/// <summary>
/// 全公司客户数据统计实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Student_Company
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 日期
/// </summary>
public DateTime Date { get; set; }
/// <summary>
/// 推送人数
/// </summary>
public decimal PushCount { get; set; }
/// <summary>
/// 新客户
/// </summary>
public decimal NewCount { get; set; }
/// <summary>
/// 初步沟通/二次沟通
/// </summary>
public decimal CommunicationCount { get; set; }
/// <summary>
/// 预约试听(已到店,已试听)
/// </summary>
public decimal TrialLessonCount { get; set; }
/// <summary>
/// 待联系
/// </summary>
public decimal NotContacted { get; set; }
/// <summary>
/// 日本语培
/// </summary>
public decimal JPCount { get; set; }
/// <summary>
/// 韩国语培
/// </summary>
public decimal KRCount { get; set; }
/// <summary>
/// 法国语培
/// </summary>
public decimal FRCount { get; set; }
/// <summary>
/// 日本留学
/// </summary>
public decimal JPStudyCount { get; set; }
/// <summary>
/// 韩国留学
/// </summary>
public decimal KRStudyCount { get; set; }
/// <summary>
/// 英港澳留学
/// </summary>
public decimal YGAStudyCount { get; set; }
/// <summary>
/// 美国留学
/// </summary>
public decimal USStudyCount { get; set; }
/// <summary>
/// 新加坡留学
/// </summary>
public decimal SGStudyCount { get; set; }
/// <summary>
/// 澳新留学
/// </summary>
public decimal AXStudyCount { get; set; }
/// <summary>
/// 其他
/// </summary>
public decimal OtherCount { get; set; }
/// <summary>
/// A类客户
/// </summary>
public decimal ClassACount { get; set; }
/// <summary>
/// B类客户
/// </summary>
public decimal ClassBCount { get; set; }
/// <summary>
/// C类客户
/// </summary>
public decimal ClassCCount { get; set; }
/// <summary>
/// D类客户
/// </summary>
public decimal ClassDCount { get; set; }
/// <summary>
/// 同行介绍
/// </summary>
public decimal CustomerCount { get; set; }
/// <summary>
/// 直客
/// </summary>
public decimal B2CCount { get; set; }
/// <summary>
/// 学员转介绍
/// </summary>
public decimal TransCount { get; set; }
/// <summary>
/// 内部介绍
/// </summary>
public decimal InnerCount { get; set; }
/// <summary>
/// 无效
/// </summary>
public decimal InvalidCount { get; set; }
/// <summary>
/// 疑似
/// </summary>
public decimal SuspectedCount { get; set; }
/// <summary>
/// 意向
/// </summary>
public decimal IntentionCount { get; set; }
/// <summary>
/// 近期可邀约
/// </summary>
public decimal InvitationCount { get; set; }
/// <summary>
/// 谈判
/// </summary>
public decimal NegotiationCount { get; set; }
/// <summary>
/// 签约(成交、续费)
/// </summary>
public decimal ContractCount { get; set; }
/// <summary>
/// 语培签约金额
/// </summary>
public decimal OrderMoney { get; set; }
/// <summary>
/// 留学签约金额
/// </summary>
public decimal StudyOrderMoney { get; set; }
/// <summary>
/// 年
/// </summary>
public int YearStr { get; set; }
/// <summary>
/// 月
/// </summary>
public int MonthStr { get; set; }
/// <summary>
/// 次(0-上旬,1-中旬,2-下旬)
/// </summary>
public int Times { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}
using Edu.Model.Entity.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.User
{
/// <summary>
/// 全公司客户数据统计扩展实体类
/// </summary>
public class RB_Student_Company_Extend : RB_Student_Company
{
/// <summary>
/// 月份
/// </summary>
public string ShowMonthStr { get; set; }
/// <summary>
/// 日期字符串
/// </summary>
public string DateStr
{
get
{
return Common.ConvertHelper.FormatDate2(this.Date);
}
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
using Edu.Model.Entity.User;
using Edu.Model.ViewModel.User;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.User
{
/// <summary>
/// 全公司客户数据统计仓储层
/// </summary>
public class RB_Student_CompanyRepository : BaseRepository<RB_Student_Company>
{
/// <summary>
/// 全公司客户数据统计
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Student_Company_Extend> GetStudentCompanyListRepository(RB_Student_Company_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Student_Company AS A
WHERE 1=1
");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Company_Extend.Group_Id), query.Group_Id);
}
if (query.YearStr > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Company_Extend.YearStr), query.YearStr);
}
if (query.MonthStr > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Company_Extend.MonthStr), query.MonthStr);
}
if (query.Times > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Company_Extend.Times), query.Times);
}
}
builder.AppendFormat(" ORDER BY A.{0} ASC ", nameof(RB_Student_Company_Extend.Id));
return Get<RB_Student_Company_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 全公司客户数据月份统计
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Student_Company_Extend> GetStudentCompanyMonthListRepository(RB_Student_Company_Extend query,bool isYear=false)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT CONCAT(DATE_FORMAT(A.Date, '%Y-%m'),'-01') AS Date,A.YearStr,A.MonthStr,SUM(A.PushCount) AS PushCount,SUM(A.NewCount) AS NewCount,SUM(A.CommunicationCount) AS CommunicationCount
,SUM(A.TrialLessonCount) AS TrialLessonCount,SUM(A.NotContacted) AS NotContacted,SUM(A.JPCount) AS JPCount,SUM(A.KRCount) AS KRCount,SUM(A.FRCount) AS FRCount
,SUM(A.JPStudyCount) AS JPStudyCount,SUM(A.KRStudyCount) AS KRStudyCount,SUM(A.YGAStudyCount) AS YGAStudyCount,SUM(A.USStudyCount) AS USStudyCount
,SUM(A.SGStudyCount) AS SGStudyCount,SUM(A.AXStudyCount) AS AXStudyCount,SUM(A.OtherCount) AS OtherCount,SUM(A.ClassACount) AS ClassACount,SUM(A.ClassBCount) AS ClassBCount
,SUM(A.ClassCCount) AS ClassCCount,SUM(A.ClassDCount) AS ClassDCount,SUM(A.CustomerCount) AS CustomerCount,SUM(A.B2CCount) AS B2CCount,SUM(A.TransCount) AS TransCount
,SUM(A.InnerCount) AS InnerCount,SUM(A.InvalidCount) AS InvalidCount,SUM(A.SuspectedCount) AS SuspectedCount,SUM(A.IntentionCount) AS IntentionCount
,SUM(A.InvitationCount) AS InvitationCount,SUM(A.NegotiationCount) AS NegotiationCount,SUM(A.ContractCount) AS ContractCount,SUM(A.OrderMoney) AS OrderMoney
,SUM(A.StudyOrderMoney) AS StudyOrderMoney
FROM RB_Student_Company AS A
WHERE 1=1 AND A.Date<>'0001-01-01 00:00:00'
");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Company_Extend.Group_Id), query.Group_Id);
}
if (query.YearStr > 0)
{
if (isYear)
{
builder.AppendFormat(" AND A.{0}<={1} ", nameof(RB_Student_Company_Extend.YearStr), query.YearStr);
}
else
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Company_Extend.YearStr), query.YearStr);
}
}
}
builder.AppendFormat(" GROUP BY DATE_FORMAT(A.Date, '%Y-%m') ");
builder.AppendFormat(" ORDER BY DATE_FORMAT(A.Date, '%Y-%m') ASC ");
return Get<RB_Student_Company_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 全公司客户数据年份统计
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Student_Company_Extend> GetStudentCompanyYearListRepository(RB_Student_Company_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT CONCAT(A.YearStr,'-01','-01') AS Date,A.YearStr,SUM(A.PushCount) AS PushCount,SUM(A.NewCount) AS NewCount,SUM(A.CommunicationCount) AS CommunicationCount
,SUM(A.TrialLessonCount) AS TrialLessonCount,SUM(A.NotContacted) AS NotContacted,SUM(A.JPCount) AS JPCount,SUM(A.KRCount) AS KRCount,SUM(A.FRCount) AS FRCount
,SUM(A.JPStudyCount) AS JPStudyCount,SUM(A.KRStudyCount) AS KRStudyCount,SUM(A.YGAStudyCount) AS YGAStudyCount,SUM(A.USStudyCount) AS USStudyCount
,SUM(A.SGStudyCount) AS SGStudyCount,SUM(A.AXStudyCount) AS AXStudyCount,SUM(A.OtherCount) AS OtherCount,SUM(A.ClassACount) AS ClassACount,SUM(A.ClassBCount) AS ClassBCount
,SUM(A.ClassCCount) AS ClassCCount,SUM(A.ClassDCount) AS ClassDCount,SUM(A.CustomerCount) AS CustomerCount,SUM(A.B2CCount) AS B2CCount,SUM(A.TransCount) AS TransCount
,SUM(A.InnerCount) AS InnerCount,SUM(A.InvalidCount) AS InvalidCount,SUM(A.SuspectedCount) AS SuspectedCount,SUM(A.IntentionCount) AS IntentionCount
,SUM(A.InvitationCount) AS InvitationCount,SUM(A.NegotiationCount) AS NegotiationCount,SUM(A.ContractCount) AS ContractCount,SUM(A.OrderMoney) AS OrderMoney
,SUM(A.StudyOrderMoney) AS StudyOrderMoney
FROM RB_Student_Company AS A
WHERE 1=1 AND A.Date<>'0001-01-01 00:00:00'
");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Company_Extend.Group_Id), query.Group_Id);
}
if (query.YearStr > 0)
{
builder.AppendFormat(" AND A.{0}<={1} ", nameof(RB_Student_Company_Extend.YearStr), query.YearStr);
}
}
builder.AppendFormat(" GROUP BY A.YearStr ");
builder.AppendFormat(" ORDER BY A.YearStr ASC ");
return Get<RB_Student_Company_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 根据存储过程统计全公司客户信息
/// </summary>
/// <param name="DateStr"></param>
/// <returns></returns>
public RB_Student_Company_Extend GetStudentCompanyByProcRepository(string DateStr,string empIds)
{
string sql = string.Format("call proc_student_company('{0}') ", DateStr);
var list = Get<RB_Student_Company_Extend>(sql);
return list?.FirstOrDefault();
}
/// <summary>
/// 清楚全公司客户统计数据
/// </summary>
public void DeleteStudentCompanyByProcRepository()
{
string sql = "TRUNCATE TABLE RB_Student_Company";
base.Execute(sql);
}
}
}
...@@ -98,10 +98,10 @@ namespace Edu.WebApi.Controllers.Course ...@@ -98,10 +98,10 @@ namespace Edu.WebApi.Controllers.Course
{ {
var extModel = new RB_Question_Bank_ViewModel() var extModel = new RB_Question_Bank_ViewModel()
{ {
BankId=base.ParmJObj.GetInt("BankId"), BankId = base.ParmJObj.GetInt("BankId"),
BankNo=base.ParmJObj.GetStringValue("BankNo"), BankNo = base.ParmJObj.GetStringValue("BankNo"),
BankName=base.ParmJObj.GetStringValue("BankName"), BankName = base.ParmJObj.GetStringValue("BankName"),
BankType=(LevelTypeEnum)base.ParmJObj.GetInt("BankType"), BankType = (LevelTypeEnum)base.ParmJObj.GetInt("BankType"),
}; };
extModel.CreateTime = DateTime.Now; extModel.CreateTime = DateTime.Now;
extModel.CreateBy = base.UserInfo.Id; extModel.CreateBy = base.UserInfo.Id;
...@@ -122,7 +122,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -122,7 +122,7 @@ namespace Edu.WebApi.Controllers.Course
public ApiResult GetBankTypeList() public ApiResult GetBankTypeList()
{ {
var list = Common.Plugin.EnumHelper.EnumToList(typeof(LevelTypeEnum)); var list = Common.Plugin.EnumHelper.EnumToList(typeof(LevelTypeEnum));
return ApiResult.Success(data:list); return ApiResult.Success(data: list);
} }
/// <summary> /// <summary>
...@@ -234,7 +234,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -234,7 +234,7 @@ namespace Edu.WebApi.Controllers.Course
item.QuestionId, item.QuestionId,
item.CourseId, item.CourseId,
Title = newTitle, Title = newTitle,
SourceTitle=item.Title, SourceTitle = item.Title,
item.QuestionTypeId, item.QuestionTypeId,
item.QuestionTypeKey, item.QuestionTypeKey,
QuestionTypeName = item.QuestionTypeKey != "single-number" ? item.QuestionTypeName : "选择题", QuestionTypeName = item.QuestionTypeKey != "single-number" ? item.QuestionTypeName : "选择题",
...@@ -386,7 +386,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -386,7 +386,7 @@ namespace Edu.WebApi.Controllers.Course
{ {
return ApiResult.Failed(message: "请填写问题题干!"); return ApiResult.Failed(message: "请填写问题题干!");
} }
string str = analysisQuestion.CheckQuestion(extModel.QuestionTypeKey, extModel.QuestionContent,extModel.Answer,out string newAnswer); string str = analysisQuestion.CheckQuestion(extModel.QuestionTypeKey, extModel.QuestionContent, extModel.Answer, out string newAnswer);
if (!string.IsNullOrEmpty(str)) if (!string.IsNullOrEmpty(str))
{ {
return ApiResult.Failed(message: str); return ApiResult.Failed(message: str);
...@@ -410,7 +410,8 @@ namespace Edu.WebApi.Controllers.Course ...@@ -410,7 +410,8 @@ namespace Edu.WebApi.Controllers.Course
[HttpPost] [HttpPost]
public ApiResult RunQuestion() public ApiResult RunQuestion()
{ {
Task.Run(() => { Task.Run(() =>
{
var list = questionModule.GetQuestionListModule(new RB_Question_ViewModel() { Q_QuestionTypeIds = "16", }); var list = questionModule.GetQuestionListModule(new RB_Question_ViewModel() { Q_QuestionTypeIds = "16", });
if (list != null && list.Count > 0) if (list != null && list.Count > 0)
{ {
......
...@@ -232,6 +232,7 @@ namespace Edu.WebApi.Timers ...@@ -232,6 +232,7 @@ namespace Edu.WebApi.Timers
UserInfo user = UserReidsCache.GetUserLoginInfo("1"); UserInfo user = UserReidsCache.GetUserLoginInfo("1");
studentStatModule.CreateStudentStaticModule(user, Common.ConvertHelper.FormatDate(today.AddDays(-1)), currentDate, isInit: false); studentStatModule.CreateStudentStaticModule(user, Common.ConvertHelper.FormatDate(today.AddDays(-1)), currentDate, isInit: false);
studentStatModule.CreateStudentMarketModule(user, Common.ConvertHelper.FormatDate(today.AddDays(-1)), currentDate, isInit: false); studentStatModule.CreateStudentMarketModule(user, Common.ConvertHelper.FormatDate(today.AddDays(-1)), currentDate, isInit: false);
studentStatModule.CreateStudentCompanyModule(user, Common.ConvertHelper.FormatDate(today.AddDays(-1)), currentDate, isInit: false);
redis.Set(createMarkDataKey, currentDate); redis.Set(createMarkDataKey, currentDate);
} }
Interlocked.Exchange(ref marketconsultant_Timer, 0); Interlocked.Exchange(ref marketconsultant_Timer, 0);
......
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