Ver código fonte

定向包 参数不限参数设置

zhaoxian 4 anos atrás
pai
commit
8e9d40e0fb

+ 15 - 12
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouDirectionalPackageServiceImpl.java

@@ -190,7 +190,7 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
                 param.put("template_name", requestJson.getString("templateName"));
             }
             JSONObject targetJson = new JSONObject();
-            if (!Check.isNull(requestJson.getJSONArray("region"))) {
+            if (requestJson.getJSONArray("region")!=null) {
                 targetJson.put("region", requestJson.getJSONArray("region"));
             }
             if (!Check.isNull(requestJson.getJSONArray("districtIds"))) {
@@ -199,11 +199,13 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
             if (!Check.isNull(requestJson.getInteger("userType"))) {
                 targetJson.put("user_type", requestJson.getInteger("userType"));
             }
-            if (!Check.isNull(requestJson.getJSONArray("agesRange"))) {
-                targetJson.put("ages_range", requestJson.getJSONArray("agesRange"));
+            JSONArray agesRange = requestJson.getJSONArray("agesRange");
+            if (!Check.isNull(agesRange)) {
+                targetJson.put("ages_range", agesRange);
             }
-
-            if (!Check.isNull(requestJson.getInteger("min")) && !Check.isNull(requestJson.getInteger("max"))) {
+            Integer min = requestJson.getInteger("min");
+            Integer max = requestJson.getInteger("max");
+            if (!Check.isNull(min) && !Check.isNull(max) && max != -1 && min != -1) {
                 JSONObject ageJson = new JSONObject();
                 ageJson.put("min", requestJson.getInteger("min"));
                 ageJson.put("max", requestJson.getInteger("max"));
@@ -228,10 +230,10 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
             if (!Check.isNull(requestJson.getInteger("filterConvertedLevel"))) {
                 targetJson.put("filter_converted_level", requestJson.getInteger("filterConvertedLevel"));
             }
-            if (!Check.isNull(requestJson.getJSONArray("deviceBrand"))) {
+            if (requestJson.getJSONArray("deviceBrand")!=null) {
                 targetJson.put("device_brand", requestJson.getJSONArray("deviceBrand"));
             }
-            if (!Check.isNull(requestJson.getJSONArray("devicePrice"))) {
+            if (requestJson.getJSONArray("devicePrice")!=null) {
                 targetJson.put("device_price", requestJson.getJSONArray("devicePrice"));
             }
             if (!Check.isNull(requestJson.getInteger("businessInterestType"))) {
@@ -330,7 +332,6 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
         }
     }
 
-
     @Override
     public Result<Object> queryList(KuaishouDirectionalPackage directionalPackage, Integer pageNo, Integer pageSize) {
         Long total = packageMapper.queryListTotal(directionalPackage);
@@ -384,7 +385,7 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
             param.put("advertiser_id", accountId);
             param.put("template_name", data.getString("templateName"));
             JSONObject targetJson = new JSONObject();
-            if (!Check.isNull(data.getJSONArray("region"))) {
+            if (data.getJSONArray("region")!=null) {
                 targetJson.put("region", data.getJSONArray("region"));
             }
             if (!Check.isNull(data.getJSONArray("districtIds"))) {
@@ -397,7 +398,9 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
                 targetJson.put("ages_range", data.getJSONArray("agesRange"));
             }
 
-            if (!Check.isNull(data.getInteger("min")) && !Check.isNull(data.getInteger("max"))) {
+            Integer min = data.getInteger("min");
+            Integer max = data.getInteger("max");
+            if (!Check.isNull(min) && !Check.isNull(max) && max != -1 && min != -1) {
                 JSONObject ageJson = new JSONObject();
                 ageJson.put("min", data.getInteger("min"));
                 ageJson.put("max", data.getInteger("max"));
@@ -422,10 +425,10 @@ public class KuaishouDirectionalPackageServiceImpl extends ServiceImpl<KuaishouD
             if (!Check.isNull(data.getInteger("filterConvertedLevel"))) {
                 targetJson.put("filter_converted_level", data.getInteger("filterConvertedLevel"));
             }
-            if (!Check.isNull(data.getJSONArray("deviceBrand"))) {
+            if (data.getJSONArray("deviceBrand")!=null) {
                 targetJson.put("device_brand", data.getJSONArray("deviceBrand"));
             }
-            if (!Check.isNull(data.getJSONArray("devicePrice"))) {
+            if (data.getJSONArray("devicePrice")!=null) {
                 targetJson.put("device_price", data.getJSONArray("devicePrice"));
             }
             if (!Check.isNull(data.getInteger("businessInterestType"))) {