OutputSpeedController.java 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. package com.gyee.runeconomy.controller;
  2. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  3. import com.gyee.runeconomy.dto.R;
  4. import com.gyee.runeconomy.dto.ResultMsg;
  5. import com.gyee.runeconomy.init.CacheContext;
  6. import com.gyee.runeconomy.model.auto.ProBasicEquipment;
  7. import com.gyee.runeconomy.model.auto.ProEconInOrOutSpeedTotal;
  8. import com.gyee.runeconomy.service.outputspeed.OutputSpeedService;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiImplicitParam;
  11. import io.swagger.annotations.ApiImplicitParams;
  12. import io.swagger.annotations.ApiOperation;
  13. import org.springframework.stereotype.Controller;
  14. import org.springframework.web.bind.annotation.PostMapping;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.ResponseBody;
  17. import javax.annotation.Resource;
  18. @Controller
  19. @RequestMapping("/outputspeed")
  20. @Api(value = "切入切出管理", tags = "切入切出管理")
  21. public class OutputSpeedController {
  22. @Resource
  23. private OutputSpeedService outputSpeedService;
  24. /**
  25. * 切入切出列表
  26. **/
  27. @PostMapping("/outputSpeedlist")
  28. @ResponseBody
  29. @ApiOperation(value = "切入切出列表", notes = "切入切出列表")
  30. @ApiImplicitParams({
  31. @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer", paramType = "query"),
  32. @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "Integer", paramType = "query"),
  33. @ApiImplicitParam(name = "cmId", value = "公司编号或者区域编号", required = true, dataType = "string", paramType = "query"),
  34. @ApiImplicitParam(name = "type", value = "0全部、光伏(-2)、风场(-1)", required = true, dataType = "string", paramType = "query"),
  35. @ApiImplicitParam(name = "wpId", value = "风场编号", required = false, dataType = "string", paramType = "query"),
  36. @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
  37. public R outputSpeedlist(Integer pageNum, Integer pageSize, String cmId, String type, String wpId, String recorddate) {
  38. Page<ProEconInOrOutSpeedTotal> pageInfo = outputSpeedService.outputSpeedlist(pageNum, pageSize, cmId, type, wpId, recorddate);
  39. if (pageInfo != null && !pageInfo.getRecords().isEmpty()) {
  40. for (ProEconInOrOutSpeedTotal pwg : pageInfo.getRecords()) {
  41. if (CacheContext.wtmap.containsKey(pwg.getWindturbineId())) {
  42. ProBasicEquipment wt = CacheContext.wtmap.get(pwg.getWindturbineId());
  43. pwg.setWtcode(wt.getAname());
  44. pwg.setModelId(wt.getModelId());
  45. }
  46. }
  47. }
  48. return R.data(ResultMsg.ok(pageInfo));
  49. }
  50. /**
  51. * 切入切出历史列表
  52. **/
  53. @PostMapping("/outputspeedhistorylist")
  54. @ResponseBody
  55. @ApiOperation(value = "切入切出历史列表", notes = "切入切出历史列表")
  56. @ApiImplicitParams({
  57. @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer", paramType = "query"),
  58. @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "Integer", paramType = "query"),
  59. @ApiImplicitParam(name = "cmId", value = "公司编号或者区域编号", required = true, dataType = "string", paramType = "query"),
  60. @ApiImplicitParam(name = "type", value = "0全部、光伏(-2)、风场(-1)", required = true, dataType = "string", paramType = "query"),
  61. @ApiImplicitParam(name = "wpId", value = "风场编号", required = false, dataType = "string", paramType = "query"),
  62. @ApiImplicitParam(name = "wtId", value = "风机编号", required = false, dataType = "string", paramType = "query"),
  63. @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
  64. @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query")})
  65. public R outputspeedhistorylist(Integer pageNum, Integer pageSize, String cmId, String type, String wpId, String wtId, String beginDate, String endDate) {
  66. Page<ProEconInOrOutSpeedTotal> pageInfo = outputSpeedService.outputspeedhistorylist(pageNum, pageSize, cmId, type, wpId, wtId, beginDate, endDate);
  67. if (pageInfo != null && !pageInfo.getRecords().isEmpty()) {
  68. for (ProEconInOrOutSpeedTotal pwg : pageInfo.getRecords()) {
  69. if (CacheContext.wtmap.containsKey(pwg.getWindturbineId())) {
  70. ProBasicEquipment wt = CacheContext.wtmap.get(pwg.getWindturbineId());
  71. pwg.setWtcode(wt.getAname());
  72. pwg.setModelId(wt.getModelId());
  73. }
  74. }
  75. }
  76. return R.data(ResultMsg.ok(pageInfo));
  77. // return AjaxResult.successData(ResultCode.SUCCESS, pageInfo);
  78. }
  79. }