|
@@ -20,6 +20,8 @@ import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
|
|
|
import org.jeecg.modules.actualControl.heatsActuals.entity.HeatsActuals;
|
|
|
import org.jeecg.modules.actualControl.heatsActuals.service.IHeatsActualsService;
|
|
|
+import org.jeecg.modules.billet.billetAutoTmp.entity.BilletAutoTmp;
|
|
|
+import org.jeecg.modules.billet.billetAutoTmp.service.IBilletAutoTmpService;
|
|
|
import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsend;
|
|
|
import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsendDetailsVo;
|
|
|
import org.jeecg.modules.billet.billetHotsend.service.IBilletHotsendBaseService;
|
|
@@ -106,6 +108,9 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
|
|
|
@Autowired
|
|
|
private IBilletHotsendBaseService billetHotsendBaseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IBilletAutoTmpService billetAutoTmpService;
|
|
|
+
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
@@ -119,15 +124,56 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
|
|
|
@ApiOperation(value="钢坯装运单-分页列表查询", notes="钢坯装运单-分页列表查询")
|
|
|
@GetMapping(value = "/list")
|
|
|
public Result<IPage<StorageBill>> queryPageList(StorageBill storageBill,
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
QueryWrapper<StorageBill> queryWrapper = QueryGenerator.initQueryWrapper(storageBill, req.getParameterMap());
|
|
|
- Page<StorageBill> page = new Page<StorageBill>(pageNo, pageSize);
|
|
|
+
|
|
|
+ // 先不加 amountTotal 过滤条件,查询所有 StorageBill
|
|
|
+ Page<StorageBill> page = new Page<>(pageNo, pageSize);
|
|
|
IPage<StorageBill> pageList = storageBillService.page(page, queryWrapper);
|
|
|
+
|
|
|
+ // 获取当前分页的记录列表
|
|
|
+ List<StorageBill> records = pageList.getRecords();
|
|
|
+ if (records.isEmpty()) {
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 批量查询所有 storageBillId 相关的 BilletAutoTmp 记录
|
|
|
+ List<String> storageBillIds = records.stream()
|
|
|
+ .map(StorageBill::getId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 查询所有 BilletAutoTmp,并按 storageBillId 进行分组统计
|
|
|
+ LambdaQueryWrapper<BilletAutoTmp> tmpQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ tmpQueryWrapper.in(BilletAutoTmp::getStorageBillId, storageBillIds);
|
|
|
+ List<BilletAutoTmp> billetAutoTmpList = billetAutoTmpService.list(tmpQueryWrapper);
|
|
|
+
|
|
|
+ // 将 BilletAutoTmp 数据按 storageBillId 进行分组统计
|
|
|
+ Map<String, Long> billetCountMap = billetAutoTmpList.stream()
|
|
|
+ .collect(Collectors.groupingBy(BilletAutoTmp::getStorageBillId, Collectors.counting()));
|
|
|
+
|
|
|
+ // 遍历 StorageBill 记录,累加 amountTotal
|
|
|
+ records.forEach(bill -> {
|
|
|
+ Long count = billetCountMap.getOrDefault(bill.getId(), 0L);
|
|
|
+ bill.setAmountTotal(bill.getAmountTotal() + count.intValue());
|
|
|
+ });
|
|
|
+
|
|
|
+ // 最终过滤掉 amountTotal 为 0 的数据
|
|
|
+ List<StorageBill> filteredRecords = records.stream()
|
|
|
+ .filter(bill -> bill.getAmountTotal() > 0) // 这里进行最终过滤
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 重新封装分页数据
|
|
|
+ pageList.setRecords(filteredRecords);
|
|
|
+ pageList.setTotal(filteredRecords.size()); // 更新总条数
|
|
|
+
|
|
|
return Result.OK(pageList);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@ApiOperation(value="钢坯热送单-分页列表查询", notes="钢坯热送单-分页列表查询")
|
|
|
@GetMapping(value = "/listHotSend")
|
|
|
public Result<IPage<StorageBill>> queryHotSendPageList(StorageBill storageBill,
|