ReportBLL.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. using PMS.DBService.Problems;
  2. using PMS.Interface.Problems;
  3. using QWPlatform.IService;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using PMS.BusinessModels.Problem;
  10. using System.Data;
  11. using QWPlatform.SystemLibrary;
  12. using QWPlatform.SystemLibrary.Utils;
  13. using PMS.BusinessModels.Account;
  14. namespace PMS.BusinessService.Problems
  15. {
  16. public class ReportBLL : IReport
  17. {
  18. private ReportService ReportService = DataServiceBase.Instance<ReportService>();
  19. public string GetAfterSale(AfterSaleModel model)
  20. {
  21. var total = 0;
  22. var dt= ReportService.GetAfterSale(model , out total);
  23. float TotalScore = 0;
  24. if (dt != null && dt.Rows.Count > 0)
  25. {
  26. foreach( DataRow row in dt.Rows)
  27. {
  28. var core = row.GetValueByName<float>("问题分值");
  29. TotalScore += core;
  30. }
  31. }
  32. var footer = new List<AfterSaleFooter>();
  33. footer.Add(new AfterSaleFooter { 编号 = "合计", 问题分值 = TotalScore });
  34. var ReportObject = new
  35. {
  36. total = total,
  37. rows = dt,
  38. footer= footer
  39. };
  40. return Strings.ObjectToJson(ReportObject);
  41. }
  42. public string GetChannel()
  43. {
  44. return ReportService.GetChannel().ToJson();
  45. }
  46. public string GetRing()
  47. {
  48. return ReportService.GetRing().ToJson();
  49. }
  50. /// <summary>
  51. /// 获取监控数据表格
  52. /// </summary>
  53. /// <param name="model"></param>
  54. /// <returns></returns>
  55. public string GetMonitoring(MonitoringModel model)
  56. {
  57. var total = 0;
  58. var dt = ReportService.GetMonitoring(model,out total);
  59. var ReportObject = new
  60. {
  61. total = total,
  62. rows = dt
  63. };
  64. return Strings.ObjectToJson(ReportObject);
  65. }
  66. /// <summary>
  67. /// 渠道服务问题统计
  68. /// </summary>
  69. /// <param name="model"></param>
  70. /// <returns></returns>
  71. public string GetChannelStatistics(MonitoringModel model)
  72. {
  73. var total = 0;
  74. DataTable dt = ReportService.GetChannelStatistics(model, out total);
  75. var TotalScore = 0;
  76. if (dt != null && dt.Rows.Count > 0)
  77. {
  78. foreach (DataRow row in dt.Rows)
  79. {
  80. var core = row.GetValueByName<int>("服务数量");
  81. TotalScore += core;
  82. }
  83. }
  84. var footer = new List<AfterSaleFooter>();
  85. footer.Add(new AfterSaleFooter { 名称 = "合计", 服务数量 = TotalScore });
  86. var ReportObject = new
  87. {
  88. footer = footer,
  89. total = total,
  90. rows = dt
  91. };
  92. return Strings.ObjectToJson(ReportObject);
  93. }
  94. /// <summary>
  95. /// 反馈人服务问题统计
  96. /// </summary>
  97. /// <param name="model"></param>
  98. /// <returns></returns>
  99. public string GetFeedbackStatistics(MonitoringModel model)
  100. {
  101. var total = 0;
  102. DataTable dt = ReportService.GetFeedbackStatistics(model, out total);
  103. var TotalScore = 0;
  104. if (dt != null && dt.Rows.Count > 0)
  105. {
  106. foreach (DataRow row in dt.Rows)
  107. {
  108. var core = row.GetValueByName<int>("服务数量");
  109. TotalScore += core;
  110. }
  111. }
  112. var footer = new List<AfterSaleFooter>();
  113. footer.Add(new AfterSaleFooter { 姓名 = "合计", 服务数量 = TotalScore });
  114. var ReportObject = new
  115. {
  116. footer = footer,
  117. total = total,
  118. rows = dt
  119. };
  120. return Strings.ObjectToJson(ReportObject);
  121. }
  122. /// <summary>
  123. /// 未完成问题统计
  124. /// </summary>
  125. /// <param name="model"></param>
  126. /// <returns></returns>
  127. public string GetNotYetStatistics(MonitoringModel model)
  128. {
  129. var total = 0;
  130. DataTable dt = ReportService.GetNotYetStatistics(model, out total);
  131. var TotalScore = 0;
  132. if (dt != null && dt.Rows.Count > 0)
  133. {
  134. foreach (DataRow row in dt.Rows)
  135. {
  136. var core = row.GetValueByName<int>("服务数量");
  137. TotalScore += core;
  138. }
  139. }
  140. var ReportObject = new
  141. {
  142. total = total,
  143. rows = dt,
  144. };
  145. return Strings.ObjectToJson(ReportObject);
  146. }
  147. /// <summary>
  148. /// 获取统计报表
  149. /// </summary>
  150. /// <returns></returns>
  151. public string GetList(UserInfo user)
  152. {
  153. DataTable dt= ReportService.GetList(user.PersonProperty);
  154. var json = "[{";
  155. foreach (DataRow row in dt.Rows)
  156. {
  157. if (row.GetValueByName<int>("上级ID") == 0)
  158. {
  159. json += "'渠道id':'"+user.CompanyID+"','id':" + row.GetValueByName<int>("ID") + ",'text':'" + row.GetValueByName<string>("报表名称") + "','children': [";
  160. foreach (DataRow r in dt.Rows)
  161. {
  162. if (r.GetValueByName<int>("上级ID") == row.GetValueByName<int>("ID"))
  163. {
  164. json += "{ 'text': '" + r.GetValueByName<string>("报表名称") + "','url':'" + r.GetValueByName<string>("报表地址") + "','file':'" + r.GetValueByName<string>("文件名称") + "'},";
  165. }
  166. }
  167. json += "],";
  168. }
  169. }
  170. json += "}]";
  171. return json;
  172. }
  173. /// <summary>
  174. /// 技术中心问题统计
  175. /// </summary>
  176. /// <param name="model"></param>
  177. /// <returns></returns>
  178. public string GetSupportStatistics(MonitoringModel model)
  179. {
  180. var total = 0;
  181. DataTable dt = ReportService.GetSupportStatistics(model, out total);
  182. var ReportObject = new
  183. {
  184. total = total,
  185. rows = dt,
  186. };
  187. return Strings.ObjectToJson(ReportObject);
  188. }
  189. /// <summary>
  190. /// 研发问题统计
  191. /// </summary>
  192. /// <param name="model"></param>
  193. /// <returns></returns>
  194. public string GetDevelopStatistics(MonitoringModel model)
  195. {
  196. var total = 0;
  197. DataTable dt = ReportService.GetDevelopStatistics(model, out total);
  198. var ReportObject = new
  199. {
  200. total = total,
  201. rows = dt,
  202. };
  203. return Strings.ObjectToJson(ReportObject);
  204. }
  205. /// <summary>
  206. /// 超时处理(30分钟)
  207. /// </summary>
  208. /// <param name="model"></param>
  209. /// <returns></returns>
  210. public string TimeoutStatistics(MonitoringModel model)
  211. {
  212. var total = 0;
  213. DataTable dt = ReportService.TimeoutStatistics(model, out total);
  214. var footer = new List<AfterSaleFooter>();
  215. footer.Add(new AfterSaleFooter { 编号 = "合计", 问题标题 = total });
  216. var ReportObject = new
  217. {
  218. footer = footer,
  219. total = total,
  220. rows = dt
  221. };
  222. return Strings.ObjectToJson(ReportObject);
  223. }
  224. /// <summary>
  225. /// 贵阳售后统计问题积分
  226. /// </summary>
  227. /// <param name="model"></param>
  228. /// <returns></returns>
  229. public string GuiyangProblems(AfterSaleModel model)
  230. {
  231. var total = 0;
  232. var dt = ReportService.GuiyangProblems(model, out total);
  233. float TotalScore = 0;
  234. if (dt != null && dt.Rows.Count > 0)
  235. {
  236. foreach (DataRow row in dt.Rows)
  237. {
  238. var core1 = row.GetValueByName<float>("陈勇");
  239. var core2 = row.GetValueByName<float>("池显");
  240. var core3 = row.GetValueByName<float>("兰忠胜");
  241. var core4 = row.GetValueByName<float>("陈运良");
  242. row["问题分值"]= (core1 + core2 + core3 + core4);
  243. TotalScore += (core1+ core2+ core3+ core4);
  244. }
  245. }
  246. var footer = new List<AfterSaleFooter>();
  247. footer.Add(new AfterSaleFooter { 名称 = "合计", 问题分值 = TotalScore });
  248. var ReportObject = new
  249. {
  250. total = total,
  251. rows = dt,
  252. footer = footer
  253. };
  254. return Strings.ObjectToJson(ReportObject);
  255. }
  256. /// <summary>
  257. /// 获取渠道脱保数
  258. /// </summary>
  259. /// <param name="model"></param>
  260. /// <returns></returns>
  261. public string GeMaintenanceInquiry(MaintenanceModel model)
  262. {
  263. var total = 0;
  264. var dt = ReportService.GeMaintenanceInquiry(model, out total);
  265. float TotalScore = 0;
  266. var ReportObject = new
  267. {
  268. total = total,
  269. rows = dt
  270. };
  271. return Strings.ObjectToJson(ReportObject);
  272. }
  273. }
  274. }