luofeiyun 1 тиждень тому
батько
коміт
a4fc073daa
10 змінених файлів з 114 додано та 103 видалено
  1. 5 2
      ship-module-marketing/ship-module-marketing-api/src/main/java/com/yc/ship/module/marketing/api/policy/PolicyApi.java
  2. 11 11
      ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/api/policy/PolicyApiImpl.java
  3. 22 40
      ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/controller/admin/policy/PolicyController.java
  4. 6 4
      ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/dal/dataobject/policy/PolicyDO.java
  5. 8 2
      ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/dal/dataobject/policydetail/PolicyDetailDO.java
  6. 0 1
      ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/dal/mysql/policy/PolicyMapper.java
  7. 11 14
      ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/dal/mysql/policydetail/PolicyDetailMapper.java
  8. 2 2
      ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/service/policy/PolicyService.java
  9. 47 25
      ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/service/policy/PolicyServiceImpl.java
  10. 2 2
      ship-module-trade/ship-module-trade-biz/src/main/java/com/yc/ship/module/trade/service/otc/impl/OtcTradeOrderServiceImpl.java

+ 5 - 2
ship-module-marketing/ship-module-marketing-api/src/main/java/com/yc/ship/module/marketing/api/policy/PolicyApi.java

@@ -8,15 +8,18 @@ public interface PolicyApi {
      * 减剩余优惠数量
      *
      * @param policyId 政策ID
+     * @param voyageId 航次ID
      * @param num 使用了的数量
      */
-    void updatePolicySurplusNum(Long policyId, BigDecimal num);
+    void updatePolicySurplusNum(Long policyId, Long voyageId, BigDecimal num);
 
     /**
      * 检查优惠券剩余数量
      *
      * @param policyId 政策ID
+     * @param voyageId 航次ID
+     * @param num 使用数量
      * @return true-剩余数量充足
      */
-    Boolean checkPolicySurplusNum(Long policyId, BigDecimal num);
+    Boolean checkPolicySurplusNum(Long policyId,Long voyageId, BigDecimal num);
 }

+ 11 - 11
ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/api/policy/PolicyApiImpl.java

@@ -1,7 +1,7 @@
 package com.yc.ship.module.marketing.api.policy;
 
-import com.yc.ship.module.marketing.dal.dataobject.policy.PolicyDO;
-import com.yc.ship.module.marketing.dal.mysql.policy.PolicyMapper;
+import com.yc.ship.module.marketing.dal.dataobject.policydetail.PolicyDetailDO;
+import com.yc.ship.module.marketing.dal.mysql.policydetail.PolicyDetailMapper;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -14,21 +14,21 @@ import static com.yc.ship.module.marketing.enums.ErrorCodeConstants.POLICY_OVER_
 public class PolicyApiImpl implements PolicyApi{
 
     @Resource
-    private PolicyMapper policyMapper;
+    private PolicyDetailMapper policyDetailMapper;
     @Override
-    public void updatePolicySurplusNum(Long policyId, BigDecimal num) {
-        PolicyDO policyDO = policyMapper.selectById(policyId);
-        if(policyDO.getSurplusNum().compareTo(num) < 0) {
+    public void updatePolicySurplusNum(Long policyId, Long voyageId, BigDecimal num) {
+        PolicyDetailDO policyDetailDO = policyDetailMapper.selectByPolicyIdAndVoyageId(policyId, voyageId);
+        if(policyDetailDO.getSurplusNum().compareTo(num) < 0) {
             throw exception(POLICY_OVER_NUM);
         }
-        policyDO.setSurplusNum(policyDO.getSurplusNum().subtract(num));
-        policyMapper.updateById(policyDO);
+        policyDetailDO.setSurplusNum(policyDetailDO.getSurplusNum().subtract(num));
+        policyDetailMapper.updateById(policyDetailDO);
     }
 
     @Override
-    public Boolean checkPolicySurplusNum(Long policyId, BigDecimal num) {
-        PolicyDO policyDO = policyMapper.selectById(policyId);
-        if(policyDO.getSurplusNum().compareTo(num) < 0) {
+    public Boolean checkPolicySurplusNum(Long policyId, Long voyageId, BigDecimal num) {
+        PolicyDetailDO policyDetailDO = policyDetailMapper.selectByPolicyIdAndVoyageId(policyId, voyageId);
+        if(policyDetailDO.getSurplusNum().compareTo(num) < 0) {
             return false;
         }
         return true;

+ 22 - 40
ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/controller/admin/policy/PolicyController.java

@@ -22,6 +22,7 @@ import javax.validation.*;
 import javax.servlet.http.*;
 import java.util.*;
 import java.io.IOException;
+import java.util.stream.Collectors;
 
 import com.yc.ship.framework.common.pojo.PageParam;
 import com.yc.ship.framework.common.pojo.PageResult;
@@ -90,8 +91,6 @@ public class PolicyController {
         List<PolicyDetailDO> policyDetails = policyDetailService.getByPolicyId(id);
         Set<Long> voyageIds = CollectionUtils.convertSet(policyDetails, PolicyDetailDO::getVoyageId);
         policyRespVO.setVoyageIds(new ArrayList<>(voyageIds));
-        Set<Long> rooModelIds = CollectionUtils.convertSet(policyDetails, PolicyDetailDO::getRoomModelId);
-        policyRespVO.setRoomModelIds(new ArrayList<>(rooModelIds));
         return success(policyRespVO);
     }
 
@@ -117,50 +116,33 @@ public class PolicyController {
     @PostMapping("/get-usable-policy")
     @Operation(summary = "获取可以使用的营销政策")
     public CommonResult<List<PolicyRespVO>> getUsablePolicy(@Validated @RequestBody PolicyUsableReqVO reqVO) {
-        List<PolicyDO> list = policyService.getUsablePolicy(reqVO);
-        List<PolicyRespVO> result = BeanUtils.toBean(list, PolicyRespVO.class);
-        result.stream().forEach(policyRespVO -> {
-            List<Long> areaIds = policyRespVO.getAreaIds();
-            List<AreaCountryDTO> areaCountryDTOS = areaApi.getAreaCountryListByAreaIds(areaIds);
-            List<Integer> countryIds = CollectionUtils.convertList(areaCountryDTOS, AreaCountryDTO::getCountryId);
-            policyRespVO.setCountryIds(countryIds);
-        });
-        List<Long> policyIds = CollectionUtils.convertList(list, PolicyDO::getId);
-        List<PolicyDetailDO> policyDetails = policyDetailService.getByPolicyIds(policyIds);
-        Map<Long, List<PolicyDetailDO>> longListMap = CollectionUtils.convertMultiMap(policyDetails, PolicyDetailDO::getPolicyId);
-        result.stream().forEach(policyRespVO -> {
-            List<PolicyDetailDO> policyDetailDOList = longListMap.get(policyRespVO.getId());
-            List<Long> voyageIds = CollectionUtils.convertList(policyDetailDOList, PolicyDetailDO::getVoyageId);
-            policyRespVO.setVoyageIds(voyageIds);
-            List<Long> roomModelIds = CollectionUtils.convertList(policyDetailDOList, PolicyDetailDO::getRoomModelId);
-            policyRespVO.setRoomModelIds(roomModelIds);
-        });
-        return success(result);
+        List<PolicyRespVO> list = policyService.getUsablePolicy(reqVO);
+        return success(list);
     }
 
     // 获取可以使用的营销政策
     @GetMapping("/get-usable-policy-new")
     @Operation(summary = "获取可以使用的营销政策")
     public CommonResult<List<PolicyRespVO>> getUsablePolicyNew(Long voyageId) {
-        List<PolicyDO> list = policyService.getUsablePolicyByVoyageId(voyageId);
-        List<PolicyRespVO> result = BeanUtils.toBean(list, PolicyRespVO.class);
-        result.stream().forEach(policyRespVO -> {
-            List<Long> areaIds = policyRespVO.getAreaIds();
-            List<AreaCountryDTO> areaCountryDTOS = areaApi.getAreaCountryListByAreaIds(areaIds);
-            List<Integer> countryIds = CollectionUtils.convertList(areaCountryDTOS, AreaCountryDTO::getCountryId);
-            policyRespVO.setCountryIds(countryIds);
-        });
-        List<Long> policyIds = CollectionUtils.convertList(list, PolicyDO::getId);
-        List<PolicyDetailDO> policyDetails = policyDetailService.getByPolicyIds(policyIds);
-        Map<Long, List<PolicyDetailDO>> longListMap = CollectionUtils.convertMultiMap(policyDetails, PolicyDetailDO::getPolicyId);
-        result.stream().forEach(policyRespVO -> {
-            List<PolicyDetailDO> policyDetailDOList = longListMap.get(policyRespVO.getId());
-            List<Long> voyageIds = CollectionUtils.convertList(policyDetailDOList, PolicyDetailDO::getVoyageId);
-            policyRespVO.setVoyageIds(voyageIds);
-            List<Long> roomModelIds = CollectionUtils.convertList(policyDetailDOList, PolicyDetailDO::getRoomModelId);
-            policyRespVO.setRoomModelIds(roomModelIds);
-        });
-        return success(result);
+        List<PolicyRespVO> list = policyService.getUsablePolicyByVoyageId(voyageId);
+//        List<PolicyRespVO> result = BeanUtils.toBean(list, PolicyRespVO.class);
+//        result.stream().forEach(policyRespVO -> {
+//            List<Long> areaIds = policyRespVO.getAreaIds();
+//            List<AreaCountryDTO> areaCountryDTOS = areaApi.getAreaCountryListByAreaIds(areaIds);
+//            List<Integer> countryIds = CollectionUtils.convertList(areaCountryDTOS, AreaCountryDTO::getCountryId);
+//            policyRespVO.setCountryIds(countryIds);
+//        });
+//        List<Long> policyIds = CollectionUtils.convertList(list, PolicyDO::getId);
+//        List<PolicyDetailDO> policyDetails = policyDetailService.getByPolicyIds(policyIds);
+//        Map<Long, List<PolicyDetailDO>> longListMap = CollectionUtils.convertMultiMap(policyDetails, PolicyDetailDO::getPolicyId);
+//        result.stream().forEach(policyRespVO -> {
+//            List<PolicyDetailDO> policyDetailDOList = longListMap.get(policyRespVO.getId());
+//            List<Long> voyageIds = CollectionUtils.convertList(policyDetailDOList, PolicyDetailDO::getVoyageId);
+//            policyRespVO.setVoyageIds(voyageIds);
+//            List<Long> roomModelIds = CollectionUtils.convertList(policyDetailDOList, PolicyDetailDO::getRoomModelIds).stream().flatMap(List::stream).collect(Collectors.toList());
+//            policyRespVO.setRoomModelIds(roomModelIds);
+//        });
+        return success(list);
     }
 
     @GetMapping("/export-excel")

+ 6 - 4
ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/dal/dataobject/policy/PolicyDO.java

@@ -48,10 +48,6 @@ public class PolicyDO extends TenantBaseDO {
      * 优惠间数
      */
     private BigDecimal discountNum;
-    /**
-     * 剩余优惠间数
-     */
-    private BigDecimal surplusNum;
     /**
      * 提前天数
      */
@@ -81,4 +77,10 @@ public class PolicyDO extends TenantBaseDO {
     @TableField(typeHandler = JacksonTypeHandler.class)
     private List<Long> areaIds;
 
+    /**
+     * 房型IDS
+     */
+    @TableField(typeHandler = JacksonTypeHandler.class)
+    private List<Long> roomModelIds;
+
 }

+ 8 - 2
ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/dal/dataobject/policydetail/PolicyDetailDO.java

@@ -3,6 +3,8 @@ package com.yc.ship.module.marketing.dal.dataobject.policydetail;
 import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
 import com.yc.ship.framework.tenant.core.db.TenantBaseDO;
 import lombok.*;
+
+import java.math.BigDecimal;
 import java.util.*;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
@@ -42,13 +44,17 @@ public class PolicyDetailDO extends TenantBaseDO {
      */
     private Long voyageId;
     /**
-     * 房型ID
+     * 剩余优惠间数
      */
-    private Long roomModelId;
+    private BigDecimal surplusNum;
     /**
      * 区域IDS
      */
     @TableField(typeHandler = JacksonTypeHandler.class)
     private List<Long> areaIds;
+    /**
+     * 房型IDS
+     */
+    private List<Long> roomModelIds;
 
 }

+ 0 - 1
ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/dal/mysql/policy/PolicyMapper.java

@@ -32,7 +32,6 @@ public interface PolicyMapper extends BaseMapperX<PolicyDO> {
         return selectList(new LambdaQueryWrapperX<PolicyDO>()
                 .inIfPresent(PolicyDO::getId, policyIds)
                 .ge(PolicyDO::getEffectiveTime, LocalDateTime.now())
-                .gt(PolicyDO::getSurplusNum, BigDecimal.ZERO)
                 .eq(PolicyDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
     }
 }

+ 11 - 14
ship-module-marketing/ship-module-marketing-biz/src/main/java/com/yc/ship/module/marketing/dal/mysql/policydetail/PolicyDetailMapper.java

@@ -1,5 +1,6 @@
 package com.yc.ship.module.marketing.dal.mysql.policydetail;
 
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.*;
 
@@ -34,23 +35,19 @@ public interface PolicyDetailMapper extends BaseMapperX<PolicyDetailDO> {
         return selectList(new LambdaQueryWrapperX<PolicyDetailDO>().eq(PolicyDetailDO::getPolicyId, policyId));
     }
 
-    /**
-     * 获取可以使用的政策详情
-     * @param voyageId 航次ID
-     * @param roomModelIds 房型ID
-     * @return
-     */
-    default List<PolicyDetailDO> selectList(Long voyageId, List<Long> roomModelIds) {
-        return selectList(new LambdaQueryWrapperX<PolicyDetailDO>()
-                .eq(PolicyDetailDO::getVoyageId, voyageId)
-                .in(PolicyDetailDO::getRoomModelId, roomModelIds));
-    }
-
     default List<PolicyDetailDO> selectByPolicyIds(List<Long> policyIds) {
-        return selectList(new LambdaQueryWrapperX<PolicyDetailDO>().in(PolicyDetailDO::getPolicyId, policyIds));
+        return selectList(new LambdaQueryWrapperX<PolicyDetailDO>().in(PolicyDetailDO::getPolicyId, policyIds)
+                .gt(PolicyDetailDO::getSurplusNum, BigDecimal.ZERO));
     }
 
     default List<PolicyDetailDO> selectListByVoyageId(Long voyageId) {
-        return selectList(new LambdaQueryWrapperX<PolicyDetailDO>().eq(PolicyDetailDO::getVoyageId, voyageId));
+        return selectList(new LambdaQueryWrapperX<PolicyDetailDO>().eq(PolicyDetailDO::getVoyageId, voyageId)
+                .gt(PolicyDetailDO::getSurplusNum, BigDecimal.ZERO));
+    }
+
+    default PolicyDetailDO selectByPolicyIdAndVoyageId(Long policyId, Long voyageId) {
+        return selectOne(new LambdaQueryWrapperX<PolicyDetailDO>()
+                .eq(PolicyDetailDO::getPolicyId, policyId)
+                .eq(PolicyDetailDO::getVoyageId, voyageId));
     }
 }

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

@@ -57,12 +57,12 @@ public interface PolicyService {
      * @param reqVO
      * @return
      */
-    List<PolicyDO> getUsablePolicy(PolicyUsableReqVO reqVO);
+    List<PolicyRespVO> getUsablePolicy(PolicyUsableReqVO reqVO);
 
     /**
      * 根据航次ID获取可以使用的营销政策
      * @param voyageId
      * @return
      */
-    List<PolicyDO> getUsablePolicyByVoyageId(Long voyageId);
+    List<PolicyRespVO> getUsablePolicyByVoyageId(Long voyageId);
 }

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

@@ -12,6 +12,7 @@ import javax.annotation.Resource;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -48,7 +49,6 @@ public class PolicyServiceImpl implements PolicyService {
     public Long createPolicy(PolicySaveReqVO createReqVO) {
         // 插入
         PolicyDO policy = BeanUtils.toBean(createReqVO, PolicyDO.class);
-        policy.setSurplusNum(createReqVO.getDiscountNum());
         policyMapper.insert(policy);
         handlePolicyDetail(policy.getId(), createReqVO);
         // 返回
@@ -76,17 +76,17 @@ public class PolicyServiceImpl implements PolicyService {
         List<Long> voyageIds = reqVO.getVoyageIds();
         List<Long> roomModelIds = reqVO.getRoomModelIds();
         List<Long> areaIds = reqVO.getAreaIds();
+        BigDecimal discountNum = reqVO.getDiscountNum();
         List<PolicyDetailDO> policyDetailDOList = new ArrayList<>();
         voyageIds.stream().forEach(voyageId -> {
-            roomModelIds.stream().forEach(roomModelId -> {
-                PolicyDetailDO policyDetailDO = new PolicyDetailDO();
-                policyDetailDO.setShipId(reqVO.getShipId());
-                policyDetailDO.setPolicyId(policyId);
-                policyDetailDO.setVoyageId(voyageId);
-                policyDetailDO.setRoomModelId(roomModelId);
-                policyDetailDO.setAreaIds(areaIds);
-                policyDetailDOList.add(policyDetailDO);
-            });
+            PolicyDetailDO policyDetailDO = new PolicyDetailDO();
+            policyDetailDO.setShipId(reqVO.getShipId());
+            policyDetailDO.setPolicyId(policyId);
+            policyDetailDO.setVoyageId(voyageId);
+            policyDetailDO.setRoomModelIds(roomModelIds);
+            policyDetailDO.setAreaIds(areaIds);
+            policyDetailDO.setSurplusNum(discountNum);
+            policyDetailDOList.add(policyDetailDO);
         });
         if(policyDetailDOList.size() > 0) {
             policyDetailMapper.insertBatch(policyDetailDOList);
@@ -105,23 +105,25 @@ public class PolicyServiceImpl implements PolicyService {
     }
 
     @Override
-    public List<PolicyDO> getUsablePolicy(PolicyUsableReqVO reqVO) {
+    public List<PolicyRespVO> getUsablePolicy(PolicyUsableReqVO reqVO) {
         //获取区域列表
         List<Long> countryIds = reqVO.getCountryIds();
         List<AreaCountryDTO> areaCountryDTOS = areaApi.getAreaCountryListByCountryIds(countryIds);
         Set<Long> areaIds = CollectionUtils.convertSet(areaCountryDTOS, AreaCountryDTO::getAreaId);
+        List<Long> roomModelIds = reqVO.getRoomModelIds();
         VoyageDO voyage = voyageService.getVoyage(reqVO.getVoyageId());
-        List<PolicyDetailDO> policyDetails = policyDetailMapper.selectList(reqVO.getVoyageId(), reqVO.getRoomModelIds());
-        List<PolicyDetailDO> policyDetailDOList = new ArrayList<>();
-        policyDetails.stream().forEach(policyDetailDO -> {
-           areaIds.stream().forEach(areaId -> {
-               if(policyDetailDO.getAreaIds() != null && policyDetailDO.getAreaIds().contains(areaId)) {
-                   policyDetailDOList.add(policyDetailDO);
-                   return;
-               }
-           });
-        });
-        List<Long> policyIds = CollectionUtils.convertList(policyDetailDOList, PolicyDetailDO::getPolicyId);
+        List<PolicyDetailDO> policyDetails = policyDetailMapper.selectListByVoyageId(reqVO.getVoyageId());
+        List<PolicyDetailDO> filterPolicyDetails = policyDetails.stream().filter(policyDetailDO -> {
+            List<Long> areaIds1 = policyDetailDO.getAreaIds();
+            List<Long> roomModelIds1 = policyDetailDO.getRoomModelIds();
+            if(CollectionUtils.isAnyEmpty(areaIds1) || CollectionUtils.isAnyEmpty(roomModelIds1)) {
+                return false;
+            }else {
+                return areaIds1.stream().anyMatch(areaIds::contains) && roomModelIds1.stream().anyMatch(roomModelIds::contains);
+            }
+        }).collect(Collectors.toList());
+
+        List<Long> policyIds = CollectionUtils.convertList(filterPolicyDetails, PolicyDetailDO::getPolicyId);
         if(CollectionUtils.isAnyEmpty(policyIds)) {
             return Collections.emptyList();
         }
@@ -130,11 +132,21 @@ public class PolicyServiceImpl implements PolicyService {
             LocalDateTime boardingTime = voyage.getBoardingTime();
             return boardingTime.plusDays(policyDO.getEarlyDays() * -1L).compareTo(LocalDateTime.now()) > 0;
         }).collect(Collectors.toList());
-        return result;
+        List<PolicyRespVO> policyRespVOS = BeanUtils.toBean(result, PolicyRespVO.class);
+        Map<Long, PolicyDetailDO> policyDetailDOMap = CollectionUtils.convertMap(filterPolicyDetails, PolicyDetailDO::getPolicyId);
+        policyRespVOS.stream().forEach(policyRespVO -> {
+            PolicyDetailDO policyDetailDO = policyDetailDOMap.get(policyRespVO.getId());
+            if(policyDetailDO != null) {
+                policyRespVO.setAreaIds(policyDetailDO.getAreaIds());
+                policyRespVO.setRoomModelIds(policyDetailDO.getRoomModelIds());
+                policyRespVO.setSurplusNum(policyDetailDO.getSurplusNum());
+            }
+        });
+        return policyRespVOS;
     }
 
     @Override
-    public List<PolicyDO> getUsablePolicyByVoyageId(Long voyageId) {
+    public List<PolicyRespVO> getUsablePolicyByVoyageId(Long voyageId) {
         VoyageDO voyage = voyageService.getVoyage(voyageId);
         List<PolicyDetailDO> policyDetails = policyDetailMapper.selectListByVoyageId(voyageId);
         List<Long> policyIds = CollectionUtils.convertList(policyDetails, PolicyDetailDO::getPolicyId);
@@ -146,7 +158,17 @@ public class PolicyServiceImpl implements PolicyService {
             LocalDateTime boardingTime = voyage.getBoardingTime();
             return boardingTime.plusDays(policyDO.getEarlyDays() * -1L).compareTo(LocalDateTime.now()) > 0;
         }).collect(Collectors.toList());
-        return result;
+        List<PolicyRespVO> policyRespVOS = BeanUtils.toBean(result, PolicyRespVO.class);
+        Map<Long, PolicyDetailDO> policyDetailDOMap = CollectionUtils.convertMap(policyDetails, PolicyDetailDO::getPolicyId);
+        policyRespVOS.stream().forEach(policyRespVO -> {
+            PolicyDetailDO policyDetailDO = policyDetailDOMap.get(policyRespVO.getId());
+            if(policyDetailDO != null) {
+                policyRespVO.setAreaIds(policyDetailDO.getAreaIds());
+                policyRespVO.setRoomModelIds(policyDetailDO.getRoomModelIds());
+                policyRespVO.setSurplusNum(policyDetailDO.getSurplusNum());
+            }
+        });
+        return policyRespVOS;
     }
 
 }

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

@@ -1542,7 +1542,7 @@ public class OtcTradeOrderServiceImpl implements OtcTradeOrderService {
                         //TODO: 需要修改订单金额,参考文档
                         orderPolicyDO.setPreUseNum(BigDecimal.ZERO);
                         orderPolicyDO.setRealUseNum(policy.getUseNum());
-                        policyApi.updatePolicySurplusNum(policy.getPolicyId(), policy.getUseNum());
+                        policyApi.updatePolicySurplusNum(policy.getPolicyId(), createVO.getVoyageId(), policy.getUseNum());
                     }
                     orderPolicyDO.setAmount(policy.getAmount());
                     orderPolicyDO.setRooms(policy.getRooms());
@@ -1853,7 +1853,7 @@ public class OtcTradeOrderServiceImpl implements OtcTradeOrderService {
                     if (tradeOrderDO.getOrderStatus() == TradeOrderStatusEnum.UNPAID.getStatus() || tradeOrderDO.getOrderStatus() == TradeOrderStatusEnum.UNPAID.getStatus()) {
                         orderPolicyDO.setRealUseNum(policy.getUseNum());
                         orderPolicyDO.setPreUseNum(BigDecimal.ZERO);
-                        policyApi.updatePolicySurplusNum(policy.getPolicyId(), policy.getUseNum());
+                        policyApi.updatePolicySurplusNum(policy.getPolicyId(), createVO.getVoyageId(), policy.getUseNum());
                         //TODO: 需要修改订单金额,参考文档
                     } else {
                         orderPolicyDO.setRealUseNum(BigDecimal.ZERO);