|
@@ -419,7 +419,7 @@ public class CustomerApiController {
|
|
|
|
|
|
query =new HashMap();
|
|
|
query.put("applicantid",indid);
|
|
|
- scriptRequest = new Request("GET", "/shanglifeecif.insurancearrangement/_search?pretty=true&q=applicantscustid:"+scustid);
|
|
|
+ scriptRequest = new Request("GET", "/shanglifeecif.insurancearrangement/_search?pretty=true&sort=padate:asc&q=applicantscustid:"+scustid);
|
|
|
|
|
|
response = restClient.performRequest(scriptRequest);
|
|
|
result = EntityUtils.toString(response.getEntity());
|
|
@@ -477,7 +477,6 @@ public class CustomerApiController {
|
|
|
JSONObject source = JSON.parseObject(jsonObject.getString("_source"));
|
|
|
String scustid = source.getString("scustid");
|
|
|
mpInfo.putAll(JSON.parseObject(jsonObject.getString("_source"),Map.class));
|
|
|
- //mpInfo.put("birthday",DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",JSON.parseObject(jsonObject.getString("_source")).getDate("birthday")));
|
|
|
if(mpInfo.containsKey("birthday")){
|
|
|
mpInfo.put("birthday", source.getString("birthday").substring(0,10));
|
|
|
mpInfo.put("age",DateUtils.getAge(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,source.getString("birthday"))));
|
|
@@ -485,18 +484,15 @@ public class CustomerApiController {
|
|
|
mpInfo.put("birthday","");
|
|
|
mpInfo.put("age","");
|
|
|
}
|
|
|
- Map query =new HashMap();
|
|
|
- query.put("applicantid",indid);
|
|
|
- HttpEntity entity = new NStringEntity(EsJsonUtil.QuerygetMust(query), ContentType.APPLICATION_JSON);
|
|
|
- scriptRequest = new Request("GET", "/shanglifeecif.insurancearrangement/_search?pretty=true&q=applicantscustid:"+scustid);
|
|
|
-
|
|
|
+ scriptRequest = new Request("GET", "/shanglifeecif.insurancearrangement/_search?pretty=true&sort=padate:asc&q=applicantscustid:"+scustid);
|
|
|
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);
|
|
|
JSONObject hitsobject = (JSONObject) jsonObject.get("hits");
|
|
|
JSONArray array = JSON.parseArray(hitsobject.get("hits").toString());
|
|
|
- long prem = 0;//总保费
|
|
|
+ double prem = 0;//标准保费
|
|
|
+
|
|
|
+ //概览投保时间和保费折线图
|
|
|
Map expectedData = new HashMap();
|
|
|
List edata = new ArrayList();
|
|
|
expectedData.put("name","");
|
|
@@ -504,25 +500,48 @@ public class CustomerApiController {
|
|
|
Map actaulData = new HashMap();
|
|
|
List adata = new ArrayList();
|
|
|
actaulData.put("name","");
|
|
|
-
|
|
|
List xaxisData = new ArrayList();
|
|
|
-
|
|
|
- long insureDay = 0;
|
|
|
+ long insureDay = 0;//投保时长
|
|
|
+ int guaranteeDay = 0;//享受保障天数
|
|
|
+
|
|
|
+ List majorCategories = new ArrayList();
|
|
|
+ Map a = new HashMap();//意外伤害险
|
|
|
+ Map u = new HashMap();//万能保险
|
|
|
+ Map r = new HashMap();//年金保险
|
|
|
+ Map s = new HashMap();//重疾保险
|
|
|
+ Map l = new HashMap();//人寿保险
|
|
|
+ Map h = new HashMap();//健康险
|
|
|
+ Map majorCategorie = new HashMap();
|
|
|
for (int i = 0; i <array.size() ; i++) {
|
|
|
JSONObject json = (JSONObject)array.get(i);
|
|
|
JSONObject _source = (JSONObject) json.get("_source");
|
|
|
if(_source.containsKey("prem")){
|
|
|
- prem+=_source.getLong("prem");
|
|
|
- edata.add(_source.getLong("prem"));
|
|
|
- adata.add(_source.getLong("prem"));
|
|
|
+ prem+=_source.getDouble("prem");
|
|
|
+ edata.add(_source.getDouble("prem"));
|
|
|
+ adata.add(_source.getDouble("prem"));
|
|
|
}
|
|
|
-
|
|
|
- if(_source.containsKey("padate")){
|
|
|
- Date padate = _source.getDate("padate");
|
|
|
- xaxisData.add(DateUtils.parseDateToStr("MM",padate));
|
|
|
+ Date padate = _source.getDate("padate");
|
|
|
+ if(i==0){
|
|
|
insureDay = DateUtils.getDateDifDay(new Date(),padate);
|
|
|
}
|
|
|
+ if("有效".equals(_source.getString("policystate"))){
|
|
|
+ guaranteeDay+=_source.getInteger("agrmntage");
|
|
|
+ }
|
|
|
+ xaxisData.add(DateUtils.parseDateToStr("MM",padate));
|
|
|
+ //String risk_categories = _source.getString("risk_categories");
|
|
|
+ String risk_categories_name = _source.getString("risk_categories_name");
|
|
|
+
|
|
|
+ if(majorCategorie.containsKey(risk_categories_name)){
|
|
|
+ double risk = Double.parseDouble(majorCategorie.get(risk_categories_name).toString());
|
|
|
+ if(_source.containsKey("risk")){
|
|
|
+ risk += _source.getDouble("risk");
|
|
|
+ }
|
|
|
+ majorCategorie.put(risk_categories_name,risk);
|
|
|
+ }
|
|
|
|
|
|
+ if(_source.containsKey("risk")){
|
|
|
+ majorCategorie.put(risk_categories_name,_source.getDouble("risk"));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
expectedData.put("data",edata);
|
|
@@ -532,8 +551,7 @@ public class CustomerApiController {
|
|
|
lineBarChartData.put("actaulData",actaulData);
|
|
|
lineBarChartData.put("xaxisData",xaxisData);
|
|
|
map.put("lineBarChartData",lineBarChartData);
|
|
|
- query =new HashMap();
|
|
|
- query.put("applicantid",indid);
|
|
|
+ //查询理赔信息
|
|
|
scriptRequest = new Request("GET", "/shanglifeecif.insuranceclaimthread/_search?pretty=true&q=lpscutid:"+scustid);
|
|
|
|
|
|
response = restClient.performRequest(scriptRequest);
|
|
@@ -541,18 +559,29 @@ public class CustomerApiController {
|
|
|
jsonObject = JSON.parseObject(result);
|
|
|
hitsobject = (JSONObject) jsonObject.get("hits");
|
|
|
array = JSON.parseArray(hitsobject.get("hits").toString());
|
|
|
- List insuranceclaimthread = new ArrayList<>();
|
|
|
+ Map insuranceclaimthread = new HashMap();
|
|
|
+ List insuranceclaimthreads = new ArrayList<>();
|
|
|
+ double claimAmount = 0;//理赔总金额
|
|
|
+ String claimType = "";//理赔类型
|
|
|
for (int i = 0; i <array.size() ; i++) {
|
|
|
JSONObject json = (JSONObject)array.get(i);
|
|
|
- Map mp = new HashMap();
|
|
|
- mp.put("id",json.getString("_id"));
|
|
|
- mp.putAll(JSON.parseObject(json.getString("_source"),Map.class));
|
|
|
- insuranceclaimthread.add(mp);
|
|
|
+ JSONObject claimSource = JSON.parseObject(json.getString("_source"));
|
|
|
+
|
|
|
+ if(claimSource.containsKey("ccamt")){
|
|
|
+ claimAmount+=claimSource.getDouble("ccamt");
|
|
|
+ }
|
|
|
+ claimType = claimSource.getString("accidenttype");
|
|
|
+ insuranceclaimthreads.add(claimSource);
|
|
|
}
|
|
|
+ insuranceclaimthread.put("isClaim",insuranceclaimthreads.size()>0?"是":"否");
|
|
|
+ insuranceclaimthread.put("claimAmount",claimAmount);
|
|
|
+ insuranceclaimthread.put("claimType",claimType);
|
|
|
map.put("insuranceclaimthread",insuranceclaimthread);
|
|
|
mpInfo.put("prem",prem);
|
|
|
mpInfo.put("insureDay",insureDay);
|
|
|
+ mpInfo.put("guaranteeDay",guaranteeDay);
|
|
|
map.put("custInfo",mpInfo);
|
|
|
+ map.put("majorCategorie",majorCategorie);
|
|
|
return AjaxResult.success(map);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|