fix(库存模块): 修复库存调整逻辑并优化即时库存接口

库存调整:修复部分商品在点击“完成库存调整”后数据未更新的问题。

即时库存:移除 JSON 返回列表中每个对象冗余的库存数量合计字段,改为在最外层统一返回,优化并缩短接口整体响应时间。
This commit is contained in:
rcx
2026-08-06 17:08:54 +08:00
parent 56b39702b5
commit 315d96063a
5 changed files with 104 additions and 30 deletions
@@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
/**
@@ -48,13 +50,14 @@ public class StatementStatisticsApi {
*/
@ApiOperation("查询即时库存列表")
@GetMapping("/queryImmediateInventoryList")
public TableDataInfo queryImmediateInventoryList(ImmediateInventoryDTO immediateInventoryDTO)
public HashMap<String, Object> queryImmediateInventoryList(ImmediateInventoryDTO immediateInventoryDTO)
{
//转换实体
ImmediateInventoryDO immediateInventoryDO = immediateInventoryAssembler.toDO(immediateInventoryDTO);
startPage();
List<ImmediateInventoryPO> list = statementStatisticsService.queryImmediateInventoryList(immediateInventoryDO);
return getDataTable(list);
BigDecimal bigDecimal = statementStatisticsService.sumImmediateInventoryQuantity(immediateInventoryDO);
return getDataTableWarehouse(list,bigDecimal);
}
/**
* 分页查询入库日报表列表
@@ -129,4 +132,18 @@ public class StatementStatisticsApi {
rspData.setTotal(new PageInfo(list).getTotal());
return rspData;
}
/**
* 响应请求分页、仓库数量 数据
*/
protected HashMap<String, Object> getDataTableWarehouse(List<?> list,BigDecimal bigDecimal)
{
HashMap<String, Object> stringObjectHashMap = new HashMap<>();
stringObjectHashMap.put("data",list);
stringObjectHashMap.put("total",new PageInfo(list).getTotal());
stringObjectHashMap.put("code",HttpStatus.SUCCESS);
stringObjectHashMap.put("msg","查询成功");
stringObjectHashMap.put("totalInventoryQuantity",bigDecimal);
return stringObjectHashMap;
}
}