Selaa lähdekoodia

Merge branch 'master' of http://123.57.213.14:3001/zgzt/dosb-java

guoqiang 1 kuukausi sitten
vanhempi
sitoutus
65ea2c6668
22 muutettua tiedostoa jossa 836 lisäystä ja 10 poistoa
  1. 24 0
      zgztBus/jeecg-module-sbm/pom.xml
  2. 84 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/controller/BilletHotsendBaseController.java
  3. 68 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/dto/BilletHotsendExportDTO.java
  4. 9 6
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/shiftConfiguration/controller/ShiftConfigurationController.java
  5. 55 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/vo/StorageCenterExportRow.java
  6. 38 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/controller/CarUnitController.java
  7. 89 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/entity/SysDict.java
  8. 84 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/entity/SysDictItem.java
  9. 3 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/CarUnitMapper.java
  10. 27 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/SysDictItemMapper.java
  11. 25 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/SysDictMapper.java
  12. 7 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/xml/CarUnitMapper.xml
  13. 5 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/xml/SysDictItemMapper.xml
  14. 12 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/mapper/xml/SysDictMapper.xml
  15. 9 2
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/ICarUnitService.java
  16. 16 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/ISysDictItemService.java
  17. 24 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/ISysDictService.java
  18. 150 2
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/CarUnitServiceImpl.java
  19. 25 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/SysDictItemServiceImpl.java
  20. 42 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/SysDictServiceImpl.java
  21. 13 0
      zgztBus/jeecg-server-cloud/jeecg-cloud-sbm/pom.xml
  22. 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>

+ 84 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/controller/BilletHotsendBaseController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.billet.billetHotsend.controller;
 
+import com.alibaba.excel.EasyExcel;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
@@ -15,20 +17,31 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
 import org.jeecg.modules.actualControl.billetActual.billetActual.service.IBilletBasicInfoService;
+import org.jeecg.modules.billet.billetHotsend.dto.BilletHotsendExportDTO;
 import org.jeecg.modules.billet.billetHotsend.entity.BilletBasicInfoDetails;
 import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsend;
 import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsendDetailsVo;
 import org.jeecg.modules.billet.billetHotsend.entity.RealtimeStats;
 import org.jeecg.modules.billet.billetHotsend.service.IBilletHotsendBaseService;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
+import org.jeecg.modules.carUnit.service.ISysDictService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
 import java.util.Arrays;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
 
 /**
 * @Description: 钢坯热送基础信息
@@ -50,6 +63,9 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
    @Autowired
    private IBilletBasicInfoService billetBasicInfoService;
 
+    @Autowired
+    private ISysDictService sysDictService;
+
    /**
     * 分页列表查询
     *
@@ -277,4 +293,72 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
         List<BilletBasicInfoDetails> billetHotsendList = billetHotsendBaseService.queryBilletInfoByBilletNo(billetNo);
         return Result.OK(billetHotsendList);
     }
+
+    @AutoLog(value = "钢坯热送基础信息-EasyExcel导出")
+    @ApiOperation(value = "钢坯热送基础信息-EasyExcel导出", notes = "分页导出当前页数据")
+    @GetMapping("/exportExcel")
+    public void exportEasyExcel(HttpServletRequest request, HttpServletResponse response,
+                                BilletHotsend billetHotsend) throws IOException {
+
+        // 构造查询条件
+        QueryWrapper<BilletHotsend> queryWrapper = QueryGenerator.initQueryWrapper(billetHotsend, request.getParameterMap());
+
+        // 获取参数
+        String createTimeBegin = request.getParameter("createTime_begin");
+        String createTimeEnd = request.getParameter("createTime_end");
+
+        // 如果前端没有传时间范围,则默认查询最近一个月
+        if (StringUtils.isBlank(createTimeBegin) && StringUtils.isBlank(createTimeEnd)) {
+            LocalDateTime now = LocalDateTime.now();
+            LocalDateTime oneMonthAgo = now.minusMonths(1);
+            queryWrapper.between("create_time", oneMonthAgo, now);
+        }
+
+        // 时间格式与字典准备
+        AtomicInteger index = new AtomicInteger(1); // 序号从 1 开始
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        ZoneId zoneId = ZoneId.systemDefault();
+
+        List<BilletHotsend> billetHotsendList = billetHotsendBaseService.list(queryWrapper);
+
+        // 构造导出数据列表
+        List<BilletHotsendExportDTO> exportList = billetHotsendList.stream().map(item -> {
+            BilletHotsendExportDTO dto = new BilletHotsendExportDTO();
+            dto.setIndex(index.getAndIncrement());
+
+            dto.setCreateTime(item.getCreateTime() != null
+                    ? item.getCreateTime().toInstant().atZone(zoneId).toLocalDateTime().format(formatter)
+                    : "");
+
+            dto.setHeatNo(item.getHeatNo());
+            dto.setShiftGroup(sysDictService.queryDictTextByKey("lg_bz", item.getShiftGroup())); // 班组中文
+            dto.setShift(sysDictService.queryDictTextByKey("lg_bb", item.getShift())); // 班别中文
+            dto.setSteel(item.getSteel());
+            dto.setSpec(item.getSpec());
+            dto.setDecideWeight(BigDecimal.valueOf(item.getDecideWeight()));
+            dto.setAmountTotal(item.getAmountTotal());
+            dto.setBlankOutput(BigDecimal.valueOf(item.getBlankOutput()));
+            dto.setStackNum(item.getStackNum());
+            dto.setRollcluboneNum(item.getRollcluboneNum());
+            dto.setRollclubtwoNum(item.getRollclubtwoNum());
+            dto.setRollclubthreeNum(item.getRollclubthreeNum());
+            dto.setRollheightNum(item.getRollheightNum());
+            dto.setRolloutshippNum(item.getRolloutshippNum());
+            dto.setWasteNum(item.getWasteNum());
+            return dto;
+        }).collect(Collectors.toList());
+
+        // 设置响应头
+        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+        response.setCharacterEncoding("utf-8");
+        String fileName = URLEncoder.encode("钢坯热送信息导出", StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20");
+        response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
+
+        // 导出数据
+        EasyExcel.write(response.getOutputStream(), BilletHotsendExportDTO.class)
+                .sheet("钢坯热送数据")
+                .doWrite(exportList);
+    }
+
+
 }

+ 68 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/dto/BilletHotsendExportDTO.java

@@ -0,0 +1,68 @@
+package org.jeecg.modules.billet.billetHotsend.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class BilletHotsendExportDTO {
+
+    @ExcelProperty("序号")
+    private Integer index;
+
+    @ExcelProperty("日期")
+    @ColumnWidth(20)
+    private String createTime;
+
+    @ExcelProperty("炉号")
+    @ColumnWidth(10)
+    private String heatNo;
+
+    @ExcelProperty("班组")
+    private String shiftGroup;
+
+    @ExcelProperty("班别")
+    private String shift;
+
+    @ExcelProperty("钢种")
+    @ColumnWidth(11)
+    private String steel;
+
+    @ExcelProperty("规格")
+    @ColumnWidth(15)
+    private String spec;
+
+    @ExcelProperty("定重")
+    @ColumnWidth(12)
+    private BigDecimal decideWeight;
+
+    @ExcelProperty("总支数")
+    private Integer amountTotal;
+
+    @ExcelProperty("出坯量")
+    @ColumnWidth(12)
+    private BigDecimal blankOutput;
+
+    @ExcelProperty("堆垛")
+    private Integer stackNum;
+
+    @ExcelProperty("棒一")
+    private Integer rollcluboneNum;
+
+    @ExcelProperty("棒二")
+    private Integer rollclubtwoNum;
+
+    @ExcelProperty("棒三")
+    private Integer rollclubthreeNum;
+
+    @ExcelProperty("高线")
+    private Integer rollheightNum;
+
+    @ExcelProperty("上若")
+    private Integer rolloutshippNum;
+
+    @ExcelProperty("判废")
+    private Integer wasteNum;
+}

+ 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);
+}

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

@@ -0,0 +1,25 @@
+package org.jeecg.modules.carUnit.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.carUnit.entity.SysDict;
+
+/**
+ * <p>
+ * 字典表 Mapper 接口
+ * </p>
+ *
+ * @Author zhangweijian
+ * @since 2018-12-28
+ */
+public interface SysDictMapper extends BaseMapper<SysDict> {
+
+    /**
+     * 通过字典code获取字典数据
+     * @param code
+     * @param key
+     * @return
+     */
+    public String queryDictTextByKey(@Param("code") String code, @Param("key") String key);
+
+}

+ 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>

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

@@ -0,0 +1,12 @@
+<?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">
+
+    <!-- 通过字典code获取字典数据 -->
+    <select id="queryDictTextByKey" parameterType="String"  resultType="String">
+        select s.item_text from sys_dict_item s
+        where s.dict_id = (select id from sys_dict where dict_code = #{code})
+          and s.item_value = #{key}
+    </select>
+
+</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> {
+
+}

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

@@ -0,0 +1,24 @@
+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> {
+
+    /**
+     * 通过字典code及字典项的value获取字典文本
+     * @param code
+     * @param key
+     * @return
+     */
+    public String queryDictTextByKey(String code, String key);
+
+}

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

@@ -1,19 +1,167 @@
 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 "其他";
+    }
+
+    public static String getBrandNum(String value) {
+        if (StringUtils.isBlank(value)) return "";
+
+        ISysDictItemService sysDictItemService = SpringContextUtils.getBean(ISysDictItemService.class);
+
+        // 查询 car_unit_type 下所有字典项(item_text + item_value)
+        String dictId = getDictId("billet_spec");
+        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 (value.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(getBrandNum(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;
+
+}

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

@@ -0,0 +1,42 @@
+package org.jeecg.modules.carUnit.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.constant.CacheConstant;
+import org.jeecg.modules.carUnit.entity.SysDict;
+import org.jeecg.modules.carUnit.mapper.SysDictMapper;
+import org.jeecg.modules.carUnit.service.ISysDictService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 字典表 服务实现类
+ * </p>
+ *
+ * @Author zhangweijian
+ * @since 2018-12-28
+ */
+@Service
+@Slf4j
+public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements ISysDictService {
+
+    @Autowired
+    private SysDictMapper sysDictMapper;
+    /**
+     * 通过查询指定code 获取字典值text
+     * @param code
+     * @param key
+     * @return
+     */
+
+    @Override
+    @Cacheable(value = CacheConstant.SYS_DICT_CACHE,key = "#code+':'+#key", unless = "#result == null ")
+    public String queryDictTextByKey(String code, String key) {
+        log.debug("无缓存dictText的时候调用这里!");
+        return sysDictMapper.queryDictTextByKey(code, key);
+    }
+
+
+}

+ 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>