124 lines
3.8 KiB
C#
124 lines
3.8 KiB
C#
using CRM.Core.BLL.FB;
|
|
using CRM.Core.BLL.Res;
|
|
using CRM.Core.BLL.Sms;
|
|
using CRM.Core.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using WX.CRM.Common;
|
|
|
|
namespace CRM.Core.CoreService.PkgSms.DataDrive
|
|
{
|
|
public class SmsBatchSendDomain
|
|
{
|
|
/// <summary>
|
|
/// 批次
|
|
/// </summary>
|
|
public decimal batchId { get; set; }
|
|
/// <summary>
|
|
/// 短信帐号编码
|
|
/// </summary>
|
|
public string clientCode { get; set; }
|
|
/// <summary>
|
|
/// 每个接口自定义的编码
|
|
/// </summary>
|
|
public string interfaceCode { get; set; }
|
|
/// <summary>
|
|
/// 对应接口的发送帐号
|
|
/// </summary>
|
|
public string interfaceAccount { get; set; }
|
|
/// <summary>
|
|
/// 对应接口的帐号密码
|
|
/// </summary>
|
|
public string interfacePwd { get; set; }
|
|
/// <summary>
|
|
/// 短信内容
|
|
/// </summary>
|
|
public string msgContent { get; set; }
|
|
|
|
/// <summary>
|
|
/// 手机号
|
|
/// </summary>
|
|
public List<string> mobiles { get; set; }
|
|
|
|
private List<decimal> pkids { get; set; }
|
|
|
|
public static int SmsWaitCount { get; set; }
|
|
|
|
public static void ClearBatch()
|
|
{
|
|
SmsWaitCount = 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取一组发送数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public SmsBatchSendDomain GetInfo()
|
|
{
|
|
try
|
|
{
|
|
var batchSms = new Sms_BatchMsg_BL(ConStringHelper.CompanyCode.QBJZ).GetTopInfo();
|
|
|
|
this.batchId = batchSms.batchid;
|
|
this.clientCode = batchSms.clientcode;
|
|
|
|
var account = new SMS_ACCOUNT_BL().GetList(p => p.CLIENTCODE == this.clientCode).FirstOrDefault();
|
|
if (account == null)
|
|
return null;
|
|
var _smsBatchMsgDetial = new Sms_BatchMsgDetail_BL(ConStringHelper.CompanyCode.QBJZ);
|
|
var totalCount = 0;
|
|
var smsDetialList = _smsBatchMsgDetial.GetList(p => p.batchid == this.batchId, p => p.pkid, 1, 200, out totalCount, System.Data.SqlClient.SortOrder.Ascending);
|
|
var mobilesDic = new RES_RESOURCEMOBILE_BL().GetNumberByResId(smsDetialList.Select(p => p.resid).ToArray());
|
|
|
|
this.interfaceCode = account.SMSSP_CODE;
|
|
this.interfaceAccount = account.SMSACCOUNT;
|
|
this.interfacePwd = account.SMSPASSWORD;
|
|
|
|
this.msgContent = batchSms.message;
|
|
|
|
foreach (KeyValuePair<string, string> item in mobilesDic)
|
|
{
|
|
mobiles.Add(item.Value);
|
|
}
|
|
|
|
LogHelper.Info("totalCount:" + totalCount.ToString());
|
|
|
|
SmsWaitCount = totalCount - 200;
|
|
|
|
|
|
return this;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WX.CRM.Common.LogHelper.Error("BatchMsg.GetInfo():" + ex.Message + ex.StackTrace);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
//public static void ExecLog(List<decimal> detaisIds, WX.CRM.Model.Entity.SMS_SENDLOG logInfo)
|
|
//{
|
|
// try
|
|
// {
|
|
// //WX.CRM.IBLL.Sms.ISMS_BATCHMSG_Q dataDriveBiz = new WX.CRM.BLL.Sms.SMS_BATCHMSG_BL();
|
|
// //dataDriveBiz.ExecLog(detaisIds, logInfo);
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// WX.CRM.Common.LogHelper.Error("【BatchMsg.ExecLog()】:" + ex.Message + ex.Source + ex.StackTrace);
|
|
// }
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 根据接口编码获取步长
|
|
/// </summary>
|
|
/// <param name="step"></param>
|
|
/// <returns></returns>
|
|
private int StemNum(string iterfaceCode)
|
|
{
|
|
return 200;
|
|
}
|
|
|
|
}
|
|
}
|