Kaynağa Gözat

授权到期前发送邮件并记录已发送的邮件数据

西昌缴费二期
zhangli 2 yıl önce
ebeveyn
işleme
3ff36f7ba6
16 değiştirilmiş dosya ile 113 ekleme ve 22 silme
  1. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/ShowAuthorizeController.cs
  2. +7
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs
  3. +7
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs
  4. +4
    -4
      Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config
  5. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_OA/ShowAuthorizeMap.cs
  6. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj
  7. +51
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Email/EmailSend/EmailSendBLL.cs
  8. +2
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Email/EmailSend/EmailSendEntity.cs
  9. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Email/EmailSend/EmailSendIBLL.cs
  10. +24
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Email/EmailSend/EmailSendService.cs
  11. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Learun.Application.OA.csproj
  12. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/ShowAuthorize/ShowAuthorizeBLL.cs
  13. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/ShowAuthorize/ShowAuthorizeEntity.cs
  14. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/ShowAuthorize/ShowAuthorizeIBLL.cs
  15. +7
    -7
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/ShowAuthorize/ShowAuthorizeService.cs
  16. +0
    -4
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/ShowAuthorizeController.cs Dosyayı Görüntüle

@@ -1,8 +1,8 @@
using Learun.Util;
using System.Data;
using Learun.Application.TwoDevelopment.LR_Desktop;
using System.Web.Mvc;
using System.Collections.Generic;
using Learun.Application.OA;

namespace Learun.Application.Web.Areas.LR_Desktop.Controllers
{


+ 7
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs Dosyayı Görüntüle

@@ -17,6 +17,7 @@ using Learun.Application.OA;
using Learun.Application.TwoDevelopment.LR_Desktop;
using Learun.Application.TwoDevelopment.Permission;
using Learun.Application.WorkFlow;
using Learun.Application.OA.Email.EmailSend;

namespace Learun.Application.Web.Controllers
{
@@ -58,6 +59,7 @@ namespace Learun.Application.Web.Controllers
private Perm_FunctionIBLL perm_FunctionIBLL = new Perm_FunctionBLL();
private ICache redisCache = CacheFactory.CaChe();
private Sys_DefaultPwdConfigIBLL sys_DefaultPwdConfigIBLL = new Sys_DefaultPwdConfigBLL();
private EmailSendIBLL emailSendIBLL = new EmailSendBLL();
#region 视图功能

public ActionResult ChangePwd()
@@ -429,6 +431,11 @@ namespace Learun.Application.Web.Controllers
{
//授权验证
var lc = LicenseChecker.CheckLicense();
//授权到期前发送邮件提醒
if (!string.IsNullOrEmpty(lc.ExpirationDate)&&!lc.ExpirationDate.Contains("永久有效"))
{
emailSendIBLL.Send(lc.ExpirationDate);
}
if (!lc.Result)
{
return Content("<script>alert('" + lc.Message + "');location.href='/ShowRegister/Index';</script>");


+ 7
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs Dosyayı Görüntüle

@@ -17,6 +17,7 @@ using System.Web;
using Quanjiang.DigitalScholl.WebLicense;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using Newtonsoft.Json;
using Learun.Application.OA.Email.EmailSend;

namespace Learun.Application.Web.Controllers
{
@@ -39,6 +40,7 @@ namespace Learun.Application.Web.Controllers
private AnnexesFileIBLL annexesFileIbll = new AnnexesFileBLL();
WeChatDevelopIBLL weChatDevelopIbll = new WeChatDevelopBLL();
private Sys_DefaultPwdConfigIBLL Sys_DefaultPwdConfigIbll = new Sys_DefaultPwdConfigBLL();
private EmailSendIBLL emailSendIBLL = new EmailSendBLL();
#endregion

#region 视图功能
@@ -182,6 +184,11 @@ namespace Learun.Application.Web.Controllers
{
//授权验证
var lc = LicenseChecker.CheckLicense();
//授权到期前发送邮件提醒
if (!string.IsNullOrEmpty(lc.ExpirationDate) && !lc.ExpirationDate.Contains("永久有效"))
{
emailSendIBLL.Send(lc.ExpirationDate);
}
if (!lc.Result)
{
return Content("<script>alert('" + lc.Message + "');location.href='/ShowRegister/Index';</script>");


+ 4
- 4
Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config Dosyayı Görüntüle

@@ -49,13 +49,13 @@
<!-- 接收错误信息的邮箱 -->
<add key="RereceiveErrorMail" value="" />
<!-- 发出邮箱的名称 -->
<add key="MailName" value="" />
<add key="MailName" value="北京泉江科技有限公司" />
<!-- 发出邮箱的地址 -->
<add key="MailUserName" value="" />
<add key="MailUserName" value="1109134334@qq.com" />
<!-- 发出邮箱的密码 -->
<add key="MailPassword" value="" />
<add key="MailPassword" value="qgngirbbrditigdf" />
<!-- 发出邮箱设置邮箱主机 -->
<add key="MailHost" value="" />
<add key="MailHost" value="smtp.qq.com" />
<!--内控材料上传角色名-->
<add key="MPRoleName" value="内控材料上传员" />
<!-- ================== 6:即时通信参数 ================== -->


Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Desktop/ShowAuthorizeMap.cs → Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_OA/ShowAuthorizeMap.cs Dosyayı Görüntüle

@@ -1,4 +1,4 @@
using Learun.Application.TwoDevelopment.LR_Desktop;
using Learun.Application.OA;
using System.Data.Entity.ModelConfiguration;

namespace Learun.Application.Mapping

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj Dosyayı Görüntüle

@@ -570,7 +570,7 @@
<Compile Include="LR_Desktop\MessageRemindMap.cs" />
<Compile Include="LogisticsManagement\Acc_DormitoryReturnMap.cs" />
<Compile Include="LogisticsManagement\Acc_DormitoryRuleMap.cs" />
<Compile Include="LR_Desktop\ShowAuthorizeMap.cs" />
<Compile Include="LR_OA\ShowAuthorizeMap.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj">


+ 51
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Email/EmailSend/EmailSendBLL.cs Dosyayı Görüntüle

@@ -1,6 +1,7 @@
using Learun.Util;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Learun.Application.OA.Email.EmailSend
{
@@ -14,6 +15,7 @@ namespace Learun.Application.OA.Email.EmailSend
public class EmailSendBLL : EmailSendIBLL
{
private EmailSendService emailSendService = new EmailSendService();
private ShowAuthorizeService showAuthorizeService = new ShowAuthorizeService();

#region 获取数据
/// <summary>
@@ -113,6 +115,55 @@ namespace Learun.Application.OA.Email.EmailSend
}
}
}


#endregion

/// <summary>
/// 授权到期前发送邮件提醒
/// </summary>
/// <param name="ExpirationDate">授权到期时间</param>
public void Send(string ExpirationDate)
{
try
{
//授权到期发送邮件配置信息
var showAuthorize = showAuthorizeService.GetShowAuthorizeEntity();
if (showAuthorize != null && showAuthorize.IsRemind == 1)
{
//授权到期时间
DateTime expirationDate = Convert.ToDateTime(ExpirationDate);
DateTime now = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
//计算授权到期时间与当前时间相差的天数
var ts = (expirationDate - now).Days;
//到期前{ExpirationTime}天,每天发送一封邮件
if (ts >= 0 && ts <= showAuthorize.ExpirationTime)
{
//判断今天有没有发送过邮件,如果今天已经发送,不再重复发送
if (emailSendService.GetTodayList(showAuthorize.EmailAddr).Count() <= 0)
{
//发送邮件
if (MailHelper.Send(showAuthorize.EmailAddr, showAuthorize.EmailTitle,
showAuthorize.EmailContent))
{
EmailSendEntity entity = new EmailSendEntity();
entity.F_Sender = Config.GetValue("MailUserName");
entity.F_To = showAuthorize.EmailAddr;
entity.F_Subject = showAuthorize.EmailTitle;
entity.F_BodyText = showAuthorize.EmailContent;
entity.F_Description = "授权到期提醒";
emailSendService.SaveSendEntity("", entity);
}
}
}

}
}
catch (Exception ex)
{
return;
}
}

}
}

+ 2
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Email/EmailSend/EmailSendEntity.cs Dosyayı Görüntüle

@@ -157,12 +157,13 @@ namespace Learun.Application.OA.Email.EmailSend
/// </summary>
public void Create()
{
this.F_Id = Guid.NewGuid().ToString();
this.F_CreatorTime = DateTime.Now;
this.F_Date = DateTime.Now;
this.F_EnabledMark = 0;
this.F_DeleteMark = 0;
UserInfo userInfo = LoginUserInfo.Get();
this.F_CreatorUserId = userInfo.userId;
this.F_CreatorUserId = userInfo?.userId;
}
/// <summary>
/// 编辑调用


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Email/EmailSend/EmailSendIBLL.cs Dosyayı Görüntüle

@@ -42,6 +42,7 @@ namespace Learun.Application.OA.Email.EmailSend
/// <param name="sendEntity">邮件发送实体</param>
/// <returns></returns>
void SaveSendEntity(string keyValue, EmailSendEntity sendEntity);
void Send(string ExpirationDate);
#endregion
}
}

+ 24
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Email/EmailSend/EmailSendService.cs Dosyayı Görüntüle

@@ -81,6 +81,30 @@ namespace Learun.Application.OA.Email.EmailSend
}
}
}

/// <summary>
/// 获取今天的邮件数据
/// </summary>
/// <returns></returns>
public IEnumerable<EmailSendEntity> GetTodayList(string emailAddr)
{
try
{
string sql = $@"SELECT * FROM LR_EmailSend t WHERE t.F_DeleteMark = 0 AND t.F_EnabledMark = 0 and DATEDIFF(DD,F_CreatorTime,Getdate())=0 and cast(F_To as nvarchar)='{emailAddr}' and F_Description='授权到期提醒'";
return this.BaseRepository().FindList<EmailSendEntity>(sql);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
#endregion

#region 提交数据


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Learun.Application.OA.csproj Dosyayı Görüntüle

@@ -152,6 +152,10 @@
<Compile Include="Schedule\ScheduleEntity.cs" />
<Compile Include="Schedule\ScheduleIBLL.cs" />
<Compile Include="Schedule\ScheduleService.cs" />
<Compile Include="ShowAuthorize\ShowAuthorizeBLL.cs" />
<Compile Include="ShowAuthorize\ShowAuthorizeEntity.cs" />
<Compile Include="ShowAuthorize\ShowAuthorizeIBLL.cs" />
<Compile Include="ShowAuthorize\ShowAuthorizeService.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Learun.Db\Learun.DataBase.Repository\Learun.DataBase.Repository.csproj">


Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/ShowAuthorize/ShowAuthorizeBLL.cs → Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/ShowAuthorize/ShowAuthorizeBLL.cs Dosyayı Görüntüle

@@ -3,7 +3,7 @@ using System;
using System.Data;
using System.Collections.Generic;

namespace Learun.Application.TwoDevelopment.LR_Desktop
namespace Learun.Application.OA
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架

Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/ShowAuthorize/ShowAuthorizeEntity.cs → Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/ShowAuthorize/ShowAuthorizeEntity.cs Dosyayı Görüntüle

@@ -2,7 +2,7 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace Learun.Application.TwoDevelopment.LR_Desktop
namespace Learun.Application.OA
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架

Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/ShowAuthorize/ShowAuthorizeIBLL.cs → Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/ShowAuthorize/ShowAuthorizeIBLL.cs Dosyayı Görüntüle

@@ -2,7 +2,7 @@
using System.Data;
using System.Collections.Generic;

namespace Learun.Application.TwoDevelopment.LR_Desktop
namespace Learun.Application.OA
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架

Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/ShowAuthorize/ShowAuthorizeService.cs → Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/ShowAuthorize/ShowAuthorizeService.cs Dosyayı Görüntüle

@@ -7,7 +7,7 @@ using System.Data;
using System.Linq;
using System.Text;

namespace Learun.Application.TwoDevelopment.LR_Desktop
namespace Learun.Application.OA
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
@@ -45,7 +45,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
var queryParam = queryJson.ToJObject();
// 虚拟参数
var dp = new DynamicParameters(new { });
return this.BaseRepository("CollegeMIS").FindList<ShowAuthorizeEntity>(strSql.ToString(), dp, pagination);
return this.BaseRepository().FindList<ShowAuthorizeEntity>(strSql.ToString(), dp, pagination);
}
catch (Exception ex)
{
@@ -69,7 +69,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
{
try
{
return this.BaseRepository("CollegeMIS").FindList<ShowAuthorizeEntity>().FirstOrDefault();
return this.BaseRepository().FindList<ShowAuthorizeEntity>().FirstOrDefault();
}
catch (Exception ex)
{
@@ -96,7 +96,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
{
try
{
this.BaseRepository("CollegeMIS").Delete<ShowAuthorizeEntity>(t => t.Id == keyValue);
this.BaseRepository().Delete<ShowAuthorizeEntity>(t => t.Id == keyValue);
}
catch (Exception ex)
{
@@ -120,16 +120,16 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
{
try
{
var model = this.BaseRepository("CollegeMIS").FindList<ShowAuthorizeEntity>().FirstOrDefault();
var model = this.BaseRepository().FindList<ShowAuthorizeEntity>().FirstOrDefault();
if (model != null)
{
entity.Modify(model.Id);
this.BaseRepository("CollegeMIS").Update(entity);
this.BaseRepository().Update(entity);
}
else
{
entity.Create();
this.BaseRepository("CollegeMIS").Insert(entity);
this.BaseRepository().Insert(entity);
}
}
catch (Exception ex)

+ 0
- 4
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj Dosyayı Görüntüle

@@ -1763,10 +1763,6 @@
<Compile Include="SystemDemo\Demoleave\DemoleaveEntity.cs" />
<Compile Include="SystemDemo\Demoleave\DemoleaveIBLL.cs" />
<Compile Include="SystemDemo\Demoleave\DemoleaveService.cs" />
<Compile Include="LR_Desktop\ShowAuthorize\ShowAuthorizeEntity.cs" />
<Compile Include="LR_Desktop\ShowAuthorize\ShowAuthorizeService.cs" />
<Compile Include="LR_Desktop\ShowAuthorize\ShowAuthorizeBLL.cs" />
<Compile Include="LR_Desktop\ShowAuthorize\ShowAuthorizeIBLL.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj">


Yükleniyor…
İptal
Kaydet