DownloadContractRest.java 1.25 KB
package com.thinkgem.jeesite.modules.eci.method;

import com.thinkgem.jeesite.modules.eci.dao.ElecLicenseInfoDao;
import com.thinkgem.jeesite.modules.eci.entity.ElecLicenseInfo;
import com.thinkgem.jeesite.modules.eci.utils.EciHttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 合同下载
 */
@Component
public class DownloadContractRest {

    // private static final String DOCUMENT_DOWNLOAD = "/document/download";

    @Autowired
    ElecLicenseInfoDao licenseInfoDao;

    /**
     * 下载合同方法
     * @return
     */
    public void accessDownload() {

        List<ElecLicenseInfo> waitForDownloads = licenseInfoDao.getWaitForDownload();

        for (ElecLicenseInfo waitForDownload : waitForDownloads) {
            String bizId = waitForDownload.getBizId();
            String documentId = waitForDownload.getDocumentId();
            // String url = Global.ECI_HOST + DOCUMENT_DOWNLOAD + "?documentId=" + documentId;

            String ofdPath = EciHttpUtil.download(documentId);
            if (ofdPath != null) {
                //入库ofd文件地址
                licenseInfoDao.updateOfdWjdz(bizId, ofdPath);
            }
        }

    }
}