Browse Source

【增加】开具发票消息提醒接口;

yanshi
dyy 2 years ago
parent
commit
897a75e99e
5 changed files with 142 additions and 0 deletions
  1. +17
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PushMessageApi.cs
  2. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/database.config
  3. +23
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/DtInvoice/DtInvoiceBLL.cs
  4. +6
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/DtInvoice/DtInvoiceIBLL.cs
  5. +95
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/DtInvoice/DtInvoiceService.cs

+ 17
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PushMessageApi.cs View File

@@ -19,6 +19,7 @@ namespace Learun.Application.WebApi

public class PushMessageApi : BaseNoLoginApi
{
DtInvoiceIBLL dtInvoiceIBLL = new DtInvoiceBLL();

/// <summary>
/// 推送消息接口
@@ -27,6 +28,7 @@ namespace Learun.Application.WebApi
: base("/Learun/adms/pushMessage")
{
Get["/msg"] = PushMessage;
Get["/dtInvoicePushMessage"] = DtInvoicePushMessage;
}

private Response PushMessage(dynamic _)
@@ -39,6 +41,21 @@ namespace Learun.Application.WebApi
}
return Success("成功");
}
/// <summary>
/// 开具发票-推送消息
/// </summary>
/// <param name="_">id</param>
/// <returns></returns>
private Response DtInvoicePushMessage(dynamic _)
{
string id = this.Request.Query["id"].ToString();

if (!string.IsNullOrEmpty(id))
{
dtInvoiceIBLL.PushMessageRemindById(id);
}
return Success("成功");
}

#region 获取数据



+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/database.config View File

@@ -4,6 +4,7 @@
<add name="CollegeMIS" connectionString="Server=192.168.2.126;Initial Catalog=CollegeMIS;User ID=sa;Password=bjqj@2015!" providerName="System.Data.SqlClient" />-->
<add name="BaseDb" connectionString="Server=123.57.209.16;Initial Catalog=adms7ultimate2_演示;;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" />
<add name="CollegeMIS" connectionString="Server=123.57.209.16;Initial Catalog=CollegeMIS_演示;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" />
<add name="waydbString" connectionString="Data Source=8.141.155.183;Port=23306;Database=waydb;User ID=root;Password=QJKJ@bjqj@123" providerName="MySql.Data.MySqlClient" />

<!--金隅-->
<!--<add name="BaseDb" connectionString="Server=192.168.100.225;Initial Catalog=adms7ultimate2;User ID=sa;Password=Jykj@2019" providerName="System.Data.SqlClient" />


+ 23
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/DtInvoice/DtInvoiceBLL.cs View File

@@ -168,6 +168,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}

/// <summary>
/// 发送消息提醒
/// </summary>
/// <param name="keyValue">主键</param>
public void PushMessageRemindById(string keyValue)
{
try
{
dtInvoiceService.PushMessageRemindById(keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}

#endregion

}


+ 6
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/DtInvoice/DtInvoiceIBLL.cs View File

@@ -57,6 +57,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// <param name="keyValue">主键</param>
/// <param name="entity">实体</param>
void SaveEntity(string keyValue, DtInvoiceEntity entity);

/// <summary>
/// 发送消息提醒
/// </summary>
/// <param name="keyValue">主键</param>
void PushMessageRemindById(string keyValue);
#endregion

}


+ 95
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/DtInvoice/DtInvoiceService.cs View File

@@ -299,6 +299,101 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}

/// <summary>
/// 发送消息提醒
/// </summary>
/// <param name="keyValue">主键</param>
public void PushMessageRemindById(string keyValue)
{
try
{
var entity = this.BaseRepository("waydbString").FindEntity<DtInvoiceEntity>($@"select
t.id as 'Id',
t.name as 'InvoiceName',
t.number as 'InvoiceNo',
t.time as 'InvoiceDate',
t.money as 'Amount',
t.people as 'TaxRate',
t.unitPrice,
t.fptype as 'InvoiceType',
t.information as 'UnitName',
t.bz as 'Remark',
t.zftype, t.innvoicesettingsid, t.files, t.shuifei, t.date, t.dzmoney
from sw_invoice t where 1=1 and t.id = '{keyValue}'",null);
if (entity != null)
{
//提醒对象发消息提醒
var messageRemindPerson = this.BaseRepository().FindEntity<MessageRemindPersonEntity>(x => x.Type == "01");
if (messageRemindPerson != null)
{
//提醒对象包含的人员列表
var personList = new List<string>();
//角色
if (!string.IsNullOrEmpty(messageRemindPerson.RoleIds))
{
var pp = this.BaseRepository().FindList<UserRelationEntity>(x => messageRemindPerson.RoleIds.Contains(x.F_ObjectId));
if (pp.Any())
{
personList.AddRange(pp.Select(x => x.F_UserId));
}
}
//部门
if (!string.IsNullOrEmpty(messageRemindPerson.DeptIds))
{
var dd = messageRemindPerson.DeptIds.Split(',');
foreach (var item in dd)
{
var pp = this.BaseRepository().FindList<UserEntity>(x => x.F_DepartmentId.Contains(item));
if (pp.Any())
{
personList.AddRange(pp.Select(x => x.F_UserId));
}
}
}
//人员
if (!string.IsNullOrEmpty(messageRemindPerson.UserIds))
{
personList.AddRange(messageRemindPerson.UserIds.Split(','));
}
personList = personList.Distinct().ToList();
//消息提醒表增加数据
var mrList = new List<MessageRemindEntity>();
foreach (var item in personList)
{
MessageRemindEntity messageRemindEntity = new MessageRemindEntity()
{
ReceiptId = item,
ReceiptName = this.BaseRepository().FindEntity<UserEntity>(x => x.F_UserId == item)?.F_RealName,
SenderId = LoginUserInfo.Get()?.userId,
SenderName = LoginUserInfo.Get()?.realName,
TheTitle = "开具发票",
TheContent = "有新发票开具,发票号" + entity.InvoiceNo,
ConnectionUrl = "/EducationalAdministration/DtInvoice/Index?keyValue=",
InstanceId = entity.Id,
SendTime = DateTime.Now,
ReadSigns = false
};
messageRemindEntity.Create();
mrList.Add(messageRemindEntity);
}
this.BaseRepository().Insert(mrList);
}
}
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

#endregion

}


Loading…
Cancel
Save