Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

liuqiwen před 4 roky
rodič
revize
4777189ccb

+ 25 - 39
dgtis-modules/dgtis-modules-data/src/main/java/com/dgtis/data/api/CustomerApiController.java

@@ -4,14 +4,10 @@ import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.arronlong.httpclientutil.HttpClientUtil;
-import com.arronlong.httpclientutil.common.HttpConfig;
-import com.arronlong.httpclientutil.exception.HttpProcessException;
 import com.dgtis.common.core.utils.DateUtils;
 import com.dgtis.common.core.utils.StringUtils;
 import com.dgtis.common.core.utils.sql.EsJsonUtil;
 import com.dgtis.common.core.web.domain.AjaxResult;
-import com.dgtis.common.security.annotation.PreAuthorize;
 import org.apache.http.HttpEntity;
 import org.apache.http.entity.ContentType;
 import org.apache.http.nio.entity.NStringEntity;
@@ -22,15 +18,9 @@ import org.elasticsearch.client.RestClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
-import javax.annotation.Resource;
-import java.io.IOException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
 import java.util.*;
 
 /**
@@ -80,7 +70,8 @@ public class CustomerApiController {
             //处理保单查询条件
             List<String> customerIds = new ArrayList<String>();
             if(StringUtils.isNotEmpty(policybelong) || StringUtils.isNotEmpty(payS) || StringUtils.isNotEmpty(payE)
-                    || StringUtils.isNotEmpty(insuredAmountS) || StringUtils.isNotEmpty(insuredAmountE)){
+                    || StringUtils.isNotEmpty(insuredAmountS) || StringUtils.isNotEmpty(insuredAmountE)
+                    || StringUtils.isNotEmpty(productname) || StringUtils.isNotEmpty(fadate)){
                 customerIds = queryInsurancearrangement(policybelong,payS,payE,fadate,productname,insuredAmountS,insuredAmountE);
             }
 
@@ -125,33 +116,33 @@ public class CustomerApiController {
             }
 
             if(StringUtils.isNotEmpty(SCustID)){
-                builder.append("{\"wildcard\":{\"custid\":\"*"+SCustID+"*\"}},");//模糊匹配
+                builder.append("{\"wildcard\":{\"scustid\":\"*"+SCustID+"*\"}},");//模糊匹配
             }
             if(StringUtils.isNotEmpty(custtype)){
                 builder.append("{\"prefix\":{\"custtype\":\""+custtype+"\"}},");
             }
 
             if(StringUtils.isNotEmpty(beginBirthDay) && StringUtils.isNotEmpty(endBirthDay)){
-                builder.append("{\"range\":{\"birthday\":{\"gt\":\""+beginBirthDay+"\",\"lt\":\""+endBirthDay+"\"}}},");
+                builder.append("{\"range\":{\"birthday\":{\"gte\":\""+beginBirthDay+"\",\"lte\":\""+endBirthDay+"\"}}},");
             }else{
 
                 if(StringUtils.isNotEmpty(beginBirthDay)){
-                    builder.append("{\"range\":{\"birthday\":{\"gt\":\""+beginBirthDay+"\"}}},");
+                    builder.append("{\"range\":{\"birthday\":{\"gte\":\""+beginBirthDay+"\"}}},");
                 }
                 if(StringUtils.isNotEmpty(endBirthDay)){
-                    builder.append("{\"range\":{\"birthday\":{\"lt\":\""+endBirthDay+"\"}}},");
+                    builder.append("{\"range\":{\"birthday\":{\"lte\":\""+endBirthDay+"\"}}},");
                 }
             }
 
             if(StringUtils.isNotEmpty(PIncomeS) && StringUtils.isNotEmpty(PIncomeE)){
-                builder.append("{\"range\":{\"PIncome\":{\"gt\":\""+PIncomeS+"\",\"lt\":\""+PIncomeE+"\"}}},");
+                builder.append("{\"range\":{\"PIncome\":{\"gte\":\""+PIncomeS+"\",\"lte\":\""+PIncomeE+"\"}}},");
             }else{
 
                 if(StringUtils.isNotEmpty(PIncomeS)){
-                    builder.append("{\"range\":{\"PIncome\":{\"gt\":\""+PIncomeS+"\"}}},");
+                    builder.append("{\"range\":{\"PIncome\":{\"gte\":\""+PIncomeS+"\"}}},");
                 }
                 if(StringUtils.isNotEmpty(PIncomeE)){
-                    builder.append("{\"range\":{\"PIncome\":{\"lt\":\""+PIncomeE+"\"}}},");
+                    builder.append("{\"range\":{\"PIncome\":{\"lte\":\""+PIncomeE+"\"}}},");
                 }
             }
 
@@ -188,7 +179,7 @@ public class CustomerApiController {
                     || StringUtils.isNotEmpty(custclass) || StringUtils.isNotEmpty(sobirth) || StringUtils.isNotEmpty(SCustID)
                     || StringUtils.isNotEmpty(beginBirthDay) || StringUtils.isNotEmpty(endBirthDay) || StringUtils.isNotEmpty(education)
                     || StringUtils.isNotEmpty(PIncomeS) || StringUtils.isNotEmpty(PIncomeE) || StringUtils.isNotEmpty(gzgw)
-                    || StringUtils.isNotEmpty(zcgw)){
+                    || StringUtils.isNotEmpty(zcgw) || customerIds.size()>0){
                 builder.delete(builder.length()-1,builder.length());
             }
 
@@ -205,8 +196,9 @@ public class CustomerApiController {
 
             HttpEntity entity = new NStringEntity(builder.toString(), ContentType.APPLICATION_JSON);
 
-            Request scriptRequest = new Request("GET", "/shanglifeecif.individual/_search?q="+ URLEncoder.encode("\""+builder.toString()+"\""));
+            Request scriptRequest = new Request("GET", "/shanglifeecif.individual/_search");
 //            Request scriptRequest = new Request("GET", "/shanglifeecif.individual/_search?q=%22{%22query%22:{%22bool%22:{%22must%22:[],%22must_not%22:[],%22should%22:[]}},%22from%22:11,%22size%22:10,%22sort%22:[{%22created_time%22:{%22order%22:%22desc%22}}],%22aggs%22:{}}%22");
+            scriptRequest.setEntity(entity);
             Response response = restClient.performRequest(scriptRequest);
 //            Response response= restClient.performRequest("GET", "/shanglifeecif.individual/_search",Collections.<String, String>emptyMap(),entity);
 
@@ -268,6 +260,10 @@ public class CustomerApiController {
             builder.append("{\"prefix\": { \"PADate\": \""+fadate+"\"}},");
         }
 
+        if(StringUtils.isNotEmpty(productname)){
+            builder.append("{\"prefix\": { \"risk_categories\": \""+productname+"\"}},");
+        }
+
         if(StringUtils.isNotEmpty(payS) && StringUtils.isNotEmpty(payE)){
             builder.append("{\"range\":{\"Prem\":{\"gt\":\""+payS+"\",\"lt\":\""+payE+"\"}}},");
         }else{
@@ -293,7 +289,8 @@ public class CustomerApiController {
         }
 
         if(StringUtils.isNotEmpty(policybelong) || StringUtils.isNotEmpty(payS) || StringUtils.isNotEmpty(payE)
-            || StringUtils.isNotEmpty(insuredAmountS) || StringUtils.isNotEmpty(insuredAmountE)){
+            || StringUtils.isNotEmpty(insuredAmountS) || StringUtils.isNotEmpty(insuredAmountE)
+                || StringUtils.isNotEmpty(productname) || StringUtils.isNotEmpty(fadate) ){
             builder.delete(builder.length()-1,builder.length());
         }
 
@@ -310,8 +307,8 @@ public class CustomerApiController {
 
         HttpEntity entity = new NStringEntity(builder.toString(), ContentType.APPLICATION_JSON);
 
-        Request scriptRequest = new Request("GET", "/shanglifeecif.insurancearrangement/_search?scroll=1m&q="+ URLEncoder.encode("\""+builder.toString()+"\""));
-
+        Request scriptRequest = new Request("GET", "/shanglifeecif.insurancearrangement/_search?scroll=1m");
+        scriptRequest.setEntity(entity);
         Response response = restClient.performRequest(scriptRequest);
 //        Response response= restClient.performRequest("GET", "/shanglifeecif.insurancearrangement/_search?scroll=1m",Collections.<String, String>emptyMap(),entity);
 
@@ -324,7 +321,7 @@ public class CustomerApiController {
         JSONObject obj  = new JSONObject();
         obj.put("scroll_id",scroll_id);
         obj.put("scroll","1m");
-        while (hitsList.size() != 0) {
+        if (hitsList.size() != 0) {
 
             // 这里填写你的业务逻辑,即对每一条数据的处理
             for (int i = 0; i <hitsList.size() ; i++) {
@@ -336,11 +333,10 @@ public class CustomerApiController {
 
             }
             // 继续向后查询
-           /* entity = new NStringEntity(JSONUtil.toJsonStr(obj), ContentType.APPLICATION_JSON);
-           Request scriptRequest = new Request("GET", "/_search/scroll?);
-
-        Response response = restClient.performRequest(scriptRequest);
-//            response= restClient.performRequest("GET", "/_search/scroll",Collections.<String, String>emptyMap(),entity);
+          /* entity = new NStringEntity(JSONUtil.toJsonStr(obj), ContentType.APPLICATION_JSON);
+           scriptRequest = new Request("GET", "/_search/scroll?");
+            scriptRequest.setEntity(entity);
+            response = restClient.performRequest(scriptRequest);
             result = EntityUtils.toString(response.getEntity());
             jsonObject = JSON.parseObject(result);
             hitsobject = (JSONObject) jsonObject.get("hits");
@@ -385,11 +381,8 @@ public class CustomerApiController {
 
           Map query  =new HashMap();
           query.put("indid1",indid);
-          HttpEntity entity = new NStringEntity(EsJsonUtil.QuerygetMust(query), ContentType.APPLICATION_JSON);
            scriptRequest = new Request("GET", "/shanglifeecif.indrelationship/_search?pretty=true&q=indid1:"+indid);
-
           response = restClient.performRequest(scriptRequest);
-//          response= restClient.performRequest("GET", "/shanglifeecif.indrelationship/_search",Collections.<String, String>emptyMap(),entity);
           result = EntityUtils.toString(response.getEntity());
           jsonObject = JSON.parseObject(result);
           JSONObject hitsobject = (JSONObject) jsonObject.get("hits");
@@ -405,7 +398,6 @@ public class CustomerApiController {
             map.put("relationship",relationship);
           query  =new HashMap();
           query.put("applicantid",indid);
-          entity = new NStringEntity(EsJsonUtil.QuerygetMust(query), ContentType.APPLICATION_JSON);
           scriptRequest = new Request("GET", "/shanglifeecif.insuranceclaimthread/_search?pretty=true&q=applicantid:"+indid);
 
           response = restClient.performRequest(scriptRequest);
@@ -426,11 +418,9 @@ public class CustomerApiController {
 
           query  =new HashMap();
           query.put("applicantid",indid);
-          entity = new NStringEntity(EsJsonUtil.QuerygetMust(query), ContentType.APPLICATION_JSON);
           scriptRequest = new Request("GET", "/shanglifeecif.insurancearrangement/_search?pretty=true&q=applicantid:"+indid);
 
           response = restClient.performRequest(scriptRequest);
-//          response= restClient.performRequest("GET", "/shanglifeecif.insurancearrangement/_search",Collections.<String, String>emptyMap(),entity);
           result = EntityUtils.toString(response.getEntity());
           jsonObject = JSON.parseObject(result);
           hitsobject = (JSONObject) jsonObject.get("hits");
@@ -465,9 +455,7 @@ public class CustomerApiController {
             Map<String, String> paramMap = new HashMap<String, String>();
             paramMap.put("pretty", "true");
             Request scriptRequest = new Request("GET", "shanglifeecif.individual/default_type_/"+id+"?pretty=true");
-
             Response response = restClient.performRequest(scriptRequest);
-//            Response response = restClient.performRequest("GET", "shanglifeecif.individual/default_type_/"+id, paramMap);
             String result = EntityUtils.toString(response.getEntity());
             Map map = new HashMap();
             JSONObject jsonObject = JSON.parseObject(result);
@@ -533,11 +521,9 @@ public class CustomerApiController {
             map.put("lineBarChartData",lineBarChartData);
             query  =new HashMap();
             query.put("applicantid",indid);
-            entity = new NStringEntity(EsJsonUtil.QuerygetMust(query), ContentType.APPLICATION_JSON);
             scriptRequest = new Request("GET", "/shanglifeecif.insuranceclaimthread/_search?pretty=true&q=applicantid:"+indid);
 
             response = restClient.performRequest(scriptRequest);
-//            response= restClient.performRequest("GET", "/shanglifeecif.insuranceclaimthread/_search",Collections.<String, String>emptyMap(),entity);
             result = EntityUtils.toString(response.getEntity());
             jsonObject = JSON.parseObject(result);
             hitsobject = (JSONObject) jsonObject.get("hits");

+ 1 - 1
dgtis-ui/src/utils/request.js

@@ -11,7 +11,7 @@ const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分
   baseURL: process.env.VUE_APP_BASE_API,
   // 超时
-  timeout: 300000
+  timeout: 10000
 })
 
 // request拦截器