新增json文件

docus-active-query-service_1.3
lzy 4 years ago
parent ce39399b60
commit 542ae513c5

@ -89,34 +89,51 @@
<version>4.4</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.axis</groupId>-->
<!--<artifactId>axis</artifactId>-->
<!--<version>1.4</version>-->
<!--</dependency>-->
<!--&lt;!&ndash; https://mvnrepository.com/artifact/org.apache.axis/axis-jaxrpc &ndash;&gt;-->
<!--<dependency>-->
<!--<groupId>org.apache.axis</groupId>-->
<!--<artifactId>axis-jaxrpc</artifactId>-->
<!--<version>1.4</version>-->
<!--</dependency>-->
<!--&lt;!&ndash; https://mvnrepository.com/artifact/commons-discovery/commons-discovery &ndash;&gt;-->
<!--<dependency>-->
<!--<groupId>commons-discovery</groupId>-->
<!--<artifactId>commons-discovery</artifactId>-->
<!--<version>0.2</version>-->
<!--</dependency>-->
<!--&lt;!&ndash; https://mvnrepository.com/artifact/commons-logging/commons-logging &ndash;&gt;-->
<!--<dependency>-->
<!--<groupId>commons-logging</groupId>-->
<!--<artifactId>commons-logging</artifactId>-->
<!--<version>1.1.1</version>-->
<!--</dependency>-->
<!--&lt;!&ndash; https://mvnrepository.com/artifact/wsdl4j/wsdl4j &ndash;&gt;-->
<!--<dependency>-->
<!--<groupId>wsdl4j</groupId>-->
<!--<artifactId>wsdl4j</artifactId>-->
<!--<version>1.6.2</version>-->
<!--</dependency>-->
<!--webService-->
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.axis/axis-jaxrpc -->
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-discovery/commons-discovery -->
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.1.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.1.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/wsdl4j/wsdl4j -->
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>

@ -38,7 +38,7 @@ public class BgtsController {
public CommonResult<String> collect(@RequestParam("empId") String empId, @Param("collectSubId") String collectSubId) {
try {
logger.info("采集接口接收到参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId);
bgtsService.collect(empId,collectSubId);
bgtsService.collect(empId);
afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
} catch (RuntimeException e) {
e.printStackTrace();
@ -63,24 +63,17 @@ public class BgtsController {
@ApiOperation("按需采集接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "emamNo",value = "报告单号",required = true,dataTypeClass = String.class),
@ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class),
@ApiImplicitParam(name = "collectSubId",value = "af_interface_collect_sub表id",required = true)
@ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class)
})
@GetMapping("/collectByExamNo")
public CommonResult<String> collectByExamNo(@RequestParam("emamNo") String emamNo,
@RequestParam("empId") String empId,
@Param("collectSubId") String collectSubId){
@RequestParam("empId") String empId){
try {
logger.info("按需采集接口接受参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId+"\nemamNo--"+emamNo);
bgtsService.collectByExamNo(emamNo,empId,collectSubId);
afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
logger.info("按需采集接口接受参数:\nempId--"+empId+"\nemamNo--"+emamNo);
bgtsService.collectByExamNo(emamNo,empId);
// afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
}catch (RuntimeException e) {
e.printStackTrace();
try {
afCollectTaskService.updateInterfaceCollect(collectSubId, 0);
}catch (Exception e1){
return CommonResult.failed(e1.getMessage());
}
return CommonResult.failed(e.getMessage());
}
catch (Exception e) {

@ -1,6 +1,5 @@
package com.docus.bgts.facade;
import javax.xml.rpc.ServiceException;
import java.io.UnsupportedEncodingException;
import java.rmi.RemoteException;
@ -9,15 +8,12 @@ public interface IBgtsService {
*
* @param empId
*/
void collect(String empId, String collectSubId) throws Exception;
void collect(String empId) throws Exception;
/**
*
* @param emamNo
* @param empId
* @throws UnsupportedEncodingException
* @throws RemoteException
* @throws ServiceException
*/
void collectByExamNo(String emamNo, String empId, String collectSubId) throws UnsupportedEncodingException, RemoteException, ServiceException, Exception;
void collectByExamNo(String emamNo, String empId) throws Exception;
}

@ -1,5 +1,6 @@
package com.docus.bgts.service;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.docus.bgts.entity.AfCollectTask;
@ -11,8 +12,10 @@ import com.docus.bgts.facade.IAfCollectTaskService;
import com.docus.bgts.facade.IBgtsService;
import com.docus.bgts.utils.FileUtils;
import com.docus.bgts.utils.HttpUtils;
import com.docus.bgts.utils.JAXDynamicClientFactory;
import com.docus.bgts.utils.XmlUtils;
import org.apache.axis.client.Call;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.cxf.endpoint.Client;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
@ -20,13 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.encoding.XMLType;
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -36,8 +33,6 @@ import java.util.Map;
public class BgtsServiceImpl implements IBgtsService {
@Value("${ws.url}")
private String wsUrl;
@Value("${ws.namespaceUrl}")
private String wsNamespaceUrl;
@Value("${ws.localMethod}")
private String wsLocalMethod;
@ -45,7 +40,7 @@ public class BgtsServiceImpl implements IBgtsService {
IAfCollectTaskService afCollectTaskService;
@Override
public void collect(String empId, String collectSubId) throws Exception {
public void collect(String empId) throws Exception {
//通过empId获取报告单号集合
List<String[]> exams = getExamNo(empId);
//通过报告单号集合采集
@ -53,7 +48,7 @@ public class BgtsServiceImpl implements IBgtsService {
}
@Override
public void collectByExamNo(String emamNo, String empId, String collectSubId) throws Exception {
public void collectByExamNo(String emamNo, String empId) throws Exception {
String[] strings = new String[2];
//通过报告单号和系统id查询任务表
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
@ -71,7 +66,7 @@ public class BgtsServiceImpl implements IBgtsService {
* @param exams
* @param empId
*/
private void collectExams(List<String[]> exams, String empId) throws UnsupportedEncodingException, RemoteException, ServiceException {
private void collectExams(List<String[]> exams, String empId) throws Exception {
//获取插入表数据
ReportDownDto reportDownDto = getUrlCreateReportDto(exams, empId);
//插入文件af_collect_task表数据
@ -95,7 +90,7 @@ public class BgtsServiceImpl implements IBgtsService {
* @param empId
* @return
*/
private ReportDownDto getUrlCreateReportDto(List<String[]> exams, String empId) throws UnsupportedEncodingException, ServiceException, RemoteException {
private ReportDownDto getUrlCreateReportDto(List<String[]> exams, String empId) throws Exception {
ReportDownDto reportDownDto = new ReportDownDto();
ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto();
reportDownPatientDto.setJzh(empId);
@ -124,7 +119,7 @@ public class BgtsServiceImpl implements IBgtsService {
* @param exam
* @return
*/
private ReportDownScanFileDto getScanByExam(String[] exam) throws UnsupportedEncodingException, ServiceException, RemoteException {
private ReportDownScanFileDto getScanByExam(String[] exam) throws Exception {
ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
reportDownScanFileDto.setSerialnum(exam[0]);
reportDownScanFileDto.setFiletitle(exam[1]);
@ -207,21 +202,35 @@ public class BgtsServiceImpl implements IBgtsService {
return exams;
}
public String invokeWs(String xml) throws ServiceException, RemoteException {
Object[] object = new Object[]{xml};//请求参数
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(wsUrl);// 远程调用路径
// 调用的命名空间和方法名
call.setOperationName(new QName(wsNamespaceUrl, wsLocalMethod));
call.setUseSOAPAction(true);
// call.setSOAPActionURI(wsNamespaceUrl + "pushSurveyReport");
call.addParameter("arg0", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);// 返回值类型String
call.setTimeout(100000);//超时
String result = (String) call.invoke(object);// 远程调用
System.out.println(result);
return result;
/**
* web service
* @param xml
* @return
* @throws Exception
*/
public String invokeWs(String xml) throws Exception {
// Object[] object = new Object[]{xml};//请求参数
// org.apache.axis.client.Service service = new org.apache.axis.client.Service();
// Call call = (Call) service.createCall();
// call.setTargetEndpointAddress(wsUrl);// 远程调用路径
// // 调用的命名空间和方法名
//// call.setOperationName(new QName(wsNamespaceUrl, wsLocalMethod));
// call.setOperationName(wsLocalMethod);
// call.setUseSOAPAction(true);
//// call.setSOAPActionURI(wsNamespaceUrl + "pushSurveyReport");
// call.addParameter("arg0", XMLType.XSD_STRING, ParameterMode.IN);
// call.setReturnType(XMLType.XSD_STRING);// 返回值类型String
// call.setTimeout(100000);//超时
// String result = (String) call.invoke(object);// 远程调用
// System.out.println(result);
JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance();
Client client = dcf.createClient(wsUrl);
Object[] objects = client.invoke(wsLocalMethod,xml);
String str = objects[0].toString();
System.out.println(str);
return str;
}

@ -0,0 +1,51 @@
package com.docus.bgts.utils;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.CXFBusFactory;
import org.apache.cxf.endpoint.EndpointImplFactory;
import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
import org.apache.cxf.jaxws.support.JaxWsEndpointImplFactory;
import java.util.List;
/**
* @ProjectName:
* @Description:
* @Param
* @Return
* @Author:
* @CreateDate: 2019/9/11 16:15
* @UpdateUser:
* @UpdateDate: 2019/9/11 16:15
* @UpdateRemark:
* @Version: 1.0
*/
public class JAXDynamicClientFactory extends DynamicClientFactory {
protected JAXDynamicClientFactory(Bus bus) {
super(bus);
}
@Override
protected EndpointImplFactory getEndpointImplFactory() {
return JaxWsEndpointImplFactory.getSingleton();
}
@Override
protected boolean allowWrapperOps() {
return true;
}
public static JAXDynamicClientFactory newInstance() {
Bus bus = CXFBusFactory.getThreadDefaultBus();
return new JAXDynamicClientFactory(bus);
}
@Override
public boolean compileJavaSrc(String classPath, List srcList, String dest) {
org.apache.cxf.common.util.Compiler javaCompiler
= new org.apache.cxf.common.util.Compiler();
javaCompiler.setEncoding("UTF-8");
javaCompiler.setClassPath(classPath);
javaCompiler.setOutputDir(dest);
javaCompiler.setTarget("1.8");
return javaCompiler.compileFiles(srcList);
}
}

@ -13,10 +13,7 @@ mybatis-plus:
db-type: MYSQL
ws:
url: http://localhost:8010/ws_server/weather?wsdl
namespaceUrl: http://service.serviceserver.nanmeishu.com/
localPart: TestServiceService
localPort: TestServicePort
url: http://192.168.1.115:8010/ws_server/weather?wsdl
localMethod: OperationA
spring:

Loading…
Cancel
Save