Report.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <?php
  2. namespace catchAdmin\report\controller;
  3. use catcher\base\CatchRequest as Request;
  4. use catcher\CatchResponse;
  5. use catcher\base\CatchController;
  6. use catchAdmin\report\model\Report as ReportModel;
  7. class Report extends CatchController
  8. {
  9. protected $reportModel;
  10. public function __construct(ReportModel $reportModel)
  11. {
  12. $this->reportModel = $reportModel;
  13. }
  14. /**
  15. * 首页数量数据
  16. * @param Request $request
  17. */
  18. public function homePageCountData(Request $request)
  19. {
  20. // 部门数据
  21. $department_data = $this->reportModel->getDepartmentCountData() ?: [];
  22. // 用户数据
  23. $user_data = $this->reportModel->getDeviceUserCountData() ?: [];
  24. $data = array_merge($department_data, $user_data);
  25. return CatchResponse::success($data);
  26. }
  27. /**
  28. * 基站增长趋势数据
  29. * @param Request $request
  30. */
  31. public function stationGrowthTrendData(Request $request)
  32. {
  33. $data = $this->reportModel->getStationGrowthTrendData() ?: [];
  34. return CatchResponse::success($data);
  35. }
  36. /**
  37. * 用户设备增长趋势数据
  38. * @param Request $request
  39. */
  40. public function deviceGrowthTrendData(Request $request)
  41. {
  42. $data = $this->reportModel->getDeviceGrowthTrendData() ?: [];
  43. return CatchResponse::success($data);
  44. }
  45. /**
  46. * 设备类型统计
  47. * @param Request $request
  48. */
  49. public function hydraulicCount(Request $request)
  50. {
  51. $list =array(
  52. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>5,'remarks'=>''],
  53. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>3,'remarks'=>''],
  54. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>2,'remarks'=>''],
  55. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>4,'remarks'=>''],
  56. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>1,'remarks'=>''],
  57. );
  58. $list20 =array(
  59. ['type'=>'液压泵','name'=>'测试设备2','number'=>20210618,'online_time'=>'2022-06-03 11:10:11','address'=>'杭州滨江','unused_days'=>20,'remarks'=>''],
  60. ['type'=>'液压泵','name'=>'测试设备2','number'=>20210618,'online_time'=>'2022-06-03 11:10:11','address'=>'杭州滨江','unused_days'=>22,'remarks'=>''],
  61. ['type'=>'液压泵','name'=>'测试设备2','number'=>20210618,'online_time'=>'2022-06-03 11:10:11','address'=>'杭州滨江','unused_days'=>22,'remarks'=>''],
  62. ['type'=>'液压泵','name'=>'测试设备2','number'=>20210618,'online_time'=>'2022-06-03 11:10:11','address'=>'杭州滨江','unused_days'=>22,'remarks'=>''],
  63. ['type'=>'液压泵','name'=>'测试设备2','number'=>20210618,'online_time'=>'2022-06-03 11:10:11','address'=>'杭州滨江','unused_days'=>22,'remarks'=>''],
  64. ['type'=>'液压泵','name'=>'测试设备2','number'=>20210618,'online_time'=>'2022-06-03 11:10:11','address'=>'杭州滨江','unused_days'=>22,'remarks'=>''],
  65. );
  66. $list40 =array(
  67. ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
  68. ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
  69. ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
  70. ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
  71. ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
  72. ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
  73. ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
  74. ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
  75. );
  76. $pie_data=array(
  77. ['name'=>'正常使用','value'=>5],
  78. ['name'=>'20+天未使用','value'=>6],
  79. ['name'=>'40+天未使用','value'=>8],
  80. );
  81. $data=array(
  82. 'list'=>$list,
  83. 'list20'=>$list20,
  84. 'list40'=>$list40,
  85. 'pie_data'=>$pie_data,
  86. );
  87. return CatchResponse::success($data);
  88. }
  89. /**
  90. * 告警统计
  91. * @param Request $request
  92. */
  93. public function alarmDeviceCount(Request $request)
  94. {
  95. $list =array(
  96. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','code'=>'ERROR_CODE','comment'=>'液压油偏低','remarks'=>''],
  97. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','code'=>'ERROR_CODE','comment'=>'液压油偏低','remarks'=>''],
  98. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','code'=>'ERROR_CODE','comment'=>'液压油偏低','remarks'=>''],
  99. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','code'=>'ERROR_CODE','comment'=>'液压油偏低','remarks'=>''],
  100. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','code'=>'ERROR_CODE','comment'=>'液压油偏低','remarks'=>''],
  101. );
  102. $pie_dataA=array(
  103. ['name'=>'故障设备','value'=>15],
  104. ['name'=>'未出现故障设备','value'=>4],
  105. );
  106. $pie_dataB=array(
  107. ['name'=>'液压油偏低','value'=>10],
  108. ['name'=>'扳手校验不合格','value'=>8],
  109. ['name'=>'液压泵校验过期','value'=>6],
  110. ['name'=>'扳手外观不合格','value'=>5],
  111. ['name'=>'设备异常','value'=>4],
  112. ['name'=>'其他','value'=>3],
  113. );
  114. $pie_dataC=array(
  115. ['name'=>' 测试设备1','value'=>9],
  116. ['name'=>' 测试设备2','value'=>8],
  117. ['name'=>' 测试设备3','value'=>7],
  118. ['name'=>' 测试设备4','value'=>5],
  119. ['name'=>' 测试设备5','value'=>4],
  120. ['name'=>' 其他设备','value'=>3],
  121. );
  122. $data=array(
  123. 'list'=>$list,
  124. 'pie_dataA'=>$pie_dataA,
  125. 'pie_dataB'=>$pie_dataB,
  126. 'pie_dataC'=>$pie_dataC,
  127. );
  128. return CatchResponse::success($data);
  129. }
  130. /**
  131. * 作业记录统计
  132. * @param Request $request
  133. */
  134. public function workCount(Request $request)
  135. {
  136. $list =array(
  137. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'wind_name'=>'风场A','fan_num'=>20,'bolt_num'=>40,'remarks'=>''],
  138. );
  139. $pie_dataB=array(
  140. ['name'=>' 测试设备1','value'=>9],
  141. ['name'=>' 测试设备2','value'=>8],
  142. ['name'=>' 测试设备3','value'=>7],
  143. ['name'=>' 测试设备4','value'=>5],
  144. ['name'=>' 测试设备5','value'=>4],
  145. ['name'=>' 其他设备','value'=>3],
  146. );
  147. $pie_dataC=array(
  148. ['name'=>' 风场A','value'=>9],
  149. ['name'=>' 风场B','value'=>8],
  150. ['name'=>' 风场C','value'=>7],
  151. ['name'=>' 风场D','value'=>5],
  152. ['name'=>' 风场E','value'=>4],
  153. ['name'=>' 其他风场','value'=>3],
  154. );
  155. $data=array(
  156. 'list'=>$list,
  157. 'pie_dataB'=>$pie_dataB,
  158. 'pie_dataC'=>$pie_dataC,
  159. );
  160. return CatchResponse::success($data);
  161. }
  162. /**
  163. * 维保设备记录统计
  164. * @param Request $request
  165. */
  166. public function maintainCount(Request $request)
  167. {
  168. $list =array(
  169. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>5,'remarks'=>''],
  170. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>3,'remarks'=>''],
  171. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>2,'remarks'=>''],
  172. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>4,'remarks'=>''],
  173. ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>1,'remarks'=>''],
  174. );
  175. $pie_dataA=array(
  176. ['name'=>'有效期内','value'=>15],
  177. ['name'=>'已失效(小于15天)','value'=>4],
  178. );
  179. $pie_dataB=array(
  180. ['name'=>'有效使用(大于45天)','value'=>13],
  181. ['name'=>'警告失效(15~45天)','value'=>2],
  182. ['name'=>'失效(0~15天)','value'=>4],
  183. );
  184. $pie_dataC=array(
  185. ['name'=>'已维护','value'=>15],
  186. ['name'=>'未维护','value'=>4],
  187. );
  188. $data=array(
  189. 'list'=>$list,
  190. 'pie_dataA'=>$pie_dataA,
  191. 'pie_dataB'=>$pie_dataB,
  192. 'pie_dataC'=>$pie_dataC,
  193. );
  194. return CatchResponse::success($data);
  195. }
  196. }