IsLotoStationController.java 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. package com.ktg.iscs.controller;
  2. import cn.hutool.core.convert.Convert;
  3. import cn.hutool.core.lang.Assert;
  4. import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  6. import com.ktg.common.annotation.Log;
  7. import com.ktg.common.core.controller.BaseController;
  8. import com.ktg.common.enums.BusinessType;
  9. import com.ktg.common.pojo.CommonResult;
  10. import com.ktg.common.utils.poi.ExcelUtil;
  11. import com.ktg.iscs.domain.IsLotoStation;
  12. import com.ktg.iscs.domain.dto.point.BindingPointDTO;
  13. import com.ktg.iscs.domain.vo.loto.IsLotoStationVO;
  14. import com.ktg.iscs.domain.vo.workarea.PointsMapVO;
  15. import com.ktg.iscs.service.IIsLotoStationService;
  16. import io.swagger.annotations.Api;
  17. import io.swagger.annotations.ApiOperation;
  18. import io.swagger.v3.oas.annotations.Parameter;
  19. import io.swagger.v3.oas.annotations.Parameters;
  20. import org.springframework.beans.factory.annotation.Autowired;
  21. import org.springframework.security.access.prepost.PreAuthorize;
  22. import org.springframework.web.bind.annotation.*;
  23. import javax.servlet.http.HttpServletResponse;
  24. import java.util.Arrays;
  25. import java.util.List;
  26. /**
  27. * 电柜Controller
  28. *
  29. * @author cgj
  30. * @date 2024-12-19
  31. */
  32. @Api(tags = "电柜")
  33. @RestController
  34. @RequestMapping("/iscs/station")
  35. public class IsLotoStationController extends BaseController
  36. {
  37. @Autowired
  38. private IIsLotoStationService isLotoStationService;
  39. /**
  40. * 查询电柜分页
  41. */
  42. @ApiOperation("查询电柜-分页")
  43. @Parameters({
  44. @Parameter(name = "page", description = "Page"),
  45. @Parameter(name = "isLotoStation", description = "实体参数")
  46. })
  47. @PreAuthorize("@ss.hasPermi('iscs:station:list')")
  48. @GetMapping("/getIsLotoStationPage")
  49. public CommonResult<Page<IsLotoStationVO>> getIsLotoStationPage(Page<IsLotoStation> page, IsLotoStation isLotoStation)
  50. {
  51. Page<IsLotoStationVO> result = isLotoStationService.getIsLotoStationPage(isLotoStation, page);
  52. return CommonResult.success(result);
  53. }
  54. /**
  55. * 导出电柜列表
  56. */
  57. @ApiOperation("导出电柜列表")
  58. @Parameter(name = "isLotoStation", description = "实体参数")
  59. @PreAuthorize("@ss.hasPermi('iscs:station:export')")
  60. @Log(title = "电柜", businessType = BusinessType.EXPORT)
  61. @PostMapping("/exportIsLotoStation")
  62. public void exportIsLotoStation(HttpServletResponse response, IsLotoStation isLotoStation)
  63. {
  64. Page<IsLotoStation> page = new Page<>();
  65. page.setSize(-1);
  66. page.setCurrent(1);
  67. List<IsLotoStation> list = isLotoStationService.page(page, Wrappers.<IsLotoStation>lambdaQuery()
  68. .orderByDesc(IsLotoStation::getLotoId)).getRecords();
  69. ExcelUtil<IsLotoStation> util = new ExcelUtil<IsLotoStation>(IsLotoStation.class);
  70. util.exportExcel(response, list, "电柜数据");
  71. }
  72. /**
  73. * 获取电柜详细信息
  74. */
  75. @ApiOperation("获取电柜详细信息")
  76. @Parameter(name = "lotoId", description = "lotoId")
  77. @PreAuthorize("@ss.hasPermi('iscs:station:query')")
  78. @GetMapping(value = "/selectIsLotoStationById")
  79. public CommonResult<IsLotoStation> selectIsLotoStationById(Long lotoId)
  80. {
  81. return CommonResult.success(isLotoStationService.selectIsLotoStationById(lotoId));
  82. }
  83. @ApiOperation("获取电柜详细信息")
  84. @Parameter(name = "lotoSerialNumber", description = "lotoSerialNumber")
  85. @PreAuthorize("@ss.hasPermi('iscs:station:query')")
  86. @GetMapping(value = "/selectLotoBySerialNumber")
  87. public CommonResult<IsLotoStation> selectLotoBySerialNumber(String lotoSerialNumber)
  88. {
  89. return CommonResult.success(isLotoStationService.selectLotoBySerialNumber(lotoSerialNumber));
  90. }
  91. /**
  92. * 新增电柜
  93. */
  94. @ApiOperation("新增电柜")
  95. @PreAuthorize("@ss.hasPermi('iscs:station:add')")
  96. @Log(title = "电柜", businessType = BusinessType.INSERT)
  97. @PostMapping("/insertIsLotoStation")
  98. public CommonResult<Boolean> insertIsLotoStation(@RequestBody @Parameter(name = "isLotoStation", description = "新增数据类,放到body") IsLotoStation isLotoStation)
  99. {
  100. return CommonResult.success(isLotoStationService.insertIsLotoStation(isLotoStation));
  101. }
  102. /**
  103. * 修改电柜
  104. */
  105. @ApiOperation("修改电柜")
  106. @PreAuthorize("@ss.hasPermi('iscs:station:edit')")
  107. @Log(title = "电柜", businessType = BusinessType.UPDATE)
  108. @PostMapping("/updateIsLotoStation")
  109. public CommonResult<Boolean> updateIsLotoStation(@RequestBody @Parameter(name = "isLotoStation", description = "修改数据类,放到body") IsLotoStation isLotoStation)
  110. {
  111. return CommonResult.success(isLotoStationService.updateIsLotoStation(isLotoStation));
  112. }
  113. /**
  114. * 删除电柜
  115. */
  116. @ApiOperation("删除电柜")
  117. @PreAuthorize("@ss.hasPermi('iscs:station:remove')")
  118. @Log(title = "电柜", businessType = BusinessType.DELETE)
  119. @PostMapping("/deleteIsLotoStationByLotoIds")
  120. public CommonResult<Boolean> deleteIsLotoStationByLotoIds(String lotoIds)
  121. {
  122. Assert.notBlank(lotoIds, "请选择需要删除的数据!");
  123. Long[] longIds = Convert.toLongArray(lotoIds);
  124. return CommonResult.success(isLotoStationService.removeBatchByIds(Arrays.asList(longIds)));
  125. }
  126. @ApiOperation("获取电柜map解析数据")
  127. @Parameter(name = "workareaId", description = "workareaId")
  128. @Parameters({
  129. @Parameter(name = "workareaId", description = "区域id"),
  130. @Parameter(name = "sopId", description = "sopId"),
  131. @Parameter(name = "ticketId", description = "ticketId")
  132. })
  133. @GetMapping(value = "/selectLotoMapById")
  134. public CommonResult<List<PointsMapVO>> selectLotoMapById(Long lotoId, Long sopId, Long ticketId) {
  135. return CommonResult.success(isLotoStationService.selectLotoMapById(lotoId, sopId, ticketId));
  136. }
  137. @ApiOperation("隔离点绑定/解绑电柜")
  138. @PreAuthorize("@ss.hasPermi('iscs:station:edit')")
  139. @Log(title = "电柜", businessType = BusinessType.UPDATE)
  140. @PostMapping("/updatePointsBindingLoto")
  141. public CommonResult<Boolean> updatePointsBindingLoto(@RequestBody @Parameter(name = "dto", description = "修改数据类,放到body") BindingPointDTO dto)
  142. {
  143. return CommonResult.success(isLotoStationService.updatePointsBindingLoto(dto));
  144. }
  145. }