Browse Source

商机下载轮询,修改少循环一次问题。

will.chen 7 years ago
parent
commit
c6a00ede60

+ 9 - 8
src/main/java/com/uas/erp/schedular/publicinquiry/task/EnterInquiryTask.java

@@ -62,7 +62,7 @@ public class EnterInquiryTask {
             JSONObject json = JSONObject.parseObject(res);
             total = json.getInteger("totalElements");
             if(total > 30){
-                double length = Math.ceil(total / 30);
+                double length = Math.ceil(total / 30.0);
                 JSONArray jsonArray = json.getJSONArray("content");
                 executeDownload(jsonArray,String.valueOf(bsNameMap.get("BS_NAME")), String.valueOf(map.get("BD_NAME")));
                 for(int i = 2; i <= length; i++){
@@ -94,14 +94,15 @@ public class EnterInquiryTask {
             sb.append("if v_count = 0 then ");
             String code = jdbcTemplate.generateCode("businesschance",2);
             String needQty ="";
-            try {
-                needQty = json.getString("needQty");
-                if(needQty == null || "null".equals(needQty)){
-                    needQty = "";
-                }
-            } catch (Exception e) {
+            needQty = json.getString("needQty");
+            if(needQty == null || "null".equals(needQty)){
+                needQty = "";
+            }
+            String description = json.getString("prodTitle")+" "+ json.getString("cmpCode")+" ";
+            if(json.getString("spec") != null && !"null".equals(json.getString("spec")) && !"".equals(json.getString("spec"))){
+                description += json.getString("spec") +" ";
             }
-            String description = json.getString("prodTitle")+" "+ json.getString("cmpCode")+" "+json.getString("spec")+" "+json.getString("inbrand");
+            description += json.getString("inbrand");
             if(needQty != null && !"null".equals(needQty) && !"".equals(needQty)){
                 description += ",需求:"+needQty;
             }