wanghc
2023-07-04 a042e0e63f86a0880d20e57c14ec4a60b65801fb
浦发分行受托支付
25 files deleted
1 files added
5 files modified
10615 ■■■■■ changed files
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/conf/GlobalExceptionHandler.java 4 ●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/controller/TradeController.java 41 ●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/metadata/ObjectFactory.java 48 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/metadata/ReqHeaderType.java 286 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/metadata/RspHeaderType.java 258 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/metadata/package-info.java 2 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/services/ITradeService.java 19 ●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/services/impl/TradeServiceImpl.java 60 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/services/wsdl/ESBServerPortType.java 62 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/services/wsdl/S080030795.java 87 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/util/ObjectFactory.java 1886 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/util/OkHttpUtil.java 63 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/util/XmlUtils.java 83 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/req/trade/ReqEPCSnglTranType.java 1615 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/req/trade/ReqPymtTrnRsltQryType.java 213 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/req/trade/ReqSvcHeaderType.java 809 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/req/trade/ReqTranQryType.java 426 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/req/trade/ReqWHPymtTrnRsltQryType.java 213 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/ResponseVo.java 36 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/RspEPCSnglTranType.java 623 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/RspPymtTrnRsltQryType.java 155 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/RspSvcHeaderType.java 547 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/RspTranQryType.java 1550 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/RspWHPymtTrnRsltQryType.java 155 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/SubSvcRetInfoType.java 176 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/resources/wsdl/DU90.wsdl 134 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/resources/wsdl/DU90.xsd 409 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/resources/wsdl/DU93.wsdl 134 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/resources/wsdl/DU93.xsd 409 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/resources/wsdl/SoapHeader.xsd 28 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/test/java/com/jttech/pfcs/services/WsdlTest.java 84 ●●●●● patch | view | raw | blame | history
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/conf/GlobalExceptionHandler.java
@@ -2,6 +2,7 @@
import com.jttech.pfcs.vo.resp.ResponseVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
@@ -18,9 +19,12 @@
@ControllerAdvice
public class GlobalExceptionHandler {
    private Logger mLogger = LoggerFactory.getLogger(getClass());
    @ResponseBody
    @ExceptionHandler(Exception.class)
    public ResponseVo exceptionHandler(HttpServletRequest request, Exception exception) {
        mLogger.error("请求发生异常 error={}", exception);
        String errMsg = StringUtils.isEmpty(exception.getMessage()) ? "服务异常" : exception.getMessage();
        //截取前面20个字符
        errMsg = errMsg.substring(0,Math.min(20, errMsg.length()));
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/controller/TradeController.java
@@ -1,18 +1,14 @@
package com.jttech.pfcs.controller;
import com.jttech.pfcs.services.ITradeService;
import com.jttech.pfcs.vo.resp.ResponseVo;
import com.jttech.pfcs.vo.req.trade.ReqEPCSnglTranType;
import com.jttech.pfcs.vo.req.trade.ReqTranQryType;
import com.jttech.pfcs.vo.resp.trade.RspEPCSnglTranType;
import com.jttech.pfcs.vo.resp.trade.RspTranQryType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jttech.pfcs.services.ITradeService;
import com.jttech.pfcs.vo.resp.ResponseVo;
/**
 * @author wanghc
@@ -29,39 +25,20 @@
    /**
     * 单笔交易
     * @param reqVo
     * @param content
     * @return
     */
    @PostMapping("/epcSnglTran")
    public ResponseVo epcSnglTran(@RequestBody ReqEPCSnglTranType reqVo) {
        mLogger.info("TradeController.epcSnglTran req={}", reqVo);
    @PostMapping("/excute")
    public ResponseVo excute(String url, String content) {
        mLogger.info("TradeController.excute excute={}", content);
        final long beginTime = System.currentTimeMillis();
        ResponseVo result = new ResponseVo();
        try {
            RspEPCSnglTranType body = mTradeService.epcSnglTran(reqVo);
            String body = mTradeService.excute(url, content);
            return result.setBody(body);
        } finally {
            final long endTime = System.currentTimeMillis();
            mLogger.info("Execute epcSnglTran the result is {} time spent is {} ", result, (endTime - beginTime));
        }
    }
    /**
     * 单笔交易
     * @param reqVo
     * @return
     */
    @PostMapping("/tranQry")
    public ResponseVo tranQry(@RequestBody ReqTranQryType reqVo) {
        mLogger.info("TradeController.tranQry req={}", reqVo);
        final long beginTime = System.currentTimeMillis();
        ResponseVo result = new ResponseVo();
        try {
            RspTranQryType body = mTradeService.tranQry(reqVo);
            return result.setBody(body);
        } finally {
            final long endTime = System.currentTimeMillis();
            mLogger.info("Execute tranQry the result is {} time spent is {} ", result, (endTime - beginTime));
            mLogger.info("Execute excute the result is {} time spent is {} ", result, (endTime - beginTime));
        }
    }
}
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/metadata/ObjectFactory.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/metadata/ReqHeaderType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/metadata/RspHeaderType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/metadata/package-info.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/services/ITradeService.java
@@ -1,10 +1,5 @@
package com.jttech.pfcs.services;
import com.jttech.pfcs.vo.req.trade.ReqEPCSnglTranType;
import com.jttech.pfcs.vo.req.trade.ReqTranQryType;
import com.jttech.pfcs.vo.resp.trade.RspEPCSnglTranType;
import com.jttech.pfcs.vo.resp.trade.RspTranQryType;
/**
 * @author wanghc
 * @version 1.0.0
@@ -13,17 +8,9 @@
public interface ITradeService {
    /**
     * 单笔交易
     * @param reqVo
     * excute
     * @param content
     * @return
     */
    RspEPCSnglTranType epcSnglTran(ReqEPCSnglTranType reqVo);
    /**
     * 交易查询
     * @param req
     * @return
     */
    RspTranQryType tranQry(ReqTranQryType req);
    String excute(String url, String content);
}
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/services/impl/TradeServiceImpl.java
@@ -1,16 +1,13 @@
package com.jttech.pfcs.services.impl;
import com.jttech.pfcs.services.ITradeService;
import com.jttech.pfcs.services.wsdl.ESBServerPortType;
import com.jttech.pfcs.services.wsdl.S080030795;
import com.jttech.pfcs.vo.req.trade.ReqEPCSnglTranType;
import com.jttech.pfcs.vo.req.trade.ReqTranQryType;
import com.jttech.pfcs.vo.resp.trade.RspEPCSnglTranType;
import com.jttech.pfcs.vo.resp.trade.RspTranQryType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;
import com.jttech.pfcs.services.ITradeService;
import com.jttech.pfcs.util.OkHttpUtil;
import okhttp3.*;
/**
 * @author wanghc
@@ -18,42 +15,33 @@
 * @date 2023-03-07
 */
@Service
public class TradeServiceImpl implements ITradeService, InitializingBean {
public class TradeServiceImpl implements ITradeService {
    private Logger mLogger = LoggerFactory.getLogger(getClass());
    private ESBServerPortType mESBServerPortType;
    @Override
    public void afterPropertiesSet() throws Exception {
        mESBServerPortType = new S080030795().getESBServerSoapEndpoint();
    }
    /**
     * 单笔交易
     * excute
     *
     * @param reqVo
     * @param content
     * @return
     */
    @Override
    public RspEPCSnglTranType epcSnglTran(ReqEPCSnglTranType reqVo) {
        mLogger.info("TradeServiceImpl.epcSnglTran req={}", reqVo);
        RspEPCSnglTranType result = mESBServerPortType.epcSnglTran(reqVo);
        mLogger.info("TradeServiceImpl.epcSnglTran resp={}", result);
        return result;
    }
    /**
     * 交易查询
     *
     * @param req
     * @return
     */
    @Override
    public RspTranQryType tranQry(ReqTranQryType req) {
        mLogger.info("TradeServiceImpl.tranQry req={}", req);
        RspTranQryType result = mESBServerPortType.tranQry(req);
        mLogger.info("TradeServiceImpl.tranQry resp={}", result);
    public String excute(String url, String content) {
        mLogger.info("TradeServiceImpl.excute req={}", content);
        String result = "";
        try {
            OkHttpClient.Builder builder = new OkHttpClient.Builder()
                    .sslSocketFactory(OkHttpUtil.getIgnoreInitedSslContext().getSocketFactory(), OkHttpUtil.IGNORE_SSL_TRUST_MANAGER_X509)
                    .hostnameVerifier(OkHttpUtil.getIgnoreSslHostnameVerifier());
            RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), content);
            Request request = new Request.Builder().url(url).post(requestBody).build();
            Response response = builder.build().newCall(request).execute();
            result = response.body().string();
        } catch (Exception e) {
            mLogger.error("TradeServiceImpl.excute error={}", e);
            throw new RuntimeException(e.getMessage());
        }
        mLogger.info("TradeServiceImpl.excute resp={}", result);
        return result;
    }
}
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/services/wsdl/ESBServerPortType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/services/wsdl/S080030795.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/util/ObjectFactory.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/util/OkHttpUtil.java
New file
@@ -0,0 +1,63 @@
package com.jttech.pfcs.util;
import javax.net.ssl.*;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
/**
 *
 * @author Jeter
 *
 */
public class OkHttpUtil {
    /**
     * X509TrustManager instance which ignored SSL certification
     */
    public static final X509TrustManager IGNORE_SSL_TRUST_MANAGER_X509 = new X509TrustManager() {
        @Override
        public void checkClientTrusted(X509Certificate[] chain, String authType) {
        }
        @Override
        public void checkServerTrusted(X509Certificate[] chain, String authType) {
        }
        @Override
        public X509Certificate[] getAcceptedIssuers() {
            return new X509Certificate[] {};
        }
    };
    /**
     * Get initialized SSLContext instance which ignored SSL certification
     *
     * @return
     * @throws NoSuchAlgorithmException
     * @throws KeyManagementException
     */
    public static SSLContext getIgnoreInitedSslContext() {
        try {
            SSLContext sslContext = SSLContext.getInstance("SSL");
            sslContext.init(null, new TrustManager[] { IGNORE_SSL_TRUST_MANAGER_X509 }, new SecureRandom());
            return sslContext;
        } catch (Exception e) {
            throw new RuntimeException("SSL 初始化异常");
        }
    }
    /**
     * Get HostnameVerifier which ignored SSL certification
     *
     * @return
     */
    public static HostnameVerifier getIgnoreSslHostnameVerifier() {
        return new HostnameVerifier() {
            @Override
            public boolean verify(String arg0, SSLSession arg1) {
                return true;
            }
        };
    }
}
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/util/XmlUtils.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/req/trade/ReqEPCSnglTranType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/req/trade/ReqPymtTrnRsltQryType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/req/trade/ReqSvcHeaderType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/req/trade/ReqTranQryType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/req/trade/ReqWHPymtTrnRsltQryType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/ResponseVo.java
@@ -4,6 +4,7 @@
/**
 * 基础返回对象
 *
 * @author wanghc
 * @version 1.0.0
 * @date 2023-03-07
@@ -14,30 +15,38 @@
    /**
     * 错误码 等于0为成功
     */
    private int errorCode = 0;
    private int               errorCode        = 0;
    /**
     * 异常信息
     */
    private String errMsg = "操作成功";
    private String            errMsg           = "操作成功";
    /**
     * 内容对象
     */
    private Object body;
    private Object            body;
    public static ResponseVo ok(Object body) {
        return new ResponseVo(body);
    }
    public static ResponseVo ok() {
        return new ResponseVo();
    }
    public static ResponseVo fail(int errorCode, String errMsg) {
        return new ResponseVo(errorCode, errMsg, null);
    }
    public ResponseVo() {
    }
    public ResponseVo(int pErrorCode, String pErrMsg, Object pBody) {
        errorCode = pErrorCode;
@@ -45,32 +54,53 @@
        body = pBody;
    }
    public ResponseVo(Object pBody) {
        body = pBody;
    }
    public int getErrorCode() {
        return errorCode;
    }
    public void setErrorCode(int pErrorCode) {
        errorCode = pErrorCode;
    }
    public String getErrMsg() {
        return errMsg;
    }
    public void setErrMsg(String pErrMsg) {
        errMsg = pErrMsg;
    }
    public Object getBody() {
        return body;
    }
    public ResponseVo setBody(Object pBody) {
        body = pBody;
        return this;
    }
    @Override
    public String toString() {
        return "ResponseVo{" + "errorCode=" + errorCode + ", errMsg='" + errMsg + '\'' + ", body=" + body + '}';
    }
}
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/RspEPCSnglTranType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/RspPymtTrnRsltQryType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/RspSvcHeaderType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/RspTranQryType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/RspWHPymtTrnRsltQryType.java
File was deleted
cmci-pfcs-gateway/src/main/java/com/jttech/pfcs/vo/resp/trade/SubSvcRetInfoType.java
File was deleted
cmci-pfcs-gateway/src/main/resources/wsdl/DU90.wsdl
File was deleted
cmci-pfcs-gateway/src/main/resources/wsdl/DU90.xsd
File was deleted
cmci-pfcs-gateway/src/main/resources/wsdl/DU93.wsdl
File was deleted
cmci-pfcs-gateway/src/main/resources/wsdl/DU93.xsd
File was deleted
cmci-pfcs-gateway/src/main/resources/wsdl/SoapHeader.xsd
File was deleted
cmci-pfcs-gateway/src/test/java/com/jttech/pfcs/services/WsdlTest.java
File was deleted