|
@@ -19,6 +19,7 @@ using System.Data;
|
|
using System.Diagnostics;
|
|
using System.Diagnostics;
|
|
using static OASystem.API.OAMethodLib.JWTHelper;
|
|
using static OASystem.API.OAMethodLib.JWTHelper;
|
|
using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
|
|
using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
|
|
|
|
+using static QRCoder.PayloadGenerator.SwissQrCode;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
namespace OASystem.API.Controllers
|
|
{
|
|
{
|
|
@@ -1379,18 +1380,34 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
|
|
|
|
var ExcludedKeyStr = new string[] { "快递费" };
|
|
var ExcludedKeyStr = new string[] { "快递费" };
|
|
var ClientKeyStr = new string[] { "邀请函翻译" };
|
|
var ClientKeyStr = new string[] { "邀请函翻译" };
|
|
- var expable = Expressionable.Create<Res_InvitationOfficialActivityData>();
|
|
|
|
- foreach (var key in ClientKeyStr)
|
|
|
|
|
|
+
|
|
|
|
+ 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)
|
|
|
|
+ .Select(x => new Res_InvitationOfficialActivityData
|
|
|
|
+ {
|
|
|
|
+ Country = x.Country,
|
|
|
|
+ UnitName = x.UnitName,
|
|
|
|
+ Contact = x.Contact,
|
|
|
|
+ Field = x.Field,
|
|
|
|
+ })
|
|
|
|
+ .ToList();
|
|
|
|
+
|
|
|
|
+ foreach (var item in ExcludedKeyStr)
|
|
{
|
|
{
|
|
- expable = expable.And(it => !it.Contact.Contains(key));
|
|
|
|
|
|
+ _ioaDatas = _ioaDatas.Where(x => string.IsNullOrWhiteSpace(x.UnitName) || !x.UnitName.Contains(item)).ToList();
|
|
}
|
|
}
|
|
- foreach (var item in ExcludedKeyStr)
|
|
|
|
|
|
+
|
|
|
|
+ foreach (var item in ClientKeyStr)
|
|
{
|
|
{
|
|
- expable = expable.And(it => !it.UnitName.Contains(item));
|
|
|
|
|
|
+ _ioaDatas = _ioaDatas.Where(x => string.IsNullOrWhiteSpace(x.Contact) || !x.Contact.Contains(item)).ToList();
|
|
}
|
|
}
|
|
|
|
|
|
- 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).Where(expable.ToExpression()).ToList();
|
|
|
|
|
|
+ foreach (var item in _ioaDatas)
|
|
|
|
+ {
|
|
|
|
+ EncryptionProcessor.DecryptProperties(item);
|
|
|
|
+ }
|
|
|
|
+
|
|
List<Sys_Users> _Users = _sqlSugar.Queryable<Sys_Users>().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 _countryData = _ioaDatas.Select(it => it.Country).Distinct().ToList(); _countryData.Remove("");
|
|
@@ -1430,6 +1447,7 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
|
|
|
|
var ExcludedKeyStr = new string[] { "快递费" };
|
|
var ExcludedKeyStr = new string[] { "快递费" };
|
|
var ClientKeyStr = new string[] { "邀请函翻译" };
|
|
var ClientKeyStr = new string[] { "邀请函翻译" };
|
|
|
|
+ var columns = "Id,UnitName,Contact";
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -1442,62 +1460,133 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
string sqlWhere = string.Empty;
|
|
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))
|
|
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(dto.Country)) { columns += ",Country"; }
|
|
|
|
+ //if (!string.IsNullOrWhiteSpace(dto.UnitName)) { columns += ",UnitName"; }
|
|
|
|
+ //if (!string.IsNullOrWhiteSpace(dto.Contact)) { columns += ",Contact"; }
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(dto.Delegation)) { columns += ",Delegation"; }
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(dto.Field)) { columns += ",Field"; }
|
|
|
|
+ //if (dto.CreateUserId != 0 && !string.IsNullOrWhiteSpace(dto.CreateUserId.ToString())) { columns += ",CreateUserId"; }
|
|
|
|
+ //if (!string.IsNullOrWhiteSpace(dto.StartCreateTime) && !string.IsNullOrWhiteSpace(dto.EndCreateTime))
|
|
|
|
+ //{
|
|
|
|
+ // columns += ",CreateUserId";
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ DateTime endTime = new DateTime();
|
|
|
|
+ var InvitationOfficialActivityDataList = _sqlSugar.Queryable<Res_InvitationOfficialActivityData>()
|
|
|
|
+ .Where(x => x.IsDel == 0)
|
|
|
|
+ .WhereIF(dto.CreateUserId != 0 && !string.IsNullOrWhiteSpace(dto.CreateUserId.ToString()), x => x.CreateUserId == dto.CreateUserId)
|
|
|
|
+ .WhereIF(DateTime.TryParse(dto.StartCreateTime , out DateTime startTime) && DateTime.TryParse(dto.EndCreateTime, out endTime), x => x.CreateTime >= startTime && x.CreateTime <= endTime )
|
|
|
|
+ .Select(columns)
|
|
|
|
+ .ToList();
|
|
|
|
+
|
|
|
|
+ foreach (var item in InvitationOfficialActivityDataList)
|
|
{
|
|
{
|
|
- sqlWhere += string.Format(@" And i.CreateTime between '{0}' and '{1}'", dto.StartCreateTime, dto.EndCreateTime);
|
|
|
|
|
|
+ EncryptionProcessor.DecryptProperties(item);
|
|
}
|
|
}
|
|
- sqlWhere += string.Format(@"And i.Isdel={0}", 0);
|
|
|
|
|
|
+ InvitationOfficialActivityDataList = InvitationOfficialActivityDataList.WhereIF(!string.IsNullOrWhiteSpace(dto.Country), x => !string.IsNullOrWhiteSpace(x.Country) && x.Country.Contains(dto.Country))
|
|
|
|
+ .WhereIF(!string.IsNullOrWhiteSpace(dto.UnitName), x => !string.IsNullOrWhiteSpace(x.UnitName) && x.UnitName.Contains(dto.UnitName))
|
|
|
|
+ .WhereIF(!string.IsNullOrWhiteSpace(dto.Contact), x => !string.IsNullOrWhiteSpace(x.Contact) && x.Contact.Contains(dto.Contact))
|
|
|
|
+ .WhereIF(!string.IsNullOrWhiteSpace(dto.Delegation), x => !string.IsNullOrWhiteSpace(x.Delegation) && x.Delegation.Contains(dto.Delegation))
|
|
|
|
+ .WhereIF(!string.IsNullOrWhiteSpace(dto.Field), x => !string.IsNullOrWhiteSpace(x.Field) && x.Field.Contains(dto.Field))
|
|
|
|
+ .ToList();
|
|
|
|
|
|
foreach (var item in ExcludedKeyStr)
|
|
foreach (var item in ExcludedKeyStr)
|
|
{
|
|
{
|
|
- sqlWhere += $" And i.UnitName not like '%{item}%' ";
|
|
|
|
|
|
+ InvitationOfficialActivityDataList = InvitationOfficialActivityDataList.Where(x => string.IsNullOrWhiteSpace(x.UnitName) || !x.UnitName.Contains(item)).ToList();
|
|
|
|
+ //sqlWhere += $" And i.UnitName not like '%{item}%' ";
|
|
}
|
|
}
|
|
|
|
|
|
foreach (var item in ClientKeyStr)
|
|
foreach (var item in ClientKeyStr)
|
|
{
|
|
{
|
|
- sqlWhere += $" And i.Contact not like '%{item}%' ";
|
|
|
|
|
|
+ InvitationOfficialActivityDataList = InvitationOfficialActivityDataList.Where(x => string.IsNullOrWhiteSpace(x.Contact) || !x.Contact.Contains(item)).ToList();
|
|
|
|
+ //sqlWhere += $" And i.Contact not like '%{item}%' ";
|
|
}
|
|
}
|
|
|
|
|
|
- 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);
|
|
|
|
|
|
+
|
|
|
|
+ var ids = InvitationOfficialActivityDataList.Select(x => x.Id);
|
|
|
|
|
|
RefAsync<int> totalCount = 0;
|
|
RefAsync<int> totalCount = 0;
|
|
|
|
|
|
- var _ivitiesViews = await _sqlSugar.SqlQueryable<InvitationOfficialActivityDataView>(sql).ToPageListAsync(dto.PageIndex, dto.PageSize, totalCount);
|
|
|
|
|
|
+ var _ivitiesViews = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>()
|
|
|
|
+ .LeftJoin<Sys_Users>((a, b) => b.IsDel == 0 && a.CreateUserId == b.Id)
|
|
|
|
+ .Where((a, b) => ids.Contains(a.Id))
|
|
|
|
+ .OrderByDescending((a, b) => a.CreateTime)
|
|
|
|
+ .Select((a, b) => new InvitationOfficialActivityDataView
|
|
|
|
+ {
|
|
|
|
+ FaceBook = a.FaceBook,
|
|
|
|
+ Id = a.Id,
|
|
|
|
+ CreateUserId = a.CreateUserId,
|
|
|
|
+ IsDel = 0,
|
|
|
|
+ Address = a.Address,
|
|
|
|
+ Background = a.Background,
|
|
|
|
+ City = a.City,
|
|
|
|
+ Contact = a.Contact,
|
|
|
|
+ Country = a.Country,
|
|
|
|
+ CreateTime = a.CreateTime,
|
|
|
|
+ CreateUserName = b.CnName,
|
|
|
|
+ Delegation = a.Delegation,
|
|
|
|
+ Email = a.Email,
|
|
|
|
+ Fax = a.Fax,
|
|
|
|
+ Field = a.Field,
|
|
|
|
+ FilePath = a.FilePath,
|
|
|
|
+ Ins = a.Ins,
|
|
|
|
+ WeChat = a.WeChat,
|
|
|
|
+ UnitWeb = a.UnitWeb,
|
|
|
|
+ UnitName = a.UnitName,
|
|
|
|
+ UnitInfo = a.UnitInfo,
|
|
|
|
+ Tel = a.Tel,
|
|
|
|
+ SndFilePath = a.SndFilePath,
|
|
|
|
+ SndFileName = a.SndFileName,
|
|
|
|
+ Remark = a.Remark,
|
|
|
|
+ OtherInfo = a.OtherInfo,
|
|
|
|
+ Job = a.Job
|
|
|
|
+ })
|
|
|
|
+ .ToPageListAsync(dto.PageIndex, dto.PageSize, totalCount);
|
|
|
|
+
|
|
|
|
+ var allGroupIds = new HashSet<int>();
|
|
|
|
+ foreach (var item in _ivitiesViews)
|
|
|
|
+ {
|
|
|
|
+ EncryptionProcessor.DecryptProperties(item);
|
|
|
|
|
|
- //List<Grp_DelegationInfo> _DelegationInfos = _sqlSugar.Queryable<Grp_DelegationInfo>().ToList();
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty(item.Delegation))
|
|
|
|
+ {
|
|
|
|
+ allGroupIds.UnionWith(item.Delegation.Split(',').Select(x =>
|
|
|
|
+ {
|
|
|
|
+ int id;
|
|
|
|
+ if (int.TryParse(x, out id)) return id;
|
|
|
|
+ return 0;
|
|
|
|
+ }).Where(id => id != 0));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var _DelegationInfos = _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
|
+ .Where(x => allGroupIds.Contains(x.Id) && x.IsDel == 0)
|
|
|
|
+ .ToList()
|
|
|
|
+ .GroupBy(x => x.Id)
|
|
|
|
+ .ToDictionary(group => group.Key, group => group.Select(g => g.TeamName));
|
|
|
|
|
|
foreach (var item in _ivitiesViews)
|
|
foreach (var item in _ivitiesViews)
|
|
{
|
|
{
|
|
string groupNameStr = "";
|
|
string groupNameStr = "";
|
|
if (!string.IsNullOrEmpty(item.Delegation))
|
|
if (!string.IsNullOrEmpty(item.Delegation))
|
|
{
|
|
{
|
|
- int[] groupIds = item.Delegation.Split(',').Select(x =>
|
|
|
|
|
|
+ var groupIds = item.Delegation.Split(',').Select(x =>
|
|
{
|
|
{
|
|
int id;
|
|
int id;
|
|
if (int.TryParse(x, out id)) return id;
|
|
if (int.TryParse(x, out id)) return id;
|
|
- else return id;
|
|
|
|
- }).ToArray();
|
|
|
|
|
|
+ return 0;
|
|
|
|
+ })
|
|
|
|
+ .Where(id => id != 0)
|
|
|
|
+ .ToArray();
|
|
|
|
|
|
- var _DelegationInfos = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(x => groupIds.Contains(x.Id) && x.IsDel == 0).ToList();
|
|
|
|
- foreach (var group in _DelegationInfos)
|
|
|
|
|
|
+ foreach (var id in groupIds)
|
|
{
|
|
{
|
|
- groupNameStr += $"{group.TeamName},";
|
|
|
|
|
|
+ if (_DelegationInfos.ContainsKey(id))
|
|
|
|
+ {
|
|
|
|
+ groupNameStr += string.Join("", _DelegationInfos[id]) + ",";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
if (groupNameStr.Length > 1)
|
|
if (groupNameStr.Length > 1)
|
|
{
|
|
{
|
|
groupNameStr = groupNameStr.Substring(0, groupNameStr.Length - 1);
|
|
groupNameStr = groupNameStr.Substring(0, groupNameStr.Length - 1);
|
|
@@ -1514,7 +1603,39 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
return Ok(JsonView(false, ex.Message));
|
|
return Ok(JsonView(false, ex.Message));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ //[HttpPost]
|
|
|
|
+ //public IActionResult EncipherInvitationOfficialActivityData()
|
|
|
|
+ //{
|
|
|
|
+
|
|
|
|
+ // var jw = JsonView(false);
|
|
|
|
+ // var List_DB = _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().ToList();
|
|
|
|
+ // try
|
|
|
|
+ // {
|
|
|
|
+ // //foreach (var item in List_DB)
|
|
|
|
+ // //{
|
|
|
|
+ // // EncryptionProcessor.DecryptProperties(item);
|
|
|
|
+ // //}
|
|
|
|
+
|
|
|
|
+ // _sqlSugar.BeginTran();
|
|
|
|
+ // foreach (var item in List_DB)
|
|
|
|
+ // {
|
|
|
|
+ // EncryptionProcessor.EncryptProperties(item);
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // var updateRow = _sqlSugar.Updateable<Res_InvitationOfficialActivityData>(List_DB).ExecuteCommand();
|
|
|
|
+ // jw = JsonView(true, "success", "修改行数:" + updateRow);
|
|
|
|
+ // _sqlSugar.CommitTran();
|
|
|
|
+ // }
|
|
|
|
+ // catch (Exception ex)
|
|
|
|
+ // {
|
|
|
|
+ // _sqlSugar.RollbackTran();
|
|
|
|
+ // jw.Msg = ex.Message;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // return Ok(jw);
|
|
|
|
+ //}
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 根据商邀资料Id查询信息
|
|
/// 根据商邀资料Id查询信息
|
|
/// </summary>
|
|
/// </summary>
|