From eff71a19c21e8d57fcaf15c931bdfe011721ecba Mon Sep 17 00:00:00 2001 From: liangzhou <594755172@qq.com> Date: Mon, 12 Aug 2024 16:37:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0=EF=BC=9A?= =?UTF-8?q?=201.=20=E5=A2=9E=E5=8A=A0=E7=89=A9=E6=96=99=E5=92=8C=E5=B7=A5?= =?UTF-8?q?=E7=AB=99=E9=85=8D=E7=BD=AE=E7=9A=84=E5=AF=BC=E5=85=A5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=82=202.=20=E5=AE=8C=E5=96=84DBS=E4=B8=8E?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E7=9A=84=E5=AF=BC=E5=85=A5=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=AF=BC=E5=85=A5=E5=A4=9A=E4=BD=99=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wms/controller/ExcelController.java | 70 ++++++++- .../excel/listener/UploadDbsListener.java | 11 +- .../excel/listener/UploadGoodsListener.java | 95 ++++++++++++ .../listener/UploadKateOrdersListener.java | 11 +- .../listener/UploadStationConfigListener.java | 103 ++++++++++++ .../com/wms/utils/excel/vo/GoodsExcelVo.java | 146 ++++++++++++++++++ .../utils/excel/vo/StationConfigExcelVo.java | 81 ++++++++++ src/main/resources/application.yml | 16 +- 8 files changed, 517 insertions(+), 16 deletions(-) create mode 100644 src/main/java/com/wms/utils/excel/listener/UploadGoodsListener.java create mode 100644 src/main/java/com/wms/utils/excel/listener/UploadStationConfigListener.java create mode 100644 src/main/java/com/wms/utils/excel/vo/GoodsExcelVo.java create mode 100644 src/main/java/com/wms/utils/excel/vo/StationConfigExcelVo.java diff --git a/src/main/java/com/wms/controller/ExcelController.java b/src/main/java/com/wms/controller/ExcelController.java index e4a6dce..dd1471c 100644 --- a/src/main/java/com/wms/controller/ExcelController.java +++ b/src/main/java/com/wms/controller/ExcelController.java @@ -15,9 +15,7 @@ import com.wms.entity.app.vo.FileVo; import com.wms.entity.table.*; import com.wms.service.*; import com.wms.utils.StringUtils; -import com.wms.utils.excel.listener.UploadDbsListener; -import com.wms.utils.excel.listener.UploadKateOrdersListener; -import com.wms.utils.excel.listener.UploadStocksListener; +import com.wms.utils.excel.listener.*; import com.wms.utils.excel.style.ExcelContentStyle; import com.wms.utils.excel.vo.*; import jakarta.servlet.http.HttpServletRequest; @@ -61,6 +59,8 @@ public class ExcelController { private final KateDBSLastService kateDbsLastService;// Dbs上次记录服务 private final KateOrdersService kateOrdersService;// 工单服务 private final KateOrdersLastService kateOrdersLastService;// 工单上次服务 + private final GoodsService goodsService;// 物料服务 + private final WorkStationConfigService workStationConfigService;// 工站配置服务 /** * 导入库存信息 @@ -112,7 +112,7 @@ public class ExcelController { // 移库Dbs表中的内容 kateDbsService.remove(new LambdaQueryWrapper<>()); // 导入excel - EasyExcel.read(file.getInputStream(), KateDbsExcelVo.class, new UploadDbsListener(kateDbsService, kateDbsLastService, fileVo.getUserName())).sheet().doRead(); + EasyExcel.read(file.getInputStream(), KateDbsExcelVo.class, new UploadDbsListener(kateDbsService, kateDbsLastService, fileVo.getUserName())).sheet().headRowNumber(8).doRead(); // 添加导入记录 uploadRecordService.save(UploadRecord.ofFileVo(fileVo, "DBS")); response.setCode(ResponseCode.OK.getCode()); @@ -129,7 +129,7 @@ public class ExcelController { } /** - * 导入DBS + * 导入工单 * * @param file 文件 * @return 导入结果 @@ -158,6 +158,66 @@ public class ExcelController { } } + /** + * 导入物料 + * + * @param file 文件 + * @return 导入结果 + */ + @PostMapping("/uploadGoods") + @ResponseBody + @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED) + public String uploadGoods(@RequestPart("file") MultipartFile file, @RequestPart("obj") FileVo fileVo) { + logger.info("导入物料,请求ip:{},文件详情:{}", getIpAddr(servletRequest), convertJsonString(fileVo)); + ResponseEntity response = new ResponseEntity(); + try { + // 导入excel + EasyExcel.read(file.getInputStream(), GoodsExcelVo.class, new UploadGoodsListener(goodsService, fileVo.getUserName())).sheet("基本信息").doRead(); + // 添加导入记录 + uploadRecordService.save(UploadRecord.ofFileVo(fileVo, "GOODS")); + response.setCode(ResponseCode.OK.getCode()); + response.setMessage("导入物料成功。"); + return convertJsonString(response); + } catch (Exception e) { + logger.error("导入物料异常:{}", convertJsonString(e)); + // 回滚事务 + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + response.setCode(ResponseCode.ERROR.getCode()); + response.setMessage("导入物料异常。"); + return convertJsonString(response); + } + } + + /** + * 导入工站配置 + * + * @param file 文件 + * @return 导入结果 + */ + @PostMapping("/uploadStationConfig") + @ResponseBody + @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED) + public String uploadStationConfig(@RequestPart("file") MultipartFile file, @RequestPart("obj") FileVo fileVo) { + logger.info("导入工站配置,请求ip:{},文件详情:{}", getIpAddr(servletRequest), convertJsonString(fileVo)); + ResponseEntity response = new ResponseEntity(); + try { + // 导入excel + EasyExcel.read(file.getInputStream(), StationConfigExcelVo.class, new UploadStationConfigListener(workStationConfigService, fileVo.getUserName())).sheet("工站配置").doRead(); + // 添加导入记录 + uploadRecordService.save(UploadRecord.ofFileVo(fileVo, "STATION-CONFIG_")); + response.setCode(ResponseCode.OK.getCode()); + response.setMessage("导入工站配置。"); + return convertJsonString(response); + } catch (Exception e) { + logger.error("导入工站配置异常:{}", convertJsonString(e)); + // 回滚事务 + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + response.setCode(ResponseCode.ERROR.getCode()); + response.setMessage("导入工站配置异常。"); + return convertJsonString(response); + } + } + /** * 导出库存数据 * diff --git a/src/main/java/com/wms/utils/excel/listener/UploadDbsListener.java b/src/main/java/com/wms/utils/excel/listener/UploadDbsListener.java index b1e1053..89fb37a 100644 --- a/src/main/java/com/wms/utils/excel/listener/UploadDbsListener.java +++ b/src/main/java/com/wms/utils/excel/listener/UploadDbsListener.java @@ -8,6 +8,7 @@ import com.wms.entity.table.KateDBS; import com.wms.entity.table.KateDBSLast; import com.wms.service.KateDBSLastService; import com.wms.service.KateDBSService; +import com.wms.utils.StringUtils; import com.wms.utils.excel.vo.KateDbsExcelVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,7 +57,13 @@ public class UploadDbsListener implements ReadListener { */ @Override public void invoke(KateDbsExcelVo kateDbsExcelVo, AnalysisContext analysisContext) { - cachedDataList.add(kateDbsExcelVo); + if (kateDbsExcelVo.getWorkSequence() != null + && StringUtils.isNotEmpty(kateDbsExcelVo.getWorkOrder()) + && StringUtils.isNotEmpty(kateDbsExcelVo.getMachineNo()) + && kateDbsExcelVo.getPlanStartDate() != null) { + // 符合条件的数据 + cachedDataList.add(kateDbsExcelVo); + } // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM if (cachedDataList.size() >= BATCH_COUNT) { logger.info("已经导入{}条数据,开始存储数据库!", cachedDataList.size()); @@ -96,6 +103,7 @@ public class UploadDbsListener implements ReadListener { KateDBS oldKateDbs = new KateDBS(); oldKateDbs.setDbsId(kateDbsLast.getDbsId()); oldKateDbs.setWorkSequence(kateDbsExcelVo.getWorkSequence()); + oldKateDbs.setMachineNo(kateDbsExcelVo.getMachineNo()); oldKateDbs.setWorkOrder(kateDbsExcelVo.getWorkOrder()); oldKateDbs.setPlanStartDate(kateDbsExcelVo.getPlanStartDate()); oldKateDbs.setDbsStatus(kateDbsLast.getDbsStatus()); @@ -107,6 +115,7 @@ public class UploadDbsListener implements ReadListener { KateDBS newKateDbs = new KateDBS(); newKateDbs.setDbsId(generateId("DBS_")); newKateDbs.setWorkSequence(kateDbsExcelVo.getWorkSequence()); + newKateDbs.setMachineNo(kateDbsExcelVo.getMachineNo()); newKateDbs.setWorkOrder(kateDbsExcelVo.getWorkOrder()); newKateDbs.setPlanStartDate(kateDbsExcelVo.getPlanStartDate()); newKateDbs.setDbsStatus(0); diff --git a/src/main/java/com/wms/utils/excel/listener/UploadGoodsListener.java b/src/main/java/com/wms/utils/excel/listener/UploadGoodsListener.java new file mode 100644 index 0000000..ec4c8e3 --- /dev/null +++ b/src/main/java/com/wms/utils/excel/listener/UploadGoodsListener.java @@ -0,0 +1,95 @@ +package com.wms.utils.excel.listener; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.read.listener.ReadListener; +import com.alibaba.excel.util.ListUtils; +import com.wms.entity.table.Goods; +import com.wms.service.GoodsService; +import com.wms.utils.StringUtils; +import com.wms.utils.excel.vo.GoodsExcelVo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +import static com.wms.utils.StringUtils.convertJsonString; + +/** + * 上传DBS监听 + */ +public class UploadGoodsListener implements ReadListener { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + /** + * 每隔5条存储数据库,实际使用中可以100条,然后清理list ,方便内存回收 + */ + private static final int BATCH_COUNT = 100; + /** + * 保存数据总数 + */ + private int SAVE_COUNT = 0; + private List cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); + private final GoodsService goodsService;// Dbs服务 + private final String uploadUser;// 用户 + public UploadGoodsListener(GoodsService goodsService, String uploadUser) { + this.goodsService = goodsService; + this.uploadUser = uploadUser; + } + + @Override + public void onException(Exception exception, AnalysisContext context) throws Exception { + logger.error("处理物料数据发生异常:{}", convertJsonString(exception)); + ReadListener.super.onException(exception, context); + } + + /** + * 这个每一条数据解析都会来调用 + * + * @param goodsExcelVo one row value. It is same as {@link AnalysisContext#readRowHolder()} + * @param analysisContext context + */ + @Override + public void invoke(GoodsExcelVo goodsExcelVo, AnalysisContext analysisContext) { + if (StringUtils.isNotEmpty(goodsExcelVo.getGoodsId())) { + // 符合条件的数据 + cachedDataList.add(goodsExcelVo); + } + // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM + if (cachedDataList.size() >= BATCH_COUNT) { + logger.info("已经导入{}条数据,开始存储数据库!", cachedDataList.size()); + saveData(); + // 存储完成清理 list + cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); + } + } + + /** + * 所有数据解析完成了 都会来调用 + * + * @param analysisContext context + */ + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + saveData(); + logger.info("此次共保存{}条数据。", SAVE_COUNT); + } + + /** + * 存储数据 + */ + private void saveData() { + // 开始存储数据 + List goodsList = new ArrayList<>(); + for (GoodsExcelVo goodsExcelVo : cachedDataList) { + Goods currentGoods = BeanUtil.copyProperties(goodsExcelVo, Goods.class); + currentGoods.setLastUpdateTime(LocalDateTime.now()); + currentGoods.setLastUpdateUser(uploadUser); + goodsList.add(currentGoods); + } + goodsService.saveOrUpdateBatch(goodsList); + // 打印保存数量 + SAVE_COUNT += goodsList.size(); + } +} diff --git a/src/main/java/com/wms/utils/excel/listener/UploadKateOrdersListener.java b/src/main/java/com/wms/utils/excel/listener/UploadKateOrdersListener.java index 2d16911..0cd3415 100644 --- a/src/main/java/com/wms/utils/excel/listener/UploadKateOrdersListener.java +++ b/src/main/java/com/wms/utils/excel/listener/UploadKateOrdersListener.java @@ -63,8 +63,15 @@ public class UploadKateOrdersListener implements ReadListener public void invoke(KateOrdersExcelVo kateOrdersExcelVo, AnalysisContext analysisContext) { String slocFilterString = configMap.get(ConfigMapKeyEnum.SLOC_FILTER_STRING.getConfigKey()); if (StringUtils.isNotEmpty(slocFilterString) && Objects.equals(kateOrdersExcelVo.getSLoc(), slocFilterString)) { - // 符合筛选条件的才能添加 - cachedDataList.add(kateOrdersExcelVo); + // 符合筛选字符串 + if (StringUtils.isNotEmpty(kateOrdersExcelVo.getWorkOrder()) + && StringUtils.isNotEmpty(kateOrdersExcelVo.getGoodsId()) + && StringUtils.isNotEmpty(kateOrdersExcelVo.getSLoc()) + && StringUtils.isNotEmpty(kateOrdersExcelVo.getSupplyArea()) + && kateOrdersExcelVo.getRequirementQuantity() != null) { + // 符合条件 + cachedDataList.add(kateOrdersExcelVo); + } } // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM if (cachedDataList.size() >= BATCH_COUNT) { diff --git a/src/main/java/com/wms/utils/excel/listener/UploadStationConfigListener.java b/src/main/java/com/wms/utils/excel/listener/UploadStationConfigListener.java new file mode 100644 index 0000000..e9ed958 --- /dev/null +++ b/src/main/java/com/wms/utils/excel/listener/UploadStationConfigListener.java @@ -0,0 +1,103 @@ +package com.wms.utils.excel.listener; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.read.listener.ReadListener; +import com.alibaba.excel.util.ListUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.wms.entity.table.KateDBS; +import com.wms.entity.table.KateDBSLast; +import com.wms.entity.table.WorkStationConfig; +import com.wms.service.KateDBSLastService; +import com.wms.service.KateDBSService; +import com.wms.service.WorkStationConfigService; +import com.wms.utils.StringUtils; +import com.wms.utils.excel.vo.KateDbsExcelVo; +import com.wms.utils.excel.vo.StationConfigExcelVo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +import static com.wms.utils.StringUtils.convertJsonString; +import static com.wms.utils.WmsUtils.generateId; + +/** + * 上传DBS监听 + */ +public class UploadStationConfigListener implements ReadListener { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + /** + * 每隔5条存储数据库,实际使用中可以100条,然后清理list ,方便内存回收 + */ + private static final int BATCH_COUNT = 100; + /** + * 保存数据总数 + */ + private int SAVE_COUNT = 0; + private List cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); + private final WorkStationConfigService workStationConfigService;// 工站配置服务 + private final String uploadUser;// 用户 + public UploadStationConfigListener(WorkStationConfigService workStationConfigService, String uploadUser) { + this.workStationConfigService = workStationConfigService; + this.uploadUser = uploadUser; + } + + @Override + public void onException(Exception exception, AnalysisContext context) throws Exception { + logger.error("处理工站配置数据发生异常:{}", convertJsonString(exception)); + ReadListener.super.onException(exception, context); + } + + /** + * 这个每一条数据解析都会来调用 + * + * @param stationConfigExcelVo one row value. It is same as {@link AnalysisContext#readRowHolder()} + * @param analysisContext context + */ + @Override + public void invoke(StationConfigExcelVo stationConfigExcelVo, AnalysisContext analysisContext) { + if (StringUtils.isNotEmpty(stationConfigExcelVo.getWorkStation())) { + // 符合条件的数据 + cachedDataList.add(stationConfigExcelVo); + } + // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM + if (cachedDataList.size() >= BATCH_COUNT) { + logger.info("已经导入{}条数据,开始存储数据库!", cachedDataList.size()); + saveData(); + // 存储完成清理 list + cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); + } + } + + /** + * 所有数据解析完成了 都会来调用 + * + * @param analysisContext context + */ + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + saveData(); + logger.info("此次共保存{}条数据。", SAVE_COUNT); + } + + /** + * 存储数据 + */ + private void saveData() { + // 存储数据 + List stationConfigList = new ArrayList<>(); + for (StationConfigExcelVo stationConfigExcelVo : cachedDataList) { + WorkStationConfig stationConfig = BeanUtil.copyProperties(stationConfigExcelVo, WorkStationConfig.class); + stationConfig.setConfigId(generateId("STATION-CONFIG_")); + stationConfig.setLastUpdateTime(LocalDateTime.now()); + stationConfig.setLastUpdateUser(uploadUser); + stationConfigList.add(stationConfig); + } + workStationConfigService.saveOrUpdateBatch(stationConfigList); + // 打印数量 + SAVE_COUNT += stationConfigList.size(); + } +} diff --git a/src/main/java/com/wms/utils/excel/vo/GoodsExcelVo.java b/src/main/java/com/wms/utils/excel/vo/GoodsExcelVo.java new file mode 100644 index 0000000..4c6eef0 --- /dev/null +++ b/src/main/java/com/wms/utils/excel/vo/GoodsExcelVo.java @@ -0,0 +1,146 @@ +package com.wms.utils.excel.vo; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.wms.entity.app.dto.extend.KanbanEntity; +import com.wms.entity.table.Goods; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 物料excel + */ +@Data +public class GoodsExcelVo { + /** + * 物料编号 + */ + @ExcelProperty("料号") + private String goodsId; + /** + * 物料名称/描述 + */ + @ExcelProperty("描述") + private String goodsName; + /** + * 单位 + */ + @ExcelProperty("单位") + private String goodsUnit = "PC"; + /** + * 物料分类 + */ + @ExcelProperty("物料分类") + private String goodsType; + /** + * 供应商分类 + */ + @ExcelProperty("供应商分类") + private String providerType; + /** + * 重量 + */ + @ExcelProperty("重量") + private BigDecimal weight; + /** + * 重量单位 + */ + @ExcelProperty("重量单位") + private String weightUnit; + /** + * 每盒数量 + */ + @ExcelProperty("每盒数量") + private BigDecimal quantityPerBox; + /** + * 拆包方式 + */ + @ExcelProperty("拆包方式") + private String unpackingType; + /** + * 料箱类型 + */ + @ExcelProperty("料箱类型") + private String vehicleType; + /** + * 料箱类型描述 + */ + @ExcelProperty("料箱类型描述") + private String vehicleTypeDescription; + /** + * 料箱类型 + */ + @ExcelProperty("料箱类型2") + private String goodsInVehicleType; + /** + * 补料方式 + * PULL:有看板 + * PUSH:无看板 + */ + @ExcelProperty("补料方式") + private String feedingType; + /** + * 每个看板包含物料数量 + */ + @ExcelProperty("看板QTY") + private BigDecimal quantityPerKanban; + /** + * 看板的数量 + */ + @ExcelProperty("Number of kanban") + private BigDecimal kanbanNum; + /** + * 看板详细信息 + */ + @ExcelProperty("看板") + private List kanbanList; + /** + * 补货点 + */ + @ExcelProperty("补货点") + private BigDecimal feedingValue; + /** + * 备注1 + */ + @ExcelProperty("备注1") + private String remark1; + /** + * 备注2 + */ + @ExcelProperty("备注2") + private String remark2; + /** + * 备注3 + */ + @ExcelProperty("备注3") + private String remark3; + /** + * 数据来源 + */ + @ExcelProperty("数据来源") + private String dataSource; + /** + * 最后更新日期 + */ + @ExcelProperty("最近更新时间") + @DateTimeFormat("yyyy-MM-dd HH:mm:ss") + private LocalDateTime lastUpdateTime; + /** + * 最近更新用户 + */ + @ExcelProperty("最近更新用户") + private String lastUpdateUser; + + /** + * 从数据库实体转换为excel对象 + * @param goodsPo 数据库实体 + * @return excel对象 + */ + public static GoodsExcelVo of(Goods goodsPo) { + return BeanUtil.copyProperties(goodsPo, GoodsExcelVo.class); + } +} diff --git a/src/main/java/com/wms/utils/excel/vo/StationConfigExcelVo.java b/src/main/java/com/wms/utils/excel/vo/StationConfigExcelVo.java new file mode 100644 index 0000000..ea73a54 --- /dev/null +++ b/src/main/java/com/wms/utils/excel/vo/StationConfigExcelVo.java @@ -0,0 +1,81 @@ +package com.wms.utils.excel.vo; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.wms.entity.table.WorkStationConfig; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * 工站配置Vo + */ +@Data +public class StationConfigExcelVo { + /** + * 配置id + */ + @ExcelProperty("配置id") + private String configId; + /** + * 工作站台 + */ + @ExcelProperty("工站") + private String workStation; + /** + * 小盒子---对面工单表里面的小工位 + */ + @ExcelProperty("小盒子#") + private String smallBox; + /** + * 机型 + */ + @ExcelProperty("机型") + private String model; + /** + * 工位 + */ + @ExcelProperty("工位") + private String workCenter; + /** + * 工位大盒子 + */ + @ExcelProperty("工位大盒子#") + private String bigBox; + /** + * 车辆 + */ + @ExcelProperty("车辆") + private String vehicle; + /** + * 线边架/车位置 + */ + @ExcelProperty("线边架/车位置") + private String vehicleLocation; + /** + * 开工时间调整 + */ + @ExcelProperty("开工时间调整") + private Integer startDateAdjust = 0; + /** + * 最近更新时间 + */ + @ExcelProperty("最近更新时间") + @DateTimeFormat("yyyy-MM-dd HH:mm:ss") + private LocalDateTime lastUpdateTime; + /** + * 最近更新用户 + */ + @ExcelProperty("最近更新用户") + private String lastUpdateUser; + + /** + * 从数据库实体转换为excel对象 + * @param stationConfigPo 数据库实体 + * @return excel对象 + */ + public static StationConfigExcelVo of(WorkStationConfig stationConfigPo) { + return BeanUtil.copyProperties(stationConfigPo, StationConfigExcelVo.class); + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index dbba78b..c7d9413 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -8,20 +8,20 @@ spring: # 主库 master: # 卡特数据库服务器 -# url: jdbc:mysql://10.90.36.71:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true -# username: developer -# password: developer -# driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://10.90.36.71:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true + username: developer + password: developer + driver-class-name: com.mysql.cj.jdbc.Driver # 宝开服务器--内网 # url: jdbc:mysql://192.168.3.254:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true # username: coder # password: coder # driver-class-name: com.mysql.cj.jdbc.Driver # # 本地环境 - url: jdbc:mysql://localhost:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true - username: developer - password: developer - driver-class-name: com.mysql.cj.jdbc.Driver +# url: jdbc:mysql://localhost:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true +# username: developer +# password: developer +# driver-class-name: com.mysql.cj.jdbc.Driver # 从库 # slave_1: # url: jdbc:mysql://localhost:3306/wms_aaa?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true