Browse Source

更新webservices

master
汪菘 2 years ago
parent
commit
55d88e1872
  1. BIN
      acs/nladmin-system/jrebel-classpath-12132.jar
  2. 10
      acs/nladmin-system/pom.xml
  3. 1
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
  4. 23
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/AutoPublish.java
  5. 15
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/CxfConfig.java
  6. 10
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/IWebServiceTest.java
  7. 43
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/PublishEndpoint.java
  8. 8
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/Test.java
  9. 23
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WebServiceTest.java
  10. 6
      acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/SaTokenConfigure.java

BIN
acs/nladmin-system/jrebel-classpath-12132.jar

Binary file not shown.

10
acs/nladmin-system/pom.xml

@ -40,6 +40,16 @@
<version>1.50</version> <version>1.50</version>
</dependency>--> </dependency>-->
<!--导出CSV相关--> <!--导出CSV相关-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-features-logging</artifactId>
<version>3.3.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId> <artifactId>commons-csv</artifactId>

1
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java

@ -44,7 +44,6 @@ import java.util.Map;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
@WebService
public class WmsToAcsServiceImpl implements WmsToAcsService { public class WmsToAcsServiceImpl implements WmsToAcsService {
private final ApplicationContext applicationContext; private final ApplicationContext applicationContext;

23
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/AutoPublish.java

@ -0,0 +1,23 @@
package org.nl.acs.ext.wms.service.wsdl;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* <p>description自动发布接口地址注解</p>
*
* @author newzhong
* @version 1.0
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface AutoPublish {
/**
*<p>description发布地址</p>
* @return String
* @author newzhong
*/
String publishAddress();
}

15
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/CxfConfig.java

@ -0,0 +1,15 @@
package org.nl.acs.ext.wms.service.wsdl;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.feature.LoggingFeature;
import org.springframework.context.annotation.Bean;
public class CxfConfig {
@Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
SpringBus bus = new SpringBus();
bus.getFeatures().add(new LoggingFeature());
return bus;
}
}

10
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/IWebServiceTest.java

@ -0,0 +1,10 @@
package org.nl.acs.ext.wms.service.wsdl;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService(targetNamespace = "http://service.mrxu.com/")
public interface IWebServiceTest {
String getDept(@WebParam(name = "jsonStr")String jsonStr);
}

43
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/PublishEndpoint.java

@ -0,0 +1,43 @@
package org.nl.acs.ext.wms.service.wsdl;
import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import org.springframework.web.context.WebApplicationContext;
@Component
@Slf4j
public class PublishEndpoint implements ApplicationRunner {
@Autowired
private WebApplicationContext applicationConnect;
@Autowired()
@Qualifier(Bus.DEFAULT_BUS_ID)
private SpringBus bus;
@SuppressWarnings("resource")
@Override
public void run(ApplicationArguments applicationArguments) throws Exception {
log.info("开始进行自动发布webService接口");
String[] beanNames = applicationConnect.getBeanNamesForAnnotation(AutoPublish.class);
for(String beanName : beanNames) {
String publishAddr = applicationConnect.getType(beanName).getAnnotation(AutoPublish.class).publishAddress();
EndpointImpl endpoint = new EndpointImpl(bus, applicationConnect.getBean(beanName));
endpoint.publish(publishAddr);
log.info(String.format("发布接口地址:[%s]", publishAddr));
}
log.info("weBservice接口自动发布结束");
}
}

8
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/Test.java

@ -0,0 +1,8 @@
package org.nl.acs.ext.wms.service.wsdl;
public class Test {
public static void Test(){
System.out.println("1111");
}
}

23
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WebServiceTest.java

@ -0,0 +1,23 @@
package org.nl.acs.ext.wms.service.wsdl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.jws.WebService;
import java.util.List;
@Service("WebServiceTest")
@AutoPublish(publishAddress = "ACS")
@WebService(endpointInterface = "org.nl.acs.ext.wms.service.wsdl.IWebServiceTest",
serviceName = "WebServiceTest",
targetNamespace = "http://127.0.0.1:8010/WebServiceTest/"
)
public class WebServiceTest implements IWebServiceTest {
@Override
public String getDept(String jsonStr) {
return "111";
}
}

6
acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/SaTokenConfigure.java

@ -34,9 +34,9 @@ public class SaTokenConfigure implements WebMvcConfigurer {
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
// 注册 Sa-Token 拦截器,打开注解式鉴权功能 // 注册 Sa-Token 拦截器,打开注解式鉴权功能
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin())) // registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
.addPathPatterns("/**") // .addPathPatterns("/**")
.excludePathPatterns(securityProperties.getExcludes()); // 白名单 // .excludePathPatterns(securityProperties.getExcludes()); // 白名单
} }
} }

Loading…
Cancel
Save