|
@ -0,0 +1,126 @@
|
|
|
package com.yihu.iot.controller.platform;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.iot.service.platform.IotShareInterfaceService;
|
|
|
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
|
|
|
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import com.yihu.jw.rm.iot.IotRequestMapping;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @author HZY
|
|
|
* @vsrsion 1.0
|
|
|
* Created at 2020/4/28
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping(IotRequestMapping.Common.platform)
|
|
|
@Api(tags = "平台接口管理相关操作", description = "平台接口管理相关操作")
|
|
|
public class IotInterfaceController extends EnvelopRestEndpoint {
|
|
|
|
|
|
@Autowired
|
|
|
private IotShareInterfaceService iotShareInterfaceService;
|
|
|
|
|
|
@PostMapping(value = IotRequestMapping.Platform.addInterface)
|
|
|
@ApiOperation(value = "新增共享接口",notes = "新增共享接口")
|
|
|
public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> addInterface(@ApiParam(name = "JSON",value = "接口JSON串") @RequestParam(value = "JSON",required = true)String json){
|
|
|
|
|
|
try {
|
|
|
iotShareInterfaceService.addInterface(json);
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_add);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError(e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = IotRequestMapping.Platform.editInterface)
|
|
|
@ApiOperation(value = "编辑共享接口",notes = "编辑共享接口")
|
|
|
public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> editInterface(@ApiParam(name = "JSON",value = "接口JSON串") @RequestParam(value = "JSON",required = true)String json){
|
|
|
|
|
|
try {
|
|
|
iotShareInterfaceService.editInterface(json);
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_edit);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError(e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(value = IotRequestMapping.Platform.findInterfaceById)
|
|
|
@ApiOperation(value = "查找共享接口",notes = "查找共享接口")
|
|
|
public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> findInterfaceById(@ApiParam(name = "id",value = "id") @RequestParam(value = "id",required = true)String id){
|
|
|
|
|
|
try {
|
|
|
IotShareInterfaceDO iotShareInterfaceDO = iotShareInterfaceService.findInterfaceById(id);
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find,iotShareInterfaceDO);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError(e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(value = IotRequestMapping.Platform.findAll)
|
|
|
@ApiOperation(value = "分页查询所有",notes = "分页查询所有")
|
|
|
public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> findAll(@ApiParam(name = "page", value = "第几页", defaultValue = "")
|
|
|
@RequestParam(value = "page", required = false) Integer page,
|
|
|
@ApiParam(name = "size", value = "每页记录数", defaultValue = "")
|
|
|
@RequestParam(value = "size", required = false) Integer size){
|
|
|
|
|
|
try {
|
|
|
if(page == null|| page < 0){
|
|
|
page = 1;
|
|
|
}
|
|
|
if(size == null){
|
|
|
size = 10;
|
|
|
}
|
|
|
return iotShareInterfaceService.findAll(page,size);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError(e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = IotRequestMapping.Platform.conditionQueryPage)
|
|
|
@ApiOperation(value = "条件查询分页",notes = "条件查询分页")
|
|
|
public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> conditionQueryPage(@ApiParam(name = "type", value = "业务类型", defaultValue = "")
|
|
|
@RequestParam(value = "type", required = false) String type,
|
|
|
@ApiParam(name = "name", value = "接口名称", defaultValue = "")
|
|
|
@RequestParam(value = "name", required = false) String name,
|
|
|
@ApiParam(name = "page", value = "第几页", defaultValue = "")
|
|
|
@RequestParam(value = "page", required = false) Integer page,
|
|
|
@ApiParam(name = "size", value = "每页记录数", defaultValue = "")
|
|
|
@RequestParam(value = "size", required = false) Integer size){
|
|
|
|
|
|
try {
|
|
|
if(page == null|| page < 0){
|
|
|
page = 1;
|
|
|
}
|
|
|
if(size == null){
|
|
|
size = 10;
|
|
|
}
|
|
|
return iotShareInterfaceService.conditionQueryPage(page,size,type,name);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError(e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|