| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- package com.ktg.iscs.controller;
- import cn.hutool.core.convert.Convert;
- import cn.hutool.core.lang.Assert;
- import com.baomidou.mybatisplus.core.toolkit.Wrappers;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.ktg.common.annotation.Log;
- import com.ktg.common.core.controller.BaseController;
- import com.ktg.common.enums.BusinessType;
- import com.ktg.common.pojo.CommonResult;
- import com.ktg.common.utils.poi.ExcelUtil;
- import com.ktg.iscs.domain.IsLotoStation;
- import com.ktg.iscs.domain.dto.point.BindingPointDTO;
- import com.ktg.iscs.domain.vo.loto.IsLotoStationVO;
- import com.ktg.iscs.domain.vo.workarea.PointsMapVO;
- import com.ktg.iscs.service.IIsLotoStationService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.v3.oas.annotations.Parameter;
- import io.swagger.v3.oas.annotations.Parameters;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletResponse;
- import java.util.Arrays;
- import java.util.List;
- /**
- * 电柜Controller
- *
- * @author cgj
- * @date 2024-12-19
- */
- @Api(tags = "电柜")
- @RestController
- @RequestMapping("/iscs/station")
- public class IsLotoStationController extends BaseController
- {
- @Autowired
- private IIsLotoStationService isLotoStationService;
- /**
- * 查询电柜分页
- */
- @ApiOperation("查询电柜-分页")
- @Parameters({
- @Parameter(name = "page", description = "Page"),
- @Parameter(name = "isLotoStation", description = "实体参数")
- })
- @PreAuthorize("@ss.hasPermi('iscs:station:list')")
- @GetMapping("/getIsLotoStationPage")
- public CommonResult<Page<IsLotoStationVO>> getIsLotoStationPage(Page<IsLotoStation> page, IsLotoStation isLotoStation)
- {
- Page<IsLotoStationVO> result = isLotoStationService.getIsLotoStationPage(isLotoStation, page);
- return CommonResult.success(result);
- }
- /**
- * 导出电柜列表
- */
- @ApiOperation("导出电柜列表")
- @Parameter(name = "isLotoStation", description = "实体参数")
- @PreAuthorize("@ss.hasPermi('iscs:station:export')")
- @Log(title = "电柜", businessType = BusinessType.EXPORT)
- @PostMapping("/exportIsLotoStation")
- public void exportIsLotoStation(HttpServletResponse response, IsLotoStation isLotoStation)
- {
- Page<IsLotoStation> page = new Page<>();
- page.setSize(-1);
- page.setCurrent(1);
- List<IsLotoStation> list = isLotoStationService.page(page, Wrappers.<IsLotoStation>lambdaQuery()
- .orderByDesc(IsLotoStation::getLotoId)).getRecords();
- ExcelUtil<IsLotoStation> util = new ExcelUtil<IsLotoStation>(IsLotoStation.class);
- util.exportExcel(response, list, "电柜数据");
- }
- /**
- * 获取电柜详细信息
- */
- @ApiOperation("获取电柜详细信息")
- @Parameter(name = "lotoId", description = "lotoId")
- @PreAuthorize("@ss.hasPermi('iscs:station:query')")
- @GetMapping(value = "/selectIsLotoStationById")
- public CommonResult<IsLotoStation> selectIsLotoStationById(Long lotoId)
- {
- return CommonResult.success(isLotoStationService.selectIsLotoStationById(lotoId));
- }
- @ApiOperation("获取电柜详细信息")
- @Parameter(name = "lotoSerialNumber", description = "lotoSerialNumber")
- @PreAuthorize("@ss.hasPermi('iscs:station:query')")
- @GetMapping(value = "/selectLotoBySerialNumber")
- public CommonResult<IsLotoStation> selectLotoBySerialNumber(String lotoSerialNumber)
- {
- return CommonResult.success(isLotoStationService.selectLotoBySerialNumber(lotoSerialNumber));
- }
- /**
- * 新增电柜
- */
- @ApiOperation("新增电柜")
- @PreAuthorize("@ss.hasPermi('iscs:station:add')")
- @Log(title = "电柜", businessType = BusinessType.INSERT)
- @PostMapping("/insertIsLotoStation")
- public CommonResult<Boolean> insertIsLotoStation(@RequestBody @Parameter(name = "isLotoStation", description = "新增数据类,放到body") IsLotoStation isLotoStation)
- {
- return CommonResult.success(isLotoStationService.insertIsLotoStation(isLotoStation));
- }
- /**
- * 修改电柜
- */
- @ApiOperation("修改电柜")
- @PreAuthorize("@ss.hasPermi('iscs:station:edit')")
- @Log(title = "电柜", businessType = BusinessType.UPDATE)
- @PostMapping("/updateIsLotoStation")
- public CommonResult<Boolean> updateIsLotoStation(@RequestBody @Parameter(name = "isLotoStation", description = "修改数据类,放到body") IsLotoStation isLotoStation)
- {
- return CommonResult.success(isLotoStationService.updateIsLotoStation(isLotoStation));
- }
- /**
- * 删除电柜
- */
- @ApiOperation("删除电柜")
- @PreAuthorize("@ss.hasPermi('iscs:station:remove')")
- @Log(title = "电柜", businessType = BusinessType.DELETE)
- @PostMapping("/deleteIsLotoStationByLotoIds")
- public CommonResult<Boolean> deleteIsLotoStationByLotoIds(String lotoIds)
- {
- Assert.notBlank(lotoIds, "请选择需要删除的数据!");
- Long[] longIds = Convert.toLongArray(lotoIds);
- return CommonResult.success(isLotoStationService.removeBatchByIds(Arrays.asList(longIds)));
- }
- @ApiOperation("获取电柜map解析数据")
- @Parameter(name = "workareaId", description = "workareaId")
- @Parameters({
- @Parameter(name = "workareaId", description = "区域id"),
- @Parameter(name = "sopId", description = "sopId"),
- @Parameter(name = "ticketId", description = "ticketId")
- })
- @GetMapping(value = "/selectLotoMapById")
- public CommonResult<List<PointsMapVO>> selectLotoMapById(Long lotoId, Long sopId, Long ticketId) {
- return CommonResult.success(isLotoStationService.selectLotoMapById(lotoId, sopId, ticketId));
- }
- @ApiOperation("隔离点绑定/解绑电柜")
- @PreAuthorize("@ss.hasPermi('iscs:station:edit')")
- @Log(title = "电柜", businessType = BusinessType.UPDATE)
- @PostMapping("/updatePointsBindingLoto")
- public CommonResult<Boolean> updatePointsBindingLoto(@RequestBody @Parameter(name = "dto", description = "修改数据类,放到body") BindingPointDTO dto)
- {
- return CommonResult.success(isLotoStationService.updatePointsBindingLoto(dto));
- }
- }
|