From 8e2bbb3ac8d259d0edbecf0d75db5d606bc80d0e Mon Sep 17 00:00:00 2001
From: sfd <sun.sunshine@163.com>
Date: 星期一, 19 五月 2025 15:58:12 +0800
Subject: [PATCH] 增加管路预测数据
---
aps-modules/aps-core/src/main/resources/mapper/core/ApsGasPipelinePredictionMapper.xml | 91 +++++++++
aps-modules/aps-core/src/main/java/com/aps/core/service/IApsGasPipelinePredictionService.java | 64 ++++++
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsGasPipelinePredictionController.java | 127 ++++++++++++
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsGasPipelinePrediction.java | 52 +++++
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsGasPipelinePredictionMapper.java | 65 ++++++
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipelinePredictionServiceImpl.java | 152 +++++++++++++++
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipelineMoServiceImpl.java | 6
7 files changed, 555 insertions(+), 2 deletions(-)
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsGasPipelinePredictionController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsGasPipelinePredictionController.java
new file mode 100644
index 0000000..5444955
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsGasPipelinePredictionController.java
@@ -0,0 +1,127 @@
+package com.aps.core.controller.mainPlan;
+
+import java.util.List;
+
+import com.aps.common.core.web.page.TableDataInfo;
+import com.aps.core.domain.ApsGasPipelineMo;
+import com.aps.core.domain.ApsGasPipelinePrediction;
+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 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.web.multipart.MultipartFile;
+
+/**
+ * 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁Controller
+ *
+ * @author ruoyi
+ * @date 2025-05-19
+ */
+
+@Tag(name = "绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁", description = "绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁鎺ュ彛")
+@RestController
+@RequestMapping("/gasPipelinePrediction")
+public class ApsGasPipelinePredictionController extends BaseController
+{
+ @Autowired
+ private IApsGasPipelinePredictionService apsGasPipelinePredictionService;
+
+ /**
+ * 鏌ヨ绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁鍒楄〃
+ */
+ @Operation(summary = "鏌ヨ绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁鍒楄〃", description = "鍒嗛〉鏌ヨ")
+// @RequiresPermissions("gasPipeline:prediction:list")
+ @GetMapping("/list")
+ 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")
+ @PostMapping("/importData")
+ public AjaxResult importData(MultipartFile file) throws Exception {
+
+ int i = apsGasPipelinePredictionService.batchInsertApsGasPipelinePrediction(file);
+ return toAjax(i);
+ }
+ /**
+ * 瀵煎嚭绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁鍒楄〃
+ */
+ @Operation(summary = "瀵煎嚭绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁鍒楄〃", description = "瀵煎嚭")
+ @RequiresPermissions("gasPipeline:prediction:export")
+ @Log(title = "绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ 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)
+ {
+ return success(apsGasPipelinePredictionService.selectApsGasPipelinePredictionById(id));
+ }
+
+ /**
+ * 鏂板绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ */
+ @Operation(summary = "鏂板绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁", description = "鍗曚釜鏂板")
+ @RequiresPermissions("gasPipeline:prediction:add")
+ @Log(title = "绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ApsGasPipelinePrediction apsGasPipelinePrediction)
+ {
+ return toAjax(apsGasPipelinePredictionService.insertApsGasPipelinePrediction(apsGasPipelinePrediction));
+ }
+
+ /**
+ * 淇敼绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ */
+ @Operation(summary = "淇敼绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁", description = "鍗曚釜淇敼")
+ @RequiresPermissions("gasPipeline:prediction:edit")
+ @Log(title = "绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁", businessType = BusinessType.UPDATE)
+ @PutMapping
+ 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)
+ {
+ return toAjax(apsGasPipelinePredictionService.deleteApsGasPipelinePredictionByIds(ids));
+ }
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsGasPipelinePrediction.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsGasPipelinePrediction.java
new file mode 100644
index 0000000..294c62e
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsGasPipelinePrediction.java
@@ -0,0 +1,52 @@
+package com.aps.core.domain;
+
+import com.aps.common.core.annotation.Excel;
+import com.aps.common.core.web.domain.BaseEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.data.annotation.Id;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+
+/**
+ * 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁瀵硅薄 aps_gas_pipeline_prediction
+ *
+ * @author ruoyi
+ * @date 2025-05-19
+ */
+@Data
+@Schema(description = "绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁瀹炰綋绫�")
+public class ApsGasPipelinePrediction extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @JsonFormat(shape = JsonFormat.Shape.STRING)
+ /** ID */
+ @Schema(description = "ID")
+ private Long id;
+
+ /** 鐢熶骇鍩哄湴 */
+ @Excel(name = "鐢熶骇鍩哄湴")
+ @Schema(description = "鐢熶骇鍩哄湴")
+ private String factory;
+
+ /** 鏂欏彿 */
+ @Excel(name = "鏂欏彿")
+ @Schema(description = "鏂欏彿")
+ private String materialCode;
+
+ /** 棰勬祴鏃ユ湡 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Excel(name = "棰勬祴鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ @Schema(description = "棰勬祴鏃ユ湡")
+ private Timestamp predictDate;
+
+ /** 鏁伴噺 */
+ @Excel(name = "鏁伴噺")
+ @Schema(description = "鏁伴噺")
+ private BigDecimal predictQuantity;
+
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsGasPipelinePredictionMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsGasPipelinePredictionMapper.java
new file mode 100644
index 0000000..c653463
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsGasPipelinePredictionMapper.java
@@ -0,0 +1,65 @@
+package com.aps.core.mapper;
+
+import com.aps.core.domain.ApsGasPipelinePrediction;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+ * 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁Mapper鎺ュ彛
+ *
+ * @author ruoyi
+ * @date 2025-05-19
+ */
+public interface ApsGasPipelinePredictionMapper extends BaseMapper<ApsGasPipelinePrediction>
+{
+ /**
+ * 鏌ヨ绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param id 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁涓婚敭
+ * @return 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ */
+ public ApsGasPipelinePrediction selectApsGasPipelinePredictionById(Long id);
+
+ /**
+ * 鏌ヨ绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁鍒楄〃
+ *
+ * @param apsGasPipelinePrediction 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ * @return 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁闆嗗悎
+ */
+ public List<ApsGasPipelinePrediction> selectApsGasPipelinePredictionList(ApsGasPipelinePrediction apsGasPipelinePrediction);
+
+ /**
+ * 鏂板绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param apsGasPipelinePrediction 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ * @return 缁撴灉
+ */
+ public int insertApsGasPipelinePrediction(ApsGasPipelinePrediction apsGasPipelinePrediction);
+
+ /**
+ * 淇敼绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param apsGasPipelinePrediction 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ * @return 缁撴灉
+ */
+ public int updateApsGasPipelinePrediction(ApsGasPipelinePrediction apsGasPipelinePrediction);
+
+ /**
+ * 鍒犻櫎绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param id 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteApsGasPipelinePredictionById(Long id);
+
+ /**
+ * 鎵归噺鍒犻櫎绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteApsGasPipelinePredictionByIds(Long[] ids);
+
+ void deleteAll();
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsGasPipelinePredictionService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsGasPipelinePredictionService.java
new file mode 100644
index 0000000..06b1023
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsGasPipelinePredictionService.java
@@ -0,0 +1,64 @@
+package com.aps.core.service;
+
+import java.util.List;
+import com.aps.core.domain.ApsGasPipelinePrediction;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁Service鎺ュ彛
+ *
+ * @author ruoyi
+ * @date 2025-05-19
+ */
+public interface IApsGasPipelinePredictionService
+{
+ /**
+ * 鏌ヨ绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param id 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁涓婚敭
+ * @return 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ */
+ public ApsGasPipelinePrediction selectApsGasPipelinePredictionById(Long id);
+
+ /**
+ * 鏌ヨ绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁鍒楄〃
+ *
+ * @param apsGasPipelinePrediction 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ * @return 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁闆嗗悎
+ */
+ public List<ApsGasPipelinePrediction> selectApsGasPipelinePredictionList(ApsGasPipelinePrediction apsGasPipelinePrediction);
+
+ /**
+ * 鏂板绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param apsGasPipelinePrediction 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ * @return 缁撴灉
+ */
+ public int insertApsGasPipelinePrediction(ApsGasPipelinePrediction apsGasPipelinePrediction);
+
+ /**
+ * 淇敼绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param apsGasPipelinePrediction 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ * @return 缁撴灉
+ */
+ public int updateApsGasPipelinePrediction(ApsGasPipelinePrediction apsGasPipelinePrediction);
+
+ /**
+ * 鎵归噺鍒犻櫎绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteApsGasPipelinePredictionByIds(Long[] ids);
+
+ /**
+ * 鍒犻櫎绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁淇℃伅
+ *
+ * @param id 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteApsGasPipelinePredictionById(Long id);
+
+ int batchInsertApsGasPipelinePrediction(MultipartFile file);
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipelineMoServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipelineMoServiceImpl.java
index d6f9650..c392f97 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipelineMoServiceImpl.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipelineMoServiceImpl.java
@@ -119,12 +119,14 @@
for (int i = 1; i <= rows; i++) {
Row row = sheet.getRow(i);
String mo = row.getCell(0).getStringCellValue();
+ if (StringUtils.isEmpty(mo)){
+ continue;
+ }
String factory = row.getCell(1).getStringCellValue();
String materialNum = row.getCell(2).getStringCellValue();
double quantity = row.getCell(3).getNumericCellValue();
Date planEnd = row.getCell(4).getDateCellValue();
- if (StringUtils.isNotBlank(mo) &&
- StringUtils.isNotBlank(factory) &&
+ if (StringUtils.isNotBlank(factory) &&
StringUtils.isNotBlank(materialNum) &&
planEnd != null) {
ApsGasPipelineMo apsGasPipelineMo = new ApsGasPipelineMo();
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipelinePredictionServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipelinePredictionServiceImpl.java
new file mode 100644
index 0000000..7a85b16
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipelinePredictionServiceImpl.java
@@ -0,0 +1,152 @@
+package com.aps.core.service.impl;
+
+import cn.hutool.core.util.IdUtil;
+import com.aps.common.core.utils.DateUtils;
+import com.aps.common.security.utils.SecurityUtils;
+import com.aps.core.domain.ApsGasPipelinePrediction;
+import com.aps.core.mapper.ApsGasPipelinePredictionMapper;
+import com.aps.core.service.IApsGasPipelinePredictionService;
+import io.micrometer.common.util.StringUtils;
+import lombok.SneakyThrows;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁Service涓氬姟灞傚鐞�
+ *
+ * @author ruoyi
+ * @date 2025-05-19
+ */
+@Service
+public class ApsGasPipelinePredictionServiceImpl implements IApsGasPipelinePredictionService
+{
+ @Autowired
+ private ApsGasPipelinePredictionMapper apsGasPipelinePredictionMapper;
+
+ /**
+ * 鏌ヨ绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param id 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁涓婚敭
+ * @return 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ */
+ @Override
+ public ApsGasPipelinePrediction selectApsGasPipelinePredictionById(Long id)
+ {
+ return apsGasPipelinePredictionMapper.selectApsGasPipelinePredictionById(id);
+ }
+
+ /**
+ * 鏌ヨ绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁鍒楄〃
+ *
+ * @param apsGasPipelinePrediction 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ * @return 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ */
+ @Override
+ public List<ApsGasPipelinePrediction> selectApsGasPipelinePredictionList(ApsGasPipelinePrediction apsGasPipelinePrediction)
+ {
+ return apsGasPipelinePredictionMapper.selectApsGasPipelinePredictionList(apsGasPipelinePrediction);
+ }
+
+ /**
+ * 鏂板绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param apsGasPipelinePrediction 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ * @return 缁撴灉
+ */
+ @Override
+ public int insertApsGasPipelinePrediction(ApsGasPipelinePrediction apsGasPipelinePrediction)
+ {
+ apsGasPipelinePrediction.setCreateTime(DateUtils.getNowDate());
+ return apsGasPipelinePredictionMapper.insertApsGasPipelinePrediction(apsGasPipelinePrediction);
+ }
+
+ /**
+ * 淇敼绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param apsGasPipelinePrediction 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ * @return 缁撴灉
+ */
+ @Override
+ public int updateApsGasPipelinePrediction(ApsGasPipelinePrediction apsGasPipelinePrediction)
+ {
+ apsGasPipelinePrediction.setUpdateTime(DateUtils.getNowDate());
+ return apsGasPipelinePredictionMapper.updateApsGasPipelinePrediction(apsGasPipelinePrediction);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteApsGasPipelinePredictionByIds(Long[] ids)
+ {
+ return apsGasPipelinePredictionMapper.deleteApsGasPipelinePredictionByIds(ids);
+ }
+
+ /**
+ * 鍒犻櫎绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁淇℃伅
+ *
+ * @param id 绠¤矾鎵嬪伐姘斾綋棰勬祴鏁版嵁涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteApsGasPipelinePredictionById(Long id)
+ {
+ return apsGasPipelinePredictionMapper.deleteApsGasPipelinePredictionById(id);
+ }
+
+ @SneakyThrows
+ @Override
+ public int batchInsertApsGasPipelinePrediction(MultipartFile file) {
+ Workbook workbook = WorkbookFactory.create(file.getInputStream());
+
+ Sheet sheet = workbook.getSheetAt(0);
+ int rows = sheet.getLastRowNum();
+ if (rows > 0) {
+ List<ApsGasPipelinePrediction> list = new ArrayList<>();
+
+ /*鏁版嵁鍒椾粠1寮�濮�*/
+ for (int i = 1; i <= rows; i++) {
+ Row row = sheet.getRow(i);
+ String materialCode = row.getCell(0).getStringCellValue();
+ if (StringUtils.isEmpty(materialCode)){
+ continue;
+ }
+ String factory = row.getCell(1).getStringCellValue();
+ double quantity = row.getCell(2).getNumericCellValue();
+ Date date = row.getCell(3).getDateCellValue();
+ if (StringUtils.isNotBlank(factory) &&
+ date != null) {
+ ApsGasPipelinePrediction item = new ApsGasPipelinePrediction();
+ item.setId(IdUtil.getSnowflakeNextId());
+ item.setFactory(factory);
+ item.setMaterialCode(materialCode);
+ item.setCreateBy(SecurityUtils.getUsername());
+ item.setCreateTime(DateUtils.getNowDate());
+ item.setPredictQuantity(new BigDecimal(quantity));
+ item.setPredictDate(new Timestamp(date.getTime()));
+ list.add(item);
+ }
+ }
+ if (!list.isEmpty()) {
+ apsGasPipelinePredictionMapper.deleteAll();
+ apsGasPipelinePredictionMapper.insert(list);
+ }
+ return list.size();
+ }
+ return 0;
+ }
+}
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsGasPipelinePredictionMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsGasPipelinePredictionMapper.xml
new file mode 100644
index 0000000..b8c149a
--- /dev/null
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsGasPipelinePredictionMapper.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.aps.core.mapper.ApsGasPipelinePredictionMapper">
+
+ <resultMap type="com.aps.core.domain.ApsGasPipelinePrediction" id="ApsGasPipelinePredictionResult">
+ <result property="id" column="id" />
+ <result property="factory" column="factory" />
+ <result property="materialCode" column="material_code" />
+ <result property="predictDate" column="predict_date" />
+ <result property="createBy" column="create_by" />
+ <result property="createTime" column="create_time" />
+ <result property="updateBy" column="update_by" />
+ <result property="updateTime" column="update_time" />
+ <result property="predictQuantity" column="predict_quantity" />
+ </resultMap>
+
+ <sql id="selectApsGasPipelinePredictionVo">
+ select id, factory, material_code, predict_date, create_by, create_time, update_by, update_time, predict_quantity from aps_gas_pipeline_prediction
+ </sql>
+
+ <select id="selectApsGasPipelinePredictionList" parameterType="ApsGasPipelinePrediction" resultMap="ApsGasPipelinePredictionResult">
+ <include refid="selectApsGasPipelinePredictionVo"/>
+ <where>
+ <if test="factory != null and factory != ''"> and factory = #{factory}</if>
+ <if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
+ <if test="predictDate != null and predictDate != ''"> and predict_date = #{predictDate}</if>
+ <if test="predictQuantity != null and predictQuantity != ''"> and predict_quantity = #{predictQuantity}</if>
+ </where>
+ </select>
+
+ <select id="selectApsGasPipelinePredictionById" parameterType="Long" resultMap="ApsGasPipelinePredictionResult">
+ </select>
+
+ <insert id="insertApsGasPipelinePrediction" parameterType="ApsGasPipelinePrediction">
+ insert into aps_gas_pipeline_prediction
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">id,</if>
+ <if test="factory != null">factory,</if>
+ <if test="materialCode != null">material_code,</if>
+ <if test="predictDate != null">predict_date,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ <if test="updateBy != null">update_by,</if>
+ <if test="updateTime != null">update_time,</if>
+ <if test="predictQuantity != null">predict_quantity,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">#{id},</if>
+ <if test="factory != null">#{factory},</if>
+ <if test="materialCode != null">#{materialCode},</if>
+ <if test="predictDate != null">#{predictDate},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ <if test="updateBy != null">#{updateBy},</if>
+ <if test="updateTime != null">#{updateTime},</if>
+ <if test="predictQuantity != null">#{predictQuantity},</if>
+ </trim>
+ </insert>
+
+ <update id="updateApsGasPipelinePrediction" parameterType="ApsGasPipelinePrediction">
+ update aps_gas_pipeline_prediction
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="factory != null">factory = #{factory},</if>
+ <if test="materialCode != null">material_code = #{materialCode},</if>
+ <if test="predictDate != null">predict_date = #{predictDate},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="updateBy != null">update_by = #{updateBy},</if>
+ <if test="updateTime != null">update_time = #{updateTime},</if>
+ <if test="predictQuantity != null">predict_quantity = #{predictQuantity},</if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteApsGasPipelinePredictionById" parameterType="Long">
+ delete from aps_gas_pipeline_prediction where id = #{id}
+ </delete>
+
+ <delete id="deleteApsGasPipelinePredictionByIds" parameterType="String">
+ delete from aps_gas_pipeline_prediction where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+
+ <delete id="deleteAll" >
+ delete from aps_gas_pipeline_prediction
+ </delete>
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3