Commit dafc9e24e1e005b9e79c923943f0dbded49977f9

Authored by 曾国涛
1 parent bf0a4447

feat(module): 添加机票类型原价字段并更新相关逻辑

- 在 TickeyTypeVO 中添加 originPrice 字段,用于存储机票类型原价
- 更新 ProductServiceImpl 中的计算逻辑,计算并设置 originPrice
- 修改 application.yml,将 active profile 从 test 改为 prod
shop/src/main/java/com/canrd/shop/module/vo/TickeyTypeVO.java
... ... @@ -32,6 +32,8 @@ public class TickeyTypeVO {
32 32 */
33 33 private BigDecimal price;
34 34  
  35 + private BigDecimal originPrice;
  36 +
35 37 @Setter
36 38 private Boolean priceShow;
37 39  
... ...
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 }
... ...
shop/src/main/resources/application.yml
... ... @@ -3,7 +3,7 @@ server:
3 3  
4 4 spring:
5 5 profiles:
6   - active: test
  6 + active: prod
7 7 mvc:
8 8 throw-exception-if-no-handler-found: true
9 9 resources:
... ...