ReportController.java 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. package com.keystar.plane.inspection.controller;
  2. /**
  3. * @Author Lucien
  4. * @Date 2023-03-02 08:00:00
  5. * @Describe 报告接口调用测试类
  6. */
  7. import com.keystar.plane.inspection.bo.PlaneInspectionPicBo;
  8. import com.keystar.plane.inspection.bo.PlaneInspectionResultBo;
  9. import com.keystar.plane.inspection.bo.PlaneInspectionResultDetailBo;
  10. import com.keystar.plane.inspection.service.IReportService;
  11. import lombok.extern.slf4j.Slf4j;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.GetMapping;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.RestController;
  16. import java.util.ArrayList;
  17. import java.util.HashMap;
  18. import java.util.List;
  19. import java.util.Map;
  20. @RestController
  21. @RequestMapping(value = "/report")
  22. @Slf4j
  23. public class ReportController {
  24. @Autowired
  25. private IReportService reportService;
  26. @GetMapping("/test")
  27. public void test() {
  28. Map<String, String> mFlyCountMap = new HashMap<>();
  29. //下面这些参数是查库得出, 所以不写在Service里面, 生成时候查库生成即可, 下面用到的都是测试数据
  30. //本月飞行总架次
  31. mFlyCountMap.put("TotalSortie", "10");
  32. //有效巡检架次
  33. mFlyCountMap.put("EffectiveSortie", "10");
  34. //有效巡检天数
  35. mFlyCountMap.put("EffectiveInspectionDate", "10");
  36. Map<String, String> mSummaryMap = new HashMap<>();
  37. //方阵总数(16不需要修改)
  38. mSummaryMap.put("TotalFZ", "16");
  39. //组串总数(4624不需要修改)
  40. mSummaryMap.put("TotalPVString", "4624");
  41. //光伏板总数(124848不需要修改)
  42. mSummaryMap.put("TotalPVPanel", "124848");
  43. //无人机巡检覆盖方阵数
  44. mSummaryMap.put("CoveredFZ", "16");
  45. //无人机巡检覆盖方阵百分比
  46. mSummaryMap.put("CoveredFZPct", "100%");
  47. //本月巡检覆盖组串总数
  48. mSummaryMap.put("CoveredPVString", "4624");
  49. //本月巡检覆盖组串百分比
  50. mSummaryMap.put("CoveredPVStringPct", "100%");
  51. //本月巡检覆盖光伏板总数
  52. mSummaryMap.put("CoveredPVPanel", "124848");
  53. //本月巡检覆盖光伏板百分比
  54. mSummaryMap.put("CoveredPVPanelPct", "100%");
  55. //无人机未巡检方阵数
  56. mSummaryMap.put("UncoveredFZ", "0");
  57. //无人机未巡检方阵百分比
  58. mSummaryMap.put("UnCoveredFZPct", "0");
  59. //本月未巡检组串总数
  60. mSummaryMap.put("UncoveredPVString", "0");
  61. //本月未巡检组串百分比
  62. mSummaryMap.put("UncoveredPVStringPct", "0");
  63. //本月未巡检光伏板总数
  64. mSummaryMap.put("UncoveredPVPanel", "0");
  65. //本月未巡检光伏板百分比
  66. mSummaryMap.put("UncoveredPVPanelPct", "0");
  67. //存在异常方阵数
  68. mSummaryMap.put("FltFZ", "1");
  69. //存在异常方阵百分比
  70. mSummaryMap.put("FltFZPct", "10%");
  71. //存在异常组串总数
  72. mSummaryMap.put("FltPVString", "50");
  73. //存在异常组串百分比
  74. mSummaryMap.put("FltPVStringPct", "1%");
  75. //存在异常光伏板总数
  76. mSummaryMap.put("FltPVPanel", "12345");
  77. //存在异常光伏板百分比
  78. mSummaryMap.put("FltPVPanelPct", "9%");
  79. //存在二极管故障的方阵数
  80. mSummaryMap.put("DioFZ", "10");
  81. //存在二极管故障的方阵百分比
  82. mSummaryMap.put("DioFZPct", "1%");
  83. //存在二极管故障的组串总数
  84. mSummaryMap.put("DioPVString", "10");
  85. //存在二极管故障的组串百分比
  86. mSummaryMap.put("DioPVStringPct", "1%");
  87. //存在二极管故障的光伏板总数
  88. mSummaryMap.put("DioPVPanel", "10");
  89. //存在二极管故障的光伏板百分比
  90. mSummaryMap.put("DioPVPanelPct", "1%");
  91. //存在热斑的方阵数
  92. mSummaryMap.put("HtsptFZ", "10");
  93. //存在热斑的方阵百分比
  94. mSummaryMap.put("HtsptFZPct", "1%");
  95. //存在热斑的组串总数
  96. mSummaryMap.put("HtsptPVString", "10");
  97. //存在热斑的组串百分比
  98. mSummaryMap.put("HtsptPVStringPct", "1%");
  99. //存在热斑的光伏板总数
  100. mSummaryMap.put("HtsptPVPanel", "10");
  101. //存在热斑的光伏板百分比
  102. mSummaryMap.put("HtsptPVPanelPct", "1%");
  103. //存在掉串的方阵数
  104. mSummaryMap.put("OcFZ", "10");
  105. //存在掉串的方阵百分比
  106. mSummaryMap.put("OcFZPct", "1%");
  107. //存在掉串的组串总数
  108. mSummaryMap.put("OcPVString", "10");
  109. //存在掉串的组串百分比
  110. mSummaryMap.put("OcPVStringPct", "1%");
  111. //存在掉串的光伏板总数
  112. mSummaryMap.put("OcPVPanel", "10");
  113. //存在掉串的光伏板百分比
  114. mSummaryMap.put("OcPVPanelPct", "1%");
  115. //下面这些可能要宇峰那边帮忙算
  116. //月度损失电量
  117. mSummaryMap.put("TotalLose", "111");
  118. //二极管故障损失量
  119. mSummaryMap.put("DioLose", "222");
  120. //热斑损失电量
  121. mSummaryMap.put("HtsptLose", "333");
  122. //掉串损失电量
  123. mSummaryMap.put("OcLose", "444");
  124. //查库组装巡检结果集合传入函数即可
  125. List<PlaneInspectionResultBo> planeInspectionResultBoList = new ArrayList<>();
  126. PlaneInspectionResultBo planeInspectionResultBo = new PlaneInspectionResultBo();
  127. planeInspectionResultBo.setId("1");
  128. planeInspectionResultBo.setDetails(new ArrayList<>());
  129. PlaneInspectionResultDetailBo planeInspectionResultDetailBo1 = new PlaneInspectionResultDetailBo();
  130. planeInspectionResultDetailBo1.setNum("1");
  131. planeInspectionResultDetailBo1.setName("FZ01-HL03");
  132. planeInspectionResultDetailBo1.setDioe("1");
  133. planeInspectionResultDetailBo1.setHtspte("0");
  134. planeInspectionResultDetailBo1.setOce("1");
  135. planeInspectionResultBo.getDetails().add(planeInspectionResultDetailBo1);
  136. PlaneInspectionResultDetailBo planeInspectionResultDetailBo2 = new PlaneInspectionResultDetailBo();
  137. planeInspectionResultDetailBo2.setNum("2");
  138. planeInspectionResultDetailBo2.setName("FZ01-HL04");
  139. planeInspectionResultDetailBo2.setDioe("0");
  140. planeInspectionResultDetailBo2.setHtspte("1");
  141. planeInspectionResultDetailBo2.setOce("0");
  142. planeInspectionResultBo.getDetails().add(planeInspectionResultDetailBo2);
  143. planeInspectionResultBo.setPics(new ArrayList<>());
  144. PlaneInspectionPicBo planeInspectionPicBo1 = new PlaneInspectionPicBo();
  145. planeInspectionPicBo1.setVisible(reportService.pic2Base64FromMinio("/nest/photo/2420/1872/方阵13-16巡检任务0224-2023-02-26-15-18-29-DJI_20230226144300_0006_THRM.jpg"));
  146. planeInspectionPicBo1.setInfrared(reportService.pic2Base64FromMinio("/nest/photo/2420/1872/方阵13-16巡检任务0224-2023-02-26-15-18-38-DJI_20230226144304_0007_ZOOM.jpg"));
  147. planeInspectionResultBo.getPics().add(planeInspectionPicBo1);
  148. PlaneInspectionPicBo planeInspectionPicBo2 = new PlaneInspectionPicBo();
  149. planeInspectionPicBo2.setVisible(reportService.pic2Base64FromMinio("/nest/photo/2420/1872/方阵13-16巡检任务0224-2023-02-26-15-18-34-DJI_20230226144302_0006_ZOOM.jpg"));
  150. planeInspectionPicBo2.setInfrared(reportService.pic2Base64FromMinio("/nest/photo/2420/1872/方阵13-16巡检任务0224-2023-02-26-15-18-48-DJI_20230226144308_0010_THRM.jpg"));
  151. planeInspectionResultBo.getPics().add(planeInspectionPicBo2);
  152. planeInspectionResultBoList.add(planeInspectionResultBo);
  153. PlaneInspectionResultBo planeInspectionResultBoNext = new PlaneInspectionResultBo();
  154. planeInspectionResultBoNext.setId("2x");
  155. planeInspectionResultBoNext.setDetails(new ArrayList<>());
  156. PlaneInspectionResultDetailBo planeInspectionResultDetailBo3 = new PlaneInspectionResultDetailBo();
  157. planeInspectionResultDetailBo3.setNum("3");
  158. planeInspectionResultDetailBo3.setName("FZ03-HL03");
  159. planeInspectionResultDetailBo3.setDioe("0");
  160. planeInspectionResultDetailBo3.setHtspte("0");
  161. planeInspectionResultDetailBo3.setOce("1");
  162. planeInspectionResultBoNext.getDetails().add(planeInspectionResultDetailBo3);
  163. PlaneInspectionResultDetailBo planeInspectionResultDetailBo4 = new PlaneInspectionResultDetailBo();
  164. planeInspectionResultDetailBo4.setNum("4");
  165. planeInspectionResultDetailBo4.setName("FZ03-HL04");
  166. planeInspectionResultDetailBo4.setDioe("0");
  167. planeInspectionResultDetailBo4.setHtspte("1");
  168. planeInspectionResultDetailBo4.setOce("1");
  169. planeInspectionResultBoNext.getDetails().add(planeInspectionResultDetailBo4);
  170. planeInspectionResultBoNext.setPics(new ArrayList<>());
  171. PlaneInspectionPicBo planeInspectionPicBo3 = new PlaneInspectionPicBo();
  172. planeInspectionPicBo3.setInfrared(reportService.pic2Base64FromMinio("/nest/photo/2420/1872/方阵13-16巡检任务0224-2023-02-26-15-18-39-DJI_20230226144304_0008_THRM.jpg"));
  173. planeInspectionPicBo3.setVisible(reportService.pic2Base64FromMinio("/nest/photo/2420/1872/方阵13-16巡检任务0224-2023-02-26-15-18-52-DJI_20230226144310_0010_ZOOM.jpg"));
  174. planeInspectionResultBoNext.getPics().add(planeInspectionPicBo3);
  175. PlaneInspectionPicBo planeInspectionPicBo4 = new PlaneInspectionPicBo();
  176. planeInspectionPicBo4.setInfrared(reportService.pic2Base64FromMinio("/nest/photo/2420/1872/方阵13-16巡检任务0224-2023-02-26-15-18-35-DJI_20230226144302_0007_THRM.jpg"));
  177. planeInspectionPicBo4.setVisible(reportService.pic2Base64FromMinio("/nest/photo/2420/1872/方阵13-16巡检任务0224-2023-02-26-15-18-42-DJI_20230226144306_0008_ZOOM.jpg"));
  178. planeInspectionResultBoNext.getPics().add(planeInspectionPicBo4);
  179. planeInspectionResultBoList.add(planeInspectionResultBoNext);
  180. //生成报告主函数
  181. reportService.createReport(mFlyCountMap, mSummaryMap, planeInspectionResultBoList);
  182. }
  183. }