张江鸿 7 years ago
parent
commit
3b6b94a235

+ 29 - 9
src/main/java/com/bjlt/spider/qunaer/cotroller/QunaerSearchAndVerifyController.java

@@ -2,21 +2,19 @@ package com.bjlt.spider.qunaer.cotroller;
 
 import com.alibaba.fastjson.JSONObject;
 import com.bjlt.spider.common.MethedNames;
-import com.bjlt.spider.taobao.entity.TaobaoRouting;
-import com.bjlt.spider.util.UUIDUtils;
-import com.bjlt.spider.utils.LoadParam;
+import com.bjlt.spider.entity.PlatformSourceVo;
 import com.bjlt.spider.qunaer.entity.*;
 import com.bjlt.spider.qunaer.service.QunaerService;
-import com.bjlt.spider.utils.RestTemplateUtils;
+import com.bjlt.spider.util.RedisPrefix;
+import com.bjlt.spider.util.UUIDUtils;
+import com.bjlt.spider.utils.LoadParam;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -63,15 +61,37 @@ public class QunaerSearchAndVerifyController {
         if (childNum == null) {
             childNum = 0;
         }
-
+        if (adultNum == null){
+            adultNum = 0;
+        }
         if (tripType.equals("2") && StringUtils.isBlank(retDate)) {
             return QunaerSearchRespEntity.error("参数错误");
         }
+        Integer passengerCount = new Integer(0);
+
+
+        //拿到默认人数
+        //TODO 大 BUG
+        PlatformSourceVo vo = (PlatformSourceVo) redisTemplate.opsForValue().get(RedisPrefix.AIRSOURCEPLATFORM.getPrefix()+cid+"1");
+
+        Integer defultCount = null;
+        if (vo != null){
+            defultCount = vo.getPassengerCount();
+        }else {
+            defultCount = 3;
+        }
+
+
+        if (adultNum +childNum <= defultCount){
+            passengerCount = defultCount;
+        }else {
+            passengerCount = adultNum +childNum;
+        }
 
 
         QunaerSearchParams params = QunaerSearchParams.builder()
-                .adultNum(adultNum)
-                .childNum(childNum)
+                .adultNum(passengerCount)
+                .childNum(0)
                 .cid(cid)
                 .fromCity(fromCity)
                 .retDate(retDate)