|
@@ -75,7 +75,11 @@ public class CustomerApiController {
|
|
|
customerIds = queryInsurancearrangement(policybelong,payS,payE,fadate,productname,insuredAmountS,insuredAmountE);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ if(StringUtils.isNotEmpty(lp)){
|
|
|
+ if ("0".equals(lp)){
|
|
|
+ customerIds = queryInsurancearrangementLp(lp);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -135,14 +139,23 @@ public class CustomerApiController {
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotEmpty(PIncomeS) && StringUtils.isNotEmpty(PIncomeE)){
|
|
|
- builder.append("{\"range\":{\"PIncome\":{\"gte\":\""+PIncomeS+"\",\"lte\":\""+PIncomeE+"\"}}},");
|
|
|
+ builder.append("{\"range\":{\"pincome\":{\"gte\":\""+PIncomeS+"\",\"lte\":\""+PIncomeE+"\"}}},");
|
|
|
}else{
|
|
|
|
|
|
if(StringUtils.isNotEmpty(PIncomeS)){
|
|
|
- builder.append("{\"range\":{\"PIncome\":{\"gte\":\""+PIncomeS+"\"}}},");
|
|
|
+ builder.append("{\"range\":{\"pincome\":{\"gte\":\""+PIncomeS+"\"}}},");
|
|
|
}
|
|
|
if(StringUtils.isNotEmpty(PIncomeE)){
|
|
|
- builder.append("{\"range\":{\"PIncome\":{\"lte\":\""+PIncomeE+"\"}}},");
|
|
|
+ builder.append("{\"range\":{\"pincome\":{\"lte\":\""+PIncomeE+"\"}}},");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(yx)){
|
|
|
+ if (yx.equals("0")){
|
|
|
+ builder.append("{\"range\":{\"novpolicy\":{\"gt\":\""+yx+"\"}}},");
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ builder.append("{\"range\":{\"noivpolicy\":{\"gt\":\""+yx+"\"}}},");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -157,7 +170,7 @@ public class CustomerApiController {
|
|
|
}
|
|
|
|
|
|
if(customerIds.size()>0){
|
|
|
- builder.append("{\"terms\":{\"_id\":[");
|
|
|
+ builder.append("{\"terms\":{\"scustid\":[");
|
|
|
for (String id:customerIds) {
|
|
|
builder.append("\""+id+"\",");
|
|
|
}
|
|
@@ -179,7 +192,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) || customerIds.size()>0){
|
|
|
+ || StringUtils.isNotEmpty(zcgw) || StringUtils.isNotEmpty(yx) || customerIds.size()>0){
|
|
|
builder.delete(builder.length()-1,builder.length());
|
|
|
}
|
|
|
|
|
@@ -258,7 +271,7 @@ public class CustomerApiController {
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotEmpty(fadate)){
|
|
|
- builder.append("{\"prefix\": { \"PADate\": \""+fadate+"\"}},");
|
|
|
+ builder.append("{\"prefix\": { \"padate\": \""+fadate+"\"}},");
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotEmpty(productname)){
|
|
@@ -329,8 +342,75 @@ public class CustomerApiController {
|
|
|
for (int i = 0; i <hitsList.size() ; i++) {
|
|
|
JSONObject json = (JSONObject)hitsList.get(i);
|
|
|
JSONObject jsonOb = JSON.parseObject(json.getString("_source"));
|
|
|
- if(StringUtils.isNotEmpty(jsonOb.getString("applicantid"))){
|
|
|
- customerIds.add(jsonOb.getString("applicantid"));
|
|
|
+ if(StringUtils.isNotEmpty(jsonOb.getString("applicantscustid"))){
|
|
|
+ customerIds.add(jsonOb.getString("applicantscustid"));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ // 继续向后查询
|
|
|
+ /* 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");
|
|
|
+ hitsList = JSON.parseArray(hitsobject.get("hits").toString());*/
|
|
|
+ }
|
|
|
+
|
|
|
+ return customerIds;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询保单信息返回客户Id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List queryInsurancearrangementLp(String ly) throws Exception {
|
|
|
+
|
|
|
+ List<String> customerIds = new ArrayList<String>();
|
|
|
+
|
|
|
+ //拼装查询条件
|
|
|
+ StringBuilder builder =new StringBuilder();
|
|
|
+ builder.append("{");
|
|
|
+ builder.append("\"query\": {");//query开始
|
|
|
+ builder.append("\"bool\": {");//boot开始
|
|
|
+ builder.append("\"must\": [");//must开始
|
|
|
+ builder.append("],");//must结束
|
|
|
+ builder.append("\"must_not\": [ ],");//must_not
|
|
|
+ builder.append("\"should\": [ ]");//should
|
|
|
+ builder.append("}");//boot结束
|
|
|
+ builder.append("},");//query结束
|
|
|
+ //builder.append("\"from\": "+pageNum+",");//第几页
|
|
|
+ builder.append("\"size\": 1000,");//查询几个
|
|
|
+ //builder.append(" \"sort\": [{\"created_time\":{\"order\":\"desc\"}}],");//排序
|
|
|
+ builder.append(" \"aggs\": {}");//
|
|
|
+ builder.append("}");
|
|
|
+
|
|
|
+ HttpEntity entity = new NStringEntity(builder.toString(), ContentType.APPLICATION_JSON);
|
|
|
+
|
|
|
+ Request scriptRequest = new Request("GET", "/shanglifeecif.insuranceclaimthread/_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);
|
|
|
+
|
|
|
+ String result = EntityUtils.toString(response.getEntity());
|
|
|
+ JSONObject jsonObject = JSON.parseObject(result);
|
|
|
+ JSONObject hitsobject = (JSONObject) jsonObject.get("hits");
|
|
|
+ JSONArray hitsList = JSON.parseArray(hitsobject.get("hits").toString());
|
|
|
+ String scroll_id = jsonObject.getString("_scroll_id");
|
|
|
+
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ obj.put("scroll_id",scroll_id);
|
|
|
+ obj.put("scroll","1m");
|
|
|
+ if (hitsList.size() != 0) {
|
|
|
+
|
|
|
+ // 这里填写你的业务逻辑,即对每一条数据的处理
|
|
|
+ for (int i = 0; i <hitsList.size() ; i++) {
|
|
|
+ JSONObject json = (JSONObject)hitsList.get(i);
|
|
|
+ JSONObject jsonOb = JSON.parseObject(json.getString("_source"));
|
|
|
+ if(StringUtils.isNotEmpty(jsonOb.getString("lpscutid"))){
|
|
|
+ customerIds.add(jsonOb.getString("lpscutid"));
|
|
|
}
|
|
|
|
|
|
}
|