Commit 2a1e773046e6de13daabb75ea01f164ec1f71a0f

Authored by Liu Haoyu
1 parent 5d9e899f

新增服务内接口调用相关功能(接口文档待维护);

代码重构;
Linux服务器监听运维功能.md
... ... @@ -593,10 +593,10 @@
593 593 ```
594 594 ## 2.6 下载日志文件
595 595  
596   -| 调用方式 | 接口地址 |
597   -| ------------ | :-------------------------------------- |
598   -| POST | http://ip:port/logListener/download/log |
599   -| Content-Type | application/json;charset=UTF-8 |
  596 +| 调用方式 | 接口地址 |
  597 +| ------------ | :---------------------------------- |
  598 +| POST | http://ip:port/logListener/download |
  599 +| Content-Type | application/json;charset=UTF-8 |
600 600  
601 601 | 请求参数 | | | | |
602 602 | -------- | ------------- | ------ | ---- | --------------------------- |
... ...
... ... @@ -178,6 +178,11 @@
178 178 <version>4.1.0-RC2</version>
179 179 <scope>test</scope>
180 180 </dependency>
  181 + <dependency>
  182 + <groupId>commons-io</groupId>
  183 + <artifactId>commons-io</artifactId>
  184 + <version>2.4</version>
  185 + </dependency>
181 186 </dependencies>
182 187  
183 188 <build>
... ...
src/main/java/com/objecteye/controller/BackGroundController.java
... ... @@ -3,11 +3,13 @@ package com.objecteye.controller;
3 3 import com.alibaba.fastjson.JSONObject;
4 4 import com.objecteye.common.CommonResult;
5 5 import com.objecteye.entity.SyBasicResourceHistory;
  6 +import com.objecteye.entity.SyServiceInterfaceMould;
6 7 import com.objecteye.service.IBackGroundService;
7 8 import io.swagger.annotations.Api;
8 9 import io.swagger.annotations.ApiOperation;
9 10 import org.springframework.beans.factory.annotation.Autowired;
10 11 import org.springframework.web.bind.annotation.*;
  12 +import org.springframework.web.multipart.MultipartFile;
11 13  
12 14 import java.util.List;
13 15 import java.util.Map;
... ... @@ -83,4 +85,22 @@ public class BackGroundController extends BasicController {
83 85 public CommonResult serviceAction(@RequestParam(required = false) Integer id, @RequestParam(required = false) String action) {
84 86 return jsonObjectResultHandle(iBackGroundService.serviceAction(id, action));
85 87 }
  88 +
  89 + @ApiOperation("根据配置明细项id获取请求http的返回值信息")
  90 + @RequestMapping(value = "getServiceHttpResponse", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
  91 + public CommonResult<String> getServiceHttpResponse(@RequestParam Integer configId, @RequestParam Integer interfaceMouldId,
  92 + @RequestParam String params, @RequestParam(required = false) MultipartFile multipartFile) {
  93 + return CommonResult.success(iBackGroundService.getServiceHttpResponse(configId, interfaceMouldId, params, multipartFile));
  94 + }
  95 +
  96 + @ApiOperation("获取配置服务支持的所有接口信息")
  97 + @RequestMapping(value = "findAllAvailableInterface", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
  98 + public CommonResult findAllAvailableInterface(@RequestParam Integer configId) {
  99 + List<SyServiceInterfaceMould> syServiceInterfaceMoulds = iBackGroundService.findAllAvailableInterface(configId);
  100 + if (syServiceInterfaceMoulds.size() > 0) {
  101 + return CommonResult.success(syServiceInterfaceMoulds);
  102 + } else {
  103 + return CommonResult.success(201, "未找到数据", null);
  104 + }
  105 + }
86 106 }
... ...
src/main/java/com/objecteye/entity/SyServiceInterfaceMould.java 0 → 100644
  1 +package com.objecteye.entity;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.ArrayList;
  5 +import java.util.Arrays;
  6 +
  7 +public class SyServiceInterfaceMould implements Serializable {
  8 +
  9 + private static final long serialVersionUID = 3590203064086293410L;
  10 +
  11 + private Integer id;
  12 +
  13 + private Integer mouldId;
  14 +
  15 + private String methodType;
  16 +
  17 + private String contentType;
  18 +
  19 + private String uri;
  20 +
  21 + private String defaultJson;
  22 +
  23 + public Integer getId() {
  24 + return id;
  25 + }
  26 +
  27 + public void setId(Integer id) {
  28 + this.id = id;
  29 + }
  30 +
  31 + public Integer getMouldId() {
  32 + return mouldId;
  33 + }
  34 +
  35 + public void setMouldId(Integer mouldId) {
  36 + this.mouldId = mouldId;
  37 + }
  38 +
  39 + public String getMethodType() {
  40 + return methodType;
  41 + }
  42 +
  43 + public void setMethodType(String methodType) {
  44 + this.methodType = methodType;
  45 + }
  46 +
  47 + public String getContentType() {
  48 + return contentType;
  49 + }
  50 +
  51 + public void setContentType(String contentType) {
  52 + this.contentType = contentType;
  53 + }
  54 +
  55 + public String getUri() {
  56 + return uri;
  57 + }
  58 +
  59 + public void setUri(String uri) {
  60 + this.uri = uri;
  61 + }
  62 +
  63 + public String getDefaultJson() {
  64 + return defaultJson;
  65 + }
  66 +
  67 + public void setDefaultJson(String defaultJson) {
  68 + this.defaultJson = defaultJson;
  69 + }
  70 +
  71 + public static SyServiceInterfaceMould.Builder builder() {
  72 + return new SyServiceInterfaceMould.Builder();
  73 + }
  74 +
  75 + public static class Builder {
  76 + private SyServiceInterfaceMould obj;
  77 +
  78 + public Builder() {
  79 + this.obj = new SyServiceInterfaceMould();
  80 + }
  81 +
  82 + public Builder id(Integer id) {
  83 + obj.setId(id);
  84 + return this;
  85 + }
  86 +
  87 + public Builder mouldId(Integer mouldId) {
  88 + obj.setMouldId(mouldId);
  89 + return this;
  90 + }
  91 +
  92 + public Builder methodType(String methodType) {
  93 + obj.setMethodType(methodType);
  94 + return this;
  95 + }
  96 +
  97 + public Builder contentType(String contentType) {
  98 + obj.setContentType(contentType);
  99 + return this;
  100 + }
  101 +
  102 + public Builder uri(String uri) {
  103 + obj.setUri(uri);
  104 + return this;
  105 + }
  106 +
  107 + public Builder defaultJson(String defaultJson) {
  108 + obj.setDefaultJson(defaultJson);
  109 + return this;
  110 + }
  111 +
  112 + public SyServiceInterfaceMould build() {
  113 + return this.obj;
  114 + }
  115 + }
  116 +
  117 + public enum Column {
  118 + id("id", "id", "INTEGER", false),
  119 + mouldId("mould_id", "mouldId", "INTEGER", false),
  120 + methodType("method_type", "methodType", "VARCHAR", false),
  121 + contentType("content_type", "contentType", "VARCHAR", false),
  122 + uri("uri", "uri", "VARCHAR", false),
  123 + defaultJson("default_json", "defaultJson", "VARCHAR", false);
  124 +
  125 + private static final String BEGINNING_DELIMITER = "\"";
  126 +
  127 + private static final String ENDING_DELIMITER = "\"";
  128 +
  129 + private final String column;
  130 +
  131 + private final boolean isColumnNameDelimited;
  132 +
  133 + private final String javaProperty;
  134 +
  135 + private final String jdbcType;
  136 +
  137 + public String value() {
  138 + return this.column;
  139 + }
  140 +
  141 + public String getValue() {
  142 + return this.column;
  143 + }
  144 +
  145 + public String getJavaProperty() {
  146 + return this.javaProperty;
  147 + }
  148 +
  149 + public String getJdbcType() {
  150 + return this.jdbcType;
  151 + }
  152 +
  153 + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
  154 + this.column = column;
  155 + this.javaProperty = javaProperty;
  156 + this.jdbcType = jdbcType;
  157 + this.isColumnNameDelimited = isColumnNameDelimited;
  158 + }
  159 +
  160 + public String desc() {
  161 + return this.getEscapedColumnName() + " DESC";
  162 + }
  163 +
  164 + public String asc() {
  165 + return this.getEscapedColumnName() + " ASC";
  166 + }
  167 +
  168 + public static Column[] excludes(Column... excludes) {
  169 + ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
  170 + if (excludes != null && excludes.length > 0) {
  171 + columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
  172 + }
  173 + return columns.toArray(new Column[]{});
  174 + }
  175 +
  176 + public static Column[] all() {
  177 + return Column.values();
  178 + }
  179 +
  180 + public String getEscapedColumnName() {
  181 + if (this.isColumnNameDelimited) {
  182 + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
  183 + } else {
  184 + return this.column;
  185 + }
  186 + }
  187 +
  188 + public String getAliasedEscapedColumnName() {
  189 + return this.getEscapedColumnName();
  190 + }
  191 + }
  192 +}
0 193 \ No newline at end of file
... ...
src/main/java/com/objecteye/entity/SyServiceInterfaceMouldExample.java 0 → 100644
  1 +package com.objecteye.entity;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +public class SyServiceInterfaceMouldExample {
  7 + protected String orderByClause;
  8 +
  9 + protected boolean distinct;
  10 +
  11 + protected List<Criteria> oredCriteria;
  12 +
  13 + protected Integer offset;
  14 +
  15 + protected Integer rows;
  16 +
  17 + public SyServiceInterfaceMouldExample() {
  18 + oredCriteria = new ArrayList<Criteria>();
  19 + }
  20 +
  21 + public void setOrderByClause(String orderByClause) {
  22 + this.orderByClause = orderByClause;
  23 + }
  24 +
  25 + public String getOrderByClause() {
  26 + return orderByClause;
  27 + }
  28 +
  29 + public void setDistinct(boolean distinct) {
  30 + this.distinct = distinct;
  31 + }
  32 +
  33 + public boolean isDistinct() {
  34 + return distinct;
  35 + }
  36 +
  37 + public List<Criteria> getOredCriteria() {
  38 + return oredCriteria;
  39 + }
  40 +
  41 + public void or(Criteria criteria) {
  42 + oredCriteria.add(criteria);
  43 + }
  44 +
  45 + public Criteria or() {
  46 + Criteria criteria = createCriteriaInternal();
  47 + oredCriteria.add(criteria);
  48 + return criteria;
  49 + }
  50 +
  51 + public SyServiceInterfaceMouldExample orderBy(String orderByClause) {
  52 + this.setOrderByClause(orderByClause);
  53 + return this;
  54 + }
  55 +
  56 + public SyServiceInterfaceMouldExample orderBy(String... orderByClauses) {
  57 + StringBuffer sb = new StringBuffer();
  58 + for (int i = 0; i < orderByClauses.length; i++) {
  59 + sb.append(orderByClauses[i]);
  60 + if (i < orderByClauses.length - 1) {
  61 + sb.append(" , ");
  62 + }
  63 + }
  64 + this.setOrderByClause(sb.toString());
  65 + return this;
  66 + }
  67 +
  68 + public Criteria createCriteria() {
  69 + Criteria criteria = createCriteriaInternal();
  70 + if (oredCriteria.size() == 0) {
  71 + oredCriteria.add(criteria);
  72 + }
  73 + return criteria;
  74 + }
  75 +
  76 + protected Criteria createCriteriaInternal() {
  77 + Criteria criteria = new Criteria(this);
  78 + return criteria;
  79 + }
  80 +
  81 + public void clear() {
  82 + oredCriteria.clear();
  83 + orderByClause = null;
  84 + distinct = false;
  85 + rows = null;
  86 + offset = null;
  87 + }
  88 +
  89 + public void setOffset(Integer offset) {
  90 + this.offset = offset;
  91 + }
  92 +
  93 + public Integer getOffset() {
  94 + return this.offset;
  95 + }
  96 +
  97 + public void setRows(Integer rows) {
  98 + this.rows = rows;
  99 + }
  100 +
  101 + public Integer getRows() {
  102 + return this.rows;
  103 + }
  104 +
  105 + public SyServiceInterfaceMouldExample limit(Integer rows) {
  106 + this.rows = rows;
  107 + return this;
  108 + }
  109 +
  110 + public SyServiceInterfaceMouldExample limit(Integer offset, Integer rows) {
  111 + this.offset = offset;
  112 + this.rows = rows;
  113 + return this;
  114 + }
  115 +
  116 + public SyServiceInterfaceMouldExample page(Integer page, Integer pageSize) {
  117 + this.offset = (page - 1) * pageSize;
  118 + this.rows = pageSize;
  119 + return this;
  120 + }
  121 +
  122 + public static Criteria newAndCreateCriteria() {
  123 + SyServiceInterfaceMouldExample example = new SyServiceInterfaceMouldExample();
  124 + return example.createCriteria();
  125 + }
  126 +
  127 + public SyServiceInterfaceMouldExample when(boolean condition, IExampleWhen then) {
  128 + if (condition) {
  129 + then.example(this);
  130 + }
  131 + return this;
  132 + }
  133 +
  134 + public SyServiceInterfaceMouldExample when(boolean condition, IExampleWhen then, IExampleWhen otherwise) {
  135 + if (condition) {
  136 + then.example(this);
  137 + } else {
  138 + otherwise.example(this);
  139 + }
  140 + return this;
  141 + }
  142 +
  143 + protected abstract static class GeneratedCriteria {
  144 + protected List<Criterion> criteria;
  145 +
  146 + protected GeneratedCriteria() {
  147 + super();
  148 + criteria = new ArrayList<Criterion>();
  149 + }
  150 +
  151 + public boolean isValid() {
  152 + return criteria.size() > 0;
  153 + }
  154 +
  155 + public List<Criterion> getAllCriteria() {
  156 + return criteria;
  157 + }
  158 +
  159 + public List<Criterion> getCriteria() {
  160 + return criteria;
  161 + }
  162 +
  163 + protected void addCriterion(String condition) {
  164 + if (condition == null) {
  165 + throw new RuntimeException("Value for condition cannot be null");
  166 + }
  167 + criteria.add(new Criterion(condition));
  168 + }
  169 +
  170 + protected void addCriterion(String condition, Object value, String property) {
  171 + if (value == null) {
  172 + throw new RuntimeException("Value for " + property + " cannot be null");
  173 + }
  174 + criteria.add(new Criterion(condition, value));
  175 + }
  176 +
  177 + protected void addCriterion(String condition, Object value1, Object value2, String property) {
  178 + if (value1 == null || value2 == null) {
  179 + throw new RuntimeException("Between values for " + property + " cannot be null");
  180 + }
  181 + criteria.add(new Criterion(condition, value1, value2));
  182 + }
  183 +
  184 + public Criteria andIdIsNull() {
  185 + addCriterion("id is null");
  186 + return (Criteria) this;
  187 + }
  188 +
  189 + public Criteria andIdIsNotNull() {
  190 + addCriterion("id is not null");
  191 + return (Criteria) this;
  192 + }
  193 +
  194 + public Criteria andIdEqualTo(Integer value) {
  195 + addCriterion("id =", value, "id");
  196 + return (Criteria) this;
  197 + }
  198 +
  199 + public Criteria andIdEqualToColumn(SyServiceInterfaceMould.Column column) {
  200 + addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString());
  201 + return (Criteria) this;
  202 + }
  203 +
  204 + public Criteria andIdNotEqualTo(Integer value) {
  205 + addCriterion("id <>", value, "id");
  206 + return (Criteria) this;
  207 + }
  208 +
  209 + public Criteria andIdNotEqualToColumn(SyServiceInterfaceMould.Column column) {
  210 + addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString());
  211 + return (Criteria) this;
  212 + }
  213 +
  214 + public Criteria andIdGreaterThan(Integer value) {
  215 + addCriterion("id >", value, "id");
  216 + return (Criteria) this;
  217 + }
  218 +
  219 + public Criteria andIdGreaterThanColumn(SyServiceInterfaceMould.Column column) {
  220 + addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString());
  221 + return (Criteria) this;
  222 + }
  223 +
  224 + public Criteria andIdGreaterThanOrEqualTo(Integer value) {
  225 + addCriterion("id >=", value, "id");
  226 + return (Criteria) this;
  227 + }
  228 +
  229 + public Criteria andIdGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  230 + addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString());
  231 + return (Criteria) this;
  232 + }
  233 +
  234 + public Criteria andIdLessThan(Integer value) {
  235 + addCriterion("id <", value, "id");
  236 + return (Criteria) this;
  237 + }
  238 +
  239 + public Criteria andIdLessThanColumn(SyServiceInterfaceMould.Column column) {
  240 + addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString());
  241 + return (Criteria) this;
  242 + }
  243 +
  244 + public Criteria andIdLessThanOrEqualTo(Integer value) {
  245 + addCriterion("id <=", value, "id");
  246 + return (Criteria) this;
  247 + }
  248 +
  249 + public Criteria andIdLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  250 + addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString());
  251 + return (Criteria) this;
  252 + }
  253 +
  254 + public Criteria andIdIn(List<Integer> values) {
  255 + addCriterion("id in", values, "id");
  256 + return (Criteria) this;
  257 + }
  258 +
  259 + public Criteria andIdNotIn(List<Integer> values) {
  260 + addCriterion("id not in", values, "id");
  261 + return (Criteria) this;
  262 + }
  263 +
  264 + public Criteria andIdBetween(Integer value1, Integer value2) {
  265 + addCriterion("id between", value1, value2, "id");
  266 + return (Criteria) this;
  267 + }
  268 +
  269 + public Criteria andIdNotBetween(Integer value1, Integer value2) {
  270 + addCriterion("id not between", value1, value2, "id");
  271 + return (Criteria) this;
  272 + }
  273 +
  274 + public Criteria andMouldIdIsNull() {
  275 + addCriterion("mould_id is null");
  276 + return (Criteria) this;
  277 + }
  278 +
  279 + public Criteria andMouldIdIsNotNull() {
  280 + addCriterion("mould_id is not null");
  281 + return (Criteria) this;
  282 + }
  283 +
  284 + public Criteria andMouldIdEqualTo(Integer value) {
  285 + addCriterion("mould_id =", value, "mouldId");
  286 + return (Criteria) this;
  287 + }
  288 +
  289 + public Criteria andMouldIdEqualToColumn(SyServiceInterfaceMould.Column column) {
  290 + addCriterion(new StringBuilder("mould_id = ").append(column.getEscapedColumnName()).toString());
  291 + return (Criteria) this;
  292 + }
  293 +
  294 + public Criteria andMouldIdNotEqualTo(Integer value) {
  295 + addCriterion("mould_id <>", value, "mouldId");
  296 + return (Criteria) this;
  297 + }
  298 +
  299 + public Criteria andMouldIdNotEqualToColumn(SyServiceInterfaceMould.Column column) {
  300 + addCriterion(new StringBuilder("mould_id <> ").append(column.getEscapedColumnName()).toString());
  301 + return (Criteria) this;
  302 + }
  303 +
  304 + public Criteria andMouldIdGreaterThan(Integer value) {
  305 + addCriterion("mould_id >", value, "mouldId");
  306 + return (Criteria) this;
  307 + }
  308 +
  309 + public Criteria andMouldIdGreaterThanColumn(SyServiceInterfaceMould.Column column) {
  310 + addCriterion(new StringBuilder("mould_id > ").append(column.getEscapedColumnName()).toString());
  311 + return (Criteria) this;
  312 + }
  313 +
  314 + public Criteria andMouldIdGreaterThanOrEqualTo(Integer value) {
  315 + addCriterion("mould_id >=", value, "mouldId");
  316 + return (Criteria) this;
  317 + }
  318 +
  319 + public Criteria andMouldIdGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  320 + addCriterion(new StringBuilder("mould_id >= ").append(column.getEscapedColumnName()).toString());
  321 + return (Criteria) this;
  322 + }
  323 +
  324 + public Criteria andMouldIdLessThan(Integer value) {
  325 + addCriterion("mould_id <", value, "mouldId");
  326 + return (Criteria) this;
  327 + }
  328 +
  329 + public Criteria andMouldIdLessThanColumn(SyServiceInterfaceMould.Column column) {
  330 + addCriterion(new StringBuilder("mould_id < ").append(column.getEscapedColumnName()).toString());
  331 + return (Criteria) this;
  332 + }
  333 +
  334 + public Criteria andMouldIdLessThanOrEqualTo(Integer value) {
  335 + addCriterion("mould_id <=", value, "mouldId");
  336 + return (Criteria) this;
  337 + }
  338 +
  339 + public Criteria andMouldIdLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  340 + addCriterion(new StringBuilder("mould_id <= ").append(column.getEscapedColumnName()).toString());
  341 + return (Criteria) this;
  342 + }
  343 +
  344 + public Criteria andMouldIdIn(List<Integer> values) {
  345 + addCriterion("mould_id in", values, "mouldId");
  346 + return (Criteria) this;
  347 + }
  348 +
  349 + public Criteria andMouldIdNotIn(List<Integer> values) {
  350 + addCriterion("mould_id not in", values, "mouldId");
  351 + return (Criteria) this;
  352 + }
  353 +
  354 + public Criteria andMouldIdBetween(Integer value1, Integer value2) {
  355 + addCriterion("mould_id between", value1, value2, "mouldId");
  356 + return (Criteria) this;
  357 + }
  358 +
  359 + public Criteria andMouldIdNotBetween(Integer value1, Integer value2) {
  360 + addCriterion("mould_id not between", value1, value2, "mouldId");
  361 + return (Criteria) this;
  362 + }
  363 +
  364 + public Criteria andMethodTypeIsNull() {
  365 + addCriterion("method_type is null");
  366 + return (Criteria) this;
  367 + }
  368 +
  369 + public Criteria andMethodTypeIsNotNull() {
  370 + addCriterion("method_type is not null");
  371 + return (Criteria) this;
  372 + }
  373 +
  374 + public Criteria andMethodTypeEqualTo(String value) {
  375 + addCriterion("method_type =", value, "methodType");
  376 + return (Criteria) this;
  377 + }
  378 +
  379 + public Criteria andMethodTypeEqualToColumn(SyServiceInterfaceMould.Column column) {
  380 + addCriterion(new StringBuilder("method_type = ").append(column.getEscapedColumnName()).toString());
  381 + return (Criteria) this;
  382 + }
  383 +
  384 + public Criteria andMethodTypeNotEqualTo(String value) {
  385 + addCriterion("method_type <>", value, "methodType");
  386 + return (Criteria) this;
  387 + }
  388 +
  389 + public Criteria andMethodTypeNotEqualToColumn(SyServiceInterfaceMould.Column column) {
  390 + addCriterion(new StringBuilder("method_type <> ").append(column.getEscapedColumnName()).toString());
  391 + return (Criteria) this;
  392 + }
  393 +
  394 + public Criteria andMethodTypeGreaterThan(String value) {
  395 + addCriterion("method_type >", value, "methodType");
  396 + return (Criteria) this;
  397 + }
  398 +
  399 + public Criteria andMethodTypeGreaterThanColumn(SyServiceInterfaceMould.Column column) {
  400 + addCriterion(new StringBuilder("method_type > ").append(column.getEscapedColumnName()).toString());
  401 + return (Criteria) this;
  402 + }
  403 +
  404 + public Criteria andMethodTypeGreaterThanOrEqualTo(String value) {
  405 + addCriterion("method_type >=", value, "methodType");
  406 + return (Criteria) this;
  407 + }
  408 +
  409 + public Criteria andMethodTypeGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  410 + addCriterion(new StringBuilder("method_type >= ").append(column.getEscapedColumnName()).toString());
  411 + return (Criteria) this;
  412 + }
  413 +
  414 + public Criteria andMethodTypeLessThan(String value) {
  415 + addCriterion("method_type <", value, "methodType");
  416 + return (Criteria) this;
  417 + }
  418 +
  419 + public Criteria andMethodTypeLessThanColumn(SyServiceInterfaceMould.Column column) {
  420 + addCriterion(new StringBuilder("method_type < ").append(column.getEscapedColumnName()).toString());
  421 + return (Criteria) this;
  422 + }
  423 +
  424 + public Criteria andMethodTypeLessThanOrEqualTo(String value) {
  425 + addCriterion("method_type <=", value, "methodType");
  426 + return (Criteria) this;
  427 + }
  428 +
  429 + public Criteria andMethodTypeLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  430 + addCriterion(new StringBuilder("method_type <= ").append(column.getEscapedColumnName()).toString());
  431 + return (Criteria) this;
  432 + }
  433 +
  434 + public Criteria andMethodTypeLike(String value) {
  435 + addCriterion("method_type like", value, "methodType");
  436 + return (Criteria) this;
  437 + }
  438 +
  439 + public Criteria andMethodTypeNotLike(String value) {
  440 + addCriterion("method_type not like", value, "methodType");
  441 + return (Criteria) this;
  442 + }
  443 +
  444 + public Criteria andMethodTypeIn(List<String> values) {
  445 + addCriterion("method_type in", values, "methodType");
  446 + return (Criteria) this;
  447 + }
  448 +
  449 + public Criteria andMethodTypeNotIn(List<String> values) {
  450 + addCriterion("method_type not in", values, "methodType");
  451 + return (Criteria) this;
  452 + }
  453 +
  454 + public Criteria andMethodTypeBetween(String value1, String value2) {
  455 + addCriterion("method_type between", value1, value2, "methodType");
  456 + return (Criteria) this;
  457 + }
  458 +
  459 + public Criteria andMethodTypeNotBetween(String value1, String value2) {
  460 + addCriterion("method_type not between", value1, value2, "methodType");
  461 + return (Criteria) this;
  462 + }
  463 +
  464 + public Criteria andContentTypeIsNull() {
  465 + addCriterion("content_type is null");
  466 + return (Criteria) this;
  467 + }
  468 +
  469 + public Criteria andContentTypeIsNotNull() {
  470 + addCriterion("content_type is not null");
  471 + return (Criteria) this;
  472 + }
  473 +
  474 + public Criteria andContentTypeEqualTo(String value) {
  475 + addCriterion("content_type =", value, "contentType");
  476 + return (Criteria) this;
  477 + }
  478 +
  479 + public Criteria andContentTypeEqualToColumn(SyServiceInterfaceMould.Column column) {
  480 + addCriterion(new StringBuilder("content_type = ").append(column.getEscapedColumnName()).toString());
  481 + return (Criteria) this;
  482 + }
  483 +
  484 + public Criteria andContentTypeNotEqualTo(String value) {
  485 + addCriterion("content_type <>", value, "contentType");
  486 + return (Criteria) this;
  487 + }
  488 +
  489 + public Criteria andContentTypeNotEqualToColumn(SyServiceInterfaceMould.Column column) {
  490 + addCriterion(new StringBuilder("content_type <> ").append(column.getEscapedColumnName()).toString());
  491 + return (Criteria) this;
  492 + }
  493 +
  494 + public Criteria andContentTypeGreaterThan(String value) {
  495 + addCriterion("content_type >", value, "contentType");
  496 + return (Criteria) this;
  497 + }
  498 +
  499 + public Criteria andContentTypeGreaterThanColumn(SyServiceInterfaceMould.Column column) {
  500 + addCriterion(new StringBuilder("content_type > ").append(column.getEscapedColumnName()).toString());
  501 + return (Criteria) this;
  502 + }
  503 +
  504 + public Criteria andContentTypeGreaterThanOrEqualTo(String value) {
  505 + addCriterion("content_type >=", value, "contentType");
  506 + return (Criteria) this;
  507 + }
  508 +
  509 + public Criteria andContentTypeGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  510 + addCriterion(new StringBuilder("content_type >= ").append(column.getEscapedColumnName()).toString());
  511 + return (Criteria) this;
  512 + }
  513 +
  514 + public Criteria andContentTypeLessThan(String value) {
  515 + addCriterion("content_type <", value, "contentType");
  516 + return (Criteria) this;
  517 + }
  518 +
  519 + public Criteria andContentTypeLessThanColumn(SyServiceInterfaceMould.Column column) {
  520 + addCriterion(new StringBuilder("content_type < ").append(column.getEscapedColumnName()).toString());
  521 + return (Criteria) this;
  522 + }
  523 +
  524 + public Criteria andContentTypeLessThanOrEqualTo(String value) {
  525 + addCriterion("content_type <=", value, "contentType");
  526 + return (Criteria) this;
  527 + }
  528 +
  529 + public Criteria andContentTypeLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  530 + addCriterion(new StringBuilder("content_type <= ").append(column.getEscapedColumnName()).toString());
  531 + return (Criteria) this;
  532 + }
  533 +
  534 + public Criteria andContentTypeLike(String value) {
  535 + addCriterion("content_type like", value, "contentType");
  536 + return (Criteria) this;
  537 + }
  538 +
  539 + public Criteria andContentTypeNotLike(String value) {
  540 + addCriterion("content_type not like", value, "contentType");
  541 + return (Criteria) this;
  542 + }
  543 +
  544 + public Criteria andContentTypeIn(List<String> values) {
  545 + addCriterion("content_type in", values, "contentType");
  546 + return (Criteria) this;
  547 + }
  548 +
  549 + public Criteria andContentTypeNotIn(List<String> values) {
  550 + addCriterion("content_type not in", values, "contentType");
  551 + return (Criteria) this;
  552 + }
  553 +
  554 + public Criteria andContentTypeBetween(String value1, String value2) {
  555 + addCriterion("content_type between", value1, value2, "contentType");
  556 + return (Criteria) this;
  557 + }
  558 +
  559 + public Criteria andContentTypeNotBetween(String value1, String value2) {
  560 + addCriterion("content_type not between", value1, value2, "contentType");
  561 + return (Criteria) this;
  562 + }
  563 +
  564 + public Criteria andUriIsNull() {
  565 + addCriterion("uri is null");
  566 + return (Criteria) this;
  567 + }
  568 +
  569 + public Criteria andUriIsNotNull() {
  570 + addCriterion("uri is not null");
  571 + return (Criteria) this;
  572 + }
  573 +
  574 + public Criteria andUriEqualTo(String value) {
  575 + addCriterion("uri =", value, "uri");
  576 + return (Criteria) this;
  577 + }
  578 +
  579 + public Criteria andUriEqualToColumn(SyServiceInterfaceMould.Column column) {
  580 + addCriterion(new StringBuilder("uri = ").append(column.getEscapedColumnName()).toString());
  581 + return (Criteria) this;
  582 + }
  583 +
  584 + public Criteria andUriNotEqualTo(String value) {
  585 + addCriterion("uri <>", value, "uri");
  586 + return (Criteria) this;
  587 + }
  588 +
  589 + public Criteria andUriNotEqualToColumn(SyServiceInterfaceMould.Column column) {
  590 + addCriterion(new StringBuilder("uri <> ").append(column.getEscapedColumnName()).toString());
  591 + return (Criteria) this;
  592 + }
  593 +
  594 + public Criteria andUriGreaterThan(String value) {
  595 + addCriterion("uri >", value, "uri");
  596 + return (Criteria) this;
  597 + }
  598 +
  599 + public Criteria andUriGreaterThanColumn(SyServiceInterfaceMould.Column column) {
  600 + addCriterion(new StringBuilder("uri > ").append(column.getEscapedColumnName()).toString());
  601 + return (Criteria) this;
  602 + }
  603 +
  604 + public Criteria andUriGreaterThanOrEqualTo(String value) {
  605 + addCriterion("uri >=", value, "uri");
  606 + return (Criteria) this;
  607 + }
  608 +
  609 + public Criteria andUriGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  610 + addCriterion(new StringBuilder("uri >= ").append(column.getEscapedColumnName()).toString());
  611 + return (Criteria) this;
  612 + }
  613 +
  614 + public Criteria andUriLessThan(String value) {
  615 + addCriterion("uri <", value, "uri");
  616 + return (Criteria) this;
  617 + }
  618 +
  619 + public Criteria andUriLessThanColumn(SyServiceInterfaceMould.Column column) {
  620 + addCriterion(new StringBuilder("uri < ").append(column.getEscapedColumnName()).toString());
  621 + return (Criteria) this;
  622 + }
  623 +
  624 + public Criteria andUriLessThanOrEqualTo(String value) {
  625 + addCriterion("uri <=", value, "uri");
  626 + return (Criteria) this;
  627 + }
  628 +
  629 + public Criteria andUriLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  630 + addCriterion(new StringBuilder("uri <= ").append(column.getEscapedColumnName()).toString());
  631 + return (Criteria) this;
  632 + }
  633 +
  634 + public Criteria andUriLike(String value) {
  635 + addCriterion("uri like", value, "uri");
  636 + return (Criteria) this;
  637 + }
  638 +
  639 + public Criteria andUriNotLike(String value) {
  640 + addCriterion("uri not like", value, "uri");
  641 + return (Criteria) this;
  642 + }
  643 +
  644 + public Criteria andUriIn(List<String> values) {
  645 + addCriterion("uri in", values, "uri");
  646 + return (Criteria) this;
  647 + }
  648 +
  649 + public Criteria andUriNotIn(List<String> values) {
  650 + addCriterion("uri not in", values, "uri");
  651 + return (Criteria) this;
  652 + }
  653 +
  654 + public Criteria andUriBetween(String value1, String value2) {
  655 + addCriterion("uri between", value1, value2, "uri");
  656 + return (Criteria) this;
  657 + }
  658 +
  659 + public Criteria andUriNotBetween(String value1, String value2) {
  660 + addCriterion("uri not between", value1, value2, "uri");
  661 + return (Criteria) this;
  662 + }
  663 +
  664 + public Criteria andDefaultJsonIsNull() {
  665 + addCriterion("default_json is null");
  666 + return (Criteria) this;
  667 + }
  668 +
  669 + public Criteria andDefaultJsonIsNotNull() {
  670 + addCriterion("default_json is not null");
  671 + return (Criteria) this;
  672 + }
  673 +
  674 + public Criteria andDefaultJsonEqualTo(String value) {
  675 + addCriterion("default_json =", value, "defaultJson");
  676 + return (Criteria) this;
  677 + }
  678 +
  679 + public Criteria andDefaultJsonEqualToColumn(SyServiceInterfaceMould.Column column) {
  680 + addCriterion(new StringBuilder("default_json = ").append(column.getEscapedColumnName()).toString());
  681 + return (Criteria) this;
  682 + }
  683 +
  684 + public Criteria andDefaultJsonNotEqualTo(String value) {
  685 + addCriterion("default_json <>", value, "defaultJson");
  686 + return (Criteria) this;
  687 + }
  688 +
  689 + public Criteria andDefaultJsonNotEqualToColumn(SyServiceInterfaceMould.Column column) {
  690 + addCriterion(new StringBuilder("default_json <> ").append(column.getEscapedColumnName()).toString());
  691 + return (Criteria) this;
  692 + }
  693 +
  694 + public Criteria andDefaultJsonGreaterThan(String value) {
  695 + addCriterion("default_json >", value, "defaultJson");
  696 + return (Criteria) this;
  697 + }
  698 +
  699 + public Criteria andDefaultJsonGreaterThanColumn(SyServiceInterfaceMould.Column column) {
  700 + addCriterion(new StringBuilder("default_json > ").append(column.getEscapedColumnName()).toString());
  701 + return (Criteria) this;
  702 + }
  703 +
  704 + public Criteria andDefaultJsonGreaterThanOrEqualTo(String value) {
  705 + addCriterion("default_json >=", value, "defaultJson");
  706 + return (Criteria) this;
  707 + }
  708 +
  709 + public Criteria andDefaultJsonGreaterThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  710 + addCriterion(new StringBuilder("default_json >= ").append(column.getEscapedColumnName()).toString());
  711 + return (Criteria) this;
  712 + }
  713 +
  714 + public Criteria andDefaultJsonLessThan(String value) {
  715 + addCriterion("default_json <", value, "defaultJson");
  716 + return (Criteria) this;
  717 + }
  718 +
  719 + public Criteria andDefaultJsonLessThanColumn(SyServiceInterfaceMould.Column column) {
  720 + addCriterion(new StringBuilder("default_json < ").append(column.getEscapedColumnName()).toString());
  721 + return (Criteria) this;
  722 + }
  723 +
  724 + public Criteria andDefaultJsonLessThanOrEqualTo(String value) {
  725 + addCriterion("default_json <=", value, "defaultJson");
  726 + return (Criteria) this;
  727 + }
  728 +
  729 + public Criteria andDefaultJsonLessThanOrEqualToColumn(SyServiceInterfaceMould.Column column) {
  730 + addCriterion(new StringBuilder("default_json <= ").append(column.getEscapedColumnName()).toString());
  731 + return (Criteria) this;
  732 + }
  733 +
  734 + public Criteria andDefaultJsonLike(String value) {
  735 + addCriterion("default_json like", value, "defaultJson");
  736 + return (Criteria) this;
  737 + }
  738 +
  739 + public Criteria andDefaultJsonNotLike(String value) {
  740 + addCriterion("default_json not like", value, "defaultJson");
  741 + return (Criteria) this;
  742 + }
  743 +
  744 + public Criteria andDefaultJsonIn(List<String> values) {
  745 + addCriterion("default_json in", values, "defaultJson");
  746 + return (Criteria) this;
  747 + }
  748 +
  749 + public Criteria andDefaultJsonNotIn(List<String> values) {
  750 + addCriterion("default_json not in", values, "defaultJson");
  751 + return (Criteria) this;
  752 + }
  753 +
  754 + public Criteria andDefaultJsonBetween(String value1, String value2) {
  755 + addCriterion("default_json between", value1, value2, "defaultJson");
  756 + return (Criteria) this;
  757 + }
  758 +
  759 + public Criteria andDefaultJsonNotBetween(String value1, String value2) {
  760 + addCriterion("default_json not between", value1, value2, "defaultJson");
  761 + return (Criteria) this;
  762 + }
  763 + }
  764 +
  765 + public static class Criteria extends GeneratedCriteria {
  766 + private SyServiceInterfaceMouldExample example;
  767 +
  768 + protected Criteria(SyServiceInterfaceMouldExample example) {
  769 + super();
  770 + this.example = example;
  771 + }
  772 +
  773 + public SyServiceInterfaceMouldExample example() {
  774 + return this.example;
  775 + }
  776 +
  777 + @Deprecated
  778 + public Criteria andIf(boolean ifAdd, ICriteriaAdd add) {
  779 + if (ifAdd) {
  780 + add.add(this);
  781 + }
  782 + return this;
  783 + }
  784 +
  785 + public Criteria when(boolean condition, ICriteriaWhen then) {
  786 + if (condition) {
  787 + then.criteria(this);
  788 + }
  789 + return this;
  790 + }
  791 +
  792 + public Criteria when(boolean condition, ICriteriaWhen then, ICriteriaWhen otherwise) {
  793 + if (condition) {
  794 + then.criteria(this);
  795 + } else {
  796 + otherwise.criteria(this);
  797 + }
  798 + return this;
  799 + }
  800 +
  801 + @Deprecated
  802 + public interface ICriteriaAdd {
  803 + Criteria add(Criteria add);
  804 + }
  805 + }
  806 +
  807 + public static class Criterion {
  808 + private String condition;
  809 +
  810 + private Object value;
  811 +
  812 + private Object secondValue;
  813 +
  814 + private boolean noValue;
  815 +
  816 + private boolean singleValue;
  817 +
  818 + private boolean betweenValue;
  819 +
  820 + private boolean listValue;
  821 +
  822 + private String typeHandler;
  823 +
  824 + public String getCondition() {
  825 + return condition;
  826 + }
  827 +
  828 + public Object getValue() {
  829 + return value;
  830 + }
  831 +
  832 + public Object getSecondValue() {
  833 + return secondValue;
  834 + }
  835 +
  836 + public boolean isNoValue() {
  837 + return noValue;
  838 + }
  839 +
  840 + public boolean isSingleValue() {
  841 + return singleValue;
  842 + }
  843 +
  844 + public boolean isBetweenValue() {
  845 + return betweenValue;
  846 + }
  847 +
  848 + public boolean isListValue() {
  849 + return listValue;
  850 + }
  851 +
  852 + public String getTypeHandler() {
  853 + return typeHandler;
  854 + }
  855 +
  856 + protected Criterion(String condition) {
  857 + super();
  858 + this.condition = condition;
  859 + this.typeHandler = null;
  860 + this.noValue = true;
  861 + }
  862 +
  863 + protected Criterion(String condition, Object value, String typeHandler) {
  864 + super();
  865 + this.condition = condition;
  866 + this.value = value;
  867 + this.typeHandler = typeHandler;
  868 + if (value instanceof List<?>) {
  869 + this.listValue = true;
  870 + } else {
  871 + this.singleValue = true;
  872 + }
  873 + }
  874 +
  875 + protected Criterion(String condition, Object value) {
  876 + this(condition, value, null);
  877 + }
  878 +
  879 + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
  880 + super();
  881 + this.condition = condition;
  882 + this.value = value;
  883 + this.secondValue = secondValue;
  884 + this.typeHandler = typeHandler;
  885 + this.betweenValue = true;
  886 + }
  887 +
  888 + protected Criterion(String condition, Object value, Object secondValue) {
  889 + this(condition, value, secondValue, null);
  890 + }
  891 + }
  892 +
  893 + public interface ICriteriaWhen {
  894 + void criteria(Criteria criteria);
  895 + }
  896 +
  897 + public interface IExampleWhen {
  898 + void example(com.objecteye.entity.SyServiceInterfaceMouldExample example);
  899 + }
  900 +}
0 901 \ No newline at end of file
... ...
src/main/java/com/objecteye/mapper/SyServiceInterfaceMouldMapper.java 0 → 100644
  1 +package com.objecteye.mapper;
  2 +
  3 +import com.objecteye.entity.SyServiceInterfaceMould;
  4 +import com.objecteye.entity.SyServiceInterfaceMouldExample;
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import java.util.List;
  8 +
  9 +public interface SyServiceInterfaceMouldMapper {
  10 + long countByExample(SyServiceInterfaceMouldExample example);
  11 +
  12 + int deleteByExample(SyServiceInterfaceMouldExample example);
  13 +
  14 + int deleteByPrimaryKey(Integer id);
  15 +
  16 + int insert(SyServiceInterfaceMould record);
  17 +
  18 + int insertSelective(SyServiceInterfaceMould record);
  19 +
  20 + SyServiceInterfaceMould selectOneByExample(SyServiceInterfaceMouldExample example);
  21 +
  22 + List<SyServiceInterfaceMould> selectByExample(SyServiceInterfaceMouldExample example);
  23 +
  24 + SyServiceInterfaceMould selectByPrimaryKey(Integer id);
  25 +
  26 + int updateByExampleSelective(@Param("record") SyServiceInterfaceMould record, @Param("example") SyServiceInterfaceMouldExample example);
  27 +
  28 + int updateByExample(@Param("record") SyServiceInterfaceMould record, @Param("example") SyServiceInterfaceMouldExample example);
  29 +
  30 + int updateByPrimaryKeySelective(SyServiceInterfaceMould record);
  31 +
  32 + int updateByPrimaryKey(SyServiceInterfaceMould record);
  33 +}
0 34 \ No newline at end of file
... ...
src/main/java/com/objecteye/service/IBackGroundService.java
... ... @@ -3,6 +3,8 @@ package com.objecteye.service;
3 3 import com.alibaba.fastjson.JSONObject;
4 4 import com.objecteye.common.PageResult;
5 5 import com.objecteye.entity.SyBasicResourceHistory;
  6 +import com.objecteye.entity.SyServiceInterfaceMould;
  7 +import org.springframework.web.multipart.MultipartFile;
6 8  
7 9 import java.util.List;
8 10 import java.util.Map;
... ... @@ -104,4 +106,23 @@ public interface IBackGroundService {
104 106 * 每分钟更新一次所有服务的状态
105 107 */
106 108 void serviceStatusUpdater();
  109 +
  110 + /**
  111 + * 根据配置明细项id获取请求http的返回值信息(固定对应的itemName为 serviceInterface)
  112 + *
  113 + * @param configId 服务主键
  114 + * @param interfaceMouldId 接口模板表主键
  115 + * @param paramsStr 发送参数
  116 + * @param multipartFile 请求文件
  117 + * @return http请求返回信息
  118 + */
  119 + String getServiceHttpResponse(Integer configId, Integer interfaceMouldId, String paramsStr, MultipartFile multipartFile);
  120 +
  121 + /**
  122 + * 获取配置服务支持的所有接口信息(固定对应的itemName为 serviceInterface, interfaceMould)
  123 + *
  124 + * @param configId 服务主键
  125 + * @return 支持的所有接口信息
  126 + */
  127 + List<SyServiceInterfaceMould> findAllAvailableInterface(Integer configId);
107 128 }
... ...
src/main/java/com/objecteye/service/impl/BackGroundServiceImpl.java
... ... @@ -7,23 +7,35 @@ import com.alibaba.fastjson.JSONObject;
7 7 import com.objecteye.common.GeneralContent;
8 8 import com.objecteye.common.PageResult;
9 9 import com.objecteye.entity.*;
  10 +import com.objecteye.exception.CustomXException;
10 11 import com.objecteye.mapper.SyBasicResourceHistoryMapper;
11 12 import com.objecteye.mapper.SyServiceConfigItemMapper;
12 13 import com.objecteye.mapper.SyServiceConfigMapper;
  14 +import com.objecteye.mapper.SyServiceInterfaceMouldMapper;
13 15 import com.objecteye.service.IBackGroundService;
14 16 import com.objecteye.service.IOccupationOfBasicResourcesService;
15 17 import com.objecteye.utils.LinuxUtils;
16 18 import com.objecteye.vo.VSyServiceMainTable;
17 19 import lombok.extern.slf4j.Slf4j;
  20 +import org.apache.commons.io.FileUtils;
18 21 import org.springframework.beans.factory.annotation.Autowired;
  22 +import org.springframework.core.io.FileSystemResource;
19 23 import org.springframework.data.redis.core.RedisTemplate;
  24 +import org.springframework.http.HttpEntity;
  25 +import org.springframework.http.HttpHeaders;
  26 +import org.springframework.http.MediaType;
20 27 import org.springframework.http.ResponseEntity;
21 28 import org.springframework.scheduling.annotation.Async;
22 29 import org.springframework.scheduling.annotation.Scheduled;
23 30 import org.springframework.stereotype.Component;
24 31 import org.springframework.transaction.annotation.Transactional;
  32 +import org.springframework.util.LinkedMultiValueMap;
  33 +import org.springframework.util.MultiValueMap;
25 34 import org.springframework.web.client.RestTemplate;
  35 +import org.springframework.web.multipart.MultipartFile;
26 36  
  37 +import java.io.File;
  38 +import java.io.IOException;
27 39 import java.util.*;
28 40 import java.util.stream.Collectors;
29 41  
... ... @@ -41,6 +53,8 @@ public class BackGroundServiceImpl implements IBackGroundService {
41 53 @Autowired
42 54 private SyServiceConfigItemMapper syServiceConfigItemMapper;
43 55 @Autowired
  56 + private SyServiceInterfaceMouldMapper syServiceInterfaceMouldMapper;
  57 + @Autowired
44 58 private RestTemplate restTemplate;
45 59  
46 60 /**
... ... @@ -340,6 +354,7 @@ public class BackGroundServiceImpl implements IBackGroundService {
340 354 @Override
341 355 @Transactional
342 356 public JSONObject deleteServiceConfig(Integer id) {
  357 + serviceAction(id, "remove");
343 358 syServiceConfigMapper.deleteByPrimaryKey(id);
344 359 SyServiceConfigItemExample syServiceConfigItemExample = SyServiceConfigItemExample
345 360 .newAndCreateCriteria().andConfigIdEqualTo(id).example();
... ... @@ -538,4 +553,110 @@ public class BackGroundServiceImpl implements IBackGroundService {
538 553 }
539 554 return resultObj;
540 555 }
  556 +
  557 + /**
  558 + * 根据配置明细项id获取请求http的返回值信息(固定对应的itemName为 serviceInterface, interfaceMould)
  559 + *
  560 + * @param configId 服务主键
  561 + * @param interfaceMouldId 接口模板表主键
  562 + * @param paramsStr 发送参数
  563 + * @param multipartFile 请求文件
  564 + * @return http请求返回信息
  565 + */
  566 + @Override
  567 + public String getServiceHttpResponse(Integer configId, Integer interfaceMouldId, String paramsStr, MultipartFile multipartFile) {
  568 + List<SyServiceConfigItem> syServiceConfigItems = syServiceConfigItemMapper.selectByExample(SyServiceConfigItemExample.newAndCreateCriteria().andConfigIdEqualTo(configId)
  569 + .andItemNameIn(Arrays.asList("http", "port")).example());
  570 + String ip = null;
  571 + String port = null;
  572 + for (SyServiceConfigItem syServiceConfigItem : syServiceConfigItems) {
  573 + if (syServiceConfigItem == null) {
  574 + continue;
  575 + }
  576 + if ("http".equals(syServiceConfigItem.getItemName())) {
  577 + ip = syServiceConfigItem.getItemValue();
  578 + } else if ("port".equals(syServiceConfigItem.getItemName())) {
  579 + port = syServiceConfigItem.getItemValue();
  580 + }
  581 + }
  582 + if (ip == null || "".equals(ip) || port == null || "".equals(port)) {
  583 + throw new CustomXException("201", "请求地址或端口配置信息异常");
  584 + }
  585 +
  586 + String uri = null;
  587 + SyServiceInterfaceMould syServiceInterfaceMould = syServiceInterfaceMouldMapper.selectByPrimaryKey(interfaceMouldId);
  588 + if (syServiceInterfaceMould == null) {
  589 + throw new CustomXException("201", "参数为空");
  590 + }
  591 + uri = syServiceInterfaceMould.getUri();
  592 + if (uri == null) {
  593 + throw new CustomXException("201", "请求路径信息异常");
  594 + }
  595 + JSONObject paramJson = JSON.parseObject(paramsStr);
  596 + MultiValueMap<String, Object> multiValueMap = new LinkedMultiValueMap<>();
  597 + for (String key : paramJson.keySet()) {
  598 + String value = paramJson.getString(key);
  599 + if ("#file#".equals(value)) {
  600 + if (multipartFile != null && multipartFile.getOriginalFilename() != null) {
  601 + try {
  602 + FileUtils.writeByteArrayToFile(new File(multipartFile.getOriginalFilename()), multipartFile.getBytes());
  603 + } catch (IOException e) {
  604 + e.printStackTrace();
  605 + }
  606 + FileSystemResource fileSystemResource = new FileSystemResource(new File(multipartFile.getOriginalFilename()));
  607 + multiValueMap.add(key, fileSystemResource);
  608 + } else {
  609 + throw new CustomXException("201", "参数为空");
  610 + }
  611 + } else {
  612 + multiValueMap.add(key, value);
  613 + }
  614 + }
  615 +
  616 + HttpHeaders httpHeaders = new HttpHeaders();
  617 + httpHeaders.setContentType(MediaType.parseMediaType(syServiceInterfaceMould.getContentType()));
  618 + HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(multiValueMap, httpHeaders);
  619 + if ("post".equals(syServiceInterfaceMould.getMethodType().toLowerCase())) {
  620 + ResponseEntity<String> responseEntity = restTemplate.postForEntity("http://" + ip + ":" + port + uri, httpEntity, String.class);
  621 + return responseEntity.getBody();
  622 + } else {
  623 + return "其他请求方式暂不支持";
  624 + }
  625 + }
  626 +
  627 + /**
  628 + * 获取配置服务支持的所有接口信息(固定对应的itemName为 serviceInterface, interfaceMould)
  629 + *
  630 + * @param configId 服务主键
  631 + * @return 支持的所有接口信息
  632 + */
  633 + @Override
  634 + public List<SyServiceInterfaceMould> findAllAvailableInterface(Integer configId) {
  635 + // serviceInterface(除接口模板外还有的接口信息), interfaceMould(接口模板对应的id)
  636 + List<SyServiceConfigItem> syServiceConfigItems = syServiceConfigItemMapper.selectByExample(SyServiceConfigItemExample
  637 + .newAndCreateCriteria()
  638 + .andConfigIdEqualTo(configId)
  639 + .andItemNameIn(Arrays.asList("serviceInterface", "interfaceMould")).example());
  640 +
  641 + List<Integer> interfaceMouldIdList = new ArrayList<>();
  642 + Integer mouldId = null;
  643 + for (SyServiceConfigItem syServiceConfigItem : syServiceConfigItems) {
  644 + if (syServiceConfigItem == null) {
  645 + continue;
  646 + }
  647 + if ("serviceInterface".equals(syServiceConfigItem.getItemName())) {
  648 + interfaceMouldIdList.add(Integer.valueOf(syServiceConfigItem.getItemValue()));
  649 + } else if ("interfaceMould".equals(syServiceConfigItem.getItemName())) {
  650 + mouldId = Integer.valueOf(syServiceConfigItem.getItemValue());
  651 + }
  652 + }
  653 + SyServiceInterfaceMouldExample syServiceInterfaceMouldExample = new SyServiceInterfaceMouldExample();
  654 + if (interfaceMouldIdList.size() > 0) {
  655 + syServiceInterfaceMouldExample.or(SyServiceInterfaceMouldExample.newAndCreateCriteria().andIdIn(interfaceMouldIdList));
  656 + }
  657 + if (mouldId != null) {
  658 + syServiceInterfaceMouldExample.or(SyServiceInterfaceMouldExample.newAndCreateCriteria().andMouldIdEqualTo(mouldId));
  659 + }
  660 + return syServiceInterfaceMouldMapper.selectByExample(syServiceInterfaceMouldExample);
  661 + }
541 662 }
... ...
src/main/java/com/objecteye/service/impl/OccupationOfBasicResourcesServiceImpl.java
... ... @@ -32,6 +32,7 @@ public class OccupationOfBasicResourcesServiceImpl implements IOccupationOfBasic
32 32 @Override
33 33 public JSONArray getInfoByModule(Map<String, Object> requestMap) {
34 34 String module = (String) requestMap.get("module");
  35 + JSONArray resultArr = new JSONArray();
35 36 if ("uptime".equals(module)) {
36 37 String cmd = "uptime";
37 38 List<String> outList = new ArrayList<>();
... ... @@ -41,15 +42,22 @@ public class OccupationOfBasicResourcesServiceImpl implements IOccupationOfBasic
41 42 String uptimeStr = outArr[0].substring(outArr[0].indexOf("up") + 2).trim() + "," + outArr[1];
42 43 uptimeStr = uptimeStr.replaceAll("days", "天");
43 44 if (!uptimeStr.contains("min")) {
44   - uptimeStr = uptimeStr.replaceAll(":", "h") + "min";
  45 + uptimeStr = uptimeStr.replaceAll(":", "小时") + "分钟";
  46 + } else {
  47 + uptimeStr = uptimeStr.replaceAll("min", "分钟");
45 48 }
46 49 JSONObject resultObj = new JSONObject();
47 50 resultObj.put("result", uptimeStr);
48   - JSONArray resultArr = new JSONArray();
49 51 resultArr.add(resultObj);
50 52 return resultArr;
51 53 } else {
52   - return getInfoByModule((String) requestMap.get("module"));
  54 + resultArr = getInfoByModule((String) requestMap.get("module"));
  55 + if (resultArr.size() > 0 && "memory_info".equals(module)) {
  56 + JSONObject resultObj = resultArr.getJSONObject(0);
  57 + String memTotal = resultObj.getString("MemTotal").replaceAll("kB", "").trim();
  58 + resultObj.put("MemTotalG", Integer.parseInt(memTotal) / 1024 / 2014 + "G");
  59 + }
  60 + return resultArr;
53 61 }
54 62 }
55 63  
... ...
src/main/resources/com.objecteye.mapper/SyServiceInterfaceMouldMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.objecteye.mapper.SyServiceInterfaceMouldMapper">
  4 + <resultMap id="BaseResultMap" type="com.objecteye.entity.SyServiceInterfaceMould">
  5 + <id column="id" jdbcType="INTEGER" property="id"/>
  6 + <result column="mould_id" jdbcType="INTEGER" property="mouldId"/>
  7 + <result column="method_type" jdbcType="VARCHAR" property="methodType"/>
  8 + <result column="content_type" jdbcType="VARCHAR" property="contentType"/>
  9 + <result column="uri" jdbcType="VARCHAR" property="uri"/>
  10 + <result column="default_json" jdbcType="VARCHAR" property="defaultJson"/>
  11 + </resultMap>
  12 + <sql id="Example_Where_Clause">
  13 + <where>
  14 + <foreach collection="oredCriteria" item="criteria" separator="or">
  15 + <if test="criteria.valid">
  16 + <trim prefix="(" prefixOverrides="and" suffix=")">
  17 + <foreach collection="criteria.criteria" item="criterion">
  18 + <choose>
  19 + <when test="criterion.noValue">
  20 + and ${criterion.condition}
  21 + </when>
  22 + <when test="criterion.singleValue">
  23 + and ${criterion.condition} #{criterion.value}
  24 + </when>
  25 + <when test="criterion.betweenValue">
  26 + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  27 + </when>
  28 + <when test="criterion.listValue">
  29 + and ${criterion.condition}
  30 + <foreach close=")" collection="criterion.value" item="listItem" open="("
  31 + separator=",">
  32 + #{listItem}
  33 + </foreach>
  34 + </when>
  35 + </choose>
  36 + </foreach>
  37 + </trim>
  38 + </if>
  39 + </foreach>
  40 + </where>
  41 + </sql>
  42 + <sql id="Update_By_Example_Where_Clause">
  43 + <where>
  44 + <foreach collection="example.oredCriteria" item="criteria" separator="or">
  45 + <if test="criteria.valid">
  46 + <trim prefix="(" prefixOverrides="and" suffix=")">
  47 + <foreach collection="criteria.criteria" item="criterion">
  48 + <choose>
  49 + <when test="criterion.noValue">
  50 + and ${criterion.condition}
  51 + </when>
  52 + <when test="criterion.singleValue">
  53 + and ${criterion.condition} #{criterion.value}
  54 + </when>
  55 + <when test="criterion.betweenValue">
  56 + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  57 + </when>
  58 + <when test="criterion.listValue">
  59 + and ${criterion.condition}
  60 + <foreach close=")" collection="criterion.value" item="listItem" open="("
  61 + separator=",">
  62 + #{listItem}
  63 + </foreach>
  64 + </when>
  65 + </choose>
  66 + </foreach>
  67 + </trim>
  68 + </if>
  69 + </foreach>
  70 + </where>
  71 + </sql>
  72 + <sql id="Base_Column_List">
  73 + id, mould_id, method_type, content_type, uri, default_json
  74 + </sql>
  75 + <select id="selectByExample" parameterType="com.objecteye.entity.SyServiceInterfaceMouldExample"
  76 + resultMap="BaseResultMap">
  77 + select
  78 + <if test="distinct">
  79 + distinct
  80 + </if>
  81 + <include refid="Base_Column_List"/>
  82 + from sy_service_interface_mould
  83 + <if test="_parameter != null">
  84 + <include refid="Example_Where_Clause"/>
  85 + </if>
  86 + <if test="orderByClause != null">
  87 + order by ${orderByClause}
  88 + </if>
  89 + <if test="rows != null">
  90 + <if test="offset != null">
  91 + limit ${offset}, ${rows}
  92 + </if>
  93 + <if test="offset == null">
  94 + limit ${rows}
  95 + </if>
  96 + </if>
  97 + </select>
  98 + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  99 + select
  100 + <include refid="Base_Column_List"/>
  101 + from sy_service_interface_mould
  102 + where id = #{id,jdbcType=INTEGER}
  103 + </select>
  104 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  105 + delete
  106 + from sy_service_interface_mould
  107 + where id = #{id,jdbcType=INTEGER}
  108 + </delete>
  109 + <delete id="deleteByExample" parameterType="com.objecteye.entity.SyServiceInterfaceMouldExample">
  110 + delete from sy_service_interface_mould
  111 + <if test="_parameter != null">
  112 + <include refid="Example_Where_Clause"/>
  113 + </if>
  114 + </delete>
  115 + <insert id="insert" parameterType="com.objecteye.entity.SyServiceInterfaceMould">
  116 + <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Integer">
  117 + SELECT LAST_INSERT_ID()
  118 + </selectKey>
  119 + insert into sy_service_interface_mould (id, mould_id, method_type,
  120 + content_type, uri, default_json
  121 + )
  122 + values (#{id,jdbcType=INTEGER}, #{mouldId,jdbcType=INTEGER}, #{methodType,jdbcType=VARCHAR},
  123 + #{contentType,jdbcType=VARCHAR}, #{uri,jdbcType=VARCHAR}, #{defaultJson,jdbcType=VARCHAR}
  124 + )
  125 + </insert>
  126 + <insert id="insertSelective" parameterType="com.objecteye.entity.SyServiceInterfaceMould">
  127 + <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Integer">
  128 + SELECT LAST_INSERT_ID()
  129 + </selectKey>
  130 + insert into sy_service_interface_mould
  131 + <trim prefix="(" suffix=")" suffixOverrides=",">
  132 + id,
  133 + <if test="mouldId != null">
  134 + mould_id,
  135 + </if>
  136 + <if test="methodType != null">
  137 + method_type,
  138 + </if>
  139 + <if test="contentType != null">
  140 + content_type,
  141 + </if>
  142 + <if test="uri != null">
  143 + uri,
  144 + </if>
  145 + <if test="defaultJson != null">
  146 + default_json,
  147 + </if>
  148 + </trim>
  149 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  150 + #{id,jdbcType=INTEGER},
  151 + <if test="mouldId != null">
  152 + #{mouldId,jdbcType=INTEGER},
  153 + </if>
  154 + <if test="methodType != null">
  155 + #{methodType,jdbcType=VARCHAR},
  156 + </if>
  157 + <if test="contentType != null">
  158 + #{contentType,jdbcType=VARCHAR},
  159 + </if>
  160 + <if test="uri != null">
  161 + #{uri,jdbcType=VARCHAR},
  162 + </if>
  163 + <if test="defaultJson != null">
  164 + #{defaultJson,jdbcType=VARCHAR},
  165 + </if>
  166 + </trim>
  167 + </insert>
  168 + <select id="countByExample" parameterType="com.objecteye.entity.SyServiceInterfaceMouldExample"
  169 + resultType="java.lang.Long">
  170 + select count(*) from sy_service_interface_mould
  171 + <if test="_parameter != null">
  172 + <include refid="Example_Where_Clause"/>
  173 + </if>
  174 + </select>
  175 + <update id="updateByExampleSelective" parameterType="map">
  176 + update sy_service_interface_mould
  177 + <set>
  178 + <if test="record.id != null">
  179 + id = #{record.id,jdbcType=INTEGER},
  180 + </if>
  181 + <if test="record.mouldId != null">
  182 + mould_id = #{record.mouldId,jdbcType=INTEGER},
  183 + </if>
  184 + <if test="record.methodType != null">
  185 + method_type = #{record.methodType,jdbcType=VARCHAR},
  186 + </if>
  187 + <if test="record.contentType != null">
  188 + content_type = #{record.contentType,jdbcType=VARCHAR},
  189 + </if>
  190 + <if test="record.uri != null">
  191 + uri = #{record.uri,jdbcType=VARCHAR},
  192 + </if>
  193 + <if test="record.defaultJson != null">
  194 + default_json = #{record.defaultJson,jdbcType=VARCHAR},
  195 + </if>
  196 + </set>
  197 + <if test="_parameter != null">
  198 + <include refid="Update_By_Example_Where_Clause"/>
  199 + </if>
  200 + </update>
  201 + <update id="updateByExample" parameterType="map">
  202 + update sy_service_interface_mould
  203 + set id = #{record.id,jdbcType=INTEGER},
  204 + mould_id = #{record.mouldId,jdbcType=INTEGER},
  205 + method_type = #{record.methodType,jdbcType=VARCHAR},
  206 + content_type = #{record.contentType,jdbcType=VARCHAR},
  207 + uri = #{record.uri,jdbcType=VARCHAR},
  208 + default_json = #{record.defaultJson,jdbcType=VARCHAR}
  209 + <if test="_parameter != null">
  210 + <include refid="Update_By_Example_Where_Clause"/>
  211 + </if>
  212 + </update>
  213 + <update id="updateByPrimaryKeySelective" parameterType="com.objecteye.entity.SyServiceInterfaceMould">
  214 + update sy_service_interface_mould
  215 + <set>
  216 + <if test="mouldId != null">
  217 + mould_id = #{mouldId,jdbcType=INTEGER},
  218 + </if>
  219 + <if test="methodType != null">
  220 + method_type = #{methodType,jdbcType=VARCHAR},
  221 + </if>
  222 + <if test="contentType != null">
  223 + content_type = #{contentType,jdbcType=VARCHAR},
  224 + </if>
  225 + <if test="uri != null">
  226 + uri = #{uri,jdbcType=VARCHAR},
  227 + </if>
  228 + <if test="defaultJson != null">
  229 + default_json = #{defaultJson,jdbcType=VARCHAR},
  230 + </if>
  231 + </set>
  232 + where id = #{id,jdbcType=INTEGER}
  233 + </update>
  234 + <update id="updateByPrimaryKey" parameterType="com.objecteye.entity.SyServiceInterfaceMould">
  235 + update sy_service_interface_mould
  236 + set mould_id = #{mouldId,jdbcType=INTEGER},
  237 + method_type = #{methodType,jdbcType=VARCHAR},
  238 + content_type = #{contentType,jdbcType=VARCHAR},
  239 + uri = #{uri,jdbcType=VARCHAR},
  240 + default_json = #{defaultJson,jdbcType=VARCHAR}
  241 + where id = #{id,jdbcType=INTEGER}
  242 + </update>
  243 + <select id="selectOneByExample" parameterType="com.objecteye.entity.SyServiceInterfaceMouldExample"
  244 + resultMap="BaseResultMap">
  245 + select
  246 + <include refid="Base_Column_List"/>
  247 + from sy_service_interface_mould
  248 + <if test="_parameter != null">
  249 + <include refid="Example_Where_Clause"/>
  250 + </if>
  251 + <if test="orderByClause != null">
  252 + order by ${orderByClause}
  253 + </if>
  254 + limit 1
  255 + </select>
  256 +</mapper>
0 257 \ No newline at end of file
... ...