|
@@ -6,6 +6,7 @@ import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -23,36 +24,71 @@ public class MaterialReportController {
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/getKuaiShouMaterialMarket")
|
|
@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")
|
|
@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")
|
|
@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")
|
|
@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;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|