1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192 |
- using OASystem.Domain.Dtos.Groups;
- using OASystem.Domain.Entities.Financial;
- using OASystem.Domain.Entities.Groups;
- using OASystem.Domain.ViewModels.CRM;
- using OASystem.Domain.ViewModels.Groups;
- using OASystem.Domain.ViewModels.QiYeWeChat;
- using OASystem.Infrastructure.Repositories.Groups;
- namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
- {
- public static class AppNoticeLibrary
- {
- private static readonly IQiYeWeChatApiService _qiYeWeChatApiService = AutofacIocManager.Instance.GetService<IQiYeWeChatApiService>();
- private static readonly DelegationInfoRepository _grpDeleRep = AutofacIocManager.Instance.GetService<DelegationInfoRepository>();
- #region 获取企微Id
- public static List<string> GetQiyeChatUserIdList(List<string> userId)
- {
- List<string> result = new List<string>();
- try
- {
- foreach (string item in userId)
- {
- int uid = int.Parse(item);
- Sys_Users users = _grpDeleRep.Query<Sys_Users>(s => s.Id == uid).First();
- if (!string.IsNullOrEmpty(users.QiyeChatUserId))
- {
- result.Add(users.QiyeChatUserId);
- }
- }
- }
- catch (Exception ex)
- {
- }
- return result;
- }
- #endregion
- #region 确认出团
- /// <summary>
- /// 向指定群聊发送- 确认出团 -通知
- /// </summary>
- /// <param name="diId"></param>
- /// <param name="qwEnum"></param>
- /// <returns></returns>
- public static async Task<bool> SendChatMsg_GroupStatus_Create(int diId, QiyeWeChatEnum qwEnum)
- {
- Grp_DelegationInfo entity = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
- string dateRange = string.Format(@"{0}至{1}", entity.VisitStartDate.ToString("yyyy-MM-dd"), entity.VisitEndDate.ToString("yyyy-MM-dd"));
- string grpTypeStr = (_grpDeleRep.Query<Sys_SetData>(s => s.Id == entity.TeamDid).First()).Name;
- GroupStatus_CreateModel info = new GroupStatus_CreateModel()
- {
- ClientName = entity.ClientName,
- ClientUnit = entity.ClientUnit,
- TeamName = entity.TeamName,
- VisitDays = entity.VisitDays,
- VisitPNumber = entity.VisitPNumber,
- VisitDateRange = dateRange,
- TeamDid_Text = grpTypeStr
- };
- string chatId = qwEnum.GetEnumDescription();
- //发送信息
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendChatMsg_Markdown(chatId, MarkdownLib.GroupStatus_Create(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- return true;
- }
- /// <summary>
- /// 向指定用户发送- 确认出团 -通知
- /// </summary>
- /// <param name="diId"></param>
- /// <param name="userId"></param>
- /// <returns></returns>
- public static async Task<bool> SendUserMsg_GroupStatus_Create(int diId, List<string> userId)
- {
- Grp_DelegationInfo entity = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
- string dateRange = string.Format(@"{0}至{1}", entity.VisitStartDate.ToString("yyyy-MM-dd"), entity.VisitEndDate.ToString("yyyy-MM-dd"));
- string grpTypeStr = (_grpDeleRep.Query<Sys_SetData>(s => s.Id == entity.TeamDid).First()).Name;
- GroupStatus_CreateModel info = new GroupStatus_CreateModel()
- {
- ClientName = entity.ClientName,
- ClientUnit = entity.ClientUnit,
- TeamName = entity.TeamName,
- VisitDays = entity.VisitDays,
- VisitPNumber = entity.VisitPNumber,
- VisitDateRange = dateRange,
- TeamDid_Text = grpTypeStr
- };
- //发送信息
- List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
- if (qwUserIdList.Count > 0)
- {
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.GroupStatus_Create(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- #endregion
- #region 团组费用审核
- /// <summary>
- /// 向指定群聊发送- 费用申请 -通知
- /// </summary>
- /// <param name="diId"></param>
- /// <param name="qwEnum"></param>
- /// <returns></returns>
- public static async Task<bool> SendChatMsg_GroupStatus_ApplyFee(int Grp_CreditCardPaymentId, int sign, QiyeWeChatEnum qwEnum)
- {
- string chatId = qwEnum.GetEnumDescription();
- Grp_CreditCardPayment ccp = _grpDeleRep.Query<Grp_CreditCardPayment>(s => s.Id == Grp_CreditCardPaymentId).First();
- Grp_DelegationInfo group = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == ccp.DIId).First();
- Sys_SetData payMoneyCurrencySetData = _grpDeleRep.Query<Sys_SetData>(s => s.Id == ccp.PaymentCurrency).First();
- string priceStr = string.Format(@"{0} {1}", ccp.PayMoney, payMoneyCurrencySetData.Name);
- List<Grp_CreditCardPayment> entityList = _grpDeleRep
- .Query<Grp_CreditCardPayment>(s => s.DIId == ccp.DIId && s.IsDel == 0 && s.CreateUserId > 0 && s.IsAuditGM == 0)
- .ToList();
- GroupStatus_ApplyFeeModel info = new GroupStatus_ApplyFeeModel()
- {
- QueueCount = entityList.Count,
- TeamName = group.TeamName,
- Price = priceStr
- };
- if (sign == 2)
- {
- info.TitleStr = "[更新]一项费用待审核";
- }
- //CTable
- #region CTable
- if (ccp.CTable == 76)//76,酒店预订
- {
- Grp_HotelReservations _HotelReservations = _grpDeleRep.Query<Grp_HotelReservations>(s => s.Id == ccp.CId).First();
- info.CreateDt = _HotelReservations.CreateTime.ToString("yyyy-MM-dd HH:mm");
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _HotelReservations.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "酒店预订";
- info.PriceName = _HotelReservations.HotelName;
- }
- else if (ccp.CTable == 79) //79://车/导游地接
- {
- Grp_CarTouristGuideGroundReservations _CarTouristGuideGroundReservations = _grpDeleRep.Query<Grp_CarTouristGuideGroundReservations>(s => s.Id == ccp.CId).First();
- info.CreateDt = _CarTouristGuideGroundReservations.CreateTime.ToString("yyyy-MM-dd HH:mm");
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _CarTouristGuideGroundReservations.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "车/导游地接";
- info.PriceName = _CarTouristGuideGroundReservations.PriceName;
- }
- else if (ccp.CTable == 80) //签证
- {
- List<SimplClientInfo> clientNameList = getSimplClientList(group.Id);
- Grp_VisaInfo _VisaInfos = _grpDeleRep.Query<Grp_VisaInfo>(s => s.Id == ccp.CId).First();
- info.CreateDt = _VisaInfos.CreateTime.ToString("yyyy-MM-dd HH:mm");
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _VisaInfos.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "签证";
- info.PriceName = getClientNameStr(clientNameList, _VisaInfos.VisaClient);
- }
- else if (ccp.CTable == 81)//邀请/公务活动
- {
- Grp_InvitationOfficialActivities _InvitationOfficialActivities = _grpDeleRep.Query<Grp_InvitationOfficialActivities>(s => s.Id == ccp.CId).First();
- info.CreateDt = _InvitationOfficialActivities.CreateTime.ToString("yyyy-MM-dd HH:mm");
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _InvitationOfficialActivities.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "邀请/公务活动";
- info.PriceName = _InvitationOfficialActivities.InviterArea;
- }
- else if (ccp.CTable == 82)//团组客户保险
- {
- List<SimplClientInfo> clientNameList = getSimplClientList(group.Id);
- Grp_Customers _Customers = _grpDeleRep.Query<Grp_Customers>(s => s.Id == ccp.CId).First();
- info.CreateDt = _Customers.CreateTime.ToString("yyyy-MM-dd HH:mm");
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _Customers.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "团组客户保险";
- info.PriceName = getClientNameStr(clientNameList, _Customers.ClientName);
- }
- else if (ccp.CTable == 85) //机票预订
- {
- Grp_AirTicketReservations _AirTicketReservations = _grpDeleRep.Query<Grp_AirTicketReservations>(s => s.Id == ccp.CId).First();
- info.CreateDt = _AirTicketReservations.CreateTime.ToString("yyyy-MM-dd HH:mm");
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _AirTicketReservations.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "机票预订";
- info.PriceName = "(" + _AirTicketReservations.FlightsCode + ")";
- }
- else if (ccp.CTable == 98) //其他款项
- {
- Grp_DecreasePayments _DecreasePayments = _grpDeleRep.Query<Grp_DecreasePayments>(s => s.Id == ccp.CId).First();
- info.CreateDt = _DecreasePayments.CreateTime.ToString("yyyy-MM-dd HH:mm");
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _DecreasePayments.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "其他款项";
- info.PriceName = _DecreasePayments.PriceName;
- }
- #endregion
- //发送信息
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendChatMsg_Markdown(chatId, MarkdownLib.GroupStatus_ApplyFee(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- return true;
- }
- /// <summary>
- /// 向财务群发送费用审核结果通知(审核通过条件下发送)
- /// </summary>
- /// <param name="Grp_CreditCardPaymentId"></param>
- /// <param name="qwEnum"></param>
- /// <returns></returns>
- public static async Task<bool> SendChatMsg_GroupStatus_AuditFee(int Grp_CreditCardPaymentId, QiyeWeChatEnum qwEnum)
- {
- string chatId = qwEnum.GetEnumDescription();
- Grp_CreditCardPayment ccp = _grpDeleRep.Query<Grp_CreditCardPayment>(s => s.Id == Grp_CreditCardPaymentId).First();
- Grp_DelegationInfo group = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == ccp.DIId).First();
- Sys_SetData payMoneyCurrencySetData = _grpDeleRep.Query<Sys_SetData>(s => s.Id == ccp.PaymentCurrency).First();
- string priceStr = string.Format(@"{0} {1}", ccp.PayMoney, payMoneyCurrencySetData.Name);
- AuditResult_ApplyFee_GroupModel info = new AuditResult_ApplyFee_GroupModel()
- {
- TeamName = group.TeamName,
- Price = priceStr,
- GMAuditDate = "-"
- };
- DateTime gmAuditDt;
- bool bGMAuditDt = DateTime.TryParse(ccp.AuditGMDate, out gmAuditDt);
- info.GMAuditDate = gmAuditDt.ToString("yyyy-MM-dd HH:mm");
- //CTable
- #region CTable
- if (ccp.CTable == 76)//76,酒店预订
- {
- Grp_HotelReservations _HotelReservations = _grpDeleRep.Query<Grp_HotelReservations>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _HotelReservations.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "酒店预订";
- info.PriceName = _HotelReservations.HotelName;
- }
- else if (ccp.CTable == 79) //79://车/导游地接
- {
- Grp_CarTouristGuideGroundReservations _CarTouristGuideGroundReservations = _grpDeleRep.Query<Grp_CarTouristGuideGroundReservations>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _CarTouristGuideGroundReservations.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "车/导游地接";
- info.PriceName = _CarTouristGuideGroundReservations.PriceName;
- }
- else if (ccp.CTable == 80) //签证
- {
- List<SimplClientInfo> clientNameList = getSimplClientList(group.Id);
- Grp_VisaInfo _VisaInfos = _grpDeleRep.Query<Grp_VisaInfo>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _VisaInfos.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "签证";
- info.PriceName = getClientNameStr(clientNameList, _VisaInfos.VisaClient);
- }
- else if (ccp.CTable == 81)//邀请/公务活动
- {
- Grp_InvitationOfficialActivities _InvitationOfficialActivities = _grpDeleRep.Query<Grp_InvitationOfficialActivities>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _InvitationOfficialActivities.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "邀请/公务活动";
- info.PriceName = _InvitationOfficialActivities.InviterArea;
- }
- else if (ccp.CTable == 82)//团组客户保险
- {
- List<SimplClientInfo> clientNameList = getSimplClientList(group.Id);
- Grp_Customers _Customers = _grpDeleRep.Query<Grp_Customers>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _Customers.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "团组客户保险";
- info.PriceName = getClientNameStr(clientNameList, _Customers.ClientName);
- }
- else if (ccp.CTable == 85) //机票预订
- {
- Grp_AirTicketReservations _AirTicketReservations = _grpDeleRep.Query<Grp_AirTicketReservations>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _AirTicketReservations.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "机票预订";
- info.PriceName = "(" + _AirTicketReservations.FlightsCode + ")";
- }
- else if (ccp.CTable == 98) //其他款项
- {
- Grp_DecreasePayments _DecreasePayments = _grpDeleRep.Query<Grp_DecreasePayments>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _DecreasePayments.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "其他款项";
- info.PriceName = _DecreasePayments.PriceName;
- }
- #endregion
- //发送信息
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendChatMsg_Markdown(chatId, MarkdownLib.AuditResult_ApplyFee_Chat(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- return true;
- }
- /// <summary>
- /// 向指定用户发送-团组费用审核结果
- /// </summary>
- /// <param name="Grp_CreditCardPaymentId"></param>
- /// <param name="userId"></param>
- /// <returns></returns>
- public static async Task<bool> SendUserMsg_GroupStatus_AuditFee(int Grp_CreditCardPaymentId, List<string> userId, QiyeWeChatEnum qwEnum)
- {
- Grp_CreditCardPayment ccp = _grpDeleRep.Query<Grp_CreditCardPayment>(s => s.Id == Grp_CreditCardPaymentId).First();
- Grp_DelegationInfo group = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == ccp.DIId).First();
- Sys_SetData payMoneyCurrencySetData = _grpDeleRep.Query<Sys_SetData>(s => s.Id == ccp.PaymentCurrency).First();
- string priceStr = string.Format(@"{0} {1}", ccp.PayMoney, payMoneyCurrencySetData.Name);
- AuditResult_ApplyFee_GroupModel info = new AuditResult_ApplyFee_GroupModel()
- {
- TeamName = group.TeamName,
- Price = priceStr,
- GMAuditDate = "-"
- };
- DateTime gmAuditDt;
- bool bGMAuditDt = DateTime.TryParse(ccp.AuditGMDate, out gmAuditDt);
- info.GMAuditDate = gmAuditDt.ToString("yyyy-MM-dd HH:mm");
- if (ccp.IsAuditGM == 2)
- {
- info.Result = "总经理审核未通过";
- info.ResultColor = "warning";
- }
- //CTable
- #region CTable
- if (ccp.CTable == 76)//76,酒店预订
- {
- Grp_HotelReservations _HotelReservations = _grpDeleRep.Query<Grp_HotelReservations>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _HotelReservations.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "酒店预订";
- info.PriceName = _HotelReservations.HotelName;
- }
- else if (ccp.CTable == 79) //79://车/导游地接
- {
- Grp_CarTouristGuideGroundReservations _CarTouristGuideGroundReservations = _grpDeleRep.Query<Grp_CarTouristGuideGroundReservations>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _CarTouristGuideGroundReservations.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "车/导游地接";
- info.PriceName = _CarTouristGuideGroundReservations.PriceName;
- }
- else if (ccp.CTable == 80) //签证
- {
- List<SimplClientInfo> clientNameList = getSimplClientList(group.Id);
- Grp_VisaInfo _VisaInfos = _grpDeleRep.Query<Grp_VisaInfo>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _VisaInfos.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "签证";
- info.PriceName = getClientNameStr(clientNameList, _VisaInfos.VisaClient);
- }
- else if (ccp.CTable == 81)//邀请/公务活动
- {
- Grp_InvitationOfficialActivities _InvitationOfficialActivities = _grpDeleRep.Query<Grp_InvitationOfficialActivities>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _InvitationOfficialActivities.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "邀请/公务活动";
- info.PriceName = _InvitationOfficialActivities.InviterArea;
- }
- else if (ccp.CTable == 82)//团组客户保险
- {
- List<SimplClientInfo> clientNameList = getSimplClientList(group.Id);
- Grp_Customers _Customers = _grpDeleRep.Query<Grp_Customers>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _Customers.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "团组客户保险";
- info.PriceName = getClientNameStr(clientNameList, _Customers.ClientName);
- }
- else if (ccp.CTable == 85) //机票预订
- {
- Grp_AirTicketReservations _AirTicketReservations = _grpDeleRep.Query<Grp_AirTicketReservations>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _AirTicketReservations.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "机票预订";
- info.PriceName = "(" + _AirTicketReservations.FlightsCode + ")";
- }
- else if (ccp.CTable == 98) //其他款项
- {
- Grp_DecreasePayments _DecreasePayments = _grpDeleRep.Query<Grp_DecreasePayments>(s => s.Id == ccp.CId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == _DecreasePayments.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- info.CreateUser = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- info.PriceModule = "其他款项";
- info.PriceName = _DecreasePayments.PriceName;
- }
- #endregion
- //发送信息
- List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
- if (qwUserIdList.Count > 0)
- {
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.AuditResult_ApplyFee_User(info));
- if (ccp.IsAuditGM == 1)
- {
- await SendChatMsg_GroupStatus_AuditFee(Grp_CreditCardPaymentId, qwEnum);
- }
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- /// <summary>
- /// 向指定用户发送-团组费用支付结果
- /// </summary>
- /// <param name="Grp_CreditCardPaymentId"></param>
- /// <param name="userId"></param>
- /// <returns></returns>
- public static async Task<bool> SendUserMsg_GroupStatus_PayResult(int Grp_CreditCardPaymentId, List<string> userId)
- {
- //, QiyeWeChatEnum qiyeWeChat
- Grp_CreditCardPayment ccp = _grpDeleRep.Query<Grp_CreditCardPayment>(s => s.Id == Grp_CreditCardPaymentId).First();
- Grp_DelegationInfo group = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == ccp.DIId).First();
- Sys_SetData payMoneyCurrencySetData = _grpDeleRep.Query<Sys_SetData>(s => s.Id == ccp.PaymentCurrency).First();
- string priceStr = string.Format(@"{0} {1}", ccp.PayMoney, payMoneyCurrencySetData.Name);
- PayResult_Group_ToUserModel info = new PayResult_Group_ToUserModel()
- {
- PayDt = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
- Price = priceStr,
- TeamName = group.TeamName
- };
- #region CTable
- if (ccp.CTable == 76)//76,酒店预订
- {
- Grp_HotelReservations _HotelReservations = _grpDeleRep.Query<Grp_HotelReservations>(s => s.Id == ccp.CId).First();
- info.PriceModule = "酒店预订";
- info.PriceName = _HotelReservations.HotelName;
- }
- else if (ccp.CTable == 79) //79://车/导游地接
- {
- Grp_CarTouristGuideGroundReservations _CarTouristGuideGroundReservations = _grpDeleRep.Query<Grp_CarTouristGuideGroundReservations>(s => s.Id == ccp.CId).First();
- info.PriceModule = "车/导游地接";
- info.PriceName = _CarTouristGuideGroundReservations.PriceName;
- }
- else if (ccp.CTable == 80) //签证
- {
- List<SimplClientInfo> clientNameList = getSimplClientList(group.Id);
- Grp_VisaInfo _VisaInfos = _grpDeleRep.Query<Grp_VisaInfo>(s => s.Id == ccp.CId).First();
- info.PriceModule = "签证";
- info.PriceName = getClientNameStr(clientNameList, _VisaInfos.VisaClient);
- }
- else if (ccp.CTable == 81)//邀请/公务活动
- {
- Grp_InvitationOfficialActivities _InvitationOfficialActivities = _grpDeleRep.Query<Grp_InvitationOfficialActivities>(s => s.Id == ccp.CId).First();
- info.PriceModule = "邀请/公务活动";
- info.PriceName = _InvitationOfficialActivities.InviterArea;
- }
- else if (ccp.CTable == 82)//团组客户保险
- {
- List<SimplClientInfo> clientNameList = getSimplClientList(group.Id);
- Grp_Customers _Customers = _grpDeleRep.Query<Grp_Customers>(s => s.Id == ccp.CId).First();
- info.PriceModule = "团组客户保险";
- info.PriceName = getClientNameStr(clientNameList, _Customers.ClientName);
- }
- else if (ccp.CTable == 85) //机票预订
- {
- Grp_AirTicketReservations _AirTicketReservations = _grpDeleRep.Query<Grp_AirTicketReservations>(s => s.Id == ccp.CId).First();
- info.PriceModule = "机票预订";
- info.PriceName = "(" + _AirTicketReservations.FlightsCode + ")";
- }
- else if (ccp.CTable == 98) //其他款项
- {
- Grp_DecreasePayments _DecreasePayments = _grpDeleRep.Query<Grp_DecreasePayments>(s => s.Id == ccp.CId).First();
- info.PriceModule = "其他款项";
- info.PriceName = _DecreasePayments.PriceName;
- }
- #endregion
- //发送信息
- List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
- if (qwUserIdList.Count > 0)
- {
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.PayResult_Group_ToUser(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- #endregion
- #region 团组出发、结束提醒(财务群)
- public static async Task<bool> SendChatMsg_GroupRemindersToCaiwu(List<Grp_DelegationInfo> list_7day, List<Grp_DelegationInfo> list_3day, List<Grp_DelegationInfo> list_minus1day, QiyeWeChatEnum qwEnum)
- {
- string chatId = qwEnum.GetEnumDescription();
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendChatMsg_Markdown(chatId, MarkdownLib.GroupRemindersToCaiwuChat(list_7day, list_3day, list_minus1day));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- return true;
- }
- #endregion
- #region 团组结束提醒(国交群)
- public static async Task<bool> SendChatMsg_GroupRemindersToGuojiao(List<Grp_DelegationInfo> list_3day, QiyeWeChatEnum qwEnum)
- {
- string chatId = qwEnum.GetEnumDescription();
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendChatMsg_Markdown(chatId, MarkdownLib.GroupRemindersToGuojiao(list_3day));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- return true;
- }
- #endregion
- #region 团组出发提醒(HR)
- public static async Task<bool> SendUserMsg_DelegationVisit_ToHR(List<Grp_DelegationInfo> list_3day, List<string> userId)
- {
- //发送信息
- List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
- if (qwUserIdList.Count > 0)
- {
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.GroupRemindersToHR(list_3day));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- #endregion
- #region 市场部新增客户资源统计
- /// <summary>
- /// 周统计
- /// </summary>
- /// <param name="sourceList"></param>
- /// <param name="userId"></param>
- /// <param name="begin"></param>
- /// <param name="end"></param>
- /// <returns></returns>
- public static async Task<bool> SendUserMsg_CRMStatistics_ToHR(List<CRMWeekStatisticsView> sourceList, List<string> userId, string begin, string end)
- {
- //发送信息
- List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
- if (qwUserIdList.Count > 0)
- {
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.CRMStatistics_ToUser(sourceList, begin, end));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- /// <summary>
- /// 月统计
- /// </summary>
- /// <param name="sourceList"></param>
- /// <param name="userId"></param>
- /// <param name="begin"></param>
- /// <param name="end"></param>
- /// <returns></returns>
- public static async Task<bool> SendUserMsg_CRMStatistics_Month_ToHR(List<CRMWeekStatisticsView> sourceList, List<string> userId, string begin, string end, int totalInsert, int totalDelete)
- {
- //发送信息
- List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
- if (qwUserIdList.Count > 0)
- {
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.CRMStatistics_Month_ToUser(sourceList, begin, end, totalInsert, totalDelete));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- #endregion
- #region 日付申请审核
- /// <summary>
- /// 日付申请提交时推送财务群
- /// </summary>
- /// <param name="dailyPayId"></param>
- /// <param name="qwEnum"></param>
- /// <returns></returns>
- public static async Task<bool> DailyPayReminders_Create_ToCaiwuChat(int dailyPayId, int sign, QiyeWeChatEnum qwEnum)
- {
- string chatId = qwEnum.GetEnumDescription();
- Fin_DailyFeePayment fin_DailyFeePayment = _grpDeleRep.Query<Fin_DailyFeePayment>(s => s.Id == dailyPayId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == fin_DailyFeePayment.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- string users = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- string[] companyArr = new string[] { "未知", "成都泛美商务有限公司", "四川泛美交流有限公司", "成都纽茵教育科技有限公司", "成都鸿企中元科技有限公司", "测试公司1" };
- string companyStr = "未知";
- if (fin_DailyFeePayment.CompanyId < companyArr.Length)
- {
- companyStr = companyArr[fin_DailyFeePayment.CompanyId];
- }
- Sys_SetData sd_tansferType = _grpDeleRep.Query<Sys_SetData>(s => s.Id == fin_DailyFeePayment.TransferTypeId).First();
- Sys_SetData sd_priceType = _grpDeleRep.Query<Sys_SetData>(s => s.Id == fin_DailyFeePayment.PriceTypeId).First();
- string feeSignStr = string.Format(@"{0}-{1}", sd_tansferType.Name, sd_priceType.Name);
- string priceStr = fin_DailyFeePayment.SumPrice.ToString("#0.00");
- DailyPayReminders_Create_ToCaiwuChatModel info = new DailyPayReminders_Create_ToCaiwuChatModel()
- {
- CreateDt = fin_DailyFeePayment.CreateTime.ToString("yyyy-MM-dd HH:mm"),
- CreateUser = users,
- Price = priceStr,
- Company = companyStr,
- FeeSign = feeSignStr,
- PriceName = fin_DailyFeePayment.Instructions
- };
- if (sign == 2)
- {
- info.TitleStr = "[更新]一项费用待审核";
- }
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendChatMsg_Markdown(chatId, MarkdownLib.DailyPayReminders_Create_ToCaiwuChat(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- return true;
- }
- /// <summary>
- /// 日付申请审核结果推送给申请人
- /// </summary>
- /// <param name="dailyPayId"></param>
- /// <param name="userId"></param>
- /// <param name="qwEnum"></param>
- /// <returns></returns>
- public static async Task<bool> DailyPayReminder_Audit_ToUser(int dailyPayId, List<string> userId, QiyeWeChatEnum qwEnum)
- {
- Fin_DailyFeePayment fin_DailyFeePayment = _grpDeleRep.Query<Fin_DailyFeePayment>(s => s.Id == dailyPayId).First();
- Sys_Users user = _grpDeleRep.Query<Sys_Users>(s => s.Id == fin_DailyFeePayment.CreateUserId).First();
- Sys_JobPost job = _grpDeleRep.Query<Sys_JobPost>(s => s.Id == user.JobPostId).First();
- string users = string.Format(@"{0}-{1}", job.JobName, user.CnName);
- string priceStr = fin_DailyFeePayment.SumPrice.ToString("#0.00");
- DailyPayReminder_Audit_ToUserModel info = new DailyPayReminder_Audit_ToUserModel()
- {
- Price = priceStr,
- PriceName = fin_DailyFeePayment.Instructions
- };
- if (fin_DailyFeePayment.FAudit == 1)
- {
- info.AuditDate = fin_DailyFeePayment.MAuditDate.ToString("yyyy-MM-dd HH:mm");
- if (fin_DailyFeePayment.MAudit == 1)
- {
- info.Result = "你有一笔日付申请已通过审核";
- info.ResultColor = "info";
- //发送至财务群
- DailyPayReminder_Audit_ToCaiwuChatModel chatInfo = new DailyPayReminder_Audit_ToCaiwuChatModel()
- {
- AuditDate = info.AuditDate,
- CreateUser = users,
- Price = priceStr,
- PriceName = fin_DailyFeePayment.Instructions
- };
- string chatId = qwEnum.GetEnumDescription();
- await _qiYeWeChatApiService.GroupStatus_SendChatMsg_Markdown(chatId, MarkdownLib.DailyPayReminder_Audit_ToCaiwuChat(chatInfo));
- }
- else if (fin_DailyFeePayment.MAudit == 2)
- {
- info.Result = "你有一笔日付申请未通过总经理审核";
- info.ResultColor = "warning";
- }
- }
- else if (fin_DailyFeePayment.FAudit == 2)
- {
- info.AuditDate = fin_DailyFeePayment.FAuditDate.ToString("yyyy-MM-dd HH:mm");
- info.Result = "你有一笔日付申请未通过财务审核";
- info.ResultColor = "warning";
- }
- List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
- if (qwUserIdList.Count > 0)
- {
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.DailyPayReminder_Audit_ToUser(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- /// <summary>
- /// 日付申请已付款推送给申请人
- /// </summary>
- /// <returns></returns>
- public static async Task<bool> DailyPayReminder_Pay_ToUser(int dailyPayId, List<string> userId)
- {
- Fin_DailyFeePayment fin_DailyFeePayment = _grpDeleRep.Query<Fin_DailyFeePayment>(s => s.Id == dailyPayId).First();
- string priceStr = fin_DailyFeePayment.SumPrice.ToString("#0.00");
- DailyPayReminder_Pay_ToUserModel info = new DailyPayReminder_Pay_ToUserModel()
- {
- PayDt = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
- PriceName = fin_DailyFeePayment.Instructions,
- Price = priceStr
- };
- List<string> qwUserIdList = GetQiyeChatUserIdList(userId);
- if (qwUserIdList.Count > 0)
- {
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.DailyPayReminder_Pay_ToUser(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- #endregion
- #region 费用保存发送消息
- #region 三公费用更改通知
- /// <summary>
- /// 三公费用更改通知发送总经理(21)
- /// </summary>
- /// <param name="sign"></param>
- /// <returns></returns>
- public static async Task<bool> SendUserMsg_GroupShare_ToGM(int diId, List<string> receivedUserIds, int updateUserId, string url)
- {
- Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
- GroupShare_ToGMModel info = new GroupShare_ToGMModel()
- {
- RefreshDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
- TeamName = groupInfo.TeamName,
- CreateUser = _grpDeleRep.Query<Sys_Users>(s => s.Id == updateUserId).First()?.CnName ?? "-",
- Url = url
- };
- if (receivedUserIds.Count > 0)
- {
- List<string> qwUserIdList = GetQiyeChatUserIdList(receivedUserIds);
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.GroupShare_ToGM(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- /// <summary>
- /// 三公费用确认通知发送财务部人员
- /// </summary>
- /// <param name="sign"></param>
- /// <returns></returns>
- public static async Task<bool> SendUserMsg_GroupShare_ToFinance(int diId)
- {
- Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
- GroupShare_ToUserModel info = new GroupShare_ToUserModel()
- {
- RefreshDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
- TeamName = groupInfo.TeamName
- };
- List<string> receivedUserIds = _grpDeleRep.Query<Sys_Users>(s => s.IsDel == 0 && s.DepId == 3).Select(x => x.Id.ToString()).ToList();
- var defaultUserIds = new List<string>() { "208", "233" };
- receivedUserIds.AddRange(defaultUserIds);
- if (receivedUserIds.Contains("150")) receivedUserIds.Remove("150");
- if (receivedUserIds.Count > 0)
- {
- List<string> qwUserIdList = GetQiyeChatUserIdList(receivedUserIds);
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.GroupShare_ToFinance(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- #endregion
- /// <summary>
- /// 机票行程代码录入变更通知发送国交经理、主管、王鸽
- /// </summary>
- /// <param name="diId"></param>
- /// <param name="operationId"></param>
- /// <returns></returns>
- public static async Task<bool> SendUserMsg_GroupShare_ToDP(int diId, int operationId)
- {
- Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
- var operationName = _grpDeleRep.Query<Sys_Users>(s => s.IsDel == 0 && s.Id == operationId).First()?.CnName ?? "Unknown";
- var defaultJobPostIds = new List<int>() { 22, 32 };
- List<string> receivedUserIds = _grpDeleRep.Query<Sys_Users>(s => s.IsDel == 0 && s.DepId == 7 && defaultJobPostIds.Contains(s.JobPostId)).Select(x => x.Id.ToString()).ToList();
- var defaultUserIds = new List<string>() { "208", "233" };
- receivedUserIds.AddRange(defaultUserIds);
- if (receivedUserIds.Count > 0)
- {
- List<string> qwUserIdList = GetQiyeChatUserIdList(receivedUserIds);
- string resMsg = string.Format(@" `机票行程代码已调整更新通知`
- >团组:<font color='info'>{0}</font>
- >操作人员:<font color='comment'>{1}</font>
- >操作时间:<font color='comment'>{2}</font>
- [详细信息请前往OA系统查看](http://oa.pan-american-intl.com:4399/) ", groupInfo.TeamName, operationName, DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, resMsg);
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- #region 公务出访数据变更发送通知
- /// <summary>
- /// 机票行程代码录入变更通知发送国交经理、主管、王鸽
- /// </summary>
- /// <param name="diId"></param>
- /// <param name="operationId"></param>
- /// <returns></returns>
- public static async Task<bool> SendUserMsg_GroupShare_ToOP(int diId, int operationId)
- {
- Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
- var operationName = _grpDeleRep.Query<Sys_Users>(s => s.IsDel == 0 && s.Id == operationId).First()?.CnName ?? "Unknown";
- var defaultJobPostIds = new List<int>();
- List<string> receivedUserIds = _grpDeleRep.Query<Sys_Users>(s => s.IsDel == 0 && s.DepId == 7 && s.JobPostId == 28).Select(x => x.Id.ToString()).ToList();
- var defaultUserIds = new List<string>() { "208", "233" };
- receivedUserIds.AddRange(defaultUserIds);
- if (receivedUserIds.Count > 0)
- {
- List<string> qwUserIdList = GetQiyeChatUserIdList(receivedUserIds);
- string resMsg = string.Format(@" `公务出访有数据更新通知`
- >团组:<font color='info'>{0}</font>
- >操作人员:<font color='comment'>{1}</font>
- >操作时间:<font color='comment'>{2}</font>
- [详细信息请前往OA系统查看](http://oa.pan-american-intl.com:4399/) ", groupInfo.TeamName, operationName, DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, resMsg);
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- #endregion
- #endregion
- #region 成本通知
- /// <summary>
- /// 成本通知发送给对应岗位用户
- /// </summary>
- /// <param name="diId"></param>
- /// <returns></returns>
- public static async Task<bool> SendUserMsg_GroupShare_ToJob(int diId)
- {
- Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
- List<Sys_Users> list_user = _grpDeleRep.Query<Sys_Users>(s => s.IsDel == 0 && (s.JobPostId == 24 || s.JobPostId == 25 || s.JobPostId == 28)).ToList();
- //List<Sys_Users> list_user = _grpDeleRep.Query<Sys_Users>(s => s.IsDel == 0 && (s.JobPostId == 40 || s.JobPostId == 41)).ToList();
- List<string> userIds = new List<string>();
- list_user.ForEach(s => userIds.Add(s.Id.ToString()));
- List<string> qwUserIdList = GetQiyeChatUserIdList(userIds);
- GroupShare_ToUserModel info = new GroupShare_ToUserModel()
- {
- RefreshDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
- TeamName = groupInfo.TeamName
- };
- if (qwUserIdList.Count > 0)
- {
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.GroupShare_ToUser(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- public static async Task<bool> SendUserMsg_blackAirInfo_ToVisaUser(int diId , List<CountryDataTime> arr)
- {
- Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
- var visaUser = _grpDeleRep.Query<Sys_Users>(x => x.IsDel == 0 && x.JobPostId == 26)
- .Select(x => x.Id)
- .ToList();
- List<string> userIds = new List<string>() { "235" };
- userIds.AddRange(visaUser.Select(x=>x.ToString()));
- List<string> qwUserIdList = GetQiyeChatUserIdList(userIds);
- BlackCodeInfo_ToVisaUser info = new BlackCodeInfo_ToVisaUser()
- {
- RefreshDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
- TeamName = groupInfo.TeamName,
- info = arr
- };
- if (qwUserIdList.Count > 0)
- {
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.BlackCodeInfo_ToVisaUser(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- public static async Task<bool> SendUserMsg_GroupTimeInfo_ToVisaUser(int diId, string startTime, string endTime)
- {
- Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
- var visaUser = _grpDeleRep.Query<Sys_Users>(x => x.IsDel == 0 && x.JobPostId == 26)
- .Select(x => x.Id)
- .ToList();
- List<string> userIds = new List<string>() { "235" };
- userIds.AddRange(visaUser.Select(x => x.ToString()));
- List<string> qwUserIdList = GetQiyeChatUserIdList(userIds);
- GroupDateTime_ToVisaUser info = new GroupDateTime_ToVisaUser()
- {
- RefreshDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
- TeamName = groupInfo.TeamName,
- EndTime = endTime,
- StartTime = startTime,
- };
- if (qwUserIdList.Count > 0)
- {
- ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.GroupDateTime_ToVisaUser(info));
- if (result.errcode != 0)
- {
- //抄送日志
- return false;
- }
- }
- return true;
- }
- #endregion
- #region Helper
- private static string getClientNameStr(List<SimplClientInfo> list, string origin)
- {
- string result = origin;
- if (Regex.Match(origin, @"\d+,?").Value.Length > 0)
- {
- string[] temparr = origin.Split(',');
- string fistrStr = temparr[0];
- int count = temparr.Count();
- int tempId;
- bool success = int.TryParse(fistrStr, out tempId);
- if (success)
- {
- SimplClientInfo tempInfo = list.FirstOrDefault(s => s.Id == tempId);
- if (tempInfo != null)
- {
- if (count > 1)
- {
- result = string.Format(@"{0}{1}等{2}人", tempInfo.LastName, tempInfo.FirstName, count);
- }
- else
- {
- result = string.Format(@"{0}{1}", tempInfo.LastName, tempInfo.FirstName);
- }
- }
- }
- }
- return result;
- }
- private static List<SimplClientInfo> getSimplClientList(int diId)
- {
- string sql = string.Format("select b.Id,b.Pinyin,b.lastName,b.firstName,b.phone from Grp_TourClientList a, Crm_DeleClient b where a.clientid = b.id and a.isdel = 0 and a.diid = {0}", diId);
- List<SimplClientInfo> arr = _grpDeleRep._sqlSugar.SqlQueryable<SimplClientInfo>(sql).ToList();
- return arr;
- }
- #endregion
- }
- }
|