物资管理大屏接口优化
This commit is contained in:
@ -83,27 +83,29 @@ public class MaterialsManagementServiceImpl implements IMaterialsManagementServi
|
||||
.eq(MatMaterialReceiveItem::getProjectId, projectId)
|
||||
.ne(MatMaterialReceiveItem::getAcceptedQuantity, BigDecimal.ZERO)
|
||||
.between(MatMaterialReceiveItem::getCreateTime, monthStart, currentTime));
|
||||
if (CollUtil.isEmpty(matMaterialReceiveItems)){
|
||||
if (CollUtil.isEmpty(matMaterialReceiveItems)) {
|
||||
vo.setEnterTotalPrices(BigDecimal.ZERO);
|
||||
}else {
|
||||
// 计算本月入库金额
|
||||
BigDecimal enterTotalPrices = matMaterialReceiveItems.stream()
|
||||
.map(item -> item.getAcceptedQuantity().multiply(item.getUnitPrice() != null? item.getUnitPrice() : BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
vo.setEnterTotalPrices(enterTotalPrices.setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
// 计算本月入库金额
|
||||
matMaterialReceiveItems.forEach(item -> {
|
||||
vo.setEnterTotalPrices(vo.getEnterTotalPrices().add(item.getAcceptedQuantity().multiply(item.getUnitPrice())));
|
||||
});
|
||||
vo.setEnterTotalPrices(vo.getEnterTotalPrices().setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
// 获取上月入库数据
|
||||
List<MatMaterialReceiveItem> oldMatMaterialReceiveItems = materialReceiveItemService.getBaseMapper().selectList(new LambdaQueryWrapper<MatMaterialReceiveItem>()
|
||||
.eq(MatMaterialReceiveItem::getProjectId, projectId)
|
||||
.ne(MatMaterialReceiveItem::getAcceptedQuantity, BigDecimal.ZERO)
|
||||
.between(MatMaterialReceiveItem::getCreateTime, lastMonthFirstDay, lastMonthLastDay));
|
||||
if (CollUtil.isEmpty(oldMatMaterialReceiveItems)){
|
||||
if (CollUtil.isEmpty(oldMatMaterialReceiveItems)) {
|
||||
vo.setOldEnterTotalPrices(BigDecimal.ZERO);
|
||||
}else {
|
||||
// 计算上月入库金额
|
||||
BigDecimal oldEnterTotalPrices = oldMatMaterialReceiveItems.stream()
|
||||
.map(item -> item.getAcceptedQuantity().multiply(item.getUnitPrice() != null? item.getUnitPrice() : BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
vo.setOldEnterTotalPrices(oldEnterTotalPrices.setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
// 计算上月入库金额
|
||||
oldMatMaterialReceiveItems.forEach(item -> {
|
||||
vo.setOldEnterTotalPrices(vo.getOldEnterTotalPrices().add(item.getAcceptedQuantity().multiply(item.getUnitPrice())));
|
||||
});
|
||||
vo.setOldEnterTotalPrices(vo.getOldEnterTotalPrices().setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
// 获取当月出库数据
|
||||
List<MatMaterialIssueItem> matMaterialIssueItems = materialIssueItemService.getBaseMapper()
|
||||
.selectList(new LambdaQueryWrapper<MatMaterialIssueItem>()
|
||||
@ -112,13 +114,14 @@ public class MaterialsManagementServiceImpl implements IMaterialsManagementServi
|
||||
.between(MatMaterialIssueItem::getCreateTime, monthStart, currentTime));
|
||||
|
||||
//计算本月出库金额
|
||||
if (CollUtil.isEmpty(matMaterialIssueItems)){
|
||||
if (CollUtil.isEmpty(matMaterialIssueItems)) {
|
||||
vo.setLeaveTotalPrices(BigDecimal.ZERO);
|
||||
}else {
|
||||
BigDecimal leaveTotalPrices = matMaterialIssueItems.stream()
|
||||
.map(item -> item.getIssuedQuantity().multiply(item.getUnitPrice() != null? item.getUnitPrice() : BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
vo.setLeaveTotalPrices(leaveTotalPrices.setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
matMaterialIssueItems.forEach(item -> {
|
||||
vo.setLeaveTotalPrices(vo.getLeaveTotalPrices().add(item.getIssuedQuantity().multiply(item.getUnitPrice())));
|
||||
});
|
||||
vo.setLeaveTotalPrices(vo.getLeaveTotalPrices().setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
// 获取上月出库数据
|
||||
List<MatMaterialIssueItem> oldMatMaterialIssueItems = materialIssueItemService.getBaseMapper()
|
||||
.selectList(new LambdaQueryWrapper<MatMaterialIssueItem>()
|
||||
@ -126,31 +129,38 @@ public class MaterialsManagementServiceImpl implements IMaterialsManagementServi
|
||||
.ne(MatMaterialIssueItem::getIssuedQuantity, BigDecimal.ZERO)
|
||||
.between(MatMaterialIssueItem::getCreateTime, lastMonthFirstDay, lastMonthLastDay));
|
||||
//计算上月出库金额
|
||||
if (CollUtil.isEmpty(oldMatMaterialIssueItems)){
|
||||
if (CollUtil.isEmpty(oldMatMaterialIssueItems)) {
|
||||
vo.setOldLeaveTotalPrices(BigDecimal.ZERO);
|
||||
}else {
|
||||
BigDecimal oldLeaveTotalPrices = oldMatMaterialIssueItems.stream()
|
||||
.map(item -> item.getIssuedQuantity().multiply(item.getUnitPrice() != null? item.getUnitPrice() : BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
vo.setOldLeaveTotalPrices(oldLeaveTotalPrices.setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
oldMatMaterialIssueItems.forEach(item -> {
|
||||
vo.setOldLeaveTotalPrices(vo.getOldLeaveTotalPrices().add(item.getIssuedQuantity().multiply(item.getUnitPrice())));
|
||||
});
|
||||
vo.setOldLeaveTotalPrices(vo.getOldLeaveTotalPrices().setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
//获取总入库存金额 入库 * 单价
|
||||
List<MatMaterialReceiveItem> totalMatMaterialReceiveItems = materialReceiveItemService.getBaseMapper().selectList(new LambdaQueryWrapper<MatMaterialReceiveItem>().eq(MatMaterialReceiveItem::getProjectId, projectId));
|
||||
if (CollUtil.isEmpty(totalMatMaterialReceiveItems)){
|
||||
if (CollUtil.isEmpty(totalMatMaterialReceiveItems)) {
|
||||
vo.setInventoryTotalPrices(BigDecimal.ZERO);
|
||||
}else {
|
||||
// 计算总入库存金额
|
||||
BigDecimal inventoryTotalPrices = totalMatMaterialReceiveItems.stream()
|
||||
.map(item -> item.getAcceptedQuantity().multiply(item.getUnitPrice() != null? item.getUnitPrice() : BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
vo.setInventoryTotalPrices(inventoryTotalPrices.setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
totalMatMaterialReceiveItems.forEach(item -> {
|
||||
vo.setInventoryTotalPrices(vo.getInventoryTotalPrices().add(item.getAcceptedQuantity().multiply(item.getUnitPrice())));
|
||||
});
|
||||
vo.setInventoryTotalPrices(vo.getInventoryTotalPrices().setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
|
||||
// 获取总出库金额 出库 * 单价
|
||||
List<MatMaterialIssueItem> totalMatMaterialIssueItems = materialIssueItemService.getBaseMapper().selectList(new LambdaQueryWrapper<MatMaterialIssueItem>().eq(MatMaterialIssueItem::getProjectId, projectId));
|
||||
if (CollUtil.isEmpty(totalMatMaterialIssueItems)){
|
||||
if (CollUtil.isEmpty(totalMatMaterialIssueItems)) {
|
||||
vo.setOutTotalPrices(BigDecimal.ZERO);
|
||||
}else {
|
||||
// 计算总出库金额
|
||||
BigDecimal outTotalPrices = totalMatMaterialIssueItems.stream()
|
||||
.map(item -> item.getIssuedQuantity().multiply(item.getUnitPrice() != null? item.getUnitPrice() : BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
vo.setOutTotalPrices(outTotalPrices.setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
totalMatMaterialIssueItems.forEach(item -> {
|
||||
vo.setOutTotalPrices(vo.getOutTotalPrices().add(item.getIssuedQuantity().multiply(item.getUnitPrice())));
|
||||
});
|
||||
vo.setOutTotalPrices(vo.getOutTotalPrices().setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
|
||||
|
||||
// 获取施工图一览大类名下所有小类名
|
||||
List<BusBillofquantitiesLimitList> limitLists = billofquantitiesLimitListService.getBaseMapper().selectList(new LambdaQueryWrapper<BusBillofquantitiesLimitList>()
|
||||
@ -184,16 +194,16 @@ public class MaterialsManagementServiceImpl implements IMaterialsManagementServi
|
||||
}
|
||||
}
|
||||
//获取库存逆变器总价
|
||||
BigDecimal inventoryInverterTotalPrices = materialsService.selectTotalPricesByNames(projectId,lBQNames);
|
||||
BigDecimal inventoryInverterTotalPrices = materialsService.selectTotalPricesByNames(projectId, lBQNames);
|
||||
vo.setInventoryInverterTotalPrices(inventoryInverterTotalPrices);
|
||||
//获取库存箱变总价
|
||||
BigDecimal inventoryBoxTransformerTotalPrices = materialsService.selectTotalPricesByNames(projectId,xBNames);
|
||||
BigDecimal inventoryBoxTransformerTotalPrices = materialsService.selectTotalPricesByNames(projectId, xBNames);
|
||||
vo.setInventoryBoxTransformerTotalPrices(inventoryBoxTransformerTotalPrices);
|
||||
//获取库存光伏支架总价
|
||||
BigDecimal inventoryPhotovoltaicSupportTotalPrices = materialsService.selectTotalPricesByNames(projectId,sFZJNames);
|
||||
BigDecimal inventoryPhotovoltaicSupportTotalPrices = materialsService.selectTotalPricesByNames(projectId, sFZJNames);
|
||||
vo.setInventoryPhotovoltaicSupportTotalPrices(inventoryPhotovoltaicSupportTotalPrices);
|
||||
//获取库存环网柜总价
|
||||
BigDecimal inventoryCircuitBreakerTotalPrices = materialsService.selectTotalPricesByNames(projectId,hWGNames);
|
||||
BigDecimal inventoryCircuitBreakerTotalPrices = materialsService.selectTotalPricesByNames(projectId, hWGNames);
|
||||
vo.setInventoryCircuitBreakerTotalPrices(inventoryCircuitBreakerTotalPrices);
|
||||
//获取当前库存总价
|
||||
BigDecimal nowInventoryTotalPrices = materialsService.selectTotalPrices(projectId);
|
||||
|
||||
@ -74,11 +74,12 @@ public class BigScreenWebSocketServer {
|
||||
// 存储会话到在线列表
|
||||
ONLINE_SESSIONS.put(session.getId(), session);
|
||||
log.info("📌 客户端连接成功!会话ID:{},当前在线数:{}", session.getId(), ONLINE_SESSIONS.size());
|
||||
|
||||
String[] split = currentSubscriptionId.split("-");
|
||||
Long projectId = Long.parseLong(split[0]);
|
||||
long type = Long.parseLong(split[1]);
|
||||
// 异步推送初始化数据(原有逻辑保留)
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
String[] split = currentSubscriptionId.split("-");
|
||||
//todo 填充不同类型大屏获取基础数据的方法判断
|
||||
IMaterialsManagementService managementService = SpringUtils.getBean(IMaterialsManagementService.class);
|
||||
IBusPurchaseDocService purchaseDocService = SpringUtils.getBean(IBusPurchaseDocService.class);
|
||||
@ -88,8 +89,7 @@ public class BigScreenWebSocketServer {
|
||||
// 大屏-质安管理
|
||||
DpzaglService dpzaglService = SpringUtils.getBean(DpzaglService.class);
|
||||
|
||||
Long projectId = Long.parseLong(split[0]);
|
||||
long type = Long.parseLong(split[1]);
|
||||
|
||||
List<Map<String, String>> maps = new ArrayList<>();
|
||||
switch ((int) type){
|
||||
case 1:
|
||||
|
||||
Reference in New Issue
Block a user