| | |
| | | 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.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); |
| | |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | |
| | | apsGasPipelinePredictionService.batchInsertApsGasPipelinePrediction(file); |
| | | return toAjax(true); |
| | | 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/ä¸ä¼ æ°ä½é¢æµæ°æ®æ¨¡æ¿.xlsx"); |
| | | ByteArrayResource resource = new ByteArrayResource(file); |
| | | return ResponseEntity.ok() |
| | | .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)); |
| | | } |
| | | } |