136 lines
5.1 KiB
C#
136 lines
5.1 KiB
C#
using CRM.Core.BLL.Base;
|
|
using CRM.Core.DAL.Soft;
|
|
using CRM.Core.DTO;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using WX.CRM.Common;
|
|
|
|
namespace CRM.Core.BLL.Application.Soft
|
|
{
|
|
public class SoftUserService
|
|
{
|
|
private readonly Soft_User_DAL _softUser = new Soft_User_DAL();
|
|
private readonly Bas_AdChannel_BL _adchannel = new Bas_AdChannel_BL();
|
|
|
|
public SoftUserCountView GetSoftUserOrderCount()
|
|
{
|
|
var dt = _softUser.GetSoftUserOrderCount().Tables[0];
|
|
var dt2 = _softUser.GetSoftUserRegDayCount().Tables[0];
|
|
var info = new SoftUserCountView()
|
|
{
|
|
AllUserOrderCount = Convert.ToInt32(dt.Rows[0][0]),
|
|
QlUserOrderCount = Convert.ToInt32(dt.Rows[0][1]),
|
|
ZzUserOrderCount = Convert.ToInt32(dt.Rows[0][2]),
|
|
TnbUserOrderCount = Convert.ToInt32(dt.Rows[0][3]),
|
|
YsUserOrderCount = Convert.ToInt32(dt.Rows[0][4]),
|
|
OtherUserOrderCount = Convert.ToInt32(dt.Rows[0][5]),
|
|
OverTimeUserOrderCount = Convert.ToInt32(dt.Rows[0][6]),
|
|
AllUserCount = Convert.ToInt32(dt.Rows[0][7]),
|
|
NewUserCount = Convert.ToInt32(dt.Rows[0][8]),
|
|
ThreeActiveUserCount = Convert.ToInt32(dt.Rows[0][9]),
|
|
SevenActiveUserCount = Convert.ToInt32(dt.Rows[0][10])
|
|
};
|
|
|
|
var softUserRegDayCount = new List<SoftUserRegDayCountView>();
|
|
foreach (DataRow item in dt2.Rows)
|
|
{
|
|
softUserRegDayCount.Add(new SoftUserRegDayCountView()
|
|
{
|
|
date = Convert.ToInt64(item[0]),
|
|
c1 = Convert.ToInt32(item[1]),
|
|
c2 = Convert.ToInt32(item[2]),
|
|
c3 = Convert.ToInt32(item[3])
|
|
});
|
|
}
|
|
|
|
info.xAxisdata = softUserRegDayCount.Select(p => p.date.ToString()).ToArray();
|
|
info.c1 = softUserRegDayCount.Select(p => p.c1).ToArray();
|
|
info.c2 = softUserRegDayCount.Select(p => p.c2).ToArray();
|
|
info.c3 = softUserRegDayCount.Select(p => p.c3).ToArray();
|
|
|
|
LogHelper.Info(info.xAxisdata.ToJson());
|
|
|
|
return info;
|
|
}
|
|
|
|
public List<SoftRptListView> GetSoftRpt(DateTime stime, DateTime etime, string companyCode)
|
|
{
|
|
var host = ConfigurationManager.AppSettings["WxMessage_" + companyCode].ToString();
|
|
var url = host + "/WxOrderSvr.svc/SoftRpt/Get";
|
|
var para = "stime=" + stime + "&etime=" + etime;
|
|
|
|
LogHelper.Info("url:" + para);
|
|
var res = CRM.Core.Common.Utility.GetData(url, para);
|
|
|
|
var result = JsonConvert.DeserializeObject<retMsg<List<SoftRptListView>>>(res);
|
|
|
|
var adchannels = _adchannel.GetList();
|
|
|
|
foreach (var item in result.retmsg)
|
|
{
|
|
var adchannel = adchannels.FirstOrDefault(p => p.ch == item.ch);
|
|
if (adchannel != null)
|
|
{
|
|
item.adtype = adchannel.adtype;
|
|
item.aduser = adchannel.aduser;
|
|
}
|
|
}
|
|
|
|
return result.retmsg;
|
|
}
|
|
}
|
|
|
|
public class SoftUserCountView
|
|
{
|
|
public int AllUserOrderCount { get; set; }
|
|
public int QlUserOrderCount { get; set; }
|
|
public int ZzUserOrderCount { get; set; }
|
|
public int TnbUserOrderCount { get; set; }
|
|
public int YsUserOrderCount { get; set; }
|
|
public int OtherUserOrderCount { get; set; }
|
|
public int OverTimeUserOrderCount { get; set; }
|
|
public int AllUserCount { get; set; }
|
|
public int NewUserCount { get; set; }
|
|
public int ThreeActiveUserCount { get; set; }
|
|
public int SevenActiveUserCount { get; set; }
|
|
|
|
public string[] xAxisdata { get; set; }
|
|
public int[] c1 { get; set; }
|
|
public int[] c2 { get; set; }
|
|
public int[] c3 { get; set; }
|
|
}
|
|
|
|
public class SoftUserRegDayCountView
|
|
{
|
|
public long date { get; set; }
|
|
public int c1 { get; set; }
|
|
public int c2 { get; set; }
|
|
public int c3 { get; set; }
|
|
}
|
|
|
|
public class SoftRptListView
|
|
{
|
|
public string ch { get; set; }
|
|
public decimal registernumber { get; set; }
|
|
public decimal resourcenumber { get; set; }
|
|
public string resourcerate { get; set; }
|
|
public decimal recordcount { get; set; }
|
|
public string recordcountrate { get; set; }
|
|
public decimal recordnumber { get; set; }
|
|
public string recordrate { get; set; }
|
|
public decimal firstcallnumber { get; set; }
|
|
public decimal secondcallnumber { get; set; }
|
|
public decimal smallordernumber { get; set; }
|
|
public string smallorderrate { get; set; }
|
|
public decimal allordernumber { get; set; }
|
|
public string allorderrate { get; set; }
|
|
public decimal allorderprice { get; set; }
|
|
public string adtype { get; set; }
|
|
public string aduser { get; set; }
|
|
}
|
|
}
|