|
@@ -2,6 +2,7 @@
|
|
using OASystem.Domain.Dtos.Business;
|
|
using OASystem.Domain.Dtos.Business;
|
|
using OASystem.Domain.Entities.Business;
|
|
using OASystem.Domain.Entities.Business;
|
|
using OASystem.Domain.Entities.Groups;
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
|
+using OASystem.Domain.ViewModels.Groups;
|
|
using OASystem.Infrastructure.Repositories.Groups;
|
|
using OASystem.Infrastructure.Repositories.Groups;
|
|
|
|
|
|
namespace OASystem.API.OAMethodLib.Quartz.Business
|
|
namespace OASystem.API.OAMethodLib.Quartz.Business
|
|
@@ -16,38 +17,43 @@ namespace OASystem.API.OAMethodLib.Quartz.Business
|
|
public static async void PostMessage()
|
|
public static async void PostMessage()
|
|
{
|
|
{
|
|
DeleReminderConfig _deleReminderConfig = AutofacIocManager.Instance.GetService<DeleReminderConfig>();
|
|
DeleReminderConfig _deleReminderConfig = AutofacIocManager.Instance.GetService<DeleReminderConfig>();
|
|
- string postPhoneNumber = string.IsNullOrEmpty(_deleReminderConfig.PhoneNumber) ? _deleReminderConfig.Test : _deleReminderConfig.PhoneNumber;
|
|
|
|
|
|
+ List<string> list_PhoneNumbers = _deleReminderConfig.PhoneNumber.Split(',').ToList();
|
|
|
|
|
|
//sqladd2day查询0A2014数据库,正式使用新OA后将两次查询合并
|
|
//sqladd2day查询0A2014数据库,正式使用新OA后将两次查询合并
|
|
DateTime dtNow = DateTime.Now;
|
|
DateTime dtNow = DateTime.Now;
|
|
- string today = dtNow.ToString("yyyy-MM-dd");
|
|
|
|
string add2day = dtNow.AddDays(2).ToString("yyyy-MM-dd");
|
|
string add2day = dtNow.AddDays(2).ToString("yyyy-MM-dd");
|
|
|
|
+ string add7day = dtNow.AddDays(7).ToString("yyyy-MM-dd");
|
|
|
|
|
|
_grpDeleRep.ChangeDataBase(DBEnum.OA2014DB);
|
|
_grpDeleRep.ChangeDataBase(DBEnum.OA2014DB);
|
|
- string sql = string.Format(@" Select * From DelegationInfo With(Nolock) Where IsdDel=0 And VisitEndDate in ('{0}','{1}') ", today, add2day);
|
|
|
|
- List<Grp_DelegationInfo> list_source = _grpDeleRep._sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).ToList();
|
|
|
|
|
|
+ string sql = string.Format(@" Select * From DelegationInfo With(Nolock) Where IsDel=0 And VisitEndDate ='{0}' Or VisitStartDate='{1}' ", add2day, add7day);
|
|
|
|
+ List<OA2021_DelegationInfo> list_source = _grpDeleRep._sqlSugar.SqlQueryable<OA2021_DelegationInfo>(sql).ToList();
|
|
|
|
|
|
_grpDeleRep.ChangeDataBase(DBEnum.OA2023DB);
|
|
_grpDeleRep.ChangeDataBase(DBEnum.OA2023DB);
|
|
if (list_source.Count > 0)
|
|
if (list_source.Count > 0)
|
|
{
|
|
{
|
|
- List<Grp_DelegationInfo> listToday = list_source.Where(s => s.VisitEndDate.Equals(today)).ToList();
|
|
|
|
- List<Grp_DelegationInfo> listAdd2day = list_source.Where(s => s.VisitEndDate.Equals(add2day)).ToList();
|
|
|
|
|
|
+ List<OA2021_DelegationInfo> listAdd7day = list_source.Where(s => s.VisitStartDate.Equals(add7day)).ToList();
|
|
|
|
+ List<OA2021_DelegationInfo> listAdd2day = list_source.Where(s => s.VisitEndDate.Equals(add2day)).ToList();
|
|
|
|
|
|
- if (listToday.Count > 0)
|
|
|
|
|
|
+ if (listAdd7day.Count > 0)
|
|
{
|
|
{
|
|
string teamNames = "";
|
|
string teamNames = "";
|
|
- listToday.ForEach(s => teamNames += s.TeamName + "、");
|
|
|
|
|
|
+ listAdd7day.ForEach(s => teamNames += s.TeamName + "、");
|
|
teamNames = teamNames.TrimEnd('、');
|
|
teamNames = teamNames.TrimEnd('、');
|
|
//发送短信
|
|
//发送短信
|
|
- string templateParam = JsonConvert.SerializeObject(new { teams = teamNames, date = "今日" });
|
|
|
|
- string postResult = AliMessagePost.PostMessage(postPhoneNumber, "泛美国际团组", "SMS_461575447", templateParam);
|
|
|
|
- Bus_MsgPostInfo _entity = new Bus_MsgPostInfo();
|
|
|
|
- _entity.Source = "ALiYun";
|
|
|
|
- _entity.TeamNames = teamNames;
|
|
|
|
- _entity.PostType = "Dele2";
|
|
|
|
- _entity.PhoneNumber = postPhoneNumber;
|
|
|
|
- _entity.PostResult = postResult;
|
|
|
|
- _grpDeleRep.AddAsync(_entity);
|
|
|
|
|
|
+ string add7dayZH = dtNow.AddDays(7).ToString("yyyy年MM月dd日");
|
|
|
|
+ string templateParam = JsonConvert.SerializeObject(new { teams = teamNames, date = add7dayZH });
|
|
|
|
+
|
|
|
|
+ foreach (string postPhoneNumber in list_PhoneNumbers)
|
|
|
|
+ {
|
|
|
|
+ string postResult = AliMessagePost.PostMessage(postPhoneNumber, "泛美国际团组", "SMS_461505530", templateParam);
|
|
|
|
+ Bus_MsgPostInfo _entity = new Bus_MsgPostInfo();
|
|
|
|
+ _entity.Source = "ALiYun";
|
|
|
|
+ _entity.TeamNames = teamNames;
|
|
|
|
+ _entity.PostType = "Dele2";
|
|
|
|
+ _entity.PhoneNumber = postPhoneNumber;
|
|
|
|
+ _entity.PostResult = postResult;
|
|
|
|
+ _grpDeleRep._sqlSugar.Insertable<Bus_MsgPostInfo>(_entity);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (listAdd2day.Count > 0)
|
|
if (listAdd2day.Count > 0)
|
|
@@ -58,14 +64,18 @@ namespace OASystem.API.OAMethodLib.Quartz.Business
|
|
//发送短信
|
|
//发送短信
|
|
string add2dayZH = dtNow.AddDays(2).ToString("yyyy年MM月dd日");
|
|
string add2dayZH = dtNow.AddDays(2).ToString("yyyy年MM月dd日");
|
|
string templateParam = JsonConvert.SerializeObject(new { teams = teamNames, date = add2dayZH });
|
|
string templateParam = JsonConvert.SerializeObject(new { teams = teamNames, date = add2dayZH });
|
|
- string postResult = AliMessagePost.PostMessage(postPhoneNumber, "泛美国际团组", "SMS_461575447", templateParam);
|
|
|
|
- Bus_MsgPostInfo _entity = new Bus_MsgPostInfo();
|
|
|
|
- _entity.Source = "ALiYun";
|
|
|
|
- _entity.TeamNames = teamNames;
|
|
|
|
- _entity.PostType = "Dele1";
|
|
|
|
- _entity.PhoneNumber = postPhoneNumber;
|
|
|
|
- _entity.PostResult = postResult;
|
|
|
|
- _grpDeleRep.AddAsync(_entity);
|
|
|
|
|
|
+ foreach (string postPhoneNumber in list_PhoneNumbers)
|
|
|
|
+ {
|
|
|
|
+ string postResult = AliMessagePost.PostMessage(postPhoneNumber, "泛美国际团组", "SMS_461575447", templateParam);
|
|
|
|
+ Bus_MsgPostInfo _entity = new Bus_MsgPostInfo();
|
|
|
|
+ _entity.Source = "ALiYun";
|
|
|
|
+ _entity.TeamNames = teamNames;
|
|
|
|
+ _entity.PostType = "Dele1";
|
|
|
|
+ _entity.PhoneNumber = postPhoneNumber;
|
|
|
|
+ _entity.PostResult = postResult;
|
|
|
|
+ _grpDeleRep._sqlSugar.Insertable<Bus_MsgPostInfo>(_entity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|