Files
obsidian_note/各种项目/数字乡村/荣昌小院/问专家-获取提交次数以及办结率.md

98 lines
3.1 KiB
Markdown
Raw Permalink Normal View History

2025-12-04 09:12:56 +08:00
- #### 问专家-获取指定用户在一个时间范围内的所有提交问题的次数与办结率
- ###### 请求地址https://api.12316cq.com/api/askExpert/getTotalAsCompletionRate POST
- ###### 请求格式为了便于兼容原系统接口的加密规则所有接口均使用POST请求请求头为application/x-www-form-urlencoded推荐 或 content-type=multipart/form-data
- ###### 接口参数:
- ```
请求参数:
phones用户手机号多个以逗号隔开
startTime开始时间
endTime结束时间
注意:以下参数参照以前的加密逻辑
appcodeh5
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);
}
}
```