Browse Source

将维修商的资产操作改为设备操作

Jxing 6 years ago
parent
commit
50d8c869d3

+ 13 - 0
src/main/java/com/sagacloud/route/Route.java

@@ -167,6 +167,7 @@ public class Route extends ExceptionHandlerBaseRoute {
                 .process(new GetEquipmentByPjProcessor())
                 .to(Const.dataPlatform + "/object/subset_query");
 
+        // 统计数据平台资产和设备信息(数量)
         from("direct:buildVenderMap")
                 .to(Const.venders + "/auxiliary/vender/query_detail?bridgeEndpoint=true&method=POST")
                 .process(new VenderMapProcessor())
@@ -183,6 +184,18 @@ public class Route extends ExceptionHandlerBaseRoute {
                     String jsonStr = exchange.getIn().getBody(String.class);
                     DPSelectPropertyResult dpResult = JSONObject.parseObject(jsonStr, DPSelectPropertyResult.class);
                     exchange.setProperty("propertyData" + exchange.getExchangeId(), dpResult);
+                    // 为下个路由准备输入数据
+                    String projectId = (String) exchange.getProperty("projectId" + exchange.getExchangeId());
+                    JSONObject json = new JSONObject();
+                    json.put("projectId", projectId);
+                    exchange.getIn().setBody(json.toString());
+                })
+                .to("direct:getEquipmentByPj")
+                .process(exchange -> {
+                    String jsonStr = exchange.getIn().getBody(String.class);
+                    DPSelectPropertyResult eqResult = JSONObject.parseObject(jsonStr, DPSelectPropertyResult.class);
+                    exchange.setProperty("facilityData" + exchange.getExchangeId(), eqResult);
+
                     exchange.getIn().setBody(exchange.getProperty("projectId" + exchange.getExchangeId()));
                 })
                 .to("direct:getPropertyStatisticsByProject");

+ 7 - 1
src/main/java/com/sagacloud/route/processors/PeriodTask/StatisticsProcessor.java

@@ -27,8 +27,10 @@ public class StatisticsProcessor implements Processor {
         String projectId = exchange.getIn().getBody(String.class);
         System.out.println("这里正在统计的是Project:" + projectId);
         DPSelectPropertyResult propertyData = (DPSelectPropertyResult) exchange.getProperty("propertyData" + exchange.getExchangeId());
+        DPSelectPropertyResult facilityData = (DPSelectPropertyResult) exchange.getProperty("facilityData" + exchange.getExchangeId());
         Map<String, Map<String, String>> infoValueMap = (Map<String, Map<String, String>>) exchange.getProperty("map");  // 信息点Code --> (厂商库在该信息点的值value --> vender DPID)
         List<Map<String, Object>> propertyList = propertyData.getContent();
+        List<Map<String, Object>> facilityList = facilityData.getContent();
         Map<String, VenderStatistics> venderStatisticsMap = new HashMap<>();
         Map<String, Set<String>> contracts = new HashMap<>(); // 保险商统计供应合同数目使用
         Map<String, Set<String>> warranties = new HashMap<>(); // 保险商统计供应合同数目使用
@@ -37,7 +39,11 @@ public class StatisticsProcessor implements Processor {
             matchCountManufacturer(singleProperty, infoValueMap, manufacturerSign, venderStatisticsMap);
             matchCountSupplier(singleProperty, infoValueMap, supplierSign, venderStatisticsMap, contracts);
             matchCountInsurer(singleProperty, infoValueMap, insuranceSign, venderStatisticsMap, warranties);
-            matchCountMaintainance(singleProperty, infoValueMap, maintainanceSign, venderStatisticsMap);
+            //
+        }
+        for(int i = 0; i < facilityList.size(); ++i){
+            Map<String, Object> singleFacility = facilityList.get(i);
+            matchCountMaintainance(singleFacility, infoValueMap, maintainanceSign, venderStatisticsMap);
         }
         addContractCount(venderStatisticsMap, contracts);
         addContractCount(venderStatisticsMap, warranties);