Selaa lähdekoodia

概览接口完善

kouchengxing 4 vuotta sitten
vanhempi
commit
60864ed958

+ 36 - 0
dgtis-modules/dgtis-modules-data/src/main/java/com/dgtis/data/api/CustomerApiController.java

@@ -10,6 +10,7 @@ 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;
@@ -194,6 +195,41 @@ 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);
+            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;//总保费
+            for (int i = 0; i <array.size() ; i++) {
+                JSONObject json = (JSONObject)array.get(i);
+                if(json.containsKey("prem")){
+                    prem+=json.getLong("prem");
+                }
+
+            }
+
+            query  =new HashMap();
+            query.put("applicantid",indid);
+            entity = new NStringEntity(EsJsonUtil.QuerygetMust(query), ContentType.APPLICATION_JSON);
+            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");
+            array = JSON.parseArray(hitsobject.get("hits").toString());
+            List insuranceclaimthread = new ArrayList<>();
+            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);
+            }
+            map.put("insuranceclaimthread",insuranceclaimthread);
+            mpInfo.put("prem",prem);
             map.put("custInfo",mpInfo);
             return AjaxResult.success(map);
         } catch (Exception e) {