Change backend Code for dashboard UI page 77/84177/1
authorguochuyicmri <guochuyi@chinamobile.com>
Thu, 4 Apr 2019 02:22:17 +0000 (10:22 +0800)
committerguochuyicmri <guochuyi@chinamobile.com>
Thu, 4 Apr 2019 02:22:27 +0000 (10:22 +0800)
Change-Id: Id284118f29846f59378dfe611d5981d256b059d1
Issue-ID: USECASEUI-215
Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java
server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java

index 7950387..7e6d94a 100644 (file)
@@ -102,6 +102,13 @@ public class ServiceInstanceController {
     public String serviceNumByCustomer(HttpServletRequest request) throws JsonProcessingException{
                return serviceInstanceService.serviceNumByCustomer();
        }
+       
+       @ResponseBody
+    @RequestMapping(value = {"/uui-lcm/serviceNumByServiceType/{customerId}"}, method = RequestMethod.GET , produces = "application/json")
+    public String serviceNumByServiceType(String customerId) throws JsonProcessingException{
+               return serviceInstanceService.serviceNumByServiceType(customerId);
+       }
+       
     @ResponseBody
     @RequestMapping(value = {"/uui-lcm/getServiceInstanceById"}, method = RequestMethod.GET , produces = "application/json")
     public String getServiceInstanceById(HttpServletRequest request){
index 28bd9e0..7f5f430 100644 (file)
@@ -26,4 +26,6 @@ public interface ServiceInstanceService {
     String getRelationShipData(String customerId, String serviceType,String serviceId );
     
     String serviceNumByCustomer() throws JsonProcessingException;
+    
+       String serviceNumByServiceType(String customerId) throws JsonProcessingException;
 }
index 8a6f7aa..92b2755 100644 (file)
@@ -180,4 +180,26 @@ public class DefaultServiceInstanceService implements ServiceInstanceService {
                result.put("customerServiceList", list);
                return omAlarm.writeValueAsString(result);
        }
+       
+       @Override
+       public String serviceNumByServiceType(String customerId) throws JsonProcessingException{
+               
+               List<AAIServiceSubscription> serviceTypes = customerService.listServiceSubscriptions(customerId);
+               
+               List<Map<String,Object>> list = new ArrayList<>();
+               
+               ObjectMapper omAlarm = new ObjectMapper();
+               
+               for (AAIServiceSubscription aaiServiceSubscription : serviceTypes) {
+                       
+                       Map<String,Object> serviceTypeMap = new HashMap<String,Object>();
+                       
+                       List<String> serviceInstances =this.listServiceInstances(customerId, aaiServiceSubscription.getServiceType());
+                       
+                       serviceTypeMap.put(aaiServiceSubscription.getServiceType(),serviceInstances.size());
+                       
+                       list.add(serviceTypeMap);
+               }
+               return omAlarm.writeValueAsString(list);
+       }
 }