|
@@ -14,6 +14,7 @@ using System.Threading.Tasks;
|
|
|
using Azure;
|
|
|
using Azure.Cosmos;
|
|
|
using Azure.Storage.Sas;
|
|
|
+using DocumentFormat.OpenXml.Drawing.Charts;
|
|
|
using HTEXLib.COMM.Helpers;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
|
|
@@ -68,6 +69,8 @@ namespace TEAMModelOS.Controllers
|
|
|
#endif
|
|
|
public async Task<IActionResult> Statistics(JsonElement json)
|
|
|
{
|
|
|
+ json.TryGetProperty("periodId", out JsonElement _periodId);
|
|
|
+ json.TryGetProperty("periodType", out JsonElement _periodType);
|
|
|
if (!json.TryGetProperty("scope", out JsonElement _scope))
|
|
|
{
|
|
|
return BadRequest();
|
|
@@ -76,16 +79,26 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
return BadRequest();
|
|
|
}
|
|
|
- List<IdNameCode> schools= new List<IdNameCode>();
|
|
|
+ List<School> schools= new List<School>();
|
|
|
List<Elegant> elegants = new List<Elegant>();
|
|
|
+ IEnumerable<string> periodIds = new List<string>();
|
|
|
if ($"{_scope}".Equals("area"))
|
|
|
{
|
|
|
- string sql = $"select c.name ,c.picture, c.id from c where c.areaId ='{_code}'";
|
|
|
- var result = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).GetList<IdNameCode>(sql, "Base");
|
|
|
+ string sql = $"select value c from c where c.areaId ='{_code}'";
|
|
|
+ var result = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).GetList<School>(sql, "Base");
|
|
|
if (result.list.IsNotEmpty())
|
|
|
{
|
|
|
+ string sqlPeriod = string.Empty;
|
|
|
+ if (!string.IsNullOrWhiteSpace($"{_periodType}")) {
|
|
|
+ periodIds = result.list.SelectMany(x => x.period).Where(z => !string.IsNullOrWhiteSpace(z.periodType) && z.periodType.Equals($"{_periodType}")).Select(x => x.id);
|
|
|
+ if (periodIds!=null && periodIds.Count()>0)
|
|
|
+ {
|
|
|
+ sqlPeriod=$" and c.periodId in ({string.Join(",",periodIds.Select(x=>$"'{x}'"))})";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
schools.AddRange(result.list);
|
|
|
- string sqlE = $"select value c from c where c.school in ({string.Join(",", result.list.Select(z => $"'{z.id}'"))}) and c.pk='Elegant' and contains(c.code,'Elegant-')";
|
|
|
+ string sqlE = $"select value c from c where c.school in ({string.Join(",", result.list.Select(z => $"'{z.id}'"))}) {sqlPeriod} and c.pk='Elegant' and contains(c.code,'Elegant-')";
|
|
|
var resultE = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).GetList<Elegant>(sqlE);
|
|
|
if (resultE.list.IsNotEmpty())
|
|
|
{
|
|
@@ -96,6 +109,9 @@ namespace TEAMModelOS.Controllers
|
|
|
else if ($"{_scope}".Equals("school"))
|
|
|
{
|
|
|
string sqlE = $"select value c from c ";
|
|
|
+ if (!string.IsNullOrWhiteSpace($"{_periodId}")) {
|
|
|
+ sqlE=$"{sqlE} where c.periodId='{_periodId}'";
|
|
|
+ }
|
|
|
var resultE = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).GetList<Elegant>(sqlE,$"Elegant-{_code}");
|
|
|
if (resultE.list.IsNotEmpty())
|
|
|
{
|
|
@@ -105,6 +121,17 @@ namespace TEAMModelOS.Controllers
|
|
|
List<ClassifiedItemSchool > schoolDatas= new List<ClassifiedItemSchool>();
|
|
|
if (schools.IsNotEmpty()) {
|
|
|
foreach (var school in schools) {
|
|
|
+ if (periodIds.Count()>0) {
|
|
|
+ bool has = false;
|
|
|
+ foreach (var period in school.period) {
|
|
|
+ if (periodIds.Contains(period.id)) {
|
|
|
+ has=true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!has) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
var esSchool = elegants.FindAll(z => z.school.Equals(school.id));
|
|
|
List<ClassifiedItem> itemschool = ClassifyHierarchy(esSchool);
|
|
|
if (!itemschool.Select(z => z.id).Contains("德育风采"))
|