Browse Source

agent 接口报错修复

xgb 6 ngày trước cách đây
mục cha
commit
c99d8d4444

+ 15 - 3
fs-agent/src/main/java/com/fs/proxy/controller/ProxyController.java

@@ -1,7 +1,11 @@
 package com.fs.proxy.controller;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.math.BigDecimal;
+import java.util.stream.Collectors;
 
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
@@ -29,8 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.ArrayList;
-
 @RestController
 @RequestMapping("/proxy")
 public class ProxyController extends BaseController
@@ -153,7 +155,17 @@ public class ProxyController extends BaseController
         Long proxyId = getCurrentProxyId();
         startPage();
         Map<String, Object> statistics = proxyDashboardService.getProfitStatistics(proxyId, month);
-        return getDataTable((List<?>) statistics.get("tenantProfit"));
+        @SuppressWarnings("unchecked")
+        Map<Long, BigDecimal> tenantProfitMap = (Map<Long, BigDecimal>) statistics.get("tenantProfit");
+        List<Map<String, Object>> list = tenantProfitMap.entrySet().stream()
+                .map(e -> {
+                    Map<String, Object> item = new HashMap<>();
+                    item.put("tenantId", e.getKey());
+                    item.put("profit", e.getValue());
+                    return item;
+                })
+                .collect(Collectors.toList());
+        return getDataTable(list);
     }
 
     @PreAuthorize("@ss.hasPermi('proxy:performance:view')")