新增可以动态添加项目V1
parent
91e1a3c640
commit
9846d05690
|
@ -0,0 +1,37 @@
|
||||||
|
package org.lsh.webservice.ui.config;
|
||||||
|
|
||||||
|
import org.apache.cxf.Bus;
|
||||||
|
import org.apache.cxf.bus.spring.SpringBus;
|
||||||
|
import org.apache.cxf.jaxws.EndpointImpl;
|
||||||
|
import org.apache.cxf.transport.servlet.CXFServlet;
|
||||||
|
import org.lsh.webservice.ui.webservice.TestWebservice;
|
||||||
|
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.xml.ws.Endpoint;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebServiceConfig {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
TestWebservice testWebservice;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ServletRegistrationBean destoryServlet(){
|
||||||
|
return new ServletRegistrationBean(new CXFServlet(),"/services/*");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean(name = Bus.DEFAULT_BUS_ID)
|
||||||
|
public SpringBus springBus(){
|
||||||
|
return new SpringBus();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Endpoint endpoint(){
|
||||||
|
EndpointImpl endpoint = new EndpointImpl(springBus(),testWebservice);
|
||||||
|
endpoint.publish("/TestWebservice");
|
||||||
|
return endpoint;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package org.lsh.webservice.ui.controller;
|
package org.lsh.webservice.ui.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.lsh.webservice.ui.common.Result;
|
import org.lsh.webservice.ui.common.Result;
|
||||||
|
@ -46,7 +47,12 @@ public class MainController {
|
||||||
){
|
){
|
||||||
Project project = projectMapper.findById(wsdl.getProjectId());
|
Project project = projectMapper.findById(wsdl.getProjectId());
|
||||||
if(project == null){
|
if(project == null){
|
||||||
return Result.failed("所选项目ID不存在!");
|
project = new Project();
|
||||||
|
project.setName(wsdl.getProjectId());
|
||||||
|
projectMapper.insert(project);
|
||||||
|
}
|
||||||
|
if(StrUtil.isBlank(project.getId())){
|
||||||
|
return Result.failed("项目创建失败:" + wsdl.getProjectId());
|
||||||
}
|
}
|
||||||
FormV2 formV2 = null;
|
FormV2 formV2 = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.lsh.webservice.ui.entity.tree;
|
package org.lsh.webservice.ui.entity.tree;
|
||||||
|
|
||||||
public class Operation extends TreeItem{
|
public class Operation extends TreeItem{
|
||||||
private int webserviceId;
|
private String webserviceId;
|
||||||
/** JSON序列化的 入参表单信息
|
/** JSON序列化的 入参表单信息
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -11,11 +11,11 @@ public class Operation extends TreeItem{
|
||||||
*/
|
*/
|
||||||
private String output;
|
private String output;
|
||||||
|
|
||||||
public int getWebserviceId() {
|
public String getWebserviceId() {
|
||||||
return webserviceId;
|
return webserviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWebserviceId(int webserviceId) {
|
public void setWebserviceId(String webserviceId) {
|
||||||
this.webserviceId = webserviceId;
|
this.webserviceId = webserviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
package org.lsh.webservice.ui.entity.tree;
|
package org.lsh.webservice.ui.entity.tree;
|
||||||
|
|
||||||
import org.lsh.webservice.ui.entity.FormItemV2;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TreeItem {
|
public class TreeItem {
|
||||||
private Integer id;
|
|
||||||
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
private List<? extends TreeItem> children;
|
private List<? extends TreeItem> children;
|
||||||
|
|
||||||
public Integer getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Integer id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||||
public class Webservice extends TreeItem {
|
public class Webservice extends TreeItem {
|
||||||
|
|
||||||
private String wsdl;
|
private String wsdl;
|
||||||
private int projectId;
|
private String projectId;
|
||||||
private List<Operation> operationList;
|
private List<Operation> operationList;
|
||||||
|
|
||||||
public String getWsdl() {
|
public String getWsdl() {
|
||||||
|
@ -24,11 +24,11 @@ public class Webservice extends TreeItem {
|
||||||
this.operationList = operationList;
|
this.operationList = operationList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProjectId() {
|
public String getProjectId() {
|
||||||
return projectId;
|
return projectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProjectId(int projectId) {
|
public void setProjectId(String projectId) {
|
||||||
this.projectId = projectId;
|
this.projectId = projectId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,18 +6,18 @@ import java.io.Serializable;
|
||||||
|
|
||||||
public class OperationQueryVO implements Serializable {
|
public class OperationQueryVO implements Serializable {
|
||||||
|
|
||||||
private Integer id;
|
private String id;
|
||||||
private String operation;
|
private String operation;
|
||||||
private FormField input;
|
private FormField input;
|
||||||
private FormField output;
|
private FormField output;
|
||||||
private String wsdl;
|
private String wsdl;
|
||||||
private String webserviceName;
|
private String webserviceName;
|
||||||
|
|
||||||
public Integer getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Integer id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.lsh.webservice.ui.entity.vo;
|
||||||
|
|
||||||
public class Wsdl {
|
public class Wsdl {
|
||||||
private String wsdl;
|
private String wsdl;
|
||||||
private int projectId;
|
private String projectId;
|
||||||
|
|
||||||
public String getWsdl() {
|
public String getWsdl() {
|
||||||
return wsdl;
|
return wsdl;
|
||||||
|
@ -12,11 +12,11 @@ public class Wsdl {
|
||||||
this.wsdl = wsdl;
|
this.wsdl = wsdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProjectId() {
|
public String getProjectId() {
|
||||||
return projectId;
|
return projectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProjectId(int projectId) {
|
public void setProjectId(String projectId) {
|
||||||
this.projectId = projectId;
|
this.projectId = projectId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public interface OperationMapper {
|
||||||
@Result(property = "name", column = "name"), // 指定属性名和列名的映射关系
|
@Result(property = "name", column = "name"), // 指定属性名和列名的映射关系
|
||||||
@Result(property = "webserviceId", column = "webservice_id"), // 指定属性名和列名的映射关系
|
@Result(property = "webserviceId", column = "webservice_id"), // 指定属性名和列名的映射关系
|
||||||
})
|
})
|
||||||
List<Operation> findByWebserviceId(Integer webserviceId);
|
List<Operation> findByWebserviceId(String webserviceId);
|
||||||
|
|
||||||
@Select("select * from operation where id=#{id}")
|
@Select("select * from operation where id=#{id}")
|
||||||
@Results({
|
@Results({
|
||||||
|
|
|
@ -9,16 +9,17 @@ import java.util.List;
|
||||||
public interface ProjectMapper {
|
public interface ProjectMapper {
|
||||||
|
|
||||||
@Insert("INSERT INTO PROJECT (NAME) VALUES (#{project.name})")
|
@Insert("INSERT INTO PROJECT (NAME) VALUES (#{project.name})")
|
||||||
|
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||||
int insert(@Param("project") Project project);
|
int insert(@Param("project") Project project);
|
||||||
|
|
||||||
void deleteById(Integer id);
|
void deleteById(String id);
|
||||||
|
|
||||||
void update(Project user);
|
void update(Project user);
|
||||||
|
|
||||||
@Select("select * from project where id=#{id}")
|
@Select("select * from PROJECT where id=#{id}")
|
||||||
Project findById(Integer id);
|
Project findById(String id);
|
||||||
|
|
||||||
@Select("select * from project")
|
@Select("select * from PROJECT")
|
||||||
@Results({
|
@Results({
|
||||||
@Result(property = "name", column = "name"), // 指定属性名和列名的映射关系
|
@Result(property = "name", column = "name"), // 指定属性名和列名的映射关系
|
||||||
})
|
})
|
||||||
|
|
|
@ -17,5 +17,5 @@ public interface ServerInfoMapper {
|
||||||
@Results({
|
@Results({
|
||||||
@Result(property = "name", column = "name"), // 指定属性名和列名的映射关系
|
@Result(property = "name", column = "name"), // 指定属性名和列名的映射关系
|
||||||
})
|
})
|
||||||
ServerInfo findByWebserviceId(Integer webserviceId);
|
ServerInfo findByWebserviceId(String webserviceId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,13 @@ public interface WebserviceMapper {
|
||||||
@Result(property = "name", column = "name"), // 指定属性名和列名的映射关系
|
@Result(property = "name", column = "name"), // 指定属性名和列名的映射关系
|
||||||
@Result(property = "projectId", column = "PROJECT_ID"), // 指定属性名和列名的映射关系
|
@Result(property = "projectId", column = "PROJECT_ID"), // 指定属性名和列名的映射关系
|
||||||
})
|
})
|
||||||
List<Webservice> findByProjectId(Integer projectId);
|
List<Webservice> findByProjectId(String projectId);
|
||||||
|
|
||||||
@Select("select * from webservice where id=#{id}")
|
@Select("select * from webservice where id=#{id}")
|
||||||
@Results({
|
@Results({
|
||||||
@Result(property = "name", column = "name"), // 指定属性名和列名的映射关系
|
@Result(property = "name", column = "name"), // 指定属性名和列名的映射关系
|
||||||
@Result(property = "projectId", column = "PROJECT_ID"), // 指定属性名和列名的映射关系
|
@Result(property = "projectId", column = "PROJECT_ID"), // 指定属性名和列名的映射关系
|
||||||
})
|
})
|
||||||
Webservice findById(Integer id);
|
Webservice findById(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.lsh.webservice.ui.webservice;
|
||||||
|
|
||||||
|
import org.lsh.webservice.ui.webservice.dto.Request;
|
||||||
|
import org.lsh.webservice.ui.webservice.dto.Response;
|
||||||
|
|
||||||
|
import javax.jws.WebMethod;
|
||||||
|
import javax.jws.WebParam;
|
||||||
|
import javax.jws.WebService;
|
||||||
|
import javax.xml.ws.soap.SOAPBinding;
|
||||||
|
import javax.xml.ws.BindingType;
|
||||||
|
|
||||||
|
@WebService(name = "TestWebservice",targetNamespace = "org.lsh.webservice.ui")
|
||||||
|
@BindingType(SOAPBinding.SOAP12HTTP_BINDING)
|
||||||
|
public interface TestWebservice {
|
||||||
|
|
||||||
|
@WebMethod
|
||||||
|
Response sayHello(@WebParam(name = "request") Request request);
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
package org.lsh.webservice.ui.webservice.dto;
|
||||||
|
|
||||||
|
public class Request {
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.lsh.webservice.ui.webservice.dto;
|
||||||
|
|
||||||
|
/** 返回参数
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Response {
|
||||||
|
private boolean status;
|
||||||
|
private int code;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
public boolean isStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(boolean status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package org.lsh.webservice.ui.webservice.impl;
|
||||||
|
|
||||||
|
import org.lsh.webservice.ui.webservice.TestWebservice;
|
||||||
|
import org.lsh.webservice.ui.webservice.dto.Request;
|
||||||
|
import org.lsh.webservice.ui.webservice.dto.Response;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.jws.WebService;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@WebService(
|
||||||
|
name = "TestWebservice",
|
||||||
|
targetNamespace = "org.lsh.webservice.ui",
|
||||||
|
endpointInterface = "org.lsh.webservice.ui.webservice.TestWebservice")
|
||||||
|
public class TestWebserviceImpl implements TestWebservice {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response sayHello(Request request) {
|
||||||
|
Response response = new Response();
|
||||||
|
response.setStatus(true);
|
||||||
|
response.setCode(1);
|
||||||
|
response.setMessage("Hello ,this is message !");
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -10,7 +10,7 @@ spring:
|
||||||
content-type: text/html
|
content-type: text/html
|
||||||
cache: false
|
cache: false
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:h2:file:./data/xxx-demo;MODE=MySQL;AUTO_SERVER=TRUE;
|
url: jdbc:h2:file:./data/xxx-demo;MODE=MySQL;DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=TRUE;
|
||||||
driverClassName: org.h2.Driver
|
driverClassName: org.h2.Driver
|
||||||
username: sa
|
username: sa
|
||||||
password: password
|
password: password
|
||||||
|
|
|
@ -1,23 +1,25 @@
|
||||||
CREATE TABLE IF NOT EXISTS Project (
|
CREATE TABLE IF NOT EXISTS Project (
|
||||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
id UUID DEFAULT RANDOM_UUID(),
|
||||||
name VARCHAR(255)
|
name VARCHAR(255)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `WebService` (
|
CREATE TABLE IF NOT EXISTS `WebService` (
|
||||||
`id` INT PRIMARY KEY AUTO_INCREMENT,
|
`id` UUID DEFAULT RANDOM_UUID(),
|
||||||
`name` varchar(255) NULL,
|
`name` varchar(255) NULL,
|
||||||
`wsdl` varchar(255) NULL,
|
`wsdl` varchar(255) NULL,
|
||||||
`project_id` int(255) NULL
|
`project_id` varchar(255) NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `operation` (
|
CREATE TABLE IF NOT EXISTS `OPERATION` (
|
||||||
`id` INT PRIMARY KEY AUTO_INCREMENT,
|
`id` UUID DEFAULT RANDOM_UUID(),
|
||||||
`name` varchar(255) NOT NULL,
|
`name` varchar(255) NOT NULL,
|
||||||
`webservice_id` int(255) NOT NULL
|
`webservice_id` varchar(255) NOT NULL,
|
||||||
|
`input` varchar(255) NOT NULL,
|
||||||
|
`output` varchar(255) NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `server_info` (
|
CREATE TABLE IF NOT EXISTS `server_info` (
|
||||||
`id` UUID DEFAULT RANDOM_UUID(),
|
`id` UUID DEFAULT RANDOM_UUID(),
|
||||||
`webservice_id` int(255) NOT NULL,
|
`webservice_id` varchar(255) NOT NULL,
|
||||||
`form_json` TEXT NOT NULL
|
`form_json` TEXT NOT NULL
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,7 +3,7 @@ Vue.component('add-wsdl', {
|
||||||
template: `
|
template: `
|
||||||
<el-form ref="form" :model="form" label-width="80px">
|
<el-form ref="form" :model="form" label-width="80px">
|
||||||
<el-form-item label="项目">
|
<el-form-item label="项目">
|
||||||
<el-select v-model="form.projectId" placeholder="请选择活动区域">
|
<el-select v-model="form.projectId" placeholder="请选择或者输入项目名称" allow-create filterable default-first-option>
|
||||||
<el-option v-for="project in projectList" :key="project.id" :label="project.name" :value="project.id"></el-option>
|
<el-option v-for="project in projectList" :key="project.id" :label="project.name" :value="project.id"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -23,7 +23,7 @@ Vue.component('add-wsdl', {
|
||||||
projectList: [],
|
projectList: [],
|
||||||
form: {
|
form: {
|
||||||
wsdl: '',
|
wsdl: '',
|
||||||
projectId: 1
|
projectId: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue