URLEncode进行url传递地址的加密与解密

URLEncode加密文件

{
    "agentUniqueParam":"8001",
    "city":"%E9%97%B5%E8%A1%8C%E5%8C%BA",
    "CallID":"",
    "businessId":"4af0acb0-49f7-11ed-bafd-b703d3a52f9f",
    "businessStep":"customerReturn",
    "signedCustomerName":"%E6%96%97%E7%BD%97%E5%A4%A7%E9%99%86",
    "followStage":"%E6%8B%9B%E5%95%86%E8%B7%9F%E8%BF%9B",
    "customerStatus":"%E5%B7%B2%E7%AD%BE%E7%BA%A6",
    "returnVisitContent":"%E5%BE%85%E5%8F%91%E8%B4%A7%E7%9A%84%E8%AF%B4%E5%BE%97%E5%AE%B9%E6%98%93%E5%92%8C%E4%BA%BA%E5%B7%A5%E5%92%8C%E4%BA%BA",
    "businessExecutionTime":"2022-10-12+14%3A29%3A58",
    "isEffectiveCustomer":"%E6%98%AF",
    "customerId":"2c582f80-49f7-11ed-bafd-b703d3a52f9f",
    "otherNoCooperation":"%E8%83%9C%E5%A4%9A%E8%B4%9F%E5%B0%91%E7%9A%84",
    "noCooperation":"%E6%88%BF%E5%B1%8B%E8%AF%81%E7%85%A7%E9%97%AE%E9%A2%98%E5%B7%B2%E6%94%BE%E5%BC%83",
    "returnWay":"%E7%94%B5%E8%AF%9D",
    "callAnsweringStatus":"%E5%B7%B2%E6%8E%A5%E9%80%9A",
    "provinces":"%E4%B8%8A%E6%B5%B7%E5%B8%82",
    "noSolve":"%E7%99%BB%E9%9D%A9%E7%83%AD",
    "firstCustomerType":"A%2B",
    "agentName":"8001",
    "returnCustomerType":"A",
    "businessNumber":"2022101200269",
    "timestampKey":"1665556198135",
    "encryptionToken":"f113b8afed9410436686714c47f4033e",
    "nextStepName":"workComplete",
    "CallSheetID":"",
    "nextVisitDate":"2022-10-18",
    "businessType":"%E5%AE%A2%E6%88%B7%E5%9B%9E%E8%AE%BF",
    "account":"N000000035385"
}

URLEncode解密文件

{
    "agentUniqueParam":"8001",
    "city":"闵行区",
    "CallID":"",
    "businessId":"4af0acb0-49f7-11ed-bafd-b703d3a52f9f",
    "businessStep":"customerReturn",
    "signedCustomerName":"斗罗大陆",
    "followStage":"招商跟进",
    "customerStatus":"已签约",
    "returnVisitContent":"待发货的说得容易和人工和人",
    "businessExecutionTime":"2022-10-12+14:29:58",
    "isEffectiveCustomer":"是",
    "customerId":"2c582f80-49f7-11ed-bafd-b703d3a52f9f",
    "otherNoCooperation":"胜多负少的",
    "noCooperation":"房屋证照问题已放弃",
    "returnWay":"电话",
    "callAnsweringStatus":"已接通",
    "provinces":"上海市",
    "noSolve":"登革热",
    "firstCustomerType":"A+",
    "agentName":"8001",
    "returnCustomerType":"A",
    "businessNumber":"2022101200269",
    "timestampKey":"1665556198135",
    "encryptionToken":"f113b8afed9410436686714c47f4033e",
    "nextStepName":"workComplete",
    "CallSheetID":"",
    "nextVisitDate":"2022-10-18",
    "businessType":"客户回访",
    "account":"N000000035385"
}

代码实现

public static void main(String[] args) throws UnsupportedEncodingException {
   String encodeStr = URLEncoder.encode("中国", "utf-8");
   System.out.println("处理后:" + encodeStr);
   String decodeStr = URLDecoder.decode(encodeStr, "utf-8");
   System.out.println("解码:" + decodeStr);

   String str = "{\n" +
           "    \"agentUniqueParam\":\"8001\",\n" +
           "    \"city\":\"%E9%97%B5%E8%A1%8C%E5%8C%BA\",\n" +
           "    \"CallID\":\"\",\n" +
           "    \"businessId\":\"4af0acb0-49f7-11ed-bafd-b703d3a52f9f\",\n" +
           "    \"businessStep\":\"customerReturn\",\n" +
           "    \"signedCustomerName\":\"%E6%96%97%E7%BD%97%E5%A4%A7%E9%99%86\",\n" +
           "    \"followStage\":\"%E6%8B%9B%E5%95%86%E8%B7%9F%E8%BF%9B\",\n" +
           "    \"customerStatus\":\"%E5%B7%B2%E7%AD%BE%E7%BA%A6\",\n" +
           "    \"returnVisitContent\":\"%E5%BE%85%E5%8F%91%E8%B4%A7%E7%9A%84%E8%AF%B4%E5%BE%97%E5%AE%B9%E6%98%93%E5%92%8C%E4%BA%BA%E5%B7%A5%E5%92%8C%E4%BA%BA\",\n" +
           "    \"businessExecutionTime\":\"2022-10-12+14%3A29%3A58\",\n" +
           "    \"isEffectiveCustomer\":\"%E6%98%AF\",\n" +
           "    \"customerId\":\"2c582f80-49f7-11ed-bafd-b703d3a52f9f\",\n" +
           "    \"otherNoCooperation\":\"%E8%83%9C%E5%A4%9A%E8%B4%9F%E5%B0%91%E7%9A%84\",\n" +
           "    \"noCooperation\":\"%E6%88%BF%E5%B1%8B%E8%AF%81%E7%85%A7%E9%97%AE%E9%A2%98%E5%B7%B2%E6%94%BE%E5%BC%83\",\n" +
           "    \"returnWay\":\"%E7%94%B5%E8%AF%9D\",\n" +
           "    \"callAnsweringStatus\":\"%E5%B7%B2%E6%8E%A5%E9%80%9A\",\n" +
           "    \"provinces\":\"%E4%B8%8A%E6%B5%B7%E5%B8%82\",\n" +
           "    \"noSolve\":\"%E7%99%BB%E9%9D%A9%E7%83%AD\",\n" +
           "    \"firstCustomerType\":\"A%2B\",\n" +
           "    \"agentName\":\"8001\",\n" +
           "    \"returnCustomerType\":\"A\",\n" +
           "    \"businessNumber\":\"2022101200269\",\n" +
           "    \"timestampKey\":\"1665556198135\",\n" +
           "    \"encryptionToken\":\"f113b8afed9410436686714c47f4033e\",\n" +
           "    \"nextStepName\":\"workComplete\",\n" +
           "    \"CallSheetID\":\"\",\n" +
           "    \"nextVisitDate\":\"2022-10-18\",\n" +
           "    \"businessType\":\"%E5%AE%A2%E6%88%B7%E5%9B%9E%E8%AE%BF\",\n" +
           "    \"account\":\"N000000035385\"\n" +
           "}";

   String json = URLDecoder.decode(str, "utf-8");
   System.out.println("解码:" + json);
}

控制台输出

处理后:%E4%B8%AD%E5%9B%BD
解码:中国
解码:{
    "agentUniqueParam":"8001",
    "city":"闵行区",
    "CallID":"",
    "businessId":"4af0acb0-49f7-11ed-bafd-b703d3a52f9f",
    "businessStep":"customerReturn",
    "signedCustomerName":"斗罗大陆",
    "followStage":"招商跟进",
    "customerStatus":"已签约",
    "returnVisitContent":"待发货的说得容易和人工和人",
    "businessExecutionTime":"2022-10-12 14:29:58",
    "isEffectiveCustomer":"是",
    "customerId":"2c582f80-49f7-11ed-bafd-b703d3a52f9f",
    "otherNoCooperation":"胜多负少的",
    "noCooperation":"房屋证照问题已放弃",
    "returnWay":"电话",
    "callAnsweringStatus":"已接通",
    "provinces":"上海市",
    "noSolve":"登革热",
    "firstCustomerType":"A+",
    "agentName":"8001",
    "returnCustomerType":"A",
    "businessNumber":"2022101200269",
    "timestampKey":"1665556198135",
    "encryptionToken":"f113b8afed9410436686714c47f4033e",
    "nextStepName":"workComplete",
    "CallSheetID":"",
    "nextVisitDate":"2022-10-18",
    "businessType":"客户回访",
    "account":"N000000035385"
}
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

智汇探长

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值