浏览代码

新增导出导出储运中心车次信息接口

lingpeng.li 1 月之前
父节点
当前提交
95e11d66b1
共有 20 个文件被更改,包括 618 次插入10 次删除
  1. 24 0
      zgztBus/jeecg-module-sbm/pom.xml
  2. 9 6
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/shiftConfiguration/controller/ShiftConfigurationController.java
  3. 55 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/vo/StorageCenterExportRow.java
  4. 38 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/controller/CarUnitController.java
  5. 89 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/entity/SysDict.java
  6. 84 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/entity/SysDictItem.java
  7. 3 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/CarUnitMapper.java
  8. 27 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/SysDictItemMapper.java
  9. 16 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/SysDictMapper.java
  10. 7 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/xml/CarUnitMapper.xml
  11. 5 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/xml/SysDictItemMapper.xml
  12. 6 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/xml/SysDictMapper.xml
  13. 9 2
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/ICarUnitService.java
  14. 16 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/ISysDictItemService.java
  15. 16 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/ISysDictService.java
  16. 126 2
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/CarUnitServiceImpl.java
  17. 25 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/SysDictItemServiceImpl.java
  18. 23 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/SysDictServiceImpl.java
  19. 13 0
      zgztBus/jeecg-server-cloud/jeecg-cloud-sbm/pom.xml
  20. 27 0
      zgztBus/pom.xml

+ 24 - 0
zgztBus/jeecg-module-sbm/pom.xml

@@ -16,6 +16,30 @@
             <artifactId>jeecg-boot-base-core</artifactId>
         </dependency>
 
+        <!-- Apache POI -->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+        </dependency>
+
+        <!-- FastJSON -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
+
+        <!-- EasyExcel -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+        </dependency>
+
+        <!-- Commons IO -->
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 9 - 6
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/shiftConfiguration/controller/ShiftConfigurationController.java

@@ -20,6 +20,8 @@ import org.jeecg.modules.billet.shiftConfiguration.entity.ShiftConfiguration;
 import org.jeecg.modules.billet.shiftConfiguration.entity.ShiftConfigurationLog;
 import org.jeecg.modules.billet.shiftConfiguration.service.IShiftConfigurationLogService;
 import org.jeecg.modules.billet.shiftConfiguration.service.IShiftConfigurationService;
+import org.jeecg.modules.billet.storageBill.service.IStorageBillService;
+import org.jeecg.modules.carUnit.service.impl.CarUnitServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.*;
@@ -27,10 +29,9 @@ import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
 import java.time.LocalDate;
-import java.time.LocalTime;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.time.ZoneId;
 import java.util.Arrays;
 import java.util.Date;
@@ -92,8 +93,9 @@ public class ShiftConfigurationController extends JeecgController<ShiftConfigura
         // 参数校验
         if (shiftConfiguration.getDate() == null ||
                 StrUtil.isBlank(shiftConfiguration.getShift()) ||
-                StrUtil.isBlank(shiftConfiguration.getShiftGroup())) {
-            return Result.error("班次日期、班别、班组不能为空!");
+                StrUtil.isBlank(shiftConfiguration.getShiftGroup()) ||
+                StrUtil.isBlank(shiftConfiguration.getCcmNo())) {
+            return Result.error("班次日期、班别、班组、铸机号不能为空!");
         }
 
         Date shiftDate = shiftConfiguration.getDate();
@@ -116,11 +118,12 @@ public class ShiftConfigurationController extends JeecgController<ShiftConfigura
         LambdaQueryWrapper<ShiftConfiguration> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.between(ShiftConfiguration::getDate, start, end)
                 .eq(ShiftConfiguration::getShift, shift)
-                .eq(ShiftConfiguration::getShiftGroup, shiftGroup);
+                .eq(ShiftConfiguration::getShiftGroup, shiftGroup)
+                .eq(ShiftConfiguration::getCcmNo, shiftConfiguration.getCcmNo());
 
         boolean exists = shiftConfigurationService.count(queryWrapper) > 0;
         if (exists) {
-            return Result.error("该班别和班组在当天已存在,不能重复添加!");
+            return Result.error("该铸机号下的班别和班组在当天已存在,不能重复添加!");
         }
 
         shiftConfigurationService.save(shiftConfiguration);

+ 55 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/vo/StorageCenterExportRow.java

@@ -0,0 +1,55 @@
+package org.jeecg.modules.billet.storageBill.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class StorageCenterExportRow {
+
+    @ExcelProperty("出厂日期")
+    @ColumnWidth(20)
+    private String factoryDate;
+
+    @ExcelProperty("终点")
+    @ColumnWidth(10)
+    private String endPoint;
+
+    @ExcelProperty("车号")
+    @ColumnWidth(13)
+    private String licensePlate;
+
+    @ExcelProperty("炉号")
+    @ColumnWidth(13)
+    private String heatNo;
+
+    @ExcelProperty("支数")
+    @ColumnWidth(13)
+    private Integer amount;
+
+    @ExcelProperty("总重")
+    @ColumnWidth(10)
+    private BigDecimal totalWeight;
+
+    @ExcelProperty("连铸机")
+    @ColumnWidth(10)
+    private Integer ccmNo;
+
+    @ExcelProperty("运输单位")
+    @ColumnWidth(15)
+    private String transportUnit;
+
+    @ExcelProperty("单支重")
+    @ColumnWidth(10)
+    private BigDecimal weightPerPiece;
+
+    @ExcelProperty("规格")
+    @ColumnWidth(16)
+    private String spec;
+
+    @ExcelProperty("牌号")
+    @ColumnWidth(13)
+    private String brand;
+}

+ 38 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/controller/CarUnitController.java

@@ -1,10 +1,22 @@
 package org.jeecg.modules.carUnit.controller;
 
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
+import com.alibaba.excel.EasyExcel;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.billet.storageBill.dto.StorageCenterQueryDTO;
+import org.jeecg.modules.billet.storageBill.entity.StorageBill;
+import org.jeecg.modules.billet.storageBill.service.IStorageBillService;
+import org.jeecg.modules.billet.storageBill.vo.StorageCenterExportRow;
+import org.jeecg.modules.billet.storageBill.vo.StorageCenterInvoicingVO;
 import org.jeecg.modules.carUnit.entity.CarUnit;
 import org.jeecg.modules.carUnit.service.ICarUnitService;
 
@@ -35,6 +47,9 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
 public class CarUnitController extends JeecgController<CarUnit, ICarUnitService> {
 	@Autowired
 	private ICarUnitService carUnitService;
+
+	@Autowired
+	private IStorageBillService storageBillService;
 	
 	/**
 	 * 分页列表查询
@@ -160,4 +175,27 @@ public class CarUnitController extends JeecgController<CarUnit, ICarUnitService>
         return super.importExcel(request, response, CarUnit.class);
     }
 
+	 @ApiOperation(value = "导出储运中心车次信息", notes = "导出储运中心车次信息")
+	 @GetMapping("/exportStorageCenterInfo")
+	 public void exportStorageCenterInfo(HttpServletResponse response, StorageCenterQueryDTO queryDTO) throws IOException {
+		 Page<StorageCenterInvoicingVO> page = storageBillService.storageCenterInvoicingInfo(queryDTO);
+
+		 // 数据处理
+		 List<StorageCenterExportRow> exportList = carUnitService.buildExportData(page.getRecords());
+
+		 // 按出厂日期倒序排序
+		 exportList.sort(Comparator.comparing(StorageCenterExportRow::getFactoryDate, Comparator.nullsLast(Comparator.reverseOrder())));
+
+		 // 设置响应
+		 response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+		 response.setCharacterEncoding("utf-8");
+		 String fileName = URLEncoder.encode("储运中心车次信息", String.valueOf(StandardCharsets.UTF_8)).replaceAll("\\+", "%20");
+		 response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
+
+		 // 导出
+		 EasyExcel.write(response.getOutputStream(), StorageCenterExportRow.class)
+				 .sheet("车次信息")
+				 .doWrite(exportList);
+	 }
+
 }

+ 89 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/entity/SysDict.java

@@ -0,0 +1,89 @@
+package org.jeecg.modules.carUnit.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 字典表
+ * </p>
+ *
+ * @Author zhangweijian
+ * @since 2018-12-28
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class SysDict implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.ASSIGN_ID)
+    private String id;
+    
+    /**
+     * [预留字段,暂时无用]
+     * 字典类型,0 string,1 number类型,2 boolean
+     * 前端js对stirng类型和number类型 boolean 类型敏感,需要区分。在select 标签匹配的时候会用到
+     * 默认为string类型
+     */
+    private Integer type;
+    
+    /**
+     * 字典名称
+     */
+    private String dictName;
+
+    /**
+     * 字典编码
+     */
+    private String dictCode;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 删除状态
+     */
+    @TableLogic
+    private Integer delFlag;
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新人
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**租户ID*/
+    private Integer tenantId;
+    
+    /** 关联的低代码应用ID */
+    private String lowAppId;
+
+}

+ 84 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/entity/SysDictItem.java

@@ -0,0 +1,84 @@
+package org.jeecg.modules.carUnit.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @Author zhangweijian
+ * @since 2018-12-28
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class SysDictItem implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.ASSIGN_ID)
+    private String id;
+
+    /**
+     * 字典id
+     */
+    private String dictId;
+
+    /**
+     * 字典项文本
+     */
+    @Excel(name = "字典项文本", width = 20)
+    private String itemText;
+
+    /**
+     * 字典项值
+     */
+    @Excel(name = "字典项值", width = 30)
+    private String itemValue;
+
+    /**
+     * 描述
+     */
+    @Excel(name = "描述", width = 40)
+    private String description;
+
+    /**
+     * 排序
+     */
+    @Excel(name = "排序", width = 15,type=4)
+    private Integer sortOrder;
+
+
+    /**
+     * 状态(1启用 0不启用)
+     */
+    @Dict(dicCode = "dict_item_status")
+    private Integer status;
+
+    private String createBy;
+
+    private Date createTime;
+
+    private String updateBy;
+
+    private Date updateTime;
+
+    /**
+     * 字典项颜色 
+     */
+    private String itemColor;
+
+}

+ 3 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/CarUnitMapper.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.carUnit.mapper;
 
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.carUnit.entity.CarUnit;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -11,4 +12,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface CarUnitMapper extends BaseMapper<CarUnit> {
 
+    String getUnitByCarNumber(@Param("carNumber") String carNumber);
+
 }

+ 27 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/SysDictItemMapper.java

@@ -0,0 +1,27 @@
+package org.jeecg.modules.carUnit.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Select;
+import org.jeecg.modules.carUnit.entity.SysDictItem;
+
+import java.util.List;
+
+/**
+ * <p>
+ * Mapper 接口
+ * </p>
+ *
+ * @Author zhangweijian
+ * @since 2018-12-28
+ */
+public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
+
+    /**
+     * 通过字典id查询字典项
+     *
+     * @param mainId 字典id
+     * @return
+     */
+    @Select("SELECT * FROM sys_dict_item WHERE DICT_ID = #{mainId} order by sort_order asc, item_value asc")
+    public List<SysDictItem> selectItemsByMainId(String mainId);
+}

+ 16 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/SysDictMapper.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.carUnit.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.carUnit.entity.SysDict;
+
+/**
+ * <p>
+ * 字典表 Mapper 接口
+ * </p>
+ *
+ * @Author zhangweijian
+ * @since 2018-12-28
+ */
+public interface SysDictMapper extends BaseMapper<SysDict> {
+
+}

+ 7 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/xml/CarUnitMapper.xml

@@ -2,4 +2,11 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.carUnit.mapper.CarUnitMapper">
 
+    <select id="getUnitByCarNumber" resultType="java.lang.String">
+        SELECT unit
+        FROM car_unit
+        WHERE car_numer = #{carNumber}
+            LIMIT 1
+    </select>
+
 </mapper>

+ 5 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/xml/SysDictItemMapper.xml

@@ -0,0 +1,5 @@
+<?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="org.jeecg.modules.carUnit.mapper.SysDictItemMapper">
+
+</mapper>

+ 6 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/xml/SysDictMapper.xml

@@ -0,0 +1,6 @@
+<?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="org.jeecg.modules.carUnit.mapper.SysDictMapper">
+
+
+</mapper>

+ 9 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/ICarUnitService.java

@@ -1,14 +1,21 @@
 package org.jeecg.modules.carUnit.service;
 
-import org.jeecg.modules.carUnit.entity.CarUnit;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.billet.storageBill.vo.StorageCenterExportRow;
+import org.jeecg.modules.billet.storageBill.vo.StorageCenterInvoicingVO;
+import org.jeecg.modules.carUnit.entity.CarUnit;
+
+import java.util.List;
 
 /**
  * @Description: 车辆单位管理
  * @Author: jeecg-boot
- * @Date:   2025-04-19
+ * @Date: 2025-04-19
  * @Version: V1.0
  */
 public interface ICarUnitService extends IService<CarUnit> {
 
+
+    List<StorageCenterExportRow> buildExportData(List<StorageCenterInvoicingVO> records);
+
 }

+ 16 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/ISysDictItemService.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.carUnit.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.carUnit.entity.SysDictItem;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @Author zhangweijian
+ * @since 2018-12-28
+ */
+public interface ISysDictItemService extends IService<SysDictItem> {
+
+}

+ 16 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/ISysDictService.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.carUnit.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.carUnit.entity.SysDict;
+
+/**
+ * <p>
+ * 字典表 服务类
+ * </p>
+ *
+ * @Author zhangweijian
+ * @since 2018-12-28
+ */
+public interface ISysDictService extends IService<SysDict> {
+
+}

+ 126 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/CarUnitServiceImpl.java

@@ -1,19 +1,143 @@
 package org.jeecg.modules.carUnit.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.util.SpringContextUtils;
+import org.jeecg.modules.billet.storageBill.vo.StorageCenterExportRow;
+import org.jeecg.modules.billet.storageBill.vo.StorageCenterHeatNoInvoicingVO;
+import org.jeecg.modules.billet.storageBill.vo.StorageCenterInvoicingVO;
 import org.jeecg.modules.carUnit.entity.CarUnit;
+import org.jeecg.modules.carUnit.entity.SysDict;
+import org.jeecg.modules.carUnit.entity.SysDictItem;
 import org.jeecg.modules.carUnit.mapper.CarUnitMapper;
 import org.jeecg.modules.carUnit.service.ICarUnitService;
+import org.jeecg.modules.carUnit.service.ISysDictItemService;
+import org.jeecg.modules.carUnit.service.ISysDictService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
 
 /**
  * @Description: 车辆单位管理
  * @Author: jeecg-boot
- * @Date:   2025-04-19
+ * @Date: 2025-04-19
  * @Version: V1.0
  */
 @Service
 public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> implements ICarUnitService {
 
+    @Autowired
+    private CarUnitMapper carUnitMapper;
+
+    @Override
+    public List<StorageCenterExportRow> buildExportData(List<StorageCenterInvoicingVO> records) {
+        List<StorageCenterExportRow> rows = new ArrayList<>();
+
+        for (StorageCenterInvoicingVO vo : records) {
+            Integer ccmNo = Optional.ofNullable(vo.getHeatNoDetails())
+                    .flatMap(list -> list.stream().findFirst())
+                    .map(StorageCenterInvoicingVO.HeatNoDetail::getCcmNo)
+                    .orElse(null);
+
+            StorageCenterHeatNoInvoicingVO invoicing = vo.getStorageCenterHeatNoInvoicing();
+            if (invoicing == null) continue;
+
+            // 棒二 rollClubTwoDetails
+            if (invoicing.getRollClubTwoDetails() != null && invoicing.getRollClubThreeDetails() != null) {
+                for (StorageCenterHeatNoInvoicingVO.RollChargeDetail detail : invoicing.getRollClubTwoDetails().getRollChargeDetails()) {
+                    StorageCenterExportRow row = convert(detail, ccmNo, "棒二");
+                    rows.add(row);
+                }
+            }
+
+            // 棒三 rollClubThreeDetails
+            if (invoicing.getRollClubThreeDetails() != null) {
+                for (StorageCenterHeatNoInvoicingVO.RollChargeDetail detail : invoicing.getRollClubThreeDetails().getRollChargeDetails()) {
+                    StorageCenterExportRow row = convert(detail, ccmNo, "棒三");
+                    rows.add(row);
+                }
+            }
+
+            // 上若 rollOutShippDetails(如有)
+            if (invoicing.getRollOutShippDetails() != null) {
+                for (StorageCenterHeatNoInvoicingVO.RollChargeDetail detail : invoicing.getRollOutShippDetails().getRollChargeDetails()) {
+                    StorageCenterExportRow row = convert(detail, ccmNo, "上若");
+                    rows.add(row);
+                }
+            }
+        }
+
+        return rows;
+    }
+
+
+    public static String getTransportUnitNameByCarNumber(String carNumber) {
+        if (StringUtils.isBlank(carNumber)) return "";
+
+        CarUnitMapper carUnitMapper = SpringContextUtils.getBean(CarUnitMapper.class);
+        ISysDictItemService sysDictItemService = SpringContextUtils.getBean(ISysDictItemService.class);
+        // 查询 unitCode
+        String unitCode = carUnitMapper.getUnitByCarNumber(carNumber);
+        if (StringUtils.isBlank(unitCode)) return "其他";
+
+        // 查询 car_unit_type 下所有字典项(item_text + item_value)
+        String dictId = getDictId("car_unit_type");
+        if (StringUtils.isBlank(dictId)) return "其他";
+
+        List<SysDictItem> sysDictItems = sysDictItemService.list(
+                new LambdaQueryWrapper<SysDictItem>()
+                        .eq(SysDictItem::getDictId, dictId)
+        );
+
+        // 遍历匹配 unitCode 是否在 item_value 中
+        for (SysDictItem item : sysDictItems) {
+            if (unitCode.equals(item.getItemValue())) {
+                return item.getItemText(); // 匹配成功返回单位名称(如“辉腾”)
+            }
+        }
+
+        return "其他";
+    }
+
+
+    private static StorageCenterExportRow convert(StorageCenterHeatNoInvoicingVO.RollChargeDetail detail, Integer ccmNo, String endpoint) {
+        StorageCenterExportRow row = new StorageCenterExportRow();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String dateString = sdf.format(detail.getCreateTime());
+        row.setFactoryDate(dateString);
+        row.setEndPoint(endpoint);
+        row.setLicensePlate(detail.getLicensePlate());
+        row.setHeatNo(detail.getHeatNo());
+        row.setAmount(detail.getAmount());
+        row.setTotalWeight(detail.getWeight());
+        row.setCcmNo(ccmNo);
+        row.setTransportUnit(getTransportUnitNameByCarNumber(detail.getLicensePlate()));
+        row.setWeightPerPiece(calcWeightPerPiece(detail.getWeight(), detail.getAmount()));
+        row.setSpec(detail.getSpec());
+        row.setBrand(detail.getBrandNum());
+
+        return row;
+    }
+
+    private static BigDecimal calcWeightPerPiece(BigDecimal total, Integer amount) {
+        if (total == null || amount == null || amount == 0) return BigDecimal.ZERO;
+        return total.divide(BigDecimal.valueOf(amount), 3, RoundingMode.HALF_UP);
+    }
+
+    private static String getDictId(String dictCode) {
+        ISysDictService sysDictService = SpringContextUtils.getBean(ISysDictService.class);
+        SysDict dict = sysDictService.getOne(
+                new LambdaQueryWrapper<SysDict>()
+                        .eq(SysDict::getDictCode, dictCode)
+                        .last("LIMIT 1")
+        );
+        return dict != null ? dict.getId() : null;
+    }
 }

+ 25 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/SysDictItemServiceImpl.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.carUnit.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.carUnit.entity.SysDictItem;
+import org.jeecg.modules.carUnit.mapper.SysDictItemMapper;
+import org.jeecg.modules.carUnit.service.ISysDictItemService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @Author zhangweijian
+ * @since 2018-12-28
+ */
+@Service
+public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDictItem> implements ISysDictItemService {
+
+    @Autowired
+    private SysDictItemMapper sysDictItemMapper;
+
+}

+ 23 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/SysDictServiceImpl.java

@@ -0,0 +1,23 @@
+package org.jeecg.modules.carUnit.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.carUnit.entity.SysDict;
+import org.jeecg.modules.carUnit.mapper.SysDictMapper;
+import org.jeecg.modules.carUnit.service.ISysDictService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 字典表 服务实现类
+ * </p>
+ *
+ * @Author zhangweijian
+ * @since 2018-12-28
+ */
+@Service
+@Slf4j
+public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements ISysDictService {
+
+
+}

+ 13 - 0
zgztBus/jeecg-server-cloud/jeecg-cloud-sbm/pom.xml

@@ -34,6 +34,19 @@
             <artifactId>jeecg-module-sbm</artifactId>
             <version>${jeecgboot.version}</version>
         </dependency>
+
+        <!-- EasyExcel -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+        </dependency>
+
+        <!-- Commons IO -->
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 27 - 0
zgztBus/pom.xml

@@ -456,6 +456,33 @@
           <artifactId>jimureport-nosql-starter</artifactId>
           <version>1.6.0</version>
         </dependency>
+        <!-- Apache POI -->
+        <dependency>
+          <groupId>org.apache.poi</groupId>
+          <artifactId>poi-ooxml</artifactId>
+          <version>5.2.2</version>
+        </dependency>
+
+        <!-- FastJSON -->
+        <dependency>
+          <groupId>com.alibaba</groupId>
+          <artifactId>fastjson</artifactId>
+          <version>1.2.83</version>
+        </dependency>
+
+        <!-- EasyExcel -->
+        <dependency>
+          <groupId>com.alibaba</groupId>
+          <artifactId>easyexcel</artifactId>
+          <version>3.3.2</version>
+        </dependency>
+
+        <!-- Commons IO -->
+        <dependency>
+          <groupId>commons-io</groupId>
+          <artifactId>commons-io</artifactId>
+          <version>2.13.0</version>
+        </dependency>
       </dependencies>
     </dependencyManagement>