Commit 42c7bad8 authored by 黄奎's avatar 黄奎

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

parents ac3d2ecf 43d2b1e8
......@@ -86,6 +86,12 @@ namespace Edu.Common.Enum.Course
/// 销售返佣批量生成财务单据
/// </summary>
[EnumField("销售返佣批量生成财务单据")]
SellCommission = 14
SellCommission = 14,
/// <summary>
/// 教育商品- 咖啡
/// </summary>
[EnumField("教育咖啡劵")]
EduCoffee = 15,
}
}
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.Goods
{
/// <summary>
/// 教育商品实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods
{
/// <summary>
/// Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 商品类型 1咖啡劵 2耗材类 3教室类
/// </summary>
public int GoodsType { get; set; }
/// <summary>
/// GoodsName
/// </summary>
public string GoodsName { get; set; }
/// <summary>
/// 封面图
/// </summary>
public string CoverImage { get; set; }
/// <summary>
/// 售价
/// </summary>
public decimal SellingPrice { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 商户号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// CreateDate
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// UpdateDate
/// </summary>
public DateTime UpdateDate { get; set; }
/// <summary>
/// 对应的电商商品ID
/// </summary>
public int MallGoodsId { get; set; }
}
}
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.Goods
{
/// <summary>
/// 教育商品订单实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_Order
{
/// <summary>
/// OrderId
/// </summary>
public int OrderId { get; set; }
/// <summary>
/// 订单类型 1咖啡劵 2耗材类 3教师类
/// </summary>
public int OrderType { get; set; }
/// <summary>
/// 对应电商订单ID
/// </summary>
public int MallOrderId { get; set; }
/// <summary>
/// 订单号
/// </summary>
public string OrderNo { get; set; }
/// <summary>
/// 用户类型 1内部人员 2学生 3甲鹤用户
/// </summary>
public int UserType { get; set; }
/// <summary>
/// 关联帐号
/// </summary>
public int AccountId { get; set; }
/// <summary>
/// 用户id
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 用户昵称(甲鹤)
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 订单来源(平台) 枚举
/// </summary>
public int OrderSource { get; set; }
/// <summary>
/// 支付方式 枚举
/// </summary>
public int PaymentWay { get; set; }
/// <summary>
/// 单价
/// </summary>
public decimal Unit_Price { get; set; }
/// <summary>
/// 数量
/// </summary>
public int Number { get; set; }
/// <summary>
/// 应收金额
/// </summary>
public decimal PreferPrice { get; set; }
/// <summary>
/// 实收金额
/// </summary>
public decimal Income { get; set; }
/// <summary>
/// 手续费
/// </summary>
public decimal Fee { get; set; }
/// <summary>
/// 退款
/// </summary>
public decimal Refund { get; set; }
/// <summary>
/// 下单备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 订单状态 1待付款 2已完成 3已取消
/// </summary>
public int OrderStatus { get; set; }
/// <summary>
/// 付款时间
/// </summary>
public DateTime PaymentTime { get; set; }
/// <summary>
/// 取消时间
/// </summary>
public DateTime? CancelTime { get; set; }
/// <summary>
/// 教育商品id
/// </summary>
public int GoodsId { get; set; }
/// <summary>
/// 对应电商商品ID
/// </summary>
public int MallGoodsId { get; set; }
/// <summary>
/// 商品名称
/// </summary>
public string GoodsName { get; set; }
/// <summary>
/// 封面图
/// </summary>
public string CoverImage { get; set; }
/// <summary>
/// 总成本价格
/// </summary>
public decimal CostMoney { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 集团ID
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// CreateDate
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// UpdateDate
/// </summary>
public DateTime UpdateDate { get; set; }
}
}
using Edu.Model.Entity.Goods;
using Edu.Model.ViewModel.Finance;
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.Goods
{
/// <summary>
/// 教育商品订单扩展类
/// </summary>
[Serializable]
public class RB_Goods_Order_ViewModel : RB_Goods_Order
{
/// <summary>
/// 财务单据 - 收入
/// </summary>
public List<RB_Finance_Extend> IncomeList { get; set; }
/// <summary>
/// 财务单据 - 支出
/// </summary>
public List<RB_Finance_Extend> ExpendList { get; set; }
/// <summary>
/// 员工/学生
/// </summary>
public string EmName { get; set; }
}
}
\ No newline at end of file
using Edu.Model.Entity.Goods;
using System;
namespace Edu.Model.ViewModel.Goods
{
/// <summary>
/// 教育商品扩展类
/// </summary>
[Serializable]
public class RB_Goods_ViewModel : RB_Goods
{
/// <summary>
/// 商品ids
/// </summary>
public string GoodsIds { get; set; }
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Edu.Aop\Edu.Aop.csproj" />
<ProjectReference Include="..\Edu.Cache\Edu.Cache.csproj" />
<ProjectReference Include="..\Edu.Common\Edu.Common.csproj" />
<ProjectReference Include="..\Edu.Model\Edu.Model.csproj" />
<ProjectReference Include="..\Edu.Repository\Edu.Repository.csproj" />
</ItemGroup>
</Project>
using Edu.Common;
using Edu.Common.Enum;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Finance;
using Edu.Model.ViewModel.Goods;
using Edu.Repository.Finance;
using Edu.Repository.Goods;
using Edu.Repository.User;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using VT.FW.DB;
namespace Edu.Module.Goods
{
/// <summary>
/// 教育商品处理类
/// </summary>
public class EduGoodsModule
{
/// <summary>
/// 教育商品订单
/// </summary>
private readonly RB_EduGoods_OrderRepository eduGoods_OrderRepository = new RB_EduGoods_OrderRepository();
/// <summary>
/// 财务单据
/// </summary>
private readonly RB_FinanceRepository financeRepository = new RB_FinanceRepository();
/// <summary>
/// 账号
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
#region 咖啡劵
/// <summary>
/// 获取咖啡劵分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Goods_Order_ViewModel> GetGoodsOrderPageList(int pageIndex, int pageSize, out long count, RB_Goods_Order_ViewModel demodel) {
var list = eduGoods_OrderRepository.GetPageList(pageIndex, pageSize, out count, demodel);
if (list.Any()) {
//查询财务单据
string orderIds = string.Join(",", list.Select(x => x.OrderId));
var financeList = financeRepository.GetListSingle(new RB_Finance_Extend() { RB_Group_Id = demodel.Group_Id, FinanceType = 2, OtherType = 54, ReFinanceIds = orderIds, IsSelectNormal = 1 });
List<Model.ViewModel.User.Employee_ViewModel> EmpList = new List<Model.ViewModel.User.Employee_ViewModel>();
if (list.Where(x => x.UserType == 1).Any()) {
string accountIds = string.Join(",", list.Where(x => x.UserType == 1).Select(x => x.AccountId).Distinct());
EmpList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = demodel.Group_Id, QIds = accountIds });
}
List<Model.ViewModel.User.RB_Account_ViewModel> StuList = new List<Model.ViewModel.User.RB_Account_ViewModel>();
if (list.Where(x => x.UserType == 2).Any()) {
string accountIds = string.Join(",", list.Where(x => x.UserType == 1).Select(x => x.AccountId).Distinct());
StuList = accountRepository.GetStudentExt(new Model.ViewModel.User.RB_Account_ViewModel() { Group_Id = demodel.Group_Id, QIds = accountIds, AccountType = Common.Enum.User.AccountTypeEnum.Student });
}
foreach (var item in list)
{
item.IncomeList = financeList.Where(x => x.ReFinanceId == item.OrderId && x.Type == Common.Enum.Finance.WFTempLateClassEnum.IN).ToList();
item.ExpendList = financeList.Where(x => x.ReFinanceId == item.OrderId && x.Type == Common.Enum.Finance.WFTempLateClassEnum.OUT).ToList();
if (item.UserType == 1) {
item.EmName = EmpList.Where(x => x.Id == item.AccountId).FirstOrDefault()?.EmployeeName ?? "";
}
if (item.UserType == 2) {
item.EmName = StuList.Where(x => x.Id == item.AccountId).FirstOrDefault()?.AccountName ?? "";
}
}
}
return list;
}
#endregion
}
}
......@@ -713,7 +713,7 @@ namespace Edu.Module.User
Nationality = "",
ForeignersUrl = "",
Specialty = "1,2,3,4",
BaseHoursEnabled = 1,
BaseHoursEnabled = 0,
EnableTime = model.EnableTime,
};
newId = teacherRepository.Insert(teacher);
......
using Edu.Model.Entity.Goods;
using Edu.Model.ViewModel.Goods;
using System.Collections.Generic;
using System.Linq;
namespace Edu.Repository.Goods
{
/// <summary>
/// 教育商品仓储
/// </summary>
public class RB_EduGoodsRepository : BaseRepository<RB_Goods>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Goods_ViewModel> GetList(RB_Goods_ViewModel demodel)
{
string where = $@" 1=1 and Status =0";
if (demodel.Group_Id > 0)
{
where += $@" and {nameof(RB_Goods_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_ViewModel.MallBaseId)} ={demodel.MallBaseId}";
}
if (demodel.GoodsType > 0)
{
where += $@" and {nameof(RB_Goods_ViewModel.GoodsType)} ={demodel.GoodsType}";
}
if (demodel.MallGoodsId > 0)
{
where += $@" and {nameof(RB_Goods_ViewModel.MallGoodsId)} ={demodel.MallGoodsId}";
}
if (!string.IsNullOrEmpty(demodel.GoodsIds))
{
where += $@" and {nameof(RB_Goods_ViewModel.Id)} in({demodel.GoodsIds})";
}
string sql = $@" select * from RB_Goods where {where} order by Id desc";
return Get<RB_Goods_ViewModel>(sql).ToList();
}
}
}
using Edu.Model.Entity.Goods;
using Edu.Model.ViewModel.Goods;
using System.Collections.Generic;
using System.Linq;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Goods
{
/// <summary>
/// 教育商品订单仓储
/// </summary>
public class RB_EduGoods_OrderRepository : BaseRepository<RB_Goods_Order>
{
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Goods_Order_ViewModel> GetPageList(int pageIndex, int pageSize, out long count, RB_Goods_Order_ViewModel demodel)
{
var parameters = new DynamicParameters();
string where = $@" 1=1 and Status =0";
if (demodel.Group_Id > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.MallBaseId)} ={demodel.MallBaseId}";
}
if (demodel.OrderStatus > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.OrderStatus)} ={demodel.OrderStatus}";
}
if (demodel.OrderId > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.OrderId)} ={demodel.OrderId}";
}
if (demodel.OrderType > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.OrderType)} ={demodel.OrderType}";
}
if (demodel.MallOrderId > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.MallOrderId)} ={demodel.MallOrderId}";
}
if (!string.IsNullOrEmpty(demodel.OrderNo))
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.OrderNo)} like @OrderNo";
parameters.Add("OrderNo", "%" + demodel.OrderNo.Trim() + "%");
}
if (demodel.UserType > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.UserType)} ={demodel.UserType}";
}
string sql = $@" select * from RB_Goods_Order where {where} order by OrderId desc";
return GetPage<RB_Goods_Order_ViewModel>(pageIndex, pageSize, out count, sql, parameters).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Goods_Order_ViewModel> GetList(RB_Goods_Order_ViewModel demodel)
{
var parameters = new DynamicParameters();
string where = $@" 1=1 and Status =0";
if (demodel.Group_Id > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.MallBaseId)} ={demodel.MallBaseId}";
}
if (demodel.OrderStatus > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.OrderStatus)} ={demodel.OrderStatus}";
}
if (demodel.OrderId > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.OrderId)} ={demodel.OrderId}";
}
if (demodel.OrderType > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.OrderType)} ={demodel.OrderType}";
}
if (demodel.MallOrderId > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.MallOrderId)} ={demodel.MallOrderId}";
}
if (!string.IsNullOrEmpty(demodel.OrderNo))
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.OrderNo)} like @OrderNo";
parameters.Add("OrderNo", "%" + demodel.OrderNo.Trim() + "%");
}
if (demodel.UserType > 0)
{
where += $@" and {nameof(RB_Goods_Order_ViewModel.UserType)} ={demodel.UserType}";
}
string sql = $@" select * from RB_Goods_Order where {where} order by OrderId desc";
return Get<RB_Goods_Order_ViewModel>(sql, parameters).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Edu.Cache.User;
using Edu.Common.API;
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Goods;
using Edu.Module.Goods;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
namespace Edu.WebApi.Controllers.Goods
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class EudGoodsController : BaseController
{
/// <summary>
/// 滚动开班处理类对象
/// </summary>
private readonly EduGoodsModule goodsModule = new EduGoodsModule();
#region 咖啡劵
/// <summary>
/// 获取教育商品订单分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetGoodsOrderPageList()
{
var userInfo = base.UserInfo;
ResultPageModel pmodel = JsonHelper.DeserializeObject<ResultPageModel>(base.RequestParm.Msg.ToString());
RB_Goods_Order_ViewModel demodel = JsonHelper.DeserializeObject<RB_Goods_Order_ViewModel>(base.RequestParm.Msg.ToString());
demodel.Group_Id = userInfo.Group_Id;
var list = goodsModule.GetGoodsOrderPageList(pmodel.PageIndex, pmodel.PageSize, out long count, demodel);
pmodel.Count = count;
pmodel.PageData = list.Select(x => new
{
x.OrderId,
x.OrderNo,
x.OrderType,
x.UserType,
x.AccountId,
x.EmName,
x.UserId,
x.UserName,
x.Unit_Price,
x.Number,
x.PreferPrice,
x.Income,
x.Fee,
x.Refund,
x.Remark,
x.OrderStatus,
PaymentTime = x.PaymentTime.ToString("yyyy-MM-dd HH:mm"),
CancelTime = x.CancelTime.HasValue ? x.CancelTime.Value.ToString("yyyy-MM-dd HH:mm") : "",
x.GoodsId,
x.GoodsName,
x.CoverImage,
CreateDate = x.CreateDate.ToString("yyyy-MM-dd HH:mm")
});
return ApiResult.Success("", pmodel);
}
#endregion
}
}
......@@ -44,6 +44,7 @@
<ProjectReference Include="..\Edu.Module.EduTask\Edu.Module.EduTask.csproj" />
<ProjectReference Include="..\Edu.Module.Exam\Edu.Module.Exam.csproj" />
<ProjectReference Include="..\Edu.Module.Finance\Edu.Module.Finance.csproj" />
<ProjectReference Include="..\Edu.Module.Goods\Edu.Module.Goods.csproj" />
<ProjectReference Include="..\Edu.Module.OKR\Edu.Module.OKR.csproj" />
<ProjectReference Include="..\Edu.Module.Public\Edu.Module.Public.csproj" />
<ProjectReference Include="..\Edu.Module.Question\Edu.Module.Question.csproj" />
......
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