Browse Source

客户详情首页接口完善

kouchengxing 3 years ago
parent
commit
f71189452a

+ 31 - 18
dgtis-modules/dgtis-modules-data/src/main/java/com/dgtis/data/api/CustomerApiController.java

@@ -467,6 +467,7 @@ public class CustomerApiController {
           mpInfo.put("id",indid);
           JSONObject source = JSON.parseObject(jsonObject.getString("_source"));
           String scustid = source.getString("scustid");
+          String custtype = source.getString("custtype");
           mpInfo.putAll(JSON.parseObject(jsonObject.getString("_source"),Map.class));
             if(mpInfo.containsKey("birthday")){
                 mpInfo.put("birthday", source.getString("birthday"));
@@ -513,7 +514,11 @@ public class CustomerApiController {
           }
           map.put("insuranceclaimthread",insuranceclaimthread);
 
-          scriptRequest = new Request("GET", "/shanglifeecif.insurancearrangement/_search?size=100&pretty=true&sort=padate:asc&q=applicantscustid:"+scustid);
+          if("被保人".equals(custtype.trim())){
+              scriptRequest = new Request("GET", "/shanglifeecif.insurancearrangement/_search?size=100&pretty=true&sort=padate:asc&q=insuredscustid:"+scustid);
+          }else{
+              scriptRequest = new Request("GET", "/shanglifeecif.insurancearrangement/_search?size=100&pretty=true&sort=padate:asc&q=applicantscustid:"+scustid);
+          }
 
           response = restClient.performRequest(scriptRequest);
           result = EntityUtils.toString(response.getEntity());
@@ -627,15 +632,17 @@ public class CustomerApiController {
                 Date padate = _source.getDate("padate");
 
 
-                if(_source.containsKey("sumprem")){
-                    sumprem+=_source.getDouble("sumprem");
-
-                }
 
                 if(i==0){
                     insureDay = DateUtils.getDateDifDay(new Date(),padate);
                 }
                 if("有效".equals(_source.getString("policystate"))){
+
+                    if(_source.containsKey("sumprem")){
+                        sumprem+=_source.getDouble("sumprem");
+
+                    }
+
                     Integer agrmntage = _source.getInteger("agrmntage");
                     //短期险
                     if(agrmntage<180){
@@ -659,21 +666,27 @@ public class CustomerApiController {
                             if(currentDateTime.compareTo(currentPadateStr)>0){
                                 handedinprem+=_source.getDouble("prem");
                             }
-                        }
-
-                        String m = DateUtils.parseDateToStr("M", padate);
 
-                        if(mpremMap.containsKey(m)){
-                            double tprem = Double.parseDouble(mpremMap.get(m).toString());
-                            tprem+=_source.getDouble("prem");
-                            //mpremMap.put(m,mprem);
-                            mpremMap.put(m,df.format(tprem));
-                            edata[Integer.parseInt(m)-1] = df.format(tprem);
-                            adata[Integer.parseInt(m)-1] = df.format(tprem);
+                            String m = DateUtils.parseDateToStr("M", padate);
+
+                            if(mpremMap.containsKey(m)){
+                                double tprem = Double.parseDouble(mpremMap.get(m).toString());
+                                tprem+=_source.getDouble("prem");
+                                //mpremMap.put(m,mprem);
+                                mpremMap.put(m,df.format(tprem));
+                                edata[Integer.parseInt(m)-1] = df.format(tprem);
+                                adata[Integer.parseInt(m)-1] = df.format(tprem);
+                            }else{
+                                mpremMap.put(m,df.format(_source.getDouble("prem")));
+                                edata[Integer.parseInt(m)-1] = df.format(_source.getDouble("prem"));
+                                adata[Integer.parseInt(m)-1] = df.format(_source.getDouble("prem"));
+                            }
                         }else{
-                            mpremMap.put(m,df.format(_source.getDouble("prem")));
-                            edata[Integer.parseInt(m)-1] = df.format(_source.getDouble("prem"));
-                            adata[Integer.parseInt(m)-1] = df.format(_source.getDouble("prem"));
+                            if("趸缴".equals(_source.getString("payment")) && currentYear.equals(DateUtils.parseDateToStr("yyyy",padate))){
+                                prem+=_source.getDouble("prem");
+                            }
+
+
                         }
 
                     }

+ 1 - 7
dgtis-modules/dgtis-modules-data/src/main/java/com/dgtis/data/api/IndexApiController.java

@@ -296,13 +296,11 @@ public class IndexApiController extends BaseController {
         // 获取索引的别名,字段,创建时间
         List<String> xaxisData = new ArrayList();//存放投保年份
         List seriesData = new ArrayList();//存放级别数据
-        Map map0 = new HashMap();//客户等级为0 无
         Map map1 = new HashMap();//客户等级为1 钻石
         Map map2 = new HashMap();//客户等级为2 白金
         Map map3 = new HashMap();//客户等级为3 黄金
         Map map4 = new HashMap();//客户等级为4 普通
 
-        List list0 = new ArrayList();//存放级别数据
         List list1 = new ArrayList();//存放级别数据
         List list2 = new ArrayList();//存放级别数据
         List list3 = new ArrayList();//存放级别数据
@@ -350,7 +348,6 @@ public class IndexApiController extends BaseController {
         }
 
         for (int i = 0; i <xaxisData.size() ; i++) {
-            list0.add(mapData.get(xaxisData.get(i)+"0"));
             list1.add(mapData.get(xaxisData.get(i)+"1"));
             list2.add(mapData.get(xaxisData.get(i)+"2"));
             list3.add(mapData.get(xaxisData.get(i)+"3"));
@@ -370,14 +367,11 @@ public class IndexApiController extends BaseController {
         map4.put("name","普通");
         map4.put("data",list4);
 
-        map0.put("name","无");
-        map0.put("data",list0);
-
         seriesData.add(map1);
         seriesData.add(map2);
         seriesData.add(map3);
         seriesData.add(map4);
-        seriesData.add(map0);
+
         Map data = new HashMap();
         data.put("xaxisData", xaxisData);
         data.put("seriesData", seriesData);