|
@@ -1,10 +1,12 @@
|
|
-using System;
|
|
|
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
|
+using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
using TEAMModelOS.Model.Syllabus.Dtos;
|
|
using TEAMModelOS.Model.Syllabus.Dtos;
|
|
using TEAMModelOS.Model.Syllabus.Models;
|
|
using TEAMModelOS.Model.Syllabus.Models;
|
|
using TEAMModelOS.SDK.Context.Exception;
|
|
using TEAMModelOS.SDK.Context.Exception;
|
|
|
|
+using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
|
|
using TEAMModelOS.SDK.Helper.Common.JsonHelper;
|
|
using TEAMModelOS.SDK.Helper.Common.JsonHelper;
|
|
using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
|
|
using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
|
|
using TEAMModelOS.Service.Syllabus.Interfaces;
|
|
using TEAMModelOS.Service.Syllabus.Interfaces;
|
|
@@ -14,9 +16,11 @@ namespace TEAMModelOS.Service.Syllabus.Implements
|
|
public class SyllabusService : ISyllabusService
|
|
public class SyllabusService : ISyllabusService
|
|
{
|
|
{
|
|
|
|
|
|
- IAzureTableDBRepository _azureTableDBRepository;
|
|
|
|
- public SyllabusService(IAzureTableDBRepository azureTableDBRepository) {
|
|
|
|
|
|
+ private IAzureTableDBRepository _azureTableDBRepository;
|
|
|
|
+ private IHttpContextAccessor _httpContextAccessor;
|
|
|
|
+ public SyllabusService(IAzureTableDBRepository azureTableDBRepository , IHttpContextAccessor httpContextAccessor) {
|
|
_azureTableDBRepository = azureTableDBRepository;
|
|
_azureTableDBRepository = azureTableDBRepository;
|
|
|
|
+ _httpContextAccessor = httpContextAccessor;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -122,6 +126,9 @@ namespace TEAMModelOS.Service.Syllabus.Implements
|
|
/// <param name="params"></param>
|
|
/// <param name="params"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
public async Task<StandardTextbook> FindTextbooksByDict(Dictionary<string, object> dict) {
|
|
public async Task<StandardTextbook> FindTextbooksByDict(Dictionary<string, object> dict) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
Dictionary<string, object> parDict = new Dictionary<string, object>
|
|
Dictionary<string, object> parDict = new Dictionary<string, object>
|
|
{
|
|
{
|
|
{ "Period", dict["Period"] },
|
|
{ "Period", dict["Period"] },
|
|
@@ -146,12 +153,13 @@ namespace TEAMModelOS.Service.Syllabus.Implements
|
|
else
|
|
else
|
|
{
|
|
{
|
|
// 校验 几个Code 是否存在
|
|
// 校验 几个Code 是否存在
|
|
|
|
+ string RowKey = "RowKey";
|
|
StandardTextbook textbook = dict.DictToObj<StandardTextbook>();
|
|
StandardTextbook textbook = dict.DictToObj<StandardTextbook>();
|
|
- List<Period> periods= await FindPeriodsByDict(new Dictionary<string, object> { { "RowKey", textbook.Period} });
|
|
|
|
- List<PeriodSubject> subjects = await FindSubjectsByDict(new Dictionary<string, object> { { "RowKey", textbook.Subject } });
|
|
|
|
- List<PeriodSubjectEdition> editions = await FindEditionsByDict(new Dictionary<string, object> { { "RowKey", textbook.Edition } });
|
|
|
|
- List<PeriodSubjectEditionTerm> terms = await FindTermsByDict(new Dictionary<string, object> { { "RowKey", textbook.Term } });
|
|
|
|
- if (periods != null && subjects != null && editions != null && terms != null && periods.Count > 0 && subjects.Count > 0 && editions.Count > 0 && terms.Count > 0)
|
|
|
|
|
|
+ List<Period> periods= await FindPeriodsByDict(new Dictionary<string, object> { { RowKey, textbook.Period} });
|
|
|
|
+ List<PeriodSubject> subjects = await FindSubjectsByDict(new Dictionary<string, object> { { RowKey, textbook.Subject } });
|
|
|
|
+ List<PeriodSubjectEdition> editions = await FindEditionsByDict(new Dictionary<string, object> { { RowKey, textbook.Edition } });
|
|
|
|
+ List<PeriodSubjectEditionTerm> terms = await FindTermsByDict(new Dictionary<string, object> { { RowKey, textbook.Term } });
|
|
|
|
+ if (periods.IsNotEmpty()&& subjects.IsNotEmpty()&& editions.IsNotEmpty()&& terms.IsNotEmpty())
|
|
{
|
|
{
|
|
textbook.RowKey = Guid.NewGuid().ToString();
|
|
textbook.RowKey = Guid.NewGuid().ToString();
|
|
textbook.PartitionKey = Guid.NewGuid().ToString();
|
|
textbook.PartitionKey = Guid.NewGuid().ToString();
|