ProEconShutdownEvent2Controller.java 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. package com.gyee.alarm.controller;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  4. import com.gyee.alarm.init.CacheContext;
  5. import com.gyee.alarm.model.auto.ProBasicEquipment;
  6. import com.gyee.alarm.model.auto.ProBasicEquipmentPoint;
  7. import com.gyee.alarm.model.auto.ProEconShutdownEvent2;
  8. import com.gyee.alarm.model.vo.AjaxResult;
  9. import com.gyee.alarm.model.vo.AjaxStatus;
  10. import com.gyee.alarm.service.auto.IProEconShutdownEvent2Service;
  11. import com.gyee.alarm.util.StringUtils;
  12. import io.swagger.annotations.ApiImplicitParam;
  13. import io.swagger.annotations.ApiImplicitParams;
  14. import io.swagger.annotations.ApiOperation;
  15. import org.springframework.web.bind.annotation.GetMapping;
  16. import org.springframework.web.bind.annotation.RequestMapping;
  17. import org.springframework.web.bind.annotation.RestController;
  18. import javax.annotation.Resource;
  19. import java.text.ParseException;
  20. import java.text.SimpleDateFormat;
  21. import java.util.*;
  22. /**
  23. * <p>
  24. * 停机事件2 前端控制器
  25. * </p>
  26. *
  27. * @author shilin
  28. * @since 2022-10-21
  29. */
  30. @RestController
  31. @RequestMapping("//shutdownevent2")
  32. public class ProEconShutdownEvent2Controller {
  33. @Resource
  34. private IProEconShutdownEvent2Service proEconShutdownEvent2Service;
  35. @GetMapping(value = "/queryshutdowneventlist")
  36. @ApiOperation(value = "查询停机事件记录", notes = "查询停机事件记录")
  37. @ApiImplicitParams({
  38. @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
  39. @ApiImplicitParam(name = "wtId", value = "设备编号", required = false, dataType = "string", paramType = "query"),
  40. @ApiImplicitParam(name = "description", value = "故障描述 模糊查询", required = false, dataType = "string", paramType = "query"),
  41. @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
  42. @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query"),
  43. @ApiImplicitParam(name = "pageNum", value = "当前页号", required = true, dataType = "string", paramType = "query"),
  44. @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "string", paramType = "query"),
  45. @ApiImplicitParam(name = "type", value = "类型(gz 故障、wh 维护)", required = true, dataType = "string", paramType = "query")
  46. })
  47. public AjaxResult queryshutdowneventlist(String wpId, String wtId,String description,String begin,String end,Integer pageNum, Integer pageSize,String type) {
  48. IPage<ProEconShutdownEvent2> vos=new Page<>();
  49. if (StringUtils.notEmp(begin) && StringUtils.notEmp(end) && StringUtils.notEmp(pageNum) && StringUtils.notEmp(pageSize) && StringUtils.notEmp(type)) {
  50. vos=proEconShutdownEvent2Service.queryShutdownEvent2(wpId, wtId, description, begin, end, pageNum, pageSize,type);
  51. }
  52. for(ProEconShutdownEvent2 vo:vos.getRecords())
  53. {
  54. if(StringUtils.notEmp(vo.getWindturbineId()) && CacheContext.wtmap.containsKey(vo.getWindturbineId()))
  55. {
  56. vo.setCode(CacheContext.wtmap.get(vo.getWindturbineId()).getNemCode());
  57. }
  58. if(StringUtils.notEmp(vo.getWindturbineId()) && CacheContext.wtmap.containsKey(vo.getWindturbineId()))
  59. {
  60. vo.setWindturbineName(CacheContext.wtmap.get(vo.getWindturbineId()).getName());
  61. }
  62. }
  63. if (StringUtils.notEmp(vos)) {
  64. return AjaxResult.successData(AjaxStatus.success.code, vos);
  65. } else {
  66. return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
  67. }
  68. }
  69. @GetMapping(value = "/queryShutdownEvent2ByType")
  70. @ApiOperation(value = "停机记录按分类统计", notes = "停机记录按分类统计")
  71. @ApiImplicitParams({
  72. @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
  73. @ApiImplicitParam(name = "modelId", value = "型号", required = false, dataType = "string", paramType = "query"),
  74. @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
  75. @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query")
  76. })
  77. public AjaxResult queryShutdownEvent2ByType(String wpId, String modelId,String begin,String end) throws ParseException {
  78. List<ProEconShutdownEvent2> vos=new ArrayList();
  79. if (StringUtils.notEmp(begin) && StringUtils.notEmp(end) ) {
  80. Date beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(begin);
  81. Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end);
  82. vos=proEconShutdownEvent2Service.queryShutdownEvent2ByType(wpId, modelId,beginDate, endDate);
  83. }
  84. if (StringUtils.notEmp(vos)) {
  85. return AjaxResult.successData(AjaxStatus.success.code, vos);
  86. } else {
  87. return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
  88. }
  89. }
  90. @GetMapping(value = "/queryShutdownEvent2ByDay")
  91. @ApiOperation(value = "停机记录按日期统计", notes = "停机记录按日期统计")
  92. @ApiImplicitParams({
  93. @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
  94. @ApiImplicitParam(name = "modelId", value = "型号", required = false, dataType = "string", paramType = "query"),
  95. @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
  96. @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query")
  97. })
  98. public AjaxResult queryShutdownEvent2ByDay(String wpId, String modelId,String begin,String end) throws ParseException {
  99. List<ProEconShutdownEvent2> vos=new ArrayList();
  100. if (StringUtils.notEmp(begin) && StringUtils.notEmp(end) ) {
  101. Date beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(begin);
  102. Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end);
  103. vos=proEconShutdownEvent2Service.queryShutdownEvent2ByDay(wpId, modelId,beginDate, endDate);
  104. }
  105. if (StringUtils.notEmp(vos)) {
  106. return AjaxResult.successData(AjaxStatus.success.code, vos);
  107. } else {
  108. return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
  109. }
  110. }
  111. @GetMapping(value = "/queryShutdownEvent2ByMonth")
  112. @ApiOperation(value = "停机记录按日期统计", notes = "停机记录按日期统计")
  113. @ApiImplicitParams({
  114. @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
  115. @ApiImplicitParam(name = "modelId", value = "型号", required = false, dataType = "string", paramType = "query"),
  116. @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
  117. @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query")
  118. })
  119. public AjaxResult queryShutdownEvent2ByMonth(String wpId, String modelId,String begin,String end) throws ParseException {
  120. List<ProEconShutdownEvent2> vos=new ArrayList();
  121. if (StringUtils.notEmp(begin) && StringUtils.notEmp(end) ) {
  122. Date beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(begin);
  123. Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end);
  124. vos=proEconShutdownEvent2Service.queryShutdownEvent2ByMonth(wpId, modelId,beginDate, endDate);
  125. }
  126. if (StringUtils.notEmp(vos)) {
  127. return AjaxResult.successData(AjaxStatus.success.code, vos);
  128. } else {
  129. return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
  130. }
  131. }
  132. @GetMapping(value = "/queryShutdownEvent2ByMap")
  133. @ApiOperation(value = "非停机记录按统计", notes = "非停机记录按统计")
  134. @ApiImplicitParams({
  135. @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
  136. @ApiImplicitParam(name = "modelId", value = "型号", required = false, dataType = "string", paramType = "query"),
  137. @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
  138. @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query")
  139. })
  140. public AjaxResult queryShutdownEvent2ByMap(String wpId, String modelId,String begin,String end) throws ParseException {
  141. Map<String,List<ProEconShutdownEvent2>> map=new HashMap<>();
  142. if (StringUtils.notEmp(begin) && StringUtils.notEmp(end) ) {
  143. Date beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(begin);
  144. Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end);
  145. List<ProEconShutdownEvent2> vos=new ArrayList();
  146. vos=proEconShutdownEvent2Service.queryShutdownEvent2ByJX(wpId, modelId,beginDate, endDate);
  147. map.put("机械故障",vos);
  148. vos=proEconShutdownEvent2Service.queryShutdownEvent2ByDQ(wpId, modelId,beginDate, endDate);
  149. map.put("电气故障",vos);
  150. vos=proEconShutdownEvent2Service.queryShutdownEvent2ByOther(wpId, modelId,beginDate, endDate);
  151. map.put("其它",vos);
  152. }
  153. if (StringUtils.notEmp(map)) {
  154. return AjaxResult.successData(AjaxStatus.success.code, map);
  155. } else {
  156. return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
  157. }
  158. }
  159. }