|
@ -1,5 +1,6 @@
|
|
|
package com.yihu.hos.resource.control;
|
|
|
|
|
|
import com.yihu.hos.gateway.model.rest.RestResponseResult;
|
|
|
import com.yihu.hos.resource.service.intf.IResourceService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@ -47,10 +48,11 @@ public class ResourceControl {
|
|
|
*/
|
|
|
@RequestMapping(value = "/getAuthorizedResource", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "授权资源清单接口", response = Object.class, produces = "application/json", notes = "查询授权资源清单")
|
|
|
public Object getAuthorizedResource(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
|
|
|
@ApiParam(value = "每页显示条数", required = true) @RequestParam(value = "rows") String rows,
|
|
|
@ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition,
|
|
|
HttpServletRequest request) {
|
|
|
public RestResponseResult getAuthorizedResource(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
|
|
|
@ApiParam(value = "每页显示条数", required = true) @RequestParam(value = "rows") String rows,
|
|
|
@ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition,
|
|
|
HttpServletRequest request) {
|
|
|
RestResponseResult restResponseResult = new RestResponseResult();
|
|
|
String returnDate = "";
|
|
|
try {
|
|
|
//String sys_id = request.getParameter("sys_id");//渠道ID
|
|
@ -61,11 +63,13 @@ public class ResourceControl {
|
|
|
rows = "10";
|
|
|
}
|
|
|
returnDate = resourceService.getAuthorizedResource(String.valueOf(page), String.valueOf(rows), condition);
|
|
|
restResponseResult.setResponseResult(returnDate);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return e.getMessage();
|
|
|
restResponseResult.setResponseCode("20000");
|
|
|
restResponseResult.setResponseMessage(e.getMessage());
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
return returnDate;
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -108,6 +112,7 @@ public class ResourceControl {
|
|
|
@ApiParam(value = "每页显示条数", required = true) @RequestParam(value = "rows") String rows,
|
|
|
@ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition,
|
|
|
HttpServletRequest request) {
|
|
|
RestResponseResult restResponseResult = new RestResponseResult();
|
|
|
String returnDate = "";
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(page)) {
|
|
@ -118,17 +123,18 @@ public class ResourceControl {
|
|
|
}
|
|
|
returnDate = resourceService.getResource(String.valueOf(page), String.valueOf(rows), condition);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return e.getMessage();
|
|
|
restResponseResult.setResponseResult(returnDate);
|
|
|
} catch (Exception e) { restResponseResult.setResponseCode("20000");
|
|
|
restResponseResult.setResponseMessage(e.getMessage());
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
return returnDate;
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 数据字典查询接口
|
|
|
* <p/>
|
|
|
* <p>
|
|
|
* code 字典代码
|
|
|
* page 当前页
|
|
|
* pageSize 每页大小
|
|
@ -159,6 +165,7 @@ public class ResourceControl {
|
|
|
public Object getDictionary(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
|
|
|
@ApiParam(value = "每页显示条数", required = true) @RequestParam(value = "rows") String rows,
|
|
|
@ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition, HttpServletRequest request) {
|
|
|
RestResponseResult restResponseResult = new RestResponseResult();
|
|
|
String returnDate = "";
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(page)) {
|
|
@ -169,16 +176,18 @@ public class ResourceControl {
|
|
|
}
|
|
|
returnDate = resourceService.getDictionary(String.valueOf(page), String.valueOf(rows), condition);
|
|
|
|
|
|
restResponseResult.setResponseResult(returnDate);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return e.getMessage();
|
|
|
restResponseResult.setResponseCode("20000");
|
|
|
restResponseResult.setResponseMessage(e.getMessage());
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
return returnDate;
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 资源元数据查询接口
|
|
|
* <p/>
|
|
|
* <p>
|
|
|
* code 数据集代码
|
|
|
*
|
|
|
* @return {
|
|
@ -202,6 +211,7 @@ public class ResourceControl {
|
|
|
public Object getResourceMetadata(@ApiParam(value = "当前页", required = true) @RequestParam(value = "page") String page,
|
|
|
@ApiParam(value = "每页显示条数", required = true) @RequestParam(value = "rows") String rows,
|
|
|
@ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition, HttpServletRequest request) {
|
|
|
RestResponseResult restResponseResult = new RestResponseResult();
|
|
|
String returnDate = "";
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(page)) {
|
|
@ -211,12 +221,13 @@ public class ResourceControl {
|
|
|
rows = "10";
|
|
|
}
|
|
|
returnDate = resourceService.getResourceMetadata(String.valueOf(page), String.valueOf(rows), condition);
|
|
|
|
|
|
restResponseResult.setResponseResult(returnDate);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return e.getMessage();
|
|
|
restResponseResult.setResponseCode("20000");
|
|
|
restResponseResult.setResponseMessage(e.getMessage());
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
return returnDate;
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/getMongoDBData", method = RequestMethod.GET)
|
|
@ -226,6 +237,7 @@ public class ResourceControl {
|
|
|
@ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition,
|
|
|
@ApiParam(value = "mongo表名", required = true) @RequestParam(value = "tableCode") String tableCode,
|
|
|
HttpServletRequest request) {
|
|
|
RestResponseResult restResponseResult = new RestResponseResult();
|
|
|
String returnDate = "";
|
|
|
try {
|
|
|
//String sys_id = request.getParameter("sys_id");//渠道ID
|
|
@ -239,11 +251,13 @@ public class ResourceControl {
|
|
|
}
|
|
|
returnDate = resourceService.getMongoDBData(String.valueOf(page), String.valueOf(rows), tableCode, condition);
|
|
|
|
|
|
restResponseResult.setResponseResult(returnDate);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return e.getMessage();
|
|
|
restResponseResult.setResponseCode("20000");
|
|
|
restResponseResult.setResponseMessage(e.getMessage());
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
return returnDate;
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/collectionData", method = RequestMethod.GET)
|
|
@ -252,6 +266,7 @@ public class ResourceControl {
|
|
|
@ApiParam(value = "mongo表名", required = true) @RequestParam(value = "tableCode") String tableCode,
|
|
|
@ApiParam(value = "参数", required = true) @RequestParam(value = "condition") String condition,
|
|
|
HttpServletRequest request) {
|
|
|
RestResponseResult restResponseResult = new RestResponseResult();
|
|
|
String returnDate = "";
|
|
|
try {
|
|
|
//String sys_id = request.getParameter("sys_id");//渠道ID
|
|
@ -261,26 +276,31 @@ public class ResourceControl {
|
|
|
throw new Exception("condition参数格式错误");
|
|
|
}
|
|
|
returnDate = resourceService.collectionData(tableCode, condition);
|
|
|
restResponseResult.setResponseResult(returnDate);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return e.getMessage();
|
|
|
restResponseResult.setResponseCode("20000");
|
|
|
restResponseResult.setResponseMessage(e.getMessage());
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
return returnDate;
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/getCurrentTime", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "得到系统时间", response = Object.class, produces = "application/json", notes = "得到系统时间")
|
|
|
public Object collectionData(
|
|
|
HttpServletRequest request) {
|
|
|
RestResponseResult restResponseResult = new RestResponseResult();
|
|
|
String returnDate = "";
|
|
|
try {
|
|
|
returnDate = Calendar.getInstance().getTimeInMillis() + "";
|
|
|
restResponseResult.setResponseResult(returnDate);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return e.getMessage();
|
|
|
restResponseResult.setResponseCode("20000");
|
|
|
restResponseResult.setResponseMessage(e.getMessage());
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
return returnDate;
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/executeSQL", method = RequestMethod.GET)
|
|
@ -288,14 +308,17 @@ public class ResourceControl {
|
|
|
public Object executeSQL(
|
|
|
@ApiParam(value = "SQL语句", required = true) @RequestParam(value = "sql") String sql,
|
|
|
HttpServletRequest request) {
|
|
|
RestResponseResult restResponseResult = new RestResponseResult();
|
|
|
String returnDate = "";
|
|
|
try {
|
|
|
returnDate = resourceService.executeSQL(sql);
|
|
|
restResponseResult.setResponseResult(returnDate);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return e.getMessage();
|
|
|
restResponseResult.setResponseCode("20000");
|
|
|
restResponseResult.setResponseMessage(e.getMessage());
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
return returnDate;
|
|
|
return restResponseResult;
|
|
|
}
|
|
|
|
|
|
/* 文件上传的例子
|