diff --git a/Linux服务器监听运维功能.md b/Linux服务器监听运维功能.md
index 4a1be3a..e78a0c8 100644
--- a/Linux服务器监听运维功能.md
+++ b/Linux服务器监听运维功能.md
@@ -593,10 +593,10 @@
```
## 2.6 下载日志文件
-| 调用方式 | 接口地址 |
-| ------------ | :-------------------------------------- |
-| POST | http://ip:port/logListener/download/log |
-| Content-Type | application/json;charset=UTF-8 |
+| 调用方式 | 接口地址 |
+| ------------ | :---------------------------------- |
+| POST | http://ip:port/logListener/download |
+| Content-Type | application/json;charset=UTF-8 |
| 请求参数 | | | | |
| -------- | ------------- | ------ | ---- | --------------------------- |
diff --git a/pom.xml b/pom.xml
index fcae28e..90833a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -178,6 +178,11 @@
4.1.0-RC2
test
+
+ commons-io
+ commons-io
+ 2.4
+
diff --git a/src/main/java/com/objecteye/controller/BackGroundController.java b/src/main/java/com/objecteye/controller/BackGroundController.java
index 6db864e..61e214a 100644
--- a/src/main/java/com/objecteye/controller/BackGroundController.java
+++ b/src/main/java/com/objecteye/controller/BackGroundController.java
@@ -3,11 +3,13 @@ package com.objecteye.controller;
import com.alibaba.fastjson.JSONObject;
import com.objecteye.common.CommonResult;
import com.objecteye.entity.SyBasicResourceHistory;
+import com.objecteye.entity.SyServiceInterfaceMould;
import com.objecteye.service.IBackGroundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
@@ -83,4 +85,22 @@ public class BackGroundController extends BasicController {
public CommonResult serviceAction(@RequestParam(required = false) Integer id, @RequestParam(required = false) String action) {
return jsonObjectResultHandle(iBackGroundService.serviceAction(id, action));
}
+
+ @ApiOperation("根据配置明细项id获取请求http的返回值信息")
+ @RequestMapping(value = "getServiceHttpResponse", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult getServiceHttpResponse(@RequestParam Integer configId, @RequestParam Integer interfaceMouldId,
+ @RequestParam String params, @RequestParam(required = false) MultipartFile multipartFile) {
+ return CommonResult.success(iBackGroundService.getServiceHttpResponse(configId, interfaceMouldId, params, multipartFile));
+ }
+
+ @ApiOperation("获取配置服务支持的所有接口信息")
+ @RequestMapping(value = "findAllAvailableInterface", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findAllAvailableInterface(@RequestParam Integer configId) {
+ List syServiceInterfaceMoulds = iBackGroundService.findAllAvailableInterface(configId);
+ if (syServiceInterfaceMoulds.size() > 0) {
+ return CommonResult.success(syServiceInterfaceMoulds);
+ } else {
+ return CommonResult.success(201, "未找到数据", null);
+ }
+ }
}
diff --git a/src/main/java/com/objecteye/entity/SyServiceInterfaceMould.java b/src/main/java/com/objecteye/entity/SyServiceInterfaceMould.java
new file mode 100644
index 0000000..8295eea
--- /dev/null
+++ b/src/main/java/com/objecteye/entity/SyServiceInterfaceMould.java
@@ -0,0 +1,192 @@
+package com.objecteye.entity;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+public class SyServiceInterfaceMould implements Serializable {
+
+ private static final long serialVersionUID = 3590203064086293410L;
+
+ private Integer id;
+
+ private Integer mouldId;
+
+ private String methodType;
+
+ private String contentType;
+
+ private String uri;
+
+ private String defaultJson;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getMouldId() {
+ return mouldId;
+ }
+
+ public void setMouldId(Integer mouldId) {
+ this.mouldId = mouldId;
+ }
+
+ public String getMethodType() {
+ return methodType;
+ }
+
+ public void setMethodType(String methodType) {
+ this.methodType = methodType;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public String getDefaultJson() {
+ return defaultJson;
+ }
+
+ public void setDefaultJson(String defaultJson) {
+ this.defaultJson = defaultJson;
+ }
+
+ public static SyServiceInterfaceMould.Builder builder() {
+ return new SyServiceInterfaceMould.Builder();
+ }
+
+ public static class Builder {
+ private SyServiceInterfaceMould obj;
+
+ public Builder() {
+ this.obj = new SyServiceInterfaceMould();
+ }
+
+ public Builder id(Integer id) {
+ obj.setId(id);
+ return this;
+ }
+
+ public Builder mouldId(Integer mouldId) {
+ obj.setMouldId(mouldId);
+ return this;
+ }
+
+ public Builder methodType(String methodType) {
+ obj.setMethodType(methodType);
+ return this;
+ }
+
+ public Builder contentType(String contentType) {
+ obj.setContentType(contentType);
+ return this;
+ }
+
+ public Builder uri(String uri) {
+ obj.setUri(uri);
+ return this;
+ }
+
+ public Builder defaultJson(String defaultJson) {
+ obj.setDefaultJson(defaultJson);
+ return this;
+ }
+
+ public SyServiceInterfaceMould build() {
+ return this.obj;
+ }
+ }
+
+ public enum Column {
+ id("id", "id", "INTEGER", false),
+ mouldId("mould_id", "mouldId", "INTEGER", false),
+ methodType("method_type", "methodType", "VARCHAR", false),
+ contentType("content_type", "contentType", "VARCHAR", false),
+ uri("uri", "uri", "VARCHAR", false),
+ defaultJson("default_json", "defaultJson", "VARCHAR", false);
+
+ private static final String BEGINNING_DELIMITER = "\"";
+
+ private static final String ENDING_DELIMITER = "\"";
+
+ private final String column;
+
+ private final boolean isColumnNameDelimited;
+
+ private final String javaProperty;
+
+ private final String jdbcType;
+
+ public String value() {
+ return this.column;
+ }
+
+ public String getValue() {
+ return this.column;
+ }
+
+ public String getJavaProperty() {
+ return this.javaProperty;
+ }
+
+ public String getJdbcType() {
+ return this.jdbcType;
+ }
+
+ Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
+ this.column = column;
+ this.javaProperty = javaProperty;
+ this.jdbcType = jdbcType;
+ this.isColumnNameDelimited = isColumnNameDelimited;
+ }
+
+ public String desc() {
+ return this.getEscapedColumnName() + " DESC";
+ }
+
+ public String asc() {
+ return this.getEscapedColumnName() + " ASC";
+ }
+
+ public static Column[] excludes(Column... excludes) {
+ ArrayList columns = new ArrayList<>(Arrays.asList(Column.values()));
+ if (excludes != null && excludes.length > 0) {
+ columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
+ }
+ return columns.toArray(new Column[]{});
+ }
+
+ public static Column[] all() {
+ return Column.values();
+ }
+
+ public String getEscapedColumnName() {
+ if (this.isColumnNameDelimited) {
+ return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
+ } else {
+ return this.column;
+ }
+ }
+
+ public String getAliasedEscapedColumnName() {
+ return this.getEscapedColumnName();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/objecteye/entity/SyServiceInterfaceMouldExample.java b/src/main/java/com/objecteye/entity/SyServiceInterfaceMouldExample.java
new file mode 100644
index 0000000..5ab1f76
--- /dev/null
+++ b/src/main/java/com/objecteye/entity/SyServiceInterfaceMouldExample.java
@@ -0,0 +1,900 @@
+package com.objecteye.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SyServiceInterfaceMouldExample {
+ protected String orderByClause;
+
+ protected boolean distinct;
+
+ protected List oredCriteria;
+
+ protected Integer offset;
+
+ protected Integer rows;
+
+ public SyServiceInterfaceMouldExample() {
+ oredCriteria = new ArrayList();
+ }
+
+ public void setOrderByClause(String orderByClause) {
+ this.orderByClause = orderByClause;
+ }
+
+ public String getOrderByClause() {
+ return orderByClause;
+ }
+
+ public void setDistinct(boolean distinct) {
+ this.distinct = distinct;
+ }
+
+ public boolean isDistinct() {
+ return distinct;
+ }
+
+ public List getOredCriteria() {
+ return oredCriteria;
+ }
+
+ public void or(Criteria criteria) {
+ oredCriteria.add(criteria);
+ }
+
+ public Criteria or() {
+ Criteria criteria = createCriteriaInternal();
+ oredCriteria.add(criteria);
+ return criteria;
+ }
+
+ public SyServiceInterfaceMouldExample orderBy(String orderByClause) {
+ this.setOrderByClause(orderByClause);
+ return this;
+ }
+
+ public SyServiceInterfaceMouldExample orderBy(String... orderByClauses) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < orderByClauses.length; i++) {
+ sb.append(orderByClauses[i]);
+ if (i < orderByClauses.length - 1) {
+ sb.append(" , ");
+ }
+ }
+ this.setOrderByClause(sb.toString());
+ return this;
+ }
+
+ public Criteria createCriteria() {
+ Criteria criteria = createCriteriaInternal();
+ if (oredCriteria.size() == 0) {
+ oredCriteria.add(criteria);
+ }
+ return criteria;
+ }
+
+ protected Criteria createCriteriaInternal() {
+ Criteria criteria = new Criteria(this);
+ return criteria;
+ }
+
+ public void clear() {
+ oredCriteria.clear();
+ orderByClause = null;
+ distinct = false;
+ rows = null;
+ offset = null;
+ }
+
+ public void setOffset(Integer offset) {
+ this.offset = offset;
+ }
+
+ public Integer getOffset() {
+ return this.offset;
+ }
+
+ public void setRows(Integer rows) {
+ this.rows = rows;
+ }
+
+ public Integer getRows() {
+ return this.rows;
+ }
+
+ public SyServiceInterfaceMouldExample limit(Integer rows) {
+ this.rows = rows;
+ return this;
+ }
+
+ public SyServiceInterfaceMouldExample limit(Integer offset, Integer rows) {
+ this.offset = offset;
+ this.rows = rows;
+ return this;
+ }
+
+ public SyServiceInterfaceMouldExample page(Integer page, Integer pageSize) {
+ this.offset = (page - 1) * pageSize;
+ this.rows = pageSize;
+ return this;
+ }
+
+ public static Criteria newAndCreateCriteria() {
+ SyServiceInterfaceMouldExample example = new SyServiceInterfaceMouldExample();
+ return example.createCriteria();
+ }
+
+ public SyServiceInterfaceMouldExample when(boolean condition, IExampleWhen then) {
+ if (condition) {
+ then.example(this);
+ }
+ return this;
+ }
+
+ public SyServiceInterfaceMouldExample when(boolean condition, IExampleWhen then, IExampleWhen otherwise) {
+ if (condition) {
+ then.example(this);
+ } else {
+ otherwise.example(this);
+ }
+ return this;
+ }
+
+ protected abstract static class GeneratedCriteria {
+ protected List criteria;
+
+ protected GeneratedCriteria() {
+ super();
+ criteria = new ArrayList();
+ }
+
+ public boolean isValid() {
+ return criteria.size() > 0;
+ }
+
+ public List getAllCriteria() {
+ return criteria;
+ }
+
+ public List getCriteria() {
+ return criteria;
+ }
+
+ protected void addCriterion(String condition) {
+ if (condition == null) {
+ throw new RuntimeException("Value for condition cannot be null");
+ }
+ criteria.add(new Criterion(condition));
+ }
+
+ protected void addCriterion(String condition, Object value, String property) {
+ if (value == null) {
+ throw new RuntimeException("Value for " + property + " cannot be null");
+ }
+ criteria.add(new Criterion(condition, value));
+ }
+
+ protected void addCriterion(String condition, Object value1, Object value2, String property) {
+ if (value1 == null || value2 == null) {
+ throw new RuntimeException("Between values for " + property + " cannot be null");
+ }
+ criteria.add(new Criterion(condition, value1, value2));
+ }
+
+ public Criteria andIdIsNull() {
+ addCriterion("id is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdIsNotNull() {
+ addCriterion("id is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdEqualTo(Integer value) {
+ addCriterion("id =", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andIdNotEqualTo(Integer value) {
+ addCriterion("id <>", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdNotEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andIdGreaterThan(Integer value) {
+ addCriterion("id >", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdGreaterThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andIdGreaterThanOrEqualTo(Integer value) {
+ addCriterion("id >=", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andIdLessThan(Integer value) {
+ addCriterion("id <", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdLessThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andIdLessThanOrEqualTo(Integer value) {
+ addCriterion("id <=", value, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andIdIn(List values) {
+ addCriterion("id in", values, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdNotIn(List values) {
+ addCriterion("id not in", values, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdBetween(Integer value1, Integer value2) {
+ addCriterion("id between", value1, value2, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andIdNotBetween(Integer value1, Integer value2) {
+ addCriterion("id not between", value1, value2, "id");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdIsNull() {
+ addCriterion("mould_id is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdIsNotNull() {
+ addCriterion("mould_id is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdEqualTo(Integer value) {
+ addCriterion("mould_id =", value, "mouldId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("mould_id = ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdNotEqualTo(Integer value) {
+ addCriterion("mould_id <>", value, "mouldId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdNotEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("mould_id <> ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdGreaterThan(Integer value) {
+ addCriterion("mould_id >", value, "mouldId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdGreaterThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("mould_id > ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdGreaterThanOrEqualTo(Integer value) {
+ addCriterion("mould_id >=", value, "mouldId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("mould_id >= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdLessThan(Integer value) {
+ addCriterion("mould_id <", value, "mouldId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdLessThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("mould_id < ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdLessThanOrEqualTo(Integer value) {
+ addCriterion("mould_id <=", value, "mouldId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("mould_id <= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdIn(List values) {
+ addCriterion("mould_id in", values, "mouldId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdNotIn(List values) {
+ addCriterion("mould_id not in", values, "mouldId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdBetween(Integer value1, Integer value2) {
+ addCriterion("mould_id between", value1, value2, "mouldId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMouldIdNotBetween(Integer value1, Integer value2) {
+ addCriterion("mould_id not between", value1, value2, "mouldId");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeIsNull() {
+ addCriterion("method_type is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeIsNotNull() {
+ addCriterion("method_type is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeEqualTo(String value) {
+ addCriterion("method_type =", value, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("method_type = ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeNotEqualTo(String value) {
+ addCriterion("method_type <>", value, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeNotEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("method_type <> ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeGreaterThan(String value) {
+ addCriterion("method_type >", value, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeGreaterThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("method_type > ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeGreaterThanOrEqualTo(String value) {
+ addCriterion("method_type >=", value, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("method_type >= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeLessThan(String value) {
+ addCriterion("method_type <", value, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeLessThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("method_type < ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeLessThanOrEqualTo(String value) {
+ addCriterion("method_type <=", value, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("method_type <= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeLike(String value) {
+ addCriterion("method_type like", value, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeNotLike(String value) {
+ addCriterion("method_type not like", value, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeIn(List values) {
+ addCriterion("method_type in", values, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeNotIn(List values) {
+ addCriterion("method_type not in", values, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeBetween(String value1, String value2) {
+ addCriterion("method_type between", value1, value2, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andMethodTypeNotBetween(String value1, String value2) {
+ addCriterion("method_type not between", value1, value2, "methodType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeIsNull() {
+ addCriterion("content_type is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeIsNotNull() {
+ addCriterion("content_type is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeEqualTo(String value) {
+ addCriterion("content_type =", value, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("content_type = ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeNotEqualTo(String value) {
+ addCriterion("content_type <>", value, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeNotEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("content_type <> ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeGreaterThan(String value) {
+ addCriterion("content_type >", value, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeGreaterThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("content_type > ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeGreaterThanOrEqualTo(String value) {
+ addCriterion("content_type >=", value, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("content_type >= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeLessThan(String value) {
+ addCriterion("content_type <", value, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeLessThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("content_type < ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeLessThanOrEqualTo(String value) {
+ addCriterion("content_type <=", value, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("content_type <= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeLike(String value) {
+ addCriterion("content_type like", value, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeNotLike(String value) {
+ addCriterion("content_type not like", value, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeIn(List values) {
+ addCriterion("content_type in", values, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeNotIn(List values) {
+ addCriterion("content_type not in", values, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeBetween(String value1, String value2) {
+ addCriterion("content_type between", value1, value2, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andContentTypeNotBetween(String value1, String value2) {
+ addCriterion("content_type not between", value1, value2, "contentType");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriIsNull() {
+ addCriterion("uri is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriIsNotNull() {
+ addCriterion("uri is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriEqualTo(String value) {
+ addCriterion("uri =", value, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("uri = ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andUriNotEqualTo(String value) {
+ addCriterion("uri <>", value, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriNotEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("uri <> ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andUriGreaterThan(String value) {
+ addCriterion("uri >", value, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriGreaterThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("uri > ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andUriGreaterThanOrEqualTo(String value) {
+ addCriterion("uri >=", value, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("uri >= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andUriLessThan(String value) {
+ addCriterion("uri <", value, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriLessThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("uri < ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andUriLessThanOrEqualTo(String value) {
+ addCriterion("uri <=", value, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("uri <= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andUriLike(String value) {
+ addCriterion("uri like", value, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriNotLike(String value) {
+ addCriterion("uri not like", value, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriIn(List values) {
+ addCriterion("uri in", values, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriNotIn(List values) {
+ addCriterion("uri not in", values, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriBetween(String value1, String value2) {
+ addCriterion("uri between", value1, value2, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andUriNotBetween(String value1, String value2) {
+ addCriterion("uri not between", value1, value2, "uri");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonIsNull() {
+ addCriterion("default_json is null");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonIsNotNull() {
+ addCriterion("default_json is not null");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonEqualTo(String value) {
+ addCriterion("default_json =", value, "defaultJson");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("default_json = ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonNotEqualTo(String value) {
+ addCriterion("default_json <>", value, "defaultJson");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonNotEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("default_json <> ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonGreaterThan(String value) {
+ addCriterion("default_json >", value, "defaultJson");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonGreaterThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("default_json > ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonGreaterThanOrEqualTo(String value) {
+ addCriterion("default_json >=", value, "defaultJson");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("default_json >= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonLessThan(String value) {
+ addCriterion("default_json <", value, "defaultJson");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonLessThanColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("default_json < ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonLessThanOrEqualTo(String value) {
+ addCriterion("default_json <=", value, "defaultJson");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
+ addCriterion(new StringBuilder("default_json <= ").append(column.getEscapedColumnName()).toString());
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonLike(String value) {
+ addCriterion("default_json like", value, "defaultJson");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonNotLike(String value) {
+ addCriterion("default_json not like", value, "defaultJson");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonIn(List values) {
+ addCriterion("default_json in", values, "defaultJson");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonNotIn(List values) {
+ addCriterion("default_json not in", values, "defaultJson");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonBetween(String value1, String value2) {
+ addCriterion("default_json between", value1, value2, "defaultJson");
+ return (Criteria) this;
+ }
+
+ public Criteria andDefaultJsonNotBetween(String value1, String value2) {
+ addCriterion("default_json not between", value1, value2, "defaultJson");
+ return (Criteria) this;
+ }
+ }
+
+ public static class Criteria extends GeneratedCriteria {
+ private SyServiceInterfaceMouldExample example;
+
+ protected Criteria(SyServiceInterfaceMouldExample example) {
+ super();
+ this.example = example;
+ }
+
+ public SyServiceInterfaceMouldExample example() {
+ return this.example;
+ }
+
+ @Deprecated
+ public Criteria andIf(boolean ifAdd, ICriteriaAdd add) {
+ if (ifAdd) {
+ add.add(this);
+ }
+ return this;
+ }
+
+ public Criteria when(boolean condition, ICriteriaWhen then) {
+ if (condition) {
+ then.criteria(this);
+ }
+ return this;
+ }
+
+ public Criteria when(boolean condition, ICriteriaWhen then, ICriteriaWhen otherwise) {
+ if (condition) {
+ then.criteria(this);
+ } else {
+ otherwise.criteria(this);
+ }
+ return this;
+ }
+
+ @Deprecated
+ public interface ICriteriaAdd {
+ Criteria add(Criteria add);
+ }
+ }
+
+ public static class Criterion {
+ private String condition;
+
+ private Object value;
+
+ private Object secondValue;
+
+ private boolean noValue;
+
+ private boolean singleValue;
+
+ private boolean betweenValue;
+
+ private boolean listValue;
+
+ private String typeHandler;
+
+ public String getCondition() {
+ return condition;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object getSecondValue() {
+ return secondValue;
+ }
+
+ public boolean isNoValue() {
+ return noValue;
+ }
+
+ public boolean isSingleValue() {
+ return singleValue;
+ }
+
+ public boolean isBetweenValue() {
+ return betweenValue;
+ }
+
+ public boolean isListValue() {
+ return listValue;
+ }
+
+ public String getTypeHandler() {
+ return typeHandler;
+ }
+
+ protected Criterion(String condition) {
+ super();
+ this.condition = condition;
+ this.typeHandler = null;
+ this.noValue = true;
+ }
+
+ protected Criterion(String condition, Object value, String typeHandler) {
+ super();
+ this.condition = condition;
+ this.value = value;
+ this.typeHandler = typeHandler;
+ if (value instanceof List>) {
+ this.listValue = true;
+ } else {
+ this.singleValue = true;
+ }
+ }
+
+ protected Criterion(String condition, Object value) {
+ this(condition, value, null);
+ }
+
+ protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+ super();
+ this.condition = condition;
+ this.value = value;
+ this.secondValue = secondValue;
+ this.typeHandler = typeHandler;
+ this.betweenValue = true;
+ }
+
+ protected Criterion(String condition, Object value, Object secondValue) {
+ this(condition, value, secondValue, null);
+ }
+ }
+
+ public interface ICriteriaWhen {
+ void criteria(Criteria criteria);
+ }
+
+ public interface IExampleWhen {
+ void example(com.objecteye.entity.SyServiceInterfaceMouldExample example);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/objecteye/mapper/SyServiceInterfaceMouldMapper.java b/src/main/java/com/objecteye/mapper/SyServiceInterfaceMouldMapper.java
new file mode 100644
index 0000000..03ba75c
--- /dev/null
+++ b/src/main/java/com/objecteye/mapper/SyServiceInterfaceMouldMapper.java
@@ -0,0 +1,33 @@
+package com.objecteye.mapper;
+
+import com.objecteye.entity.SyServiceInterfaceMould;
+import com.objecteye.entity.SyServiceInterfaceMouldExample;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface SyServiceInterfaceMouldMapper {
+ long countByExample(SyServiceInterfaceMouldExample example);
+
+ int deleteByExample(SyServiceInterfaceMouldExample example);
+
+ int deleteByPrimaryKey(Integer id);
+
+ int insert(SyServiceInterfaceMould record);
+
+ int insertSelective(SyServiceInterfaceMould record);
+
+ SyServiceInterfaceMould selectOneByExample(SyServiceInterfaceMouldExample example);
+
+ List selectByExample(SyServiceInterfaceMouldExample example);
+
+ SyServiceInterfaceMould selectByPrimaryKey(Integer id);
+
+ int updateByExampleSelective(@Param("record") SyServiceInterfaceMould record, @Param("example") SyServiceInterfaceMouldExample example);
+
+ int updateByExample(@Param("record") SyServiceInterfaceMould record, @Param("example") SyServiceInterfaceMouldExample example);
+
+ int updateByPrimaryKeySelective(SyServiceInterfaceMould record);
+
+ int updateByPrimaryKey(SyServiceInterfaceMould record);
+}
\ No newline at end of file
diff --git a/src/main/java/com/objecteye/service/IBackGroundService.java b/src/main/java/com/objecteye/service/IBackGroundService.java
index be69715..e7a3d54 100644
--- a/src/main/java/com/objecteye/service/IBackGroundService.java
+++ b/src/main/java/com/objecteye/service/IBackGroundService.java
@@ -3,6 +3,8 @@ package com.objecteye.service;
import com.alibaba.fastjson.JSONObject;
import com.objecteye.common.PageResult;
import com.objecteye.entity.SyBasicResourceHistory;
+import com.objecteye.entity.SyServiceInterfaceMould;
+import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
@@ -104,4 +106,23 @@ public interface IBackGroundService {
* 每分钟更新一次所有服务的状态
*/
void serviceStatusUpdater();
+
+ /**
+ * 根据配置明细项id获取请求http的返回值信息(固定对应的itemName为 serviceInterface)
+ *
+ * @param configId 服务主键
+ * @param interfaceMouldId 接口模板表主键
+ * @param paramsStr 发送参数
+ * @param multipartFile 请求文件
+ * @return http请求返回信息
+ */
+ String getServiceHttpResponse(Integer configId, Integer interfaceMouldId, String paramsStr, MultipartFile multipartFile);
+
+ /**
+ * 获取配置服务支持的所有接口信息(固定对应的itemName为 serviceInterface, interfaceMould)
+ *
+ * @param configId 服务主键
+ * @return 支持的所有接口信息
+ */
+ List findAllAvailableInterface(Integer configId);
}
diff --git a/src/main/java/com/objecteye/service/impl/BackGroundServiceImpl.java b/src/main/java/com/objecteye/service/impl/BackGroundServiceImpl.java
index e8e11b4..a4efb25 100644
--- a/src/main/java/com/objecteye/service/impl/BackGroundServiceImpl.java
+++ b/src/main/java/com/objecteye/service/impl/BackGroundServiceImpl.java
@@ -7,23 +7,35 @@ import com.alibaba.fastjson.JSONObject;
import com.objecteye.common.GeneralContent;
import com.objecteye.common.PageResult;
import com.objecteye.entity.*;
+import com.objecteye.exception.CustomXException;
import com.objecteye.mapper.SyBasicResourceHistoryMapper;
import com.objecteye.mapper.SyServiceConfigItemMapper;
import com.objecteye.mapper.SyServiceConfigMapper;
+import com.objecteye.mapper.SyServiceInterfaceMouldMapper;
import com.objecteye.service.IBackGroundService;
import com.objecteye.service.IOccupationOfBasicResourcesService;
import com.objecteye.utils.LinuxUtils;
import com.objecteye.vo.VSyServiceMainTable;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.FileSystemResource;
import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartFile;
+import java.io.File;
+import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
@@ -41,6 +53,8 @@ public class BackGroundServiceImpl implements IBackGroundService {
@Autowired
private SyServiceConfigItemMapper syServiceConfigItemMapper;
@Autowired
+ private SyServiceInterfaceMouldMapper syServiceInterfaceMouldMapper;
+ @Autowired
private RestTemplate restTemplate;
/**
@@ -340,6 +354,7 @@ public class BackGroundServiceImpl implements IBackGroundService {
@Override
@Transactional
public JSONObject deleteServiceConfig(Integer id) {
+ serviceAction(id, "remove");
syServiceConfigMapper.deleteByPrimaryKey(id);
SyServiceConfigItemExample syServiceConfigItemExample = SyServiceConfigItemExample
.newAndCreateCriteria().andConfigIdEqualTo(id).example();
@@ -538,4 +553,110 @@ public class BackGroundServiceImpl implements IBackGroundService {
}
return resultObj;
}
+
+ /**
+ * 根据配置明细项id获取请求http的返回值信息(固定对应的itemName为 serviceInterface, interfaceMould)
+ *
+ * @param configId 服务主键
+ * @param interfaceMouldId 接口模板表主键
+ * @param paramsStr 发送参数
+ * @param multipartFile 请求文件
+ * @return http请求返回信息
+ */
+ @Override
+ public String getServiceHttpResponse(Integer configId, Integer interfaceMouldId, String paramsStr, MultipartFile multipartFile) {
+ List syServiceConfigItems = syServiceConfigItemMapper.selectByExample(SyServiceConfigItemExample.newAndCreateCriteria().andConfigIdEqualTo(configId)
+ .andItemNameIn(Arrays.asList("http", "port")).example());
+ String ip = null;
+ String port = null;
+ for (SyServiceConfigItem syServiceConfigItem : syServiceConfigItems) {
+ if (syServiceConfigItem == null) {
+ continue;
+ }
+ if ("http".equals(syServiceConfigItem.getItemName())) {
+ ip = syServiceConfigItem.getItemValue();
+ } else if ("port".equals(syServiceConfigItem.getItemName())) {
+ port = syServiceConfigItem.getItemValue();
+ }
+ }
+ if (ip == null || "".equals(ip) || port == null || "".equals(port)) {
+ throw new CustomXException("201", "请求地址或端口配置信息异常");
+ }
+
+ String uri = null;
+ SyServiceInterfaceMould syServiceInterfaceMould = syServiceInterfaceMouldMapper.selectByPrimaryKey(interfaceMouldId);
+ if (syServiceInterfaceMould == null) {
+ throw new CustomXException("201", "参数为空");
+ }
+ uri = syServiceInterfaceMould.getUri();
+ if (uri == null) {
+ throw new CustomXException("201", "请求路径信息异常");
+ }
+ JSONObject paramJson = JSON.parseObject(paramsStr);
+ MultiValueMap multiValueMap = new LinkedMultiValueMap<>();
+ for (String key : paramJson.keySet()) {
+ String value = paramJson.getString(key);
+ if ("#file#".equals(value)) {
+ if (multipartFile != null && multipartFile.getOriginalFilename() != null) {
+ try {
+ FileUtils.writeByteArrayToFile(new File(multipartFile.getOriginalFilename()), multipartFile.getBytes());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ FileSystemResource fileSystemResource = new FileSystemResource(new File(multipartFile.getOriginalFilename()));
+ multiValueMap.add(key, fileSystemResource);
+ } else {
+ throw new CustomXException("201", "参数为空");
+ }
+ } else {
+ multiValueMap.add(key, value);
+ }
+ }
+
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.setContentType(MediaType.parseMediaType(syServiceInterfaceMould.getContentType()));
+ HttpEntity> httpEntity = new HttpEntity<>(multiValueMap, httpHeaders);
+ if ("post".equals(syServiceInterfaceMould.getMethodType().toLowerCase())) {
+ ResponseEntity responseEntity = restTemplate.postForEntity("http://" + ip + ":" + port + uri, httpEntity, String.class);
+ return responseEntity.getBody();
+ } else {
+ return "其他请求方式暂不支持";
+ }
+ }
+
+ /**
+ * 获取配置服务支持的所有接口信息(固定对应的itemName为 serviceInterface, interfaceMould)
+ *
+ * @param configId 服务主键
+ * @return 支持的所有接口信息
+ */
+ @Override
+ public List findAllAvailableInterface(Integer configId) {
+ // serviceInterface(除接口模板外还有的接口信息), interfaceMould(接口模板对应的id)
+ List syServiceConfigItems = syServiceConfigItemMapper.selectByExample(SyServiceConfigItemExample
+ .newAndCreateCriteria()
+ .andConfigIdEqualTo(configId)
+ .andItemNameIn(Arrays.asList("serviceInterface", "interfaceMould")).example());
+
+ List interfaceMouldIdList = new ArrayList<>();
+ Integer mouldId = null;
+ for (SyServiceConfigItem syServiceConfigItem : syServiceConfigItems) {
+ if (syServiceConfigItem == null) {
+ continue;
+ }
+ if ("serviceInterface".equals(syServiceConfigItem.getItemName())) {
+ interfaceMouldIdList.add(Integer.valueOf(syServiceConfigItem.getItemValue()));
+ } else if ("interfaceMould".equals(syServiceConfigItem.getItemName())) {
+ mouldId = Integer.valueOf(syServiceConfigItem.getItemValue());
+ }
+ }
+ SyServiceInterfaceMouldExample syServiceInterfaceMouldExample = new SyServiceInterfaceMouldExample();
+ if (interfaceMouldIdList.size() > 0) {
+ syServiceInterfaceMouldExample.or(SyServiceInterfaceMouldExample.newAndCreateCriteria().andIdIn(interfaceMouldIdList));
+ }
+ if (mouldId != null) {
+ syServiceInterfaceMouldExample.or(SyServiceInterfaceMouldExample.newAndCreateCriteria().andMouldIdEqualTo(mouldId));
+ }
+ return syServiceInterfaceMouldMapper.selectByExample(syServiceInterfaceMouldExample);
+ }
}
diff --git a/src/main/java/com/objecteye/service/impl/OccupationOfBasicResourcesServiceImpl.java b/src/main/java/com/objecteye/service/impl/OccupationOfBasicResourcesServiceImpl.java
index 31224be..91fca07 100644
--- a/src/main/java/com/objecteye/service/impl/OccupationOfBasicResourcesServiceImpl.java
+++ b/src/main/java/com/objecteye/service/impl/OccupationOfBasicResourcesServiceImpl.java
@@ -32,6 +32,7 @@ public class OccupationOfBasicResourcesServiceImpl implements IOccupationOfBasic
@Override
public JSONArray getInfoByModule(Map requestMap) {
String module = (String) requestMap.get("module");
+ JSONArray resultArr = new JSONArray();
if ("uptime".equals(module)) {
String cmd = "uptime";
List outList = new ArrayList<>();
@@ -41,15 +42,22 @@ public class OccupationOfBasicResourcesServiceImpl implements IOccupationOfBasic
String uptimeStr = outArr[0].substring(outArr[0].indexOf("up") + 2).trim() + "," + outArr[1];
uptimeStr = uptimeStr.replaceAll("days", "天");
if (!uptimeStr.contains("min")) {
- uptimeStr = uptimeStr.replaceAll(":", "h") + "min";
+ uptimeStr = uptimeStr.replaceAll(":", "小时") + "分钟";
+ } else {
+ uptimeStr = uptimeStr.replaceAll("min", "分钟");
}
JSONObject resultObj = new JSONObject();
resultObj.put("result", uptimeStr);
- JSONArray resultArr = new JSONArray();
resultArr.add(resultObj);
return resultArr;
} else {
- return getInfoByModule((String) requestMap.get("module"));
+ resultArr = getInfoByModule((String) requestMap.get("module"));
+ if (resultArr.size() > 0 && "memory_info".equals(module)) {
+ JSONObject resultObj = resultArr.getJSONObject(0);
+ String memTotal = resultObj.getString("MemTotal").replaceAll("kB", "").trim();
+ resultObj.put("MemTotalG", Integer.parseInt(memTotal) / 1024 / 2014 + "G");
+ }
+ return resultArr;
}
}
diff --git a/src/main/resources/com.objecteye.mapper/SyServiceInterfaceMouldMapper.xml b/src/main/resources/com.objecteye.mapper/SyServiceInterfaceMouldMapper.xml
new file mode 100644
index 0000000..a6ffd1b
--- /dev/null
+++ b/src/main/resources/com.objecteye.mapper/SyServiceInterfaceMouldMapper.xml
@@ -0,0 +1,256 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and ${criterion.condition}
+
+
+ and ${criterion.condition} #{criterion.value}
+
+
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+
+
+ and ${criterion.condition}
+
+ #{listItem}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and ${criterion.condition}
+
+
+ and ${criterion.condition} #{criterion.value}
+
+
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+
+
+ and ${criterion.condition}
+
+ #{listItem}
+
+
+
+
+
+
+
+
+
+
+ id, mould_id, method_type, content_type, uri, default_json
+
+
+
+
+ delete
+ from sy_service_interface_mould
+ where id = #{id,jdbcType=INTEGER}
+
+
+ delete from sy_service_interface_mould
+
+
+
+
+
+
+ SELECT LAST_INSERT_ID()
+
+ insert into sy_service_interface_mould (id, mould_id, method_type,
+ content_type, uri, default_json
+ )
+ values (#{id,jdbcType=INTEGER}, #{mouldId,jdbcType=INTEGER}, #{methodType,jdbcType=VARCHAR},
+ #{contentType,jdbcType=VARCHAR}, #{uri,jdbcType=VARCHAR}, #{defaultJson,jdbcType=VARCHAR}
+ )
+
+
+
+ SELECT LAST_INSERT_ID()
+
+ insert into sy_service_interface_mould
+
+ id,
+
+ mould_id,
+
+
+ method_type,
+
+
+ content_type,
+
+
+ uri,
+
+
+ default_json,
+
+
+
+ #{id,jdbcType=INTEGER},
+
+ #{mouldId,jdbcType=INTEGER},
+
+
+ #{methodType,jdbcType=VARCHAR},
+
+
+ #{contentType,jdbcType=VARCHAR},
+
+
+ #{uri,jdbcType=VARCHAR},
+
+
+ #{defaultJson,jdbcType=VARCHAR},
+
+
+
+
+
+ update sy_service_interface_mould
+
+
+ id = #{record.id,jdbcType=INTEGER},
+
+
+ mould_id = #{record.mouldId,jdbcType=INTEGER},
+
+
+ method_type = #{record.methodType,jdbcType=VARCHAR},
+
+
+ content_type = #{record.contentType,jdbcType=VARCHAR},
+
+
+ uri = #{record.uri,jdbcType=VARCHAR},
+
+
+ default_json = #{record.defaultJson,jdbcType=VARCHAR},
+
+
+
+
+
+
+
+ update sy_service_interface_mould
+ set id = #{record.id,jdbcType=INTEGER},
+ mould_id = #{record.mouldId,jdbcType=INTEGER},
+ method_type = #{record.methodType,jdbcType=VARCHAR},
+ content_type = #{record.contentType,jdbcType=VARCHAR},
+ uri = #{record.uri,jdbcType=VARCHAR},
+ default_json = #{record.defaultJson,jdbcType=VARCHAR}
+
+
+
+
+
+ update sy_service_interface_mould
+
+
+ mould_id = #{mouldId,jdbcType=INTEGER},
+
+
+ method_type = #{methodType,jdbcType=VARCHAR},
+
+
+ content_type = #{contentType,jdbcType=VARCHAR},
+
+
+ uri = #{uri,jdbcType=VARCHAR},
+
+
+ default_json = #{defaultJson,jdbcType=VARCHAR},
+
+
+ where id = #{id,jdbcType=INTEGER}
+
+
+ update sy_service_interface_mould
+ set mould_id = #{mouldId,jdbcType=INTEGER},
+ method_type = #{methodType,jdbcType=VARCHAR},
+ content_type = #{contentType,jdbcType=VARCHAR},
+ uri = #{uri,jdbcType=VARCHAR},
+ default_json = #{defaultJson,jdbcType=VARCHAR}
+ where id = #{id,jdbcType=INTEGER}
+
+
+
\ No newline at end of file