From 6fd11a195ebfbf8a0fcca35917c2a952cce8769f Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Mon, 12 Jan 2026 17:48:56 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E5=AF=BC=E4=BA=BA=E5=91=98=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DrpCheckInventoryServiceImp.java | 2 +- .../core/reportforms/beans/DrpDictVO.java | 21 + .../beans/DrpInventoryIntoDetailQueryDTO.java | 33 ++ .../beans/DrpInventoryIntoDetailVO.java | 116 ++++ .../beans/DrpInventoryIntoDetailWrapper.java | 18 + .../beans/DrpInventoryoutDetailVO.java | 116 ++++ .../core/reportforms/beans/DrpSupplierVO.java | 15 + .../reportforms/beans/DrpWarehouseAllVO.java | 12 + .../beans/InventoryGoodsSummaryVO.java | 70 +++ .../beans/InventoryIntoSummaryVO.java | 18 + .../ReportDrpInventoryWarehouseSummaryVO.java | 51 ++ .../controller/DrpInventoryController.java | 79 +++ .../DrpInventoryIntoDetailController.java | 149 +++++ .../exportUtils/FenToYuanHandler.java | 33 ++ .../mapper/DrpInventoryIntoDetailMapper.java | 49 ++ .../mapper/DrpInventoryhzMapper.java | 16 + .../service/DrpInventoryService.java | 19 + .../IDrpInventoryIntoDetailService.java | 46 ++ .../DrpInventoryIntoDetailServiceImpl.java | 238 ++++++++ .../service/impl/DrpInventoryServiceImpl.java | 79 +++ .../mapper/reportforms/DrpInventorMapper.xml | 294 ++++++++++ .../DrpInventoryIntoDetailMapper.xml | 519 ++++++++++++++++++ 22 files changed, 1992 insertions(+), 1 deletion(-) create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpDictVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailQueryDTO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailWrapper.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryoutDetailVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpSupplierVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpWarehouseAllVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/InventoryGoodsSummaryVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/InventoryIntoSummaryVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/ReportDrpInventoryWarehouseSummaryVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/DrpInventoryController.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/DrpInventoryIntoDetailController.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/exportUtils/FenToYuanHandler.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/DrpInventoryIntoDetailMapper.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/DrpInventoryhzMapper.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/DrpInventoryService.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/IDrpInventoryIntoDetailService.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/DrpInventoryIntoDetailServiceImpl.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/DrpInventoryServiceImpl.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/DrpInventorMapper.xml create mode 100644 bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/DrpInventoryIntoDetailMapper.xml diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/drp/service/impl/DrpCheckInventoryServiceImp.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/drp/service/impl/DrpCheckInventoryServiceImp.java index 045677b3..d626b6da 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/drp/service/impl/DrpCheckInventoryServiceImp.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/drp/service/impl/DrpCheckInventoryServiceImp.java @@ -63,7 +63,7 @@ public class DrpCheckInventoryServiceImp implements DrpCheckInventoryService { mapper.selectInventoryByPrice(materialIds, leRequest.getSecondCheckDate(), leRequest.getWarehouseId()); if (priceBuckets == null || priceBuckets.isEmpty()) { - return Collections.emptyList(); + return detailList; } // 3. 按物料ID汇总实盘总数(来自 drp_check_detail.actual_num) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpDictVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpDictVO.java new file mode 100644 index 00000000..5dac8462 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpDictVO.java @@ -0,0 +1,21 @@ +package com.bonus.canteen.core.reportforms.beans; + +import lombok.Data; + +import java.util.List; + + +/** + * 字典VO对象 + */ +@Data +public class DrpDictVO { + + private String value; + private String label; + private Long id; + private String dictLabel; + private String dictValue; + private Long parentId; + private List children; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailQueryDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailQueryDTO.java new file mode 100644 index 00000000..7e3743d5 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailQueryDTO.java @@ -0,0 +1,33 @@ +package com.bonus.canteen.core.reportforms.beans; + + +import com.bonus.common.core.web.domain.BaseEntity; +import lombok.Data; + +import java.util.List; + +/** + * 库存入库明细查询DTO对象 + * + * @author lizhenhua + * @date 2025-12-29 + */ +@Data +public class DrpInventoryIntoDetailQueryDTO extends BaseEntity +{ + private static final long serialVersionUID = 1L; + private String recordId; + private List intoTypeList; + private String goodsCategory; + private List warehouseIdList; + private String goodsName; + private List supplierIdList; + private List areaIdList; + private String startDate; + private String endDate; + private String materialName; + private List categoryIdList; + public int pageNum; + public int pageSize; + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailVO.java new file mode 100644 index 00000000..5209388e --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailVO.java @@ -0,0 +1,116 @@ +package com.bonus.canteen.core.reportforms.beans; + +import java.math.BigDecimal; +import java.util.Date; + +import com.bonus.canteen.core.reportforms.exportUtils.FenToYuanHandler; +import com.bonus.common.core.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +/** + * 库存入库明细相关VO(合并版) + * 包含:入库明细VO、仓库VO、供应商VO、字典VO + * + * @author lizhenhua + * @date 2025-12-29 + */ +@Data +public class DrpInventoryIntoDetailVO{ + + /** 仓库ID */ + private Long warehouseId; + + /** 操作人ID */ + private String operatorId; + + /** 供应商ID */ + private Long supplierId; + + /** 货品类别 */ + private String goodsCategory; + + /** 货品编码 */ + @Excel(name = "货品编码") + private String goodsCode; + + /** 货品类别名称 */ + @Excel(name = "货品类别") + private String goodsCategoryName; + + /** 货品名称 */ + @Excel(name = "货品名称") + private String goodsName; + + /** 计量单位 */ + @Excel(name = "计量单位") + private String unitName; + + /** 货品规格 */ + @Excel(name = "货品规格") + private String specification; + + /** 单价(元) */ + @Excel(name = "单价(元)", cellType = Excel.ColumnType.NUMERIC, handler = FenToYuanHandler.class) + private BigDecimal price; + + /** 所属区域名称 */ + @Excel(name = "所属区域") + private String areaName; + + /** 仓库名称 */ + @Excel(name = "货品仓库") + private String warehouseName; + + /** 入库类型 */ + @Excel(name = "入库类型") + private String intoType; + + /** 供应商名称 */ + @Excel(name = "供应商") + private String supplierName; + + /** 入库时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "入库时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date intoDate; + + /** 入库数量 */ + @Excel(name = "入库数量", cellType = Excel.ColumnType.NUMERIC) + private BigDecimal intoNum; + + @Excel(name = "入库金额(元)", cellType = Excel.ColumnType.NUMERIC, handler = FenToYuanHandler.class) + private BigDecimal intoAmount; + + /** 结存数量 */ + @Excel(name = "结存数量", cellType = Excel.ColumnType.NUMERIC) + private BigDecimal balanceNum; + + /** 结存金额(元) */ + @Excel(name = "结存金额(元)",cellType = Excel.ColumnType.NUMERIC, handler = FenToYuanHandler.class) + private BigDecimal balanceAmount; + + /** 生产日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "生产日期", width = 15, dateFormat = "yyyy-MM-dd") + private Date productionDate; + + /** 过期日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "过期日期", width = 15, dateFormat = "yyyy-MM-dd") + private Date expiryDate; + + /** 操作人名称 */ + @Excel(name = "操作人") + private String operatorName; + + /** 入库单号 */ + @Excel(name = "入库单号") + private String recordId; + + /** 合计行 */ + private Boolean sumRow = false; + + + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailWrapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailWrapper.java new file mode 100644 index 00000000..af35743e --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryIntoDetailWrapper.java @@ -0,0 +1,18 @@ +package com.bonus.canteen.core.reportforms.beans; + +import lombok.Data; + +import java.util.List; + +/** + * 库存入库明细相关VO(合并版) + * 解决分页问题 + */ + +@Data +public class DrpInventoryIntoDetailWrapper { + + private DrpInventoryIntoDetailQueryDTO param; + private List warehouseAuthority; + private List areaAuth; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryoutDetailVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryoutDetailVO.java new file mode 100644 index 00000000..3b4edfd2 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpInventoryoutDetailVO.java @@ -0,0 +1,116 @@ +package com.bonus.canteen.core.reportforms.beans; + +import com.bonus.canteen.core.reportforms.exportUtils.FenToYuanHandler; +import com.bonus.common.core.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 库存出库明细相关VO(合并版) + * 包含:出库明细VO、仓库VO、供应商VO、字典VO + * + * @author lizhenhua + * @date 2025-12-29 + */ +@Data +public class DrpInventoryoutDetailVO { + + /** 仓库ID */ + private Long warehouseId; + + /** 操作人ID */ + private String operatorId; + + /** 供应商ID */ + private Long supplierId; + + /** 货品类别 */ + private String goodsCategory; + + /** 货品编码 */ + @Excel(name = "货品编码") + private String goodsCode; + + /** 货品类别名称 */ + @Excel(name = "货品类别") + private String goodsCategoryName; + + /** 货品名称 */ + @Excel(name = "货品名称") + private String goodsName; + + /** 计量单位 */ + @Excel(name = "计量单位") + private String unitName; + + /** 货品规格 */ + @Excel(name = "货品规格") + private String specification; + + /** 单价(元) */ + @Excel(name = "单价(元)", cellType = Excel.ColumnType.NUMERIC, handler = FenToYuanHandler.class) + private BigDecimal price; + + /** 所属区域名称 */ + @Excel(name = "所属区域") + private String areaName; + + /** 仓库名称 */ + @Excel(name = "货品仓库") + private String warehouseName; + + /** 出库类型 */ + @Excel(name = "出库类型") + private String intoType; + + /** 供应商名称 */ + @Excel(name = "供应商") + private String supplierName; + + /** 出库时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "出库时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date intoDate; + + /** 出库数量 */ + @Excel(name = "出库数量", cellType = Excel.ColumnType.NUMERIC) + private BigDecimal intoNum; + + @Excel(name = "出库金额(元)", cellType = Excel.ColumnType.NUMERIC, handler = FenToYuanHandler.class) + private BigDecimal intoAmount; + + /** 结存数量 */ + @Excel(name = "结存数量", cellType = Excel.ColumnType.NUMERIC) + private BigDecimal balanceNum; + + /** 结存金额(元) */ + @Excel(name = "结存金额(元)",cellType = Excel.ColumnType.NUMERIC, handler = FenToYuanHandler.class) + private BigDecimal balanceAmount; + + /** 生产日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "生产日期", width = 15, dateFormat = "yyyy-MM-dd") + private Date productionDate; + + /** 过期日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "过期日期", width = 15, dateFormat = "yyyy-MM-dd") + private Date expiryDate; + + /** 操作人名称 */ + @Excel(name = "操作人") + private String operatorName; + + /** 出库单号 */ + @Excel(name = "出库单号") + private String recordId; + + /** 合计行 */ + private Boolean sumRow = false; + + + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpSupplierVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpSupplierVO.java new file mode 100644 index 00000000..e638784b --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpSupplierVO.java @@ -0,0 +1,15 @@ +package com.bonus.canteen.core.reportforms.beans; + + +import lombok.Data; + +/** + * 供应商VO对象 + */ +@Data +public class DrpSupplierVO { + + private Long supplierId; + private String supplierName; + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpWarehouseAllVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpWarehouseAllVO.java new file mode 100644 index 00000000..2dc1d104 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/DrpWarehouseAllVO.java @@ -0,0 +1,12 @@ +package com.bonus.canteen.core.reportforms.beans; + + +import lombok.Data; + +@Data +public class DrpWarehouseAllVO { + + private Long warehouseId; + private Long areaId; + private String warehouseName; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/InventoryGoodsSummaryVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/InventoryGoodsSummaryVO.java new file mode 100644 index 00000000..cc2a571e --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/InventoryGoodsSummaryVO.java @@ -0,0 +1,70 @@ +package com.bonus.canteen.core.reportforms.beans; + + +import com.bonus.common.core.annotation.Excel; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class InventoryGoodsSummaryVO { + /** 货品ID */ + private Long materialId; + + /** 货品名称 */ + @Excel(name = "货品名称") + private String materialName; + + /** 货品编码 */ + @Excel(name = "货品编码") + private String materialCode; + + /** 分类ID */ + private Long categoryId; + + /** 分类名称 */ + @Excel(name = "货品类别") + private String categoryName; + + /** 单位ID */ + private Long unitId; + + /** 单位名称 */ + @Excel(name = "计量单位") + private String unitName; + + /** 尺寸/规格 */ + @Excel(name = "货品规格") + private String size; + + /** 入库总数 */ + @Excel(name = "入库数量") + private BigDecimal intoTotalNum; + + /** 入库总金额 */ + @Excel(name = "入库金额") + private BigDecimal intoTotalAmount; + + /** 出库总数 */ + @Excel(name = "出库数量") + private BigDecimal outTotalNum; + + /** 出库总金额 */ + @Excel(name = "出库金额") + private BigDecimal outTotalAmount; + + /** 结存数量 */ + private BigDecimal balanceNum; + + /** 结存金额 */ + private BigDecimal balanceAmount; + + /** 区域名称 */ + @Excel(name = "区域名称") + private String areaName; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/InventoryIntoSummaryVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/InventoryIntoSummaryVO.java new file mode 100644 index 00000000..b3247725 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/InventoryIntoSummaryVO.java @@ -0,0 +1,18 @@ +package com.bonus.canteen.core.reportforms.beans; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class InventoryIntoSummaryVO { + + private BigDecimal totalInQty; // 出库数量合计 + private BigDecimal totalInAmount; // 出库金额合计 + private BigDecimal totalStockQty; // 结存数量合计 + private BigDecimal totalStockAmount; // 结存金额合计 + private BigDecimal intoTotalNum; // 内部数量 + private BigDecimal intoTotalAmount; // 内部金额 + private BigDecimal outTotalNum; // 外部数量 + private BigDecimal outTotalAmount; // 外部金额 +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/ReportDrpInventoryWarehouseSummaryVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/ReportDrpInventoryWarehouseSummaryVO.java new file mode 100644 index 00000000..5b5e9d16 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/ReportDrpInventoryWarehouseSummaryVO.java @@ -0,0 +1,51 @@ +package com.bonus.canteen.core.reportforms.beans; + +import com.bonus.common.core.annotation.Excel; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ReportDrpInventoryWarehouseSummaryVO { + + /** + * 所属区域 + */ + @Excel(name = "所属区域") + private String areaName; + /** + * 仓库ID + */ + @Excel(name = "仓库ID") + + private String warehouseId; + /** + * 仓库名称 + */ + @Excel(name = "仓库名称") + + private String warehouseName; + /** + * 入库总数量 + */ + @Excel(name = "入库总数量") + private BigDecimal intoTotalNum; + /** + * 入库总金额 + */ + @Excel(name = "入库总金额") + + private BigDecimal intoTotalAmount; + /** + * 出库总数量 + */ + @Excel(name = "出库总数量") + + private BigDecimal outTotalNum; + /** + * 出库总金额 + */ + @Excel(name = "出库总金额") + + private BigDecimal outTotalAmount; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/DrpInventoryController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/DrpInventoryController.java new file mode 100644 index 00000000..c8ee4994 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/DrpInventoryController.java @@ -0,0 +1,79 @@ +package com.bonus.canteen.core.reportforms.controller; + + +import com.bonus.canteen.core.reportforms.beans.DrpInventoryIntoDetailQueryDTO; +import com.bonus.canteen.core.reportforms.beans.DrpInventoryIntoDetailVO; +import com.bonus.canteen.core.reportforms.beans.InventoryGoodsSummaryVO; +import com.bonus.canteen.core.reportforms.beans.InventoryIntoSummaryVO; +import com.bonus.canteen.core.reportforms.service.DrpInventoryService; +import com.bonus.common.core.utils.poi.ExcelUtil; +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/drp/inventoryIntohz") +public class DrpInventoryController extends BaseController{ + + @Autowired + private DrpInventoryService drpInventoryService; + + /** + * 查询货品汇总明细列表 + */ + @GetMapping("/goods/summary/page") + public AjaxResult list(DrpInventoryIntoDetailQueryDTO queryDTO) + { + // 调用Service方法 - 返回 Map + Map result = drpInventoryService.pageInventoryIntoDetail(queryDTO); + List list = (List) result.get("list"); + InventoryIntoSummaryVO summary = (InventoryIntoSummaryVO) result.get("summary"); + // 使用 AjaxResult 返回数据 + AjaxResult ajax = AjaxResult.success(); + ajax.put("rows", list); + ajax.put("total", new PageInfo(list).getTotal()); + ajax.put("summary", summary); + return ajax; + } + /** + * 导出货品汇总明细列表 + */ + @PostMapping("/goods/summary/export") + public void export(HttpServletResponse response, DrpInventoryIntoDetailQueryDTO queryDTO) + { + List list = drpInventoryService.pageInventoryIntoDetailExport(queryDTO); + //里面金额除以100 + list.forEach(item -> { + item.setIntoTotalAmount(item.getIntoTotalAmount().divide(new java.math.BigDecimal(100))); + item.setOutTotalAmount(item.getOutTotalAmount().divide(new java.math.BigDecimal(100))); + }); + ExcelUtil util = new ExcelUtil(InventoryGoodsSummaryVO.class); + util.exportExcel(response, list, "货品汇总明细数据"); + } + /** + * 查询仓库汇总明细列表 + */ + @GetMapping("/warehouse/summary/page") + public AjaxResult warehouselist(DrpInventoryIntoDetailQueryDTO queryDTO) + { + // 调用Service方法 - 返回 Map + Map result = drpInventoryService.pageInventoryWarehouseSummary(queryDTO); + List list = (List) result.get("list"); + InventoryIntoSummaryVO summary = (InventoryIntoSummaryVO) result.get("summary"); + // 使用 AjaxResult 返回数据 + AjaxResult ajax = AjaxResult.success(); + ajax.put("rows", list); + ajax.put("total", new PageInfo(list).getTotal()); + ajax.put("summary", summary); + return ajax; + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/DrpInventoryIntoDetailController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/DrpInventoryIntoDetailController.java new file mode 100644 index 00000000..77bb066f --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/DrpInventoryIntoDetailController.java @@ -0,0 +1,149 @@ +package com.bonus.canteen.core.reportforms.controller; + + +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletResponse; + +import com.bonus.canteen.core.reportforms.beans.*; +import com.bonus.canteen.core.reportforms.service.IDrpInventoryIntoDetailService; +import com.bonus.common.core.utils.poi.ExcelUtil; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.core.web.controller.BaseController; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 库存入库明细Controller + * 包含所有接口:查询、导出、公共数据接口 + * + * @author ruoyi + * @date 2024-01-01 + */ +@RestController +@RequestMapping("/drp/inventoryInto") +public class DrpInventoryIntoDetailController extends BaseController +{ + @Autowired + private IDrpInventoryIntoDetailService drpInventoryIntoDetailService; + + /** + * 查询库存入库明细列表 + */ + @GetMapping("/detail/list") + public AjaxResult list(DrpInventoryIntoDetailQueryDTO queryDTO) + { + // 调用Service方法 - 返回 Map + Map result = drpInventoryIntoDetailService.pageInventoryIntoDetail(queryDTO); + List list = (List) result.get("list"); + InventoryIntoSummaryVO summary = (InventoryIntoSummaryVO) result.get("summary"); + // 使用 AjaxResult 返回数据 + AjaxResult ajax = AjaxResult.success(); + ajax.put("rows", list); + ajax.put("total", new PageInfo(list).getTotal()); + ajax.put("summary", summary); + + return ajax; + } + /** + * 查询库存出库明细列表 + */ + @GetMapping("/detail/listout") + public AjaxResult listout(DrpInventoryIntoDetailQueryDTO queryDTO) + { + // 调用Service方法 - 返回 Map + Map result = drpInventoryIntoDetailService.pageInventoryOutDetail(queryDTO); + List list = (List) result.get("list"); + InventoryIntoSummaryVO summary = (InventoryIntoSummaryVO) result.get("summary"); + // 使用 AjaxResult 返回数据 + AjaxResult ajax = AjaxResult.success(); + ajax.put("rows", list); + ajax.put("total", new PageInfo(list).getTotal()); + ajax.put("summary", summary); + return ajax; + } + + /** + * 导出库存入库明细列表 + */ + @PostMapping("/detail/export") + public void export(HttpServletResponse response, DrpInventoryIntoDetailQueryDTO queryDTO) + { + List list = drpInventoryIntoDetailService.pageInventoryIntoDetailesport(queryDTO); + for (DrpInventoryIntoDetailVO vo : list) { + vo.setIntoType(convertIntoType(vo.getIntoType())); + } + ExcelUtil util = new ExcelUtil(DrpInventoryIntoDetailVO.class); + util.exportExcel(response, list, "库存入库明细数据"); + } + + /** + * 导出库存出库明细列表 + */ + @PostMapping("/detail/outexport") + public void outexport(HttpServletResponse response, DrpInventoryIntoDetailQueryDTO queryDTO) + { + List list = drpInventoryIntoDetailService.pageInventoryIntoDetailoutesport(queryDTO); + for (DrpInventoryoutDetailVO vo : list) { + vo.setIntoType(convertIntoOutType(vo.getIntoType())); + } + ExcelUtil util = new ExcelUtil(DrpInventoryoutDetailVO.class); + util.exportExcel(response, list, "库存出库明细数据"); + } + private String convertIntoType(String type) { + if ("6".equals(type)) { + return "超市退单入库"; + } else if ("1".equals(type)) { + return "采购入库"; + } else if ("5".equals(type)) { + return "即入即出"; + } else { + return "--"; + } + } + private String convertIntoOutType(String type) { + if ("6".equals(type)) { + return "超市入库"; + } else if ("1".equals(type)) { + return "领取出库"; + } else if ("5".equals(type)) { + return "即入即出"; + } else if ("3".equals(type)) { + return "退货出库"; + }else { + return "--"; + } + } + + + /** + * 获取仓库列表(带权限控制) + */ + @GetMapping("/warehouse/list") + public AjaxResult getWarehouseList(@RequestParam("areaIdList") Long[] areaIdList) + { + List list = drpInventoryIntoDetailService.getTenantWarehouse(areaIdList); + return AjaxResult.success(list); + } + + /** + * 获取供应商列表 + */ + @GetMapping("/supplier/list") + public AjaxResult getSupplierList() + { + List list = drpInventoryIntoDetailService.getSupplierList(); + return AjaxResult.success(list); + } + + /** + * 获取货品类别字典 + */ + @GetMapping("/goodsCategory/dict") + public AjaxResult getGoodsCategoryDict() + { + List list = drpInventoryIntoDetailService.getGoodsCategoryDict(); + return AjaxResult.success(list); + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/exportUtils/FenToYuanHandler.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/exportUtils/FenToYuanHandler.java new file mode 100644 index 00000000..38d3da7f --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/exportUtils/FenToYuanHandler.java @@ -0,0 +1,33 @@ +package com.bonus.canteen.core.reportforms.exportUtils; + +import com.bonus.common.core.utils.poi.ExcelHandlerAdapter; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.Workbook; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +public class FenToYuanHandler implements ExcelHandlerAdapter { + @Override + public Object format(Object value, String[] args, Cell cell, Workbook workbook) { + + if (value == null) { + return null; + } + + try { + BigDecimal fen = new BigDecimal(value.toString()); + BigDecimal yuan = fen.divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP); + + // 关键三件套 + cell.setCellType(CellType.NUMERIC); + cell.setCellValue(yuan.doubleValue()); + return yuan.doubleValue(); + + } catch (Exception e) { + return value; + } + } +} + diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/DrpInventoryIntoDetailMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/DrpInventoryIntoDetailMapper.java new file mode 100644 index 00000000..e20d43ba --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/DrpInventoryIntoDetailMapper.java @@ -0,0 +1,49 @@ +package com.bonus.canteen.core.reportforms.mapper; + +import com.bonus.canteen.core.reportforms.beans.*; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface DrpInventoryIntoDetailMapper { + /** + * 查询库存入库明细列表 + */ + public List queryInventoryIntoDocDetail(DrpInventoryIntoDetailWrapper wrapper); + + InventoryIntoSummaryVO queryInventoryIntoDocDetailSum(DrpInventoryIntoDetailWrapper wrapper); + + + /** + * 获取租户仓库列表(带权限控制) + */ + public List getTenantWarehouse(@Param("areaAuth") Long[] areaAuth); + + /** + * 获取用户有权限的仓库ID列表 + */ + public List getTenantWarehouseIds(@Param("userId") Long userId); + + /** + * 获取用户有权限的区域ID列表 + */ + public List getTenantAreaIds(@Param("userId") Long userId); + + /** + * 获取供应商列表 + */ + List getSupplierList(@Param("content") List areaAuth); + + /** + * 获取货品类别字典 + */ + public List getGoodsCategoryDict(@Param("areaAuth") List areaAuth); + + /** + * 查询库存出库明细列表 + */ + List queryInventoryOutDetail(DrpInventoryIntoDetailWrapper wrapper); + + + InventoryIntoSummaryVO queryInventoryIntoDocDetailoutSum(DrpInventoryIntoDetailWrapper wrapper); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/DrpInventoryhzMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/DrpInventoryhzMapper.java new file mode 100644 index 00000000..d335ebb5 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/DrpInventoryhzMapper.java @@ -0,0 +1,16 @@ +package com.bonus.canteen.core.reportforms.mapper; + +import com.bonus.canteen.core.reportforms.beans.*; + +import java.util.List; + +public interface DrpInventoryhzMapper { + + List pageInventoryIntoDetail(DrpInventoryIntoDetailWrapper wrapper); + + InventoryIntoSummaryVO queryInventoryIntoDocDetailSum(DrpInventoryIntoDetailWrapper wrapper); + + List queryInventoryWarehouseSummaryList(DrpInventoryIntoDetailWrapper wrapper); + + InventoryIntoSummaryVO queryInventoryWarehouseSummarySum(DrpInventoryIntoDetailWrapper wrapper); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/DrpInventoryService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/DrpInventoryService.java new file mode 100644 index 00000000..c7bdefd6 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/DrpInventoryService.java @@ -0,0 +1,19 @@ +package com.bonus.canteen.core.reportforms.service; + +import com.bonus.canteen.core.reportforms.beans.DrpInventoryIntoDetailQueryDTO; +import com.bonus.canteen.core.reportforms.beans.DrpInventoryIntoDetailVO; +import com.bonus.canteen.core.reportforms.beans.InventoryGoodsSummaryVO; + +import java.util.List; +import java.util.Map; + +public interface DrpInventoryService { + /** + * 查询货品汇总明细列表 + */ + Map pageInventoryIntoDetail(DrpInventoryIntoDetailQueryDTO queryDTO); + + List pageInventoryIntoDetailExport(DrpInventoryIntoDetailQueryDTO queryDTO); + + Map pageInventoryWarehouseSummary(DrpInventoryIntoDetailQueryDTO queryDTO); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/IDrpInventoryIntoDetailService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/IDrpInventoryIntoDetailService.java new file mode 100644 index 00000000..2f23cae2 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/IDrpInventoryIntoDetailService.java @@ -0,0 +1,46 @@ +package com.bonus.canteen.core.reportforms.service; + +import com.bonus.canteen.core.reportforms.beans.*; + +import java.util.List; +import java.util.Map; + +public interface IDrpInventoryIntoDetailService { + /** + * 查询库存入库明细列表 + * + * @param queryDTO 查询条件 + * @return 库存入库明细列表 + */ + public Map pageInventoryIntoDetail(DrpInventoryIntoDetailQueryDTO queryDTO); + /** + * 导出库存入库明细列表 + */ + public List pageInventoryIntoDetailesport(DrpInventoryIntoDetailQueryDTO queryDTO); + + /** + * 获取租户仓库列表(带权限控制) + * + * @param areaIdList 区域ID列表 + * @return 仓库列表 + */ + public List getTenantWarehouse(Long[] areaIdList); + + /** + * 获取供应商列表 + * + * @return 供应商列表 + */ + public List getSupplierList(); + + /** + * 获取货品类别字典 + * + * @return 货品类别字典列表 + */ + public List getGoodsCategoryDict(); + + public Map pageInventoryOutDetail(DrpInventoryIntoDetailQueryDTO queryDTO); + + List pageInventoryIntoDetailoutesport(DrpInventoryIntoDetailQueryDTO queryDTO); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/DrpInventoryIntoDetailServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/DrpInventoryIntoDetailServiceImpl.java new file mode 100644 index 00000000..909863bb --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/DrpInventoryIntoDetailServiceImpl.java @@ -0,0 +1,238 @@ +package com.bonus.canteen.core.reportforms.service.impl; + +import com.bonus.canteen.core.reportforms.beans.*; +import com.bonus.canteen.core.reportforms.mapper.DrpInventoryIntoDetailMapper; +import com.bonus.canteen.core.reportforms.service.IDrpInventoryIntoDetailService; +import com.bonus.common.houqin.utils.SM4EncryptUtils; +import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.system.api.domain.SysUser; +import com.github.pagehelper.PageHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; + +@Service +public class DrpInventoryIntoDetailServiceImpl implements IDrpInventoryIntoDetailService +{ + @Autowired + private DrpInventoryIntoDetailMapper drpInventoryIntoDetailMapper; + /** + * 查询库存入库明细列表 + * + * @param queryDTO 查询条件 + * @return 库存入库明细列表 + */ + @Override + public Map pageInventoryIntoDetail(DrpInventoryIntoDetailQueryDTO queryDTO) + { + SysUser currentUser = SecurityUtils.getLoginUser().getSysUser(); + List warehouseAuthority = drpInventoryIntoDetailMapper.getTenantWarehouseIds(currentUser.getUserId()); + List areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId()); + PageHelper.startPage(queryDTO); + DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper(); + wrapper.setParam(queryDTO); + wrapper.setWarehouseAuthority(warehouseAuthority); + wrapper.setAreaAuth(areaAuth); + + // 查询明细数据 + List drpInventoryIntoDetailVOS = drpInventoryIntoDetailMapper.queryInventoryIntoDocDetail(wrapper); + for ( DrpInventoryIntoDetailVO c : drpInventoryIntoDetailVOS) { + try { + // 姓名解密 + if (c.getOperatorName() != null && !c.getOperatorName().isEmpty()) { + c.setOperatorName(SM4EncryptUtils.sm4Decrypt(c.getOperatorName())); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + // 查询合计数据 - 这里应该返回 InventoryIntoSummaryVO + InventoryIntoSummaryVO sumRow = drpInventoryIntoDetailMapper.queryInventoryIntoDocDetailSum(wrapper); + + // 创建一个Map来返回明细和合计数据 + Map result = new HashMap<>(); + result.put("list", drpInventoryIntoDetailVOS); + result.put("summary", sumRow); // 这里直接放入 sumRow 对象 + + return result; + } + + @Override + public List pageInventoryIntoDetailesport(DrpInventoryIntoDetailQueryDTO queryDTO) + { + SysUser currentUser = SecurityUtils.getLoginUser().getSysUser(); + List warehouseAuthority = drpInventoryIntoDetailMapper.getTenantWarehouseIds(currentUser.getUserId()); + List areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId()); + DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper(); + wrapper.setParam(queryDTO); + wrapper.setWarehouseAuthority(warehouseAuthority); + wrapper.setAreaAuth(areaAuth); + List drpInventoryIntoDetailVOS = drpInventoryIntoDetailMapper.queryInventoryIntoDocDetail(wrapper); + for ( DrpInventoryIntoDetailVO c : drpInventoryIntoDetailVOS) { + try { + // 姓名解密 + if (c.getOperatorName() != null && !c.getOperatorName().isEmpty()) { + c.setOperatorName(SM4EncryptUtils.sm4Decrypt(c.getOperatorName())); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return drpInventoryIntoDetailVOS; + } + @Override + public Map pageInventoryOutDetail(DrpInventoryIntoDetailQueryDTO queryDTO) { + SysUser currentUser = SecurityUtils.getLoginUser().getSysUser(); + List warehouseAuthority = drpInventoryIntoDetailMapper.getTenantWarehouseIds(currentUser.getUserId()); + List areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId()); + PageHelper.startPage(queryDTO); + DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper(); + wrapper.setParam(queryDTO); + wrapper.setWarehouseAuthority(warehouseAuthority); + wrapper.setAreaAuth(areaAuth); + List drpInventoryoutDetailVOS = drpInventoryIntoDetailMapper.queryInventoryOutDetail(wrapper); + for ( DrpInventoryoutDetailVO c : drpInventoryoutDetailVOS) { + try { + // 姓名解密 + if (c.getOperatorName() != null && !c.getOperatorName().isEmpty()) { + c.setOperatorName(SM4EncryptUtils.sm4Decrypt(c.getOperatorName())); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + // 查询合计数据 - 这里应该返回 InventoryIntoSummaryVO + InventoryIntoSummaryVO sumRow = drpInventoryIntoDetailMapper.queryInventoryIntoDocDetailoutSum(wrapper); + // 创建一个Map来返回明细和合计数据 + Map result = new HashMap<>(); + result.put("list", drpInventoryoutDetailVOS); + result.put("summary", sumRow); // 这里直接放入 sumRow 对象 + return result; + } + + @Override + public List pageInventoryIntoDetailoutesport(DrpInventoryIntoDetailQueryDTO queryDTO) { + SysUser currentUser = SecurityUtils.getLoginUser().getSysUser(); + List warehouseAuthority = drpInventoryIntoDetailMapper.getTenantWarehouseIds(currentUser.getUserId()); + List areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId()); + DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper(); + wrapper.setParam(queryDTO); + wrapper.setWarehouseAuthority(warehouseAuthority); + wrapper.setAreaAuth(areaAuth); + List drpInventoryIntoDetailVOS = drpInventoryIntoDetailMapper.queryInventoryOutDetail(wrapper); + for ( DrpInventoryoutDetailVO c : drpInventoryIntoDetailVOS) { + try { + // 姓名解密 + if (c.getOperatorName() != null && !c.getOperatorName().isEmpty()) { + c.setOperatorName(SM4EncryptUtils.sm4Decrypt(c.getOperatorName())); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return drpInventoryIntoDetailVOS; + } + + /** + * 获取租户仓库列表(带权限控制) + * + * @param areaIdList 区域ID列表 + * @return 仓库列表 + */ + @Override + public List getTenantWarehouse(Long[] areaIdList) + { + // 获取当前用户信息 + SysUser currentUser = SecurityUtils.getLoginUser().getSysUser(); + // List areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId()); + // 调用Mapper查询 + List tenantWarehouse = drpInventoryIntoDetailMapper.getTenantWarehouse(areaIdList); + return tenantWarehouse; + } + + /** + * 获取供应商列表 + * + * @return 供应商列表 + */ + @Override + public List getSupplierList() + { + SysUser currentUser = SecurityUtils.getLoginUser().getSysUser(); + List areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId()); + return drpInventoryIntoDetailMapper.getSupplierList(areaAuth); + } + + /** + * 获取货品类别字典 + * + * @return 货品类别字典列表 + */ + @Override + public List getGoodsCategoryDict() + { + // 获取当前用户信息 + SysUser currentUser = SecurityUtils.getLoginUser().getSysUser(); + List areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId()); + List list = drpInventoryIntoDetailMapper.getGoodsCategoryDict(areaAuth); + + // 构建树形结构 + return buildGoodsCategoryTree(list); + } + /** + * 构建货品类别树形结构 + */ + private List buildGoodsCategoryTree(List list) { + // 创建根节点(原料和商品) + List tree = new ArrayList<>(); + + // 1. 原料根节点 + DrpDictVO materialRoot = new DrpDictVO(); + materialRoot.setId(25595457052610560L); + materialRoot.setDictLabel("原料"); + materialRoot.setParentId(-1L); + materialRoot.setChildren(new ArrayList<>()); + tree.add(materialRoot); + + // 2. 商品根节点 + DrpDictVO goodsRoot = new DrpDictVO(); + goodsRoot.setId(65595542415085568L); + goodsRoot.setDictLabel("商品"); + goodsRoot.setParentId(-1L); + goodsRoot.setChildren(new ArrayList<>()); + tree.add(goodsRoot); + + // 将数据按 parent_id 分组 + Map> parentMap = list.stream() + .filter(item -> item.getParentId() != null && item.getParentId() != -1L) + .collect(Collectors.groupingBy(DrpDictVO::getParentId)); + + // 递归构建树 + buildCategoryChildren(materialRoot, parentMap); + buildCategoryChildren(goodsRoot, parentMap); + + return tree; + } + /** + * 递归构建子节点 + */ + private void buildCategoryChildren(DrpDictVO parent, Map> parentMap) { + List children = parentMap.get(parent.getId()); + if (children != null && !children.isEmpty()) { + // 确保 children 列表已初始化 + if (parent.getChildren() == null) { + parent.setChildren(new ArrayList<>()); + } + + for (DrpDictVO child : children) { + // 递归构建孙子节点 + buildCategoryChildren(child, parentMap); + parent.getChildren().add(child); + } + } + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/DrpInventoryServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/DrpInventoryServiceImpl.java new file mode 100644 index 00000000..0c7c859c --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/DrpInventoryServiceImpl.java @@ -0,0 +1,79 @@ +package com.bonus.canteen.core.reportforms.service.impl; + +import com.bonus.canteen.core.reportforms.beans.*; +import com.bonus.canteen.core.reportforms.mapper.DrpInventoryIntoDetailMapper; +import com.bonus.canteen.core.reportforms.mapper.DrpInventoryhzMapper; +import com.bonus.canteen.core.reportforms.service.DrpInventoryService; +import com.bonus.common.houqin.utils.SM4EncryptUtils; +import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.system.api.domain.SysUser; +import com.github.pagehelper.PageHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class DrpInventoryServiceImpl implements DrpInventoryService { + + @Autowired + private DrpInventoryhzMapper drpInventoryMapper; + + @Autowired + private DrpInventoryIntoDetailMapper drpInventoryIntoDetailMapper; + + @Override + public Map pageInventoryIntoDetail(DrpInventoryIntoDetailQueryDTO queryDTO) { + SysUser currentUser = SecurityUtils.getLoginUser().getSysUser(); + List areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId()); + PageHelper.startPage(queryDTO); + DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper(); + wrapper.setParam(queryDTO); + wrapper.setAreaAuth(areaAuth); + // 查询明细数据 + List drpInventoryIntoDetailVOS = drpInventoryMapper.pageInventoryIntoDetail(wrapper); + + // 查询合计数据 - 这里应该返回 InventoryIntoSummaryVO + InventoryIntoSummaryVO sumRow = drpInventoryMapper.queryInventoryIntoDocDetailSum(wrapper); + + // 创建一个Map来返回明细和合计数据 + Map result = new HashMap<>(); + result.put("list", drpInventoryIntoDetailVOS); + result.put("summary", sumRow); // 这里直接放入 sumRow 对象 + + return result; + } + + @Override + public List pageInventoryIntoDetailExport(DrpInventoryIntoDetailQueryDTO queryDTO) { + SysUser currentUser = SecurityUtils.getLoginUser().getSysUser(); + List areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId()); + DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper(); + wrapper.setParam(queryDTO); + wrapper.setAreaAuth(areaAuth); + // 查询明细数据 + List drpInventoryIntoDetailVOS = drpInventoryMapper.pageInventoryIntoDetail(wrapper); + return drpInventoryIntoDetailVOS; + } + + @Override + public Map pageInventoryWarehouseSummary(DrpInventoryIntoDetailQueryDTO queryDTO) { + SysUser currentUser = SecurityUtils.getLoginUser().getSysUser(); + List areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId()); + PageHelper.startPage(queryDTO); + DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper(); + wrapper.setParam(queryDTO); + wrapper.setAreaAuth(areaAuth); + List list = this.drpInventoryMapper.queryInventoryWarehouseSummaryList(wrapper); + // 查询合计数据 - 这里应该返回 InventoryIntoSummaryVO + InventoryIntoSummaryVO sumRow = drpInventoryMapper.queryInventoryWarehouseSummarySum(wrapper); + // 创建一个Map来返回明细和合计数据 + Map result = new HashMap<>(); + result.put("list", list); + result.put("summary", sumRow); // 这里直接放入 sumRow 对象 + return result; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/DrpInventorMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/DrpInventorMapper.xml new file mode 100644 index 00000000..3d056419 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/DrpInventorMapper.xml @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/DrpInventoryIntoDetailMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/DrpInventoryIntoDetailMapper.xml new file mode 100644 index 00000000..fc8c77a0 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/DrpInventoryIntoDetailMapper.xml @@ -0,0 +1,519 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +