feat(wms,oms):库存管理新增入库排名统计(按仓单+货品汇总,件数降序,与出库排名tab配对);还原出库排名第一版源码
入库排名统计(新增):WMS /inboundRankApi、OMS /executionInboundRankApi 的 queryMaterialRankList 分页+合计、exportMaterialRank 导出;口径:仅已入库(status=5),明细仅level=1主行,日期区间按入仓日期warehouse_date筛选(必填);一行=仓单内某货品合计(GROUP BY 仓单+货品 ORDER BY 件数DESC);字段:入仓日期/仓单编号/客户编号/存货人/货名/件数/毛重(吨=KG/1000)/投保总额(货品档案保额,组内MAX防重复累加)/体积(CBM)+货号/规格/单位;合计行:totalPieceCount/totalGrossWeightTon/totalInsureAmount/totalVolume/totalOrderCount;登录上下文:日期必填校验+topOrganizationId租户隔离,WMS另注入关联仓库warehouseId。出库排名统计(还原第一版):/outboundRankApi、/executionOutboundRankApi,按货品/线路汇总排名
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
package com.mhd.wms.interfaces.assember.inboundRank;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.inboundRank.repository.todo.InboundRankDO;
|
||||
import com.mhd.wms.interfaces.dto.inboundRank.InboundRankDTO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 入库排名统计Assembler
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@Component
|
||||
public class InboundRankAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public InboundRankDO toDO(InboundRankDTO inboundRankDTO) {
|
||||
InboundRankDO inboundRankDO = new InboundRankDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(inboundRankDTO, inboundRankDO, IgnoreNullUtil.getNullPropertyNames(inboundRankDTO));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
return inboundRankDO;
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.mhd.wms.interfaces.assember.outboundRank;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.outboundRank.repository.todo.OutboundRankDO;
|
||||
import com.mhd.wms.interfaces.dto.outboundRank.OutboundRankDTO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 出库排名统计Assembler
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@Component
|
||||
public class OutboundRankAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public OutboundRankDO toDO(OutboundRankDTO outboundRankDTO) {
|
||||
OutboundRankDO outboundRankDO = new OutboundRankDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(outboundRankDTO, outboundRankDO, IgnoreNullUtil.getNullPropertyNames(outboundRankDTO));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
return outboundRankDO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.mhd.wms.interfaces.dto.inboundRank;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 入库排名统计入参DTO
|
||||
*
|
||||
* <p>按入仓日期区间筛选商品入库量统计排名,统计口径:入仓日期 + 仅已入库状态(5) + 明细仅取 level=1 主行;
|
||||
* 一行 = 某仓单内某货品的合计,按件数降序排名</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@Data
|
||||
public class InboundRankDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("入仓日期-开始 yyyy-MM-dd(必填,按入仓单入仓日期筛选)")
|
||||
private String warehouseDateStart;
|
||||
|
||||
@ApiModelProperty("入仓日期-结束 yyyy-MM-dd(必填,按入仓单入仓日期筛选)")
|
||||
private String warehouseDateEnd;
|
||||
|
||||
@ApiModelProperty("仓单编号/入库单号(模糊)")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("客户编号(模糊)")
|
||||
private String shipperCode;
|
||||
|
||||
@ApiModelProperty("存货人/客户名称(模糊)")
|
||||
private String shipperName;
|
||||
|
||||
@ApiModelProperty("商品货号(模糊)")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("货名/商品名称(模糊)")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("仓库名称(模糊)")
|
||||
private String warehouseName;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.mhd.wms.interfaces.dto.outboundRank;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 出库排名统计入参DTO
|
||||
*
|
||||
* <p>按日期区间统计商品/线路出库量排名,统计口径:出库单创建时间 + 已出库及之后状态(9,12,13)</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@Data
|
||||
public class OutboundRankDTO {
|
||||
|
||||
@ApiModelProperty("出库日期-开始 yyyy-MM-dd(必填,按出库单创建时间统计)")
|
||||
private String createTimeStart;
|
||||
|
||||
@ApiModelProperty("出库日期-结束 yyyy-MM-dd(必填,按出库单创建时间统计)")
|
||||
private String createTimeEnd;
|
||||
|
||||
@ApiModelProperty("商品货号(模糊)")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("商品名称(模糊)")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("线路编码(模糊)")
|
||||
private String lineCode;
|
||||
|
||||
@ApiModelProperty("线路名称(模糊)")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("仓库名称(模糊)")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("客户名称(模糊)")
|
||||
private String customerName;
|
||||
|
||||
@ApiModelProperty("货主名称(模糊)")
|
||||
private String shipperName;
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package com.mhd.wms.interfaces.facadeApi.inboundRank;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mhd.common.core.constant.HttpStatus;
|
||||
import com.mhd.common.core.utils.PageUtils;
|
||||
import com.mhd.common.core.utils.poi.ExcelUtil;
|
||||
import com.mhd.wms.application.service.inboundRank.InboundRankApplicationService;
|
||||
import com.mhd.wms.domain.inboundRank.repository.po.InboundMaterialRankPO;
|
||||
import com.mhd.wms.domain.inboundRank.repository.po.InboundRankTotalPO;
|
||||
import com.mhd.wms.domain.inboundRank.repository.todo.InboundRankDO;
|
||||
import com.mhd.wms.interfaces.assember.inboundRank.InboundRankAssembler;
|
||||
import com.mhd.wms.interfaces.dto.inboundRank.InboundRankDTO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 入库排名统计Api
|
||||
*
|
||||
* <p>按入仓日期区间筛选商品入库量统计排名。统计口径:入仓日期 + 仅已入库状态(5),
|
||||
* 明细仅取 level=1 主行;一行 = 某仓单内某货品的合计,按件数降序排名。
|
||||
* 字段:入仓日期/仓单编号/客户编号/存货人/货名/件数/毛重(吨)/投保总额/体积(CBM)。
|
||||
* 与出库排名(/outboundRankApi)配对,前端用 tab 页区分</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/inboundRankApi")
|
||||
public class InboundRankApi {
|
||||
|
||||
@Resource
|
||||
private InboundRankAssembler inboundRankAssembler;
|
||||
|
||||
@Autowired
|
||||
private InboundRankApplicationService inboundRankApplicationService;
|
||||
|
||||
/**
|
||||
* 分页查询商品入库排名列表(含合计行)
|
||||
*/
|
||||
@ApiOperation("分页查询商品入库排名列表")
|
||||
@GetMapping("/queryMaterialRankList")
|
||||
public HashMap<String, Object> queryMaterialRankList(InboundRankDTO inboundRankDTO) {
|
||||
//转换实体
|
||||
InboundRankDO inboundRankDO = inboundRankAssembler.toDO(inboundRankDTO);
|
||||
startPage();
|
||||
List<InboundMaterialRankPO> list = inboundRankApplicationService.queryMaterialRankList(inboundRankDO);
|
||||
InboundRankTotalPO total = inboundRankApplicationService.queryMaterialRankTotal(inboundRankDO);
|
||||
return getDataTableWithTotal(list, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品入库排名Excel
|
||||
*/
|
||||
@ApiOperation("导出商品入库排名Excel")
|
||||
@GetMapping("/exportMaterialRank")
|
||||
public void exportMaterialRank(HttpServletResponse response, InboundRankDTO inboundRankDTO) throws Exception {
|
||||
//转换实体(不分页,导出全量)
|
||||
InboundRankDO inboundRankDO = inboundRankAssembler.toDO(inboundRankDTO);
|
||||
List<InboundMaterialRankPO> list = inboundRankApplicationService.exportMaterialRank(inboundRankDO);
|
||||
|
||||
String fileName = URLEncoder.encode("入库排名统计", "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
ExcelUtil<InboundMaterialRankPO> util = new ExcelUtil<>(InboundMaterialRankPO.class);
|
||||
util.exportExcel(response, list, "入库排名统计");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页结果 + 合计行:data/total/code/msg 之外追加
|
||||
* totalPieceCount/totalGrossWeightTon/totalInsureAmount/totalVolume/totalOrderCount
|
||||
*/
|
||||
private HashMap<String, Object> getDataTableWithTotal(List<?> list, InboundRankTotalPO total) {
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
result.put("data", list);
|
||||
result.put("total", new PageInfo<>(list).getTotal());
|
||||
result.put("code", HttpStatus.SUCCESS);
|
||||
result.put("msg", "查询成功");
|
||||
if (total != null) {
|
||||
result.put("totalPieceCount", total.getTotalPieceCount());
|
||||
result.put("totalGrossWeightTon", total.getTotalGrossWeightTon());
|
||||
result.put("totalInsureAmount", total.getTotalInsureAmount());
|
||||
result.put("totalVolume", total.getTotalVolume());
|
||||
result.put("totalOrderCount", total.getTotalOrderCount());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求分页数据
|
||||
*/
|
||||
protected void startPage() {
|
||||
PageUtils.startPage();
|
||||
}
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
package com.mhd.wms.interfaces.facadeApi.outboundRank;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mhd.common.core.constant.HttpStatus;
|
||||
import com.mhd.common.core.utils.PageUtils;
|
||||
import com.mhd.common.core.utils.poi.ExcelUtil;
|
||||
import com.mhd.wms.application.service.outboundRank.OutboundRankApplicationService;
|
||||
import com.mhd.wms.domain.outboundRank.repository.po.OutboundLineRankPO;
|
||||
import com.mhd.wms.domain.outboundRank.repository.po.OutboundMaterialRankPO;
|
||||
import com.mhd.wms.domain.outboundRank.repository.po.OutboundRankTotalPO;
|
||||
import com.mhd.wms.domain.outboundRank.repository.todo.OutboundRankDO;
|
||||
import com.mhd.wms.interfaces.assember.outboundRank.OutboundRankAssembler;
|
||||
import com.mhd.wms.interfaces.dto.outboundRank.OutboundRankDTO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出库排名统计Api
|
||||
*
|
||||
* <p>按日期区间筛选,统计商品/线路出库量排名。统计口径:出库单创建时间 + 已出库及之后状态(9,12,13),
|
||||
* 明细仅取 level=1 主行;销售量=SUM(出库数量)、交易数=COUNT(DISTINCT 出库单号)、金额=SUM(明细总价)</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/outboundRankApi")
|
||||
public class OutboundRankApi {
|
||||
|
||||
@Resource
|
||||
private OutboundRankAssembler outboundRankAssembler;
|
||||
|
||||
@Autowired
|
||||
private OutboundRankApplicationService outboundRankApplicationService;
|
||||
|
||||
/**
|
||||
* 分页查询商品出库排名列表(含合计行)
|
||||
*/
|
||||
@ApiOperation("分页查询商品出库排名列表")
|
||||
@GetMapping("/queryMaterialRankList")
|
||||
public HashMap<String, Object> queryMaterialRankList(OutboundRankDTO outboundRankDTO) {
|
||||
//转换实体
|
||||
OutboundRankDO outboundRankDO = outboundRankAssembler.toDO(outboundRankDTO);
|
||||
startPage();
|
||||
List<OutboundMaterialRankPO> list = outboundRankApplicationService.queryMaterialRankList(outboundRankDO);
|
||||
OutboundRankTotalPO total = outboundRankApplicationService.queryMaterialRankTotal(outboundRankDO);
|
||||
return getDataTableWithTotal(list, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询线路出库排名列表(含合计行)
|
||||
*/
|
||||
@ApiOperation("分页查询线路出库排名列表")
|
||||
@GetMapping("/queryLineRankList")
|
||||
public HashMap<String, Object> queryLineRankList(OutboundRankDTO outboundRankDTO) {
|
||||
//转换实体
|
||||
OutboundRankDO outboundRankDO = outboundRankAssembler.toDO(outboundRankDTO);
|
||||
startPage();
|
||||
List<OutboundLineRankPO> list = outboundRankApplicationService.queryLineRankList(outboundRankDO);
|
||||
OutboundRankTotalPO total = outboundRankApplicationService.queryLineRankTotal(outboundRankDO);
|
||||
return getDataTableWithTotal(list, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品出库排名Excel
|
||||
*/
|
||||
@ApiOperation("导出商品出库排名Excel")
|
||||
@GetMapping("/exportMaterialRank")
|
||||
public void exportMaterialRank(HttpServletResponse response, OutboundRankDTO outboundRankDTO) throws Exception {
|
||||
//转换实体(不分页,导出全量)
|
||||
OutboundRankDO outboundRankDO = outboundRankAssembler.toDO(outboundRankDTO);
|
||||
List<OutboundMaterialRankPO> list = outboundRankApplicationService.exportMaterialRankList(outboundRankDO);
|
||||
|
||||
String fileName = URLEncoder.encode("商品出库排名", "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
ExcelUtil<OutboundMaterialRankPO> util = new ExcelUtil<>(OutboundMaterialRankPO.class);
|
||||
util.exportExcel(response, list, "商品出库排名");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出线路出库排名Excel
|
||||
*/
|
||||
@ApiOperation("导出线路出库排名Excel")
|
||||
@GetMapping("/exportLineRank")
|
||||
public void exportLineRank(HttpServletResponse response, OutboundRankDTO outboundRankDTO) throws Exception {
|
||||
//转换实体(不分页,导出全量)
|
||||
OutboundRankDO outboundRankDO = outboundRankAssembler.toDO(outboundRankDTO);
|
||||
List<OutboundLineRankPO> list = outboundRankApplicationService.exportLineRankList(outboundRankDO);
|
||||
|
||||
String fileName = URLEncoder.encode("线路出库排名", "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
ExcelUtil<OutboundLineRankPO> util = new ExcelUtil<>(OutboundLineRankPO.class);
|
||||
util.exportExcel(response, list, "线路出库排名");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页结果 + 合计行:data/total/code/msg 之外追加 totalSalesQuantity/totalTradeCount/totalAmount
|
||||
*/
|
||||
private HashMap<String, Object> getDataTableWithTotal(List<?> list, OutboundRankTotalPO total) {
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
result.put("data", list);
|
||||
result.put("total", new PageInfo<>(list).getTotal());
|
||||
result.put("code", HttpStatus.SUCCESS);
|
||||
result.put("msg", "查询成功");
|
||||
if (total != null) {
|
||||
result.put("totalSalesQuantity", total.getTotalSalesQuantity());
|
||||
result.put("totalTradeCount", total.getTotalTradeCount());
|
||||
result.put("totalAmount", total.getTotalAmount());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求分页数据
|
||||
*/
|
||||
protected void startPage() {
|
||||
PageUtils.startPage();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user