|
@@ -76,23 +76,11 @@ public class CustomerApiController {
|
|
|
String mobile
|
|
|
) {
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
try {
|
|
|
logger.info("进客户列表时间:"+DateUtils.getTime());
|
|
|
|
|
|
SysUser sysUser = userService.selectUserById(userId);
|
|
|
String deptCode = sysUser.getDept().getDeptCode();*/
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(StringUtils.isNotEmpty(payS) || StringUtils.isNotEmpty(payE)
|
|
|
- || StringUtils.isNotEmpty(insuredAmountS) || StringUtils.isNotEmpty(insuredAmountE)
|
|
|
- || StringUtils.isNotEmpty(productname) || StringUtils.isNotEmpty(fadate)){
|
|
|
- customerIds = queryInsurancearrangement(policybelong,payS,payE,fadate,productname,insuredAmountS,insuredAmountE);
|
|
|
- }*/
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
@@ -217,16 +205,6 @@ public class CustomerApiController {
|
|
|
builder.append ("]}},");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- builder.append("{\"terms\":{\"scustid\":[");
|
|
|
- for (String id:customerIds) {
|
|
|
- builder.append("\""+id+"\",");
|
|
|
- }
|
|
|
- builder.delete(builder.length()-1,builder.length());
|
|
|
- builder.append ("]}},");
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
if(StringUtils.isNotEmpty(gzgw) && "0".equals(gzgw)){
|
|
|
builder.append("{\"prefix\":{\"label73\":\"关注官微\"}},");
|
|
|
}
|
|
@@ -336,117 +314,6 @@ public class CustomerApiController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- * 查询保单信息返回客户Id
|
|
|
- * @return
|
|
|
- */
|
|
|
- public List queryInsurancearrangement(String policybelong,String payS,String payE,String fadate,
|
|
|
- String productname,String insuredAmountS,String insuredAmountE) throws Exception {
|
|
|
-
|
|
|
- List<String> customerIds = new ArrayList<String>();
|
|
|
-
|
|
|
-
|
|
|
- StringBuilder builder =new StringBuilder();
|
|
|
- builder.append("{");
|
|
|
- builder.append("\"query\": {");
|
|
|
- builder.append("\"bool\": {");
|
|
|
- builder.append("\"must\": [");
|
|
|
-
|
|
|
- if(StringUtils.isNotEmpty(policybelong)){
|
|
|
- builder.append("{\"prefix\": { \"policybelong\": \""+policybelong+"\"}},");
|
|
|
- }
|
|
|
-
|
|
|
- if(StringUtils.isNotEmpty(fadate)){
|
|
|
- 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{
|
|
|
-
|
|
|
- if(StringUtils.isNotEmpty(payS)){
|
|
|
- builder.append("{\"range\":{\"prem\":{\"gt\":\""+payS+"\"}}},");
|
|
|
- }
|
|
|
- if(StringUtils.isNotEmpty(payE)){
|
|
|
- builder.append("{\"range\":{\"prem\":{\"lt\":\""+payE+"\"}}},");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(StringUtils.isNotEmpty(insuredAmountS) && StringUtils.isNotEmpty(insuredAmountE)){
|
|
|
- builder.append("{\"range\":{\"Risk\":{\"gt\":\""+insuredAmountS+"\",\"lt\":\""+insuredAmountE+"\"}}},");
|
|
|
- }else{
|
|
|
-
|
|
|
- if(StringUtils.isNotEmpty(payS)){
|
|
|
- builder.append("{\"range\":{\"Risk\":{\"gt\":\""+insuredAmountS+"\"}}},");
|
|
|
- }
|
|
|
- if(StringUtils.isNotEmpty(payE)){
|
|
|
- builder.append("{\"range\":{\"Risk\":{\"lt\":\""+insuredAmountE+"\"}}},");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(StringUtils.isNotEmpty(policybelong) || StringUtils.isNotEmpty(payS) || StringUtils.isNotEmpty(payE)
|
|
|
- || StringUtils.isNotEmpty(insuredAmountS) || StringUtils.isNotEmpty(insuredAmountE)
|
|
|
- || StringUtils.isNotEmpty(productname) || StringUtils.isNotEmpty(fadate) ){
|
|
|
- builder.delete(builder.length()-1,builder.length());
|
|
|
- }
|
|
|
-
|
|
|
- builder.append("],");
|
|
|
- builder.append("\"must_not\": [ ],");
|
|
|
- builder.append("\"should\": [ ]");
|
|
|
- builder.append("}");
|
|
|
- builder.append("},");
|
|
|
-
|
|
|
- builder.append("\"size\": 1000,");
|
|
|
-
|
|
|
- builder.append(" \"aggs\": {}");
|
|
|
- builder.append("}");
|
|
|
-
|
|
|
- HttpEntity entity = new NStringEntity(builder.toString(), ContentType.APPLICATION_JSON);
|
|
|
-
|
|
|
- Request scriptRequest = new Request("GET", "/shanglifeecif.insurancearrangement/_search?scroll=1m");
|
|
|
- scriptRequest.setEntity(entity);
|
|
|
-
|
|
|
- Response response = restClient.performRequest(scriptRequest);
|
|
|
-
|
|
|
-
|
|
|
- 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("applicantscustid"))){
|
|
|
- customerIds.add(jsonOb.getString("applicantscustid"));
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- 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;
|
|
|
- }
|
|
|
-
|
|
|
@GetMapping("/getCustomerById")
|
|
|
@ResponseBody
|
|
|
public AjaxResult getCustomerById(String id) {
|
|
@@ -628,11 +495,8 @@ public class CustomerApiController {
|
|
|
for (int i = 0; i <array.size() ; i++) {
|
|
|
JSONObject json = (JSONObject)array.get(i);
|
|
|
JSONObject _source = (JSONObject) json.get("_source");
|
|
|
-
|
|
|
Date padate = _source.getDate("padate");
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if(i==0){
|
|
|
insureDay = DateUtils.getDateDifDay(new Date(),padate);
|
|
|
}
|
|
@@ -672,7 +536,6 @@ public class CustomerApiController {
|
|
|
if(mpremMap.containsKey(m)){
|
|
|
double tprem = Double.parseDouble(mpremMap.get(m).toString());
|
|
|
tprem+=_source.getDouble("prem");
|
|
|
-
|
|
|
mpremMap.put(m,df.format(tprem));
|
|
|
edata[Integer.parseInt(m)-1] = df.format(tprem);
|
|
|
adata[Integer.parseInt(m)-1] = df.format(tprem);
|
|
@@ -691,7 +554,6 @@ public class CustomerApiController {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
String risk_categories_name = _source.getString("risk_categories_name");
|
|
|
|
|
|
if(majorCategorie.containsKey(risk_categories_name)){
|
|
@@ -706,9 +568,20 @@ public class CustomerApiController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
+ }else{
|
|
|
+
|
|
|
+ if("终止".equals(_source.getString("policystate"))){
|
|
|
+ String norenewal = _source.getString("norenewal")==null?"":_source.getString("norenewal").trim();
|
|
|
+ String payendyear = _source.getString("payendyear")==null?"":_source.getString("payendyear").trim();
|
|
|
+ Date pmdate = _source.getDate("pmdate");
|
|
|
+ if(norenewal.equals(payendyear) && currentDateTime.compareTo(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,pmdate))>0){
|
|
|
+ if(_source.containsKey("sumprem")){
|
|
|
+ sumprem+=_source.getDouble("sumprem");
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -721,7 +594,6 @@ public class CustomerApiController {
|
|
|
map.put("lineBarChartData",lineBarChartData);
|
|
|
|
|
|
scriptRequest = new Request("GET", "/shanglifeecif.insuranceclaimthread/_search?size=100&pretty=true&q=lpscutid:"+scustid);
|
|
|
-
|
|
|
response = restClient.performRequest(scriptRequest);
|
|
|
result = EntityUtils.toString(response.getEntity());
|
|
|
jsonObject = JSON.parseObject(result);
|
|
@@ -730,7 +602,6 @@ public class CustomerApiController {
|
|
|
Map insuranceclaimthread = new HashMap();
|
|
|
List insuranceclaimthreads = new ArrayList<>();
|
|
|
double claimAmount = 0;
|
|
|
-
|
|
|
Set<String> claimTypeSet = new HashSet<>();
|
|
|
for (int i = 0; i <array.size() ; i++) {
|
|
|
JSONObject json = (JSONObject)array.get(i);
|
|
@@ -739,7 +610,6 @@ public class CustomerApiController {
|
|
|
if(claimSource.containsKey("ccamt")){
|
|
|
claimAmount+=claimSource.getDouble("ccamt");
|
|
|
}
|
|
|
-
|
|
|
claimTypeSet.add(claimSource.getString("accidenttype"));
|
|
|
insuranceclaimthreads.add(claimSource);
|
|
|
}
|
|
@@ -751,6 +621,21 @@ public class CustomerApiController {
|
|
|
mpInfo.put("sumprem",df.format(sumprem));
|
|
|
mpInfo.put("handedinprem",df.format(handedinprem));
|
|
|
mpInfo.put("insureDay",(insureDay/365) +"年"+(insureDay%365)+"天");
|
|
|
+
|
|
|
+ scriptRequest = new Request("GET", "/shanglifeecif.surrenderprotectiontemp/_search?pretty=true&q=scustid:"+scustid);
|
|
|
+ response = restClient.performRequest(scriptRequest);
|
|
|
+ result = EntityUtils.toString(response.getEntity());
|
|
|
+ jsonObject = JSON.parseObject(result);
|
|
|
+ hitsobject = (JSONObject) jsonObject.get("hits");
|
|
|
+ array = JSON.parseArray(hitsobject.get("hits").toString());
|
|
|
+ for (int i = 0; i <array.size() ; i++) {
|
|
|
+ JSONObject json = (JSONObject)array.get(i);
|
|
|
+ JSONObject tbSource = JSON.parseObject(json.getString("_source"));
|
|
|
+ if(tbSource.containsKey("tbday")){
|
|
|
+ guaranteeDay+=tbSource.getInteger("tbday");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
mpInfo.put("guaranteeDay",guaranteeDay>insureDay?insureDay+"天":guaranteeDay+"天");
|
|
|
map.put("custInfo",mpInfo);
|
|
|
map.put("majorCategorie",majorCategorie);
|
|
@@ -927,16 +812,6 @@ public class CustomerApiController {
|
|
|
builder.append ("]}},");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- builder.append("{\"terms\":{\"scustid\":[");
|
|
|
- for (String id:customerIds) {
|
|
|
- builder.append("\""+id+"\",");
|
|
|
- }
|
|
|
- builder.delete(builder.length()-1,builder.length());
|
|
|
- builder.append ("]}},");
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
if(StringUtils.isNotEmpty(gzgw) && "0".equals(gzgw)){
|
|
|
builder.append("{\"prefix\":{\"label73\":\"关注官微\"}},");
|
|
|
}
|
|
@@ -1095,25 +970,6 @@ public class CustomerApiController {
|
|
|
customer.setCustClass("无");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- String policybelong = jsonOb.getString("policybelong");
|
|
|
- switch (policybelong){
|
|
|
- case "00":
|
|
|
- customer.setPolicyBelong("总部团险个单业务");
|
|
|
- case "01":
|
|
|
- customer.setPolicyBelong("上分团险个单业务");
|
|
|
- case "02":
|
|
|
- customer.setPolicyBelong("个险渠道");
|
|
|
- case "03":
|
|
|
- customer.setPolicyBelong("银保渠道");
|
|
|
- case "05":
|
|
|
- customer.setPolicyBelong("网销渠道");
|
|
|
- case "06":
|
|
|
- customer.setPolicyBelong("健康险事业部");
|
|
|
- }
|
|
|
-
|
|
|
- }*/
|
|
|
-
|
|
|
customers.add(customer);
|
|
|
}
|
|
|
|