|
|
@@ -22,6 +22,8 @@ namespace CallCenterApi.Interface.Controllers
|
|
22
|
22
|
{
|
|
23
|
23
|
public class SMSController : BaseController
|
|
24
|
24
|
{
|
|
|
25
|
+ BLL.T_Sys_DictionaryValue bllDic = new BLL.T_Sys_DictionaryValue();
|
|
|
26
|
+
|
|
25
|
27
|
#region 接收短信
|
|
26
|
28
|
string url = "http://47.92.26.244/sms.aspx?";
|
|
27
|
29
|
string account = "yhyy"; string password = "yhyy190903";
|
|
|
@@ -40,7 +42,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
40
|
42
|
/// <param name="type"></param>
|
|
41
|
43
|
/// <returns></returns>
|
|
42
|
44
|
|
|
43
|
|
- public ActionResult SendSMS(string mobile, string time, string timeslot, string department, string doctor, string floor, string sendTime, string name, string content, int MBID, int sendWay = 0)
|
|
|
45
|
+ public ActionResult SendSMS(string mobile, string time, string timeslot, string department, string doctor, string floor, string sendTime, string name, string content, int MBID = 0, int sendWay = 0)
|
|
44
|
46
|
{
|
|
45
|
47
|
WebClient web = new WebClient();
|
|
46
|
48
|
web.Encoding = Encoding.UTF8;
|
|
|
@@ -325,26 +327,27 @@ namespace CallCenterApi.Interface.Controllers
|
|
325
|
327
|
if (!string.IsNullOrWhiteSpace(keywords))//关键字搜索
|
|
326
|
328
|
sql += $" and ( Detail like '%" + keywords.Trim() + "%'or Name like '%" + keywords.Trim() + "%' or MName like '%" + keywords.Trim() + "%' ) ";
|
|
327
|
329
|
if (!string.IsNullOrWhiteSpace(name))//
|
|
328
|
|
- sql += $" and Name like '%" + name.Trim() + "%'";
|
|
|
330
|
+ sql += $" and Name = '" + name.Trim() + "'";
|
|
|
331
|
+ //sql += $" and Name like '%" + name.Trim() + "%'";
|
|
329
|
332
|
// var modellist = new BLL.T_SMS_Template().GetModelList(sql);
|
|
330
|
|
-
|
|
|
333
|
+
|
|
331
|
334
|
int recordCount = 0;
|
|
332
|
335
|
dt = BLL.PagerBLL.GetListPager(
|
|
333
|
336
|
"T_SMS_Template",
|
|
334
|
337
|
"T_SMS_Template.ID",
|
|
335
|
|
- "*",
|
|
|
338
|
+ "(SELECT F_Name FROM dbo.T_Sys_DictionaryValue WHERE F_State=1 and F_DictionaryFlag='DXLX' AND CONVERT(VARCHAR,F_DictionaryValueId) = Name) AS NameType,*",
|
|
336
|
339
|
sql,
|
|
337
|
340
|
"ORDER BY T_SMS_Template.ID desc",
|
|
338
|
341
|
pagesize,
|
|
339
|
342
|
page,
|
|
340
|
343
|
true,
|
|
341
|
344
|
out recordCount);
|
|
342
|
|
- List<Model.T_SMS_Template> modlelist = new BLL.T_SMS_Template().DataTableToList(dt);
|
|
|
345
|
+ //List<Model.T_SMS_Template> modlelist = new BLL.T_SMS_Template().DataTableToList(dt);
|
|
343
|
346
|
var obj = new
|
|
344
|
347
|
{
|
|
345
|
348
|
state = "success",
|
|
346
|
349
|
message = "成功",
|
|
347
|
|
- rows = modlelist,
|
|
|
350
|
+ rows = dt,
|
|
348
|
351
|
total = recordCount
|
|
349
|
352
|
|
|
350
|
353
|
};
|
|
|
@@ -367,7 +370,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
367
|
370
|
Model.T_SMS_Template dModel = new Model.T_SMS_Template();
|
|
368
|
371
|
if (string.IsNullOrEmpty(name.Trim()))
|
|
369
|
372
|
return Error("短信类型不能为空!");
|
|
370
|
|
- var model = new BLL.T_SMS_Template().GetModelList($"Name like '%" + name.Trim() + "%'").FirstOrDefault();
|
|
|
373
|
+ var model = new BLL.T_SMS_Template().GetModelList($"Name = '" + name.Trim() + "'").FirstOrDefault();
|
|
371
|
374
|
if (model == null)
|
|
372
|
375
|
return Error("查询不到此模板!");
|
|
373
|
376
|
return Success("获取成功", model);
|
|
|
@@ -460,6 +463,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
460
|
463
|
dModel.MName = MName.Trim();
|
|
461
|
464
|
dModel.CreateDate = DateTime.Now;
|
|
462
|
465
|
dModel.IsEnable = 0;
|
|
|
466
|
+ var listDIc = bllDic.DataTableToList(bllDic.GetList(" F_State=1 and F_DictionaryFlag='DXLX' ").Tables[0]);
|
|
463
|
467
|
foreach (DataRow dr in dt.Rows)
|
|
464
|
468
|
{
|
|
465
|
469
|
#region 数据入库
|
|
|
@@ -469,7 +473,8 @@ namespace CallCenterApi.Interface.Controllers
|
|
469
|
473
|
{
|
|
470
|
474
|
if (!getunique( dr["短信类型"].ToString()))
|
|
471
|
475
|
{
|
|
472
|
|
- dModel.Name = dr["短信类型"].ToString();
|
|
|
476
|
+ var modelDic = listDIc.SingleOrDefault(x => x.F_Name.Equals(dr["短信类型"].ToString()));
|
|
|
477
|
+ dModel.Name = modelDic != null ? modelDic.F_DictionaryValueId.ToString() : ""; // 短信类型
|
|
473
|
478
|
dModel.Detail = dr["短信内容"].ToString();
|
|
474
|
479
|
var res = new BLL.T_SMS_Template().Add(dModel);
|
|
475
|
480
|
if (res < 0)
|
|
|
@@ -523,6 +528,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
523
|
528
|
MName = ua.F_UserName;
|
|
524
|
529
|
}
|
|
525
|
530
|
Model.T_SMS_List dModel = new Model.T_SMS_List();
|
|
|
531
|
+ //dModel.Type = TypeId;
|
|
526
|
532
|
dModel.SendWay = SendWay;
|
|
527
|
533
|
dModel.DSSendTime = DSSendTime;
|
|
528
|
534
|
dModel.SendTime = SendTime;
|
|
|
@@ -556,7 +562,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
556
|
562
|
string sql = $" F_IsDelete=0";
|
|
557
|
563
|
if (!string.IsNullOrEmpty(name))
|
|
558
|
564
|
{
|
|
559
|
|
- var model = new BLL.T_SMS_Template().GetModelList($"Name like '%" + name.Trim() + "%'").FirstOrDefault();
|
|
|
565
|
+ var model = new BLL.T_SMS_Template().GetModelList($"Name = '" + name.Trim() + "'").FirstOrDefault();
|
|
560
|
566
|
if (model!=null )
|
|
561
|
567
|
{
|
|
562
|
568
|
sql += " and MBID=" + model.ID ;
|
|
|
@@ -578,6 +584,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
578
|
584
|
dt.Columns.Add("发送时间");
|
|
579
|
585
|
dt.Columns.Add("短信类型");
|
|
580
|
586
|
dt.Columns.Add("发送人");
|
|
|
587
|
+ var listDIc = bllDic.DataTableToList(bllDic.GetList(" F_State=1 and F_DictionaryFlag='DXLX' ").Tables[0]);
|
|
581
|
588
|
var itemlist = new BLL.T_SMS_List().GetModelList(sql);
|
|
582
|
589
|
foreach (var it in itemlist)
|
|
583
|
590
|
{
|
|
|
@@ -599,7 +606,8 @@ namespace CallCenterApi.Interface.Controllers
|
|
599
|
606
|
var model = new BLL.T_SMS_Template().GetModel(int.Parse(it.MBID.ToString()));
|
|
600
|
607
|
if (model != null)
|
|
601
|
608
|
{
|
|
602
|
|
- drNew["短信类型"]= model.Name ;
|
|
|
609
|
+ var modelDic = listDIc.SingleOrDefault(x => x.F_DictionaryValueId.ToString() == model.Name);
|
|
|
610
|
+ drNew["短信类型"] = modelDic != null ? modelDic.F_Name : ""; // 短信类型 model.Name;
|
|
603
|
611
|
}
|
|
604
|
612
|
}
|
|
605
|
613
|
drNew["发送人"] =it .MID +"("+it.MName +")";
|
|
|
@@ -666,6 +674,13 @@ namespace CallCenterApi.Interface.Controllers
|
|
666
|
674
|
/// <summary>
|
|
667
|
675
|
/// 获取短信记录列表
|
|
668
|
676
|
/// </summary>
|
|
|
677
|
+ /// <param name="name">模板类型</param>
|
|
|
678
|
+ /// <param name="phone">接收号码</param>
|
|
|
679
|
+ /// <param name="creatname">创建人工号</param>
|
|
|
680
|
+ /// <param name="SendWay">发送方式(-1默认所有;0立即发送; 1定时发送)</param>
|
|
|
681
|
+ /// <param name="IsSend">发送状态(-1默认所有;0已发送; 1发送失败)</param>
|
|
|
682
|
+ /// <param name="page"></param>
|
|
|
683
|
+ /// <param name="pagesize"></param>
|
|
669
|
684
|
/// <returns></returns>
|
|
670
|
685
|
public ActionResult GetSMSList(string name, string phone, string creatname ,int SendWay=-1, int IsSend=-1, int page = 1, int pagesize = 10)
|
|
671
|
686
|
{
|
|
|
@@ -673,15 +688,15 @@ namespace CallCenterApi.Interface.Controllers
|
|
673
|
688
|
int userId = CurrentUser.UserData.F_UserId;
|
|
674
|
689
|
if (userId != 0)
|
|
675
|
690
|
{
|
|
676
|
|
-
|
|
|
691
|
+ bool isNameType = true;
|
|
677
|
692
|
string sql = $"and F_IsDelete=0";
|
|
678
|
693
|
if (!string.IsNullOrEmpty(name))
|
|
679
|
694
|
{
|
|
680
|
|
- var model = new BLL.T_SMS_Template().GetModelList($"Name like '%" + name.Trim() + "%'").FirstOrDefault();
|
|
|
695
|
+ var model = new BLL.T_SMS_Template().GetModelList($" Name = '" + name.Trim() + "'").FirstOrDefault();
|
|
681
|
696
|
if (model != null)
|
|
682
|
|
- {
|
|
683
|
697
|
sql += " and MBID=" + model.ID;
|
|
684
|
|
- }
|
|
|
698
|
+ else
|
|
|
699
|
+ isNameType = false;
|
|
685
|
700
|
}
|
|
686
|
701
|
if (!string.IsNullOrEmpty(phone))
|
|
687
|
702
|
sql += " and Telephone like'%" + phone+"%'";
|
|
|
@@ -694,17 +709,19 @@ namespace CallCenterApi.Interface.Controllers
|
|
694
|
709
|
int recordCount = 0;
|
|
695
|
710
|
if (!string.IsNullOrWhiteSpace(sql))
|
|
696
|
711
|
{
|
|
697
|
|
-
|
|
698
|
|
- dt = BLL.PagerBLL.GetListPager(
|
|
699
|
|
- "T_SMS_List",
|
|
700
|
|
- "T_SMS_List.ID",
|
|
701
|
|
- "*",
|
|
702
|
|
- sql,
|
|
703
|
|
- "ORDER BY T_SMS_List.ID desc",
|
|
704
|
|
- pagesize,
|
|
705
|
|
- page,
|
|
706
|
|
- true,
|
|
707
|
|
- out recordCount);
|
|
|
712
|
+ if (isNameType)
|
|
|
713
|
+ {
|
|
|
714
|
+ dt = BLL.PagerBLL.GetListPager(
|
|
|
715
|
+ "T_SMS_List",
|
|
|
716
|
+ "T_SMS_List.ID",
|
|
|
717
|
+ "*",
|
|
|
718
|
+ sql,
|
|
|
719
|
+ "ORDER BY T_SMS_List.ID desc",
|
|
|
720
|
+ pagesize,
|
|
|
721
|
+ page,
|
|
|
722
|
+ true,
|
|
|
723
|
+ out recordCount);
|
|
|
724
|
+ }
|
|
708
|
725
|
}
|
|
709
|
726
|
var modlelist = new BLL.T_SMS_List().DataTableToList(dt);
|
|
710
|
727
|
//var modellist = new BLL.T_SMS_List().GetModelList(sql);
|
|
|
@@ -725,6 +742,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
725
|
742
|
public List<SMSList> ModeltoSMSList(List <Model .T_SMS_List> list)
|
|
726
|
743
|
{
|
|
727
|
744
|
List<SMSList> modellist = new List<SMSList>();
|
|
|
745
|
+ var listDIc = bllDic.DataTableToList(bllDic.GetList(" F_State=1 and F_DictionaryFlag='DXLX' ").Tables[0]);
|
|
728
|
746
|
foreach (var it in list)
|
|
729
|
747
|
{
|
|
730
|
748
|
SMSList model = new SMSList();
|
|
|
@@ -742,10 +760,14 @@ namespace CallCenterApi.Interface.Controllers
|
|
742
|
760
|
model.Telephone = it.Telephone;
|
|
743
|
761
|
model.Detail = it.Detail;
|
|
744
|
762
|
if (it.MBID>0)
|
|
745
|
|
- {
|
|
|
763
|
+ {
|
|
746
|
764
|
var MID = new BLL.T_SMS_Template().GetModel(int.Parse(it.MBID.ToString()));
|
|
747
|
765
|
if (MID != null)
|
|
748
|
|
- model.MBDetail = MID.Name;
|
|
|
766
|
+ {
|
|
|
767
|
+ var modelDic = listDIc.SingleOrDefault(x => x.F_DictionaryValueId.ToString() == MID.Name);
|
|
|
768
|
+ model.NameType = modelDic != null ? modelDic.F_Name : ""; // 短信类型 model.Name;
|
|
|
769
|
+ //model.NameType = MID.Name;
|
|
|
770
|
+ }
|
|
749
|
771
|
}
|
|
750
|
772
|
model.MID = it.MID;
|
|
751
|
773
|
model.MName = it.MName;
|
|
|
@@ -848,7 +870,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
848
|
870
|
public string IsSend;
|
|
849
|
871
|
public string Telephone;
|
|
850
|
872
|
public string Detail;
|
|
851
|
|
- public string MBDetail;
|
|
|
873
|
+ public string NameType;
|
|
852
|
874
|
public string MID;
|
|
853
|
875
|
public string MName;
|
|
854
|
876
|
public string CreateDate;
|