Commit 238a463d authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents ac946d9e 6745d148
...@@ -105,6 +105,10 @@ namespace Edu.Cache.User ...@@ -105,6 +105,10 @@ namespace Edu.Cache.User
/// 账号仓储层对象 /// 账号仓储层对象
/// </summary> /// </summary>
private static readonly RB_AccountRepository accountRepository = new RB_AccountRepository(); private static readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 部门仓储层对象
/// </summary>
private static readonly RB_DepartmentRepository departmentRepository = new RB_DepartmentRepository();
/// <summary> /// <summary>
/// 获取用户登录信息 /// 获取用户登录信息
...@@ -138,12 +142,18 @@ namespace Edu.Cache.User ...@@ -138,12 +142,18 @@ namespace Edu.Cache.User
})?.FirstOrDefault(); })?.FirstOrDefault();
if (model != null) if (model != null)
{ {
var deptList = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel()
{
DeptId = model.Dept_Id,
Group_Id = model.Group_Id,
ManagerIds = model.Id.ToString()
});
userInfo = new UserInfo userInfo = new UserInfo
{ {
Id = model.Id, Id = model.Id,
Group_Id = model.Group_Id, Group_Id = model.Group_Id,
School_Id = model.School_Id, School_Id = model.School_Id,
AccountType=model.AccountType, AccountType = model.AccountType,
AccountName = model.AccountName, AccountName = model.AccountName,
GroupName = model.GroupName, GroupName = model.GroupName,
SchoolName = model.SchoolName, SchoolName = model.SchoolName,
...@@ -165,6 +175,7 @@ namespace Edu.Cache.User ...@@ -165,6 +175,7 @@ namespace Edu.Cache.User
IsTenCccUser = model.IsTenCccUser, IsTenCccUser = model.IsTenCccUser,
IsCourseConsultant = (model != null && model.UserRole == UserRoleEnum.CourseConsultant) ? 1 : 0, IsCourseConsultant = (model != null && model.UserRole == UserRoleEnum.CourseConsultant) ? 1 : 0,
IsMarket = (model != null && model.UserRole == UserRoleEnum.MarketPersion) ? 1 : 0, IsMarket = (model != null && model.UserRole == UserRoleEnum.MarketPersion) ? 1 : 0,
IsManager = (deptList?.Count ?? 0) > 0 ? 1 : 0,
}; };
UserInfoSet(Cache.CacheKey.User_Login_Key + Id.ToString(), userInfo, Common.Config.JwtExpirTime); UserInfoSet(Cache.CacheKey.User_Login_Key + Id.ToString(), userInfo, Common.Config.JwtExpirTime);
} }
......
...@@ -177,6 +177,11 @@ namespace Edu.Model.CacheModel ...@@ -177,6 +177,11 @@ namespace Edu.Model.CacheModel
/// 是否是市场(1-是) /// 是否是市场(1-是)
/// </summary> /// </summary>
public int IsMarket { get; set; } public int IsMarket { get; set; }
/// <summary>
/// 部门负责人(1-是)
/// </summary>
public int IsManager { get; set; }
} }
/// <summary> /// <summary>
......
...@@ -209,5 +209,30 @@ namespace Edu.Model.Entity.DataStatistics ...@@ -209,5 +209,30 @@ namespace Edu.Model.Entity.DataStatistics
/// 所属部门编号 /// 所属部门编号
/// </summary> /// </summary>
public int DeptId { get; set; } public int DeptId { get; set; }
/// <summary>
/// 当月完成订单累计金额
/// </summary>
public decimal CurMonthOrderSale { get; set; }
/// <summary>
/// 当月效能目标金额
/// </summary>
public decimal CurMonthOrderGoal { get; set; }
/// <summary>
/// 当月新签累计 [订单数量累计】
/// </summary>
public int CurMonthOrderNum { get; set; }
/// <summary>
/// 上月新签累计 [订单数量累计】
/// </summary>
public int LastMonthOrderNum { get; set; }
/// <summary>
/// 上月累计金额
/// </summary>
public decimal LastMonthOrderSale { get; set; }
} }
} }
using Edu.Common.Enum;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.DataStatistics
{
/// <summary>
/// 课程顾问部月目标实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Consultant_Goal
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 年份
/// </summary>
public int YearStr { get; set; }
/// <summary>
/// 月份
/// </summary>
public int MonthStr { get; set; }
/// <summary>
/// 目标金额
/// </summary>
public decimal GoalMoney { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 校区编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 部门编号
/// </summary>
public int Dept_Id { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
}
}
...@@ -39,5 +39,15 @@ namespace Edu.Model.ViewModel.Customer ...@@ -39,5 +39,15 @@ namespace Edu.Model.ViewModel.Customer
/// 有效数据量 (第一次跟进且不等于流失) /// 有效数据量 (第一次跟进且不等于流失)
/// </summary> /// </summary>
public int FollowCount { get; set; } public int FollowCount { get; set; }
/// <summary>
/// 单资源回访平均数
/// </summary>
public decimal FollowEffectiveCount { get; set; }
/// <summary>
/// 单资源回访平均数~~~就是一条资源跟进了几次 【平均】
/// </summary>
public decimal AgFollow { get; set; }
} }
} }
...@@ -76,6 +76,11 @@ namespace Edu.Model.ViewModel.Customer ...@@ -76,6 +76,11 @@ namespace Edu.Model.ViewModel.Customer
/// </summary> /// </summary>
public int VisitCount { get; set; } public int VisitCount { get; set; }
/// <summary>
/// 订单数量
/// </summary>
public int OrderCount { get; set; }
/// <summary> /// <summary>
/// 创建人【查询使用】 /// 创建人【查询使用】
/// </summary> /// </summary>
......
using Edu.Model.Entity.DataStatistics;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.DataStatistics
{
/// <summary>
/// 课程顾问部月目标扩展实体类
/// </summary>
public class RB_Consultant_Goal_Extend : RB_Consultant_Goal
{
/// <summary>
/// 部门名称
/// </summary>
public string DeptName { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 创建时间字符串
/// </summary>
public string CreateTimeStr { get { return Common.ConvertHelper.FormatTime(this.CreateTime); } }
}
}
...@@ -309,5 +309,10 @@ namespace Edu.Model.ViewModel.Sell ...@@ -309,5 +309,10 @@ namespace Edu.Model.ViewModel.Sell
/// 业务员 /// 业务员
/// </summary> /// </summary>
public string QEnterIds { get; set; } public string QEnterIds { get; set; }
/// <summary>
/// 订单条数
/// </summary>
public int OrderCount { get; set; }
} }
} }
\ No newline at end of file
...@@ -569,28 +569,31 @@ namespace Edu.Module.Duty ...@@ -569,28 +569,31 @@ namespace Edu.Module.Duty
}; };
var flag = reserve_ClassRepository.Update(fileds, new WhereHelper(nameof(RB_Reserve_Class_Extend.ReserveClassId), ReserveClassId)); var flag = reserve_ClassRepository.Update(fileds, new WhereHelper(nameof(RB_Reserve_Class_Extend.ReserveClassId), ReserveClassId));
var model = GetReserveClassModule(ReserveClassId); var model = GetReserveClassModule(ReserveClassId);
var teacherModel = accountRepository.GetAccountListRepository(new Model.ViewModel.User.RB_Account_ViewModel() if (model != null)
{ {
Group_Id = model.Group_Id, var teacherModel = accountRepository.GetAccountListRepository(new RB_Account_ViewModel()
AccountId = model.TeacherId, {
AccountType= Common.Enum.User.AccountTypeEnum.Teacher Group_Id = model.Group_Id,
})?.FirstOrDefault(); AccountId = model.TeacherId,
Common.Message.PushMessageModel pushModel = new Common.Message.PushMessageModel() AccountType = Common.Enum.User.AccountTypeEnum.Teacher
{ })?.FirstOrDefault();
CategoryId = PushMessageCategoryEnum.ReserveClass, Common.Message.PushMessageModel pushModel = new Common.Message.PushMessageModel()
Content = "您有试听课信息被取消!请查收", {
CoverImg = "", CategoryId = PushMessageCategoryEnum.ReserveClass,
CreateByName = UserInfo.AccountName, Content = "您有试听课信息被取消!请查收",
JumpUrl = $"/course/classPlan?ClassType=2", CoverImg = "",
SendTime = DateTime.Now, CreateByName = UserInfo.AccountName,
SendType = 0, JumpUrl = $"/course/classPlan?ClassType=2",
Title = "试听课", SendTime = DateTime.Now,
Platform = 2, SendType = 0,
ReceiveId = (teacherModel?.Id??0).ToString(), Title = "试听课",
}; Platform = 2,
if (flag) ReceiveId = (teacherModel?.Id ?? 0).ToString(),
{ };
Common.Message.MessageHelper.SendMessage(pushModel); if (flag)
{
Common.Message.MessageHelper.SendMessage(pushModel);
}
} }
return flag; return flag;
} }
......
...@@ -170,7 +170,216 @@ SELECT A.CreateBy,COUNT(1) AS FollowCount ...@@ -170,7 +170,216 @@ SELECT A.CreateBy,COUNT(1) AS FollowCount
FROM rb_student_follow AS A INNER JOIN(SELECT StuId,CreateBy,MIN(Id) AS Id FROM rb_student_follow WHERE `Status`=0 GROUP BY StuId,CreateBy) AS B ON A.Id=B.Id FROM rb_student_follow AS A INNER JOIN(SELECT StuId,CreateBy,MIN(Id) AS Id FROM rb_student_follow WHERE `Status`=0 GROUP BY StuId,CreateBy) AS B ON A.Id=B.Id
INNER JOIN RB_student AS C ON A.StuId=C.StuId INNER JOIN RB_student AS C ON A.StuId=C.StuId
WHERE A.Status=0 AND C.Status=0 AND C.StuStage<>7 {0} WHERE A.Status=0 AND C.Status=0 AND C.StuStage<>7 {0}
GROUP BY A.CreateBy
";
if (query.CreateBy > 0)
{
sql += string.Format(" AND A.CreateBy={0} ", query.CreateBy);
}
sql += " GROUP BY A.CreateBy ";
string todayWhere = "";
if (!string.IsNullOrEmpty(query.STime))
{
todayWhere += string.Format(" AND to_days(A.CreateTime)=to_days('{0}') ", query.STime);
}
else
{
todayWhere += string.Format(" AND to_days(A.CreateTime)=to_days(now()) ");
}
//今日
var todayList = Get<RB_Student_Follow_Extend>(string.Format(sql.ToString(), todayWhere)).ToList();
dicList.Add("today", todayList);
//昨日
string yesWhere = "";
if (!string.IsNullOrEmpty(query.STime))
{
yesWhere += string.Format(" AND TO_DAYS('{0}')-TO_DAYS(A.CreateTime)=1 ", query.STime);
}
else
{
yesWhere += string.Format(" AND TO_DAYS(now())-TO_DAYS(A.CreateTime)=1 ");
}
var yesList = Get<RB_Student_Follow_Extend>(string.Format(sql, yesWhere)).ToList();
dicList.Add("yestoday", yesList);
//本周
string curWeek = "";
if (!string.IsNullOrEmpty(query.STime))
{
curWeek += string.Format(" AND YEARWEEK(date_format(A.CreateTime,'%Y-%m-%d' )) = YEARWEEK('{0}') ", query.STime);
}
else
{
curWeek += string.Format(" AND YEARWEEK(date_format(A.CreateTime,'%Y-%m-%d')) = YEARWEEK(now()) ");
}
var curWeekList = Get<RB_Student_Follow_Extend>(string.Format(sql, curWeek)).ToList();
dicList.Add("currentWeek", curWeekList);
//上周
string lastWeek = "";
if (!string.IsNullOrEmpty(query.STime))
{
lastWeek += string.Format(" AND YEARWEEK(date_format(A.CreateTime,'%Y-%m-%d')) = YEARWEEK('{0}')-1 ", query.STime);
}
else
{
lastWeek += string.Format(" AND YEARWEEK(date_format(A.CreateTime,'%Y-%m-%d')) = YEARWEEK(now())-1 ");
}
var lastWeekList = Get<RB_Student_Follow_Extend>(string.Format(sql, lastWeek)).ToList();
dicList.Add("lastWeek", lastWeekList);
//本月
string curMonth = "";
if (!string.IsNullOrEmpty(query.STime))
{
curMonth += string.Format(" AND DATE_FORMAT(A.CreateTime,'%Y%m')=DATE_FORMAT('{0}','%Y%m') ", query.STime);
}
else
{
curMonth += string.Format(" AND DATE_FORMAT(A.CreateTime,'%Y%m')=DATE_FORMAT(CURDATE(),'%Y%m') ");
}
var curMonthList = Get<RB_Student_Follow_Extend>(string.Format(sql, curMonth)).ToList();
dicList.Add("curMonth", curMonthList);
//上月
string lastMonth = "";
if (!string.IsNullOrEmpty(query.STime))
{
lastMonth += string.Format(" AND PERIOD_DIFF(date_format('{0}','%Y%m'),date_format(A.CreateTime,'%Y%m')) =1 ", query.STime);
}
else
{
lastMonth += string.Format(" AND PERIOD_DIFF(date_format(now(),'%Y%m'),date_format(A.CreateTime,'%Y%m')) =1 ");
}
var lastMonthList = Get<RB_Student_Follow_Extend>(string.Format(sql, lastMonth)).ToList();
dicList.Add("lastMonth", lastMonthList);
return dicList;
}
/// <summary>
/// 课程顾问部有效回访总量
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public Dictionary<string, List<RB_Student_Follow_Extend>> GetConsultantFollowStaticRepository(RB_Student_Follow_Extend query)
{
Dictionary<string, List<RB_Student_Follow_Extend>> dicList = new Dictionary<string, List<RB_Student_Follow_Extend>>();
string sql = @"
SELECT A.CreateBy,COUNT(1) AS FollowCount
FROM rb_student_follow AS A
WHERE A.Status=0 {0}
";
if (query.CreateBy > 0)
{
sql += string.Format(" AND A.CreateBy={0} ", query.CreateBy);
}
sql += " GROUP BY A.CreateBy ";
string todayWhere = "";
if (!string.IsNullOrEmpty(query.STime))
{
todayWhere += string.Format(" AND to_days(A.CreateTime)=to_days('{0}') ", query.STime);
}
else
{
todayWhere += string.Format(" AND to_days(A.CreateTime)=to_days(now()) ");
}
//今日
var todayList = Get<RB_Student_Follow_Extend>(string.Format(sql.ToString(), todayWhere)).ToList();
dicList.Add("today", todayList);
//昨日
string yesWhere = "";
if (!string.IsNullOrEmpty(query.STime))
{
yesWhere += string.Format(" AND TO_DAYS('{0}')-TO_DAYS(A.CreateTime)=1 ", query.STime);
}
else
{
yesWhere += string.Format(" AND TO_DAYS(now())-TO_DAYS(A.CreateTime)=1 ");
}
var yesList = Get<RB_Student_Follow_Extend>(string.Format(sql, yesWhere)).ToList();
dicList.Add("yestoday", yesList);
//本周
string curWeek = "";
if (!string.IsNullOrEmpty(query.STime))
{
curWeek += string.Format(" AND YEARWEEK(date_format(A.CreateTime,'%Y-%m-%d' )) = YEARWEEK('{0}') ", query.STime);
}
else
{
curWeek += string.Format(" AND YEARWEEK(date_format(A.CreateTime,'%Y-%m-%d')) = YEARWEEK(now()) ");
}
var curWeekList = Get<RB_Student_Follow_Extend>(string.Format(sql, curWeek)).ToList();
dicList.Add("currentWeek", curWeekList);
//上周
string lastWeek = "";
if (!string.IsNullOrEmpty(query.STime))
{
lastWeek += string.Format(" AND YEARWEEK(date_format(A.CreateTime,'%Y-%m-%d')) = YEARWEEK('{0}')-1 ", query.STime);
}
else
{
lastWeek += string.Format(" AND YEARWEEK(date_format(A.CreateTime,'%Y-%m-%d')) = YEARWEEK(now())-1 ");
}
var lastWeekList = Get<RB_Student_Follow_Extend>(string.Format(sql, lastWeek)).ToList();
dicList.Add("lastWeek", lastWeekList);
//本月
string curMonth = "";
if (!string.IsNullOrEmpty(query.STime))
{
curMonth += string.Format(" AND DATE_FORMAT(A.CreateTime,'%Y%m')=DATE_FORMAT('{0}','%Y%m') ", query.STime);
}
else
{
curMonth += string.Format(" AND DATE_FORMAT(A.CreateTime,'%Y%m')=DATE_FORMAT(CURDATE(),'%Y%m') ");
}
var curMonthList = Get<RB_Student_Follow_Extend>(string.Format(sql, curMonth)).ToList();
dicList.Add("curMonth", curMonthList);
//上月
string lastMonth = "";
if (!string.IsNullOrEmpty(query.STime))
{
lastMonth += string.Format(" AND PERIOD_DIFF(date_format('{0}','%Y%m'),date_format(A.CreateTime,'%Y%m')) =1 ", query.STime);
}
else
{
lastMonth += string.Format(" AND PERIOD_DIFF(date_format(now(),'%Y%m'),date_format(A.CreateTime,'%Y%m')) =1 ");
}
var lastMonthList = Get<RB_Student_Follow_Extend>(string.Format(sql, lastMonth)).ToList();
dicList.Add("lastMonth", lastMonthList);
return dicList;
}
/// <summary>
/// 单资源回访平均数~~~就是一条资源跟进了几次 【平均】
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public Dictionary<string, List<RB_Student_Follow_Extend>> GetConsultantAvgFollowStaticRepository(RB_Student_Follow_Extend query)
{
Dictionary<string, List<RB_Student_Follow_Extend>> dicList = new Dictionary<string, List<RB_Student_Follow_Extend>>();
string whereStr = "";
if (query.CreateBy > 0)
{
whereStr += string.Format(" AND CreateBy={0} ", query.CreateBy);
}
string sql = @"
SELECT Avg(FollowCount) AS FollowEffectiveCount FROM
(
SELECT A.StuId,COUNT(1) AS FollowCount
FROM rb_student_follow AS A
WHERE A.Status=0 " + whereStr + @" {0}
GROUP BY A.StuId
) AS A
"; ";
string todayWhere = ""; string todayWhere = "";
......
...@@ -143,11 +143,21 @@ WHERE 1=1 ...@@ -143,11 +143,21 @@ WHERE 1=1
{ {
Dictionary<string, List<RB_Student_Visit_Extend>> dicList = new Dictionary<string, List<RB_Student_Visit_Extend>>(); Dictionary<string, List<RB_Student_Visit_Extend>> dicList = new Dictionary<string, List<RB_Student_Visit_Extend>>();
string sql = @" string sql = @"
SELECT A.CreateBy,Count(1) AS VisitCount SELECT A.CreateBy,Count(1) AS VisitCount,IFNULL(C.OrderCount,0) AS OrderCount
FROM RB_Student_Visit AS A INNER JOIN rb_student AS B ON A.StuId=B.StuId FROM RB_Student_Visit AS A INNER JOIN rb_student AS B ON A.StuId=B.StuId
LEFT JOIN (
SELECT sog.Student_Id,COUNT(1) AS OrderCount
FROM rb_student_orderguest AS sog INNER JOIN rb_order AS o ON sog.OrderId=o.OrderId
WHERE o.OrderState IN(1,2)
GROUP BY sog.Student_Id
) AS C ON A.StuId=C.Student_Id
WHERE 1=1 AND B.Status=0 {0} WHERE 1=1 AND B.Status=0 {0}
GROUP BY A.CreateBy
"; ";
if (query.CreateBy > 0)
{
sql += string.Format(" AND A.CreateBy={0} ", query.CreateBy);
}
sql += " GROUP BY A.CreateBy ";
string todayWhere = ""; string todayWhere = "";
if (!string.IsNullOrEmpty(query.StartDate)) if (!string.IsNullOrEmpty(query.StartDate))
{ {
......
...@@ -65,26 +65,52 @@ WHERE 1=1 ...@@ -65,26 +65,52 @@ WHERE 1=1
var newModel = new RB_Consultant_Data_Extend() var newModel = new RB_Consultant_Data_Extend()
{ {
Date = model.Date, Date = model.Date,
//ClueCount = model.ClueCount,
//YestodayClue = model.YestodayClue,
//LastWeekClue = model.LastWeekClue,
//LastMonthClue = model.LastMonthClue,
VisitCount = model.VisitCount,
YestodayVisit = model.YestodayVisit,
LastWeekVisit = model.LastWeekVisit,
LastMonthVisit = model.LastMonthVisit,
TrialLessonCount = model.TrialLessonCount, TrialLessonCount = model.TrialLessonCount,
YestodayTrialLesson = model.YestodayTrialLesson, YestodayTrialLesson = model.YestodayTrialLesson,
CurWeekTrialLesson = model.CurWeekTrialLesson,
LastWeekTrialLesson = model.LastWeekTrialLesson, LastWeekTrialLesson = model.LastWeekTrialLesson,
CurMonthTrialLesson = model.CurMonthTrialLesson,
LastMonthTrialLesson = model.LastMonthTrialLesson, LastMonthTrialLesson = model.LastMonthTrialLesson,
VisitCount = model.VisitCount,
YestodayVisit = model.YestodayVisit,
CurWeekVisit = model.CurWeekVisit,
LastWeekVisit = model.LastWeekVisit,
CurMonthVisit = model.CurMonthVisit,
LastMonthVisit = model.LastMonthVisit,
Rates = model.Rates,
YestodayRates = model.YestodayRates,
CurWeekRates = model.CurWeekRates,
LastWeekRates = model.LastWeekRates,
CurMonthRates = model.CurMonthRates,
LastMonthRates = model.LastMonthRates,
FollowCount = model.FollowCount, FollowCount = model.FollowCount,
YestodayFollow = model.YestodayFollow, YestodayFollow = model.YestodayFollow,
CurWeekFollow = model.CurWeekFollow,
LastWeekFollow = model.LastWeekFollow, LastWeekFollow = model.LastWeekFollow,
CurMonthFollow = model.CurMonthFollow,
LastMonthFollow = model.LastMonthFollow, LastMonthFollow = model.LastMonthFollow,
//SaleMoney = model.SaleMoney,
//YestodaySale = model.YestodaySale, AgFollow = model.AgFollow,
//LastWeekSale = model.LastWeekSale, YestodayAgFollow = model.YestodayAgFollow,
//LastMonthSale = model.LastMonthSale, CurWeekAgFollow = model.CurWeekAgFollow,
LastWeekAgFollow=model.LastWeekAgFollow,
CurMonthAgFollow=model.CurMonthAgFollow,
LastMonthAgFollow=model.LastMonthAgFollow,
CurWeekOrderNum=model.CurWeekOrderNum,
LastWeekOrderNum=model.LastWeekOrderNum,
CurWeekOrderSale=model.CurWeekOrderSale,
LastWeekOrderSale=model.LastWeekOrderSale,
CurMonthOrderGoal=model.CurMonthOrderGoal,
LastMonthOrderSale=model.LastMonthOrderSale,
CurMonthOrderSale=model.CurMonthOrderSale,
CurMonthOrderNum=model.CurMonthOrderNum,
LastMonthOrderNum=model.LastMonthOrderNum,
CreateBy = model.CreateBy, CreateBy = model.CreateBy,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
DeptId = model.DeptId, DeptId = model.DeptId,
......
using Edu.Common.Enum;
using Edu.Model.Entity.DataStatistics;
using Edu.Model.ViewModel.DataStatistics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.DataStatistics
{
/// <summary>
/// 课程顾问部月目标仓储层
/// </summary>
public class RB_Consultant_GoalRepository : BaseRepository<RB_Consultant_Goal>
{
/// <summary>
/// 获取课程顾问部目标分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Consultant_Goal_Extend> GetConsultantGoalPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Consultant_Goal_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_Consultant_Goal AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Consultant_Goal_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Consultant_Goal_Extend.Group_Id), query.Group_Id);
}
if (query.YearStr > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Consultant_Goal_Extend.YearStr), query.YearStr);
}
if (query.MonthStr > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Consultant_Goal_Extend.MonthStr), query.MonthStr);
}
}
builder.Append(" ORDER BY A.YearStr,A.MonthStr ");
return GetPage<RB_Consultant_Goal_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取课程顾问部目标列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Consultant_Goal_Extend> GetConsultantGoalListRepository(RB_Consultant_Goal_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_Consultant_Goal AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Consultant_Goal_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Consultant_Goal_Extend.Group_Id), query.Group_Id);
}
if (query.YearStr > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Consultant_Goal_Extend.YearStr), query.YearStr);
}
if (query.MonthStr > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Consultant_Goal_Extend.MonthStr), query.MonthStr);
}
if (query.Dept_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Consultant_Goal_Extend.Dept_Id), query.Dept_Id);
}
}
return Get<RB_Consultant_Goal_Extend>(builder.ToString()).ToList();
}
}
}
...@@ -65,26 +65,42 @@ WHERE 1=1 ...@@ -65,26 +65,42 @@ WHERE 1=1
var newModel = new RB_Market_Data_Extend() var newModel = new RB_Market_Data_Extend()
{ {
Date = model.Date, Date = model.Date,
ClueCount = model.ClueCount, ClueCount = model.ClueCount,
YestodayClue = model.YestodayClue, YestodayClue = model.YestodayClue,
CurWeekClue=model.CurWeekClue,
LastWeekClue = model.LastWeekClue, LastWeekClue = model.LastWeekClue,
CurMonthClue=model.CurMonthClue,
LastMonthClue = model.LastMonthClue, LastMonthClue = model.LastMonthClue,
VisitCount = model.VisitCount, VisitCount = model.VisitCount,
YestodayVisit = model.YestodayVisit, YestodayVisit = model.YestodayVisit,
CurWeekVisit=model.CurWeekVisit,
LastWeekVisit = model.LastWeekVisit, LastWeekVisit = model.LastWeekVisit,
CurMonthVisit=model.CurMonthVisit,
LastMonthVisit = model.LastMonthVisit, LastMonthVisit = model.LastMonthVisit,
TrialLessonCount = model.TrialLessonCount, TrialLessonCount = model.TrialLessonCount,
YestodayTrialLesson = model.YestodayTrialLesson, YestodayTrialLesson = model.YestodayTrialLesson,
CurWeekTrialLesson=model.CurWeekTrialLesson,
LastWeekTrialLesson = model.LastWeekTrialLesson, LastWeekTrialLesson = model.LastWeekTrialLesson,
CurMonthTrialLesson=model.CurMonthTrialLesson,
LastMonthTrialLesson = model.LastMonthTrialLesson, LastMonthTrialLesson = model.LastMonthTrialLesson,
FollowCount = model.FollowCount, FollowCount = model.FollowCount,
YestodayFollow = model.YestodayFollow, YestodayFollow = model.YestodayFollow,
CurWeekFollow=model.CurWeekFollow,
LastWeekFollow = model.LastWeekFollow, LastWeekFollow = model.LastWeekFollow,
CurMonthFollow=model.CurMonthFollow,
LastMonthFollow = model.LastMonthFollow, LastMonthFollow = model.LastMonthFollow,
SaleMoney = model.SaleMoney, SaleMoney = model.SaleMoney,
YestodaySale = model.YestodaySale, YestodaySale = model.YestodaySale,
CurWeekSale=model.CurWeekSale,
LastWeekSale = model.LastWeekSale, LastWeekSale = model.LastWeekSale,
CurMonrhSale=model.CurMonrhSale,
LastMonthSale = model.LastMonthSale, LastMonthSale = model.LastMonthSale,
CreateBy = model.CreateBy, CreateBy = model.CreateBy,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
DeptId = model.DeptId, DeptId = model.DeptId,
......
...@@ -318,8 +318,12 @@ WHERE 1=1 ...@@ -318,8 +318,12 @@ WHERE 1=1
SELECT A.CreateBy,COUNT(1) AS TrialLessonCount SELECT A.CreateBy,COUNT(1) AS TrialLessonCount
FROM RB_Visitor_Reserve AS A FROM RB_Visitor_Reserve AS A
WHERE 1=1 AND A.Status=0 {0} WHERE 1=1 AND A.Status=0 {0}
GROUP BY A.CreateBy
"; ";
if (query.CreateBy > 0)
{
sql += string.Format(@" AND A.CreateBy={0} ", query.CreateBy);
}
sql += " GROUP BY A.CreateBy ";
string todayWhere = ""; string todayWhere = "";
if (!string.IsNullOrEmpty(query.StartClassDate)) if (!string.IsNullOrEmpty(query.StartClassDate))
{ {
......
...@@ -1218,16 +1218,39 @@ WHERE 1=1 ...@@ -1218,16 +1218,39 @@ WHERE 1=1
/// 市场部和课程顾问部销售额统计 /// 市场部和课程顾问部销售额统计
/// </summary> /// </summary>
/// <param name="query"></param> /// <param name="query"></param>
/// <param name="qType">1-市场部,2-课程顾问部</param>
/// <returns></returns> /// <returns></returns>
public Dictionary<string, List<RB_Order_ViewModel>> GetMarketMarketConsultantStaticRepository(RB_Order_ViewModel query) public Dictionary<string, List<RB_Order_ViewModel>> GetMarketConsultantStaticRepository(RB_Order_ViewModel query,int qType=1)
{ {
Dictionary<string, List<RB_Order_ViewModel>> dicList = new Dictionary<string, List<RB_Order_ViewModel>>(); Dictionary<string, List<RB_Order_ViewModel>> dicList = new Dictionary<string, List<RB_Order_ViewModel>>();
string sql = @" string sql = "";
SELECT A.EnterID,A.CourseConsultantId,SUM(A.Income) AS Income if (qType == 1)
{
sql = @"
SELECT A.EnterID,SUM(A.Income) AS Income
FROM RB_Order AS A FROM RB_Order AS A
WHERE 1=1 AND A.OrderState IN(1,2) {0} WHERE 1=1 AND A.OrderState IN(1,2) {0}
GROUP BY A.EnterID,A.CourseConsultantId
"; ";
if (query.EnterID > 0)
{
sql += string.Format(" AND A.EnterID={0} ", query.EnterID);
}
sql += " GROUP BY A.EnterID ";
}
else
{
sql = @"
SELECT A.CourseConsultantId,Count(1) AS OrderCount, SUM(A.Income) AS Income
FROM RB_Order AS A
WHERE 1=1 AND A.OrderState IN(1,2) {0}
";
if (query.CourseConsultantId > 0)
{
sql += string.Format(" AND A.CourseConsultantId={0} ", query.CourseConsultantId);
}
sql += " GROUP BY A.CourseConsultantId ";
}
string todayWhere = ""; string todayWhere = "";
if (!string.IsNullOrEmpty(query.StartTime)) if (!string.IsNullOrEmpty(query.StartTime))
{ {
......
...@@ -832,14 +832,23 @@ WHERE 1=1 ...@@ -832,14 +832,23 @@ WHERE 1=1
public Dictionary<string,List<RB_Student_ViewModel>> GetStudentClueRepository(RB_Student_ViewModel query) public Dictionary<string,List<RB_Student_ViewModel>> GetStudentClueRepository(RB_Student_ViewModel query)
{ {
Dictionary<string, List<RB_Student_ViewModel>> dicList = new Dictionary<string, List<RB_Student_ViewModel>>(); Dictionary<string, List<RB_Student_ViewModel>> dicList = new Dictionary<string, List<RB_Student_ViewModel>>();
string whereStr = "";
if (query.CreateBy > 0)
{
whereStr += string.Format(" AND CreateBy={0} ", query.CreateBy);
}
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.Append(@" builder.Append(@"
SELECT Count(1) AS ClueCount,CreateBy SELECT Count(1) AS ClueCount,CreateBy
FROM RB_Student FROM RB_Student
WHERE Status=0 {0} WHERE Status=0 {0}
GROUP BY CreateBy
"); ");
if (!string.IsNullOrEmpty(whereStr))
{
builder.Append(whereStr);
}
builder.Append(" GROUP BY CreateBy ");
string todayWhere = ""; string todayWhere = "";
if (!string.IsNullOrEmpty(query.StartTime)) if (!string.IsNullOrEmpty(query.StartTime))
{ {
......
...@@ -51,15 +51,16 @@ namespace Edu.WebApi.Controllers.User ...@@ -51,15 +51,16 @@ namespace Edu.WebApi.Controllers.User
/// </summary> /// </summary>
private readonly TeacherModule teacherModule = new TeacherModule(); private readonly TeacherModule teacherModule = new TeacherModule();
/// <summary>
private readonly StudentModule studentModule = new StudentModule(); /// 部门处理类对象
/// </summary>
private readonly DepartmentModule departmentModule = new DepartmentModule();
[HttpGet] [HttpGet]
[HttpPost] [HttpPost]
[AllowAnonymous] [AllowAnonymous]
public ApiResult Test() public ApiResult Test()
{ {
studentModule.UpdateTel();
return ApiResult.Success(); return ApiResult.Success();
} }
...@@ -153,10 +154,6 @@ namespace Edu.WebApi.Controllers.User ...@@ -153,10 +154,6 @@ namespace Edu.WebApi.Controllers.User
string erpToken = WebApiTokenHelper.CreateToken(Common.GlobalKey.JWT_ERP_User_Key, erpUserInfo); string erpToken = WebApiTokenHelper.CreateToken(Common.GlobalKey.JWT_ERP_User_Key, erpUserInfo);
#region 获取甲鹤教育Token #region 获取甲鹤教育Token
string JHTenantId = Config.JHTenantId; string JHTenantId = Config.JHTenantId;
string JHMallBaseId = Config.JHMallBaseId; string JHMallBaseId = Config.JHMallBaseId;
...@@ -190,6 +187,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -190,6 +187,7 @@ namespace Edu.WebApi.Controllers.User
#endregion #endregion
var treeList = menuModule.GetPostMenuTreeModule(new Model.ViewModel.System.RB_Menu_ViewModel() var treeList = menuModule.GetPostMenuTreeModule(new Model.ViewModel.System.RB_Menu_ViewModel()
{ {
MenuType = accountType MenuType = accountType
...@@ -198,6 +196,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -198,6 +196,7 @@ namespace Edu.WebApi.Controllers.User
var actionList = menuModule.GetPostMenuFunctionListModule(model.Post_Id.ToString()); var actionList = menuModule.GetPostMenuFunctionListModule(model.Post_Id.ToString());
//上传配置 //上传配置
var uploadConfig = publicModule.GetFileStoreList(new Model.Public.RB_File_Store() { Group_Id = model.Group_Id, IsDefault = 1 })?.FirstOrDefault(); var uploadConfig = publicModule.GetFileStoreList(new Model.Public.RB_File_Store() { Group_Id = model.Group_Id, IsDefault = 1 })?.FirstOrDefault();
var deptList= departmentModule.GetDepartmentListModule(new RB_Department_ViewModel() { DeptId = model.Dept_Id, Group_Id = model.Group_Id, ManagerIds = model.Id.ToString() });
UserInfo obj = new UserInfo UserInfo obj = new UserInfo
{ {
...@@ -225,6 +224,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -225,6 +224,7 @@ namespace Edu.WebApi.Controllers.User
PostId = model.Post_Id, PostId = model.Post_Id,
PostName = model.PostName, PostName = model.PostName,
Email = model.Email, Email = model.Email,
IsManager=(deptList?.Count??0)>0?1:0,
IsTenCccUser = model.IsTenCccUser, IsTenCccUser = model.IsTenCccUser,
IsCourseConsultant = (model != null && model.UserRole == UserRoleEnum.CourseConsultant) ? 1 : 0, IsCourseConsultant = (model != null && model.UserRole == UserRoleEnum.CourseConsultant) ? 1 : 0,
IsMarket= (model != null && model.UserRole == UserRoleEnum.MarketPersion) ? 1 : 0, IsMarket= (model != null && model.UserRole == UserRoleEnum.MarketPersion) ? 1 : 0,
...@@ -255,6 +255,28 @@ namespace Edu.WebApi.Controllers.User ...@@ -255,6 +255,28 @@ namespace Edu.WebApi.Controllers.User
} }
} }
/// <summary>
/// 获取最新token
/// </summary>
/// <returns></returns>
public ApiResult GetSeatNewToken()
{
if (!string.IsNullOrEmpty(this.UserInfo.Email))
{
var tObj = new TenCloudCCCHelper().GetTenCccUserToken(this.UserInfo.Email).Result;
var tenCccToken = new TenCccTokenItem()
{
SdkURL = tObj.SdkURL,
Token = tObj.Token
};
return ApiResult.Success(data: tenCccToken);
}
else
{
return ApiResult.Failed("用户信息不合法,无法获取信息");
}
}
/// <summary> /// <summary>
/// 根据Token获取用户信息 /// 根据Token获取用户信息
/// </summary> /// </summary>
......
...@@ -13,6 +13,7 @@ using Edu.Common.Enum.User; ...@@ -13,6 +13,7 @@ using Edu.Common.Enum.User;
using Edu.Common.Plugin; using Edu.Common.Plugin;
using Edu.Model.CacheModel; using Edu.Model.CacheModel;
using Edu.Model.Public; using Edu.Model.Public;
using Edu.Model.ViewModel.DataStatistics;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using Edu.Module.Course; using Edu.Module.Course;
using Edu.Module.Customer; using Edu.Module.Customer;
...@@ -2538,7 +2539,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -2538,7 +2539,7 @@ namespace Edu.WebApi.Controllers.User
marketConsultantModule.ClearData(); marketConsultantModule.ClearData();
Task.Run(() => Task.Run(() =>
{ {
for (var i = 0; i < days; i++) for (var i = 0; i <= days; i++)
{ {
marketConsultantModule.CreateMarketDataModule(start.AddDays(i)); marketConsultantModule.CreateMarketDataModule(start.AddDays(i));
marketConsultantModule.CreateConsultantDataModule(start.AddDays(i)); marketConsultantModule.CreateConsultantDataModule(start.AddDays(i));
...@@ -2552,6 +2553,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -2552,6 +2553,7 @@ namespace Edu.WebApi.Controllers.User
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[AllowRepeatAttribute]
public ApiResult MarketStatic() public ApiResult MarketStatic()
{ {
string startTime = base.ParmJObj.GetStringValue("startTime"); string startTime = base.ParmJObj.GetStringValue("startTime");
...@@ -2584,6 +2586,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -2584,6 +2586,7 @@ namespace Edu.WebApi.Controllers.User
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[AllowRepeatAttribute]
public ApiResult ConsultantStatic() public ApiResult ConsultantStatic()
{ {
string startTime = base.ParmJObj.GetStringValue("startTime"); string startTime = base.ParmJObj.GetStringValue("startTime");
...@@ -2611,5 +2614,148 @@ namespace Edu.WebApi.Controllers.User ...@@ -2611,5 +2614,148 @@ namespace Edu.WebApi.Controllers.User
return ApiResult.Success(data: obj); return ApiResult.Success(data: obj);
} }
#endregion #endregion
#region 课程顾问部目标
/// <summary>
/// 获取课程顾问部目标分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetConsultantGoalPage()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Consultant_Goal_Extend()
{
YearStr=base.ParmJObj.GetInt("YearStr"),
MonthStr=base.ParmJObj.GetInt("MonthStr"),
};
query.Group_Id = base.UserInfo.Group_Id;
List<object> list = new List<object>();
var data= marketConsultantModule.GetConsultantGoalPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
if (data != null && data.Count > 0)
{
foreach (var item in data)
{
string CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
list.Add(new
{
item.Id,
item.YearStr,
item.MonthStr,
item.GoalMoney,
CreateByName,
item.CreateTimeStr,
item.Dept_Id,
item.DeptName,
});
}
}
pageModel.Count = rowsCount;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 修改课程顾问部目标
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult UpdateConsultantGoal()
{
var model = new RB_Consultant_Goal_Extend()
{
Id=base.ParmJObj.GetInt("Id"),
YearStr=base.ParmJObj.GetInt("YearStr"),
MonthStr=base.ParmJObj.GetInt("MonthStr"),
GoalMoney=base.ParmJObj.GetDecimal("GoalMoney"),
Dept_Id=base.ParmJObj.GetInt("Dept_Id"),
};
model.CreateBy = base.UserInfo.Id;
model.CreateTime = DateTime.Now;
model.Group_Id = base.UserInfo.Group_Id;
model.School_Id = base.UserInfo.School_Id;
model.Status = Common.Enum.DateStateEnum.Normal;
bool flag = marketConsultantModule.SetConsultantGoalModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 新增课程顾问部目标
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult AddConsultantGoal()
{
List<RB_Consultant_Goal_Extend> list = new List<RB_Consultant_Goal_Extend>();
var timeListStr = base.ParmJObj.GetStringValue("TimeList");
if (!string.IsNullOrEmpty(timeListStr))
{
List<string> timeList = Common.Plugin.JsonHelper.DeserializeObject<List<string>>(timeListStr);
if (timeList != null && timeList.Count > 0)
{
foreach (var item in timeList)
{
var tempArray = item.Split('-');
if (tempArray != null && tempArray.Length == 2)
{
Int32.TryParse(tempArray[0], out int YearStr);
Int32.TryParse(tempArray[1], out int MonthStr);
var model = new RB_Consultant_Goal_Extend()
{
Id = 0,
YearStr = YearStr,
MonthStr = MonthStr,
GoalMoney = base.ParmJObj.GetDecimal("GoalMoney"),
Dept_Id = base.ParmJObj.GetInt("Dept_Id"),
};
model.CreateBy = base.UserInfo.Id;
model.CreateTime = DateTime.Now;
model.Group_Id = base.UserInfo.Group_Id;
model.School_Id = base.UserInfo.School_Id;
model.Status = Common.Enum.DateStateEnum.Normal;
if (YearStr > 0 && MonthStr > 0)
{
list.Add(model);
}
}
}
}
}
bool flag = marketConsultantModule.AddConsultantGoalModule(list);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 根据编号获取目标
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetConsultantGoal()
{
var Id = base.ParmJObj.GetInt("Id");
var extModel = marketConsultantModule.GetConsultantGoalModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 根据编号删除目标
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult RemoveConsultantGoal()
{
var Id = base.ParmJObj.GetInt("Id");
var extModel = marketConsultantModule.RemoveConsultantGoalModule(Id);
return ApiResult.Success(data: extModel);
}
#endregion
} }
} }
\ No newline at end of file
...@@ -1273,7 +1273,6 @@ namespace Edu.WebApi.Controllers.User ...@@ -1273,7 +1273,6 @@ namespace Edu.WebApi.Controllers.User
var customer = base.AppletCustomerInfo; var customer = base.AppletCustomerInfo;
var query = new RB_Student_ViewModel() var query = new RB_Student_ViewModel()
{ {
QQ = base.ParmJObj.GetStringValue("QQ"), QQ = base.ParmJObj.GetStringValue("QQ"),
WeChatNo = base.ParmJObj.GetStringValue("WeChatNo") WeChatNo = base.ParmJObj.GetStringValue("WeChatNo")
}; };
...@@ -1293,7 +1292,6 @@ namespace Edu.WebApi.Controllers.User ...@@ -1293,7 +1292,6 @@ namespace Edu.WebApi.Controllers.User
extModel.CreateByName = UserReidsCache.GetUserLoginInfo(extModel.CreateBy)?.AccountName ?? ""; extModel.CreateByName = UserReidsCache.GetUserLoginInfo(extModel.CreateBy)?.AccountName ?? "";
if (customer != null) if (customer != null)
{ {
Common.Plugin.LogHelper.Write("查重推送消息");
studentModule.PushMessageModule(extModel,1); studentModule.PushMessageModule(extModel,1);
} }
} }
......
using Edu.Common.Plugin; using Edu.Common.Plugin;
using Edu.Module.Course; using Edu.Module.Course;
using Edu.Module.Customer;
using Edu.Module.Duty; using Edu.Module.Duty;
using Edu.Module.EduTask; using Edu.Module.EduTask;
using Edu.Module.Exam; using Edu.Module.Exam;
...@@ -39,6 +40,11 @@ namespace Edu.WebApi.Timers ...@@ -39,6 +40,11 @@ namespace Edu.WebApi.Timers
/// </summary> /// </summary>
private static readonly PaperModule paperModule = new PaperModule(); private static readonly PaperModule paperModule = new PaperModule();
/// <summary>
/// 课程顾问部和市场部数据统计
/// </summary>
private static readonly MarketConsultantModule marketConsultantModule = new MarketConsultantModule();
static System.Timers.Timer timer1;//计时器 static System.Timers.Timer timer1;//计时器
static System.Timers.Timer timer2;//定期处理未值班数据 static System.Timers.Timer timer2;//定期处理未值班数据
...@@ -53,6 +59,8 @@ namespace Edu.WebApi.Timers ...@@ -53,6 +59,8 @@ namespace Edu.WebApi.Timers
static System.Timers.Timer finishGuest;//处理学生毕业状态 static System.Timers.Timer finishGuest;//处理学生毕业状态
static System.Timers.Timer marketTimer;//处理市场部和课程顾问部数据统计
public static void RunTimer() public static void RunTimer()
{ {
timer1 = new System.Timers.Timer timer1 = new System.Timers.Timer
...@@ -104,6 +112,13 @@ namespace Edu.WebApi.Timers ...@@ -104,6 +112,13 @@ namespace Edu.WebApi.Timers
}; };
finishGuest.Elapsed += new System.Timers.ElapsedEventHandler(DealGuestFinish); finishGuest.Elapsed += new System.Timers.ElapsedEventHandler(DealGuestFinish);
finishGuest.Enabled = true; finishGuest.Enabled = true;
marketTimer= new System.Timers.Timer()
{
Interval = (1000) * (1) //1秒检测一次 00:30:00 每天执行一次
};
marketTimer.Elapsed += new System.Timers.ElapsedEventHandler(DealMarketConsultantData);
marketTimer.Enabled = true;
} }
public static void RunStop() public static void RunStop()
...@@ -115,6 +130,7 @@ namespace Edu.WebApi.Timers ...@@ -115,6 +130,7 @@ namespace Edu.WebApi.Timers
changeOrder.Enabled = false; changeOrder.Enabled = false;
examTimer.Enabled = false; examTimer.Enabled = false;
finishGuest.Enabled = false; finishGuest.Enabled = false;
marketTimer.Enabled = false;
} }
/// <summary> /// <summary>
...@@ -127,6 +143,34 @@ namespace Edu.WebApi.Timers ...@@ -127,6 +143,34 @@ namespace Edu.WebApi.Timers
private static int changeOrder_Timer = 0; private static int changeOrder_Timer = 0;
private static int examPublish_Timer = 0; private static int examPublish_Timer = 0;
private static int guestfinish_Timer = 0; private static int guestfinish_Timer = 0;
private static int marketconsultant_Timer = 0;
/// <summary>
/// 定时生成市场部和课程顾问部数据统计
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public static void DealMarketConsultantData(object sender, System.Timers.ElapsedEventArgs e)
{
if (Interlocked.Exchange(ref marketconsultant_Timer, 1) == 0)
{
int intHour = e.SignalTime.Hour;
int intMinute = e.SignalTime.Minute;
int intSecond = e.SignalTime.Second;
// 定制时间;比如 在00:30:00 的时候执行某个函数
int iHour = 00;
int iMinute = 30;
int iSecond = 00;
// 设置每天的
if (intHour == iHour && intMinute == iMinute && intSecond == iSecond)
{
marketConsultantModule.CreateConsultantDataModule(DateTime.Now);
marketConsultantModule.CreateMarketDataModule(DateTime.Now);
}
Interlocked.Exchange(ref marketconsultant_Timer, 0);
}
}
/// <summary> /// <summary>
/// 处理学员毕业状态 /// 处理学员毕业状态
......
{ {
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "server=192.168.10.214;user id=reborn;password=Reborn@2018;database=test_edu;CharSet=utf8mb4; Convert Zero Datetime=true; ", "DefaultConnection": "server=192.168.10.214;user id=reborn;password=Reborn@2018;database=reborn_edu;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"DefaultConnectionPName": "MySql.Data.MySqlClient", "DefaultConnectionPName": "MySql.Data.MySqlClient",
"FinanceConnection": "server=192.168.10.214;user id=reborn;password=Reborn@2018;database=reborn_finance;CharSet=utf8mb4; Convert Zero Datetime=true; ", "FinanceConnection": "server=192.168.10.214;user id=reborn;password=Reborn@2018;database=reborn_finance;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"FinanceConnectionPName": "MySql.Data.MySqlClient", "FinanceConnectionPName": "MySql.Data.MySqlClient",
......
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