Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

LAPTOP-KB9HII50\70708 3 years ago
parent
commit
a207369cd7

+ 13 - 8
business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java

@ -3,6 +3,7 @@ package com.yihu.jw.healthCare.service;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.healthCare.utils.AES;
import com.yihu.jw.healthCare.utils.MD5;
import com.yihu.jw.healthCare.utils.MD5;
import com.yihu.jw.healthCare.utils.SafeUtil;
import com.yihu.jw.healthCare.utils.SafeUtil;
import com.yihu.jw.healthCare.utils.StringUtils;
import com.yihu.jw.healthCare.utils.StringUtils;
@ -83,9 +84,12 @@ public class HealthCareService {
        object.put("access_token",accessToken);
        object.put("access_token",accessToken);
        object.put("funid",funid);
        object.put("funid",funid);
        String encrypt_data = SafeUtil.encrypt(data,ylzConfigEncryptKey);
        String encrypt_data = SafeUtil.encrypt(data,ylzConfigEncryptKey);
        object.put("encrypt_data",encrypt_data);
        object.put("data",data);
        object.put("data",data);
        String response = httpClientUtil.postBody(ylzConfigUrl,object);
        String signResult = SafeUtil.sign(object.toJSONString(),ylzConfigSignKey);
        String obj = SafeUtil.encrypt(signResult,ylzConfigEncryptKey);
        JSONObject jsonObject = JSONObject.parseObject(obj);
        logger.info("请求前funid=="+funid+"data="+data);
        String response = httpClientUtil.postBody(ylzConfigUrl,jsonObject);
        return response;
        return response;
    }
    }
@ -100,12 +104,12 @@ public class HealthCareService {
        JSONObject object = new JSONObject();
        JSONObject object = new JSONObject();
        object.put("sign_type","md5");
        object.put("sign_type","md5");
        object.put("appid",ylzConfigAppid);
        object.put("appid",ylzConfigAppid);
        String stringSignTemp ="appid="+ylzConfigAppid+"&appsecret="+ylzConfigAppSecret+"&data="+data+"&funid="+funid+"&sign_type=md5&key="+ylzConfigSignKey;
        String sign = MD5.md5(stringSignTemp).toUpperCase();
        object.put("sign",sign);
       /* String stringSignTemp ="appid="+ylzConfigAppid+"&appsecret="+ylzConfigAppSecret+"&data="+data+"&funid="+funid+"&sign_type=md5&key="+ylzConfigSignKey;
        String sign = MD5.md5(stringSignTemp).toUpperCase();*/
        object.put("data",data);
        object.put("data",data);
        object.put("funid",funid);
        object.put("funid",funid);
        String obj = SafeUtil.encrypt(object.toJSONString(),ylzConfigEncryptKey);
        String signResult = SafeUtil.sign(object.toJSONString(),ylzConfigSignKey);
        String obj = SafeUtil.encrypt(signResult,ylzConfigEncryptKey);
        JSONObject jsonObject = JSONObject.parseObject(obj);
        JSONObject jsonObject = JSONObject.parseObject(obj);
        logger.info("请求前funid=="+funid+"data="+data);
        logger.info("请求前funid=="+funid+"data="+data);
        String response = httpClientUtil.postBody(ylzConfigUrl,jsonObject);
        String response = httpClientUtil.postBody(ylzConfigUrl,jsonObject);
@ -113,9 +117,10 @@ public class HealthCareService {
        if (response!=null&&response!=""){
        if (response!=null&&response!=""){
            JSONObject result = JSONObject.parseObject(response);
            JSONObject result = JSONObject.parseObject(response);
            if (result.getString("flag").equalsIgnoreCase("1")){
            if (result.getString("flag").equalsIgnoreCase("1")){
                String dataResult = result.getString("data");
                String dataResult = result.getString("encrypt_data");
                if (dataResult!=null&&dataResult!=""){
                if (dataResult!=null&&dataResult!=""){
                    JSONObject dataObject = JSONObject.parseObject(dataResult);
                    String decryptResult = AES.aesDecrypt(dataResult,ylzConfigEncryptKey);
                    JSONObject dataObject = JSONObject.parseObject(decryptResult);
                    token = dataObject.getString("access_token");
                    token = dataObject.getString("access_token");
                }
                }
            }
            }

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/healthCare/utils/SafeUtil.java

@ -17,7 +17,7 @@ public class SafeUtil {
    public static void main(String[] args) throws Exception {
    public static void main(String[] args) throws Exception {
        //String reqStr = "{\"funid\":\"N09.00.00.01\",\"data\":{\"idNo\":\"350823199201173123\",\"first\":\"022\",\"keyword1\":\"5\",\"keyword2\":\"通过审核\",\"keyword3\":\"20200706155415\"},\"access_token\":\"4f886faf22775ccc9c8add16268ca9cd\",\"sign_type\":\"MD5\",\"encrypt_type\":\"AES\"}";
        //String reqStr = "{\"funid\":\"N09.00.00.01\",\"data\":{\"idNo\":\"350823199201173123\",\"first\":\"022\",\"keyword1\":\"5\",\"keyword2\":\"通过审核\",\"keyword3\":\"20200706155415\"},\"access_token\":\"4f886faf22775ccc9c8add16268ca9cd\",\"sign_type\":\"MD5\",\"encrypt_type\":\"AES\"}";
        //solution(reqStr,"signBefore");
        //solution(reqStr,"signBefore");
        System.out.println(AES.aesDecrypt("omqzWGEfb+g9SFTqGrs+2mdmWuFuFN2kjCdSOWPfChotHQmXY2NMZodw2x5fFPegFcqJm2LWSc5xTCrXE0YSa9pvj5JxI7dfvKM9K/kogs0LPvppRLTyxAZmA7A0IrDKtylHGHa95qQ3WGWPWGTW705YDRtzhuX5AQamnOKuR1lNkAr9XNuZJVsvEJJ1uM0SojN7FpU48u0Jp5K2TTptj5H8WUDDllqX7H/vVX+4Ju/nhpa72ASS6j5dzqPS85Aj", "a4f66019e3af4c4b"));
        System.out.println(AES.aesDecrypt("BUOL01yRhFPlT2J+6wTYzNc9Hv3aAwwjOGdqoU6NIe2wvR9MMg6p0Jv4h012uwDKrBv3HGIXu1t7xVStC/nX4QKmYDelbd+hUFl5QZQ6FX1f0LPXNki99HKcSV00aB+DDb9j9ocfr/z3G091yNHAo+VD/FxFo60agRdcv1vl7Hg=", "4bfb6947baf9df93"));
    }
    }