PJDataSerivceSoap_PJDataSerivceSoap12_Client.java 4.26 KB

package com.bsth.wsdl;

/**
 * Please modify this class to meet your needs
 * This class is not complete
 */

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.bsth.util.XmlToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.xml.namespace.QName;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
/**
 * This class was generated by Apache CXF 3.3.2
 * 2019-06-25T10:55:23.727+08:00
 * Generated source version: 3.3.2
 *
 */
public final class PJDataSerivceSoap_PJDataSerivceSoap12_Client {

    @Autowired
    JdbcTemplate jdbcTemplate;

    private static final QName SERVICE_NAME = new QName("http://www.pd-transport.com/", "PJDataSerivce");

    private PJDataSerivceSoap_PJDataSerivceSoap12_Client() {
    }

    public static void main(String args[]) throws Exception {
        URL wsdlURL = PJDataSerivce.WSDL_LOCATION;
        if (args.length > 0 && args[0] != null && !"".equals(args[0])) {
            File wsdlFile = new File(args[0]);
            try {
                if (wsdlFile.exists()) {
                    wsdlURL = wsdlFile.toURI().toURL();
                } else {
                    wsdlURL = new URL(args[0]);
                }
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
        }

        PJDataSerivce ss = new PJDataSerivce(wsdlURL, SERVICE_NAME);
        PJDataSerivceSoap port = ss.getPJDataSerivceSoap12();

        {
        System.out.println("Invoking getRetiredInfor...");
        String _getRetiredInfor_unintCode = "KD01.0110";
        String _getRetiredInfor_beginDate = "1900-01-01";
        String _getRetiredInfor_endDate = "2019-06-25";
        String _getRetiredInfor__return = port.getRetiredInfor(_getRetiredInfor_unintCode, _getRetiredInfor_beginDate, _getRetiredInfor_endDate);

        JSONObject jsonInfor = XmlToJson.xml2Json(_getRetiredInfor__return);
        System.out.println("getRetiredInfor.result=" + _getRetiredInfor__return);
            JSONArray jsonArr = JSONArray.parseArray(jsonInfor.get("Retire").toString());
            for(int i=0;i<jsonArr.size()-1; i++){
                JSONObject pjson =  jsonArr.getJSONObject(i);
                String codeArr[] = pjson.getString("Code").split("-");
//                if(pjson.getString("EmployeeName").equals("潘英") || pjson.getString("EmployeeName").equals("陆志兴")|| pjson.getString("EmployeeName").equals("沈志钢")){
//                    System.out.print(pjson);
//                }
//                if(codeArr.length > 1){
//                    if(codeArr[1].equals("016007") || codeArr[1].equals("006005") || codeArr[1].equals("005634")  || codeArr[1].equals("007969")){
//                        System.out.print(pjson);
//                    }
//                } else {
//                    System.out.print(codeArr);
//                }
            }

        }
//        {
//        System.out.println("Invoking getPAItem...");
//        int _getPAItem_year = 0;
//        int _getPAItem_period = 0;
//        String _getPAItem__return = port.getPAItem(_getPAItem_year, _getPAItem_period);
//        System.out.println("getPAItem.result=" + _getPAItem__return);
//
//
//        }

        {
        System.out.println("Invoking getEmployee...");
        String _getEmployee_unintCode = "KD01.0112";
        String _getEmployee_idCard = "";
        String _getEmployee__return = port.getEmployee(_getEmployee_unintCode, _getEmployee_idCard);
        JSONObject jsonInfor = XmlToJson.xml2Json(_getEmployee__return);
        JSONArray jsonArr = JSONArray.parseArray(jsonInfor.get("Emp").toString());
        jsonArr.getJSONObject(0).get("Code");
//            jsonArr =  JSONArray.fromObject(jsonInfor.get("Emp").toString());
        System.out.println("getEmployee.result=" + _getEmployee__return);
        for(int i=0;i<jsonArr.size()-1; i++){
                JSONObject pjson =  jsonArr.getJSONObject(i);
                String codeArr[] = pjson.getString("Code").split("-");
            if(codeArr[1].equals("016007") || codeArr[1].equals("006005") || codeArr[1].equals("005634")  || codeArr[1].equals("007969")){
                System.out.print(pjson);
            }
        }

        }

        System.exit(0);
    }

}