From d8c86797adaef6c416efae16586f350ae77bde4b Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期六, 12 九月 2026 12:43:08 +0800
Subject: [PATCH] feat: 库存入库/出库字段全链路、采购台账申请提交时间、储罐租客信息、油库储罐模块

---
 src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java |  107 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 106 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
index 07d70a5..0f70cfe 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -7,8 +7,17 @@
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.alibaba.fastjson2.JSON;
+import com.ruoyi.basic.dto.StorageBlobVO;
+import com.ruoyi.basic.mapper.CustomerMapper;
+import com.ruoyi.basic.mapper.OilDepotMapper;
 import com.ruoyi.basic.mapper.ProductModelMapper;
+import com.ruoyi.basic.mapper.TankInfoMapper;
+import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.basic.pojo.OilDepot;
 import com.ruoyi.basic.pojo.ProductModel;
+import com.ruoyi.basic.pojo.TankInfo;
+import com.ruoyi.basic.utils.FileUtil;
 import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.StringUtils;
@@ -60,6 +69,10 @@
     private final StockUninventoryService stockUninventoryService;
     private final SalesLedgerProductMapper salesLedgerProductMapper;
     private final ProductModelMapper productModelMapper;
+    private final OilDepotMapper oilDepotMapper;
+    private final TankInfoMapper tankInfoMapper;
+    private final CustomerMapper customerMapper;
+    private final FileUtil fileUtil;
 
     @Override
     public IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto) {
@@ -173,6 +186,54 @@
         stockInRecordDto.setType("0");
         stockInRecordDto.setRemark(stockInventoryDto.getRemark());
         stockInRecordDto.setWarnNum(stockInventoryDto.getWarnNum());
+        stockInRecordDto.setOilDepotId(stockInventoryDto.getOilDepotId());
+        stockInRecordDto.setOilDepotName(stockInventoryDto.getOilDepotName());
+        stockInRecordDto.setInboundCategory(stockInventoryDto.getInboundCategory());
+        if (stockInventoryDto.getOilDepotId() != null && StringUtils.isEmpty(stockInRecordDto.getOilDepotName())) {
+            OilDepot oilDepot = oilDepotMapper.selectById(stockInventoryDto.getOilDepotId());
+            if (oilDepot != null) {
+                stockInRecordDto.setOilDepotName(oilDepot.getDepotName());
+            }
+        }
+        stockInRecordDto.setTankId(stockInventoryDto.getTankId());
+        stockInRecordDto.setTankNo(stockInventoryDto.getTankNo());
+        if (stockInventoryDto.getTankId() != null && StringUtils.isEmpty(stockInRecordDto.getTankNo())) {
+            TankInfo tankInfo = tankInfoMapper.selectById(stockInventoryDto.getTankId());
+            if (tankInfo != null) {
+                stockInRecordDto.setTankNo(tankInfo.getTankNo());
+            }
+        }
+        stockInRecordDto.setInboundTime(stockInventoryDto.getInboundTime());
+        stockInRecordDto.setOilProduct(stockInventoryDto.getOilProduct());
+        stockInRecordDto.setOriginalQuantity(stockInventoryDto.getOriginalQuantity());
+        stockInRecordDto.setCustomerId(stockInventoryDto.getCustomerId());
+        stockInRecordDto.setCustomerName(stockInventoryDto.getCustomerName());
+        stockInRecordDto.setContactPerson(stockInventoryDto.getContactPerson());
+        stockInRecordDto.setContactPhone(stockInventoryDto.getContactPhone());
+        stockInRecordDto.setDriverName(stockInventoryDto.getDriverName());
+        stockInRecordDto.setDriverPhone(stockInventoryDto.getDriverPhone());
+        stockInRecordDto.setEscortName(stockInventoryDto.getEscortName());
+        stockInRecordDto.setEscortPhone(stockInventoryDto.getEscortPhone());
+        stockInRecordDto.setTruckPlateNo(stockInventoryDto.getTruckPlateNo());
+        stockInRecordDto.setTrailerPlateNo(stockInventoryDto.getTrailerPlateNo());
+        stockInRecordDto.setTankInspectionStatus(stockInventoryDto.getTankInspectionStatus());
+        stockInRecordDto.setUnloadingCranePosition(stockInventoryDto.getUnloadingCranePosition());
+        stockInRecordDto.setDensity(stockInventoryDto.getDensity());
+        stockInRecordDto.setUnloadPhotos(stockInventoryDto.getUnloadPhotos() == null
+                ? null : JSON.toJSONString(stockInventoryDto.getUnloadPhotos()));
+        stockInRecordDto.setGrossWeight(stockInventoryDto.getGrossWeight());
+        stockInRecordDto.setTareWeight(stockInventoryDto.getTareWeight());
+        stockInRecordDto.setNetWeight(stockInventoryDto.getNetWeight());
+        stockInRecordDto.setLossQuantity(stockInventoryDto.getLossQuantity());
+        stockInRecordDto.setActualVolume(stockInventoryDto.getActualVolume());
+        stockInRecordDto.setPoundPhotos(stockInventoryDto.getPoundPhotos() == null
+                ? null : JSON.toJSONString(stockInventoryDto.getPoundPhotos()));
+        if (stockInventoryDto.getCustomerId() != null && StringUtils.isEmpty(stockInRecordDto.getCustomerName())) {
+            Customer customer = customerMapper.selectById(stockInventoryDto.getCustomerId());
+            if (customer != null) {
+                stockInRecordDto.setCustomerName(customer.getCustomerName());
+            }
+        }
         stockInRecordService.add(stockInRecordDto);
         return true;
     }
@@ -442,6 +503,50 @@
 
     @Override
     public IPage<StockInventoryDto> getBatchNoQty(Page page, StockInventoryDto stockInventoryDto) {
-        return stockInventoryMapper.getBatchNoQty(page, stockInventoryDto);
+        IPage<StockInventoryDto> result = stockInventoryMapper.getBatchNoQty(page, stockInventoryDto);
+        // 鐓х墖搴撻噷瀛樼殑鏄笂浼犳椂鐨勭鍚峌RL锛堥粯璁�2灏忔椂杩囨湡锛夛紝杩斿洖鍓嶉噸鏂扮鍙戯紝閬垮厤鍓嶇鍥剧墖鍔犺浇澶辫触
+        for (StockInventoryDto record : result.getRecords()) {
+            record.setUnloadPhotos(refreshPhotoUrls(record.getUnloadPhotos()));
+            record.setPoundPhotos(refreshPhotoUrls(record.getPoundPhotos()));
+            record.setLoadingPhotos(refreshPhotoUrls(record.getLoadingPhotos()));
+            record.setOutPoundPhotos(refreshPhotoUrls(record.getOutPoundPhotos()));
+        }
+        return result;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean addOilOutRecordOnly(StockOutRecordDto stockOutRecordDto) {
+        stockOutRecordDto.setStockOutNum(stockOutRecordDto.getOutTonnage());
+        stockOutRecordDto.setApprovalStatus(0);
+        return stockOutRecordService.add(stockOutRecordDto) > 0;
+    }
+
+    /**
+     * 閲嶆柊绛惧彂鐓х墖棰勮/涓嬭浇URL
+     */
+    private Object refreshPhotoUrls(Object photos) {
+        if (!(photos instanceof String)) {
+            return photos;
+        }
+        String json = (String) photos;
+        if (StringUtils.isEmpty(json)) {
+            return photos;
+        }
+        try {
+            List<StorageBlobVO> list = JSON.parseArray(json, StorageBlobVO.class);
+            if (list == null || list.isEmpty()) {
+                return photos;
+            }
+            for (StorageBlobVO vo : list) {
+                String previewUrl = fileUtil.buildSignedUrl(vo, "/preview/", null);
+                vo.setPreviewURL(previewUrl);
+                vo.setUrl(previewUrl);
+                vo.setDownloadURL(fileUtil.buildSignedUrl(vo, "/download/", null));
+            }
+            return JSON.toJSONString(list);
+        } catch (Exception e) {
+            return photos;
+        }
     }
 }

--
Gitblit v1.9.3