Commit 07237255 authored by liudong1993's avatar liudong1993

1投稿提成

parent b903aaf0
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.Sell
{
/// <summary>
/// 投稿提成明细实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_TeaCon_Commission_Details
{
/// <summary>
/// 编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 教师ID
/// </summary>
public int TeacherId { get; set; }
/// <summary>
/// 投稿ID
/// </summary>
public int ContributeId { get; set; }
/// <summary>
/// 父级ID
/// </summary>
public int PeriodId { get; set; }
/// <summary>
/// 期号
/// </summary>
public string Periods { get; set; }
/// <summary>
/// 提成总金额
/// </summary>
public decimal CommissionMoney { get; set; }
/// <summary>
/// 部门id
/// </summary>
public int Depart_Id { get; set; }
/// <summary>
/// 校区id
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 集团id
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 备注, 记录抵扣金额等等
/// </summary>
public string Remark { get; set; }
}
}
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.Sell
{
/// <summary>
/// 投稿提成期数实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_TeaCon_Commission_Periods
{
/// <summary>
/// 编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 期数
/// </summary>
public string Periods { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建日期
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 累计金额
/// </summary>
public decimal SumPrice { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 关联财务单据ids
/// </summary>
public string Financials { get; set; }
/// <summary>
/// 已发放人员的列表
/// </summary>
public string EmpIds { get; set; }
}
}
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.Sell
{
/// <summary>
/// 投稿提成规则实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_TeaCon_Commission_Rule
{
/// <summary>
/// Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 单篇投稿的提成金额
/// </summary>
public decimal Money { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateTime { get; set; }
}
}
......@@ -133,5 +133,15 @@ namespace Edu.Model.Entity.WeChat
/// </summary>
public string SourceUrl { get; set; }
/// <summary>
/// 是否已发放提成 1是
/// </summary>
public int IsSendCommission { get; set; }
/// <summary>
/// 提成金额
/// </summary>
public decimal CommissionMoney { get; set; }
}
}
......@@ -179,7 +179,7 @@ namespace Edu.Model.Entity.WeChat
public int ClueState { get; set; }
/// <summary>
/// 转客户时间 ClueState=4
/// 线索转客户时间 ClueState=4
/// </summary>
public DateTime? TurnCustomerTime { get; set; }
......
using Edu.Model.Entity.Sell;
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.Sell
{
/// <summary>
/// 投稿提成明细实体类
/// </summary>
[Serializable]
public class RB_TeaCon_Commission_Details_ViewModel : RB_TeaCon_Commission_Details
{
/// <summary>
/// 老师ids
/// </summary>
public string TeacherIds { get; set; }
/// <summary>
/// 教师
/// </summary>
public string TeacherName { get; set; }
/// <summary>
/// 部门
/// </summary>
public string DeptName { get; set; }
/// <summary>
/// 校区
/// </summary>
public string SchoolName { get; set; }
/// <summary>
/// 投稿标题
/// </summary>
public string ContributeTitle { get; set; }
/// <summary>
/// 投稿类型
/// </summary>
public string ContributeType { get; set; }
}
}
\ No newline at end of file
using Edu.Model.Entity.Sell;
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.Sell
{
/// <summary>
/// 投稿提成期数实体类
/// </summary>
[Serializable]
public class RB_TeaCon_Commission_Periods_ViewModel : RB_TeaCon_Commission_Periods
{
}
}
\ No newline at end of file
using Edu.Model.Entity.Sell;
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.Sell
{
/// <summary>
/// 投稿提成规则实体类
/// </summary>
[Serializable]
public class RB_TeaCon_Commission_Rule_ViewModel : RB_TeaCon_Commission_Rule
{
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum.Sale;
using Edu.Model.Entity.WeChat;
using Edu.Model.Public;
namespace Edu.Model.ViewModel.WeChat
{
/// <summary>
/// 企业微信客户线索规则扩展类
/// </summary>
public class RB_WeChat_CustomerClueRule_ViewModel : RB_WeChat_CustomerClueRule
{
/// <summary>
/// 分配的部门
/// </summary>
public List<User.RB_Department_ViewModel> DeptList { get; set; }
/// <summary>
/// 分配的员工
/// </summary>
public List<User.Employee_ViewModel> EmpList { get; set; }
/// <summary>
/// 客户筛选列表 (标签 + 自定义字段)
/// </summary>
public List<CustomerCommissionSelectModel> ConditionList { get; set; }
/// <summary>
/// 条件描述列表
/// </summary>
public List<string> ConditionStrList { get; set; }
}
}
This diff is collapsed.
......@@ -1541,7 +1541,8 @@ namespace Edu.Module.EduTask
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Contribute_Info_ViewModel.AuditState),(int)Common.Enum.WeChat.ContributeInfoStateEnum.Audited}
{nameof(RB_Contribute_Info_ViewModel.AuditState),(int)Common.Enum.WeChat.ContributeInfoStateEnum.Audited},
{nameof(RB_Contribute_Info_ViewModel.PublishDate), DateTime.Now}
};
flag = contribute_InfoRepository.Update(fileds, new WhereHelper(nameof(RB_Contribute_Info_ViewModel.Id), receiptModel.RelationId));
}
......
This diff is collapsed.
using Edu.Common.Enum;
using Edu.Model.Entity.Course;
using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Sell;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Sell
{
/// <summary>
/// 投稿提成期数明细仓储层
/// </summary>
public class RB_TeaCon_Commission_DetailsRepository : BaseRepository<RB_TeaCon_Commission_Details>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_TeaCon_Commission_Details_ViewModel> GetList(RB_TeaCon_Commission_Details_ViewModel demodel)
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.PeriodId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.PeriodId)} ={demodel.PeriodId}";
}
if (demodel.TeacherId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.TeacherId)} ={demodel.TeacherId}";
}
if (!string.IsNullOrEmpty(demodel.TeacherIds))
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.TeacherId)} in({demodel.TeacherIds})";
}
if (demodel.ContributeId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.ContributeId)} ={demodel.ContributeId}";
}
string sql = $@" select r.* from RB_TeaCon_Commission_Details r where {where} order by r.Id asc";
return Get<RB_TeaCon_Commission_Details_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_TeaCon_Commission_Details_ViewModel> GetPageList(int pageIndex, int pageSize, out long count, RB_TeaCon_Commission_Details_ViewModel demodel)
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.School_Id >= 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.School_Id)} ={demodel.School_Id}";
}
if (demodel.Depart_Id > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.Depart_Id)} ={demodel.Depart_Id}";
}
if (demodel.PeriodId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.PeriodId)} ={demodel.PeriodId}";
}
if (demodel.TeacherId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.TeacherId)} ={demodel.TeacherId}";
}
if (!string.IsNullOrEmpty(demodel.TeacherIds))
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.TeacherId)} in({demodel.TeacherIds})";
}
if (demodel.ContributeId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.ContributeId)} ={demodel.ContributeId}";
}
string sql = $@" select r.* from RB_TeaCon_Commission_Details r where {where} order by r.Id desc";
return GetPage<RB_TeaCon_Commission_Details_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
/// 获取用户提成列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_TeaCon_Commission_Details_ViewModel> GetTeaConCommissionUserList(RB_TeaCon_Commission_Details_ViewModel demodel)
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.School_Id >= 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.School_Id)} ={demodel.School_Id}";
}
if (demodel.Depart_Id > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.Depart_Id)} ={demodel.Depart_Id}";
}
if (demodel.PeriodId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.PeriodId)} ={demodel.PeriodId}";
}
if (demodel.TeacherId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.TeacherId)} ={demodel.TeacherId}";
}
if (demodel.ContributeId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.ContributeId)} ={demodel.ContributeId}";
}
string sql = $@" select r.TeacherId,r.Depart_Id,r.School_Id,sum(r.CommissionMoney) as CommissionMoney
from RB_TeaCon_Commission_Details r where {where} group by r.TeacherId,r.Depart_Id,r.School_Id";
return Get<RB_TeaCon_Commission_Details_ViewModel>(sql).ToList();
}
/// <summary>
/// 累计提成金额
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public decimal GetTeaConCommissionStatistics(RB_TeaCon_Commission_Details_ViewModel demodel)
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.School_Id >= 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.School_Id)} ={demodel.School_Id}";
}
if (demodel.Depart_Id > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.Depart_Id)} ={demodel.Depart_Id}";
}
if (demodel.PeriodId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.PeriodId)} ={demodel.PeriodId}";
}
if (demodel.TeacherId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.TeacherId)} ={demodel.TeacherId}";
}
if (demodel.ContributeId > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Details_ViewModel.ContributeId)} ={demodel.ContributeId}";
}
string sql = $@" select sum(r.CommissionMoney) from RB_TeaCon_Commission_Details r where {where}";
var obj = ExecuteScalar(sql);
return obj == null ? 0 : Convert.ToDecimal(obj);
}
}
}
using Edu.Common.Enum;
using Edu.Model.Entity.Course;
using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Sell;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Sell
{
/// <summary>
/// 投稿提成期数仓储层
/// </summary>
public class RB_TeaCon_Commission_PeriodsRepository : BaseRepository<RB_TeaCon_Commission_Periods>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_TeaCon_Commission_Periods_ViewModel> GetList(RB_TeaCon_Commission_Periods_ViewModel demodel)
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Periods_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (!string.IsNullOrEmpty(demodel.Name))
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Periods_ViewModel.Name)} like '%{demodel.Name}%'";
}
if (!string.IsNullOrEmpty(demodel.Periods))
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Periods_ViewModel.Periods)} ='{demodel.Periods}'";
}
string sql = $@" select r.* from RB_TeaCon_Commission_Periods r where {where} order by r.Id desc";
return Get<RB_TeaCon_Commission_Periods_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_TeaCon_Commission_Periods_ViewModel> GetPageList(int pageIndex,int pageSize,out long count, RB_TeaCon_Commission_Periods_ViewModel demodel)
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Periods_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (!string.IsNullOrEmpty(demodel.Name))
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Periods_ViewModel.Name)} like '%{demodel.Name}%'";
}
string sql = $@" select r.* from RB_TeaCon_Commission_Periods r where {where} order by r.Id desc";
return GetPage<RB_TeaCon_Commission_Periods_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
}
}
using Edu.Common.Enum;
using Edu.Model.Entity.Course;
using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Sell;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Sell
{
/// <summary>
/// 投稿提成规则仓储层
/// </summary>
public class RB_TeaCon_Commission_RuleRepository : BaseRepository<RB_TeaCon_Commission_Rule>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_TeaCon_Commission_Rule_ViewModel> GetList(RB_TeaCon_Commission_Rule_ViewModel demodel)
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_TeaCon_Commission_Rule_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
string sql = $@" select r.* from RB_TeaCon_Commission_Rule r where {where} order by r.Id desc";
return Get<RB_TeaCon_Commission_Rule_ViewModel>(sql).ToList();
}
}
}
......@@ -100,5 +100,18 @@ WHERE {where}
ORDER BY r.Id DESC ";
return Get<RB_Contribute_Info_ViewModel>(sql, parameters).ToList();
}
/// <summary>
/// 获取可发放提成的投稿列表
/// </summary>
/// <param name="group_Id"></param>
/// <param name="eDate"></param>
/// <returns></returns>
public List<RB_Contribute_Info_ViewModel> GetCanSendCommissionList(int group_Id, string eDate)
{
string sql = $@"SELECT * FROM rb_contribute_info WHERE `Status` =0 and Group_Id ={group_Id}
and AuditState =2 and PublishDate <='{eDate} 23:59:59' and IFNULL(IsSendCommission,0) <>1";
return Get<RB_Contribute_Info_ViewModel>(sql).ToList();
}
}
}
using Edu.Common.Enum;
using Edu.Model.Entity.WeChat;
using Edu.Model.ViewModel.WeChat;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB;
using VT.FW.DB.Dapper;
namespace Edu.Repository.WeChat
{
/// <summary>
/// 企业微信客户线索规则仓储层
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_WeChat_CustomerClueRuleRepository : BaseRepository<RB_WeChat_CustomerClueRule>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_WeChat_CustomerClueRule_ViewModel> GetList(RB_WeChat_CustomerClueRule_ViewModel demodel)
{
DynamicParameters parameters = new DynamicParameters();
string where = $@" 1=1 and r.{nameof(RB_WeChat_CustomerClueRule_ViewModel.Status)} =0";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_WeChat_CustomerClueRule_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.Id > 0)
{
where += $@" and r.{nameof(RB_WeChat_CustomerClueRule_ViewModel.Id)} ={demodel.Id}";
}
string sql = $@"
SELECT * From RB_WeChat_CustomerClueRule r
WHERE {where}
ORDER BY r.Id DESC ";
return Get<RB_WeChat_CustomerClueRule_ViewModel>(sql, parameters).ToList();
}
/// <summary>
/// 执行排序+1
/// </summary>
/// <param name="group_Id"></param>
/// <param name="id"></param>
public void UpdateLastClueRuleSortAdd(int group_Id, int id, int minSort =0, int maxSort =0)
{
string sql = $@" update RB_WeChat_CustomerClueRule set Sort = Sort +1 where Status =0 and Group_Id ={group_Id} and Sort >0 and Id <>{id}";
if (minSort > 0) {
sql += $" and Sort >=" + minSort;
}
if (maxSort > 0) {
sql += $" and Sort <=" + maxSort;
}
Execute(sql);
}
/// <summary>
/// 执行排序-1
/// </summary>
/// <param name="group_Id"></param>
/// <param name="id"></param>
/// <param name="minSort"></param>
/// <param name="maxSort"></param>
public void UpdateLastClueRuleSortSubtract(int group_Id, int id, int minSort = 0, int maxSort = 0)
{
string sql = $@" update RB_WeChat_CustomerClueRule set Sort = Sort -1 where Status =0 and Group_Id ={group_Id} and Sort >0 and Id <>{id}";
if (minSort > 0)
{
sql += $" and Sort >=" + minSort;
}
if (maxSort > 0)
{
sql += $" and Sort <=" + maxSort;
}
Execute(sql);
}
}
}
......@@ -259,7 +259,7 @@ namespace Edu.Repository.WeChat
string vstr = "'" + string.Join("','", vList) + "'";
if (item.IsCustom == 1)
{
where += $@" r.CustomContent -> '$.{item.Name}' in({vstr}) ";
where += $@" DATE_FORMAT(r.CustomContent -> '$.{item.Name}','%m月%d号') in({vstr}) ";
}
else
{
......
......@@ -597,6 +597,8 @@ namespace Edu.WebApi.Controllers.QYWeChat
}),
x.AuditState,
AuditStateName = x.AuditState.ToName(),
x.IsSendCommission,
x.CommissionMoney,
x.UpdateBy,
UpdateByName = Cache.User.UserReidsCache.GetUserLoginInfo(x.UpdateBy)?.AccountName??"",
UpdateTime = x.UpdateTime.ToString("yyyy-MM-dd HH:mm")
......
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