|
@ -1332,45 +1332,6 @@ public class GuahaoService {
|
|
|
return immPostSecond("GetOrgImmuneList","计免预约-获取免疫接种机构列表",params);
|
|
|
}
|
|
|
|
|
|
public static byte[] encrypt(byte[] data, PublicKey publicKey) throws Exception{
|
|
|
Cipher cipher=Cipher.getInstance("RSA");//java默认"RSA"="RSA/ECB/PKCS1Padding"
|
|
|
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
|
|
|
|
|
int inputLen = data.length;
|
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
|
int offSet = 0;
|
|
|
byte[] cache;
|
|
|
int i = 0;
|
|
|
// 对数据分段加密
|
|
|
while (inputLen - offSet > 0) {
|
|
|
if (inputLen - offSet > MAX_ENCRYPT_BLOCK) {
|
|
|
cache = cipher.doFinal(data, offSet, MAX_ENCRYPT_BLOCK);
|
|
|
} else {
|
|
|
cache = cipher.doFinal(data, offSet, inputLen - offSet);
|
|
|
}
|
|
|
out.write(cache, 0, cache.length);
|
|
|
i++;
|
|
|
offSet = i * MAX_ENCRYPT_BLOCK;
|
|
|
}
|
|
|
byte[] encryptedData = out.toByteArray();
|
|
|
out.close();
|
|
|
return encryptedData;
|
|
|
}
|
|
|
|
|
|
public PublicKey immPublicKeyget(String filename) throws Exception {
|
|
|
File f = new File(filename);
|
|
|
FileInputStream fis = new FileInputStream(f);
|
|
|
DataInputStream dis = new DataInputStream(fis);
|
|
|
byte[] keyBytes = new byte[(int)f.length()];
|
|
|
dis.readFully(keyBytes);
|
|
|
dis.close();
|
|
|
X509EncodedKeySpec spec = new X509EncodedKeySpec(keyBytes);
|
|
|
KeyFactory kf = KeyFactory.getInstance("RSA");
|
|
|
return kf.generatePublic(spec);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取免疫接种号源
|
|
|
* @param orgId 机构编码
|
|
@ -1380,7 +1341,7 @@ public class GuahaoService {
|
|
|
public String GetOrgNumberList(String orgId, String scheduleId) throws Exception {
|
|
|
String result = "";
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
params.put("orgId", orgId);
|
|
|
params.put("OrgId", orgId);
|
|
|
params.put("ScheduleId", scheduleId);
|
|
|
return immPostSecond("GetOrgNumberList","计免预约-获取免疫接种号源",params);
|
|
|
}
|
|
@ -1397,8 +1358,8 @@ public class GuahaoService {
|
|
|
String result = "";
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
params.put("OrgCode", orgCode);
|
|
|
params.put("strStart", strStart);
|
|
|
params.put("strEnd", strEnd);
|
|
|
params.put("StartTime", strStart);
|
|
|
params.put("EndTime", strEnd);
|
|
|
return immPostSecond("GetOrgScheduleList","计免预约-获取免疫接种排班信息",params);
|
|
|
}
|
|
|
|