|
@@ -6,7 +6,9 @@ using OASystem.Infrastructure.Repositories.Groups;
|
|
|
using Org.BouncyCastle.Utilities;
|
|
|
using Quartz.Util;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Diagnostics;
|
|
|
using System.Net.Http.Headers;
|
|
|
+using static QRCoder.PayloadGenerator.SwissQrCode;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -1366,6 +1368,53 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
|
#endregion
|
|
|
|
|
|
#region 商邀资料
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 商邀资料 基础数据源
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> QueryIOAInitData(QueryIOAInitDataDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ #region 参数验证
|
|
|
+
|
|
|
+ if (dto.PortType < 1) return Ok(JsonView(false, "请传入有效的PortType参数!"));
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ List<Grp_DelegationInfo> _DelegationInfos = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0).OrderByDescending(it => it.JietuanTime).ToList();
|
|
|
+ List<Res_InvitationOfficialActivityData> _ioaDatas = _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().Where(it => it.IsDel == 0).ToList();
|
|
|
+ List<Sys_Users> _Users = _sqlSugar.Queryable<Sys_Users>().Where(it => it.IsDel == 0).ToList();
|
|
|
+
|
|
|
+ var _countryData = _ioaDatas.Select(it => it.Country).Distinct().ToList(); _countryData.Remove("");
|
|
|
+ var _inviterData = _ioaDatas.Select(it => it.UnitName).Distinct().ToList(); _inviterData.Remove("");
|
|
|
+ var _contactData = _ioaDatas.Select(it => it.Contact).Distinct().ToList(); _contactData.Remove("");
|
|
|
+ var _domainData = _ioaDatas.Select(it => it.Field).Distinct().ToList(); _domainData.Remove("");
|
|
|
+ var _groupNameData = _DelegationInfos.Select(it => new { it.Id, it.TeamName }).ToList();
|
|
|
+ var _userNameData = _Users.Select(it => new { it.Id, it.CnName }).ToList();
|
|
|
+
|
|
|
+ var _data = new {
|
|
|
+ CountryData = _countryData,
|
|
|
+ InviterData = _inviterData,
|
|
|
+ DomainData = _domainData,
|
|
|
+ ContactData = _contactData,
|
|
|
+ GroupNameData = _groupNameData,
|
|
|
+ UserNameData = _userNameData,
|
|
|
+ };
|
|
|
+
|
|
|
+ return Ok(JsonView(true, $"查询成功!", _data));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, ex.Message));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 商邀资料查询
|
|
|
/// </summary>
|
|
@@ -1377,17 +1426,63 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- Result groupData = await _InvitationOfficialActivityDataRep.QueryInvitationOfficialActivityData(dto);
|
|
|
- if (groupData.Code != 0)
|
|
|
+ #region 参数验证
|
|
|
+
|
|
|
+ if (dto.PageIndex < 1) return Ok(JsonView(false, "请传入有效的PageIndex参数!"));
|
|
|
+
|
|
|
+ if (dto.PageSize < 1) return Ok(JsonView(false, "请传入有效的PageSize参数!"));
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ string sqlWhere = string.Empty;
|
|
|
+ if (!string.IsNullOrWhiteSpace(dto.Country)) { sqlWhere += string.Format(@" And i.Country like '%{0}%'", dto.Country); }
|
|
|
+ if (!string.IsNullOrWhiteSpace(dto.UnitName)) { sqlWhere += string.Format(@" And i.UnitName like '%{0}%'", dto.UnitName); }
|
|
|
+ if (!string.IsNullOrWhiteSpace(dto.Contact)) { sqlWhere += string.Format(@" And i.Contact like '%{0}%'", dto.Contact); }
|
|
|
+ if (!string.IsNullOrWhiteSpace(dto.Delegation)) { sqlWhere += string.Format(@" And i.Delegation like '%{0}%'", dto.Delegation); }
|
|
|
+ if (!string.IsNullOrWhiteSpace(dto.Field)) { sqlWhere += string.Format(@" And i.Field like '%{0}%'", dto.Field); }
|
|
|
+
|
|
|
+ if (dto.CreateUserId != 0 && !string.IsNullOrWhiteSpace(dto.CreateUserId.ToString())) { sqlWhere += string.Format(@" And i.CreateUserId={0}", dto.CreateUserId); }
|
|
|
+ if (!string.IsNullOrWhiteSpace(dto.StartCreateTime) && !string.IsNullOrWhiteSpace(dto.EndCreateTime))
|
|
|
{
|
|
|
- return Ok(JsonView(false, groupData.Msg));
|
|
|
+ sqlWhere += string.Format(@" And i.CreateTime between '{0}' and '{1}'", dto.StartCreateTime, dto.EndCreateTime);
|
|
|
}
|
|
|
- return Ok(JsonView(true, groupData.Msg, groupData.Data));
|
|
|
+ sqlWhere += string.Format(@"And i.Isdel={0}", 0);
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(sqlWhere.Trim()))
|
|
|
+ {
|
|
|
+ Regex r = new Regex("And");
|
|
|
+ sqlWhere = r.Replace(sqlWhere, "Where", 1);
|
|
|
+ }
|
|
|
+ string sql = string.Format(@"Select ROW_NUMBER() Over(Order By i.CreateTime Desc) As Row_Number,
|
|
|
+ i.*,u.CnName As CreateUserName
|
|
|
+ From Res_InvitationOfficialActivityData i
|
|
|
+ Left Join Sys_Users u On i.CreateUserId = u.Id {0}", sqlWhere);
|
|
|
+
|
|
|
+ int totalCount = 0;
|
|
|
+
|
|
|
+ List<InvitationOfficialActivityDataView> _ivitiesViews = _sqlSugar.SqlQueryable<InvitationOfficialActivityDataView>(sql).ToPageList(dto.PageIndex, dto.PageSize, ref totalCount);
|
|
|
+
|
|
|
+ List<Grp_DelegationInfo> _DelegationInfos = _sqlSugar.Queryable<Grp_DelegationInfo>().ToList();
|
|
|
+
|
|
|
+ foreach (var item in _ivitiesViews)
|
|
|
+ {
|
|
|
+ string delegationNameList = "";
|
|
|
+ string[] DelegationName = item.Delegation.Split(',');
|
|
|
+ for (int i = 0; i < DelegationName.Length; i++)
|
|
|
+ {
|
|
|
+ delegationNameList += _DelegationInfos.Find(it => it.Id == int.Parse(DelegationName[i]))?.TeamName ?? "Unknown" + ",";
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrWhiteSpace(delegationNameList))
|
|
|
+ {
|
|
|
+ item.DelegationStr = delegationNameList.Substring(0, delegationNameList.Length - 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(JsonView(true, $"查询成功!", _ivitiesViews, totalCount));
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- return Ok(JsonView(false, "程序错误!"));
|
|
|
- throw;
|
|
|
+ return Ok(JsonView(false, ex.Message));
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|