Pārlūkot izejas kodu

结算中心-业务接口加密调整

ZhangWenQiang 5 gadi atpakaļ
vecāks
revīzija
519d796b08

+ 4 - 1
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgcompany/service/impl/HlgCompanyServiceImpl.java

@@ -13,6 +13,7 @@ import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.StringUtils;
 import org.jeecg.common.util.YouBianCodeUtil;
+import org.jeecg.common.utils.CryptTool;
 import org.jeecg.common.utils.HttpsContants;
 import org.jeecg.common.utils.OauthApi;
 import org.jeecg.common.utils.OauthTokenUtils;
@@ -122,7 +123,9 @@ public class HlgCompanyServiceImpl extends ServiceImpl<HlgCompanyMapper, HlgComp
         parameters.put("countryCode", hlgCompany.getCountryCode());
         parameters.put("provinceCityCountry", hlgCompany.getProvinceCityCountry());
         log.info("param============{}", JSONObject.toJSONString(parameters));
-        JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, JSONObject.toJSONString(parameters), accessToken);
+        //数据加密
+        String biz_content = CryptTool.encode(JSONObject.toJSONString(parameters));
+        JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, biz_content, accessToken);
         log.info("企业-新增===={}", jsonObject);
         if (jsonObject != null) {
             if (jsonObject.getBoolean("success")) {

+ 10 - 7
happy-boot-module-settlement/src/main/java/org/jeecg/common/utils/CryptTool.java

@@ -20,15 +20,18 @@ public class CryptTool {
      *
      * @param biz_content
      * @return
-     * @throws UnsupportedEncodingException
      */
-    public static String encode(String biz_content) throws UnsupportedEncodingException {
+    public static String encode(String biz_content) {
         //将JSON串进行URLEncoder 编码,编码格式都是 UTF-8
-        biz_content = URLEncoder.encode(biz_content, "UTF-8");
-        log.info("urlencode加密=====", biz_content);
-        //base64加密
-        biz_content = encryptBASE64(biz_content.getBytes());
-        log.info("base64加密=====", biz_content);
+        try {
+            biz_content = URLEncoder.encode(biz_content, "UTF-8");
+            log.info("urlencode加密=====", biz_content);
+            //base64加密
+            biz_content = encryptBASE64(biz_content.getBytes());
+            log.info("base64加密=====", biz_content);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
         return biz_content;
     }