Ver código fonte

营销政策修改

ZHOUTD 1 semana atrás
pai
commit
82dc7a326e

+ 9 - 2
ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/service/policy/PolicyServiceImpl.java

@@ -156,6 +156,12 @@ public class PolicyServiceImpl implements PolicyService {
     public List<PolicyRespVO> getUsablePolicyByVoyageId(Long voyageId, Long orderId) {
         List<OrderPolicyDTO> orderPolicyList = tradeApi.getOrderPolicyList(orderId);
         List<Long> orderPolicyIds = CollectionUtils.convertList(orderPolicyList, OrderPolicyDTO::getPolicyId);
+        Map<Long, BigDecimal> orderPolicyUseNumMap = orderPolicyList.stream()
+                .filter(item -> item.getPolicyId() != null)
+                .collect(Collectors.toMap(OrderPolicyDTO::getPolicyId,
+                        item -> item.getPreUseNum() != null ? item.getPreUseNum()
+                                : Optional.ofNullable(item.getRealUseNum()).orElse(BigDecimal.ZERO),
+                        BigDecimal::add));
         VoyageDO voyage = voyageService.getVoyage(voyageId);
         LocalDateTime boardingTime = voyage.getBoardingTime();
         List<PolicyDetailDO> policyDetails = policyDetailMapper.selectListByVoyageId(voyageId);
@@ -179,7 +185,8 @@ public class PolicyServiceImpl implements PolicyService {
                 List<Integer> countryIds = CollectionUtils.convertList(areaCountryListByAreaIds, AreaCountryDTO::getCountryId);
                 policyRespVO.setCountryIds(countryIds);
                 policyRespVO.setRoomModelIds(policyDetailDO.getRoomModelIds());
-                policyRespVO.setSurplusNum(policyDetailDO.getSurplusNum());
+                policyRespVO.setSurplusNum(policyDetailDO.getSurplusNum().add(
+                        orderPolicyUseNumMap.getOrDefault(policyRespVO.getId(), BigDecimal.ZERO)));
             }
             if(Objects.equals(policyRespVO.getStatus(), CommonStatusEnum.DISABLE.getStatus())) {
                 policyRespVO.setCanAddRoom(false);
@@ -207,4 +214,4 @@ public class PolicyServiceImpl implements PolicyService {
         return policyMapper.selectList(policyIds);
     }
 
-}
+}

+ 3 - 1
ship-module-trade/ship-module-trade-biz/src/main/java/com/yc/ship/module/trade/service/otc/impl/OtcTradeOrderServiceImpl.java

@@ -2795,7 +2795,9 @@ public class OtcTradeOrderServiceImpl implements OtcTradeOrderService {
             //减去优惠金额
             shipTradeOrderCreateReqVO.setPayAmount(realAmount);
             shipTradeOrderCreateReqVO.setFreeAmount(freeAmount);
-            if (createVO.getSummary().getDeposi() != null && shipTradeOrderCreateReqVO.getDeposi().compareTo(tradeOrderDO.getDeposi())!=0) {
+            BigDecimal oldOrderDeposi = ObjectUtil.defaultIfNull(tradeOrderDO.getDeposi(), BigDecimal.ZERO);
+            if (createVO.getSummary().getDeposi() != null
+                    && shipTradeOrderCreateReqVO.getDeposi().compareTo(oldOrderDeposi) != 0) {
                 // 判断定金金额是否发生变化,记录变更日志
                 shipTradeOrderCreateReqVO.setDeposiStatus(1);
             }