|
|
|
@ -1,8 +1,10 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.controller;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.icloud.core.sdk.ICoreDemoCloud;
|
|
|
|
|
import cn.estsh.i3plus.icloud.wms.sdk.IWmsDemoCloud;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.BaseModelBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRole;
|
|
|
|
@ -13,68 +15,69 @@ import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/cloud")
|
|
|
|
|
@RequestMapping("/impp/cloud")
|
|
|
|
|
@Api(description="分布式服务测试")
|
|
|
|
|
public class DemoCloudController {
|
|
|
|
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(DemoCloudController.class);
|
|
|
|
|
|
|
|
|
|
@Value("${server.port}")
|
|
|
|
|
private String serverPort;
|
|
|
|
|
|
|
|
|
|
@Value("${eureka.instance.ip-address}")
|
|
|
|
|
private String ipAddress;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
ICoreDemoCloud iCoreDemoCloud;
|
|
|
|
|
|
|
|
|
|
@GetMapping(value="/test")
|
|
|
|
|
@ApiOperation(value="测试",notes = "测试")
|
|
|
|
|
public ResultBean simpleTest(String test) {
|
|
|
|
|
LOGGER.info("【接受数据】{}",test);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
iCoreDemoCloud.testGet("get = " + test);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error("XXXX --> get调用出错:" + e.getMessage(),e);
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
iCoreDemoCloud.testPost("post = " + test);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error("XXXX --> post调用出错:" + e.getMessage(),e);
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
// iCoreDemoCloud.testPut("testPut = " + test,"name");
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error("XXXX --> testPut调用出错:" + e.getMessage(),e);
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
// iCoreDemoCloud.testDelete(new Pager(),"delete = " + test);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error("XXXX --> delete调用出错:" + e.getMessage(),e);
|
|
|
|
|
}
|
|
|
|
|
@Autowired
|
|
|
|
|
IWmsDemoCloud iWmsDemoCloud;
|
|
|
|
|
|
|
|
|
|
test += "cloud return = ";
|
|
|
|
|
@GetMapping(value="/test")
|
|
|
|
|
@ApiOperation(value="core测试",notes = "core测试")
|
|
|
|
|
public ResultBean testCore(String test) {
|
|
|
|
|
LOGGER.info("{}:{},【impp-core接受数据】{}",ipAddress,serverPort,test);
|
|
|
|
|
return ResultBean.success("返回:" + test).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(value="/test-wms")
|
|
|
|
|
@ApiOperation(value="wms测试",notes = "wms测试")
|
|
|
|
|
public ResultBean testWms(String test) {
|
|
|
|
|
LOGGER.info("【{}:{},impp-core接受数据 -> wms】{}",ipAddress,serverPort,test);
|
|
|
|
|
|
|
|
|
|
BaseResultBean result = iWmsDemoCloud.testWms(test);
|
|
|
|
|
if(result.isSuccess()){
|
|
|
|
|
return ResultBean.success("wms返回:" + test).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}else{
|
|
|
|
|
LOGGER.error("无法调用wms服务:{}",result.getErrorMsg());
|
|
|
|
|
return ResultBean.fail("调用wms服务出错:" + result.getErrorMsg());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(value="/test-get")
|
|
|
|
|
@ApiOperation(value="测试get",notes = "测试get")
|
|
|
|
|
public ResultBean testFeignGet(String test) {
|
|
|
|
|
LOGGER.info("【get接受数据】{}" ,test);
|
|
|
|
|
LOGGER.info("【impp-core-get接受数据】{}" ,test);
|
|
|
|
|
return ResultBean.success("返回:" + test).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping(value="/test-post")
|
|
|
|
|
@ApiOperation(value="测试post",notes = "测试post")
|
|
|
|
|
public ResultBean testFeignPost(String test) {
|
|
|
|
|
LOGGER.info("【post接受数据】{}" ,test);
|
|
|
|
|
LOGGER.info("【impp-core-post接受数据】{}" ,test);
|
|
|
|
|
return ResultBean.success("返回:" + test).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PutMapping(value="/test-put")
|
|
|
|
|
@ApiOperation(value="put接受数据",notes = "put接受数据")
|
|
|
|
|
public ResultBean testPut(String test,String name) {
|
|
|
|
|
LOGGER.info("【put接受数据】param1:{},param2:{}", test,name);
|
|
|
|
|
LOGGER.info("【impp-core-put接受数据】param1:{},param2:{}", test,name);
|
|
|
|
|
return ResultBean.success("返回:" + test).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -83,42 +86,42 @@ public class DemoCloudController {
|
|
|
|
|
public ResultBean testDelete(
|
|
|
|
|
@RequestBody Pager pager,
|
|
|
|
|
@RequestParam("test") String test) {
|
|
|
|
|
LOGGER.info("【delete接受数据】pager:{},test:{}",pager,test);
|
|
|
|
|
LOGGER.info("【impp-core-delete接受数据】pager:{},test:{}",pager,test);
|
|
|
|
|
return ResultBean.success("返回:" + test).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PutMapping(value="/test-cloud-put")
|
|
|
|
|
@ApiOperation(value="测试cloudput",notes = "测试cloudput")
|
|
|
|
|
public ResultBean putTestCloud(String test,String name) {
|
|
|
|
|
LOGGER.info("【put接受数据】test:{},name:{}",test,name);
|
|
|
|
|
LOGGER.info("【impp-core-put接受数据】test:{},name:{}",test,name);
|
|
|
|
|
return ResultBean.success("返回:" + test).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping(value="/test-object")
|
|
|
|
|
@ApiOperation(value="测试单对象")
|
|
|
|
|
public ResultBean testObject(@RequestBody Pager pager) {
|
|
|
|
|
LOGGER.info("【object接受数据】{}" ,pager);
|
|
|
|
|
LOGGER.info("【impp-core-object接受数据】{}" ,pager);
|
|
|
|
|
return ResultBean.success("返回:" + pager).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping(value="/test-map")
|
|
|
|
|
@ApiOperation(value="测试get",notes = "测试get")
|
|
|
|
|
public ResultBean testFeignMap(@RequestBody Map<String,String> map) {
|
|
|
|
|
LOGGER.info("【map接受数据】{}" ,map);
|
|
|
|
|
LOGGER.info("【impp-core-map接受数据】{}" ,map);
|
|
|
|
|
return ResultBean.success("返回:" + map).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping(value="/test-arr")
|
|
|
|
|
@ApiOperation(value="测试arr",notes = "测试arr")
|
|
|
|
|
public ResultBean testFeignArr(@RequestBody String[] arr) {
|
|
|
|
|
LOGGER.info("【arr接受数据】{}" ,arr);
|
|
|
|
|
LOGGER.info("【impp-core-arr接受数据】{}" ,arr);
|
|
|
|
|
return ResultBean.success("返回:" + arr).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping(value="/test-more-object")
|
|
|
|
|
@ApiOperation(value="测试多对象模型",notes = "测试多对象模型")
|
|
|
|
|
public ResultBean testFeignMoreObj(@RequestBody BaseModelBean<SysRole> roleBean) {
|
|
|
|
|
LOGGER.info("【more-obj接受多对象模型】objBean:{},pager:{}" ,roleBean.getObj(),roleBean.getPager());
|
|
|
|
|
LOGGER.info("【impp-core-more-obj接受多对象模型】objBean:{},pager:{}" ,roleBean.getObj(),roleBean.getPager());
|
|
|
|
|
return ResultBean.success("返回:" + roleBean).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|