|
@@ -12128,14 +12128,12 @@ ORDER by gctggrc.id DESC
|
|
|
|
|
|
bool isDepStatus = await GeneralMethod.IsMarketingStaff(dto.CurrUserId);
|
|
|
List<Grp_DelegationInfo> groupInfos = new List<Grp_DelegationInfo>();
|
|
|
- if (isDepStatus)
|
|
|
- {
|
|
|
- groupInfos = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.JietuanOperator == dto.CurrUserId).OrderByDescending(it => it.CreateUserId).ToListAsync();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- groupInfos = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0).OrderByDescending(it => it.CreateUserId).ToListAsync();
|
|
|
- }
|
|
|
+ groupInfos = _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .Where(it => it.IsDel == 0)
|
|
|
+ .WhereIF(isDepStatus, it => it.JietuanOperator == dto.CurrUserId)
|
|
|
+ .OrderByDescending(it => it.CreateUserId)
|
|
|
+ .ToList();
|
|
|
+ if (groupInfos.Count < 1) return Ok(JsonView(false,"暂无和你相关的团组信息!"));
|
|
|
|
|
|
var country = groupInfos.Select(it => it.VisitCountry).ToList();
|
|
|
var diids = groupInfos.Select(it => it.Id).ToList();
|
|
@@ -12146,23 +12144,13 @@ ORDER by gctggrc.id DESC
|
|
|
var dataArray = _groupRepository.GroupSplitCountry(data);
|
|
|
if (dataArray.Count > 0) countrys.AddRange(dataArray);
|
|
|
}
|
|
|
- countrys = countrys.Distinct().ToList();
|
|
|
-
|
|
|
- for (int i = 0; i < countrys.Count; i++)
|
|
|
- {
|
|
|
- string item = countrys[i];
|
|
|
- if (string.IsNullOrEmpty(item) || item.Contains("-"))
|
|
|
- {
|
|
|
- countrys.Remove(item);
|
|
|
- i--;
|
|
|
- }
|
|
|
- }
|
|
|
+ countrys = countrys.Where(it => !string.IsNullOrEmpty(it)).Distinct().ToList();
|
|
|
|
|
|
List<string> areaArray = new List<string>(); //GetGroupCityLine
|
|
|
-
|
|
|
- foreach (var item in diids)
|
|
|
+ var areaItem = GeneralMethod.GetGroupCityLineItem(diids, "-");
|
|
|
+ foreach (var item in areaItem)
|
|
|
{
|
|
|
- string areaStr = GeneralMethod.GetGroupCityLine(item, "-");
|
|
|
+ string areaStr = item.Value;
|
|
|
if (!string.IsNullOrEmpty(areaStr))
|
|
|
{
|
|
|
string[] str1 = areaStr.Split("-");
|
|
@@ -12175,50 +12163,24 @@ ORDER by gctggrc.id DESC
|
|
|
|
|
|
if (areaArray.Count > 0) areaArray = areaArray.Distinct().ToList();
|
|
|
|
|
|
- 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 cityDatas = _sqlSugar.Queryable<Sys_Cities>()
|
|
|
+ .Where(it => it.IsDel == 0 && areaArray.Contains(it.Name_CN))
|
|
|
+ .Select(it => new { id = it.Id, parentId = it.CountriesId, name = it.Name_CN })
|
|
|
+ .ToList();
|
|
|
|
|
|
- List<Sys_Cities> existCitys = new List<Sys_Cities>();
|
|
|
- var existCitys1 = cityDatas.Where(it => areaArray.Contains(it.Name_CN)).Select(it => new { id = it.Id, parentId = it.CountriesId, name = it.Name_CN }).ToList();
|
|
|
+ List<int> countriesIds = cityDatas.Select(it => it.parentId).ToList();
|
|
|
|
|
|
- List<int> countriesIds = existCitys1.Select(it => it.parentId).ToList();
|
|
|
+ var countriesDatas = _sqlSugar.Queryable<Sys_Countries>()
|
|
|
+ .Where(it => countriesIds.Contains(it.Id))
|
|
|
+ .Select(it => new { it.Id, Name = it.Name_CN })
|
|
|
+ .ToList();
|
|
|
|
|
|
- var countriesDatas = await _sqlSugar.Queryable<Sys_Countries>()
|
|
|
- .Where(it => countriesIds.Contains(it.Id))
|
|
|
- .Select(it => new { it.Id, Name = it.Name_CN })
|
|
|
- .ToListAsync();
|
|
|
|
|
|
- //var countryDatas = countriesDatas.Select(it => new
|
|
|
- //{
|
|
|
- // id = it.Id,
|
|
|
- // name = it.Name,
|
|
|
- // childList = existCitys.Where(it1 => it1.CountriesId == it.Id).Select(it1 => new { parentId = it1.CountriesId, id = it1.Id, name = it1.Name_CN }).ToList()
|
|
|
- //}).ToList();
|
|
|
-
|
|
|
- var teamNames = groupInfos.Select(it => it.TeamName).ToList();
|
|
|
-
|
|
|
- for (int i = 0; i < teamNames.Count; i++)
|
|
|
- {
|
|
|
- string item = teamNames[i];
|
|
|
- if (string.IsNullOrEmpty(item) || item.Contains("-"))
|
|
|
- {
|
|
|
- teamNames.Remove(item);
|
|
|
- i--;
|
|
|
- }
|
|
|
- }
|
|
|
+ var teamNames = groupInfos.Where(it => !string.IsNullOrEmpty(it.TeamName) )
|
|
|
+ .Select(it => it.TeamName).ToList();
|
|
|
|
|
|
stopwatch.Stop();
|
|
|
- return Ok(JsonView(true, $"操作成功,耗时{stopwatch.ElapsedMilliseconds} ms", new { teamNames,countriesDatas, citiesDatas = existCitys1 }));
|
|
|
+ return Ok(JsonView(true, $"操作成功,耗时{stopwatch.ElapsedMilliseconds} ms", new { teamNames,countriesDatas, citiesDatas = cityDatas }));
|
|
|
|
|
|
}
|
|
|
|
|
@@ -12371,6 +12333,10 @@ ORDER by gctggrc.id DESC
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> PostMateOpGroupPageList(MateOpGroupPageListDto dto)
|
|
|
{
|
|
|
+
|
|
|
+ var swatch = new Stopwatch();
|
|
|
+ swatch.Start();
|
|
|
+
|
|
|
#region 参数验证
|
|
|
if (dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
|
|
|
if (dto.PageId < 1) return Ok(JsonView(false, "页面Id为空"));
|
|
@@ -12403,8 +12369,8 @@ ORDER by gctggrc.id DESC
|
|
|
{
|
|
|
_view = _view.Where(x => x.TeamName != null && x.TeamName.Contains(dto.TeamName)).ToList();
|
|
|
}
|
|
|
-
|
|
|
- return Ok(JsonView(true, "查询成功!", _view.Skip(dto.PageIndex).Take(dto.PageSize).ToList(), _view.Count));
|
|
|
+ swatch.Stop();
|
|
|
+ return Ok(JsonView(true, $"查询成功!耗时 {swatch.ElapsedMilliseconds} ms", _view.Skip(dto.PageIndex).Take(dto.PageSize).ToList(), _view.Count));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -12789,6 +12755,166 @@ ORDER by gctggrc.id DESC
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
+ #region 查看邀请方
|
|
|
+ /// <summary>
|
|
|
+ /// 查看邀请方
|
|
|
+ /// 邀请方信息 Init
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostGroupLinkInvitingUnitNameInit(GroupLinkInvitingUnitNameInitDto dto)
|
|
|
+ {
|
|
|
+ string sqlWhere = string.Empty;
|
|
|
+ if (!string.IsNullOrEmpty(dto.Search))
|
|
|
+ {
|
|
|
+ sqlWhere = string.Format($@" And UnitName Like '%{dto.Search}%'");
|
|
|
+ }
|
|
|
+ string sql = string.Format($@"Select
|
|
|
+ ROW_NUMBER() Over(Order By Id desc) As Row_Number,
|
|
|
+ Id,
|
|
|
+ UnitName
|
|
|
+From Res_InvitationOfficialActivityData
|
|
|
+Where IsDel = 0
|
|
|
+And (UnitName != '' Or UnitName != null) {sqlWhere}");
|
|
|
+
|
|
|
+ RefAsync<int> total = 0;
|
|
|
+ var _views = await _sqlSugar.SqlQueryable<GroupLinkInvitingUnitNameInitView>(sql).ToPageListAsync(dto.PageIndex, dto.PageSize, total);
|
|
|
+
|
|
|
+
|
|
|
+ return Ok(JsonView(true, MsgTips.Succeed, _views, total));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 查看邀请方
|
|
|
+ /// 国家信息 Init
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostGroupLinkInvitingCountryInit(GroupLinkInvitingUnitNameInitDto dto)
|
|
|
+ {
|
|
|
+ var groupInfos = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0).OrderByDescending(it => it.CreateUserId).ToListAsync();
|
|
|
+
|
|
|
+ var country = groupInfos.Select(it => it.VisitCountry).ToList();
|
|
|
+ var diids = groupInfos.Select(it => it.Id).ToList();
|
|
|
+ List<string> countrys = new List<string>();
|
|
|
+ foreach (var item in country)
|
|
|
+ {
|
|
|
+ var data = _groupRepository.FormartTeamName(item);
|
|
|
+ var dataArray = _groupRepository.GroupSplitCountry(data);
|
|
|
+ if (dataArray.Count > 0) countrys.AddRange(dataArray);
|
|
|
+ }
|
|
|
+ countrys = countrys.Distinct().ToList();
|
|
|
+
|
|
|
+ for (int i = 0; i < countrys.Count; i++)
|
|
|
+ {
|
|
|
+ string item = countrys[i];
|
|
|
+ if (string.IsNullOrEmpty(item) || item.Contains("-"))
|
|
|
+ {
|
|
|
+ countrys.Remove(item);
|
|
|
+ i--;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ RefAsync<int> total = 0;
|
|
|
+ var countyDatas = await _sqlSugar.Queryable<Sys_Countries>()
|
|
|
+ .Where(it => countrys.Contains(it.Name_CN))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Search), it => it.Name_CN.Contains(dto.Search))
|
|
|
+ .Select(it => new { id = it.Id, name = it.Name_CN })
|
|
|
+ .ToPageListAsync(dto.PageIndex,dto.PageSize, total);
|
|
|
+
|
|
|
+ return Ok(JsonView(true, MsgTips.Succeed, countyDatas, total));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 查看邀请方
|
|
|
+ /// 城市信息 Init
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostGroupLinkInvitingCityInit(GroupLinkInvitingCityInitDto dto)
|
|
|
+ {
|
|
|
+ if (dto.CountiesId < 1) return Ok(JsonView(false, "请传入有效的国家Id"));
|
|
|
+ RefAsync<int> total = 0;
|
|
|
+ var countyDatas = await _sqlSugar.Queryable<Sys_Cities>()
|
|
|
+ .Where(it => it.CountriesId == dto.CountiesId)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Search), it => it.Name_CN.Contains(dto.Search))
|
|
|
+ .OrderBy(it => new { IsCapital = SqlFunc.Asc(it.IsCapital), Id = SqlFunc.Asc(it.Id) })
|
|
|
+ .Select(it => new { id = it.Id, name = it.Name_CN })
|
|
|
+ .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
|
|
|
+
|
|
|
+ return Ok(JsonView(true, MsgTips.Succeed, countyDatas, total));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 查看邀请方
|
|
|
+ /// 团组名称 Init
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostGroupLinkInvitingGroupInit(GroupLinkInvitingDto dto)
|
|
|
+ {
|
|
|
+ var watch = new Stopwatch();
|
|
|
+ watch.Start();
|
|
|
+ RefAsync<int> total = 0;
|
|
|
+ var countyDatas = await _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .Where(it => it.IsDel == 0)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Search), it => it.TeamName.Contains(dto.Search))
|
|
|
+ .OrderBy(it => new { JietuanTime = SqlFunc.Desc(it.JietuanTime) })
|
|
|
+ .Select(it => new { id = it.Id, name = it.TeamName })
|
|
|
+ .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
|
|
|
+ watch.Stop();
|
|
|
+
|
|
|
+ return Ok(JsonView(true, $"{MsgTips.Succeed},耗时 {watch.ElapsedMilliseconds} ms", countyDatas, total));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 查看邀请方
|
|
|
+ /// 团组 & 邀请方信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostGroupLinkInvitingPageList(GroupLinkInvitingPageListDto dto)
|
|
|
+ {
|
|
|
+ var watch = new Stopwatch();
|
|
|
+ watch.Start();
|
|
|
+ RefAsync<int> total = 0;
|
|
|
+ var infos = await _sqlSugar.Queryable<GroupLinkInvitingPageListView>()
|
|
|
+ .AS("Grp_DelegationInfo")
|
|
|
+ .Includes(x => x.InvitingInfos)
|
|
|
+ .Where(x => x.IsDel == 0)
|
|
|
+ .Where(x => x.InvitingInfos.Any(z => z.IsDel == 0))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Counrty), x => x.VisitCountry.Contains(dto.Counrty))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Area), x => x.InvitingInfos.Any(z => z.Area.Contains(dto.Area))) //TeamName
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.TeamName), x => x.TeamName.Contains(dto.TeamName)) //
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.UnitName), x => x.InvitingInfos.Any(z => z.Client.Contains(dto.UnitName)))
|
|
|
+ .OrderBy(x => new { JietuanTime = SqlFunc.Desc(x.VisitStartDate) })
|
|
|
+ .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
|
|
|
+ var userDatas = _sqlSugar.Queryable<Sys_Users>().Where(x => x.IsDel == 0).ToList();
|
|
|
+ var setDatas = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0).ToList();
|
|
|
+ infos.ForEach(x => {
|
|
|
+ x.TeamDid = setDatas.Find(y => int.Parse(x.TeamDid) == y.Id)?.Name ?? "-";
|
|
|
+ x.JietuanOperator = userDatas.Find(y => int.Parse(x.JietuanOperator) == y.Id)?.CnName ?? "-";
|
|
|
+ x.TeamLevSId = setDatas.Find(y => int.Parse(x.TeamLevSId) == y.Id)?.Name ?? "-";
|
|
|
+ });
|
|
|
+
|
|
|
+ watch.Stop();
|
|
|
+
|
|
|
+ return Ok(JsonView(true, $"{MsgTips.Succeed},耗时 {watch.ElapsedMilliseconds} ms", infos, total));
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
|
|
|
#region 报批行程
|
|
|
/// <summary>
|