Commit dafc9e24e1e005b9e79c923943f0dbded49977f9
1 parent
bf0a4447
feat(module): 添加机票类型原价字段并更新相关逻辑
- 在 TickeyTypeVO 中添加 originPrice 字段,用于存储机票类型原价 - 更新 ProductServiceImpl 中的计算逻辑,计算并设置 originPrice - 修改 application.yml,将 active profile 从 test 改为 prod
Showing
3 changed files
with
9 additions
and
3 deletions
shop/src/main/java/com/canrd/shop/module/vo/TickeyTypeVO.java
shop/src/main/java/com/canrd/shop/service/impl/ProductServiceImpl.java
... | ... | @@ -418,7 +418,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductDO> im |
418 | 418 | product.setOriginMinPrice(originMinPrice); |
419 | 419 | } |
420 | 420 | if (Objects.nonNull(pId3ttMaxPriceMap.get(product.getId()))){ |
421 | - BigDecimal originMaxPrice = pId2ttMinPriceMap.get(product.getId()) | |
421 | + BigDecimal originMaxPrice = pId3ttMaxPriceMap.get(product.getId()) | |
422 | 422 | .divide(new BigDecimal("0.7"), 2, RoundingMode.HALF_UP) |
423 | 423 | .divide(new BigDecimal("0.7"), 2, RoundingMode.HALF_UP) |
424 | 424 | .setScale(2, RoundingMode.HALF_UP); |
... | ... | @@ -522,11 +522,15 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductDO> im |
522 | 522 | if (price == null) { |
523 | 523 | return; |
524 | 524 | } |
525 | + BigDecimal originPrice = price | |
526 | + .divide(new BigDecimal("0.7"), 2, RoundingMode.HALF_UP) | |
527 | + .divide(new BigDecimal("0.7"), 2, RoundingMode.HALF_UP) | |
528 | + .setScale(2, RoundingMode.HALF_UP); | |
525 | 529 | BigDecimal computedPrice = price |
526 | 530 | .divide(new BigDecimal("0.7"), 2, RoundingMode.HALF_UP) |
527 | - .multiply(new BigDecimal("0.148")) | |
528 | 531 | .setScale(2, RoundingMode.HALF_UP); |
529 | 532 | tickeyTypeVO.setPrice(computedPrice); |
533 | + tickeyTypeVO.setOriginPrice(originPrice); | |
530 | 534 | tickeyTypeVO.setPriceUnit(PriceConstants.USD); |
531 | 535 | return; |
532 | 536 | } | ... | ... |