Commit 6b07c16a2a3a0065ffb25ab67c2051fbd559255a

Authored by Liu Haoyu
1 parent 993065fd

调用接口返回格式修改为jsonobject;

src/main/java/com/objecteye/controller/BackGroundController.java
@@ -88,9 +88,9 @@ public class BackGroundController extends BasicController { @@ -88,9 +88,9 @@ public class BackGroundController extends BasicController {
88 88
89 @ApiOperation("根据配置明细项id获取请求http的返回值信息") 89 @ApiOperation("根据配置明细项id获取请求http的返回值信息")
90 @RequestMapping(value = "getServiceHttpResponse", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) 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(required = false) String params,  
93 - @RequestParam(required = false) MultipartFile multipartFile) { 91 + public CommonResult getServiceHttpResponse(@RequestParam Integer configId, @RequestParam Integer interfaceMouldId,
  92 + @RequestParam(required = false) String params,
  93 + @RequestParam(required = false) MultipartFile multipartFile) {
94 return CommonResult.success(iBackGroundService.getServiceHttpResponse(configId, interfaceMouldId, params, multipartFile)); 94 return CommonResult.success(iBackGroundService.getServiceHttpResponse(configId, interfaceMouldId, params, multipartFile));
95 } 95 }
96 96
src/main/java/com/objecteye/service/IBackGroundService.java
@@ -116,7 +116,7 @@ public interface IBackGroundService { @@ -116,7 +116,7 @@ public interface IBackGroundService {
116 * @param multipartFile 请求文件 116 * @param multipartFile 请求文件
117 * @return http请求返回信息 117 * @return http请求返回信息
118 */ 118 */
119 - String getServiceHttpResponse(Integer configId, Integer interfaceMouldId, String paramsStr, MultipartFile multipartFile); 119 + JSONObject getServiceHttpResponse(Integer configId, Integer interfaceMouldId, String paramsStr, MultipartFile multipartFile);
120 120
121 /** 121 /**
122 * 获取配置服务支持的所有接口信息(固定对应的itemName为 serviceInterface, interfaceMould) 122 * 获取配置服务支持的所有接口信息(固定对应的itemName为 serviceInterface, interfaceMould)
src/main/java/com/objecteye/service/impl/BackGroundServiceImpl.java
@@ -596,7 +596,7 @@ public class BackGroundServiceImpl implements IBackGroundService { @@ -596,7 +596,7 @@ public class BackGroundServiceImpl implements IBackGroundService {
596 * @return http请求返回信息 596 * @return http请求返回信息
597 */ 597 */
598 @Override 598 @Override
599 - public String getServiceHttpResponse(Integer configId, Integer interfaceMouldId, String paramsStr, MultipartFile multipartFile) { 599 + public JSONObject getServiceHttpResponse(Integer configId, Integer interfaceMouldId, String paramsStr, MultipartFile multipartFile) {
600 List<SyServiceConfigItem> syServiceConfigItems = syServiceConfigItemMapper.selectByExample(SyServiceConfigItemExample.newAndCreateCriteria().andConfigIdEqualTo(configId) 600 List<SyServiceConfigItem> syServiceConfigItems = syServiceConfigItemMapper.selectByExample(SyServiceConfigItemExample.newAndCreateCriteria().andConfigIdEqualTo(configId)
601 .andItemNameIn(Arrays.asList("http", "port")).example()); 601 .andItemNameIn(Arrays.asList("http", "port")).example());
602 String ip = null; 602 String ip = null;
@@ -667,9 +667,11 @@ public class BackGroundServiceImpl implements IBackGroundService { @@ -667,9 +667,11 @@ public class BackGroundServiceImpl implements IBackGroundService {
667 } 667 }
668 668
669 if ("post".equals(syServiceInterfaceMould.getMethodType().toLowerCase())) { 669 if ("post".equals(syServiceInterfaceMould.getMethodType().toLowerCase())) {
670 - return resultString; 670 + return JSON.parseObject(resultString);
671 } else { 671 } else {
672 - return "其他请求方式暂不支持"; 672 + JSONObject resultObj = new JSONObject();
  673 + resultObj.put("error", "其他请求方式暂不支持");
  674 + return resultObj;
673 } 675 }
674 } 676 }
675 677