yumeng hace 5 años
padre
commit
0cbae76212

+ 26 - 6
module-report/src/main/java/cn/com/ctop/bytedance/controller/AccountReportController.java

@@ -56,17 +56,37 @@ public class AccountReportController {
     }
 
     @PostMapping("/getReportList")
-    public JSONObject getReportList(@RequestBody JSONObject json) {
-        JSONObject summaryJson = accountReportService.getSummaryReport(json);
-        return summaryJson;
+    public Result<JSONObject> getReportList(@RequestBody JSONObject json) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            JSONObject summaryJson = accountReportService.getSummaryReport(json);
+            result.setResult(summaryJson);
+            result.setSuccess(true);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+
+        return result;
 
     }
 
 
     @PostMapping("/getStatistics")
-    public JSONObject getStatistics(@RequestBody JSONObject json) {
-        JSONObject statisticsJson = accountReportService.getStatistics(json);
-        return statisticsJson;
+    public Result<JSONObject> getStatistics(@RequestBody JSONObject json) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            JSONObject statisticsJson = accountReportService.getStatistics(json);
+            result.setResult(statisticsJson);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+
+        }
+
+        return result;
 
     }
 

+ 52 - 12
module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedanceReportController.java

@@ -3,6 +3,7 @@ package cn.com.ctop.bytedance.controller;
 import cn.com.ctop.bytedance.service.IBytedanceReportService;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -24,32 +25,71 @@ public class BytedanceReportController {
      * @return
      */
     @RequestMapping(value = "/accountReport")
-    public JSONObject getAccountReport() {
-        JSONObject json = bytedanceReportService.getAccountReport("e9ca23d68d884d4ebb19d07889727dae");
-        return json;
+    public Result<JSONObject> getAccountReport() {
+        Result<JSONObject> result = new Result<>();
+
+        try {
+            JSONObject json = bytedanceReportService.getAccountReport("e9ca23d68d884d4ebb19d07889727dae");
+            result.setResult(json);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+
+        return result;
     }
 
 
     @PostMapping("/kuaiShou/accountReport")
-    public JSONObject getKuaiShouAccountReport(@RequestBody JSONObject requestJson) {
-        JSONObject json = bytedanceReportService.getKuaiShouAccountReport(requestJson);
-        return json;
+    public Result<JSONObject> getKuaiShouAccountReport(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            JSONObject json = bytedanceReportService.getKuaiShouAccountReport(requestJson);
+            result.setResult(json);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+
+        return result;
 
     }
 
 
     @PostMapping("/kuaiShou/accountDetailReport")
-    public List<JSONObject> getKuaiShouAccountDetailReport(@RequestBody JSONObject requestJson) {
-        List<JSONObject> kuaiShouAccounDetailtReport = bytedanceReportService.getKuaiShouAccounDetailtReport(requestJson);
-        return kuaiShouAccounDetailtReport;
+    public Result<List<JSONObject>> getKuaiShouAccountDetailReport(@RequestBody JSONObject requestJson) {
+
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            List<JSONObject> kuaiShouAccounDetailtReport = bytedanceReportService.getKuaiShouAccounDetailtReport(requestJson);
+            result.setResult(kuaiShouAccounDetailtReport);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+
+        return result;
 
     }
 
 
     @PostMapping("/kuaiShou/getReportList")
-    public List<JSONObject> getReportList(@RequestBody JSONObject requestJson) {
-        List<JSONObject> kuaiShouAccounDetailtReport = bytedanceReportService.getReportList(requestJson);
-        return kuaiShouAccounDetailtReport;
+    public Result<List<JSONObject>> getReportList(@RequestBody JSONObject requestJson) {
+
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            List<JSONObject> kuaiShouAccounDetailtReport = bytedanceReportService.getReportList(requestJson);
+            result.setResult(kuaiShouAccounDetailtReport);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+
+        }
+        return result;
 
     }
 

+ 50 - 14
module-report/src/main/java/cn/com/ctop/bytedance/controller/MaterialReportController.java

@@ -6,6 +6,7 @@ import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -23,36 +24,71 @@ public class MaterialReportController {
 
 
     @PostMapping(value = "/getKuaiShouMaterialMarket")
-    public List<JSONObject> getKuaiShouMaterialMarket(@RequestBody JSONObject json) {
-        List<JSONObject> marketJson = materialReportService.getKuaiShouMaterialMarket(json);
-        return marketJson;
+    public Result<List<JSONObject>> getKuaiShouMaterialMarket(@RequestBody JSONObject json) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            List<JSONObject> marketJson = materialReportService.getKuaiShouMaterialMarket(json);
+            result.setResult(marketJson);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+
+        return result;
     }
 
 
     @PostMapping(value = "/getKuaiShouChainRatio")
-    public JSONObject getKuaiShouChainRatio(@RequestBody JSONObject json) {
-        JSONObject marketJson = materialReportService.getKuaiShouChainRatio(json);
-        return marketJson;
+    public Result<JSONObject> getKuaiShouChainRatio(@RequestBody JSONObject json) {
+
+        Result<JSONObject> result = new Result<>();
+        try {
+            JSONObject marketJson = materialReportService.getKuaiShouChainRatio(json);
+            result.setResult(marketJson);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+
+        return result;
 
     }
 
 
     @PostMapping(value = "/getMaterialAccount")
-    public List<UserAllocation> getKuaiShouChainRatio(@RequestBody String userId) {
-        if (Check.isNull(userId)) {
-            return null;
+    public Result<List<UserAllocation>> getKuaiShouChainRatio(@RequestBody String userId) {
+        Result<List<UserAllocation>> result = new Result<>();
+        try {
+            if (Check.isNull(userId)) {
+                throw new Exception("用户id为空");
+            }
+            List<UserAllocation> accountIdList = materialReportService.selectAccountIds(userId);
+            result.setResult(accountIdList);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+
         }
-        List<UserAllocation> accountIdList = materialReportService.selectAccountIds(userId);
-        return accountIdList;
+        return result;
 
     }
 
 
     @PostMapping(value = "/getMaterialReportByAccount")
-    public List<JSONObject> getMaterialReportByAccount(@RequestBody JSONObject json) {
+    public Result<List<JSONObject>> getMaterialReportByAccount(@RequestBody JSONObject json) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            List<JSONObject> reportList = materialReportService.selectReportByAccountIds(json);
+            result.setResult(reportList);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            result.setSuccess(false);
+        }
 
-        List<JSONObject> reportList = materialReportService.selectReportByAccountIds(json);
-        return reportList;
+        return result;
 
     }