You can spray me if you don’t understand

Project needs to access the new pay channels: unionpay jump pay, take a little bit of time to access to success here released a record on pit, in the process of the problem would be to share the QAQ, finish see don’t understand you to spray I o (╯ / ╰) o blog have access to other payment alipay: blog.csdn.net/hu150813982… WeChat: https://blog.csdn.net/hu15081398237/article/details/94721290

Eventually all the source code and the documentation used will be uploaded to Git

preface

For example, with the continuous development of artificial intelligence, machine learning is becoming more and more important. Many people have started to learn machine learning. This article introduces the basic content of machine learning. Tip: The following is the body of this article, the following cases for reference

A website,

Open.unionpay.com/tjweb/user/… You can view related parameters after personal login

== In fact, before access to payment, we recommend that you understand symmetric encryption, such as symmetric encryption RSA, abstract algorithm, HTTPS, certificate and other knowledge points, because the code behind the check, judgment is based on this. Initialize and load the certificate, and determine whether the certificate is correct, expired, or changed in a string

Two, the use of steps

1. Download the official code

Open.unionpay.com/tjweb/acpro…Support for access to 3 languages, only the Java version here. I also refactored the code later, since demo projects can’t be directly embedded into production projects

Project Demonstration (Example) : Because I access the token version, I only check the token code. The payment of UnionPay involves both Web and token, which are almost the same except that the input parameter types are different

2. Be sure to read this paragraph carefully against the project structure

ACPSample – WuTiaoZhuan │ ├ SRC ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ class folder │ │ │ ├ assets ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ related resources directory │ │ │ │ ├ assets ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ related resources directory │ │ │ │ │ ├ apache_httpclient ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ apache HTTP post method of │ │ │ │ │ ├ test environment certificate │ │ │ │ │ │ │ ├ acp_test_enc. Cer ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ │ │ ├acp_test_sign. PFX ┈┈┈┈┈┈┈┈┈ │ │ │ ├acp_test_sign. PFX ┈┈┈┈┈┈┈┈┈ │ │ │ ├acp_test_sign. PFX └ │ ├ ─ 0├ acp_test_middle ┈┈┈┈┈┈┈┈┈ │ │ │ ├ ─ ├ acp_test_middle ┈┈┈┈┈┈┈┈┈ │ │ │ ├ │ ├ 802310848924_20150905. Zip ┈┈┈┈┈┈┈┈┈ │ │ │ ├ │ ├ 802310848924_20150905. │ │ ├ │ ├acp_test_sign_inst. PFX ┈┈┈┈┈┈┈┈┈ │ │ │ │ ├acp_test_sign_inst │ │ ├ ─ ├ acp_dk.properties ┈┈┈┈┈┈┈┈┈ │ │ ├ ─ ├ acp_dk.properties │ │ ├ │ ├ acp_sdk. Properties ┈┈┈┈┈┈┈┈┈ │ │ │ ├ │ ├ │ ├ acp_sdk │ │ ├ acp_Prod_root. Cer ┈┈┈┈┈┈┈┈┈ │ │ │ ├ acp_Prod_root │ │ ├ ─ ├com.unionpay.acp. Demo │ │ ├ ─ ├.unionpay, unionpay, unionpay, unionpay, unionpay, unionpay, unionpay │ │ ├ token ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ no jump token transactions related │ │ │ │ │ │ │ ├ Form03_6_2_Token_OpenCard_Back. Java ┈ ┈ ┈ ┈ ┈ merchants side open sample classes (background) │ │ │ │ │ │ │ ├Form03_6_2_Token_OpenCard_Front. Java ┈┈┈┈┈ │ │ │ ├ form03_6_2_token_OpenQuery. Java ┈┈┈┈┈ │ ├ form03_6_3_token_OpenQuery. Java ┈┈┈┈┈ │ ├Form03_6_2_Token_OpenCard_Front │ │ │ │ │ │ ├ Form03_6_4_Token_DeleteToken. Java ┈ ┈ ┈ ┈ ┈ delete token sample classes (background) │ │ │ │ │ │ │ │ ├ form03_6_5_Token_CONSUMption.java ┈┈┈┈┈ │ │ │ │ ├ form03_6_6_token_consumption.java ┈┈┈┈┈ │ ├ form03_6_token_consumption.java │ │ ├ form03_6_6_token_opensms. Java ┈┈┈┈┈ │ │ │ ├Form03_6_7_Token_Consume Java ┈┈┈┈┈ │ │ ├Form03_6_7_Token_Consume │ │ │ ├Form03_6_7_Token_OpenAndConsume. ┈┈┈┈┈ │ │ │ ├Form03_6_7_Token_OpenAndConsume └ │ ├ │ ├ Back.txt ┈┈┈┈ │ │ ├ │ ├ Back.txt ┈┈┈┈┈ │ │ │ ├.txt ├ DemoBase. Java ┈ ┈ ┈ ┈ ┈ base class │ │ │ │ │ ├ EncryptCerUpdateQuery. Java ┈ ┈ ┈ ┈ ┈ encryption certificate update sample classes (background) │ │ │ │ │ │ ├ form03_6_3_consumeundo. Java ┈┈┈┈┈ │ │ │ ├Form03_6_4_Refund ├ form03_6_5_query. Java ┈┈┈┈┈ Transaction status query example class │ │ │ ├ form03_7_filetransfer. Java ┈┈┈┈┈ Check file download example │ │ │ ├ form03_6_5_query. Java ┈┈┈┈┈ Transaction status query example class │ │ │ ├ form03_7_filetransfer. Java ┈┈┈┈┈ Check file download example │ │ │ ├ frontrcvResponse.java ┈┈┈┈┈ │ │ ├ │ ├com.unionpay.acp. SDK │ │ ├ │ ├ 07.txt ├ AcPService. Java ┈┈┈┈┈┈ │ │ ├ │ ├CertUtil. Java ┈┈┈┈┈┈ │ │ │ ├HttpClient Post communication, You can use apache httpClient │ │ ├LogUtil. Java ┈┈┈┈┈ │ │ │ ├LogUtil ├ sdkConfig. Java ┈┈┈┈┈┈┈ Read the acp_sdk.properties property file and fill in the configuration class │ │ ├SDKConstants. Java ┈┈┈┈┈┈┈ │ │ │ Constants ├ sdkutil. Java ┈┈┈┈┈┈┈SDK tool class, including the signature of the message, Methods of attestation │ │ │ │ │ ├ SecureUtil. Java ┈ ┈ ┈ ┈ ┈ ┈ ┈ safety related tools │ │ │ │ │ └ SM3Digest. Java ┈ ┈ ┈ ┈ ┈ ┈ ┈ sm3 algorithm tools │ │ │ └ web ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ web related classes │ │ │ ├AutoLoadServlet. Java ┈┈┈┈┈┈ Init Read acp_SDK. properties Init Request UnionPay address Certificate and other related resources of the servlet │ │ │ └ CharsetEncodingFilter. Java ┈ ┈ ┈ ┈ web request encoding filter │ ├ acp_sdk. Properties ┈ ┈ ┈ ┈ [important] test environment configuration files, request unionpay address, private key signing certificate, Check the public key path, Properties ┈┈┈┈ Logutil. Java Log class configuration file │ ├WebContent ┈┈┈┈┈┈┈┈┈┈┈┈┈┈ page folder │ │ ├WebContent │ │ ├ web-inf │ ├ lib │ ├ WEB- ├ lib ┈┈┈┈┈┈┈┈┈ You don’t need to import) │ │ │ ├ bcprov jdk15on – 1.54. The jar — — — — — — — — — pay attention to the package name suffix version, Low version of the BC used the method of part of the package does not support the SDK │ │ │ ├ Commons – codec – 1.6 jar │ │ │ ├ Commons – IO – 2.2 jar │ │ │ ├ Commons – lang – 2.5 jar │ │ │ ├ log4j – 1.2.17. Jar │ │ │ ├ slf4j – API – 1.5.11. Jar │ │ │ └ slf4j – log4j12-1.5.11. Jar │ └ readme. TXT ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ instructions text

─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ attention

1. [Interface Specification] Location of the interface reference document: Interface Product Specification: open.unionpay.com Help Center Download product interface specification No Jump Product Interface Specification Answer code specification: Platform Access Interface Specification – Part 5 – Appendix Description of merchant reconciliation file format: Specification for All-channel Platform Access Interface part 3 File Interface

2. The merchant number 777290058110097 used in the development kit is the test merchant number registered by Open.unionpay.com and can only be used in the network access test environment; You can use this merchant to transact transactions first (of course, you can also register a test merchant number starting with 777 on this website, and open permissions after registering yourself: After login at open.unionpay.com, click my test – My Product – in the upper right corner to make the untested product into the test state, and the permission will be granted after 10 minutes.) Please replace the official online environment with the official merchant number applied, and ensure that the merchant number has the corresponding permission. If there is no error such as the transaction permission, Please contact the business personnel you apply for access to UnionPay to confirm whether you have opened the corresponding authority for the transaction.

3. [About the configuration file] You can find the configuration file in the SRC/Assets folder. By default, the configuration file under SRC is signed in certificate mode in the test environment. Follow the instructions in the configuration file. You need to set the certificate path when using the certificate. Except for the signed certificate in the production environment, which can be downloaded by service email, other certificates are provided in the SRC/Assets folder and need to be copied to the path configured in the configuration file.

4. 1) test process encounter problems 】 【 priority to find the answer in the open platform: in the process of debugging problems or other problems please in open.unionpay.com/ajweb/help/… Help center search solutions in the process of testing the FAQ seven response code problem question please enter a response code search solution at https://open.unionpay.com/ajweb/help/respCode/respCodeList 2) Test environment test payment please use test card number test, FAQ search “test card”. 3) For details about switching the production environment, search for Switching in the FAQ.

5. [Problems encountered in production environment] If the problems encountered in connection with unionPay production environment test cannot be solved through the Open platform, please log on merchant.unionpay.com menu “Service Order Management “->” Create service Order” to request troubleshooting.


3. Set project startup parameters

Since you need to verify various types of certificates to start the project, you need to copy the certificates in the Assert directory to disk and put them in the path in the configuration file as follows

4. Rely on the jar

Since the current project is not a Maven project but a normal Web project with various JAR dependencies, you can configure the lib directory in the web path of the project. If you have any problems, please refer to the documentation of the current directory

5. Tomcat startup project

In fact, this document written by UnionPay is quite good. Is in the process of the various problems involved in the need to understand their own. After all, it is an old version, so some technical details are different, such as passing parameters that are not JSON.

6. Pay

The project has been started normally, so LET’s take you to know its payment process. Here is a brief introduction, and then directly on the code. In fact, all payment is to produce the order, request the interface defined by the third-party payment, pass the parameters of the specification, and then the payer will return a synchronous notification, and an asynchronous notification, and implement your business processing in both notifications.

= = synchronous and asynchronous notifications are need access to networks outside connection address, so you need a network through tools, I have been using natapp blog.csdn.net/hu150813982… There I introduce use natapp letter detail steps, here today is used uTools = = https://u.tools/docs/guide/about-uTools.html it provides penetration function

When your project is successfully launched, then use the current tool to map the address successfully, and then you can use the link to access your project. This project can be accessed from the Internet

7. A brief introduction of unionPay’s own project code

Suggest you look at their first code, after running through their integration, we are generally at a glance, our architecture began to encapsulate, after all is big, but we are behind on hole, and I call it the original code, analysis into the ginseng, ginseng, combined with our code analysis problem, tend to be out in the problem of parameter passing

== After you are connected, you need to test with the information provided by them. If there is a problem, you can find and search this address. Unionpay this respect is doing a good job = = open.unionpay.com/tjweb/suppo…

8. Integrated SpringBoot project

User-defined starter Initializes items

Note the equivalent of the JDK SPI,doubo SPI:

9. The Springboot project is started

10. Payment explanation, first look at the picture, behind the Demo code, notes are very clear

The preceding parameters are required information

11. Sample code explanation

package com.ehs.union.pay.spring.boot.demo.controller;


import com.esh.union.pay.sdk.bean.config.UnionPayConfig;
import com.esh.union.pay.sdk.bean.consts.*;
import com.esh.union.pay.sdk.bean.request.UnionOpenAllChannelAndPayRequest;
import com.esh.union.pay.sdk.service.UnionPayService;
import com.esh.union.pay.sdk.utils.UnionStrUtil;
import com.esh.union.pay.sdk.utils.sign.CertDescriptor;
import com.esh.union.pay.sdk.utils.sign.UnionSecureUtil;
import com.esh.union.pay.sdk.utils.sign.UnionSignUtil;
import com.esh.union.pay.sdk.utils.sign.encrypt.RSA2;
import com.esh.union.pay.sdk.utils.sign.encrypt.X509;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.security.PrivateKey;
import java.util.*;


/** * No jump payment **@author huyufan
 * @date2020/11/8 now * /
@Controller
@RequestMapping(value = "/pay")
public class PayController {


    protected static final Logger log = LoggerFactory.getLogger(PayController.class);


    @Autowired
    private UnionPayService unionPayService;


    @Autowired
    private CertDescriptor certDescriptor;




    /** * Payment request TO UnionPay *@param resp
     * @param openAllChannelAndPayRequest
     */
    @RequestMapping(value = "/yinlian", method = RequestMethod.POST)
    public void toYinlianPay(HttpServletResponse resp, @ModelAttribute(value = "openAllChannelAndPayRequest") UnionOpenAllChannelAndPayRequest openAllChannelAndPayRequest) {
        UnionPayConfig config = unionPayService.getConfig();
        CertDescriptor certDescriptor = unionPayService.getCertDescriptor();
        openAllChannelAndPayRequest.setBizType(UnionBizTypeConsts.BIZ_TYPE_000902);
        openAllChannelAndPayRequest.setTxnTime(DateFormatUtils.format(new Date(), "yyyyMMddHHmmss"));
        //TODO background async callback. BackUrl defaults to the default value required by the official, otherwise it will be verified
        openAllChannelAndPayRequest.setBackUrl(config.getBackUrl());
        openAllChannelAndPayRequest.setCurrencyCode("156");
        openAllChannelAndPayRequest.setTxnType(UnionTxnTypeConsts.TXN_TYPE_01);
        openAllChannelAndPayRequest.setTxnSubType(UnionTxnSubTypeConsts.TXN_SUB_TYPE_01);
        openAllChannelAndPayRequest.setAccessType(UnionAccessTypeConsts.ACCESS_TYPE_0);
        openAllChannelAndPayRequest.setSignature(UnionSignMethodConsts.SIGNMETHOD_01);
        openAllChannelAndPayRequest.setChannelType(UnionChannelTypeConsts.CHANNEL_TYPE_07);
        openAllChannelAndPayRequest.setAccType(UnionAccTypeConsts.ACC_TYPE_01);
        openAllChannelAndPayRequest.setTokenPayData("{trId=99988877766&tokenType=01}");
        openAllChannelAndPayRequest.setAccNo(null);
        // Address of the front desk notification
        openAllChannelAndPayRequest.setFrontUrl(config.getFrontUrl());
        openAllChannelAndPayRequest.setPayTimeout(DateFormatUtils.format(DateUtils.addDays(new Date(), 1), "yyyyMMddHHmmss"));
        //requestopenAllChannelAndPayRequest.setCertId(certDescriptor.getSignCertId()); openAllChannelAndPayRequest.setEncryptCertId(certDescriptor.getEncryptCertId()); Map< String, String> paramMap = openAllChannelAndPayRequest.signAndGetMap(config, certDescriptor.getSignCertPrivateKey(config.getPrivateCertPwd()), config.getPrivateKeyString()); String html = createAutoFormHtml(String.format(UnionUrlConsts.FRONT_TRANS_URL,"test.95516.com"), paramMap, "UTF-8");
        try {
            resp.getWriter().write(html);
        } catch(IOException e) { e.printStackTrace(); }}/** * UnionPay synchronous notification *@param req
     * @return* /
    @RequestMapping("/frontRcvResponse")
    public ModelAndView frontRcvResponse(HttpServletRequest req) {
        String encoding = req.getParameter("encoding");
        log.info("Return message encoding=[" + encoding + "]");
        String pageResult = "";
        if ("UTF-8".equalsIgnoreCase(encoding)) {
            pageResult = "success";
        } else {
            pageResult = "error";
            ModelAndView modelAndView = new ModelAndView(pageResult);
            modelAndView.addObject("result"."Transaction error, please contact administrator.");
            return modelAndView;
        }
        // Get the response data and convert it to mapMap< String, String> respParam = getAllRequestParam(req);// Check the signature collectionMap< String, String> valideData =null;
        StringBuffer page = new StringBuffer();
        // Assemble the collection data
        if (null! = respParam && ! respParam.isEmpty()) { Iterator< Map.Entry< String, String> > it = respParam.entrySet().iterator(); valideData =newHashMap< String, String> (respParam.size());while (it.hasNext()) {
                Map.Entry<String, String> e = it.next();
                String key = (String) e.getKey();
                String value = (String) e.getValue();
                valideData.put(key, value);
            }
        }
        // Obtain the public key certificate
        /*X509Certificate x509Cert = SDK.genCertificateByStr(valideData.get("signPubKeyCert")); if (x509Cert == null) { log.info("convert signPubKeyCert failed"); throw new RuntimeException(); } * /
        // 2. Verify the certificate chain and whether it expires
        /*if (! Sdk.verifycertificate (x509Cert, certDescriptor)) {log.info(" Failed to verify public key certificate, certificate info: [" + valideData.get("signPubKeyCert") + "]"); throw new RuntimeException(); } * /
        // Check the signature
        String sign256 = DigestUtils.sha256Hex(UnionSignUtil.createQueryString(valideData, UnionParamConsts.getDefaultIgnoreSignParams()));
        booleanvalidate = RSA2.verify(sign256, valideData.get(UnionParamConsts.PARAM_SIGNATURE),X509.getPublicKey(valideData.get(UnionParamConsts.PARAM_SIGN_PUB_KEY_CE RT)),"UTF-8");
        if(! validate) { log.info("Verifying signature result [failed].");
            return null;
        } else {
            log.info("Verify signature result [success].");
            // The foreground callback interface does not involve encapsulation of user-related information
            /*String customerInfo = valideData.get("customerInfo"); if (null ! = customerInfo) { Map< String, String> customerInfoMap = this.parseCustomerInfo(customerInfo, "UTF-8"); Page. Append ("customerInfo plaintext: "+ customerInfoMap); } String accNo = valideData.get("accNo"); // If the card number returned is ciphertext, then you can decrypt it with the following method: = accNo) { accNo = AcpService.decryptData(accNo, "UTF-8"); page.append("< br> "+ accNo); } * /
            // Determine respCode=00, A6, and initiate the query interface again for transactions involving funds. Update the database after confirming the success of the transaction.
            String respCode = valideData.get("respCode");
        }
        if (StringUtils.equals(valideData.get("respCode"), "00")) {
            // Decrypt the card number
            String accNo = UnionSecureUtil.decryptData(certDescriptor.getSignCertPrivateKey("000000"), valideData.get("accNo"), "UTF-8");
            respParam.put("AccNo proclaimed in writing",accNo);
            ModelAndView modelAndView = new ModelAndView(pageResult);
            modelAndView.addObject("result", respParam);
            return modelAndView;
        } else {
            // The TODO transaction code is not correct
            ModelAndView modelAndView = new ModelAndView(pageResult);
            modelAndView.addObject("result"."Transaction error, please contact administrator.");
            returnmodelAndView; }}/** * Parse the customerInfo field in the return message (background notification) : &lt; br&gt; * Unbase base64, decrypt encryptedInfo if it encrypts it with sensitive information and put the fields in encryptedInfo into customerInfoMap return &lt; br&gt; * *@paramcustomerInfo&lt; br&gt; *@paramencoding&lt; br&gt; *@return* /
    publicMap&lt; String, String&gt; parseCustomerInfo(String customerInfo, String encoding) { Map&lt; String, String&gt; customerInfoMap =null;
        try {
            byte[] b = Base64.decodeBase64(customerInfo.getBytes(encoding));
            String customerInfoNoBase64 = new String(b, encoding);
            log.info("Unbase64 === >" + customerInfoNoBase64);
            // remove before and after {}
            customerInfoNoBase64 = customerInfoNoBase64.substring(1, customerInfoNoBase64.length() - 1);
            customerInfoMap = UnionStrUtil.parseQString(customerInfoNoBase64);
            if (customerInfoMap.containsKey("encryptedInfo")) {
                String encInfoStr = customerInfoMap.get("encryptedInfo");
                customerInfoMap.remove("encryptedInfo");
                PrivateKey privateKey = certDescriptor.getSignCertPrivateKey("000000");
                String encryptedInfoStr = UnionSecureUtil.decryptData(privateKey, encInfoStr, encoding);
                Map&lt;String, String&gt; encryptedInfoMap = UnionStrUtil.parseQString(encryptedInfoStr);
                customerInfoMap.putAll(encryptedInfoMap);
            }
        } catch (UnsupportedEncodingException e) {
            log.info(e.getMessage(), e);
        } catch (IOException e) {
            log.info(e.getMessage(), e);
        }
        return customerInfoMap;
    }




    * When merchants send frontUrl or backUrl addresses with parameter information, * this method will read the parameters in the URL address into the map, which will lead to more information, resulting in verification failure. In this case, you can modify the filter parameters in the URL or use the getAllRequestParamStream method. * *@param request
     * @return* /
    public staticMap&lt; String, String&gt; getAllRequestParam(finalHttpServletRequest request) { Map&lt; String, String&gt; res =newHashMap&lt; String, String&gt; (a); Enumeration&lt; ? &gt; temp = request.getParameterNames();if (null! = temp) {while (temp.hasMoreElements()) {
                String en = (String) temp.nextElement();
                String value = request.getParameter(en);
                res.put(en, value);
                // If the field value is empty, the packet is not sent. > < span style = "color: RGB (0, 0, 0);
                if (res.get(en) == null || "".equals(res.get(en))) {
                    Println ("====== empty field name ===="+en); // system.out. println("====== empty field name ===="+en);res.remove(en); }}}return res;
    }


    /** * get all the information in the request parameters. * Non-Struts can use this method to filter out url parameters that cannot be filtered by the Request. getParameter method. * Struts may not be able to use this method because some Content-Types read parameters ahead of time and cannot read information from inputStream. The theory should be able to adjust the Struts configuration so that it doesn't matter, but do your own research. * Req.getParameter ("key") cannot be called before calling this method; Otherwise, the request will not get the input stream. * *@param request
     * @return* /
    public staticMap&lt; String, String&gt; getAllRequestParamStream(finalHttpServletRequest request) { Map&lt; String, String&gt; res =newHashMap&lt; String, String&gt; (a);try {
            String notifyStr = new String(IOUtils.toByteArray(request.getInputStream()), "UTF-8");
            log.info("Received notification message:" + notifyStr);
            String[] kvs = notifyStr.split("&");
            for (String kv : kvs) {
                String[] tmp = kv.split("=");
                if(tmp.length &gt; =2) {
                    String key = tmp[0];
                    String value = URLDecoder.decode(tmp[1]."UTF-8"); res.put(key, value); }}}catch (UnsupportedEncodingException e) {
            log.info("getAllRequestParamStream.UnsupportedEncodingException error: " + e.getClass() + ":" + e.getMessage());
        } catch (IOException e) {
            log.info("getAllRequestParamStream.IOException error: " + e.getClass() + ":" + e.getMessage());
        }
        return res;
    }




    public static String createAutoFormHtml(String reqUrl, Map< String, String> hiddens, String encoding) {
        StringBuffer sf = new StringBuffer();
        sf.append("< html> < head> < meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + encoding + "\"/> < /head> < body>");
        sf.append("< form id = \"pay_form\" action=\"" + reqUrl
                + "\" method=\"post\"&gt;");
        if (null! = hiddens &&0! = hiddens.size()) { Set&lt; Map.Entry&lt; String, String&gt; &gt; set = hiddens.entrySet(); Iterator&lt; Map.Entry&lt; String, String&gt; &gt; it = set.iterator();while(it.hasNext()) { Map.Entry&lt; String, String&gt; ey = it.next(); String key = ey.getKey(); String value = ey.getValue(); sf.append("< input type=\"hidden\" name=\"" + key + "\" id=\""
                        + key + "\" value=\"" + value + "\"/&gt;");
            }
        }
        sf.append("< /form>");
        sf.append("< /body>");
        sf.append("< script type=\"text/javascript\">");
        sf.append("document.all.pay_form.submit();");
        sf.append("< /script>");
        sf.append("< /html>");
        returnsf.toString(); }}Copy the code

conclusion

We use design mode SDK module for project encapsulation and business processing, mainly template design. I suggest that you have a good understanding of the template design pattern, really a variety of project framework source code can not have templates. Need project source please double click like message + mailbox, after all, collation is not easy. Later, I will arrange an open source SDK. The package of this is our architecture package, and I just embed the business function code. So some of these packages are just for our business, and we don’t consider them for open source. I’ll sort it out if you get a lot of attention. Main recently addicted to Netty, from entry to confusion (>^ω^<) meow

Wrote last

Welcome to follow my wechat public account [Village of apes] to talk about Java interview and my wechat for further communication and learning, wechat mobile search [codeyuanzhicunup] to add if there are related technical questions, welcome to leave a message to discuss, the public account is mainly used for technology sharing, Including often meet test analysis, as well as source code interpretation, micro service framework, technology hot spots.