Browse Source

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

西昌缴费二期
zhangli 2 years ago
parent
commit
3ff36f7ba6
16 changed files with 113 additions and 22 deletions
  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 View File

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


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


+ 7
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs View File

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


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


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


+ 7
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs View File

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


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


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


+ 4
- 4
Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config View File

@@ -49,13 +49,13 @@
<!-- 接收错误信息的邮箱 --> <!-- 接收错误信息的邮箱 -->
<add key="RereceiveErrorMail" value="" /> <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="内控材料上传员" /> <add key="MPRoleName" value="内控材料上传员" />
<!-- ================== 6:即时通信参数 ================== --> <!-- ================== 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 View File

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


namespace Learun.Application.Mapping namespace Learun.Application.Mapping

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj View File

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

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


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


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


#endregion #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 View File

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


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Email/EmailSend/EmailSendIBLL.cs View File

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

+ 24
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Email/EmailSend/EmailSendService.cs View File

@@ -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 #endregion


#region 提交数据 #region 提交数据


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Learun.Application.OA.csproj View File

@@ -152,6 +152,10 @@
<Compile Include="Schedule\ScheduleEntity.cs" /> <Compile Include="Schedule\ScheduleEntity.cs" />
<Compile Include="Schedule\ScheduleIBLL.cs" /> <Compile Include="Schedule\ScheduleIBLL.cs" />
<Compile Include="Schedule\ScheduleService.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>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Learun.Db\Learun.DataBase.Repository\Learun.DataBase.Repository.csproj"> <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 View File

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


namespace Learun.Application.TwoDevelopment.LR_Desktop
namespace Learun.Application.OA
{ {
/// <summary> /// <summary>
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 /// 版 本 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 View File

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


namespace Learun.Application.TwoDevelopment.LR_Desktop
namespace Learun.Application.OA
{ {
/// <summary> /// <summary>
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 /// 版 本 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 View File

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


namespace Learun.Application.TwoDevelopment.LR_Desktop
namespace Learun.Application.OA
{ {
/// <summary> /// <summary>
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 /// 版 本 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 View File

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


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

+ 0
- 4
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj View File

@@ -1763,10 +1763,6 @@
<Compile Include="SystemDemo\Demoleave\DemoleaveEntity.cs" /> <Compile Include="SystemDemo\Demoleave\DemoleaveEntity.cs" />
<Compile Include="SystemDemo\Demoleave\DemoleaveIBLL.cs" /> <Compile Include="SystemDemo\Demoleave\DemoleaveIBLL.cs" />
<Compile Include="SystemDemo\Demoleave\DemoleaveService.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>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj"> <ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj">


Loading…
Cancel
Save