中山医院接口

2.0
linjj 2 years ago
parent 64c230113f
commit 3955445ac7

@ -81,5 +81,11 @@
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</project>

@ -1,6 +1,6 @@
package com.docus.soap.api;
import com.docus.soap.api.service.ComplaintAPIService;
import com.docus.soap.api.service.XMZSYYQRCodeAPIService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
@ -83,8 +83,8 @@ public class SoapAPIConfig {
}
@Bean
public ComplaintAPIService complaintApiService() {
ComplaintAPIService complaintApiService = new ComplaintAPIService();
public XMZSYYQRCodeAPIService complaintApiService() {
XMZSYYQRCodeAPIService complaintApiService = new XMZSYYQRCodeAPIService();
complaintApiService.setWebServiceClient(soapApiClient());
return complaintApiService;
}

@ -9,7 +9,7 @@ import org.springframework.web.context.ConfigurableWebApplicationContext;
import java.io.IOException;
import java.util.Properties;
public class DefaultAppContextInitializer implements ApplicationContextInitializer<ConfigurableWebApplicationContext> {
public class SoapAppContextInitializer implements ApplicationContextInitializer<ConfigurableWebApplicationContext> {
@Override
public void initialize(ConfigurableWebApplicationContext context) {
PropertyLoader propertyLoader = new PropertyLoader();

@ -1,53 +0,0 @@
package com.docus.soap.api.request.complain;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public enum ComplaintProcessStatus {
/*受理中*/
RECEIVED(0),
/*网友已给出方案*/
BUYER_GIVE_SOLUTION(1),
/*商家已给出方案*/
SELLER_GIVE_SOLUTION(2),
/*安排监理上门*/
SUPERVISOR_CALL(3),
/*双方达成协议*/
REACH_AGREEMENT(4),
/*协调未果*/
CONSULTATION_NO_RESULT(5),
/*无理投诉*/
UNJUSTIFIABLE_COMPLAINT(6),
/*处理完成*/
FINISH(7),
/*节后处理*/
PROCESS_AFTER_HOLIDAY(8);
private static final Logger LOGGER = LoggerFactory.getLogger(ComplaintProcessStatus.class);
private int value;
ComplaintProcessStatus(int value) {
this.value = value;
}
@JsonValue
public int getValue() {
return value;
}
@JsonCreator
public static ComplaintProcessStatus fromValue(int code) {
for (ComplaintProcessStatus status : ComplaintProcessStatus.values()) {
if (status.value == code) {
return status;
}
}
LOGGER.warn(ComplaintProcessStatus.class.getName() + " can not find value :" + code);
return null;
}
}

@ -1,72 +0,0 @@
package com.docus.soap.api.request.complain;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "GetTableByIdDateDataRequest")
@XmlAccessorType(XmlAccessType.FIELD)
public class GetTableByIdDateDataRequest {
@XmlElement(name = "store_id")
private int storeId;
@XmlElement(name = "startDate")
private String startDate;
@XmlElement(name = "endDate")
private String endDate;
@XmlElement(name = "complaintGrade")
private Integer complaintGrade;
@XmlElement(name = "currentpage")
private int currentpage;
@XmlElement(name = "pagesize")
private int pagesize;
public int getStoreId() {
return storeId;
}
public void setStoreId(int storeId) {
this.storeId = storeId;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public Integer getComplaintGrade() {
return complaintGrade;
}
public void setComplaintGrade(Integer complaintGrade) {
this.complaintGrade = complaintGrade;
}
public int getCurrentpage() {
return currentpage;
}
public void setCurrentpage(int currentpage) {
this.currentpage = currentpage;
}
public int getPagesize() {
return pagesize;
}
public void setPagesize(int pagesize) {
this.pagesize = pagesize;
}
}

@ -0,0 +1,28 @@
package com.docus.soap.api.request.zsyy;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@Data
@XmlRootElement(name = "SOF_LoginWithAccountInfo", namespace = "http://webservice.platform.jhsec.com.cn/")
@XmlAccessorType(XmlAccessType.FIELD)
public class GetLoginInfoRequest {
@XmlElement(name = "sys")
private String sys;
@XmlElement(name = "accountType")
private String accountType;
@XmlElement(name = "account")
private String account;
@XmlElement(name = "password")
private String password;
}

@ -1,4 +1,4 @@
package com.docus.soap.api.request.complain;
package com.docus.soap.api.request.zsyy;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@ -7,7 +7,7 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "SOF_GetQRCodeBySys", namespace = "http://webservice.qrcode.pki.jhsec.com.cn/")
@XmlAccessorType(XmlAccessType.FIELD)
public class GetTableByIdDateRequest {
public class GetQRCodeBySysRequest {
@XmlElement(name = "sys")
private String sys;

@ -0,0 +1,22 @@
package com.docus.soap.api.request.zsyy;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "SOF_QueryQRCode", namespace = "http://webservice.qrcode.pki.jhsec.com.cn/")
@XmlAccessorType(XmlAccessType.FIELD)
public class GetQueryQRCodeRequest {
@XmlElement(name = "qrCode")
private String qrCode;
public String getQrCode() {
return qrCode;
}
public void setQrCode(String qrCode) {
this.qrCode = qrCode;
}
}

@ -1,22 +0,0 @@
package com.docus.soap.api.response.complain;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "GetComplaintListResponse")
@XmlAccessorType(XmlAccessType.FIELD)
public class GetComplaintListResponse {
@XmlElement(name = "GetComplaintListResult")
private String complaintListResult;
public String getComplaintListResult() {
return complaintListResult;
}
public void setComplaintListResult(String complaintListResult) {
this.complaintListResult = complaintListResult;
}
}

@ -1,5 +1,6 @@
package com.docus.soap.api.response.complain;
import com.docus.soap.api.response.zsyy.DataItem;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;

@ -1,4 +1,4 @@
package com.docus.soap.api.response.complain;
package com.docus.soap.api.response.zsyy;
import lombok.Data;

@ -1,4 +1,4 @@
package com.docus.soap.api.response.complain;
package com.docus.soap.api.response.zsyy;
import javax.xml.bind.annotation.*;
import java.util.List;

@ -0,0 +1,42 @@
package com.docus.soap.api.response.zsyy;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@Data
@XmlAccessorType(XmlAccessType.FIELD)
public class GetLoginInfoResponse {
@XmlElement(name = "data")
private String data;
@XmlElement(name = "code")
private String code;
@XmlElement(name = "msg")
private String msg;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}

@ -0,0 +1,20 @@
package com.docus.soap.api.response.zsyy;
import javax.xml.bind.annotation.*;
import java.util.List;
@XmlRootElement(name = "SOF_LoginWithAccountInfoResponse" ,namespace = "http://webservice.platform.jhsec.com.cn/")
@XmlAccessorType(XmlAccessType.FIELD)
public class GetLoginInfoResultResponse {
@XmlAnyElement
public List<Object> results;
public List<Object> getResults() {
return results;
}
public void setResults(List<Object> results) {
this.results = results;
}
}

@ -1,11 +1,15 @@
package com.docus.soap.api.response.complain;
package com.docus.soap.api.response.zsyy;
import lombok.Data;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@Data
@XmlAccessorType(XmlAccessType.FIELD)
public class ComplaintListResult {
public class GetQRCodeBySysResponse {
@XmlElement(name = "data")
private DataItem data;
@ -16,13 +20,7 @@ public class ComplaintListResult {
@XmlElement(name = "msg")
private String msg;
public DataItem getData() {
return data;
}
public void setData(DataItem data) {
this.data = data;
}
public String getCode() {
return code;

@ -1,4 +1,4 @@
package com.docus.soap.api.response.complain;
package com.docus.soap.api.response.zsyy;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@ -8,7 +8,7 @@ import java.util.List;
@XmlRootElement(name = "SOF_GetQRCodeBySysResponse")
@XmlAccessorType(XmlAccessType.FIELD)
public class GetTableByIdDateResponse {
public class GetQRCodeBySysResultResponse {
@XmlAnyElement
public List<Object> results;

@ -0,0 +1,42 @@
package com.docus.soap.api.response.zsyy;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@Data
@XmlAccessorType(XmlAccessType.FIELD)
public class GetQueryQRCodeResponse {
@XmlElement(name = "data")
private QueryQRCodeData data;
@XmlElement(name = "code")
private String code;
@XmlElement(name = "msg")
private String msg;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}

@ -0,0 +1,23 @@
package com.docus.soap.api.response.zsyy;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
@XmlRootElement(name = "SOF_QueryQRCodeResponse")
@XmlAccessorType(XmlAccessType.FIELD)
public class GetQueryQRCodeResultResponse {
@XmlAnyElement
public List<Object> results;
public List<Object> getResults() {
return results;
}
public void setResults(List<Object> results) {
this.results = results;
}
}

@ -0,0 +1,37 @@
package com.docus.soap.api.response.zsyy;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import java.io.Serializable;
@Data
@XmlAccessorType(XmlAccessType.FIELD)
public class QueryQRCodeData implements Serializable {
private static final long serialVersionUID = 2657976429770220410L;
@XmlElement(name = "resultCode")
private String resultCode;
@XmlElement(name = "qrCodeStatus")
private String qrCodeStatus;
@XmlElement(name = "userName")
private String userName;
@XmlElement(name = "userIdCardNum")
private String userIdCardNum;
@XmlElement(name = "userPhoneNum")
private String userPhoneNum;
@XmlElement(name = "resultMsg")
private String resultMsg;
@XmlElement(name = "userJobNum")
private String userJobNum;
}

@ -1,5 +1,5 @@
@XmlSchema(namespace = "http://webservice.qrcode.pki.jhsec.com.cn/", elementFormDefault = XmlNsForm.QUALIFIED)
package com.docus.soap.api.response.complain;
package com.docus.soap.api.response.zsyy;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;

@ -1,23 +0,0 @@
package com.docus.soap.api.service;
import com.docus.soap.api.SoapAPIClient;
import com.docus.soap.api.SoapAPISettings;
import com.docus.soap.api.request.complain.GetTableByIdDateRequest;
import com.docus.soap.api.response.complain.ComplaintListResult;
import com.docus.soap.api.response.complain.GetTableByIdDateResponse;
import com.docus.soap.api.util.JSON;
import com.sun.org.apache.xerces.internal.dom.ElementNSImpl;
public class ComplaintAPIService {
private SoapAPIClient soapAPIClient;
public ComplaintListResult getTableByIdDate(GetTableByIdDateRequest targetRequest, SoapAPISettings soapAPISettings) {
GetTableByIdDateResponse response = (GetTableByIdDateResponse) soapAPIClient.soapCall(targetRequest, soapAPISettings.getAction(), soapAPISettings.getUri());
ComplaintListResult complaintListResult = JSON.fromJSON((((ElementNSImpl) response.getResults().get(0)).getFirstChild().getTextContent()), ComplaintListResult.class);
return complaintListResult;
}
public void setWebServiceClient(SoapAPIClient webServiceClient) {
this.soapAPIClient = webServiceClient;
}
}

@ -0,0 +1,45 @@
package com.docus.soap.api.service;
import com.docus.soap.api.SoapAPIClient;
import com.docus.soap.api.SoapAPISettings;
import com.docus.soap.api.request.zsyy.GetLoginInfoRequest;
import com.docus.soap.api.request.zsyy.GetQRCodeBySysRequest;
import com.docus.soap.api.request.zsyy.GetQueryQRCodeRequest;
import com.docus.soap.api.response.zsyy.*;
import com.docus.soap.api.util.JSON;
import com.sun.org.apache.xerces.internal.dom.ElementNSImpl;
public class XMZSYYQRCodeAPIService {
private SoapAPIClient soapAPIClient;
/**
*
*/
public GetQRCodeBySysResponse getQRCodeBySys(GetQRCodeBySysRequest targetRequest, SoapAPISettings soapAPISettings) {
GetQRCodeBySysResultResponse response = (GetQRCodeBySysResultResponse) soapAPIClient.soapCall(targetRequest, soapAPISettings.getAction(), soapAPISettings.getUri());
return JSON.fromJSON((((ElementNSImpl) response.getResults().get(0)).getFirstChild().getTextContent()), GetQRCodeBySysResponse.class);
}
/**
* @description:
* @author linjj
* @date: 2023/5/24 11:46
*/
public GetQueryQRCodeResponse getQueryQRCode(GetQueryQRCodeRequest queryQRCodeRequest, SoapAPISettings soapAPISettings){
GetQueryQRCodeResultResponse response = (GetQueryQRCodeResultResponse) soapAPIClient.soapCall(queryQRCodeRequest, soapAPISettings.getAction(), soapAPISettings.getUri());
return JSON.fromJSON((((ElementNSImpl) response.getResults().get(0)).getFirstChild().getTextContent()), GetQueryQRCodeResponse.class);
}
/**
* @description:
* @author linjj
* @date: 2023/5/25 11:33
*/
public GetLoginInfoResponse getLoginInfo(GetLoginInfoRequest getLoginInfoRequest, SoapAPISettings soapAPISettings){
GetLoginInfoResultResponse response = (GetLoginInfoResultResponse) soapAPIClient.soapCall(getLoginInfoRequest, soapAPISettings.getAction(), soapAPISettings.getUri());
return JSON.fromJSON((((ElementNSImpl) response.getResults().get(0)).getFirstChild().getTextContent()), GetLoginInfoResponse.class);
}
public void setWebServiceClient(SoapAPIClient webServiceClient) {
this.soapAPIClient = webServiceClient;
}
}

@ -1,9 +1,14 @@
package com.docus.soap.api;
import com.docus.soap.api.request.complain.GetTableByIdDateRequest;
import com.docus.soap.api.response.complain.ComplaintListResult;
import com.docus.soap.api.service.ComplaintAPIService;
import com.docus.soap.api.request.zsyy.GetLoginInfoRequest;
import com.docus.soap.api.request.zsyy.GetQRCodeBySysRequest;
import com.docus.soap.api.request.zsyy.GetQueryQRCodeRequest;
import com.docus.soap.api.response.zsyy.GetLoginInfoResponse;
import com.docus.soap.api.response.zsyy.GetQRCodeBySysResponse;
import com.docus.soap.api.response.zsyy.GetQueryQRCodeResponse;
import com.docus.soap.api.service.XMZSYYQRCodeAPIService;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -19,21 +24,62 @@ public class ComplaintAPIServiceTest extends SpringTest {
private Environment env;
@Inject
private ComplaintAPIService complaintAPIService;
private XMZSYYQRCodeAPIService complaintAPIService;
@Test
@Ignore
public void getTableByIdDateTest() {
GetTableByIdDateRequest request = new GetTableByIdDateRequest();
GetQRCodeBySysRequest request = new GetQRCodeBySysRequest();
request.setSys("JSScan");
ComplaintListResult result = complaintAPIService.getTableByIdDate(request, getTableByIdDateSettings());
GetQRCodeBySysResponse result = complaintAPIService.getQRCodeBySys(request, getTableByIdDateSettings());
Assert.assertNotNull("not null", result);
}
@Test
@Ignore
public void getQueryQRCode() {
GetQueryQRCodeRequest request = new GetQueryQRCodeRequest();
request.setQrCode("二维码状态查询字符串");
GetQueryQRCodeResponse queryQRCode = complaintAPIService.getQueryQRCode(request, queryQRCodeUrlAndName());
Assert.assertNotNull("not null", queryQRCode);
}
@Test
public void getLoginInfo() {
GetLoginInfoRequest request = new GetLoginInfoRequest();
request.setSys("JSScan");
request.setAccountType("IdCardNumber");
request.setAccount("350301200008100057");
request.setPassword("lin123456");
GetLoginInfoResponse loginInfo = complaintAPIService.getLoginInfo(request, getLoginUserInfo());
Assert.assertNotNull("not null", loginInfo);
}
private SoapAPISettings getTableByIdDateSettings() {
SoapAPISettings soapAPISettings = new SoapAPISettings();
soapAPISettings.setAction(env.getProperty("soap.complaint.api.action"));
soapAPISettings.setUri(env.getProperty("soap.complaint.api.url"));
return soapAPISettings;
}
private SoapAPISettings queryQRCodeUrlAndName() {
SoapAPISettings soapAPISettings = new SoapAPISettings();
soapAPISettings.setAction("SOF_QueryQRCode");
soapAPISettings.setUri("http://101.132.67.155:8087/PKIQRCode/services/v1?wsdl");
return soapAPISettings;
}
private SoapAPISettings getLoginUserInfo() {
SoapAPISettings soapAPISettings = new SoapAPISettings();
soapAPISettings.setAction("SOF_LoginWithAccountInfo");
soapAPISettings.setUri("http://101.132.67.155:8087/pkis/services/v1?wsdl");
return soapAPISettings;
}
}

@ -4,12 +4,10 @@ import org.junit.runner.RunWith;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {TestEnvironmentConfig.class}, initializers = DefaultAppContextInitializer.class)
@TransactionConfiguration
@ContextConfiguration(classes = {TestEnvironmentConfig.class}, initializers = SoapAppContextInitializer.class)
@ActiveProfiles("test")
@WebAppConfiguration
public abstract class SpringTest {

Loading…
Cancel
Save