|
@@ -86,6 +86,8 @@ using NPOI.SS.Util;
|
|
|
using RestSharp.Extensions;
|
|
|
using Microsoft.AspNetCore.WebUtilities;
|
|
|
using K4os.Compression.LZ4.Internal;
|
|
|
+using static Pipelines.Sockets.Unofficial.SocketConnection;
|
|
|
+using System.Diagnostics.PerformanceData;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -12120,6 +12122,8 @@ ORDER by gctggrc.id DESC
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> PostMateOpGroupInit(MateOpGroupInitDto dto)
|
|
|
{
|
|
|
+ Stopwatch stopwatch = Stopwatch.StartNew(); // 创建并启动Stopwatch
|
|
|
+
|
|
|
if (dto.CurrUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
|
|
|
|
|
|
bool isDepStatus = await GeneralMethod.IsMarketingStaff(dto.CurrUserId);
|
|
@@ -12133,7 +12137,6 @@ ORDER by gctggrc.id DESC
|
|
|
groupInfos = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0).OrderByDescending(it => it.CreateUserId).ToListAsync();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
var country = groupInfos.Select(it => it.VisitCountry).ToList();
|
|
|
List<string> countrys = new List<string>();
|
|
|
foreach (var item in country)
|
|
@@ -12154,6 +12157,20 @@ ORDER by gctggrc.id DESC
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ List<dynamic> countryDatas = new List<dynamic>();
|
|
|
+ var countries1 = await _sqlSugar.Queryable<Sys_Countries>().Select(it => new { it.Id, Name = it.Name_CN }).ToListAsync();
|
|
|
+
|
|
|
+ List<dynamic> countries = new List<dynamic>();
|
|
|
+ foreach (var item in countrys)
|
|
|
+ {
|
|
|
+ var countryInfo = countries1.Find(it => it.Name.Contains(item));
|
|
|
+ if (countryInfo != null)
|
|
|
+ {
|
|
|
+ countries.Add(countryInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var teamNames = groupInfos.Select(it => it.TeamName).ToList();
|
|
|
|
|
|
for (int i = 0; i < teamNames.Count; i++)
|
|
@@ -12165,10 +12182,156 @@ ORDER by gctggrc.id DESC
|
|
|
i--;
|
|
|
}
|
|
|
}
|
|
|
- return Ok(JsonView(true, "操作成功", new { countryDatas = countrys, teamNameDatas = teamNames }));
|
|
|
+
|
|
|
+ stopwatch.Stop();
|
|
|
+ return Ok(JsonView(true, $"操作成功,耗时{stopwatch.ElapsedMilliseconds} ms", new { countryDatas = countries, teamNameDatas = teamNames }));
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 匹配op行程单
|
|
|
+ /// Init 查询区域数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto">团组列表请求dto</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostMateOpGroupCountryChangeData(MateOpGroupCountryChangeDataDto dto)
|
|
|
+ {
|
|
|
+ Stopwatch stopwatch = Stopwatch.StartNew(); // 创建并启动Stopwatch
|
|
|
+
|
|
|
+ List<Sys_Cities> cityDatas = new List<Sys_Cities>();
|
|
|
+ string countriesDataStr = await RedisRepository.RedisFactory.CreateRedisRepository().StringGetAsync<string>("CityDatas");//string 取
|
|
|
+ if (string.IsNullOrEmpty(countriesDataStr))
|
|
|
+ {
|
|
|
+ cityDatas = await _sqlSugar.Queryable<Sys_Cities>().Where(it => it.IsDel == 0).ToListAsync();
|
|
|
+ TimeSpan ts = DateTime.Now.AddHours(2).TimeOfDay; //设置redis 过期时间 2
|
|
|
+ await RedisRepository.RedisFactory.CreateRedisRepository().StringSetAsync<string>("CountriesDatas", JsonConvert.SerializeObject(cityDatas), ts);//string 存
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cityDatas = JsonConvert.DeserializeObject<List<Sys_Cities>>(countriesDataStr);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ var provinceData = cityDatas.Where(it => it.CountriesId == dto.CountriesId && it.Level == 1).ToList();
|
|
|
+ var citiesData = cityDatas.Where(it => it.CountriesId == dto.CountriesId && it.Level == 2).ToList();
|
|
|
+ var countiesData = cityDatas.Where(it => it.CountriesId == dto.CountriesId && it.Level == 3).ToList();
|
|
|
+
|
|
|
+ List<dynamic> childList = new List<dynamic>();
|
|
|
+ int parentId = dto.CountriesId;
|
|
|
+ if (provinceData.Count > 1)
|
|
|
+ {
|
|
|
+ foreach (var item1 in provinceData)
|
|
|
+ {
|
|
|
+ List<dynamic> childList1 = new List<dynamic>();
|
|
|
+ var citiesData1 = citiesData.Where(it => it.ParentId == item1.Id).ToList();
|
|
|
+ foreach (var item2 in citiesData1)
|
|
|
+ {
|
|
|
+
|
|
|
+ List<dynamic> childList2 = new List<dynamic>();
|
|
|
+
|
|
|
+ var countiesData1 = countiesData.Where(it => it.ParentId == item2.Id).ToList();
|
|
|
+ foreach (var item3 in countiesData1)
|
|
|
+ {
|
|
|
+ childList2.Add(new
|
|
|
+ {
|
|
|
+
|
|
|
+ id = item3.Id,
|
|
|
+ parentId = item2.Id,
|
|
|
+ level = "district",
|
|
|
+ name = item3.Name_CN,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ childList1.Add(new
|
|
|
+ {
|
|
|
+ id = item2.Id,
|
|
|
+ parentId = item1.Id,
|
|
|
+ level = "city",
|
|
|
+ name = item2.Name_CN,
|
|
|
+ childList = childList2
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ childList.Add(new
|
|
|
+ {
|
|
|
+ id = item1.Id,
|
|
|
+ parentId = parentId,
|
|
|
+ level = "province",
|
|
|
+ name = item1.Name_CN,
|
|
|
+ childList = childList1
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //城市
|
|
|
+ var citiesData2 = citiesData.Where(it => it.ParentId == 0).ToList();
|
|
|
+ foreach (var item2 in citiesData2)
|
|
|
+ {
|
|
|
+ List<dynamic> childList22 = new List<dynamic>();
|
|
|
+
|
|
|
+ var countiesData1 = countiesData.Where(it => it.ParentId == item2.Id).ToList();
|
|
|
+ foreach (var item3 in countiesData1)
|
|
|
+ {
|
|
|
+ childList22.Add(new
|
|
|
+ {
|
|
|
+
|
|
|
+ id = item3.Id,
|
|
|
+ parentId = item2.Id,
|
|
|
+ level = "district",
|
|
|
+ name = item3.Name_CN,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ childList.Add(new
|
|
|
+ {
|
|
|
+ id = item2.Id,
|
|
|
+ parentId = parentId,
|
|
|
+ level = "city",
|
|
|
+ name = item2.Name_CN,
|
|
|
+ childList = childList22
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ foreach (var item2 in citiesData)
|
|
|
+ {
|
|
|
+ string cname = item2.Name_CN;
|
|
|
+ List<dynamic> childList1 = new List<dynamic>();
|
|
|
+ var countiesData1 = countiesData.Where(it => it.ParentId == item2.Id).ToList();
|
|
|
+ foreach (var item3 in countiesData1)
|
|
|
+ {
|
|
|
+ childList1.Add(new
|
|
|
+ {
|
|
|
+ Id = item3.Id,
|
|
|
+ parentId = item2.Id,
|
|
|
+ level = "district",
|
|
|
+ name = item3.Name_CN
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ childList.Add(new
|
|
|
+ {
|
|
|
+ id = item2.Id,
|
|
|
+ parentId = parentId,
|
|
|
+ level = "city",
|
|
|
+ name = item2.Name_CN,
|
|
|
+ childList = childList1
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ stopwatch.Stop();
|
|
|
+ return Ok(JsonView(true, $"操作成功,耗时{stopwatch.ElapsedMilliseconds} ms", childList));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 匹配op行程单
|
|
|
/// 接团信息列表 Page
|
|
@@ -12301,6 +12464,43 @@ ORDER by gctggrc.id DESC
|
|
|
#endregion
|
|
|
|
|
|
#region 国家信息 数据 注释
|
|
|
+
|
|
|
+ //[HttpPost]
|
|
|
+ //public async Task<IActionResult> LoadCitiesInitData(List<int> dto)
|
|
|
+ //{
|
|
|
+ // List<Grp_GroupsTaskAssignment> infos = new List<Grp_GroupsTaskAssignment>();
|
|
|
+
|
|
|
+ // foreach (var item in dto)
|
|
|
+ // {
|
|
|
+ // infos.Add(new Grp_GroupsTaskAssignment()
|
|
|
+ // {
|
|
|
+ // DIId = item,
|
|
|
+ // CTId = 82,
|
|
|
+ // UId = 248,
|
|
|
+ // IsEnable = 1,
|
|
|
+ // CreateUserId = 233,
|
|
|
+ // CreateTime = DateTime.Now,
|
|
|
+ // IsDel = 0
|
|
|
+
|
|
|
+ // });
|
|
|
+ // infos.Add(new Grp_GroupsTaskAssignment()
|
|
|
+ // {
|
|
|
+ // DIId = item,
|
|
|
+ // CTId = 82,
|
|
|
+ // UId = 286,
|
|
|
+ // IsEnable = 1,
|
|
|
+ // CreateUserId = 233,
|
|
|
+ // CreateTime = DateTime.Now,
|
|
|
+ // IsDel = 0
|
|
|
+
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+
|
|
|
+ // int add = _sqlSugar.Insertable<Grp_GroupsTaskAssignment>(infos).ExecuteCommand();
|
|
|
+
|
|
|
+ // return Ok("操作成功");
|
|
|
+ //}
|
|
|
+
|
|
|
//public class paramJsonDto
|
|
|
//{
|
|
|
// public List<CountriesInfo> str { get; set; }
|