Commit ed25580e authored by 吴春's avatar 吴春

提交代码

parent 5fb5ada1
......@@ -541,5 +541,51 @@ namespace Edu.Common
}
}
/// <summary>
/// 甲鹤教育接口请求地址
/// </summary>
public static string DmcMallApi
{
get
{
return ReadConfigKey("DmcMallApi");
}
}
/// <summary>
/// 甲鹤教育商户id
/// </summary>
public static string JHTenantId
{
get
{
return ReadConfigKey("JHTenantId");
}
}
/// <summary>
/// 甲鹤教育小程序id
/// </summary>
public static string JHMallBaseId
{
get
{
return ReadConfigKey("JHMallBaseId");
}
}
/// <summary>
/// 电商加密
/// </summary>
public static string MallJwtSecretKey
{
get
{
return ReadConfigKey("MallJwtSecretKey");
}
}
}
}
\ No newline at end of file
......@@ -38,6 +38,13 @@ namespace Edu.Common.Enum
[EnumField("ERP")]
ERP =6,
/// <summary>
/// Mall【生成Token使用】
/// </summary>
[EnumField("Mall")]
Mall = 7,
/// <summary>
/// App学生端
/// </summary>
......
......@@ -52,6 +52,18 @@ namespace Edu.Common.Enum.Course
/// 学费收入
/// </summary>
[EnumField("学费收入")]
Tuition = 8
Tuition = 8,
/// <summary>
/// 活动收入(电商)
/// </summary>
[EnumField("活动收入")]
ActivityIncome = 9,
/// <summary>
/// 活动退款(电商)
/// </summary>
[EnumField("活动退款")]
ActivityExpenditure = 10,
}
}
......@@ -67,6 +67,22 @@ namespace Edu.Model.CacheModel
/// </summary>
public string ErpToken { get; set; }
/// <summary>
/// 电商-token
/// </summary>
public string MallToken { get; set; }
/// <summary>
/// 电商-JHTenantId
/// </summary>
public string JHTenantId { get; set; }
/// <summary>
/// 电商-JHMallBaseId
/// </summary>
public string JHMallBaseId { get; set; }
/// <summary>
/// 菜单列表
/// </summary>
......
......@@ -45,5 +45,20 @@ namespace Edu.Model.ViewModel.Question
/// 间隔多少个15分钟
/// </summary>
public int IntervalNum { get; set; }
/// <summary>
/// 课程名称
/// </summary>
public string CourseName { get; set; }
/// <summary>
/// 课程进度
/// </summary>
public decimal CompleteProgress { get; set; }
/// <summary>
/// 学生
/// </summary>
public string StudentName { get; set; }
}
}
......@@ -1372,7 +1372,7 @@ namespace Edu.Module.Course
public object GetClassPlanLogPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Class_Plan_ViewModel query)
{
List<object> result = new List<object>();
var list= class_PlanRepository.GetClassPlanLogPageListRepository(pageIndex, pageSize, out rowsCount, query);
var list = class_PlanRepository.GetClassPlanLogPageListRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count > 0)
{
List<RB_Class_Check_ViewModel> checkLogList = new List<RB_Class_Check_ViewModel>();
......@@ -1421,7 +1421,7 @@ namespace Edu.Module.Course
MonthStr = item.ClassDate.ToString("MM"),
DayStr = item.ClassDate.ToString("dd"),
YearStr = item.ClassDate.ToString("yyyy"),
TimeList=time
TimeList = time
};
result.Add(planCheckObj);
}
......@@ -1490,7 +1490,29 @@ namespace Edu.Module.Course
/// <returns></returns>
public List<RB_Class_Plan_ViewModel> GetClassPlanList_V2(RB_Class_Plan_ViewModel query)
{
return class_PlanRepository.GetClassPlanList_V2(query);
var list = class_PlanRepository.GetClassPlanList_V2(query);
if (list != null && list.Any())
{
string ClassIds = string.Join(",", list.Distinct().Select(x => x.ClassId));
var orderStudentList = order_GuestRepository.GetList(new RB_Order_Guest_ViewModel()
{
ClassIds = ClassIds,
Group_Id = query.Group_Id,
School_Id = -1
}).Where(x => x.GuestState == 1).ToList();
if (orderStudentList != null && orderStudentList.Any())
{
foreach (var item in list)
{
item.GuestList = new List<RB_Order_Guest_ViewModel>();
item.GuestList = orderStudentList.Where(x => x.ClassId == item.ClassId).ToList();
}
}
}
return list;
}
/// <summary>
......
......@@ -277,7 +277,7 @@ namespace Edu.WebApi.Controllers.Course
InfoTime = item.CreateTime,
Type = item.ErrorType == 0 ? 1 : 2,
ClassStatus = -1,
IntervalNum = IntervalNum
IntervalNum = IntervalNum,
});
}
foreach (var item in timeList)
......@@ -291,17 +291,22 @@ namespace Edu.WebApi.Controllers.Course
var planModel = roomList.Where(x => x.ClassPlanId == item.ClassPlanId).FirstOrDefault();
if (planModel != null && planModel.ClassPlanId > 0)
{
var roomModel = roomList.Where(x => x.ClassPlanId == item.ClassPlanId).FirstOrDefault();
resultList.Add(new Model.ViewModel.Question.RB_Question_RoomUseLog_ViewModel
{
Id = item.ClassTimeId,
Title = roomList.Where(x => x.ClassPlanId == item.ClassPlanId).FirstOrDefault()?.ClassName,
Content = roomList.Where(x => x.ClassPlanId == item.ClassPlanId).FirstOrDefault()?.TeacherName,
Title = roomModel?.ClassName,
Content = roomModel?.TeacherName,
StartTime = item.StartTime,
EndTime = item.EndTime,
InfoTime = Convert.ToDateTime(planModel.ClassDate.ToString("yyyy-MM-dd ") + item.StartTime),
Type = 0,
ClassStatus = item.ClassStatus,
IntervalNum = IntervalNum
IntervalNum = IntervalNum,
CourseName = roomModel?.CourseName,
CompleteProgress = roomModel?.CompleteProgress ?? 0,
StudentName = (roomModel != null && roomModel.GuestList != null && roomModel.GuestList.Any()) ? string.Join(",", roomModel.GuestList.Select(x => x.GuestName)) : ""
});
}
}
......
......@@ -2,7 +2,9 @@
using System.Collections.Generic;
using System.Linq;
using Edu.Cache.User;
using Edu.Common;
using Edu.Common.API;
using Edu.Common.Enum;
using Edu.Common.Enum.User;
using Edu.Common.Plugin;
using Edu.Model.CacheModel;
......@@ -108,6 +110,59 @@ namespace Edu.WebApi.Controllers.User
string token = WebApiTokenHelper.CreateToken(Common.GlobalKey.JWT_User_Key, eduUserInfo);
string erpToken = WebApiTokenHelper.CreateToken(Common.GlobalKey.JWT_ERP_User_Key, erpUserInfo);
#region 获取甲鹤教育Token
string JHTenantId = Config.JHTenantId;
string JHMallBaseId = Config.JHMallBaseId;
IUserInfoToken mallJHUserInfo = new ErpTokenUserInfo()
{
requestFrom = Common.Enum.ApiRequestFromEnum.Mall,
uid = JHTenantId,
groupId = model.Group_Id
};
#region JWT
// string mallToken = WebApiTokenHelper.CreateToken(Common.GlobalKey.JWT_Mall_User_Key, mallJHUserInfo);
#endregion
#endregion
#region 获取甲鹤教育Token
#region JWT
JWT.IDateTimeProvider provider2 = new JWT.UtcDateTimeProvider();
var now2 = provider2.GetNow().AddMinutes(-1);
var unixEpoch2 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // or use JwtValidator.UnixEpoch
var secondsSinceEpoch2 = Math.Round((now2 - unixEpoch2).TotalSeconds);
var payload2 = new Dictionary<string, object>
{
{"iat",secondsSinceEpoch2 },
{"exp",secondsSinceEpoch2+Config.JwtExpirTime},
{"mall_userInfoJH",mallJHUserInfo }
};
JWT.Algorithms.IJwtAlgorithm algorithm2 = new JWT.Algorithms.HMACSHA256Algorithm();
JWT.IJsonSerializer serializer2 = new JWT.Serializers.JsonNetSerializer();
JWT.IBase64UrlEncoder urlEncoder2 = new JWT.JwtBase64UrlEncoder();
JWT.IJwtEncoder encoder2 = new JWT.JwtEncoder(algorithm2, serializer2, urlEncoder2);
string secret2 = Config.MallJwtSecretKey;
string malltokenJH = encoder2.Encode(payload2, secret2);
#endregion
#endregion
var treeList = menuModule.GetPostMenuTreeModule(new Model.ViewModel.System.RB_Menu_ViewModel()
{
MenuType = accountType
......@@ -130,6 +185,9 @@ namespace Edu.WebApi.Controllers.User
SchoolName = model.SchoolName,
Token = token,
ErpToken = erpToken,
MallToken = malltokenJH,
JHMallBaseId = JHMallBaseId,
JHTenantId = JHTenantId,
MenuList = treeList,
UserCenterList = userCenterList,
GroupLogo = model.GroupLogo,
......
......@@ -149,7 +149,7 @@ namespace Edu.WebApi.Controllers.WeChatPay
Cache.User.UserReidsCache.Set(Cache.CacheKey.WeChatPay_Callback_Key + payModel.out_trade_no, payModel.out_trade_no, 1800);
isAdd = true;
Cache.User.UserReidsCache.Set(Cache.CacheKey.WeChatPay_Callback_Key + payModel.out_trade_no, payModel.out_trade_no, 1800);
var oldOrderRecordModel = educationContractModule.GetOrderRecordList(new RB_Finance_OrderRecord { ContractId = contractId, OutTradeNo = payModel.out_trade_no }).FirstOrDefault();
var oldOrderRecordModel = educationContractModule.GetOrderRecordList(new RB_Finance_OrderRecord { ContractId = contractId, OutTradeNo = payModel.out_trade_no, Type = 1 }).FirstOrDefault();
if (oldOrderRecordModel == null || oldOrderRecordModel.ID == 0)
{
isAdd = true;
......@@ -338,7 +338,7 @@ namespace Edu.WebApi.Controllers.WeChatPay
contractId = Convert.ToInt32(outTradeNo[17..]);
}
var orderModle = educationContractModule.GetEducationContractModule(contractId);
var orderRecordModel = educationContractModule.GetOrderRecordList(new RB_Finance_OrderRecord { ContractId = contractId, OutTradeNo = outTradeNo }).FirstOrDefault();
var orderRecordModel = educationContractModule.GetOrderRecordList(new RB_Finance_OrderRecord { ContractId = contractId, OutTradeNo = outTradeNo, Type = 2 }).FirstOrDefault();
if (orderRecordModel == null)
{
return ApiResult.Failed("未查询到当前商户订单号对应的支付记录");
......@@ -433,7 +433,7 @@ namespace Edu.WebApi.Controllers.WeChatPay
Cache.User.UserReidsCache.Set(Cache.CacheKey.WeChatPay_Callback_Key + payModel.out_trade_no, payModel.out_trade_no, 1800);
isAdd = true;
Cache.User.UserReidsCache.Set(Cache.CacheKey.WeChatPay_Callback_Key + payModel.out_trade_no, payModel.out_trade_no, 1800);
var oldOrderRecordModel = educationContractModule.GetOrderRecordList(new RB_Finance_OrderRecord { ContractId = contractId, OutTradeNo = payModel.out_trade_no }).FirstOrDefault();
var oldOrderRecordModel = educationContractModule.GetOrderRecordList(new RB_Finance_OrderRecord { ContractId = contractId, OutTradeNo = payModel.out_trade_no, Type = 2 }).FirstOrDefault();
if (oldOrderRecordModel == null || oldOrderRecordModel.ID == 0)
{
isAdd = true;
......@@ -442,7 +442,7 @@ namespace Edu.WebApi.Controllers.WeChatPay
{
var orderModle = educationContractModule.GetEducationContractModule(contractId);
var orderModel = orderModule.GetClassOrderInfoModule(orderModle.OrderId);
var payOrderRecordModel = educationContractModule.GetOrderRecordList(new RB_Finance_OrderRecord { ContractId = contractId, OutTradeNo = payModel.out_trade_no }).FirstOrDefault();
var payOrderRecordModel = educationContractModule.GetOrderRecordList(new RB_Finance_OrderRecord { ContractId = contractId, OutTradeNo = payModel.out_trade_no, Type = 1 }).FirstOrDefault();
var userInfo = employeeModule.GetEmployeeListModule(new Model.ViewModel.User.Employee_ViewModel { Id = orderModel.EnterID, Group_Id = orderModel.Group_Id }).ToList().FirstOrDefault();
var OriginalFee = Math.Round(Convert.ToDecimal((Convert.ToDecimal(Config.SettlementRate) / 100) * (Convert.ToDecimal(payModel.amount.payer_total) / 100)), 2, MidpointRounding.AwayFromZero);//手续费
RB_Online_Trade_Detail model = new RB_Online_Trade_Detail();
......
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