| | |
| | | package com.aps.core.controller.mainPlan; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.aps.common.core.utils.poi.ExcelUtil; |
| | | import com.aps.common.core.web.controller.BaseController; |
| | | import com.aps.common.core.web.domain.AjaxResult; |
| | | import com.aps.common.core.web.page.TableDataInfo; |
| | | import com.aps.core.domain.ApsGasPipelineMo; |
| | | import com.aps.common.log.annotation.Log; |
| | | import com.aps.common.log.enums.BusinessType; |
| | | import com.aps.common.security.annotation.RequiresPermissions; |
| | | import com.aps.core.domain.ApsGasPipelinePrediction; |
| | | import com.aps.core.domain.ApsMaterialProductGroupManagement; |
| | | import com.aps.core.service.IApsGasPipelinePredictionService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.aps.common.log.annotation.Log; |
| | | import com.aps.common.log.enums.BusinessType; |
| | | import com.aps.common.security.annotation.RequiresPermissions; |
| | | import com.aps.common.core.web.controller.BaseController; |
| | | import com.aps.common.core.web.domain.AjaxResult; |
| | | import com.aps.common.core.utils.poi.ExcelUtil; |
| | | import org.springframework.core.io.ByteArrayResource; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.InputStream; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 管路手工气体预测数据Controller |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2025-05-19 |
| | | */ |
| | |
| | | @Tag(name = "管路手工气体预测数据", description = "管路手工气体预测数据接口") |
| | | @RestController |
| | | @RequestMapping("/gasPipelinePrediction") |
| | | public class ApsGasPipelinePredictionController extends BaseController |
| | | { |
| | | public class ApsGasPipelinePredictionController extends BaseController { |
| | | @Autowired |
| | | private IApsGasPipelinePredictionService apsGasPipelinePredictionService; |
| | | |
| | |
| | | @Operation(summary = "查询管路手工气体预测数据列表", description = "分页查询") |
| | | @RequiresPermissions("gasPipeline:prediction:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ApsGasPipelinePrediction apsGasPipelineMo) |
| | | { |
| | | public TableDataInfo list(ApsGasPipelinePrediction apsGasPipelineMo) { |
| | | startPage(); |
| | | List<ApsGasPipelinePrediction> list = apsGasPipelinePredictionService.selectApsGasPipelinePredictionList(apsGasPipelineMo); |
| | | return getDataTable(list); |
| | |
| | | |
| | | @Operation(summary = "导入手工气体预测数据", description = "批量导入") |
| | | @Log(title = "导入手工气体预测数据", businessType = BusinessType.IMPORT) |
| | | @RequiresPermissions("gasPipeline:mo:import") |
| | | @RequiresPermissions("gasPipeline:prediction:import") |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | |
| | | int i = apsGasPipelinePredictionService.batchInsertApsGasPipelinePrediction(file); |
| | | return toAjax(i); |
| | | apsGasPipelinePredictionService.batchInsertApsGasPipelinePrediction(file); |
| | | return toAjax(true); |
| | | } |
| | | |
| | | /** |
| | | * 下载气体预测数据导入模板 |
| | | */ |
| | | @SneakyThrows |
| | | @Operation(summary = "下载气体预测数据导入模板", description = "下载气体预测数据导入模板") |
| | | // @RequiresPermissions("gasPipeline:prediction:template") |
| | | // @Log(title = "下载气体预测数据导入模板", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/template") |
| | | public ResponseEntity<ByteArrayResource> exportTemplate() { |
| | | byte[] file = IOUtils.resourceToByteArray("/templates/气体预测数据模板v1.0.xlsx"); |
| | | ByteArrayResource resource = new ByteArrayResource(file); |
| | | return ResponseEntity.ok() |
| | | .header("Access-Control-Expose-Headers", HttpHeaders.CONTENT_DISPOSITION) |
| | | .header(HttpHeaders.CONTENT_DISPOSITION, |
| | | String.format("attachment;filename=%s", URLEncoder.encode("气体预测数据模板.xlsx", StandardCharsets.UTF_8))) |
| | | .header(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") |
| | | .contentLength(file.length) |
| | | .body(resource); |
| | | } |
| | | |
| | | /** |
| | | * 导出管路手工气体预测数据列表 |
| | | */ |
| | |
| | | @RequiresPermissions("gasPipeline:prediction:export") |
| | | @Log(title = "管路手工气体预测数据", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ApsGasPipelinePrediction apsGasPipelinePrediction) |
| | | { |
| | | public void export(HttpServletResponse response, ApsGasPipelinePrediction apsGasPipelinePrediction) { |
| | | List<ApsGasPipelinePrediction> list = apsGasPipelinePredictionService.selectApsGasPipelinePredictionList(apsGasPipelinePrediction); |
| | | ExcelUtil<ApsGasPipelinePrediction> util = new ExcelUtil<ApsGasPipelinePrediction>(ApsGasPipelinePrediction.class); |
| | | util.exportExcel(response, list, "管路手工气体预测数据数据"); |
| | |
| | | @Operation(summary = "获取管路手工气体预测数据详细信息", description = "根据id获取") |
| | | @RequiresPermissions("gasPipeline:prediction:query") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return success(apsGasPipelinePredictionService.selectApsGasPipelinePredictionById(id)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("gasPipeline:prediction:add") |
| | | @Log(title = "管路手工气体预测数据", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ApsGasPipelinePrediction apsGasPipelinePrediction) |
| | | { |
| | | public AjaxResult add(@RequestBody ApsGasPipelinePrediction apsGasPipelinePrediction) { |
| | | return toAjax(apsGasPipelinePredictionService.insertApsGasPipelinePrediction(apsGasPipelinePrediction)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("gasPipeline:prediction:edit") |
| | | @Log(title = "管路手工气体预测数据", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ApsGasPipelinePrediction apsGasPipelinePrediction) |
| | | { |
| | | public AjaxResult edit(@RequestBody ApsGasPipelinePrediction apsGasPipelinePrediction) { |
| | | return toAjax(apsGasPipelinePredictionService.updateApsGasPipelinePrediction(apsGasPipelinePrediction)); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "删除管路手工气体预测数据", description = "批量删除") |
| | | @RequiresPermissions("gasPipeline:prediction:remove") |
| | | @Log(title = "管路手工气体预测数据", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | | return toAjax(apsGasPipelinePredictionService.deleteApsGasPipelinePredictionByIds(ids)); |
| | | } |
| | | } |