- #### 问专家-获取指定用户在一个时间范围内的所有提交问题的次数与办结率 - ###### 请求地址:https://api.12316cq.com/api/askExpert/getTotalAsCompletionRate POST - ###### 请求格式:为了便于兼容原系统接口的加密规则,所有接口均使用POST请求,请求头为:application/x-www-form-urlencoded(推荐) 或 content-type=multipart/form-data - ###### 接口参数: - ``` 请求参数: phones:用户手机号(多个以逗号隔开) startTime:开始时间 endTime:结束时间 注意:以下参数参照以前的加密逻辑 appcode:h5 ts: rnd: sig: 返回参数: { "code": "0", "message": "成功", "data": { “sumSubmitCount”:"60",// 用户累计提交问题次数 "completionRate": "50" // 办结率 } } ``` - ###### 需要对手机号进行加密处理,下面是加密工具类 - ###### 加密工具类: ``` public class AESUtil { private static byte[] encrypt(byte[] text, byte[] key) throws Exception { SecretKeySpec aesKey = new SecretKeySpec(key, "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, aesKey); return cipher.doFinal(text); } /** * @desc 加密 * @param text 明文 * @param key 密钥 */ public static String encodeAES(String text, String key) throws Exception { byte[] keybBytes = DigestUtils.md5(key); byte[] passwdBytes = text.getBytes(); byte[] aesBytyes = encrypt(passwdBytes, keybBytes); return new String(Base64.encodeBase64(aesBytyes)); } /** * @desc 解密 * @param password 密文 * @param key 密钥 */ public static String deCodeAES(String password, String key) throws Exception { byte[] keybBytes = DigestUtils.md5(key); byte[] debase64Bytes = Base64.decodeBase64(password.getBytes()); return new String(decrypt(debase64Bytes, keybBytes)); } private static byte[] decrypt(byte[] text, byte[] key) throws Exception { SecretKeySpec aesKey = new SecretKeySpec(key, "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, aesKey); return cipher.doFinal(text); } public static void main(String[] args) throws Exception { String text = "15320345049"; String code = AESUtil.encodeAES(text, "密钥"); String t = AESUtil.deCodeAES(code, "密钥"); System.out.println("加密后 = " + text); System.out.println("解密后 = " + t); String tm = DesensitizationUtils.custNoDesensitization(phone); System.out.println("tm = " + tm); } } ``` ​