首先要知道对应的服务号,公钥,私钥。下载地址 https://openapi.alipay.com/gateway.do
public final static String APPID = "";// 服务号的应用号
public final static String Private_key = ;// 私钥
public final static String Public_key = "";// 公钥
public final static String LocalFile="" ;//放置服务器地址
public static void main(String[] args) throws Exception {
//1.请求对账单下载接口
AlipayDataDataserviceBillDownloadurlQueryResponse response= AliPayRequest.clliet( format.format(dateFrom),APPID,Private_key,Public_key);
if (response.isSuccess()) {
//文件夹没有重新生成
File file = new File(LocalFile);
if (!file.exists()) {
file.mkdirs();
}
//下载 地址需要修改
String loadfile=LocalFile + str.format(dateFrom) + ".zip";
//2. 根据返回路径下载文件
downloadNet(response.getBillDownloadUrl(), loadfile);
//解压
File fil=new File(loadfile );
String afterpath =LocalFile + format.format(dateFrom) + "/";
//3.解压出来
zipDecompressing(fil, afterpath);
// 4. 遍历文件 找出明细表
List<String> regs = readfile2(afterpath,str.format(dateFrom) );
List<AccountStatementModel> accountStatementModelAlipayList=new ArrayList<