新增json文件

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

@ -89,34 +89,51 @@
<version>4.4</version> <version>4.4</version>
</dependency> </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> <dependency>
<groupId>org.apache.axis</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>axis</artifactId> <artifactId>cxf-rt-transports-http</artifactId>
<version>1.4</version> <version>3.1.8</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>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency> <dependency>
<groupId>commons-logging</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>commons-logging</artifactId> <artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>1.1.1</version> <version>3.1.8</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/wsdl4j/wsdl4j -->
<dependency> <dependency>
<groupId>wsdl4j</groupId> <groupId>xerces</groupId>
<artifactId>wsdl4j</artifactId> <artifactId>xercesImpl</artifactId>
<version>1.6.2</version> <version>2.11.0</version>
</dependency> </dependency>
</dependencies> </dependencies>

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

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

Loading…
Cancel
Save