领导人员功能开发
This commit is contained in:
parent
420fc1907c
commit
6fd11a195e
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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<DrpDictVO> children;
|
||||
}
|
||||
|
|
@ -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<String> intoTypeList;
|
||||
private String goodsCategory;
|
||||
private List<Long> warehouseIdList;
|
||||
private String goodsName;
|
||||
private List<Long> supplierIdList;
|
||||
private List<Long> areaIdList;
|
||||
private String startDate;
|
||||
private String endDate;
|
||||
private String materialName;
|
||||
private List<Long> categoryIdList;
|
||||
public int pageNum;
|
||||
public int pageSize;
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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<Long> warehouseAuthority;
|
||||
private List<Long> areaAuth;
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
@ -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; // 外部金额
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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<String, Object> result = drpInventoryService.pageInventoryIntoDetail(queryDTO);
|
||||
List<DrpInventoryIntoDetailVO> list = (List<DrpInventoryIntoDetailVO>) 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<InventoryGoodsSummaryVO> 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<InventoryGoodsSummaryVO> util = new ExcelUtil<InventoryGoodsSummaryVO>(InventoryGoodsSummaryVO.class);
|
||||
util.exportExcel(response, list, "货品汇总明细数据");
|
||||
}
|
||||
/**
|
||||
* 查询仓库汇总明细列表
|
||||
*/
|
||||
@GetMapping("/warehouse/summary/page")
|
||||
public AjaxResult warehouselist(DrpInventoryIntoDetailQueryDTO queryDTO)
|
||||
{
|
||||
// 调用Service方法 - 返回 Map
|
||||
Map<String, Object> result = drpInventoryService.pageInventoryWarehouseSummary(queryDTO);
|
||||
List<DrpInventoryIntoDetailVO> list = (List<DrpInventoryIntoDetailVO>) 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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<String, Object> result = drpInventoryIntoDetailService.pageInventoryIntoDetail(queryDTO);
|
||||
List<DrpInventoryIntoDetailVO> list = (List<DrpInventoryIntoDetailVO>) 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<String, Object> result = drpInventoryIntoDetailService.pageInventoryOutDetail(queryDTO);
|
||||
List<DrpInventoryIntoDetailVO> list = (List<DrpInventoryIntoDetailVO>) 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<DrpInventoryIntoDetailVO> list = drpInventoryIntoDetailService.pageInventoryIntoDetailesport(queryDTO);
|
||||
for (DrpInventoryIntoDetailVO vo : list) {
|
||||
vo.setIntoType(convertIntoType(vo.getIntoType()));
|
||||
}
|
||||
ExcelUtil<DrpInventoryIntoDetailVO> util = new ExcelUtil<DrpInventoryIntoDetailVO>(DrpInventoryIntoDetailVO.class);
|
||||
util.exportExcel(response, list, "库存入库明细数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存出库明细列表
|
||||
*/
|
||||
@PostMapping("/detail/outexport")
|
||||
public void outexport(HttpServletResponse response, DrpInventoryIntoDetailQueryDTO queryDTO)
|
||||
{
|
||||
List<DrpInventoryoutDetailVO> list = drpInventoryIntoDetailService.pageInventoryIntoDetailoutesport(queryDTO);
|
||||
for (DrpInventoryoutDetailVO vo : list) {
|
||||
vo.setIntoType(convertIntoOutType(vo.getIntoType()));
|
||||
}
|
||||
ExcelUtil<DrpInventoryoutDetailVO> util = new ExcelUtil<DrpInventoryoutDetailVO>(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<DrpWarehouseAllVO> list = drpInventoryIntoDetailService.getTenantWarehouse(areaIdList);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取供应商列表
|
||||
*/
|
||||
@GetMapping("/supplier/list")
|
||||
public AjaxResult getSupplierList()
|
||||
{
|
||||
List<DrpSupplierVO> list = drpInventoryIntoDetailService.getSupplierList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取货品类别字典
|
||||
*/
|
||||
@GetMapping("/goodsCategory/dict")
|
||||
public AjaxResult getGoodsCategoryDict()
|
||||
{
|
||||
List<DrpDictVO> list = drpInventoryIntoDetailService.getGoodsCategoryDict();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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<DrpInventoryIntoDetailVO> queryInventoryIntoDocDetail(DrpInventoryIntoDetailWrapper wrapper);
|
||||
|
||||
InventoryIntoSummaryVO queryInventoryIntoDocDetailSum(DrpInventoryIntoDetailWrapper wrapper);
|
||||
|
||||
|
||||
/**
|
||||
* 获取租户仓库列表(带权限控制)
|
||||
*/
|
||||
public List<DrpWarehouseAllVO> getTenantWarehouse(@Param("areaAuth") Long[] areaAuth);
|
||||
|
||||
/**
|
||||
* 获取用户有权限的仓库ID列表
|
||||
*/
|
||||
public List<Long> getTenantWarehouseIds(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 获取用户有权限的区域ID列表
|
||||
*/
|
||||
public List<Long> getTenantAreaIds(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 获取供应商列表
|
||||
*/
|
||||
List<DrpSupplierVO> getSupplierList(@Param("content") List<Long> areaAuth);
|
||||
|
||||
/**
|
||||
* 获取货品类别字典
|
||||
*/
|
||||
public List<DrpDictVO> getGoodsCategoryDict(@Param("areaAuth") List<Long> areaAuth);
|
||||
|
||||
/**
|
||||
* 查询库存出库明细列表
|
||||
*/
|
||||
List<DrpInventoryoutDetailVO> queryInventoryOutDetail(DrpInventoryIntoDetailWrapper wrapper);
|
||||
|
||||
|
||||
InventoryIntoSummaryVO queryInventoryIntoDocDetailoutSum(DrpInventoryIntoDetailWrapper wrapper);
|
||||
}
|
||||
|
|
@ -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<InventoryGoodsSummaryVO> pageInventoryIntoDetail(DrpInventoryIntoDetailWrapper wrapper);
|
||||
|
||||
InventoryIntoSummaryVO queryInventoryIntoDocDetailSum(DrpInventoryIntoDetailWrapper wrapper);
|
||||
|
||||
List<ReportDrpInventoryWarehouseSummaryVO> queryInventoryWarehouseSummaryList(DrpInventoryIntoDetailWrapper wrapper);
|
||||
|
||||
InventoryIntoSummaryVO queryInventoryWarehouseSummarySum(DrpInventoryIntoDetailWrapper wrapper);
|
||||
}
|
||||
|
|
@ -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<String, Object> pageInventoryIntoDetail(DrpInventoryIntoDetailQueryDTO queryDTO);
|
||||
|
||||
List<InventoryGoodsSummaryVO> pageInventoryIntoDetailExport(DrpInventoryIntoDetailQueryDTO queryDTO);
|
||||
|
||||
Map<String, Object> pageInventoryWarehouseSummary(DrpInventoryIntoDetailQueryDTO queryDTO);
|
||||
}
|
||||
|
|
@ -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<String, Object> pageInventoryIntoDetail(DrpInventoryIntoDetailQueryDTO queryDTO);
|
||||
/**
|
||||
* 导出库存入库明细列表
|
||||
*/
|
||||
public List<DrpInventoryIntoDetailVO> pageInventoryIntoDetailesport(DrpInventoryIntoDetailQueryDTO queryDTO);
|
||||
|
||||
/**
|
||||
* 获取租户仓库列表(带权限控制)
|
||||
*
|
||||
* @param areaIdList 区域ID列表
|
||||
* @return 仓库列表
|
||||
*/
|
||||
public List<DrpWarehouseAllVO> getTenantWarehouse(Long[] areaIdList);
|
||||
|
||||
/**
|
||||
* 获取供应商列表
|
||||
*
|
||||
* @return 供应商列表
|
||||
*/
|
||||
public List<DrpSupplierVO> getSupplierList();
|
||||
|
||||
/**
|
||||
* 获取货品类别字典
|
||||
*
|
||||
* @return 货品类别字典列表
|
||||
*/
|
||||
public List<DrpDictVO> getGoodsCategoryDict();
|
||||
|
||||
public Map<String, Object> pageInventoryOutDetail(DrpInventoryIntoDetailQueryDTO queryDTO);
|
||||
|
||||
List<DrpInventoryoutDetailVO> pageInventoryIntoDetailoutesport(DrpInventoryIntoDetailQueryDTO queryDTO);
|
||||
}
|
||||
|
|
@ -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<String, Object> pageInventoryIntoDetail(DrpInventoryIntoDetailQueryDTO queryDTO)
|
||||
{
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
List<Long> warehouseAuthority = drpInventoryIntoDetailMapper.getTenantWarehouseIds(currentUser.getUserId());
|
||||
List<Long> areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId());
|
||||
PageHelper.startPage(queryDTO);
|
||||
DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper();
|
||||
wrapper.setParam(queryDTO);
|
||||
wrapper.setWarehouseAuthority(warehouseAuthority);
|
||||
wrapper.setAreaAuth(areaAuth);
|
||||
|
||||
// 查询明细数据
|
||||
List<DrpInventoryIntoDetailVO> 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<String, Object> result = new HashMap<>();
|
||||
result.put("list", drpInventoryIntoDetailVOS);
|
||||
result.put("summary", sumRow); // 这里直接放入 sumRow 对象
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DrpInventoryIntoDetailVO> pageInventoryIntoDetailesport(DrpInventoryIntoDetailQueryDTO queryDTO)
|
||||
{
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
List<Long> warehouseAuthority = drpInventoryIntoDetailMapper.getTenantWarehouseIds(currentUser.getUserId());
|
||||
List<Long> areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId());
|
||||
DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper();
|
||||
wrapper.setParam(queryDTO);
|
||||
wrapper.setWarehouseAuthority(warehouseAuthority);
|
||||
wrapper.setAreaAuth(areaAuth);
|
||||
List<DrpInventoryIntoDetailVO> 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<String, Object> pageInventoryOutDetail(DrpInventoryIntoDetailQueryDTO queryDTO) {
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
List<Long> warehouseAuthority = drpInventoryIntoDetailMapper.getTenantWarehouseIds(currentUser.getUserId());
|
||||
List<Long> areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId());
|
||||
PageHelper.startPage(queryDTO);
|
||||
DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper();
|
||||
wrapper.setParam(queryDTO);
|
||||
wrapper.setWarehouseAuthority(warehouseAuthority);
|
||||
wrapper.setAreaAuth(areaAuth);
|
||||
List<DrpInventoryoutDetailVO> 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<String, Object> result = new HashMap<>();
|
||||
result.put("list", drpInventoryoutDetailVOS);
|
||||
result.put("summary", sumRow); // 这里直接放入 sumRow 对象
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DrpInventoryoutDetailVO> pageInventoryIntoDetailoutesport(DrpInventoryIntoDetailQueryDTO queryDTO) {
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
List<Long> warehouseAuthority = drpInventoryIntoDetailMapper.getTenantWarehouseIds(currentUser.getUserId());
|
||||
List<Long> areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId());
|
||||
DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper();
|
||||
wrapper.setParam(queryDTO);
|
||||
wrapper.setWarehouseAuthority(warehouseAuthority);
|
||||
wrapper.setAreaAuth(areaAuth);
|
||||
List<DrpInventoryoutDetailVO> 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<DrpWarehouseAllVO> getTenantWarehouse(Long[] areaIdList)
|
||||
{
|
||||
// 获取当前用户信息
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
// List<Long> areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId());
|
||||
// 调用Mapper查询
|
||||
List<DrpWarehouseAllVO> tenantWarehouse = drpInventoryIntoDetailMapper.getTenantWarehouse(areaIdList);
|
||||
return tenantWarehouse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取供应商列表
|
||||
*
|
||||
* @return 供应商列表
|
||||
*/
|
||||
@Override
|
||||
public List<DrpSupplierVO> getSupplierList()
|
||||
{
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
List<Long> areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId());
|
||||
return drpInventoryIntoDetailMapper.getSupplierList(areaAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取货品类别字典
|
||||
*
|
||||
* @return 货品类别字典列表
|
||||
*/
|
||||
@Override
|
||||
public List<DrpDictVO> getGoodsCategoryDict()
|
||||
{
|
||||
// 获取当前用户信息
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
List<Long> areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId());
|
||||
List<DrpDictVO> list = drpInventoryIntoDetailMapper.getGoodsCategoryDict(areaAuth);
|
||||
|
||||
// 构建树形结构
|
||||
return buildGoodsCategoryTree(list);
|
||||
}
|
||||
/**
|
||||
* 构建货品类别树形结构
|
||||
*/
|
||||
private List<DrpDictVO> buildGoodsCategoryTree(List<DrpDictVO> list) {
|
||||
// 创建根节点(原料和商品)
|
||||
List<DrpDictVO> 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<Long, List<DrpDictVO>> 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<Long, List<DrpDictVO>> parentMap) {
|
||||
List<DrpDictVO> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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<String, Object> pageInventoryIntoDetail(DrpInventoryIntoDetailQueryDTO queryDTO) {
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
List<Long> areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId());
|
||||
PageHelper.startPage(queryDTO);
|
||||
DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper();
|
||||
wrapper.setParam(queryDTO);
|
||||
wrapper.setAreaAuth(areaAuth);
|
||||
// 查询明细数据
|
||||
List<InventoryGoodsSummaryVO> drpInventoryIntoDetailVOS = drpInventoryMapper.pageInventoryIntoDetail(wrapper);
|
||||
|
||||
// 查询合计数据 - 这里应该返回 InventoryIntoSummaryVO
|
||||
InventoryIntoSummaryVO sumRow = drpInventoryMapper.queryInventoryIntoDocDetailSum(wrapper);
|
||||
|
||||
// 创建一个Map来返回明细和合计数据
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("list", drpInventoryIntoDetailVOS);
|
||||
result.put("summary", sumRow); // 这里直接放入 sumRow 对象
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InventoryGoodsSummaryVO> pageInventoryIntoDetailExport(DrpInventoryIntoDetailQueryDTO queryDTO) {
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
List<Long> areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId());
|
||||
DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper();
|
||||
wrapper.setParam(queryDTO);
|
||||
wrapper.setAreaAuth(areaAuth);
|
||||
// 查询明细数据
|
||||
List<InventoryGoodsSummaryVO> drpInventoryIntoDetailVOS = drpInventoryMapper.pageInventoryIntoDetail(wrapper);
|
||||
return drpInventoryIntoDetailVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageInventoryWarehouseSummary(DrpInventoryIntoDetailQueryDTO queryDTO) {
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
List<Long> areaAuth = drpInventoryIntoDetailMapper.getTenantAreaIds(currentUser.getUserId());
|
||||
PageHelper.startPage(queryDTO);
|
||||
DrpInventoryIntoDetailWrapper wrapper = new DrpInventoryIntoDetailWrapper();
|
||||
wrapper.setParam(queryDTO);
|
||||
wrapper.setAreaAuth(areaAuth);
|
||||
List<ReportDrpInventoryWarehouseSummaryVO> list = this.drpInventoryMapper.queryInventoryWarehouseSummaryList(wrapper);
|
||||
// 查询合计数据 - 这里应该返回 InventoryIntoSummaryVO
|
||||
InventoryIntoSummaryVO sumRow = drpInventoryMapper.queryInventoryWarehouseSummarySum(wrapper);
|
||||
// 创建一个Map来返回明细和合计数据
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("list", list);
|
||||
result.put("summary", sumRow); // 这里直接放入 sumRow 对象
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,294 @@
|
|||
<?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="com.bonus.canteen.core.reportforms.mapper.DrpInventoryhzMapper">
|
||||
<!-- 结果映射:库存入库明细VO -->
|
||||
<resultMap type="com.bonus.canteen.core.reportforms.beans.DrpInventoryIntoDetailVO" id="DrpInventoryIntoDetailVOResult">
|
||||
<result property="recordId" column="record_id" />
|
||||
<result property="areaName" column="area_name" />
|
||||
<result property="warehouseId" column="warehouse_id" />
|
||||
<result property="warehouseName" column="warehouse_name" />
|
||||
<result property="intoType" column="intoType" />
|
||||
<result property="intoDate" column="intoDate" />
|
||||
<result property="intoNum" column="intoNum" />
|
||||
<result property="intoAmount" column="intoAmount" />
|
||||
<result property="operatorId" column="operator_id" />
|
||||
<result property="operatorName" column="operatorName" />
|
||||
<result property="goodsCode" column="goods_code" />
|
||||
<result property="goodsCategory" column="goods_category" />
|
||||
<result property="goodsCategoryName" column="goods_category_name" />
|
||||
<result property="goodsName" column="goods_name" />
|
||||
<result property="unitName" column="unit_name" />
|
||||
<result property="specification" column="specification" />
|
||||
<result property="price" column="price" />
|
||||
<result property="supplierId" column="supplier_id" />
|
||||
<result property="supplierName" column="supplier_name" />
|
||||
<result property="balanceNum" column="balance_num" />
|
||||
<result property="balanceAmount" column="balance_amount" />
|
||||
<result property="productionDate" column="production_date" />
|
||||
<result property="expiryDate" column="expiry_date" />
|
||||
</resultMap>
|
||||
<select id="pageInventoryIntoDetail"
|
||||
resultType="com.bonus.canteen.core.reportforms.beans.InventoryGoodsSummaryVO">
|
||||
SELECT
|
||||
t.warehouse_name,
|
||||
t.area_name,
|
||||
t.material_id,
|
||||
t.material_name,
|
||||
t.material_code,
|
||||
t.category_id,
|
||||
t.category_name,
|
||||
t.unit_id,
|
||||
t.unit_name,
|
||||
t.size,
|
||||
SUM(t.into_num) intoTotalNum,
|
||||
SUM(t.into_amount) intoTotalAmount,
|
||||
SUM(t.out_num) outTotalNum,
|
||||
SUM(t.out_amount) outTotalAmount
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
aa.area_name,
|
||||
dw.warehouse_name,
|
||||
ds.material_id,
|
||||
mm.material_name,
|
||||
mm.material_code,
|
||||
mmc.category_id,
|
||||
mmc.category_name,
|
||||
ds.unit_id,
|
||||
du.unit_name,
|
||||
mm.size,
|
||||
dw.warehouse_id,
|
||||
SUM(ds.into_num) into_num,
|
||||
SUM(ds.into_amount) into_amount,
|
||||
SUM(ds.out_num) out_num,
|
||||
SUM(ds.out_amount) out_amount
|
||||
FROM
|
||||
report_drp_inventory_summary ds
|
||||
LEFT JOIN menu_material mm ON ds.material_id = mm.material_id
|
||||
LEFT JOIN drp_unit du ON ds.unit_id = du.unit_id
|
||||
LEFT JOIN menu_material_category mmc ON mmc.category_id = mm.category_id
|
||||
LEFT JOIN drp_warehouse dw ON dw.warehouse_id = ds.warehouse_id
|
||||
left join alloc_area aa on aa.area_id = dw.area_id
|
||||
<where>
|
||||
<if test="param.startDate != null">
|
||||
and ds.statistic_date <![CDATA[ >= ]]> #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null">
|
||||
and ds.statistic_date <![CDATA[ <= ]]> #{param.endDate}
|
||||
</if>
|
||||
<if test="param.materialName != null and param.materialName != ''">
|
||||
and (mm.material_name like concat('%', #{param.materialName}, '%')
|
||||
or mm.material_code like concat('%', #{param.materialName}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="param.categoryIdList != null and param.categoryIdList.size() > 0">
|
||||
AND mmc.category_id in
|
||||
<foreach collection="param.categoryIdList" item="categoryId" separator="," open="("
|
||||
close=")">
|
||||
#{categoryId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.areaIdList != null and param.areaIdList.size() > 0">
|
||||
AND dw.area_id in
|
||||
<foreach collection="param.areaIdList" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.warehouseIdList != null and param.warehouseIdList.size() > 0">
|
||||
AND dw.warehouse_id in
|
||||
<foreach collection="param.warehouseIdList" item="warehouseId" separator="," open="("
|
||||
close=")">
|
||||
#{warehouseId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="warehouseAuthority != null and warehouseAuthority.size() > 0">
|
||||
and dw.warehouse_id in
|
||||
<foreach collection="warehouseAuthority" item="warehouseId" separator="," open="(" close=")">
|
||||
#{warehouseId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="areaAuth != null and areaAuth.size() > 0">
|
||||
and dw.area_id in
|
||||
<foreach collection="areaAuth" item="areaId" separator="," open="(" close=")">
|
||||
#{areaId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by ds.material_id,
|
||||
mm.material_name,
|
||||
mm.material_code,
|
||||
mmc.category_id,
|
||||
mmc.category_name,
|
||||
ds.unit_id,
|
||||
du.unit_name,
|
||||
mm.size,
|
||||
dw.warehouse_id,
|
||||
dw.warehouse_name
|
||||
) t
|
||||
group by t.material_id,
|
||||
t.material_name,
|
||||
t.material_code,
|
||||
t.category_id,
|
||||
t.category_name,
|
||||
t.unit_id,
|
||||
t.unit_name,
|
||||
t.size
|
||||
|
||||
|
||||
</select>
|
||||
<select id="queryInventoryIntoDocDetailSum"
|
||||
resultType="com.bonus.canteen.core.reportforms.beans.InventoryIntoSummaryVO">
|
||||
SELECT
|
||||
SUM(ds.into_num) as intoTotalNum,
|
||||
SUM(ds.into_amount) as intoTotalAmount,
|
||||
SUM(ds.out_num) as outTotalNum,
|
||||
SUM(ds.out_amount) as outTotalAmount
|
||||
FROM
|
||||
report_drp_inventory_summary ds
|
||||
LEFT JOIN menu_material mm ON ds.material_id = mm.material_id
|
||||
LEFT JOIN drp_unit du ON ds.unit_id = du.unit_id
|
||||
LEFT JOIN menu_material_category mmc ON mmc.category_id = mm.category_id
|
||||
LEFT JOIN drp_warehouse dw ON dw.warehouse_id = ds.warehouse_id
|
||||
LEFT JOIN alloc_area aa ON aa.area_id = dw.area_id
|
||||
<where>
|
||||
<if test="param.startDate != null">
|
||||
and ds.statistic_date <![CDATA[ >= ]]> #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null">
|
||||
and ds.statistic_date <![CDATA[ <= ]]> #{param.endDate}
|
||||
</if>
|
||||
<if test="param.materialName != null and param.materialName != ''">
|
||||
and (mm.material_name like concat('%', #{param.materialName}, '%')
|
||||
or mm.material_code like concat('%', #{param.materialName}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="param.categoryIdList != null and param.categoryIdList.size() > 0">
|
||||
AND mmc.category_id in
|
||||
<foreach collection="param.categoryIdList" item="categoryId" separator="," open="("
|
||||
close=")">
|
||||
#{categoryId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.areaIdList != null and param.areaIdList.size() > 0">
|
||||
AND dw.area_id in
|
||||
<foreach collection="param.areaIdList" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.warehouseIdList != null and param.warehouseIdList.size() > 0">
|
||||
AND dw.warehouse_id in
|
||||
<foreach collection="param.warehouseIdList" item="warehouseId" separator="," open="("
|
||||
close=")">
|
||||
#{warehouseId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="warehouseAuthority != null and warehouseAuthority.size() > 0">
|
||||
and dw.warehouse_id in
|
||||
<foreach collection="warehouseAuthority" item="warehouseId" separator="," open="(" close=")">
|
||||
#{warehouseId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="areaAuth != null and areaAuth.size() > 0">
|
||||
and dw.area_id in
|
||||
<foreach collection="areaAuth" item="areaId" separator="," open="(" close=")">
|
||||
#{areaId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryInventoryWarehouseSummaryList"
|
||||
resultType="com.bonus.canteen.core.reportforms.beans.ReportDrpInventoryWarehouseSummaryVO">
|
||||
select
|
||||
aa.area_name,
|
||||
dw.warehouse_id,
|
||||
dw.warehouse_name,
|
||||
sum(ds.into_num) intoTotalNum,
|
||||
sum(ds.into_amount) intoTotalAmount,
|
||||
sum(ds.out_num) outTotalNum,
|
||||
sum(ds.out_amount) outTotalAmount
|
||||
from report_drp_inventory_summary ds
|
||||
left join drp_warehouse dw on dw.warehouse_id = ds.warehouse_id
|
||||
left join alloc_area aa on aa.area_id = dw.area_id
|
||||
<where>
|
||||
<if test="param.startDate != null">
|
||||
and ds.statistic_date <![CDATA[ >= ]]> #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null">
|
||||
and ds.statistic_date <![CDATA[ <= ]]> #{param.endDate}
|
||||
</if>
|
||||
<if test="param.areaIdList != null and param.areaIdList.size() > 0">
|
||||
AND dw.area_id in
|
||||
<foreach collection="param.areaIdList" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.warehouseIdList != null and param.warehouseIdList.size() > 0">
|
||||
AND dw.warehouse_id in
|
||||
<foreach collection="param.warehouseIdList" item="warehouseId" separator="," open="("
|
||||
close=")">
|
||||
#{warehouseId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="warehouseAuthority != null and warehouseAuthority.size() > 0">
|
||||
and dw.warehouse_id in
|
||||
<foreach collection="warehouseAuthority" item="warehouseId" separator="," open="(" close=")">
|
||||
#{warehouseId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="areaAuth != null and areaAuth.size() > 0">
|
||||
and dw.area_id in
|
||||
<foreach collection="areaAuth" item="areaId" separator="," open="(" close=")">
|
||||
#{areaId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by aa.area_name, dw.warehouse_id,
|
||||
dw.warehouse_name
|
||||
</select>
|
||||
<select id="queryInventoryWarehouseSummarySum"
|
||||
resultType="com.bonus.canteen.core.reportforms.beans.InventoryIntoSummaryVO">
|
||||
SELECT
|
||||
SUM(ds.into_num) AS intoTotalNum,
|
||||
SUM(ds.into_amount) AS intoTotalAmount,
|
||||
SUM(ds.out_num) AS outTotalNum,
|
||||
SUM(ds.out_amount) AS outTotalAmount
|
||||
FROM report_drp_inventory_summary ds
|
||||
LEFT JOIN drp_warehouse dw ON dw.warehouse_id = ds.warehouse_id
|
||||
LEFT JOIN alloc_area aa ON aa.area_id = dw.area_id
|
||||
<where>
|
||||
<if test="param.startDate != null">
|
||||
AND ds.statistic_date <![CDATA[ >= ]]> #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null">
|
||||
AND ds.statistic_date <![CDATA[ <= ]]> #{param.endDate}
|
||||
</if>
|
||||
<if test="param.areaIdList != null and param.areaIdList.size() > 0">
|
||||
AND dw.area_id IN
|
||||
<foreach collection="param.areaIdList" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.warehouseIdList != null and param.warehouseIdList.size() > 0">
|
||||
AND dw.warehouse_id IN
|
||||
<foreach collection="param.warehouseIdList" item="warehouseId" separator="," open="(" close=")">
|
||||
#{warehouseId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="warehouseAuthority != null and warehouseAuthority.size() > 0">
|
||||
AND dw.warehouse_id IN
|
||||
<foreach collection="warehouseAuthority" item="warehouseId" separator="," open="(" close=")">
|
||||
#{warehouseId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="areaAuth != null and areaAuth.size() > 0">
|
||||
AND dw.area_id IN
|
||||
<foreach collection="areaAuth" item="areaId" separator="," open="(" close=")">
|
||||
#{areaId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
@ -0,0 +1,519 @@
|
|||
<?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="com.bonus.canteen.core.reportforms.mapper.DrpInventoryIntoDetailMapper">
|
||||
<!-- 结果映射:库存入库明细VO -->
|
||||
<resultMap type="com.bonus.canteen.core.reportforms.beans.DrpInventoryIntoDetailVO" id="DrpInventoryIntoDetailVOResult">
|
||||
<result property="recordId" column="record_id" />
|
||||
<result property="areaName" column="area_name" />
|
||||
<result property="warehouseId" column="warehouse_id" />
|
||||
<result property="warehouseName" column="warehouse_name" />
|
||||
<result property="intoType" column="intoType" />
|
||||
<result property="intoDate" column="intoDate" />
|
||||
<result property="intoNum" column="intoNum" />
|
||||
<result property="intoAmount" column="intoAmount" />
|
||||
<result property="operatorId" column="operator_id" />
|
||||
<result property="operatorName" column="operatorName" />
|
||||
<result property="goodsCode" column="goods_code" />
|
||||
<result property="goodsCategory" column="goods_category" />
|
||||
<result property="goodsCategoryName" column="goods_category_name" />
|
||||
<result property="goodsName" column="goods_name" />
|
||||
<result property="unitName" column="unit_name" />
|
||||
<result property="specification" column="specification" />
|
||||
<result property="price" column="price" />
|
||||
<result property="supplierId" column="supplier_id" />
|
||||
<result property="supplierName" column="supplier_name" />
|
||||
<result property="balanceNum" column="balance_num" />
|
||||
<result property="balanceAmount" column="balance_amount" />
|
||||
<result property="productionDate" column="production_date" />
|
||||
<result property="expiryDate" column="expiry_date" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 结果映射:仓库VO -->
|
||||
<resultMap type="com.bonus.canteen.core.reportforms.beans.DrpWarehouseAllVO" id="DrpWarehouseAllVOResult">
|
||||
<result property="warehouseId" column="warehouse_id" />
|
||||
<result property="areaId" column="area_id" />
|
||||
<result property="warehouseName" column="warehouse_name" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 查询库存入库明细列表 -->
|
||||
<select id="queryInventoryIntoDocDetail" resultMap="DrpInventoryIntoDetailVOResult"
|
||||
parameterType="com.bonus.canteen.core.reportforms.beans.DrpInventoryIntoDetailWrapper" >
|
||||
select de.material_id,
|
||||
mm.material_name as goods_name,
|
||||
mm.material_code as goods_code,
|
||||
mmc.category_id,
|
||||
mmc.category_name as goods_category_name,
|
||||
de.unit_id,
|
||||
du.unit_name,
|
||||
de.unit_price as price,
|
||||
aa.area_name,
|
||||
dw.warehouse_id,
|
||||
dw.warehouse_name,
|
||||
de.out_into_type intoType,
|
||||
de.supplier_id,
|
||||
ds.supplier_name,
|
||||
de.record_time intoDate,
|
||||
de.out_into_num intoNum,
|
||||
de.inventory_num balance_num,
|
||||
de.out_into_amount intoAmount,
|
||||
de.total_amount balance_amount,
|
||||
de.operator_id,
|
||||
IF
|
||||
(mu.real_name IS NULL OR mu.real_name = '', mu.username, mu.real_name) operatorName,
|
||||
de.product_date as production_date,
|
||||
de.expire_time as expiry_date,
|
||||
de.record_id,
|
||||
mm.size as specification
|
||||
from report_drp_inventory_base de
|
||||
LEFT JOIN menu_material mm ON de.material_id = mm.material_id
|
||||
LEFT JOIN drp_unit du ON de.unit_id = du.unit_id
|
||||
LEFT JOIN menu_material_category mmc ON mmc.category_id = mm.category_id
|
||||
left join drp_warehouse dw on dw.warehouse_id = de.warehouse_id
|
||||
left join alloc_area aa on aa.area_id = dw.area_id
|
||||
LEFT JOIN drp_supplier ds ON de.supplier_id = ds.supplier_id
|
||||
LEFT JOIN mgr_user mu ON de.operator_id = mu.username
|
||||
where de.record_type=1 and de.out_into_type in (1, 5)
|
||||
<if test="param.startDate != null">
|
||||
and de.record_date >= #{param.startDate}
|
||||
</if>
|
||||
|
||||
<if test="param.endDate != null">
|
||||
and de.record_date <= #{param.endDate}
|
||||
</if>
|
||||
|
||||
<if test="param.supplierIdList != null and param.supplierIdList.size() > 0">
|
||||
and de.supplier_id in
|
||||
<foreach collection="param.supplierIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.materialName != null and param.materialName != ''">
|
||||
and (mm.material_name like concat('%', #{param.materialName}, '%')
|
||||
or mm.material_code like concat('%', #{param.materialName}, '%'))
|
||||
</if>
|
||||
|
||||
<if test="param.categoryIdList != null and param.categoryIdList.size() > 0">
|
||||
and mmc.category_id in
|
||||
<foreach collection="param.categoryIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.intoTypeList != null and param.intoTypeList.size() > 0">
|
||||
and de.out_into_type in
|
||||
<foreach collection="param.intoTypeList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.recordId != null and param.recordId != ''">
|
||||
and de.record_id like concat('%', #{param.recordId}, '%')
|
||||
</if>
|
||||
|
||||
<if test="param.areaIdList != null and param.areaIdList.size() > 0">
|
||||
and dw.area_id in
|
||||
<foreach collection="param.areaIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.warehouseIdList != null and param.warehouseIdList.size() > 0">
|
||||
and dw.warehouse_id in
|
||||
<foreach collection="param.warehouseIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="warehouseAuthority != null and warehouseAuthority.size() > 0">
|
||||
and dw.warehouse_id in
|
||||
<foreach collection="warehouseAuthority" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="areaAuth != null and areaAuth.size() > 0">
|
||||
and dw.area_id in
|
||||
<foreach collection="areaAuth" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
<!-- 查询库存入库明细合计 -->
|
||||
<select id="queryInventoryIntoDocDetailSum" resultType="com.bonus.canteen.core.reportforms.beans.InventoryIntoSummaryVO"
|
||||
parameterType="com.bonus.canteen.core.reportforms.beans.DrpInventoryIntoDetailWrapper">
|
||||
|
||||
SELECT
|
||||
SUM(de.out_into_num) as totalInQty,
|
||||
SUM(de.out_into_amount) as totalInAmount,
|
||||
SUM(de.inventory_num) as totalStockQty,
|
||||
SUM(de.total_amount) as totalStockAmount
|
||||
FROM report_drp_inventory_base de
|
||||
LEFT JOIN menu_material mm ON de.material_id = mm.material_id
|
||||
LEFT JOIN drp_unit du ON de.unit_id = du.unit_id
|
||||
LEFT JOIN menu_material_category mmc ON mmc.category_id = mm.category_id
|
||||
LEFT JOIN drp_warehouse dw ON dw.warehouse_id = de.warehouse_id
|
||||
LEFT JOIN alloc_area aa ON aa.area_id = dw.area_id
|
||||
LEFT JOIN drp_supplier ds ON de.supplier_id = ds.supplier_id
|
||||
LEFT JOIN mgr_user mu ON de.operator_id = mu.username
|
||||
WHERE de.record_type=1 AND de.out_into_type IN (1,5)
|
||||
|
||||
<!-- 以下条件和明细保持一模一样 -->
|
||||
<if test="param.startDate != null">
|
||||
AND de.record_date >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null">
|
||||
AND de.record_date <= #{param.endDate}
|
||||
</if>
|
||||
<if test="param.supplierIdList != null and param.supplierIdList.size() > 0">
|
||||
AND de.supplier_id IN
|
||||
<foreach collection="param.supplierIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.materialName != null and param.materialName != ''">
|
||||
AND (mm.material_name LIKE concat('%',#{param.materialName},'%')
|
||||
OR mm.material_code LIKE concat('%',#{param.materialName},'%'))
|
||||
</if>
|
||||
<if test="param.categoryIdList != null and param.categoryIdList.size() > 0">
|
||||
AND mmc.category_id IN
|
||||
<foreach collection="param.categoryIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.intoTypeList != null and param.intoTypeList.size() > 0">
|
||||
AND de.out_into_type IN
|
||||
<foreach collection="param.intoTypeList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.recordId != null and param.recordId != ''">
|
||||
AND de.record_id LIKE concat('%',#{param.recordId},'%')
|
||||
</if>
|
||||
<if test="param.areaIdList != null and param.areaIdList.size() > 0">
|
||||
AND dw.area_id IN
|
||||
<foreach collection="param.areaIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.warehouseIdList != null and param.warehouseIdList.size() > 0">
|
||||
AND dw.warehouse_id IN
|
||||
<foreach collection="param.warehouseIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="warehouseAuthority != null and warehouseAuthority.size() > 0">
|
||||
AND dw.warehouse_id IN
|
||||
<foreach collection="warehouseAuthority" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="areaAuth != null and areaAuth.size() > 0">
|
||||
AND dw.area_id IN
|
||||
<foreach collection="areaAuth" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryInventoryOutDetail"
|
||||
resultType="com.bonus.canteen.core.reportforms.beans.DrpInventoryoutDetailVO"
|
||||
parameterType="com.bonus.canteen.core.reportforms.beans.DrpInventoryIntoDetailWrapper">
|
||||
|
||||
select de.material_id,
|
||||
mm.material_name as goods_name,
|
||||
mm.material_code as goods_code,
|
||||
mmc.category_id,
|
||||
mmc.category_name as goods_category_name,
|
||||
de.unit_id,
|
||||
du.unit_name,
|
||||
de.unit_price as price,
|
||||
aa.area_name,
|
||||
dw.warehouse_id,
|
||||
dw.warehouse_name,
|
||||
de.out_into_type intoType,
|
||||
de.fetch_user_id as supplier_id,
|
||||
null as supplier_name,
|
||||
de.record_time intoDate,
|
||||
de.out_into_num intoNum,
|
||||
de.inventory_num balance_num,
|
||||
de.out_into_amount intoAmount,
|
||||
de.total_amount balance_amount,
|
||||
de.fetch_user_id as operator_id,
|
||||
IF (mu.real_name IS NULL OR mu.real_name = '', mu.username, mu.real_name) operatorName,
|
||||
de.product_date as production_date,
|
||||
de.expire_time as expiry_date,
|
||||
de.record_id,
|
||||
mm.size as specification
|
||||
from report_drp_inventory_base de
|
||||
LEFT JOIN menu_material mm ON de.material_id = mm.material_id
|
||||
LEFT JOIN drp_unit du ON de.unit_id = du.unit_id
|
||||
LEFT JOIN menu_material_category mmc ON mmc.category_id = mm.category_id
|
||||
left join drp_warehouse dw on dw.warehouse_id = de.warehouse_id
|
||||
left join alloc_area aa on aa.area_id = dw.area_id
|
||||
LEFT JOIN mgr_user mu ON de.fetch_user_id = mu.user_id
|
||||
left join order_info oi on oi.order_time = de.record_time
|
||||
where de.record_type = 2 and de.out_into_type in (1,3,5,6)
|
||||
and not exists (
|
||||
select 1 from order_info oi
|
||||
where oi.order_time = de.record_time
|
||||
and oi.order_state = 3
|
||||
)
|
||||
|
||||
<if test="param.startDate != null">
|
||||
and de.record_date >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null">
|
||||
and de.record_date <= #{param.endDate}
|
||||
</if>
|
||||
|
||||
<if test="param.supplierIdList != null and param.supplierIdList.size() > 0">
|
||||
and de.fetch_user_id in
|
||||
<foreach collection="param.supplierIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.materialName != null and param.materialName != ''">
|
||||
and (mm.material_name like concat('%', #{param.materialName}, '%')
|
||||
or mm.material_code like concat('%', #{param.materialName}, '%'))
|
||||
</if>
|
||||
|
||||
<if test="param.categoryIdList != null and param.categoryIdList.size() > 0">
|
||||
and mmc.category_id in
|
||||
<foreach collection="param.categoryIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.intoTypeList != null and param.intoTypeList.size() > 0">
|
||||
and de.out_into_type in
|
||||
<foreach collection="param.intoTypeList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.recordId != null and param.recordId != ''">
|
||||
and de.record_id like concat('%', #{param.recordId}, '%')
|
||||
</if>
|
||||
|
||||
<if test="param.areaIdList != null and param.areaIdList.size() > 0">
|
||||
and dw.area_id in
|
||||
<foreach collection="param.areaIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.warehouseIdList != null and param.warehouseIdList.size() > 0">
|
||||
and dw.warehouse_id in
|
||||
<foreach collection="param.warehouseIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="warehouseAuthority != null and warehouseAuthority.size() > 0">
|
||||
and dw.warehouse_id in
|
||||
<foreach collection="warehouseAuthority" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="areaAuth != null and areaAuth.size() > 0">
|
||||
and dw.area_id in
|
||||
<foreach collection="areaAuth" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 获取租户仓库列表(带权限控制) -->
|
||||
<select id="getTenantWarehouse" resultMap="DrpWarehouseAllVOResult">
|
||||
SELECT
|
||||
a.warehouse_id,
|
||||
a.warehouse_name,
|
||||
a.warehouse_num,
|
||||
a.address,
|
||||
a.fetch_user_id,
|
||||
IF(mu.real_name IS NULL OR mu.real_name = '', mu.username, mu.real_name) AS fetchUserName
|
||||
FROM drp_warehouse a
|
||||
LEFT JOIN alloc_area aa ON aa.area_id = a.area_id
|
||||
LEFT JOIN mgr_user mu ON a.fetch_user_id = mu.user_id
|
||||
WHERE a.del_flag = 2
|
||||
AND a.status = 2
|
||||
|
||||
<if test="areaAuth != null and areaAuth.length > 0">
|
||||
AND (
|
||||
a.area_id IN
|
||||
<foreach collection="areaAuth" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
OR a.area_id IS NULL
|
||||
)
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 获取用户有权限的仓库ID列表 -->
|
||||
<select id="getTenantWarehouseIds" resultType="java.lang.Long">
|
||||
SELECT DISTINCT rw.warehouse_id
|
||||
FROM mgr_role_warehouse rw
|
||||
JOIN mgr_role r ON rw.role_id = r.role_id
|
||||
WHERE r.role_code = '-1'
|
||||
AND r.del_flag = 2;
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 获取用户有权限的区域ID列表 -->
|
||||
<select id="getTenantAreaIds" resultType="java.lang.Long">
|
||||
SELECT DISTINCT d.area_id
|
||||
FROM drp_warehouse d
|
||||
WHERE d.area_id IS NOT NULL
|
||||
</select>
|
||||
|
||||
<!-- 获取供应商列表 -->
|
||||
<select id="getSupplierList" resultType="com.bonus.canteen.core.reportforms.beans.DrpSupplierVO">
|
||||
SELECT
|
||||
ds.supplier_id,
|
||||
ds.supplier_name,
|
||||
ds.supplier_score,
|
||||
ds.area_id,
|
||||
aa.area_name
|
||||
FROM
|
||||
drp_supplier ds
|
||||
LEFT JOIN alloc_area aa ON aa.area_id = ds.area_id
|
||||
where ds.status = 2
|
||||
and ds.del_flag = 2
|
||||
<if test="content != null and content.size() > 0">
|
||||
and (
|
||||
ds.area_id in
|
||||
<foreach collection="content" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
or ds.area_id is null
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 获取货品类别字典(树形结构) -->
|
||||
<select id="getGoodsCategoryDict" resultType="com.bonus.canteen.core.reportforms.beans.DrpDictVO">
|
||||
SELECT
|
||||
mmc.category_id AS id,
|
||||
CASE
|
||||
WHEN mmc.area_id IS NOT NULL AND aa.area_name IS NOT NULL
|
||||
THEN CONCAT(mmc.category_name, '(', aa.area_name, ')')
|
||||
ELSE mmc.category_name
|
||||
END AS dictLabel,
|
||||
mmc.parent_id,
|
||||
mmc.area_id,
|
||||
mmc.category_type,
|
||||
mmc.level
|
||||
FROM menu_material_category mmc
|
||||
LEFT JOIN alloc_area aa ON aa.area_id = mmc.area_id
|
||||
WHERE mmc.del_flag = 2
|
||||
|
||||
<if test="areaAuth != null and areaAuth.size() > 0">
|
||||
AND (
|
||||
mmc.area_id IN
|
||||
<foreach collection="areaAuth" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
OR mmc.area_id IS NULL
|
||||
)
|
||||
</if>
|
||||
ORDER BY parent_id, category_type, category_id
|
||||
</select>
|
||||
<select id="queryInventoryIntoDocDetailoutSum"
|
||||
resultType="com.bonus.canteen.core.reportforms.beans.InventoryIntoSummaryVO">
|
||||
SELECT
|
||||
SUM(de.out_into_num) as totalInQty,
|
||||
SUM(de.out_into_amount) as totalInAmount,
|
||||
SUM(de.inventory_num) as totalStockQty,
|
||||
SUM(de.total_amount) as totalStockAmount
|
||||
from report_drp_inventory_base de
|
||||
LEFT JOIN menu_material mm ON de.material_id = mm.material_id
|
||||
LEFT JOIN drp_unit du ON de.unit_id = du.unit_id
|
||||
LEFT JOIN menu_material_category mmc ON mmc.category_id = mm.category_id
|
||||
left join drp_warehouse dw on dw.warehouse_id = de.warehouse_id
|
||||
left join alloc_area aa on aa.area_id = dw.area_id
|
||||
LEFT JOIN drp_supplier ds ON de.supplier_id = ds.supplier_id
|
||||
LEFT JOIN mgr_user mu ON de.operator_id = mu.username
|
||||
left join order_info oi on oi.order_time = de.record_time
|
||||
where de.record_type=2 and de.out_into_type in (1,3,5,6)
|
||||
and not exists (
|
||||
select 1 from order_info oi
|
||||
where oi.order_time = de.record_time
|
||||
and oi.order_state = 3
|
||||
)
|
||||
|
||||
<if test="param.startDate != null">
|
||||
and de.record_date >= #{param.startDate}
|
||||
</if>
|
||||
|
||||
<if test="param.endDate != null">
|
||||
and de.record_date <= #{param.endDate}
|
||||
</if>
|
||||
|
||||
<if test="param.supplierIdList != null and param.supplierIdList.size() > 0">
|
||||
and de.supplier_id in
|
||||
<foreach collection="param.supplierIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.materialName != null and param.materialName != ''">
|
||||
and (mm.material_name like concat('%', #{param.materialName}, '%')
|
||||
or mm.material_code like concat('%', #{param.materialName}, '%'))
|
||||
</if>
|
||||
|
||||
<if test="param.categoryIdList != null and param.categoryIdList.size() > 0">
|
||||
and mmc.category_id in
|
||||
<foreach collection="param.categoryIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.intoTypeList != null and param.intoTypeList.size() > 0">
|
||||
and de.out_into_type in
|
||||
<foreach collection="param.intoTypeList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.recordId != null and param.recordId != ''">
|
||||
and de.record_id like concat('%', #{param.recordId}, '%')
|
||||
</if>
|
||||
|
||||
<if test="param.areaIdList != null and param.areaIdList.size() > 0">
|
||||
and dw.area_id in
|
||||
<foreach collection="param.areaIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.warehouseIdList != null and param.warehouseIdList.size() > 0">
|
||||
and dw.warehouse_id in
|
||||
<foreach collection="param.warehouseIdList" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="warehouseAuthority != null and warehouseAuthority.size() > 0">
|
||||
and dw.warehouse_id in
|
||||
<foreach collection="warehouseAuthority" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="areaAuth != null and areaAuth.size() > 0">
|
||||
and dw.area_id in
|
||||
<foreach collection="areaAuth" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue