refactor(sip): 移除产品价格计算代码

- 删除了 ProjectProductInfoServiceImpl 类中的价格计算逻辑
- 保留了产品编码验证逻辑
- 此修改可能会影响前端的价格显示,需要确认是否保留后端计算逻辑
master
chenhao 2025-07-07 10:18:02 +08:00
parent eda7c8e286
commit d030f05826
1 changed files with 13 additions and 13 deletions

View File

@ -124,19 +124,19 @@ public class ProjectProductInfoServiceImpl implements IProjectProductInfoService
if (stringJoiner.length() > 0) {
throw new ServiceException(StringUtils.format("产品编码[{}]在产品库中未找到,请确认后重试", stringJoiner.toString()));
}
for (ProjectProductInfo info : list) {
//计算价格 防止前端价格计算错误
if (info.getGuidanceDiscount() != null && info.getDiscount() == null) {
info.setDiscount(info.getGuidanceDiscount());
}
if (info.getCataloguePrice() != null && info.getDiscount() != null) {
info.setPrice(info.getCataloguePrice().multiply(info.getDiscount()).setScale(2, RoundingMode.HALF_UP));
}
if (info.getPrice() != null && info.getQuantity() != null) {
BigDecimal allPrice = info.getPrice().multiply(new BigDecimal(info.getQuantity()));
info.setAllPrice(allPrice.setScale(2, RoundingMode.HALF_UP));
}
}
// for (ProjectProductInfo info : list) {
// //计算价格 防止前端价格计算错误
// if (info.getGuidanceDiscount() != null && info.getDiscount() == null) {
// info.setDiscount(info.getGuidanceDiscount());
// }
// if (info.getCataloguePrice() != null && info.getDiscount() != null) {
// info.setPrice(info.getCataloguePrice().multiply(info.getDiscount()).setScale(2, RoundingMode.HALF_UP));
// }
// if (info.getPrice() != null && info.getQuantity() != null) {
// BigDecimal allPrice = info.getPrice().multiply(new BigDecimal(info.getQuantity()));
// info.setAllPrice(allPrice.setScale(2, RoundingMode.HALF_UP));
// }
// }
List<ProjectProductInfo> projectProductInfos = projectProductInfoMapper.selectProjectProductInfoListByProjectId(Collections.singletonList(list.get(0).getProjectId()));
Set<Long> idSet = list.stream().map(ProjectProductInfo::getId).collect(Collectors.toSet());