Ver código fonte

概览接口错误修改

kouchengxing 4 anos atrás
pai
commit
bd81325f26

+ 12 - 9
dgtis-modules/dgtis-modules-data/src/main/java/com/dgtis/data/api/CustomerApiController.java

@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
+import java.text.DecimalFormat;
 import java.util.*;
 
 /**
@@ -195,7 +196,7 @@ public class CustomerApiController {
 
             HttpEntity entity = new NStringEntity(builder.toString(), ContentType.APPLICATION_JSON);
 
-            Request scriptRequest = new Request("GET", "/shanglifeecif.individual/_search");
+            Request scriptRequest = new Request("GET", "/shanglifeecif.individual/_search?pretty=true&sort=scustid:asc");
 //            Request scriptRequest = new Request("GET", "/shanglifeecif.individual/_search?q=%22{%22query%22:{%22bool%22:{%22must%22:[],%22must_not%22:[],%22should%22:[]}},%22from%22:11,%22size%22:10,%22sort%22:[{%22created_time%22:{%22order%22:%22desc%22}}],%22aggs%22:{}}%22");
             scriptRequest.setEntity(entity);
             Response response = restClient.performRequest(scriptRequest);
@@ -495,15 +496,16 @@ public class CustomerApiController {
             jsonObject = JSON.parseObject(result);
             JSONObject hitsobject = (JSONObject) jsonObject.get("hits");
             JSONArray array = JSON.parseArray(hitsobject.get("hits").toString());
+            DecimalFormat   df  = new DecimalFormat("######0.00");//保留两位小数
             double prem = 0;//标准保费
 
             //概览投保时间和保费折线图
             Map expectedData = new HashMap();
-            Double[] edata = new Double[12];
+            String[] edata = new String[12];
             expectedData.put("name","");
 
             Map actaulData = new HashMap();
-            Double[] adata = new Double[12];
+            String[] adata = new String[12];
             actaulData.put("name","");
             List xaxisData = new ArrayList();
             xaxisData.add("1");
@@ -541,12 +543,13 @@ public class CustomerApiController {
                         double tprem = Double.parseDouble(mpremMap.get(m).toString());
                         tprem+=_source.getDouble("prem");
                         //mpremMap.put(m,mprem);
-                        edata[Integer.parseInt(m)-1] = tprem;
-                        adata[Integer.parseInt(m)-1] = tprem;
+                        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,_source.getDouble("prem"));
-                        edata[Integer.parseInt(m)-1] = _source.getDouble("prem");
-                        adata[Integer.parseInt(m)-1] = _source.getDouble("prem");
+                        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"));
                     }
 
                     //edata.add(_source.getDouble("prem"));
@@ -611,7 +614,7 @@ public class CustomerApiController {
             insuranceclaimthread.put("claimAmount",claimAmount);
             insuranceclaimthread.put("claimType",claimType);
             map.put("insuranceclaimthread",insuranceclaimthread);
-            mpInfo.put("prem",prem);
+            mpInfo.put("prem",df.format(prem));
             mpInfo.put("insureDay",insureDay);
             mpInfo.put("guaranteeDay",guaranteeDay);
             map.put("custInfo",mpInfo);