ComplianceServer/oldcode/WEB/ViewModel/SMS/GetOpenSms.cs

208 lines
6.5 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Ninject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WX.CRM.Common;
using WX.CRM.IBLL.Util;
using WX.CRM.Model.Entity;
using WX.CRM.WebHelper.Infrastructure;
namespace WX.CRM.WEB.ViewModel.SMS
{
public class GetOpenSms
{
public List<SMS_USERVERIFYCODE> GetSmsList(out string msg, string resid, string username)
{
List<SMS_USERVERIFYCODE> list = new List<SMS_USERVERIFYCODE>();
msg = "";
if (string.IsNullOrWhiteSpace(resid) && string.IsNullOrWhiteSpace(username))
{
msg = "resid和用户名不能同时为空";
return list;
}
SmsopenModel model = new SmsopenModel();
model.resid = resid;
model.username = username;
string json = Utility.ObjectToJson(model);
//try
//{
ISecurityHelper sHelper = NinjectControllerFactory.ninjectKernel.Get<ISecurityHelper>();
string url = Utility.GetSettingByKey("SmsGetOpenList");
string key = sHelper.createSignEncodingStr(json);
string response = Utility.PostData(url + "?" + key, Encoding.UTF8);
string _retmsg = sHelper.decyptData("UPWEBSITE", response);
SmsopenResult result = Utility.JSONToObject<SmsopenResult>(_retmsg);
if (result.result)
{
list = result.SmsList;
msg = "调用成功";
}
else
{
msg = "接口数据:" + result.retMessage;
}
//}catch (Exception ex)
//{
// msg = "接口数据:" + ex.Message;
//}
return list;
}
public List<openverifSms> GetopenUserDetial(out string msg, string stime, string etime, string DEPTCDOE)
{
List<openverifSms> list = new List<openverifSms>();
msg = "";
if (string.IsNullOrWhiteSpace(stime) && string.IsNullOrWhiteSpace(etime))
{
msg = "营业部编号和查找时间不能同时为空!";
return list;
}
SmsopenUserModel model = new SmsopenUserModel();
model.DEPTCDOE = DEPTCDOE;
model.stime = stime;
model.etime = etime;
string json = Utility.ObjectToJson(model);
//try
//{
ISecurityHelper sHelper = NinjectControllerFactory.ninjectKernel.Get<ISecurityHelper>();
string url = Utility.GetSettingByKey("GetopenUserDetialt");
string key = sHelper.createSignEncodingStr(json);
string response = Utility.PostData(url + "?" + key, Encoding.UTF8);
string _retmsg = sHelper.decyptData("UPWEBSITE", response);
SmsopenverifResult result = Utility.JSONToObject<SmsopenverifResult>(_retmsg);
if (result.result)
{
list = result.SmsList;
msg = "调用成功";
}
else
{
msg = "接口数据:" + result.retMessage;
}
//}catch (Exception ex)
//{
// msg = "接口数据:" + ex.Message;
//}
return list;
}
public List<openverifSms> GetopenUserDetialtList(out string msg, string stime, string etime, string DEPTCDOE, ref Pager pager, string STATUS)
{
DEPTCDOE = DEPTCDOE.Substring(0, DEPTCDOE.Length - 2);
List<openverifSms> list = new List<openverifSms>();
list = GetopenUserDetial(out msg, stime, etime, DEPTCDOE);
//通过resid获取用户开户状态
//foreach (var item in list)
//{
// var customer = _gjs_customer.GetGjsCustomersByResIds(item.VERIFYRESID);
// if (customer != null)
// {
// item.SCHEDULESTATUS = customer.SCHEDULESTATUS;
// item.TRADECODE = customer.TRADECODE;
// }
//}
if (STATUS != "-1")
{
if (STATUS == "1")
{
list = list.Where(p => p.SCHEDULESTATUS != null).ToList();
}
else
{
list = list.Where(p => p.SCHEDULESTATUS == null).ToList();
}
}
list = list.OrderByDescending(p => p.EXPIRETIME).ToList();
//分页
pager.totalRows = list.Count();
if (pager.totalRows > 0)
{
if (pager.page <= 1)
{
list = list.Take(pager.rows).ToList();
}
else
{
list = list.Skip((pager.page - 1) * pager.rows).Take(pager.rows).ToList(); ;//分页
}
}
return list;
}
}
/// <summary>
/// 开户短信查询
/// </summary>
public class SmsopenModel
{
public string resid { get; set; }
public string username { get; set; }
}
/// <summary>
/// 已生成开户验证码用户开户查询
/// </summary>
public class SmsopenUserModel
{
/// <summary>
///开始时间
/// </summary>
public string stime { get; set; }
/// <summary>
///结束时间
/// </summary>
public string etime { get; set; }
/// <summary>
/// 营业部编号UJHD
/// </summary>
public string DEPTCDOE { get; set; }
}
public class SmsopenResult
{
public bool result { get; set; }
public int retcode { get; set; }
public List<SMS_USERVERIFYCODE> SmsList { get; set; }
public string retMessage { get; set; }
}
public class openverifSms
{
/// <summary>
///过期时间
/// </summary>
public DateTime EXPIRETIME { get; set; }
/// <summary>
/// 营业部编号600000175
/// </summary>
public string VERIFYRESID { get; set; }
public string USERNAME { get; set; }
public string VERIFYCODE { get; set; }
public decimal? SCHEDULESTATUS { get; set; }
public string TRADECODE { get; set; }
}
public class SmsopenverifResult
{
public bool result { get; set; }
public int retcode { get; set; }
public List<openverifSms> SmsList { get; set; }
public string retMessage { get; set; }
}
}