bug
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
package org.dromara.cailiaoshebei.controller;
|
package org.dromara.cailiaoshebei.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
@ -33,8 +34,12 @@ import org.dromara.design.service.IBusBillofquantitiesVersionsService;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物资-采购联系单
|
* 物资-采购联系单
|
||||||
@ -159,13 +164,23 @@ public class BusPurchaseDocController extends BaseController {
|
|||||||
@PathVariable("id") Long id) {
|
@PathVariable("id") Long id) {
|
||||||
List<BusPlanDocAssociation> list = planDocAssociationService.list(Wrappers.lambdaQuery(BusPlanDocAssociation.class)
|
List<BusPlanDocAssociation> list = planDocAssociationService.list(Wrappers.lambdaQuery(BusPlanDocAssociation.class)
|
||||||
.eq(BusPlanDocAssociation::getDocId, id));
|
.eq(BusPlanDocAssociation::getDocId, id));
|
||||||
List<Long> list1 = list.stream().map(BusPlanDocAssociation::getPlanId).toList();
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
if (list1.isEmpty()) {
|
|
||||||
return R.ok(new ArrayList<>());
|
return R.ok(new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
Map<Long, BigDecimal> collect = list.stream()
|
||||||
|
.filter(Objects::nonNull) // 过滤空对象
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
BusPlanDocAssociation::getPlanId,
|
||||||
|
BusPlanDocAssociation::getDemandQuantity,
|
||||||
|
(existing, replacement) -> existing // 保留第一个遇到的重复键
|
||||||
|
));
|
||||||
BusMaterialbatchdemandplanBo bo = new BusMaterialbatchdemandplanBo();
|
BusMaterialbatchdemandplanBo bo = new BusMaterialbatchdemandplanBo();
|
||||||
bo.setIds(list1);
|
bo.setIds(new ArrayList<>(collect.keySet()));
|
||||||
return R.ok(materialbatchdemandplanService.queryList(bo));
|
List<BusMaterialbatchdemandplanVo> busMaterialbatchdemandplanVos = materialbatchdemandplanService.queryList(bo);
|
||||||
|
for (BusMaterialbatchdemandplanVo busMaterialbatchdemandplanVo : busMaterialbatchdemandplanVos) {
|
||||||
|
busMaterialbatchdemandplanVo.setDemandQuantity(collect.get(busMaterialbatchdemandplanVo.getId()).longValue());
|
||||||
|
}
|
||||||
|
return R.ok(busMaterialbatchdemandplanVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -315,17 +315,23 @@ public class OutMonthPlanServiceImpl extends ServiceImpl<OutMonthPlanMapper, Out
|
|||||||
|
|
||||||
outMonthPlanAudit.setProjectId(outMonthPlan.getProjectId());
|
outMonthPlanAudit.setProjectId(outMonthPlan.getProjectId());
|
||||||
outMonthPlanAudit.setPlanMonth(outMonthPlan.getPlanMonth());
|
outMonthPlanAudit.setPlanMonth(outMonthPlan.getPlanMonth());
|
||||||
|
BigDecimal designValue = BigDecimal.ZERO;
|
||||||
|
BigDecimal purchaseValue = BigDecimal.ZERO;
|
||||||
|
BigDecimal constructionValue = BigDecimal.ZERO;
|
||||||
if(outMonthPlan.getValueType().equals("1")){
|
if(outMonthPlan.getValueType().equals("1")){
|
||||||
outMonthPlanAudit.setDesignValue(outMonthPlan.getPlanValue());
|
outMonthPlanAudit.setDesignValue(outMonthPlan.getPlanValue());
|
||||||
|
designValue = outMonthPlan.getPlanValue();
|
||||||
}
|
}
|
||||||
if(outMonthPlan.getValueType().equals("2")){
|
if(outMonthPlan.getValueType().equals("2")){
|
||||||
outMonthPlanAudit.setPurchaseValue(outMonthPlan.getPlanValue());
|
outMonthPlanAudit.setPurchaseValue(outMonthPlan.getPlanValue());
|
||||||
|
purchaseValue = outMonthPlan.getPlanValue();
|
||||||
}
|
}
|
||||||
if(outMonthPlan.getValueType().equals("3")){
|
if(outMonthPlan.getValueType().equals("3")){
|
||||||
outMonthPlanAudit.setConstructionValue(outMonthPlan.getPlanValue());
|
outMonthPlanAudit.setConstructionValue(outMonthPlan.getPlanValue());
|
||||||
|
constructionValue = outMonthPlan.getPlanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
outMonthPlanAudit.setTotalValue(outMonthPlanAudit.getDesignValue().add(outMonthPlanAudit.getPurchaseValue()).add(outMonthPlanAudit.getConstructionValue()));
|
outMonthPlanAudit.setTotalValue(designValue.add(purchaseValue).add(constructionValue));
|
||||||
return outMonthPlanAudit;
|
return outMonthPlanAudit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user