zdm 5 years ago
parent
commit
d4c4beab8a

+ 40 - 0
pom.xml

@ -104,9 +104,49 @@
        <version>1.2.5</version>
    </dependency>
    <!-- xml解析为json end -->
   <!-- <dependency>
        <groupId>org.apache.axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
    </dependency>-->
    <!--<dependency>
        <groupId>javax.xml.rpc</groupId>
        <artifactId>javax.xml.rpc-api</artifactId>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>wsdl4j</groupId>
        <artifactId>wsdl4j</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>commons-discovery</groupId>
        <artifactId>commons-discovery</artifactId>
        <version>0.5</version>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>2.5.0</version>
    </dependency>-->
    <dependency>
        <groupId>soap</groupId>
        <artifactId>soap</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.sun.mail</groupId>
        <artifactId>javax.mail</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>2.1</version>
    </dependency>
</dependencies>
    <build>
        <!--<finalName>svr-internet-hospital-entrance</finalName>-->

+ 67 - 14
src/main/java/com/yihu/wlyy/controller/MqSdkController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.controller;
import com.yihu.wlyy.service.CAService;
import com.yihu.wlyy.service.EntranceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -21,6 +22,8 @@ public class MqSdkController /*extends EnvelopRestEndpoint */{
    private boolean testProfiles=false;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private CAService caService;
    @GetMapping(value = "/BS15017")
    @ApiOperation(value = "固定入参:门诊余额查询")
@ -73,11 +76,13 @@ public class MqSdkController /*extends EnvelopRestEndpoint */{
            @ApiParam(name = "PAT_NO", value = "病人id", required = false)
            @RequestParam(value = "PAT_NO",required = false) String PAT_NO,
            @ApiParam(name = "ADM_NO", value = "住院唯一号", required = false)
            @RequestParam(value = "ADM_NO",required = false) String ADM_NO) {
            @RequestParam(value = "ADM_NO",required = false) String ADM_NO,
            @ApiParam(name = "real_order", value = "处方号", required = false)
            @RequestParam(value = "real_order",required = false) String real_order) {
        try {
            String  obj="";
            if(!testProfiles){
                obj=  entranceService.BS16017(REGISTER_SN,PAT_NO,ADM_NO);
                obj=  entranceService.BS16017(REGISTER_SN,PAT_NO,ADM_NO,real_order);
            }else {
                obj="[{\"PAT_NO\":\"P5616242-0  \",\"CARD_NO\":\"D40136791\",\"CARD_STAT\":\"旧卡停用\",\"OP_DATE\":\"2011-09-27 15:35:57\",\"CARD_TYPE\":\"2\",\"CARD_TYPE_NAME\":\"社保卡\",\"social_no\":\"350211198411053024\"},{\"PAT_NO\":\"P5616242-0  \",\"CARD_NO\":\"DA1872143\",\"CARD_STAT\":\"激活\",\"OP_DATE\":\"2014-07-25 08:46:40\",\"CARD_TYPE\":\"2\",\"CARD_TYPE_NAME\":\"社保卡\",\"social_no\":\"350211198411053024\"}]";
            }
@ -91,20 +96,16 @@ public class MqSdkController /*extends EnvelopRestEndpoint */{
    @GetMapping(value = "/BS30025")
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录 V1.00")
    public String BS30025(@ApiParam(name = "PAT_NO", value = "居民id")
                          @RequestParam(value = "PAT_NO",required = false) String PAT_NO,
                          @ApiParam(name = "ADM_NO", value = "就诊唯一号")
                          @RequestParam(value = "ADM_NO",required = false) String ADM_NO,
                          @ApiParam(name = "REGISTER_SN", value = "流水号(处方号)")
                          @RequestParam(value = "REGISTER_SN",required = false) String REGISTER_SN,
                          @ApiParam(name = "PAT_CARDNO", value = "卡号")
                          @RequestParam(value = "PAT_CARDNO",required = false) String PAT_CARDNO,
                          @ApiParam(name = "social_no", value = "身份证号")
                          @RequestParam(value = "social_no",required = false) String social_no) {
    public String BS30025(@ApiParam(name = "patNo", value = "居民id")
                              @RequestParam(value = "patNo",required = false) String patNo,
                          @ApiParam(name = "startTime", value = "开始时间")
                              @RequestParam(value = "startTime",required = false) String startTime,
                          @ApiParam(name = "endTime", value = "结束时间")
                              @RequestParam(value = "endTime",required = false) String endTime) {
        try {
            String obj = "";
            if (!testProfiles) {
                obj = entranceService.BS30025(PAT_NO,ADM_NO,REGISTER_SN,PAT_CARDNO, social_no);
                obj = entranceService.BS30025(patNo,startTime,endTime);
            } else {
                obj = "[{\"PAT_NO\":\"P5616242-0  \",\"CARD_NO\":\"D40136791\",\"CARD_STAT\":\"旧卡停用\",\"OP_DATE\":\"2011-09-27 15:35:57\",\"CARD_TYPE\":\"2\",\"CARD_TYPE_NAME\":\"社保卡\",\"social_no\":\"350211198411053024\"},{\"PAT_NO\":\"P5616242-0  \",\"CARD_NO\":\"DA1872143\",\"CARD_STAT\":\"激活\",\"OP_DATE\":\"2014-07-25 08:46:40\",\"CARD_TYPE\":\"2\",\"CARD_TYPE_NAME\":\"社保卡\",\"social_no\":\"350211198411053024\"}]";
            }
@ -146,12 +147,14 @@ public class MqSdkController /*extends EnvelopRestEndpoint */{
                          @RequestParam(value = "py_code", required = false) String py_code,
                          @ApiParam(name = "stock_amount", value = "库存")
                          @RequestParam(value = "stock_amount", required = false) String stock_amount,
                          @ApiParam(name = "win_no", value = "库存")
                          @RequestParam(value = "win_no", required = false) String win_no,
                          @ApiParam(name = "visible_flag", value = "可用标志(0可用1不可用)")
                          @RequestParam(value = "visible_flag", required = false) String visible_flag) {
        try {
            String  obj="";
            if(!testProfiles){
                obj=  entranceService.MS53001(charge_code,py_code,stock_amount,visible_flag);
                obj=  entranceService.MS53001(charge_code,py_code,stock_amount,win_no,visible_flag);
            }else {
                obj="[{\"PAT_NO\":\"P5616242-0  \",\"CARD_NO\":\"D40136791\",\"CARD_STAT\":\"旧卡停用\",\"OP_DATE\":\"2011-09-27 15:35:57\",\"CARD_TYPE\":\"2\",\"CARD_TYPE_NAME\":\"社保卡\",\"social_no\":\"350211198411053024\"},{\"PAT_NO\":\"P5616242-0  \",\"CARD_NO\":\"DA1872143\",\"CARD_STAT\":\"激活\",\"OP_DATE\":\"2014-07-25 08:46:40\",\"CARD_TYPE\":\"2\",\"CARD_TYPE_NAME\":\"社保卡\",\"social_no\":\"350211198411053024\"}]";
            }
@ -375,4 +378,54 @@ public class MqSdkController /*extends EnvelopRestEndpoint */{
        return "";
    }
    @GetMapping(value = "/MS25002")
    @ApiOperation(value = " 检查检验字典接口 ")
    public String MS25002( @ApiParam(name = "py_code", value = "拼音码")
                           @RequestParam(value = "py_code", required = false) String py_code,
                           @ApiParam(name = "win_no", value = "库存")
                           @RequestParam(value = "win_no", required = false) String win_no) {
        try {
            String  obj="";
            if(!testProfiles){
                obj=  entranceService.MS25002(py_code,win_no);
            }else {
                obj="{\"code\":\"1\",\"MsgInfo\":[{\"resquest\":{\"@RESULT\":\"-1\",\"@MSG\":\"该医生无权挂号该科室!\"}}]}";
            }
            System.out.println("obj=="+obj);
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
        return "";
    }
/*
    @GetMapping(value = "/testCa")
    @ApiOperation(value = " webService测试 ")
    public String testCa(String strSignData,String strCertData,String strOriginalData,String srcBusinessStreamNO) {
        try {
            String  obj="";
            caService.verifySignOnMultiServer( strSignData, strCertData, strOriginalData, srcBusinessStreamNO);
            System.out.println("obj=="+obj);
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
        return "";
    }*/
    @GetMapping(value = "/yytDown")
    @ApiOperation(value = " 银医通下载 ")
    public String yytDown() {
        try {
            String  obj="";
           obj= caService.callYYTServerService();
            System.out.println("obj=="+obj);
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
        return "";
    }
}

+ 64 - 0
src/main/java/com/yihu/wlyy/entity/WebServiceParamVO.java

@ -0,0 +1,64 @@
package com.yihu.wlyy.entity;
import org.apache.catalina.util.ServerInfo;
/**
 * Created by zdm on 2019/5/30.
 */
public class WebServiceParamVO {
    private String serverInfo;
    private String regMsg;
    private String wsdlUrl;
    private String soapAction;
    private String methodName;
    private String targetObjectURI;
    public String getServerInfo() {
        return serverInfo;
    }
    public void setServerInfo(String serverInfo) {
        this.serverInfo = serverInfo;
    }
    public String getRegMsg() {
        return regMsg;
    }
    public void setRegMsg(String regMsg) {
        this.regMsg = regMsg;
    }
    public String getWsdlUrl() {
        return wsdlUrl;
    }
    public void setWsdlUrl(String wsdlUrl) {
        this.wsdlUrl = wsdlUrl;
    }
    public String getSoapAction() {
        return soapAction;
    }
    public void setSoapAction(String soapAction) {
        this.soapAction = soapAction;
    }
    public String getMethodName() {
        return methodName;
    }
    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }
    public String getTargetObjectURI() {
        return targetObjectURI;
    }
    public void setTargetObjectURI(String targetObjectURI) {
        this.targetObjectURI = targetObjectURI;
    }
}

+ 280 - 0
src/main/java/com/yihu/wlyy/entity/WlyyHisPrescriptionVO.java

@ -0,0 +1,280 @@
package com.yihu.wlyy.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * 
 * his在线处方主表vo
 * </pre>
 * @since 1.
 */
@ApiModel(value = "WlyyHisPrescriptionVO", description = "在线处方主表")
public class WlyyHisPrescriptionVO {
    @ApiModelProperty(value = "id", example = "402803ee656498890165649ad2da1112" )
    protected String id;  // 非业务主键
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    /**
     * 卡号
     */
  private String cardNo;
    /**
     * 医生工号
     */
    private String doctor;
    /**
     * 科室编码
     */
    private String dept;
    /**
     * 收费码
     */
    private String chargeCode;
    /**
     * 分部号
     */
    private String winNo;
    /**
     * 项目类别
     */
    private String chargeFlag;
    /**
     * 数量
     */
    private String quantity;
    /**
     * 挂号流水号
     */
    private String serialNo;
    /**
     * 库房号
     */
    private String groupNo;
    /**
     * 药品序列号
     */
    private String serial;
    /**
     * 主诊断编码
     */
    private String icdCode;
    /**
     * 用量
     */
    private String dosage;
    /**
     * 用量单位
     */
    private String unit;
    /**
     * 频率
     */
    private String usage;
    /**
     * 用法
     */
    private String supplyCode;
    /**
     * 天数
     */
    private String days;
    /**
     * 组号
     */
    private String frequency;
    /**
     * 第二诊断
     */
    private String diagTwo;
    /**
     * 第三诊断
     */
    private String diagThree;
    /**
     * 第四诊断
     */
    private String diagFour;
    /**
     * 第五诊断
     */
  private String diagFive;
    public String getCardNo() {
        return cardNo;
    }
    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getChargeCode() {
        return chargeCode;
    }
    public void setChargeCode(String chargeCode) {
        this.chargeCode = chargeCode;
    }
    public String getWinNo() {
        return winNo;
    }
    public void setWinNo(String winNo) {
        this.winNo = winNo;
    }
    public String getChargeFlag() {
        return chargeFlag;
    }
    public void setChargeFlag(String chargeFlag) {
        this.chargeFlag = chargeFlag;
    }
    public String getQuantity() {
        return quantity;
    }
    public void setQuantity(String quantity) {
        this.quantity = quantity;
    }
    public String getSerialNo() {
        return serialNo;
    }
    public void setSerialNo(String serialNo) {
        this.serialNo = serialNo;
    }
    public String getGroupNo() {
        return groupNo;
    }
    public void setGroupNo(String groupNo) {
        this.groupNo = groupNo;
    }
    public String getSerial() {
        return serial;
    }
    public void setSerial(String serial) {
        this.serial = serial;
    }
    public String getIcdCode() {
        return icdCode;
    }
    public void setIcdCode(String icdCode) {
        this.icdCode = icdCode;
    }
    public String getDiagTwo() {
        return diagTwo;
    }
    public void setDiagTwo(String diagTwo) {
        this.diagTwo = diagTwo;
    }
    public String getDiagThree() {
        return diagThree;
    }
    public void setDiagThree(String diagThree) {
        this.diagThree = diagThree;
    }
    public String getDiagFour() {
        return diagFour;
    }
    public void setDiagFour(String diagFour) {
        this.diagFour = diagFour;
    }
    public String getDiagFive() {
        return diagFive;
    }
    public void setDiagFive(String diagFive) {
        this.diagFive = diagFive;
    }
    public String getDosage() {
        return dosage;
    }
    public void setDosage(String dosage) {
        this.dosage = dosage;
    }
    public String getUnit() {
        return unit;
    }
    public void setUnit(String unit) {
        this.unit = unit;
    }
    public String getUsage() {
        return usage;
    }
    public void setUsage(String usage) {
        this.usage = usage;
    }
    public String getSupplyCode() {
        return supplyCode;
    }
    public void setSupplyCode(String supplyCode) {
        this.supplyCode = supplyCode;
    }
    public String getDays() {
        return days;
    }
    public void setDays(String days) {
        this.days = days;
    }
    public String getFrequency() {
        return frequency;
    }
    public void setFrequency(String frequency) {
        this.frequency = frequency;
    }
}

+ 78 - 0
src/main/java/com/yihu/wlyy/service/CAService.java

@ -0,0 +1,78 @@
package com.yihu.wlyy.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.WebServiceParamVO;
import com.yihu.wlyy.util.StringUtil;
import com.yihu.wlyy.util.WebserviceUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by zdm on 2019/5/28.
 */
@Service
public class CAService {
    //银医通下载
    private String YYT_DOWN = "CallYYTServerService";
    @Autowired
    private ObjectMapper objectMapper;
    private String getHeaderXml(String api, String srcBusinessStreamNO, String srcRequestStreamNO) {
        return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
                "<root>\n" +
                "   <serverName>" + api + "</serverName>\n" +
                "   <format>xml</format>\n" +
                "   <callOperator></callOperator>\n" +
                "   <certificate></certificate>\n" +
                "   <srcIP>10.95.22.10</srcIP >\n" +
                "   <srcUserMac>00:50:56:85:39:82</srcUserMac>\n" +
                "   <srcSystemCode>1</srcSystemCode>\n" +
                "   <srcSystemName>厦门i健康</srcSystemName>\n" +
                "   <srcBusinessNodeCode>node01</srcBusinessNodeCode>\n" +
                "   <srcBusinessNodeName>审核</srcBusinessNodeName>\n" +
                "   <srcOperatorAccount>" + srcBusinessStreamNO + "</srcOperatorAccount>\n" +
                "   <srcBusinessStreamNO>" + srcBusinessStreamNO + "</srcBusinessStreamNO>\n" +
                "   <srcRequestStreamNO>" + srcRequestStreamNO + "</srcRequestStreamNO>\n" +
                "   <srcDataExtProperty></srcDataExtProperty>\n" +
                "</root>";
    }
    /**
     * 银医通下载
     **/
    public String callYYTServerService() throws Exception {
        String re = "";
        String info_xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
                "<root>\n" +
                "<ip>172.16.50.40</ip>\n" +
                "<port>5516</port>\n" +
                "<compress_encode_flag>1</compress_encode_flag>\n" +
                "</root>\n";
        String reqmsg_xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
                "<root><sick_id>DB8687139</sick_id>\n" +
                "<cus_card_no>DB8687139</cus_card_no>\n" +
                "<req_type>2001</req_type><\n" +
                "trade_type>2001</trade_type>\n" +
                "<req_oper>8644</req_oper>\n" +
                "<req_term>192001019019</req_term>\n" +
                "<win_no>6</win_no></root>\n";
        WebServiceParamVO paramVO=new WebServiceParamVO();
        paramVO.setServerInfo(info_xml);
        paramVO.setRegMsg(reqmsg_xml);
        paramVO.setSoapAction("#CallYYTServerService");
        paramVO.setTargetObjectURI("zysoft");
        paramVO.setWsdlUrl("http://172.16.50.40/ZyXmyytRequestService/ZyXmyytRequestServiceWs.dll?Handler=GenZyXmyytRequestServiceWsWSDL");
        paramVO.setMethodName("CallYYTServerService");
        WebserviceUtil.callMethod(paramVO);
        return re;
    }
}

+ 44 - 15
src/main/java/com/yihu/wlyy/service/EntranceService.java

@ -105,7 +105,7 @@ public class EntranceService {
     * @return
     * @throws Exception
     */
    public String BS16017(String REGISTER_SN,String PAT_NO,String ADM_NO) throws Exception {
    public String BS16017(String REGISTER_SN,String PAT_NO,String ADM_NO,String real_order) throws Exception {
        String fid=BS16017;
        StringBuffer sbs= new StringBuffer();
        //AccessControl :用户、密码、服务id
@ -123,6 +123,9 @@ public class EntranceService {
        if(StringUtils.isNotBlank(ADM_NO)) {
            sbs.append("<query compy=\"=\" item=\"ADM_NO\" splice=\"and\" value=\"'" + ADM_NO + "'\"/>");
        }
        if(StringUtils.isNotBlank(real_order)) {
            sbs.append("<query compy=\"=\" item=\"real_order\" splice=\"and\" value=\"'" + real_order + "'\"/>");
        }
        //查询信息结束
        sbs.append("<startNum>1</startNum></MsgInfo></ESBEntry>");
@ -137,7 +140,7 @@ public class EntranceService {
     * @return
     * @throws Exception
     */
    public String BS30025(String PAT_NO,String ADM_NO,String REGISTER_SN,String PAT_CARDNO,String social_no) throws Exception {
    public String BS30025(String PAT_NO,String startTime,String endTime) throws Exception {
        String fid=BS30025;
        StringBuffer sbs= new StringBuffer();
        //AccessControl :用户、密码、服务id
@ -146,20 +149,14 @@ public class EntranceService {
        sbs.append("<MessageHeader><Fid>"+fid+"</Fid><MsgDate>"+ DateUtil.dateToStr(new Date(),DateUtil.YYYY_MM_DD_HH_MM_SS)+"</MsgDate><SourceSysCode>S60</SourceSysCode><TargetSysCode>S01</TargetSysCode></MessageHeader>");
        //查询信息拼接
        sbs.append("<MsgInfo><onceFlag>1</onceFlag><startNum>1</startNum><endNum>50000</endNum><Msg/>");
        if(StringUtils.isNotBlank(PAT_NO)){
            sbs.append("<query compy=\"=\" item=\"PAT_NO\" splice=\"and\" value=\"'"+PAT_NO+"'\"/>");
        }
        if(StringUtils.isNotBlank(ADM_NO)){
            sbs.append("<query compy=\"=\" item=\"ADM_NO\" splice=\"and\" value=\"'"+ADM_NO+"'\"/>");
        }
        if(StringUtils.isNotBlank(REGISTER_SN)){
            sbs.append("<query compy=\"=\" item=\"REGISTER_SN\" splice=\"and\" value=\"'"+REGISTER_SN+"'\"/>");
        if (StringUtils.isNotBlank(PAT_NO)) {
            sbs.append("<query compy=\"=\" item=\"PAT_NO\" splice=\"and\" value=\"'" + PAT_NO + "'\"/>");
        }
        if(StringUtils.isNotBlank(PAT_CARDNO)){
            sbs.append("<query compy=\"=\" item=\"PAT_CARDNO\" splice=\"and\" value=\"'"+PAT_CARDNO+"'\"/>");
        if (StringUtils.isNotBlank(startTime)) {
            sbs.append("<query compy=\"&gt;=\" item=\"CON_DATE\" splice=\"and\" value=\"'" + startTime + "'\"/>");
        }
        if(StringUtils.isNotBlank(social_no)){
            sbs.append("<query compy=\"=\" item=\"social_no\" splice=\"and\" value=\"'"+social_no+"'\"/>");
        if (StringUtils.isNotBlank(endTime)) {
            sbs.append("<query compy=\"&lt;\" item=\"CON_DATE\" splice=\"and\" value=\"'" + endTime + "'\"/>");
        }
        //查询信息结束
        sbs.append("</MsgInfo></ESBEntry>");
@ -192,7 +189,7 @@ public class EntranceService {
     * @return
     * @throws Exception
     */
    public String MS53001(String charge_code,String py_code,String stock_amount,String visible_flag) throws Exception {
    public String MS53001(String charge_code,String py_code,String stock_amount,String win_no,String visible_flag) throws Exception {
        String fid="MS53001";
        StringBuffer sbs= new StringBuffer();
        //AccessControl :用户、密码、服务id
@ -210,6 +207,9 @@ public class EntranceService {
        if(StringUtils.isNotBlank(stock_amount)){
            sbs.append("<query compy=\"&gt;=\" item=\"stock_amount\" splice=\"and\" value=\"'"+stock_amount+"'\"/>");
        }
        if(StringUtils.isNotBlank(win_no)){
            sbs.append("<query compy=\"=\" item=\"win_no\" splice=\"and\" value=\"'"+win_no+"'\"/>");
        }
        if(StringUtils.isNotBlank(visible_flag)){
            sbs.append("<query compy=\"=\" item=\"visible_flag\" splice=\"and\" value=\"'"+visible_flag+"'\"/>");
        }
@ -448,4 +448,33 @@ public class EntranceService {
        return resp;
    }
    /**
     * 诊断编码
     * @return
     * @throws Exception
     */
    public String MS25002(String py_code,String win_no) throws Exception {
        String fid="MS25002";
        StringBuffer sbs= new StringBuffer();
        //AccessControl :用户、密码、服务id
        sbs.append("<ESBEntry><AccessControl><Fid>"+fid+"</Fid><UserName>JKZL</UserName><Password>123456</Password></AccessControl>");
        //MessageHeader :固定值 消费方系统编号 S60,提供方系统编号 S01
        sbs.append("<MessageHeader><Fid>"+fid+"</Fid><MsgDate>"+ DateUtil.dateToStr(new Date(),DateUtil.YYYY_MM_DD_HH_MM_SS)+"</MsgDate><SourceSysCode>S60</SourceSysCode><TargetSysCode>S01</TargetSysCode></MessageHeader>");
        //查询信息拼接
        sbs.append("<MsgInfo><endNum>1000</endNum><Msg/>");
        if(StringUtils.isNotBlank(py_code)){
            sbs.append("<query compy=\"=\" item=\"py_code\" splice=\"and\" value=\"'"+py_code+"'\"/>");
        }
        if(StringUtils.isNotBlank(win_no)){
            sbs.append("<query compy=\"=\" item=\"win_no\" splice=\"and\" value=\"'"+win_no+"'\"/>");
        }
        sbs.append("<startNum>1</startNum></MsgInfo></ESBEntry>");
        //<ESBEntry><AccessControl><Fid>MS25002</Fid><UserName>jcjy</UserName><Password>123456</Password></AccessControl>
        // <MessageHeader><Fid>MS25002</Fid><MsgDate>2018-10-09 16:52:39</MsgDate><SourceSysCode>S60</SourceSysCode><TargetSysCode>S01</TargetSysCode></MessageHeader>
        // <MsgInfo><endNum>20000</endNum><Msg></Msg><startNum>1</startNum></MsgInfo></ESBEntry>
        String resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid );
        resp= MqSdkUtil.xml2jsonArrayRootRow(resp);
        return resp;
    }
}

+ 50 - 0
src/main/java/com/yihu/wlyy/service/PrescriptionCAService.java

@ -0,0 +1,50 @@
package com.yihu.wlyy.service;
/**
 * Created by ${liuwenbin} on 2017/8/28.
 */
public interface PrescriptionCAService {
//    String getHeaderXml(String api,String srcBusinessStreamNO,String srcRequestStreamNO);
    /**
     * 生产环境 智业CA接口二次封装
     * @param api
     * @param params
     * @param srcBusinessStreamNO
     * @return
     * @throws Exception
     */
//    public String postZyCaServer(String api, Map<String,String> params, String srcBusinessStreamNO, String content) throws Exception;
    /**
     * 测试环境:CA认证服务二次封装
     */
//    public String postCAServer(String api, Map<String,String> params,String srcBusinessStreamNO) throws Exception;
    /**
     * 请求实名软证书并进行数字签名
     **/
    public String requestRealNameSoftCertAndSign(String strUserIdcardNum, String strRealNameSoftCertCalledPasswd, String strOriginalData, String srcBusinessStreamNO)  throws Exception;
    /**
     * 获取实名软证书的过期时间
     **/
    public String getRealNameSoftCertExpiredDatetime(String strUserIdcardNum, String srcBusinessStreamNO)  throws Exception;
    /**
     * 修改实名软证书调用保护口令
     **/
    public String modifyRealNameSoftCertCalledPasswd(String strUserIdcardNum, String strOldCalledPasswd, String strNewCalledPasswd, String srcBusinessStreamNO) throws Exception;
    /**
     * 验证签名(带多服务器负载均衡)
     **/
    public String verifySignOnMultiServer(String strSignData, String strCertData, String strOriginalData, String srcBusinessStreamNO)  throws Exception;
    /**
     * 判断是否有实名证书
     **/
    public String isApplied(String strUserIdcardNum, String srcBusinessStreamNO)  throws Exception;
}

+ 354 - 0
src/main/java/com/yihu/wlyy/service/ZysoftBaseService.java

@ -0,0 +1,354 @@
/*
package com.yihu.wlyy.service;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.common.SystemConfig;
import com.yihu.wlyy.service.common.http.HttpApiException;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.common.util.StringUtil;
import com.yihu.wlyy.service.dao.HospitalMappingDao;
import com.yihu.wlyy.service.dao.log.ZyPushLogDao;
import com.yihu.wlyy.service.dao.log.ZyPushLogDetailDao;
import com.yihu.wlyy.service.entity.HospitalMapping;
import com.yihu.wlyy.service.entity.log.ZyPushLog;
import com.yihu.wlyy.service.entity.log.ZyPushLogDetail;
import com.zoe.phip.ssp.sdk.ApiException;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
*/
/**
 * 智业接口--基本方法
 * Created by yeshijie on 2017/7/17.
 *//*
@Service
public class ZysoftBaseService {
    private org.slf4j.Logger logger= LoggerFactory.getLogger(ZysoftBaseService.class);
    @Autowired
    private LogService logService;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private HospitalMappingDao hospitalMappingDao;
    @Autowired
    private ZyPushLogDao zyPushLogDao;
    @Autowired
    private ZyPushLogDetailDao zyPushLogDetailDao;
    //默认重复次数
    private int retryTimes = 3;
    @Value("${zysoftApi.internet}")
    private String internet;
    @Value("${zysoftApi.base}")
    private String base;
    @Value("${zysoftApi.imm}")
    private String imm;
    @Value("${zyapi.openCrypto}")
    private Boolean openCrypto;
    public String getCode() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
    */
/**
     * 保存智业推送日志
     * @param request
     * @param api
     * @param content
     * @param error
     * @param method
     * @param status
     * @param type
     *//*
    public Result addZyPushLog(String request, String api, String content, String error, String method, String status, String type,String errMsg){
        Result re = null;
        if(errMsg==null){
            re = Result.success(content);
        }else {
            re = Result.error(-1,errMsg);
        }
        ZyPushLog log = new ZyPushLog();
        log.setCreateTime(new Date());
        log.setApi(api);
        log.setContent(content);
//        log.setError(error);
        log.setMethod(method);
//        log.setRequest(request);
//        log.setResponse(JSONObject.toJSONString(re,SerializerFeature.WriteMapNullValue));
        log.setRetryTimes(0);
        log.setStatus(status);
        log.setType(type);
        zyPushLogDao.save(log);
        //明细表
        ZyPushLogDetail detail = new ZyPushLogDetail();
        detail.setCode(log.getId());
        detail.setError(error);
        detail.setCreateTime(new Date());
        detail.setResponse(JSONObject.toJSONString(re,SerializerFeature.WriteMapNullValue));
        detail.setRequest(request);
        zyPushLogDetailDao.save(detail);
        return re;
    }
    */
/**
     * 获取基础路径
     * @param apiType
     * @return
     *//*
    private String getBaseApi(Integer apiType){
        String baseApi = "";
        switch (apiType){
            case 1:
                baseApi = base;
                break;
            case 2:
                baseApi = internet;
                break;
            default:
                baseApi = base;
                break;
        }
        return baseApi;
    }
    */
/**
     * 基卫二次封装Get接口
     *//*
    public String getSecond(String api, String content, Map<String,String> params, Map<String,String> headers, boolean needRetry,Integer apiType) throws Exception
    {
        String re = "";
        headers.put("INTERFACE",api);
        Map<String,String> paramsList = new HashMap<>();
        String msgBody = JSONObject.toJSONString(params, SerializerFeature.WriteMapNullValue);
        String msgHeader = JSONObject.toJSONString(headers, SerializerFeature.WriteMapNullValue);
        paramsList.put("msgHeader",msgHeader);
        paramsList.put("msgBody",msgBody);
        logger.info("msgHeader:"+msgHeader+"\r\n");
        logger.info("msgBody:"+msgBody+"\r\n");
        //新增日志
        String method = "GET";
        Boolean isSuccess = true;
        String error = "";
        String baseApi = getBaseApi(apiType);
        int times = 0;
        try {
            re = ZysoftApi.getSingleton().get(baseApi, paramsList, null,openCrypto);
            if(needRetry)
            {
                while(retryTimes>0 && re.contains("接口调用传入的参数[msgHeader]格式不正确"))    //基卫bug预防,重调接口
                {
                    re = ZysoftApi.getSingleton().post(baseApi, paramsList, null,openCrypto);
                    retryTimes --;
                    times++;
                }
            }
            Map<String,String> map = objectMapper.readValue(re,Map.class);
            String code = map.get("CODE");
            String message = map.get("MESSAGE");
            if(!code.equals("1"))
            {
                throw new HttpApiException(Integer.valueOf(code),message);
            }
            //保存http日志
//            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            logService.saveZyPushLog(api,content,null,"POST",msgHeader+","+msgBody,re,"1","2");
        }
        catch (Exception ex)
        {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
            isSuccess = false;
            //保存http日志
//            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            logService.saveZyPushLog(api,content,null,"POST",msgHeader+","+msgBody,re,"0","2");
            if(ex instanceof ApiException)
            {
                ApiException apiEx = (ApiException) ex;
                throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
            }
            else{
                throw new HttpApiException(-1,ex.getMessage());
            }
        }
        return re;
    }
    */
/**
     * 基卫二次封装Post接口
     *//*
    public String postSecond(String api,String content, Map<String,String> params,JSONObject jsonParams, Map<String,String> headers,boolean needRetry,Integer apiType,String type) throws Exception
    {
        String re = "";
        headers.put("INTERFACE",api);
        Map<String,String> paramsList = new HashMap<>();
        String msgBody = params==null?JSONObject.toJSONString(jsonParams, SerializerFeature.WriteMapNullValue):JSONObject.toJSONString(params, SerializerFeature.WriteMapNullValue);
        String msgHeader = JSONObject.toJSONString(headers, SerializerFeature.WriteMapNullValue);
        paramsList.put("msgHeader",msgHeader);
        paramsList.put("msgBody",msgBody);
        logger.info("msgHeader:"+msgHeader+"\r\n");
        logger.info("msgBody:"+msgBody+"\r\n");
        //新增日志
        String method = "POST";
        Boolean isSuccess = true;
        String error = "";
        String baseApi = getBaseApi(apiType);
        int times = 0;
        try {
            re = ZysoftApi.getSingleton().post(baseApi, paramsList, null,openCrypto);
            if(needRetry)
            {
                int maxTimes = retryTimes;
                while(maxTimes>0 && re.contains("接口调用传入的参数[msgHeader]格式不正确"))    //基卫bug预防,重调接口
                {
                    re = ZysoftApi.getSingleton().post(baseApi, paramsList, null,openCrypto);
                    maxTimes --;
                    times++;
                }
            }
            Map<String,String> map = objectMapper.readValue(re,Map.class);
            String code = map.get("CODE");
            if(!code.equals("1"))
            {
                throw new HttpApiException(Integer.valueOf(code),map.get("MESSAGE"));
            }
//            com.alibaba.fastjson.JSONObject j = com.alibaba.fastjson.JSONObject.parseObject(re);
            //保存http日志
//            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            logService.saveZyPushLog(api,content,null,"POST",msgHeader+","+msgBody,re,"1",type);
        }
        catch (Exception ex)
        {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
            //保存http日志
//            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            logService.saveZyPushLog(api,content,error,"POST",msgHeader+","+msgBody,re,"0",type);
            if(ex instanceof ApiException)
            {
                ApiException apiEx = (ApiException) ex;
                throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
            }
            else{
                throw new HttpApiException(-1,ex.getMessage());
            }
        }
        return re;
    }
    */
/**
     * 获取机构映射
     *//*
    public String[] getHospitalMapping(String hospital) throws Exception
    {
        if(StringUtil.isEmpty(hospital)) //使用默认医院
        {
            String mappingCode = SystemConfig.getInstance().getJwHospital();
            String licence = SystemConfig.getInstance().getJwLicence();
            return new String[]{mappingCode,licence};
        }
        else {
            HospitalMapping hm = hospitalMappingDao.getMappingCode(hospital, "1");  //转换成基卫机构代码
            String licence = "";
            if (hm != null && !StringUtil.isEmpty(hm.getMappingCode()) && !StringUtil.isEmpty(hm.getLicence())) {
                hospital = hm.getMappingCode();
                licence = hm.getLicence();
            } else {
                throw new Exception("机构【" + hospital + "】映射配置未完善!");
            }
            return new String[]{hospital, licence};
        }
    }
    */
/*************************** 格式转换 *******************************************************//*
    */
/**
     * 获取单对象
     *//*
    public Map<String,String> getJwOne(String response) throws Exception
    {
        Map<String,String> re = new HashMap<>();
        Map<String,Object> map = objectMapper.readValue(response,Map.class);
        String code = String.valueOf(map.get("CODE"));
        if(code.equals("1")) {
            List<Map<String, String>> list = (List<Map<String, String>>) map.get("DATA");
            if (list != null && list.size() > 0) {
                re = list.get(0);
            }
        }
        else{
            re.put("MESSAGE",String.valueOf(map.get("MESSAGE")));
        }
        return re;
    }
    */
/**
     * 获取单对象列表
     **//*
    public List<Map<String,String>> getJwList(String response) throws Exception
    {
        Map<String,Object> map = objectMapper.readValue(response,Map.class);
        List<Map<String,String>> list = (List<Map<String,String>>)map.get("DATA");
        return list;
    }
}
*/

+ 159 - 0
src/main/java/com/yihu/wlyy/util/ConvertUtil.java

@ -0,0 +1,159 @@
package com.yihu.wlyy.util;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
 * Created by zdm on 2019/5/27.
 */
public class ConvertUtil {
    /**
     * 返回单个对象数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public static JSONObject convertObjectEnvelopByString(String obj)throws Exception{
        JSONObject jsonObject= JSONObject.fromObject(obj);
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONObject jsonObjectMgsInfo=(JSONObject)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                return  (JSONObject)jsonObjectMgsInfo.get("Msg");
            }else {
                return null;
            }
        }else {
            return null;
        }
    }
    /**
     * 返回对象数组数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public static JSONArray convertListEnvelopByString(String obj)throws Exception{
        JSONObject jsonObject= JSONObject.fromObject(obj);
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                return jsonObjectMgsInfo;
            }else {
                return null;
            }
        }else {
            return  null;
        }
    }
    /**
     * 返回对象数组数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public static JSONArray convertListEnvelopInBodyRow(String obj)throws Exception{
        JSONObject jsonObject= JSONObject.fromObject(obj);
        JSONArray jsonArray=new JSONArray();
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                for (Object object : jsonObjectMgsInfo) {
                    JSONObject jsonObjectBody=(JSONObject)object;
                    jsonObjectBody= (JSONObject)jsonObjectBody.get("body");
                    if(null!=jsonObjectBody){
                        jsonArray.add(jsonObjectBody.get("row")) ;
                    }
                }
                return jsonArray;
            }else {
                return null;
            }
        }else {
            return  null;
        }
    }
    /**
     * 返回对象数组数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public  static JSONArray convertListEnvelopInRow(String obj)throws Exception{
        JSONObject jsonObject= JSONObject.fromObject(obj);
        JSONArray jsonArray=new JSONArray();
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                for (Object object : jsonObjectMgsInfo) {
                    JSONObject jsonObjectBody=(JSONObject)object;
                    if(null!=jsonObjectBody){
                        jsonArray.add(jsonObjectBody.get("row")) ;
                    }
                }
                return jsonArray;
            }else {
                return null;
            }
        }else {
            return  null;
        }
    }
    /**
     * 返回对象数组数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public static JSONArray convertListEnvelopInBody(String obj)throws Exception{
        JSONObject jsonObject= JSONObject.fromObject(obj);
        JSONArray jsonArray=new JSONArray();
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                for (Object object : jsonObjectMgsInfo) {
                    JSONObject jsonObjectBody=(JSONObject)object;
                    Object objectBody=jsonObjectBody.get("body");
                    if(objectBody instanceof JSONArray){
                        net.sf.json.JSONArray jsonArrayBody = (net.sf.json.JSONArray) jsonObjectBody.get("body");
                        for (Object objectBodySub : jsonArrayBody) {
                            jsonArray.add(objectBodySub);
                        }
                    }else {
                        jsonArray.add(jsonObjectBody) ;
                    }
                }
                return jsonArray;
            }else {
                return null;
            }
        }else {
            return  null;
        }
    }
    /**
     * 返回对象数组数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public static JSONObject convertListEnvelopInRequest(String obj)throws Exception{
        JSONObject jsonObject= JSONObject.fromObject(obj);
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                for (Object object : jsonObjectMgsInfo) {
                    JSONObject jsonObjectBody = (JSONObject) object;
                    return jsonObjectBody;
                }
            }
        }
        return  null;
    }
}

+ 1126 - 0
src/main/java/com/yihu/wlyy/util/StringUtil.java

@ -0,0 +1,1126 @@
package com.yihu.wlyy.util;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.sql.Clob;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtil {
    /**
     * 获取手机号码
     */
    public static String getTelnum(String sParam){
        if(sParam.length()<=0)
            return "";
        Pattern pattern = Pattern.compile("(1|861)(3|5|8)\\d{9}$*");
        Matcher matcher = pattern.matcher(sParam);
        StringBuffer bf = new StringBuffer();
        if (matcher.find(0)) {
            String re = matcher.group(0);
            return re;
        }
        else{
            return "";
        }
    }
    public static String substring(String str, int start) {
        return StringUtils.substring(str, start);
    }
    public static String substring(String str, int start, int end) {
        return StringUtils.substring(str, start, end);
    }
    public static boolean isBlank(String str) {
        return StringUtils.isBlank(str);
    }
    public static String toString(Object obj) {
        if (obj == null) {
            return null;
        }
        return obj.toString();
    }
    public static String trimLeft(String value) {
        if (value == null)
            return "";
        String result = value;
        char ch[] = result.toCharArray();
        int index = -1;
        for (int i = 0; i < ch.length; i++) {
            if (Character.isWhitespace(ch[i])) {
                index = i;
            } else {
                break;
            }
        }
        if (index != -1) {
            result = result.substring(index + 1);
        }
        return result;
    }
    public static String trimRight(String value) {
        if (value == null)
            return "";
        String result = value;
        char ch[] = result.toCharArray();
        int endIndex = -1;
        for (int i = ch.length - 1; i > -1; i--) {
            if (Character.isWhitespace(ch[i])) {
                endIndex = i;
            } else {
                break;
            }
        }
        if (endIndex != -1) {
            result = result.substring(0, endIndex);
        }
        return result;
    }
    public static String fillHeadCharsLen(String strOri, int len) {
        return fillHeadCharsLen(strOri, "0", len);
    }
    public static String fillBackCharsLen(String strOri, int len) {
        return fillBackCharsLen(strOri, "0", len);
    }
    public static String fillHeadCharsLen(String strOri, String subStr, int len) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (subStr == null) {
            subStr = " ";
        }
        String fillStr = "";
        for (int i = 0; i < len; i++) {
            fillStr = fillStr + subStr;
        }
        subStr = fillStr + strOri;
        return (subStr.substring(subStr.length() - len, subStr.length()));
    }
    public static String fillBackCharsLen(String strOri, String subStr, int len) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (subStr == null) {
            subStr = " ";
        }
        String fillStr = "";
        for (int i = 0; i < len; i++) {
            fillStr = fillStr + subStr;
        }
        subStr = strOri + fillStr;
        return (subStr.substring(0, len));
    }
    public static String fillHeadChars(String strOri, int counter) {
        return fillHeadChars(strOri, "0", counter);
    }
    public static String fillBackChars(String strOri, int counter) {
        return fillBackChars(strOri, "0", counter);
    }
    public static String fillHeadChars(String strOri, String subStr, int counter) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (counter <= 0 || subStr == null) {
            return strOri;
        }
        String fillStr = "";
        for (int i = 0; i < counter; i++) {
            fillStr = fillStr + subStr;
        }
        return (fillStr + strOri);
    }
    public static String fillBackChars(String strOri, String subStr, int counter) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (counter <= 0 || subStr == null) {
            return strOri;
        }
        String fillStr = "";
        for (int i = 0; i < counter; i++) {
            fillStr = fillStr + subStr;
        }
        return (strOri + fillStr);
    }
    public static boolean isEmpty(Object strObj) {
        if (strObj == null || strObj.toString().trim().length() < 1) {
            return true;
        } else {
            return false;
        }
    }
    public static boolean isStrEmpty(String str) {
        if ((str == null) || (str.trim().length() < 1) || "null".endsWith(str.toLowerCase())) {
            return true;
        } else {
            return false;
        }
    }
    public static String getValue(String str) {
        if (str == null) {
            return "";
        }
        if (str.trim().length() <= 0)
            return "";
        str = "H" + str;
        str = str.trim();
        str = str.substring(1);
        return str;
    }
    public static boolean chkTextLen(String text, int len) {
        if (text == null || text.length() > len) {
            return false;
        } else {
            return true;
        }
    }
    public static boolean chkTextTrimLen(String text, int len) {
        if (text == null || text.trim().length() > len) {
            return false;
        } else {
            return true;
        }
    }
    public static boolean isStrEn(String text) {
        for (int i = 0; i < text.length(); i++) {
            if (text.charAt(i) > 127) {
                return false;
            }
        }
        return true;
    }
    public static boolean isCharNum(char ch) {
        if (ch > 47 && ch < 58) {
            return true;
        } else {
            return false;
        }
    }
    public static boolean isStrNum(String str) {
        if (isStrEmpty(str)) {
            return true;
        }
        boolean notNum = false;
        for (int i = 0; i < str.length(); i++) {
            if (!isCharNum(str.charAt(i))) {
                notNum = true;
            }
        }
        return !notNum;
    }
    public static boolean isNum(String strSrc) throws Exception {
        for (int i = 0; i < strSrc.length(); i++) {
            if (!isCharNum(strSrc.charAt(i)))
                return false;
        }
        return true;
    }
    public static boolean isCharLetter(char ch) {
        if ((ch >= 65 && ch <= 90) && (ch >= 97 && ch <= 122)) {
            return true;
        } else {
            return false;
        }
    }
    public static boolean isStrLetter(String str) {
        if (isStrEmpty(str))
            return true;
        boolean notLetter = false;
        for (int i = 0; i < str.length(); i++) {
            if (!isCharLetter(str.charAt(i))) {
                notLetter = true;
            }
        }
        return !notLetter;
    }
    public static char strToChar(String src) {
        src = src.trim();
        char result = src.charAt(0);
        return result;
    }
    public static String encodeSQL(String sql) {
        StringBuffer tempBuff = new StringBuffer();
        for (int i = 0; i < sql.length(); i++) {
            tempBuff.append(Integer.toHexString(sql.charAt(i)));
        }
        return tempBuff.toString();
    }
    public static String decodeSQL(String encoded) {
        StringBuffer tempBuff = new StringBuffer();
        for (int i = 0; i < encoded.length(); i += 2) {
            tempBuff.append((char) Integer.parseInt(
                    encoded.substring(i, i + 2), 16));
        }
        return tempBuff.toString();
    }
    public static String getAbsolutePath(String path1, String context1) {
        int i1 = path1.indexOf(context1);
        if (i1 < 0) {
            return path1;
        } else {
            return path1.substring(path1.indexOf(context1) + context1.length());
        }
    }
    public static String getSubString(String str1, int sindex, int eindex) {
        if (str1 == null) {
            return "";
        }
        if (str1.trim().length() <= 0)
            return "";
        if (str1.length() > sindex) {
            if (eindex >= 0)
                return str1.substring(sindex, eindex);
            else if (eindex < 0)
                return str1.substring(sindex);
        }
        return "";
    }
    public static String[] getValues(String[] strs, int size1) {
        String[] strs1 = new String[size1];
        for (int i = 0; i < size1; i++) {
            strs1[i] = "";
        }
        if (strs == null) {
            return strs1;
        } else {
            if (strs.length < size1) {
                for (int i = 0; i < strs.length; i++) {
                    strs1[i] = strs[i];
                }
                return strs1;
            } else {
                return strs;
            }
        }
    }
    public static String replaceStrAll(String strSource, String strFrom,
                                       String strTo) {
        String strDest = "";
        int intFromLen = strFrom.length();
        int intPos;
        while ((intPos = strSource.indexOf(strFrom)) != -1) {
            strDest = strDest + strSource.substring(0, intPos);
            strDest = strDest + strTo;
            strSource = strSource.substring(intPos + intFromLen);
        }
        strDest = strDest + strSource;
        return strDest;
    }
    public static String replaceStr(String strTarget, String strNew) {
        int iIndex = -1;
        while (true) {
            iIndex = strTarget.indexOf('\n');
            if (iIndex < 0) {
                break;
            }
            String strTemp = null;
            strTemp = strTarget.substring(0, iIndex);
            strTarget = strTemp + strNew + strTarget.substring(iIndex + 1);
        }
        return strTarget;
    }
    public static boolean includestr(String str1, String[] strarray) {
        if (strarray == null || strarray.length <= 0)
            return false;
        for (int i = 0; i < strarray.length; i++) {
            if (strarray[i] == null) {
                if (str1 == null)
                    return true;
                else
                    continue;
            }
            if (strarray[i].trim().equals(str1)) {
                return true;
            }
        }
        return false;
    }
    public static String[] getAreaValues(String fvalue) {
        String tmpstr = fvalue;
        int i = 0;
        if (tmpstr == null)
            return null;
        if (tmpstr.trim().equals(""))
            return null;
        while (tmpstr.indexOf("\n") >= 0) {
            i++;
            tmpstr = tmpstr.substring(tmpstr.indexOf("\n") + 1);
        }
        if (tmpstr.trim().equals("")) {
            i--;
        }
        String[] fvalues = new String[i + 1];
        tmpstr = fvalue;
        i = 0;
        while (tmpstr.indexOf("\n") >= 0) {
            fvalues[i] = tmpstr.substring(0, tmpstr.indexOf("\n"));
            if (fvalues[i].indexOf("\r") >= 0)
                fvalues[i] = fvalues[i].substring(0, fvalues[i].indexOf("\r"));
            i++;
            tmpstr = tmpstr.substring(tmpstr.indexOf("\n") + 1);
        }
        if (!tmpstr.trim().equals(""))
            fvalues[i] = tmpstr;
        return fvalues;
    }
    public static String getrealAreaValues(String fvalue) {
        String tmpstr = fvalue;
        String returnstr = "";
        if (tmpstr == null)
            return null;
        if (tmpstr.trim().equals(""))
            return "";
        while (tmpstr.indexOf("|") > 0) {
            returnstr += tmpstr.substring(0, tmpstr.indexOf("|")) + "\n";
            tmpstr = tmpstr.substring(tmpstr.indexOf("|") + 1);
        }
        return returnstr;
    }
    public static int countChar(String strInput, char chr) {
        int iCount = 0;
        char chrTmp = ' ';
        if (strInput.trim().length() == 0)
            return 0;
        for (int i = 0; i < strInput.length(); i++) {
            chrTmp = strInput.charAt(i);
            if (chrTmp == chr) {
                iCount++;
            }
        }
        return iCount;
    }
    public static String strArrayToStr(String[] strs) {
        return strArrayToStr(strs, null);
    }
    public static void printStrs(String[] strs) {
        for (int i = 0; i < strs.length; i++) {
            System.out.println(strs[i]);
        }
    }
    public static void printDualStr(String[][] dualStr) {
        for (int i = 0; i < dualStr.length; i++) {
            for (int j = 0; j < dualStr[i].length; j++) {
                System.out.print(dualStr[i][j] + " ");
            }
            System.out.println();
        }
    }
    public static String[][] rowToColumn(String[][] dualStr) {
        String[][] returnDualStr = null;
        if (dualStr != null) {
            returnDualStr = new String[dualStr[0].length][dualStr.length];
            for (int i = 0; i < dualStr.length; i++)
                for (int j = 0; j < dualStr[0].length; j++)
                    returnDualStr[j][i] = dualStr[i][j];
        }
        return returnDualStr;
    }
    public static String latinString(String inStr) {
        String res = inStr;
        if (null == res)
            return null;
        res = replaceStrAll(res, "\"", "\\\"");
        res = replaceStrAll(res, "'", "\\'");
        return res;
    }
    public static String replaceWhiteSpace(String strTarget, String strNew) {
        int iIndex = -1;
        while (true) {
            char cRep = 32;
            iIndex = strTarget.indexOf(cRep);
            if (iIndex < 0) {
                break;
            }
            String strTemp = null;
            strTemp = strTarget.substring(0, iIndex);
            strTarget = strTemp + strNew + strTarget.substring(iIndex + 1);
        }
        return strTarget;
    }
    public static String double2str(double amount, int length) {
        String strAmt = Double.toString(amount);
        int pos = strAmt.indexOf('.');
        if (pos != -1 && strAmt.length() > length + pos + 1)
            strAmt = strAmt.substring(0, pos + length + 1);
        return strAmt;
    }
    public static String[] doSplit(String str, char chr) {
        int iCount = 0;
        char chrTmp = ' ';
        // ?????????????????
        for (int i = 0; i < str.length(); i++) {
            chrTmp = str.charAt(i);
            if (chrTmp == chr) {
                iCount++;
            }
        }
        String[] strArray = new String[iCount];
        for (int i = 0; i < iCount; i++) {
            int iPos = str.indexOf(chr);
            if (iPos == 0) {
                strArray[i] = "";
            } else {
                strArray[i] = str.substring(0, iPos);
            }
            str = str.substring(iPos + 1); // ??iPos+1??????,str????????��
        }
        return strArray;
    }
    public static String[] strSplit(String src, String splitchar) {
        int resultSize = 0;
        int len = src.length();
        int idx = 0;
        String strTemp = "";
        for (int i = 0; i < len; i++) {
            if (src.substring(i, i + 1).equals(splitchar)) {
                resultSize++;
            }
        }
        if ((len > 1) & (!src.substring(len - 1, len).equals(splitchar))) {
            resultSize++;
        }
        String result[] = new String[resultSize];
        for (int i = 0; i < len; i++) {
            if (src.substring(i, i + 1).equals(splitchar)) {
                result[idx] = strTemp;
                idx++;
                strTemp = "";
            } else {
                strTemp = String.valueOf(strTemp)
                        + String.valueOf(src.charAt(i));
            }
        }
        if (!strTemp.equals("")) {
            result[idx] = strTemp;
        }
        return result;
    }
    public static String[] split(String strToSplit, String strSeparator,
                                 int iLimit) {
        ArrayList tmpList = new ArrayList();
        int iFromIndex = 0;
        int iCurIndex = strToSplit.length();
        String strUnitInfo = "";
        int iCurCounts = 0;
        while ((iCurIndex != -1) && (iFromIndex < strToSplit.length())
                && (iCurCounts < iLimit)) {
            iCurIndex = strToSplit.indexOf(strSeparator, iFromIndex);
            if (iCurIndex == -1) {
                strUnitInfo = strToSplit.substring(iFromIndex, strToSplit
                        .length());
            } else {
                strUnitInfo = strToSplit.substring(iFromIndex, iCurIndex);
                iFromIndex = iCurIndex + 1;
            }
            tmpList.add(strUnitInfo);
            iCurCounts++;
        }
        int iCounts = tmpList.size();
        String tmpArray[] = new String[iCounts];
        for (int i = 0; i < iCounts; i++) {
            tmpArray[i] = (String) tmpList.get(i);
        }
        return tmpArray;
    }
    public static String strIntercept(String src, int len) {
        if (src == null) {
            return "";
        }
        if (src.length() > len) {
            src = String.valueOf(String.valueOf(src.substring(0, len))).concat(
                    "...");
        }
        return src;
    }
    public static String strtochn(String str_in) {
        try {
            String temp_p = str_in;
            if (temp_p == null) {
                temp_p = "";
            }
            String temp = "";
            if (!temp_p.equals("")) {
                byte[] byte1 = temp_p.getBytes("ISO8859_1");
                temp = new String(byte1);
            }
            return temp;
        } catch (Exception e) {
        }
        return "null";
    }
    public static String ISO2GBK(String strvalue) {
        try {
            if (strvalue == null)
                return null;
            else {
                strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK");
                return strvalue;
            }
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * ***************************************************** ??
     * ?????????????????????��?????? ????????param str ??????????????? ????????? ?? ???return String
     * ????????????? ??????? ******************************************************
     */
    public static String cnCodeTrans(String str) {
        String s = "";
        try {
            s = new String(str.getBytes("GB2312"), "8859_1");
        } catch (UnsupportedEncodingException a) {
            System.out.print("chinese thansform exception");
        }
        return s;
    }
    /**
     * ***************************************************** ??
     * ????��?????????????????STaaaa????ST****** ????????param strSource???????????????param
     * strRule???? ????????? ?? ???return false:???????????true:????????? ???????
     * ******************************************************
     */
    public static boolean judgeMatch(String strSource, String strRule) {
        int i = 0;
        // ????????��?
        if ((null == strSource) || (strSource.length() == 0))
            return false;
        // ????????��?
        if ((null == strRule) || (strRule.length() == 0))
            return false;
        // ??????????
        if (strSource.length() > strRule.length())
            return false;
        // ??��???��?
        for (i = 0; i < strRule.length(); i++) {
            // ?????????
            if (strSource.length() < i + 1) {
                break;
            }
            if ((strRule.charAt(i) != '*')
                    && (strSource.charAt(i) != strRule.charAt(i))) {
                return false;
            }
        }
        // ??????????????????????????????'*'?????????
        for (; i < strRule.length(); i++) {
            if (strRule.charAt(i) != '*')
                return false;
        }
        return true;
    }
    public static String column2Property(String column) {
        column = column.toLowerCase();
        int i = column.indexOf("_");
        while (i != -1) {
            if (i != column.length() - 1) {
                char temp = column.charAt(i + 1);
                String strTemp = String.valueOf(temp);
                column = column.replaceFirst("_" + strTemp, strTemp
                        .toUpperCase());
                i = column.indexOf("_");
            } else {
                break;
            }
        }
        return column;
    }
    public static String strArrayToStr(String[] strs, String separator) {
        StringBuffer returnstr = new StringBuffer("");
        if (strs == null)
            return "";
        if (separator == null)
            separator = "";
        for (int i = 0; i < strs.length; i++) {
            returnstr.append(strs[i]);
            if (i < strs.length - 1)
                returnstr.append(separator);
        }
        return returnstr.toString();
    }
    public static String objectArrayToStr(Object[] objects, String separator) {
        StringBuffer returnstr = new StringBuffer("");
        if (objects == null)
            return "";
        if (separator == null)
            separator = "";
        for (int i = 0; i < objects.length; i++) {
            returnstr.append(String.valueOf(objects[i]));
            if (i < objects.length - 1)
                returnstr.append(separator);
        }
        return returnstr.toString();
    }
    public static String listToStr(List element, String separator) {
        StringBuffer returnstr = new StringBuffer("");
        if (element == null)
            return "";
        if (separator == null)
            separator = "";
        Iterator it = element.iterator();
        while (it.hasNext()) {
            returnstr.append(String.valueOf(it.next()));
            if (it.hasNext())
                returnstr.append(separator);
        }
        return returnstr.toString();
    }
    public static String[] listToStrArray(List element) {
        if (element == null || element.size() == 0)
            return null;
        Iterator it = element.iterator();
        String[] strArray = new String[element.size()];
        int i = 0;
        while (it.hasNext()) {
            strArray[i] = String.valueOf(it.next());
            i++;
        }
        return strArray;
    }
    public static List strToList(String str, String separator) {
        if (str == null || str.equals(""))
            return null;
        if (separator == null)
            separator = "";
        String[] strArr = str.split(separator);
        int size = strArr.length;
        List list = new ArrayList();
        for (int i = 0; i < size; i++) {
            list.add(strArr[i]);
        }
        return list;
    }
    public static StringBuffer populate(StringBuffer bf, String value,
                                        boolean isNotLast) {
        if (value == null) {
            return bf;
        }
        // ???????????????????�I??????????????????????????????SQL???????????
        System.out.println(value.replaceAll("'", "''"));
        bf.append("'").append(value.replaceAll("'", "''")).append("'");
        if (isNotLast)
            bf.append(",");
        return bf;
    }
    public static boolean isExist(String str, String substr, String sepatator) {
        if (str == null || str.trim().equals(""))
            return false;
        if (substr == null || substr.trim().equals(""))
            return false;
        String[] strArr = str.split(sepatator);
        int size = strArr.length;
        for (int i = 0; i < size; i++) {
            if (strArr[i].equals(substr))
                return true;
        }
        return false;
    }
    public static boolean isExist(String str, String substr) {
        return isExist(str, substr, ",");
    }
    public static String leftInclude(String str) {
        if (str == null || str.equals(""))
            return str;
        return str + "%";
    }
    public static String rightInclude(String str) {
        if (str == null || str.equals(""))
            return str;
        return "%" + str;
    }
    public static String include(String str) {
        if (str == null || str.equals(""))
            return str;
        return "%" + str + "%";
    }
    public static String nvl(Object source, Object target) {
        return source != null ? String.valueOf(source)
                : (target != null ? String.valueOf(target) : null);
    }
    public static String clob2Str(Object clobValue) throws SQLException {
        return ((Clob) clobValue).getSubString(1, (int) ((Clob) clobValue)
                .length());
    }
    public static String hideFlowStr(String str, int maxLen) {
        if (str == null || maxLen == 0) {
            return "";
        }
        if (str.length() > maxLen) {
            str = str.substring(0, maxLen) + "...";
        }
        return str;
    }
    public static String escapeLuceneSpecialCharacters(String str) {
        if (str == null) {
            return null;
        }
        try {
            StringWriter writer = new StringWriter(str.length() * 2);
            escapeLuceneSpecialCharacterString(writer, str);
            return writer.toString();
        } catch (IOException ex) {
            //LogService.getLogger(StringUtil.class).error(ex.getMessage());
            return null;
        }
    }
    private static void escapeLuceneSpecialCharacterString(Writer out,
                                                           String str) throws IOException {
        if (str == null) {
            return;
        }
        int sz = str.length();
        for (int i = 0; i < sz; i++) {
            char ch = str.charAt(i);
            /*
             * Reference link:
			 * http://lucene.apache.org/java/docs/queryparsersyntax.html Lucene
			 * supports escaping special characters that are part of the query
			 * syntax. The current list special characters are: + - && || ! ( ) { } [ ] ^ " ~ * ? : \
			 * To escape these character use the \ before the character.
			 */
            switch (ch) {
                case '+':
                case '-':
                case '!':
                case '(':
                case ')':
                case '{':
                case '}':
                case '[':
                case ']':
                case '^':
                case '\"':
                case '~':
                case '*':
                case '?':
                case ':':
                case '\\':
                    out.write('\\');
                    out.write(ch);
                    break;
                case '&':
                case '|':
                    // check if it is '&&' or '||' ~ check if the next char is '&'
                    // or '|'
                    if ((i + 1) < sz && str.charAt(i + 1) == ch) {
                        out.write('\\');
                        out.write(ch);
                        i++;
                    }
                    out.write(ch);
                    break;
                default:
                    out.write(ch);
                    break;
            }
        }
    }
    public static String getFirstLetter(String chinese) {
        final int[] li_SecPosValue = {1601, 1637, 1833, 2078, 2274, 2302,
                2433, 2594, 2787, 3106, 3212, 3472, 3635, 3722, 3730, 3858,
                4027, 4086, 4390, 4558, 4684, 4925, 5249, 5590};
        final String[] lc_FirstLetter = {"A", "B", "C", "D", "E", "F", "G",
                "H", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
                "W", "X", "Y", "Z"};
        if (chinese == null || chinese.trim().length() == 0) {
            return "";
        }
        chinese = conversionStr(chinese, "GB2312", "ISO8859-1");
        if (chinese.length() > 1) { // ?��?????????
            int li_SectorCode = (int) chinese.charAt(0); // ????????
            int li_PositionCode = (int) chinese.charAt(1); // ????��??
            li_SectorCode = li_SectorCode - 160;
            li_PositionCode = li_PositionCode - 160;
            int li_SecPosCode = li_SectorCode * 100 + li_PositionCode;// ??????��??
            if (li_SecPosCode > 1600 && li_SecPosCode < 5590) {
                for (int i = 0; i < 23; i++) {
                    if (li_SecPosCode >= li_SecPosValue[i]
                            && li_SecPosCode < li_SecPosValue[i + 1]) {
                        chinese = lc_FirstLetter[i];
                        break;
                    }
                }
            } else {
                chinese = conversionStr(chinese, "ISO8859-1", "GB2312");
                chinese = chinese.substring(0, 1);
            }
        }
        return chinese;
    }
    private static String conversionStr(String str, String charsetName,
                                        String toCharsetName) {
        try {
            str = new String(str.getBytes(charsetName), toCharsetName);
        } catch (UnsupportedEncodingException ex) {
        }
        return str;
    }
    public static String checkStr(String html) {
        try {
            html = html.replaceAll("\r", "");
            html = html.replaceAll("\n", "");
            html = html.replaceAll("\"", "'");
            html = html.replaceAll("\t", " ");
            Pattern p_script;
            Matcher m_script;
            Pattern p_href;
            Matcher m_href;
            Pattern p_a;
            Matcher m_a;
            Pattern p_on;
            Matcher m_on;
            Pattern p_iframe;
            Matcher m_iframe;
            Pattern p_frameset;
            Matcher m_frameset;
            Pattern p_img;
            Matcher m_img;
            Pattern p_p1;
            Matcher m_p1;
            Pattern p_p2;
            Matcher m_p2;
            String stript_str = "<script[\\s\\S]+</script *>";
            String href_str = " href *= *[\\s\\S]*script *:";
            String on_str = " on[\\s\\S]*=";
            String iframe_str = "<iframe[\\s\\S]+</iframe *>";
            String frameset_str = "<frameset[\\s\\S]+</frameset *>";
            String a_str = "<a ([^>])*>.*?</a([^>])*>";
            //String img_str = "\\<img[^\\>]+\\>";
            String p_str1 = "</p>";
            String p_str2 = "<p>";
            p_script = Pattern.compile(stript_str, Pattern.CASE_INSENSITIVE);
            m_script = p_script.matcher(html);
            html = m_script.replaceAll(""); // ????script???
            p_href = Pattern.compile(href_str, Pattern.CASE_INSENSITIVE);
            m_href = p_href.matcher(html);
            html = m_href.replaceAll(""); // ????script???
            p_a = Pattern.compile(a_str, Pattern.CASE_INSENSITIVE);
            m_a = p_a.matcher(html);
            html = m_a.replaceAll(""); // ????script???
            p_on = Pattern.compile(on_str, Pattern.CASE_INSENSITIVE);
            m_on = p_on.matcher(html);
            html = m_on.replaceAll(""); // ????script???
            p_iframe = Pattern.compile(iframe_str, Pattern.CASE_INSENSITIVE);
            m_iframe = p_iframe.matcher(html);
            html = m_iframe.replaceAll(""); // ????script???
            p_frameset = Pattern
                    .compile(frameset_str, Pattern.CASE_INSENSITIVE);
            m_frameset = p_frameset.matcher(html);
            html = m_frameset.replaceAll(""); // ????script???
            // p_img = Pattern.compile(img_str, Pattern.CASE_INSENSITIVE);
            // m_img = p_img.matcher(html);
            // html = m_img.replaceAll(""); // ????script???
            p_p1 = Pattern.compile(p_str1, Pattern.CASE_INSENSITIVE);
            m_p1 = p_p1.matcher(html);
            html = m_p1.replaceAll(""); // ????script???
            p_p2 = Pattern.compile(p_str2, Pattern.CASE_INSENSITIVE);
            m_p2 = p_p2.matcher(html);
            html = m_p2.replaceAll(""); // ????script???
        } catch (Exception e) {
            System.err.println("Html2Text: " + e.getMessage());
        }
        return html;
    }
    public static String substr(String value, int maxlength, String postfix) {
        int k = 0;
        int l = 0;
        for (int i = 0; i < value.length() && maxlength > l * 2 + k; i++) {
            if (value.charAt(i) > '\200') {
                l++;
            } else {
                k++;
            }
        }
        if (l + k >= value.length()) {
            return value;
        } else if (maxlength >= l * 2 + k && l + k > 0) {
            value = value.substring(0, l + k);
        } else if (l + k > 0) {
            value = value.substring(0, (l + k) - 1);
        } else {
            return value;
        }
        if (!StringUtils.isEmpty(postfix)) {
            value += postfix;
        }
        return value;
    }
    public String nullToSpace(String Content) {
        if (Content == null) {
            Content = "";
        }
        return Content;
    }
    public String GBK2ISO(String strvalue) throws Exception {
        try {
            if (strvalue == null)
                return null;
            else {
                strvalue = new String(strvalue.getBytes("GBK"), "ISO8859_1");
                return strvalue;
            }
        } catch (Exception e) {
            return null;
        }
    }
    public static   String replaceBlank(String str) {
        String dest = "";
        if (str!=null) {
            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
            Matcher m = p.matcher(str);
            dest = m.replaceAll("");
        }
        return dest;
    }
}

+ 115 - 0
src/main/java/com/yihu/wlyy/util/WebserviceUtil.java

@ -0,0 +1,115 @@
package com.yihu.wlyy.util;
/*import org.apache.axis.client.Call;
import org.apache.axis.client.Service;*/
import com.yihu.wlyy.entity.WebServiceParamVO;
import org.apache.soap.Constants;
import org.apache.soap.Fault;
import org.apache.soap.encoding.SOAPMappingRegistry;
import org.apache.soap.encoding.soapenc.StringDeserializer;
import org.apache.soap.rpc.Call;
import org.apache.soap.rpc.Parameter;
import org.apache.soap.rpc.Response;
import org.apache.soap.transport.http.SOAPHTTPConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.namespace.QName;
import java.net.URL;
import java.util.Map;
import java.util.Vector;
/**
 * Created by hzp on 2017/7/31.
 * webservice调用服务
 **/
public class WebserviceUtil {
    private static Logger logger = LoggerFactory.getLogger(WebserviceUtil.class);
/*
    *//**
     * webservice 调用接口
     *//*
    public static String post(String urlString,String namespace,String api, Map<String,String> params) throws Exception {
        try {
            Service service = new Service();
            // 通过service创建call对象
            Call call = (Call) service.createCall();
            // 设置service所在URL
            call.setTargetEndpointAddress(new java.net.URL(urlString));
            call.setOperationName(new QName(namespace, api));
            call.setUseSOAPAction(true);
            Object[] objs = null;
            if (params != null && params.size() > 0) {
                objs = new Object[params.size()];
                int i = 0;
                for (String key : params.keySet()) {
                    logger.info("=======>参数key:" + key);
                    //接口的参数
                    call.addParameter(new QName(key), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
                    logger.info("=======>参数值:" + params.get(key));
                    objs[i] = params.get(key);
                    i++;
                }
            }
            //设置返回类型
            call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
            String ret = (String) call.invoke(objs);
            logger.info("=======>请求结果.toString():" + ret.toString());
            return ret.toString();
        } catch (Exception e) {
            logger.info("=======>CA请求报错:" + e.getMessage());
            e.printStackTrace();
            throw e;
        }
    }*/
    /**
     * 通过soap方式访问接口
     *
     * @param paramVO
     * @throws Exception
     */
    public static String callMethod(WebServiceParamVO  paramVO) throws Exception {
        SOAPMappingRegistry smr = new SOAPMappingRegistry();
        StringDeserializer sd = new StringDeserializer();
        smr.mapTypes(Constants.NS_URI_SOAP_ENC, new org.apache.soap.util.xml.QName("", "return"), null,
                null, sd);
        // 创建传输路径和参数
        SOAPHTTPConnection st = new SOAPHTTPConnection();
        // 创建调用
        Call call = new Call();
        call.setSOAPTransport(st);
        call.setSOAPMappingRegistry(smr);
        call.setTargetObjectURI(paramVO.getTargetObjectURI());
        call.setMethodName(paramVO.getMethodName());
        call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
        Vector<Parameter> params = getParameter(paramVO);
        call.setParams(params);
        URL url = new URL(paramVO.getWsdlUrl());
        Response resp = call.invoke(url, paramVO.getSoapAction());
        if (resp == null) {
            return null;
        }
        if (resp.generatedFault()) {
            Fault fault = resp.getFault();
            throw new Exception(fault.getFaultString());
        }
        Parameter ret = resp.getReturnValue();
        Object value = ret.getValue();
        return (String) value;
    }
    private static Vector<Parameter> getParameter(WebServiceParamVO paramVO) {
        Vector<Parameter> params = new Vector<Parameter>();
        params.addElement(new Parameter("ServerInfo",String.class, paramVO.getServerInfo(), null));
        params.addElement(new Parameter("RegMsg",String.class, paramVO.getRegMsg(), null));
        return params;
    }
}

+ 2 - 0
src/mqConfig/esbmq-config.xml

@ -43,6 +43,8 @@
				<MS53001_1>EwellQ.S60.MS53001.GET</MS53001_1>
				<MS25001_0>EwellQ.S60.MS25001.PUT</MS25001_0>
				<MS25001_1>EwellQ.S60.MS25001.GET</MS25001_1>
				<MS25002_0>EwellQ.S60.MS25002.PUT</MS25002_0>
				<MS25002_1>EwellQ.S60.MS25002.GET</MS25002_1>
			</QUEUES>
		</QMGR.S60>
	</MQCONFIG>